XRP

XRP

XRP is the native asset on the XRP Ledger blockchain. XRP can be accessed with the following coin types:

EnvironmentCoin TypeFaucet
XRP Productionxrp
XRP Altnettxrp
XRP Testnettxrphttps://xrpl.org/resources/dev-tools/xrp-faucets/

Explorer

https://livenet.xrpl.org/

Generating wallets

1 2 3 4 5 6 7 8 9 10 11 bitgo .coin('txrp') .wallets() .generateWallet({ label: 'My Test Wallet', passphrase: 'secretpassphrase1a5df8380e0e30', }) .then(function (wallet) { // print the new wallet console.dir(wallet); });
1 2 3 4 5 6 7 8 LABEL="My Test Wallet" PASSPHRASE="secretpassphrase1a5df8380e0e30" curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\" }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/txrp/wallet/generate

Before you can use an XRP wallet, it must be initialized on the XRP blockchain (or XRP Ledger). When you create an XRP wallet, BitGo sends 4 initialization transactions on the XRP network to generate the wallet.

Until the initialization transaction is confirmed, the wallet is not ready for use, and the receive address is not exposed in the API. This is to protect users from losing assets by sending to a wallet that does not exist on the network.

Warning: Do not use an XRP wallet while it is being initialized or you may lose assets.

The fee for creating an XRP wallet is currently 12 XRP. In production, there is limit of 5 wallets total per enterprise plus a mandatory payment agreement. In testnet, there is no limit.

Note: To inquire about increasing your limit, contact BitGo at support@bitgo.com.

Creating addresses

1 2 3 4 5 6 7 8 9 10 11 bitgo .coin('txrp') .wallets() .getWallet({ id: '585c51a5df8380e0e3082e46' }) .then(function (wallet) { return wallet.createAddress(); }) .then(function (newAddress) { // print new address details console.dir(newAddress); });
1 2 3 4 5 WALLET=585c51a5df8380e0e3082e46 curl -X POST \ -H "Authorization: Bearer $ACCESS_TOKEN" \ https://app.bitgo-test.com/api/v2/txrp/wallet/$WALLET/address

A key difference between XRP and Bitcoin is that XRP has no concept of UTXOs, and operates on an account-based model instead. Additionally, XRP transactions only support one input and one output. That means that the sendMany call is not supported.

The BIP-32 standard therefore cannot be taken advantage of, and hence generated XRP addresses differ only in their sequentially incrementing destination tag components.

Destination tags indicate beneficiaries or destinations for payments. You can make transactions without a destination tag. However, a destination tag is required when sending to a BitGo wallet.

Balances

XRP (XRP) is the native asset of the XRP ledger. The base unit of XRP is drop:

  • 1 drop is (10-6) or 0.000001 XRP.
  • 1 XRP is (106) or 1000000 drops (1 million).

Balances are supported in string format: balanceString, confirmedBalanceString, and spendableBalanceString.

Tokens

XRP supports tokens transactions. This means you can now make transactions with other tokens apart from native XRP coin.

Enable token

In order to make token transactions you first need to enable the token in your wallet address(es). Once enabled, you will be able to receive and send that respective token. This process will take some fees from your account (0.000045 xrp is the minimum and most common fee for enabling tokens).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 bitgo .coin('txrp') .wallets() .get({ id: walletId }) .then(function (wallet) { return wallet.sendMany({ type: 'enabletoken', recipients: [ { amount: '0', address: yourWalletAddress, tokenName: 'txrp:tokenID', }, ], walletPassphrase: yourWalletPassphrase, }) });

Note: closeRemainderTo is the address you want to send all remaining token balance when disable it.

XRPL Authorized Trustlines

A user can hold an XRPL token on an XRP address only if a trustline is initiated with the issuer of that token. This is achieved by enabling the token.

Trustlines: Trustlines on the XRP Ledger (XRPL) are bilateral ledger entries that enable the holding and transfer of issued assets (IOUs) between accounts. Unlike XRP, which can be freely held without any restrictions, these trustlines define a credit relationship where each party sets a limit to how much of a particular asset they are willing to hold.

There are two types of trustlines that can allow user to hold a xrpl token.

  1. Regular Trustlines: A regular trustline allows a user to hold a token issued by an issuer. For example, if User A wants to hold Token X issued by Issuer I, User A must initiate a trustline transaction to establish the connection.

  2. Authorized Trustlines: Authorized trustlines can be established in two ways, but the order of operations does not impact the outcome. The trustline will only become active once both the user and issuer complete their respective transactions.

🔹 User-Initiated Authorization: The user first initiates a trustline transaction (similar to a regular trustline). The issuer then sends an authorization transaction to complete the trustline.

🔹 Issuer-Initiated Authorization: The issuer first sends an authorization trustline transaction to the user. The user then completes the trustline by sending their own trustline transaction.

Requirement for Authorized Trustlines: The requirement for trustline authorization is determined by the issuer. If the issuer account has the asfRequireAuth flag enabled, any trustline to that issuer must be explicitly authorized by the issuer.

Send tokens

Just as for your native token you would be able to send tokens (from token enabled addresses) to other wallets. Here is an example of it:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 bitgo .coin('txrp:tokenID') .wallets() .get({ id: walletId }) .then(function (wallet) { return wallet.sendMany({ type: 'payment', recipients: [ { amount, address: receiverAddress, }, ], walletPassphrase: yourWalletPassphrase, }); });

Note: While the XRP token standard supports up to 81 decimal places on-chain, BitGo currently supports a maximum of 15 decimal places.

Transactions

BitGo's XRP multisig contract currently only supports one sender and one recipient so the sendMany is not supported.