2

I want to have a function to send eth to another address by php program, and I do not want to run a local node on my server. Can I use infura as the web3 provider and use the API to send eth to another address? That means, can I use infura as the node, not using my own local node. I heard that I must sign the message offline? can I directly call infura API to sign? or any easy PHP script for sign and send transaction without running a local node? Thanks

0

You can use infura, but you need to sign the messages locally and send a raw transaction. Infura's nodes will not allow you to store your keys in there (and you shouldn't). Another option is to use metamask, which is using infura nodes, but it will take care of the signing locally.

You will find how to sign locally described in this answer: how to use ethereumjs-tx.js in a browser

Hope this help

  • Thanks, actually metamask needs a plugin to be installed so it cannot be used for cell phone. As for the signing message locally, is easy any easy php script to use for generating raw transaction? thanks or is there any other node api that allows me to submit my private key so that I can sign the transaction by their api? – Louis Aug 18 '18 at 7:17
  • signing the transaction using javascript is easy, see how to do it here: ethereum.stackexchange.com/questions/8579/… – Jaime Aug 18 '18 at 7:31
  • Thanks a lot. i checked the site ethereum.stackexchange.com/questions/8579/…, let serializedTx = tx.serialize().toString('hex') console.log('serializedTx:', serializedTx), here whether serializedTx will be the raw transaction and will be sent to infura api ? thanks – Louis Aug 18 '18 at 8:27
  • if this answered your question please accept the answer – Jaime Aug 18 '18 at 8:28
  • accept this answer – Louis Aug 19 '18 at 16:23

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.