Interfaces
CyberTrees Ledger provides three interfaces for interacting with a node:
Command-Line Interface
gRPC Interface
REST Interface
Command-Line Interface
When discussing the command-line interface for the CyberTrees Ledger application, we're referring to the cybertrees
binary. This binary acts as both the node client and the application client. This means that the cybertrees
binary is capable of not only running a node but also interacting with it.
As a comprehensive tool for the CyberTrees Ledger, the cybertrees
binary has multiple functions. It can handle key management, operate nodes, query the state of the blockchain, and facilitate the creation, signing, and broadcasting of transactions. For those who are adept at using command-line interfaces, experimenting with the cybertrees
binary offers an excellent opportunity to gain a deeper understanding of the CyberTrees Ledger.
To learn more about the available commands, install Green Nodes and run the following:
For transaction commands, run the following:
For query commands, run the following:
gRPC Interface
gRPC, a contemporary RPC framework, utilizes protocol buffers for encoding both requests and responses exchanged between a client and a service. The CyberTrees Ledger primarily employs gRPC for querying blockchain states, such as credit or token balances, data signature records, and more.
As a client developer, you have the flexibility to query the state using a gRPC library in your preferred programming language. This can be achieved by importing and generating code from the CyberTrees Ledger API.
Depending on the programming language you use, you might find pre-existing libraries that significantly simplify the process, including compiling protobuf messages. For instance, if you're developing in Go, you can utilize the cybertrees-ledger modules. For those working in Typescript, the cybertrees-js is an option worth exploring.
It's important to note that the gRPC interface is solely for broadcasting transactions. For generating and signing transactions, developers should use additional libraries, such as keplr-wallet. An example of this can be seen in the cybertrees-js, which demonstrates usage with Typescript and Keplr.
Beyond programmatic use, gRPC libraries can also be interacted with through grpcurl, a command-line tool designed for working with gRPC servers directly from the command-line.
If you're running a local node, you can identify available services using a specific command.
To execute a call, you can use the following format:
If you are running a local node and attempting to execute the above command but you are receiving an error, make sure the gRPC service is enabled in ~/.cybertrees/config/app.toml
.
For more information about the gRPC interface, check out the Cosmos SDK Documentation.
Last updated