Title: Bitcoin Digital Signatures in TypeScript Post by: bitcoinNoob21 on September 18, 2020, 09:13:04 AM Hi all. I am new to development with bitcoin. I was trying to use ECDSA signatures for a transaction generated on JavaScript. But I am thoroughly confused to say the least.
First of all I would be really grateful if anyone of you could point me towards an example of using digital signatures to sign a transaction in JS/TS. This is my implementation of what I have done, with using bitcoinjs-lib. Code: const bitcoin = require('bitcoinjs-lib'); Can I replace digitalSignature with the private key? I tried to use txb.sign() but it requires a keyPair which I don't think is necessary if I am using a digitalSignature? Correct me if I am wrong? But still I tried to do something like Code: const keyPair = bitcoin.ECPair.makeRandom({ network: bitcoin.networks.testnet }); Now don't get me wrong I know this is wrong, but I am feeling pretty helpless in this situation. I am not sure how to proceed. How to use my digital signature for the unsigned transaction I generated. Is there anyway to sign the unsigned transaction bytes I generated? Should I be using any other library. Any help, literally any help would be much much appreciated. Title: Re: Bitcoin Digital Signatures in TypeScript Post by: BASE16 on September 18, 2020, 09:32:29 AM Code: pubKey = keyPair.publicKey; https://npmdoc.github.io/node-npmdoc-bitcoinjs-lib/build/apidoc.html (https://npmdoc.github.io/node-npmdoc-bitcoinjs-lib/build/apidoc.html) A lot of things change now and then so depending on the build you are using you can always check the master. https://github.com/bitcoinjs/bitcoinjs-lib/tree/master/test (https://github.com/bitcoinjs/bitcoinjs-lib/tree/master/test) |