Hello everyone,
After seeing Mike Hearn's talk at the conference I wanted to play a bit with some of that stuff so I started working on an
assurance contracts proof of concept.
Using bitcoin 0.7 and the raw transaction API I got this working on testnet-in-a-box. I haven't tried this on the main bitcoin network.
This is a small python script that does three things:
1) Creating a new assurance contract.
$ python pledge.py createcontract miA6bqrz9thieUpd5rZmHe1XpTmY6DLjot 7500000000
Contract tx:
Amount: 75
To: miA6bqrz9thieUpd5rZmHe1XpTmY6DLjot
01000000000100eb08bf010000001976a9141cf69384eb6b27a8161b59577f41310a93b9c14388ac00000000
2) Adding pledges (this should be done by the various people wanting to pledge some bitcoins):
$ python pledge.py pledge 01000000000100eb08bf010000001976a9141cf69384eb6b27a8161b59577f41310a93b9c14388ac00000000 5000000000
Sent 50BTC to address n21Nw4ikZrURVxaydZwYrPmdDyd8J8ZdQw
(private key: cVNe9DSbZPe71pzwWpRbiR1n4NQ2Bdqi67g7HGiJCzARtX66nefY)
TXId: 0ae14dc7c016d8bce090cfaa2eb88ce1e2818f24d3372c5682118ff5a68e8200
TXOut: 0ae14dc7c016d8bce090cfaa2eb88ce1e2818f24d3372c5682118ff5a68e8200:0
Signing transaction...
Signed input:
00828ea6f58f1182562c37d3248f81e2e18cb82eaacf90e0bcd...
3) The person that made that contract needs to collect all inputs from everyone and put them in a single text file.
If there are enough pledges they can be combined and the final transaction sent to the bitcoin network.
$ python pledge.py finalize 01000000000100eb08bf010000001976a9141cf69384eb6b27a8161b59577f41310a93b9c14388ac00000000 inputs
Sending raw tx...
010000000200828ea6f58f11...
This is still very much a proof of concept: command line application, having to share inputs, big strings that needs to be copied around, ... But it works

The code is on
https://github.com/titeuf87/btcassuranceParts of it are copied from bitcoin-python, pynode and pywallet.
I think the next thing for this is to divide it in a server/client model: a server that holds assurance contracts and a client that allows people to pledge bitcoins to one of those contract and send a signed input over.