Closed antmaster2001 closed 2 years ago
Yes, you're making a small mistake. The documentation may be out of date - below works with the new bsv2 library v2 on I think
let privateKey = bsv.PrivKey.Testnet.fromRandom()
let publicKey = bsv.PubKey.fromPrivKey(privateKey)
let address = bsv.Address.Testnet.fromPubKey(publicKey)
let address2 = bsv.Address.Testnet.fromPrivKey(privateKey)
console.log(address.toString())
console.log(address2.toString())
I just checked and that works perfect 😃 The code I added is straight from the Docs
Such is documentation sadly.
Hello, today is my first day using the bsv package.
I'm trying to generate a 'testnet' address following the code in the documentation.
No matter how many times I try, they all start with a 1.
Am I making a mistake or is there something wrong with the documentation?