2

I am trying to build a website that will allow multiple users to send Ethereum transactions without having to install a node. My server is running a node, which is configured to accept requests from any internet address, and it seems that I should be able to connect to the node from any device through a web browser. Is the Ethereum JavaScript API useful to doing this? Thank you!

  • Though possible, allowing RPC connections from any hosts is discouraged due to security implications. The usual pattern is to have server-side software that speaks to Ethereum node behind a firewall. – Mikko Ohtamaa Jul 19 '16 at 17:16
1

Yes, you can use web3.ETH.sendTransaction to Sends a transaction to the network.

web3.eth.sendTransaction(transactionObject [, callback])

Example

// compiled solidity source code using https://chriseth.github.io/cpp-ethereum/
var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3";

web3.eth.sendTransaction({data: code}, function(err, address) {
  if (!err)
    console.log(address); // "0x7f9fade1c0d57a7af66ab4ead7c2eb7b11a91385"
});
  • This question does not answer regarding if you need or don't need a node running on users' side – Mikko Ohtamaa Jul 19 '16 at 16:25
  • @MikkoOhtamaa Why not? web3 can connect to any node right? – niksmac Jul 19 '16 at 16:32
  • Are you saying one should run publicly facing Ethereum node allowing RPC connections from any host? As far as I know running public RPC interface is highly discouraged due to security implications. – Mikko Ohtamaa Jul 19 '16 at 17:11
  • @MikkoOhtamaa yeah, i am aware of that. OP is not asking or seems to be worried about that. – niksmac Jul 19 '16 at 17:14
1

Set up your node, then create a public facing api that accepts signed raw transactions input. You could do this with hooked web3 and your users could use eth-lightwallet by ConsenSys.

signing.signTx(keystore, pwDerivedKey, rawTx, signingAddress, hdPathString)

Signs a transaction with the private key corresponding to signingAddress.

Inputs

  • keystore: An instance of the keystore with which to sign the TX with.
  • pwDerivedKey: the users password derived key (Uint8Array)
  • rawTx: Hex-string defining an RLP-encoded raw transaction.
  • signingAddress: hex-string defining the address to send the transaction from.
  • hdPathString: (Optional) A path at which to create the encryption keys.

Return value

Hex-string corresponding to the RLP-encoded raw transaction.

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.