Author

Topic: offline bitcoin database connect on python (Read 329 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
June 23, 2020, 07:17:24 AM
#3
Check a couple of things:

Did you fill the following settings in your config file of bitcoin core (bitcoin.conf, on linux in .bitcoin-folder):
Code:
server=1
rpcpassword=
rpcuser=
You should fill in the and values with your own.

Don't forget to makesure rpcport properties on bitcoin.conf file and your software have same value, i saw few members missconfigure their ports, especially when they use testnet or regnet.
sr. member
Activity: 310
Merit: 727
---------> 1231006505
Check a couple of things:

Did you fill the following settings in your config file of bitcoin core (bitcoin.conf, on linux in .bitcoin-folder):
Code:
server=1
rpcpassword=
rpcuser=
You should fill in the and values with your own.

If you want to be able to also get transaction info on addresses not in your wallet you also want to add txindex to your bitcoin.conf file:
Code:
txindex=1

Fire up bitcoind:
Code:
bitcoind -daemon

Check to see if you can use rpc calls from the commandline:
Code:
curl --user : --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockcount","params":[]}' -H 'content-type:text/plain;' http://127.0.0.1:8332
Where you use the same and as included in your bitcoin.conf file

If all works fine, you can setup things for Python, First install the bitcoin-rpc package (I assume you use python3):
Code:
sudo pip3 install bitcoinrpc

And finally connect from python:
Code:
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:8332"%("", ""),timeout = 120)
print('You are synced up to block %s) , % rpc_connection.getblockcount())
And once again, replace the and with your own settings.
member
Activity: 73
Merit: 19
rpc how to connect on python

i install bitcoin-core and downloaded all blocks

but i cant do connect rpc on python

my documants this > https://bitcoinlib.readthedocs.io/en/latest/_static/manuals.setup-bitcoind-connection.html#bitcoin-node-settings


is there any advice ?
Jump to: