If you still can’t figure out what the heck a bitcoin is…

We’re sitting on a park bench. It’s a great day.

I have one apple with me. I give it to you.

You now have one apple and I have zero.

That was simple, right?

Let’s look closely at what happened:

My apple was physically put into your hand.

You know it happened. I was there. You were there. You touched it.

We didn’t need a third person there to help us make the transfer. We didn’t need to pull in Uncle Tommy (who’s a famous judge) to sit with us on the bench and confirm that the apple went from me to you.

The apple’s yours! I can’t give you another apple because I don’t have any left. I can’t control it anymore. The apple left my possession completely. You have full control over that apple now. You can give it to your friend if you want, and then that friend can give it to his friend. And so on.

So that’s what an in-person exchange looks like. I guess it’s really the same, whether I’m giving you a banana, a book, or say a quarter, or a dollar bill…. But I’m getting ahead of myself.

Back to apples!

Now say, I have one digital apple. Here, I’ll give you my digital apple. Ah! Now it gets interesting.

How do you know that that digital apple that used to be mine, is now yours, and only yours? Think about it for a second.

It’s more complicated, right? How do you know that I didn’t send that apple to Uncle Tommy as an email attachment first? Or your friend Joe? Or my friend Lisa too?

Maybe I made a couple of copies of that digital apple on my computer. Maybe I put it up on the internet and one million people downloaded it.

As you see, this digital exchange is a bit of a problem. Sending digital apples doesn’t look like sending physical apples.

Some brainy computer scientists actually have a name for this problem: it’s called the double-spending problem. But don’t worry about it. All you need to know is that, it’s confused them for quite some time and they’ve never solved it.

Until now.

But let’s try to think of a solution on our own.


Maybe these digital apples need to be tracked in a ledger. It’s basically a book where you track all transactions — an accounting book.

This ledger, since it’s digital, needs to live in its own world and have someone in charge of it.

Say, just like World of Warcraft. Blizzard, the guys who created the online game, have a “digital ledger” of all the rare flaming fire swords that exist in their system. So, cool, someone like them could keep track of our digital apples. Awesome — we solved it!


There’s a bit of a problem though:

1) What if some guy over at Blizzard created more? He could just add a couple of digital apples to his balance whenever he wants!

2) It’s not exactly like when we were on the bench that one day. It was just you and me then. Going through Blizzard is like pulling in Uncle Tommy(a third-party) out of court(did I mention he’s a famous judge?) for all our park bench transactions. How can I just hand over my digital apple to you, like, you know— the usual way?

Is there any way to closely replicate our park bench, just you-and-me, transaction digitally? Seems kinda tough…

The Solution

What if we gave this ledger — to everybody? Instead of the ledger living on a Blizzard computer, it’ll live in everybody’s computers. All the transactions that have ever happened, from all time, in digital apples will be recorded in it.

You can’t cheat it. I can’t send you digital apples I don’t have, because then it wouldn’t sync up with everybody in the system. It’d be a tough system to beat. Especially if it got really big.

Plus it’s not controlled by one person, so I know there’s no one that can just decide to give himself more digital apples. The rules of the system were already defined at the beginning. And the code and rules are open-source—you know, kinda like the software used in your mom’s Android phone. Or kinda like Wikipedia. It’s there for the smart people to contribute to, maintain, secure, improve on, and check on.

You could participate in this network too and update the ledger and make sure it all checks out. For the trouble, you could get like 25 digital apples as a reward. In fact, that’s the only way to create more digital apples in the system.

I simplified quite a bit

…but that system I explained exists. It’s called the Bitcoin protocol. And those digital apples are the “bitcoins” within the system. Fancy!

So, did you see what happened? What does the public ledger enable?

1) It’s open source remember? The total number of apples was defined in the public ledger at the beginning. I know the exact amount that exists. Within the system, I know they are limited(scarce).

2) When I make an exchange I now know that digital apple certifiably left my possession and is now completely yours. I used to not be able to say that about digital things. It will be updated and verified by the public ledger.

3) Because it’s a public ledger, I didn’t need Uncle Tommy(third-party) to make sure I didn’t cheat, or make extra copies for myself, or send apples twice, or thrice…

Within the system, the exchange of a digital apple is now just like the exchange of a physical one. It’s now as good as seeing a physical apple leave my hand and drop into your pocket. And just like on the park bench, the exchange involved two people only. You and me — we didn’t need Uncle Tommy there to make it valid.

In other words, it behaves like a physical object.

But you know what’s cool? It’s still digital. We can now deal with 1,000 apples, or 1 million apples, or even .0000001 apples. I can send it with a click of a button, and I can still drop it in your digital pocket if I was in Nicaragua and you were all the way in New York.

