8

I have Mist wallet running on Windows 8. I want to connect my NodeJS applcation to the Ethereum network. I have no idea where to start. Could you point me to the direction I should be looking at? Are there any NPM modules for this?

P.S. My end goal is to create a website that connects through an Ethereum client to the network, calls a contract and recieves return values from it. In other words, I want to create a custom token and issue it to the users of my app. This is an amazing technology!

2
  • If the answer resolves your doubt, feel free to accept is the correct answer by checking the tick mark below the voting buttons. accept
    – niksmac
    Apr 6, 2016 at 3:29
  • I am also trying the same.Please let me know the steps if you done. thanks, Bala
    – user3886
    Aug 12, 2016 at 17:42

1 Answer 1

7

Ethereum offers a Web3 JavaScript Ðapp API

To make your Ðapp work on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer.

You can use this library as jQuery in any HTML page. To use this is NodeJS web3 is available as an npm package

How to use.

Run your node with geth --rpc

npm install web3

web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var coinbase = web3.ETH.coinbase;
console.log(coinbase);
3
  • 1
    Keep in mind that you have to run your own node, as it's not common to expose the RPC to worldwide use, as RPC is not considered a secure API.
    – Paul S
    Apr 2, 2016 at 4:24
  • @PaulS yes, i added some details to the answer.
    – niksmac
    Apr 2, 2016 at 4:28
  • BTW is there an in-browser ethereum node e.g. ethereumjs?
    – Paul S
    Apr 2, 2016 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.