To really understand what is special about Bitcoin, we need to understand how it works at a technical level. We’ll address the important questions about Bitcoin, such as:
How does Bitcoin work? What makes Bitcoin different? How secure are your Bitcoins? How anonymous are Bitcoin users? What determines the price of Bitcoins? Can cryptocurrencies be regulated? What might the future hold?
After this course, you’ll know everything you need to be able to separate fact from fiction when reading claims about Bitcoin and other cryptocurrencies. You’ll have the conceptual foundations you need to engineer secure software that interacts with the Bitcoin network. And you’ll be able to integrate ideas from Bitcoin in your own projects.
Course Lecturers:
Arvind Narayanan, Princeton University
All the features of this course are available for free. It does not offer a certificate upon completion.

LB

I find this course prepared very well. There are many perspectives and this course does not concentrate on the technology only. I find this course very helpful. The level is more then just beginner.

AG

Feb 08, 2017

Filled StarFilled StarFilled StarFilled StarFilled Star

Loved this course! It was very thorough. However I think assignments could have been made more clearer as it was often hard to figure out what needed to be done without checking discussion forums.

レッスンから

Bitcoin as a Platform

One of the most exciting things about Bitcoin technology is its potential to support applications other than currency. We'll study several of these and study the properties of Bitcoin that makes this possible.

講師

Arvind Narayanan

Associate Professor

字幕

