Ethereum Wallet Toolkit for iOS - You can implement an Ethereum wallet without a server and blockchain knowledge.

Overview

EtherWalletKit

Swift Xcode License: MIT iOS

Introduction

EtherWalletKit is an Ethereum Wallet Toolkit for iOS.

I hope cryptocurrency and decentralized token economy become more widely adapted. However, some developers hesitate to add a crypto wallet on apps since blockchain and cryptocurrency are complex and require many new knowledge.

Don't worry.
With EtherWalletKit, you can implement an Ethereum wallet without a server and blockchain knowledge.

Features

Released Features

  • Creating/Importing an account(address and private key)
  • Checking Ether and tokens balance
  • Sending Ether and tokens to other addresses
  • Browsing token information
  • Testnet(Rinkeby & Ropsten) support
  • BIP39 Mnemonics

Planned Features

  • Browsing transaction history
  • Keystore import / export
  • Custom configuration / advanced transactions
  • Multiple accounts
  • Third party APIs
  • ERC-721 supports

Installation

CocoaPods

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

pod 'EtherWalletKit'

Quick Start

0. Don't forget to import it

import EtherWalletKit

1. Create an Ethereum Wallet

// Generate a new account with its new password.
try? EtherWallet.account.generateAccount(password: "ABCDEFG")

// Import an existing account from its private key and set its new password.
try? EtherWallet.account.importAccount(privateKey: "1dcbc1d6e0a4587a3a9095984cf051a1bc6ed975f15380a0ac97f01c0c045062, password: "ABCDEFG")

Note: password will be encrypted and saved to the device and it will be required to access the wallet.

2. Get balance

// Get balance of Ether
EtherWallet.balance.etherBalance { balance in
    print(balance)
}

// Get balance of a token
EtherWallet.balance.tokenBalance(contractAddress: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07") { balance in
    print(balance)
}

3. Send

// send Ether to an address.
EtherWallet.transaction.sendEther(to: "0x7777787C97a35d37Db8E5afb0C92BCfd4F6480bE", amount: "1.5", password: "ABCDEFG") { txHash in
    print(txHash)
}

// send a token to an address.
EtherWallet.transaction.sendToken(to: "0x7777787C97a35d37Db8E5afb0C92BCfd4F6480bE", contractAddress: "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07", amount: "20", password: "ABCDEFG", decimal: 18) { txHash in
    print(txHash)
}

Note: password should be eqaul to the password of wallet created. Also you can put gasPrice as an extra parameter to set gas price for the transcation.

For full documentation, please see THIS.

Notes

  • Nothing will be sent to a server. Everything will be worked on the local device and Ethereum Blockchain.
  • You dont need to download and sync the nodes because Infura is doing it for you.
  • password for wallet is equal to the password for the keystore file. Always make sure a password is long enough for security.

Contribution

  • Make sure you have a GitHub account
  • Create a GitHub pull request for your contribution
    • Clearly describe the issue or feature.
  • Fork the repository on GitHub
  • Create a topic branch from where you want to base your work. (Gitflow is welcome)
    • Please avoid working directly on the master branch.
  • Make sure you have added the necessary tests for your changes and make sure all tests pass.

Donation

Only accept cryptocurrency 😂

ETH: 0x7777787C97a35d37Db8E5afb0C92BCfd4F6480bE

License

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

You might also like...
Headline News Widget for Pock.You can display the articles fetched by rss.
Headline News Widget for Pock.You can display the articles fetched by rss.

Headline News Widget for Pock This is a headline news widget plugin for Pock You can display the articles fetched by rss. Demo In the demo video, the

Utility to run the SPI-Server tests as a benchmark

spi-benchmark This package comprises a simple tool to run the SwiftPackageIndex-Server tests in a loop, logging the run times. The purpose is to colle

swift-highlight a pure-Swift data structure library designed for server applications that need to store a lot of styled text

swift-highlight is a pure-Swift data structure library designed for server applications that need to store a lot of styled text. The Highlight module is memory-efficient and uses slab allocations and small-string optimizations to pack large amounts of styled text into a small amount of memory, while still supporting efficient traversal through the Sequence protocol.

Swift Server Implementation - RESTful APIs, AWS Lambda Serverless For Swift Runtime amazonlinux: AWS Lambda + API Gateway
Swift Server Implementation - RESTful APIs, AWS Lambda Serverless For Swift Runtime amazonlinux: AWS Lambda + API Gateway

Swift Server Implementation - RESTful APIs, AWS Lambda Serverless For Swift Runtime amazonlinux: AWS Lambda + API Gateway deployed on Graviton arm64 build swift:5.6.2-amazonlinux2-docker image

The Objective-C block utilities you always wish you had.

BlocksKit Blocks in C and Objective-C are downright magical. They make coding easier and potentially quicker, not to mention faster on the front end w

A NEWS app which can be used to read,share and bookmark articles of various categories
A NEWS app which can be used to read,share and bookmark articles of various categories

Scoop A NEWS App for iOS 14 built using Swift which allow the users to read,bookmark and share news articles. Built using MVC architecture Requirement

A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar.

bose-macos-utility A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar. Why Have you e

An application where users can simulate trading stocks with a starting balance of fake money.
An application where users can simulate trading stocks with a starting balance of fake money.

Eighth Wonder Finance Table of Contents Overview Product Spec Video Walkthrough Wireframes Schema Overview Description An application where users can

MediaType is a library that can be used to create Media Types in a type-safe manner.

This is a general purpose Swift library for a concept of typed treatment for Media Types. We use this library on clients and servers to speak the same dialect and to enjoy all the comfort strong types provide over raw strings.

Comments
  • 如何使用助记词

    如何使用助记词

    在web3swift中可以使用

    let keystore = try! BIP32Keystore(seed: seed, password: "")
    

    我不知道在EtherWalletKit中该如何使用助记词进行创建 是否需要在EtherWallet+Account.swift添加

       public func generateMmemonics(mmemonics: String, password: String) throws {
            
            guard let seed = BIP39.seedFromMmemonics(mmemonics, password: password) else {
                throw WalletError.toSeedFailure
            }
            let keystore = try BIP32Keystore(seed: seed)
            let keystoreManager = KeystoreManager([keystore!])
            guard let keystoreV3 = keystoreManager.keystores.first else {
                throw WalletError.malformedKeystore
            }
            try saveKeystore(keystoreV3)
        }
    
    opened by fengmingdev 4
  • Error

    Error "Cannot load module 'web3swift' as 'Web3swift'"

    I am having this error on Xcode 13.0 in EtherWallet.swift and the 'EtherWalletKit' pod version is 0.1.4

    Screenshot 2022-03-14 at 12 43 46 PM

    Screenshot 2022-03-14 at 12 42 35 PM

    When I updated web3swift instead of Web3swift then got another issue is "No such module 'EthereumAddress'".

    Screenshot 2022-03-14 at 12 43 24 PM

    Please give me suggestions regarding this issue.

    opened by priyankgandhi0 1
  • Support Infura V3

    Support Infura V3

    Great repo !

    Infura no longer supports the old API, now we have to access through https://mainnet.infura.io/v3/<PROJECT_ID>

    I updated the project accordingly with the following pieces of code and my Project ID obtained through Infura dashboard:

    EtherWallet.swift private let web3Main = Web3.InfuraMainnetWeb3("<PROJECT ID>")

    Web3.swift (unchanged)

    public static func InfuraMainnetWeb3(accessToken: String? = nil) -> web3 {
            let infura = InfuraProvider(Networks.Mainnet, accessToken: accessToken)!
            return web3(provider: infura)
        }
    

    Web3+Infura.swift

    public class InfuraProvider: Web3HttpProvider {
        public init?(_ net:Networks, accessToken token: String? = nil, keystoreManager manager: KeystoreManager? = nil) {
            var requestURLstring = "https://" + net.name + ".infura.io/v3/"
            if token != nil {
                requestURLstring = requestURLstring + token!
            }
            let providerURL = URL(string: requestURLstring)
            super.init(providerURL!, network: net, keystoreManager: manager)
        }
    ...
    }
    

    Requesting the balance with EtherWallet.balance throws the following error.

    EtherWalletTest[3957:62791] CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
        class = inet;
        "m_Limit" = "m_LimitAll";
        ptcl = htps;
        "r_Attributes" = 1;
        sdmn = "Project ID is required in the URL";
        srvr = "mainnet.infura.io";
        sync = syna;
    }
    

    It seems that the project ID is missing in the call, but printing requestURLstring shows the correct URL with the access token.

    opened by romain64 0
