Skip to content

Commit 858d106

Browse files
committed
final page cleanup
1 parent 394da0c commit 858d106

File tree

8 files changed

+149
-69
lines changed

8 files changed

+149
-69
lines changed

docs/documentation/concepts/accounts.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,6 @@ You can query an account address using CLI, gRPC, REST, or JSON-RPC:
232232
</Tabs>
233233

234234
<Note>
235-
For JSON-RPC methods, see [`eth_accounts`](/api-reference/ethereum-json-rpc/methods#eth-accounts) and [`personal_listAccounts`](/api-reference/ethereum-json-rpc/methods#personal-listAccounts) documentation.
235+
For JSON-RPC methods, see [`eth_accounts`](/docs/api-reference/ethereum-json-rpc/methods#eth-accounts) and [`personal_listAccounts`](/docs/api-reference/ethereum-json-rpc/methods#personal-listAccounts) documentation.
236236
</Note>
237237

docs/documentation/concepts/encoding.mdx

Lines changed: 89 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,102 @@ In Ethereum, integers must be represented in big-endian binary form with no lead
99

1010
The Cosmos Stargate release introduces protobuf as the main encoding format for both client and state serialization. All the EVM module types that are used for state and clients, such as transaction messages, genesis, query services, etc., will be implemented as protocol buffer messages. The Cosmos SDK also supports the legacy Amino encoding. Protocol Buffers (protobuf) is a language-agnostic binary serialization format that is smaller and faster than JSON. It is used to serialize structured data, such as messages, and is designed to be highly efficient and extensible. The encoding format is defined in a language-agnostic language called Protocol Buffers Language (proto3), and the encoded messages can be used to generate code for a variety of programming languages. The main advantage of protobuf is its efficiency, which results in smaller message sizes and faster serialization and deserialization times. The RLP decoding process is as follows: according to the first byte (i.e., prefix) of input data and decoding the data type, the length of the actual data and offset; according to the type and offset of data, decode the data correspondingly.
1111

12-
## Prerequisite Readings[](#prerequisite-readings "Direct link to Prerequisite Readings")
12+
## Prerequisite Readings
1313

14-
* [Cosmos SDK Encoding](https://docs.cosmos.network/main/learn/advanced/encoding)
15-
* [Ethereum RLP](https://eth.wiki/en/fundamentals/rlp)
14+
<CardGroup cols={2}>
15+
<Card title="Cosmos SDK Encoding" icon="code" href="https://docs.cosmos.network/main/learn/advanced/encoding">
16+
Learn about protobuf and Amino encoding in Cosmos SDK
17+
</Card>
18+
<Card title="Ethereum RLP" icon="ethereum" href="https://eth.wiki/en/fundamentals/rlp">
19+
Understand Recursive Length Prefix encoding
20+
</Card>
21+
</CardGroup>
1622

17-
## Encoding Formats[](#encoding-formats "Direct link to Encoding Formats")
23+
## Encoding Formats
1824

19-
### Protocol Buffers[](#protocol-buffers "Direct link to Protocol Buffers")
25+
<Tabs>
26+
<Tab title="Protocol Buffers">
27+
**Primary encoding for Cosmos EVM**
28+
29+
The Cosmos [Stargate](https://stargate.cosmos.network/) release introduces [protobuf](https://developers.google.com/protocol-buffers) as the main encoding format for both client and state serialization.
30+
31+
<Info>
32+
All EVM module types (transaction messages, genesis, query services) are implemented as protocol buffer messages.
33+
</Info>
34+
35+
**Advantages:**
36+
- Language-agnostic binary serialization
37+
- Smaller message sizes than JSON
38+
- Faster serialization/deserialization
39+
- Strongly typed with schema validation
40+
</Tab>
41+
42+
<Tab title="RLP">
43+
**Ethereum compatibility encoding**
44+
45+
Recursive Length Prefix ([RLP](https://eth.wiki/en/fundamentals/rlp)) is an encoding/decoding algorithm that serializes messages for Ethereum compatibility.
46+
47+
<Note>
48+
Cosmos EVM uses RLP specifically for Ethereum transaction encoding to ensure JSON-RPC compatibility.
49+
</Note>
50+
51+
**Usage in Cosmos EVM:**
52+
- Encoding `MsgEthereumTx` for JSON-RPC
53+
- Transaction signing and verification
54+
- Block hash computation
55+
- Merkle tree data structures
56+
</Tab>
57+
58+
<Tab title="Amino (Legacy)">
59+
**Backwards compatibility only**
60+
61+
The Cosmos SDK supports legacy Amino encoding for backwards compatibility with older versions.
62+
63+
<Warning>
64+
Cosmos EVM does not support Amino in the EVM module. It's only available for other Cosmos SDK modules that enable it.
65+
</Warning>
66+
67+
**Limited use cases:**
68+
- Client encoding for legacy wallets
69+
- Signing with Ledger devices
70+
- Not used for EVM transactions
71+
</Tab>
72+
</Tabs>
2073

21-
The Cosmos [Stargate](https://stargate.cosmos.network/) release introduces [protobuf](https://developers.google.com/protocol-buffers) as the main encoding format for both client and state serialization. All the EVM module types that are used for state and clients (transaction messages, genesis, query services, etc) will be implemented as protocol buffer messages.
74+
### Transaction Encoding Implementation
2275

23-
### Amino[](#amino "Direct link to Amino")
76+
The `x/vm` module handles `MsgEthereumTx` encoding by converting to go-ethereum's `Transaction` format and using RLP:
2477

25-
The Cosmos SDK also supports the legacy Amino encoding format for backwards compatibility with previous versions, specially for client encoding and signing with Ledger devices. Cosmos EVM does not support Amino in the EVM module, but it is supported for all other Cosmos SDK modules that enable it.
26-
27-
### RLP[](#rlp "Direct link to RLP")
28-
29-
Recursive Length Prefix ([RLP](https://eth.wiki/en/fundamentals/rlp)), is an encoding/decoding algorithm that serializes a message and allows for quick reconstruction of encoded data. Cosmos EVM uses RLP to encode/decode Ethereum messages for JSON-RPC handling to conform messages to the proper Ethereum format. This allows messages to be encoded and decoded in the exact format as Ethereum's.
30-
31-
The `x/vm` transactions (`MsgEthereumTx`) encoding is performed by casting the message to a go-ethereum's `Transaction` and then marshaling the transaction data using RLP:
78+
<CodeGroup>
3279

80+
```go TxEncoder
81+
// TxEncoder overwrites sdk.TxEncoder to support MsgEthereumTx
82+
func (g txConfig) TxEncoder() sdk.TxEncoder {
83+
return func(tx sdk.Tx) ([]byte, error) {
84+
msg, ok := tx.(*evmtypes.MsgEthereumTx)
85+
if ok {
86+
return msg.AsTransaction().MarshalBinary()
87+
}
88+
return g.TxConfig.TxEncoder()(tx)
89+
}
90+
}
3391
```
34-
// TxEncoder overwrites sdk.TxEncoder to support MsgEthereumTxfunc (g txConfig) TxEncoder() sdk.TxEncoder {return func(tx sdk.Tx) ([]byte, error) { msg, ok := tx.(*evmtypes.MsgEthereumTx) if ok { return msg.AsTransaction().MarshalBinary() } return g.TxConfig.TxEncoder()(tx)}}// TxDecoder overwrites sdk.TxDecoder to support MsgEthereumTxfunc (g txConfig) TxDecoder() sdk.TxDecoder {return func(txBytes []byte) (sdk.Tx, error) { tx := &ethtypes.Transaction{} err := tx.UnmarshalBinary(txBytes) if err == nil { msg := &evmtypes.MsgEthereumTx{} msg.FromEthereumTx(tx) return msg, nil } return g.TxConfig.TxDecoder()(txBytes)}}
92+
93+
```go TxDecoder
94+
// TxDecoder overwrites sdk.TxDecoder to support MsgEthereumTx
95+
func (g txConfig) TxDecoder() sdk.TxDecoder {
96+
return func(txBytes []byte) (sdk.Tx, error) {
97+
tx := &ethtypes.Transaction{}
98+
err := tx.UnmarshalBinary(txBytes)
99+
if err == nil {
100+
msg := &evmtypes.MsgEthereumTx{}
101+
msg.FromEthereumTx(tx)
102+
return msg, nil
103+
}
104+
return g.TxConfig.TxDecoder()(txBytes)
105+
}
106+
}
35107
```
36108

109+
</CodeGroup>
110+

docs/documentation/concepts/mempool.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ You can also explore these methods interactively using the [RPC Explorer](/docs/
204204
## Integration
205205

206206
<Note>
207-
For chain developers looking to integrate the mempool into their Cosmos SDK chain, see the [EVM Mempool Integration Guide](/documentation/integration/mempool-integration) for complete setup instructions.
207+
For chain developers looking to integrate the mempool into their Cosmos SDK chain, see the [EVM Mempool Integration Guide](/docs/documentation/integration/mempool-integration) for complete setup instructions.
208208
</Note>
209209

210210
## State Management

docs/documentation/concepts/pending-state.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ During the pending state, the transaction initiator is allowed to change the tra
88
## Prerequisite Readings[](#prerequisite-readings "Direct link to Prerequisite Readings")
99

1010
* [Cosmos SDK Mempool](https://docs.cosmos.network/main/building-apps/app-mempool)
11-
* [Mempool Architecture](/documentation/concepts/mempool)
11+
* [Mempool Architecture](/docs/documentation/concepts/mempool)
1212

1313
## Cosmos EVM vs Ethereum[](#cosmos-evm-vs-ethereum "Direct link to Cosmos EVM vs Ethereum")
1414

@@ -145,6 +145,6 @@ const fasterTx = await wallet.sendTransaction({
145145
## Architecture Details
146146

147147
For a detailed understanding of how the pending state is managed:
148-
- See [Mempool Architecture](/documentation/concepts/mempool#architecture) for the two-tier system design
149-
- Review [Transaction Flow](/documentation/concepts/mempool#transaction-flow) for state transitions
150-
- Check [Integration Guide](/documentation/integration/mempool-integration) for implementation details
148+
- See [Mempool Architecture](/docs/documentation/concepts/mempool#architecture) for the two-tier system design
149+
- Review [Transaction Flow](/docs/documentation/concepts/mempool#transaction-flow) for state transitions
150+
- Check [Integration Guide](/docs/documentation/integration/mempool-integration) for implementation details

docs/documentation/concepts/transactions.mdx

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ Additionally, a transaction needs to be signed using the sender's private key. T
1010
In a nutshell, the transaction lifecycle once a signed transaction is submitted to the network is the following:
1111

1212
* A transaction hash is cryptographically generated.
13-
* The transaction is validated through CheckTx and added to the mempool:
14-
* **For Ethereum transactions**: If the nonce is correct, it enters the public mempool immediately. If there's a nonce gap, it's queued locally until the gap is filled (see [Mempool](/docs/documentation/concepts/mempool) for details).
15-
* **For Cosmos transactions**: Standard sequential nonce validation applies.
13+
* The transaction is validated through CheckTx and added to the mempool (see [Transaction Ordering](#transaction-ordering-and-prioritization) below).
1614
* The transaction is broadcasted to the network peers (only if immediately executable).
1715
* A validator selects your transaction for inclusion in a block based on fee prioritization.
1816
* The transaction is executed and the state change is committed.
1917

20-
For a more detailed explanation of the transaction lifecycle, see [the corresponding section](https://docs.cosmos.network/main/basics/tx-lifecycle) and the [Mempool documentation](/docs/documentation/concepts/mempool#transaction-flow).
18+
<Note>
19+
For detailed transaction flow and mempool behavior, see the [Mempool documentation](/docs/documentation/concepts/mempool#transaction-flow) and [Cosmos SDK lifecycle](https://docs.cosmos.network/main/basics/tx-lifecycle).
20+
</Note>
2121

2222
The transaction hash is a unique identifier and can be used to check transaction information, for example, the events emitted, if was successful or not.
2323

2424
Transactions can fail for various reasons. For example, the provided gas or fees may be insufficient. Also, the transaction validation may fail. Each transaction has specific conditions that must fullfil to be considered valid. A widespread validation is that the sender is the transaction signer. In such a case, if you send a transaction where the sender address is different than the signer's address, the transation will fail, even if the fees are sufficient.
2525

2626
Nowadays, transactions can not only perform state transitions on the chain in which are submitted, but also can execute transactions on another blockchains. Interchain transactions are possible through the [Inter-Blockchain Communication protocol (IBC)](https://ibcprotocol.org/). Find a more detailed explanation on the section below.
2727

28-
## Transaction Types[](#transaction-types "Direct link to Transaction Types")
28+
## Transaction Types
2929

3030
Cosmos EVM supports two transaction types:
3131

@@ -38,7 +38,7 @@ Although most of the information included on both of these transaction types is
3838

3939
Find more information about these two types on the following sections.
4040

41-
### Cosmos Transactions[](#cosmos-transactions "Direct link to Cosmos Transactions")
41+
### Cosmos Transactions
4242

4343
On Cosmos chains, transactions are comprised of metadata held in contexts and `sdk.Msg`s that trigger state changes within a module through the module's Protobuf [Msg service](https://docs.cosmos.network/main/building-modules/msg-services).
4444

@@ -55,13 +55,12 @@ A Cosmos transaction includes the following information:
5555

5656
To submit a Cosmos transaction, users must use one of the provided clients.
5757

58-
### Ethereum Transactions[](#ethereum-transactions "Direct link to Ethereum Transactions")
58+
### Ethereum Transactions
5959

6060
Ethereum transactions refer to actions initiated by EOAs (externally-owned accounts, managed by humans), rather than internal smart contract calls. Ethereum transactions transform the state of the EVM and therefore must be broadcasted to the entire network.
6161

6262
Ethereum transactions also require a fee, known as `gas`. ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)) introduced the idea of a base fee, along with a priority fee which serves as an incentive for validators to include specific transactions in blocks.
6363

64-
**Nonce Management**: Unlike traditional Cosmos transactions, Ethereum transactions can be submitted with nonce gaps. The EVM mempool will queue these transactions locally until the gaps are filled, enabling compatibility with Ethereum tooling that sends batch transactions. See the [Mempool documentation](/docs/documentation/concepts/mempool) for details on nonce gap handling.
6564

6665
There are several categories of Ethereum transactions:
6766

@@ -73,7 +72,7 @@ An Ethereum transaction includes the following information:
7372

7473
* `recipient`: receiving address
7574
* `signature`: sender's signature
76-
* `nonce`: counter of tx number from account (supports out-of-order submission with queuing)
75+
* `nonce`: counter of tx number from account
7776
* `value`: amount of ETH to transfer (in wei)
7877
* `data`: include arbitrary data. Used when deploying a smart contract or making a smart contract method call
7978
* `gasLimit`: max amount of gas to be consumed
@@ -96,13 +95,8 @@ Cosmos EVM is capable of processing Ethereum transactions by wrapping them on a
9695

9796
One remark about the `MsgEthereumTx` is that it implements both the `sdk.Msg` and `sdk.Tx` interfaces (generally SDK messages only implement the former, while the latter is a group of messages bundled together). The reason for this is that the `MsgEthereumTx` must not be included in a `auth.StdTx` (SDK's standard transaction type) as it performs gas and fee checks using the Ethereum logic from Geth instead of the Cosmos SDK checks done on the auth module `AnteHandler`.
9897

99-
**Mempool Handling**: `MsgEthereumTx` transactions receive special treatment in the mempool:
100-
- Transactions with correct nonces are immediately added to the public mempool and broadcast
101-
- Transactions with nonce gaps are intercepted and queued locally without broadcasting
102-
- When gaps are filled, queued transactions are automatically promoted and broadcast
103-
- This enables compatibility with Ethereum tooling that sends batched transactions
10498

105-
#### Ethereum Tx Type[](#ethereum-tx-type "Direct link to Ethereum Tx Type")
99+
#### Ethereum Tx Type
106100

107101
There are three types of transaction types used in Cosmos EVM's [Go Ethereum](https://github.com/ethereum/go-ethereum/blob/b946b7a13b749c99979e312c83dce34cac8dd7b1/core/types/transaction.go#L43-L48) implementation that came from Ethereum Improvement Proposals(EIPs):
108102

@@ -114,7 +108,7 @@ There are three types of transaction types used in Cosmos EVM's [Go Ethereum](ht
114108

115109
These transaction types represent Ethereum's continuous evolution and improvements to its network, helping address challenges related to scalability, security, and user experience.
116110

117-
### Interchain Transactions[](#interchain-transactions "Direct link to Interchain Transactions")
111+
### Interchain Transactions
118112

119113
Interchain transactions refer to the transfer of digital assets or data between two or more different blockchain networks.
120114

@@ -133,19 +127,31 @@ Interchain transactions are becoming increasingly important as the number of dif
133127

134128
## Transaction Ordering and Prioritization
135129

136-
In Cosmos EVM, both Ethereum and Cosmos transactions compete fairly for block inclusion based on their effective tips:
137-
138-
### Fee-Based Priority
139-
- **Ethereum transactions**: Priority determined by `gas_tip_cap` or `min(gas_tip_cap, gas_fee_cap - base_fee)`
140-
- **Cosmos transactions**: Priority calculated as `(fee_amount / gas_limit) - base_fee`
141-
- Transactions with higher effective tips are selected first, regardless of type
142-
143-
### Nonce Sequencing
144-
- Within each account, transactions must be executed in nonce order
145-
- The mempool automatically handles nonce gaps for Ethereum transactions
146-
- See the [Mempool Architecture](/docs/documentation/concepts/mempool#architecture) for detailed flow diagrams
147-
148-
## Transaction Receipts[](#transaction-receipts "Direct link to Transaction Receipts")
130+
In Cosmos EVM, both Ethereum and Cosmos transactions compete fairly for block inclusion:
131+
132+
<Tabs>
133+
<Tab title="Fee Priority">
134+
Transactions are ordered by their effective tips:
135+
- **Ethereum**: `gas_tip_cap` or `min(gas_tip_cap, gas_fee_cap - base_fee)`
136+
- **Cosmos**: `(fee_amount / gas_limit) - base_fee`
137+
- Higher tips = higher priority, regardless of transaction type
138+
</Tab>
139+
140+
<Tab title="Nonce Handling">
141+
**Ethereum transactions** support nonce gaps:
142+
- Correct nonce → immediate broadcast
143+
- Nonce gap → queued locally
144+
- Gap filled → automatic promotion
145+
146+
**Cosmos transactions** require sequential nonces.
147+
</Tab>
148+
</Tabs>
149+
150+
<Info>
151+
For detailed mempool behavior and flow diagrams, see [Mempool Architecture](/docs/documentation/concepts/mempool#architecture).
152+
</Info>
153+
154+
## Transaction Receipts
149155

150156
A transaction receipt shows data returned by an Ethereum client to represent the result of a particular transaction, including a hash of the transaction, its block number, the amount of gas used, and, in case of deployment of a smart contract, the address of the contract. Additionally, it includes custom information from the events emitted in the smart contract.
151157

0 commit comments

Comments
 (0)