You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Jae Kwon 2a4894310d Remove Proof message, replace with more flexible Query 8 years ago
client Remove Proof message, replace with more flexible Query 8 years ago
cmd Remove Proof message, replace with more flexible Query 8 years ago
example Remove Proof message, replace with more flexible Query 8 years ago
server Remove Proof message, replace with more flexible Query 8 years ago
tests Remove Proof message, replace with more flexible Query 8 years ago
testutil TMSP -> ABCI 8 years ago
types Remove Proof message, replace with more flexible Query 8 years ago
.gitignore Fixed Makefile to cleanup after run 8 years ago
LICENSE TMSP -> ABCI 8 years ago
Makefile Improve Makefile 8 years ago
README.md Remove Proof message, replace with more flexible Query 8 years ago
circle.yml add glide 8 years ago
glide.lock Remove Proof message, replace with more flexible Query 8 years ago
glide.yaml Add tests for client-server proofs over socket and grpc 8 years ago

README.md

Tendermint Socket Protocol (ABCI)

CircleCI

Blockchains are a system for creating shared multi-master application state. ABCI is a socket protocol enabling a blockchain consensus engine, running in one process,

For more information on ABCI, motivations, and tutorials, please visit our blog post.

Other implementations:

Contents

This repository holds a number of important pieces:

  • types/types.proto

    • the protobuf file defining ABCI message types, and the optional grpc interface.
      • to build, run make protoc
    • see protoc --help and the grpc docs for examples and details of other languages
  • golang implementation of ABCI client and server

    • two implementations:
      • asynchronous, ordered message passing over unix or tcp;
        • messages are serialized using protobuf and length prefixed
      • grpc
    • TendermintCore runs a client, and the application runs a server
  • cmd/abci-cli

    • command line tool wrapping the client for probing/testing a ABCI application
    • use abci-cli --version to get the ABCI version
  • examples:

    • the cmd/counter application, which illustrates nonce checking in txs
    • the cmd/dummy application, which illustrates a simple key-value merkle tree

Message format

Since this is a streaming protocol, all messages are encoded with a length-prefix followed by the message encoded in Protobuf3. 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....

Note this prefixing does not apply for grpc.

Message types

ABCI requests/responses are simple Protobuf messages. Check out the schema file.

DeliverTx

  • Arguments:
    • Data ([]byte): The request transaction bytes
  • Returns:
    • Code (uint32): Response code
    • Data ([]byte): Result bytes, if any
    • Log (string): Debug or error message
  • Usage:
    Append and run a transaction. If the transaction is valid, returns CodeType.OK

CheckTx

  • Arguments:

    • Data ([]byte): The request transaction bytes
  • Returns:

    • Code (uint32): Response code
    • Data ([]byte): Result bytes, if any
    • Log (string): Debug or error message
  • Usage:
    Validate a mempool transaction, prior to broadcasting or proposing. This message should not mutate the main state, but application developers may want to keep a separate CheckTx state that gets reset upon Commit.

    CheckTx can happen interspersed with DeliverTx, but they happen on different connections - CheckTx from the mempool connection, and DeliverTx from the consensus connection. During Commit, the mempool is locked, so you can reset the mempool state to the latest state after running all those delivertxs, and then the mempool will re run whatever txs it has against that latest mempool stte

    Transactions are first run through CheckTx before broadcast to peers in the mempool layer. You can make CheckTx semi-stateful and clear the state upon Commit or BeginBlock, to allow for dependent sequences of transactions in the same block.

Commit

  • Returns:
    • Data ([]byte): The Merkle root hash
    • Log (string): Debug or error message
  • Usage:
    Return a Merkle root hash of the application state.

Query

  • Arguments:
    • Data ([]byte): Raw query bytes. Can be used with or in lieu of Path.
    • Path (string): Path of request, like an HTTP GET path. Can be used with or in liue of Data.
      • Apps MUST interpret '/store' as a query by key on the underlying store. The key SHOULD be specified in the Data field.
      • Apps SHOULD allow queries over specific types like '/accounts/...' or '/votes/...'
    • Height (uint64): The block height for which you want the query (default=0 returns data for the latest committed block)
    • Prove (bool): Return Merkle proof with response if possible
  • Returns:
    • Code (uint32): Response code
    • Key ([]byte): The key of the matching data
    • Value ([]byte): The value of the matching data
    • Proof ([]byte): Proof for the data, if requested
    • Height (uint64): The block height from which data was derived
    • Log (string): Debug or error message Please note The current implementation of go-merkle doesn't support querying proofs from past blocks, so for the present moment, any height other than 0 will return an error. Hopefully this will be improved soon(ish)

Flush

  • Usage:
    Flush the response queue. Applications that implement types.Application need not implement this message -- it's handled by the project.

Info

  • Returns:
    • Data ([]byte): The info bytes
  • Usage:
    Return information about the application state. Application specific.

SetOption

  • Arguments:
    • Key (string): Key to set
    • Value (string): Value to set for key
  • Returns:
    • Log (string): Debug or error message
  • Usage:
    Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection. Other options are application specific.

InitChain

  • Arguments:
    • Validators ([]Validator): Initial genesis validators
  • Usage:
    Called once upon genesis

BeginBlock

  • Arguments:
    • Height (uint64): The block height that is starting
  • Usage:
    Signals the beginning of a new block. Called prior to any DeliverTxs.

EndBlock

  • Arguments:
    • Height (uint64): The block height that ended
  • Returns:
    • Validators ([]Validator): Changed validators with new voting powers (0 to remove)
  • Usage:
    Signals the end of a block. Called prior to each Commit after all transactions

Changelog

Mar 26h, 2016
  • Introduce BeginBlock
Mar 6th, 2016
  • Added InitChain, EndBlock
Feb 14th, 2016
  • s/GetHash/Commit/g
  • Document Protobuf request/response fields
Jan 23th, 2016
  • Added CheckTx/Query ABCI message types
  • Added Result/Log fields to DeliverTx/CheckTx/SetOption
  • Removed Listener messages
  • Removed Code from ResponseSetOption and ResponseGetHash
  • Made examples BigEndian
Jan 12th, 2016
  • Added "RetCodeBadNonce = 0x06" return code
Jan 8th, 2016
  • Tendermint/ABCI now comes to consensus on the order first before DeliverTx.