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!

  • 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 '16 at 3:29
  • I am also trying the same.Please let me know the steps if you done. thanks, Bala – user3886 Aug 12 '16 at 17:42
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);
  • 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 '16 at 4:24
  • @PaulS yes, i added some details to the answer. – niksmac Apr 2 '16 at 4:28
  • BTW is there an in-browser ethereum node e.g. ethereumjs? – Paul S Apr 2 '16 at 4:32

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.