[Ethereum] How to access all accounts across multiple nodes? JS/Web3.js/API

go-ethereumweb3js

I'm running a private ethereum development network with 3 nodes connected to each other. Before asking my question, something about my setup. This is how I start those nodes:

geth --networkid 2345 --datadir /some/dir/01 --rpc --rpccorsdomain "*" --rpcapi "db,net,web3,miner,eth,personal" --port "30301" --rpcport 8101 --maxpeers 2 --identity "MyChain01" console

This is just the statement for one node, the others have different port numbers.

Once all nodes are up, I connect them within the JavaScript console via:

admin.addPeer("enode:1234567890.....")

and when running:

admin.peers

I'm getting the other peers accordingly. When I start mining on one node, the mined blocks get synchronized to the others, so it all works good.

Now here comes my question. Let's say I've created 2 accounts on Node01, 2 accounts on Node02 and 2 accounts on Node03. How could I actually do any transaction across nodes? So from account1.node01 to account1.node02?

When running:

personal.listAccounts

on any given node, I only get the accounts created on that very node.

Does anyone know if there is a solution to access all accounts from all connected nodes?
Maybe I'm missing a trick here, but I couldn't really find anything that would explain how to do that.

Thanks,
Borinho

Best Answer

for all who maybe ask the same question I wanted to provide an answer to my question to my best knowledge.

What I basically described above is the concept of a "hot wallet". As, in the example above, the account is created directly at the node, all data, keys etc are stored on that node. Now as wallets, or containers of keys, should not (and I guess, cannot) be copied across nodes, the initial question is actually pointless or plain wrong. Another problem is that I actually asked two questions in one.

Transferring something from account1.node1 to account1.node2 is no problem at all (within the same network). Simply do:

eth.sendTransaction({from:sender, to:receiver, value: amount})

The other question I was asking myself was kinda along the lines of a blockchain explorer. Listing, via web3, what's going on in the network. With web3.js one can query all account data on any specified node, but not all accounts within a given private blockchain installation (unless someone tells me otherwise).

I hope that helps someone at some time :)

Borinho

Related Topic