Mastering Bitcoin PDF with ASCIIDoctor and Docker

Mastering bitcoin is a modern masterpiece. It describes, in easy to understand terms, how Blockchain and Bitcoin work from a fundamental level as well as a very detailed technical level. When you have a moment, purchase the book and support the very worthy author, Andres Antonopolous. However, in the spirit of open-ness, O’Reilly (the publisher) has released the source code for the book on Github. In this article I’ll show you how to generate your own English language PDF version from the public, open-source source files.

Let’s get started…

Docker and ASCIIDoctor

Once you have docker installed, we can move onto the next step.

Downloading the Book Source Code

The second edition of the book does not yet allow for derivatives in its license, and generating a PDF of the book is conceptually the same. So what we’ll be generating here is edition 1 of the book, from the Edition1Print1 tag.

To download the book, we’ll use git. Move to the directory you’d like to clone the book into and use the git clone command to clone it.

git clone

Next, we’ll check out the Edition1Print1 to ensure we’re generating the properly licensed one.

git checkout Edition1Print1

Setting Up Our ASCIIDoctor Image

The docker run command will run the docker image and, if you haven’t yet downloaded the image, will automatically download the image we need from DockerHub. We’ll mount a local folder with our bitcoinbook source code to a special folder in the ASCIIDoctor image. The image already knows to check that directory for source code and convert it so we shouldn’t need to do much to have a PDF generated.

Let’s give it a try. Run the following command from your terminal:

docker run -it -v <path to your bitcoinbook>:/documents/ asciidoctor/docker-asciidoctor

This will drop us directly into a command shell in the container. In this container, we have access to all of the ASCIIDoctor commands and it starts us in the folder that we mounted in the volume when we ran the container.

Creating a PDF using ASCIIDoctor

asciidoctor-pdf book.asciidoc

You may see some warnings and errors generated, but if all goes well then at the end you should see a new file called book.pdf with the newly generated book. Once you exit the container, the file will be in the directory you mounted to your container.

You’re Now One Step Closer to Mastering Bitcoin!

Entrepreneur. Engineer. Educator.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store