How do you detect user has blockstack?

I have a web application and I now want to add login with Blockstack to it. But I don’t want to have the “log in with Blockstack” option unless the user has installed Blockstack.

So my question is: on load of a web page, what is the best way to detect or “sniff out” whether blockstack exists so I can decide to show/not show the “log in with Blockstack” option?

Many thanks!


Hey @danmermel,

Blockstack runs on http://localhost:8888. One way to do this today is to try and fetch from it, to see if it’s running.

We should add a method in blockstack.js that does this automatically if that would be more convenient. I opened an issue here to track this.

thanks @jude! That would be a useful addition.
In the end what I did was ping the blockstack API and set a flag if it was there, so that I can use it later. In the Blockstack settings it says the API is at http://localhost:6270.

So just doing http://localhost:6270/v1/ping will tell you if it is there or not!

I will follow your issue and replace when available!