1

I have my own node deployed on Amazon and backend/frontend to work with it and it operates fine - transaction executed, events catched. Now I want to use INFURA instead maintaining my own node and confused how to solve following situation:

I have couple of functions in contract that availabled only for owner and protected by modifier. On my own node it works this way: first unlocked contract creator account (UI form contains wallet password field), then, if success, executed protected function. It is possible only when I have keyfile on the node.

But when I migrate to INFURA I'll have not access to this wallet and thus unable to unlock it. I see only one way - is to ask creator's provate key insteand of password, then create raw transaction, sign it and send to the network.

Question: it is only way to execute protected functions or I missed something simpler then this?

My stack is: Solidity, Node, Truffle, Web3 and so on.

Alex G.P.
  • 1,277
  • 11
  • 27

1 Answers1

1

You can send a signed transaction, then you don't need the keyfile on the node. See the answer to this questions on how to sign transactions. Use eth.sendRawTransaction for sending the signed transaction.

gisdev_p
  • 1,801
  • 1
  • 9
  • 18
  • I know how to make raw transaction and sign it. My question is whether it is only way or not. – Alex G.P. Nov 21 '17 at 09:18
  • Very well, I just wanted to make sure that it's clear that signing a transaction and sending it as raw transacrtion is definiteley a different approach than what you described in your question. And yes, I think in this case it's the only way, and the proper and secure way. – gisdev_p Nov 21 '17 at 09:30