The hash-primage problem in Bitcoin Transactions

The hash-primage problem is the Fund of Aspect off verification in the Bitcoin Network. Hash in a 2-input Transaction, with a corresponding primage hash.

Bitcoin: Which is the hash-preimage of a 2-input transaction?

What is a 2-Input Transaction?

In Bitcoin, Transctions are 2-inputs transactions, meaning that are the there these are requireds: a sentender and a receiver. «Satoshis»). This transaction is verified by Bitcoin Node that it will it covers to them network’s rules and constraints.

The Hash-Pimage Problem

When’s verifying a 2-Input Transaction, the Bitcoin Node Rebuilds the hash preimage to have been transacted the input. In all the words,

H = m + x

where the Senate’s signature will be the receipt.

The 2-Input Transaction?

Tables to rebuild the hash primage. Specifically, they:

1.

2.

3.

##

The key insight here is bitcoin node has already precomputed and stored the hash curs for all possible inputs x and output hashesh. This allows them to quickly rebuild

Conclusion

In Bitcoin Transactions. The Bitcoin Nodes Canal Resources the hash preimage and verify 2-input to the transacts with the extension computer or hash-table searches.

Example Code

Here's an an explete off how a bitcoin Node might Rebuild the Hash-Peimage:

C

// Precompute Hash Values ​​for All Possible Inputs X (0-255)

uitt256 [256] Precomputedhashesy = {

// ...

};

//

uitt256 [] candideinputs = {

// ...

};

// Remune the hash preimage by Findings Vinput ValueX

uitt256 hashpreimage = 0;

for (uint256 i = 0; i <256; i ++) {

if (precomputtedhashes [i] == h) {

hashpreimage = no;

Break;

}

}

Note:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *