1

In State, use Merkle Patricia Trie for storing data.

"key value" is account address(hash value).

And also, Ethereum block uses MPT for storing transactions.

However, Additionally Ethereum Block use a transaction sequence;

miners already decided the execution sequence of the transaction.

This situation(Transaction have not only hash but also order) looks different from that of the state.

Q. How are transactions stored in a block?

is similar to the state? If so, how the transaction sequence is considered?

2 Answers 2

1

In State, use Merkle Patricia Trie for storing data. "key value" is account address(hash value). And also, Ethereum block uses MPT for storing transactions.

Yep, correct. And the hash of the root of the transaction tree is stored in the block header.

However, Additionally Ethereum Block use a transaction sequence

Correct. There's a transaction list in the block body (not the header).

How are transactions stored in a block?

In the block body, they're in an "ordered list". (Using whatever data structure is suitable - the implementation details aren't in the Yellow Paper.)

how the transaction sequence is considered?

For the default ordering, see What is the default ordering of transactions during mining, in e.g. geth?

However, miners can order transactions however they like, as long as the order equates to a set of valid state transitions.

1
  • No problem - happy to help :-) Commented Mar 14, 2019 at 11:49
0

Miners don't generate transaction hash.
Whenever a smart contract triggers(only for write state) it generate the transaction hash.

Lets understand the process by an example:

contract Test {
    uint public x;

    function set(uint _x) public {
        x = _x;
    }

    function get() public returns(uint) {
        return x;
    }

}

Suppose you executed a set function to change the value of x to 4.
When it successfully execute it will generate a transaction receipt inside it their will be a transaction hash.
Then this transaction is sent to the respective network. In the network there are transactions too waiting for validating and add into block.
Now Miners will pick the transactions then they will validate it and order it in block.
So Miners don't generate transaction hash, they just validate it and order it and create a block. Then they publish their block on network for verification. Once block gets the majority it gets added in the Blockchain.

Hope it cleared you doubt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.