Questions tagged [bitcoinjs]
BitcoinJS allows you to create webpages that pull information from the blockchain.
76
questions
7
votes
1answer
670 views
How to use bitcoinjs with TestNet?
One of my colleagues is trying to use bitcoinjs with TestNet, but apparently it doesn't like TestNet headers, so it doesn't work. Is there any way to make to use bitcoinjs with TestNet? Is there some ...
7
votes
1answer
740 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 ...
6
votes
1answer
1k views
Is there a good tutorial on how to use bitcoinjs exit nodes?
The documentation that I found seems to contain info about specific API calls, but no top level explaination/example.
Where can I find a practical concise example of using exit nodes?
I'd like to ...
5
votes
1answer
311 views
Are there live BitcoinJS Exit Nodes?
Where can I find some live (trusted?) BitcoinJS Exit Nodes?
I'm looking it it from the client perspective - I want to write a Java app that doesn't store a blockchain. I don't want to setup an exit ...
4
votes
2answers
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 ...
4
votes
1answer
212 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?
4
votes
1answer
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. ...
4
votes
4answers
193 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 ...
3
votes
1answer
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?
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: "...
3
votes
1answer
471 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-...
3
votes
3answers
634 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....
3
votes
0answers
212 views
BitcoinJS with no storage?
I have a use-case where I'd only need to be monitoring the mempool transactions and recently-committed blocks/transactions (the last month's worth of blocks would be sufficient). Is there a way to ...
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 ...
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 ...
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
1answer
333 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 ...
2
votes
1answer
56 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 ...
2
votes
1answer
324 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: ...
2
votes
1answer
294 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 ...
2
votes
1answer
271 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 =...
2
votes
1answer
283 views
Created an HTML5 Game, best way to integrate Bitcoin?
Okay so I just finished up a ping pong HTML5 game I've been working on as practice, and I was thinking of integrating Bitcoin into the game so when a user wins vs. the CPU, they get a small amount of ...
2
votes
0answers
185 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 ...
2
votes
1answer
930 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'
...
2
votes
1answer
419 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 ...
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
775 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 : ...
1
vote
1answer
269 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 ...
1
vote
1answer
116 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
1answer
601 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.
...
1
vote
1answer
986 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'...
1
vote
1answer
366 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'...
1
vote
1answer
335 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 ...
1
vote
1answer
490 views
Is BitcoinJS under active development?
I love the idea of a powerful alternative to bitcoind, and especially the ability to subscribe on blockchain events and easily process them on the server side.
However, I see the last activity on ...
1
vote
0answers
32 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
28 views
How to use Digital Signature to Sign Unsigned Transaction?
so I was trying to sign my unsigned transaction:
...
1
vote
2answers
68 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 ...
1
vote
1answer
160 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 ...
1
vote
1answer
329 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 ...
1
vote
1answer
345 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 ...
1
vote
1answer
32 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?
1
vote
2answers
529 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
0answers
246 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 ...
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 ...
1
vote
1answer
427 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?...
1
vote
0answers
106 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 ...
1
vote
0answers
1k views
Getting wallet balance with BitcoinJS + Bitcoin-lib (client lib)
I have server with BitcoinJS and Bitcoin ExitNode running. I try to fetch wallet balance from client with code from manual on wiki page. I have send money on client generated address, but app says ...
0
votes
3answers
429 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> ...
0
votes
2answers
334 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?
0
votes
2answers
101 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 ...