What is bitcoinj?
bitcoinj is a library for working with the Bitcoin protocol. It can maintain a wallet, send/receive transactions without needing a local copy of Bitcoin Core and has many other advanced features. It's implemented in Java but can be used from any JVM compatible language: examples in Python and JavaScript are included.
It comes with full documentation and many large, well known Bitcoin apps and services are built on it.
Features
- Highly optimised lightweight simplified payment verification (SPV) mode. In this mode, only a small part of the block chain is downloaded, making bitcoinj suitable for usage on constrained devices like smartphones or cheap virtual private servers.
- Experimental full verification mode, which does the same verification work as Bitcoin Core. In this mode, the unspent transaction output set (UTXO set) is calculated and, thanks to a PostgreSQL store, can be indexed into a database allowing for fast lookup of balance by address.
- A wallet class with encryption, fee calculation, multi-signing, deterministic key derivation, pluggable coin selection/coin control, extensions support and event listeners that let you stay up to date with changes in your balance.
- Support for micropayment channels that let you set up a multi-signature contract between client and server, and then negotiate on the channel, allowing fast micropayments that avoid miner fees.
- Provides both async and thread-per-connection for network IO, allowing you to choose between scalability and blocking-only features like SOCKS proxying.
- Easily implement apps that use Bitcoin's contracts features.
- A simple GUI wallet app that you can use as the basis for your own apps. Watch or read a tutorial on how to customise it and build a native installer that does not require Java.
- Command line tools for working with wallet and chain files, the payment protocol, the network and more.
- Strong Bitcoin standards support.
- A friendly and helpful community!
Getting started
You can download the library as a JAR, or use Maven/use Gradle, or get the code from github. Then read:
- Satoshi's white paper - the bitcoinj documentation assumes basic familiarity with how Bitcoin works, the structure of transactions and the block chain.
- Getting started - a step by step tutorial for Java and JavaScript devs on how to use the library.
Important announcements: If you use bitcoinj in an application please sign up for the announcement list so you know when new versions are available and if there are critical bugs found.
Be aware: this library is Apache licensed. By using it, you agree with the terms of that license. In particular pay attention to section 7 and 8, which assert there is NO WARRANTY that this library is safe to use or bug free, and in fact that by using this code you accept that none of the contributors shall be liable for any damages or monetary loss that results from your use of their code, even if due to bugs in that code. In short, according to the license the library is distributed under, there are no situations in which you could sue any of the developers (it's as if you wrote the entire library yourself). If you can't handle that, don't use this library.
Documentation
Read the API documentation: 0.16.3 API documentationThere are also some more in depth articles covering various topics. For best understanding, read them in order.
Basics
- Limitations and missing features
- Understanding the bitcoinj security model
- Working with bitcoinj - basic patterns and things you should know
- How the different components of your app fit together
- How to test your software
Core APIs in depth
- Working with transactions
-
Working with the wallet, which covers:
- Setting one up
- Receiving and sending money
- Crafting custom transactions and contracts
- Balances, coin selection and how to customise
- Wallet maintenance
- Encryption and passwords
- Watching/following wallets
- Multisig/married wallets and pluggable transaction signing
- Connecting the wallet to an external unspent outputs store e.g. for web wallets
- Working with monetary amounts
- How to use the network API
bitcoinj TV
- Video tutorial: how to make a simple GUI wallet using the wallet template app
- Video tutorial: how to build and bundle a document timestamping contracts app in under 30 minutes
Advanced features
- API contexts
- How to use the experimental fully verifying mode
- Working with contracts
- Working with the BIP70 payment protocol
- Working with micropayment channels
- Information on block chain synchronisation optimisations
- Using bitcoinj from other languages like C++, JavaScript, Ruby, Python, etc
- Coding conventions in the library itself
You can read the release notes for each release starting from 0.3. We also got pre-release notes for alphas, betas and release candidates!
Community
- Join our Matrix space: #bitcoinj:matrix.org, which contains the following:
- The #bitcoinj-users:matrix.org room for discussion among developers using bitcoinj in their projects.
- A bitcoinj-developers room (visible after joining the space) for discussion among developers working on (contributing to) bitcoinj.
- Search and report issues on the Issues Data Base (to ask for help please use the Matrix rooms above, not the Issues DB)
- View bitcoinj on Github - make sure to
star
us!