I can even make other digital things ride on top of these digital apples! It’s digital after-all. Maybe I can attach some text on it — a digital note. Or maybe I can attach more important things; like say a contract, or a stock certificate, or an ID card…

So this is great! How should we treat or value these “digital apples”? They’re quite useful aren’t they?

Well, a lot of people are arguing over it now. There’s debate between this and that economic school. Between politicians. Between programmers. Don’t listen to all of them though. Some people are smart. Some are misinformed. Some say the system is worth a lot, some say it’s actually worth zero. Some guy actually put a hard number: $1,300 per apple. Some say it’s digital gold, some a currency. Other say they’re just like tulips. Some people say it’ll change the world, some say it’s just a fad.

I have my own opinion about it.

That’s a story for another time though. But kid, you now know more about Bitcoin than most.

The dining philosophers problem is a classic concurrency problem dealing with synchronization. Gather round and I’ll tell you how it goes:

Five philosophers are sitting at a table.

Now, each philosopher has two forks: left fork and right fork. If a Swanson gets two forks, he can eat!

If he only has one fork he can’t eat :(

So the Swansons need to learn to share forks:

The dining philosophers problem is: how do you make sure every Swanson gets to eat?


Don’t get me wrong, I love Swansons. But damn they are competitive. As soon as I told them to start eating, every Swanson grabbed a fork:

And then they waited for someone to give up their fork so they could eat. But of course, “a Swanson never gives up his fork!” sigh So they waited forever and eventually died in their stupid log cabin. Great job, guys. When all Swansons are stuck, that is called deadlock.


Alright Rons. I’m going to set a time limit. If you have been waiting for a fork for 10 minutes, you need to give up your fork. And wait 10 minutes before you try to pick up a fork again. By then, someone else will be done and you can use his fork:

Now you can’t have deadlock. But if all Swansons do these actions at the exact same time, you now have livelock: Yay! Nothing can go wrong now! Right? 30 minutes later So let me get this straight…

  1. You all picked up your fork at the exact same time.
  2. 10 minutes later, you all put down your forks.
  3. 10 minutes later, you just picked up your forks again! This will go on forever!

What do, nephew? You Swansons will starve!

Resource Hierarchy

Let’s number the forks:

Now Rons, the rule is, if you’re using two forks, you need to pick up the lower numbered fork first. Now let’s see what happens:

  • Ron #1 picks up fork #1
  • Ron #2 picks up fork #2
  • Ron #3 picks up fork #3
  • Ron #4 picks up fork #4
  • Ron #5 can’t pick up fork #5! Because he will need two forks and he needs to pick up the lower numbered fork first!

So fork #5 goes to Ron #4 – no deadlock!

Cool, resource hierarchy avoids deadlocks! But it is slow. Suppose you have forks #3 and #5. Then you decide you need fork #2. Well forks #3 and #5 are larger numbers. So you’ll have to:

  1. put down fork #5
  2. put down fork #3 (the order you put these down in doesn’t matter)
  3. pick up fork #2
  4. pick up fork #3
  5. pick up fork #5

Ugh, what a waste of time!


Here’s an easier solution: if there are 5 forks, only 4 Swansons should be allowed at the table. We’ll have a waiter control access to the table:

If there are < 4 Swansons on the table, you can join. Otherwise you have to wait until there are < 4 Swansons! Ok, this prevents deadlock, but you can still have starvation…a Swanson could wait forever and never get to sit at the table. Unless he kills off one of the other Swansons.


Now I’ve got it. All forks can be clean or dirty: Initially all forks are dirty:


  1. Number all the Swansons
  2. For every pair of Swansons, give the fork to the guy with the smaller id:
  3. When a Swanson needs a fork, he asks his neighbor for his fork. When his neighbor gets the request:
    • if his fork is clean, he keeps it.
    • if his fork is dirty, he cleans it and sends it over.

When a Swanson has eaten, all his forks become dirty. Bam! Starvation problem solved! The guys who are starving get a higher priority than the guys who are eating!

Q. Swansons 3 and 4 both only have one fork. Suppose Swanson #3 requests a second fork from Swanson #4. Will Swanson #4 give up his fork even though he didn’t eat? A. YES. According to the rules of Chandy-Misra, Swanson #4 would have to clean his fork and send it over to Swanson #3.


Proof-of-Stake Resources


Bitcoin Developer Documentation: Guides, examples and references about blockchain, transactions, contracts, wallets, payment processing, operating modes, p2p network and mining. Bitcoin Wiki: For all your Bitcoin information needs. This wiki is maintained by the Bitcoin community. bitcoin.org: Bitcoin.org was originally registered and owned by Bitcoin’s first two developers, Satoshi Nakamoto and Martti Malmi. When Nakamoto left the project, he gave ownership of the domain to additional people, separate from the Bitcoin developers, to spread responsibility and prevent any one person or group from easily gaining control over the Bitcoin project. Bitcoin 101: It’s getting easier to find information on Bitcoin these days. But it can still be overwhelming for newcomers. Here’s a list of places online that are worth visiting if you’re keen to wrap your head around what’s going on. 趣块链: 区块链论坛 bitshuo区块链技术中文社区 Bitcoin Forum


Ethereum Frontier Guide: The Frontier is the first live release of the Ethereum network. As such you are entering uncharted territory and you are invited to test the grounds and explore. There is a lot of danger, there may still be undiscovered traps, there may be ravaging bands of pirates waiting to attack you, but there also is vast room for opportunities. Home-Go-Ethereum-Wiki Ethereum Community Forum Ethereum Homestead Documentation: This documentation is the result of an ongoing collaborative effort by volunteers from the Ethereum Community. Although it has not been authorized by the The Ethereum Foundation, we hope you will find it useful. Ethereum Builder’s Guide: This guide is still under heavy development. Ethereum Development Tutorial Parity Go Ethereum: Go Ethereum is one of the three original implementations (along with C++ and Python) of the Ethereum protocol. It is written in Go, fully open source and licensed under the GNU LGPL v3. Ethereum Network Status The Ethereum Wiki: The Ethereum Wiki METAMASK: MetaMask is a bridge that allows you to visit the distributed web of tomorrow in your browser today. It allows you to run Ethereum dApps right in your browser without running a full Ethereum node. Blog: 汪晓明对区块链、以太坊的思考 bitcoinj: bitcoinj is a library for working with the Bitcoin protocol. It can maintain a wallet, send/receive transactions without needing a local copy of Bitcoin Core and has many other advanced features. It’s implemented in Java but can be used from any JVM compatible language: examples in Python and JavaScript are included. TurboEthereum Guide: TurboEthereum is a large distribution of software including a number of diverse tools. This book begins with the installation instructions, before proceeding to introductions, walk-throughs and references for the various tools that make up TurboEthereum. Giant Ethereum Resource List: These links have helped me set-up Ethereum, create DApps, and understand the platform. Ethereum Tutorials and Tips by Hudson reddit.com/r/ethereum/

Ethereum Wallet & Stats

electrum etherscan: EtherScan is a Block Explorer and Analytics Platform for Ethereum, a decentralized smart contracts platform. ROPSTEN TESTNET下的etherscan wallet.ethereum.org blockmeta: BTC, ETH, ETC浏览器,比特币地址,地址类型分布,比特币区块链数据,算力分布,比特币节点分布,比特币节点网络,API等等。 blockchain.info: Wallet, charts, stats, markets and API. http://idex.market/ myetherwallet: Open-Source & Client-Side Ether Wallet · v3.5.3 Ethereum Ropsten Faucet


Blog: tryblockchain Docs: Solidity: Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed to target the Ethereum Virtual Machine. Tutorials | Solidity Solidity Tutorials Learn X in Y minutes Where X=Solidity


hyperledger.org github: hyperledger


Ethfans.org : 建立最好的以太坊中文技术社区。 铅笔 巴比特: 巴比特建立于2011年,旗下包括巴比特资讯、巴比特社区、区块元、币众筹四大区块链基础信息与数据服务产品,巴比特资讯专注于区块链、比特币以及数字货币领域的新闻报道。 万向区块链实验室: 万向区块链实验室(WanXiang Blockchain Labs)是中国万向控股成立的一家专注于区块链技术的前沿研究机构,实验室将聚集领域内的专家就技术研发、商业应用、产业战略等方面进行研究探讨,为创业者提供指引,为行业发展和政策制定提供参考,促进区块链技术服务于社会经济的进步发展。 chinaledger: 中国分布式总账基础协议联盟


STATE OF THE ÐAPPS etherisc crop.etherisc fdd.etherisc

The precise definition of each statistic and graph displayed in https://ethstats.net.

Best Block is the heaviest block regarding the cummultative difficulty, or in simple words: the highest block number of the longest valid chain. Uncles are orphaned blocks, but in oposite to other blockchain systems, uncles are rewarded and included in the blockchain. Shows current bloc’s uncle count and uncle count of last 50 blocks. Last Block shows the time since the last block was mined, usually in seconds. Average Block Time is, well, the average time between two blocks, excluding uncles, in seconds. Should be something around 15 seconds. Average Network Hashrate is the number of hashes bruteforced by the network miners to find a new block. 5 TH/s means the network power is at five trillion hashes per second. Difficulty is the current mining difficulty to find a new block which basicly means how hard it is to find a matching hash. Active Nodes is the number of connected nodes to the Ethstats dashboard, (not the whole ethereum network!) Gas Price is the price miners accept for gas. While gas is used to calculate fees. 20 gwei is the current default, which stands for 20 Giga-Wei which are twenty billion wei that is 0.00000002 ETH. Gas Limit is the block gas limit. It defaults to 1.5 pi million gas (4,712,388) and miner can only include transactions until the gas limit is met (and the block is full). The gas limit is the analogy to bitcoin’s block size limit, but not fixed in size. Page Latency and Uptime are specific stats for the dashboard. Block Time Chart shows the actual time between the last blocks. Difficulty Chart shows the actual difficulty of the last blocks. Block Propagation Chart shows how fast blocks are shared among the nodes connected to the dashboard. Last Block Miners are the public keys of the miners who found most of the last blocks. Uncle Count Chart shows numbers of uncles per 25 blocks per bar. Transactions Chart shows numbers of transactions included in last blocks. Gas Spending Chart shows how much gas was spent on transactions in each block, note the correlation to the transactions chart. Gas Limit Chart shows the dynamicly adjusted block gas limit for each block.

See also: http://blog.codinglabs.org/articles/bitcoin-mechanism-make-easy.html






















  • 这个体系完全依赖于账本持有人的个人信用,如果这个人不守规矩,随意篡改账本,那么整个货币系统就会崩溃
  • 如果这个人家里失火或者账本失窃,同样也会为整个体系带来毁灭性的打击






  1. 账簿上不再记载每户村民的余额,而只记载每一笔交易。即记载每一笔交易的付款人、收款人和付款金额。只要账簿的初始状态确定,每一笔交易记录可靠并有时序,当前每个人持有多少钱是可以推算出来的。
  2. 账簿由私有改为公开,只要任何村民需要,都可以获得当前完整的账簿,账簿上记录了从账簿创建开始到当前所有的交易记录。






  • 保密印章可以在纸上盖一个章,每个印章盖出的章都隐含了一个全村唯一的一串字符,但是凭肉眼是看不出来的。也无法通过观察来制造出相应的印章。
  • 印章扫描器可以扫描某个已经盖好的章,读出隐含的信息,并在液晶屏上显示出一串字符。




  • 矿工以组为单位,一组可以是单独的一户,也可以是几户联合为一组
  • 成为矿工不影响正常使用货币
  • 矿工每天要花费一定时间从事比特币“挖矿”活动,但是不同于挖金矿,虚拟矿工不需要拿着工具去野外作业,在家里就可以完成工作
  • 矿工有一定可能性获得报酬,在挖矿活动中付出的努力越多,获得报酬的可能性越大
  • 矿工可以随时退出,也可以随时有新的矿工加进来






















  • 生成的编号仅与账簿纸上填入的内容有关,与填写人、字体、填写时间等因素均无关
  • 内容相同的账簿纸生成的编号总是相同,但是如果内容哪怕只改一个字符,编号就会面目全非
  • 编码生成器在打印编码时还需要将所有填入账簿纸的交易单放入,机器会扫描交易单和填入交易单的一致性,尤其是保密印章,如果发现保密印章和付款人不一致,会拒绝打印编码
  • 将一张已打印的账簿纸放入,机器会判定编号是否是有效的机器打印,并且判定编号和内容是否一致,这个编号无法伪造
  • 交易单收件箱。每个矿工小组需要在门口挂一个箱子用于收集交易单。
  • 公告板。每个矿工小组同样需要一个公告板公示一些信息。






此时小组的人拿出一张空的账簿纸,把这些交易填写到“交易清单”一栏,同时找到当前账簿最后一页,将最后一页的编号抄写到“上一张账单编号一栏”。 注意还有个“幸运数字”,可以随便填上一个数字,如12345。然后,将这样账簿纸放入编号生成器,打印好编号,一张账簿就算完成了。











  1. 账簿的编号有效
  2. 账簿的前一页账簿有效
  3. 交易清单有效















































  1. 为了便于理解,我做了很多简化,因此有些机制细节和实际的比特币可能不完全相同。但总体思想和关键原理是一致的。
  2. 由于很多计算机世界的东西(如公钥体系、网络传输)在现实世界中并没有特别好的对等物,所以故事里难免有一些生硬和不合常理的细节。
  3. 本文描述的是比特币网络本身的技术原理和运作机制,当在如Mtgox这种买卖市场中进行比特币交易时,市场做了中间代理,并不遵从上述机制


  1. Bitcoin: A Peer-to-Peer Electronic Cash System
  2. https://bitcoin.it
  3. 云风的BLOG: Bitcoin 的基本原理
  4. 易懂的比特币工作机理详解