TendermintConnector

command module
v0.0.0-...-113e32b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

Tendermint Connector Banner

Tendermint Connector

Tendermint Connector is a bridging application required for Tendermint based blockchains to interface with Marlin Protocol. Tendermint Connector connects as a peer to already running TM based blockchain and retrieves / pushes selective messages that the peer needs from / to Marlin Relays. Tendermint Connector also doubles up as a spam checker machanism for marlin relay.

Serviced Blockchains

Currently, the following blockchains are serviced by TendermintConnector:

  1. Irisnet Mainnet 0.16.3
  2. Cosmos-3 Mainnet

Building the application

Ensure that go is installed on the build system - ensure all is good using go version. This should return good version string. Proceed to build the application using:

make
make install

Tendermint Connector concepts

Tendermint Connector is an application that provides full support for tendermint to interplay with Marlin Relay Network. Consequently, there are many roles that Tendermint Connector needs to play with a few variations in all of them. Here are a few concepts that is essential in understanding of Tendermint Connector

Organisation

Tendermint Connector is organised in primarily two separate modules - Marlin Side Connector and Peer Side Connector. Marlin side connector is a module that is tasked with interactions pertaining to marlin relay network - interactions with bridge or relay abci are both handled by marlin side connector. Peer side connector is tasked with interactions pertaining to TMCore of different blockchains - These include recieving messages from Tendermint Core, validating, asking Marlin Side Connector to put messages onto relay, deliver messages recieved from relay to TMCore and also, check for spam messages if there are any.

Consequently the connector can be thought of as follows:

Tendermint Connector diagram

Running modes

Tendermint Connector runs in two different modes:

  1. DataConnect mode: Tendermint Connector acts as a connecting bridge between a real tendermint based blockchain application (Connector talks to real TMCore) and Marlin TCP bridge. Most users would like to use this mode. In this mode, connector connects as a peer to real TMCore is capable of both sending messages to marlin side connector and recieving from it while interacting with TMCore.

  2. SpamFilter mode: Tendermint Connector acts as a spamfilter servicing application at marlin relay nodes and interacts with tm_abci. Relay operators would like to use this mode.

marlinTo and marlinFrom

marlinTo and marlinFrom are two channels which act as a connecting buffer between the marlin side connector and peer side connector. Both of these are capable of holding upto 1000 messages in each direction and are supposed to make both sides (marlin side / peer side) be agnostic of wire protocols each of them use. In case of overflow, oldest messages are dropped and shown as warning by TendermintConnector.

Selecting a Peer Side Connector

Tendermint Connector aims to provide support for many tendermint based blockchains. Consequently, there needs to be quite similar however different peer side connectors that are engineered to support a specific blockchain.

Decision of which peer side connector to use is done during runtime and is based on the nodeInfo that TMCore provides. Based on Block version and chain id of node, Tendermint Connector chooses a peer side connector that best fits to service that particular blockchain.

Currently, there is only one peer side connector written and supported:

  1. Irisnet Mainnet 0.16.3
  2. Cosmos-3 Mainnet
Peer side connector TCP connections

TMCore peers communicate with each other on TCP connections. Hence, if communication is to be established with real TMCore, one must dial the real TMCore or "be dialed" by the other side. Tendermint Core can do both - dial a real TMCore or be dialed.

Dialing a TMCore is simpler - Tendermint Connector generates keypair on the fly before connecting to TMCore - allowing Tendermint Connector to have different IDs between connections. This is ideal - since it circumvents issues when TMCore blacklists an ID (of Tendermint Connector) as a bad actor - since tendermint connector connects with a new identity.

Being dialed however is a little tricky - Tendermint Connector needs to listen on a specific port with certain nodeID. In this case when Tendermint Connector is dialed, the Connector needs to have consistent ID across multiple connections and cannot use new generated IDs on the fly. This ID can be persisted on the disk to be used across connections and across process runs by saving it as a keyfile (Keyfiles save private key / public key pairs). An example keyfile is given in keyfiles directory here.

There are certain time when being dialed is preferred way - by adding the Tendermint Connector fake peer as persistent_peer or unconditional_peer of real TMCore (More on how to do this below).

Marlin side connector

Tendermint Connector's marlin side connectivity is not always TCP. While in "dataconnect" mode, the marlin side connector interacts with Marlin Bridge. However, while in "spamfilter" mode, the marlin side connector relies on unix sockets to service spamfilter responses. Marlin side connector handles both in separate modes.

Running the application

The TendermintConnector application provides the following features:

  1. Full CLI interface (POSIX style flags)
  2. Automatic Blockchain detection based on Node Info of peer (RPC access to real TMCore required)
  3. Secured On the fly ED25519 key pair generation and handshake for every session in peerdial

For finding version info of the application, supported chains and supported encodings for marlin relay, run:

TendermintConnector --version

This should return you information such as this:

TendermintConnector version 0.1-rc-1
+ [Tendermint Chain]   IRISNet Mainnet 0.16.3 (Consensus State transfers) v0.1
+ [Marlin TM Protocol] Marlin Tendermint Data Transfer Protocol v1
TendermintConnector as a dataconnector between TMCore and Marlin Relay
TendermintConnector dataconnect --dial

Tendermint connector will automatically try to connect using the default parameters.

