Skip to content

Invalid version or Network mismatch #22

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

Closed
Merrick17 opened this issue Jan 13, 2020 · 2 comments
Closed

Invalid version or Network mismatch #22

Merrick17 opened this issue Jan 13, 2020 · 2 comments

Comments

@Merrick17
Copy link

Hello I am Trying to create a Transaction , but i always get the error Invalid version or Network mismatch i am using testnet adresses this is my log..
Bitcoin Adress moZ3hBUMbu5pFaodrsLCKg76U53NdmDVqc
Bitcoin Second Address muYEstcvt7ZyLUv6DRXNX592NF7RGSUEAo
Unhandled exception:
Invalid argument(s): Invalid version or Network mismatch
#0 P2PKH._getDataFromAddress (package:bitcoin_flutter/src/payments/p2pkh.dart:87:7)
#1 P2PKH._init (package:bitcoin_flutter/src/payments/p2pkh.dart:22:7)
#2 new P2PKH (package:bitcoin_flutter/src/payments/p2pkh.dart:18:5)
#3 addressToOutputScript (package:bitcoin_flutter/src/transaction_builder.dart:286:11)
#4 TransactionBuilder.addOutput (package:bitcoin_flutter/src/transaction_builder.dart:71:22)
#5 CreateWallet.generateTransaction (file:///home/safouene/crypto_test/main.dart:152:11)
#6 main (file:///home/safouene/crypto_test/main.dart:178:8)
#7 _startIsolate. (dart:isolate-patch/isolate_patch.dart:307:19)
#8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

@longhoangwkm
Copy link
Collaborator

Hi @Merrick17, Would you mind if show me your full code ?!. I guess you didn't set network is testnet. Default network is mainnet

@SFzxc
Copy link
Collaborator

SFzxc commented Jan 15, 2020

Hi @Merrick17,
Here are how can using testnet in this lib:

// Generate a testnet P2PKH address from <pubkey>

import 'package:bitcoin_flutter/src/models/networks.dart' as NETWORKS;
import 'package:bitcoin_flutter/src/payments/p2pkh.dart' show P2PKH;
import 'package:bitcoin_flutter/src/payments/index.dart' show PaymentData;

final address = new P2PKH(data: new PaymentData(pubkey: <pubkey>), network: NETWORKS.testnet).data.address;

@SFzxc SFzxc closed this as completed Jan 15, 2020
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

3 participants