Ethereum: Full list of “special cases” during Bitcoin Script execution (p2sh, p2wsh, etc.)?


Ethereum: Understanding special cases during the execution of Bitcoin script

When you interact with Bitcoin networks, especially during the execution of Bitcoin scripts, it is essential to be aware of several “special cases” that deviate from the standard procedure. These exceptions require a deeper understanding of both Bitcoin and Ethereum ecosystems, as well as the respective scenarios.

1. P2sh (Pay-to-Inscripthash)

The Type of the P2sh script is used for payments, where the recipient’s address is derived from scriptpubkey instead by a hardcoded address. When performing an P2sh transaction, the interpreter performs additional checks to ensure that the sender has sufficient funds in the wallet.

To understand this process, it is crucial to understand how the script Bitcoin is executed:

  • The script is executed by the node, which verifies its validity and integrity.

  • Scriptsig is checked using a hash of the entire script, including the P2sh instruction.

  • Scriptpubkey is then extracted from the resulting hash and used for payment.

Example:

Ethereum: Full list of

Suppose Alice wants to send 10 BTC to Bob derived from his scriptpubkey (0x ...). During execution:

  • The node verifies the validity of the Bitcoin transaction, including the addressee address.

  • Extract the P2sh instruction and create a hash that includes the entire script (Scriptsig +P2sh).

  • This resulting hash is then used to obtain Bob’s payment address (0x ...).

2. P2WSH (Pay-to-Wealth)

The Type of the P2WSH script is similar to P2sh, but with an additional layer of complexity:

  • The recipient's wealth is derived from the balance of the wallet instead of a coded address.

  • When performing anP2WSHtransaction, the interpreter performs additional checks to ensure that the sender has sufficient funds in the wallet.

Example:

Suppose Alice wants to send 10 BTC to Bob derived from her wallet balance (0x …). During execution:

  • The node verifies the validity of the Bitcoin transaction, including the addressee address.

  • Extract theP2WSHinstruction and create a hash that includes the entire script (Scriptsig + P2wsh).

  • This resulting hash is then used to obtain Bob's wealth (0x …).

3. P2CO (Pay-to-Contract)

The type of script "P2CO" allows the execution of contracts on other nodes:

  • The contract bytecode is extracted from a contractual address.

  • When performing anP2Cotransaction, the interpreter performs additional checks to ensure that the sender has sufficient funds in the wallet.

Example:

Suppose Alice wants to execute a contract created by Bob (0x …) on another knot. During execution:

  • The node verifies the validity of the Bitcoin transaction.

  • Extract the Bytecode contract from the contract address (0x …).

  • This result bytecode is then used for theP2Coinstruction.

4. P2Pay (Pay-Address)

The Type of theP2Pay ‘script allows the payment of a specific address:

  • The sender’s address is derived from their wallet balance.

  • When executing an P2pay transaction, the interpreter performs additional checks to ensure that the recipient has sufficient funds in the wallet.

Example:

Suppose Alice wants to send 10 BTC to Bob (0x ...). During execution:

  • The node verifies the validity of the Bitcoin transaction.

  • Extract Bob’s wealth balance in his wallet.

  • This resulting balance is then used for the P2pay 'instruction.

5. P2WSHPAY (Pay-to-Wealth and Pay-to-ADDRESS)

The type of scriptP2WSHPAYcombines both P2WSH andP2Pay:

  • The recipient’s wealth is derived from their wallet balance.

  • When performing an `P2wshpay ‘transaction, the interpreter performs additional checks to ensure that the sender has sufficient funds in the wallet.

Ethereum Size Blocker Adoption


Leave a Reply

Your email address will not be published. Required fields are marked *