Transaction structure
Bitcoin makes use of the Unspent Transaction Output (UTXO) set in order to keep track of output transactions that have not been yet spent and thus can be used as inputs to new transactions. Bitcoin full nodes keep a copy of the UTXO set in order to validate transactions and produce new ones without having to check the whole blockchain. The MASS blockchain system still uses UTXO's design ideas and has made some design innovations to adapt to our economic mechanism.
The transaction consists of two main parts, one is the transaction input, which indicates which transaction is quoted, and the other is the transaction output, which indicates where the transaction is going. Each transaction contains one or more “input”, which are like debits against a MASS account. On the other side of the transaction, there are one or more “output”, which are like credits added to a MASS account. The inputs and outputs (debits and credits) do not necessarily add up to the same amount. Instead, outputs add up to slightly less than inputs and the difference represents an implied transaction fee, which is a small payment collected by the miner who includes the transaction in the ledger.
There are three main types of transactions in the MASS blockchain system: ordinary transaction, staking transaction, and binding transaction. The ordinary transaction is the normal transfer operation of the token. The staking transaction is to freeze the trading rights of the token to a certain block height. When the staking transaction is packaged, the transaction is allowed to be spent only after the block height reaches the specified height. The binding transaction is the union of the ownership of the token to the address of the capacity space.
The output of the ordinary transaction uses “Pay-to-Witness-Script-Hash” (P2WSH). Complex scripts are replaced by shorter fingerprints in the transaction output, making the transaction smaller. Scripts can be coded as an address, so the sender and the sender’s wallet don’t need complex engineering to implement P2WSH. P2WSH shifts the transaction fee cost of a long script from the sender to the recipient, who has to include the long redeem script to spend it. The script executed by the virtual machine is
The output of the staking transaction is extended on the basis of P2WSH. The difference between staking transaction and ordinary transaction is the output. The script executed by the virtual machine is
The output of the binding transaction is also extended on the basis of P2WSH. The script executed by the virtual machine is