• About
  • Privacy Poilicy
  • Disclaimer
  • Contact
CoinInsight
  • Home
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Ripple
  • Future of Crypto
  • Crypto Mining
No Result
View All Result
  • Home
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Ripple
  • Future of Crypto
  • Crypto Mining
No Result
View All Result
CoinInsight
No Result
View All Result
Home Bitcoin

bitcoin core – Attempting to spend UTXO with customized script

Coininsight by Coininsight
March 31, 2025
in Bitcoin
0
bitcoin core – Attempting to spend UTXO with customized script
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


To unlock, the locking script would require three numbers whose sum is 15 and most is smaller than 8. So I did this script in python, duplicating the highest 3, then checking every of them whether or not lower than 8, after eradicating them including them as much as examine if its 15.

ex2a_txout_scriptPubKey = [OP_3DUP,OP_8,OP_LESSTHAN,OP_VERIFY,OP_8,OP_LESSTHAN,OP_VERIFY,OP_8,OP_LESSTHAN,OP_VERIFY,OP_ADD,OP_ADD,OP_15,OP_EQUALVERIFY]

ship it with this perform response = send_from_P2PKH_transaction(amount_to_send, txid_to_spend, utxo_index, ex2a_txout_scriptPubKey)

def send_from_P2PKH_transaction(amount_to_send, txid_to_spend, utxo_index, txout_scriptPubKey):
    # Step 1: Create the txin
    txin = CMutableTxIn(COutPoint(lx(txid_to_spend), utxo_index)) #now we've got txin

    # Step 2: Create the txout
    txout = CMutableTxOut(amount_to_send * COIN, CScript(txout_scriptPubKey))

    # Step 3: Create the transaction
    tx = CMutableTransaction([txin], [txout])

    # Step 4: Create the txin_scriptPubKey (from the tackle holding the UTXO)
    txin_scriptPubKey = my_address.to_scriptPubKey()

    # Step 5: Create the signature
    sig = create_OP_CHECKSIG_signature(tx, txin_scriptPubKey, my_private_key)

    # Step 6: Set the txin's scriptSig worth (signature + public_key)
    txin.scriptSig = CScript([sig, my_public_key])

    # Confirm the transaction
    VerifyScript(txin.scriptSig, txin_scriptPubKey, tx, 0, (SCRIPT_VERIFY_P2SH,))

    # Broadcast the transaction
    return broadcast_transaction(tx)

It really works for traditional P2PKH, however when i exploit my txout_scriptpubkey, the response is

`400 Dangerous Request sendrawtransaction RPC error -26: scriptpubkey`

Any assistance is appreciated, I do not know the place i did improper within the script. I used 8 first however OP_8 wanted for use I suppose, however nonetheless would not work. EDIT: It additionally would not settle for "[OP_5, OP_EQUAL]". I can not make it settle for something aside from P2PKH.

Related articles

$480 Million In 2 Weeks? XRP Whale Actions Might Reveal The Subsequent Worth Course

$480 Million In 2 Weeks? XRP Whale Actions Might Reveal The Subsequent Worth Course

September 17, 2025
BTC Inc. And Technique Agree To 5-Yr Strategic Partnership Renewal Extending Bitcoin For Firms Initiative

BTC Inc. And Technique Agree To 5-Yr Strategic Partnership Renewal Extending Bitcoin For Firms Initiative

September 17, 2025


To unlock, the locking script would require three numbers whose sum is 15 and most is smaller than 8. So I did this script in python, duplicating the highest 3, then checking every of them whether or not lower than 8, after eradicating them including them as much as examine if its 15.

ex2a_txout_scriptPubKey = [OP_3DUP,OP_8,OP_LESSTHAN,OP_VERIFY,OP_8,OP_LESSTHAN,OP_VERIFY,OP_8,OP_LESSTHAN,OP_VERIFY,OP_ADD,OP_ADD,OP_15,OP_EQUALVERIFY]

ship it with this perform response = send_from_P2PKH_transaction(amount_to_send, txid_to_spend, utxo_index, ex2a_txout_scriptPubKey)

def send_from_P2PKH_transaction(amount_to_send, txid_to_spend, utxo_index, txout_scriptPubKey):
    # Step 1: Create the txin
    txin = CMutableTxIn(COutPoint(lx(txid_to_spend), utxo_index)) #now we've got txin

    # Step 2: Create the txout
    txout = CMutableTxOut(amount_to_send * COIN, CScript(txout_scriptPubKey))

    # Step 3: Create the transaction
    tx = CMutableTransaction([txin], [txout])

    # Step 4: Create the txin_scriptPubKey (from the tackle holding the UTXO)
    txin_scriptPubKey = my_address.to_scriptPubKey()

    # Step 5: Create the signature
    sig = create_OP_CHECKSIG_signature(tx, txin_scriptPubKey, my_private_key)

    # Step 6: Set the txin's scriptSig worth (signature + public_key)
    txin.scriptSig = CScript([sig, my_public_key])

    # Confirm the transaction
    VerifyScript(txin.scriptSig, txin_scriptPubKey, tx, 0, (SCRIPT_VERIFY_P2SH,))

    # Broadcast the transaction
    return broadcast_transaction(tx)

It really works for traditional P2PKH, however when i exploit my txout_scriptpubkey, the response is

`400 Dangerous Request sendrawtransaction RPC error -26: scriptpubkey`

