You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
Running insight to getUnspentUtxos for a testnet address shows the following error:
throw new TypeError('Address has mismatched network type.'); ^TypeError: Address has mismatched network type.
Code:
var Insight = require('bitcore-explorers').Insight; var insight = new Insight('testnet'); return insight.getUnspentUtxos(address, function (err, utxos) { if (err) { console.err(err) } console.log(utxos); });
Calling it with a testnet address
Code for testnet address: let privateKey = new bitcore.PrivateKey(), hexa = privateKey.toString(), publicKey = new bitcore.PublicKey(privateKey); address = new bitcore.Address(publicKey, Networks.testnet);
The text was updated successfully, but these errors were encountered:
Hello @ActoMatics, Please try below code for generate address
const bitcore = require('bitcore-lib');
let value = new Buffer('*Unique string.....');
let hash = bitcore.crypto.Hash.sha256(value);
let bn = bitcore.crypto.BN.fromBuffer(hash);
let privateKey = new bitcore.PrivateKey(bn,'testnet');
let address = privateKey.toAddress();
addressArr.address = address.toString();
resolve(addressArr);
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Running insight to getUnspentUtxos for a testnet address shows the following error:
throw new TypeError('Address has mismatched network type.'); ^TypeError: Address has mismatched network type.
Code:
var Insight = require('bitcore-explorers').Insight; var insight = new Insight('testnet'); return insight.getUnspentUtxos(address, function (err, utxos) { if (err) { console.err(err) } console.log(utxos); });
Calling it with a testnet address
Code for testnet address:
let privateKey = new bitcore.PrivateKey(), hexa = privateKey.toString(), publicKey = new bitcore.PublicKey(privateKey); address = new bitcore.Address(publicKey, Networks.testnet);
The text was updated successfully, but these errors were encountered: