Next, install the abci-cli tool and example applications:
Copy
git clone https://github.com/tendermint/tendermint.git
cd tendermint
make install_abci
Now run abci-cli to see the list of commands:
Copy
Usage:
abci-cli [command]
Available Commands:
batch Run a batch of abci commands against an application
check_tx Validate a tx
commit Commit the application state and return the Merkle root hash
console Start an interactive abci console for multiple commands
finalize_block Send a set of transactions to the application
kvstore ABCI demo example
echo Have the application echo a message
help Help about any command
info Get some info about the application
query Query the application state
set_option Set an options on the application
Flags:
--abci string socket or grpc (default "socket")
--address string address of application socket (default "tcp://127.0.0.1:26658")
-h, --help help for abci-cli
-v, --verbose print the command and results as if it were a console session
Use "abci-cli [command] --help" for more information about a command.
The handler is specific to the application, and may be arbitrary, so
long as it is deterministic and conforms to the ABCI interface
specification.
So when we run abci-cli info, we open a new connection to the ABCI
server, which calls the Info() method on the application, which tells
us the number of transactions in our Merkle tree.
Now, since every command opens a new connection, we provide the
abci-cli console and abci-cli batch commands, to allow multiple ABCI
messages to be sent over a single connection.
Running abci-cli console should drop you in an interactive console for
speaking ABCI messages to your application.
Try running these commands:
Copy
> echo hello
-> code: OK
-> data: hello
-> data.hex: 0x68656C6C6F
> info
-> code: OK
-> data: {"size":0}
-> data.hex: 0x7B2273697A65223A307D
> finalize_block "abc"
-> code: OK
-> code: OK
-> data.hex: 0x0200000000000000
> commit
-> code: OK
> info
-> code: OK
-> data: {"size":1}
-> data.hex: 0x7B2273697A65223A317D
> query "abc"
-> code: OK
-> log: exists
-> height: 1
-> key: abc
-> key.hex: 616263
-> value: abc
-> value.hex: 616263
> finalize_block "def=xyz" "ghi=123"
-> code: OK
-> code: OK
-> code: OK
-> data.hex: 0x0600000000000000
> commit
-> code: OK
> query "def"
-> code: OK
-> log: exists
-> height: 2
-> key: def
-> key.hex: 646566
-> value: xyz
-> value.hex: 78797A
> prepare_proposal "preparedef"
-> code: OK
-> log: Succeeded. Tx: def action: ADDED
-> code: OK
-> log: Succeeded. Tx: preparedef action: REMOVED
> process_proposal "def"
-> code: OK
-> status: ACCEPT
> process_proposal "preparedef"
-> code: OK
-> status: REJECT
> prepare_proposal
> process_proposal
-> code: OK
-> status: ACCEPT
> finalize_block
-> code: OK
-> data.hex: 0x0600000000000000
> commit
-> code: OK
Note that if we do finalize_block "abc" ... it will store (abc, abc), but if
we do finalize_block "abc=efg" ... it will store (abc, efg).
Similarly, you could put the commands in a file and run
abci-cli --verbose batch < myfile.
Want to write an app in your favorite language?! We'd be happy
to add you to our ecosystem(opens new window)!
TODO link to bounties page.
The abci-cli is designed strictly for testing and debugging. In a real
deployment, the role of sending messages is taken by Tendermint, which
connects to the app using three separate connections, each with its own
pattern of messages.
For examples of running an ABCI app with
Tendermint, see the getting started guide.
Next is the ABCI specification.