Bitcoin Tutorials

Learn How to Build Your First Bitcoin Apps


Introduction to 21

Introduction to 21Introduction to 21

This introductory guide will teach you the basics of 21.

  • Installing 21
  • Using 21 as an app
  • Using the 21 marketplace
  • Setting up your 21 profile
  • Writing programs with the 21 library

Get started

Introduction to the 21 Bitcoin ComputerIntroduction to the 21 Bitcoin Computer

Build Apps with 21

Go through the examples below to start building your first bitcoin-powered apps:

Build a Simple Bitcoin Game

In this tutorial we'll show you how to host a simple game of skill using 21. If your friends answer correctly, they win bitcoin!

Bitcoin-payable HTTP Proxy

Set up a simple web proxy and allow any visitor to access any website after paying you a little bitcoin. Free as in freedom - and as in free market.

Receive an SMS from Anyone for Bitcoin

Set up 21 to allow anyone to send you an SMS for a small amount of bitcoin - without revealing your phone number.

A Bitcoin-Payable API

Learn how to create a bitcoin-payable API server with Flask. Your server will take a text file and some bitcoin, and return a spoken rendering of that text as an audio file.

A Bitcoin Mashup

Compose two bitcoin-payable APIs set up by different users to get a sense for what a bitcoin-payable digital supply chain might look like.

Sell or License Any File for Bitcoin

Are you a designer, musician, or author? Use this sample code to turn any directory full of digital assets into your own personal iTunes-like store.

Bitcoin-Accelerated Computing

Learn how to outsource computations for bitcoin by paying a remote server for an API call. This illustrates how to use bitcoin as a new kind of system resource.

Intelligent Agents with Bitcoin

Create a simple bitcoin-powered intelligent agent that finds and purchases the digital service with the lowest price in bitcoin.

A Bitcoin-Payable Notary Public

This tutorial will show you how to set up a notary public service. Any user can pay bitcoin to write a message to the blockchain to be stored forever.

A Crawler for the Machine-Payable Web

Set up a crawler service using 21 that checks the status of 402 endpoints.

Monetize the Command Line with Bitcoin

This tutorial will teach you how to build a bitcoin-payable command line SAAS tool that converts an address to geographic coordinates.

Translate English to Chinese for Bitcoin

This tutorial will teach you how to set up a simple bitcoin-payable translation API using 21.

Grid Computing with Bitcoin Micropayment Channels

Set up a grid computing service in which users can pay for remote computation with Bitcoin micropayments.

Ping21: Earn Bitcoin by Monitoring Uptime and Latency

Set up a ping service and publish it to the 21 marketplace. In conjunction with other service providers, earn bitcoin by helping webmasters monitor uptime and latency.

Sensor21: Earn bitcoin by collecting environmental data

Set up a sensor and record longitudinal data. Then monetize this data by publishing it to the 21 marketplace and aggregating it with other data providers.

Using 21 with Django and Heroku

Learn how to use Django with 21 and deploy to Heroku. This tutorial covers best practices for managing a stateful bitcoin-payable endpoint.

Deep Learning with 21 and AWS

Learn how to use 21 with Amazon Web Services to set up a bitcoin-payable deep learning service.

Neural Art

Learn how to use a bitcoin-payable endpoint that uses deep learning to apply the style of one image to another.

A Bitcoin-payable Black-Scholes Server

Calculate the theoretical price of an option using the Black-Scholes formula and discover how to create bitcoin-payable financial calculators.

Reference

We have divided our reference section below into several sections, including documentation specific to the 21 Platform, documentation for the 21 Bitcoin Library, guides to creating your own DIY Bitcoin Computers, and general Bitcoin documentation whichis useful even if you don't use 21.


21.coThe 21 Platform

This section contains documentation on the 21 Platform. It shows how to get set up, use the built-in 21 command line interface, and publish an app. It also explains how micropayments and the marketplace work within the 21 ecosystem.

Set up your 21 Bitcoin Computer

If you have received your 21 Bitcoin Computer box in the mail, you are just a few minutes away from booting it up.

Introduction to the 21 Bitcoin Computer

This introductory guide will teach you the basics of the 21 Command Line and Library and show you how to build a bitcoin-powered application on the 21 Bitcoin Computer.

The 21 Command Line Interface

In this tutorial you'll learn the basics of the 21 Command Line Interface as well as the syntax of several initial commands that you will frequently use.

How 21 Mining Works

Learn about the concept of buffered pooled mining within the 21 system, and how the 21 mine command works.

