A decentralized command-line application that monitors a user's account on the Polkadot relay chain for the system.remarkWithEvent extrinsic. When a remark addressed to the specified account is detected, the application plays the iconic "You've Got Mail!" sound byte.
- Monitors the Westend Test Network for
system.remarkWithEventextrinsics. - Uses a light client powered by
smoldotfor efficient synchronization. - Detects remarks addressed to a specific account and plays a sound notification.
- Displays the sender's account and the hash of the remark.
Before starting, ensure the following tools and dependencies are installed:
npm(or an alternative package manager)nodegit- Polkadot.js Browser Extension (wallet)
Additionally, you will need an account with Westend tokens. Refer to the following resources for assistance:
-
Clone the repository:
git clone https://github.com/CrackTheCode016/polkadot-api-example-cli --branch empty-cli cd polkadot-api-example-cli -
Install dependencies:
npm install
-
Start the application and specify the account to monitor:
npm start -- --account <account-address>
Example:
npm start -- --account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
-
The application will display the following output and start monitoring the specified account:
__ __ _ _____ __ __ _ _ __ __ _ _ \ \ / /__| |__|___ / | \/ | __ _(_) | \ \ / /_ _| |_ ___| |__ ___ _ __ \ \ /\ / / _ \ '_ \ |_ \ | |\/| |/ _` | | | \ \ /\ / / _` | __/ __| '_ \ / _ \ '__| \ V V / __/ |_) |__) | | | | | (_| | | | \ V V / (_| | || (__| | | | __/ | \_/\_/ \___|_.__/____/ |_| |_|\__,_|_|_| \_/\_/ \__,_|\__\___|_| |_|\___|_| Watching account: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY -
When a remark is detected, the application will play the "You've Got Mail!" sound and display the following:
You've got mail! From: 5Cm8yiG45rqrpyV2zPLrbtr8efksrRuCXcqcB4xj8AejfcTB Hash: 0xb6999c9082f5b1dede08b387404c9eb4eb2deee4781415dfa7edf08b87472050
-
Navigate to the PAPI Dev Console > Extrinsics.
-
Select the
Systempallet and theremark_with_eventcall. -
Input a remark in the format
address+email. For example, if monitoring5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY, input:5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY+email -
Submit the extrinsic and sign it using the Polkadot.js browser wallet. The application will detect the remark and display the output.
This application can be extended in various ways, such as:
- Implementing a chatroom using remarks.
- Leveraging rollups on Polkadot to enhance functionality.
This project is licensed under the MIT License.