Skip to main content

Bitcoin RPC Client

Project description

Bitcoin RPC Client

RPC client for Bitcoin Daemons

Install

pip install bitcoin-rpc-client

Usage

Prerequesites:

Run a Bitcoin daemon/node

bitcoind -server -rpcuser=user -rpcpassword=pass

Sync

from bitcoin_rpc_client import RPCClient

with RPCClient('http://127.0.0.1:18443', 'user', 'pass') as rpc:
    blocks = rpc.generate(101)
    tx = rpc.sendtoaddress(address, 20)

# or 

rpc = RPCClient('http://127.0.0.1:18443', 'user', 'pass')
blocks = rpc.generate(101)
tx = rpc.sendtoaddress(address, 20)
rpc.close()

Async

from bitcoin_rpc_client import RPCClientAsync

with RPCClientAsync('http://127.0.0.1:18443', 'user', 'pass') as rpc:
    blocks = await rpc.generate(101)
    tx = await rpc.sendtoaddress(address, 20)

# or

rpc = RPCClientAsync('http://127.0.0.1:18443', 'user', 'pass')
blocks = await rpc.generate(101)
tx = await rpc.sendtoaddress(address, 20)
await rpc.aclose()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitcoin-rpc-client-0.1.2.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

bitcoin_rpc_client-0.1.2-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page