2

I have read RPC communications from Internet can be forwarded to geth console. But I have no hint on How? How can I use rpc port to carry out transactions over Internet that I performed using geth console.
Is there any way I can access my account, carry out transactions from a web browser? PS: I know there are security issues related to it, and using this is not safe.

1

I have read RPC communications from Internet can be forwarded to geth console. But I have no hint on How?

geth listens by default on localhost port 8545. In order to be able to access an instance of geth running on a separate machine you need to launch it with the following RPC modules enabled:

--rpcapi "admin,personal,db,eth,net,web3"
  • personal and admin handle account managing operations (change credentials, unlock, create, etc.)
  • db handles the local copy of the block chain
  • eth is an object use to manage transaction related operations (making transactions, retrieving receipts, contract deployment, etc.)
  • net is a network manager module (shows the number of connected peers, allows disconnecting a peer, etc.)
  • and web3 is a js framework used to communicate with geth through JSON objects received by a client

Note that any peer with remote access to the respective machine can interact with the client meaning that if an account is unlocked an attacker can empty all of it's Ether through a transaction sent as a JSON object to the port geth is listening on.

You can set the RPC port to a custom value:

--rpc --rpcport "8080"

and, as you want to use a browser you must also specify a cross domain command line argument to get around the same-origin-policy most browsers implement.

--rpccorsdomain "*"

Is there any way I can access my account, carry out transactions from a web browser? PS: I know there are security issues related to it, and using this is not safe.

In order to interact with the geth instance on a remote machine from a browser you can make use of the web3 framework and point it to the network address and port geth is listening on:

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://<remote_address>:<remote_port>"));
}
  • 1
    Default port is 8545, not <s>8585</s>. – Xavier Leprêtre B9lab Aug 26 '16 at 10:56
  • Thanks for support. I have set rpcport and also rpccprsdomain already, but my main issue is accessing my account from remote machine through a web browser (not using command line). Can you please elaborate the second part of you answer like, where I need use that script, and what steps do I need to carry out transactions using a web browser. I have accessed my account using geth console and Mist, I found lot of tutorials regarding that, But now I want to take a step ahead to use web based GUI to carry out transactions , but I am not getting any tutorials or explanations on that.Any help? – Prashant Prabhakar Singh Sep 8 '16 at 6:42

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.