Skip to content

Comprehensive Bitcoin development library for iOS, implemented on Swift.

License

Notifications You must be signed in to change notification settings

horizontalsystems/BitcoinCore.Swift

Repository files navigation

BitcoinCore.Swift

BitcoinCore.Swift is a core package that implements a full Simplified Payment Verification (SPV) client in Swift. It implements Bitcoin P2P Protocol and can be extended to be a client of other Bitcoin forks like BitcoinCash, Litecoin, etc. Currently, we have extensions BitcoinKit.Swift, BitcoinCashKit.Swift, LitecoinKit.Swift and DashKit.Swift that complement this package with blockchain(fork) specific logic and used by UnstoppableWallet for integration of them.

Being an SPV client, BitcoinCore.Swift downloads and validates all the block headers, inclusion of transactions in the blocks, integrity and immutability of transactions as described in the Bitcoin whitepaper or delegates validation to the extensions that implement the forks of Bitcoin.

Features

  • Bitcoin P2P Protocol implementaion in Swift.
  • Full SPV implementation for fast mobile performance with account security and privacy in mind
  • P2PK, P2PKH, P2SH-P2WPKH, P2WPKH outputs support.
  • Restoring with mnemonic seed. (Generated from private seed phrase)
  • Restoring with BIP32 extended public key. (This becomes a Watch account unable to spend funds)
  • Quick initial restore over node API. (optional)
  • Handling transaction (Replacement)/(Doube spend)/(Failure by expiration)
  • Optimized UTXO selection when spending coins.
  • BIP69 or simple shuffle output ordering. (configurable)
  • BIP21 URI schemes with payment address, amount, label and other parameters

Usage

This package is designed to be used by a concrete kit like BitcoinKit.Swift. See BitcoinKit.Swift for more documentation.

Prerequisites

  • Xcode 10.0+
  • Swift 5+
  • iOS 13+

Swift Package Manager

Swift Package Manager is a dependency manager for Swift projects. You can install BitcoinCore.Swift by adding a line in dependencies value of your Package.swift:

dependencies: [
    .package(url: "https://github.com/horizontalsystems/BitcoinCore.Swift.git", .upToNextMajor(from: "1.0.0"))
]

License

The BitcoinCore.Swift toolkit is open source and available under the terms of the MIT License.