Closed rahul70392 closed 6 years ago
Hello! You need to restart bitcoind with parameter to work in testnet, that way bitcoind will accept testnet adressess as valid.
Thanks a lot for your kind reply! I have started it as testnet, the issue here is the address generated is for livenet. Please refer below
Listening on port 2222 new Segwit generated addess { address: '3Bc8gcSk9XvttwswLXcQvkCRhxDFH7JEht', WIF: 'cSNPsA9fMtdoAL5WjNeauMpRLL9NMHbox6YjQqyhvsatDpt9BBzg' } c8c20e12-00a8-425f-8175-71b8191298ca checking seller existance... c8c20e12-00a8-425f-8175-71b8191298ca seller already exists c8c20e12-00a8-425f-8175-71b8191298ca created address 3Bc8gcSk9XvttwswLXcQvkCRhxDFH7JEht c8c20e12-00a8-425f-8175-71b8191298ca { Error: {"result":null,"error":{"code":-5,"message":"Invalid Bitcoin address or script"},"id":"5ab67858-c72e-4a69-8919-b89ba41d7793"}
I have made the necessary changes in the code(I believe) to generate the testnet address.
let testnet = bitcoinjs.networks.testnet // define bitcoin testnet exports.generateNewSegwitAddress = function () { // let keyPair = bitcoinjs.ECPair.makeRandom() -- for bitcoin mainnet let keyPair = bitcoinjs.ECPair.makeRandom({network: testnet})
I don't get what is the issue here.
Same issue, with bitcoind in testnet mode, the app try to create a livenet address
Okay, testnet support feature is obviously demanded. Ill implement it nearest time.
Hello @Overtorment .
Have you solved the issue on testnet?
I am still getting the same error Invalid address
.
Thank you.
I just solve the issue.
var testnet = bitcoinjs.networks.testnet
var keyPair = bitcoinjs.ECPair.makeRandom({ network: testnet })
var wif = keyPair.toWIF()
var address = keyPair.getAddress()
I can make a PR if you want.
Please do. Testnet should be configurable in config
-Igor
On Feb 23, 2018, 16:26 +0000, freshgreen notifications@github.com, wrote:
I just solve the issue. var testnet = bitcoinjs.networks.testnet var keyPair = bitcoinjs.ECPair.makeRandom({ network: testnet }) var wif = keyPair.toWIF() var address = keyPair.getAddress() I can make a PR if you want. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@ITsolution-git ^^^
@Overtorment Would you please add me as a collaborator?
@ITsolution-git Why not. Added. But better add things through pull-requests in order to review them
@Overtorment Done. Please review.
testnet support added by @ITsolution-git thanks!
Firstly, thanks for creating this very useful code. I am using it to test payment gateway with Bitcoin testnet. I have altered signer.js for testnet -
let testnet = bitcoinjs.networks.testnet // define bitcoin testnet exports.generateNewSegwitAddress = function () { // let keyPair = bitcoinjs.ECPair.makeRandom() -- for bitcoin mainnet let keyPair = bitcoinjs.ECPair.makeRandom({network: testnet})
But when I hit the -"http://localhost:2222/request_payment/0.005/BTC/wheres%20the%20money%20lebowski/seller3/customer2/http%3A%2F%2Fgoogle.com%2F"
it returns - " "error": "{\"result\":null,\"error\":{\"code\":-5,\"message\":\"Invalid Bitcoin address or script\"},\"id\":\"2c015994-6f01-4acd-94e4-77bd2b1d547c\"}\n""
Please suggest if I need to add something to make it work on the bitcoin testnet. Thanks in advance!