You can learn more about the TendermintConnector connect command using TendermintConnector connect -h.

For configuring any of this for runtime, the following can be used for changed params:

TendermintConnector --server_address 127.0.0.2 --rpc_port 21222
TendermintConnector keyfiles for persistent peer connection between TMCore and TendermintConnector
TendermintConnector keyfile

Tendermint connector can act as a tendermint peer who listens for connections instead of dialing TMCore itself. For this, you may need a persistent node ID to put in config.toml file for your real tendermint node. This is of format: ae239af43..9bd7@127.0.0.1:266657. This is essentially nodeID@IP:PORT. A keyfile for TendermintConnector is a file which describes the nodeID for TendermintConnector to use across process runs; it provides TendermintConnector with keys for fulfilling it's job as the given nodeID.

For example, you can generate a keyfile for irisnet chain using the following command:

TendermintConnector keyfile --chain irisnet --filelocation irisnetkeys.json --generate

This would return logs similar to below:

[INFO]:2020-11-13 15:32:51 - Generating KeyPair for irisnet-0.16.3-mainnet
[INFO]:2020-11-13 15:32:51 - ID for node after generating KeyPair: 376378adce3c6e3fde8201a4926b4adae6cb72e0
[INFO]:2020-11-13 15:32:51 - Successfully written keyfile irisnetkeys.json

This would create a new file irisnetkeys.json which contains keys relevant to peer nodeID 376378adce3c6e3fde8201a4926b4adae6cb72e0. You can now put 376378adce3c6e3fde8201a4926b4adae6cb72e0@127.0.0.1:59001 (for localhost) as a persistent peer of your real tendermint node by editing your config.toml or passing peer as a command line argument.

Subsequent runs of TendermintConnector connect would require this keyfile to be provided to the program using command such as follows:

TendermintConnector connect --keyfile irisnetkeys.json

You may wish to verify the integrity of generated keyfiles. This can be done by simply (no --generate flag):

TendermintConnector keyfile --keyfile irisnetkeys.json --chain irisnet
TendermintConnector as a spamfilter for Marlin Relay
TendermintConnector spamfilter

Tendermint connector will run as a spam filter endpoint for verifying messages recieved at any relay endpoint. The expected format of message in spamfilter mode is proto3 encoded Marlin Tendermint Data Transfer Protocol messages. Spamfilter replies with a single byte (0 or 1) for whether message is spam (0), hence to be blocked or not (1), hence to be allowed.

You can learn more about the TendermintConnector spamfilter command using TendermintConnector spamfilter -h.

For configuring any of this for runtime, the following can be used for changed params:

TendermintConnector spamfilter --peerip 127.0.0.2 --rpcport 26667

Documentation

Overview

Copyright © 2020 Supragya Raj <supragyaraj@gmail.com>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
_deprecated_chains
nolint
cosmos/libs/errors
Package errors contains errors that are thrown across packages.
Package errors contains errors that are thrown across packages.
cosmos/libs/events
Package events - Pub-Sub in go with event caching
Package events - Pub-Sub in go with event caching
cosmos/libs/flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
cosmos/libs/pubsub
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
cosmos/libs/pubsub/query
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
nolint
irisnet/libs/errors
Package errors contains errors that are thrown across packages.
Package errors contains errors that are thrown across packages.
irisnet/libs/events
Package events - Pub-Sub in go with event caching
Package events - Pub-Sub in go with event caching
irisnet/libs/flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
irisnet/libs/pubsub
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
irisnet/libs/pubsub/query
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
cosmos/crypto/merkle
Package merkle computes a deterministic minimal height Merkle tree hash.
Package merkle computes a deterministic minimal height Merkle tree hash.
cosmos/crypto/xchacha20poly1305
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
cosmos/libs/events
Package events - Pub-Sub in go with event caching
Package events - Pub-Sub in go with event caching
cosmos/libs/flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
cosmos/libs/json
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
cosmos/libs/pubsub
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
cosmos/libs/pubsub/query
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
iris/crypto/merkle
Package merkle computes a deterministic minimal height Merkle tree hash.
Package merkle computes a deterministic minimal height Merkle tree hash.
iris/crypto/xchacha20poly1305
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
iris/libs/events
Package events - Pub-Sub in go with event caching
Package events - Pub-Sub in go with event caching
iris/libs/flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
iris/libs/json
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
iris/libs/pubsub
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
iris/libs/pubsub/query
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
tm34/crypto/merkle
Package merkle computes a deterministic minimal height Merkle tree hash.
Package merkle computes a deterministic minimal height Merkle tree hash.
tm34/crypto/xchacha20poly1305
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
tm34/libs/events
Package events - Pub-Sub in go with event caching
Package events - Pub-Sub in go with event caching
tm34/libs/flowrate
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
Package flowrate provides the tools for monitoring and limiting the flow rate of an arbitrary data stream.
tm34/libs/json
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
Package json provides functions for marshaling and unmarshaling JSON in a format that is backwards-compatible with Amino JSON encoding.
tm34/libs/pubsub
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
Package pubsub implements a pub-sub model with a single publisher (Server) and multiple subscribers (clients).
tm34/libs/pubsub/query
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
Package query provides a parser for a custom query format: abci.invoice.number=22 AND abci.invoice.owner=Ivan See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
protocols

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL