|
1 | | -# Tempo Zones |
| 1 | +<!-- TODO: add logo --> |
| 2 | +<!-- <p align="center"><a href="https://tempo.xyz/zones"><img src="assets/logo.png" alt="Tempo Zones" width="400"></a></p> --> |
2 | 3 |
|
3 | | -Zones are sidechains anchored to Tempo. Each zone has its own sequencer, genesis state, and portal contract that escrows deposits and processes withdrawals. |
| 4 | +<h1 align="center">Tempo Zones</h1> |
4 | 5 |
|
5 | | -**Explorers:** [Moderato](https://explore.moderato.tempo.xyz/) |
| 6 | +--- |
6 | 7 |
|
7 | | -This repository contains the `tempo-zone` node, zone-specific precompiles and RPC support, and the `just` workflows for deploying and operating zones on Tempo. |
| 8 | +Zones are private blockchains anchored to [Tempo](https://github.com/tempoxyz/tempo), with native support for confidential balances and transactions. Zones inherit compliance from Tempo L1 and support interoperability with Tempo for moving assets in and out of zones. |
8 | 9 |
|
9 | | -For the main Tempo repository, see [tempoxyz/tempo](https://github.com/tempoxyz/tempo). |
| 10 | +You can get started today by [deploying a zone](#getting-started) on Tempo testnet, reading the [full zone documentation](docs/ZONES.md), or exploring the [Zone specs](https://docs.tempo.xyz/protocol). |
10 | 11 |
|
11 | | -## Quick Start |
12 | 12 |
|
13 | | -Prerequisites: |
| 13 | +## What Makes Zones Interesting |
14 | 14 |
|
15 | | -- [Rust toolchain](https://rustup.rs/) |
16 | | -- [Foundry](https://book.getfoundry.sh/getting-started/installation) (`cast`, `forge`) |
17 | | -- [`just`](https://github.com/casey/just#packages) |
18 | | -- [`jq`](https://jqlang.github.io/jq/download/) |
| 15 | +- **Private balances and transactions.** State access requires account authentication at the RPC layer. This ensures that only the authorized account holder can access balances and transaction history. The zone operator maintains full visibility into state for compliance. |
19 | 16 |
|
20 | | -Deploy and start a zone on Moderato: |
| 17 | +- **Encrypted deposits and withdrawals.** When depositing into a zone, users can encrypt the recipient to not reveal who receives funds inside the zone. Encrypted withdrawals are also possible, allowing the sender to be replaced with a commitment, preserving recipient verifiability without exposing the sender when withdrawing to Tempo mainnet. |
21 | 18 |
|
22 | | -```bash |
23 | | -export L1_RPC_URL="wss://rpc.moderato.tempo.xyz" |
24 | | -just deploy-zone my-zone |
25 | | -``` |
| 19 | +- **Zone to zone transfers.** Zones interoperate with Tempo Mainnet via withdrawals with optional calldata. Withdrawal calldata can execute on Tempo and deposit into another zone, enabling flows like zone to zone transfers or executing a swap between sending amounts to another zone. |
26 | 20 |
|
27 | | -To choose a different initial TIP-20 on the portal at deploy time, pass it as the second positional argument: |
| 21 | +- **Compliance inherited from Tempo Mainnet.** [TIP-403](https://docs.tempo.xyz/protocol/tip403/overview) policies (whitelist, blacklist) are mirrored from Tempo and enforced on zones. Issuers set the policy once on Tempo and the zone picks it up automatically. If an issuer freezes an address or updates a blacklist on Tempo, the zone inherits the change in the next block. |
28 | 22 |
|
29 | | -```bash |
30 | | -just deploy-zone my-zone alphausd |
31 | | -``` |
| 23 | +- **Fast withdrawals.** The zone processes transactions every 250ms and submits batches of withdrawals to Tempo, where blocks are produced every ~500ms. Once batches are accepted and the attached proof is validated, withdrawals are processed and funds are released from escrow. |
32 | 24 |
|
33 | | -`just deploy-zone` will: |
34 | 25 |
|
35 | | -- Generate a fresh sequencer keypair |
36 | | -- Fund the sequencer via `tempo_fundAddress` |
37 | | -- Build the Solidity specs |
38 | | -- Deploy a zone via `ZoneFactory` |
39 | | -- Generate `generated/<name>/genesis.json` and `generated/<name>/zone.json` |
40 | | -- Register the sequencer encryption key and start the zone node |
| 26 | +## Getting Started |
41 | 27 |
|
42 | | -### Key Addresses |
| 28 | +Prerequisites: [Rust](https://rustup.rs/), [Foundry](https://book.getfoundry.sh/getting-started/installation), [`just`](https://github.com/casey/just#packages), [`jq`](https://jqlang.github.io/jq/download/) |
43 | 29 |
|
44 | | -| Contract | Address | Explorer | |
45 | | -|----------|---------|----------| |
46 | | -| ZoneFactory (moderato) | `0x7Cc496Dc634b718289c192b59CF90262C5228545` | [View on Moderato explorer](https://explore.moderato.tempo.xyz/address/0x7Cc496Dc634b718289c192b59CF90262C5228545) | |
47 | 30 |
|
48 | | -`just create-zone`, `just deploy-zone`, and `just zone-info` default to this Moderato `ZoneFactory`. `just deploy-router` also falls back to it when `zone.json` does not already include `zoneFactory`. |
| 31 | +## Deploying a Zone |
49 | 32 |
|
50 | | -`zone.json` stores the deployed portal address, zone ID, anchor block, and sequencer metadata used by later commands such as `just zone-up` and `just deploy-router`. |
| 33 | +```bash |
| 34 | +# Deploy and start a zone on Moderato testnet |
| 35 | +export L1_RPC_URL="wss://rpc.moderato.tempo.xyz" |
| 36 | +just deploy-zone my-zone |
| 37 | +``` |
51 | 38 |
|
52 | | -To restart the same zone later: |
| 39 | +The `deploy-zone` command generates a sequencer keypair, funds it on L1, deploys the portal via `ZoneFactory`, generates genesis, and starts the node. |
53 | 40 |
|
54 | 41 | ```bash |
55 | | -just zone-up my-zone false release |
| 42 | +# Start/restart a zone after initial deployment |
| 43 | +just zone-up my-zone |
56 | 44 | ``` |
57 | 45 |
|
58 | | -## Query the Private RPC |
| 46 | +## Depositing into a Zone |
59 | 47 |
|
60 | | -With `PRIVATE_KEY` set to your zone wallet, you can hit the private RPC on `http://localhost:8544` with a one-liner. `just zone-auth-token` reads `generated/<name>/zone.json`, signs a short-lived auth token, and `cast rpc` passes it through the `X-Authorization-Token` header: |
| 48 | +```bash |
| 49 | +export L1_PORTAL_ADDRESS=$(jq -r '.portal' generated/my-zone/zone.json) |
| 50 | +just max-approve-portal |
| 51 | + |
| 52 | +# deposit into the zone |
| 53 | +just send-deposit 1000000 # deposit to your own address |
| 54 | +just send-deposit 1000000 <recipient-address> # deposit to a specific address |
| 55 | +``` |
61 | 56 |
|
62 | 57 | ```bash |
63 | | -cast rpc zone_getAuthorizationTokenInfo \ |
64 | | - --rpc-url http://localhost:8544 \ |
65 | | - --rpc-headers "X-Authorization-Token: $(just zone-auth-token my-zone)" |
| 58 | +# send an encrypted deposit |
| 59 | +just send-deposit-encrypted 1000000 # to your own address |
| 60 | +just send-deposit-encrypted 1000000 <recipient-address> # to a specific address |
66 | 61 | ``` |
67 | 62 |
|
68 | | -See [docs/ZONES.md](docs/ZONES.md) for more private RPC examples, including reusable tokens and `eth_call` queries. |
| 63 | +## Withdrawing from Zone to Tempo |
69 | 64 |
|
70 | | -## How Zones Work |
| 65 | +```bash |
71 | 66 |
|
72 | | -- A zone sequencer subscribes to Tempo for headers, deposits, and token-enablement events, including backfill from the zone's anchor block. |
73 | | -- The zone builds one sidechain block per Tempo block, processing Tempo-driven state transitions through system transactions before app transactions. |
74 | | -- The zone monitor batches zone blocks back to Tempo and processes withdrawals from the zone back to Tempo users. |
| 67 | +# withdraw from the zone |
| 68 | +just max-approve-outbox |
| 69 | +just send-withdrawal 1000000 <recipient-address> # withdraw to a specific address |
| 70 | +``` |
75 | 71 |
|
76 | | -## More Docs |
| 72 | +The sequencer includes the withdrawal in the next batch submission to L1 and processes it automatically. |
77 | 73 |
|
78 | | -See [docs/ZONES.md](docs/ZONES.md) for: |
79 | 74 |
|
80 | | -- Step-by-step setup and deployment |
81 | | -- Deposits, withdrawals, and private RPC usage |
82 | | -- Router demos and TIP-403 policy flows |
83 | | -- Architecture, configuration, and command reference |
| 75 | +## Querying the Private RPC |
84 | 76 |
|
85 | | -## Development |
| 77 | +Zone balances are private by default. Every RPC request must include a signed authorization token that proves you control the querying account. |
| 78 | + |
| 79 | +`just zone-auth-token` reads `generated/<name>/zone.json` and signs a short-lived auth token: |
86 | 80 |
|
87 | 81 | ```bash |
88 | | -git clone https://github.com/tempoxyz/zones.git |
89 | | -cd zones |
90 | | -cargo build --bin tempo-zone |
91 | | -cargo test --workspace |
92 | | -``` |
93 | 82 |
|
94 | | -The main binary in this repository is `tempo-zone`: |
| 83 | +# generate an auth token |
| 84 | +export PRIVATE_KEY=<zone-wallet-private-key> |
| 85 | +export TOKEN=$(just zone-auth-token my-zone) |
95 | 86 |
|
96 | | -```bash |
97 | | -cargo run --bin tempo-zone -- node --help |
| 87 | +# query your TIP-20 balance |
| 88 | +just check-balance-private my-zone <token-address> |
98 | 89 | ``` |
99 | 90 |
|
100 | | -## Contributing |
101 | | - |
102 | | -Our contributor guidelines can be found in [`CONTRIBUTING.md`](https://github.com/tempoxyz/tempo?tab=contributing-ov-file). |
103 | 91 |
|
104 | | -## Security |
| 92 | +See [docs/ZONES.md](docs/ZONES.md) for the full guide on deposits, withdrawals, private RPC, router demos, TIP-403 policy flows, and command references. |
105 | 93 |
|
106 | | -See [`SECURITY.md`](https://github.com/tempoxyz/tempo?tab=security-ov-file). Note: Tempo is still undergoing audit and does not have an active bug bounty. Submissions will not be eligible for a bounty until audits have concluded. |
107 | 94 |
|
108 | 95 | ## License |
109 | 96 |
|
|
0 commit comments