Skip to main content

DePIN Node Tutorial

15 minutes to launch a Trinity DePIN node


Goal of This Tutorial

Launch a DePIN (Decentralized Physical Infrastructure Network) node.

What you'll learn:

  • How to set up a DePIN node
  • How to connect to the network
  • How to earn rewards
  • How to monitor the node

What is DePIN?

DePIN is a decentralized network of Trinity inference nodes.

ComponentDescription
NodeYour server running Trinity
NetworkP2P network of nodes
Rewards$TRI tokens for inference
MiningProof of work

Step 1: Requirements

RequirementMinimum
RAM8 GB
CPU4 cores
Disk50 GB SSD
Network100 Mbps
Zig0.15.x

Step 2: Initialize Node

# Build DePIN components
zig build tri

# Initialize node
./zig-out/bin/tri depin init

# Generate node key
./zig-out/bin/tri depin generate-key

Result:

Node ID: trinity-node-0x1234...
Public Key: 0xabc...
Private Key: stored in ~/.trinity/keys/

Step 3: Configure Node

# Edit config
nano ~/.trinity/depin/config.toml
[node]
name = "my-trinity-node"
region = "europe"

[network]
bootstrap_peers = [
"trinity-bootstrap.example:8765"
]

[mining]
enabled = true
max_concurrent_jobs = 4

[rewards]
address = "0xYourWalletAddress"

Step 4: Start Node

# Start node
./zig-out/bin/tri depin start

# Or with logging
./zig-out/bin/tri depin start --verbose

Expected output:

[INFO] Starting Trinity DePIN Node...
[INFO] Node ID: trinity-node-0x1234...
[INFO] Connecting to network...
[INFO] Connected to 5 peers
[INFO] Mining enabled: 4 workers
[INFO] Ready for inference jobs

Step 5: Monitor Node

# Check status
./zig-out/bin/tri depin status

# View logs
tail -f ~/.trinity/logs/depin.log

# Check earnings
./zig-out/bin/tri depin rewards

Code Example

const std = @import("std");
const depin = @import("depin");

pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}) {};
defer _ = gpa.deinit();
const allocator = &gpa.allocator;

// Create node
var node = try depin.Node.init(allocator, .{
.name = "my-node",
.max_jobs = 4,
});
defer node.deinit();

// Start
try node.start();

// Run forever
std.time.sleep(std.time.us_per_s * 1_000_000_000);
}

Rewards

ActionReward
Inference job10 $TRI per 1K tokens
Block validation1 $TRI per block
Referral5% of referral earnings

Troubleshooting

ProblemSolution
Cannot connect to peersCheck firewall port 8765
Low earningsIncrease max_concurrent_jobs
Out of memoryReduce max_jobs

What's Next?

TutorialDescription
DeploymentDeploy to Fly.io
BitNet InferenceLLM inference

φ² + 1/φ² = 3 = TRINITY