The foundation for XRPL smart contract development
Bedrock is a developer tool for building, deploying, and interacting with XRPL smart contracts written in Rust. Think Foundry, but for XRPL.
- 🏗️ Build - Compile Rust smart contracts to WASM
- 🚀 Deploy - Smart deployment with auto-build and ABI generation
- 📞 Call - Interact with deployed contracts
- 🔧 Local Node - Manage local XRPL test network
- 📝 ABI Generation - Automatic ABI extraction from Rust code
- ⚡ Fast - Embedded JS modules with intelligent caching
Before installing Bedrock, ensure you have:
- Go (1.21 or later) - For building/installing Bedrock
- Node.js (18 or later) - For XRPL transaction handling
- Rust - For compiling smart contracts
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Docker (optional) - For running local XRPL node
go version # Should show 1.21+ node --version # Should show v18+ rustc --version # Should show 1.70+ cargo --version
# Clone the repository git clone https://github.com/xrpl-bedrock/bedrock.git cd bedrock # Build and install go build -o bedrock cmd/bedrock/main.go sudo mv bedrock /usr/local/bin/ # Verify installation bedrock --help
On first run, Bedrock will automatically:
- Install JavaScript dependencies (XRPL libraries)
- Cache them in
~/.cache/bedrock/modules(Linux/macOS) - You'll see:
⚡ First run detected - installing JavaScript dependencies...
This only happens once. Subsequent runs are instant!
bedrock init my-contract
cd my-contractThis creates:
my-contract/
├── bedrock.toml # Project configuration
├── contract/
│ └── src/
│ └── lib.rs # Your smart contract
└── abi.json # Generated ABI (after build)
bedrock build
This compiles your Rust contract to WASM in release mode.
bedrock node start
Starts a local XRPL test network in Docker at:
- WebSocket:
ws://localhost:6006 - Faucet:
http://localhost:8080/faucet
# Deploy to local node bedrock deploy --network local # Deploy to alphanet (testnet) bedrock deploy --network alphanet # Deploy with specific wallet bedrock deploy --wallet sXXX...
Smart Deployment automatically:
- ✅ Builds contract in release mode (if needed)
- ✅ Generates ABI (if needed)
- ✅ Deploys to network
# Call without parameters bedrock call rContract123... hello --wallet sXXX... # Call with parameters bedrock call rContract123... transfer \ --wallet sXXX... \ --params '{"to":"rRecipient...","amount":1000}' # Use parameters from file bedrock call rContract123... register \ --wallet sXXX... \ --params-file params.json
| Command | Description |
|---|---|
bedrock init [name] |
Initialize new project |
bedrock build |
Build contract (release mode) |
bedrock deploy |
Deploy with auto-build & ABI |
bedrock call <contract> <fn> |
Call contract function |
bedrock node <start|stop|status> |
Manage local node |
bedrock build # Build in release mode (default) bedrock build --debug # Build in debug mode (faster, larger)
bedrock deploy # Smart deploy (auto-build + ABI) bedrock deploy --skip-build # Skip building bedrock deploy --skip-abi # Skip ABI generation bedrock deploy --network alphanet # Deploy to alphanet bedrock deploy --wallet sXXX... # Use specific wallet
bedrock call <contract> <function> \ --wallet sXXX... # Wallet seed (required) --network alphanet # Network (default: alphanet) --params '{"key":"value"}' # JSON parameters --params-file params.json # Parameters from file --gas 1000000 # Computation allowance --fee 1000000 # Transaction fee (drops)
bedrock node start # Start local XRPL node bedrock node stop # Stop local node bedrock node status # Check if running bedrock node logs # View node logs (coming soon)
Edit bedrock.toml to configure your project:
[project] name = "my-contract" version = "0.1.0" [build] source = "contract/src/lib.rs" target = "wasm32-unknown-unknown" [networks.local] url = "ws://localhost:6006" faucet_url = "http://localhost:8080/faucet" [networks.alphanet] url = "wss://alphanet.nerdnest.xyz" faucet_url = "https://alphanet.faucet.nerdnest.xyz/accounts"
use xrpl_wasm::*; /// @xrpl-function hello /// @xrpl-param name: VL - User name /// @xrpl-return UINT64 - Success code #[wasm_export] fn hello(name: Vec<u8>) -> u64 { let _ = trace("Hello from XRPL!"); 0 // Success }
Bedrock automatically generates ABIs from JSDoc-style comments:
/// @xrpl-function transfer /// @xrpl-param to: ACCOUNT - Recipient address /// @xrpl-param amount: UINT64 - Amount to transfer /// @xrpl-return UINT64 - Success code #[wasm_export] fn transfer(to: Vec<u8>, amount: u64) -> u64 { // Implementation 0 }
Supported parameter types:
UINT8,UINT16,UINT32,UINT64,UINT128,UINT256VL(variable length bytes/string)ACCOUNT(XRPL address)AMOUNT(XRP drops or IOU)CURRENCY,ISSUE
# Terminal 1: Start local node bedrock node start # Terminal 2: Develop and test bedrock build # Build contract bedrock deploy --local # Deploy to local node bedrock call rXXX... hello --wallet sXXX... # Test function # Make changes to contract... bedrock deploy --local # Redeploy (auto-rebuilds)
# 1. Build and deploy to alphanet bedrock deploy --network alphanet # Save the output: # Wallet Seed: sXXX... # Contract Account: rContract123... # 2. Call your contract bedrock call rContract123... myFunction \ --wallet sXXX... \ --network alphanet
Bedrock uses embedded JavaScript modules for XRPL transaction handling:
~/.cache/bedrock/modules/
├── deploy.js # Deployment module
├── call.js # Contract calling module
├── package.json # Dependencies (@transia/xrpl)
└── node_modules/ # Installed on first run
XRPL smart contracts are in alpha, and the only stable tooling is in JavaScript. Bedrock embeds these modules and will migrate to pure Go as XRPL tooling matures.
- First run: Installs npm dependencies (~10-15 seconds)
- Subsequent runs: Uses cached modules (instant)
- Updates: Automatic reinstall when CLI is updated (version detection via SHA256)
- Manual cleanup:
rm -rf ~/.cache/bedrock
# Check Node.js version node --version # Should be 18+ # Manually install dependencies cd ~/.cache/bedrock/modules npm install
# Add wasm32 target rustup target add wasm32-unknown-unknown # Update Rust rustup update
# Check Docker is running docker ps # View Docker logs docker logs bedrock-xrpl-node # Restart Docker daemon
# Make sure you're in a Bedrock project directory ls bedrock.toml # Or initialize a new project bedrock init my-project
Contributions are welcome! Please check out:
- CONTRIBUTING.md - Contribution guidelines
- BRANDING.md - Design philosophy
- Issues - Bug reports & features
- Smart contract compilation (Rust → WASM)
- Automatic ABI generation
- Contract deployment
- Contract function calling
- Local node management
- Contract testing framework
- Wallet management (
bedrock wallet) - Contract verification
- TypeScript SDK generation
- Watch mode for development
- Migration to pure Go (when XRPL tooling matures)
MIT License - See LICENSE for details
- XRPL Docs: https://xrpl.org/
- Smart Contracts: https://xrpl.org/smart-contracts.html
- Alphanet: https://alphanet.nerdnest.xyz
- Community: XRPL Discord
Built with ⚡ by the Bedrock team