Verifier: Witnesses
Validates the witness component of a transaction proof is properly formatted.
This is needed to ensure that the preimage to the transaction ID provided in the transaction proof proof
(i.e. the unsigned transaction) is actually valid. Data is elided when being posting transactions to Ethereum, so the integrity of the data provided in the proof must be checked.
For the provided state element stateElement
, witness = proof.transaction.witnesses[0]
, and input = proof.transaction.inputs[0]
:
- If
witness
's type isSignature
:- Recover the address with signature
witness
and the transaction ID of computed fromproof.transaction
andproof.data[0]
as message. - If
input
's type isTransfer
orHTLC
:- The recovered address must match
stateElement.owner
.
- The recovered address must match
- If
input
's type isDeposit
:- The recovered address must match
stateElement.owner
.
- The recovered address must match
- If
input
's type isRoot
:- The recovered address must match
proof.blockProducer
.
- The recovered address must match
- Recover the address with signature
- If
witness
's type isCaller
:- The witness registered indexed by
stateElement.owner
andstateElement.blockNumber
must match the transaction ID of computed fromproof.transaction
andproof.data[0]
- The witness registered indexed by
- If
witness
's type isProducer
:- The
stateElement.hash
must match the transaction ID of computed fromproof.transaction
andproof.data[0]
.
- The
Note that stateElement
can come in different types, depending on the type of the input (i.e. what is being spent).