A React Native version of the Bitcoin Development Kit (https://bitcoindevkit.org/)
bdk aims to be the core building block for Bitcoin Applications of any kind.
Using npm:
npm i --save bdk-rnUsing yarn:
yarn add bdk-rn[IOS Only] Install pods:
npx pod-install
or
cd ios && pod installimport { DescriptorSecretKey, Mnemonic, Blockchain, Wallet, DatabaseConfig, Descriptor } from 'bdk-rn';
import { WordCount, Network, KeychainKind } from 'bdk-rn/lib/lib/enums';
// ....
const mnemonic = await new Mnemonic().create(WordCount.WORDS12);
const descriptorSecretKey = await new DescriptorSecretKey().create(Network.Testnet, mnemonic);
const externalDescriptor = await new Descriptor().newBip84(descriptorSecretKey, KeychainKind.External, Network.Testnet);
const internalDescriptor = await new Descriptor().newBip84(descriptorSecretKey, KeychainKind.Internal, Network.Testnet);
const config: BlockchainElectrumConfig = {
url: 'ssl://electrum.blockstream.info:60002',
sock5: null,
retry: 5,
timeout: 5,
stopGap: 500,
validateDomain: false,
};
const blockchain = await new Blockchain().create(config);
const dbConfig = await new DatabaseConfig().memory();
const wallet = await new Wallet().create(externalDescriptor, internalDescriptor, Network.Testnet, dbConfig);
await wallet.sync(blockchain);import { DescriptorSecretKey, Mnemonic, Descriptor } from 'bdk-rn';
import { WordCount, Network, KeychainKind } from 'bdk-rn/lib/lib/enums';
// ....
const mnemonic = await new Mnemonic().create(WordCount.WORDS12);
const descriptorSecretKey = await new DescriptorSecretKey().create(Network.Testnet, mnemonic);
const descriptorPublicKey = await descriptorSecretKey.asPublic();
const fingerprint = 'd1d04177';
const externalPublicDescriptor = await new Descriptor().newBip84Public(
descriptorPublicKey,
fingerprint,
KeychainKind.External,
Network.Testnet
);import RNFS from 'react-native-fs'
import { DatabaseConfig, ... } from 'bdk-rn';
// create sqlite database config with rn document directory path
const dbConfig = await new DatabaseConfig().sqlite(`${RNFS.DocumentDirectoryPath}/bdk-wallet`)- Setting up a local Esplora instance for testing: https://bitcoin.stackexchange.com/questions/116937/how-do-i-setup-an-esplora-instance-for-local-testing/116938#116938
Google Play can reject uploads when any 64-bit native library (.so under arm64-v8a / x86_64) is linked with 4 KB ELF segment alignment instead of 16 KB. See the official guide: Support 16 KB page sizes.
This library: bdk-rn pulls bdk-android, which ships libbdkffi.so. From bdk-android 2.2.0 onward those binaries are built with 16 KB page compatibility (bitcoindevkit bdk-ffi CHANGELOG v2.2.0, PR #865).
If Play Console still reports the error:
- Confirm the resolved version — run
./gradlew :app:dependencies --configuration releaseRuntimeClasspath(adjust:appif needed) and check thatorg.bitcoindevkit:bdk-androidis ≥ 2.2.0 (this repo pins 2.3.x). Force a resolution if another dependency downgrades it. - Upgrade your app project — Android Gradle Plugin 8.5.1+, and preferably NDK r28+ when you build your own native code (developer guidance).
gradle.properties(application root) — many teams addandroid.bundle.enable16KbPageSupport=truewhile migrating (release notes / tooling).- Other
.sofiles — React Native, Hermes, Firebase, ads SDKs, etc. often cause this error before BDK. Use Android Studio → Build → Analyze APK… (or your merged AAB) and inspect lib/**/*.so alignments, or runscripts/check-apk-native-page-alignment.shon a release APK.
Note: Caution this is an Alpha at this stage Please consider reviewing, experimenting and contributing ⚡️
Thanks for taking a look!