Crates.io | arweave_rs_validator |
lib.rs | arweave_rs_validator |
version | 0.1.0 |
source | src |
created_at | 2024-02-14 23:38:27.940408 |
updated_at | 2024-02-14 23:38:27.940408 |
description | Methods for doing PoW pre-validation on Arweave block headers to verify their integrity. |
homepage | |
repository | https://github.com/ThePeopleOfTheNetwork/arweave_rs |
max_upload_size | |
id | 1140335 |
size | 42,808 |
This libary package cointains the components neccessary to validate that an Arweave block was produced by Proof-of-work consensus and met or exceeded the difficulty setting of the network at the time it was produce.
Because Arweave uses a "Proof-of-useful-work" mechanisim where the hashes computed to produce a block are calcuated from Arweaves historical data, thes steps for validaing consensus are more elaborate then simply comparing a hash.
To validate an Arweave block header you need the block header currently being validated, and the previous block header.
The steps are as follows
Huge thanks to janekolszak for his go work on computing the block_hash
for validation.
Also to CalebEverett for the merkle tree building blocks which I borrowed from arloader. Both were insturmental in completing the validation steps.
There are two merkle proofs in a block header. The tx_path
and the data_path
. The tx_path
is the path though a merkle tree composed of all the data_roots
of all the transactions in the block. It proves that the transaction the chunk belongs to was part of the block.
The data_path
is the path though the merkle tree composed of all the chunks in the transaction. It maps the path from the transactions data_root
to a specific chunk. In thise case, the chunk provided as part of the poa
or poa2
data.