• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

bitcoinjs – Transaction sending failed (No script found for input #0)

Moussa by Moussa
January 10, 2024
in Bitcoin
0
peer discovery – how to obtain the IP addresses of nodes for mining pools?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


I tried to make a simple btc transfer but i got this error: No script found for input #0. What did i miss?

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,
    });
};



Source link

Related articles

peer discovery – how to obtain the IP addresses of nodes for mining pools?

Who maintains BTCRecover?

October 8, 2025
Ethereum Price Climbs As ETH Trading Volume Overtakes Bitcoin

Ethereum Price Up 2%, SharpLink Gains Soar As Staking ETP Live

October 8, 2025
Share76Tweet47

Related Posts

peer discovery – how to obtain the IP addresses of nodes for mining pools?

Who maintains BTCRecover?

by Moussa
October 8, 2025
0

BTCrecover is often suggested as a tool for recovering partly forgotten wallet passwords etc. Who maintains this software? Source link

Ethereum Price Climbs As ETH Trading Volume Overtakes Bitcoin

Ethereum Price Up 2%, SharpLink Gains Soar As Staking ETP Live

by Moussa
October 8, 2025
0

Join Our Telegram channel to stay up to date on breaking news coverage The Ethereum price has pumped 2% in...

ASI Is Coming And Equities Know It. So How Do You Make It Big With AI In Crypto?

ASI Is Coming And Equities Know It. So How Do You Make It Big With AI In Crypto?

by Moussa
October 8, 2025
0

The AI age is upon us, and you cannot ignore it. Now that the quest for AI Superintelligence has been...

XRP Price Reaches Legendary 4.236 Fibonacci Level Once Again, Is A Rally To $9 Possible From Here?

XRP Price To Teleport To $6.9 Once Wave 3 Of 3 Is Completed

by Moussa
October 8, 2025
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure The XRP price is already seeing a...

The Historical Performance That Says Dogecoin Price Will Hit $11.71 By End Of Year

The Historical Performance That Says Dogecoin Price Will Hit $11.71 By End Of Year

by Moussa
October 8, 2025
0

Historically, the Dogecoin price has recorded some of the most legendary rallies in the crypto space. Over the last couple...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJTIybm4lMjIlMjBpZCUzRCUyMnRucC0xJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1lbWFpbCUyMiUzRSUzQ2xhYmVsJTIwZm9yJTNEJTIydG5wLTIlMjIlM0VFbWFpbCUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1lbWFpbCUyMiUyMHR5cGUlM0QlMjJlbWFpbCUyMiUyMG5hbWUlM0QlMjJuZSUyMiUyMGlkJTNEJTIydG5wLTIlMjIlMjB2YWx1ZSUzRCUyMiUyMiUyMHJlcXVpcmVkJTNFJTNDJTJGZGl2JTNFJTBBJTNDZGl2JTIwY2xhc3MlM0QlMjJ0bnAtZmllbGQlMjB0bnAtcHJpdmFjeS1maWVsZCUyMiUzRSUzQ2xhYmVsJTNFJTNDaW5wdXQlMjB0eXBlJTNEJTIyY2hlY2tib3glMjIlMjBuYW1lJTNEJTIybnklMjIlMjByZXF1aXJlZCUyMGNsYXNzJTNEJTIydG5wLXByaXZhY3klMjIlM0UlQzIlQTBCeSUyMGNvbnRpbnVpbmclMkMlMjB5b3UlMjBhY2NlcHQlMjB0aGUlMjBwcml2YWN5JTIwcG9saWN5JTNDJTJGbGFiZWwlM0UlM0MlMkZkaXYlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1idXR0b24lMjIlM0UlM0NpbnB1dCUyMGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News