2017-01-13 03:09:28 -05:00
# Application BlockChain Interface (ABCI)
2015-11-02 07:39:53 -08:00
2017-01-12 15:47:55 -05:00
[](https://circleci.com/gh/tendermint/abci)
2016-07-06 17:01:20 -04:00
2017-12-05 17:22:06 -05:00
Blockchains are systems for multi-master state machine replication.
2017-01-13 03:09:28 -05:00
**ABCI** is an interface that defines the boundary between the replication engine (the blockchain),
2017-01-23 20:14:14 -08:00
and the state machine (the application).
2017-01-13 03:09:28 -05:00
By using a socket protocol, we enable a consensus engine running in one process
to manage an application state running in another.
2015-11-02 07:39:53 -08:00
2017-09-22 09:38:14 -04:00
For background information on ABCI, motivations, and tendermint, please visit [the documentation ](http://tendermint.readthedocs.io/en/master/ ).
The two guides to focus on are the `Application Development Guide` and `Using ABCI-CLI` .
2017-01-13 03:09:28 -05:00
2017-03-13 16:36:41 -04:00
Previously, the ABCI was referred to as TMSP.
2016-01-01 18:19:58 -08:00
2018-01-01 14:45:57 +00:00
The community has provided a number of addtional implementations, see the [Tendermint Ecosystem ](https://tendermint.com/ecosystem )
2016-04-15 15:01:05 -07:00
2017-09-22 09:38:14 -04:00
## Implementation
We provide three implementations of the ABCI in Go:
2017-12-05 17:22:06 -05:00
- Golang in-process
2017-09-22 09:38:14 -04:00
- ABCI-socket
- GRPC
2017-12-05 17:22:06 -05:00
Note the GRPC version is maintained primarily to simplify onboarding and prototyping and is not receiving the same
attention to security and performance as the others.
### In Process
The simplest implementation just uses function calls within Go.
This means ABCI applications written in Golang can be compiled with TendermintCore and run as a single binary.
2017-09-22 09:38:14 -04:00
2017-12-05 17:45:26 -05:00
### Socket (TSP)
2017-09-22 09:38:14 -04:00
ABCI is best implemented as a streaming protocol.
The socket implementation provides for asynchronous, ordered message passing over unix or tcp.
Messages are serialized using Protobuf3 and length-prefixed.
Protobuf3 doesn't have an official length-prefix standard, so we use our own. The first byte represents the length of the big-endian encoded length.
For example, if the Protobuf3 encoded ABCI message is `0xDEADBEEF` (4 bytes), the length-prefixed message is `0x0104DEADBEEF` . If the Protobuf3 encoded ABCI message is 65535 bytes long, the length-prefixed message would be like `0x02FFFF...` .
### GRPC
GRPC is an rpc framework native to Protocol Buffers with support in many languages.
Implementing the ABCI using GRPC can allow for faster prototyping, but is expected to be much slower than
2017-12-05 17:22:06 -05:00
the ordered, asynchronous socket protocol. The implementation has also not received as much testing or review.
2017-09-22 09:38:14 -04:00
Note the length-prefixing used in the socket implementation does not apply for GRPC.
2018-01-01 14:45:57 +00:00
## Usage
2017-09-22 09:38:14 -04:00
2017-12-05 17:45:26 -05:00
The `abci-cli` tool wraps an ABCI client and can be used for probing/testing an ABCI server.
For instance, `abci-cli test` will run a test sequence against a listening server running the Counter application (see below).
It can also be used to run some example applications.
2017-09-22 09:38:14 -04:00
See [the documentation ](http://tendermint.readthedocs.io/en/master/ ) for more details.
2017-12-05 17:45:26 -05:00
### Example Apps
2017-09-22 09:38:14 -04:00
Multiple example apps are included:
2017-10-18 15:32:34 -04:00
- the `abci-cli counter` application, which illustrates nonce checking in txs
2017-12-20 00:07:58 -08:00
- the `abci-cli dummy` application, which illustrates a simple key-value Merkle tree
2017-10-18 15:32:34 -04:00
- the `abci-cli dummy --persistent` application, which augments the dummy with persistence and validator set changes
2017-09-22 09:38:14 -04:00
2017-12-05 17:22:06 -05:00
### Install
```
go get github.com/tendermint/abci
cd $GOPATH/src/github.com/tendermint/abci
make get_vendor_deps
make install
```
2017-09-22 09:38:14 -04:00
## Specification
2016-07-23 17:37:09 -04:00
2018-01-01 14:45:57 +00:00
See the [spec file ](specification.rst ) for more information.