Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: maplelake on February 25, 2020, 03:02:03 PM



Title: what if I want to create rest-API service ?
Post by: maplelake on February 25, 2020, 03:02:03 PM
Bitcoin core natually supports some rest api, such as ../rest/chaininfo.json.

I see many websites, like https://www.blockchain.com/explorer,  provide query info service by rest-api.

If i want to create such service, do I just run bitcoin core ? is it right ?




Title: Re: what if I want to create rest-API service ?
Post by: zeuner on March 02, 2021, 06:40:22 PM
https://libbitcoin.info/ (https://libbitcoin.info/) might be helpful.


Title: Re: what if I want to create rest-API service ?
Post by: NotATether on March 03, 2021, 04:07:27 AM
If i want to create such service, do I just run bitcoin core ? is it right ?

No you can't just run Core and be done with it, because the results of any queries will only show the state of your node. Certain things such as unconfirmed transactions and peers aren't the same for each node. And even if they were, JSON-RPC isn't identical to REST and you'll have to make a few minor translations in the query before you can pass it to a node.


Title: Re: what if I want to create rest-API service ?
Post by: odolvlobo on March 06, 2021, 12:16:53 AM
Take a look at the btc-rpc-explorer project here: https://github.com/janoside/btc-rpc-explorer

It might be exactly what you are looking for. If you want to create your own service, you could also use it to guide you. Note that it requires a Bitcoin node.