Elegant Web3js functionality in Swift. Native ABI parsing and smart contract interactions on Ethereum network.

Overview

You can ask for help in our Discord Channel

Support Stackoverflow Apps using web3swift

bkx-foundation-github-swift

Swift 4.2 Compatible Platforms iOS | macOS Compatible

web3swift

  • Swift implementation of web3.js functionality ⚑
  • Interaction with remote node via JSON RPC πŸ’­
  • Smart-contract ABI parsing πŸ“–
  • Local keystore management (geth compatible)
  • Private key and transaction were created directly on an iOS device and sent directly to Infura node
  • Native API
  • Security (as cool as a hard wallet! Right out-of-the-box! :box: )
  • No unnecessary dependencies
  • Possibility to work with all existing smart contracts
  • Referencing the newest features introduced in Solidity

Features

  • Create Account
  • Import Account
  • Sign transactions
  • Send transactions, call functions of smart-contracts, estimate gas costs
  • Serialize and deserialize transactions and results to native Swift types
  • Convenience functions for chain state: block number, gas price
  • Check transaction results and get receipt
  • Parse event logs for transaction
  • Manage user's private keys through encrypted keystore abstractions
  • Batched requests in concurrent mode, checks balances of 580 tokens (from the latest MyEtherWallet repo) over 3 seconds
  • Literally following the standards:

BIP32 BIP39 BIP44 EIP 20 EIP 67 EIP 155 EIP 681 EIP 721 EIP 777 EIP 888

Requirements

Web3swift requires Swift 4.2 and deploys to macOS 10.10, iOS 9, watchOS 2 and tvOS 9 and linux.

Don't forget to set the iOS version in a Podfile, otherwise you get an error if the deployment target is less than the latest SDK.

Installation

  • Swift Package Manager: Although the Package Manager is still in its infancy, web3swift provides full support for it. Add this to the dependency section of your Package.swift manifest:

    .package(url: "https://github.com/BANKEX/web3swift.git", from: "2.1.0")
  • CocoaPods: Put this in your Podfile:

    pod 'web3swift.pod'
  • Carthage: Put this in your Cartfile:

    github "BANKEX/web3swift" ~> 2.1
    

Documentation

Hi. We spend a lot of time working on documentation. If you have some questions after reading it just open an issue or ask in our discord channel. We would be happy to help you.

Most of the classes are documented and have some examples on how to use it.

Read documentation in using Xcode

Github Pages

We would appreciate it if you translate our documentation into another language, and will be happy to provide you with all the necessary information on how to do this. We will compensate you for translations that will be included in the master branch.

Design decisions

  • Not every JSON RPC function is exposed yet, priority is given to the ones required for mobile devices
  • Functionality was focused on serializing and signing transactions locally on the device to send raw transactions to Ethereum network
  • Requirements for password input on every transaction are indeed a design decision. Interface designers can save user passwords with the user's consent
  • Public function for private key export is exposed for user convenience, but marked as UNSAFE_ :) Normal workflow takes care of EIP155 compatibility and proper clearing of private key data from memory

Contribution

For the latest version, please check develop branch.

Changes made to this branch will be merged into the master branch at some point.

Special thanks to

  • Gnosis team and their library Bivrost-swift for inspiration for the ABI decoding approach
  • Trust iOS Wallet for the collaboration and discussion of the initial idea
  • Official Ethereum and Solidity docs, everything was written from ground truth standards

Donate

0x47FC2e245b983A92EB3359F06E31F34B107B6EF6
You might also like...
An open-source Ethereum wallet built with SwiftUI

lil wallet welcome to lil wallet. it's an open-source Ethereum wallet built with SwiftUI there are two main views - coins and objects. coins are your

AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS
AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS

AlphaWallet - Advanced, Open Source Ethereum Mobile Wallet & dApp Browser for iOS

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

CryptoSwift - Crypto related functions and helpers for Swift implemented in Swift
CryptoSwift - Crypto related functions and helpers for Swift implemented in Swift

CryptoSwift Crypto related functions and helpers for Swift implemented in Swift.

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

Modern Swift implementations of BIP39, BIP32, and BIP44
Modern Swift implementations of BIP39, BIP32, and BIP44

PLEASE NOTE! This is fork from KevinVitale/WalletKit Due to SPM (Swift package manager) and github restrictions it's impossible to add original KevinV

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.

Fearless Wallet - a mobile wallet designed for the decentralized future on the Kusama and Polkadot networks
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.

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