How 21 Micropayments Work

This reference discusses the three micropayment modes offered by 21: on-chain transactions, off-chain transactions ("BitTransfers"), and micropayment channels.

The 21 Marketplace

Here we explain how peer-to-peer networking, the 21 Developer Community, and the 21 Command Line work together to form the 21 Marketplace.

Running A Full Node

This tutorial will show you how to run your 21 Bitcoin Computer as a full node.

Publish an App to the 21 Marketplace

Learn how to publish your bitcoin app to the 21 Marketplace to start earning bitcoin right now.

21 App Manifest Walkthrough

Learn how to write a manifest for your bitcoin app in the 21 Marketplace by example.

Introduction to Micropayment Channels

Micropayment channels provide secure instant payments from one person to another with the same security as regular Bitcoin transactions. This introduction shows you how they work and provides concrete examples.

Selling microservices with 21

21 sell makes it easy for you to sell Bitcoin-payable microservices. This tutorial explains how it works and helps you set it up locally or remotely.


21.coThe 21 Do-It-Yourself (DIY) Bitcoin Computer Instructions

21 enables users to create and sell machine-payable APIs on the 21 Marketplace from any Debian or OSX based system. But often you don't want to host these kinds of APIs on your primary laptop. Single-board computels such as the Raspberry Pi are a great alternative. These tutorials will guide you through the steps necessary to build your own do-it-yourself (DIY) Bitcoin Computers capable of hosting machine-payable apis.

The Do-It-Yourself 21 Bitcoin Computer - Raspberry Pi 3 Edition

This tutorial guides you through the steps necessary to host 21 Marketplace apps from your Raspberry Pi 3. A Raspberry Pi 2 can also be used.

The Do-It-Yourself 21 Bitcoin Computer - ODROID XU4 Edition

This tutorial guides you through the steps necessary to host 21 Marketplace apps from your ODROID XU4.


21.coThe 21 Bitcoin Library (two1)

This section contains the API Documentation for the 21 Bitcoin Library. The library is written in Python 3, is importable as two1 within a Python 3 context, and it underpins the 21 command line interface. Below we provide both high level introductions and function-level documentation for the Bitcoin, Blockchain, Crypto, Wallet, Micropayment Channels Client, BitServ, and BitRequests components of this library.

The 21 Bitcoin Library (two1.bitcoin)

The Bitcoin module in the 21 Bitcoin Library includes code for working with key Bitcoin datastructures, like transactions and scripts.

The 21 Blockchain Library (two1.blockchain)

The Blockchain module in the 21 Bitcoin Library provides information about the blockchain.

The 21 Crypto Library (two1.crypto)

The Crypto module in the 21 Bitcoin Library provides low-level access to essential Bitcoin-related cryptographic functions.

The 21 Machine Wallet (two1.wallet)

The wallet module in the 21 Bitcoin Library includes an HD machine wallet which integrates with the 21 mining chip.

The 21 Micropayment Channels Client Library (two1.channels)

The Channels module in the 21 Bitcoin Library allows customers and merchants to establish long-lived micropayment channels for fast peer-to-peer payments.

The 21 BitServ Library (two1.bitserv)

The BitServ module in the 21 Bitcoin Library provides functions and decorators that allow Flask and Django web applications to easily accept micropayments.

The 21 BitRequests Library (two1.bitrequests)

The BitRequests module in the 21 Bitcoin Library wraps the Python's HTTP Requests library so that adding the 402 payment protocol to existing programs is easy.

The 21 Marketplace Library (two1.mkt)

The 21 Marketplace library makes it easy to access the 21 marketplace programmatically, allowing you to quickly buy APIs from multiple providers.


The 21 Bitcoin Tutorial

This section contains a general tutorial on Bitcoin,useful even if you have not yet purchased a 21 Bitcoin Computer or installed the free 21 Client.The lessons explain the basics of Bitcoin to help you build apps that use Bitcoin for more than just sending and receiving payment. These articles are written by the people who brought you the Bitcoin.org developer documentation.

Introduction to Bitcoin concepts

What's a hash, blockchain, or public key? This short article quickly explains many of the concepts experienced Bitcoin developers take for granted. Recommended reading for all developers new to Bitcoin.

Digital signatures

Digital signatures and hashes are two of the most important building blocks that make Bitcoin possible. In this tutorial, you'll get familar with digital signature basics.

Cryptographic hash functions

