• 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

bitcoin core – Error in sending transaction:Insufficient funds

Moussa by Moussa
February 18, 2025
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


import Client from "bitcoin-core";
import fs from "fs";
const client = new Client({
  network: "regtest",
  username: "alice",
  password: "password",
  host: "http://alice:password@localhost:18443",
});
const SENDER_ADDRESS = "bcrt1qq2yshcmzdlznnpxx258xswqlmqcxjs4dssfxt2";

async function setTransactionFee() {
  try {
    const success = await client.setTxFee(0.00001);
    console.log("Transaction fee rate set to 21 sats/vB");
  } catch (error) {
    console.log("Error setting fee rate:", error);
  }
}
async function main() {
  // await client.loadWallet("testwallet");
  try {
    const address = await client.getNewAddress();
    console.log("Address:", address);
    await client.generateToAddress(103, address);
    const balance = await client.getBalance();
    console.log(balance);
    const txid1 = await client.sendToAddress(SENDER_ADDRESS, 100);
    console.log("Sent 100 BTC, TXID:", txid1);

    // 6. Get raw transaction details
    const txDetails = await client.getRawTransaction(txid1, true);

    // 7. Construct Raw Transaction
    const rawTx = await client.createRawTransaction(
      [
        {
          txid: txid1,
          vout: 0,
        },
      ],
      {
        bcrt1qq2yshcmzdlznnpxx258xswqlmqcxjs4dssfxt2: 100,
        data: Buffer.from("We are all Satoshi!!", "utf8").toString("hex"),
      }
    );

    // 8. Fund the raw transaction with required fee rate
    const fundedTx = await client.fundRawTransaction(rawTx, { fee_rate: 21 });
    console.log("Funded TX:", fundedTx);

    // 9. Sign the transaction
    const signedTx = await client.signRawTransactionWithWallet(fundedTx.hex);
    console.log("Signed TX:", signedTx);

    // 10. Broadcast the transaction
    const finalTxid = await client.sendRawTransaction(signedTx.hex);
    console.log("Final Transaction ID:", finalTxid);

    // 11. Write TXID to a file
    fs.writeFileSync("../out.txt", finalTxid);
    console.log("Transaction ID written to out.txt");
  } catch (err) {
    console.error("Error:", err);
  }
}
try {
  main();
} catch (e) {
  console.log("Error:", e);
}

I am trying to run this transaction
but getting the following error

Address: bcrt1q930lz38fuqaw83ujh8s050yyntaev2ll6xrzvu
11649.99941734
Sent 100 BTC, TXID: d6f19c05ec6f5022907b38c521ac387d8c3186f30ecef81d2bd1a40703d52eed
Error: RpcError: Insufficient funds

I have enough balance as u can see what am i doing wrong here?



Source link

Related articles

XRP Funding Rates Hint At Repeat Of $3.6 Surge Scenario

May 12, 2026
Bitcoin Price Holds Near $82,000 As ETF Inflows Surge And CLARITY Act Battle Intensifies

Bitcoin Price Holds Near $82,000 As ETF Inflows Surge And CLARITY Act Battle Intensifies

May 12, 2026
Share76Tweet47

Related Posts

XRP Funding Rates Hint At Repeat Of $3.6 Surge Scenario

by Moussa
May 12, 2026
0

They say journalists never truly clock out. But for Christian, that's not just a metaphor, it's a lifestyle. By day,...

Bitcoin Price Holds Near $82,000 As ETF Inflows Surge And CLARITY Act Battle Intensifies

Bitcoin Price Holds Near $82,000 As ETF Inflows Surge And CLARITY Act Battle Intensifies

by Moussa
May 12, 2026
0

Bitcoin price hovered in a tight range around 82,000 today, extending a week of steady but cautious gains as structural...

XRP Ledger Foundation Names Ripple’s David Schwartz Honorary Board Member

XRP Ledger Foundation Names Ripple’s David Schwartz Honorary Board Member

by Moussa
May 12, 2026
0

Key TakeawaysDavid Schwartz joined the XRP Ledger Foundation as an honorary board member.Foundation leaders are assigning engineering, operations, and community...

How do Bitcoin mining pools typically handle payout frequency versus thresholds?

How to export an encrypted non-seedless electrum wallet into bitcoin-qt?

by Moussa
May 11, 2026
0

How to export an encrypted non-seedless electrum wallet into bitcoin-qt? Is it even possible? Cheers Source link

Bitcoin at $80K: Is the ‘Peace Dividend’ Real or Geopolitical Lip Service?

Bitcoin at $80K: Is the ‘Peace Dividend’ Real or Geopolitical Lip Service?

by Moussa
May 11, 2026
0

Bitcoin price is holding above $80,000 as prediction markets price a Russia-Ukraine ceasefire at near-certainty, and the question of whether...

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]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyM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][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News