How to Use Smart Contracts
Escrow, payment channels, and multi-signature on XRPL
The Smart Contracts module provides access to advanced XRPL features including escrow, payment channels, and multi-signature transactions.
Available Smart Contract Features
Lock XRP with time-based or condition-based release
High-speed micropayments with minimal fees
Require multiple approvals for transactions
Enable token holding and trading
Note: Smart contracts on XRPL are native protocol features, not Turing-complete programs. They're highly efficient and gas-free.
The Cost Calculator helps you understand the significant cost savings of using XRPL for smart contract operations compared to Ethereum and other chains.
How to Use the Calculator
- 1Select Operation TypeChoose from Escrow, Payment Channel, Multi-sig, or Token Creation
- 2Enter Transaction AmountSpecify the value in XRP or USD
- 3View Cost ComparisonSee side-by-side costs for XRPL vs Ethereum
Cost Comparison Example:
Pro Tip: XRPL reserves are returned when escrows are finished or payment channels are closed, making them essentially free.
Escrow allows you to lock XRP that can only be released when certain conditions are met, such as a specific time or a cryptographic condition.
Escrow Configuration
EscrowCreate Transaction
{
"TransactionType": "EscrowCreate",
"Account": "rN7n3473SaZBCG4dFL83w7a1RXtXtbk2D9",
"Destination": "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
"Amount": "10000000", // 10 XRP in drops
"FinishAfter": 789014400, // Ripple Epoch
"CancelAfter": 789019600
}Escrow Use Cases:
Important: Escrow locks 2 XRP as a reserve. This is returned when the escrow is finished or cancelled.
Payment channels enable high-speed, off-ledger transactions with minimal fees. Perfect for streaming payments, subscriptions, and micropayments.
Payment Channel Configuration
PaymentChannelCreate Transaction
{
"TransactionType": "PaymentChannelCreate",
"Account": "rN7n3473SaZBCG4dFL83w7a1RXtXtbk2D9",
"Destination": "rfkE1aSy9G8Upk4JssnwBxhEv5p4mn2KTy",
"Amount": "100000000", // 100 XRP
"SettleDelay": 86400, // 24 hours
"PublicKey": "023693F15967AE357D..."
}How Payment Channels Work:
Pro Tip: Payment channels are perfect for API metering, content streaming, and any scenario requiring many small payments.
Multi-signature (multi-sig) accounts require approval from multiple parties before transactions can be executed, providing enhanced security for high-value assets.
Multi-Sig Configuration
SignerListSet Transaction
{
"TransactionType": "SignerListSet",
"Account": "rN7n3473SaZBCG4dFL83w7a1RXtXtbk2D9",
"SignerQuorum": 3,
"SignerEntries": [
{ "SignerEntry": { "Account": "...", "SignerWeight": 2 } },
{ "SignerEntry": { "Account": "...", "SignerWeight": 1 } },
{ "SignerEntry": { "Account": "...", "SignerWeight": 1 } }
]
}Common Multi-Sig Configurations:
Security Tip: Multi-sig is essential for treasury management, token issuance controls, and any high-value operations.
Once configured, deploy your smart contracts to the XRP Ledger and monitor their status through the dashboard.
Deployment Process
- 1Review ConfigurationVerify all contract parameters are correct
- 2Connect WalletEnsure your Xaman wallet is connected
- 3Click DeploySubmit the transaction to XRPL
- 4Sign with XamanAuthorize the transaction on your device
- ✓Contract Live!View on XRPL Explorer and in your dashboard
Monitoring Dashboard:
Congratulations!
You've mastered XRP Ledger smart contracts! You can now create escrows, payment channels, and multi-signature accounts for enterprise-grade asset management.