![]() The transaction fees in the example were off. 2-of-3 P2SH inputs are between 293 and 297 bytes (293 bytes if both signatures have low-R, 296 bytes if one signature has high-R, 297 bytes if both signatures have high-R) and P2SH outputs are 32 bytes. 2-of-3 P2WSH (native segwit) inputs are between 104 and 104.5 vbytes (416–418 WU, depending on low-R/high-R as above) and P2WSH outputs are 43 bytes. The transaction header has 10 bytes for non-segwit transactions and 42 WU for segwit transactions. Source: https://github.com/BitGo/unspents/blob/master/src/dimensions.ts#L69 I have updated the numbers in the example and amended the conclusion which did not match the new numbers. Calculation details follow. ----- Let's assume that the wallet is using signature grinding and will always produce signatures with low-R: •Without Segregated Witness: Transaction A using 2-of-3 P2SH inputs and P2SH outputs: 3*293 + 10 + 2*32 = 953 953 * 30 = 28,590 Transaction B using 2-of-3 P2SH inputs and P2SH outputs: 2*293 + 10 + 3*32 = 692 692 * 30 = 20,760 •With Segregated Witness: Transaction A using 2-of-3 P2WSH (native segwit) inputs and outputs: 3*104 + 10.5 + 2*43 = 408.5 408.5 * 30 = 12,255 Transaction B using 2-of-3 P2WSH (native segwit) inputs and P2WSH outputs: 2*104 + 10.5 + 3*43 = 347.5 347.5 * 30 = 10,425 |
||
---|---|---|
code | ||
images | ||
theme | ||
tools | ||
.gitignore | ||
.travis.yml | ||
appdx-bips.asciidoc | ||
appdx-bitcoinwhitepaper.asciidoc | ||
appdx-bitcore.asciidoc | ||
appdx-bx.asciidoc | ||
appdx-pycoin.asciidoc | ||
appdx-scriptops.asciidoc | ||
atlas.json | ||
author_bio.html | ||
book.asciidoc | ||
ch01.asciidoc | ||
ch02.asciidoc | ||
ch03.asciidoc | ||
ch04.asciidoc | ||
ch05.asciidoc | ||
ch06.asciidoc | ||
ch07.asciidoc | ||
ch08.asciidoc | ||
ch09.asciidoc | ||
ch10.asciidoc | ||
ch11.asciidoc | ||
ch12.asciidoc | ||
colo.html | ||
copyright.html | ||
cover.html | ||
dedication.html | ||
github_contrib.asciidoc | ||
glossary.asciidoc | ||
ix.html | ||
LICENSE | ||
praise.html | ||
preface.asciidoc | ||
README.md | ||
second_edition_changes.asciidoc | ||
titlepage.html | ||
toc.html |
Mastering Bitcoin
Mastering Bitcoin is a book for developers, although the first two chapters cover bitcoin at a level that is also approachable to non-programmers. Anyone with a basic understanding of technology can read the first two chapters to get a great understanding of bitcoin.
This repository contains the complete first edition, second print, published in December 2014, and the complete second edition, third print, published in March 2018, as published by O'Reilly Media in paperback and ebook formats.
Issues, Errors, Comments, Contributions
If you know how to make a pull request to contribute a fix, please write the correction and use a pull request to submit it for consideration against the develop branch. If you are making several changes, please use a separate commit for each to make it easier to cherry-pick or resolve conflicts. Otherwise, please submit an issue, explaining the error or comment. If you would like to contribute extensive changes or new material, please coordinate with the author first; contact information can be found on his website: https://antonopoulos.com/
Reading this book
To read this book, see book.asciidoc. Click on each of the chapters to read in your browser. Other parties may choose to release PDFs of the book online.
Chapters
- Chapter 1: 'Introduction'
- Chapter 2: 'How Bitcoin Works'
- Chapter 3: 'Bitcoin Core: The Reference Implementation'
- Chapter 4: 'Keys, Addresses'
- Chapter 5: 'Wallets'
- Chapter 6: 'Transactions'
- Chapter 7: 'Advanced Transactions and Scripting'
- Chapter 8: 'The Bitcoin Network'
- Chapter 9: 'The Blockchain'
- Chapter 10: 'Mining and Consensus'
- Chapter 11: 'Bitcoin Security'
- Chapter 12: 'Blockchain Applications'
Published
"Mastering Bitcoin (Second Edition, Second Print): Programming the Open Blockchain" is now available in paperback and ebook formats by many booksellers worldwide:
Mastering Bitcoin (First Edition Second Print) is also published in Japanese, Korean, and Chinese (Simplified) by publishers in the respective countries.
Mastering Bitcoin (Open Edition), based on the First Edition, has been translated by volunteers into more than a dozen languages. Translations are available for free under CC-BY-SA license at: https://bitcoinbook.info
Source
The book's source code, found in this repository, is kept synchronized with the print and ebook editions.
Mastering Bitcoin - First Edition
The tags Edition1Print1, Edition1Print2 correspond to the two existing prints of Mastering Bitcoin (First Edition) as published by O'Reilly Media.
Mastering Bitcoin - First Edition by Andreas M. Antonopoulos LLC is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
This "Free Culture" compliant license was approved by my publisher O'Reilly Media (http://oreilly.com), who understands the value of open source. O'Reilly Media is not just the world's best publisher of technical books, but is also a strong supporter of this open culture and the sharing of knowledge.
Thank you O'Reilly Media!
Mastering Bitcoin - Second Edition
The tags, second_edition_print_1 and second_edition_print2, correspond to the first (June 8th, 2017) and second (July 20th, 2017) print of Mastering Bitcoin (Second Edition), as published by O'Reilly Media.
Mastering Bitcoin - Second Edition by Andreas M. Antonopoulos LLC is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Translations
If you are interested in translating this book, please join our team of volunteers at: https://www.transifex.com/aantonop/mastering-bitcoin
Free copies of "Mastering Bitcoin Open Edition," translated in many languages, can be downloaded from: https://bitcoinbook.info