1

I am trying to generate transactions from a device that will have a copy of my private key, send that over to my node server, which will then just send that over to ethereum.

Are transactions just like JSON blobs that I can relay like that? I just want my server to be a proxy that WRITES whatever transactions the device generates.

bigpotato
  • 279
  • 4
  • 12

1 Answers1

1

That's how it works, besides that transactions are no JSON objects, but hexadecimal strings. Your device creates a signed transaction, which requires the private key. Then you pass this signed transaction as a hex string on to your node. Since your node is actually part of the Ethereum network, the transaction has reached the blockchain infrastructure already.

gisdev_p
  • 1,801
  • 1
  • 9
  • 18
  • So can I just pass this hexadecimal string to my server? The device in this case would be something like Amazons Alexa (smart home hub). I want to generate the transaction there and send it to my server, which will send it to ethereum. Does that make sense? – bigpotato Nov 24 '17 at 22:02
  • Yes, you need to create the transaction, sign it and use function sendRawTransaction to send the hex string resulting from signing the transaction. Please refer to https://ethereum.stackexchange.com/questions/30682/private-key-needed-or-not-for-sending-transaction-in-ethereum/30687#30687 for more information. So, yes, what you says makes sense, even though I am not sufficient familiar with Alexa to say if this is possible. – gisdev_p Nov 24 '17 at 22:10
  • But sendRawTransaction is probably dangerous right? Basically anyone who sends a request to my server can create a transaction? Well maybe not... since I would be signing it with the private key and my smart contract would look for the signature... right? – bigpotato Nov 24 '17 at 23:50
  • Exactly, the smart contract will know who sent the transaction, it's written in the 'msg.sender' field, and he will know that the transaction is authentic because it's signed. – gisdev_p Nov 25 '17 at 04:51