{"id":17946567,"url":"https://github.com/ledger-things/kadena-rust-lib","last_synced_at":"2025-08-27T05:05:18.824Z","repository":{"id":259631624,"uuid":"879075226","full_name":"ledger-things/kadena-rust-lib","owner":"ledger-things","description":"A comprehensive Rust library for interacting with Pact smart contracts and the Kadena blockchain.","archived":false,"fork":false,"pushed_at":"2024-10-27T00:39:06.000Z","size":47,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-13T02:36:54.071Z","etag":null,"topics":["blockchain","cryptography","kadena","pact","rust-lang","rust-library"],"latest_commit_sha":null,"homepage":"","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/ledger-things.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-26T22:40:38.000Z","updated_at":"2025-04-24T14:49:14.000Z","dependencies_parsed_at":"2024-10-27T00:44:40.479Z","dependency_job_id":"d1d04e98-c67f-4fcc-aa71-cffa73434e83","html_url":"https://github.com/ledger-things/kadena-rust-lib","commit_stats":null,"previous_names":["ledger-things/kadena-rust-lib"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ledger-things/kadena-rust-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledger-things%2Fkadena-rust-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledger-things%2Fkadena-rust-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledger-things%2Fkadena-rust-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledger-things%2Fkadena-rust-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ledger-things","download_url":"https://codeload.github.com/ledger-things/kadena-rust-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ledger-things%2Fkadena-rust-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272293530,"owners_count":24908639,"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-08-27T02:00:09.397Z","response_time":76,"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":["blockchain","cryptography","kadena","pact","rust-lang","rust-library"],"created_at":"2024-10-29T07:06:22.828Z","updated_at":"2025-08-27T05:05:18.789Z","avatar_url":"https://github.com/ledger-things.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kadena Rust Lib\n\n![Continuous Integration](https://github.com/ledger-things/kadena-rust-lib/workflows/Continuous%20Integration/badge.svg)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)\n\nA comprehensive Rust library for interacting with Pact smart contracts and the Kadena blockchain. This library provides a type-safe, ergonomic interface for creating and signing Pact commands, managing cryptographic operations, and interacting with Kadena nodes.\n\n## Features\n\n- **🔑 Cryptographic Operations**\n  - ED25519 key generation and management\n  - Message signing and verification\n  - Blake2b hashing\n- **📜 Pact Command Creation**\n  - Type-safe command builders\n  - Capability management\n  - Transaction metadata handling\n- **🔄 Transaction Management**\n  - Command preparation\n  - Transaction signing\n  - Local and Send endpoint integration\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nkadena = \"0.1.0\"\n```\n\n## Quick Start\n\n```rust\nuse kadena::{\n    crypto::PactKeypair,\n    pact::{\n        meta::Meta,\n        cap::Cap,\n        command::Cmd,\n    },\n    fetch::{ApiClient, ApiConfig}\n};\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // Create keypair from known keys\n    let keypair = PactKeypair::generate();\n\n    // Format sender account with \"k:\" prefix\n    let sender_account = format!(\"k:{}\", keypair.public_key);\n\n    let network = \"testnet04\";\n    let chain_id = \"0\";\n\n    // Create metadata using the new constructor and builder pattern\n    let meta = Meta::new(chain_id, \u0026sender_account)\n        .with_gas_limit(1500)\n        .with_gas_price(0.00000001)\n        .with_ttl(3600);\n\n    // Create capabilities using the new constructors\n    let caps = vec![\n        Cap::new(\"coin.GAS\"), // Using the convenience constructor for GAS capability\n        Cap::transfer(\u0026sender_account, \"Bob\", 10.0), // Using the convenience constructor for TRANSFER\n    ];\n\n    // Create Pact code for the transaction\n    let pact_code = format!(\"(coin.transfer \\\"{}\\\" \\\"Bob\\\" 10.0)\", sender_account);\n\n    // Prepare the execution command using the new method\n    let transaction_cmd = Cmd::prepare_exec(\n        \u0026[(\u0026keypair, caps)],\n        None, // Let it generate a random nonce\n        \u0026pact_code,\n        None,\n        meta,\n        Some(network.to_string()),\n    )?;\n\n    println!(\"Transaction Payload:\");\n    println!(\"{}\", serde_json::to_string_pretty(\u0026transaction_cmd)?);\n\n    // Send the transaction to the Kadena testnet node\n    // Create the client\n    let client = ApiClient::new(\n        ApiConfig::new(\"https://api.testnet.chainweb.com\", network, chain_id).with_timeout(60),\n    );\n    let result = client.local(\u0026transaction_cmd).await?;\n\n    println!(\"\\nTransaction Response:\");\n    println!(\"{}\", serde_json::to_string_pretty(\u0026result)?);\n\n    Ok(())\n}\n```\n\n## Documentation\n\nFor detailed documentation and examples, visit [docs.rs/kadena](https://docs.rs/kadena).\n\n## Examples\n\nSee the [examples](examples/) directory for more detailed examples.\n\n## Performance\n\nThis library includes comprehensive benchmarks that you can run with:\n\n```bash\ncargo bench\n```\n\nView the benchmark results in `target/criterion/report/index.html`.\n\n## Safety and Security\n\nThis library uses well-audited cryptographic implementations:\n\n- ED25519 operations via `ed25519-dalek`\n- Blake2b hashing via `blake2`\n- Secure random number generation via `rand`\n\n## Contributing\n\nWe welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n### Development Setup\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/ledger-things/kadena-rust-lib\n   cd kadena\n   ```\n\n2. Run tests:\n\n   ```bash\n   cargo test\n   ```\n\n3. Run benchmarks:\n   ```bash\n   cargo bench\n   ```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a list of changes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fledger-things%2Fkadena-rust-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fledger-things%2Fkadena-rust-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fledger-things%2Fkadena-rust-lib/lists"}