I am a Truffle user. I would like to create one contract and test this. When testing, I'd like to setup three nodes, link them, access the contract and test it. Is this possible? Or am I doing strange things? Please tell me if possible.

  • node1 rpcport:8101,
  • node2 rpcport:8102,
  • node3 rpcport:8103,

I set up. I used admin.addPeer command, link them.

Next, to deploy that contract on node1, I did truffle migrate command.

Next, to build a app I created with Truffle on node1, I did truffle build command.

And, I would like to build the app on node2, node3, then I would like to access the same contract. ← How do I do?

  • Interesting, does using multiple nodes serve any purpose? I do not see the advantages,
    – comodoro
    Feb 14 '17 at 19:28

I think I see what you're after.

Is it safe to say you just want to test on a slightly more realistic network with more than one participating node and more than one participating client?

If so, you should be able to separate the concerns.

Private Chain You can set up a private chain with three nodes. If the chain is working as expected, the contract you deploy on one node, will be mined by the miner (any node or nodes that are mining this chain) and will ultimately be deployed on all nodes when it gets mined. Same for the transactions and events, if any. Every node on an Ethereum network has the same view of the consensus data. It's just not possible to not have deployed the contract on all nodes.

Front End Truffle's (2.x) build process merges bootstrap code with your app and drops the merged file into into the ./build folder. It isn't concerned with how that code gets loaded into the browser.

The front end would typically be served from a consistent location, so using your build workstation as a web server is a valid option. You want to keep RPC on the default port 8545 or at least consistent on all clients, since the same front-end needs to work everywhere. I would stick with the default so one day it works in testnet or mainnet for people using default settings. It would be safe to say that your front end requires an Ethereum node with RPC on the default port.

Hope it helps.

  • Is RPC and rpcport same? Mar 23 '18 at 9:58
  • rpc is Remote Procedure Call. It has a number of properties such as enable/disable, the address to listen on and the port to listen on (the rpcport). Mar 23 '18 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.