{"id":13596955,"url":"https://github.com/LtbLightning/bdk-flutter","last_synced_at":"2025-04-10T00:31:29.964Z","repository":{"id":45797915,"uuid":"474376938","full_name":"LtbLightning/bdk-flutter","owner":"LtbLightning","description":"Bitcoin Development Kit - Flutter Package","archived":false,"fork":false,"pushed_at":"2024-07-19T18:30:54.000Z","size":742099,"stargazers_count":60,"open_issues_count":34,"forks_count":27,"subscribers_count":11,"default_branch":"main","last_synced_at":"2024-08-02T17:29:39.647Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/LtbLightning.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-03-26T14:48:05.000Z","updated_at":"2024-07-19T18:30:00.000Z","dependencies_parsed_at":"2024-01-20T22:27:09.303Z","dependency_job_id":"8bf92ebd-b22d-4f00-a413-132f08fe66f7","html_url":"https://github.com/LtbLightning/bdk-flutter","commit_stats":{"total_commits":158,"total_committers":5,"mean_commits":31.6,"dds":0.259493670886076,"last_synced_commit":"6bb09ef91c3e29b36b73bf073888d6f41d9b2168"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LtbLightning%2Fbdk-flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LtbLightning%2Fbdk-flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LtbLightning%2Fbdk-flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LtbLightning%2Fbdk-flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LtbLightning","download_url":"https://codeload.github.com/LtbLightning/bdk-flutter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248135201,"owners_count":21053636,"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-08-01T17:00:15.737Z","updated_at":"2025-04-10T00:31:29.956Z","avatar_url":"https://github.com/LtbLightning.png","language":"Dart","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"### Bdk Flutter\n\n\u003cp\u003e\n  \u003ca href=\"https://github.com/LtbLightning/bdk-flutter/blob/HEAD/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"BDK is released under the MIT license.\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pub.dev/documentation/bdk_flutter/latest/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-red.svg\" alt=\"Docs\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pub.dev/packages/bdk_flutter\"\u003e\n    \u003cimg src=\"https://img.shields.io/pub/v/bdk_flutter?color=blueviolet\" alt=\"Current pub package version.\" /\u003e\n  \u003c/a\u003e\n    \u003ca href=\"https://github.com/LtbLightning/bdk-flutter/issues\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/issues/LtbLightning/bdk-flutter.svg\" alt=\"Issues\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/LtbLightning/bdk-flutter/stargazers\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/LtbLightning/bdk-flutter.svg\" alt=\"Stars\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/LtbLightning/bdk-flutter/forks\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/forks/LtbLightning/bdk-flutter.svg?color=brightgreen\" alt=\"Forks\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/LtbLightning/bdk-flutter-quickstart\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Demo App-orange\" alt=\"Demo App\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nA Flutter library for the [Bitcoin Development Kit](https://bitcoindevkit.org/).\nThe bdk library aims to be the core building block for Bitcoin Applications of any kind.\n\n### Requirements\n\n- Flutter : 3.0 or higher\n- Android minSdkVersion. : API 23 or higher.\n- Deployment target : iOS 12.0 or greater.\n\n### How to Use\n\nTo use the `bdk_flutter` package in your project, add it as a dependency in your project's pubspec.yaml:\n\n```dart\ndependencies:\n  bdk_flutter: ^0.31.3\n```\n\n### Examples\n\n### Create a Wallet \u0026 sync the balance of a descriptor\n\n```dart\nimport 'package:bdk_flutter/bdk_flutter.dart';\n\n// ....\n\nfinal mnemonic = await Mnemonic.create(WordCount.words12);\nfinal descriptorSecretKey = await DescriptorSecretKey.create( network: Network.testnet,\n                                                              mnemonic: mnemonic );\nfinal externalDescriptor = await Descriptor.newBip44( secretKey: descriptorSecretKey,\n                                                      network: Network.testnet,\n                                                      keychain: KeychainKind.externalChain );\nfinal internalDescriptor = await Descriptor.newBip44( secretKey: descriptorSecretKey,\n                                                      network: Network.testnet,\n                                                      keychain: KeyChainKind.internalChain );\nfinal blockchain = await Blockchain.create( config: BlockchainConfig.electrum(\n                                                                        config: ElectrumConfig(\n                                                                            stopGap: 10,\n                                                                            timeout: 5,\n                                                                            retry: 5,\n                                                                            url: \"ssl://electrum.blockstream.info:60002\" )));\nfinal wallet = await Wallet.create( descriptor: externalDescriptor,\n                                    changeDescriptor: internalDescriptor,\n                                    network: Network.testnet,\n                                    databaseConfig: const DatabaseConfig.memory() );\nfinal _ = await wallet.sync( blockchain );\n```\n\n### Create a `public` wallet descriptor\n\n```dart\nimport 'package:bdk_flutter/bdk_flutter.dart';\n\n// ....\n\nfinal mnemonic = await Mnemonic.create(WordCount.words12);\nfinal descriptorSecretKey = await DescriptorSecretKey.create( network: Network.testnet,\n                                                              mnemonic: mnemonic );\nfinal externalDescriptor = await Descriptor.newBip44( secretKey: descriptorSecretKey,\n                                                      network: Network.testnet,\n                                                      keychain: KeychainKind.externalChain  );\nfinal externalPublicDescriptor = await Descriptor.create( descriptor: externalDescriptor.toString(),\n                                                    network: Network.testnet);\n```\n\n### Get the transaction details\n\n```dart\nimport 'package:bdk_flutter/bdk_flutter.dart';\n\nfinal bdkWallet = .....\n\n// ....\n\nfinal txBuilder  = TxBuilder();\nfinal address = await Address.fromString(s: \"mv4rnyY3Su5gjcDNzbMLKBQkBicCtHUtFB\", network: Network.testnet);\n\nfinal script = await address.scriptPubkey();\nfinal feeRate = await blockchain.estimateFee(target: 25);\n\nfinal (psbt, transactionDetails) = await txBuilder.feeRate( feeRate.satPerVb )\n                                       .addRecipient( script, 2000 )\n                                       .finish( bdkWallet );\n\nfinal serializedPsbt = await psbt.jsonSerialize();\nfinal jsonObject = json.decode(serializedPsbt);\nfinal outputs = jsonObject['unsigned_tx']['output'] as List;\nfinal inputs = jsonObject['inputs'][0]['non_witness_utxo']['output'] as List;\n\ndebugPrint(\"=========Inputs=====\");\n    for (var e in inputs) {\n      debugPrint(\"amount: ${e['value']}\");\n      debugPrint(\"script_pubkey: ${e['script_pubkey']}\");\n    }\n\ndebugPrint(\"=========Outputs=====\");\n    for (var e in outputs) {\n      debugPrint(\"amount: ${e['value']}\");\n      debugPrint(\"script_pubkey: ${e['script_pubkey']}\");\n    }\n\n```\n\n### Create an `internal` and `extarnal` wallet descriptors from derivation path.\n\n```dart\nimport 'package:bdk_flutter/bdk_flutter.dart';\n\n\nfinal mnemonic = await Mnemonic.create(WordCount.words12);\nfinal descriptorSecretKey = await DescriptorSecretKey.create(\n        network: Network.testnet, mnemonic: mnemonic);\n\n// create external descriptor\nfinal derivationPath = await DerivationPath.create(path: \"m/44h/1h/0h/0\");\nfinal descriptorPrivateKey =\n        await descriptorSecretKey.derive(derivationPath);\nfinal Descriptor descriptorPrivate = await Descriptor.create(\n      descriptor: \"pkh(${descriptorPrivateKey.toString()})\",\n      network: Network.testnet,\n    );\n\n// create internal descriptor\nfinal derivationPathInt =\n        await DerivationPath.create(path: \"m/44h/1h/0h/1\");\nfinal descriptorPrivateKeyInt =\n        await descriptorSecretKey.derive(derivationPathInt);\nfinal Descriptor descriptorPrivateInt = await Descriptor.create(\n      descriptor: \"pkh(${descriptorPrivateKeyInt.toString()})\",\n      network: Network.testnet,\n    );\n\nfinal bdkWallet = await Wallet.create(\n      descriptor: descriptorPrivate,\n      changeDescriptor: descriptorPrivateInt,\n      network: Network.testnet,\n      databaseConfig: const DatabaseConfig.memory(),\n    );\n\nfinal address =\n        await bdkWallet.getAddress(addressIndex: const AddressIndex.increase());\nfinal internalAddress =\n        await bdkWallet.getInternalAddress(addressIndex: const AddressIndex.increase());\n\n```\n\n### API Documentation\n\nThe latest API documentation is available [here](https://pub.dev/documentation/bdk_flutter/latest/bdk_flutter/bdk_flutter-library.html)\n\n### Example Projects\n\n- **\\*BDK Flutter Demo App:** The [BDK Flutter Demo App](https://github.com/LtbLightning/bdk-flutter-quickstart)\n  is a simple bitcoin app built in flutter to serve as a reference app to demonstrate `bdk-flutter` api usage.\n\n### References:\n\n- Setting up a local Esplora instance for testing:\n  https://bitcoin.stackexchange.com/questions/116937/how-do-i-setup-an-esplora-instance-for-local-testing/116938#116938\n\n\nThanks for taking a look!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLtbLightning%2Fbdk-flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLtbLightning%2Fbdk-flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLtbLightning%2Fbdk-flutter/lists"}