Hyperledger Sawtooth is an enterprise solution for building, deploying, and running distributed ledgers (also called blockchains). It provides an extremely modular and flexible platform for implementing transaction-based updates to shared state between untrusted parties coordinated by consensus algorithms.
The Sawtooth Swift SDK provides a number of useful components that simplify developing Swift applications which interface with the Sawtooth platform.
The Swift SDK's SawtoothSigning module can be imported to a Cocoa/Cocoa Touch project via Carthage, a dependency manager for Cocoa applications.
-
Install Carthage using these installation instructions.
-
Create a Cartfile in the same directory where your
.xcodeproj
or.xcworkspace
is. -
In the Cartfile for your project, add:
github "hyperledger/sawtooth-sdk-swift" "master"
- Run
carthage update
After the framework is downloaded and built, it can be found at
path/to/your/project/Carthage/Build/<platform>/SawtoothSigning.framework
-
Add the built .framework binaries to the Embedded Binaries and Linked Frameworks and Libraries sections in your Xcode project.
pod 'SawtoothSigning'
- Generate private/public key pairs
- Sign transactions
- Verify signatures
import SawtoothSigning
let context = Secp256k1Context()
let privateKey = context.newRandomPrivateKey()
let signer = Signer(context: context, privateKey: privateKey)
let signature = signer.sign(data: message_bytes)
context.verify(signature: signature, data: message_bytes,
publicKey: signer.getPublicKey())
For full usage information, please refer to the Swift SDK documentation included in this repository.
To generate the Swift SDK documentation from source:
- Install sphinx.
pip install -U Sphinx
- Install the sphinx theme used by the Sawtooth documentation using pip.
pip install sphinx_rtd_theme
- In the
sawtooth-sdk-swift/docs
directory run
make html
Sphinx generates the documentation and puts it in the folder
sawtooth-sdk-swift/docs/_build
.
- To open the index file, run
open _build/html/index.html
For more information, please see the Hyperledger Sawtooth documentation, especially the Application Developer's Guide.
Hyperledger Sawtooth software is licensed under the Apache License Version 2.0 software license.