/tendermint

⟁ Tendermint Core (BFT Consensus) in Go

Primary LanguageGoOtherNOASSERTION

Tendermint

更新内容说明

1、leader由随机数触发更换(state/execution.go updateState函数中
2、leader更换后会在etcd中更新新leader的ip和端口(PS:新产生的leader后的下一个区块会由第三个节点发放,但是只产生这一个区块后,就会一直由新leader接管)
3、新的leader产生后,会从区块数据库中回滚没处理完的rtx交易,并且发布一个checkpoint交易记录(这条tx会出现“Timed out waiting for tx to be included in a block”的错误日志,可能没被成功写入)
4、只有leader会执行applyblcok中的blockExec.CheckRelayTxs(block)函数
blockExec.CheckRelayTxs(block)实现的主要功能:
CheckCommitedBlock部分
1、检测即将被commit的区块中tx的Txtype是否是relaytx,如果是则发送给相应的reciver区块,并且加入leader节点的内存数据库中
2、检测即将被commit的区块中tx的Txtype是否是addtx,如果是,则需要将内存数据库中对应relaytx删除掉
UpdateRelaytxDB()部分
3、更新内存中的relaytx数据库的状态,如果有rtx已经过了20个区块还没有被确认,需要重新发送一次。也可能是对方区块已接收,返回addtx时候丢失,这种情况开可以根据发送时候返回的日志,如果是“Error on broadcastTxCommit: Tx already exists in cache”,则将内存数据库中对应relaytx删除掉
发送checkpoint部分
4、每20个,更新一次checkpoint。从内存数据库中拿到所有的tx,转化成tx格式(用sender写发送时候区块高度)

Byzantine-Fault Tolerant State Machines. Or Blockchain, for short.

version API Reference Go version riot.im license

Branch Tests Coverage
master CircleCI codecov
develop CircleCI codecov

Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state transition machine - written in any programming language - and securely replicates it on many machines.

For protocol details, see the specification.

For detailed analysis of the consensus protocol, including safety and liveness proofs, see our recent paper, "The latest gossip on BFT consensus".

A Note on Production Readiness

While Tendermint is being used in production in private, permissioned environments, we are still working actively to harden and audit it in preparation for use in public blockchains, such as the Cosmos Network. We are also still making breaking changes to the protocol and the APIs. Thus, we tag the releases as alpha software.

In any case, if you intend to run Tendermint in production, please contact us and join the chat.

Security

To report a security vulnerability, see our bug bounty program

For examples of the kinds of bugs we're looking for, see SECURITY.md

Minimum requirements

Requirement Notes
Go version Go1.11.4 or higher

Documentation

Complete documentation can be found on the website.

Install

See the install instructions

Quick Start

Contributing

Please abide by the Code of Conduct in all interactions, and the contributing guidelines when submitting code.

Join the larger community on the forum and the chat.

To learn more about the structure of the software, watch the Developer Sessions and read some Architectural Decision Records.

Learn more by reading the code and comparing it to the specification.

Versioning

Semantic Versioning

Tendermint uses Semantic Versioning to determine when and how the version changes. According to SemVer, anything in the public API can change at any time before version 1.0.0

To provide some stability to Tendermint users in these 0.X.X days, the MINOR version is used to signal breaking changes across a subset of the total public API. This subset includes all interfaces exposed to other processes (cli, rpc, p2p, etc.), but does not include the in-process Go APIs.

That said, breaking changes in the following packages will be documented in the CHANGELOG even if they don't lead to MINOR version bumps:

  • crypto
  • types
  • rpc/client
  • config
  • node
  • libs
    • bech32
    • common
    • db
    • errors
    • log

Exported objects in these packages that are not covered by the versioning scheme are explicitly marked by // UNSTABLE in their go doc comment and may change at any time without notice. Functions, types, and values in any other package may also change at any time.

Upgrades

In an effort to avoid accumulating technical debt prior to 1.0.0, we do not guarantee that breaking changes (ie. bumps in the MINOR version) will work with existing tendermint blockchains. In these cases you will have to start a new blockchain, or write something custom to get the old data into the new chain.

However, any bump in the PATCH version should be compatible with existing histories (if not please open an issue).

For more information on upgrading, see UPGRADING.md

Resources

Tendermint Core

For details about the blockchain data structures and the p2p protocols, see the Tendermint specification.

For details on using the software, see the documentation which is also hosted at: https://tendermint.com/docs/

Tools

Benchmarking and monitoring is provided by tm-bench and tm-monitor, respectively. Their code is found here and these binaries need to be built seperately. Additional documentation is found here.

Sub-projects

  • Amino, reflection-based proto3, with interfaces
  • IAVL, Merkleized IAVL+ Tree implementation

Applications

Research