Yellow Network and Nitrolite (ERC-7824) development best practices for building state channel applications. Use when building apps with Yellow SDK, implementing state channels, connecting to ClearNodes, managing off-chain transactions, or working with application sessions.
78%
Does it follow best practices?
Impact
91%
1.82xAverage score across 3 eval scenarios
—
The risk profile of this skill
Fix and improve this skill with Tessl
tessl review fix ./data/skills-md/0xarcano/agent-skills/yellow-best-practices/SKILL.mdGuidelines for building high-performance decentralized applications using Yellow Network's state channel infrastructure and the Nitrolite SDK (ERC-7824).
npm install @erc7824/nitroliteClearNode WebSocket URL: wss://clearnet.yellow.com/ws
Yellow Network is a decentralized clearing and settlement network that connects brokers, exchanges, and applications across multiple blockchains using state channels. Key features:
┌─────────────────┐ ┌─────────────────┐
│ Your App │────▶│ ClearNode │
│ (Nitrolite SDK)│◀────│ (Broker) │
└─────────────────┘ └─────────────────┘
│ │
└───────────┬───────────┘
▼
┌───────────────┐
│ Blockchain │
│ (Settlement) │
└───────────────┘For detailed rules, see the rules/ directory:
Always implement reconnection logic with exponential backoff:
class ClearNodeConnection {
constructor(url) {
this.url = url;
this.reconnectAttempts = 0;
this.maxReconnectAttempts = 5;
this.reconnectInterval = 3000;
}
connect() {
this.ws = new WebSocket(this.url);
this.ws.onopen = () => {
this.reconnectAttempts = 0;
// Proceed with authentication
};
this.ws.onclose = () => this.attemptReconnect();
}
attemptReconnect() {
if (this.reconnectAttempts >= this.maxReconnectAttempts) return;
this.reconnectAttempts++;
const delay = this.reconnectInterval * Math.pow(2, this.reconnectAttempts - 1);
setTimeout(() => this.connect(), delay);
}
}Use EIP-712 structured data signatures:
import {
createAuthRequestMessage,
createAuthVerifyMessage,
createEIP712AuthMessageSigner,
parseRPCResponse,
RPCMethod,
} from '@erc7824/nitrolite';
// 1. Send auth_request
const authRequest = await createAuthRequestMessage({
address: walletAddress,
session_key: signerAddress,
application: 'YourAppDomain',
expires_at: (Math.floor(Date.now() / 1000) + 3600).toString(),
scope: 'console',
allowances: [],
});
// 2. Handle auth_challenge and send auth_verify
// 3. Store JWT token for reconnectionSign plain JSON payloads (NOT EIP-191):
const messageSigner = async (payload) => {
const wallet = new ethers.Wallet(privateKey);
const messageBytes = ethers.utils.arrayify(
ethers.utils.id(JSON.stringify(payload))
);
const flatSignature = await wallet._signingKey().signDigest(messageBytes);
return ethers.utils.joinSignature(flatSignature);
};import { createAppSessionMessage } from '@erc7824/nitrolite';
const appDefinition = {
protocol: 'nitroliterpc',
participants: [participantA, participantB],
weights: [100, 0],
quorum: 100,
challenge: 0,
nonce: Date.now(),
};
const allocations = [
{ participant: participantA, asset: 'usdc', amount: '1000000' },
{ participant: participantB, asset: 'usdc', amount: '0' },
];
const message = await createAppSessionMessage(signer, [{
definition: appDefinition,
allocations,
}]);wss:// - Never use unencrypted WebSocket connections| Component | Purpose |
|---|---|
NitroliteRPC | Message construction and signing |
NitroliteClient | High-level channel management |
createAuthRequestMessage | Auth request creation |
createAuthVerifyMessage | Challenge response |
createAppSessionMessage | App session creation |
createCloseAppSessionMessage | Session closure |
createGetLedgerBalancesMessage | Balance queries |
parseRPCResponse | Response parsing |
NeverSight/learn-skills.dev
a144501
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.