Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stepansnigirev/requests-bitcoin-cli

A tiny script to run Bitcoin JSON-RPC commands using requests
https://github.com/stepansnigirev/requests-bitcoin-cli

Last synced: 8 days ago
JSON representation

A tiny script to run Bitcoin JSON-RPC commands using requests

Awesome Lists containing this project

README

        

# requests-bitcoin-cli

A tiny script to run Bitcoin JSON-RPC commands using requests

## Usage

```python
from rpc import BitcoinCLI

# port: 18332 - testnet, 18443 - regtest, 8332 - mainnet
cli = BitcoinCLI("bitcoinrpc", "mysecretpassword", port=18443)

print(cli.url)

print(cli.getmininginfo())

print(cli.listwallets())

##### WORKING WITH WALLETS #########

# specify wallet name as a key argument
print(cli.getbalance(wallet=""))

# or create a new instance for this wallet
w = cli.wallet("mywallet") # will load default wallet.dat

# url will be different
print(w.url)

print(w.getbalance()) # now you can call commands for the wallet
```