This tutorial demo starts up a simple instance of Tendermint consensus (single node, just for illustration). The ABCI application (smart contract in Tendermint terms) is a simple key-value store which, through transactions, allows clients to set and get the value for keys with the restriction that any new value set must be a longer string than the current value for a given key. Transactions are sent via the Tendermint RPC API by an off-chain client application. Both the ABCI application and the client are written in Python. The demo also includes a simple blockchain viewer written in JavaScript that allows the user to visualize all transactions and blocks.
First, open a terminal and run
python app/restart_tm_node.py
This convenience script just configures, adds a few settings, and begins running a full tendermint consensus node.
Then, in a new terminal, start the ABCI application (our application logic):
python app/app.py
Then you can use the Tendermint RPC API to interact with tendermint (and our application through tendermint).
app/client.py
is a convenience CLI to send/receive data to our application.
Try running the following commands:
python app/client.py get hello
python app/client.py set hello world
python app/client.py get hello
python app/client.py set hello toast # rejected - new values for a key must be longer than old values
python app/client.py get hello
python app/client.py set hello toast!
python app/client.py get hello
Finally, we have a small GUI to visualize the blockchain, run:
cd tendermint-gui
yarn start