Bitcoin scripts

Apr 28, 2024 1:13:57 AM

Bitcoin was designed to be an electronic payment system and programmable money. We can program every coin we own to obey specific rules that we define. This is done through the Bitcoin script, which implements a computational machine with limitations.

In other words, there is a limited operating system within Bitcoin where we can write small programs. Their purpose is to indicate how a particular coin can be used. These scripts generally lock the coin sent to a specific account until that account finally unlocks it to transfer it to someone else.

However, Bitcoin allows other ways of dealing with coins. For example, it is possible to lock a particular coin until a group of people unlocks it. What is this useful for? Let’s say a company owns a large number of bitcoins. It would be too risky if only one private key could move those bitcoins. With a script that requires multiple signatures, it is possible to lock such bitcoins so they can only be spent if two or three executives authorize an expense. In that case, just one signature would not be enough.

Another typical pattern in Bitcoin is to lock coins for a specific time so they can just be moved in the future. This can be useful in buy-sell scenarios where the buyer can appeal for a refund if the seller fails to ship the agreed item.

The ability to program bitcoins makes it possible to build applications on top of Bitcoin, such as the Lightning Network, for micropayments. In this scenario, it is possible to transfer small amounts of bitcoins to pay, for example, a cup of coffee. Currently, micropayments are not feasible with the price of transactions on the Bitcoin network.

It is even possible to use the Bitcoin network to store information and to store the authorship of a poem, a book, or even a song, on the blockchain. Such a record will remain immutable and tamper-proof, as well as it may be used as proof of authorship.

However, as Bitcoin was designed to be programmable money, there is a limitation on the scope of programs that can be written with its script. The idea of creating a blockchain that could run any program came just six years after the launch of Bitcoin, with the emergence of protocols like Ethereum and Neo.