A
A
artem_sib2019-08-06 11:14:55
Python
artem_sib, 2019-08-06 11:14:55

Where can I find a Python library or methods for working with Bitcoin RPC or CLI?

Good afternoon, I know that it’s not right to ask questions in this format, but I can’t figure out how to simply use Python, for example, create a wallet, delete it, send coins from it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Developer, 2019-08-06
@artem_sib

Just downloaded, tried it - works
https://github.com/jgarzik/python-bitcoinrpc

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException

rpc_user = "btc_user"
rpc_password = "btc_password"
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:8332"%(rpc_user, rpc_password))

addr = "1LTzdfgert56546ytythghgfUEK"
print(rpc_connection.getreceivedbyaddress(addr))

newaddress = rpc_connection.getnewaddress ( "label", "p2sh-segwit" )
print(newaddress)

difficulty = rpc_connection.getdifficulty()
print(difficulty)

balance = rpc_connection.getbalance()
print(balance)

#список всех последних 1000 транзакций:
transactions = rpc_connection.listtransactions("*", 1000)
print(transactions)

The list of methods can be found here:
https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/g...
https://bitcoincore.org/en/doc/0.17.0/rpc/wallet/ s...

U
user., 2019-11-22
@nekolov

I’m starting to deal with this topic, tell me, in this code, do we authorize in the blockchain itself or is this a library for working with api of a particular exchange?

rpc_user = "btc_user"
rpc_password = "btc_password"
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:8332"%(rpc_user, rpc_password))

I'm not entirely sure which proxy data should be specified here.
I will assume that Core must be installed and, accordingly, downloaded the entire blockchain, but here we simply indicate the data for authorization on my Core?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question