This repository contains the source code for TxVM and related components of the Chain Protocol. It also contains command line tools for creating, manipulating, and evaluating TxVM programs, transactions, blocks, and blockchains.
TxVM is a new model for blockchain transactions. TxVM seeks to achieve the expressiveness and flexibility of an imperative contract model such as Ethereum's while maintaining the efficiency, safety, and scalability of a declarative transaction model such as Bitcoin's.
- TxVM White Paper
- TxVM Specification
- Documentation for TxVM command line tools
- Presentation and slides
You’ll need Go version 1.11 or later.
Depending on the version of Go you’re using,
and where you choose to put your copy of the TxVM code,
you may need to set the environment variable
Run the following command:
go get github.com/chain/txvm/...
go test -race -cover github.com/chain/txvm/...
In TxVM, each transaction is a single program, whose execution produces a log of desired (and authorized) effects to be applied to the blockchain state.
Here's the bytecode for an example transaction:
To inspect the assembly language for this transaction,
you can pass it to the disassembler,
> echo $BIGTXPROGRAM | hex -d | asm -d
To compute its transaction log:
> echo $BIGTXPROGRAM | hex -d | tx log
For more on the commands
txvm makes available,
you can check out the
Chain has adopted the code of conduct defined by the Contributor Covenant. It can be read in full here.
Contributors must have signed the Contributor License Agreement.
The code in this repository is licensed under version 2.0 of the Apache License.