{"id":14980048,"url":"https://github.com/essentiaone/hdwallet","last_synced_at":"2025-04-09T13:09:57.869Z","repository":{"id":49771161,"uuid":"138898540","full_name":"essentiaone/HDWallet","owner":"essentiaone","description":"Simple Swift library for creating HD cryptocurrencies wallets and working with crypto Coins/ERC20 tokens.","archived":false,"fork":false,"pushed_at":"2023-01-30T08:29:02.000Z","size":11581,"stargazers_count":131,"open_issues_count":16,"forks_count":84,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2025-04-09T13:09:52.029Z","etag":null,"topics":["bitcoin","bitcoin-cash","bitcoin-wallet","carthage","cocoapods","crypto","erc20","ethereum","ethereum-address","ethereum-wallet","hdwallet","hierarchical-deterministic-wallets","ios","keystore","litecoin","mnemonic","seed","swift","transaction-signer","wallet-generator"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/essentiaone.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2018-06-27T15:13:05.000Z","updated_at":"2024-12-30T18:59:42.000Z","dependencies_parsed_at":"2023-02-16T05:30:56.622Z","dependency_job_id":null,"html_url":"https://github.com/essentiaone/HDWallet","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentiaone%2FHDWallet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentiaone%2FHDWallet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentiaone%2FHDWallet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/essentiaone%2FHDWallet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/essentiaone","download_url":"https://codeload.github.com/essentiaone/HDWallet/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045245,"owners_count":21038554,"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":["bitcoin","bitcoin-cash","bitcoin-wallet","carthage","cocoapods","crypto","erc20","ethereum","ethereum-address","ethereum-wallet","hdwallet","hierarchical-deterministic-wallets","ios","keystore","litecoin","mnemonic","seed","swift","transaction-signer","wallet-generator"],"created_at":"2024-09-24T14:01:12.875Z","updated_at":"2025-04-09T13:09:57.843Z","avatar_url":"https://github.com/essentiaone.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/essentiaone/HDWallet.svg?branch=develop)](https://travis-ci.com/essentiaone/HDWallet)\n[![Black Duck Security Risk](https://copilot.blackducksoftware.com/github/repos/essentiaone/HDWallet/branches/develop/badge-risk.svg)](https://copilot.blackducksoftware.com/github/repos/essentiaone/HDWallet/branches/develop)\n[![Badge w/ Version](https://cocoapod-badges.herokuapp.com/v/HDWalletKit/badge.png)](https://cocoadocs.org/docsets/HDWalletKit)\n[![Badge w/ Platform](https://cocoapod-badges.herokuapp.com/p/HDWalletKit/badge.svg)](https://cocoadocs.org/docsets/HDWalletKit)\n[![Badge w/ Licence](https://cocoapod-badges.herokuapp.com/l/HDWalletKit/badge.svg)](https://cocoadocs.org/docsets/HDWalletKit)\n\n# HDWalletKit\nHDWalletKit is a Swift framwork that enables you to create and use bitcoin HD wallet ([Hierarchical Deterministic Wallets](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)) in your own app.\n\u003cp\u003e\n\u003cimg src=\"https://clogos.essdev.info/64x64/bitcoin.png\" \u003e  \u003cimg src=\"https://clogos.essdev.info/64x64/bitcoin-cash.png\" \u003e  \u003cimg src=\"https://clogos.essdev.info/64x64/litecoin.png\" \u003e \u003cimg src=\"https://clogos.essdev.info/64x64/dash.png\" \u003e \u003cimg src=\"https://clogos.essdev.info/64x64/ethereum.png\" \u003e \u003cimg src=\"https://clogos.essdev.info/64x64/erc20.png\" \u003e\n\u003c/p\u003e\nYou can check if the address generation is working right [here](https://iancoleman.io/bip39/).\n\n## Features\n- HD and NonHD wallets support\n- Mnemonic recovery phrease in [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)\n- Keystore generation\n- Read keystore file\n- Sign ether transaction\n- ERC20 Tokens\n- Sign UTXO based transaction\n\n## Installation\n### CocoaPods\n\u003cp\u003eTo integrate HDWalletKit into your Xcode project using \u003ca href=\"http://cocoapods.org\"\u003eCocoaPods\u003c/a\u003e, specify it in your \u003ccode\u003ePodfile\u003c/code\u003e:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"ruby language-ruby\"\u003epod 'HDWalletKit'\u003c/code\u003e\u003c/pre\u003e\n\n### Carthage\nTo install with [Carthage](https://github.com/Carthage/Carthage), simply add this in your `Cartfile`:\n```ruby\ngithub \"essentiaone/HDWallet\"\n```\n## Communication\n\n- If you **found a bug**, open an issue.\n- If you **have a feature request**, open an issue.\n- If you **want to contribute**, submit a pull request.\n## How to use\n#### Generate seed and convert it to mnemonic sentence.\n```swift\nlet entropy = Data(hex: \"000102030405060708090a0b0c0d0e0f\")\nlet mnemonic = Mnemonic.create(entropy: entropy)\nprint(mnemonic)\n// abandon amount liar amount expire adjust cage candy arch gather drum buyer\n\nlet seed = Mnemonic.createSeed(mnemonic: mnemonic)\nprint(seed.toHexString())\n```\n#### PrivateKey and key derivation (BIP39)\n\n```swift\nlet mnemonic = Mnemonic.create()\nlet seed = Mnemonic.createSeed(mnemonic: mnemonic)\nlet privateKey = PrivateKey(seed: seed, coin: .bitcoin)\n\n// BIP44 key derivation\n// m/44'\nlet purpose = privateKey.derived(at: .hardened(44))\n\n// m/44'/0'\nlet coinType = purpose.derived(at: .hardened(0))\n\n// m/44'/0'/0'\nlet account = coinType.derived(at: .hardened(0))\n\n// m/44'/0'/0'/0\nlet change = account.derived(at: .notHardened(0))\n\n// m/44'/0'/0'/0/0\nlet firstPrivateKey = change.derived(at: .notHardened(0))\nprint(firstPrivateKey.publicKey.address)\n```\n#### Generate keystore file\n```swift\nlet data = \"abandon amount liar amount expire adjust cage candy arch gather drum buyer\"\nlet keystore = try! KeystoreV3(data: data, password: \"qwertyui\")\nlet encodedKeystoreDaya = (try? keystore?.encodedData())\n```\n#### Open keystore file\n```swift\nlet keystore = try! KeystoreV3(data: encodedKeystoreDaya, password: password)\nguard let decoded = try? keystore?.getDecriptedKeyStore(password: password) else {\nfatalError()\n}\nprint(decoded)\n```\n#### Create your wallet and generate address\n```swift\nlet mnemonic = Mnemonic.create()\nlet seed = Mnemonic.createSeed(mnemonic: mnemonic)\nlet network: Network = .main(.bitcoin)\nlet wallet = Wallet(seed: seed, network: network)\nlet account = wallet.generateAccount()\nprint(account)\n```\n#### Sign Ethereum transaction by private key\n```swift\nlet signer = EIP155Signer()\nlet rawTransaction1 = EthereumRawTransaction(\n    value: Wei(\"10000000000000000\")!,\n    to: \"0x34205555576717bBdF8158E2b2c9ed64EB1e6B85\",\n    gasPrice: 99000000000,\n    gasLimit: 21000,\n    nonce: 2\n)\nguard let signed = try? signer.hash(rawTransaction: rawTransaction1).toHexString() else { return }\nprint(signed)\n```\n\n#### Sign Bitcoin transaction by private key\nFor getting UTXO you can use (https://github.com/essentiaone/essentia-bridges-api-ios)\n```swift\nlet address = try LegacyAddress(\"1HLqrFX5fYwKriU7LRKMQGhwpz5HuszjnK\", coin: .bitcoin)\nlet utxoWallet = UTXOWallet(privateKey: \"Kz9UKkL6bKE92QPxQbPcqkCZTnCyLVyfRNFRSbToNjyb4bx321fh\")\nlet signedTx = try utxoWallet.createTransaction(to: address, amount: 0, utxos: utxos)\n```\n\n#### Create send ERC20 tokens transaction data \n```swift\nlet erc20Token = ERC20(contractAddress: \"0x8f0921f30555624143d427b340b1156914882c10\", decimal: 18, symbol: \"ESS\")\nlet address = \"0x2f5059f64D5C0c4895092D26CDDacC58751e0C3C\"\nlet data = try! erc20Token.generateDataParameter(toAddress: address, amount: \"3\") \n```\n#### Create get balance ERC20 token transaction data \n```swift\nlet erc20Token = ERC20(contractAddress: \"0x8f0921f30555624143d427b340b1156914882c10\", decimal: 18, symbol: \"ESS\")\nlet data = try! erc20Token.generateGetBalanceParameter(toAddress: \"2f5059f64D5C0c4895092D26CDDacC58751e0C3C\")\n```\n#### Convert non HD PrivateKey to Address\n```swift\nlet privateKey = PrivateKey(pk: \"L35qaFLpbCc9yCzeTuWJg4qWnTs9BaLr5CDYcnJ5UnGmgLo8JBgk\", coin: .bitcoin)\nprint(privateKey.publicKey.address)\n//128BCBZndgrPXzEgF4QbVR3jnQGwzRtEz5\n```\n\n## License\nWalletKit is released under the [MIT License](https://github.com/essentiaone/HDWallet/blob/develop/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessentiaone%2Fhdwallet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fessentiaone%2Fhdwallet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fessentiaone%2Fhdwallet/lists"}