Blockchain and Money 5–6: Bitcoin Transactions & Smart Contracts

Blake Im
4 min readAug 29, 2021

Each week, I will be posting my notes from MIT’s Blockchain and Money course to keep myself accountable for my learning.

A transaction in Bitcoin involves input and output.

The inputs are essentially historic transactions that prove your current balance (block ID and a unique transaction ID within that block), and a signature to validate the sender.

The output is the value being transferred and Bitcoin address of the recipient.

Captured from the lecture.

The input values have to be greater or equal to the output value. One can include their own address in the output to control changes, since you cannot split the amount of Bitcoin in the input otherwise.

Any excess will be paid as a “fee” for the miner. The higher the allocated fee, the more likely it will get accepted by a miner to be validated in the next block.

At the time of this writing, the fee averages around 2.7 USD per transaction. The fee varies with supply and demand, and it hit over 60 USD earlier this year. An output cannot be used as a transaction input until there are at least another 100 blocks behind it.

UTXO

Unspent transaction output (UTXO) is a database which contains all currently unspent transaction outputs, intended to speed up the transaction validation process.

This is how Bitcoin tracks available balances that can be spent in the system. Each node in the blockchain may have a copy of the UTXO, but they don’t have to.

Bitcoin also has a scripting language that can be used to set very basic conditions for payments, which can be thought of as the primordial version of smart contracts.

Smart Contracts

A smart contract is a set of promises in digital form, including standard operating procedures.

Ethereum is another blockchain-based decentralised system that aims to improve on Bitcoin’s technical limitations for more practical use.

The big difference between Bitcoin and Ethereum is how they make and store transactions. Bitcoin processes transactions through UTXO while Ethereum is account-based, where different accounts are controlled by a private key. The scripting in Ethereum is also more flexible than that of Bitcoin and supports more languages.

On Ethereum, a smart contract is just an Ethereum account. However, instead of being controlled by a private key, it is deployed into the network and act as programmed when specified conditions (terms of the contract) are met. These smart contracts cannot be deleted or reversed.

Legal Issues of Smart Contracts

A contract is a promise or performance given in exchange for promise or performance. In the context of digital contracts, they are mostly concerned with performance-for-performance exchanges.

A vending machine is an example of performance-for-performance contract. When you put in coins, it will output a snack of that cost. There are direct and implied terms in this exchange. The direct being the completion of transaction itself, but indirect being the qualification of the snack to be safely consumed by a person. This indirect term is imposed by the “legal system”, which in turn means the legal system has an interest in the contract.

Hence a contract always involves 3 parties, the 2 private parties that engages with the contract, and the state that imposes conditions on the contract.

The state cares about the kinds of contract, effect of contract, terms of contract as well as taxation of contract.

As an obvious example, a contract “I’ll pay you $10K if you burn down my car so I can get my insurance payment” would not legally be enforced by the state (it is an illegal contract).

The legal issue with smart contracts is that it can remain hidden from the government’s conditions.

In countries like Australia, we take it for granted that the terms of the contract will be enforced upon breach by a legal body.

One argument for smart contracts is to be a substitute in places where there are not established legal systems. Another is to handle transactions where the cost of the transaction itself is too high. All of these factors already brought great market demand for smart contracts.

While smart contracts bring more clarity in the terms since all possible scenarios are covered by code, sometimes ambiguity is a positive in contracts. For example, how long would you spend negotiating the terms of a scenario that only has 0.01% chance of happening? In this sense, contracts that is wrapped in a lot of ambiguity would actually be more costly to establish via smart contracts.

In the end, practical open ended conditions such as: “If X happens, then we will take this to the court and settle it there” mean smart contracts will inevitably be still embedded in the classic legal system.

--

--

Blake Im

Data Analyst & Analytics Engineer. Writing about all things tech and personal reflections.