Swift Bitcoin is a Bitcoin network client written entirely in Swift with minimal1 third-party dependencies. It fully implements the Bitcoin protocol and exposes it as a framework for Swift application development on every supported platform. In addition to the API there's command-line tools for launching a peer-to-peer node, interfacing with it using RPC and performing advanced off-chain wallet and cryptographic operations.
The library provides full support for bitcoin transactions, SCRIPT, segregated witness, Schnorr signatures, taproot, tapscript and more.
The goal is to make Swift Bitcoin the most comprehensive SDK for bitcoin in Swift with features like mempool management, block mining and connectivity via the bitcoin protocol.
We want the library to be fully tested from the beginning. When available we will use test vectors from the BIPs and reference implementations or port tests directly from Bitcoin Core.
This implies a slow and steady progress but the end result will be a secure and robust product on which developers can base their solutions.
Below is a rough roadmap of the order in which features could be integrated.
- Full transaction model with script, lock-time, input sequence and witness.
- Transaction serialization and deserialization.
- SCRIPT interpreter loop.
- Transaction signature hash, signature signature hash types and signature generation (ECDSA).
OP_CHECKSIG
.- Transaction verifying for Pay-to-Public-Key (
P2PK
) and Pay-to-Public-Key-Hash (P2PKH
). OP_RIPEMD160
,OP_SHA256
,OP_HASH256
,OP_HASH160
and other cryptographic operations.Base58
andBase58Check
address encoding/decoding.OP_CHECKMULTISIG
.- Transaction verifying
P2SH
. - Relative lock-time.
OP_CHECKSEQUENCEVERIFY
.OP_CHECKLOCKTIMEVERIFY
.NULLDUMMY
.- Other script operations (arithmetic, stack, …).
- Segwit transaction verifying
P2WPKH
,P2WSH
,P2SH-P2WPKH
,P2SH-P2WSH
. Bech32
address encoding/decoding.- Transaction Schnorr signature generation.
- Pay-to-Taproot
P2TR
(key-hash spends only). - Transaction signing for all standard scripts.
Bech32m
address encoding/decoding.OP_CHECKSIGADD
(witness V1 script).- Tapscript transactions.