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
{{ message }}
This repository was archived by the owner on Jul 31, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/erc-7824.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,12 +49,6 @@ The Nitrolite protocol defines the following core data structures:
49
49
#### Basic Types
50
50
51
51
```solidity
52
-
struct Signature {
53
-
uint8 v;
54
-
bytes32 r;
55
-
bytes32 s;
56
-
}
57
-
58
52
struct Amount {
59
53
address token; // ERC-20 token address (address(0) for native tokens)
60
54
uint256 amount; // Token amount
@@ -86,7 +80,7 @@ struct State {
86
80
uint256 version; // State version incremental number to compare most recent
87
81
bytes data; // Application data encoded, decoded by the adjudicator
88
82
Allocation[] allocations; // Asset allocation and destination for each participant
89
-
Signature[] sigs; // stateHash signatures from participants
83
+
bytes[] sigs; // stateHash signatures from participants
90
84
}
91
85
92
86
enum StateIntent {
@@ -132,14 +126,15 @@ For signature verification, the state hash is computed as:
132
126
bytes32 stateHash = keccak256(
133
127
abi.encode(
134
128
channelId,
135
-
state.data,
129
+
state.intent,
136
130
state.version,
131
+
state.data,
137
132
state.allocations
138
133
)
139
134
);
140
135
```
141
136
142
-
Note: The stateHash is bare signed without EIP-191 since the protocol is intended to be chain-agnostic.
137
+
Note: The smart contract supports all popular signature formats, specifically: raw ECDSA, EIP-191, EIP-712, EIP-1271, and EIP-6492.
143
138
144
139
### Interfaces
145
140
@@ -218,7 +213,7 @@ interface IChannel {
218
213
* @param sig Signature of the participant on the funding state
219
214
* @return channelId Unique identifier for the joined channel
220
215
*/
221
-
function join(bytes32 channelId, uint256 index, Signature calldata sig)
216
+
function join(bytes32 channelId, uint256 index, bytes calldata sig)
222
217
external returns (bytes32);
223
218
224
219
/**
@@ -253,11 +248,13 @@ interface IChannel {
253
248
* @param channelId Unique identifier for the channel
254
249
* @param candidate The state being submitted as the latest valid state
255
250
* @param proofs Additional states required by the adjudicator
251
+
* @param challengerSig Signature of the challenger on the candidate state. Must be signed by one of the participants
256
252
*/
257
253
function challenge(
258
254
bytes32 channelId,
259
255
State calldata candidate,
260
-
State[] calldata proofs
256
+
State[] calldata proofs,
257
+
bytes calldata challengerSig
261
258
) external;
262
259
263
260
/**
@@ -284,25 +281,27 @@ interface IDeposit {
284
281
/**
285
282
* @notice Deposits tokens into the contract
286
283
* @dev For native tokens, the value should be sent with the transaction
284
+
* @param wallet Address of the account whose ledger is changed
287
285
* @param token Token address (use address(0) for native tokens)
288
286
* @param amount Amount of tokens to deposit
289
287
*/
290
-
function deposit(address token, uint256 amount) external payable;
288
+
function deposit(address wallet, address token, uint256 amount) external payable;
291
289
292
290
/**
293
291
* @notice Withdraws tokens from the contract
294
292
* @dev Can only withdraw available (not locked in channels) funds
293
+
* @param wallet Address of the account whose ledger is changed
295
294
* @param token Token address (use address(0) for native tokens)
296
295
* @param amount Amount of tokens to withdraw
297
296
*/
298
-
function withdraw(address token, uint256 amount) external;
297
+
function withdraw(address wallet, address token, uint256 amount) external;
299
298
}
300
299
```
301
300
302
301
### Channel Lifecycle
303
302
304
-
1.**Creation**: Creator constructs channel config and signs initial state with `StateIntent.INITIALIZE`
305
-
2.**Joining**: Participants verify the channel and sign the same funding state
303
+
1.**Creation**: Creator constructs channel config and signs initial state with `StateIntent.INITIALIZE`. Second participant are able to join a channel immediately by providing a signature over initial state, and funds will be deducted from their account, if available.
304
+
2.**Joining**: Participants verify the channel and sign the same funding state. This step can be omitted by providing a signature over the initial state when creating the channel. Note, however, that this means that funds will be locked from the participant's balance, while `join(...)` allows to fund the channel from external account.
306
305
3.**Active**: Once fully funded, the channel transitions to active state for off-chain operation
307
306
4.**Off-chain Updates**: Participants exchange and sign state updates according to application logic
308
307
5.**Resolution**:
@@ -456,7 +455,7 @@ No backward compatibility issues found. This ERC is designed to coexist with exi
456
455
457
456
### On-Chain Security
458
457
459
-
-**Signature Verification**: All state transitions require valid signatures from participants. The protocol uses bare signatures (without EIP-191) for chain agnosticism.
458
+
-**Signature Verification**: All state transitions require valid signatures from participants. The protocol supports signatures of all popular formats, including EIP-191 and EIP-712.
460
459
-**Challenge Period**: The configurable challenge duration provides time for honest participants to respond to invalid states.
461
460
-**Adjudicator Validation**: Custom adjudicators must be carefully audited as they control state transition rules.
462
461
-**Reentrancy Protection**: Implementation should follow checks-effects-interactions pattern, especially in fund distribution.
After authenticating with a ClearNode, you can request information about your channels. This is useful to verify your connection is working correctly and to retrieve channel data.
0 commit comments