We just released web3swift 2.0 check it out
also check our Discord Channel
- Swift implementation of web3.js functionality :zap:
- Interaction with remote node via JSON RPC :thought_balloon:
- Smart-contract ABI parsing :book:
- ABI deconding (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)
- RLP encoding
- Interactions (read/write to Smart contracts) :arrows_counterclockwise:
- Local keystore management (geth compatible)
- Literally following the standards:
- BIP32 HD Wallets: Deterministic Wallet
- BIP39 (Seed phrases)
- BIP44 (Key generation prefixes)
- EIP-155 (Replay attacks protection) enforced!
Web3swift requires Swift 4.2 and deploys to
watchOS 2 and
tvOS 9 and
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.
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(url: "https://github.com/BANKEX/web3swift.git", from: "2.0.0")
CocoaPods: Put this in your
pod 'web3swift', :git => 'https://github.com/bankex/web3swift.git'
Carthage: Put this in your
github "BANKEX/web3swift" ~> 2.0
Most of the classes are documented and have some examples on how to use it.
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.
Check this out
- 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
- 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
Here it is
Transaction Nonce: 35 Gas price: 5000000000 Gas limit: 21000 To: 0x6394b37Cf80A7358b38068f0CA4760ad49983a1B Value: 1000000000000000 Data: 0x v: 43 r: 73059897783840535708732471549376620878882680550447969052675399628060606060727 s: 12280625377431973240236065453692843538037349746280474092545114784968542260859 Intrinsic chainID: Optional(4) Infered chainID: Optional(4) sender: Optional(web3swift.Address(_address: "0x855adf524273c14b7260a188af0ae30e82e91959")) ["id": 1514485925, "result": 0xc6eca60ecac004a1501a4323a10edb7fa4cd1a0896675f6b51704c84dedad056, "jsonrpc": 2.0] On Rinkeby TXid = 0xc6eca60ecac004a1501a4323a10edb7fa4cd1a0896675f6b51704c84dedad056
You can try it yourself by running the example project:
- Clone the repo
pod installfrom the
- if you *need help*, use Stack Overflow (tag ‘web3swift’)
- If you’d like to *ask a general question*, use Stack Overflow.
- If you *found a bug*, open an issue.
- If you *have a feature request*, open an issue.
- If you *want to contribute*, submit a pull request.
- [x] Create Account
- [x] Import Account
- [x] Sign transactions
- [x] Send transactions, call functions of smart-contracts, estimate gas costs
- [x] Serialize and deserialize transactions and results to native Swift types
- [x] Convenience functions for chain state: block number, gas price
- [x] Check transaction results and get receipt
- [x] Parse event logs for transaction
- [x] Manage user’s private keys through encrypted keystore abstractions
- [x] Batched requests in concurrent mode, checks balances of 580 tokens (from the latest MyEtherWallet repo) over 3 seconds
- Full reference
- Light Ethereum subprotocol (LES) integration
If you’ve used this project in a live app, please let us know!
If you are using
web3swiftin your app or know of an app that uses it, please add it to this list.*
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
For the latest version, please check develop branch.
Changes made to this branch will be merged into the master branch at some point.
- If you want to contribute, submit a pull request against a development
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
web3swift is available under the Apache License 2.0 license. See the LICENSE file for more info.