Blockchain: An Overview (transcript)
Tae Royle provides an overview of how blockchain and smart contracts work along with a live demonstration of a smart contract transaction.
Jean Woo:
Hi, good afternoon, everybody. My name is Jean Woo. I'm a banking lawyer, a banking partner in Singapore. I specialise in trade and commodity finance. Very delighted to see everyone, to join us for our very exciting fintech clinic today. I believe that all of you would know that fintech's transforming a lot of our sectors [*] certainly in transforming mine, and I'm sure it would yours as well. We've got quite a lot of exciting material to go through today, so without further ado, let me introduce our first speaker, is Tae Royle. So Tae is the Head of Digital Legal Services for Ashurst. Fintech is important to our firm. We hope to make sure that Ashurst is synonymous with the word fintech. Tae leads a team of legal technologists. So what it means that is innovation, so we're trying to bring innovation both internally as well as to our clients. Tae is gonna go through a couple of slides but he's gonna show us something live, something really interesting. It's to show you how blockchain transaction works, and then he's gonna go through and show you how an actual smart contract works in practice. So without further ado, let me pass it across to Tae.
Tae Royle:
Thank you very much, Jean. Thank you for joining us this morning. What we have here is a real time depiction of the ethereum network, and hopefully by the end of my session, you'll understand what many of these numbers mean and a little bit more. Just very quickly, a little background about myself. I'm Tae Royle, I'm a member of Ashurst Advance, and I'm part of a larger consolidated team. I head up the Legal Technologist Team. We've got a branch of legal project managers that assist in the smooth running of legal transactions. We've got a group of legal analysts who sit out in Glasgow that do routine legal work and we've got my team, and we do artificial intelligence, document automation, blockchain and many other fun things besides.
So the purpose of today's discussion is ultimately I want to demystify the operation of smart contracts and explain to you how these work in a mechanical perspective and also understand a bit of the broader context. Smart contracts, for the most part, run on blockchain technology, so I also want to explain to you how blockchain works. But in order to understand how blockchain works, it's best to go back to first principles and understand firstly what it is, what is the problem we're trying to solve. What's the purpose of blockchain technology? At its heart, blockchain technology is essentially solving an accounting problem, who owns what, who has rights in respect of what, how do you trap all of these assets passing through various hands? At its heart, blockchain technology is a ledger, a distributed ledger. It's a distributed ledger technology where you have a group of people that can all share a common consensus as to the state of the world. What we have here is a page taken from the Lloyds register in 1764. On the left hand side, we have a list of the ships, on the right hand side, we have the owners of the vessels, and to show we're talking about a very different time, it also has a listing of the guns on each vessel and type of guns.
Now if we look at this page though modern eyes, we can see that it's actually a database, but there are also some problems with this database, looking at it through modern eyes. At the time, it was an innovation that you have this register of all the ships, but it's only published once a year and that means potentially, even on date of publication, it may already be slightly out of date. Secondly, you have to trust the issuer of this database to be giving you valid information. And thirdly, and most importantly from a modern perspective, this information up here actually isn't that useful. The reason it's not useful is it's on a written page, you can't actually do anything with it. You need somebody who's job it is to sit down and read it and transcribe it into some other format so that that information can be used elsewhere. And that's a big problem in business, particularly in the finance industry where you may have hundreds of thousands of documents spread across multiple jurisdictions. You've got an enormous data problem and you have people who spend their entire careers picking up information out of one box, moving it across and putting it into another box, and that's a really inefficient way to run a business.
The key purpose of blockchain is to tackle those three issues. Firstly, what we're doing is a blockchain is refreshed very quickly; with the ethereum blockchain, on average, once every 17 seconds. Secondly, in order to move data onto a blockchain or distributed ledger, there's very strict rules about how that information moves on. That means that we don't have to trust a central authority. But thirdly, and most importantly, it that this is a way for organisations such as banks, other financial institutions, each one of those has a very deep data silo. They're got enormous amounts of information of information, but the banks and the financial institutions don't talk to each other, their financial information doesn't talk to each other. They can't. Even if they wanted to, APIs are only of limited application, so the purpose of blockchain, effectively, is to create a bridge or superhighway linking all of the financial institutions together in a multilateral network. You can run bilateral deals on it, certainly, but it's a multilateral network where everyone is linked together. They're all sharing the same reality. They have consensus as to what their individual rights are on this distributed ledger, and that means that we can avoid disputes as to who owns what or who should be doing what, and we can also automate financial instruments. More on that later.
What are the mechanics of a blockchain? How does it actually work? At its heart, a blockchain is tracking assets. Those assets, for the most part, are digital tokens. On the ethereum blockchain, those tokens re referred to as Ether or coins. On other blockchains you'll have other tokens, the most famous is Bitcoin, it has Bitcoin coins on it. So if you're tracking tokens, how do you move them around? We have the example here of a simple transfer of a token from Alice to Bob. What really happens though, is you don't really transfer it from one person to another, you transfer it from one address controlled by one person to another address controlled by another person. The important point here is that Alice has got a secret password that … called a private key, that allows her to access assets held at this address, and Bob has a secret password, again, called a private key, that allows him to access tokens held at that address. Relevantly, once a transaction has passed, has been built into a block, you create an immutable record. That means the ledger cannot be changed, and I'll explain how we monitor that and control that, shortly. But suffice to say, you've created an immutable record for all time and, because of that, people can trust the ledger. They know that other bad actors aren't cheating.
So a transaction is a transfer of a digital token from one address to another. relevantly, on public blockchains, there's no link of the address back to any specific individual unless you tell someone and allow that to be linked to you. So you randomly generate an address each time you want to have a transaction, and then you just throw it away. You're only supposed to use an address once. That gives you an element of quasi-anonymity. Your anonymity is not pierced unless you allow it to be. And most importantly, transactions are irreversible. I've got a small asterisk on the end because if you have extraordinary levels of computing power, we're talking state-level amounts of computer power, it is possible to do some stuff at the margins. It's beyond the scope of this talk. But for all intents and purposes, it is an immutable ledger. Okay, so that's a transaction. What's a block? A block is merely a collection of transactions. Here we have a group of transactions that have been gathered together, and then there's a piece of code that goes on the back top that's called the block header, and the block header has got an attachment to the prior block in the blockchain. It's the chain part of the blockchain. So you've got blocks, which are groups of transactions, and they're chained together to other blocks.
In essence, what we have is a blockchain is simply another page … a block is another page in a journal in a ledger. If you think of this accounting ledger, effectively what you do when you add a new block, is you're adding a new page to the ledger. On ethereum, every 17 seconds, you're adding a new page to the ledger, an immutable page. With Bitcoin, you're adding a new page on average every ten minutes. So here we have the live depiction of the ethereum network. Up in the top left hand corner here is a list … is the number of blocks, 4.3 million blocks. The ethereum network started on 30 June 2015 and, at an average speed right now of 31 seconds per block, we've managed to get to 4.3 million blocks since 30 June 2015. The last block was 11 seconds ago. This is the average block time, and you can see it has a long tail. Most blocks are created very quickly, round a few seconds, under two seconds, but there's also a large … it's not a normal distribution, there's a long tail there. Finally, this is the computing power, on the right hand side, that holds together the entire network. That's a 115 tera-hashes. A hash is a calculation, a tera is a trillion; so that's a 115 trillion calculations per second that's currently maintaining the integrity of this blockchain. That's basically 33,000 computers with hundreds of sub-systems, hundreds of sub-computers running underneath that. It's a massive computing power.
What is a hash? In order to properly understand blockchain, we need to know what a hash is. Fortunately, it's actually quite a simple concept. This is an Enigma machine. Many of you will recognise it, perhaps, from movies. It was invented by a German engineer prior to the Second World War. They realised that there's this new invention called radio that allows you to send a message to the battlefield, however, that message is sent over the open airwaves and your enemy can intercept it as well. So if we're gonna have a modern technology of radio, we also need to have a modern technology of encryption to allow us for our messages to not be intercepted, so they created what is effectively a clanky typewriter. How it works is, the operator types furiously on one ends, you get gibberish out the other end. You transmit that gibberish over the radio waves, and you have another operator on the other end that types the gibberish in and you get your original message. This is Alan Turing. He was instrumental in cracking the Enigma machine, breaking the Enigma code, and it's estimated that his efforts … a British computer scientist, it's estimated that his efforts shortened the war in Europe by two years and saved 14 million lives. An Enigma machine operates by taking a message, you pass it through the machine, you get gibberish out the other end.
A computer hash works in exactly the same way. You have a message, a very short message, you pass it through the machine and you get gibberish out the other end. Importantly, however, with a hash, unlike the Enigma machine, this is a one-way message journey only. You can't reverse it on the other side. This is your hash. If you take a different message, you will get a completely different hash out the other end, so if I was to change one tiny little part of this message on the left hand, I would get a completely different message here. And relevantly, it doesn't matter how long this message is. This message could be the length of a book, or it could be a single word. I will always get the same size hash out the other end. The input can be any length, the hash output is always the same length. If you make any change at all to the input, no matter how tiny, an entire book, you completely change the output. It's acutely sensitive to inputs. And importantly, it's very, very, very difficult to reverse engineer … well, it's impossible to reverse engineer a hash and work out the input, so you have to keep guessing what the input is. Why is that important? If I wanted to guess what somebody's private key is and steal their money, and I took all of the computers in the world and kept them guessing to the heat death of the universe, that is not a sufficient amount of time to make enough guesses even at a hundred trillion guesses a second, or a bigger number than that, it's not gonna happen. We call it computationally infeasible in order to make that many guesses, in order to guess a private key. It's another way of saying it's not gonna happen in your lifetime.
Hashes, effectively, are a digest of the input and you can use hashing to prove that the information has not been tampered with. The reason is, because the input is so incredibly sensitive … if you see that the hash has changed, you instantly now that that data has been tampered with, so all you need to do is look at the hash to know that the input data is secure and has not been tampered with, no one has attempted forgery. That's a lovely story; how does that tie back to blockchain? What's that important? It's important because, remember how I said it doesn't matter how big the input information is, you can take two transactions and squish them together, and if you take those two transactions and squish them together and put them through your hash machine, you'll get a hash off the back end. Now remember, if you make any changes at all to that input, it means that your output is going to be completely different. What we can do is we can take a pair of hashes that have been each produced from a pair of transactions, and hash those together. And what we're starting to do here is we're starting to create a chain of hashes where you're taking information and you're compressing it through the hash algorithm, but it can't be tampered with. You're creating a tamper-proof chain. And so we can get a hash of a hash of a hash, if you wanna be Dr Seuss, and if anyone makes the slightest change to any part of the underlying data set, you change the output. And if you change the output at the bottom, you create a cascade of errors that goes all the way to the top of this hash chain, and that means that this top most point of the hash chain is really important and really powerful.
It is a … by looking at the top most point of the hash chain and making sure that that number at the top hasn't been changed, you can check the validity of an unlimited amount of underlying data. That top most point is called a Merkle root. Why's it called a Merkle root? Because of this gentleman, Ralph Merkle. He invented cryptographic hashing and he invented the Merkle tree. And here we have a depiction of a Merkle tree with the Merkle root at the top. Effectively, what a block is in a blockchain, is it's just a Merkle tree. We have pairs of transactions hashed together, hashes of hashes form a tree, and the top most point is called a Merkle root. Don't ask me why the top of the tree is called a root. I don't understand either.
Okay. What's a block? A block is just a Merkle tree with a Merkle root sitting at the top in the header. A Merkle tree at the bottom, a Merkle root in the block header. You've got some other information in the header as well, you've got a timestamp and, most importantly, you've got a pointer. And this is where the real magic happens, because the pointer itself is a hash of the previous block header, and what you've just done is you've created the chain. By hashing the previous block header, this becomes an incorruptible link back to the prior block … it just becomes an extension. The prior block simply becomes an extension of the hash chain. So you have blocks that are chained together using this crytographic method. So we create a blockchain, we have a pointer that points at the previous block, and the blockchain just runs along merrily. You have blocks being progressively added to the blockchain, and you have a bad actor that comes along, and the bad actor decides that what they're going to do is they're gonna forge a transaction some time ago, down at the bottom of this block right here, and they are gonna present that to the world as being a valid part of the ledger. The problem with that is, by corrupting part of the data deep down in the hash tree, you cause a cascade of errors to come straight up through the hash tree, you corrupt the Merkle root, and once the Merkle root is corrupted, the pointer breaks because it no longer points back at a valid Merkle tree, and you get a cascade of errors that flows up through the blockchain. And what we've done is we can demonstrate here that if anyone attempts to forge part of a blockchain, it will immediately become apparent to all of the other users in the system and they can reject that individual as a bad actor. Any attempt to tamper with any transaction immediately corrupts the entirety of the hash chain, and the hash chain presented by that bad actor will be rejected.
So how are the blocks actually put together? You've got users on the system and they elect the … something called a miner, and those miners race to solve difficult math problems, and whoever wins the race to solve the math problem, has the right to create a new block. The reason we have a race is we want creation to be random among the entire user pool, so you don't have a single group of people taking over and creating blocks. And in order to incentivise them to solve these very difficult math problems, we give them a reward, a reward in digital currency. Right now, currently, the reward on the ethereum block chain is five Ether coins, which are worth about 320 US dollars right now. It works out to be about US 7 or 8 million US dollars a day in digital currency rewards, which are readily … can readily be sold and converted to cash. So 7 million US dollars a day, it's good money if you can get it.
What makes the ethereum blockchain special, of all the blockchains? Well, the ethereum blockchain allows fully executable code to be written into transactions. All transactions are written into blocks, and if it's written into a block, then it's written into the blockchain. This means that if you write code, that code is written down into this permanent record, this permanent blockchain forevermore, for better or for worse. Well, what does that mean? It means that you've just created the world's … one of the world's greatest supercomputers. On the ethereum network you have 33,000 computers all around the world who are simultaneously executing your programme. That's where the 110 trillion calculations a second comes from. It's all of these network computers all simultaneously executing your code. It is massively redundantly parallel. This is not an efficient computing system, but what it is, is it is enormously safe from bad actors because if you have a handful of bad actors, the other 33,000 players will simply disregard any output that they create. So here is a depiction … another depiction of the ethereum network. We're down to 21,000 nodes. There's some variation. Most in the United States, 6,500, just under 1,700 in China as well.
Now, running one of the world's greatest supercomputers is not without risk, and the reason for that is computers are simple beasts and they'll do exactly what you tell them to do. And there are bad actors out there. There are people who will cause mischief just for the sake of causing mischief, and there are people who make mistakes, and I'm not talking about lawyers, I'm talking about computer programmers. And one of the worst mistakes you can do with a large computing system is tell it to go back and do the thing that it just did before ad infinitum. You get caught in a loop, eventually that loop consumes all of the computer's resources, and the computer grinds to a halt. So how do we stop this? How do we stop people from creating loops while giving them the freedom to write whatever code they want on a completely decentralised computing system? We have a concept called gas. Gas is what stops people from running loops forever. Effectively, what is, is it is a transaction fee for running transactions. It's a user fee. It's called gas because it was conceived of being the crypto-fuel that was going to power the ethereum blockchain. How it works … how the fee is calculated is for each calculation that you do, it will cost a predetermined amount of units of gas. That's the fuel component that's required. However, there's no government regulators here to tell us how much gas should cost. It's a free market system, and so what individual users do is they bid a price into the market as to what they're prepared to pay for that gas. So you have the amount of fuel that you require, you multiply that by your bid price, and that gives you your transaction fee, which is a great system.
It's very efficient, but it's not without risk, and this is why many financial institutions are a bit reluctant to use the public ethereum blockchain and prefer a private version such as Hyperledger or, taking one step further away from this concept, Corda, which is with the R3 consortium. And the reason for that is, being a public blockchain, a public resource, it is subject to massive spikes in transaction volume. Many … most of you in this room here will have heard of initial coin offerings, ICOs, and here we show the impact of these ICOs on the ethereum network. So we had the BAT ICO a couple of months ago that raised 24 million US dollars in 38 seconds. We have the Bancor ICO that raised 128 million US dollars in 12 hours, and it was followed by the Status ICO that severely clogged the network because it ran for a full day but it raised a measly 100 million US dollars. What that means is when your transaction volumes spike, your gas prices spike as well, and so if you're operating on the public ethereum network as a business, you need to be aware that transaction spikes do happen. When transaction spikes happen, gas price spikes happen, and that means you've got two choices: you can either bid a lower price, and if you bid a lower price, it will take longer for your transaction to be accepted, or you can bid the going market rate, and something that might cost you six cents today might cost you six dollars tomorrow. And that's a real and material risk. You don't have that risk running on a private blockchains but you also don't have the massive computing power backing you.
Okay, enough about blockchains. Let's talk about the good stuff, let's talk about what are smart contracts. At its heart, a smart contract is just a piece of computer code. It is a piece of computer code that's been uploaded to a blockchain. This is the opening lines of the computer code that we used to create a digital currency for Ashurst known as Ashurst coin. The code is written in a language called Solidity. It end in the suffix .sol. If you see a .sol file, it's a smart contract most likely. A smart contract is a piece of code uploaded to the blockchain. It operates like an autonomous agent living inside this giant computing network that is the ethereum network, and it lies there dormant, asleep, until you wake it up. How do you wake it up? You send it a message and you poke it on its address on the blockchain. And if you wake it up, it executes its code. It can do four things if you wake it up. It can read and write to memory, it can remember things. It can perform calculations including calculating something based on something that it remembers. It can itself send and receive currencies, and they don't have to be the same currency, it can receive one currency and send another. And itself can send and receive messages, so it means that it can message another smart contract. So as an autonomous agent, you can create a network of autonomous agents that talk to each other and transact with each other, automatically self-enforcing on the blockchain.
Let's give a simple example of a smart contract. We have a gentleman on the left, we'll call him Vitalik Buterin. He sends a message to a blockchain, wakes up a smart contract and, effectively, the message empowers the smart contract to release some of the digital currency held in the reserves of that smart contract and passed that on to another individual. So what we have here is a transfer value that's triggered by a message going to a blockchain. We can automate that. So Thomson Reuters, as one example, provides a service that will send messages to blockchains, in this case … well, that service is referred to as an oracle, so it provides information that's not available on the blockchain. So these messages can be based on data feeds, in this case, Thomson Reuters data feed. We can take the example of LIBOR. If LIBOR goes over 0.5 per cent, you trigger a payment. What we've just done there is we've just created a self-enforcing automatic interest rate hedge that's triggered off a data feed, and this can be a financial institution. The smart contract can be set up by another financial institution, or we can create decentralised exchanges to exchange digital tokens between various entities. Myself, I can go onto the blockchain, I can create a smart contract that will accept digital tokens and issue digital tokens at a different exchange rate, so I can go into competition, effectively, as an exchange myself by offering my smart contract on the blockchain and offer to exchange tokens.
Now, that gets more powerful when these tokens don't just represent cryptocurrency, but they start to represent real world assets. You have to ask the question, "How can these tokens, how can these digital currencies have any value? Aren't we just swopping bits on the internet"? What we have here is a promissory note issued by a goldsmith, Abraham Fowler, on Fleet Street by the Sign of the Three Squirrels, and it's for £75. It is just a piece of paper with the gentleman's signature at the bottom promising to pay the bearer £75. What does that mean? It means that this paper is worth whatever people think it's worth. Likewise, digital tokens are worth whatever people think they are worth. So we have businesses who are setting themselves up as issuers of digital currencies. Tether's one example. It says that each of the digital tokens that it issues is one to one backed by US dollars. So there's no fluctuation in value of this digital token, it's worth exactly one US dollar, and if you go to redeem it from Tether, they'll give you back your US dollar. If you give them a US dollar, they'll give you a digital token. Frankly, I think it's a very nice business idea that you get people to give you money in exchange for digital tokens and not pay them any interest. I think it's good business.
So what we can see is we can see here the growth, the emergence of smart contract-based businesses. We're talking here about businesses that have no overhead, for all intents and purposes. They're simply a piece of code that sits on a blockchain. So if you've got tokens that represent real world currency, someone can set up a decentralised forex exchange. They can offer to take US dollars and issue pounds sterling in return, in digital tokens, at a fixed exchange rate or however else they may wish to calculate that exchange rate. So I mentioned earlier the ICO of Bancor, and this is very much their business model, and to give an example in real time, you can purchase the shares of Bancor, the digital tokens of Bancor, in exchange for ethereum tokens. That is the current price, so it's just under one thousandth of an ethereum tokens, the current price in real time. It all operates on a smart contract on the blockchain. You send your ethereum to the Bancor smart contract, and it will give you back a Bancor token.
Likewise, if you wish to redeem your Bancor token, you send it to the smart contract and it gives you back the corresponding amount in ethereum, and it's not that much of a leap to imagine doing this with real securities and real dollars.
So how the initial coin offering here worked, again, they used a smart contract. You send ethereum coins to the smart contract and you were issued shares. And perhaps in ten years' time, maybe we will see IPOs using smart contracts instead of using stock exchanges. Likewise, trading, you simply send your coins to the reserve and you get issued with new securities. To be cancelled, you send them back and they are erased. And we can imagine this operating not just with digital tokens of these entities but also real world commodities, so potentially the trading of commodities, where an individual token represents a barrel of oil or a bushel of wheat. We can imagine creating ETFs for currencies, and potentially ETFs for real world securities as well.
So what's a DAP? A DAP is a way of enabling normal people to interact with the ethereum blockchain, to interact with smart contracts, because right now the current state of technology requires you to know some code, it's all a bit messy. So what we do is we simply insert a web interface in between the individual user and the message that goes to the blockchain, and what that allows it to do is become very user-friendly way of sending value over the blockchain, or otherwise interacting with the blockchain. It's a tool that lawyers could use without any training. So I will show you an example of something we've built. So what we have here is a smart contract where conceptually we have an individual who's receiving a bill of lading and is going to confirm receipt, and upon confirming receipt, what they're going to do is they're going to transfer value, make a payment to the supplier. So they simply enter the ID number and on the left hand side here we can see a payment being made … effectively, the user fee paying the gas fee for that transaction. So this is costing a matter of cents. At this time transaction volume is very low. So I've submitted it and if I refresh, I can see that the payment has been made, sent out across the blockchain to the supplier. So what we've done here is we've moved an Ashurst coin, which is has no real value, but it could easily be a digital token with real value, and in that time we could've moved millions of dollars safely, securely, without requiring financial institutions to take part in that. And, of course, you can automate that as well, so that you can trigger payments when LIBOR moves, when some other financial indice moves, or for whatever other reason you want.
So who's working on the blockchain? Who are the major players? The largest consortia is something called R3, and they use a technology called Corda. Now, technically … strictly speaking, Corda isn't actually a blockchain. If you think back to the traditional chain of title analysis that they used to do in the days before a Torrens system where you didn't have a registrar … a register of who owns what property, you had to do the analysis on the individual chains, that's effectively how Corda works. And the reason by that is it's intended to have stronger privacy by default, so somebody who takes an asset only needs to evaluate the chain but doesn't necessarily need to see other transactions. But, in other ways, it works pretty much the same as other distributed ledger technologies. Hyperledger, also a very well-known technology. It's effectively a flavour of the ethereum blockchain, and Ripple, which follows many of the same principles as well. And as you can see, there's … well, you'll all recognise the financial institutions lists up there.
Where are we in terms of something real happening? Well, I read a few days ago that AXA, the insurance company, is now offering insurance products for flight delay on the ethereum blockchain. So there are some things that are happening for real commercial application, but for the most part, we're still operating at the proof of concept stage. This is Morgan Stanley's prediction as to how this might go: we'll see some shared infrastructure emerging over the next three years but it's probably not gonna really kick off until we get into the early 2020s. There's a lot of work to be done, there's a lot of bugs to be worked out. We need to keep in mind that the ethereum blockchain has only been around since 30 June 2015. That's not very long, but it's quite exciting.
That concludes this session. Thank you.
Key Contacts
We bring together lawyers of the highest calibre with the technical knowledge, industry experience and regional know-how to provide the incisive advice our clients need.
Keep up to date
Sign up to receive the latest legal developments, insights and news from Ashurst. By signing up, you agree to receive commercial messages from us. You may unsubscribe at any time.
Sign upThe information provided is not intended to be a comprehensive review of all developments in the law and practice, or to cover all aspects of those referred to.
Readers should take legal advice before applying it to specific issues or transactions.