Releases(2.1.10)
  • 2.1.6(Jan 21, 2019)

  • 2.1.5(Jan 8, 2019)

    W3 classes now automatically casts to swift classes in transaction arguments Added SolidityFunction support Added hex string to data and data to hex string functions Added W3UInt init with decimals You can now easily add accounts with mnemonics and private key using [web3 addAccountWithMnemonics:password:] and [web3 addAccountWithPrivateKey:password:]

    Source code(tar.gz)
    Source code(zip)
  • 2.1(Dec 3, 2018)

    Now we are using CommonCrypto instead of CryptoSwift Optimized mnemonics generation (10 times faster) Added PrivateKey and Signature classes

    Performance

    Operations per second in debug and release build mode

    Before -> After

    Encryption

    HDNode:
     release x1.17      debug x3.38
     16670 -> 19666     1421 -> 4816
     
     HDNode-auth:
     release x6.0       debug x265
     133883 -> 809534   2334 -> 619319
     
     KeystoreV3:
     release            debug
     138 -> 141         1.28 -> 1.3013496
     
     BIP32Keystore:
     release x2.8       debug x2.2
     42 -> 120          0.63 -> 1.3975109
     
     Mnemonics generation:
     release x7.7       debug x7.2
     1455 -> 11252      1183 -> 8574
     
     Mnemonics to seed:
     release x11        debug x638
     61 -> 734          1.10 -> 702
    

    KeystoreV3 and BIP32Keystore doesn't changed because they using scrypt do encrypt private key. We want to change all that in 2.2 update so BIP32Keystore will have HDNode performance and KeystoreV3 will have Generate Private key performance

    PrivateKey class

    Operations per second in debug and release build mode

     Generate Private key:
     release            debug
     175772             160180
     
     PrivateKey -> Public Key:
     release            debug
     26642              9036
     
     PrivateKey -> Address:
     release            debug
     11894              2058
    
    Source code(tar.gz)
    Source code(zip)
  • 2.0.9(Nov 29, 2018)

  • 2.0.7(Nov 27, 2018)

  • 2.0.5(Nov 19, 2018)

    Fixed iOS minimum version for Carthage #262 Added some documentation Web3.keystoreManager is not optional now Added append functions to KeystoreManager

    Source code(tar.gz)
    Source code(zip)
  • 2.0.4(Nov 13, 2018)

    SolidityFunction is now a little bit smarter than it was Added some documentation check commits so see more Added ERC888 token Added SecurityToken

    Source code(tar.gz)
    Source code(zip)
  • 2.0.2(Nov 8, 2018)

  • 2.0.1(Nov 2, 2018)

  • 2.0.0(Oct 31, 2018)

    More try less optionals! Added a lot of error explanations Added native support for ERC20, ERC721, ERC777 tokens You can now easily call any solidity function without knowing its abi Added txpool Added macOS, watchOS, tvOS and linux support Added Swift Package Manager support Removed Result framework

    Update now

    • Swift Package Manager .package(url: "https://github.com/BANKEX/web3swift.git", from: "2.0.0")
    • CocoaPods pod 'web3swift', :git => 'https://github.com/bankex/web3swift.git', '~> 2.0'
    • Carthage github "BANKEX/web3swift" ~> 2.0
    Source code(tar.gz)
    Source code(zip)
  • 1.1.6(Oct 3, 2018)

    Added Swift 4.2, Xcode 10 support Added Swift Package Manager and Carthage support Added some cosmetics to the code Removed json file from tests Changed access control of function fromRaw in struct EthereumTransaction

    Source code(tar.gz)
    Source code(zip)
  • 1.1.5(Aug 10, 2018)

  • 1.1.1(Jul 30, 2018)

  • 1.1.0(Jul 27, 2018)

  • 1.0.1(Jul 12, 2018)

  • 1.0.0(Jul 4, 2018)

    1.0.0 release!

    • Get rid of synchronous calls under the hood
    • All previous synchronous API calls are bridged to async internal calls
    • Remove Alamofire from depencencies
    • Huge code cleanup
    • Added block explorer public API provided by BANKEX Scan
    Source code(tar.gz)
    Source code(zip)
  • 0.9.0(Jun 18, 2018)

    Switch to PromiseKit for asynchronous functions Implement few user requested features Gas estimation is now optimistic by default, if no options provided, than use an estimate as the best guess Event parsing now joins event logs and transaction receipts if requested

    Source code(tar.gz)
    Source code(zip)
Owner
BANKEX - Proof-of-Asset Protocol
Proof-of-Asset Protocol β€” bringing bank-as-a-service and blockchain together to transform capital markets
BANKEX - Proof-of-Asset Protocol
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
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
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
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

null 484 Dec 16, 2022
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

Ryo Fukuda 458 Dec 31, 2022
Web3keystore - Ethereum keystore logic, in Swift

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

Brian Wagner 0 Feb 12, 2022
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

null 16 Nov 25, 2022
Smart Wallet - iOS application for managing money

This is an iOS application for managing money written in Swift language. Different reports are presented in the application to help the user managing the money and keeping track of it easily.

Soheil Novinfard 53 Dec 26, 2022
Wei Wallet - Ethereum wallet app for iOS

Wei Wallet - Ethereum wallet app for iOS Getting Started Download the latest Xcode Clone this repository Install Carthage, Cocoapods Run make bootstra

Popshoot, Inc. 277 Nov 17, 2022
Rainbow - 🌈the Ethereum wallet that lives in your pocket

??️ the Ethereum wallet that lives in your pocket! ??️ Available on the iOS App Store. ?? Android Beta available on Google Play Store ??️ Foll

Rainbow 3.2k Jan 3, 2023