You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/cli-grpc-rest.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ All endpoints default to `localhost` and must be configured to be accessible ove
32
32
33
33
The CLI is the primary tool for developers and operators interacting with a chain from the terminal. Most Cosmos SDK chains ship a single binary that acts as both the server process and the CLI client. It is common to append a `d` suffix to the binary name to indicate that it is a daemon process, such as `exampled` or `simd`.
34
34
35
-
{/* todo: link to node tutorial page */}
35
+
For a hands-on walkthrough of running a local chain and using the CLI, see the [Running and Testing](/sdk/next/tutorials/example/05-run-and-test) tutorial.
36
36
37
37
When used as a client, the CLI constructs a transaction or query, signs it if required, and submits it through the node client interface.
38
38
@@ -67,11 +67,11 @@ exampled tx counter add 10 \
67
67
68
68
Gas limits the computational work a transaction can perform. The full gas model is explained in [Execution Context, Gas, and Events](/sdk/next/learn/concepts/context-gas-events).
69
69
70
-
{/* todo: link to node tutorial page on how to use the CLI*/}
70
+
For a full CLI reference for the example chain, see [CLI reference](/sdk/next/tutorials/example/05-run-and-test#cli-reference) in the Running and Testing tutorial.
71
71
72
72
### How modules expose CLI commands with `AutoCLI`
73
73
74
-
In modern Cosmos SDK applications, modules expose CLI commands through **`AutoCLI`**. `AutoCLI` reads a module's protobuf service definitions and generates CLI commands automatically, without requiring modules to hand-write Cobra command boilerplate. The counter snippets in this section are from the minimal counter module example. {/* TODO: link to minimal counter module example when it is published in the docs */}
74
+
In modern Cosmos SDK applications, modules expose CLI commands through **`AutoCLI`**. `AutoCLI` reads a module's protobuf service definitions and generates CLI commands automatically, without requiring modules to hand-write Cobra command boilerplate. The counter snippets in this section are from the minimal counter module example. See the [Build a Module from Scratch](/sdk/next/tutorials/example/03-build-a-module) tutorial.
75
75
76
76
A module opts into `AutoCLI` by implementing `AutoCLIOptions()` on its `AppModule`:
77
77
@@ -248,7 +248,7 @@ Some CometBFT RPC endpoints are directly related to the Cosmos SDK:
248
248
249
249
## End-to-end interaction flow
250
250
251
-
To illustrate how these interfaces connect, here is the path of a `counter add` transaction from the user's terminal to a state change on the chain. This example follows the minimal counter module example's CLI shape. {/* TODO: link to minimal counter module example when it is published in the docs */}
251
+
To illustrate how these interfaces connect, here is the path of a `counter add` transaction from the user's terminal to a state change on the chain. This example follows the minimal counter module example's CLI shape. See the [Build a Module from Scratch](/sdk/next/tutorials/example/03-build-a-module#step-9-autocli) tutorial.
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/context-gas-events.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ If gas is exhausted during execution, `ConsumeGas` panics with `ErrorOutOfGas`.
99
99
100
100
### Block gas limit
101
101
102
-
In addition to the per-transaction gas meter, there is a block-level gas meter that tracks total gas consumed by all transactions in a block. The block gas limit prevents a single block from consuming unbounded computation. If a transaction would cause the block's gas total to exceed the limit, it is excluded from the block.
102
+
In addition to the per-transaction gas meter, there is a block-level gas meter that tracks total gas consumed by all transactions in a block. The block gas limit prevents a single block from consuming unbounded computation. If a transaction would cause the block's gas total to exceed the limit, it is excluded from the block. The block gas limit and minimum gas prices are configured in [`app.toml`](/sdk/next/tutorials/example/05-run-and-test#apptoml).
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/encoding.mdx
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ The Cosmos SDK uses protobuf in two encoding modes:
41
41
42
42
**Binary encoding** is the default for everything that participates in consensus: transactions written to blocks, state stored in KV stores, and genesis data. Binary encoding is compact and deterministic. When a transaction is broadcast to the network, it travels as protobuf binary. When a module writes state, it serializes values to protobuf binary before calling `Set` on the store.
43
43
44
-
**JSON encoding** is used for human-readable output: the CLI, gRPC-gateway REST endpoints, and off-chain tooling. The Cosmos SDK uses protobuf's JSON encoding (`ProtoMarshalJSON`) rather than standard Go JSON, which preserves field names from the `.proto` schema and handles special types like `Any` correctly.
44
+
**JSON encoding** is used for human-readable output: the [CLI, gRPC-gateway REST endpoints](/sdk/next/learn/concepts/cli-grpc-rest), and off-chain tooling. The Cosmos SDK uses protobuf's JSON encoding (`ProtoMarshalJSON`) rather than standard Go JSON, which preserves field names from the `.proto` schema and handles special types like `Any` correctly.
45
45
46
46
It is important to keep in mind that **binary encoding is consensus-critical**. Two validators must produce identical binary bytes for identical data. JSON is only used where humans or external clients need to read the data; it never influences the AppHash.
47
47
@@ -123,13 +123,13 @@ Most public and persisted data types in modern SDK modules are defined in `.prot
123
123
124
124
Each module defines its transaction messages in a `tx.proto` file. The `MsgSend` definition above is an example. When a user submits a transaction, the SDK serializes the transaction body (including its messages) to binary using protobuf before broadcasting it.
125
125
126
-
[todo: link to tutorial tx.proto section]
126
+
For a hands-on example, see [tx.proto](/sdk/next/tutorials/example/03-build-a-module#txproto) in the Build a Module tutorial.
127
127
128
128
### Queries
129
129
130
130
Modules define their query services in `query.proto`. Request and response types are protobuf messages. The SDK uses gRPC for queries, and gRPC uses protobuf as its serialization format by definition.
131
131
132
-
[todo: link to tutorial query proto section]
132
+
For a hands-on example, see [query.proto](/sdk/next/tutorials/example/03-build-a-module#queryproto) in the Build a Module tutorial.
`RegisterInterfaces` is required for every module that defines message types. Without it, the SDK cannot decode those messages from transactions. `RegisterLegacyAminoCodec` is optional and only needed for Ledger hardware wallet support via `SIGN_MODE_LEGACY_AMINO_JSON`.
279
279
280
-
{/* todo: link to tutorial codec.go section */}
280
+
For an example of interface registration in a working module, see [Interface Registration](/sdk/next/tutorials/example/03-build-a-module#interface-registration) in the Build a Module tutorial.
The generated gRPC service stub is registered with BaseApp's message router, connecting the handler to the transaction execution pipeline automatically.
353
353
354
+
To learn how to build a module from scratch using this workflow, visit the [Module building tutorial](/sdk/next/tutorials/example/00-overview)
355
+
354
356
## Legacy Amino encoding
355
357
356
358
Before protobuf, the Cosmos SDK used a custom serialization format called **Amino** for transaction encoding, JSON signing documents, and interface serialization. Protobuf has replaced it in all of those roles. The `LegacyAmino` codec still exists for backward compatibility, but is not used in the consensus-critical path.
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/lifecycle.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,14 @@ In the [Transactions, Messages, and Queries](/sdk/next/learn/concepts/transactio
6
6
7
7
Before building with the Cosmos SDK, it's important to connect the high-level architecture from [SDK Application Architecture](/sdk/next/learn/intro/sdk-app-architecture) with how blocks and transactions actually execute in code.
8
8
9
-
A Cosmos SDK application can be conceptually split into layers:
9
+
The following components are essential for understanding the lifecycle of a transaction in the Cosmos SDK:
10
10
11
11
-[CometBFT](/cometbft) (consensus engine) — orders and proposes blocks
12
12
-[ABCI](/sdk/next/learn/intro/sdk-app-architecture#abci-application-blockchain-interface) (Application-Blockchain Interface) — the protocol CometBFT uses to talk to the Cosmos SDK application
13
13
- SDK application ([`BaseApp`](/sdk/next/learn/concepts/baseapp) + [modules](/sdk/next/learn/concepts/modules)) — the deterministic state machine that executes transactions
14
14
-[Protobuf schemas](/sdk/next/learn/concepts/encoding) — define transactions, messages, state, and query types
15
15
16
-
This page maps the block and transaction lifecycle back to those layers.
16
+
This page maps the block and transaction lifecycle back to those components.
17
17
18
18
## ABCI overview
19
19
@@ -203,4 +203,4 @@ CometBFT drives block processing through ABCI. `BaseApp` implements ABCI and orc
203
203
- Message execution within a transaction is atomic: all messages commit or none do
204
204
-`FinalizeBlock` computes and returns the app hash; `Commit` persists state to disk
205
205
206
-
Protobuf ensures canonical encoding so all validators interpret transactions identically. The next section, [Intro to Modules](/sdk/next/learn/concepts/modules), turns from block execution to the module structure that actually implements chain logic.
206
+
[Protobuf](/sdk/next/learn/concepts/encoding) ensures canonical encoding so all validators interpret transactions identically. The next section, [Intro to Modules](/sdk/next/learn/concepts/modules), turns from block execution to the module structure that actually implements chain logic.
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/modules.mdx
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ In the Cosmos SDK, **modules** define that logic.
8
8
9
9
Modules are the fundamental building blocks of a Cosmos SDK application. Each module encapsulates a specific piece of functionality, such as accounts, token transfers, validator management, governance, or any custom logic you define.
10
10
11
-
{/* TODO: link to counter module example walkthrough when it is published in the docs */}
11
+
To see a complete working module, follow the [Build a module tutorial series](/sdk/next/tutorials/example/00-overview).
12
12
13
13
## Why modules exist
14
14
@@ -106,7 +106,7 @@ The `MsgServer` is responsible for:
106
106
- Delegating to keeper methods that validate inputs, enforce business rules, and perform state transitions
107
107
- Returning a response
108
108
109
-
The following example is from the minimal counter module tutorial example, which walks you through building a module that lets users increment a shared counter. {/* TODO: link to Build a Module tutorial */}
109
+
The following example is from the minimal counter module tutorial example, which walks you through building a module that lets users increment a shared counter. See the [Build a Module from Scratch](/sdk/next/tutorials/example/03-build-a-module) tutorial.
110
110
111
111
The following is the counter module's `Add` handler which is the `MsgServer` method that processes a request to increment the counter:
In the minimal tutorial, `Add` is permissionless and delegates directly to the keeper. The handler itself contains almost no business logic. That keeps `msg_server.go` focused on request handling, while the keeper owns the actual state transition.
125
125
126
-
The full counter module example adds richer patterns on top of that minimal shape. For privileged messages like `MsgUpdateParams`, the `MsgServer` checks the caller against the stored authority before proceeding: {/* TODO: link to counter module example walkthrough */}
126
+
The full counter module example adds richer patterns on top of that minimal shape. For privileged messages like `MsgUpdateParams`, the `MsgServer` checks the caller against the stored authority before proceeding. See the [Full Counter Module Walkthrough](/sdk/next/tutorials/example/04-counter-walkthrough#params-and-authority).
@@ -150,7 +150,7 @@ A module's **`Keeper`** is its state access layer. It owns the module's `KVStore
150
150
151
151
The `MsgServer` and `QueryServer` both embed the keeper. It is best practice for business logic to be implemented in keeper methods rather than the `MsgServer`, so the same rules apply whether the caller is a message handler, a block hook, or a governance proposal.
152
152
153
-
The following keeper example is from the minimal counter module example. It holds a single state item and shows the smallest useful keeper shape. {/* TODO: link to minimal counter module example */}
153
+
The following keeper example is from the minimal counter module example. It holds a single state item and shows the smallest useful keeper shape. See [Step 5: Keeper](/sdk/next/tutorials/example/03-build-a-module#step-5-keeper) in the tutorial.
154
154
155
155
```go
156
156
typeKeeperstruct {
@@ -185,7 +185,7 @@ Each module defines an `expected_keepers.go` file that declares the interfaces i
185
185
186
186
This design keeps dependencies auditable and prevents accidental or unsafe cross-module state mutation.
187
187
188
-
{/* TODO: link to minimal counter module example section on expected keepers */}
188
+
To see expected keepers and cross-module fee collection in practice, see [Expected keepers and fee collection](/sdk/next/tutorials/example/04-counter-walkthrough#expected-keepers-and-fee-collection) in the Full Counter Module Walkthrough.
189
189
190
190
### Params
191
191
@@ -197,8 +197,7 @@ The authority address is set at keeper construction time in [`app.go`](/sdk/next
197
197
198
198
For chain-level consensus parameters, the [`x/consensus`](/sdk/next/build/modules/consensus) module manages them centrally; it also supports [`AuthorityParams`](/sdk/next/build/modules/consensus/README#authorityparams), which lets governance update the authority address on-chain without a software upgrade.
199
199
200
-
{/* TODO: link to params section of the module tutorial when published */}
201
-
200
+
To see params implemented in a working module, see [Params and authority](/sdk/next/tutorials/example/04-counter-walkthrough#params-and-authority) in the Full Counter Module Walkthrough.
202
201
203
202
### Block hooks
204
203
@@ -245,7 +244,7 @@ Each module implements:
245
244
During `InitChain`, `BaseApp` calls each module's `InitGenesis` to populate its state from `genesis.json`.
246
245
247
246
For where this happens in the block lifecycle, see [InitChain (genesis only)](/sdk/next/learn/concepts/lifecycle#initchain-genesis-only).
248
-
{/* todo: link to tutorial genesis section */}
247
+
For a walkthrough of genesis implementation, see [Step 2: Proto files](/sdk/next/tutorials/example/03-build-a-module#step-2-proto-files) and [Step 8: module.go](/sdk/next/tutorials/example/03-build-a-module#step-8-modulego) in the Build a Module tutorial.
249
248
250
249
## Built-in and custom modules
251
250
@@ -324,6 +323,8 @@ proto/myapp/mymodule/v1/
324
323
-`module.go`: Connects the module to the application and registers genesis handlers, block hooks, and message and query services.
325
324
-`.proto` files: Define messages, queries, state schemas, and genesis state. Go code is generated from these files and used throughout the module.
326
325
326
+
Check out the [Module Tutorial](/sdk/next/tutorials/example/00-overview) to learn how to build a module from scratch.
327
+
327
328
## Modules in context
328
329
329
330
Putting everything together you've learned so far:
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/sdk-structure.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Every SDK application is composed of three main elements:
14
14
-[Modules](/sdk/next/learn/concepts/modules): self-contained units of business logic, state, messages, and queries
15
15
-[`app.go`](/sdk/next/learn/concepts/app-go): the wiring layer that instantiates `BaseApp`, registers modules, and configures the application at startup
16
16
17
-
`BaseApp` and `app.go` are covered in depth in the next two sections. This page focuses on how they are organized in the codebase.
17
+
`BaseApp` and `app.go` are covered in depth in the next two sections. This page focuses on how they are organized in the codebase. To see all of this in action, follow the [Build a Chain tutorial series](/sdk/next/tutorials/example/00-overview).
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/store.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ The IAVL tree does not store data in memory. It writes versioned nodes to a data
107
107
108
108
The Cosmos SDK uses [CometBFT's `db` package](https://github.com/cometbft/cometbft-db) to abstract over the database implementation. The default backend is [goleveldb](https://github.com/syndtr/goleveldb). Other supported backends include [PebbleDB](https://github.com/cockroachdb/pebble), [RocksDB](https://github.com/facebook/rocksdb), and memDB (in-memory, for testing).
109
109
110
-
The database backend is selected at node startup and configured in `app.toml`. Application code never interacts with it directly; the store layer owns that boundary.
110
+
The database backend is selected at node startup and configured in [`app.toml`](/sdk/next/tutorials/example/05-run-and-test#apptoml). Application code never interacts with it directly; the store layer owns that boundary.
111
111
112
112
## Store types in the SDK
113
113
@@ -245,7 +245,7 @@ KVStores populated
245
245
246
246
For information on how modules define their genesis methods (`DefaultGenesis`, `ValidateGenesis`, `InitGenesis`, `ExportGenesis`) and initialization ordering, see [Intro to Modules](/sdk/next/learn/concepts/modules) and [Transaction Lifecycle](/sdk/next/learn/concepts/lifecycle).
247
247
248
-
{/* todo: link to genesis in tutorial */}
248
+
For a walkthrough of genesis implementation in a module, see [Step 2: Proto files](/sdk/next/tutorials/example/03-build-a-module#step-2-proto-files) and [Step 8: module.go](/sdk/next/tutorials/example/03-build-a-module#step-8-modulego) in the Build a Module tutorial.
Copy file name to clipboardExpand all lines: sdk/next/learn/concepts/testing.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Testing in the SDK
4
4
5
5
The Cosmos SDK provides a layered testing approach that mirrors the architecture of the framework itself. Tests are organized into three levels, each testing a progressively larger slice of the application. This page uses the counter module example in the `example` repo, not the minimal counter module example, because the fuller module includes the testing surfaces needed for these examples.
6
6
7
-
{/* TODO: link to counter module example walkthrough when it is published in the docs throughout this page. */}
7
+
The examples on this page come from the [Full Counter Module Walkthrough](/sdk/next/tutorials/example/04-counter-walkthrough#unit-tests) and [Running and Testing](/sdk/next/tutorials/example/05-run-and-test) tutorials.
0 commit comments