Skip to main content

Questions tagged [javascript]

JavaScript is a high-level programming language widely used for web development.

Filter by
Sorted by
Tagged with
0 votes
0 answers
39 views

How to sign a message with privateKey on Bitcoin using TS/JS?

I'm trying to sign the message to UniSat to this endpoint Bind btcAddress and nftAddress. Using code like: import * as bitcoin from 'bitcoinjs-lib'; import * as ecc from 'tiny-secp256k1'; import * as ...
dill's user avatar
  • 1
0 votes
1 answer
30 views

How can you make the most basic version of BTC Nodes/Peer to Peer communication?

I started to work on my version of blockchain, and for that, I read how everything works, and everything made sense. But when I got to Nodes/CConnman/CNode, after reading for a week, I understood most ...
Rahul Mishra's user avatar
0 votes
0 answers
51 views

Getting error for transferring BTC using node js code, getting error "No inputs were signed"

I am creating a system where users will raise a request to transfer them some BTC, in my code i am using all the previous utxos of my wallet to transfer BTC, even i am signing all the utxos still i am ...
Arun Lohia's user avatar
2 votes
2 answers
86 views

After signing a message, how to verify the signature with JavaScript/TypeScript?

At the frontend, user signs an arbitrary message (e.g., "Sign this message to prove that you own this wallet"). We can do this via, for example, UniSat's signMessage function (see here). I ...
Yan's user avatar
  • 173
0 votes
1 answer
90 views

How to create and sign a segwit transaction using any npm pacakge

