Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Forna-Dev on January 09, 2020, 10:37:23 AM



Title: Own Bitcoin-API
Post by: Forna-Dev on January 09, 2020, 10:37:23 AM
Hello everyone,

I would like to create an own project where I will be able to check balances and transaction from the BTC blockchain. I would like to use my own infrastructure and I don't want to request other API services.
As far as I could read now the official BTC core installation supports RPC-Calls but you can get only the balance of your own accounts.

Does somebody know a simple way how I can run my own BTC node and request from it balances from BTC addresses and Details of Transactions with python, ideally as REST-API?
It would be great if there is already a docker container available :-)

Thanks for your help!

Forna-Dev


Title: Re: Own Bitcoin-API
Post by: ETFbitcoin on January 09, 2020, 11:05:04 AM
You could try looking for open-source Bitcoin blockexplorer project, example https://github.com/janoside/btc-rpc-explorer (https://github.com/janoside/btc-rpc-explorer)

I never try it, so i've no idea if it has all features you're looking for.


Title: Re: Own Bitcoin-API
Post by: pooya87 on January 09, 2020, 11:07:09 AM
Does somebody know a simple way how I can run my own BTC node and request from it balances from BTC addresses and Details of Transactions with python, ideally as REST-API?

take a look at ElectrumX implementation projects: https://github.com/kyuupichan/electrumx that are the Electrum server implementations based on the protocol used by Electrum software (this is in python). or any of the block explorers on github that are open source.
basically you have to do what block explorers do, add an additional index on top of your blockchain so that you can enable searching based on any arbitrary address. obviously that would take an additional space on your disk.


Title: Re: Own Bitcoin-API
Post by: darosior on January 09, 2020, 11:10:09 AM
Hi,

Details of Transactions with python, ideally as REST-API?
Esplora (https://github.com/Blockstream/esplora) is exactly what you're looking for (but beware of the storage requirements :) ). I tested it earlier and it's really great.


Title: Re: Own Bitcoin-API
Post by: nc50lc on January 09, 2020, 12:00:20 PM
As far as I could read now the official BTC core installation supports RPC-Calls but you can get only the balance of your own accounts.
For transactions, you can use the RPC command -getrawtransaction "TXID" true for any transaction as long as you add -txindex in the config which will require additional space.
You might also need to add/start with -reindex if it's the first time you start with txindex.

For addresses' balance, you need something like the above posts.


Title: Re: Own Bitcoin-API
Post by: Forna-Dev on January 09, 2020, 12:38:02 PM
This sounds already very good, exactly what I was looking for.
I will have a look on the mentioned tools. Thank you very much !