Skip to content

mpwsh/chia-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

chia-client is a simple Rust library to interact with the Chia RPC API (fullnode/wallet/harvester). Currently, most of the RPC endpoints are available and some utility functions to encode and decode puzzle hashes.

Installation

To use chia-client in your Rust project, add the following to your Cargo.toml:

[dependencies]
chia-client = { git = "https://github.com/mpwsh/chia-client" }

Usage

Please checkout a basic example at ./examples/get_balance.rs

Run the example:

cargo run --example get_balance
#output
Balance: 0.000000000001 XCH

There's another example to create a simple CLI called chiactl to get balance as well, that you can expand with more useful commands.

Using example project chiactl

Update the contents of ./examples/ctlconfig.yaml to suit your needs, and then run the following to fetch the balance for a wallet address:

cargo run --example chiactl -- get balance <wallet_address> --config examples/ctlconfig.yaml

Get 'transactions' for a given wallet

cargo run --example chiactl -- get transactions <wallet_address> --config examples/ctlconfig.yaml

You could also provide these values using command arguments, or specify the path of the config file in an arg as well. Use --help to get all available arguments.

More commands:

cargo run --example chiactl -- get blockchain --config examples/ctlconfig.yaml
cargo run --example chiactl -- get network --config examples/ctlconfig.yaml
cargo run --example chiactl -- get blockmetrics --config examples/ctlconfig.yaml
cargo run --example chiactl -- get block 3392968 --config examples/ctlconfig.yaml

All get commands

SUBCOMMANDS:
    balance
    block
    blockchain
    blockmetrics
    coin
    network
    transactions

Contributing

If you'd like to contribute to the development of chia-client, feel free to submit a pull request or create an issue on the GitHub repository. License

This project is licensed under the MIT License. See the LICENSE file for more information.

Credits

This is a fork of crate chia-node-rs from Mike Cronce: https://gitlab.cronce.io/foss/`chia-client`

Disclaimer

Please note that this library is provided "as-is" and the author is not responsible for any harm or misuse that may arise from the use of this library. Users are advised to use this library at their own risk and are encouraged to review the source code and understand the workings of the library before using it in any application or project.

Releases

No releases published

Packages

No packages published

Languages