{"id":30126476,"url":"https://github.com/iotaledger/ledger.rs","last_synced_at":"2025-09-12T19:33:45.587Z","repository":{"id":38841882,"uuid":"334973248","full_name":"iotaledger/ledger.rs","owner":"iotaledger","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-19T16:51:11.000Z","size":260,"stargazers_count":15,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-08-10T16:51:38.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iotaledger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-02-01T14:19:11.000Z","updated_at":"2025-04-09T10:17:45.000Z","dependencies_parsed_at":"2025-08-10T17:04:18.920Z","dependency_job_id":null,"html_url":"https://github.com/iotaledger/ledger.rs","commit_stats":{"total_commits":33,"total_committers":5,"mean_commits":6.6,"dds":0.303030303030303,"last_synced_commit":"8a0952280cadf9f1e1c7726529f8d3042dbf422c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iotaledger/ledger.rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotaledger%2Fledger.rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotaledger%2Fledger.rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotaledger%2Fledger.rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotaledger%2Fledger.rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iotaledger","download_url":"https://codeload.github.com/iotaledger/ledger.rs/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iotaledger%2Fledger.rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274864016,"owners_count":25364230,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-08-10T16:50:21.108Z","updated_at":"2025-09-12T19:33:45.518Z","avatar_url":"https://github.com/iotaledger.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ledger.rs\n\nThe `ledger.rs` library implements all API commands of the Ledger Nano S/X app and provides some abstraction for common tasks like generating addresses or signing essences.\n\nIt is free of dependencies to other iota specific libraries (like `iota.rs` or `bee`).\n\nThe API specification can be found here: [API-Specification](https://github.com/iotaledger/ledger-iota-app/blob/develop/docs/specification_chrysalis.md)\n\n## Example\n\nFollowing an example how a ledger object is instanciated and an address is generated that is converted into bech32 representation:\n\n```rust\nconst HARDENED : u32 = 0x80000000;\n\n// bip32 path follows: 2c'/107a'/account'/change'/index'\nlet mut ledger = iota_ledger::get_ledger_by_type(0 | HARDENED, TransportTypes::TCP, None)?;\n\nlet input_bip32_index = LedgerBIP32Index {\n    bip32_index: 1 | HARDENED,\n    bip32_change: 0 | HARDENED,\n};\n\n// get one single address, don't show it on the UI\nlet input_addr_bytes: [u8; 32] = ledger\n    .get_addresses(false, input_bip32_index, 1)\n    .expect(\"error get new address\")\n    .first()\n    .unwrap();\n\n// add the address_type byte\nlet mut addr_bytes_with_type = [0u8; 33];\naddr_bytes_with_type[0] = 0; // ed25519 address_type\naddr_bytes_with_type[1..33].clone_from_slice(\u0026input_addr_bytes[..]);\n\n// convert the 33 byte address into a bech32 string\nlet bech32_address = bech32::encode(\"iota\", \n    addr_bytes_with_type.to_base32()).unwrap();\n\n// output the address\nprintln!(\"{}\", bech32_address);\n\n```\n\n\n\n# Test Program `cli.rs`\n\nThere is a test program that can be used for automatic testing of the app running in the Speculos simulator (Nano S and Nano X) or on a real device.\n\nIn comparison to `ledger.rs`, the `cli.rs` test program has dependencies to `bee`.\n\n## What it does\n\nThe program builds (pseudo-)random essences of messages for several different account-, input-, output-, remainder-configurations.\n\nThe number of runs is pseudo-random. Currently, a total of 10000 pseudo-random configurations are generated, but only unique configurations are tested - the rest is skipped. In this case the total number of runs is 62.\n\nCurrently, the number of \"valid configurations\" is limited by the `MAX_SUM_INPUTS_OUTPUTS` that is 16. That means, essences up to a total count of 16 (sum of the count of inputs + outputs) with and without extra remainder are generated.\n\nThe test program also can record APDU transfers as `bin`, `hex` or `json` for automatic testing with a [dependency-free C testing program](https://github.com/iotaledger/ledger-iota-app/tree/develop/tests).\n\nAdditionally, interactive or non-interactive tests can be done. The difference is that in non-interactive mode no user interaction is required to sign essences. Non-interactive mode only is available if the [app](https://github.com/iotaledger/ledger-iota-app) is compiled with `DEBUG=1` or `SPECULOS=1` flag. (The Debug flag also changes the bip32-path to `2c'/1'/account/change/index` and bech32 addresses start with the HRP `atoi`, indicating the app is compiled for the testnet).\n\nThe Speculos simulator can be used with the test-program. [Here are instructions](https://github.com/iotaledger/ledger-iota-app/tree/develop/docker) how to set it up.\n\n## Parameters\n\n```\nledger iota tester 1.0\nThomas Pototschnig \u003cmicroengineer18@gmail.com\u003e\n\nUSAGE:\n    cli [FLAGS] [OPTIONS]\n\nFLAGS:\n    -d, --dump               dump memory after tests\n    -h, --help               Prints help information\n    -s, --simulator          select the simulator as transport\n    -n, --non-interactive    run the program in non-interactive mode for automatic testing\n    -V, --version            Prints version information\n\nOPTIONS:\n    -f, --format \u003cformat\u003e        user output format hex, bin, json (default) as output file format\n    -l, --limit \u003climit\u003e          maximum number of tests done\n    -r, --recorder \u003crecorder\u003e    record APDU requests and responses to a file\n```\n\nThe `dump` flag is a bit special because it does a complete memory dump after tests are run. It's only available if the app is compiled with `DEBUG=1` or `SPECULOS=1`. The main usage is to verify manually and visually that stack didn't grow into the data section. This is only of interest for people developing on the app.\n\n\nThe `bin`-Testfiles for CI-testing can be created by executing:\n\n```\n$ cli -n -s -r=reference.bin -f=bin\n```\n\nPlease note that reference files for the Nano S and the Nano X differ because the `ledger.rs` lib uses a single-signing mode for the Nano S to save RAM, but uses another (faster) signing-mode on the Nano X. Also device information that can be read out via the `get_app_config` API-call are different.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiotaledger%2Fledger.rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiotaledger%2Fledger.rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiotaledger%2Fledger.rs/lists"}