4.3 Transaction structure
In DeFi Mall, a state represents the atomic unit of information.
States are Immutable A state is either in an "unspent" circulating state or in an invalid "spent" state. Transactions consume zero or more states (inputs) and create zero or more new states (outputs). Since a state cannot exist outside the transaction that created it, its status (spent or unspent) can be identified by the identifier of the transaction that created it and its index in the transaction's output list.
Transactions Comprise the Following Components
Instructions: An input state can lead to multiple output states. For example, an asset can be issued or transferred to an account.
Timestamp: If provided, it defines the time range within which the transaction is considered to have occurred or is redeemed by the owner.
As signatures are added at the end of a transaction and the transaction is identified by the hash used for signing, signature malleability is not a concern. There is never a need to identify a transaction, including its signature information, with a hash. Signatures can be generated and verified in parallel and are not directly exposed to contract code. In fact, contracts check if the public key set specified in the instructions is appropriate, as a transaction is only valid when every public key listed in each instruction has a matching signature. The structure of the public keys is opaque, maintaining the flexibility of algorithms: new signature algorithms can be implemented without altering the smart contract's code.
Details of Issued Cash: Total amount, currency, issuer, owner, etc.
Contract Code: The
verify
function of the contract is responsible for validating the issuance transaction and future transactions that consume this state.A hash of a document containing important legal clauses, providing a basic legal regulatory framework for the behavior of this state and its contract code.
The transaction also includes an instruction indicating the purpose of issuing cash, specifying a public key. The verification function of the cash state ensures that the public key specified in the instruction belongs to a participant of the transaction, who must provide their signature to validate it. In this example, the verify
function must confirm that the instruction specified a public key corresponding to the issuer of the cash state.
The DeFi Mall framework is responsible for verifying that the transaction has been signed by all the public keys listed in the instructions. Therefore, the verify
function only needs to ensure that all participants requiring a signature are specified in the instructions, while the framework ensures that the transaction is signed by all participants listed in the instructions.
Last updated