javascript – How one can use BlockCypher’s take a look at community with BitcoinJS-lib?


Attempting to make a PSBT through BitcoinJS-lib.

I am utilizing BlockCypher’s inside testnet (bcy/take a look at) as a result of I’ve no selection: actually each different testnet faucet I examined was damaged.

Utilizing BlockCypher’s API to make new addresses, they offer you an handle, personal, public and wif

(their documentation does not point out the wif, but it surely does certainly give one…)

This is an instance response

{
  "personal": "9125ea9f573e23ce178d98cc2ec2a78655bd030c14b525729a026d6570b411c8",
  "public": "03f1fbc34305c61d7638c449030c32a66eb36726c208fca9962923a98ca75d77fe",
  "handle": "C1E96vE5GvKd5kXU4T4hhF6QioZzACrmdD",
  "wif": "BtCBNtS2noEXwm4rJi9nyiVbmZJMR9CEBMbF5Uz6JTSaR9EQn8jS"
}

Nonetheless none of this info is usable on it is personal as a result of the signal features of BitcoinJS-lib count on a Signer (KeyPair) class object.. giving it a non-public key on it is personal does not work.

i.e. psbt.signInput(0, privateKey); leads to: Error: Want Signer to signal enter

I attempted to make a KeyPair out of a WIF, however as a result of BitcoinJS-lib lacks the bitcoin.networks configuration acceptable for bcy/take a look at it at all times fails to resolve..

ECPair.fromWIF(wif, bitcoin.networks.testnet); // Error: Invalid community model
ECPair.fromWIF(wif, bitcoin.networks.important); // Error: Invalid community model
ECPair.fromWIF(wif); // Error: Invalid community model

The error message suggests the WIF just isn’t doable on these tried networks.

How do I make a KeyPair for bcy/take a look at ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top