Swiftpack.co - Package - yenom/BitcoinKit

BitcoinKit: Let’s Play with Bitcoin in Swift! TravisCI Swift 5.0+ Carthage Swift Package Manager CococaPods

Welcome to BitcoinKit

The BitcoinKit library is a Swift implementation of the Bitcoin protocol which support both BCH and BTC. Improving the mobile ecosystem for Bitcoin developers is our mission.

BitcoinKit allows maintaining a wallet, sending or receiving transactions without a full blockchain node. Following is a wallet app that demonstrates the way to use it.

Release notes are here.

 

Features

  • Encoding/decoding addresses: base58, Cashaddr, P2PKH, P2SH, WIF format.
  • Transaction building blocks: inputs, outputs, scripts.
  • EC keys and signatures.
  • BIP32, BIP44 hierarchical deterministic wallets.
  • BIP39 implementation.
  • SPV features are under construction. The following functions cannot work well sometimes.
    • Send/receive transactions.
    • See current balance in a wallet.

Requirements

  • iOS 9.0+ / Mac OS X 10.11+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 10.0+
  • Swift 5.0+

Installation

CocoaPods

$ gem install cocoapods

CocoaPods 1.5.0+ is required to build BitcoinKit.

To integrate BitcoinKit into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '13.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'BitcoinKit', '~> 1.1.0'
end

Then, run the following command:

$ pod install

Carthage

Add this to Cartfile

github "yenom/BitcoinKit" ~> 1.1.0

Run carthage update to build the framework and drag the built BitcoinKit.framework into your Xcode project.

Swift Package Manager

Simply add the following lines to dependencies of your Package.swift:

.package(url: "https://github.com/yenom/BitcoinKit.git", .upToNextMinor(from: "1.1.0"))

Note that following data types and features are currently not supported on Linux platform.

  • Peer and PeerGroup
  • SQLite based BlockStore

Contribute

Contributions to BitcoinKit are welcome and encouraged! Feel free to open issues, drop us pull requests.

Authors & Maintainers

About

BitcoinKit is maintained and funded by Yenom. Visit our website or say hi on twitter (@Yenom_wallet_en)

License

BitcoinKit is available under the MIT license. See the LICENSE file for more info.

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

Github

link
Stars: 697

Used By

Total: 0

Releases

Ver.1.1.0 - 2019-09-29 11:56:36

⬆️ Swift 5.0

Now we support Swift5.0!

⭐️ New Features

  • Plan, Build and Sign a transaction #228
  • QRCode support #158
  • ECPoint multiplication methods #219

♻️ Refactor

  • Mnemonic #227
  • HDWallet #228
  • Address #232

🐛 Fix bugs

  • Key derivation bug #220

And more...!

  • Add merkleblock and proof of work check #170 #153
  • Add BlockMessage.computeMerkleRoot() #215
  • Using secp256k1 library instead of openssl #218 #203
  • Fix typos #179
  • Modify README #180 #208 #211

✅ All Merged PRs

All PRs since v1.0.2

  • #158
  • #159
  • #161
  • #167
  • #169
  • #171
  • #173
  • #211
  • #208
  • #179
  • #168
  • #215
  • #170
  • #218
  • #219
  • #220
  • #220
  • #222
  • #223
  • #226
  • #227
  • #228
  • #229
  • #232

v1.1.0 (Release Candidate 2) - 2019-09-23 15:54:03

v1.1.0 (Release Candidate 1) - 2019-09-21 15:29:33

v1.1.0-beta5 - 2019-09-13 08:09:42

Swift5.0

v1.1.0-beta4 - 2019-09-12 18:20:26

v1.1.0-beta3 - 2018-09-27 01:01:07

  • Update properties name and access modifiers of MDKeychain

v1.1.0-beta2 - 2018-09-21 07:05:44

  • Refactor MockUnlockScriptBuilder

v1.1.0-beta1 - 2018-09-20 06:34:28

Wallet class become super convenient class! You can create wallet application with only 10 lines.

  • Binary build is available now!
  • Wallet class is super convenience
  • Generating QRCode is super easy now. PrivateKey, PublicKey, Address has .qrImage()

Easiest way of receiving and sending Bitcoin ever.

// 1. Create Private Key, Publick Key, Address
let privkey: PrivateKey = PrivateKey(network: .mainnet)
let pubkey: PublicKey = privkey.publicKey()
let address: Cashaddr = pubkey.toCashaddr()
let qrImage: UIImage? = address.qrImage(size: CGSize(width: 240, height: 240))

// 2. Create Wallet, Get balance, Refresh balance
let wallet: Wallet = Wallet(privateKey: privkey,
                            walletDataStore: UserDefaults.standard)
let balance = wallet.balance
wallet.reloadBalance()

// 3. Send Bitcoin
let toAddress = try! AddressFactory.create("bitcoincash:qz936smm809wq0eqthqyh2sgdzhs7v08nvnuq0dmps")
wallet.send(to: toAddress, amount: 10000)

v1.0.2 - 2018-09-06 02:33:59

Thanks everyone involved!

  • Added Multisig Script Mock!
  • Added isCoinbase() in Transaction class by @federicobond
  • Fix some typo by @federicobond
  • Add HeadersMessage by @akifuj
  • Add open collective committers and backers by @monkeywithacupcake

v1.0.1 - 2018-08-17 14:46:00

Added ScriptFactory!

v1.0.0 - 2018-08-17 02:48:41

First major release v1.0.0!

v0.1.2 - 2018-02-10 20:39:38

Breaking
  • None.
Enhancements
  • None.
Bug Fixes
  • Hide OpenSSL headers in private module. No longer needed to add header search paths in a user project.
    #20

v0.1.1 - 2018-02-06 13:56:59

Breaking
  • None.
Enhancements
  • Extend supported lower iOS version to 8.0
  • Support CocoaPods

v0.1.0 - 2018-02-06 13:18:46

First release!