This repository contains scripts in both JavaScript and Python to interact with the XRP Ledger (XRPL). These scripts allow testing functionalities such as wallet generation, trustline approval, transactions, and Automated Market Maker (AMM) operations.
The XRP Ledger operates on three distinct network environments, each serving different purposes in the development and deployment lifecycle.
Devnet functions as a sandbox environment where new amendments and features are tested in their pre-release state, allowing developers to experiment with upcoming functionality before it reaches production.
Mainnet (livenet) is the live production network where real XRP transactions occur and hold actual monetary value.
Testnet serves as a replica of Mainnet, mirroring its current state and configuration - when an amendment is activated on Mainnet, it is subsequently enabled on Testnet to maintain consistency between the two environments.
This tiered approach ensures thorough testing and validation of new features while providing developers with appropriate environments for different stages of application development.
The scripts are divided into two main folders:
js/β Contains JavaScript scripts for XRPL interactions.python/β Contains Python scripts for XRPL interactions.
generate.jsβ Generates a new XRPL wallet (address & seed) πgenerate_and_trustline.jsβ Generates a wallet and establishes a trustline π€trustline.jsβ Creates a trustline for the RLUSD token πxrp_transaction.jsβ Handles XRP transactions πΈrlusd_transaction.jsβ Manages RLUSD token transactions π°amm_create_RLUSD_XRP.jsβ Creates an AMM pool for RLUSD/XRP pair π¦amm_deposit_RLUSD_XRP.jsβ Deposits assets into an existing AMM pool π₯escrow.jsβ Create a condition and time based escrow π.mpt.jsβ Issue and interact with MPTs.
generate.pyβ Generates a new XRPL wallet (address & seed) πgenerate_and_trustline.pyβ Generates a wallet and establishes a trustline π€trustline.pyβ Creates a trustline for the RLUSD token πxrp_transaction.pyβ Handles XRP transactions πΈrlusd_transaction.pyβ Manages RLUSD token transactions π°amm_create_RLUSD_XRP.pyβ Creates an AMM pool for RLUSD/XRP pair π¦amm_deposit_RLUSD_XRP.pyβ Deposits assets into an existing AMM pool π₯escrow.pyβ Create a condition and time based escrow π
Within this folder you will find scripts to interact with new amendments that are only live on DevNet and not on Testnet/Mainnet. You can find the list of amendments currently live on DevNet here: https://devnet.xrpl.org/amendments.
Important note: An amendment may be live on DevNet but not yet supported by one of the XRPL libraries (Python/JS). Please check the library documentation or release notes for compatibility before using these scripts.
batch.jsβ Test the new batch transaction amendmenttokenEscrow.jsβ Use MPT with Escrow instead of XRPcredential.js-> Demonstrates On-Chain Credentials functionality
- Clone this repo and navigate to the
js/folder. - Run
npm installto install dependencies.
- Navigate to the
python/folder. - Install required packages:
pip install -r requirements.txtor:
# Create a virtual env
python3 -m venv myenv
# Activate env
source myenv/bin/activate # On macOS/Linux
# myenv\Scripts\activate # On Windows
# Install xrpl-py in the virtual env
pip install xrpl-py```- All scripts are designed for the XRPL Testnet / Devnet.
- Keep your wallet seed secure and never share it.
- Ensure you have sufficient XRP for fees and reserves.
- RLUSD operations require an established trustline first.