{"id":18340407,"url":"https://github.com/dimensiondev/web3swift","last_synced_at":"2025-04-09T20:43:42.588Z","repository":{"id":41180124,"uuid":"460424966","full_name":"DimensionDev/web3swift","owner":"DimensionDev","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-06T10:24:29.000Z","size":56849,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-15T12:52:52.812Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DimensionDev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-17T12:25:09.000Z","updated_at":"2023-04-14T11:52:40.000Z","dependencies_parsed_at":"2023-01-17T22:01:41.859Z","dependency_job_id":null,"html_url":"https://github.com/DimensionDev/web3swift","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2Fweb3swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2Fweb3swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2Fweb3swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DimensionDev%2Fweb3swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DimensionDev","download_url":"https://codeload.github.com/DimensionDev/web3swift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248110618,"owners_count":21049518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T20:22:25.530Z","updated_at":"2025-04-09T20:43:40.472Z","avatar_url":"https://github.com/DimensionDev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# web3swift\n**web3swift** is an iOS toolbelt for interaction with the Ethereum network.\n\n![matter-github-swift](https://github.com/matter-labs/web3swift/blob/develop/web3swift-logo.png)\n[![Build Status](https://travis-ci.com/matter-labs/web3swift.svg?branch=develop)](https://travis-ci.com/matter-labs/web3swift)\n[![Swift](https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat)](https://developer.apple.com/swift/)\n[![Platform](https://img.shields.io/cocoapods/p/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3.swift.pod)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/web3.swift.pod.svg?style=flat)](http://cocoapods.org/pods/web3.swift.pod)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/web3swift.svg?style=flat)](http://cocoapods.org/pods/web3.swift.pod)\n[![support](https://brianmacdonald.github.io/Ethonate/svg/eth-support-blue.svg)](https://brianmacdonald.github.io/Ethonate/address#0xe22b8979739d724343bd002f9f432f5990879901)\n[![Stackoverflow](https://img.shields.io/badge/stackoverflow-ask-blue.svg)](https://stackoverflow.com/questions/tagged/web3swift)\n\n---\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n\n- [Core features](#core-features)\n- [Installation](#installation)\n  - [Example usage](#example-usage)\n      - [Send Ether](#send-ether)\n      - [Send ERC-20 Token](#send-erc-20-token)\n      - [Write Transaction and call smart contract method](#write-transaction-and-call-smart-contract-method)\n  - [Web3View example](#web3view-example)\n  - [Build from source](#build-from-source)\n  - [Requirements](#requirements)\n  - [Migration Guides](#migration-guides)\n- [Documentation](#documentation)\n- [Projects that are using web3swift](#projects-that-are-using-web3swift)\n- [Support](#support)\n- [Contribute](#contribute)\n  - [Future steps](#future-steps)\n- [Credits](#credits)\n- [Security Disclosure](#security-disclosure)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Core features\n\n- [x] :zap: Swift implementation of [web3.js](https://github.com/ethereum/web3.js/) functionality \n- [x] :thought_balloon: Interaction with remote node via **JSON RPC** \n- [x] 🔐 Local **keystore management** (`geth` compatible)\n- [x] 🤖 Smart-contract **ABI parsing** \n- [x] 🔓**ABI deconding** (V2 is supported with return of structures from public functions. Part of 0.4.22 Solidity compiler)\n- [x] 🕸Ethereum Name Service **(ENS) support** - a secure \u0026 decentralised way to address resources both on and off the blockchain using simple, human-readable names\n- [x] :arrows_counterclockwise: **Smart contracts interactions** (read/write) \n- [x]  ⛩ **Infura support**, patial Websockets API support\n- [x] ⚒  **Parsing TxPool** content into native values (ethereum addresses and transactions) - easy to get pending transactions\n- [x] 🖇 **Event loops** functionality\n- [x] 📱Supports Web3View functionality (WKWebView with **injected \"web3\" provider**)\n- [x] 🕵️‍♂️ Possibility to **add or remove \"middleware\" that intercepts**, modifies and even **cancel transaction** workflow on stages \"before assembly\", \"after assembly\"and \"before submission\"\n- [x] ✅**Literally following the standards** (BIP, EIP, etc):\n\n    - [x] **[BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) (HD Wallets), [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) (Seed phrases), [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) (Key generation prefixes)**\n- [x] **[EIP-20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md)** (Standart interface for tokens - ERC-20), **[EIP-67](https://github.com/ethereum/EIPs/issues/67)** (Standard URI scheme), **[EIP-155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md)** (Replay attacks protection)\n    - [x] **And many others** *(For details about this EIP's look at [Documentation page](https://github.com/matter-labs/web3swift/blob/master/Documentation/))*: EIP-681, EIP-721, EIP-165, EIP-777, EIP-820, EIP-888, EIP-1400, EIP-1410, EIP-1594, EIP-1643, EIP-1644, EIP-1633, EIP-721, EIP-1155, EIP-1376, ST-20\n\n- [x] 🗜 **Batched requests** in concurrent mode\n- [x] **RLP encoding**\n- [x] Base58 encoding scheme\n- [x] Formatting to and from Ethereum Units\n- [x] Comprehensive Unit and Integration Test Coverage\n\n## Installation\n\n- CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ sudo gem install cocoapods\n```\n\nTo integrate web3swift into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '9.0'\n\ntarget '\u003cYour Target Name\u003e' do\n    use_frameworks!\n    pod 'web3swift'\nend\n\n```\n\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n- Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](https://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate web3swift into your Xcode project using Carthage, specify it in your `Cartfile`.\nCreate an empty Cartfile with the touch command and open it:\n\n```bash\n$ touch Cartfile\n$ open -a Xcode Cartfile\n```\n\nAdd the following line to the Cartfile and save it:\n\n```ogdl\ngithub \"matter-labs/web3swift\" \"master\"\n```\n\nRun `carthage update` to build the framework. By default, Carthage performs checkouts and creates a new directory 'Carthage' in the same location as your Cartfile. Open this directory, go to 'Build' directory, choose iOS or macOS directory, and use the selected directory framework in your Xcode project.\n\n- Swift Package\nOpen xcode setting and add this repo as a source\n\n### Example usage\n\n\n##### Send Ether\n\n```swift\nlet value: String = \"1.0\" // In Ether\nlet walletAddress = EthereumAddress(wallet.address)! // Your wallet address\nlet toAddress = EthereumAddress(toAddressString)!\nlet contract = web3.contract(Web3.Utils.coldWalletABI, at: toAddress, abiVersion: 2)!\nlet amount = Web3.Utils.parseToBigUInt(value, units: .eth)\nvar options = TransactionOptions.defaultOptions\noptions.value = amount\noptions.from = walletAddress\noptions.gasPrice = .automatic\noptions.gasLimit = .automatic\nlet tx = contract.write(\n    \"fallback\",\n    parameters: [AnyObject](),\n    extraData: Data(),\n    transactionOptions: options)!\n```\n\n##### Send ERC-20 Token\n\n```swift\nlet web3 = Web3.InfuraMainnetWeb3() \nlet value: String = \"1.0\" // In Tokens\nlet walletAddress = EthereumAddress(wallet.address)! // Your wallet address\nlet toAddress = EthereumAddress(toAddressString)!\nlet erc20ContractAddress = EthereumAddress(token.address)!\nlet contract = web3.contract(Web3.Utils.erc20ABI, at: erc20ContractAddress, abiVersion: 2)!\nlet amount = Web3.Utils.parseToBigUInt(value, units: .eth)\nvar options = TransactionOptions.defaultOptions\noptions.value = amount\noptions.from = walletAddress\noptions.gasPrice = .automatic\noptions.gasLimit = .automatic\nlet method = \"transfer\"\nlet tx = contract.write(\n    method,\n    parameters: [toAddress, amount] as [AnyObject],\n    extraData: Data(),\n    transactionOptions: options)!\n```\n\n\n##### Get account balance\n```swift\nlet web3 = Web3.InfuraMainnetWeb3() \nlet address = EthereumAddress(\"\u003cAddress\u003e\")!\nlet balance = try web3.eth.getBalance(address: address)\nlet balanceString = Web3.Utils.formatToEthereumUnits(balance, toUnits: .eth, decimals: 3)\n```\n\n##### Write Transaction and call smart contract method\n\n```swift\nlet web3 = Web3.InfuraMainnetWeb3() \nlet value: String = \"0.0\" // Any amount of Ether you need to send\nlet walletAddress = EthereumAddress(wallet.address)! // Your wallet address\nlet contractMethod = \"SOMECONTRACTMETHOD\" // Contract method you want to write\nlet contractABI = \"...\" // Contract ABI\nlet contractAddress = EthereumAddress(contractAddressString)!\nlet abiVersion = 2 // Contract ABI version\nlet parameters: [AnyObject] = [...]() // Parameters for contract method\nlet extraData: Data = Data() // Extra data for contract method\nlet contract = web3.contract(contractABI, at: contractAddress, abiVersion: abiVersion)!\nlet amount = Web3.Utils.parseToBigUInt(value, units: .eth)\nvar options = TransactionOptions.defaultOptions\noptions.value = amount\noptions.from = walletAddress\noptions.gasPrice = .automatic\noptions.gasLimit = .automatic\nlet tx = contract.write(\n    contractMethod,\n    parameters: parameters,\n    extraData: extraData,\n    transactionOptions: options)!\n```\n\n### Web3View example\n\nYou can see how to our demo project: **WKWebView with injected \"web3\" provider**:\n\n``` bash\ngit clone https://github.com/matter-labs/web3swift.git\ncd web3swift/Example/web3swiftBrowser\npod install\nopen ./web3swiftBrowser.xcworkspace\n```\n\n### Build from source\n\n- Clone repo\n- Instal dependencies via  `./carthage-build.sh --platform iOS` (temp workaround, foe of Carthage bug. [For details please look at](https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323)\n\n### Requirements\n\n- iOS 9.0+ / macOS 10.11+\n- Xcode 10.2+\n- Swift 5.0+\n\n### Migration Guides\n\n- [web3swift 2.0 Migration Guide](https://github.com/matterinc/web3swift/blob/master/Documentation/web3swift%202.0%20Migration%20Guide.md)\n\n## Documentation\n\nFor full documentation details and FAQ, please look at [Documentation](https://github.com/matter-labs/web3swift/blob/master/Documentation/)\n\n*If you need to find or understand an API, check [Usage.md](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md).*\n\n **FAQ moved [Documentation Page](https://github.com/matter-labs/web3swift/blob/master/Documentation/)**\n\nHere are quick references for essential features:\n\n- [Preffered models](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#preffered-models)\n- [Account Management (create, import, private keys managments, etc.)](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#account-management)\n- [Ethereum Endpoints interaction (web3, balance, tx's operations, chain state)](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#ethereum-endpoints-interaction)\n- [Websockets](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#websockets)\n- [ENS](https://github.com/matter-labs/web3swift/blob/master/Documentation/Usage.md#ens)\n\n## Projects that are using web3swift\n\nIf you are using this library in your project, please [add a link](https://github.com/matter-labs/web3swift/edit/develop/README.md) to this repo.\n\n* [MyEtherWallet/MEWconnect-iOS](https://github.com/MyEtherWallet/MEWconnect-iOS)\n* [Peepeth iOS client](https://github.com/matterinc/PeepethClient)\n* [Ethereum \u0026 ERC20Tokens Wallet](https://itunes.apple.com/us/app/ethereum-erc20tokens-wallet/id1386738877?ls=1\u0026mt=8)\n* [Pay-iOS](https://github.com/BANKEX/Pay-iOS)\n* [GeoChain](https://github.com/awallish/GeoChain)\n* [NewHorizonLabs/TRX-Wallet](https://github.com/NewHorizonLabs/TRX-Wallet)\n* [SteadyAction/EtherWalletKit](https://github.com/SteadyAction/EtherWalletKit)\n* [UP Wallet/loopr-ios](https://github.com/Loopring/loopr-ios)\n* [MyENS Wallet](https://github.com/barrasso/enswallet)\n* [LoanStar](https://github.com/barrasso/loan-star)\n* [AlphaWallet](https://github.com/AlphaWallet/alpha-wallet-ios)\n* [Follow_iOS](https://github.com/FollowInc/Follow_iOS)\n* [Biomedical Data Sharing dApp - Geolocation](https://github.com/HD2i/Geolocation-iOS)\n* [Alice Wallet](https://github.com/alicedapp/AliceX)\n* [web3-react-native](https://github.com/cawfree/web3-react-native)\n* [YOUR APP CAN BE THERE (click me)](https://github.com/matter-labs/web3swift/edit/develop/README.md) :wink:\n\n*Nothing makes developers happier than seeing someone else use our work and go wild with it.*\n\n## Support\n\n- If you **need help**, [open an issue](https://github.com/matter-labs/web3swift/issues).\n- If you'd like to **see web3swift best practices**, check [Projects that using web3swift](https://github.com/matter-labs/web3swift#projects-that-using-web3swift).\n- If you **found a bug**, [open an issue](https://github.com/matter-labs/web3swift/issues).\n\n\n## Contribute\n\nWant to improve? It's awesome:\n\nThen good news for you: **We are ready to pay for your contribution via [@gitcoin bot](https://gitcoin.co/grants/358/web3swift)!**\n\n- If you **have a feature request**, [open an issue](https://github.com/matter-labs/web3swift/issues).\n\n- If you **want to contribute**, read [contribution policy](https://github.com/matter-labs/web3swift/blob/master/Documentation/CONTRIBUTION_POLICY.md) \u0026 [submit a pull request](https://github.com/matter-labs/web3swift/pulls).\n\nIf you use any of our libraries for work, see if your employers would be interested in donating. Any amount you can donate today to help us reach our goal would be much appreciated.\n\n[Matter Labs](https://github.com/orgs/matter-labs/people) are charged with open-sourсe and do not require money for using their web3swift lib.\nWe want to continue to do everything we can to move the needle forward.\n\n- **Support us** via [@gitcoin Grant program](https://gitcoin.co/grants/358/web3swift)\n- Ether wallet address: `0x6A3738c6299f45c31697aceA647D49EdCC9C28A4`\n\n\u003cimg src=\"https://raw.githubusercontent.com/matter-labs/web3swift/develop/img/Ether-donations.jpeg\" width=\"300\" /\u003e\n\n### Future steps \n\nYou are more than welcome to participate! **Your contribution will be paid via  [@gitcoin Grant program](https://gitcoin.co/grants/358/web3swift).**\n\n- [ ] **L2 support** (such as [ZkSync](https://zksync.io/))\n\n- [ ] **Modularity** with the basic Web3 subspec/SPM (the most basic functions like transaction signing and interacting with an http rpc server) and other modules with additional functionality\n\n- [ ] Complete Documentation (https://web3swift.github.io/web3swift)\n\n- [ ] Performance Improvements\n\n- [ ] Convenient methods for namespaces\n\n  \n\n## Credits\n\n- Alex Vlasov, [@shamatar](https://github.com/shamatar)\n- Petr Korolev, [@skywinder](https://github.com/skywinder)\n- Anton Grigorev, [@baldyash](https://github.com/BaldyAsh)\n\n## Security Disclosure\n\nIf you believe you have identified a security vulnerability with web3swift, you should report it as soon as possible via email to [hello@matter-labs.io](mailto:hello@matter-labs.io). Please do not post it to a public issue tracker.\n\n\n## License\n\nweb3swift is available under the Apache License 2.0 license. See the [LICENSE](https://github.com/matter-labs/web3swift/blob/master/LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimensiondev%2Fweb3swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimensiondev%2Fweb3swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimensiondev%2Fweb3swift/lists"}