Skip to main content

Questions tagged [bitcoinjs]

BitcoinJS (bitcoinjs-lib) is JavaScript Bitcoin library.

Filter by
Sorted by
Tagged with
0 votes
2 answers
161 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 ...
AditiB's user avatar
  • 111
0 votes
1 answer
1k 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 ...
NoudS's user avatar
  • 1
0 votes
1 answer
514 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 ...
danosphere's user avatar
0 votes
0 answers
189 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 ...
Shubham Saxena's user avatar
2 votes
0 answers
391 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 ...
Monarth Sarvaiya's user avatar
0 votes
3 answers
2k 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=...
syeda Roushan Arshid's user avatar
1 vote
1 answer
2k 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....
mesqueeb's user avatar
  • 131
0 votes
1 answer
752 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 ...
Mason's user avatar
  • 1
0 votes
1 answer
2k 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: ...
timothyylim's user avatar
0 votes
0 answers
41 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. ...
timothyylim's user avatar
2 votes
1 answer
3k 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
jfjobidon's user avatar
  • 285
0 votes
1 answer
1k 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 ...
Ishwar Chandra Tiwari's user avatar
2 votes
1 answer
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' ...
TSR's user avatar
  • 143
1 vote
1 answer
56 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?
Oysho Boy's user avatar
1 vote
1 answer
619 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: ...
elderapo's user avatar
  • 134
-2 votes
2 answers
393 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, ...
Prem Govind's user avatar
0 votes
1 answer
328 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"...
patwhite's user avatar
  • 101
0 votes
1 answer
807 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 ...
Caio Souza Andrade's user avatar
0 votes
2 answers
1k 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-...
Oysho Boy's user avatar
0 votes
1 answer
313 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 ...
Robert's user avatar
  • 351
1 vote
0 answers
396 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 ...
arshbot's user avatar
  • 1,808
1 vote
2 answers
592 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?
Patoshi パトシ's user avatar
3 votes
2 answers
4k 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 ...
Patoshi パトシ's user avatar
1 vote
1 answer
184 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 ...
Dalit Sairio's user avatar
1 vote
0 answers
103 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 ...
Kunal Birhade's user avatar
3 votes
1 answer
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: "...
smartmouse's user avatar
2 votes
1 answer
680 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?...
Setheroni's user avatar
2 votes
1 answer
2k 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. ...
youssef's user avatar
  • 266
0 votes
0 answers
125 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 ...
Devan Buggay's user avatar
0 votes
1 answer
274 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 - ...
Setheroni's user avatar
2 votes
2 answers
3k 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 ...
keaukraine's user avatar
0 votes
1 answer
164 views

How BitcoinJS sync bitcoin blockchain/transaction data?

I see the reference code in BitcoinJS website about 'Creating a Transaction': var tx = new bitcoin.TransactionBuilder() // Add the input (who is paying): // [previous transaction hash, index of the ...
Anderson's user avatar
  • 245
0 votes
3 answers
573 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> ...
Colin Atkinson's user avatar
0 votes
1 answer
2k views

HD wallet implementation

I want to create public addresses in offline browser from master public key so that owner of master private can access the funds available in child address. but I am not able to understand how to use ...
rahul's user avatar
  • 131
1 vote
1 answer
1k views

Specifying fee amount using bitcoinjs

I'm currently playing with bitcoinjs (https://bitcoinjs.org/) and I'm creating offline transactions that I broadcast over the network after. I've successfully create my first transaction using this : ...
Jérémy Seban's user avatar
1 vote
1 answer
1k views

How to create a deterministic wallet using bitcoinjs-lib

I'm new to bitcoin technology, however, I'm trying to develop a web wallet using bitcoinjs-lib that works like that of blockchain.info. I've gone through the code samples on the github repo but couldn'...
Chibuzo's user avatar
  • 111
5 votes
1 answer
2k views

How do you validate a bitcoin address using bitcoinjs library in javascript?

