arrow-left Course Hub
Lesson 2: Send XRP with a new account using React.js
Estimated reading time:

25 minutes

Difficulty:

Intermediate

Concepts covered:
  • Blockchain
  • React.js
  • Send Currency

Key takeaway:

Learn how to create accounts and send XRP on the XRP Ledger. Use the code sandboxes in the lesson to begin coding with React.js.

Lesson 2

Send XRP with a new account using React.js

Make a test account and send your first payment transaction.

To send XRP, we first need to make an account

Accounts on the XRPL are created when you send XRP to them. For our test purposes, we’ll be creating accounts on Testnet instead of Mainnet. The two networks follow the same rules, but on Testnet you can receive free XRP from a “faucet.” If you’re ever writing code that sends transactions, you’ll want to debug it using Testnet first.

Accounts (sometimes referred to as “wallets”) have a couple pieces:

  1. A private seed – You will use this to sign transactions verifying that you are the account owner when submitting transactions. It starts with “s” and looks something like this: “sEdTzP1z11WKUy3WndyUBFg1jPFtfjL”.
  2. A public address – This is basically the name of your account. It starts with “r” and looks something like this “rskh3X7QtFhLVr1oFwqR19AcCP7oRnmpFi”.

To create an account behind the scenes a couple of things happen.

  1. First, we generate a random seed privately so no one can impersonate us.
  2. We then use that to derive the unique address that corresponding to that seed.
  3. Then we ask someone to send us some XRP to create our account on the ledger.

On the Testnet, instead of funding our account via an exchange or a friend with an existing account, we can send a request to the faucet to get free XRP for testing purposes using the `Client.fundWallet` function in xrpl.js.

Seeing this in action

  1. Open the sandbox below, which will let you play with creating accounts and sending payments:
  2. In the sandbox, click Create source wallet.
  3. Then click Create destination wallet.
  4. Copy the address of the destination wallet and paste it into the second field of the source wallet.
    – This is how you specify who you are paying. In this case, we are paying a random wallet, but normally you would need to learn the address of your recipient’s account from them to send them XRP.
  5. Send an amount of XRP that is less than your current balance.

 

END OF LESSON

Now that you've learned a bit about sending XRP with React on the XRP Ledger, test your knowledge with a quiz.