On March, 7 2012, the first P2SH bitcoin transaction occurred. Unlike traditional forms of payment, bitcoin is programmable, and P2SH is the method to unleash this power. Since then, the number of these transactions has been growing exponentially, reaching thousands daily in the last several weeks. In this article, we are going to examine what bitcoin contracts are, how they can be implemented using P2SH, and conclude with a short analysis of the growth of P2SH tranactions.

Bitcoin Contracts

Bitcoin is programmable. This means that bitcoin owners can give instructions for when or how their bitcoins can be spent. A mother can program a gift that will occur on her child’s 18th birthday. A bank can program a loan to a potential homeowner where a cosigner is needed before the transfer of funds will take place. This logic is baked into the money. No separate contract needed.

For a traditional contract, a third-party is needed to enforce the agreement. If Bob agrees to pay Alice in ten years, but later changes his mind, Alice’s only option is to sue. The same occurs if Bob no longer has the means to pay. With bitcoin, the conditions of the contract can be directly programmed into the funds. This allows the transaction to occur automatically when the contract’s conditions have been met, and prevents the funds from being spent in another way. Bob can’t change his mind, and he can’t run out of funds to pay Alice.

P2SH

The most popular implementation of bitcoin contracts is through something called P2SH, or “Pay to Script Hash.” Using P2SH, a bitcoin can be programmed with a certain type of script. With this script, the intended recepient of the bitcoin must provide specific data in order to redeem the funds. That is, the transfer of funds occurs automatically once the build-in conditions of the funds have been met—and can’t occur before then.

For example, if Alice wants to pay Bob for work, but only if the work performed is satisfactory, she can create a bitcoin address that requires the signature of a third-party arbitrator to redeem the funds. In this way, Alice can send the funds to this address, and Bob will receive them only after the arbitrator has agreed. Indeed, there are startups offering this sort of service.

Are People Using Bitcoin Contracts?

Through February 11, 2015 (block 342,999), there have been 323,662 P2SH payments. This represents less than one half of one percent of all payments.

People are beginning to use P2SH transactions; in recent blocks, P2SH payments are closer to 1.5% of the total. More importantly, the number of P2SH payments is growing exponentially, as can be seen in the chart below, showing the log number of P2SH transaction outputs per 1000 blocks.

In some sense, this result should not be surprising, as bitcoin is still relatively new. Major wallets like Coinbase are starting to offer support for these more complicated transactions, and a host of startups are entering the space. Only time will tell if bitcoin contracts take off (and if bitcoin itself becomes more mainstream). Just as the first widely-available browser appeared a couple of years after the first website, it looks like we may be at the dawn of a new age of payments.