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
- Align Node TypeScript config with the runnable lifecycle example.
- Remove internal checklist terminology and internal stress endpoint defaults from PR1 docs.
- Make app-session nonce and version snippets copy-paste safe.
- Clarify home-channel vs app-session deposit amounts and the Node local-account transaction shim.
- Tighten key-term definitions and footer metadata from review feedback.
Nitrolite uses one shared vocabulary across the SDK, protocol docs, and on-chain contracts. Learn these terms first and the rest of the docs become much easier to scan.
11
11
12
12
:::info Canonical source
13
-
The protocol source of truth is [Protocol Terminology](../../protocol/terminology). PR7 will add a dedicated Learn glossary; until then, use this page as the builder-facing quick reference.
13
+
The protocol source of truth is [Protocol Terminology](../../protocol/terminology). Use this page as the builder-facing quick reference for the SDK docs.
14
14
:::
15
15
16
16
## Core mental model
@@ -22,15 +22,16 @@ Nitrolite lets a user and Nitronode exchange signed channel states off-chain, th
22
22
| Term | What it means | Builder cue |
23
23
|------|---------------|-------------|
24
24
|**Channel**| A state container shared by a user and Nitronode for one unified asset. | The thing your deposits, transfers, withdrawals, and checkpoints update. |
25
-
|**Home Channel**| The default user-Nitronode channel whose home ledger is enforced on its home chain. | Most apps start here. `deposit()`, `transfer()`, and `checkpoint()` act on the home channel for an asset. |
25
+
|**Home Channel**(for a specific Asset) | The default user-Nitronode channel whose home ledger for the Asset is enforced on its home chain. | Most apps start here. `deposit()`, `transfer()`, and `checkpoint()` act on the home channel for an asset. |
26
26
|**Escrow Channel**| A temporary cross-chain channel derived from a home channel for escrow operations. | You meet this when funds move between chains. |
27
27
|**Channel State**| The current agreed channel configuration: ledgers, version, and transition data. | SDK state operations return a state before you decide whether to checkpoint it. |
28
28
|**Channel Definition**| The immutable channel parameters: user, node, asset, nonce, challenge duration, and signature validators. | Fixed at channel creation. Do not model it as app-level mutable config. |
29
29
|**Ledger**| A record of asset allocations and net flows for a specific blockchain inside a channel state. | Ledger math must balance exactly. |
30
30
|**Home Ledger**| The ledger tied to the chain where the current channel state is enforced. | This is the authoritative ledger for checkpoint and challenge flows. |
31
31
|**Non-Home Ledger**| A secondary ledger for a blockchain other than the home chain. | Used by escrow and migration flows, not as a synonym for home channel. |
32
-
|**Vault**| Nitronode's per-chain pool of available funds used to cover required locking during transitions. | Cross-chain availability depends on node liquidity in the right vault. |
32
+
|**(Node) Vault**| Nitronode's per-chain pool of available funds used to cover required locking during transitions. | Cross-chain availability depends on node liquidity in the right vault. |
33
33
|**Asset**| A logical value unit, such as USDC, with a symbol and decimal precision independent of any one chain. | The SDK takes asset symbols like `'usdc'`, not token addresses, for high-level channel operations. |
34
+
|**Token**| The per-blockchain contract representation of an Asset. | Nitronode asset config maps an asset symbol to the token address used on each supported chain. |
34
35
|**Decimal**| An exact decimal amount represented with `decimal.js`. | Use `new Decimal(5)`, not JavaScript floating-point numbers, for SDK amounts. |
35
36
|**App Session**| An application extension that commits channel funds into a multi-party off-chain session. | Games, matching, escrow, and other multi-party flows live here. |
36
37
|**Quorum**| The minimum weighted approval needed for an app session state update. | If weights are `[40, 40, 50]` and quorum is `80`, two participants may be enough. |
@@ -39,7 +40,7 @@ Nitrolite lets a user and Nitronode exchange signed channel states off-chain, th
39
40
|**Checkpoint**| The operation of submitting a signed state to the blockchain layer for enforcement. |`client.checkpoint('usdc')` settles the latest agreed state for that asset. |
40
41
|**Nitronode**| The v1 off-chain coordinator that serves RPC, co-signs valid states, tracks channels, and coordinates app sessions. | This is the node your SDK client connects to over WebSocket. |
41
42
|**ChannelHub**| The v1 on-chain entrypoint for channel create, deposit, withdraw, checkpoint, challenge, and close operations. | The SDK hides most contract calls, but this is the contract enforcing the state. |
42
-
|**Migration**| A transition that moves the channel's home-chain relationship as part of cross-chain operation. | Treat it as protocol state movement, not a package upgrade. |
43
+
|**Migration**| A transition that moves the home-chain channel of a specific Asset to another blockchain. | Treat it as protocol state enforcement configuration, not a package upgrade. |
43
44
|**Transition**| A typed operation explaining why the channel state changed. | Every state advancement carries one transition type. |
Copy file name to clipboardExpand all lines: docs/nitrolite/build/getting-started/prerequisites.mdx
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,8 +89,8 @@ Create `tsconfig.json`:
89
89
{
90
90
"compilerOptions": {
91
91
"target": "ES2022",
92
-
"module": "ESNext",
93
-
"moduleResolution": "bundler",
92
+
"module": "NodeNext",
93
+
"moduleResolution": "NodeNext",
94
94
"strict": true,
95
95
"esModuleInterop": true,
96
96
"skipLibCheck": true,
@@ -101,6 +101,8 @@ Create `tsconfig.json`:
101
101
}
102
102
```
103
103
104
+
This config matches the checked-in Node.js lifecycle example. If your app is built by Vite, webpack, or another bundler, `moduleResolution: "bundler"` can be valid there, but do not use it for a plain `tsc` + `node dist/...` script.
105
+
104
106
Update `package.json`:
105
107
106
108
```json
@@ -121,14 +123,14 @@ Create `.env` for sensitive values:
`NITRONODE_WS_URL` should point at a v1 Nitronode endpoint for the environment you are testing against. The quickstart lifecycle example uses the current public stress endpoint and Sepolia test assets.
133
+
`NITRONODE_WS_URL` should point at a v1 Nitronode endpoint for the environment you are testing against. Use the current sandbox or test endpoint provided for your environment until the public sandbox URL is pinned.
`CHANNEL_DEPOSIT_AMOUNT` is the amount available in the user's home channel. `APP_DEPOSIT_AMOUNT` is the smaller amount committed from that home-channel balance into the app session.
54
+
53
55
Use a dedicated test wallet. Do not reuse a wallet that holds mainnet funds.
54
56
55
57
## Step 2: Connect clients
@@ -70,6 +72,8 @@ const user = await Client.create(
70
72
71
73
`createSigners()` derives both signer types the SDK needs: off-chain state signing and on-chain transaction signing.
72
74
75
+
The checked-in Node.js script also applies `enableNodeLocalAccountTransactions()` after client creation. Public RPC transports need the local account preserved on `writeContract()` calls, otherwise `approveToken()` and `checkpoint()` can fail with viem account errors. Browser wallet apps do not need this shim.
76
+
73
77
## Step 3: Prepare the home channel
74
78
75
79
The script loads Nitronode config, checks the configured asset, sets the asset home blockchain, and prepares the user home channel.
Copy file name to clipboardExpand all lines: examples/nitrolite-v1-lifecycle/README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,4 +22,8 @@ npm run lifecycle
22
22
23
23
Use disposable test wallets only. The app signer can be an unfunded test wallet; the user wallet needs Sepolia gas and the selected test asset.
24
24
25
+
Set `NITRONODE_WS_URL` to the current v1 sandbox or test endpoint provided for your environment before running `npm run lifecycle`.
26
+
27
+
The script calls `enableNodeLocalAccountTransactions()` after creating each SDK client. This keeps viem's local account attached to `writeContract()` requests in Node.js so `approveToken()` and `checkpoint()` can send transactions through public RPC endpoints. Browser wallet apps do not need this shim.
28
+
25
29
Set `CLOSE_HOME_CHANNEL=true` only when you intentionally want to close the example home channel after the app-session lifecycle.
0 commit comments