Is there a way to broadcast another account's transaction to the Ethereum network using Geth?
This question really won't make sense unless I describe my set-up.
1) Device A has a private key. It creates a transaction, signs it, and sends it to Device B
2) Device B is actually connected to the ethereum network, but doesn't know Device A's private key. It receives A's signed transaction and sends it to the network, no questions asked.
I'm running into a couple problems with this set-up. The first is the fact that Ethereum transactions require a nonce that must be strictly increasing with each of Device A's transactions. What happens if Device A crashes and loses its private key? How the heck would a person recover the value of their nonce in addition to their private key? Perhaps I am misinterpreting the nonce itself — Does the nonce limit the private key's transactions, or is it increased when a node sends a transaction? In the latter case, I imagine I would need to poll Device B to obtain a nonce before signing the transaction. Is there any other data I would want to get, like the gas price?
I haven't gotten to step 2 yet, but I'm expecting this to be the real difficulty. Does geth even allow you to send another account's signed transaction? Surely there must be some core protocol beneath geth that I can access to do this for me?
Is it really impossible for something like this to be done using Ethereum's account system?
Best Answer
[this is probably not the most elegant solution]:
You better have an encrypted backup of the private key stored in multiple secure locations
The nonce is stored in the global account list on every node, no need to back it up. You can obtain it via
web3.eth.getTransactionCount(accountAddress)
.The latter, it increases on every valid tx that was signed by the corresponding private key and broadcasted.