Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error of sync with bitcoin-core regtest #113

Open
nemoRevers opened this issue Oct 4, 2023 · 0 comments
Open

Error of sync with bitcoin-core regtest #113

nemoRevers opened this issue Oct 4, 2023 · 0 comments

Comments

@nemoRevers
Copy link

nemoRevers commented Oct 4, 2023

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final String mnemonic = generateMnemonic();

  final DescriptorSecretKey secretKey = await (await DescriptorSecretKey.create(
    network: Network.Regtest,
    mnemonic: await Mnemonic.fromString(mnemonic),
  ))
      .derive(await DerivationPath.create(path: "m/49'/0'/0'"));

  final Descriptor descriptorExternal = await Descriptor.newBip49(
    secretKey: secretKey,
    network: Network.Regtest,
    keychain: KeychainKind.External,
  );

  final Descriptor descriptorInternal = await Descriptor.newBip49(
    secretKey: secretKey,
    network: Network.Regtest,
    keychain: KeychainKind.Internal,
  );

  final Wallet wallet = await Wallet.create(
    descriptor: descriptorExternal,
    changeDescriptor: descriptorInternal,
    network: Network.Regtest,
    databaseConfig: const DatabaseConfig.memory(),
  );

  final AddressInfo address =
      await wallet.getAddress(addressIndex: const AddressIndex.reset(index: 0));
  print(address.address);

  final Blockchain blockchain = await Blockchain.create(
    config: const BlockchainConfig.rpc(
      config: RpcConfig(
        url: 'http://127.0.0.1:18443',
        network: Network.Regtest,
        authUserPass: UserPass(
          username: "your_username",
          password: "your_password",
        ),
        walletName: 'bdk_flutter',
      ),
    ),
  );
  await wallet.sync(blockchain);
  await wallet.getBalance();
}

I catch error below on wallet.sync(...)

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: Rpc(Transport(SocketError(Os { code: 35, kind: WouldBlock, message: "Resource temporarily unavailable" }))))
#0 Wallet.sync (package:bdk_flutter/src/root.dart:1200:7)

#1 main (package:bdk_flutter_test/main.dart:51:3)

@nemoRevers nemoRevers reopened this Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant