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.

  • I am not sure what the use case for your application is, but if it is production grade, I would be hesitant to use Infura. We used Infura for a while but encountered multiple issues with them returning inconsistent data because of the way their system is architected (load balancer in front of a lot of different nodes). We switched to Alchemy (alchemyapi.io) and have had more consistent responses. – hhppj Mar 7 at 23:00
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.

  • 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 9: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 9:30

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.