Skip to content

Instantly share code, notes, and snippets.

View yashbhutwala's full-sized avatar
spreading tribal knowledge

Yash Bhutwala yashbhutwala

spreading tribal knowledge
View GitHub Profile

A description of known problems in Satoshi Nakamoto's paper, "Bitcoin: A Peer-to-Peer Electronic Cash System", as well as notes on terminology changes and how Bitcoin's implementation differs from that described in the paper.


The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power.

I'll first give some thoughts on the design of the wallet in general, before explaining current and future SegWit wallet support.

Current design

Conceptually, a wallet currently contains mapKeys, mapScripts, and setWatchOnly, which together determine which outputs are considered "ours" (IsMine), and how to solve and sign for them. Then the wallet further contains key metadata, key chains, and key pool at the wallet level that feed into this.

We determine whether outputs are ours using ad-hoc logic that mostly answers the question "Could we sign this?", but with some notable exceptions: