2

How do you access the api's of ethereum via the browser? Say I wanted to make a one page app that updates every 1 minute with the block number. And where can I get a list of all the API variables?

4

Accessing Ethereum's APIs via a plain browser is very dangerous, as it opens you up to all kinds of nasty things people on the internet might load into your browser.

It's still doable of course via --rpc and --rpccorsdomain, but I strongly recommend against doing it. A better solution is to develop and run your API through Mist, which has access to the blockchain via IPC channels and also has the necessary precautions in place to prevent harmful code from screwing around with your node.

  • 1
    I'd add onto this: It's nasty because the domain you allow through may have complete control over your ether, no dialogs will be displayed, the domain could just transfer all the ether over to themselves. – linagee Feb 2 '16 at 19:49
2

I want to reiterate the answer that "Accessing Ethereum's APIs via a plain browser is very dangerous, as it opens you up to all kinds of nasty things people on the internet might load into your browser."

That said, "a one page app that updates every 1 minute with the block number" is a reasonable test which does not need an unlocked account or transactions to be signed. The web3.js JavaScript API is what you can use and the related APIs you need to spend time on is web3.eth.filter.

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.