Ethereum Asked by Tanay Bhartia on September 3, 2020
I have recently started developement on Ethereum and the concepts are pretty much new to me. I need to test event emitting/listening on multiple machines for my contract. For the same, I have tried creating a private network and adding peers. I have been stuck for a while now in submitting transactions to the network via a nodejs script. I had posted a question for that purpose Question 1, Question 2.
I am looking for another methods to do this thing. I have developed my contract on Truffle Suite
. What is the an another alternate way to test these functionalities on multiple machines?
Thank you.
You can have a small private network of 2 or 3 nodes, for example using docker-compose.
There are a lots of tutorials out these explaining how to make sure that your nodes are connecting to each others, by passing the addresses explicitly.
If you don't like Docker, here is an example of how I setup a private net of 2 geth nodes using a Makefile: https://github.com/WeTrustPlatform/poa-interchain-node/blob/develop/dev/Makefile
Now what you want to achieve with monitoring events is a very common use case. There are APIs in multiple languages to subscribe to these events, or list the past events.
But as @goodvibration said in his comment, you may as well have multiple process talking to a single node, because events will be pushed to your listener when the block is mined, so having multiple nodes is useless.
I would go even further and say that if your information system rely on Ethereum, and you want to avoid sync issues, you'd better have all your services pointing to the same RPC endpoint. It's a very common source of UI bugs, when people have their client connected to let say infura.io, and their server to a hosted geth node, if the two nodes are a bit out of sync your system will have to handle that. By using a single endpoint you avoid a lot of complexity.
Answered by Kivutar on September 3, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP