{"id":23886768,"url":"https://github.com/elmurci/xpring-rs","last_synced_at":"2025-08-27T17:12:30.441Z","repository":{"id":37182664,"uuid":"248839769","full_name":"elmurci/xpring-rs","owner":"elmurci","description":"Rust client-side library for the XRP Ledger","archived":false,"fork":false,"pushed_at":"2022-09-16T17:53:49.000Z","size":797,"stargazers_count":4,"open_issues_count":13,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T04:03:35.700Z","etag":null,"topics":["crypto","ilp","interledger-protocol","ripple","rust","wallet-generation","xpring","xpring-sdk","xrp","xrp-ledger","xrpl"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elmurci.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-20T19:50:16.000Z","updated_at":"2022-10-31T07:20:33.000Z","dependencies_parsed_at":"2022-06-24T02:44:19.833Z","dependency_job_id":null,"html_url":"https://github.com/elmurci/xpring-rs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmurci%2Fxpring-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmurci%2Fxpring-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmurci%2Fxpring-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elmurci%2Fxpring-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elmurci","download_url":"https://codeload.github.com/elmurci/xpring-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144268,"owners_count":21054899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto","ilp","interledger-protocol","ripple","rust","wallet-generation","xpring","xpring-sdk","xrp","xrp-ledger","xrpl"],"created_at":"2025-01-04T06:47:27.618Z","updated_at":"2025-04-10T02:32:27.080Z","avatar_url":"https://github.com/elmurci.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Crate](https://github.com/elmurci/xpring-rs/workflows/Rust/badge.svg)](https://github.com/elmurci/xpring-rs/actions)\n[![Crate](https://img.shields.io/crates/v/xpring.svg)](https://crates.io/crates/xpring)\n[![Docs](https://img.shields.io/badge/rust-documentation-blue.svg)](https://docs.rs/xpring)\n\n# xpring-rs\n\nxpring-rs is a Rust client-side library that:\n\n- Performs some offline calculations around XRP Ledger wallet generation/derivation\n- Provides an easy interface to interact with the XRP Ledger\n\n## Architecture\n\n![alt text](https://raw.githubusercontent.com/elmurci/xpring-rs/master/architecture.png \"xpring-rs Architecture\")\n\n## Features\n\nxpring-rs provides the following features:\n\n- Wallet generation and derivation (Seed-based or HD Wallet-based)\n- Address validation\n- Account balance retrieval\n- Sending XRP payments\n\n## Requirements\n\n- Node.js (10+)\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nxpring = \"0.0.10\"\n```\n\n## Usage\n\n**Note:** xpring-rs only works with the X-Address format. For more information about this format, see the [Utilities section](#utilities) and \u003chttp://xrpaddress.info\u003e.\n\n### Wallets\n\nA wallet is a fundamental model object in xpring-rs. A wallet provides:\n\n- key management\n- address derivation\n- signing functionality\n\nWallets can be derived from either a seed or a mnemonic and derivation path. You can also generate a new random HD wallet.\n\n#### Wallet Derivation\n\nxpring-rs can derive a wallet from a seed or it can derive a hierarchical deterministic wallet (HD Wallet) from a mnemonic and derivation path.\n\n##### Hierarchical Deterministic Wallets\n\nA hierarchical deterministic wallet is created using a mnemonic and a derivation path. Simply pass the mnemonic and derivation path to the wallet generation function. Note that you omit passing a derivation path and have a default path be used instead.\n\n```rust\nuse xpring::{Xrpl};\n\n...\n// TestNet\nlet mut xrpl = Xrpl::new(\"http://test.xrp.xpring.io:50051\", false)?;\n\n// With mnemonic and default derivation path\nlet wallet_from_mnemonic = xrpl.wallet_from_mnemonic(\n    \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\", \n    None\n)?;\n\n// With mnemonic and custom derivation path\nlet wallet_from_mnemonic = xrpl.wallet_from_mnemonic(\n    \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\", \n    Some(\"m/44'/144'/0'/0/1\")\n)?;\n```\n\n##### Seed-Based Wallets\n\nYou can construct a seed based wallet by passing a base58check encoded seed string.\n\n```rust\nlet wallet_from_seed = xrpl.wallet_from_seed(\"snYP7oArxKepd3GPDcrjMsJYiJeJB\", None)?;\n// XWalletGenerationResult { wallet: \n//   XWallet \n//     { \n//       public_key: \"031D68BC1A142E6766B2BDFB006CCFE135EF2E0E2E94ABB5CF5C9AB6104776FBAE\", \n//       private_key: \"0090802A50AA84EFB6CDB225F17C27616EA94048C179142FECF03F4712A07EA7A4\", \n//       test: true, \n//       address: Some(\"TVHLFWLKvbMv1LFzd6FA2Bf9MPpcy4mRto4VFAAxLuNpvdW\") \n//     }, \n//   mnemonic: \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\", \n//   derivation_path: \"m/44\\'/144\\'/0\\'/0/0\" \n// }\n```\n\n#### Wallet Generation\n\nxpring-rs can generate a new and random HD Wallet. The result of a wallet generation call is a `XWalletGenerationResult` struct which contains the following:\n\n- A randomly generated mnemonic\n- The derivation path used, which is the default path\n- A reference to the new wallet\n\n\n```rust\n// Generate a random wallet.\nlet random_wallet = xrpl.generate_random_wallet(None)?; //no entropy and testnet \nlet random_wallet_with_entropy = xrpl.generate_random_wallet(Some(\"00000000000000000000000000000000\"))?; //entropy and mainnet \n\n// XWalletGenerationResult { wallet: \n//   XWallet \n//     { \n//       public_key: \"031D68BC1A142E6766B2BDFB006CCFE135EF2E0E2E94ABB5CF5C9AB6104776FBAE\", \n//       private_key: \"0090802A50AA84EFB6CDB225F17C27616EA94048C179142FECF03F4712A07EA7A4\", \n//       test: true, \n//       address: Some(\"TVHLFWLKvbMv1LFzd6FA2Bf9MPpcy4mRto4VFAAxLuNpvdW\") \n//     }, \n//   mnemonic: \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\", \n//   derivation_path: \"m/44\\'/144\\'/0\\'/0/0\" \n// }\n```\n\n#### Wallet Properties\n\nA generated wallet can provide its public key, private key, and address on the XRP ledger.\n\n```rust\nlet wallet_from_mnemonic = xrpl.wallet_from_mnemonic(\n    \"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about\", \n    Some(\"m/44'/144'/0'/0/1\")\n)?;\n\nprintln!(\"Address: {}\", wallet.address); //XVMFQQBMhdouRqhPMuawgBMN1AVFTofPAdRsXG5RkPtUPNQ\nprintln!(\"Public Key: {}\", wallet.publicKey); //031D68BC1A142E6766B2BDFB006CCFE135EF2E0E2E94ABB5CF5C9AB6104776FBAE\nprintln!(\"Private Key: {}\", wallet.privateKey); //0090802A50AA84EFB6CDB225F17C27616EA94048C179142FECF03F4712A07EA7A4\n```\n\n#### Signing / Verifying\n\nA wallet can also sign and verify arbitrary messages. Generally, users should use the functions on `wallet` to perform cryptographic functions rather than using these low level APIs.\n\n```rust\nlet signed_message = xrpl.wallet_sign(\n    \"mymessage\", \n    \"000974B4CFE004A2E6C4364CBF3510A36A352796728D0861F6B555ED7E54A70389\"\n    ).unwrap();\n\nprintln!(\"Signed Message: {:?}\", signed_message); //304402204146402099809E1F021421569F72BA34DCAFCC832741AB6310F887F60734D9F002203E813AD6A59D67D8EE06C8EA05BCC1BA8F690B631E6F243E8BE60633D27BE05D\n\n...\n\nlet verified_message = xrpl.wallet_verify(\n    \"mymessage\", \n    \"3045022100DD88E31FF9AFD2A6DA48D40C4B4E8F11725E11C9D9E52388710E35ED19212EF6022068CFA9C09071322751C11DD21E89088879DC28B3B683D3F863090FB7C331EC32\", \n    \"038BF420B5271ADA2D7479358FF98A29954CF18DC25155184AEAD05796DA737E89\"\n).unwrap();\n// true\n```\n\n#### Retrieving a Balance\n\n```rust\nlet balance = xrpl.get_balance(\"TVr7v7JGN5suv7Zgdu9aL4PtCkwayZNYWvjSG23uMMWMvzZ\")?;\n//1000.00\n```\n\n#### Checking Transaction Status\n\nAn `Xrpl` instance can check the status of an transaction on the XRP Ledger.\n\nXrpl returns the following transaction states:\n- `SUCCEEDED`: The transaction was successfully validated and applied to the XRP Ledger.\n- `FAILED:` The transaction was successfully validated but not applied to the XRP Ledger. Or the operation will never be validated.\n- `PENDING`: The transaction has not yet been validated, but may be validated in the future.\n- `UNKNOWN`: The transaction status could not be determined.\n\n**Note:** For more information, see [Reliable Transaction Submission](https://xrpl.org/reliable-transaction-submission.html) and [Transaction Results](https://xrpl.org/transaction-results.html).\n\nThese states are determined by the `XTransactionStatus` enum.\n\n```rust\nlet status = xrpl.get_transaction_status(\"4DBA25199653A2E8BC5879DF2F830DA0149D9DE5216D2A4496A59505C107D6BB\")?;\n//SUCCEEDED\n```\n\n**Note:** The example transactionHash may lead to a \"Transaction not found.\" error because the Testnet is regularly reset, or the accessed node may only maintain one month of history.  Recent transaction hashes can be found in the XRP Ledger Explorer: [Mainnet](https://livenet.xrpl.org) or [Testnet](https://testnet.xrpl.org).\n\n#### Sending XRP\n\nAn `XrplClient` can send XRP to other [accounts](https://xrpl.org/accounts.html) on the XRP Ledger.\n\n**Note:** The payment operation will block the calling thread until the operation reaches a definitive and irreversible success or failure state.\n\n```rust\nlet w = wallet.from_seed(\n    \"shKtxFAYfNUHYayYMYkp3KjQQX2UY\",\n    None,\n).unwrap();\nlet response = client.send(12.12, \"T7jkn8zYC2NhPdcbVxkiEXZGy56YiEE4P7uXRgpy5j4Q6S1\",\"T7QqSicoC1nB4YRyzWzctWW7KjwiYUtDzVaLwFd4N7W1AUU\", w); \n//XrplReliableSendResponse {\n//  transaction_status: SUCCEEDED,\n//  transaction_hash: \"EE70A3A5B8F5E5C6B7AA8A76E640E4AF4AFC37E87767130824F7D211CE45604E\",\n//  transaction_info: \"\"\n//}\n```\n\n### Utilities\n\n#### Address validation\n\n```rust\nxrpl.validate_address(\"rU6K7V3Po4snVhBBaU29sesqs2qTQJWDw1\")?; // returns true\nxrpl.validate_address(\"XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi\")?; // returns true\nxrpl.validate_address(\"1DiqLtKZZviDxccRpowkhVowsbLSNQWBE8\")?; // returns false\n```\n\nYou can also validate if an address is an X-Address or a classic address.\n\n```rust\nxrpl.validate_x_address(\"rU6K7V3Po4snVhBBaU29sesqs2qTQJWDw1\")?; // returns false\nxrpl.validate_x_address(\"XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi\")?; // returns true\nxrpl.validate_x_address(\"1DiqLtKZZviDxccRpowkhVowsbLSNQWBE8\")?; // returns false\n```\n\n```rust\nxrpl.validate_classic_address(\"rU6K7V3Po4snVhBBaU29sesqs2qTQJWDw1\")?; // returns true\nxrpl.validate_classic_address(\"XVLhHMPHU98es4dbozjVtdWzVrDjtV18pX8yuPT7y4xaEHi\")?; // returns false\n```\n\n#### X-Address Encoding\n\n```rust\n// Encode an X-Address.\nxpring.encode_classic_address(\"rU6K7V3Po4snVhBBaU29sesqs2qTQJWDw1\", Some(12345), None)?;\n//XVfC9CTCJh6GN2x8bnrw3LtdbqiVCUvtU3HnooQDgBnUpQT\n\n// Decode an X-Address.\nxpring.decode_x_address(\"XVfC9CTCJh6GN2x8bnrw3LtdbqiVCUvtU3HnooQDgBnUpQT\")?;\n// ClassicAddress {\n//     address: \"rU6K7V3Po4snVhBBaU29sesqs2qTQJWDw1\",\n//     tag: Some(12345),\n//     test: false\n// }\n```\n\n### ILP\n\nAn `Ilp` instance can send ILP Payments and get account balances.\n\n#### Get Balance\n\n```rust\n// Ilp instance\nlet mut ilp = Ilp::new(\"http://hermes-grpc.ilpv4.dev\", \"test\", \"password\")?;\n\n// Send Payment\nlet payment =\n    ilp.get_balance()?;\n//  IlpBalanceResponse {\n//      account_id: \"sdk_account1\",\n//      asset_code: \"XRP\",\n//      asset_scale: 9,\n//      net_balance: -10491,\n//      prepaid_amount: 0,\n//      clearing_balance: -10491,\n//  }\n```\n\n#### Send ILP Payment\n\n```rust\n// Ilp instance\nlet mut ilp = Ilp::new(\"http://hermes-grpc.ilpv4.dev\", \"test\", \"password\")?;\n\n// Send Payment\nlet payment =\n    ilp.send_to(\n        \"$money.ilpv4.dev/test2\",\n        8,\n        10\n    )?;\n//  IlpSendResponse {\n//      payment_status: SUCCEEDED,\n//      original_amount: 8,\n//      amount_delivered: 8,\n//      amount_sent: 8,\n//  }\n```\n\n# Examples\n\nYou can find some sample code in the [examples](examples) folder.\n\n# Contributing\n\nPull requests are welcome! To get started with building this library and opening pull requests, please see the [contributing](CONTRIBUTING.md) page.\n\n# License\n\nxpring-rs is available under the MIT license. See the [LICENSE](LICENSE) file for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmurci%2Fxpring-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felmurci%2Fxpring-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felmurci%2Fxpring-rs/lists"}