Any assistance is appreciated, I do not know the place i did improper within the script. I used 8 first however OP_8 wanted for use I suppose, however nonetheless would not work. EDIT: It additionally would not settle for "[OP_5, OP_EQUAL]". I can not make it settle for something aside from P2PKH.

Tags: Bitcoincore..customscriptspendUTXO
Share76Tweet47

Related Posts

$480 Million In 2 Weeks? XRP Whale Actions Might Reveal The Subsequent Worth Course

$480 Million In 2 Weeks? XRP Whale Actions Might Reveal The Subsequent Worth Course

by Coininsight
September 17, 2025
0

On-chain knowledge reveals that XRP whales are at present offloading their cash, which paints a bearish outlook for the altcoin....

BTC Inc. And Technique Agree To 5-Yr Strategic Partnership Renewal Extending Bitcoin For Firms Initiative

BTC Inc. And Technique Agree To 5-Yr Strategic Partnership Renewal Extending Bitcoin For Firms Initiative

by Coininsight
September 17, 2025
0

In a big improvement for company Bitcoin adoption, BTC Inc. and Technique Inc. (Nasdaq: STRF/STRC/STRK/STRD/MSTR) have introduced a five-year renewal...

American Specific Affords NFT Passport Stamps for Vacationers

American Specific Affords NFT Passport Stamps for Vacationers

by Coininsight
September 17, 2025
0

Key TakeawaysAmerican Specific is providing NFT “passport stamps” to cardholders as a strategy to digitally commemorate their travels and acquire...

Metaplanet Plunges 8% As UBS Joins Morgan Stanley Brief Guess

Metaplanet Plunges 8% As UBS Joins Morgan Stanley Brief Guess

by Coininsight
September 16, 2025
0

Be part of Our Telegram channel to remain updated on breaking information protection Metaplanet shares plunged 8% after UBS reopened...

Peter Schiff Warns Bitcoin Is “Topping Out” Forward of Fed Price Cuts

Peter Schiff Warns Bitcoin Is “Topping Out” Forward of Fed Price Cuts

by Coininsight
September 16, 2025
0

Is Bitcoin critic Peter Schiff lastly going to be proper for the primary time in 16 years about Fed price...

Load More
  • Trending
  • Comments
  • Latest
MetaMask Launches An NFT Reward Program – Right here’s Extra Data..

MetaMask Launches An NFT Reward Program – Right here’s Extra Data..

July 24, 2025
BitHub 77-Bit token airdrop information

BitHub 77-Bit token airdrop information

February 6, 2025
Haedal token airdrop information

Haedal token airdrop information

April 24, 2025
MilkyWay ($milkTIA, $MILK) Token Airdrop Information

MilkyWay ($milkTIA, $MILK) Token Airdrop Information

March 4, 2025
Kuwait bans Bitcoin mining over power issues and authorized violations

Kuwait bans Bitcoin mining over power issues and authorized violations

2
The Ethereum Basis’s Imaginative and prescient | Ethereum Basis Weblog

The Ethereum Basis’s Imaginative and prescient | Ethereum Basis Weblog

2
Unchained Launches Multi-Million Greenback Bitcoin Legacy Mission

Unchained Launches Multi-Million Greenback Bitcoin Legacy Mission

1
Earnings Preview: Microsoft anticipated to report larger Q3 income, revenue

Earnings Preview: Microsoft anticipated to report larger Q3 income, revenue

1
Bloomberg Analysts Trace at XRP and Dogecoin ETFs, Right here’s What It Means for Traders

Bloomberg Analysts Trace at XRP and Dogecoin ETFs, Right here’s What It Means for Traders

September 17, 2025
Ethereum Protocol Fellowship – Fourth Cohort Purposes Are Open!

Ethereum Protocol Fellowship – Fourth Cohort Purposes Are Open!

September 17, 2025
$480 Million In 2 Weeks? XRP Whale Actions Might Reveal The Subsequent Worth Course

$480 Million In 2 Weeks? XRP Whale Actions Might Reveal The Subsequent Worth Course

September 17, 2025
Kraken Provides Help for Circle’s USDC and EURC Stablecoins to Enhance Liquidity

Kraken Provides Help for Circle’s USDC and EURC Stablecoins to Enhance Liquidity

September 17, 2025

CoinInight

Welcome to CoinInsight.co.uk – your trusted source for all things cryptocurrency! We are passionate about educating and informing our audience on the rapidly evolving world of digital assets, blockchain technology, and the future of finance.

Categories

  • Bitcoin
  • Blockchain
  • Crypto Mining
  • Ethereum
  • Future of Crypto
  • Market
  • Regulation
  • Ripple

Recent News

Bloomberg Analysts Trace at XRP and Dogecoin ETFs, Right here’s What It Means for Traders

Bloomberg Analysts Trace at XRP and Dogecoin ETFs, Right here’s What It Means for Traders

September 17, 2025
Ethereum Protocol Fellowship – Fourth Cohort Purposes Are Open!

Ethereum Protocol Fellowship – Fourth Cohort Purposes Are Open!

September 17, 2025
  • About
  • Privacy Poilicy
  • Disclaimer
  • Contact

© 2025- https://coininsight.co.uk/ - All Rights Reserved

No Result
View All Result
  • Home
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Ripple
  • Future of Crypto
  • Crypto Mining

© 2025- https://coininsight.co.uk/ - All Rights Reserved

Social Media Auto Publish Powered By : XYZScripts.com
Verified by MonsterInsights