Crypto Flexs
  • DIRECTORY
  • CRYPTO
    • ETHEREUM
    • BITCOIN
    • ALTCOIN
  • BLOCKCHAIN
  • EXCHANGE
  • ADOPTION
  • TRADING
  • HACKING
  • SLOT
Crypto Flexs
  • DIRECTORY
  • CRYPTO
    • ETHEREUM
    • BITCOIN
    • ALTCOIN
  • BLOCKCHAIN
  • EXCHANGE
  • ADOPTION
  • TRADING
  • HACKING
  • SLOT
Crypto Flexs
Home»BITCOIN NEWS»bitcoinjs – Transaction transfer failed (script not found for input #0)
BITCOIN NEWS

bitcoinjs – Transaction transfer failed (script not found for input #0)

By Crypto FlexsJanuary 10, 20241 Min Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
bitcoinjs – Transaction transfer failed (script not found for input #0)
Share
Facebook Twitter LinkedIn Pinterest Email

I tried making a simple BTC transfer but got the following error: Script not found for input #0. What am I missing?

const bitcoin = require("bitcoinjs-lib");
const ECPairFactory = require("ecpair");
const ecc = require("tiny-secp256k1");
const  RegtestUtils  = require("regtest-client");

module.exports = async function (req, res) 
    const regtestUtils = new RegtestUtils(
        APIURL: "https://regtest.bitbank.cc/1",
        APIPASS: "satoshi",
    );

    const network = regtestUtils.network; // regtest network params

    const ECPair = ECPairFactory.ECPairFactory(ecc);
    const keyPair = ECPair.fromWIF(
        "xxxxxxxx"
    );

    const p2pkh = bitcoin.payments.p2pkh(
        pubkey: keyPair.publicKey,
        network,
    );

    const unspent = await regtestUtils.faucet(p2pkh.address, 2e4);

    const txb = new bitcoin.Psbt( network );
    txb.setVersion(2)
        .setLocktime(0)
        .addInput(
            hash: unspent.txId,
            index: unspent.vout,
        )
        .addOutput(
            address: regtestUtils.RANDOM_ADDRESS,
            value: 1e4,
        )
        .signAllInputs(keyPair);

    const tx = txb.build();

    console.log("hash", tx.toHex());

    return;

    // build and broadcast to the Bitcoin Local RegTest server
    await regtestUtils.broadcast(tx.toHex());

    // This verifies that the vout output of txId transaction is actually for value
    // in satoshis and is locked for the address given.
    // The utxo can be unconfirmed. We are just verifying it was at least placed in
    // the mempool.
    await regtestUtils.verify(
        txId: tx.getId(),
        address: regtestUtils.RANDOM_ADDRESS,
        vout: 0,
        value: 1e4,
    );

    res.status(400).json(
        error: false,
        message: address,
    );
;

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

Related Posts

Apple, X, Airbnb Eye Stablecoin Integration

June 7, 2025

Does Ethereum start their business? MorningStar Candlestick Pattern tells the story

June 6, 2025

Bitcoin Is An Unreplicable Lifeline In Authoritarian Regimes

June 6, 2025
Add A Comment

Comments are closed.

Recent Posts

How does it affect Bitcoin?

June 7, 2025

Gala Games introduces a step -by -step approach to founder node staking.

June 7, 2025

AB starts in binance

June 7, 2025

ETF publisher’s latest warning -SEC’s approval process ‘Innovation, AIDS GIANTS’

June 7, 2025

Solana (SOL) introduces Alpenglow for faster blockchain agreement.

June 7, 2025

The Foresight Ventures report shows a collection shift where more than 32,000 sellers around the world accept encryption.

June 7, 2025

$ AB is live on Binance, guiding the new era of new cross chain asset mobility.

June 7, 2025

Trump memoin is faced with a $ 520m lock in July and the price drops by 85%.

June 7, 2025

Vaneck launches GPZ ETF for alternative asset managers.

June 7, 2025

Apple, X, Airbnb Eye Stablecoin Integration

June 7, 2025

Strategy to raise almost $ 1B by STRD priority proposal for BTC accumulation

June 7, 2025

Crypto Flexs is a Professional Cryptocurrency News Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of Cryptocurrency. We hope you enjoy our Cryptocurrency News as much as we enjoy offering them to you.

Contact Us : Partner(@)Cryptoflexs.com

Top Insights

How does it affect Bitcoin?

June 7, 2025

Gala Games introduces a step -by -step approach to founder node staking.

June 7, 2025

AB starts in binance

June 7, 2025
Most Popular

Coinbase said Justin Sun was an ‘unacceptable risk’ in packaging Bitcoin after delisting wBTC.

December 18, 2024

Russia’s Crypto Infrastructure Aims to Circumvent Western Sanctions, According to Chainalysis

September 6, 2024

Blessing or curse on the encryption market?

March 28, 2025
  • Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions
© 2025 Crypto Flexs

Type above and press Enter to search. Press Esc to cancel.