Struct miden_lib::transaction::TransactionKernel
source · pub struct TransactionKernel;Implementations§
source§impl TransactionKernel
impl TransactionKernel
sourcepub fn kernel() -> &'static str
pub fn kernel() -> &'static str
Returns MASM source code which encodes the transaction kernel system procedures.
sourcepub fn main() -> Result<ProgramAst, DeserializationError>
pub fn main() -> Result<ProgramAst, DeserializationError>
Returns an AST of the transaction kernel executable program.
§Errors
Returns an error if deserialization of the binary fails.
sourcepub fn program_info() -> ProgramInfo
pub fn program_info() -> ProgramInfo
Returns ProgramInfo for the transaction kernel executable program.
§Panics
Panics if the transaction kernel source is not well-formed.
sourcepub fn assembler() -> Assembler
pub fn assembler() -> Assembler
Returns a new Miden assembler instantiated with the transaction kernel and loaded with the Miden stdlib as well as with midenlib.
sourcepub fn build_input_stack(
acct_id: AccountId,
init_acct_hash: Digest,
input_notes_hash: Digest,
block_hash: Digest,
) -> StackInputs
pub fn build_input_stack( acct_id: AccountId, init_acct_hash: Digest, input_notes_hash: Digest, block_hash: Digest, ) -> StackInputs
Returns the stack with the public inputs required by the transaction kernel.
The initial stack is defined:
[BLOCK_HASH, acct_id, INITIAL_ACCOUNT_HASH, INPUT_NOTES_COMMITMENT]
Where:
- BLOCK_HASH, reference block for the transaction execution.
- acct_id, the account that the transaction is being executed against.
- INITIAL_ACCOUNT_HASH, account state prior to the transaction, EMPTY_WORD for new accounts.
- INPUT_NOTES_COMMITMENT, see
transaction::api::get_input_notes_commitment.
pub fn build_output_stack( final_acct_hash: Digest, output_notes_hash: Digest, ) -> StackOutputs
sourcepub fn parse_output_stack(
stack: &StackOutputs,
) -> Result<(Digest, Digest), TransactionOutputError>
pub fn parse_output_stack( stack: &StackOutputs, ) -> Result<(Digest, Digest), TransactionOutputError>
Extracts transaction output data from the provided stack outputs.
The data on the stack is expected to be arranged as follows:
Stack: [CNC, FAH]
Where:
- CNC is the commitment to the notes created by the transaction.
- FAH is the final account hash of the account that the transaction is being executed against.
§Errors
Returns an error if:
- Words 3 and 4 on the stack are not 0.
- Overflow addresses are not empty.
sourcepub fn from_transaction_parts(
stack: &StackOutputs,
adv_map: &AdviceMap,
output_notes: Vec<OutputNote>,
) -> Result<TransactionOutputs, TransactionOutputError>
pub fn from_transaction_parts( stack: &StackOutputs, adv_map: &AdviceMap, output_notes: Vec<OutputNote>, ) -> Result<TransactionOutputs, TransactionOutputError>
Returns TransactionOutputs constructed from the provided output stack and advice map.
The output stack is expected to be arrange as follows:
Stack: [CNC, FAH]
Where:
- CNC is the commitment to the notes created by the transaction.
- FAH is the final account hash of the account that the transaction is being executed against.
The actual data describing the new account state and output notes is expected to be located in the provided advice map under keys CNC and FAH.