So I am using this NPM package ( https://www.npmjs.com/package/bitcore-lib ) to create and sign a Bitcoin legacy transaction locally and it was working fine for legacy. But when I tried to do the same ...
Sudhanshu Sinha's user avatar
4 votes
1 answer
103 views

Why is my P2WSH OP_IF/NOTIF argument not minimal?

I have created an HTLC with the following Bitcoin script using bitcoinlib-js: const redeemScript = bitcoin.script.compile([ bitcoin.opcodes.OP_IF, bitcoin.opcodes.OP_SHA256, ...
Oscar Chambers's user avatar
0 votes
1 answer
101 views

How to recover wallet from Master Private Key?

I've tried this approach to recover litecoin wallet, but it seem to print wrongly generated hashes (as I actually have wallet public and private keys for comparison), what can be wrong here? my wallet ...
Masofke's user avatar
1 vote
1 answer
59 views

Using bitcore-p2p and bitcore-lib to get block data

I've prepared a Nodejs javascript script to (attempt to) fetch block information for an example testnet block (3) from the P2P network, using bitcore-p2p library (which uses the getdata P2P protocol, ...
Lee's user avatar
  • 958
0 votes
1 answer
203 views

bitcoinjs - mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)

I'm trying to follow the below transaction example by magic eden and extend it to support multiple buyers and seller (in red). However I am having difficulties when I add more than one signature from ...
psbt_trustless_tx's user avatar
1 vote
1 answer
182 views

How to use BlockCypher's test network with BitcoinJS-lib?

Trying to make a PSBT via BitcoinJS-lib. I'm using BlockCypher's internal testnet (bcy/test) because I have no choice: literally every other testnet faucet I tested was broken. Using BlockCypher's API ...
1owk3y's user avatar
  • 115
1 vote
1 answer
239 views

non-mandatory-script-verify-flag (Invalid Schnorr signature)

I try to put this into a Psbt: Alice make payment to purchase an amount of BRC-20 from Bob Bob request to inscribe a transfer of BRC-20 by using Burner account Burner inscribe the transfer of BRC-20 ...
LikKee 沥祺 Richie's user avatar
2 votes
1 answer
439 views

"Witness program hash mismatch" code -26 when broadcasting a transaction

I'm trying to broadcast a transaction to my RPC provider: curl https://my-quicknode-rpc-provider/ \ -X POST \ -H "Content-Type: application/json" \ --data '{"method": &...
Sherwin Li's user avatar
2 votes
1 answer
203 views

Getting Error while trying to decode psbt base64 to json using bitcoinjs/bip174 library

const base64PSBT = 'base_64'; // Decode the base64 PSBT to a Buffer const psbtBuffer = Buffer.from(base64PSBT, 'base64'); // Parse the PSBT const psbt = bip174.Psbt.fromBuffer(psbtBuffer); // ...
soumyadeep.eth's user avatar
0 votes
1 answer
268 views

Redeem script for input #0 doesn't match the scriptPubKey in the prevout

I'm trying to create a new bitcoin transaction using bitcoinjs-lib. Here is my transaction. { "weight" : 661, "txid" : "...
Berry Blue's user avatar
3 votes
1 answer
1k views

How to build a transaction using bitcoinjs-lib

I'm trying to build a transaction using bitcoinjs-lib. Here is my last transaction. https://blockstream.info/api/tx/91feea5f5c7b67b3e56c0f5d23d6da3065855c23b4cc7dded8efd8ff8065500f { "weight&...
Berry Blue's user avatar
1 vote
1 answer
135 views

Do Bitcore APIs have daily limits?

I can't find online if the bitcore API (https://github.com/bitpay/bitcore/blob/master/packages/bitcore-node/docs/api-documentation.md) has daily limits for making requests, or if there is a need to ...
AlexCav's user avatar
  • 51
1 vote
0 answers
145 views

Transactions only work the first time

I'm implementing the code to sign and send Bitcoin transactions on testnet, using the bitcore library, in javascript. I need some help, as once I try to broadcast my transaction, it gives me this ...
AlexCav's user avatar
  • 51
0 votes
0 answers
281 views

Generate a Bitcoin taproot address with specific prefix for burning assets

I would like to generate a bitcoin taproot address (bc1p) for burning assets. Which means not one would have the private key. But in the mean time I would also want a vanity address (an address start ...
daniaoren's user avatar
3 votes
1 answer
268 views

How do descriptors work with miniscript in the library bitcoinerLab?

What I want is to be able to spend the funds from an address, either with its private key or with the private key of another address that I designate in the policy. As I understand it, it works like ...
Chupitastiiks's user avatar
1 vote
1 answer
722 views

How to get the private key & wallet address using a multi-wallet recovery seed phrase?

How can I „convert“ a 12-words-long multi wallet seed phrase (of the Blockchain.com wallet) to the wallets private key and the wallets address using any programming language? The given multi wallet ...
FledDev's user avatar
  • 151
1 vote
1 answer
301 views

How to send a Bitcoin transaction only using the seed phrase using NodeJS?

I am working on a NodeJS script that allows you to enter your 12-words-long Bitcoin secret recovery phrase and automatically withdraw all of your coins to a defined wallet address. The script is for ...
FledDev's user avatar
  • 151
0 votes
1 answer
45 views

Recreate Java code in python

I have a java code that I need to pass to python but I don't know which libraries to use and how to start and if you can help me I would really appreciate it MNEMONIC = "twenty four mnemonic ...
you1977's user avatar
  • 19
2 votes
1 answer
329 views

Invalid checksum when generating BIP-39 Mnemonic

I am trying to generate a mnemonic seed in Javascript, and while everything seems to be working, I am not getting a mnemonic with a correct checksum. Here is my implementation: export const ...
Egge's user avatar
  • 21
-1 votes
1 answer
950 views

bitcoinjs-lib is installed but cannot use its functions

I've installed the latest version of bitcoinjs-lib but I cannot use the functions of the library. const bitcoin = require('bitcoinjs-lib'); const keyPair = bitcoin.ECPair.makeRandom(); const { address ...
Tornike Tskhvediani's user avatar
-1 votes
1 answer
197 views

How to implement stake.com model of deposit & withdraw flow for my crypto poker casino?

In stake.com for each user they generate separate bech32 address for deposit & displays the deposited amount as balance in top of the navigation bar. Similarly for withdraw they just ask for the ...
Kimi Raikkonen 9790's user avatar
1 vote
1 answer
462 views

How to make bitcoin hd wallet in typescript?

I am trying to create HD wallet for bitcoin. I have developed an Ethereum wallet, but I am having a hard time making a Bitcoin wallet. In my case, I am developing a server using Golang and Typescript. ...
Primrose's user avatar
4 votes
1 answer
4k views

Uncaught TypeError: bip32.fromSeed is not a function

I am trying to run the below code to print the private key, the Public key and the mnemonics, but getting Uncaught TypeError: bip32.fromSeed is not a function : //Import dependencies const bip32 = ...
spraveenitpro's user avatar
2 votes
1 answer
989 views

Is there a Base58 encoder function that runs in pure javascript without node?

I see a lot of JavaScript Base58 encoder functions online, but all of them seem to require node. Is there a simple JavaScript Base58 encoder that will just run in the browser without any node ...
schulwitz's user avatar
  • 335
0 votes
1 answer
153 views

What are some different ways to retrieve btc transaction information of an address using bitcoinjs?

What are some different ways to retrieve btc transaction information of an address using bitcoinjs? I've tried using the syntax from this page (https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/...
jiamijiang's user avatar
1 vote
0 answers
91 views

Cannot unserialize chainstate transaction outputs after de-obfuscation

I was able to read chainstate database. Getting the key and de-obfuscating to get a valid last block. However, when it comes to transactions that follow after that, I cannot de-serialize them no ...
Anonymous's user avatar
  • 111
0 votes
1 answer
809 views

generating a zprv from a base58 rootKey with bitcoinjs-lib

var bitcoin = require('bitcoinjs-lib'); let bip32 = require('bip32'); let rootKey = 'xprv9s21ZrQH143K32CfqoCQHtbKiEb5BqFazXX6jCtNCnuty3gUjxS4CsXWi9rcNyHdjDVPiC6P1bnyEZr2ioouRq56h6HAdwejeTty1BsSEtL' ...
Not My Real Name's user avatar
0 votes
1 answer
416 views

Using Javascript, I want to generate a segwit private key (zprv) similarly to how I am generating my legacy base58 extended private key. How?

let bip32 = require('bip32'); let bip39 = require('bip39'); let { bech32, bech32m } = require('bech32') const seed = bip39.mnemonicToSeedSync('rural catch say tooth tell soul road pilot fee board ...
Not My Real Name's user avatar
2 votes
1 answer
295 views

How to spend from a custom P2SH script using bitcore-lib

My Javascript/typescript project uses bitcore-lib. It uses Script.buildScriptHashOut to build custom P2SH outputs. How do I spend from this custom output?
MCCCS's user avatar
  • 10.2k
0 votes
0 answers
59 views

Cryptocurrency Wallet 3rd party access

Do Crypto wallets such as Exodus etc have something like an API? For example is it possible to perform a cryptocurrency transaction directly from the web browser client (using the specified amount and ...
shauna vayne's user avatar
0 votes
1 answer
39 views

Distinguishing bitcoin deposits

If i had a central Bitcoin wallet, and then allowed 3 different people to deposit bitcoin into that address, would there be anyway to distinguish who they are, without knowing who's address is who, i ...
Nathan Leadill's user avatar
1 vote
0 answers
90 views

Bitcoin Script - Beautify

My question is if something exists to do the job in the opposite direction of miniscript. Miniscript's intention is to help:     ...writing (a subset of) Bitcoin Scripts in a structured way, enabling ...
Vlad Stan's user avatar
1 vote
3 answers
2k views

The best JavaScript libraries supporting Bitcoin Core?

I have downloaded and installed Bitcoin full node on my Linux server and I'd like to start working with the bitcoin core to create wallet, addresses, and transactions. What is the best JS libraries ...
Armin's user avatar
  • 11
1 vote
0 answers
217 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 ...
Mario Mazzola's user avatar
2 votes
0 answers
83 views

Sign transaction externally

I create a transaction with inputs from a given address / public key without signatures. Every input needs to be signed. I use a different method to generate the signatures so I can't provide a ...
Bernd Strehl's user avatar
1 vote
0 answers
671 views

bitcoind: How to get rawblock data with ZeroMQ

I am trying to use the zeromq api for bitcoind to get rawblock but its not working with the code I've provided below. I am able to get hashtx and rawtx if I remove the filter but not hashblock and ...
Kevin Kelbie's user avatar
1 vote
2 answers
1k views

Understand how transaction size and fees calculation works in caravan

Looks like there is no activity in caravan github repository so maybe someone here can help me with this issue. Already mentioned everything in the below link however my three basic questions are: ...
user avatar
2 votes
0 answers
455 views

How to connect to an ElectrumX server using JavaScript WebSockets?

I'm trying to connect to an ElectrumX server from an HTML webpage. But I can't get a working connection. I've tried with many servers from Electrum's servers.json list but none worked. Here's the ...
M.K. Safi's user avatar
  • 143
1 vote
0 answers
29 views

Is there any 'Metamask-like' app for Bitcoin? [duplicate]

9 months ago someone asked this same question: Metamask-like web3 inject for bitcoin but I was wondering if there had been be any changes since then. I'm currently looking for a Chrome extension that ...
Stack's user avatar
  • 127
1 vote
1 answer
1k views

How do I get old blocks while running a pruned node?

Hello I'm trying to build a NodeJS app that fetches Bitcoin blocks, potentially old ones, and I'm running into issues. I've downloaded Bitcoin Core but I don't have enough space to run a full node and ...
Colman Koivisto's user avatar
0 votes
2 answers
1k views

Generating Bitcoin address from private key in browser console

I am a newbie Bitcoin evangelist and I have a recommendation to see all the code responsible for computing yourPublicKey from yourPrivateKey, especially for big deal addresses. The easiest way to ...
rcfanboi's user avatar
0 votes
1 answer
88 views

how to sign a multiple output transaction

currently i m using below code,how to add multiple address to address. let transaction = new bitcore.Transaction() transaction .from(txoSet) .to( ...
indrajit's user avatar
0 votes
0 answers
93 views

How can i mine bitcoins to direct wallet using JavaScript?

I heard that we can mine bitcoins using javascript direct to the wallet? How can I create Program, script or application which direct mines to the wallet & I even search online but did not get ...
user avatar
0 votes
2 answers
278 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 ...
Michael Khoroshun's user avatar
0 votes
0 answers
197 views

broadcasting bitcoin transaction issue using bitcore-explorers

I have been trying to do a transaction using bitcore-lib. I have successfully created transaction object. let bitcore_transaction = new bitcore.Transaction() .from(utxos[0]) .to(to, +...
Komal Bansal's user avatar
0 votes
1 answer
49 views

JavaScript Mining System Design

How do I verify a unconfirmed transaction using JavaScript ?
Hide7's user avatar
  • 1