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:
- 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”.
- 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.
- First, we generate a random seed privately so no one can impersonate us.
- We then use that to derive the unique address that corresponding to that seed.
- 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
- Open the sandbox below, which will let you play with creating accounts and sending payments:
- In the sandbox, click Create source wallet.
- Then click Create destination wallet.
- 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.
- Send an amount of XRP that is less than your current balance.