mirror of
https://github.com/tendermint/tendermint.git
synced 2026-07-19 14:32:21 +00:00
docs: Update all docs to prepare for v0.37 (#9243)
* Update docs references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update DOCS_README to reflect current reality Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update vuepress config with current versions and updated discussions link Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update generated docs versions Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update docs build to use temp folder instead of home Signed-off-by: Thane Thomson <connect@thanethomson.com> * Document build-docs Makefile target Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add serve-docs Makefile target to serve local build of docs Signed-off-by: Thane Thomson <connect@thanethomson.com> * Ensure 404 page is copied during docs build Signed-off-by: Thane Thomson <connect@thanethomson.com> * Redirect /master/ to /main/ Signed-off-by: Thane Thomson <connect@thanethomson.com> * Attempt to resolve #7908 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update OpenAPI references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update CHANGELOG references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update Docker readme references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update UPGRADING references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update package-specific documentation references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update spec references from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update all code comment references to docs site from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Build v0.34.x as "latest" Signed-off-by: Thane Thomson <connect@thanethomson.com> * Explicitly mark v0.34 docs as latest in version selector Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update all links from docs.tendermint.com/main to docs.tendermint.com/latest Signed-off-by: Thane Thomson <connect@thanethomson.com> * ci: Redeploy docs on pushes to v0.34.x Signed-off-by: Thane Thomson <connect@thanethomson.com> * Temporarily copy spec directory into docs while building Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add nav link to main and clearly mark as unstable Signed-off-by: Thane Thomson <connect@thanethomson.com> * Revert to only publishing docs in nav for v0.34 and v0.33 with no latest Signed-off-by: Thane Thomson <connect@thanethomson.com> * Link to docs.tendermint.com/v0.34 from RFCs Signed-off-by: Thane Thomson <connect@thanethomson.com> * Rather just use main for all docs.tendermint.com references on main branch Signed-off-by: Thane Thomson <connect@thanethomson.com> * Rename GitHub tree links from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update link for ABCI Rust client Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update github links from master to main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update badges in root readme Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove codecov badge since we do not use it any more Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove Java and Kotlin tutorials Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove specs from docs build Signed-off-by: Thane Thomson <connect@thanethomson.com> * Migrate spec links to GitHub repo from docs site Signed-off-by: Thane Thomson <connect@thanethomson.com> * Remove references to non-existent PEX reactor spec Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix linting badge in README Signed-off-by: Thane Thomson <connect@thanethomson.com> Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -8,6 +8,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- v0.34.x
|
||||
paths:
|
||||
- docs/**
|
||||
- spec/**
|
||||
@@ -40,7 +41,7 @@ jobs:
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-output
|
||||
path: ~/output/
|
||||
path: /tmp/tendermint-core-docs
|
||||
|
||||
deploy:
|
||||
name: Deploy to GitHub Pages
|
||||
|
||||
+14
-14
@@ -438,7 +438,7 @@ Special thanks to external contributors on this release: @james-ray, @fedekunze,
|
||||
- [abci] [\#5174](https://github.com/tendermint/tendermint/pull/5174) Remove `MockEvidence` in favor of testing with actual evidence types (`DuplicateVoteEvidence` & `LightClientAttackEvidence`) (@cmwaters)
|
||||
- [abci] [\#5191](https://github.com/tendermint/tendermint/pull/5191) Add `InitChain.InitialHeight` field giving the initial block height (@erikgrinaker)
|
||||
- [abci] [\#5227](https://github.com/tendermint/tendermint/pull/5227) Add `ResponseInitChain.app_hash` which is recorded in genesis block (@erikgrinaker)
|
||||
- [config] [\#5147](https://github.com/tendermint/tendermint/pull/5147) Add `--consensus.double_sign_check_height` flag and `DoubleSignCheckHeight` config variable. See [ADR-51](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-051-double-signing-risk-reduction.md) (@dongsam)
|
||||
- [config] [\#5147](https://github.com/tendermint/tendermint/pull/5147) Add `--consensus.double_sign_check_height` flag and `DoubleSignCheckHeight` config variable. See [ADR-51](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-051-double-signing-risk-reduction.md) (@dongsam)
|
||||
- [db] [\#5233](https://github.com/tendermint/tendermint/pull/5233) Add support for `badgerdb` database backend (@erikgrinaker)
|
||||
- [evidence] [\#4532](https://github.com/tendermint/tendermint/pull/4532) Handle evidence from light clients (@melekes)
|
||||
- [evidence] [#4821](https://github.com/tendermint/tendermint/pull/4821) Amnesia (light client attack) evidence can be detected, verified and committed (@cmwaters)
|
||||
@@ -452,7 +452,7 @@ Special thanks to external contributors on this release: @james-ray, @fedekunze,
|
||||
- [rpc] [\#5017](https://github.com/tendermint/tendermint/pull/5017) Add `/check_tx` endpoint to check transactions without executing them or adding them to the mempool (@melekes)
|
||||
- [rpc] [\#5108](https://github.com/tendermint/tendermint/pull/5108) Subscribe using the websocket for new evidence events (@cmwaters)
|
||||
- [statesync] Add state sync support, where a new node can be rapidly bootstrapped by fetching state snapshots from peers instead of replaying blocks. See the `[statesync]` config section.
|
||||
- [evidence] [\#5361](https://github.com/tendermint/tendermint/pull/5361) Add LightClientAttackEvidence and refactor evidence lifecycle - for more information see [ADR-059](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-059-evidence-composition-and-lifecycle.md) (@cmwaters)
|
||||
- [evidence] [\#5361](https://github.com/tendermint/tendermint/pull/5361) Add LightClientAttackEvidence and refactor evidence lifecycle - for more information see [ADR-059](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-059-evidence-composition-and-lifecycle.md) (@cmwaters)
|
||||
|
||||
### IMPROVEMENTS
|
||||
|
||||
@@ -532,7 +532,7 @@ This security release fixes:
|
||||
Tendermint 0.33.0 and above allow block proposers to include signatures for the
|
||||
wrong block. This may happen naturally if you start a network, have it run for
|
||||
some time and restart it **without changing the chainID**. (It is a
|
||||
[misconfiguration](https://docs.tendermint.com/master/tendermint-core/using-tendermint.html)
|
||||
[misconfiguration](https://docs.tendermint.com/v0.33/tendermint-core/using-tendermint.html)
|
||||
to reuse chainIDs.) Correct block proposers will accidentally include signatures
|
||||
for the wrong block if they see these signatures, and then commits won't validate,
|
||||
making all proposed blocks invalid. A malicious validator (even with a minimal
|
||||
@@ -831,7 +831,7 @@ and a validator address plus a timestamp. Note we may remove the validator
|
||||
address & timestamp fields in the future (see ADR-25).
|
||||
|
||||
`lite2` package has been added to solve `lite` issues and introduce weak
|
||||
subjectivity interface. Refer to the [spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md) for complete details.
|
||||
subjectivity interface. Refer to the [spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client.md) for complete details.
|
||||
`lite` package is now deprecated and will be removed in v0.34 release.
|
||||
|
||||
### BREAKING CHANGES:
|
||||
@@ -1192,7 +1192,7 @@ Special thanks to external contributors on this release: @jon-certik, @gracenoah
|
||||
*August 28, 2019*
|
||||
|
||||
@climber73 wrote the [Writing a Tendermint Core application in Java
|
||||
(gRPC)](https://github.com/tendermint/tendermint/blob/master/docs/guides/java.md)
|
||||
(gRPC)](https://github.com/tendermint/tendermint/blob/main/docs/guides/java.md)
|
||||
guide.
|
||||
|
||||
Special thanks to external contributors on this release:
|
||||
@@ -1225,7 +1225,7 @@ Special thanks to external contributors on this release:
|
||||
|
||||
### FEATURES:
|
||||
|
||||
- [blockchain] [\#3561](https://github.com/tendermint/tendermint/issues/3561) Add early version of the new blockchain reactor, which is supposed to be more modular and testable compared to the old version. To try it, you'll have to change `version` in the config file, [here](https://github.com/tendermint/tendermint/blob/master/config/toml.go#L303) NOTE: It's not ready for a production yet. For further information, see [ADR-40](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-040-blockchain-reactor-refactor.md) & [ADR-43](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-043-blockchain-riri-org.md)
|
||||
- [blockchain] [\#3561](https://github.com/tendermint/tendermint/issues/3561) Add early version of the new blockchain reactor, which is supposed to be more modular and testable compared to the old version. To try it, you'll have to change `version` in the config file, [here](https://github.com/tendermint/tendermint/blob/main/config/toml.go#L303) NOTE: It's not ready for a production yet. For further information, see [ADR-40](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-040-blockchain-reactor-refactor.md) & [ADR-43](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-043-blockchain-riri-org.md)
|
||||
- [mempool] [\#3826](https://github.com/tendermint/tendermint/issues/3826) Make `max_msg_bytes` configurable(@bluele)
|
||||
- [node] [\#3846](https://github.com/tendermint/tendermint/pull/3846) Allow replacing existing p2p.Reactor(s) using [`CustomReactors`
|
||||
option](https://godoc.org/github.com/tendermint/tendermint/node#CustomReactors).
|
||||
@@ -1542,7 +1542,7 @@ Special thanks to external contributors on this release:
|
||||
- [libs/db] [\#3611](https://github.com/tendermint/tendermint/issues/3611) Conditional compilation
|
||||
* Use `cleveldb` tag instead of `gcc` to compile Tendermint with CLevelDB or
|
||||
use `make build_c` / `make install_c` (full instructions can be found at
|
||||
https://docs.tendermint.com/master/introduction/install.html#compile-with-cleveldb-support)
|
||||
<https://docs.tendermint.com>)
|
||||
* Use `boltdb` tag to compile Tendermint with bolt db
|
||||
- [node] [\#3362](https://github.com/tendermint/tendermint/issues/3362) Return an error if `persistent_peers` list is invalid (except
|
||||
when IP lookup fails)
|
||||
@@ -1766,7 +1766,7 @@ more details.
|
||||
- [rpc] [\#3269](https://github.com/tendermint/tendermint/issues/2826) Limit number of unique clientIDs with open subscriptions. Configurable via `rpc.max_subscription_clients`
|
||||
- [rpc] [\#3269](https://github.com/tendermint/tendermint/issues/2826) Limit number of unique queries a given client can subscribe to at once. Configurable via `rpc.max_subscriptions_per_client`.
|
||||
- [rpc] [\#3435](https://github.com/tendermint/tendermint/issues/3435) Default ReadTimeout and WriteTimeout changed to 10s. WriteTimeout can increased by setting `rpc.timeout_broadcast_tx_commit` in the config.
|
||||
- [rpc/client] [\#3269](https://github.com/tendermint/tendermint/issues/3269) Update `EventsClient` interface to reflect new pubsub/eventBus API [ADR-33](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-033-pubsub.md). This includes `Subscribe`, `Unsubscribe`, and `UnsubscribeAll` methods.
|
||||
- [rpc/client] [\#3269](https://github.com/tendermint/tendermint/issues/3269) Update `EventsClient` interface to reflect new pubsub/eventBus API [ADR-33](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-033-pubsub.md). This includes `Subscribe`, `Unsubscribe`, and `UnsubscribeAll` methods.
|
||||
|
||||
* Apps
|
||||
- [abci] [\#3403](https://github.com/tendermint/tendermint/issues/3403) Remove `time_iota_ms` from BlockParams. This is a
|
||||
@@ -1819,7 +1819,7 @@ more details.
|
||||
- [blockchain] [\#3358](https://github.com/tendermint/tendermint/pull/3358) Fix timer leak in `BlockPool` (@guagualvcha)
|
||||
- [cmd] [\#3408](https://github.com/tendermint/tendermint/issues/3408) Fix `testnet` command's panic when creating non-validator configs (using `--n` flag) (@srmo)
|
||||
- [libs/db/remotedb/grpcdb] [\#3402](https://github.com/tendermint/tendermint/issues/3402) Close Iterator/ReverseIterator after use
|
||||
- [libs/pubsub] [\#951](https://github.com/tendermint/tendermint/issues/951), [\#1880](https://github.com/tendermint/tendermint/issues/1880) Use non-blocking send when dispatching messages [ADR-33](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-033-pubsub.md)
|
||||
- [libs/pubsub] [\#951](https://github.com/tendermint/tendermint/issues/951), [\#1880](https://github.com/tendermint/tendermint/issues/1880) Use non-blocking send when dispatching messages [ADR-33](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-033-pubsub.md)
|
||||
- [lite] [\#3364](https://github.com/tendermint/tendermint/issues/3364) Fix `/validators` and `/abci_query` proxy endpoints
|
||||
(@guagualvcha)
|
||||
- [p2p/conn] [\#3347](https://github.com/tendermint/tendermint/issues/3347) Reject all-zero shared secrets in the Diffie-Hellman step of secret-connection
|
||||
@@ -2517,7 +2517,7 @@ Special thanks to external contributors on this release:
|
||||
This release is mostly about the ConsensusParams - removing fields and enforcing MaxGas.
|
||||
It also addresses some issues found via security audit, removes various unused
|
||||
functions from `libs/common`, and implements
|
||||
[ADR-012](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-012-peer-transport.md).
|
||||
[ADR-012](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-012-peer-transport.md).
|
||||
|
||||
BREAKING CHANGES:
|
||||
|
||||
@@ -2598,7 +2598,7 @@ BREAKING CHANGES:
|
||||
- [abci] Added address of the original proposer of the block to Header
|
||||
- [abci] Change ABCI Header to match Tendermint exactly
|
||||
- [abci] [\#2159](https://github.com/tendermint/tendermint/issues/2159) Update use of `Validator` (see
|
||||
[ADR-018](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-018-ABCI-Validators.md)):
|
||||
[ADR-018](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-018-ABCI-Validators.md)):
|
||||
- Remove PubKey from `Validator` (so it's just Address and Power)
|
||||
- Introduce `ValidatorUpdate` (with just PubKey and Power)
|
||||
- InitChain and EndBlock use ValidatorUpdate
|
||||
@@ -2620,7 +2620,7 @@ BREAKING CHANGES:
|
||||
- [state] [\#1815](https://github.com/tendermint/tendermint/issues/1815) Validator set changes are now delayed by one block (!)
|
||||
- Add NextValidatorSet to State, changes on-disk representation of state
|
||||
- [state] [\#2184](https://github.com/tendermint/tendermint/issues/2184) Enforce ConsensusParams.BlockSize.MaxBytes (See
|
||||
[ADR-020](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-020-block-size.md)).
|
||||
[ADR-020](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-020-block-size.md)).
|
||||
- Remove ConsensusParams.BlockSize.MaxTxs
|
||||
- Introduce maximum sizes for all components of a block, including ChainID
|
||||
- [types] Updates to the block Header:
|
||||
@@ -2631,7 +2631,7 @@ BREAKING CHANGES:
|
||||
- [consensus] [\#2203](https://github.com/tendermint/tendermint/issues/2203) Implement BFT time
|
||||
- Timestamp in block must be monotonic and equal the median of timestamps in block's LastCommit
|
||||
- [crypto] [\#2239](https://github.com/tendermint/tendermint/issues/2239) Secp256k1 signature changes (See
|
||||
[ADR-014](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-014-secp-malleability.md)):
|
||||
[ADR-014](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-014-secp-malleability.md)):
|
||||
- format changed from DER to `r || s`, both little endian encoded as 32 bytes.
|
||||
- malleability removed by requiring `s` to be in canonical form.
|
||||
|
||||
@@ -3431,7 +3431,7 @@ Also includes the Grand Repo-Merge of 2017.
|
||||
BREAKING CHANGES:
|
||||
|
||||
- Config and Flags:
|
||||
- The `config` map is replaced with a [`Config` struct](https://github.com/tendermint/tendermint/blob/master/config/config.go#L11),
|
||||
- The `config` map is replaced with a [`Config` struct](https://github.com/tendermint/tendermint/blob/main/config/config.go#L11),
|
||||
containing substructs: `BaseConfig`, `P2PConfig`, `MempoolConfig`, `ConsensusConfig`, `RPCConfig`
|
||||
- This affects the following flags:
|
||||
- `--seeds` is now `--p2p.seeds`
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ will indicate their support with a heartfelt emoji.
|
||||
|
||||
If the issue would benefit from thorough discussion, maintainers may
|
||||
request that you create a [Request For
|
||||
Comment](https://github.com/tendermint/spec/tree/master/rfc)
|
||||
Comment](https://github.com/tendermint/tendermint/tree/main/docs/rfc)
|
||||
in the Tendermint spec repo. Discussion
|
||||
at the RFC stage will build collective understanding of the dimensions
|
||||
of the problems and help structure conversations around trade-offs.
|
||||
|
||||
+6
-6
@@ -6,7 +6,7 @@ DockerHub tags for official releases are [here](https://hub.docker.com/r/tenderm
|
||||
|
||||
Official releases can be found [here](https://github.com/tendermint/tendermint/releases).
|
||||
|
||||
The Dockerfile for tendermint is not expected to change in the near future. The master file used for all builds can be found [here](https://raw.githubusercontent.com/tendermint/tendermint/master/DOCKER/Dockerfile).
|
||||
The Dockerfile for Tendermint is not expected to change in the near future. The main file used for all builds can be found [here](https://raw.githubusercontent.com/tendermint/tendermint/main/DOCKER/Dockerfile).
|
||||
|
||||
Respective versioned files can be found <https://raw.githubusercontent.com/tendermint/tendermint/vX.XX.XX/DOCKER/Dockerfile> (replace the Xs with the version number).
|
||||
|
||||
@@ -20,9 +20,9 @@ Respective versioned files can be found <https://raw.githubusercontent.com/tende
|
||||
|
||||
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 more background, see the [the docs](https://docs.tendermint.com/master/introduction/#quick-start).
|
||||
For more background, see the [the docs](https://docs.tendermint.com/main/introduction/#quick-start).
|
||||
|
||||
To get started developing applications, see the [application developers guide](https://docs.tendermint.com/master/introduction/quick-start.html).
|
||||
To get started developing applications, see the [application developers guide](https://docs.tendermint.com/main/introduction/quick-start.html).
|
||||
|
||||
## How to use this image
|
||||
|
||||
@@ -37,7 +37,7 @@ docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app
|
||||
|
||||
## Local cluster
|
||||
|
||||
To run a 4-node network, see the `Makefile` in the root of [the repo](https://github.com/tendermint/tendermint/blob/master/Makefile) and run:
|
||||
To run a 4-node network, see the `Makefile` in the root of [the repo](https://github.com/tendermint/tendermint/blob/main/Makefile) and run:
|
||||
|
||||
```sh
|
||||
make build-linux
|
||||
@@ -49,8 +49,8 @@ Note that this will build and use a different image than the ones provided here.
|
||||
|
||||
## License
|
||||
|
||||
- Tendermint's license is [Apache 2.0](https://github.com/tendermint/tendermint/blob/master/LICENSE).
|
||||
- Tendermint's license is [Apache 2.0](https://github.com/tendermint/tendermint/blob/main/LICENSE).
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are most welcome! See the [contributing file](https://github.com/tendermint/tendermint/blob/master/CONTRIBUTING.md) for more information.
|
||||
Contributions are most welcome! See the [contributing file](https://github.com/tendermint/tendermint/blob/main/CONTRIBUTING.md) for more information.
|
||||
|
||||
@@ -285,16 +285,30 @@ DESTINATION = ./index.html.md
|
||||
### Documentation ###
|
||||
###############################################################################
|
||||
|
||||
DOCS_OUTPUT?=/tmp/tendermint-core-docs
|
||||
|
||||
# This builds a docs site for each branch/tag in `./docs/versions` and copies
|
||||
# each site to a version prefixed path. The last entry inside the `versions`
|
||||
# file will be the default root index.html
|
||||
build-docs:
|
||||
@cd docs && \
|
||||
while read -r branch path_prefix; do \
|
||||
(git checkout $${branch} && npm ci && VUEPRESS_BASE="/$${path_prefix}/" npm run build) ; \
|
||||
mkdir -p ~/output/$${path_prefix} ; \
|
||||
cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \
|
||||
cp ~/output/$${path_prefix}/index.html ~/output ; \
|
||||
mkdir -p $(DOCS_OUTPUT)/$${path_prefix} ; \
|
||||
cp -r .vuepress/dist/* $(DOCS_OUTPUT)/$${path_prefix}/ ; \
|
||||
cp $(DOCS_OUTPUT)/$${path_prefix}/index.html $(DOCS_OUTPUT) ; \
|
||||
cp $(DOCS_OUTPUT)/$${path_prefix}/404.html $(DOCS_OUTPUT) ; \
|
||||
done < versions ;
|
||||
.PHONY: build-docs
|
||||
|
||||
# Build and serve the local version of the docs on the current branch from
|
||||
# http://0.0.0.0:8080
|
||||
serve-docs:
|
||||
@cd docs && \
|
||||
npm ci && \
|
||||
npm run serve
|
||||
.PHONY: serve-docs
|
||||
|
||||
sync-docs:
|
||||
cd ~/output && \
|
||||
echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \
|
||||
|
||||
@@ -10,12 +10,11 @@
|
||||
[![Go version][go-badge]][go-url]
|
||||
[![Discord chat][discord-badge]][discord-url]
|
||||
[![License][license-badge]][license-url]
|
||||
[![tendermint/tendermint][loc-badge]][loc-url]
|
||||
[![Sourcegraph][sg-badge]][sg-url]
|
||||
|
||||
| Branch | Tests | Coverage | Linting |
|
||||
|--------|-----------------------|------------------------------------------|---------------------|
|
||||
| main | ![Tests][tests-badge] | [![codecov][codecov-badge]][codecov-url] | ![Lint][lint-badge] |
|
||||
| Branch | Tests | Linting |
|
||||
|--------|------------------------------------|---------------------------------|
|
||||
| main | [![Tests][tests-badge]][tests-url] | [![Lint][lint-badge]][lint-url] |
|
||||
|
||||
Tendermint Core is a Byzantine Fault Tolerant (BFT) middleware that takes a
|
||||
state transition machine - written in any programming language - and securely
|
||||
@@ -155,7 +154,6 @@ Funding for Tendermint Core development comes primarily from the
|
||||
Tendermint trademark is owned by [Tendermint Inc.](https://tendermint.com), the
|
||||
for-profit entity that also maintains [tendermint.com](https://tendermint.com).
|
||||
|
||||
|
||||
[bft]: https://en.wikipedia.org/wiki/Byzantine_fault_tolerance
|
||||
[smr]: https://en.wikipedia.org/wiki/State_machine_replication
|
||||
[Blockchain]: https://en.wikipedia.org/wiki/Blockchain
|
||||
@@ -163,17 +161,15 @@ for-profit entity that also maintains [tendermint.com](https://tendermint.com).
|
||||
[version-url]: https://github.com/tendermint/tendermint/releases/latest
|
||||
[api-badge]: https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667
|
||||
[api-url]: https://pkg.go.dev/github.com/tendermint/tendermint
|
||||
[go-badge]: https://img.shields.io/badge/go-1.17-blue.svg
|
||||
[go-badge]: https://img.shields.io/badge/go-1.18-blue.svg
|
||||
[go-url]: https://github.com/moovweb/gvm
|
||||
[discord-badge]: https://img.shields.io/discord/669268347736686612.svg
|
||||
[discord-url]: https://discord.gg/cosmosnetwork
|
||||
[license-badge]: https://img.shields.io/github/license/tendermint/tendermint.svg
|
||||
[license-url]: https://github.com/tendermint/tendermint/blob/main/LICENSE
|
||||
[loc-badge]: https://tokei.rs/b1/github/tendermint/tendermint?category=lines
|
||||
[loc-url]: https://github.com/tendermint/tendermint
|
||||
[sg-badge]: https://sourcegraph.com/github.com/tendermint/tendermint/-/badge.svg
|
||||
[sg-url]: https://sourcegraph.com/github.com/tendermint/tendermint?badge
|
||||
[tests-badge]: https://github.com/tendermint/tendermint/workflows/Tests/badge.svg?branch=main
|
||||
[codecov-badge]: https://codecov.io/gh/tendermint/tendermint/branch/main/graph/badge.svg
|
||||
[codecov-url]: https://codecov.io/gh/tendermint/tendermint
|
||||
[lint-badge]: https://github.com/tendermint/tendermint/workflows/Lint/badge.svg
|
||||
[tests-url]: https://github.com/tendermint/tendermint/actions/workflows/tests.yml
|
||||
[tests-badge]: https://github.com/tendermint/tendermint/actions/workflows/tests.yml/badge.svg?branch=main
|
||||
[lint-badge]: https://github.com/tendermint/tendermint/actions/workflows/lint.yml/badge.svg
|
||||
[lint-url]: https://github.com/tendermint/tendermint/actions/workflows/lint.yml
|
||||
|
||||
+8
-8
@@ -30,7 +30,7 @@ and gas cost).
|
||||
Operators can enable the priority mempool by setting `mempool.version` to
|
||||
`"v1"` in the `config.toml`. For more technical details about the priority
|
||||
mempool, see [ADR 067: Mempool
|
||||
Refactor](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-067-mempool-refactor.md).
|
||||
Refactor](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-067-mempool-refactor.md).
|
||||
|
||||
## v0.34.0
|
||||
|
||||
@@ -48,7 +48,7 @@ Note also that Tendermint 0.34 also requires Go 1.15 or higher.
|
||||
were added to support the new State Sync feature.
|
||||
Previously, syncing a new node to a preexisting network could take days; but with State Sync,
|
||||
new nodes are able to join a network in a matter of seconds.
|
||||
Read [the spec](https://docs.tendermint.com/master/spec/abci/apps.html#state-sync)
|
||||
Read [the spec](https://github.com/tendermint/tendermint/blob/v0.34.x/spec/abci/apps.md#state-sync)
|
||||
if you want to learn more about State Sync, or if you'd like your application to use it.
|
||||
(If you don't want to support State Sync in your application, you can just implement these new
|
||||
ABCI methods as no-ops, leaving them empty.)
|
||||
@@ -64,7 +64,7 @@ Note also that Tendermint 0.34 also requires Go 1.15 or higher.
|
||||
Applications should be able to handle these evidence types
|
||||
(i.e., through slashing or other accountability measures).
|
||||
|
||||
* The [`PublicKey` type](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/crypto/keys.proto#L13-L15)
|
||||
* The [`PublicKey` type](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/crypto/keys.proto#L13-L15)
|
||||
(used in ABCI as part of `ValidatorUpdate`) now uses a `oneof` protobuf type.
|
||||
Note that since Tendermint only supports ed25519 validator keys, there's only one
|
||||
option in the `oneof`. For more, see "Protocol Buffers," below.
|
||||
@@ -174,7 +174,7 @@ The `bech32` package has moved to the Cosmos SDK:
|
||||
### CLI
|
||||
|
||||
The `tendermint lite` command has been renamed to `tendermint light` and has a slightly different API.
|
||||
See [the docs](https://docs.tendermint.com/master/tendermint-core/light-client-protocol.html#http-proxy) for details.
|
||||
See [the docs](https://docs.tendermint.com/v0.33/tendermint-core/light-client-protocol.html#http-proxy) for details.
|
||||
|
||||
### Light Client
|
||||
|
||||
@@ -329,7 +329,7 @@ Evidence Params has been changed to include duration.
|
||||
### RPC Changes
|
||||
|
||||
* `/validators` is now paginated (default: 30 vals per page)
|
||||
* `/block_results` response format updated [see RPC docs for details](https://docs.tendermint.com/master/rpc/#/Info/block_results)
|
||||
* `/block_results` response format updated [see RPC docs for details](https://docs.tendermint.com/v0.33/rpc/#/Info/block_results)
|
||||
* Event suffix has been removed from the ID in event responses
|
||||
* IDs are now integers not `json-client-XYZ`
|
||||
|
||||
@@ -523,14 +523,14 @@ due to changes in how various data structures are hashed.
|
||||
Any implementations of Tendermint blockchain verification, including lite clients,
|
||||
will need to be updated. For specific details:
|
||||
|
||||
* [Merkle tree](https://github.com/tendermint/spec/blob/master/spec/blockchain/encoding.md#merkle-trees)
|
||||
* [ConsensusParams](https://github.com/tendermint/spec/blob/master/spec/blockchain/state.md#consensusparams)
|
||||
* [Merkle tree](https://github.com/tendermint/tendermint/blob/main/spec/blockchain/encoding.md#merkle-trees)
|
||||
* [ConsensusParams](https://github.com/tendermint/tendermint/blob/main/spec/blockchain/state.md#consensusparams)
|
||||
|
||||
There was also a small change to field ordering in the vote struct. Any
|
||||
implementations of an out-of-process validator (like a Key-Management Server)
|
||||
will need to be updated. For specific details:
|
||||
|
||||
* [Vote](https://github.com/tendermint/spec/blob/master/spec/consensus/signing.md#votes)
|
||||
* [Vote](https://github.com/tendermint/tendermint/blob/main/spec/consensus/signing.md#votes)
|
||||
|
||||
Finally, the proposer selection algorithm continues to evolve. See the
|
||||
[work-in-progress
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ To get up and running quickly, see the [getting started guide](../docs/app-dev/g
|
||||
|
||||
A detailed description of the ABCI methods and message types is contained in:
|
||||
|
||||
- [The main spec](https://github.com/tendermint/spec/blob/master/spec/abci/abci.md)
|
||||
- [The main spec](https://github.com/tendermint/tendermint/blob/main/spec/abci/abci.md)
|
||||
- [A protobuf file](./types/types.proto)
|
||||
- [A Go interface](./types/application.go)
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
# Consensus
|
||||
|
||||
See the [consensus spec](https://github.com/tendermint/spec/tree/master/spec/consensus) and the [reactor consensus spec](https://github.com/tendermint/spec/tree/master/spec/reactors/consensus) for more information.
|
||||
See the [consensus spec](https://github.com/tendermint/tendermint/tree/main/spec/consensus) and the [reactor consensus spec](https://github.com/tendermint/tendermint/tree/main/spec/reactors/consensus) for more information.
|
||||
|
||||
+9
-4
@@ -978,7 +978,9 @@ func (cs *State) handleTxsAvailable() {
|
||||
// Used internally by handleTimeout and handleMsg to make state transitions
|
||||
|
||||
// Enter: `timeoutNewHeight` by startTime (commitTime+timeoutCommit),
|
||||
// or, if SkipTimeoutCommit==true, after receiving all precommits from (height,round-1)
|
||||
//
|
||||
// or, if SkipTimeoutCommit==true, after receiving all precommits from (height,round-1)
|
||||
//
|
||||
// Enter: `timeoutPrecommits` after any +2/3 precommits from (height,round-1)
|
||||
// Enter: +2/3 precommits for nil at (height,round-1)
|
||||
// Enter: +2/3 prevotes any or +2/3 precommits for block or any from (height, round)
|
||||
@@ -1060,7 +1062,9 @@ func (cs *State) needProofBlock(height int64) bool {
|
||||
|
||||
// Enter (CreateEmptyBlocks): from enterNewRound(height,round)
|
||||
// Enter (CreateEmptyBlocks, CreateEmptyBlocksInterval > 0 ):
|
||||
// after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval
|
||||
//
|
||||
// after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval
|
||||
//
|
||||
// Enter (!CreateEmptyBlocks) : after enterNewRound(height,round), once txs are in the mempool
|
||||
func (cs *State) enterPropose(height int64, round int32) {
|
||||
logger := cs.Logger.With("height", height, "round", round)
|
||||
@@ -2221,10 +2225,11 @@ func (cs *State) voteTime() time.Time {
|
||||
now := tmtime.Now()
|
||||
minVoteTime := now
|
||||
// TODO: We should remove next line in case we don't vote for v in case cs.ProposalBlock == nil,
|
||||
// even if cs.LockedBlock != nil. See https://docs.tendermint.com/master/spec/.
|
||||
// even if cs.LockedBlock != nil. See https://github.com/tendermint/tendermint/tree/main/spec/.
|
||||
timeIota := time.Duration(cs.state.ConsensusParams.Block.TimeIotaMs) * time.Millisecond
|
||||
if cs.LockedBlock != nil {
|
||||
// See the BFT time spec https://docs.tendermint.com/master/spec/consensus/bft-time.html
|
||||
// See the BFT time spec
|
||||
// https://github.com/tendermint/tendermint/blob/main/spec/consensus/bft-time.md
|
||||
minVoteTime = cs.LockedBlock.Time.Add(timeIota)
|
||||
} else if cs.ProposalBlock != nil {
|
||||
minVoteTime = cs.ProposalBlock.Time.Add(timeIota)
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ For any specific algorithm, use its specific module e.g.
|
||||
|
||||
## Binary encoding
|
||||
|
||||
For Binary encoding, please refer to the [Tendermint encoding specification](https://docs.tendermint.com/master/spec/blockchain/encoding.html).
|
||||
For Binary encoding, please refer to the [Tendermint encoding specification](https://github.com/tendermint/tendermint/blob/main/spec/core/encoding.md).
|
||||
|
||||
## JSON Encoding
|
||||
|
||||
|
||||
+10
-24
@@ -1,14 +1,6 @@
|
||||
module.exports = {
|
||||
theme: 'cosmos',
|
||||
title: 'Tendermint Core',
|
||||
// locales: {
|
||||
// "/": {
|
||||
// lang: "en-US"
|
||||
// },
|
||||
// "/ru/": {
|
||||
// lang: "ru"
|
||||
// }
|
||||
// },
|
||||
base: process.env.VUEPRESS_BASE,
|
||||
themeConfig: {
|
||||
repo: 'tendermint/tendermint',
|
||||
@@ -23,16 +15,12 @@ module.exports = {
|
||||
},
|
||||
versions: [
|
||||
{
|
||||
"label": "v0.33",
|
||||
"key": "v0.33"
|
||||
},
|
||||
{
|
||||
"label": "v0.34",
|
||||
"label": "v0.34 (latest)",
|
||||
"key": "v0.34"
|
||||
},
|
||||
{
|
||||
"label": "v0.35",
|
||||
"key": "v0.35"
|
||||
"label": "v0.33",
|
||||
"key": "v0.33"
|
||||
}
|
||||
],
|
||||
topbar: {
|
||||
@@ -45,10 +33,8 @@ module.exports = {
|
||||
title: 'Resources',
|
||||
children: [
|
||||
{
|
||||
// TODO(creachadair): Figure out how to make this per-branch.
|
||||
// See: https://github.com/tendermint/tendermint/issues/7908
|
||||
title: 'RPC',
|
||||
path: 'https://docs.tendermint.com/v0.35/rpc/',
|
||||
path: (process.env.VUEPRESS_BASE ? process.env.VUEPRESS_BASE : '/')+'rpc/',
|
||||
static: true
|
||||
},
|
||||
]
|
||||
@@ -59,9 +45,9 @@ module.exports = {
|
||||
title: 'Help & Support',
|
||||
editLink: true,
|
||||
forum: {
|
||||
title: 'Tendermint Forum',
|
||||
text: 'Join the Tendermint forum to learn more',
|
||||
url: 'https://forum.cosmos.network/c/tendermint',
|
||||
title: 'Tendermint Discussions',
|
||||
text: 'Join the Tendermint discussions to learn more',
|
||||
url: 'https://github.com/tendermint/tendermint/discussions',
|
||||
bg: '#0B7E0B',
|
||||
logo: 'tendermint'
|
||||
},
|
||||
@@ -72,7 +58,7 @@ module.exports = {
|
||||
},
|
||||
footer: {
|
||||
question: {
|
||||
text: 'Chat with Tendermint developers in <a href=\'https://discord.gg/vcExX9T\' target=\'_blank\'>Discord</a> or reach out on the <a href=\'https://forum.cosmos.network/c/tendermint\' target=\'_blank\'>Tendermint Forum</a> to learn more.'
|
||||
text: 'Chat with Tendermint developers in <a href=\'https://discord.gg/vcExX9T\' target=\'_blank\'>Discord</a> or reach out on <a href=\'https://github.com/tendermint/tendermint/discussions\' target=\'_blank\'>GitHub</a> to learn more.'
|
||||
},
|
||||
logo: '/logo-bw.svg',
|
||||
textLink: {
|
||||
@@ -129,8 +115,8 @@ module.exports = {
|
||||
url: 'https://medium.com/@tendermint'
|
||||
},
|
||||
{
|
||||
title: 'Forum',
|
||||
url: 'https://forum.cosmos.network/c/tendermint'
|
||||
title: 'GitHub Discussions',
|
||||
url: 'https://github.com/tendermint/tendermint/discussions'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -1 +1 @@
|
||||
/master/ /v0.35/
|
||||
/master/ /main/
|
||||
|
||||
+30
-23
@@ -2,39 +2,38 @@
|
||||
|
||||
The documentation for Tendermint Core is hosted at:
|
||||
|
||||
- <https://docs.tendermint.com/master/>
|
||||
- <https://docs.tendermint.com>
|
||||
|
||||
built from the files in this (`/docs`) directory for
|
||||
[master](https://github.com/tendermint/tendermint/tree/master/docs) respectively.
|
||||
built from the files in this (`/docs`) directory.
|
||||
|
||||
## How It Works
|
||||
|
||||
There is a CircleCI job listening for changes in the `/docs` directory, on both
|
||||
the `master` branch. Any updates to files in this directory
|
||||
on those branches will automatically trigger a website deployment. Under the hood,
|
||||
the private website repository has a `make build-docs` target consumed by a CircleCI job in that repo.
|
||||
There is a [GitHub Action](../.github/workflows/docs-deployment.yml) that is
|
||||
triggered by changes in the `/docs` directory on `main` as well as the branch of
|
||||
each major supported version (e.g. `v0.34.x`). Any updates to files in this
|
||||
directory on those branches will automatically trigger a website deployment.
|
||||
|
||||
## README
|
||||
|
||||
The [README.md](./README.md) is also the landing page for the documentation
|
||||
on the website. During the Jenkins build, the current commit is added to the bottom
|
||||
of the README.
|
||||
The [README.md](./README.md) is also the landing page for the documentation on
|
||||
the website.
|
||||
|
||||
## Config.js
|
||||
|
||||
The [config.js](./.vuepress/config.js) generates the sidebar and Table of Contents
|
||||
on the website docs. Note the use of relative links and the omission of
|
||||
file extensions. Additional features are available to improve the look
|
||||
of the sidebar.
|
||||
The [config.js](./.vuepress/config.js) generates the sidebar and Table of
|
||||
Contents on the website docs. Note the use of relative links and the omission of
|
||||
file extensions. Additional features are available to improve the look of the
|
||||
sidebar.
|
||||
|
||||
## Links
|
||||
|
||||
**NOTE:** Strongly consider the existing links - both within this directory
|
||||
and to the website docs - when moving or deleting files.
|
||||
**NOTE:** Strongly consider the existing links - both within this directory and
|
||||
to the website docs - when moving or deleting files.
|
||||
|
||||
Links to directories _MUST_ end in a `/`.
|
||||
|
||||
Relative links should be used nearly everywhere, having discovered and weighed the following:
|
||||
Relative links should be used nearly everywhere, having discovered and weighed
|
||||
the following:
|
||||
|
||||
### Relative
|
||||
|
||||
@@ -65,7 +64,8 @@ Make sure you are in the `docs` directory and run the following commands:
|
||||
rm -rf node_modules
|
||||
```
|
||||
|
||||
This command will remove old version of the visual theme and required packages. This step is optional.
|
||||
This command will remove old version of the visual theme and required packages.
|
||||
This step is optional.
|
||||
|
||||
```bash
|
||||
npm install
|
||||
@@ -79,17 +79,24 @@ npm run serve
|
||||
|
||||
<!-- markdown-link-check-disable -->
|
||||
|
||||
Run `pre` and `post` hooks and start a hot-reloading web-server. See output of this command for the URL (it is often <https://localhost:8080>).
|
||||
Run `pre` and `post` hooks and start a hot-reloading web-server. See output of
|
||||
this command for the URL (it is often <https://localhost:8080>).
|
||||
|
||||
<!-- markdown-link-check-enable -->
|
||||
|
||||
To build documentation as a static website run `npm run build`. You will find the website in `.vuepress/dist` directory.
|
||||
To build documentation as a static website run `npm run build`. You will find
|
||||
the website in `.vuepress/dist` directory.
|
||||
|
||||
## Search
|
||||
|
||||
We are using [Algolia](https://www.algolia.com) to power full-text search. This uses a public API search-only key in the `config.js` as well as a [tendermint.json](https://github.com/algolia/docsearch-configs/blob/master/configs/tendermint.json) configuration file that we can update with PRs.
|
||||
We are using [Algolia](https://www.algolia.com) to power full-text search. This
|
||||
uses a public API search-only key in the `config.js` as well as a
|
||||
[tendermint.json](https://github.com/algolia/docsearch-configs/blob/master/configs/tendermint.json)
|
||||
configuration file that we can update with PRs.
|
||||
|
||||
## Consistency
|
||||
|
||||
Because the build processes are identical (as is the information contained herein), this file should be kept in sync as
|
||||
much as possible with its [counterpart in the Cosmos SDK repo](https://github.com/cosmos/cosmos-sdk/blob/master/docs/DOCS_README.md).
|
||||
Because the build processes are identical (as is the information contained
|
||||
herein), this file should be kept in sync as much as possible with its
|
||||
[counterpart in the Cosmos SDK
|
||||
repo](https://github.com/cosmos/cosmos-sdk/blob/master/docs/DOCS_README.md).
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ Tendermint?](introduction/what-is-tendermint.md).
|
||||
|
||||
To get started quickly with an example application, see the [quick start guide](introduction/quick-start.md).
|
||||
|
||||
To learn about application development on Tendermint, see the [Application Blockchain Interface](https://github.com/tendermint/spec/tree/master/spec/abci).
|
||||
To learn about application development on Tendermint, see the [Application Blockchain Interface](https://github.com/tendermint/tendermint/tree/main/spec/abci).
|
||||
|
||||
For more details on using Tendermint, see the respective documentation for
|
||||
[Tendermint Core](tendermint-core/), [benchmarking and monitoring](tools/), and [network deployments](networks/).
|
||||
@@ -30,4 +30,4 @@ To find out about the Tendermint ecosystem you can go [here](https://github.com/
|
||||
|
||||
## Contribute
|
||||
|
||||
To contribute to the documentation, see [this file](https://github.com/tendermint/tendermint/blob/master/docs/DOCS_README.md) for details of the build process and considerations when making changes.
|
||||
To contribute to the documentation, see [this file](https://github.com/tendermint/tendermint/blob/main/docs/DOCS_README.md) for details of the build process and considerations when making changes.
|
||||
|
||||
@@ -137,7 +137,7 @@ response.
|
||||
|
||||
The server may be generic for a particular language, and we provide a
|
||||
[reference implementation in
|
||||
Golang](https://github.com/tendermint/tendermint/tree/master/abci/server). See the
|
||||
Golang](https://github.com/tendermint/tendermint/tree/main/abci/server). See the
|
||||
[list of other ABCI implementations](https://github.com/tendermint/awesome#ecosystem) for servers in
|
||||
other languages.
|
||||
|
||||
|
||||
@@ -55,6 +55,6 @@ Tendermint.
|
||||
See the following for more extensive documentation:
|
||||
|
||||
- [Interchain Standard for the Light-Client REST API](https://github.com/cosmos/cosmos-sdk/pull/1028)
|
||||
- [Tendermint RPC Docs](https://docs.tendermint.com/master/rpc/)
|
||||
- [Tendermint RPC Docs](https://docs.tendermint.com/main/rpc/)
|
||||
- [Tendermint in Production](../tendermint-core/running-in-production.md)
|
||||
- [ABCI spec](https://github.com/tendermint/spec/tree/95cf253b6df623066ff7cd4074a94e7a3f147c7a/spec/abci)
|
||||
|
||||
@@ -15,7 +15,7 @@ the block itself is never stored.
|
||||
Each event contains a type and a list of attributes, which are key-value pairs
|
||||
denoting something about what happened during the method's execution. For more
|
||||
details on `Events`, see the
|
||||
[ABCI](https://github.com/tendermint/spec/blob/master/spec/abci/abci.md#events)
|
||||
[ABCI](https://github.com/tendermint/tendermint/blob/main/spec/abci/abci.md#events)
|
||||
documentation.
|
||||
|
||||
An `Event` has a composite key associated with it. A `compositeKey` is
|
||||
@@ -146,7 +146,7 @@ You can query for a paginated set of transaction by their events by calling the
|
||||
curl "localhost:26657/tx_search?query=\"message.sender='cosmos1...'\"&prove=true"
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/#/Info/tx_search)
|
||||
Check out [API docs](https://docs.tendermint.com/main/rpc/#/Info/tx_search)
|
||||
for more information on query syntax and other options.
|
||||
|
||||
## Subscribing to Transactions
|
||||
@@ -165,7 +165,7 @@ a query to `/subscribe` RPC endpoint.
|
||||
}
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/#subscribe) for more information
|
||||
Check out [API docs](https://docs.tendermint.com/main/rpc/#subscribe) for more information
|
||||
on query syntax and other options.
|
||||
|
||||
## Querying Blocks Events
|
||||
@@ -177,5 +177,5 @@ You can query for a paginated set of blocks by their events by calling the
|
||||
curl "localhost:26657/block_search?query=\"block.height > 10 AND val_set.num_changed > 0\""
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/#/Info/block_search)
|
||||
Check out [API docs](https://docs.tendermint.com/main/rpc/#/Info/block_search)
|
||||
for more information on query syntax and other options.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
## Context
|
||||
|
||||
ABCI tags were first described in [ADR 002](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-002-event-subscription.md).
|
||||
ABCI tags were first described in [ADR 002](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-002-event-subscription.md).
|
||||
They are key-value pairs that can be used to index transactions.
|
||||
|
||||
Currently, ABCI messages return a list of tags to describe an
|
||||
|
||||
@@ -16,7 +16,7 @@ The messages exchanged between tendermint and a remote signer currently live in
|
||||
|
||||
[privval/socket.go]: https://github.com/tendermint/tendermint/blob/d419fffe18531317c28c29a292ad7d253f6cafdf/privval/socket.go#L496-L502
|
||||
[issue#1622]: https://github.com/tendermint/tendermint/issues/1622
|
||||
[types]: https://github.com/tendermint/tendermint/tree/master/types
|
||||
[types]: https://github.com/tendermint/tendermint/tree/main/types
|
||||
|
||||
|
||||
## Decision
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## Context
|
||||
|
||||
The blockchain reactor is responsible for two high level processes:sending/receiving blocks from peers and FastSync-ing blocks to catch upnode who is far behind. The goal of [ADR-40](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-040-blockchain-reactor-refactor.md) was to refactor these two processes by separating business logic currently wrapped up in go-channels into pure `handle*` functions. While the ADR specified what the final form of the reactor might look like it lacked guidance on intermediary steps to get there.
|
||||
The blockchain reactor is responsible for two high level processes:sending/receiving blocks from peers and FastSync-ing blocks to catch upnode who is far behind. The goal of [ADR-40](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-040-blockchain-reactor-refactor.md) was to refactor these two processes by separating business logic currently wrapped up in go-channels into pure `handle*` functions. While the ADR specified what the final form of the reactor might look like it lacked guidance on intermediary steps to get there.
|
||||
The following diagram illustrates the state of the [blockchain-reorg](https://github.com/tendermint/tendermint/pull/3561) reactor which will be referred to as `v1`.
|
||||
|
||||
.
|
||||
This ADR is meant to specify the missing components and control necessary to achieve [ADR-40](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-040-blockchain-reactor-refactor.md).
|
||||
|
||||
## Decision
|
||||
|
||||
@@ -41,7 +41,7 @@ Diagram](https://github.com/tendermint/tendermint/blob/5cf570690f989646fb3b615b7
|
||||
|
||||
### Reactor changes in detail
|
||||
|
||||
The reactor will include a demultiplexing routine which will send each message to each sub routine for independent processing. Each sub routine will then select the messages it's interested in and call the handle specific function specified in [ADR-40](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-040-blockchain-reactor-refactor.md). The demuxRoutine acts as "pacemaker" setting the time in which events are expected to be handled.
|
||||
The reactor will include a demultiplexing routine which will send each message to each sub routine for independent processing. Each sub routine will then select the messages it's interested in and call the handle specific function specified in [ADR-40](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-040-blockchain-reactor-refactor.md). The demuxRoutine acts as "pacemaker" setting the time in which events are expected to be handled.
|
||||
|
||||
```go
|
||||
func demuxRoutine(msgs, scheduleMsgs, processorMsgs, ioMsgs) {
|
||||
@@ -400,5 +400,5 @@ Implemented
|
||||
|
||||
## References
|
||||
|
||||
- [ADR-40](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-040-blockchain-reactor-refactor.md): The original blockchain reactor re-org proposal
|
||||
- [ADR-40](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-040-blockchain-reactor-refactor.md): The original blockchain reactor re-org proposal
|
||||
- [Blockchain re-org](https://github.com/tendermint/tendermint/pull/3561): The current blockchain reactor re-org implementation (v1)
|
||||
|
||||
@@ -32,7 +32,7 @@ fork the network at some point in its prior history. See Vitalik’s post at
|
||||
Subjectivity](https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/).
|
||||
|
||||
Currently, Tendermint provides a lite client implementation in the
|
||||
[light](https://github.com/tendermint/tendermint/tree/master/light) package. This
|
||||
[light](https://github.com/tendermint/tendermint/tree/main/light) package. This
|
||||
lite client implements a bisection algorithm that tries to use a binary search
|
||||
to find the minimum number of block headers where the validator set voting
|
||||
power changes are less than < 1/3rd. This interface does not support weak
|
||||
@@ -84,7 +84,7 @@ The linear verification algorithm requires downloading all headers
|
||||
between the `TrustHeight` and the `LatestHeight`. The lite client downloads the
|
||||
full header for the provided `TrustHeight` and then proceeds to download `N+1`
|
||||
headers and applies the [Tendermint validation
|
||||
rules](https://github.com/tendermint/tendermint/tree/master/spec/light-client/verification/README.md)
|
||||
rules](https://github.com/tendermint/tendermint/tree/main/spec/light-client/verification/README.md)
|
||||
to each block.
|
||||
|
||||
### Bisecting Verification
|
||||
@@ -119,7 +119,7 @@ network usage.
|
||||
---
|
||||
|
||||
Check out the formal specification
|
||||
[here](https://github.com/tendermint/tendermint/tree/master/spec/light-client).
|
||||
[here](https://github.com/tendermint/tendermint/tree/main/spec/light-client).
|
||||
|
||||
## Status
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ graceful here, but that's for another day.
|
||||
|
||||
It's possible to fool lite clients without there being a fork on the
|
||||
main chain - so called Fork-Lite. See the
|
||||
[fork accountability](https://github.com/tendermint/tendermint/blob/master/spec/light-client/accountability/README.md)
|
||||
[fork accountability](https://github.com/tendermint/tendermint/blob/main/spec/light-client/accountability/README.md)
|
||||
document for more details. For a sequential lite client, this can happen via
|
||||
equivocation or amnesia attacks. For a skipping lite client this can also happen
|
||||
via lunatic validator attacks. There must be some way for applications to punish
|
||||
@@ -31,7 +31,7 @@ checking).
|
||||
|
||||
Currently, evidence verification is handled by Tendermint. Once committed,
|
||||
[evidence is passed over
|
||||
ABCI](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto#L354)
|
||||
ABCI](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/abci/types.proto#L354)
|
||||
in BeginBlock in a reduced form that includes only
|
||||
the type of evidence, its height and timestamp, the validator it's from, and the
|
||||
total voting power of the validator set at the height. The app trusts Tendermint
|
||||
|
||||
@@ -179,13 +179,13 @@ This then ends the process and the verify function that was called at the start
|
||||
the user.
|
||||
|
||||
For a detailed overview of how each of these three attacks can be conducted please refer to the
|
||||
[fork accountability spec](https://github.com/tendermint/tendermint/blob/master/spec/consensus/light-client/accountability.md).
|
||||
[fork accountability spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/accountability.md).
|
||||
|
||||
## Full Node Verification
|
||||
|
||||
When a full node receives evidence from the light client it will need to verify
|
||||
it for itself before gossiping it to peers and trying to commit it on chain. This process is outlined
|
||||
in [ADR-059](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-059-evidence-composition-and-lifecycle.md).
|
||||
in [ADR-059](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-059-evidence-composition-and-lifecycle.md).
|
||||
|
||||
## Status
|
||||
|
||||
@@ -212,9 +212,9 @@ clear from the current information which nodes behaved maliciously.
|
||||
|
||||
## References
|
||||
|
||||
* [Fork accountability spec](https://github.com/tendermint/tendermint/blob/master/spec/consensus/light-client/accountability.md)
|
||||
* [ADR 056: Light client amnesia attacks](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-056-light-client-amnesia-attacks.md)
|
||||
* [ADR-059: Evidence Composition and Lifecycle](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-059-evidence-composition-and-lifecycle.md)
|
||||
* [Fork accountability spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/accountability.md)
|
||||
* [ADR 056: Light client amnesia attacks](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-056-light-client-amnesia-attacks.md)
|
||||
* [ADR-059: Evidence Composition and Lifecycle](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-059-evidence-composition-and-lifecycle.md)
|
||||
* [Informal's Light Client Detector](https://github.com/informalsystems/tendermint-rs/blob/master/docs/spec/lightclient/detection/detection.md)
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
## Context
|
||||
|
||||
Whilst most created evidence of malicious behavior is self evident such that any individual can verify them independently there are types of evidence, known collectively as global evidence, that require further collaboration from the network in order to accumulate enough information to create evidence that is individually verifiable and can therefore be processed through consensus. [Fork Accountability](https://github.com/tendermint/tendermint/blob/master/spec/consensus/light-client/accountability.md) has been coined to describe the entire process of detection, proving and punishing of malicious behavior. This ADR addresses specifically what a light client amnesia attack is and how it can be proven and the current decision around handling light client amnesia attacks. For information on evidence handling by the light client, it is recommended to read [ADR 47](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-047-handling-evidence-from-light-client.md).
|
||||
Whilst most created evidence of malicious behavior is self evident such that any individual can verify them independently there are types of evidence, known collectively as global evidence, that require further collaboration from the network in order to accumulate enough information to create evidence that is individually verifiable and can therefore be processed through consensus. [Fork Accountability](https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/accountability.md) has been coined to describe the entire process of detection, proving and punishing of malicious behavior. This ADR addresses specifically what a light client amnesia attack is and how it can be proven and the current decision around handling light client amnesia attacks. For information on evidence handling by the light client, it is recommended to read [ADR 47](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-047-handling-evidence-from-light-client.md).
|
||||
|
||||
### Amnesia Attack
|
||||
|
||||
@@ -33,7 +33,7 @@ The decision surrounding amnesia attacks has both a short term and long term com
|
||||
|
||||
The latter of the two options meant storing a record of all votes in any height with which there was more than one round. This information would then be accessible for applications if they wanted to perform some off-chain verification and punishment.
|
||||
|
||||
In summary, this seemed like too much to ask of the application to implement only on a temporary basis, whilst not having the domain specific knowledge and considering such a difficult and unlikely attack. Therefore the short term decision is to identify when the attack has occurred and implement the detector algorithm highlighted in [ADR 47](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-047-handling-evidence-from-light-client.md) but to not implement any accountability protocol that would identify malicious validators and allow applications to punish them. This will hopefully change in the long term with the focus on eventually reaching a concrete and secure protocol with identifying and dealing with these attacks.
|
||||
In summary, this seemed like too much to ask of the application to implement only on a temporary basis, whilst not having the domain specific knowledge and considering such a difficult and unlikely attack. Therefore the short term decision is to identify when the attack has occurred and implement the detector algorithm highlighted in [ADR 47](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-047-handling-evidence-from-light-client.md) but to not implement any accountability protocol that would identify malicious validators and allow applications to punish them. This will hopefully change in the long term with the focus on eventually reaching a concrete and secure protocol with identifying and dealing with these attacks.
|
||||
|
||||
## Implications
|
||||
|
||||
@@ -65,7 +65,7 @@ Light clients where all witnesses are faulty can be subject to an amnesia attack
|
||||
## References
|
||||
|
||||
- [Fork accountability algorithm](https://docs.google.com/document/d/11ZhMsCj3y7zIZz4udO9l25xqb0kl7gmWqNpGVRzOeyY/edit)
|
||||
- [Fork accountability spec](https://github.com/tendermint/tendermint/blob/master/spec/consensus/light-client/accountability.md)
|
||||
- [Fork accountability spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/accountability.md)
|
||||
|
||||
## Appendix A: Detailed Walkthrough of Performing a Light Client Amnesia Attack
|
||||
|
||||
@@ -107,7 +107,7 @@ As the distinction between these two attacks (amnesia and back to the past) can
|
||||
|
||||
Currently, the evidence reactor is used to simply broadcast and store evidence. The idea of creating a new reactor for the specific task of verifying these attacks was briefly discussed, but it is decided that the current evidence reactor will be extended.
|
||||
|
||||
The process begins with a light client receiving conflicting headers (in the future this could also be a full node during fast sync or state sync), which it sends to a full node to analyze. As part of [evidence handling](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-047-handling-evidence-from-light-client.md), this is extracted into potential amnesia evidence when the validator voted in more than one round for a different block.
|
||||
The process begins with a light client receiving conflicting headers (in the future this could also be a full node during fast sync or state sync), which it sends to a full node to analyze. As part of [evidence handling](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-047-handling-evidence-from-light-client.md), this is extracted into potential amnesia evidence when the validator voted in more than one round for a different block.
|
||||
|
||||
```golang
|
||||
type PotentialAmnesiaEvidence struct {
|
||||
@@ -128,7 +128,7 @@ This trial period will be discussed later.
|
||||
|
||||
Returning to the event of an amnesia attack, if we were to examine the behavior of the honest nodes, C1 and C2, in the schematic, C2 will not PRECOMMIT an earlier round, but it is likely, if a node in C1 were to receive +2/3 PREVOTE's or PRECOMMIT's for a higher round, that it would remove the lock and PREVOTE and PRECOMMIT for the later round. Therefore, unfortunately it is not a case of simply punishing all nodes that have double voted in the `PotentialAmnesiaEvidence`.
|
||||
|
||||
Instead we use the Proof of Lock Change (PoLC) referred to in the [consensus spec](https://github.com/tendermint/tendermint/blob/master/spec/consensus/consensus.md#terms). When an honest node votes again for a different block in a later round
|
||||
Instead we use the Proof of Lock Change (PoLC) referred to in the [consensus spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/consensus.md#terms). When an honest node votes again for a different block in a later round
|
||||
(which will only occur in very rare cases), it will generate the PoLC and store it in the evidence reactor for a time equal to the `MaxEvidenceAge`
|
||||
|
||||
```golang
|
||||
|
||||
@@ -106,7 +106,7 @@ invasive in the required set of protocol and implementation changes, which
|
||||
simply extends the existing `CheckTx` ABCI method. The second candidate essentially
|
||||
involves the introduction of new ABCI method(s) and would require a higher degree
|
||||
of complexity in protocol and implementation changes, some of which may either
|
||||
overlap or conflict with the upcoming introduction of [ABCI++](https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-013-abci%2B%2B.md).
|
||||
overlap or conflict with the upcoming introduction of [ABCI++](https://github.com/tendermint/tendermint/blob/main/docs/rfc/rfc-013-abci%2B%2B.md).
|
||||
|
||||
For more information on the various approaches and proposals, please see the
|
||||
[mempool discussion](https://github.com/tendermint/tendermint/discussions/6295).
|
||||
@@ -299,5 +299,5 @@ non-contentious and backwards compatible manner.
|
||||
|
||||
## References
|
||||
|
||||
- [ABCI++](https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-013-abci%2B%2B.md)
|
||||
- [ABCI++](https://github.com/tendermint/tendermint/blob/main/docs/rfc/rfc-013-abci%2B%2B.md)
|
||||
- [Mempool Discussion](https://github.com/tendermint/tendermint/discussions/6295)
|
||||
|
||||
@@ -12,7 +12,7 @@ Accepted
|
||||
|
||||
The advent of state sync and block pruning gave rise to the opportunity for full nodes to participate in consensus without needing complete block history. This also introduced a problem with respect to evidence handling. Nodes that didn't have all the blocks within the evidence age were incapable of validating evidence, thus halting if that evidence was committed on chain.
|
||||
|
||||
[ADR 068](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-068-reverse-sync.md) was published in response to this problem and modified the spec to add a minimum block history invariant. This predominantly sought to extend state sync so that it was capable of fetching and storing the `Header`, `Commit` and `ValidatorSet` (essentially a `LightBlock`) of the last `n` heights, where `n` was calculated based from the evidence age.
|
||||
[ADR 068](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-068-reverse-sync.md) was published in response to this problem and modified the spec to add a minimum block history invariant. This predominantly sought to extend state sync so that it was capable of fetching and storing the `Header`, `Commit` and `ValidatorSet` (essentially a `LightBlock`) of the last `n` heights, where `n` was calculated based from the evidence age.
|
||||
|
||||
This ADR sets out to describe the design of this state sync extension as well as modifications to the light client provider and the merging of tm store.
|
||||
|
||||
@@ -93,5 +93,5 @@ This ADR tries to remain within the scope of extending state sync, however the c
|
||||
|
||||
## References
|
||||
|
||||
- [Reverse Sync RFC](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-068-reverse-sync.md)
|
||||
- [Reverse Sync RFC](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-068-reverse-sync.md)
|
||||
- [Original Issue](https://github.com/tendermint/tendermint/issues/5617)
|
||||
|
||||
@@ -126,13 +126,13 @@ would probably be overly-abstract at this stage.
|
||||
## Detailed Design
|
||||
|
||||
The [current
|
||||
nodeImpl](https://github.com/tendermint/tendermint/blob/master/node/node.go#L47)
|
||||
nodeImpl](https://github.com/tendermint/tendermint/blob/main/node/node.go#L47)
|
||||
includes direct references to the implementations of each of the
|
||||
reactors, which should be replaced by references to `service.Service`
|
||||
objects. This will require moving construction of the [rpc
|
||||
service](https://github.com/tendermint/tendermint/blob/master/node/node.go#L771)
|
||||
service](https://github.com/tendermint/tendermint/blob/main/node/node.go#L771)
|
||||
into the constructor of
|
||||
[makeNode](https://github.com/tendermint/tendermint/blob/master/node/node.go#L126). One
|
||||
[makeNode](https://github.com/tendermint/tendermint/blob/main/node/node.go#L126). One
|
||||
possible implementation of this would be to eliminate the current
|
||||
`ConfigureRPC` method on the node package and instead [configure it
|
||||
here](https://github.com/tendermint/tendermint/pull/6798/files#diff-375d57e386f20eaa5f09f02bb9d28bfc48ac3dca18d0325f59492208219e5618R441).
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
## Context
|
||||
|
||||
Tendermint currently provides a monotonically increasing source of time known as [BFTTime](https://github.com/tendermint/tendermint/blob/master/spec/consensus/bft-time.md).
|
||||
Tendermint currently provides a monotonically increasing source of time known as [BFTTime](https://github.com/tendermint/tendermint/blob/main/spec/consensus/bft-time.md).
|
||||
This mechanism for producing a source of time is reasonably simple.
|
||||
Each correct validator adds a timestamp to each `Precommit` message it sends.
|
||||
The timestamp it sends is either the validator's current known Unix time or one millisecond greater than the previous block time, depending on which value is greater.
|
||||
@@ -41,7 +41,7 @@ Proposer-based timestamps alter the current mechanism for producing block timest
|
||||
1. Correct validators only approve the proposed block timestamp if it is close enough to their own currently known Unix time.
|
||||
|
||||
The result of these changes is a more meaningful timestamp that cannot be controlled by `<= 2/3` of the validator voting power.
|
||||
This document outlines the necessary code changes in Tendermint to implement the corresponding [proposer-based timestamps specification](https://github.com/tendermint/tendermint/tree/master/spec/consensus/proposer-based-timestamp).
|
||||
This document outlines the necessary code changes in Tendermint to implement the corresponding [proposer-based timestamps specification](https://github.com/tendermint/tendermint/tree/main/spec/consensus/proposer-based-timestamp).
|
||||
|
||||
## Alternative Approaches
|
||||
|
||||
@@ -58,7 +58,7 @@ We therefore decided not to remove the timestamp.
|
||||
Applications often wish for some transactions to occur on a certain day, on a regular period, or after some time following a different event.
|
||||
All of these require some meaningful representation of agreed upon time.
|
||||
The following protocols and application features require a reliable source of time:
|
||||
* Tendermint Light Clients [rely on correspondence between their known time](https://github.com/tendermint/tendermint/blob/master/spec/light-client/verification/README.md#definitions-1) and the block time for block verification.
|
||||
* Tendermint Light Clients [rely on correspondence between their known time](https://github.com/tendermint/tendermint/blob/main/spec/light-client/verification/README.md#definitions-1) and the block time for block verification.
|
||||
* Tendermint Evidence validity is determined [either in terms of heights or in terms of time](https://github.com/tendermint/tendermint/blob/8029cf7a0fcc89a5004e173ec065aa48ad5ba3c8/spec/consensus/evidence.md#verification).
|
||||
* Unbonding of staked assets in the Cosmos Hub [occurs after a period of 21 days](https://github.com/cosmos/governance/blob/ce75de4019b0129f6efcbb0e752cd2cc9e6136d3/params-change/Staking.md#unbondingtime).
|
||||
* IBC packets can use either a [timestamp or a height to timeout packet delivery](https://docs.cosmos.network/v0.44/ibc/overview.html#acknowledgements)
|
||||
@@ -135,7 +135,7 @@ A validator will only Prevote a proposal if the proposal timestamp is considered
|
||||
A proposal timestamp is considered `timely` if it is within `PRECISION` and `MSGDELAY` of the Unix time known to the validator.
|
||||
More specifically, a proposal timestamp is `timely` if `proposalTimestamp - PRECISION ≤ validatorLocalTime ≤ proposalTimestamp + PRECISION + MSGDELAY`.
|
||||
|
||||
Because the `PRECISION` and `MSGDELAY` parameters must be the same across all validators, they will be added to the [consensus parameters](https://github.com/tendermint/spec/blob/master/proto/tendermint/types/params.proto#L11) as [durations](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration).
|
||||
Because the `PRECISION` and `MSGDELAY` parameters must be the same across all validators, they will be added to the [consensus parameters](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/types/params.proto#L11) as [durations](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Duration).
|
||||
|
||||
The consensus parameters will be updated to include this `Synchrony` field as follows:
|
||||
|
||||
@@ -328,6 +328,6 @@ This skew will be bound by the `PRECISION` value, so it is unlikely to be too la
|
||||
|
||||
## References
|
||||
|
||||
* [PBTS Spec](https://github.com/tendermint/tendermint/tree/master/spec/consensus/proposer-based-timestamp)
|
||||
* [BFTTime spec](https://github.com/tendermint/spec/blob/master/spec/consensus/bft-time.md)
|
||||
* [PBTS Spec](https://github.com/tendermint/tendermint/tree/main/spec/consensus/proposer-based-timestamp)
|
||||
* [BFTTime spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/bft-time.md)
|
||||
* [Issue 371](https://github.com/tendermint/spec/issues/371)
|
||||
|
||||
@@ -664,8 +664,8 @@ The following alternative approaches were considered:
|
||||
- [indexer: unbuffered event subscription slow down the consensus][i7247] (#7247)
|
||||
- [rpc: remove duplication of events when querying][i7273] (#7273)
|
||||
|
||||
[rfc006]: https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-006-event-subscription.md
|
||||
[rpc-service]: https://github.com/tendermint/tendermint/blob/master/rpc/openapi/openapi.yaml
|
||||
[rfc006]: https://github.com/tendermint/tendermint/blob/main/docs/rfc/rfc-006-event-subscription.md
|
||||
[rpc-service]: https://github.com/tendermint/tendermint/blob/main/rpc/openapi/openapi.yaml
|
||||
[query-grammar]: https://pkg.go.dev/github.com/tendermint/tendermint@master/internal/pubsub/query/syntax
|
||||
[ws]: https://datatracker.ietf.org/doc/html/rfc6455
|
||||
[jsonrpc2]: https://www.jsonrpc.org/specification
|
||||
@@ -675,8 +675,8 @@ The following alternative approaches were considered:
|
||||
<!-- markdown-link-check-disable-next-line -->
|
||||
[ng-xm]: https://www.nginx.com/resources/wiki/extending/
|
||||
[abci-event]: https://pkg.go.dev/github.com/tendermint/tendermint/abci/types#Event
|
||||
[rfc001]: https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-001-storage-engine.rst
|
||||
[rfc002]: https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-002-ipc-ecosystem.md
|
||||
[rfc001]: https://github.com/tendermint/tendermint/blob/main/docs/rfc/rfc-001-storage-engine.rst
|
||||
[rfc002]: https://github.com/tendermint/tendermint/blob/main/docs/rfc/rfc-002-ipc-ecosystem.md
|
||||
[i3380]: https://github.com/tendermint/tendermint/issues/3380
|
||||
[i6439]: https://github.com/tendermint/tendermint/issues/6439
|
||||
[i6729]: https://github.com/tendermint/tendermint/issues/6729
|
||||
|
||||
@@ -102,7 +102,7 @@ Accepted
|
||||
|
||||
## References
|
||||
|
||||
- State sync ADR: <https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md>
|
||||
- State sync ADR: <https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-053-state-sync-prototype.md>
|
||||
|
||||
- State sync issue: <https://github.com/tendermint/tendermint/issues/828>
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
## Context
|
||||
|
||||
Two new features: [Block pruning](https://github.com/tendermint/tendermint/issues/3652)
|
||||
and [State sync](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-042-state-sync.md)
|
||||
and [State sync](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-042-state-sync.md)
|
||||
meant nodes no longer needed a complete history of the blockchain. This
|
||||
introduced some challenges of its own which were covered and subsequently
|
||||
tackled with [RFC-001](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-077-block-retention.md).
|
||||
tackled with [RFC-001](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-077-block-retention.md).
|
||||
The RFC allowed applications to set a block retention height; an upper bound on
|
||||
what blocks would be pruned. However nodes who state sync past this upper bound
|
||||
(which is necessary as snapshots must be saved within the trusting period for
|
||||
@@ -199,5 +199,5 @@ nodes to freely fetch and verify prior blocks
|
||||
|
||||
## References
|
||||
|
||||
- [RFC-001: Block retention](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-077-block-retention.md)
|
||||
- [RFC-001: Block retention](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-077-block-retention.md)
|
||||
- [Original issue](https://github.com/tendermint/tendermint/issues/4629)
|
||||
|
||||
@@ -120,7 +120,7 @@ consensus engine, and provides a particular application state.
|
||||
## ABCI Overview
|
||||
|
||||
The [Application BlockChain Interface
|
||||
(ABCI)](https://github.com/tendermint/tendermint/tree/master/abci)
|
||||
(ABCI)](https://github.com/tendermint/tendermint/tree/main/abci)
|
||||
allows for Byzantine Fault Tolerant replication of applications
|
||||
written in any programming language.
|
||||
|
||||
@@ -188,7 +188,7 @@ core to the application. The application replies with corresponding
|
||||
response messages.
|
||||
|
||||
The messages are specified here: [ABCI Message
|
||||
Types](https://github.com/tendermint/tendermint/blob/master/abci/README.md#message-types).
|
||||
Types](https://github.com/tendermint/tendermint/blob/main/abci/README.md#message-types).
|
||||
|
||||
The **DeliverTx** message is the work horse of the application. Each
|
||||
transaction in the blockchain is delivered with this message. The
|
||||
|
||||
@@ -14,7 +14,7 @@ testnets on those servers.
|
||||
## Install
|
||||
|
||||
NOTE: see the [integration bash
|
||||
script](https://github.com/tendermint/tendermint/blob/master/networks/remote/integration.sh)
|
||||
script](https://github.com/tendermint/tendermint/blob/main/networks/remote/integration.sh)
|
||||
that can be run on a fresh DO droplet and will automatically spin up a 4
|
||||
node testnet. The script more or less does everything described below.
|
||||
|
||||
@@ -58,7 +58,7 @@ With the droplets created and running, let's setup Ansible.
|
||||
## Ansible
|
||||
|
||||
The playbooks in [the ansible
|
||||
directory](https://github.com/tendermint/tendermint/tree/master/networks/remote/ansible)
|
||||
directory](https://github.com/tendermint/tendermint/tree/main/networks/remote/ansible)
|
||||
run ansible roles to configure the sentry node architecture. You must
|
||||
switch to this directory to run ansible
|
||||
(`cd $GOPATH/src/github.com/tendermint/tendermint/networks/remote/ansible`).
|
||||
|
||||
@@ -407,14 +407,14 @@ discussed.
|
||||
|
||||
## References
|
||||
|
||||
[abci]: https://github.com/tendermint/tendermint/tree/master/spec/abci
|
||||
[rpc-service]: https://docs.tendermint.com/master/rpc/
|
||||
[light-client]: https://docs.tendermint.com/master/tendermint-core/light-client.html
|
||||
[tm-cli]: https://github.com/tendermint/tendermint/tree/master/cmd/tendermint
|
||||
[abci]: https://github.com/tendermint/tendermint/tree/main/spec/abci
|
||||
[rpc-service]: https://docs.tendermint.com/v0.34/rpc/
|
||||
[light-client]: https://docs.tendermint.com/v0.34/tendermint-core/light-client.html
|
||||
[tm-cli]: https://github.com/tendermint/tendermint/tree/main/cmd/tendermint
|
||||
[cosmos-sdk]: https://github.com/cosmos/cosmos-sdk/
|
||||
[local-client]: https://github.com/tendermint/tendermint/blob/master/abci/client/local_client.go
|
||||
[socket-server]: https://github.com/tendermint/tendermint/blob/master/abci/server/socket_server.go
|
||||
[local-client]: https://github.com/tendermint/tendermint/blob/main/abci/client/local_client.go
|
||||
[socket-server]: https://github.com/tendermint/tendermint/blob/main/abci/server/socket_server.go
|
||||
[sdk-grpc]: https://pkg.go.dev/github.com/cosmos/cosmos-sdk/types/tx#ServiceServer
|
||||
[json-rpc]: https://www.jsonrpc.org/specification
|
||||
[abci-conn]: https://github.com/tendermint/tendermint/blob/master/spec/abci/apps.md#state
|
||||
[adr-57]: https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-057-RPC.md
|
||||
[abci-conn]: https://github.com/tendermint/tendermint/blob/main/spec/abci/apps.md#state
|
||||
[adr-57]: https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-057-RPC.md
|
||||
|
||||
@@ -270,9 +270,9 @@ event sends. The following metrics would be a good start for tracking this perfo
|
||||
[issue-2186]: https://github.com/tendermint/tendermint/issues/2186
|
||||
[issue-2187]: https://github.com/tendermint/tendermint/issues/2187
|
||||
[rfc-002]: https://github.com/tendermint/tendermint/pull/6913
|
||||
[adr-57]: https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-057-RPC.md
|
||||
[adr-57]: https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-057-RPC.md
|
||||
[issue-1319]: https://github.com/tendermint/tendermint/issues/1319
|
||||
[abci-commit-description]: https://github.com/tendermint/tendermint/blob/master/spec/abci/apps.md#commit
|
||||
[abci-commit-description]: https://github.com/tendermint/tendermint/blob/main/spec/abci/apps.md#commit
|
||||
[abci-local-client-code]: https://github.com/tendermint/tendermint/blob/511bd3eb7f037855a793a27ff4c53c12f085b570/abci/client/local_client.go#L84
|
||||
[hub-signature]: https://github.com/cosmos/gaia/blob/0ecb6ed8a244d835807f1ced49217d54a9ca2070/docs/resources/genesis.md#consensus-parameters
|
||||
[ed25519-bench]: https://github.com/oasisprotocol/curve25519-voi/blob/d2e7fc59fe38c18ca990c84c4186cba2cc45b1f9/PERFORMANCE.md
|
||||
|
||||
@@ -59,7 +59,7 @@ Configurable Generator
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The nightly e2e suite is defined by the `testnet generator
|
||||
<https://github.com/tendermint/tendermint/blob/master/test/e2e/generator/generate.go#L13-L65>`_,
|
||||
<https://github.com/tendermint/tendermint/blob/main/test/e2e/generator/generate.go#L13-L65>`_,
|
||||
and it's difficult to add dimensions or change the focus of the test suite in
|
||||
any way without modifying the implementation of the generator. If the
|
||||
generator were more configurable, potentially via a file rather than in
|
||||
|
||||
@@ -55,9 +55,9 @@ References
|
||||
~~~~~~~~~~
|
||||
|
||||
- Legacy Implementation
|
||||
- `publication of events <https://github.com/tendermint/tendermint/blob/master/libs/pubsub/pubsub.go#L333-L345>`_
|
||||
- `send operation <https://github.com/tendermint/tendermint/blob/master/libs/pubsub/pubsub.go#L489-L527>`_
|
||||
- `send loop <https://github.com/tendermint/tendermint/blob/master/libs/pubsub/pubsub.go#L381-L402>`_
|
||||
- `publication of events <https://github.com/tendermint/tendermint/blob/main/libs/pubsub/pubsub.go#L333-L345>`_
|
||||
- `send operation <https://github.com/tendermint/tendermint/blob/main/libs/pubsub/pubsub.go#L489-L527>`_
|
||||
- `send loop <https://github.com/tendermint/tendermint/blob/main/libs/pubsub/pubsub.go#L381-L402>`_
|
||||
- Related RFCs
|
||||
- `RFC 002: IPC Ecosystem <./rfc-002-ipc-ecosystem.md>`_
|
||||
- `RFC 003: Performance Questions <./rfc-003-performance-questions.md>`_
|
||||
|
||||
@@ -194,8 +194,8 @@ mutually exclusive.
|
||||
- [RFC 6455: The websocket protocol][ws]
|
||||
- [JSON-RPC 2.0 Specification](https://www.jsonrpc.org/specification)
|
||||
|
||||
[rpc-service]: https://docs.tendermint.com/master/rpc/
|
||||
[rpc-methods]: https://github.com/tendermint/tendermint/blob/master/internal/rpc/core/routes.go#L12
|
||||
[rpc-service]: https://docs.tendermint.com/v0.34/rpc/
|
||||
[rpc-methods]: https://github.com/tendermint/tendermint/blob/main/internal/rpc/core/routes.go#L12
|
||||
[events]: ./rfc-005-event-system.rst
|
||||
[rpc-transport]: ./rfc-002-ipc-ecosystem.md#rpc-transport
|
||||
[ws]: https://datatracker.ietf.org/doc/html/rfc6455
|
||||
|
||||
@@ -336,17 +336,17 @@ something like this (subject to refinement):
|
||||
- [`EventSink` interface][esink]
|
||||
- [`tm-db` library][tmdb]
|
||||
|
||||
[adr065]: https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-065-custom-event-indexing.md
|
||||
[adr075]: https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-075-rpc-subscription.md
|
||||
[adr065]: https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-065-custom-event-indexing.md
|
||||
[adr075]: https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-075-rpc-subscription.md
|
||||
[esink]: https://pkg.go.dev/github.com/tendermint/tendermint/internal/state/indexer#EventSink
|
||||
[event-rpc]: https://docs.tendermint.com/master/rpc/#/Websocket/subscribe
|
||||
[event-rpc]: https://docs.tendermint.com/v0.34/rpc/#/Websocket/subscribe
|
||||
[i1161]: https://github.com/tendermint/tendermint/issues/1161
|
||||
[i7135]: https://github.com/tendermint/tendermint/issues/7135
|
||||
[i7247]: https://github.com/tendermint/tendermint/issues/7247
|
||||
[kv-index]: https://github.com/tendermint/tendermint/blob/master/internal/state/indexer/tx/kv
|
||||
[kv-index]: https://github.com/tendermint/tendermint/blob/main/internal/state/indexer/tx/kv
|
||||
[postgres]: https://postgresql.org/
|
||||
[psql]: https://github.com/tendermint/tendermint/blob/master/internal/state/indexer/sink/psql
|
||||
[psql]: https://github.com/tendermint/tendermint/blob/master/internal/state/indexer/sink/psql
|
||||
[psql]: https://github.com/tendermint/tendermint/blob/main/internal/state/indexer/sink/psql
|
||||
[psql]: https://github.com/tendermint/tendermint/blob/main/internal/state/indexer/sink/psql
|
||||
[query]: https://pkg.go.dev/github.com/tendermint/tendermint/internal/pubsub/query/syntax
|
||||
[sdk]: https://github.com/cosmos/cosmos-sdk
|
||||
[tmdb]: https://pkg.go.dev/github.com/tendermint/tm-db#DB
|
||||
|
||||
@@ -289,11 +289,11 @@ balance:
|
||||
- [ADR 075: RPC Event Subscription Interface][adr075]
|
||||
|
||||
[config-pkg]: https://godoc.org/github.com/tendermint/tendermint/config
|
||||
[confix]: https://github.com/tendermint/tendermint/blob/master/scripts/confix
|
||||
[condiff]: https://github.com/tendermint/tendermint/blob/master/scripts/confix/condiff
|
||||
[plan]: https://github.com/tendermint/tendermint/blob/master/scripts/confix/plan.go
|
||||
[testdata]: https://github.com/tendermint/tendermint/blob/master/scripts/confix/testdata
|
||||
[adr075]: https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-075-rpc-subscription.md
|
||||
[confix]: https://github.com/tendermint/tendermint/blob/main/scripts/confix
|
||||
[condiff]: https://github.com/tendermint/tendermint/blob/main/scripts/confix/condiff
|
||||
[plan]: https://github.com/tendermint/tendermint/blob/main/scripts/confix/plan.go
|
||||
[testdata]: https://github.com/tendermint/tendermint/blob/main/scripts/confix/testdata
|
||||
[adr075]: https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-075-rpc-subscription.md
|
||||
|
||||
## Appendix: Research Notes
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ in many cases the panics were just added to simplify downstream error
|
||||
checking, and could easily be converted to errors.
|
||||
|
||||
The `Don't Panic RFC
|
||||
<https://github.com/tendermint/tendermint/blob/master/docs/rfc/rfc-008-do-not-panic.MD>`_
|
||||
<https://github.com/tendermint/tendermint/blob/main/docs/rfc/rfc-008-do-not-panic.MD>`_
|
||||
covers some of the background and approach.
|
||||
|
||||
While the changes are in this project are relatively rote, this will provide
|
||||
|
||||
@@ -73,7 +73,7 @@ applications using it. In particular:
|
||||
server to understand which operation is requested is to dispatch on the type
|
||||
of the request and response payloads. For responses, this means that [any
|
||||
error condition is terminal not only to the request, but to the entire ABCI
|
||||
client](https://github.com/tendermint/tendermint/blob/master/abci/client/socket_client.go#L149).
|
||||
client](https://github.com/tendermint/tendermint/blob/main/abci/client/socket_client.go#L149).
|
||||
|
||||
The historical intent of terminating for any error seems to have been that
|
||||
all ABCI errors are unrecoverable and hence protocol fatal <!-- markdown-link-check-disable-next-line -->
|
||||
@@ -221,10 +221,10 @@ design.
|
||||
- [Tendermint ABCI gRPC client][grpc-client]
|
||||
- [Initial commit of gRPC client][abci-start]
|
||||
|
||||
[abci]: https://github.com/tendermint/spec/tree/master/spec/abci
|
||||
[socket-client]: https://github.com/tendermint/tendermint/blob/master/abci/client/socket_client.go
|
||||
[socket-server]: https://github.com/tendermint/tendermint/blob/master/abci/server/socket_server.go
|
||||
[grpc-client]: https://github.com/tendermint/tendermint/blob/master/abci/client/grpc_client.go
|
||||
[abci]: https://github.com/tendermint/tendermint/tree/main/spec/abci
|
||||
[socket-client]: https://github.com/tendermint/tendermint/blob/main/abci/client/socket_client.go
|
||||
[socket-server]: https://github.com/tendermint/tendermint/blob/main/abci/server/socket_server.go
|
||||
[grpc-client]: https://github.com/tendermint/tendermint/blob/main/abci/client/grpc_client.go
|
||||
[abci-start]: https://github.com/tendermint/abci/commit/1ab3c747182aaa38418258679c667090c2bb1e0d
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -67,7 +67,7 @@ Next follows a standard block creation cycle, where we enter a new
|
||||
round, propose a block, receive more than 2/3 of prevotes, then
|
||||
precommits and finally have a chance to commit a block. For details,
|
||||
please refer to [Byzantine Consensus
|
||||
Algorithm](https://github.com/tendermint/spec/blob/master/spec/consensus/consensus.md).
|
||||
Algorithm](https://github.com/tendermint/tendermint/blob/main/spec/consensus/consensus.md).
|
||||
|
||||
```sh
|
||||
I[10-04|13:54:30.393] enterNewRound(91/0). Current: 91/0/RoundStepNewHeight module=consensus
|
||||
|
||||
@@ -6,6 +6,6 @@ order: 9
|
||||
|
||||
The RPC documentation is hosted here:
|
||||
|
||||
- [https://docs.tendermint.com/master/rpc/](https://docs.tendermint.com/master/rpc/)
|
||||
- [https://docs.tendermint.com/main/rpc/](https://docs.tendermint.com/main/rpc/)
|
||||
|
||||
To update the documentation, edit the relevant `godoc` comments in the [rpc/core directory](https://github.com/tendermint/tendermint/blob/v0.34.x/rpc/core).
|
||||
|
||||
@@ -95,7 +95,7 @@ mechanisms.
|
||||
### RPC
|
||||
|
||||
Endpoints returning multiple entries are limited by default to return 30
|
||||
elements (100 max). See the [RPC Documentation](https://docs.tendermint.com/master/rpc/)
|
||||
elements (100 max). See the [RPC Documentation](https://docs.tendermint.com/main/rpc/)
|
||||
for more information.
|
||||
|
||||
Rate-limiting and authentication are another key aspects to help protect
|
||||
|
||||
@@ -31,7 +31,7 @@ method via Websocket along with a valid query.
|
||||
}
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/) for
|
||||
Check out [API docs](https://docs.tendermint.com/main/rpc/) for
|
||||
more information on query syntax and other options.
|
||||
|
||||
You can also use tags, given you had included them into DeliverTx
|
||||
@@ -43,7 +43,7 @@ transactions](./indexing-transactions.md) for details.
|
||||
When validator set changes, ValidatorSetUpdates event is published. The
|
||||
event carries a list of pubkey/power pairs. The list is the same
|
||||
Tendermint receives from ABCI application (see [EndBlock
|
||||
section](https://github.com/tendermint/spec/blob/master/spec/abci/abci.md#endblock) in
|
||||
section](https://github.com/tendermint/tendermint/blob/main/spec/abci/abci.md#endblock) in
|
||||
the ABCI spec).
|
||||
|
||||
Response:
|
||||
|
||||
@@ -39,7 +39,7 @@ tendermint testnet --help
|
||||
|
||||
The `genesis.json` file in `$TMHOME/config/` defines the initial
|
||||
TendermintCore state upon genesis of the blockchain ([see
|
||||
definition](https://github.com/tendermint/tendermint/blob/master/types/genesis.go)).
|
||||
definition](https://github.com/tendermint/tendermint/blob/main/types/genesis.go)).
|
||||
|
||||
#### Fields
|
||||
|
||||
@@ -49,7 +49,7 @@ definition](https://github.com/tendermint/tendermint/blob/master/types/genesis.g
|
||||
chain IDs, you will have a bad time. The ChainID must be less than 50 symbols.
|
||||
- `initial_height`: Height at which Tendermint should begin at. If a blockchain is conducting a network upgrade,
|
||||
starting from the stopped height brings uniqueness to previous heights.
|
||||
- `consensus_params` [spec](https://github.com/tendermint/spec/blob/master/spec/core/state.md#consensusparams)
|
||||
- `consensus_params` [spec](https://github.com/tendermint/tendermint/blob/main/spec/core/state.md#consensusparams)
|
||||
- `block`
|
||||
- `max_bytes`: Max block size, in bytes.
|
||||
- `max_gas`: Max gas per block.
|
||||
@@ -183,7 +183,7 @@ endpoints. Some take no arguments (like `/status`), while others specify
|
||||
the argument name and use `_` as a placeholder.
|
||||
|
||||
|
||||
> TIP: Find the RPC Documentation [here](https://docs.tendermint.com/master/rpc/)
|
||||
> TIP: Find the RPC Documentation [here](https://docs.tendermint.com/main/rpc/)
|
||||
|
||||
### Formatting
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Hello, Tendermint Core
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto).
|
||||
file](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/abci/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
@@ -218,7 +218,7 @@ etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
specification"](https://github.com/tendermint/tendermint/blob/main/spec/abci/apps.md#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[badger](https://github.com/dgraph-io/badger), which is an embeddable,
|
||||
@@ -337,7 +337,7 @@ func (app *KVStoreApplication) Query(reqQuery abcitypes.RequestQuery) (resQuery
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
[here](https://github.com/tendermint/tendermint/tree/main/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instance in the same process
|
||||
|
||||
@@ -610,7 +610,7 @@ go build
|
||||
To create a default configuration, nodeKey and private validator files, let's
|
||||
execute `tendermint init`. But before we do that, we will need to install
|
||||
Tendermint Core. Please refer to [the official
|
||||
guide](https://docs.tendermint.com/master/introduction/install.html). If you're
|
||||
guide](https://docs.tendermint.com/main/introduction/install.html). If you're
|
||||
installing from source, don't forget to checkout the latest release (`git checkout vX.Y.Z`).
|
||||
|
||||
```bash
|
||||
@@ -680,4 +680,4 @@ $ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
deeper, read [the docs](https://docs.tendermint.com/main/).
|
||||
|
||||
@@ -87,7 +87,7 @@ Hello, Tendermint Core
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto).
|
||||
file](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/abci/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
@@ -221,7 +221,7 @@ etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
specification"](https://github.com/tendermint/tendermint/blob/main/spec/abci/apps.md#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[badger](https://github.com/dgraph-io/badger), which is an embeddable,
|
||||
@@ -340,7 +340,7 @@ func (app *KVStoreApplication) Query(reqQuery abcitypes.RequestQuery) (resQuery
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
[here](https://github.com/tendermint/tendermint/tree/main/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instances
|
||||
|
||||
@@ -468,7 +468,7 @@ go build
|
||||
To create a default configuration, nodeKey and private validator files, let's
|
||||
execute `tendermint init`. But before we do that, we will need to install
|
||||
Tendermint Core. Please refer to [the official
|
||||
guide](https://docs.tendermint.com/master/introduction/install.html). If you're
|
||||
guide](https://docs.tendermint.com/main/introduction/install.html). If you're
|
||||
installing from source, don't forget to checkout the latest release (`git checkout vX.Y.Z`).
|
||||
|
||||
```bash
|
||||
@@ -482,7 +482,7 @@ I[2019-07-16|18:20:36.482] Generated genesis file module=m
|
||||
|
||||
Feel free to explore the generated files, which can be found at
|
||||
`/tmp/example/config` directory. Documentation on the config can be found
|
||||
[here](https://docs.tendermint.com/master/tendermint-core/configuration.html).
|
||||
[here](https://docs.tendermint.com/main/tendermint-core/configuration.html).
|
||||
|
||||
We are ready to start our application:
|
||||
|
||||
@@ -565,4 +565,4 @@ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
deeper, read [the docs](https://docs.tendermint.com/main/).
|
||||
|
||||
@@ -1,630 +0,0 @@
|
||||
<!---
|
||||
order: 3
|
||||
--->
|
||||
|
||||
# Creating an application in Java
|
||||
|
||||
## Guide Assumptions
|
||||
|
||||
This guide is designed for beginners who want to get started with a Tendermint
|
||||
Core application from scratch. It does not assume that you have any prior
|
||||
experience with Tendermint Core.
|
||||
|
||||
Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state
|
||||
transition machine (your application) - written in any programming language - and securely
|
||||
replicates it on many machines.
|
||||
|
||||
By following along with this guide, you'll create a Tendermint Core project
|
||||
called kvstore, a (very) simple distributed BFT key-value store. The application (which should
|
||||
implementing the blockchain interface (ABCI)) will be written in Java.
|
||||
|
||||
This guide assumes that you are not new to JVM world. If you are new please see [JVM Minimal Survival Guide](https://hadihariri.com/2013/12/29/jvm-minimal-survival-guide-for-the-dotnet-developer/#java-the-language-java-the-ecosystem-java-the-jvm) and [Gradle Docs](https://docs.gradle.org/current/userguide/userguide.html).
|
||||
|
||||
## Built-in app vs external app
|
||||
|
||||
If you use Golang, you can run your app and Tendermint Core in the same process to get maximum performance.
|
||||
[Cosmos SDK](https://github.com/cosmos/cosmos-sdk) is written this way.
|
||||
Please refer to [Writing a built-in Tendermint Core application in Go](./go-built-in.md) guide for details.
|
||||
|
||||
If you choose another language, like we did in this guide, you have to write a separate app,
|
||||
which will communicate with Tendermint Core via a socket (UNIX or TCP) or gRPC.
|
||||
This guide will show you how to build external application using RPC server.
|
||||
|
||||
Having a separate application might give you better security guarantees as two
|
||||
processes would be communicating via established binary protocol. Tendermint
|
||||
Core will not have access to application's state.
|
||||
|
||||
## 1.1 Installing Java and Gradle
|
||||
|
||||
Please refer to [the Oracle's guide for installing JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html).
|
||||
|
||||
Verify that you have installed Java successfully:
|
||||
|
||||
```bash
|
||||
$ java -version
|
||||
java version "12.0.2" 2019-07-16
|
||||
Java(TM) SE Runtime Environment (build 12.0.2+10)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
|
||||
```
|
||||
|
||||
You can choose any version of Java higher or equal to 8.
|
||||
This guide is written using Java SE Development Kit 12.
|
||||
|
||||
Make sure you have `$JAVA_HOME` environment variable set:
|
||||
|
||||
```bash
|
||||
$ echo $JAVA_HOME
|
||||
/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
|
||||
```
|
||||
|
||||
For Gradle installation, please refer to [their official guide](https://gradle.org/install/).
|
||||
|
||||
## 1.2 Creating a new Java project
|
||||
|
||||
We'll start by creating a new Gradle project.
|
||||
|
||||
```bash
|
||||
export KVSTORE_HOME=~/kvstore
|
||||
mkdir $KVSTORE_HOME
|
||||
cd $KVSTORE_HOME
|
||||
```
|
||||
|
||||
Inside the example directory run:
|
||||
|
||||
```bash
|
||||
gradle init --dsl groovy --package io.example --project-name example --type java-application --test-framework junit
|
||||
```
|
||||
|
||||
This will create a new project for you. The tree of files should look like:
|
||||
|
||||
```bash
|
||||
$ tree
|
||||
.
|
||||
|-- build.gradle
|
||||
|-- gradle
|
||||
| `-- wrapper
|
||||
| |-- gradle-wrapper.jar
|
||||
| `-- gradle-wrapper.properties
|
||||
|-- gradlew
|
||||
|-- gradlew.bat
|
||||
|-- settings.gradle
|
||||
`-- src
|
||||
|-- main
|
||||
| |-- java
|
||||
| | `-- io
|
||||
| | `-- example
|
||||
| | `-- App.java
|
||||
| `-- resources
|
||||
`-- test
|
||||
|-- java
|
||||
| `-- io
|
||||
| `-- example
|
||||
| `-- AppTest.java
|
||||
`-- resources
|
||||
```
|
||||
|
||||
When run, this should print "Hello world." to the standard output.
|
||||
|
||||
```bash
|
||||
$ ./gradlew run
|
||||
> Task :run
|
||||
Hello world.
|
||||
```
|
||||
|
||||
## 1.3 Writing a Tendermint Core application
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
### 1.3.1 Compile .proto files
|
||||
|
||||
Add the following piece to the top of the `build.gradle`:
|
||||
|
||||
```groovy
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Enable the protobuf plugin in the `plugins` section of the `build.gradle`:
|
||||
|
||||
```groovy
|
||||
plugins {
|
||||
id 'com.google.protobuf' version '0.8.8'
|
||||
}
|
||||
```
|
||||
|
||||
Add the following code to `build.gradle`:
|
||||
|
||||
```groovy
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:3.7.1"
|
||||
}
|
||||
plugins {
|
||||
grpc {
|
||||
artifact = 'io.grpc:protoc-gen-grpc-java:1.22.1'
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
all()*.plugins {
|
||||
grpc {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now we should be ready to compile the `*.proto` files.
|
||||
|
||||
Copy the necessary `.proto` files to your project:
|
||||
|
||||
```bash
|
||||
mkdir -p \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/abci \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/version \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/crypto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/libs \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/gogo/protobuf/gogoproto
|
||||
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/abci/types.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/abci/types.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/version/version.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/version/version.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/types/types.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types/types.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/types/evidence.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types/evidence.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/types/params.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types/params.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/crypto/merkle.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/crypto/merkle.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/crypto/keys.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/crypto/keys.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/libs/types.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/libs/types.proto
|
||||
cp $GOPATH/src/github.com/gogo/protobuf/gogoproto/gogo.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/gogo/protobuf/gogoproto/gogo.proto
|
||||
```
|
||||
|
||||
Add these dependencies to `build.gradle`:
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'io.grpc:grpc-protobuf:1.22.1'
|
||||
implementation 'io.grpc:grpc-netty-shaded:1.22.1'
|
||||
implementation 'io.grpc:grpc-stub:1.22.1'
|
||||
}
|
||||
```
|
||||
|
||||
To generate all protobuf-type classes run:
|
||||
|
||||
```bash
|
||||
./gradlew generateProto
|
||||
```
|
||||
|
||||
To verify that everything went smoothly, you can inspect the `build/generated/` directory:
|
||||
|
||||
```bash
|
||||
$ tree build/generated/
|
||||
build/generated/
|
||||
|-- source
|
||||
| `-- proto
|
||||
| `-- main
|
||||
| |-- grpc
|
||||
| | `-- types
|
||||
| | `-- ABCIApplicationGrpc.java
|
||||
| `-- java
|
||||
| |-- com
|
||||
| | `-- google
|
||||
| | `-- protobuf
|
||||
| | `-- GoGoProtos.java
|
||||
| |-- common
|
||||
| | `-- Types.java
|
||||
| |-- merkle
|
||||
| | `-- Merkle.java
|
||||
| `-- types
|
||||
| `-- Types.java
|
||||
```
|
||||
|
||||
### 1.3.2 Implementing ABCI
|
||||
|
||||
The resulting `$KVSTORE_HOME/build/generated/source/proto/main/grpc/types/ABCIApplicationGrpc.java` file
|
||||
contains the abstract class `ABCIApplicationImplBase`, which is an interface we'll need to implement.
|
||||
|
||||
Create `$KVSTORE_HOME/src/main/java/io/example/KVStoreApp.java` file with the following content:
|
||||
|
||||
```java
|
||||
package io.example;
|
||||
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import types.ABCIApplicationGrpc;
|
||||
import types.Types.*;
|
||||
|
||||
class KVStoreApp extends ABCIApplicationGrpc.ABCIApplicationImplBase {
|
||||
|
||||
// methods implementation
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Now I will go through each method of `ABCIApplicationImplBase` explaining when it's called and adding
|
||||
required business logic.
|
||||
|
||||
### 1.3.3 CheckTx
|
||||
|
||||
When a new transaction is added to the Tendermint Core, it will ask the
|
||||
application to check it (validate the format, signatures, etc.).
|
||||
|
||||
```java
|
||||
@Override
|
||||
public void checkTx(RequestCheckTx req, StreamObserver<ResponseCheckTx> responseObserver) {
|
||||
var tx = req.getTx();
|
||||
int code = validate(tx);
|
||||
var resp = ResponseCheckTx.newBuilder()
|
||||
.setCode(code)
|
||||
.setGasWanted(1)
|
||||
.build();
|
||||
responseObserver.onNext(resp);
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
|
||||
private int validate(ByteString tx) {
|
||||
List<byte[]> parts = split(tx, '=');
|
||||
if (parts.size() != 2) {
|
||||
return 1;
|
||||
}
|
||||
byte[] key = parts.get(0);
|
||||
byte[] value = parts.get(1);
|
||||
|
||||
// check if the same key=value already exists
|
||||
var stored = getPersistedValue(key);
|
||||
if (stored != null && Arrays.equals(stored, value)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private List<byte[]> split(ByteString tx, char separator) {
|
||||
var arr = tx.toByteArray();
|
||||
int i;
|
||||
for (i = 0; i < tx.size(); i++) {
|
||||
if (arr[i] == (byte)separator) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == tx.size()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return List.of(
|
||||
tx.substring(0, i).toByteArray(),
|
||||
tx.substring(i + 1).toByteArray()
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
Don't worry if this does not compile yet.
|
||||
|
||||
If the transaction does not have a form of `{bytes}={bytes}`, we return `1`
|
||||
code. When the same key=value already exist (same key and value), we return `2`
|
||||
code. For others, we return a zero code indicating that they are valid.
|
||||
|
||||
Note that anything with non-zero code will be considered invalid (`-1`, `100`,
|
||||
etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[JetBrains Xodus](https://github.com/JetBrains/xodus), which is a transactional schema-less embedded high-performance database written in Java.
|
||||
|
||||
`build.gradle`:
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.xodus:xodus-environment:1.3.91'
|
||||
}
|
||||
```
|
||||
|
||||
```java
|
||||
...
|
||||
import jetbrains.exodus.ArrayByteIterable;
|
||||
import jetbrains.exodus.ByteIterable;
|
||||
import jetbrains.exodus.env.Environment;
|
||||
import jetbrains.exodus.env.Store;
|
||||
import jetbrains.exodus.env.StoreConfig;
|
||||
import jetbrains.exodus.env.Transaction;
|
||||
|
||||
class KVStoreApp extends ABCIApplicationGrpc.ABCIApplicationImplBase {
|
||||
private Environment env;
|
||||
private Transaction txn = null;
|
||||
private Store store = null;
|
||||
|
||||
KVStoreApp(Environment env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
private byte[] getPersistedValue(byte[] k) {
|
||||
return env.computeInReadonlyTransaction(txn -> {
|
||||
var store = env.openStore("store", StoreConfig.WITHOUT_DUPLICATES, txn);
|
||||
ByteIterable byteIterable = store.get(txn, new ArrayByteIterable(k));
|
||||
if (byteIterable == null) {
|
||||
return null;
|
||||
}
|
||||
return byteIterable.getBytesUnsafe();
|
||||
});
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3.4 BeginBlock -> DeliverTx -> EndBlock -> Commit
|
||||
|
||||
When Tendermint Core has decided on the block, it's transferred to the
|
||||
application in 3 parts: `BeginBlock`, one `DeliverTx` per transaction and
|
||||
`EndBlock` in the end. `DeliverTx` are being transferred asynchronously, but the
|
||||
responses are expected to come in order.
|
||||
|
||||
```java
|
||||
@Override
|
||||
public void beginBlock(RequestBeginBlock req, StreamObserver<ResponseBeginBlock> responseObserver) {
|
||||
txn = env.beginTransaction();
|
||||
store = env.openStore("store", StoreConfig.WITHOUT_DUPLICATES, txn);
|
||||
var resp = ResponseBeginBlock.newBuilder().build();
|
||||
responseObserver.onNext(resp);
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
Here we begin a new transaction, which will accumulate the block's transactions and open the corresponding store.
|
||||
|
||||
```java
|
||||
@Override
|
||||
public void deliverTx(RequestDeliverTx req, StreamObserver<ResponseDeliverTx> responseObserver) {
|
||||
var tx = req.getTx();
|
||||
int code = validate(tx);
|
||||
if (code == 0) {
|
||||
List<byte[]> parts = split(tx, '=');
|
||||
var key = new ArrayByteIterable(parts.get(0));
|
||||
var value = new ArrayByteIterable(parts.get(1));
|
||||
store.put(txn, key, value);
|
||||
}
|
||||
var resp = ResponseDeliverTx.newBuilder()
|
||||
.setCode(code)
|
||||
.build();
|
||||
responseObserver.onNext(resp);
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
If the transaction is badly formatted or the same key=value already exist, we
|
||||
again return the non-zero code. Otherwise, we add it to the store.
|
||||
|
||||
In the current design, a block can include incorrect transactions (those who
|
||||
passed `CheckTx`, but failed `DeliverTx` or transactions included by the proposer
|
||||
directly). This is done for performance reasons.
|
||||
|
||||
Note we can't commit transactions inside the `DeliverTx` because in such case
|
||||
`Query`, which may be called in parallel, will return inconsistent data (i.e.
|
||||
it will report that some value already exist even when the actual block was not
|
||||
yet committed).
|
||||
|
||||
`Commit` instructs the application to persist the new state.
|
||||
|
||||
```java
|
||||
@Override
|
||||
public void commit(RequestCommit req, StreamObserver<ResponseCommit> responseObserver) {
|
||||
txn.commit();
|
||||
var resp = ResponseCommit.newBuilder()
|
||||
.setData(ByteString.copyFrom(new byte[8]))
|
||||
.build();
|
||||
responseObserver.onNext(resp);
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3.5 Query
|
||||
|
||||
Now, when the client wants to know whenever a particular key/value exist, it
|
||||
will call Tendermint Core RPC `/abci_query` endpoint, which in turn will call
|
||||
the application's `Query` method.
|
||||
|
||||
Applications are free to provide their own APIs. But by using Tendermint Core
|
||||
as a proxy, clients (including [light client
|
||||
package](https://godoc.org/github.com/tendermint/tendermint/light)) can leverage
|
||||
the unified API across different applications. Plus they won't have to call the
|
||||
otherwise separate Tendermint Core API for additional proofs.
|
||||
|
||||
Note we don't include a proof here.
|
||||
|
||||
```java
|
||||
@Override
|
||||
public void query(RequestQuery req, StreamObserver<ResponseQuery> responseObserver) {
|
||||
var k = req.getData().toByteArray();
|
||||
var v = getPersistedValue(k);
|
||||
var builder = ResponseQuery.newBuilder();
|
||||
if (v == null) {
|
||||
builder.setLog("does not exist");
|
||||
} else {
|
||||
builder.setLog("exists");
|
||||
builder.setKey(ByteString.copyFrom(k));
|
||||
builder.setValue(ByteString.copyFrom(v));
|
||||
}
|
||||
responseObserver.onNext(builder.build());
|
||||
responseObserver.onCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instances
|
||||
|
||||
Put the following code into the `$KVSTORE_HOME/src/main/java/io/example/App.java` file:
|
||||
|
||||
```java
|
||||
package io.example;
|
||||
|
||||
import jetbrains.exodus.env.Environment;
|
||||
import jetbrains.exodus.env.Environments;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class App {
|
||||
public static void main(String[] args) throws IOException, InterruptedException {
|
||||
try (Environment env = Environments.newInstance("tmp/storage")) {
|
||||
var app = new KVStoreApp(env);
|
||||
var server = new GrpcServer(app, 26658);
|
||||
server.start();
|
||||
server.blockUntilShutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
It is the entry point of the application.
|
||||
Here we create a special object `Environment`, which knows where to store the application state.
|
||||
Then we create and start the gRPC server to handle Tendermint Core requests.
|
||||
|
||||
Create the `$KVSTORE_HOME/src/main/java/io/example/GrpcServer.java` file with the following content:
|
||||
|
||||
```java
|
||||
package io.example;
|
||||
|
||||
import io.grpc.BindableService;
|
||||
import io.grpc.Server;
|
||||
import io.grpc.ServerBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
class GrpcServer {
|
||||
private Server server;
|
||||
|
||||
GrpcServer(BindableService service, int port) {
|
||||
this.server = ServerBuilder.forPort(port)
|
||||
.addService(service)
|
||||
.build();
|
||||
}
|
||||
|
||||
void start() throws IOException {
|
||||
server.start();
|
||||
System.out.println("gRPC server started, listening on $port");
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
System.out.println("shutting down gRPC server since JVM is shutting down");
|
||||
GrpcServer.this.stop();
|
||||
System.out.println("server shut down");
|
||||
}));
|
||||
}
|
||||
|
||||
private void stop() {
|
||||
server.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Await termination on the main thread since the grpc library uses daemon threads.
|
||||
*/
|
||||
void blockUntilShutdown() throws InterruptedException {
|
||||
server.awaitTermination();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 1.5 Getting Up and Running
|
||||
|
||||
To create a default configuration, nodeKey and private validator files, let's
|
||||
execute `tendermint init`. But before we do that, we will need to install
|
||||
Tendermint Core.
|
||||
|
||||
```bash
|
||||
$ rm -rf /tmp/example
|
||||
$ cd $GOPATH/src/github.com/tendermint/tendermint
|
||||
$ make install
|
||||
$ TMHOME="/tmp/example" tendermint init
|
||||
|
||||
I[2019-07-16|18:20:36.480] Generated private validator module=main keyFile=/tmp/example/config/priv_validator_key.json stateFile=/tmp/example2/data/priv_validator_state.json
|
||||
I[2019-07-16|18:20:36.481] Generated node key module=main path=/tmp/example/config/node_key.json
|
||||
I[2019-07-16|18:20:36.482] Generated genesis file module=main path=/tmp/example/config/genesis.json
|
||||
```
|
||||
|
||||
Feel free to explore the generated files, which can be found at
|
||||
`/tmp/example/config` directory. Documentation on the config can be found
|
||||
[here](https://docs.tendermint.com/master/tendermint-core/configuration.html).
|
||||
|
||||
We are ready to start our application:
|
||||
|
||||
```bash
|
||||
./gradlew run
|
||||
|
||||
gRPC server started, listening on 26658
|
||||
```
|
||||
|
||||
Then we need to start Tendermint Core and point it to our application. Staying
|
||||
within the application directory execute:
|
||||
|
||||
```bash
|
||||
$ TMHOME="/tmp/example" tendermint node --abci grpc --proxy_app tcp://127.0.0.1:26658
|
||||
|
||||
I[2019-07-28|15:44:53.632] Version info module=main software=0.32.1 block=10 p2p=7
|
||||
I[2019-07-28|15:44:53.677] Starting Node module=main impl=Node
|
||||
I[2019-07-28|15:44:53.681] Started node module=main nodeInfo="{ProtocolVersion:{P2P:7 Block:10 App:0} ID_:7639e2841ccd47d5ae0f5aad3011b14049d3f452 ListenAddr:tcp://0.0.0.0:26656 Network:test-chain-Nhl3zk Version:0.32.1 Channels:4020212223303800 Moniker:Ivans-MacBook-Pro.local Other:{TxIndex:on RPCAddress:tcp://127.0.0.1:26657}}"
|
||||
I[2019-07-28|15:44:54.801] Executed block module=state height=8 validTxs=0 invalidTxs=0
|
||||
I[2019-07-28|15:44:54.814] Committed state module=state height=8 txs=0 appHash=0000000000000000
|
||||
```
|
||||
|
||||
Now open another tab in your terminal and try sending a transaction:
|
||||
|
||||
```bash
|
||||
$ curl -s 'localhost:26657/broadcast_tx_commit?tx="tendermint=rocks"'
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": "",
|
||||
"result": {
|
||||
"check_tx": {
|
||||
"gasWanted": "1"
|
||||
},
|
||||
"deliver_tx": {},
|
||||
"hash": "CDD3C6DFA0A08CAEDF546F9938A2EEC232209C24AA0E4201194E0AFB78A2C2BB",
|
||||
"height": "33"
|
||||
}
|
||||
```
|
||||
|
||||
Response should contain the height where this transaction was committed.
|
||||
|
||||
Now let's check if the given key now exists and its value:
|
||||
|
||||
```bash
|
||||
$ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": "",
|
||||
"result": {
|
||||
"response": {
|
||||
"log": "exists",
|
||||
"key": "dGVuZGVybWludA==",
|
||||
"value": "cm9ja3My"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`dGVuZGVybWludA==` and `cm9ja3M=` are the base64-encoding of the ASCII of `tendermint` and `rocks` accordingly.
|
||||
|
||||
## Outro
|
||||
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
|
||||
The full source code of this example project can be found [here](https://github.com/climber73/tendermint-abci-grpc-java).
|
||||
@@ -1,604 +0,0 @@
|
||||
<!---
|
||||
order: 4
|
||||
--->
|
||||
|
||||
# Creating an application in Kotlin
|
||||
|
||||
## Guide Assumptions
|
||||
|
||||
This guide is designed for beginners who want to get started with a Tendermint
|
||||
Core application from scratch. It does not assume that you have any prior
|
||||
experience with Tendermint Core.
|
||||
|
||||
Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state
|
||||
transition machine (your application) - written in any programming language - and securely
|
||||
replicates it on many machines.
|
||||
|
||||
By following along with this guide, you'll create a Tendermint Core project
|
||||
called kvstore, a (very) simple distributed BFT key-value store. The application (which should
|
||||
implementing the blockchain interface (ABCI)) will be written in Kotlin.
|
||||
|
||||
This guide assumes that you are not new to JVM world. If you are new please see [JVM Minimal Survival Guide](https://hadihariri.com/2013/12/29/jvm-minimal-survival-guide-for-the-dotnet-developer/#java-the-language-java-the-ecosystem-java-the-jvm) and [Gradle Docs](https://docs.gradle.org/current/userguide/userguide.html).
|
||||
|
||||
## Built-in app vs external app
|
||||
|
||||
If you use Golang, you can run your app and Tendermint Core in the same process to get maximum performance.
|
||||
[Cosmos SDK](https://github.com/cosmos/cosmos-sdk) is written this way.
|
||||
Please refer to [Writing a built-in Tendermint Core application in Go](./go-built-in.md) guide for details.
|
||||
|
||||
If you choose another language, like we did in this guide, you have to write a separate app,
|
||||
which will communicate with Tendermint Core via a socket (UNIX or TCP) or gRPC.
|
||||
This guide will show you how to build external application using RPC server.
|
||||
|
||||
Having a separate application might give you better security guarantees as two
|
||||
processes would be communicating via established binary protocol. Tendermint
|
||||
Core will not have access to application's state.
|
||||
|
||||
## 1.1 Installing Java and Gradle
|
||||
|
||||
Please refer to [the Oracle's guide for installing JDK](https://www.oracle.com/technetwork/java/javase/downloads/index.html).
|
||||
|
||||
Verify that you have installed Java successfully:
|
||||
|
||||
```bash
|
||||
java -version
|
||||
java version "1.8.0_162"
|
||||
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
|
||||
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
|
||||
```
|
||||
|
||||
You can choose any version of Java higher or equal to 8.
|
||||
In my case it is Java SE Development Kit 8.
|
||||
|
||||
Make sure you have `$JAVA_HOME` environment variable set:
|
||||
|
||||
```bash
|
||||
echo $JAVA_HOME
|
||||
/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
|
||||
```
|
||||
|
||||
For Gradle installation, please refer to [their official guide](https://gradle.org/install/).
|
||||
|
||||
## 1.2 Creating a new Kotlin project
|
||||
|
||||
We'll start by creating a new Gradle project.
|
||||
|
||||
```bash
|
||||
export KVSTORE_HOME=~/kvstore
|
||||
mkdir $KVSTORE_HOME
|
||||
cd $KVSTORE_HOME
|
||||
```
|
||||
|
||||
Inside the example directory run:
|
||||
|
||||
```bash
|
||||
gradle init --dsl groovy --package io.example --project-name example --type kotlin-application
|
||||
```
|
||||
|
||||
This will create a new project for you. The tree of files should look like:
|
||||
|
||||
```bash
|
||||
tree
|
||||
.
|
||||
|-- build.gradle
|
||||
|-- gradle
|
||||
| `-- wrapper
|
||||
| |-- gradle-wrapper.jar
|
||||
| `-- gradle-wrapper.properties
|
||||
|-- gradlew
|
||||
|-- gradlew.bat
|
||||
|-- settings.gradle
|
||||
`-- src
|
||||
|-- main
|
||||
| |-- kotlin
|
||||
| | `-- io
|
||||
| | `-- example
|
||||
| | `-- App.kt
|
||||
| `-- resources
|
||||
`-- test
|
||||
|-- kotlin
|
||||
| `-- io
|
||||
| `-- example
|
||||
| `-- AppTest.kt
|
||||
`-- resources
|
||||
```
|
||||
|
||||
When run, this should print "Hello world." to the standard output.
|
||||
|
||||
```bash
|
||||
./gradlew run
|
||||
> Task :run
|
||||
Hello world.
|
||||
```
|
||||
|
||||
## 1.3 Writing a Tendermint Core application
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
### 1.3.1 Compile .proto files
|
||||
|
||||
Add the following piece to the top of the `build.gradle`:
|
||||
|
||||
```groovy
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Enable the protobuf plugin in the `plugins` section of the `build.gradle`:
|
||||
|
||||
```groovy
|
||||
plugins {
|
||||
id 'com.google.protobuf' version '0.8.8'
|
||||
}
|
||||
```
|
||||
|
||||
Add the following code to `build.gradle`:
|
||||
|
||||
```groovy
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = "com.google.protobuf:protoc:3.7.1"
|
||||
}
|
||||
plugins {
|
||||
grpc {
|
||||
artifact = 'io.grpc:protoc-gen-grpc-java:1.22.1'
|
||||
}
|
||||
}
|
||||
generateProtoTasks {
|
||||
all()*.plugins {
|
||||
grpc {}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Now we should be ready to compile the `*.proto` files.
|
||||
|
||||
Copy the necessary `.proto` files to your project:
|
||||
|
||||
```bash
|
||||
mkdir -p \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/abci \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/version \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/crypto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/libs \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/gogo/protobuf/gogoproto
|
||||
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/abci/types.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/abci/types.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/version/version.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/version/version.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/types/types.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types/types.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/types/evidence.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types/evidence.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/types/params.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/types/params.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/crypto/merkle.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/crypto/merkle.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/crypto/keys.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/crypto/keys.proto
|
||||
cp $GOPATH/src/github.com/tendermint/tendermint/proto/tendermint/libs/types.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/tendermint/tendermint/proto/tendermint/libs/types.proto
|
||||
cp $GOPATH/src/github.com/gogo/protobuf/gogoproto/gogo.proto \
|
||||
$KVSTORE_HOME/src/main/proto/github.com/gogo/protobuf/gogoproto/gogo.proto
|
||||
```
|
||||
|
||||
Add these dependencies to `build.gradle`:
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'io.grpc:grpc-protobuf:1.22.1'
|
||||
implementation 'io.grpc:grpc-netty-shaded:1.22.1'
|
||||
implementation 'io.grpc:grpc-stub:1.22.1'
|
||||
}
|
||||
```
|
||||
|
||||
To generate all protobuf-type classes run:
|
||||
|
||||
```bash
|
||||
./gradlew generateProto
|
||||
```
|
||||
|
||||
To verify that everything went smoothly, you can inspect the `build/generated/` directory:
|
||||
|
||||
```bash
|
||||
tree build/generated/
|
||||
build/generated/
|
||||
`-- source
|
||||
`-- proto
|
||||
`-- main
|
||||
|-- grpc
|
||||
| `-- types
|
||||
| `-- ABCIApplicationGrpc.java
|
||||
`-- java
|
||||
|-- com
|
||||
| `-- google
|
||||
| `-- protobuf
|
||||
| `-- GoGoProtos.java
|
||||
|-- common
|
||||
| `-- Types.java
|
||||
|-- merkle
|
||||
| `-- Merkle.java
|
||||
`-- types
|
||||
`-- Types.java
|
||||
```
|
||||
|
||||
### 1.3.2 Implementing ABCI
|
||||
|
||||
The resulting `$KVSTORE_HOME/build/generated/source/proto/main/grpc/types/ABCIApplicationGrpc.java` file
|
||||
contains the abstract class `ABCIApplicationImplBase`, which is an interface we'll need to implement.
|
||||
|
||||
Create `$KVSTORE_HOME/src/main/kotlin/io/example/KVStoreApp.kt` file with the following content:
|
||||
|
||||
```kotlin
|
||||
package io.example
|
||||
|
||||
import io.grpc.stub.StreamObserver
|
||||
import types.ABCIApplicationGrpc
|
||||
import types.Types.*
|
||||
|
||||
class KVStoreApp : ABCIApplicationGrpc.ABCIApplicationImplBase() {
|
||||
|
||||
// methods implementation
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Now I will go through each method of `ABCIApplicationImplBase` explaining when it's called and adding
|
||||
required business logic.
|
||||
|
||||
### 1.3.3 CheckTx
|
||||
|
||||
When a new transaction is added to the Tendermint Core, it will ask the
|
||||
application to check it (validate the format, signatures, etc.).
|
||||
|
||||
```kotlin
|
||||
override fun checkTx(req: RequestCheckTx, responseObserver: StreamObserver<ResponseCheckTx>) {
|
||||
val code = req.tx.validate()
|
||||
val resp = ResponseCheckTx.newBuilder()
|
||||
.setCode(code)
|
||||
.setGasWanted(1)
|
||||
.build()
|
||||
responseObserver.onNext(resp)
|
||||
responseObserver.onCompleted()
|
||||
}
|
||||
|
||||
private fun ByteString.validate(): Int {
|
||||
val parts = this.split('=')
|
||||
if (parts.size != 2) {
|
||||
return 1
|
||||
}
|
||||
val key = parts[0]
|
||||
val value = parts[1]
|
||||
|
||||
// check if the same key=value already exists
|
||||
val stored = getPersistedValue(key)
|
||||
if (stored != null && stored.contentEquals(value)) {
|
||||
return 2
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
private fun ByteString.split(separator: Char): List<ByteArray> {
|
||||
val arr = this.toByteArray()
|
||||
val i = (0 until this.size()).firstOrNull { arr[it] == separator.toByte() }
|
||||
?: return emptyList()
|
||||
return listOf(
|
||||
this.substring(0, i).toByteArray(),
|
||||
this.substring(i + 1).toByteArray()
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
Don't worry if this does not compile yet.
|
||||
|
||||
If the transaction does not have a form of `{bytes}={bytes}`, we return `1`
|
||||
code. When the same key=value already exist (same key and value), we return `2`
|
||||
code. For others, we return a zero code indicating that they are valid.
|
||||
|
||||
Note that anything with non-zero code will be considered invalid (`-1`, `100`,
|
||||
etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[JetBrains Xodus](https://github.com/JetBrains/xodus), which is a transactional schema-less embedded high-performance database written in Java.
|
||||
|
||||
`build.gradle`:
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.xodus:xodus-environment:1.3.91'
|
||||
}
|
||||
```
|
||||
|
||||
```kotlin
|
||||
...
|
||||
import jetbrains.exodus.ArrayByteIterable
|
||||
import jetbrains.exodus.env.Environment
|
||||
import jetbrains.exodus.env.Store
|
||||
import jetbrains.exodus.env.StoreConfig
|
||||
import jetbrains.exodus.env.Transaction
|
||||
|
||||
class KVStoreApp(
|
||||
private val env: Environment
|
||||
) : ABCIApplicationGrpc.ABCIApplicationImplBase() {
|
||||
|
||||
private var txn: Transaction? = null
|
||||
private var store: Store? = null
|
||||
|
||||
...
|
||||
|
||||
private fun getPersistedValue(k: ByteArray): ByteArray? {
|
||||
return env.computeInReadonlyTransaction { txn ->
|
||||
val store = env.openStore("store", StoreConfig.WITHOUT_DUPLICATES, txn)
|
||||
store.get(txn, ArrayByteIterable(k))?.bytesUnsafe
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3.4 BeginBlock -> DeliverTx -> EndBlock -> Commit
|
||||
|
||||
When Tendermint Core has decided on the block, it's transferred to the
|
||||
application in 3 parts: `BeginBlock`, one `DeliverTx` per transaction and
|
||||
`EndBlock` in the end. `DeliverTx` are being transferred asynchronously, but the
|
||||
responses are expected to come in order.
|
||||
|
||||
```kotlin
|
||||
override fun beginBlock(req: RequestBeginBlock, responseObserver: StreamObserver<ResponseBeginBlock>) {
|
||||
txn = env.beginTransaction()
|
||||
store = env.openStore("store", StoreConfig.WITHOUT_DUPLICATES, txn!!)
|
||||
val resp = ResponseBeginBlock.newBuilder().build()
|
||||
responseObserver.onNext(resp)
|
||||
responseObserver.onCompleted()
|
||||
}
|
||||
```
|
||||
|
||||
Here we begin a new transaction, which will accumulate the block's transactions and open the corresponding store.
|
||||
|
||||
```kotlin
|
||||
override fun deliverTx(req: RequestDeliverTx, responseObserver: StreamObserver<ResponseDeliverTx>) {
|
||||
val code = req.tx.validate()
|
||||
if (code == 0) {
|
||||
val parts = req.tx.split('=')
|
||||
val key = ArrayByteIterable(parts[0])
|
||||
val value = ArrayByteIterable(parts[1])
|
||||
store!!.put(txn!!, key, value)
|
||||
}
|
||||
val resp = ResponseDeliverTx.newBuilder()
|
||||
.setCode(code)
|
||||
.build()
|
||||
responseObserver.onNext(resp)
|
||||
responseObserver.onCompleted()
|
||||
}
|
||||
```
|
||||
|
||||
If the transaction is badly formatted or the same key=value already exist, we
|
||||
again return the non-zero code. Otherwise, we add it to the store.
|
||||
|
||||
In the current design, a block can include incorrect transactions (those who
|
||||
passed `CheckTx`, but failed `DeliverTx` or transactions included by the proposer
|
||||
directly). This is done for performance reasons.
|
||||
|
||||
Note we can't commit transactions inside the `DeliverTx` because in such case
|
||||
`Query`, which may be called in parallel, will return inconsistent data (i.e.
|
||||
it will report that some value already exist even when the actual block was not
|
||||
yet committed).
|
||||
|
||||
`Commit` instructs the application to persist the new state.
|
||||
|
||||
```kotlin
|
||||
override fun commit(req: RequestCommit, responseObserver: StreamObserver<ResponseCommit>) {
|
||||
txn!!.commit()
|
||||
val resp = ResponseCommit.newBuilder()
|
||||
.setData(ByteString.copyFrom(ByteArray(8)))
|
||||
.build()
|
||||
responseObserver.onNext(resp)
|
||||
responseObserver.onCompleted()
|
||||
}
|
||||
```
|
||||
|
||||
### 1.3.5 Query
|
||||
|
||||
Now, when the client wants to know whenever a particular key/value exist, it
|
||||
will call Tendermint Core RPC `/abci_query` endpoint, which in turn will call
|
||||
the application's `Query` method.
|
||||
|
||||
Applications are free to provide their own APIs. But by using Tendermint Core
|
||||
as a proxy, clients (including [light client
|
||||
package](https://godoc.org/github.com/tendermint/tendermint/light)) can leverage
|
||||
the unified API across different applications. Plus they won't have to call the
|
||||
otherwise separate Tendermint Core API for additional proofs.
|
||||
|
||||
Note we don't include a proof here.
|
||||
|
||||
```kotlin
|
||||
override fun query(req: RequestQuery, responseObserver: StreamObserver<ResponseQuery>) {
|
||||
val k = req.data.toByteArray()
|
||||
val v = getPersistedValue(k)
|
||||
val builder = ResponseQuery.newBuilder()
|
||||
if (v == null) {
|
||||
builder.log = "does not exist"
|
||||
} else {
|
||||
builder.log = "exists"
|
||||
builder.key = ByteString.copyFrom(k)
|
||||
builder.value = ByteString.copyFrom(v)
|
||||
}
|
||||
responseObserver.onNext(builder.build())
|
||||
responseObserver.onCompleted()
|
||||
}
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instances
|
||||
|
||||
Put the following code into the `$KVSTORE_HOME/src/main/kotlin/io/example/App.kt` file:
|
||||
|
||||
```kotlin
|
||||
package io.example
|
||||
|
||||
import jetbrains.exodus.env.Environments
|
||||
|
||||
fun main() {
|
||||
Environments.newInstance("tmp/storage").use { env ->
|
||||
val app = KVStoreApp(env)
|
||||
val server = GrpcServer(app, 26658)
|
||||
server.start()
|
||||
server.blockUntilShutdown()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
It is the entry point of the application.
|
||||
Here we create a special object `Environment`, which knows where to store the application state.
|
||||
Then we create and start the gRPC server to handle Tendermint Core requests.
|
||||
|
||||
Create `$KVSTORE_HOME/src/main/kotlin/io/example/GrpcServer.kt` file with the following content:
|
||||
|
||||
```kotlin
|
||||
package io.example
|
||||
|
||||
import io.grpc.BindableService
|
||||
import io.grpc.ServerBuilder
|
||||
|
||||
class GrpcServer(
|
||||
private val service: BindableService,
|
||||
private val port: Int
|
||||
) {
|
||||
private val server = ServerBuilder
|
||||
.forPort(port)
|
||||
.addService(service)
|
||||
.build()
|
||||
|
||||
fun start() {
|
||||
server.start()
|
||||
println("gRPC server started, listening on $port")
|
||||
Runtime.getRuntime().addShutdownHook(object : Thread() {
|
||||
override fun run() {
|
||||
println("shutting down gRPC server since JVM is shutting down")
|
||||
this@GrpcServer.stop()
|
||||
println("server shut down")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
server.shutdown()
|
||||
}
|
||||
|
||||
/**
|
||||
* Await termination on the main thread since the grpc library uses daemon threads.
|
||||
*/
|
||||
fun blockUntilShutdown() {
|
||||
server.awaitTermination()
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## 1.5 Getting Up and Running
|
||||
|
||||
To create a default configuration, nodeKey and private validator files, let's
|
||||
execute `tendermint init`. But before we do that, we will need to install
|
||||
Tendermint Core.
|
||||
|
||||
```bash
|
||||
rm -rf /tmp/example
|
||||
cd $GOPATH/src/github.com/tendermint/tendermint
|
||||
make install
|
||||
TMHOME="/tmp/example" tendermint init
|
||||
|
||||
I[2019-07-16|18:20:36.480] Generated private validator module=main keyFile=/tmp/example/config/priv_validator_key.json stateFile=/tmp/example2/data/priv_validator_state.json
|
||||
I[2019-07-16|18:20:36.481] Generated node key module=main path=/tmp/example/config/node_key.json
|
||||
I[2019-07-16|18:20:36.482] Generated genesis file module=main path=/tmp/example/config/genesis.json
|
||||
```
|
||||
|
||||
Feel free to explore the generated files, which can be found at
|
||||
`/tmp/example/config` directory. Documentation on the config can be found
|
||||
[here](https://docs.tendermint.com/master/tendermint-core/configuration.html).
|
||||
|
||||
We are ready to start our application:
|
||||
|
||||
```bash
|
||||
./gradlew run
|
||||
|
||||
gRPC server started, listening on 26658
|
||||
```
|
||||
|
||||
Then we need to start Tendermint Core and point it to our application. Staying
|
||||
within the application directory execute:
|
||||
|
||||
```bash
|
||||
TMHOME="/tmp/example" tendermint node --abci grpc --proxy_app tcp://127.0.0.1:26658
|
||||
|
||||
I[2019-07-28|15:44:53.632] Version info module=main software=0.32.1 block=10 p2p=7
|
||||
I[2019-07-28|15:44:53.677] Starting Node module=main impl=Node
|
||||
I[2019-07-28|15:44:53.681] Started node module=main nodeInfo="{ProtocolVersion:{P2P:7 Block:10 App:0} ID_:7639e2841ccd47d5ae0f5aad3011b14049d3f452 ListenAddr:tcp://0.0.0.0:26656 Network:test-chain-Nhl3zk Version:0.32.1 Channels:4020212223303800 Moniker:Ivans-MacBook-Pro.local Other:{TxIndex:on RPCAddress:tcp://127.0.0.1:26657}}"
|
||||
I[2019-07-28|15:44:54.801] Executed block module=state height=8 validTxs=0 invalidTxs=0
|
||||
I[2019-07-28|15:44:54.814] Committed state module=state height=8 txs=0 appHash=0000000000000000
|
||||
```
|
||||
|
||||
Now open another tab in your terminal and try sending a transaction:
|
||||
|
||||
```bash
|
||||
curl -s 'localhost:26657/broadcast_tx_commit?tx="tendermint=rocks"'
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": "",
|
||||
"result": {
|
||||
"check_tx": {
|
||||
"gasWanted": "1"
|
||||
},
|
||||
"deliver_tx": {},
|
||||
"hash": "CDD3C6DFA0A08CAEDF546F9938A2EEC232209C24AA0E4201194E0AFB78A2C2BB",
|
||||
"height": "33"
|
||||
}
|
||||
```
|
||||
|
||||
Response should contain the height where this transaction was committed.
|
||||
|
||||
Now let's check if the given key now exists and its value:
|
||||
|
||||
```bash
|
||||
curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": "",
|
||||
"result": {
|
||||
"response": {
|
||||
"log": "exists",
|
||||
"key": "dGVuZGVybWludA==",
|
||||
"value": "cm9ja3My"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`dGVuZGVybWludA==` and `cm9ja3M=` are the base64-encoding of the ASCII of `tendermint` and `rocks` accordingly.
|
||||
|
||||
## Outro
|
||||
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
|
||||
The full source code of this example project can be found [here](https://github.com/climber73/tendermint-abci-grpc-kotlin).
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
master master
|
||||
main main
|
||||
v0.33.x v0.33
|
||||
v0.34.x v0.34
|
||||
v0.35.x v0.35
|
||||
|
||||
+4
-5
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
Package evidence handles all evidence storage and gossiping from detection to block proposal.
|
||||
For the different types of evidence refer to the `evidence.go` file in the types package
|
||||
or https://github.com/tendermint/spec/blob/master/spec/consensus/light-client/accountability.md.
|
||||
or https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/accountability.md.
|
||||
|
||||
Gossiping
|
||||
# Gossiping
|
||||
|
||||
The core functionality begins with the evidence reactor (see reactor.
|
||||
go) which operates both the sending and receiving of evidence.
|
||||
@@ -29,7 +29,7 @@ There are two buckets that evidence can be stored in: Pending & Committed.
|
||||
|
||||
All evidence is proto encoded to disk.
|
||||
|
||||
Proposing
|
||||
# Proposing
|
||||
|
||||
When a new block is being proposed (in state/execution.go#CreateProposalBlock),
|
||||
`PendingEvidence(maxBytes)` is called to send up to the maxBytes of uncommitted evidence, from the evidence store,
|
||||
@@ -42,12 +42,11 @@ Once the proposed evidence is submitted,
|
||||
the evidence is marked as committed and is moved from the broadcasted set to the committed set.
|
||||
As a result it is also removed from the concurrent list so that it is no longer gossiped.
|
||||
|
||||
Minor Functionality
|
||||
# Minor Functionality
|
||||
|
||||
As all evidence (including POLC's) are bounded by an expiration date, those that exceed this are no longer needed
|
||||
and hence pruned. Currently, only committed evidence in which a marker to the height that the evidence was committed
|
||||
and hence very small is saved. All updates are made from the `Update(block, state)` function which should be called
|
||||
when a new block is committed.
|
||||
|
||||
*/
|
||||
package evidence
|
||||
|
||||
+17
-16
@@ -284,16 +284,16 @@ func (c *Client) restoreTrustedLightBlock() error {
|
||||
|
||||
// if options.Height:
|
||||
//
|
||||
// 1) ahead of trustedLightBlock.Height => fetch light blocks (same height as
|
||||
// 1. ahead of trustedLightBlock.Height => fetch light blocks (same height as
|
||||
// trustedLightBlock) from primary provider and check it's hash matches the
|
||||
// trustedLightBlock's hash (if not, remove trustedLightBlock and all the light blocks
|
||||
// before)
|
||||
//
|
||||
// 2) equals trustedLightBlock.Height => check options.Hash matches the
|
||||
// 2. equals trustedLightBlock.Height => check options.Hash matches the
|
||||
// trustedLightBlock's hash (if not, remove trustedLightBlock and all the light blocks
|
||||
// before)
|
||||
//
|
||||
// 3) behind trustedLightBlock.Height => remove all the light blocks between
|
||||
// 3. behind trustedLightBlock.Height => remove all the light blocks between
|
||||
// options.Height and trustedLightBlock.Height, update trustedLightBlock, then
|
||||
// check options.Hash matches the trustedLightBlock's hash (if not, remove
|
||||
// trustedLightBlock and all the light blocks before)
|
||||
@@ -395,10 +395,10 @@ func (c *Client) initializeWithTrustOptions(ctx context.Context, options TrustOp
|
||||
// TrustedLightBlock returns a trusted light block at the given height (0 - the latest).
|
||||
//
|
||||
// It returns an error if:
|
||||
// - there are some issues with the trusted store, although that should not
|
||||
// happen normally;
|
||||
// - negative height is passed;
|
||||
// - header has not been verified yet and is therefore not in the store
|
||||
// - there are some issues with the trusted store, although that should not
|
||||
// happen normally;
|
||||
// - negative height is passed;
|
||||
// - header has not been verified yet and is therefore not in the store
|
||||
//
|
||||
// Safe for concurrent use by multiple goroutines.
|
||||
func (c *Client) TrustedLightBlock(height int64) (*types.LightBlock, error) {
|
||||
@@ -506,12 +506,13 @@ func (c *Client) VerifyLightBlockAtHeight(ctx context.Context, height int64, now
|
||||
// headers are not adjacent, verifySkipping is performed and necessary (not all)
|
||||
// intermediate headers will be requested. See the specification for details.
|
||||
// Intermediate headers are not saved to database.
|
||||
// https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md
|
||||
// https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client.md
|
||||
//
|
||||
// If the header, which is older than the currently trusted header, is
|
||||
// requested and the light client does not have it, VerifyHeader will perform:
|
||||
// a) verifySkipping verification if nearest trusted header is found & not expired
|
||||
// b) backwards verification in all other cases
|
||||
//
|
||||
// a) verifySkipping verification if nearest trusted header is found & not expired
|
||||
// b) backwards verification in all other cases
|
||||
//
|
||||
// It returns ErrOldHeaderExpired if the latest trusted header expired.
|
||||
//
|
||||
@@ -980,12 +981,12 @@ func (c *Client) backwards(
|
||||
// lightBlockFromPrimary retrieves the lightBlock from the primary provider
|
||||
// at the specified height. This method also handles provider behavior as follows:
|
||||
//
|
||||
// 1. If the provider does not respond or does not have the block, it tries again
|
||||
// with a different provider
|
||||
// 2. If all providers return the same error, the light client forwards the error to
|
||||
// where the initial request came from
|
||||
// 3. If the provider provides an invalid light block, is deemed unreliable or returns
|
||||
// any other error, the primary is permanently dropped and is replaced by a witness.
|
||||
// 1. If the provider does not respond or does not have the block, it tries again
|
||||
// with a different provider
|
||||
// 2. If all providers return the same error, the light client forwards the error to
|
||||
// where the initial request came from
|
||||
// 3. If the provider provides an invalid light block, is deemed unreliable or returns
|
||||
// any other error, the primary is permanently dropped and is replaced by a witness.
|
||||
func (c *Client) lightBlockFromPrimary(ctx context.Context, height int64) (*types.LightBlock, error) {
|
||||
c.providerMutex.Lock()
|
||||
l, err := c.primary.LightBlock(ctx, height)
|
||||
|
||||
+26
-26
@@ -63,38 +63,38 @@ This package provides three major things:
|
||||
|
||||
Example usage:
|
||||
|
||||
db, err := dbm.NewGoLevelDB("light-client-db", dbDir)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
db, err := dbm.NewGoLevelDB("light-client-db", dbDir)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
c, err := NewHTTPClient(
|
||||
chainID,
|
||||
TrustOptions{
|
||||
Period: 504 * time.Hour, // 21 days
|
||||
Height: 100,
|
||||
Hash: header.Hash(),
|
||||
},
|
||||
"http://localhost:26657",
|
||||
[]string{"http://witness1:26657"},
|
||||
dbs.New(db, ""),
|
||||
)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
c, err := NewHTTPClient(
|
||||
chainID,
|
||||
TrustOptions{
|
||||
Period: 504 * time.Hour, // 21 days
|
||||
Height: 100,
|
||||
Hash: header.Hash(),
|
||||
},
|
||||
"http://localhost:26657",
|
||||
[]string{"http://witness1:26657"},
|
||||
dbs.New(db, ""),
|
||||
)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
h, err := c.TrustedHeader(100)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
fmt.Println("header", h)
|
||||
h, err := c.TrustedHeader(100)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
fmt.Println("header", h)
|
||||
|
||||
Check out other examples in example_test.go
|
||||
|
||||
## 2. Pure functions to verify a new header (see verifier.go)
|
||||
|
||||
Verify function verifies a new header against some trusted header. See
|
||||
https://github.com/tendermint/spec/blob/master/spec/consensus/light-client/verification.md
|
||||
https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/verification.md
|
||||
for details.
|
||||
|
||||
There are two methods of verification: sequential and bisection
|
||||
@@ -118,10 +118,10 @@ as a wrapper, which verifies all the headers, using a light client connected to
|
||||
some other node.
|
||||
|
||||
See
|
||||
https://docs.tendermint.com/master/tendermint-core/light-client-protocol.html
|
||||
https://docs.tendermint.com/main/tendermint-core/light-client-protocol.html
|
||||
for usage example.
|
||||
Or see
|
||||
https://github.com/tendermint/spec/tree/master/spec/consensus/light-client
|
||||
https://github.com/tendermint/tendermint/tree/main/spec/consensus/light-client
|
||||
for the full spec
|
||||
*/
|
||||
package light
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Local Cluster with Docker Compose
|
||||
|
||||
See the [docs](https://docs.tendermint.com/master/networks/docker-compose.html).
|
||||
See the [docs](https://docs.tendermint.com/main/networks/docker-compose.html).
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Remote Cluster with Terraform and Ansible
|
||||
|
||||
See the [docs](https://docs.tendermint.com/master/networks/terraform-and-ansible.html).
|
||||
See the [docs](https://docs.tendermint.com/main/networks/terraform-and-ansible.html).
|
||||
|
||||
+4
-5
@@ -4,8 +4,7 @@ The p2p package provides an abstraction around peer-to-peer communication.
|
||||
|
||||
Docs:
|
||||
|
||||
- [Connection](https://docs.tendermint.com/master/spec/p2p/connection.html) for details on how connections and multiplexing work
|
||||
- [Peer](https://docs.tendermint.com/master/spec/p2p/node.html) for details on peer ID, handshakes, and peer exchange
|
||||
- [Node](https://docs.tendermint.com/master/spec/p2p/node.html) for details about different types of nodes and how they should work
|
||||
- [Pex](https://docs.tendermint.com/master/spec/reactors/pex/pex.html) for details on peer discovery and exchange
|
||||
- [Config](https://docs.tendermint.com/master/spec/p2p/config.html) for details on some config option
|
||||
- [Connection](https://github.com/tendermint/tendermint/blob/main/spec/p2p/connection.md) for details on how connections and multiplexing work
|
||||
- [Peer](https://github.com/tendermint/tendermint/blob/main/spec/p2p/node.md) for details on peer ID, handshakes, and peer exchange
|
||||
- [Node](https://github.com/tendermint/tendermint/blob/main/spec/p2p/node.md) for details about different types of nodes and how they should work
|
||||
- [Config](https://github.com/tendermint/tendermint/blob/main/spec/p2p/config.md) for details on some config option
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// ABCIQuery queries the application for some information.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/ABCI/abci_query
|
||||
// More: https://docs.tendermint.com/main/rpc/#/ABCI/abci_query
|
||||
func ABCIQuery(
|
||||
ctx *rpctypes.Context,
|
||||
path string,
|
||||
@@ -31,7 +31,7 @@ func ABCIQuery(
|
||||
}
|
||||
|
||||
// ABCIInfo gets some info about the application.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/ABCI/abci_info
|
||||
// More: https://docs.tendermint.com/main/rpc/#/ABCI/abci_info
|
||||
func ABCIInfo(ctx *rpctypes.Context) (*ctypes.ResultABCIInfo, error) {
|
||||
resInfo, err := env.ProxyAppQuery.InfoSync(proxy.RequestInfo)
|
||||
if err != nil {
|
||||
|
||||
+5
-5
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
// BlockchainInfo gets block headers for minHeight <= height <= maxHeight.
|
||||
// Block headers are returned in descending order (highest first).
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/blockchain
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/blockchain
|
||||
func BlockchainInfo(ctx *rpctypes.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) {
|
||||
// maximum 20 block metas
|
||||
const limit int64 = 20
|
||||
@@ -77,7 +77,7 @@ func filterMinMax(base, height, min, max, limit int64) (int64, int64, error) {
|
||||
|
||||
// Block gets block at a given height.
|
||||
// If no height is provided, it will fetch the latest block.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/block
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/block
|
||||
func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error) {
|
||||
height, err := getHeight(env.BlockStore.Height(), heightPtr)
|
||||
if err != nil {
|
||||
@@ -93,7 +93,7 @@ func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error)
|
||||
}
|
||||
|
||||
// BlockByHash gets block by hash.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/block_by_hash
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/block_by_hash
|
||||
func BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error) {
|
||||
block := env.BlockStore.LoadBlockByHash(hash)
|
||||
if block == nil {
|
||||
@@ -106,7 +106,7 @@ func BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error
|
||||
|
||||
// Commit gets block commit at a given height.
|
||||
// If no height is provided, it will fetch the commit for the latest block.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/commit
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/commit
|
||||
func Commit(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultCommit, error) {
|
||||
height, err := getHeight(env.BlockStore.Height(), heightPtr)
|
||||
if err != nil {
|
||||
@@ -137,7 +137,7 @@ func Commit(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultCommit, erro
|
||||
// Results are for the height of the block containing the txs.
|
||||
// Thus response.results.deliver_tx[5] is the results of executing
|
||||
// getBlock(h).Txs[5]
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/block_results
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/block_results
|
||||
func BlockResults(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlockResults, error) {
|
||||
height, err := getHeight(env.BlockStore.Height(), heightPtr)
|
||||
if err != nil {
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
// validators are sorted by their voting power - this is the canonical order
|
||||
// for the validators in the set as used in computing their Merkle root.
|
||||
//
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/validators
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/validators
|
||||
func Validators(ctx *rpctypes.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*ctypes.ResultValidators, error) {
|
||||
// The latest validator that we know is the NextValidator of the last block.
|
||||
height, err := getHeight(latestUncommittedHeight(), heightPtr)
|
||||
@@ -47,7 +47,7 @@ func Validators(ctx *rpctypes.Context, heightPtr *int64, pagePtr, perPagePtr *in
|
||||
|
||||
// DumpConsensusState dumps consensus state.
|
||||
// UNSTABLE
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/dump_consensus_state
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/dump_consensus_state
|
||||
func DumpConsensusState(ctx *rpctypes.Context) (*ctypes.ResultDumpConsensusState, error) {
|
||||
// Get Peer consensus states.
|
||||
peers := env.P2PPeers.Peers().List()
|
||||
@@ -80,7 +80,7 @@ func DumpConsensusState(ctx *rpctypes.Context) (*ctypes.ResultDumpConsensusState
|
||||
|
||||
// ConsensusState returns a concise summary of the consensus state.
|
||||
// UNSTABLE
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/consensus_state
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/consensus_state
|
||||
func ConsensusState(ctx *rpctypes.Context) (*ctypes.ResultConsensusState, error) {
|
||||
// Get self round state.
|
||||
bz, err := env.ConsensusState.GetRoundStateSimpleJSON()
|
||||
@@ -89,7 +89,7 @@ func ConsensusState(ctx *rpctypes.Context) (*ctypes.ResultConsensusState, error)
|
||||
|
||||
// ConsensusParams gets the consensus parameters at the given block height.
|
||||
// If no height is provided, it will fetch the latest consensus params.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/consensus_params
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/consensus_params
|
||||
func ConsensusParams(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultConsensusParams, error) {
|
||||
// The latest consensus params that we know is the consensus params after the
|
||||
// last block.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
Package core defines the Tendermint RPC endpoints.
|
||||
|
||||
Tendermint ships with its own JSONRPC library -
|
||||
https://github.com/tendermint/tendermint/tree/master/rpc/jsonrpc.
|
||||
https://github.com/tendermint/tendermint/tree/main/rpc/jsonrpc.
|
||||
|
||||
## Get the list
|
||||
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ const (
|
||||
)
|
||||
|
||||
// Subscribe for events via WebSocket.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Websocket/subscribe
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Websocket/subscribe
|
||||
func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, error) {
|
||||
addr := ctx.RemoteAddr()
|
||||
|
||||
@@ -102,7 +102,7 @@ func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, er
|
||||
}
|
||||
|
||||
// Unsubscribe from events via WebSocket.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Websocket/unsubscribe
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Websocket/unsubscribe
|
||||
func Unsubscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error) {
|
||||
addr := ctx.RemoteAddr()
|
||||
env.Logger.Info("Unsubscribe from query", "remote", addr, "query", query)
|
||||
@@ -118,7 +118,7 @@ func Unsubscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe
|
||||
}
|
||||
|
||||
// UnsubscribeAll from all events via WebSocket.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Websocket/unsubscribe_all
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Websocket/unsubscribe_all
|
||||
func UnsubscribeAll(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error) {
|
||||
addr := ctx.RemoteAddr()
|
||||
env.Logger.Info("Unsubscribe from all", "remote", addr)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// BroadcastEvidence broadcasts evidence of the misbehavior.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/broadcast_evidence
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/broadcast_evidence
|
||||
func BroadcastEvidence(ctx *rpctypes.Context, ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
|
||||
if ev == nil {
|
||||
return nil, errors.New("no evidence was provided")
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// Health gets node health. Returns empty result (200 OK) on success, no
|
||||
// response - in case of an error.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/health
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/health
|
||||
func Health(ctx *rpctypes.Context) (*ctypes.ResultHealth, error) {
|
||||
return &ctypes.ResultHealth{}, nil
|
||||
}
|
||||
|
||||
+6
-6
@@ -18,7 +18,7 @@ import (
|
||||
|
||||
// BroadcastTxAsync returns right away, with no response. Does not wait for
|
||||
// CheckTx nor DeliverTx results.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Tx/broadcast_tx_async
|
||||
func BroadcastTxAsync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
err := env.Mempool.CheckTx(tx, nil, mempl.TxInfo{})
|
||||
|
||||
@@ -30,7 +30,7 @@ func BroadcastTxAsync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadca
|
||||
|
||||
// BroadcastTxSync returns with the response from CheckTx. Does not wait for
|
||||
// DeliverTx result.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Tx/broadcast_tx_sync
|
||||
func BroadcastTxSync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
resCh := make(chan *abci.Response, 1)
|
||||
err := env.Mempool.CheckTx(tx, func(res *abci.Response) {
|
||||
@@ -60,7 +60,7 @@ func BroadcastTxSync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcas
|
||||
}
|
||||
|
||||
// BroadcastTxCommit returns with the responses from CheckTx and DeliverTx.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Tx/broadcast_tx_commit
|
||||
func BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||
subscriber := ctx.RemoteAddr()
|
||||
|
||||
@@ -149,7 +149,7 @@ func BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadc
|
||||
|
||||
// UnconfirmedTxs gets unconfirmed transactions (maximum ?limit entries)
|
||||
// including their number.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/unconfirmed_txs
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/unconfirmed_txs
|
||||
func UnconfirmedTxs(ctx *rpctypes.Context, limitPtr *int) (*ctypes.ResultUnconfirmedTxs, error) {
|
||||
// reuse per_page validator
|
||||
limit := validatePerPage(limitPtr)
|
||||
@@ -163,7 +163,7 @@ func UnconfirmedTxs(ctx *rpctypes.Context, limitPtr *int) (*ctypes.ResultUnconfi
|
||||
}
|
||||
|
||||
// NumUnconfirmedTxs gets number of unconfirmed transactions.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/num_unconfirmed_txs
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/num_unconfirmed_txs
|
||||
func NumUnconfirmedTxs(ctx *rpctypes.Context) (*ctypes.ResultUnconfirmedTxs, error) {
|
||||
return &ctypes.ResultUnconfirmedTxs{
|
||||
Count: env.Mempool.Size(),
|
||||
@@ -173,7 +173,7 @@ func NumUnconfirmedTxs(ctx *rpctypes.Context) (*ctypes.ResultUnconfirmedTxs, err
|
||||
|
||||
// CheckTx checks the transaction without executing it. The transaction won't
|
||||
// be added to the mempool either.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/check_tx
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Tx/check_tx
|
||||
func CheckTx(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultCheckTx, error) {
|
||||
res, err := env.ProxyAppMempool.CheckTxSync(abci.RequestCheckTx{Tx: tx})
|
||||
if err != nil {
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// NetInfo returns network info.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/net_info
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/net_info
|
||||
func NetInfo(ctx *rpctypes.Context) (*ctypes.ResultNetInfo, error) {
|
||||
peersList := env.P2PPeers.Peers().List()
|
||||
peers := make([]ctypes.Peer, 0, len(peersList))
|
||||
@@ -92,7 +92,7 @@ func UnsafeDialPeers(ctx *rpctypes.Context, peers []string, persistent, uncondit
|
||||
}
|
||||
|
||||
// Genesis returns genesis file.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/genesis
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/genesis
|
||||
func Genesis(ctx *rpctypes.Context) (*ctypes.ResultGenesis, error) {
|
||||
if len(env.genChunks) > 1 {
|
||||
return nil, errors.New("genesis response is large, please use the genesis_chunked API instead")
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// Status returns Tendermint status including node info, pubkey, latest block
|
||||
// hash, app hash, block height and time.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/status
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/status
|
||||
func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) {
|
||||
var (
|
||||
earliestBlockHeight int64
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import (
|
||||
// Tx allows you to query the transaction results. `nil` could mean the
|
||||
// transaction is in the mempool, invalidated, or was not sent in the first
|
||||
// place.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/tx
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/tx
|
||||
func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error) {
|
||||
// if index is disabled, return error
|
||||
if _, ok := env.TxIndexer.(*null.TxIndex); ok {
|
||||
@@ -53,7 +53,7 @@ func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error
|
||||
|
||||
// TxSearch allows you to query for multiple transactions results. It returns a
|
||||
// list of transactions (maximum ?per_page entries) and the total count.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/tx_search
|
||||
// More: https://docs.tendermint.com/main/rpc/#/Info/tx_search
|
||||
func TxSearch(
|
||||
ctx *rpctypes.Context,
|
||||
query string,
|
||||
|
||||
+33
-34
@@ -1,7 +1,7 @@
|
||||
// HTTP RPC server supporting calls via uri params, jsonrpc over HTTP, and jsonrpc over
|
||||
// websockets
|
||||
//
|
||||
// Client Requests
|
||||
// # Client Requests
|
||||
//
|
||||
// Suppose we want to expose the rpc function `HelloWorld(name string, num int)`.
|
||||
//
|
||||
@@ -9,12 +9,12 @@
|
||||
//
|
||||
// As a GET request, it would have URI encoded parameters, and look like:
|
||||
//
|
||||
// curl 'http://localhost:8008/hello_world?name="my_world"&num=5'
|
||||
// curl 'http://localhost:8008/hello_world?name="my_world"&num=5'
|
||||
//
|
||||
// Note the `'` around the url, which is just so bash doesn't ignore the quotes in `"my_world"`.
|
||||
// This should also work:
|
||||
//
|
||||
// curl http://localhost:8008/hello_world?name=\"my_world\"&num=5
|
||||
// curl http://localhost:8008/hello_world?name=\"my_world\"&num=5
|
||||
//
|
||||
// A GET request to `/` returns a list of available endpoints.
|
||||
// For those which take arguments, the arguments will be listed in order, with `_` where the actual value should be.
|
||||
@@ -23,20 +23,19 @@
|
||||
//
|
||||
// As a POST request, we use JSONRPC. For instance, the same request would have this as the body:
|
||||
//
|
||||
// {
|
||||
// "jsonrpc": "2.0",
|
||||
// "id": "anything",
|
||||
// "method": "hello_world",
|
||||
// "params": {
|
||||
// "name": "my_world",
|
||||
// "num": 5
|
||||
// }
|
||||
// }
|
||||
// {
|
||||
// "jsonrpc": "2.0",
|
||||
// "id": "anything",
|
||||
// "method": "hello_world",
|
||||
// "params": {
|
||||
// "name": "my_world",
|
||||
// "num": 5
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// With the above saved in file `data.json`, we can make the request with
|
||||
//
|
||||
// curl --data @data.json http://localhost:8008
|
||||
//
|
||||
// curl --data @data.json http://localhost:8008
|
||||
//
|
||||
// WebSocket (JSONRPC)
|
||||
//
|
||||
@@ -44,42 +43,42 @@
|
||||
// Websocket connections are available at their own endpoint, typically `/websocket`,
|
||||
// though this is configurable when starting the server.
|
||||
//
|
||||
// Server Definition
|
||||
// # Server Definition
|
||||
//
|
||||
// Define some types and routes:
|
||||
//
|
||||
// type ResultStatus struct {
|
||||
// Value string
|
||||
// }
|
||||
// type ResultStatus struct {
|
||||
// Value string
|
||||
// }
|
||||
//
|
||||
// Define some routes
|
||||
//
|
||||
// var Routes = map[string]*rpcserver.RPCFunc{
|
||||
// "status": rpcserver.NewRPCFunc(Status, "arg"),
|
||||
// }
|
||||
// var Routes = map[string]*rpcserver.RPCFunc{
|
||||
// "status": rpcserver.NewRPCFunc(Status, "arg"),
|
||||
// }
|
||||
//
|
||||
// An rpc function:
|
||||
//
|
||||
// func Status(v string) (*ResultStatus, error) {
|
||||
// return &ResultStatus{v}, nil
|
||||
// }
|
||||
// func Status(v string) (*ResultStatus, error) {
|
||||
// return &ResultStatus{v}, nil
|
||||
// }
|
||||
//
|
||||
// Now start the server:
|
||||
//
|
||||
// mux := http.NewServeMux()
|
||||
// rpcserver.RegisterRPCFuncs(mux, Routes)
|
||||
// wm := rpcserver.NewWebsocketManager(Routes)
|
||||
// mux.HandleFunc("/websocket", wm.WebsocketHandler)
|
||||
// logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
// listener, err := rpc.Listen("0.0.0.0:8080", rpcserver.Config{})
|
||||
// if err != nil { panic(err) }
|
||||
// go rpcserver.Serve(listener, mux, logger)
|
||||
// mux := http.NewServeMux()
|
||||
// rpcserver.RegisterRPCFuncs(mux, Routes)
|
||||
// wm := rpcserver.NewWebsocketManager(Routes)
|
||||
// mux.HandleFunc("/websocket", wm.WebsocketHandler)
|
||||
// logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
// listener, err := rpc.Listen("0.0.0.0:8080", rpcserver.Config{})
|
||||
// if err != nil { panic(err) }
|
||||
// go rpcserver.Serve(listener, mux, logger)
|
||||
//
|
||||
// Note that unix sockets are supported as well (eg. `/path/to/socket` instead of `0.0.0.0:8008`)
|
||||
// Now see all available endpoints by sending a GET request to `0.0.0.0:8008`.
|
||||
// Each route is available as a GET request, as a JSONRPCv2 POST request, and via JSONRPCv2 over websockets.
|
||||
//
|
||||
// Examples
|
||||
// # Examples
|
||||
//
|
||||
// - [Tendermint](https://github.com/tendermint/tendermint/blob/master/rpc/core/routes.go)
|
||||
// - [Tendermint](https://github.com/tendermint/tendermint/blob/main/rpc/core/routes.go)
|
||||
package jsonrpc
|
||||
|
||||
@@ -51,10 +51,10 @@ info:
|
||||
|
||||
ws ws://localhost:26657/websocket
|
||||
> { "jsonrpc": "2.0", "method": "subscribe", "params": ["tm.event='NewBlock'"], "id": 1 }
|
||||
version: "Master"
|
||||
version: "main"
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: https://github.com/tendermint/tendermint/blob/master/LICENSE
|
||||
url: https://github.com/tendermint/tendermint/blob/main/LICENSE
|
||||
servers:
|
||||
- url: https://rpc.cosmos.network
|
||||
description: Cosmos mainnet node to interact with the Tendermint RPC
|
||||
@@ -83,7 +83,7 @@ paths:
|
||||
description: |
|
||||
If you want to be sure that the transaction is included in a block, you can
|
||||
subscribe for the result using JSONRPC via a websocket. See
|
||||
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
|
||||
https://docs.tendermint.com/main/app-dev/subscribing-to-events-via-websocket.html
|
||||
If you haven't received anything after a couple of blocks, resend it. If the
|
||||
same happens again, send it to some other node. A few reasons why it could
|
||||
happen:
|
||||
@@ -95,7 +95,7 @@ paths:
|
||||
|
||||
|
||||
Please refer to
|
||||
https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
|
||||
https://docs.tendermint.com/main/tendermint-core/using-tendermint.html#formatting
|
||||
for formatting/encoding rules.
|
||||
parameters:
|
||||
- in: query
|
||||
@@ -127,7 +127,7 @@ paths:
|
||||
description: |
|
||||
If you want to be sure that the transaction is included in a block, you can
|
||||
subscribe for the result using JSONRPC via a websocket. See
|
||||
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
|
||||
https://docs.tendermint.com/main/app-dev/subscribing-to-events-via-websocket.html
|
||||
If you haven't received anything after a couple of blocks, resend it. If the
|
||||
same happens again, send it to some other node. A few reasons why it could
|
||||
happen:
|
||||
@@ -139,7 +139,7 @@ paths:
|
||||
3. node can be offline
|
||||
|
||||
Please refer to
|
||||
https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
|
||||
https://docs.tendermint.com/main/tendermint-core/using-tendermint.html#formatting
|
||||
for formatting/encoding rules.
|
||||
parameters:
|
||||
- in: query
|
||||
@@ -172,7 +172,7 @@ paths:
|
||||
IMPORTANT: use only for testing and development. In production, use
|
||||
BroadcastTxSync or BroadcastTxAsync. You can subscribe for the transaction
|
||||
result using JSONRPC via a websocket. See
|
||||
https://docs.tendermint.com/master/app-dev/subscribing-to-events-via-websocket.html
|
||||
https://docs.tendermint.com/main/app-dev/subscribing-to-events-via-websocket.html
|
||||
|
||||
CONTRACT: only returns error if mempool.CheckTx() errs or if we timeout
|
||||
waiting for tx to commit.
|
||||
@@ -181,7 +181,7 @@ paths:
|
||||
will contain a non-OK ABCI code.
|
||||
|
||||
Please refer to
|
||||
https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
|
||||
https://docs.tendermint.com/main/tendermint-core/using-tendermint.html#formatting
|
||||
for formatting/encoding rules.
|
||||
parameters:
|
||||
- in: query
|
||||
@@ -214,7 +214,7 @@ paths:
|
||||
The transaction won't be added to the mempool.
|
||||
|
||||
Please refer to
|
||||
https://docs.tendermint.com/master/tendermint-core/using-tendermint.html#formatting
|
||||
https://docs.tendermint.com/main/tendermint-core/using-tendermint.html#formatting
|
||||
for formatting/encoding rules.
|
||||
parameters:
|
||||
- in: query
|
||||
|
||||
+4
-2
@@ -14,8 +14,10 @@ _methods_, each with a corresponding `Request` and `Response`message type.
|
||||
To perform state-machine replication, Tendermint calls the ABCI methods on the
|
||||
ABCI application by sending the `Request*` messages and receiving the `Response*` messages in return.
|
||||
|
||||
All ABCI messages and methods are defined in [protocol buffers](https://github.com/tendermint/spec/blob/master/proto/abci/types.proto).
|
||||
This allows Tendermint to run with applications written in many programming languages.
|
||||
All ABCI messages and methods are defined in [protocol
|
||||
buffers](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/abci/types.proto).
|
||||
This allows Tendermint to run with applications written in many programming
|
||||
languages.
|
||||
|
||||
This specification is split as follows:
|
||||
|
||||
|
||||
+2
-2
@@ -179,8 +179,8 @@ enum EvidenceType {
|
||||
```
|
||||
|
||||
There are two forms of evidence: Duplicate Vote and Light Client Attack. More
|
||||
information can be found in either [data structures](https://github.com/tendermint/spec/blob/master/spec/core/data_structures.md)
|
||||
or [accountability](https://github.com/tendermint/spec/blob/master/spec/light-client/accountability/)
|
||||
information can be found in either [data structures](https://github.com/tendermint/tendermint/blob/main/spec/core/data_structures.md)
|
||||
or [accountability](https://github.com/tendermint/tendermint/blob/main/spec/light-client/accountability/)
|
||||
|
||||
## Determinism
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Applications](./apps.md).
|
||||
## Message Protocol
|
||||
|
||||
The message protocol consists of pairs of requests and responses defined in the
|
||||
[protobuf file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto).
|
||||
[protobuf file](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/abci/types.proto).
|
||||
|
||||
Some messages have no fields, while others may include byte-arrays, strings, integers,
|
||||
or custom protobuf types.
|
||||
@@ -30,7 +30,8 @@ responses.
|
||||
To use ABCI in your programming language of choice, there must be a ABCI
|
||||
server in that language. Tendermint supports three implementations of the ABCI, written in Go:
|
||||
|
||||
- In-process ([Golang](https://github.com/tendermint/tendermint/tree/master/abci), [Rust](https://github.com/tendermint/rust-abci))
|
||||
- In-process ([Golang](https://github.com/tendermint/tendermint/tree/main/abci),
|
||||
[Rust](https://github.com/informalsystems/tendermint-rs/tree/main/abci))
|
||||
- ABCI-socket
|
||||
- GRPC
|
||||
|
||||
@@ -38,7 +39,7 @@ The latter two can be tested using the `abci-cli` by setting the `--abci` flag
|
||||
appropriately (ie. to `socket` or `grpc`).
|
||||
|
||||
See examples, in various stages of maintenance, in
|
||||
[Go](https://github.com/tendermint/tendermint/tree/master/abci/server),
|
||||
[Go](https://github.com/tendermint/tendermint/tree/main/abci/server),
|
||||
[JavaScript](https://github.com/tendermint/js-abci),
|
||||
[C++](https://github.com/mdyring/cpp-tmsp), and
|
||||
[Java](https://github.com/jTendermint/jabci).
|
||||
@@ -54,7 +55,7 @@ If GRPC is available in your language, this is the easiest approach,
|
||||
though it will have significant performance overhead.
|
||||
|
||||
To get started with GRPC, copy in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/proto/tendermint/abci/types.proto)
|
||||
file](https://github.com/tendermint/tendermint/blob/main/proto/tendermint/abci/types.proto)
|
||||
and compile it using the GRPC plugin for your language. For instance,
|
||||
for golang, the command is `protoc --go_out=plugins=grpc:. types.proto`.
|
||||
See the [grpc documentation for more details](http://www.grpc.io/docs/).
|
||||
@@ -113,4 +114,4 @@ received or a block is committed.
|
||||
|
||||
It is unlikely that you will need to implement a client. For details of
|
||||
our client, see
|
||||
[here](https://github.com/tendermint/tendermint/tree/master/abci/client).
|
||||
[here](https://github.com/tendermint/tendermint/tree/main/abci/client).
|
||||
|
||||
@@ -123,7 +123,7 @@ A proposal is signed and published by the designated proposer at each
|
||||
round. The proposer is chosen by a deterministic and non-choking round
|
||||
robin selection algorithm that selects proposers in proportion to their
|
||||
voting power (see
|
||||
[implementation](https://github.com/tendermint/tendermint/blob/master/types/validator_set.go)).
|
||||
[implementation](https://github.com/tendermint/tendermint/blob/main/types/validator_set.go)).
|
||||
|
||||
A proposal at `(H,R)` is composed of a block and an optional latest
|
||||
`PoLC-Round < R` which is included iff the proposer knows of one. This
|
||||
@@ -295,7 +295,7 @@ may make JSet verification/gossip logic easier to implement.
|
||||
### Censorship Attacks
|
||||
|
||||
Due to the definition of a block
|
||||
[commit](https://github.com/tendermint/tendermint/blob/master/docs/tendermint-core/validators.md), any 1/3+ coalition of
|
||||
[commit](https://github.com/tendermint/tendermint/blob/main/docs/tendermint-core/validators.md), any 1/3+ coalition of
|
||||
validators can halt the blockchain by not broadcasting their votes. Such
|
||||
a coalition can also censor particular transactions by rejecting blocks
|
||||
that include these transactions, though this would result in a
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A TLA+ specification of a simplified Tendermint consensus, with added clocks
|
||||
and proposer-based timestamps. This TLA+ specification extends and modifies
|
||||
the Tendermint TLA+ specification for fork accountability:
|
||||
https://github.com/tendermint/spec/blob/master/spec/light-client/accountability/TendermintAcc_004_draft.tla
|
||||
https://github.com/tendermint/tendermint/blob/main/spec/light-client/accountability/TendermintAcc_004_draft.tla
|
||||
|
||||
* Version 1. A preliminary specification.
|
||||
|
||||
|
||||
@@ -28,5 +28,5 @@ WAL. Then it will go to precommit, and that time it will work because the
|
||||
private validator contains the `LastSignBytes` and then we’ll replay the
|
||||
precommit from the WAL.
|
||||
|
||||
Make sure to read about [WAL corruption](https://github.com/tendermint/tendermint/blob/master/docs/tendermint-core/running-in-production.md#wal-corruption)
|
||||
Make sure to read about [WAL corruption](https://github.com/tendermint/tendermint/blob/main/docs/tendermint-core/running-in-production.md#wal-corruption)
|
||||
and recovery strategies.
|
||||
|
||||
@@ -210,7 +210,7 @@ to reconstruct the vote set given the validator set.
|
||||
| Signature | [Signature](#signature) | Signature corresponding to the validators participation in consensus. | The length of the signature must be > 0 and < than 64 |
|
||||
|
||||
NOTE: `ValidatorAddress` and `Timestamp` fields may be removed in the future
|
||||
(see [ADR-25](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-025-commit.md)).
|
||||
(see [ADR-25](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-025-commit.md)).
|
||||
|
||||
## BlockIDFlag
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ parent:
|
||||
This directory contains work-in-progress English and TLA+ specifications for the Light Client
|
||||
protocol. Implementations of the light client can be found in
|
||||
[Rust](https://github.com/informalsystems/tendermint-rs/tree/master/light-client) and
|
||||
[Go](https://github.com/tendermint/tendermint/tree/master/light).
|
||||
[Go](https://github.com/tendermint/tendermint/tree/main/light).
|
||||
|
||||
Light clients are assumed to be initialized once from a trusted source
|
||||
with a trusted header and validator set. The light client
|
||||
|
||||
@@ -307,7 +307,7 @@ type LCInitData struct {
|
||||
|
||||
where only one of the components must be provided. `GenesisDoc` is
|
||||
defined in the [Tendermint
|
||||
Types](https://github.com/tendermint/tendermint/blob/master/types/genesis.go).
|
||||
Types](https://github.com/tendermint/tendermint/blob/main/types/genesis.go).
|
||||
|
||||
#### **[LC-DATA-GENESIS.1]**
|
||||
|
||||
@@ -634,4 +634,4 @@ func VerifyAndDetect (lightStore LightStore, targetHeight Height)
|
||||
- an attack is detected
|
||||
- [LC-DATA-PEERLIST-INV.1] is violated
|
||||
|
||||
----
|
||||
----
|
||||
|
||||
@@ -17,7 +17,7 @@ type LCInitData struct {
|
||||
|
||||
where only one of the components must be provided. `GenesisDoc` is
|
||||
defined in the [Tendermint
|
||||
Types](https://github.com/tendermint/tendermint/blob/master/types/genesis.go).
|
||||
Types](https://github.com/tendermint/tendermint/blob/main/types/genesis.go).
|
||||
|
||||
|
||||
### Initialization
|
||||
@@ -45,8 +45,8 @@ able to verify anything.
|
||||
Cross-checking this trusted block with providers upon initialization is helpful
|
||||
for ensuring that the node is responsive and correctly configured but does not
|
||||
increase trust since proving a conflicting block is a
|
||||
[light client attack](https://github.com/tendermint/spec/blob/master/spec/light-client/detection/detection_003_reviewed.md#tmbc-lc-attack1)
|
||||
and not just a [bogus](https://github.com/tendermint/spec/blob/master/spec/light-client/detection/detection_003_reviewed.md#tmbc-bogus1) block could result in
|
||||
[light client attack](https://github.com/tendermint/tendermint/blob/main/spec/light-client/detection/detection_003_reviewed.md#tmbc-lc-attack1)
|
||||
and not just a [bogus](https://github.com/tendermint/tendermint/blob/main/spec/light-client/detection/detection_003_reviewed.md#tmbc-bogus1) block could result in
|
||||
performing backwards verification beyond the trusted period, thus a fruitless
|
||||
endeavour.
|
||||
|
||||
|
||||
@@ -1148,7 +1148,7 @@ func Main (primary PeerID, lightStore LightStore, targetHeight Height)
|
||||
|
||||
[[lightclient]] The light client ADR [77d2651 on Dec 27, 2019].
|
||||
|
||||
[RPC]: https://docs.tendermint.com/master/rpc/
|
||||
[RPC]: https://docs.tendermint.com/v0.34/rpc/
|
||||
|
||||
[block]: https://github.com/tendermint/spec/blob/d46cd7f573a2c6a2399fcab2cde981330aa63f37/spec/core/data_structures.md
|
||||
|
||||
@@ -1164,15 +1164,15 @@ func Main (primary PeerID, lightStore LightStore, targetHeight Height)
|
||||
|
||||
[lightclient]: https://github.com/interchainio/tendermint-rs/blob/e2cb9aca0b95430fca2eac154edddc9588038982/docs/architecture/adr-002-lite-client.md
|
||||
[fork-detector]: https://github.com/informalsystems/tendermint-rs/blob/master/docs/spec/lightclient/detection.md
|
||||
[fullnode]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md
|
||||
[fullnode]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md
|
||||
|
||||
[ibc-rs]:https://github.com/informalsystems/ibc-rs
|
||||
|
||||
[FN-LuckyCase-link]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md#fn-luckycase
|
||||
[FN-LuckyCase-link]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md#fn-luckycase
|
||||
|
||||
[blockchain-validator-set]: https://github.com/tendermint/spec/blob/master/spec/blockchain/blockchain.md#data-structures
|
||||
[fullnode-data-structures]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md#data-structures
|
||||
[blockchain-validator-set]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/blockchain.md#data-structures
|
||||
[fullnode-data-structures]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md#data-structures
|
||||
|
||||
[FN-ManifestFaulty-link]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md#fn-manifestfaulty
|
||||
[FN-ManifestFaulty-link]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md#fn-manifestfaulty
|
||||
|
||||
[arXiv]: https://arxiv.org/abs/1807.04938
|
||||
[arXiv]: https://arxiv.org/abs/1807.04938
|
||||
|
||||
@@ -1033,7 +1033,7 @@ func Backwards (primary PeerID, root LightBlock, targetHeight Height)
|
||||
|
||||
[[lightclient]] The light client ADR [77d2651 on Dec 27, 2019].
|
||||
|
||||
[RPC]: https://docs.tendermint.com/master/rpc/
|
||||
[RPC]: https://docs.tendermint.com/v0.34/rpc/
|
||||
|
||||
[block]: https://github.com/tendermint/spec/blob/d46cd7f573a2c6a2399fcab2cde981330aa63f37/spec/core/data_structures.md
|
||||
|
||||
@@ -1049,13 +1049,13 @@ func Backwards (primary PeerID, root LightBlock, targetHeight Height)
|
||||
|
||||
[lightclient]: https://github.com/interchainio/tendermint-rs/blob/e2cb9aca0b95430fca2eac154edddc9588038982/docs/architecture/adr-002-lite-client.md
|
||||
[attack-detector]: https://github.com/tendermint/spec/blob/master/rust-spec/lightclient/detection/detection_001_reviewed.md
|
||||
[fullnode]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md
|
||||
[fullnode]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md
|
||||
|
||||
[ibc-rs]:https://github.com/informalsystems/ibc-rs
|
||||
|
||||
[blockchain-validator-set]: https://github.com/tendermint/spec/blob/master/spec/blockchain/blockchain.md#data-structures
|
||||
[fullnode-data-structures]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md#data-structures
|
||||
[blockchain-validator-set]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/blockchain.md#data-structures
|
||||
[fullnode-data-structures]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md#data-structures
|
||||
|
||||
[FN-ManifestFaulty-link]: https://github.com/tendermint/spec/blob/master/spec/blockchain/fullnode.md#fn-manifestfaulty
|
||||
[FN-ManifestFaulty-link]: https://github.com/tendermint/tendermint/blob/main/spec/blockchain/fullnode.md#fn-manifestfaulty
|
||||
|
||||
[arXiv]: https://arxiv.org/abs/1807.04938
|
||||
|
||||
@@ -30,7 +30,7 @@ next block in the blockchain should be.
|
||||
|
||||
Vote is sent to vote for some block (or to inform others that a process does not vote in the
|
||||
current round). Vote is defined in the
|
||||
[Blockchain](https://github.com/tendermint/spec/blob/master/spec/core/data_structures.md#blockidd)
|
||||
[Blockchain](https://github.com/tendermint/tendermint/blob/main/spec/core/data_structures.md#blockidd)
|
||||
section and contains validator's
|
||||
information (validator address and index), height and round for which the vote is sent, vote type,
|
||||
blockID if process vote for some block (`nil` otherwise) and a timestamp when the vote is sent. The
|
||||
|
||||
@@ -12,8 +12,6 @@ Seeds should operate full nodes with the PEX reactor in a "crawler" mode
|
||||
that continuously explores to validate the availability of peers.
|
||||
|
||||
Seeds should only respond with some top percentile of the best peers it knows about.
|
||||
See [the peer-exchange docs](https://github.com/tendermint/spec/blob/master/spec/reactors/pex/pex.md) for
|
||||
details on peer quality.
|
||||
|
||||
## New Full Node
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
This document explains how Tendermint Peers are identified and how they connect to one another.
|
||||
|
||||
For details on peer discovery, see the [peer exchange (PEX) reactor doc](https://github.com/tendermint/spec/blob/master/spec/reactors/pex/pex.md).
|
||||
|
||||
## Peer Identity
|
||||
|
||||
Tendermint peers are expected to maintain long-term persistent identities in the form of a public key.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
Tools for working with Tendermint and associated technologies. Documentation for
|
||||
these tools can be found online in the [Tendermint tools
|
||||
documentation](https://docs.tendermint.com/master/tools/).
|
||||
documentation](https://docs.tendermint.com/main/tools/).
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ func MaxDataBytesNoEvidence(maxBytes int64, valsCount int) int64 {
|
||||
// NOTE: changes to the Header should be duplicated in:
|
||||
// - header.Hash()
|
||||
// - abci.Header
|
||||
// - https://github.com/tendermint/spec/blob/master/spec/blockchain/blockchain.md
|
||||
// - https://github.com/tendermint/tendermint/blob/main/spec/blockchain/blockchain.md
|
||||
type Header struct {
|
||||
// basic block info
|
||||
Version tmversion.Consensus `json:"version"`
|
||||
|
||||
Reference in New Issue
Block a user