Owner
Sung Woo Chang
iOS Engineer @DoorDash
Sung Woo Chang
Prototype actor and async/await toolkit for Swift 5.5+

Prototype actor and async/await toolkit for Swift 5.5+

d-exclaimation 0 Feb 17, 2022
Readium Mobile is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin.

Readium Swift Toolkit Readium Mobile is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin. This toolkit is a modular project, whic

Readium 89 Dec 30, 2022
Pavel Surový 0 Jan 1, 2022
Tweak your iOS app without recompiling!

SwiftTweaks Adjust your iOS app on the fly without waiting to re-compile! Your users won’t see your animation study, Sketch comps, or prototypes. What

Khan Academy 1.4k Dec 28, 2022
Tweak your iOS app without recompiling!

SwiftTweaks Adjust your iOS app on the fly without waiting to re-compile! Your users won’t see your animation study, Sketch comps, or prototypes. What

Khan Academy 1.4k Dec 28, 2022
👷‍♀️ Closure-based delegation without memory leaks

Delegated 2.0 Delegated is a super small package that helps you avoid retain cycles when using closure-based delegation. New Medium post here. Origina

Oleg Dreyman 703 Oct 8, 2022
Swift code to programmatically execute local or hosted JXA payloads without using the on-disk osascript binary

Swift code to programmatically execute local or hosted JXA payloads without using the on-disk osascript binary. This is helpful when you have Terminal access to a macOS host and want to launch a JXA .js payload without using on-disk osascript commands.

Cedric Owens 20 Sep 27, 2022
Project shows how to unit test asynchronous API calls in Swift using Mocking without using any 3rd party software

UnitTestingNetworkCalls-Swift Project shows how to unit test asynchronous API ca

Gary M 0 May 6, 2022
Weather and forecasts for humans. Information you can act on.

Tropos Weather and forecasts for humans. Information you can act on. Most weather apps throw a lot of information at you but that doesn't answer the q

thoughtbot, inc. 1.5k Dec 28, 2022
LifetimeTracker can surface retain cycle / memory issues right as you develop your application

LifetimeTracker Bar style Circular style LifetimeTracker can surface retain cycle / memory issues right as you develop your application, and it will s

Krzysztof Zabłocki 2.8k Jan 4, 2023