ExPlasma.Transaction.Signed (ExPlasma v0.2.0)
Holds functions related to transactions containing signatures.
Link to this section Summary
Functions
Decodes a binary expecting it to represent a signed transactions with the signatures being the first element of the decoded RLP list.
Recovers the witnesses for non-empty signatures, in the order they appear in transaction's signatures.
Validate a signed transaction.
Link to this section Types
decoding_error()
Specs
decoding_error() :: :malformed_rlp | :malformed_witnesses
sigs()
Specs
sigs() :: [ExPlasma.Crypto.sig_t()] | []
tx_bytes()
Specs
tx_bytes() :: binary()
validation_error()
Specs
validation_error() :: {:witnesses, :malformed_witnesses}
Link to this section Functions
compute_signatures(transaction, keys)
Specs
compute_signatures(ExPlasma.Transaction.t(), [String.t()]) :: {:ok, sigs()} | {:error, :not_signable}
decode(signed_tx_bytes)
Specs
decode(tx_bytes()) :: {:ok, list()} | {:error, decoding_error()}
Decodes a binary expecting it to represent a signed transactions with the signatures being the first element of the decoded RLP list.
Returns {:ok, signed_tx_rlp_items} if the encoded RLP can be decoded, or {:error, atom} otherwise.
Only validates that the RLP is structurally correct. Does not perform any other kind of validation, use validate/1 for that.
get_witnesses(transaction)
Specs
get_witnesses(ExPlasma.Transaction.t()) :: {:ok, [ExPlasma.Transaction.Witness.t()]} | {:error, ExPlasma.Transaction.Witness.recovery_error()}
Recovers the witnesses for non-empty signatures, in the order they appear in transaction's signatures.
Returns {:ok, witness_list} if witnesses are recoverable, or {:error, :corrupted_witness} otherwise.
validate(transaction)
Specs
validate(ExPlasma.Transaction.t()) :: :ok | {:error, validation_error()}
Validate a signed transaction.
Returns :ok if valid or {:error, {:witnesses, :malformed_witnesses}} otherwise.