roytags
roytags

Reputation: 99

SSH and Ethereum node

I have a node (virtual machine 1) with open port for SSH and keys are in the keystore, can another virtual machine (without a node and keys) in same network transact using the node and keys in the virtual machine 1 by accessing a website that use web3.js ?

e.g. Like accessing a METAMASK custom RPC pointing to localhost in the VM2 >> but the transaction is in VM1

Please advise

Upvotes: 0

Views: 219

Answers (1)

q9f
q9f

Reputation: 11824

Yes, sure, but this is really dangerous! Because you basically expose your keys to the outside world and this is a honeypot for script-kiddies to find your exposed RPC endpoints.

Better way is to create the transaction at VM2 and use VM1 to broadcast it, there is no web3.js required at all. Just expose the Websockets- or HTTP-JSONRPC endpoints to the web. Note, you should only expose safe APIs.

For Parity-Ethereum, VM1 config would look like this:

parity --jsonrpc-port 53545           \
       --jsonrpc-interface 133.3.3.37 \ # your public IP of VM1
       --jsonrpc-apis safe            \ # only expose safe APIs
       --jsonrpc-hosts 242.42.42.42   \ # the IP (or hostname) of VM2

This way you can create the transaction at VM2 and broadcast it using VM1 raw transaction:

curl --data '{"method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST 133.3.3.37:53545

Upvotes: 1

Related Questions