Crypto Flexs
  • DIRECTORY
  • CRYPTO
    • ETHEREUM
    • BITCOIN
    • ALTCOIN
  • BLOCKCHAIN
  • EXCHANGE
  • ADOPTION
  • TRADING
  • HACKING
  • SLOT
  • TRADE
Crypto Flexs
  • DIRECTORY
  • CRYPTO
    • ETHEREUM
    • BITCOIN
    • ALTCOIN
  • BLOCKCHAIN
  • EXCHANGE
  • ADOPTION
  • TRADING
  • HACKING
  • SLOT
  • TRADE
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

The strategy has hit the highest market cap since the Rally Bitcoin rally.

July 17, 2025

21.72% of encryption in the second quarter of 2025

July 11, 2025

As Nano Labs begins to accumulate $ 1 billion, BNB gets a big supporter.

July 5, 2025
Add A Comment

Comments are closed.

Recent Posts

Ether Lee Rium breaks $ 3K with 7,200% of the virus L2 coin eyes.

July 20, 2025

XRP Breaks Through $3.5! DL Mining Launches AI Cloud Mining Contracts, Earning Steady Profits Every Day

July 20, 2025

AAVE gains strength as AAVE dominates defect loans with net deposits of $ 50B or more.

July 19, 2025

As XRP Surges, DLMining Platform Opens New High-yield Cloud Mining Opportunities For Holders

July 19, 2025

Missed Out On Bitcoin At $9999? SIM Mining Cloud Mining Brings You New Opportunities For Wealth!

July 19, 2025

NFT is a rebound -there is a teenage NFTS this week.

July 19, 2025

MultiBank Group To List $MBG Token On Gate.io And MEXC During Official Token Generation Event

July 18, 2025

Earn $4,777 Daily! PaxMining Leads 2025’s Record-Breaking Bitcoin Mining Boom

July 18, 2025

GSR Leads $100M Private Placement Into Nasdaq-listed MEI Pharma To Launch First Institutional Litecoin Treasury Strategy Alongside Charlie Lee

July 18, 2025

KuCoin Launches XStocks, Delivering A One-Stop Access Point To Top Global Tokenized Equities

July 18, 2025

💵 FREE $18 USDT – Just For Signing Up!

July 18, 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

Ether Lee Rium breaks $ 3K with 7,200% of the virus L2 coin eyes.

July 20, 2025

XRP Breaks Through $3.5! DL Mining Launches AI Cloud Mining Contracts, Earning Steady Profits Every Day

July 20, 2025

AAVE gains strength as AAVE dominates defect loans with net deposits of $ 50B or more.

July 19, 2025
Most Popular

Secret Sharing and Erasure Coding: A Guide for the Aspiring Dropbox Decentralizer

May 30, 2024

HKMA releases quarterly disclosure and financial stability report for September 2024

September 27, 2024

Ethereum price remains strong, but DApp activity is down 23%, raising concerns.

October 15, 2024
  • 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.