Post
Topic
Board Announcements (Altcoins)
Re: [ANN][DASH] Dash | First Anonymous Coin | Inventor of X11, DGW, Darksend and InstantX
by
afreer
on 15/04/2016, 09:41:18 UTC
Trying to access Dash api at https://explorer.dash.org/q via javascript gives me Cross Origin Block error. Do anyone of you know any Dash api that works with js?

I think its not possible and not wanted to access files, that are not located on your own server, via javascript. Thats not a problem with this particular API, it's javascript in general.

I access the api with a PHP file and open this file with javascript. Works fine.

Js has this limitation, but it can be overwritten by API server settings.

Dash is one of the few altcoins for which I cannot find a public API that works with Javascript. This means that you cannot do a hybrid mobile application (in cordova framework in my case) involving Dash in general. That's not a good thing for an altcoin's ecosystem I think.

Sounds like the server isn't setup for cross-origin resource sharing because I think Cordova XHR requests are already setup for CORS so it should 'just work' from your client side.

We're building a decentralized REST API for Dash Evolution hosted by the Masternode network you can call from JavaScript that will be accessible at api.dash.org, right now not sure of any public Dash APIs although maybe one of the other devs on DashTalk can answer better.

I'll have a look at enabling CORS for explorer.dash.org

edit: @borntorun: I have enabled CORS now, please try your JS code again Smiley

great, works for me: https://gist.github.com/andyfreer/b742c3cf901a1e54aa4f993efa6bbe96

EDIT: there is also a live Dash Insight API from UdjinM6 that's powering the transaction visualizer http://listen.masternode.io, the API endpoint at http://insight.masternode.io:3000/.  Insight is the BitPay block explorer api: https://insight.is/