Hashes and digital signatures are the two most important cryptographic technologies used by Bitcoin. In this tutorial, you'll create a hash and learn about its special properties.

View the Genesis Block

Get a look at the Genesis Block, the first block on the Bitcoin blockchain, and the block into which Bitcoin creator Satoshi Nakamoto embedded an important message.

Proof of work using Hashcash

What is Hashcash, and what does it have to do with Bitcoin? In this tutorial, we'll work directly with one of the tools Satoshi Nakamoto used to make Bitcoin a fully decentralized currency.

Introduction to Linux

Learn the basics of Linux to help you get the most out of the 21 Bitcoin Computer and the other tutorials on this site.

Embedding data in the blockchain with OP_RETURN

by Justin Guy

This tutorial is designed to get a developer started with storing data in the Bitcoin blockchain using the OP_RETURN script opcode.

Generating a P2PKH address with Node.js

by Trevin Hofmann

Discover how to generate a standard Bitcoin address using Node.js, from creating a secure private key to encoding the final result.


21.coThe Bitcoin Labs

Instructions on how to get started with bitcoin computing and machine-to-machine micropayments. In the new field of bitcoin computing, the virtual currency bitcoin is used as a fundamental system resource on par with power, memory, bandwidth, or hard drive space.

Create an Amazon AWS EC2 Ubuntu VPS

Create a Virtual Private Server (VPS) using Amazon Web Service's (AWS) Elastic Compute Cloud (EC2) to install 21 and run Bitcoin-payable services.

Create a Development Environment in VirtualBox

Create a development environment in VirtualBox for testing software with 21, keeping everything separate from your main laptop operating system.

Introduction to Python

A short primer on Python to help programmers familiar with other languages quickly learn what they need to know to follow the other Bitcoin tutorials.

The Blockchain

What do other people really know about your Bitcoin transactions? In this tutorial we look at actual blockchain data to explore how much privacy is possible with Bitcoin, and how Bitcoin has evolved over time through protocol forks.

Mine the Genesis Block

How do Bitcoin blocks get assembled and then mined? In this tutorial, you'll learn about the six fields that make up every block header and then mine the same fields Satoshi Nakamoto mined to create Bitcoin's first block.

Introduction to Bitcoin

An introduction to basic Bitcoin concepts using a Bitcoin Computer, giving you enough knowledge to write micropayments-capable apps and demos.

Introduction to Bitcoin Computing

You will learn how to mine bitcoin, set up a bitcoin-payable API server for micropayments, and buy and sell digital goods for bitcoin.

Bitcoin Instagram

You will learn how to create a simple "user-monetized content" site, in which you sell a library of content you own to your peers for bitcoin.

Bitcoin Linux

Merge the power of the Unix/Linux command line with Software as a Service (SaaS) to create command-line SaaS tools that can be piped to each other.


21.coReference: Bitcoin.org documentation

The folks who wrote the 21 Bitcoin Tutorials also wrote the bulk of the Bitcoin.org Developer Documentation. Once you've gotten your bearings by going through the Bitcoin Apps and tutorials, the documentation will help you learn in detail how the Bitcoin protocol works and let you look up many of Bitcoin's technical details. The documentation is split into several large pages, each addressing a different need.

Developer Examples

The Bitcoin.org Examples can help you start building Bitcoin-based applications. Whether you're working with raw transactions or parsing a merkle block, you'll find an example here that can help you get your project done faster.

Developer Guide

The Bitcoin.org Developer Guide provides an overview of how Bitcoin works. If you've read Satoshi Nakamoto's whitepaper, done the 21 Bitcoin Tutorials, and want to learn more about how Bitcoin works, this is the place to start.

Developer Reference

The Bitcoin.org Reference contains technical details about the Bitcoin consensus rules, the p2p network protocol, and the Bitcoin Core API. If you know how Bitcoin works and just want the facts, jump in here.

Earn Bitcoin By Helping Others Learn Bitcoin

Do you know Bitcoin? This is your chance to earn up to $200 in Bitcoin per article by helping others learn Bitcoin. Help us take Bitcoin development to the next level by educating new developers. We’re looking for high-quality material that takes a hands-on approach to teaching Bitcoin concepts and practicalities.

Submit A Bitcoin Tutorial

In addition to the core Bitcoin.org contributors, we also know that there’s a world of as-yet-undiscovered talent out there, especially outside the United States. So if you want to earn bitcoin while helping others learn Bitcoin, please click above to submit a draft tutorial and we will pay you up to $200 in Bitcoin per article upon acceptance.