在使用 bitcoinjs-lib 时,我得到 getAddress() is not function
While using bitcoinjs-lib I am getting getAddress() is not fuction
下面是代码。
常量比特币=要求('bitcoinjs-lib');
让测试网 = bitcoin.networks.testnet;
let keypair = bitcoin.ECPair.makeRandom({network: testnet});
let addr = keypair.getAddress();
let pk = keypair.toWIF();
你试过了吗:
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
这似乎是 the definitive example at github 所做的。
只需将网络参数直接传递给 ECPair.makeRandom 而无需包装器对象,您就会在那里:)
const bitcoin = require('bitcoinjs-lib');
let testnet = bitcoin.networks.testnet;
let keypair = bitcoin.ECPair.makeRandom(testnet);
let addr = keypair.getAddress();
let pk = keypair.toWIF();
下面是代码。
常量比特币=要求('bitcoinjs-lib'); 让测试网 = bitcoin.networks.testnet;
let keypair = bitcoin.ECPair.makeRandom({network: testnet});
let addr = keypair.getAddress();
let pk = keypair.toWIF();
你试过了吗:
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
这似乎是 the definitive example at github 所做的。
只需将网络参数直接传递给 ECPair.makeRandom 而无需包装器对象,您就会在那里:)
const bitcoin = require('bitcoinjs-lib');
let testnet = bitcoin.networks.testnet;
let keypair = bitcoin.ECPair.makeRandom(testnet);
let addr = keypair.getAddress();
let pk = keypair.toWIF();