Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions README → README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
python-bitcoinlib
-----------------
# python-bitcoinlib

This Python2/3 library provides an easy interface to the bitcoin data
structures and protocol. The approach is low-level and "ground up", with a
Expand All @@ -8,17 +7,15 @@ focus on providing tools to manipulate the internals of how Bitcoin works.
"The Swiss Army Knife of the Bitcoin protocol." - Wladimir J. van der Laan


Requirements
------------
## Requirements

sudo apt-get install libssl-dev

The RPC interface, bitcoin.rpc, is designed to work with Bitcoin Core v0.11.0
Older versions mostly work but there do exist some incompatibilities.


Structure
---------
## Structure

Everything consensus critical is found in the modules under bitcoin.core. This
rule is followed pretty strictly, for instance chain parameters are split into
Expand Down Expand Up @@ -49,16 +46,14 @@ corresponding Satoshi C++ code uses the same naming conventions: CTransaction,
CBlockHeader, nValue etc. Otherwise Python naming conventions are followed.


Mutable vs. Immutable objects
-----------------------------
# Mutable vs. Immutable objects

Like the Bitcoin Core codebase CTransaction is immutable and
CMutableTransaction is mutable; unlike the Bitcoin Core codebase this
distinction also applies to COutPoint, CTxIn, CTxOut, and CBlock.


Endianness Gotchas
------------------
# Endianness Gotchas

Rather confusingly Bitcoin Core shows transaction and block hashes as
little-endian hex rather than the big-endian the rest of the world uses for
Expand All @@ -68,16 +63,14 @@ accomodate this. In addition see b2x() and b2lx() for conversion from bytes to
big/little-endian hex.


Module import style
-------------------
# Module import style

While not always good style, it's often convenient for quick scripts if import
* can be used. To support that all the modules have __all__ defined
appropriately.


Example Code
------------
# Example Code

See examples/ directory. For instance this example creates a transaction
spending a pay-to-script-hash transaction output:
Expand All @@ -89,8 +82,7 @@ Also see dust-b-gone for a simple example of Bitcoin Core wallet interaction
through the RPC interface: https://github.com/petertodd/dust-b-gone


Selecting the chain to use
--------------------------
# Selecting the chain to use

Do the following:

Expand All @@ -102,8 +94,7 @@ selected is a global variable that changes behavior everywhere, just like in
the Satoshi codebase.


Unit tests
----------
# Unit tests

Under bitcoin/tests using test data from Bitcoin Core. To run them:

Expand All @@ -128,8 +119,7 @@ skipped):

HTML coverage reports can then be found in the htmlcov/ subdirectory.

Documentation
-------------
# Documentation

Sphinx documentation is in the "doc" subdirectory. Run "make help" from there
to see how to build. You will need the Python "sphinx" package installed.
Expand Down