You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assuming you have complied and installed bitcoin, use the following commands to download and install the latest python-bitcoinlib from Peter Todds repository on Github
Then run the following commands as root to install
cd python-bitcoinlib python setup.py build python setup.py install
Congratulatons, you are now able to interface with the bitcoin RPC at higher speed, using the simple commands from this python library.
Here are two very basic example scripts you are able to run on your #fullnode
balance.py
import bitcoin
#bitcoin.SelectParams("testnet")
import bitcoin.rpc
myproxy = bitcoin.rpc.Proxy()
bal = myproxy.getbalance()
print "Your balance is ...", bal, " satoshis."
print "Thank you for using bitcoin, have a nice day!"
exit()
send.py
import bitcoin
#bitcoin.SelectParams("testnet")
import bitcoin.rpc
import bitcoin.wallet
myproxy = bitcoin.rpc.Proxy()
bal = myproxy.getbalance()
print ("Your balance is ...")
print (bal)
address = raw_input("Please enter the address to send to: ")
if len(address) == 0 :
print ("No address supplied, have a nice day!")
else :
satoshis = raw_input("Please enter the number of satoshis to send: ")
if len(satoshis) == 0 :
print("We can not send zero satoshis, please enter only numbers, have a nice day!")
else :
myproxy.sendtoaddress(address, satoshis)
print("Coins have been sent!")
exit()
The text was updated successfully, but these errors were encountered:
This is great! We should script this as well and also put the example code inside this repository. That way when we clone and install the fullnode, everything is there for the user.
Getting Started - Bitcoin Fullnode and Python Programming
OK so you have your #fullnode but now what? You want to be able to program with it of course.
You can use the Bitcoin RPC directly however it can be a bit slow on the Rasberry Pi 2 (http://bitcoinupdates.net/bitcoin-cli-very-slow-to-respond-to-rpc-calls-raspberry-pi/)
but with some additional libraries interfacing with bitcoin becomes faster and quite simple.
Step 1
Assuming you have complied and installed bitcoin, use the following commands to download and install the latest python-bitcoinlib from Peter Todds repository on Github
git clone https://github.com/petertodd/python-bitcoinlib
Then run the following commands as root to install
cd python-bitcoinlib
python setup.py build
python setup.py install
Congratulatons, you are now able to interface with the bitcoin RPC at higher speed, using the simple commands from this python library.
Here are two very basic example scripts you are able to run on your #fullnode
balance.py
send.py
The text was updated successfully, but these errors were encountered: