Ethan Buchman 37b5cca87c | 8 years ago | |
---|---|---|
client | 8 years ago | |
cmd | 8 years ago | |
example | 8 years ago | |
server | 8 years ago | |
tests | 8 years ago | |
testutil | 9 years ago | |
types | 8 years ago | |
.gitignore | 9 years ago | |
LICENSE | 9 years ago | |
Makefile | 8 years ago | |
README.md | 8 years ago | |
circle.yml | 8 years ago | |
glide.lock | 8 years ago | |
glide.yaml | 8 years ago |
Blockchains are a system for creating shared multi-master application state. TMSP is a socket protocol enabling a blockchain consensus engine, running in one process, to manage a blockchain application state, running in another.
For more information on TMSP, motivations, and tutorials, please visit our blog post.
Other implementations:
This repository holds a number of important pieces:
types/types.proto
make protoc
protoc --help
and the grpc docs for examples and details of other languagesgolang implementation of TMSP client and server
cmd/tmsp-cli
tmsp-cli --version
to get the TMSP versionexamples:
cmd/counter
application, which illustrates nonce checking in txscmd/dummy
application, which illustrates a simple key-value merkle treeSince 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 TMSP message is 0xDEADBEEF
(4 bytes), the length-prefixed message is 0x0104DEADBEEF
. If the Protobuf3 encoded TMSP message is 65535 bytes long, the length-prefixed message would be like 0x02FFFF...
.
Note this prefixing does not apply for grpc.
TMSP requests/responses are simple Protobuf messages. Check out the schema file.
Data ([]byte)
: The request transaction bytesCode (uint32)
: Response codeData ([]byte)
: Result bytes, if anyLog (string)
: Debug or error messageArguments:
Data ([]byte)
: The request transaction bytesReturns:
Code (uint32)
: Response codeData ([]byte)
: Result bytes, if anyLog (string)
: Debug or error messageUsage:
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 AppendTx, but they happen on different connections - CheckTx from the mempool connection, and AppendTx 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 appendtxs, 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.
Data ([]byte)
: The Merkle root hashLog (string)
: Debug or error messageData ([]byte)
: The query request bytesCode (uint32)
: Response codeData ([]byte)
: The query response bytesLog (string)
: Debug or error messagetypes.Application
need not implement this message -- it's handled by the project.Data ([]byte)
: The info bytesKey (string)
: Key to setValue (string)
: Value to set for keyLog (string)
: Debug or error messageValidators ([]Validator)
: Initial genesis validatorsHeight (uint64)
: The block height that is startingHeight (uint64)
: The block height that endedValidators ([]Validator)
: Changed validators with new voting powers (0 to remove)