Zone SDK Tutorial#211
Conversation
| ## Introduction | ||
| Applications built on Logos are not implemented on the Logos Blockchain directly. Instead, they live in Layer 2 execution environments known as *Sovereign Zones*, henceforth *Zones* for short (*Native Zones* are planned for future versions of Logos). A Zone could host a versatile rollup with thousands of applications, such as the [Logos Execution Zone](../apps/wallet/journeys/quickstart-for-the-logos-execution-zone-wallet.md). It could also be a simple, standalone Zone keeping track of the state of just one application, or anything in between. | ||
|
|
||
| The **Zone SDK** is a ready-to-use toolbox of code that handles basic interactions with a Logos Zone. Develops can use the SDK to simplify the process of building their own Zones and Zone apps. |
There was a problem hiding this comment.
| The **Zone SDK** is a ready-to-use toolbox of code that handles basic interactions with a Logos Zone. Develops can use the SDK to simplify the process of building their own Zones and Zone apps. | |
| The **Zone SDK** is a ready-to-use toolbox of code that handles basic interactions with a Logos Zone. Developers can use the SDK to simplify the process of building their own Zones and Zone apps. |
| @@ -0,0 +1,544 @@ | |||
| # Creating a Logos Zone with the Zone SDK | |||
| ## Introduction | |||
| Applications built on Logos are not implemented on the Logos Blockchain directly. Instead, they live in Layer 2 execution environments known as *Sovereign Zones*, henceforth *Zones* for short (*Native Zones* are planned for future versions of Logos). A Zone could host a versatile rollup with thousands of applications, such as the [Logos Execution Zone](../apps/wallet/journeys/quickstart-for-the-logos-execution-zone-wallet.md). It could also be a simple, standalone Zone keeping track of the state of just one application, or anything in between. | |||
There was a problem hiding this comment.
I feel like we've hit the reader in the head here with way too many variations of zones and jargon.
Can we try something like:
| Applications built on Logos are not implemented on the Logos Blockchain directly. Instead, they live in Layer 2 execution environments known as *Sovereign Zones*, henceforth *Zones* for short (*Native Zones* are planned for future versions of Logos). A Zone could host a versatile rollup with thousands of applications, such as the [Logos Execution Zone](../apps/wallet/journeys/quickstart-for-the-logos-execution-zone-wallet.md). It could also be a simple, standalone Zone keeping track of the state of just one application, or anything in between. | |
| Zones are how you build applications on Logos Blockchain. Zones are lightweight app chains that use Logos Blockchain for settlement and ordering. ... |
We can introduce the distinction between Native Zone and Sovereign Zones later, no need to hit them with everything in the first sentence
|
|
||
| ### Who Interacts with a Zone? | ||
|
|
||
| Every Zone is maintained by a **sequencer**, an execution node publishes updates to the Logos Blockchain. A Zone can also have multiple sequencers taking turns or competing to submit updates. |
There was a problem hiding this comment.
Can we say something like:
| Every Zone is maintained by a **sequencer**, an execution node publishes updates to the Logos Blockchain. A Zone can also have multiple sequencers taking turns or competing to submit updates. | |
| Every Zone is operated by one or more **sequencer**'s. These sequencers collect transactions from users, batches them and publishes them in the form of an inscription to a Channel on Logos Blockchain. |
| The first step to creating a Logos Zone is defining the Zone state - what application(s) it will host, how the state is updated, and in what form updates are posted on-chain. | ||
|
|
||
| #### Example | ||
| In this tutorial, we'll be adapting an existing Rust [password manager](https://github.com/H2CO3/steelsafe) application to the Logos Zone context. The goal is for the user to be able to update their passwords on one device, with other devices syncing their state to match the main device. This design is useful for users who want to avoid relying on managed hosting for their password manager, and cannot self-host it on their own server. |
There was a problem hiding this comment.
| In this tutorial, we'll be adapting an existing Rust [password manager](https://github.com/H2CO3/steelsafe) application to the Logos Zone context. The goal is for the user to be able to update their passwords on one device, with other devices syncing their state to match the main device. This design is useful for users who want to avoid relying on managed hosting for their password manager, and cannot self-host it on their own server. | |
| In this tutorial, we'll be adapting an existing Rust [password manager](https://github.com/H2CO3/steelsafe) application to the Logos Zone context. The goal is for the user to be able to update their passwords on one device, with other devices syncing their state to match the main device. This design is useful for users who want to avoid relying on managed hosting for their password manager, and don't want to be burdened by self-hosting on their own server. |
| ### More Zone Possibilities | ||
| This tutorial illustrated the basic functionality of the Zone SDK to build a simple appchain Zone. However, this is far from the only possibility for custom Zones on Logos. You could use the SDK to build traditional ZK or optimistic rollups, customised high transaction throughput appchains, or even applications with functionality compartmentalised across several Zones. | ||
|
|
||
| Despite their autonomy and customisability, Logos Zones support several key interoperability features. Bridging Layer 1 (Bedrock) tokens into Zones, on-chain message passing between Zones, as well as complex cross-Zone transaction coordination are all supported by the Logos Blockchain. See [**The Secret to Sovereign Zone Interoperability on Logos**](https://press.logos.co/article/sovereign-zone-interoperability) for more details. |
There was a problem hiding this comment.
We will be calling the Bedrock "Logos Blockchain", Shouldn't be referring to bedrock publicly
There was a problem hiding this comment.
Will this change in the specs as well?
weboko
left a comment
There was a problem hiding this comment.
Dogfooded on Ubuntu 24.04.4 LTS x86_64 with Rust 1.94.1. Cloned logos-sql-zone, switched to the tutorial branch, and followed the tutorial by adding all the code examples to the skeleton files.
Two issues blocked a successful build — see inline comments. After fixing them, cargo build succeeded with no errors.
The tutorial logic and code examples are otherwise correct once these gaps are addressed.
| ### Define Your Zone Environment | ||
| The first step to creating a Logos Zone is defining the Zone state - what application(s) it will host, how the state is updated, and in what form updates are posted on-chain. | ||
|
|
||
| #### Example |
There was a problem hiding this comment.
Missing step: git submodule init. The logos-sql-zone repo uses logos-blockchain as a git submodule. After running git clone and git checkout tutorial, the logos-blockchain/ directory is empty, so cargo build fails immediately with:
error: failed to load manifest for dependency `logos-blockchain-core`
Caused by: No such file or directory
A submodule init step is required after the clone:
| #### Example | |
| ```bash | |
| git clone https://github.com/logos-blockchain/logos-sql-zone.git | |
| cd logos-sql-zone | |
| git submodule update --init --recursive |
| handle_event(event, &handle, &mut state, &checkpoint_path).await; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Bug: ZoneIndexer missing generic type parameter. The tutorial shows:
pub struct Indexer {
zone_indexer: ZoneIndexer,
db_path: String,
}But ZoneIndexer<Node> requires a generic argument. This fails to compile:
error[E0107]: struct takes 1 generic argument but 0 generic arguments were supplied
Suggested fix:
| } | |
| pub struct Indexer { | |
| zone_indexer: ZoneIndexer<NodeHttpClient>, | |
| db_path: String, | |
| } |
NodeHttpClient is already imported via use logos_blockchain_zone_sdk::adapter::NodeHttpClient; in the tutorial’s imports.
Tutorial for using the Zone SDK to build a simple custom Zone, with the sql password manager Zone in the logos-blockchain sql-zone branch as the example to follow.