<p>Assuming you have a Bitcoin node to execute RPC calls against (i.e. you're running <code>bitcoind</code> with the RPC turned on), you can do this rather simply with pyjsonrpc:</p>

<pre><code>#!/usr/bin/env python
from pyjsonrpc import ServiceProxy

bitcoin = ServiceProxy("http://127.0.0.1:8332")  # this is your bitcoind node and RPC port
bitcoin.username = 'testuser'  # rpcuser
bitcoin.password = 'testpass'  # rpcpassword
print(bitcoin.getbalance())
</code></pre>

CC BY-SA 4.0
2018-09-27T23:20:53.277Z
Thank you @Motoma. I am not aware if I have run any local RPC node unless pybitcointools is running it on the background. My intent is to have a personalized payment gateway and be able to track balances of multiple wallet addresses.
CodeJammer
CC BY-SA 4.0
2018-09-28T12:36:53.733Z
@CodeJammer In that case, you'll need to run a local Bitcoin node in addition to the script above. Doing that is probably beyond the scope of this question, but Bitcoin Core or Bcoin are two such options for running a local node.
Motoma
CC BY-SA 4.0
2018-09-26T22:02:33.303Z
2018-09-26T22:02:33.303Z
Motoma
<p>On a tutorial in <a href="https://www.youtube.com/watch?v=um9omi943jw" rel="nofollow noreferrer">Youtube</a>
it uses <a href="https://github.com/vbuterin/pybitcointools" rel="nofollow noreferrer">pybitcointools</a>. Upon searching it's github repository, I have found that it was <a href="https://github.com/bitcoinbook/bitcoinbook/issues/447" rel="nofollow noreferrer">not maintained</a> anymore. Are there any alternative to this library which can get wallet balance?</p>

<p>Thank you.</p>

CC BY-SA 4.0
2018-09-26T15:21:44.380Z
i assume you want to create a wallet for bitcoin, here the lib for that: https://github.com/1200wd/bitcoinlib
Zombie
CC BY-SA 4.0
2018-09-26T23:13:37.480Z
Try this one https://github.com/mcdallas/cryptotools
Mike D
<wallet><python><balance>
Get Bitcoin Wallet balance with Python
CodeJammer
# Get Bitcoin Wallet balance with Python

(Asked by: username_0 on 2018-09-26)

On a tutorial in [Youtube](https://www.youtube.com/watch?v=um9omi943jw)
it uses [pybitcointools](https://github.com/vbuterin/pybitcointools). Upon searching it's github repository, I have found that it was [not maintained](https://github.com/bitcoinbook/bitcoinbook/issues/447) anymore. Are there any alternative to this library which can get wallet balance?

Thank you.

**Tags:** wallet, python, balance

> **Comments:**
> **username_1**: i assume you want to create a wallet for bitcoin, here the lib for that: https://github.com/1200wd/bitcoinlib  
> **username_2**: Try this one https://github.com/mcdallas/cryptotools  

---

## 1 answers

### Answer by username_3 on 2018-09-26. Score: 0 | Accepted answer

Assuming you have a Bitcoin node to execute RPC calls against (i.e. you're running bitcoind with the RPC turned on), you can do this rather simply with pyjsonrpc:
#!/usr/bin/env python
from pyjsonrpc import ServiceProxy

bitcoin = ServiceProxy("http://127.0.0.1:8332")  # this is your bitcoind node and RPC port
bitcoin.username = 'testuser'  # rpcuser
bitcoin.password = 'testpass'  # rpcpassword
print(bitcoin.getbalance())

> **Comments:**
> **username_0**: Thank you @username_3. I am not aware if I have run any local RPC node unless pybitcointools is running it on the background. My intent is to have a personalized payment gateway and be able to track balances of multiple wallet addresses.  
> **username_3**: @username_0 In that case, you'll need to run a local Bitcoin node in addition to the script above. Doing that is probably beyond the scope of this question, but Bitcoin Core or Bcoin are two such options for running a local node.  

---

