See the [repo root] for build status, license, rust version, etc.
A Rust implementation of the core types returned by a Tendermint node's RPC endpoint. These can be used to deserialize JSON-RPC responses.
All networking related features will be feature guarded to keep the dependencies small in cases where only the core types are needed.
See documentation on crates.io.
This crate optionally provides access to different types of RPC client functionality and different client transports based on which features you select when using it.
Several client-related features are provided at present:
http-client
- Provides HttpClient
, which is a basic RPC client that
interacts with remote Tendermint nodes via JSON-RPC over HTTP or
HTTPS. This client does not provide Event
subscription
functionality. See the [Tendermint RPC] for more details.websocket-client
- Provides WebSocketClient
, which provides full
client functionality, including general RPC functionality as well as
Event
] subscription functionality. Can be used over secure
(wss://
) and unsecure (ws://
) connections.A tendermint-rpc
console application is provided for testing/experimentation
purposes. To build this application:
```bash
cd rpc cargo build --bin tendermint-rpc --features cli
cargo run --bin tendermint-rpc --features cli -- --help
cargo install --bin tendermint-rpc --features cli --path . ```
The application sends its logs to stderr and its output to stdout, so it's relatively easy to capture RPC output.
Usage examples: (assuming you've installed the binary)
```bash
tendermint-rpc --help
tendermint-rpc status
tendermint-rpc broadcast-tx-async somekey=somevalue
tendermint-rpc abci-query somekey
tendermint-rpc --proxy-url http://yourproxy:8080 abci-query somekey
export HTTP_PROXY=http://yourproxy:8080 tendermint-rpc abci-query somekey
tendermint-rpc -u ws://127.0.0.1:26657/websocket subscribe "tm.event='NewBlock'"
export TENDERMINTRPCURL=ws://127.0.0.1:26657/websocket tendermint-rpc subscribe "tm.event='Tx'" ```
Mock clients are included when either of the http-client
or
websocket-client
features are enabled to aid in testing. This includes
MockClient
, which implements both Client
and SubscriptionClient
traits.
RPC [core types] in golang
RPC endpoints REST interface documentation: https://docs.tendermint.com/v0.34/rpc/
The RPC types are directly tested through the integration tests. These tests use fixtures taken from running Tendermint nodes to ensure compatibility without needing access to a running node during testing. All of these fixtures were generated manually, and automatic regeneration of the fixtures is on our roadmap.
To run these tests locally:
```bash
cargo test --all-features ```
The RPC client is also indirectly tested through the Tendermint integration tests, which happens during CI. All of these tests require a running Tendermint node, and are therefore ignored by default. To run these tests locally:
```bash
docker pull tendermint/tendermint:latest docker run -it --rm -v "/tmp/tendermint:/tendermint" \ tendermint/tendermint init docker run -it --rm -v "/tmp/tendermint:/tendermint" \ -p 26657:26657 \ tendermint/tendermint node --proxy_app=kvstore
cd ../tendermint cargo test --all-features -- --ignored ```