Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement support for admin.addPeer() #198

Open
ggarri opened this issue Aug 19, 2019 · 7 comments
Open

Implement support for admin.addPeer() #198

ggarri opened this issue Aug 19, 2019 · 7 comments
Labels
enhancement Something that it currently work but can be improved

Comments

@ggarri
Copy link
Contributor

ggarri commented Aug 19, 2019

In order to provide a better integration of the PoC protocol in Lightchain we should provide support for the admin method addPeer(). See more information about the expected behaviour at the official ethereum doc https://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network

@ggarri ggarri added the enhancement Something that it currently work but can be improved label Aug 19, 2019
@liuqihang
Copy link

Hi, ggarri ~
At present, what is the standard for lightchain synchronization? How do you know that multiple lightchain nodes are synchronized? Can each synchronized node like Etheneum geth query each other's account balance?

@ggarri
Copy link
Contributor Author

ggarri commented Aug 25, 2019

In lightchain we are using Tendermint consensus protocol, therefore every information regarding to the consensus status, including synchronization is exposed via Tendermint RPC endpoints (https://tendermint.com/rpc/#). By default, on every lightchain node, the tendermint rpc is bind to the port 127.0.0.0:26657

At the minute you could fetch the current local synchronization status by doing a http call to the url localhost:26657/status (see more info here).

This issue, and future ongoing issues, are intending to implement a smooth and seamless integration of tendermint rpc api into geth native rpc api calls.

@liuqihang
Copy link

ok~ thank you,
In addition, I would like to consult, I use Tendermint to observe the log, it will show the block record, but I did not show the block record when using the lightchain-sirius mode, I understand that the lightchain integrates the tendermint.

@liuqihang
Copy link

this's log of my console

INFO [08-28|14:45:56.756] Started database engine...               engine=database
INFO [08-28|14:45:56.756] Starting consensus engine...             engine=node
INFO [08-28|14:45:56.756] Loading database 'blockstore'...         engine=consensus
INFO [08-28|14:45:56.765] Loading database 'state'...              engine=consensus
INFO [08-28|14:45:56.772] Starting multiAppConn                    engine=consensus module=proxy      impl=multiAppConn
INFO [08-28|14:45:56.772] Starting localClient                     engine=consensus module=proxy      module=abci-client connection=query impl=localClient
INFO [08-28|14:45:56.772] Starting localClient                     engine=consensus module=proxy       module=abci-client connection=mempool impl=localClient
INFO [08-28|14:45:56.772] Starting localClient                     engine=consensus module=proxy       module=abci-client connection=consensus impl=localClient
INFO [08-28|14:45:56.772] Starting EventBus                        engine=consensus module=events      impl=EventBus
INFO [08-28|14:45:56.772] Starting PubSub                          engine=consensus module=events      module=pubsub      impl=PubSub
INFO [08-28|14:45:56.772] Loading database 'tx_index'...           engine=consensus
INFO [08-28|14:45:56.781] Starting IndexerService                  engine=consensus module=txindex     impl=IndexerService
INFO [08-28|14:45:56.781] State info                               engine=consensus module=ABCI        data="{Version:0.31.5 BlockVersion:10 P2PVersion:7 XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}" height=0
INFO [08-28|14:45:56.781] ABCI Handshake App Info                  engine=consensus module=consensus   height=0 hash=              software-version= protocol-version=0
INFO [08-28|14:45:56.784] ABCI Replay Blocks                       engine=consensus module=consensus   appHeight=0 storeHeight=0 stateHeight=0
INFO [08-28|14:45:56.786] Completed ABCI Handshake - Tendermint and App are synced engine=consensus module=consensus   appHeight=0 appHash=
INFO [08-28|14:45:56.786] Version info                             engine=consensus software=0.31.5 block=10 p2p=7
INFO [08-28|14:45:56.786] Software and state have different block protocols engine=consensus software=10     state=9
INFO [08-28|14:45:56.786] This node is not a validator             engine=consensus module=consensus   addr=717C8875BEDB1FC7D4F35620F267F4F9204D32D7 pubKey=PubKeyEd25519{A5471310149510422DC33A8EA43D022AC60DDF3093A2BBE037CC4BEDC72DC28A}
INFO [08-28|14:45:56.787] Loading database 'evidence'...           engine=consensus
INFO [08-28|14:45:56.796] P2P Node ID                              engine=consensus module=p2p         ID=4331adabc5198c668c2e8c4d65de0aaf63b422f9 file=/home/lqh/lightchain/consensus/config/node_key.json
INFO [08-28|14:45:56.797] Starting tendermint node...              engine=consensus
INFO [08-28|14:45:56.797] Starting Node                            engine=consensus impl=Node
INFO [08-28|14:45:56.797] Starting P2P Switch                      engine=consensus module=p2p         impl="P2P Switch"
INFO [08-28|14:45:56.797] Starting MempoolReactor                  engine=consensus module=mempool     impl=MempoolReactor
INFO [08-28|14:45:56.797] Starting BlockchainReactor               engine=consensus module=blockchain  impl=BlockchainReactor
INFO [08-28|14:45:56.797] Starting BlockPool                       engine=consensus module=blockchain  impl=BlockPool
INFO [08-28|14:45:56.797] Starting RPC HTTP server on [::]:26657   engine=consensus module=rpc-server
INFO [08-28|14:45:56.797] Starting ConsensusReactor                engine=consensus module=consensus   impl=ConsensusReactor
INFO [08-28|14:45:56.797] ConsensusReactor                         engine=consensus module=consensus   fastSync=true
INFO [08-28|14:45:56.797] Starting EvidenceReactor                 engine=consensus module=evidence    impl=EvidenceReactor
INFO [08-28|14:45:56.797] Starting PEXReactor                      engine=consensus module=pex         impl=PEXReactor
INFO [08-28|14:45:56.797] Starting AddrBook                        engine=consensus module=p2p         book=/home/lqh/lightchain/consensus/config/addrbook.json impl=AddrBook
ERROR[08-28|14:45:56.797] Can't add peer's address to addrbook     engine=consensus module=p2p         err="Cannot add invalid address [email protected]:46656"
INFO [08-28|14:45:56.797] Saving AddrBook to file                  engine=consensus module=p2p         book=/home/lqh/lightchain/consensus/config/addrbook.json size=0
INFO [08-28|14:45:56.797] Ensure peers                             engine=consensus module=pex         numOutPeers=0 numInPeers=0 numDialing=0 numToDial=10
INFO [08-28|14:45:56.799] Tendermint node started                  engine=consensus
INFO [08-28|14:45:56.799] No addresses to dial nor connected peers. Falling back to seeds engine=consensus module=pex
ERROR[08-28|14:45:56.799] Couldn't connect to any seeds            engine=consensus module=p2p
INFO [08-28|14:45:57.656] Lightchain DB successfully connected to the Tendermint HTTP service. engine=database  info=Success
INFO [08-28|14:45:58.705] Dialing peer                             engine=consensus module=p2p         [email protected]:46656
INFO [08-28|14:45:58.707] Starting Peer                            engine=consensus module=p2p         [email protected]:46656 impl="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:45:58.707] Starting MConnection                     engine=consensus module=p2p         [email protected]:46656 impl=MConn{127.0.0.1:46656}
INFO [08-28|14:45:58.708] Added peer                               engine=consensus module=p2p         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:45:59.797] Time to switch to consensus reactor!     engine=consensus module=blockchain  height=1
INFO [08-28|14:45:59.797] Stopping BlockPool                       engine=consensus module=blockchain  impl=BlockPool
INFO [08-28|14:45:59.797] SwitchToConsensus                        engine=consensus module=consensus
INFO [08-28|14:45:59.797] Ignoring updateToState()                 engine=consensus module=consensus   newHeight=1 oldHeight=1
INFO [08-28|14:45:59.797] Starting ConsensusState                  engine=consensus module=consensus   impl=ConsensusState
INFO [08-28|14:45:59.798] Starting baseWAL                         engine=consensus module=consensus   wal=/home/lqh/lightchain/consensus/data/cs.wal/wal impl=baseWAL
INFO [08-28|14:45:59.798] Starting Group                           engine=consensus module=consensus   wal=/home/lqh/lightchain/consensus/data/cs.wal/wal impl=Group
INFO [08-28|14:45:59.798] Starting TimeoutTicker                   engine=consensus module=consensus   impl=TimeoutTicker
INFO [08-28|14:45:59.798] Searching for height                     engine=consensus module=consensus   wal=/home/lqh/lightchain/consensus/data/cs.wal/wal height=1 min=0 max=0
INFO [08-28|14:45:59.798] Searching for height                     engine=consensus module=consensus   wal=/home/lqh/lightchain/consensus/data/cs.wal/wal height=0 min=0 max=0
INFO [08-28|14:45:59.798] Found                                    engine=consensus module=consensus   wal=/home/lqh/lightchain/consensus/data/cs.wal/wal height=0 index=0
INFO [08-28|14:45:59.798] Catchup by replaying consensus messages  engine=consensus module=consensus   height=1
INFO [08-28|14:45:59.798] Replay: Timeout                          engine=consensus module=consensus   height=1 round=0 step=RoundStepNewHeight dur=-5.003286391s
INFO [08-28|14:45:59.798] enterNewRound(1/0). Current: 1/0/RoundStepNewHeight engine=consensus module=consensus   height=1 round=0
INFO [08-28|14:45:59.798] enterPropose(1/0). Current: 1/0/RoundStepNewRound engine=consensus module=consensus   height=1 round=0
INFO [08-28|14:45:59.798] Replay: New Step                         engine=consensus module=consensus   height=1 round=0 step=RoundStepPropose
INFO [08-28|14:45:59.798] Replay: Timeout                          engine=consensus module=consensus   height=1 round=0 step=RoundStepPropose   dur=50s
INFO [08-28|14:45:59.798] enterPrevote(1/0). Current: 1/0/RoundStepPropose engine=consensus module=consensus
INFO [08-28|14:45:59.798] enterPrevote: ProposalBlock is nil       engine=consensus module=consensus   height=1 round=0
INFO [08-28|14:45:59.798] Replay: New Step                         engine=consensus module=consensus   height=1 round=0 step=RoundStepPrevote
INFO [08-28|14:45:59.798] Replay: New Step                         engine=consensus module=consensus   height=1 round=0 step=RoundStepPropose
INFO [08-28|14:45:59.798] Replay: New Step                         engine=consensus module=consensus   height=1 round=0 step=RoundStepPrevote
INFO [08-28|14:45:59.798] Replay: New Step                         engine=consensus module=consensus   height=1 round=0 step=RoundStepPropose
INFO [08-28|14:45:59.798] Replay: New Step                         engine=consensus module=consensus   height=1 round=0 step=RoundStepPrevote
INFO [08-28|14:45:59.798] Replay: Timeout                          engine=consensus module=consensus   height=1 round=0 step=RoundStepPropose   dur=50s
INFO [08-28|14:45:59.798] Replay: Done                             engine=consensus module=consensus
INFO [08-28|14:46:26.799] Ensure peers                             engine=consensus module=pex         numOutPeers=1 numInPeers=0 numDialing=0 numToDial=9
INFO [08-28|14:46:26.800] We need more addresses. Sending pexRequest to random peer engine=consensus module=pex         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:46:49.798] Timed out                                engine=consensus module=consensus   dur=50s           height=1 round=0 step=RoundStepPropose
INFO [08-28|14:46:56.799] Ensure peers                             engine=consensus module=pex         numOutPeers=1 numInPeers=0 numDialing=0 numToDial=9
INFO [08-28|14:46:56.800] We need more addresses. Sending pexRequest to random peer engine=consensus module=pex         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:47:26.799] Ensure peers                             engine=consensus module=pex         numOutPeers=1 numInPeers=0 numDialing=0 numToDial=9
INFO [08-28|14:47:26.800] We need more addresses. Sending pexRequest to random peer engine=consensus module=pex         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:47:33.650] Served RPC HTTP response                 engine=consensus module=rpc-server  method=GET url=/                                      status=200 duration=0 remoteAddr=127.0.0.1:55380
INFO [08-28|14:47:50.157] Served RPC HTTP response                 engine=consensus module=rpc-server  method=GET url=/                                      status=200 duration=0 remoteAddr=192.168.1.115:61900
INFO [08-28|14:47:56.797] Saving AddrBook to file                  engine=consensus module=p2p         book=/home/lqh/lightchain/consensus/config/addrbook.json size=0
INFO [08-28|14:47:56.799] Ensure peers                             engine=consensus module=pex         numOutPeers=1 numInPeers=0 numDialing=0 numToDial=9
INFO [08-28|14:47:56.800] We need more addresses. Sending pexRequest to random peer engine=consensus module=pex         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:47:58.753] HTTPRestRPC                              engine=consensus module=rpc-server  method=/health args="[<*rpctypes.Context Value>]" returns="[<*core_types.ResultHealth Value> <error Value>]"
INFO [08-28|14:47:58.753] Served RPC HTTP response                 engine=consensus module=rpc-server  method=GET     url=/health?                               status=200 duration=0 remoteAddr=192.168.1.115:61900
INFO [08-28|14:48:04.386] HTTPRestRPC                              engine=consensus module=rpc-server  method=/net_info args="[<*rpctypes.Context Value>]" returns="[<*core_types.ResultNetInfo Value> <error Value>]"
INFO [08-28|14:48:04.387] Served RPC HTTP response                 engine=consensus module=rpc-server  method=GET       url=/net_info?                             status=200 duration=1 remoteAddr=192.168.1.115:61900
INFO [08-28|14:48:26.799] Ensure peers                             engine=consensus module=pex         numOutPeers=1 numInPeers=0 numDialing=0 numToDial=9
INFO [08-28|14:48:26.800] We need more addresses. Sending pexRequest to random peer engine=consensus module=pex         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"
INFO [08-28|14:48:56.799] Ensure peers                             engine=consensus module=pex         numOutPeers=1 numInPeers=0 numDialing=0 numToDial=9
INFO [08-28|14:48:56.800] We need more addresses. Sending pexRequest to random peer engine=consensus module=pex         peer="Peer{MConn{127.0.0.1:46656} 49a07b0730d773d8724e5087fa8d4b456ffdb70c out}"