How would one validate a bitcoin address using the bitcoinjs library? Or is there another way to do this via javascript?
Patoshi パトシ's user avatar
0 votes
1 answer
484 views

How to convert a keyPair to JSON and back?

Using bitcoinjs you can generate a keyPair with the following code: var keyPair = bitcoin.ECPair.makeRandom(); How can I stringify this object to JSON and then parse it back to an object? JSON doesn'...
user1929274's user avatar
3 votes
1 answer
717 views

Understanding signing messages with bitcoinjs-lib

I'm trying to understand what a specific line of code does when signing a message using bitcoinjs-lib. Here's the code: var bitcoin = require('bitcoinjs-lib') var bitcoinMessage = require('bitcoinjs-...
user1929274's user avatar
6 votes
1 answer
2k views

How to use bitcoinjs-lib with Regtest?

I was trying to use the bitcoinjs-lib (1) with my regtest network. More specifically I was trying to build a tx with TransactionBuilder but it gave me a 'transaction has no matching Script' exception. ...
joe.js's user avatar
  • 592
1 vote
0 answers
127 views

BItcoinjs - safest way to manage wallet on a potentially untrusted device

As per the title, what would be the safest way to run a Bitcoin wallet on a potentially untrusted device, such as a mobile phone? The question assumes the usage of bitcoinjs-lib (which allows, among ...
youser's user avatar
  • 11
2 votes
1 answer
521 views

OP_RETURN Promise with bitcoinjs-lib v2.2.0 and blockchain.info

So the below is the function I'm running. I'm sending in the key for this bitcoin address 16WBguy6KVyTGnF4KX7Vmdx8ztj4wENh4W and the message bkawk to this function // Require the packages that ...
Will-In-China's user avatar
1 vote
1 answer
347 views

How to develop an ownership tracking service based on bitcoin blockchain

Now I expect to develop an ownership tracking service like Ascribe. I'm planning to develop it as following, however I am not sure whether my plan is correct. Therefore, please let me ask two ...
Toshi's user avatar
  • 251
1 vote
1 answer
346 views

OP_EQUALVERIFY Problem

I'm making a full-service wallet, I already made the UTXOs selection algorithm and now I want to push the transaction hex bytes. It works when I push only a transaction with only 1 input, but if I try ...
caxco93's user avatar
  • 93
7 votes
1 answer
778 views

Which language has better Bitcoin API experience, C# or Node.js?

At the moment it seems to me on the .NET side NBitcoin would compete with Bitcoin.js on the other. Update: I decided on NBitcoin. It has a great book to learn from. Note I will not form opinion on my ...
nopara73's user avatar
  • 846
5 votes
2 answers
2k views

How do you broadcast a transaction programatically?

What is the best way to broadcast a transaction to the network programatically? I know that blockchain.info has /pushtx but I'm pretty sure it rejects XHR requests from external sources because of ...
Andrew Malta's user avatar
4 votes
1 answer
278 views

Do all implementation of Deterministic RFC6979-compliant ECDSA signatures generate the same signed transaction given the same data?

So if I were to create the same transaction using bitcoinjs and bitcoinj, the end result of the signed transaction would be the same with both libraries, is that correct?
User134's user avatar
  • 115
2 votes
1 answer
365 views

Why am I unable to post two transactions (the second from the change address of the first) in the same block?

I'm attempting to make a transaction on the testnet with an OP_RETURN and a change address in it, and then make a second OP_RETURN transaction from first transaction's change address in the same ...
JNCF's user avatar
  • 89
2 votes
1 answer
337 views

Hybrid Bitcoin web wallet for performing multi-sig transaction on an e-commerce site

Two participants in a transaction, a buyer and a seller, need to interact financially. For security, they themselves keep their private keys and sign transactions on client using JS. I want to create ...
Ami's user avatar
  • 123
4 votes
4 answers
211 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 ...
ken Code's user avatar