Major changes: - Replaced Binance TSS library with luxfi/threshold (supports CGGMP21 & FROST) - Added XRPL network support for secp256k1 signatures - Implemented resharing functionality for both ECDSA and EdDSA - Fixed protocol adapters for CGGMP21 and FROST - Updated event consumer to use new node methods - Fixed all build errors in core packages Technical improvements: - Simplified party.ID usage (now string-based) - Added proper message types and encoding - Updated session interfaces with required methods - Fixed test suite to work with new library structure All core package tests passing. Ready for mainnet deployment.
3.4 KiB
XRPL Integration Guide
This guide explains how to use the Lux MPC library for XRP Ledger (XRPL) transaction signing.
Overview
The Lux MPC library now includes explicit support for XRPL networks. XRPL uses secp256k1 signatures for transaction authorization, which is fully supported by our threshold signature implementation.
Supported Networks
XRPL- XRP Ledger MainnetXRPL-testnet- XRP Ledger TestnetXRPL-devnet- XRP Ledger Devnet
Key Type
XRPL uses secp256k1 (ECDSA) signatures. The library automatically selects the correct key type when you specify an XRPL network code.
Usage Example
import (
"github.com/luxfi/mpc/pkg/types"
"github.com/luxfi/mpc/pkg/client"
)
// Create signing request for XRPL
signingMsg := &types.SignTxMessage{
WalletID: "your-wallet-id",
TxID: "unique-tx-id",
Tx: xrplTransactionBytes,
KeyType: types.KeyTypeSecp256k1,
NetworkInternalCode: string(types.NetworkXRPL),
}
// Sign the transaction
err := mpcClient.SignTransaction(signingMsg)
Transaction Format
XRPL transactions should be provided as serialized bytes according to the XRPL binary codec specification. The typical flow is:
- Create XRPL transaction JSON
- Serialize using XRPL binary codec
- Pass serialized bytes to MPC for signing
- Apply signature to transaction
- Submit to XRPL network
Integration with ripple-lib
When integrating with JavaScript XRPL libraries:
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI();
// Create transaction
const txJSON = {
TransactionType: 'Payment',
Account: 'rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH',
Destination: 'rLNaPoKeeBjZe2qs6x52yVPZpZ8td4dc6w',
Amount: '1000000', // 1 XRP in drops
Fee: '12',
Sequence: 1
};
// Serialize transaction (prepare for signing)
const serialized = api.encodeTransaction(txJSON);
// Send serialized bytes to MPC for signing
// ... MPC signing process ...
// Apply MPC signature to transaction
const signedTx = {
...txJSON,
TxnSignature: mpcSignature
};
// Submit to XRPL
api.submit(signedTx);
Security Considerations
-
Key Derivation: XRPL uses specific key derivation paths. Ensure your wallet implementation follows XRPL standards.
-
Transaction Validation: Always validate transaction data before signing:
- Check destination addresses
- Verify amounts
- Confirm fees are reasonable
- Validate sequence numbers
-
Network Selection: Always specify the correct network code to prevent signing mainnet transactions with testnet keys or vice versa.
Testing
Run XRPL-specific tests:
go test ./e2e -run TestXRPL
Network Configuration
The supported networks are defined in pkg/types/networks.go:
const (
NetworkXRPL NetworkCode = "XRPL"
NetworkXRPLTestnet NetworkCode = "XRPL-testnet"
NetworkXRPLDevnet NetworkCode = "XRPL-devnet"
)
Error Handling
Common XRPL-related errors:
- Invalid network code: Ensure you're using one of the supported XRPL network codes
- Wrong key type: XRPL only supports secp256k1 signatures
- Invalid transaction format: Ensure proper XRPL transaction serialization