A bitcoin transaction script language / vm implementation in python. Built based on info from the bitcoin wiki.
- Install bitcoind
- Guide for installing using Macports on Maverick guide
- Enable the bitcoin rpc server and historical transaction indexing in ~/bitcoin.conf by
adding/uncommenting the following lines and replacing bracketed
things:
- txindex=1
- server=1
- rpcuser=[yourUser]
- rpcpassword=[yourPass]
- rpcport=8332
- rpcconnect=127.0.0.1
- Spin up a bitcoind daemon, rebuilding the historical index. This will take some time to complete; about a day for all transactions. You will be able to work with the current state of the index, though, so transactions from early blocks should work pretty quickly.
bitcoind -conf=/path/to/your/bitcoin.conf -daemon -reindex
- Get bitrans:
git clone https://github.com/hackscience/bitrans.git
cd bitrans
- Install the python ecdsa lib.
- Fire up python:
python
- Establish a connection to the bitcoind daemon
>>> import rpc
>>> s = rpc.jsonrpc("yourUser","yourPass")
- Grab a transaction
- the transaction id could be found in https://blockchain.info/
- for testing, we use txid = ‘fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4’.
- Note that if your bitcoind hasn’t finished reindex, the current rpcserver will just return NoneType Error.Just grab a different txid or wait until reindex finishes.
>>> import transaction
>>> t = transaction.transaction('fff2525b8931402dd09222c50775608f75787bd2b87e56995a7bdd30f79702c4',s)
- Verify the transaction:
t.verify()
Install and run nose:
pip install nose
nosetests