The developers of 21 Bitcoin Computer, a small Linux computer that has the bitcoin protocol as part of its operating system, have posted documentation designed to make its library easier to use. Launched in September, 21 Bitcoin Computer is both a bitcoin miner and a device that enables users to buy, sell and rent products using bitcoin.
21 Bitcoin Computer’s main goal is to make bitcoin an Internet protocol. The company, backed by Andreessen Horowitz, believes that it is participating in building bitcoin’s infrastructure. 21 Bitcoin Computer has been welcomed by those who think it will support Internet machine-to-machine commerce.
Library Documentation Posts
The documentation about the 21 Bitcoin Library has posted on Twitter and Medium, an Internet forum. The purpose is to make the library easier to use.
The documentation covers 21 Bitcoin Library’s wallet, block chain, bitcoin and crypto submodules. The documentation will stay in sync with each library update. The developers view the library documentation as a first step towards a portable, open-source release. The library is written in Python 3 and provides the several submodules:
The 21 Bitcoin Library. The main module (two1.lib.bitcoin) provides functionality for users working with major bitcoin data structures, covering:
• Classes for major bitcoin data structures, such as scripts, blocks, block headers, transactions, private and public keys, and digital signatures
• Code to serialize and deserialize these data structures consistently, to and from raw byte representations
• Creation of standard scripts (Pay-to-Script-Hash [P2SH] and Pay-to-Public-Key-Hash [P2PKH]) and multi-signature support
• Transaction creation, verification, signing, and broadcasting, including multi-signature transactions
• Standard private/public key generation of keys for HD wallets
• Utilities for working with various bitcoin’s idiosyncrasies, including parsing variable length integers and converting difficulties to bits and back
Other Library Modules
Other 21 Bitcoin Library Modules include:
The 21 Blockchain Library. The block chain module within the 21 Bitcoin Library (two1.lib.blockchain) enables a user to request block and transaction data from a block chain data provider as well as to submit new transactions to the provider for inclusion in new blocks and to relay to the network.
The 21 Machine Wallet. The wallet module within the library (two1.lib.wallet) provides a fully-functional HD wallet. It integrates with the bitcoin mined by a 21 Mining Chip and is optimized for machine-to-machine transactions. The wallet conforms to BIP-32 and BIP-44 and can be accessed both via the command line and programmatically.
The 21 Crypto Library. The crypto module within the library (two1.lib.crypto) provides an interface to low-level cryptographic functions used in bitcoin to generate public keys and signatures using the elliptic curve digital signature algorithm (ECDSA) on the secp256k1 curve. There are two submodules: an OpenSSL-using module available if OpenSSL is available on the system, and a pure Python module that’s available always and portable, but doesn’t contain as many performance optimizations and hasn’t been audited as heavily as bitcoin-related parts of OpenSSL. The OpenSSL module is used by default. The pure Python module is used as a backup.
User Feedback Welcome
This documentation, as well as tutorials at 21.co/learn, is intended to help users build additional bitcoin-enabled applications. 21 Bitcoin Computer welcomes feedback.
Images from Shutterstock and 21 Bitcoin.