{"id":13830820,"url":"https://github.com/consenlabs/token-core-ios","last_synced_at":"2025-05-16T05:00:27.744Z","repository":{"id":54981094,"uuid":"154245955","full_name":"consenlabs/token-core-ios","owner":"consenlabs","description":"a blockchain private key management library on iOS","archived":false,"fork":false,"pushed_at":"2024-04-16T06:06:32.000Z","size":18304,"stargazers_count":880,"open_issues_count":40,"forks_count":231,"subscribers_count":45,"default_branch":"master","last_synced_at":"2025-05-12T03:02:32.304Z","etag":null,"topics":["bitcoin","blockchain","eos","ethereum"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/consenlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-23T02:01:55.000Z","updated_at":"2025-05-10T15:34:50.000Z","dependencies_parsed_at":"2024-01-07T21:02:56.148Z","dependency_job_id":"b155e737-b007-4a5b-bbb7-02adcff49f49","html_url":"https://github.com/consenlabs/token-core-ios","commit_stats":{"total_commits":17,"total_committers":6,"mean_commits":"2.8333333333333335","dds":0.4117647058823529,"last_synced_commit":"b896f0cacb9530894cd18ec3843c4ca630d8a867"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consenlabs%2Ftoken-core-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consenlabs%2Ftoken-core-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consenlabs%2Ftoken-core-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consenlabs%2Ftoken-core-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/consenlabs","download_url":"https://codeload.github.com/consenlabs/token-core-ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254471028,"owners_count":22076582,"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","blockchain","eos","ethereum"],"created_at":"2024-08-04T10:01:09.534Z","updated_at":"2025-05-16T05:00:27.667Z","avatar_url":"https://github.com/consenlabs.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# TokenCore\nTokenCore is a blockchain library. TokenCore provides the relatively consistent API that allows you to manage your wallets and sign transactions in BTC, ETH and EOS chains simultaneously.\nIn addition, TokenCore introduces the concept of 'identity', you can use the same mnemonic to manage wallets on the three chains.\n\n## Installation\nTo install TokenCore, use CocoaPods and add this to your Podfile:\n\n```\npod \"TokenCore\", git: \"https://github.com/consenlabs/token-core-ios.git\", branch: \"master\"\n```\n\n## Run the Example   \nThe example show how to manager the wallet and sign transaction, the eos sign will coming soon.    \n```\n$ cd Example\n$ pod install\n```\n\n## Try the API\n### Create new Identity and derive the eth, btc wallets\n```swift\n// You should create or recover Identity first before you create other wallets\ndo {\n  var metadata = WalletMeta(source: .newIdentity)\n  metadata.network = Network.mainnet\n  metadata.segWit = .p2wpkh // .p2wpkh means that the derived btc wallet is a SegWit wallet\n  metadata.name = \"MyFirstIdentity\"\n  let (mnemonic, identity) = try Identity.createIdentity(password: TestData.password, metadata: metadata)\n  let ethereumWallet = identity.wallets[0]\n  let bitcoinWalelt = identity.wallets[1]\n} catch {\n  print(\"createIdentity failed, error:\\(error)\")\n}\n```\n### Export Wallet\n```swift\n\nlet prvKey = try WalletManager.exportPrivateKey(walletID: ethereumWallet.walletID, password: TestData.password)\nprint(\"PrivateKey: \\(prvKey)\")\nlet mnemonics = try WalletManager.exportMnemonic(walletID: ethereumWallet.walletID, password: TestData.password)\nprint(\"Mnemonic: \\(mnemonics)\")\nlet keystore = try WalletManager.exportKeystore(walletID: ethereumWallet.walletID, password: TestData.password)\nprint(\"Keystore: \\(keystore)\")\n\n// output:\n// PrivateKey: f653be3f639f45ea1ed3eb152829b6d881ce62257aa873891e06fa9569a8d9aa\n// Mnemonic: tide inmate cloud around wise bargain celery cement jungle melody galaxy grocery\n// Keystore: {\"id\":\"c7575eba-3ae3-4cc3-86ba-2eb9c6839cad\",\"version\":3,\"crypto\":{\"ciphertext\":\"7083ba3dd5470ba4be4237604625e05fa6b668954d270beb848365cbf6933ec5\",\"mac\":\"f4f9ea8d42ff348b11fc146c396da446cc975309b3538e08a58c0b218bddd15d\",\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"db3f523faf4da4f1c6edcd7bc1386879\"},\"kdf\":\"pbkdf2\",\"kdfparams\":{\"dklen\":32,\"c\":10240,\"prf\":\"hmac-sha256\",\"salt\":\"0ce830e9f888dfe33c31e6cfc444d6f588161c9d4128d4066ee5dfdcbc5d0079\"}},\"address\":\"4a1c2072ac67b616e5c578fd9e2a4d30e0158471\"}\n```\n\n### SignTransaction\n```swift\nlet signResult = WalletManager.ethSignTransaction(\n        walletID: String,\n        nonce: String,\n        gasPrice: String,\n        gasLimit: String,\n        to: String,\n        value: String,\n        data: String,\n        password: String,\n        chainID: Int\n      )\nlet signedTx = signResult.signedTx // This is the signature result which you need to broadcast.\nlet txHahs = signResult.txHash // This is txHash which you can use for locating your transaction record\n```\n\n\n## Troubleshooting\nFor macOS 10.14 Mojave and Xcode 10, install `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` since Xcode command line tools don't install to `/usr/include` anymore.\n\n## TODO\n- [ ] Test on Objective-C   \n- [ ] upgrade the `BigInt` from 3.0 to 3.1  \n\n\n## Copyright and License\n\n```\n  Copyright 2018 imToken PTE. LTD.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n```\n\n## Thanks and more info\nThanks bitcoinj, CoreBitcoin and others library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsenlabs%2Ftoken-core-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsenlabs%2Ftoken-core-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsenlabs%2Ftoken-core-ios/lists"}