@liuqihang
Copy link

I saw your previous Issues, need to modify the value of parameter "needAddressThreshold", i hav modified.
needAddressThreshold = 2

@ggarri
Copy link
Contributor Author

ggarri commented Aug 28, 2019

@liuqihang do you mind to paste he which block record log you refer to ?

Lightchain implementation is meant to display every Tendermint log trace, applying the log_level defined at the Tendermint config.toml. You could try to set it to DEBUG as follow:

# Output level for logging, including package level options
log_level = "debug"

@liuqihang
Copy link

./tendermint node --home /home/lqh/tenderchain2 --proxy_app persistent_kvstore --p2p.laddr tcp://0.0.0.0:36656 --rpc.laddr tcp://0.0.0.0:36657 I[2019-08-28|15:37:33.848] Version info module=main software=0.31.5 block=10 p2p=7 I[2019-08-28|15:37:33.865] Starting Node module=main impl=Node E[2019-08-28|15:37:33.867] Can't add peer's address to addrbook module=p2p err="Cannot add non-routable address [email protected]:26656" I[2019-08-28|15:37:33.869] Started node module=main nodeInfo="{ProtocolVersion:{P2P:7 Block:10 App:1} ID_:23c689ab8d1b0c8b12706dca8b0eed1da52e66d9 ListenAddr:tcp://0.0.0.0:36656 Network:test-chain-5NBZOc Version:0.31.5 Channels:4020212223303800 Moniker:lqh Other:{TxIndex:on RPCAddress:tcp://0.0.0.0:36657}}" E[2019-08-28|15:37:33.869] Couldn't connect to any seeds module=p2p I[2019-08-28|15:37:36.343] Executed block module=state height=305 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:36.346] Committed state module=state height=305 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:37.568] Executed block module=state height=306 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:37.570] Committed state module=state height=306 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:38.984] Executed block module=state height=307 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:38.987] Committed state module=state height=307 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:40.226] Executed block module=state height=308 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:40.228] Committed state module=state height=308 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:41.635] Executed block module=state height=309 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:41.637] Committed state module=state height=309 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:43.063] Executed block module=state height=310 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:43.065] Committed state module=state height=310 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:44.380] Executed block module=state height=311 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:44.382] Committed state module=state height=311 txs=0 appHash=0000000000000000 I[2019-08-28|15:37:45.618] Executed block module=state height=312 validTxs=0 invalidTxs=0 I[2019-08-28|15:37:45.620] Committed state module=state height=312 txs=0 appHash=0000000000000000

I started two Tendermints and implemented synchronization.
Their block num are consistent

but
Lightchain but did not see the block log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something that it currently work but can be improved
Projects
None yet
Development

No branches or pull requests

2 participants