Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Add Block Height Flag Support to Bitcoin Transaction Script #277

Closed
3 tasks
okhaimie-dev opened this issue Nov 3, 2024 · 4 comments
Closed
3 tasks

Comments

@okhaimie-dev
Copy link
Contributor

The current run_bitcoin_transaction.sh script needs to be updated to support Bitcoin script flags based on block height. This is necessary to properly validate transactions from different periods of Bitcoin's history where different features (BIPs) were active.

Expected Behavior

  1. Script should accept transaction hash and block height
  2. Calculate appropriate flags based on block height:
    • BIP16 (P2SH) >= 173805
    • BIP34 (Coinbase Height) >= 227931
    • BIP65 (CLTV) >= 388381
    • BIP66 (Strict DER) >= 363725
    • BIP141 (SegWit) >= 481824
    • BIP341 (Taproot) >= 709632
  3. Pass flags correctly to the Cairo function
  4. Successfully validate transaction with appropriate feature flags

Technical Details

  • Reference implementation of flag calculation: Raito Script Flags
  • Current script location: shinigami/scripts/run_bitcoin_transaction.sh
  • Related Cairo function: run_with_flags in shinigami/packages/cmds/src/main.cairo

Implementation Tasks

  • Update script to properly calculate flags based on block height
  • Fix argument formatting for Cairo function call
  • Add proper error handling for invalid inputs

Example Usage (After Fix)

# Run transaction with block height
./run_bitcoin_transaction.sh <txid> <block_height>

# Example
./run_bitcoin_transaction.sh 8eb402c4e73c1002d9c891003cbde5c73074cfea53306f3e3b6b2e858bc22ec7 255018
@supreme2580
Copy link
Contributor

Hey guys can I be assigned to this?

@Mystic-Nayy
Copy link
Contributor

@okhaimie-dev can I work on this

@ShantelPeters
Copy link
Contributor

Please can I be assigned to this issue @okhaimie-dev

@SoarinSkySagar
Copy link
Contributor

SoarinSkySagar commented Nov 6, 2024

gm @okhaimie-dev and @b-j-roberts , I would like to handle this issue. I am providing my background, approach and ETA for this issue below.

My background:

I'm a web3 engineer with extensive experience in writing smart contracts in cairo.

My approach:

I will modify the shell file to now accept the <block_height> flag. Then modify the cairo function call's argument to properly handle the new flag. Lastly, I will add proper error handling for wrong or invalid block height flag.

ETA: 4 Days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants