Swift bindings for libbitcoin.
On January 25, 2019 I published an announcement for this framework on my blog here.
-
Swift 5.1
-
Xcode 11.3
-
The
Bitcoin
framework depends on the CBitcoin framework, which includes a pre-made build of libbitcoin. To properly install this, you need to first install the latest version of Git and the Git Large File Storage handler:
$ brew install git
$ brew install git-lfs
$ which git
/usr/local/bin/git
$ git --version
git version 2.21.0
Bitcoin
no longer supports building via Cocoapods, but since it depends on the CBitcoin
framework, which in turn embeds several third-party pre-built binary frameworks (libbitcoin etc.) it is also not suitable for distribution via the Swift Package Manager at this time. So for now, it is built directly as an Xcode project.
The Bitcoin and CBitcoin project directories should be siblings in the same directory:
MyProjects
|
+—— CBitcoin
| |
| +—— CBitcoin.xcodeproj
|
+—— Bitcoin
|
+—— Bitcoin.xcworkspace
$ cd MyProjects
$ git clone https://github.com/BlockchainCommons/iOS-CBitcoin.git CBitcoin
$ git clone https://github.com/BlockchainCommons/iOS-Bitcoin.git Bitcoin
$ cd CBitcoin/Sources
$ unzip -q Frameworks.zip
$ cd ../../Bitcoin
$ open Bitcoin.xcworkspace/
Bitcoin.xcworkspace
and not Bitcoin.xcodeproj
.
Within Xcode:
- Wait for the required Swift Packages to resolve
- Build the
Bitcoin
target for an available platform.
The BitcoinDemo
app is simply an iOS container for the test suite. To run the unit tests, select the BitcoinDemo
target and then Product > Test
.
Wolf McNally, [email protected]
Bitcoin is available under the Apache 2 license. See the LICENSE file for more info.
- Added master key component to hdAccountPrivateKeyDerivationPath()
- Improvements to BIP32Path to support Master key component.
- Derivations now have a
path
attribute that retrieves the BIP32Path associated with the derivation.
- Bech32 and TxRef functionality now support original Bech32 and Bech32Bis.