So for the final topic today, we're gonna be talking about prediction markets and bringing real-world data into Bitcoin. And this is gonna be another big change of direction. And we're gonna stray a little bit far away from Bitcoin in this one perhaps, but it should be a really fun topic. So how can we make assertions about the outside world within Bitcoin? So the idea is we'd like to add a mechanism to assert facts about the real world into Bitcoin. And those facts might be who won an election, who won a sports match, what the price of some commodity is on a certain day, any kind of real-world data that is of importance to a lot of people. So [COUGH] if we had those kind of facts available in Bitcoin, say there was some script call that you can make that would just say what the current price of copper is on some common exchange, you could start doing all sorts of cool things with smart contracts. You could bet on the future price of commodities on who's going to win the sports match. You could hedge and you could derive all of the things like forwards and futures that financial markets are built to [COUGH] buy and sell and trade. So wouldn't it be great if we could do all of this in the range of Bitcoin? Basically every variety of betting on the future. And the most general formulation of this is called a prediction market, and we'll be talking about how to build a prediction market in Bitcoin. Since then if can build a prediction market you can essentially build almost any other financial derivative that you'd be interested in. So what's a prediction market? Quite simply, it's a market where you can trade shares in potential future events. So you can have a share in some events, the event might be the Yankees win the World Series in 2014. And that share will be worth some price X, if the event actually happens, and it will be worth nothing if it doesn't happen. So before the event is certain during the season say, there will be some price at which that asset is trading. And the price will indicate the probability that people have in their minds, the belief that they have of how likely the event is to actually occur. Okay, so let's take a look at an example which hopefully will make the concepts behind prediction markets make a lot more sense. Let's look at the 2014 World Cup which just wrapped up last month in Brazil. And let's say we had a market where you could buy and sell shares in teams. And the idea is that these shares will be worth one only for the team that ultimately wins. Now, going into the tournament, every team, of course I just have five examples here, every team would actually have some non-zero price. But, before the tournament starts, every team's shares would have some price based on what the market believes their chances of winning are. So over there on the left, you can see Germany, their shares are trading for about 0.12. Which means, that the market thinks they have a 12% chance of winning. And so on for Argentina, Brazil, the U.S., and England over here on the right, which the market gives about a 5% chance of winning. So again, that price that the market assigns, is equal to the probability that people believe that that team has to win. Now, as the tournament goes on these prices are going to fluctuate and that's going to reflect the market's changing belief in how likely each team is to win. So after the group stage we can see that England, which was trading at 0.05, a 5% chance to win before the tournament started, has now gone to zero. So England was knocked out after the group stage. There's no way for them to win at this point and the price reflects that their shares are now worthless. Where as the US team which people thought didn't have a good chance of even surviving the group stage, hence the 1 cent price at the beginning of the tournament, did fairly well to get out of the tough group, and the group stage so maybe they were trading for 0.06 after that point. Now here's the key insight, the most important thing to understand about prediction markets. If you had thought to buy U.S. shares in the beginning when they were very cheap, when they were selling for 0.01, you could sell them immediately after the group stage for 0.06, you wouldn't have to wait until the end of the tournament. You could immediately profit not from the fact that the U.S. team won the whole tournament cuz they didn't in the end. Just from the fact that peoples' belief that they had a chance to win the tournament went up after their strong performance in the group stage. So the tournament is gonna go on, [COUGH] when we get the the semi-finals there's only four teams left. Of course, sadly the U.S. is knocked out, so their share price has gone to zero along with England. When there are four teams left, now they all have a relatively high price. And the Brazilian team was trading for a very high price going into the semi-finals, people thought they were a strong team, and they had a good chance to win. Of course, the German team actually defeated the Brazilians quite strongly. So Brazil's share price went to 0. And once again, you would have had a very strong chance to profit here if you took a short position. And there's a variety of ways to do that. [COUGH] But essentially you can set yourself up to profit. If the share price goes down as well as going up. And within the span of a couple of hours people's beliefs changed dramatically as the Brazilian team lost and lost decisively. And you can profit in a very short time frame if you are confident going into that match, that the Brazilian team was overvalued, not as good as people thought it was and that the share price was about to decline. And of course going into the Finals there's only two teams left. So at this point between the German and the Argentine team the only two teams in the Final, those two prizes should add up to one because one of those teams have to win and probabilities should always sum to one. After the whole tournament's over, everybody's ready to pack up and go home. The only shares that have any value are shares in the German team, because the Germans are the team that actually won in the end. But the most important insight here is that one way to profit, certainly, would have been to buy shares in Germany at the beginning for 0.12, and hold them all to the way to the end, in which case you would make a dollar. And that would be basically equivalent to traditional sports betting where you place a bet before the tournament starts that Germany is going to win. But in a prediction market there's lots of other ways to play and lots of other ways to profit. You don't have to just bet on the right team and hope that they win. You can invest in any team at any time, or you can take a short position and you can profit just on the ability to predict that people's beliefs will change. Here's another example, and this is from a real prediction market. This is the belief over time before the 2008 U.S. Presidential election and whether Barack Obama or John McCain would win. Now Barack Obama is represented in blue on the top, and McCain represented in red on the bottom. And you can see that as the months unfold and various things and gaffs happen on the campaign trail, peoples' beliefs about who's going to win the election fluctuate a little bit. And historically you can go back to most of these fluctuations and trace them to a specific event. Either a candidate made a gaff or they did something good that make them more popular and then people's beliefs changed. And you can see that as of about September 2008, so about two months ago before the election, all the way on the right side here McCain almost got back up to a fifty-fifty chance with Obama. So at that point in time the public really didn't know who was going to win the election. It was still a tossup. But by the time the election actually happened, you can see that Obama was given a 90% chance to win the day before the election. So the market was well aware going into it based on polling that the election was basically over before votes were cast. At least it was very unlikely for Obama to lose the election. And this really demonstrates the power of prediction markets. Because you can read all the newspapers and watch all the news that you want. And they'll offer a lot of expert opinions discussing either way who they think's gonna win. But if you just look at the prediction market where people have real money at stake, you can see that in the week leading up to the election it was pretty clear that Obama was gonna win the thing. So that's why economists really love prediction markets. They should reveal, if you believe in an efficient market and a couple of other assumptions. And it should reveal all the knowledge that the public has about the future. So that share price in different events should be the best encapsulation of everything we know about the future. So they're a great mechanism for revealing information and they allow you to profit from being able to make accurate predictions. So one description of prediction markets has been attacks on BS. So if you're saying things that aren't true or making predictions that are very unlikely to happen, if you have to actually put money behind them in a prediction market, that will be very costly. And it has been shown that in practice prediction markets have pretty good predictive power. Collectively they can often beat opinions polls or asking experts. But there's also been a tortured regulatory history here. So, Intrade was the most popular production market on the Internet for a period of about ten years. And it ran into all sorts of regulatory issues in the US for a variety of reasons. I won't get into all of the legal details here, but InTrade was eventually shut down in 2013. And a lot of economists were sad about this, cuz they believed that this valuable social tool that revealed information about the future was lost. So could we build a decentralized prediction market? Again, decentralization being the name of the game with Bitcoin. So there's a couple of tasks that we'll have to decentralize to make a decentralized prediction market work. So we need payment and we need enforcement of bets that people are making. That all has to be decentralized. We're gonna need decentralized arbitration. Arbitration is the process of asserting which outcomes have actually happened. Most of the time in a case of an election or a sports match you may say, it's pretty obvious who won and who lost. But there are gray areas, and we need to decentralized order books. So a way for people to buy and sell shares to [COUGH] for buyers to meet sellers, that's decentralized and doesn't rely on a centralized clearing house. So we'll go through each of these challenges in order. So payment and settlement, this is the easiest given Bitcoin. We could use Bitcoin to do payment. And in the simplest solution, maybe we could use trusted arbiters so we could basically do escrow transactions. And the arbiter will enforce the contract, the fact that if you bet on something that didn't happen, you lose money, simply by not signing transactions. A better solution would be if we built an altcoin that had explicit support for prediction markets. So what would that look like? There's a proposal for doing this called FutureCoin. This isn't an altcoin, it hasn't actually been built. That adds a couple of transaction types, in addition to just normal sales of Bitcoin or any other cryptocurrency. So this, the transactions that are added specific to prediction markets let you buy a portfolio in some event. So the idea is that for one dollar, or one FutureCoin, you buy a share in every possible outcome. So say this is the World Cup, there's 32 teams entered. For one FutureCoin, you buy a share in every possible team. And then on the bottom here, there's a sell portfolio which lets you sell a share in every outcome to get one FutureCoin, one unit of currency back. So obviously those two match so for one FutureCoin you can buy a share in every outcome and you can turn a share in every outcome back into one future coin. But you can also trade the shares one for one for each other, which is much more interesting. So you can buy a share in every outcome and then you can sell the shares that you don't actually think you wanna hold. So the teams that you don't want to bet on, you would sell to somebody else that did want those shares. And then you would end up with a position which wasn't just bounced on every team. Say you would buy a bunch of shares on the team that you actually wanted to back. And again that would be one way of profiting. You could just buy a portfolio, wait for the prices to change, and then sell all of the shares directly for FutureCoins that you could turn into Bitcoin or some other currency and profit that way. And the other way of profit would be to buy a portfolio, sell some of the shares, and then eventually at the very end of the market, there's a special close that happens, at which point, you can sell portfolio and you only need one share in the winning outcome. So how can we do arbitration? How can we assert who actually won so we can do this close and let people redeem their winning shares to get their money back, to get their winnings? So the simplest model is to just have trusted arbiters so we say anybody who wants to can define and open a new market. They can stand up and say I'm opening a market on the World Cup. I will decide who won in the end and if you trust me you should be willing to except my signature that that is the correct outcome. And like many other thing they would probably build up a reputation over time and they would have some incentive to arbitrate correctly to maintain their reputation. But there's always the risk that they could abscond, and this could be very dangerous in a prediction market. So for example, if one arbiter was in business for a long time and everybody trusted them, they might wait until the World Cup. And then they might assert to say that Argentina won even though they lost in the final if they had bet on Argentina heavily and were trying to profit from it. So good, we have a more decentralized arbitration model. This is a little bit tricky, but there's a few ideas here. One is to have all the users, all the people who hold shares in the market, vote on who won, and the idea wouldn't be really to vote as if there' was a lot of uncertainty, but just that everyone would vote on what happened in reality. And there's various ways you could try to incentivize users to vote correctly. So you could have users put up bonds or maintain a reputation, and if they vote in a different direction than most other people vote, they suffer some penalty. They lose their bond or their reputation goes down. And then everybody's incentivized at least to vote in the same way that everybody else is voting, if not to vote in the way that reality actually happened. And you could set up a similar system where instead of the users voting, you have the miners in your cryptocurrency voting. And again, miners would be incentivized to vote correctly because if they vote incorrectly, future miners might fork and then they would lose their block reward. But this runs into the problem that minors may not know about every market that people are interested in, and they may just not care about some. So it may be too high of a burden to put on minors if you expect them to be able to arbitrate every match that happens in the second tier Mongolian football league that somebody somewhere wants to bet on. So there's been one attempt to actually make this happen, at least one attempt to make this happen, which is a protocol called RealityKeys. And the idea with RealityKeys is that you can actually sign statements that are usable in Bitcoin that assert yes or no, whether or not one of two outcomes happened. [COUGH] So this is fairly simple. It's not as complicated as some of the more sophisticated arbitration models we'd like to get to, but this is a step toward having arbitration for a online prediction market. So there's a caveat here which is that sometimes reality is complicated. I had assumed that what actually happened in reality wasn't in dispute. We just wanted to have a voting mechanism to insert the facts from reality into the digital world. Sometimes what happens in reality isn't quite so easy to discretize into a digital form. So my favorite example came from the Super Bowl this past year. There's an annual bet that a lot of people like to make in the Super Bowl, which is what color Gatorade the winning team will dump on the winning head coach, so this is a tradition after every Super Bowl or lots of other big football games, the winning team takes a bucket of Gatorade and dumps it on their coach. And you an actually make a bet on what color Gatorade they're gonna use for this purpose. You can see that clear was the odds on favorite, but orange and yellow were also strong contenders, those are popular colors, and green, blue, red, less likely to happen. So this bet has happened for probably 20 or 30 years. It's been just a popular, fun bet. And in the last Super Bowl something went a little bit awry. So the Seattle Seahawks won, they celebrated, they dumped some orange Gatorade on their head coach Pete Carroll. And then a little later, a few other players decided to do it again and they used yellow Gatorade. So this had never happened before, but the Seahawks decided they like the dumping Gatorade on the head coach ritual so much that they would do it twice and they used two different colors. So if you're running a prediction market where people had bet on this, what do you do on this scenario? It's not clear if orange or yellow should win. What happened in practice with a lot of sports books, is that they said we're actually gonna lose money, and just to try to maintain our reputation with our customers as a show of good faith, if you bet on orange or if you bet on yellow, either way you win. Of course in a decentralized prediction market you cant do that cuz you can't just create money out of thin air to pay both parties. So there's a couple of solutions here. Maybe you could say that orange and yellow both win. They each win half of the winnings, so instead of closing at a value of one they close at a value of point five. But ideally you would define your contract a little bit more carefully next time, and you might say, what will the first color of Gatorade be to be poured on the winning head coach? But the lesson here is that no matter how careful you are in defining what your market is, there can always be some event that happens in reality that wasn't something that you predicted, so something that people didn't have shares in might actually happen, in which case, it's very tricky to know what to actually do. So, the final piece to build is an order book. So, in a real prediction market or most financial markets, there isn't truly one market price, there's the lowest price that anybody's willing to sell at, and the highest price that anybody's willing to buy at. So, this is an example from a small prediction market that's being run today using Bitcoin, called Predictious, and they have a market here on whether or not Scotland will vote yes in their independence referendum, which is scheduled two months from today. And you can see that there's a spread, in each case, there's a spread between what people are willing to sell at, and what people are willing to buy at. And the goal of an order book is to match up those sellers and buyers, that that they make a trade, and that they split the difference. Traditionally, this has been done in a centralized way, so you have one order book, they collect all of the orders, they actually keep them secret, they match people up, and they divide the difference down the middle, so the price you get is halfway between, basically, the lowest you were willing to sell for, and the highest that the buyer is willing to buy for. And this has a couple of risks. So, if you centralized order book is dishonest, they might put their own orders in ahead of time to try and get a better deal for themselves. So this is called front-running, it shows up in a variety of financial settings, and it's considered a serious crime. So, theoretically, this is something that you go to jail for a long time if you're caught doing. And centralized order books require that legal enforcement to prevent front-running and keep the security model sound. So, in a decentralized order book, we're not gonna be able to have strong legal enforcement like that, but there's a clever idea, which is to just forget about front-running, and say, instead of having front-running be a bug or a crime, we're just gonna have it be a feature. And the way they do that is that everybody can submit orders to miners, and the miners can match any possible trade, and instead of splitting down the middle, the miner actually keeps the entire spread as a transaction fee. And the beauty of doing this is the miners now receive a transaction fee, and they have no incentive to front-run, because front-running will never be more profitable than just capturing the spread as a transaction fee. So, this is a very nice elegant way of doing a decentralized order book, The only downside here is that you have to pay potentially a high fee to the miner if there's a high spread, and to try to prevent paying that high fee people might submit much more conservative orders. And as a result this thing might be less efficient, people might make trades more slowly as they slowly iterate towards each other. They're not willing to, they may not be willing to declare upfront their exact willingness to pay because doing so might lead to a large spread, that the miner gets to capture. So it's not known yet how this will function in practice, there's some fear that it will be a lot less sufficient than a centralized order book. But it seems to be a very promising approach to go. So, to summarize, in trying to build a prediction market, what can we actually bolt on top of Bitcoin? So, it looks like, payment-wise, we're in good shape, Bitcoin is a good currency to base a prediction market off of. In terms of doing settlement, it's fairly hard. You could draw up some contracts using reality keys, where you have a position based on some future event, but there's no way on Bitcoin to really trade that position. So we don't have a way to do decentralized trades. In terms of arbitration the only thing you can do is a trusted arbiter model again the reality key model the more sophisticated things where users or miners vote, aren't going to be possible on Bitcoin, you need and Altcoin for those things. And finally, order books, there's no built-in concept of an order book in Bitcoin, so you'd be stuck with an external, centralized order book. So, this lecture was really all about building things on top of Bitcoin, and it looks like we can't quite build a functioning prediction market, at least, not in the way we'd like, directly on top of Bitcoin. This is something that we would really need an Altcoin to build. And this is a lead in to what was going to be covered in the next lecture, which is Altcoins. So the observation is that for some things like prediction markets, Bitcoin only takes us so far. It really doesn't get us where we want to go in terms of building a secure, decentralized prediction market and decentralized order book and all those other things. So what if we could start again from scratch? What if we could forget about soft forks and hard forks and how to bolt things onto Bitcoin and just say we've learned a lot since 2008 when Bitcoin first came out. Why don't we design a new cryptocurrency and everything will be better? So the next lecture will be all about Altcoins, which are attempts to do just that, and we'll talk about all of the promising ideas people have and all of the challenges to starting a new currency at this point.