Modern Swift implementations of BIP39, BIP32, and BIP44

Related tags

Blockchain WalletKit
Overview

PLEASE NOTE!

This is fork from KevinVitale/WalletKit

Due to SPM (Swift package manager) and github restrictions it's impossible to add original KevinVitale wallet as dependency to SPM in XCode. That's why below repos had been created to make it work:

Adding WalletKit as a Dependency

To use the WalletKit library in a Swift Package Manager (SPM) project, add the following line to the dependencies in you Package.swift file:

.package(url: "https://github.com/astrokin/WalletKit", branch: "main"),

The WalletKit library is under active development, and while attempts are made to maintain source-stability, this is not guaranteed between minor versions. You may specify .upToNextMinor(from:), instead of from(_:), if you need to be at a specific version.

Platforms

  • macOS, v10.15+;
  • iOS, v13+;
  • Linux

CLI Utility

This CLI utility is cross-platform, and demonstrates a portion of this framework's functionality.

Usage

import WalletKit

let wallet  = try Mnemonic().createWallet()
let account = try wallet.account(coinType: .ETH, atIndex: 0)

// 'Normal' addresses...
account[.normal(0..<10)].forEach { 
    print($0.address)
}

// 'Hardened' addresses...
account[.hardened(0..<10)].forEach { 
    print($0.address)
}

Examples

let mnemonic = try Mnemonic()
  print(mnemonic.phrase)

  let accounts = try mnemonic.createWallet().account(coinType: .ETH, atIndex: 0)
  accounts[.hardened(0..<10)].enumerated().forEach { (index, account) in
    let address = account.address
    let privateKey = "0x" + account.privateKey.key.dropFirst().hexString
    
    print("[idx: \(index)]", address, privateKey)
  }
}

// Console output
<24-word seed phrase>
[idx: 0] 0x95e18dd2115c49651a5195cdaed1e4589d9a882d 0x...privatekey...
[idx: 1] 0x70c52be490029822278eecf2d9e4324c6e0505b8 0x...privatekey...
[idx: 2] 0x11194b63c701ba9612d8b4c29e9d34127160043c 0x...privatekey...
[idx: 3] 0x90ec34dd860c4e2876ea3e2ce3f7362d6ef9c8b5 0x...privatekey...
[idx: 4] 0x3a0a814ad24e703aae2b1acb2211dba4dab7330f 0x...privatekey...
[idx: 5] 0x9cc103ff117e604fbf5fee3d4b90b2646576190f 0x...privatekey...
[idx: 6] 0x263c0757284090a3ceec27243d483399bbc0a570 0x...privatekey...
[idx: 7] 0x645b93bda895c130451b5e20341130665f693c53 0x...privatekey...
[idx: 8] 0x14b6fdfdbe37fbcd6a2e4a6f85a303bcc8327552 0x...privatekey...
[idx: 9] 0xffd4e7a268a8cf75f4215f06a8ebc049195c1b4e 0x...privatekey...

Command-Line Interface

USAGE: cli [--seed-phrase <seed-phrase>] [--passphrase <passphrase>]

OPTIONS:
  -s, --seed-phrase <seed-phrase>
                          A specific mnemonic seed phrase used to create the wallet. 
  -p, --passphrase <passphrase>
                          An optional passphrase for improving entropy. 
  -h, --help              Show help information.
You might also like...
A pure swift Ethereum Web3 library

⚗️ Web3 Web3.swift is a Swift library for signing transactions and interacting with Smart Contracts in the Ethereum Network. It allows you to connect

EthereumKit is a free, open-source Swift framework for easily interacting with the Ethereum.
EthereumKit is a free, open-source Swift framework for easily interacting with the Ethereum.

EthereumKit is a Swift framework that enables you to create Ethereum wallet and use it in your app. // BIP39: Generate seed and mnemonic sentence. le

Bitcoin protocol toolkit for Swift
Bitcoin protocol toolkit for Swift

Welcome to BitcoinKit The BitcoinKit library is a Swift implementation of the Bitcoin protocol which support both BCH and BTC. Improving the mobile ec

This library provides convenient way to use Coinpaprika.com API in Swift.

Coinpaprika API Swift Client Documentation | Repository | Installation Usage This library provides convenient way to use Coinpaprika.com API in Swift.

