Token Transfer Between Users 3 | XRPL Development in JavaScript Level 1
Finally, let’s try sending DOJ
tokens from Alice to Bob once again.
Prerequisites
This guide proceeds with the following characters:
- Charlie (Token Issuer)
- Alice (Token Recipient 1) ※Currently holds 1000 DOJ
- Bob (Token Recipient 2)
Create the Script
The following is a script to send tokens from Alice to Bob.
-
Reuse the previously created payment_token_ab.js file in your project directory.
-
Ensure the code is as follows.
- Enter Alice’s testnet secret key in
alice_wallet_secret_here
. - Enter Bob’s testnet address in
bob_wallet_address_here
. - Enter Charlie’s testnet address in
charlie_wallet_address_here
.
- Enter Alice’s testnet secret key in
Run the Script
-
Run the following command in the command line to execute the script.
-
Check result in the console .
Finally, the DOJ token transfer from Alice to Bob was successful.
Use the hash value and Alice’s address displayed in the actual console to check the testnet version of the Explorer.
Conclusion
In the “Level 1” curriculum, we introduced scripts, concepts, and specifications related to the trust line functionality.
You may now understand what we meant by “understanding the Ripple protocol” as stated at the beginning of this guide.
For actual development, you need to understand fields and flags displayed in the console to some extent, so we deliberately introduced them in a complex manner for your future learning.
One of the major benefits of XRPL and the reason why it is attractive is that it provides a protocol feature based on trust for handling tokens, in addition to exchanging the native token XRP
.
Details about IOUs and Rippling are only covered briefly in this guide. For more information, please refer to the official documentation or articles by experts.