Questions tagged [bitcoinjs]
BitcoinJS allows you to create webpages that pull information from the blockchain.
74
questions
0
votes
1answer
55 views
Can we sign a psbt raw tx having multiple inputs created from BTC node with bitcoinjs lib?
Due to secruity reasons, unavailablity of private keys on my end and as per project requirements I need to build back end apis where I will provide a PSBT raw transaction hex (having multiple inputs) ...
0
votes
1answer
178 views
Looking for JS/Node.js code example to sign a transaction (with multiple UTXOs) with only the extended private key
Is there any Javascript code out there or examples on how to sign a transaction by using the extended-private-key?
What I am essentially looking for is code that will help derive the private key, ...
1
vote
1answer
453 views
How to get unspents for inputs using bitcoinjs-lib?
I would like my simple wallet app to automatically select UTXOs for inputs. I realize that I can't accomplish this with just bitcoinjs, but is there something I can add to it to keep track of unspents?...
0
votes
1answer
898 views
How to retrieve readable private key from bitcoinjs-lib
I'm still new to bitcoin and experimenting a lot with bitcoinjs-lib in JavaScript.
How do I create a readable string from a private key?
This is my current setup:
const seed = bip39....
0
votes
1answer
246 views
Why do I get: Error: <address> has no matching Script
The example code for psbt.addOutput() with address '1KRMKfeZcmosxALVYESdPNez1AP1mEtywp' works as expected. But if I change this to an testnet address I get this error: ' has no matching script'. I ...
1
vote
1answer
451 views
Tracking incoming transactions using nodejs and own node
I need to verify that user from my database has sent btc to my wallet.
Ideally I want to generate a unique address for each user transaction and then track all those addresses but I suppose it will ...
0
votes
1answer
82 views
How to get BTC transfer amount from raw tx using bitcoinjs
Suppose I have following object
console.log(bitcoinjs.Transaction.fromHex(rawTx));
The output
Transaction {
version: 2,
locktime: 1655960,
ins: [
{
hash: <Buffer dc 4d aa 10 db ...
0
votes
1answer
99 views
How to calculate fee in BitcoinJS raw transaction?
I have a transaction with 3 inputs and 2 outputs. 1output is the recipient and the other output is change address. How should I calculate the fee and apply it to output?
0
votes
3answers
567 views
how to generate bitcoin adddres using seed?
Hi i am new to bitcoin all i want to know is how to generate address using mnemonic seed?
let testnet =Bitcoin.networks.testnet;
let keypair =Bitcoin.ECPair.makeRandom({network:testnet});
let address=...
1
vote
2answers
97 views
How to verify the compressed signature in Bitcoin? It is 138 long in hex
I am using the bicoinjs-message npm module for signature verification.
I learned that there are few signatures which are of length 138 in hexadecimal.
When I tried to verify such a signature it is ...
0
votes
1answer
117 views
How to get Bitcoin input transaction hash string from bitcoinjslib Transaction object?
I'm using bitcoinjs-lib and its Transaction object. Transaction.ins is an array of objects, each which has a hash and script property. Both of these properties are Uint8Arrays.
I am trying to get ...
0
votes
0answers
30 views
How to get raw tx in hex format by not fetching API from provider?
I've looking for some solution to encode raw transaction in hex format by programmatically without fetching data from any blockchain provider. Are there any way to do this?
2
votes
0answers
207 views
How to send & receive bitcoin using bitcoinjs-lib?
First I create HD Wallet using BIP32 using mnemonics.
Now I want to generate new child addresses with private key using xpub & xpriv for every receive.
Then for example, I received BTC in 2 ...
1
vote
0answers
41 views
How can I use PSBT in a JavaScript project?
I am trying to use PSBT in a Bitcoin project.
The idea is to generate keys and sign transactions client-side.
I am already familiar with bitcoinjs-lib but I find the API rather complicated.
It would ...
1
vote
0answers
38 views
How to use Digital Signature to Sign Unsigned Transaction?
so I was trying to sign my unsigned transaction:
...
0
votes
0answers
48 views
Using a bitcoin library to create digital signatures in TypeScript/Javascript
I have been trying to sign my transactions with a digital signature for the past few days but seems that libraries in bitcoin, as far as to my knowledge do not provide a simple way to sign the ...
0
votes
1answer
42 views
How to do tx.addInput without tx_hash if sending from address for the first time?
Iam using the bitcoinjs-lib library and trying to do a transaction. Iam doing the tx.addInput method before building but running into a build issue. I assume an error is thrown if ...
2
votes
1answer
76 views
How to fetch all UTXO from a SPV wallet using bitcoin-filter.js (or other lib)?
I am using bitcoinjs-lib to create private key (WIF), addresses and sign the transactions.
I would like to fetch all transactions (UTXOs) associated with a wallet. I found these libs: bitcoin-filter ...
0
votes
3answers
445 views
Creating an OP_CSV transaction with bitcoinjs
I'm working on a tool for timelocked contract generation. My redeem script looks like so:
OP_HASH160 <revocationHash> OP_EQUAL
OP_IF
<bobPubKey>
OP_ELSE
<timeDelay> ...
1
vote
1answer
208 views
Bitcoinjs-lib how to add multiple utxos in addInput
Hi i want to make transactions of bitcoin bech32 addresses using bitcoinjs-lib , here is my code below, it works fine when my address has only one utxos but when it increases to two or more as its ...
3
votes
3answers
769 views
How do you switch your bitcoinjs integrationfrom TransactionBuilder to transactions-psbt.js?
the code below works:
const btc = require('bitcoinjs-lib');
var tx = new btc.TransactionBuilder(net);
inputs.forEach(o => tx.addInput(o.txId, o.vout));
outputs.forEach(o => tx.addOutput(o....
0
votes
2answers
116 views
How can I consume my whole bitcoin balance in a single transction? Is it possible to use multiples UTXOs in a single transaction?
I want to make use of a single bitcoin address for payment. I'm using bitcoinjs library's transction builder for creating my own transaction. Can anyone help with a proper code to use multiple UTXO's ...
1
vote
1answer
423 views
Cannot sign txn with change address using bitcoinjs-lib psbt
I am having a difficult time figuring out how to sign a spend from a change address. I get Error: cannot sign for this input with the key <value>. The initial transaction works fine, where I ...
0
votes
0answers
40 views
Sign a Partially Signed rawtransaction with bitcoinjs-lib
I was trying to figure out how to use the bitcoinjs-lib. I was thinking if I could sign a partially signed raw transaction in bitcoijs-lib.
For example - If I have a hex String whose input1 is ...
2
votes
1answer
1k views
How to get xpriv and xpub from keyPair with bitcoinjs-lib
I have this code:
const bitcoin = require('bitcoinjs-lib');
const keyPair = bitcoin.ECPair.makeRandom({ });
Question: how do I get xpriv and xpub from keyPair
2
votes
2answers
4k views
Create OP_RETURN tx with Bitcoinjs-lib
I know how to create a basic TX:
var bitcoin = require('bitcoinjs-lib')
var tx = new bitcoin.Transaction()
// Add the input (who is paying) of the form [previous transaction hash, index of the ...
0
votes
1answer
249 views
Cannot read property 'toWIF' of undefined
I am working on a cryptocurrency site in which each user will have there own individual deposit address to put currency on site. I am using bitcoin-core, bitcoinjs-lib, along with quite a few other ...
0
votes
1answer
1k views
How do you sign data with a private key? [javascript]
Using BlockCypher’s signing tool (link), I can sign the following data:
05de69f5d37f41340eed3230f03d2394dde5e497738a76f027b7d962a0cbdf39
with the private key:
...
0
votes
0answers
32 views
How do you sign transactions from a HD wallet? [duplicate]
I'm using the following tool to generate a HD wallet:
https://iancoleman.io/bip39/
However, it gives quite a few different private keys and I'm not sure which one is used to sign transactions with.
...
0
votes
1answer
117 views
how to create a transaction that can only run in bch-abc using javascript?
I use the "bitcoincashjs" or "bch-lib" and want to add a new opcode "OP_CHECKDATASIG" to output.How to do?
const utxo = {
'txId' : '...
0
votes
1answer
212 views
Generating Output Script from Bitcoin.js or other Javascript Library
I'm attempting to use the Ledger Wallet API to sign a multi-sig transaction. The API works as follows:
var inputs = [
[ "71f97fa2a21486ecd99674a8ae068d92acd2e9db49c199473be39984e6cbe0f6", "00000000"...
0
votes
2answers
351 views
Using BitcoinJS - How do you verify a message using a segwit bech32 (bc1…) / P2SH (3…) addresses?
I created a signature from a message using my private key. But how do I verify this signed message using my segwit addresses of 3... or bc1...? How do I verify this using the BitcoinJS library?
2
votes
1answer
1k views
How to create a brainwallet with bitcoinjs?
This is how to create a brainwallet with bitcore
const Bitcore = require("bitcore-lib");
// const Mnemonic = require("bitcore-mnemonic");
// https://bitcore.io/api/lib/crypto
let brainsrc= 'satoshi'
...
0
votes
1answer
890 views
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'fromSeedBuffer' of undefined
I am getting Getting error at this line
var root = bitcoin.HDNode.fromSeedBuffer(seed);
UnhandledPromiseRejectionWarning: TypeError: Cannot read property
'fromSeedBuffer' of undefined
Here is ...
1
vote
1answer
34 views
Can I use wallet balance in satoshis as input for transaction builder ( bitcoinjs-lib )? [closed]
Can I use wallet balance in satoshis as input for transaction builder using bitcoinjs-lib ?
If yes, how?
0
votes
2answers
580 views
How to change network on BitcoinJS-lib with Coininfo and generate Dogecoin address?
Can't find out how to change network on BitcoinJS-lib with Coininfo and generate Dogecoin address?
In a Coininfo's example I found this: https://github.com/cryptocoinjs/coininfo#want-to-use-with-...
1
vote
1answer
377 views
Can't generate same addresses as bitcoincore using xprv from bitcoin-core
First of all all addresses below are for testing purposes so I don't care about private keys.
So dumped wallet created by Bitcoin-qt v0.16.2:
extended private masterkey: ...
4
votes
4answers
194 views
Preventing the exposure of public addresses on a website
Rather than having a single, fixed address, I want to generate a new address on my website every time a user request comes in.
I'm concerned about google or another web crawler indexing my website ...
0
votes
1answer
525 views
Bitcoinjs-lib help with deterministc wallet
i'm learning about bitcoin, and bitcoinjs-lib (https://github.com/bitcoinjs/bitcoinjs-lib)
I created a dummy wallet on coinomi using this mnemonic ('eight better wealth display father cave suffer ...
0
votes
1answer
145 views
Bitcoinjs module missing issue
I am trying to run this code with node and bitcoinjs-lib but I keep getting missing lib.
Any idea what am I missing?
I am on a Windows Server 2016. I try to create a P2SH address by hashing a ...
1
vote
0answers
258 views
bitcoinjs-lib seems to skip a step in deriving addresses from a BIP 44 wallet
According to this wiki page to create a bitcoin address,
1) you have your public key of the properly derived path
2) Then SHA256 it
3) Then RIPEMD-160 it,
Add version byte at the front and boom ...
2
votes
1answer
272 views
Error pushing hex of tx, generated with bitcoinjs 1.0, on testnet
I'm new to bitcoin programming and decided to give it a try with the release of bitcoinjs-lib 1.0. Here is how I generate the hex for the transaction
var bitcoin = require('bitcoinjs-lib');
var key =...
1
vote
1answer
2k views
How to sweep a segwit bech32 private key?
I'm testing segwit bech32 addresses and generated the following using bitcoinjs:
address: bc1qc7u5njf4nf2rj3zys642mfc7nct6kdven8j4e9
private key: 5Kkzs8XrJNAmf9VQDFeGBfaRvSByAvPK6DbDXw5BVqswWaXSG2Y
...
1
vote
1answer
121 views
Where does the entropy of BitcoinJS' makeRandom() come from?
The library BitcoinJS (https://github.com/bitcoinjs) has a method called makeRandom(). Where does its entropy (randomness) come from? Is it as secure as the method from http://bitaddress.org/ (moving ...
1
vote
0answers
75 views
Using blockcypher BitcoinJs at clientside is secure or not?
I am trying to create new transaction using bitcoinjs at client side.
Is it a secure way to create a transaction from Client side, which includes curl call.
Scenario, if I start from creating the new ...
3
votes
1answer
2k views
How to push a raw transaction using BitcoinJS (and Request)?
I'm using BitcoinJS to create a playground for Bitcoin transactions.
I have created the following Javascript file:
const request = require('request');
const proxiedRequest = request.defaults({proxy: "...
1
vote
1answer
656 views
ScriptHash from bitcoin address with BitcoinJS
I need to interact with Electrum server API, in order to get UTXOs of a bech32 address.
Electrum doesn't support bech32 but supports searching by ScriptHash, which is be obtainable from an address.
...
0
votes
0answers
86 views
Transferring partial BTC between wallets if I know both private keys [duplicate]
Is there a way to transfer/import partial amounts of BTC from one wallet to another off the chain in order to avoid transaction fees? I assume this is how services like Coinbase get around letting you ...
2
votes
2answers
2k views
How to decode transaction inputs from raw data using bitcoinjs-lib?
I need to calculate fees for each transaction in block.
I retrieve raw block data and use bitcoinjs-lib library to decode it to Block object:
const block = Bitcoin.Block.fromHex(data.rawblock);
It ...
0
votes
1answer
252 views
Having issues broadcasting BitcoinJS transaction.
I'm trying to send testnet with bitcoinjs, but when I go to broadcast the hex, it gives me an error code that says "fee is too high: 12372928". Now, from my understanding, the fee is the input - ...