A simple Proof-of-Work Blockchain built in Swift

Blockchain in Swift A simple Proof-of-Work Blockchain built in Swift. Requirements Xcode 13.0 Swift 5.2 Vapor 4.49 Swift NIO 2.33.0 Getting started Cl

IOTA wallet.rs Swift binding

IOTA wallet.rs Swift Binding Swift binding for the official wallet.rs Rust library for IOTA Ledger. The Swift binding links and communicates with the

Web3keystore - Ethereum keystore logic, in Swift

web3keystore A module for creating and interacting with Ethereum keystores. Hand

A swift utility to resolve Ethereum Domain Names.

ENSKit A swift utility to resolve Ethereum Domain Names per EIP-137. Examples Initializing: // Use default options with Cloudflare Ethereum Gateway le

Swift UI component - Stories instagram, slideshow, crypto wallet intro
Swift UI component - Stories instagram, slideshow, crypto wallet intro

SwiftUI and Combine - Stories intro multi-platform widget Features Long tap - pause stories showcase Tap - next story Leeway - pause before start stor

Owner
Alexey Strokin
Proactive Software Engineer with great experience in mobile applications development
Alexey Strokin
Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.

You can ask for help in our Discord Channel web3swift Swift implementation of web3.js functionality ⚡ Interaction with remote node via JSON RPC ?? Sma

BANKEX - Proof-of-Asset Protocol 487 Mar 25, 2022
Full Bitcoin library for iOS, implemented on Swift. SPV wallet implementation for Bitcoin, Bitcoin Cash and Dash blockchains.

BitcoinKit-iOS Bitcoin, BitcoinCash(ABC) and Dash wallet toolkit for Swift. This is a full implementation of SPV node including wallet creation/restor

Horizontal Systems 231 Dec 2, 2022
BitcoinCore for Bitcoin, BitcoinCash(ABC), Litecoin and Dash wallet toolkit for Swift.

BitcoinCore for Bitcoin, BitcoinCash(ABC), Litecoin and Dash wallet toolkit for Swift. This is a full implementation of SPV node including wallet creation/restore, synchronization with network, send/receive transactions, and more.

Horizontal Systems 4 Nov 23, 2022
Kukai Crypto Swift is a native Swift library for creating regular or HD wallets for the Tezos blockchain

Kukai Crypto Swift Kukai Crypto Swift is a native Swift library for creating regular and HD key pairs for the Tezos blockchain. Supporting both TZ1 (E

Kukai Wallet 2 Aug 18, 2022
Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Introduction EtherWalletKit is an Ethereum Wallet Toolkit for iOS. I hope cryptocurrency and decentralized token economy become more widely adapted. H

Sung Woo Chang 136 Dec 25, 2022
Multi-wallet for Bitcoin, Ethereum, Binance Smart Chain and other emerging blockchains

Multi-wallet for Bitcoin, Ethereum, Binance Smart Chain and other emerging blockchains. Non-custodial storage, decentralized exchange, and extensive analytics for thousands of tokens and NFTs. Implemented on Swift.

Horizontal Systems 446 Jan 3, 2023
Trust - Ethereum Wallet and Web3 DApp Browser for iOS

Trust - Ethereum Wallet and Web3 DApp Browser for iOS Welcome to Trust's open source iOS app! Getting Started Download the Xcode 9 release. Clone this

Trust Wallet 1.4k Dec 31, 2022
Fearless Wallet - a mobile wallet designed for the decentralized future on the Kusama and Polkadot networks

Fearless Wallet is a mobile wallet designed for the decentralized future on the Kusama and Polkadot network, with support on iOS and Android platforms. The best user experience, fast performance, and secure storage for your accounts. Development of Fearless Wallet is supported by Kusama Treasury grant.

ソラミツ 68 Dec 14, 2022
Swiftlint, SwiftGen and Sourcery for your SPM package

BuildSystemPlugins This plugin assumes you have the same architecture proposed in here as a base. As an example for this implementation you can check

Karim Alweheshy 10 Sep 29, 2022
A highly experimental, self-custody Lightning wallet built to work for iOS and macOS.

Surge Surge is a highly experimental, self-custody Lightning wallet built to work for iOS and macOS. Motivation Tools and infrastructure for running a

Jurvis Tan 2 Oct 26, 2022