agorix
AirdropMarketsCollectionsLeaderboardActivity
Agorix · Decentralized Marketplace
Independent · Resilient · Community-Run

A cross-chain marketplace, run by the community.

Discover, list, and trade across Bitcoin, Ethereum, and Solana on an open, community-run network.

Marketplace
CollectionsMarketsLeaderboardActivity
Network
GovernanceExplorerAirdropDocs
Account
ProfileSettings
Legal
Terms of ServicePrivacy PolicyYour Privacy Choices
agorix.io — Lasting Access
CID: 0xA60R1X · v0.1
AirdropMarketsCollections
D
Protocol Docs
Public APISmart ContractsSecurity ModelOpen SourceRust Node CoreGetting Started (Developer)Benchmarks
Docs/Developer/Getting Started (Developer)
Developer

Getting Started (Developer)

Developer quick start. Local setup, dev commands, package guidelines, and how to add new protocol events and API routes.

#Getting Started (Developer)

Everything you need to go from zero to a running local dev cluster.

#Local Setup

bash
# Clone the repository
git clone https://github.com/decenterlize/decenterlizemarket.git
cd decenterlizemarket

# Install dependencies (pnpm required)
pnpm install

# Start infrastructure (PostgreSQL, Redis)
docker compose up -d

# Copy environment template
cp .env.example .env

# Run database migrations
pnpm db:migrate

# Start the dev server
pnpm dev

#Dev Commands

CommandDescription
pnpm devStart single node in development mode
pnpm dev:clusterStart a multi-node local cluster (3 nodes)
pnpm dev:btcStart with Bitcoin testnet/regtest configuration
pnpm dev:evmStart with EVM local chain (Hardhat/Anvil)
pnpm dev:solStart with Solana localnet
pnpm testRun the full test suite (vitest)
pnpm buildProduction build
pnpm bench:dashboardStart the benchmark dashboard on port 4400
pnpm db:migrateRun database migrations
pnpm db:seedSeed development data

#Package Guidelines

Each package has a specific role and a strict dependency direction. Packages higher in the stack can depend on packages below them, but never the reverse.

services/protocol — The foundation. Zero external dependencies. Pure Zod schemas and deterministic validation logic. Every function must be deterministic: same input, same output, every time. No IO, no randomness, no side effects. If you're adding something here, it must be a protocol rule that every node computes identically.

services/db — Database layer. Drizzle ORM schemas for PostgreSQL. Can depend on protocol for type definitions. Each node has its own isolated database. No shared DB across nodes.

services/agent — Node runtime. Mesh networking, gossip protocol, peer management, heartbeat. Can depend on protocol and db. This is the process lifecycle layer.

services/server — Business logic. tRPC routers, API handlers, chain-specific settlement. Can depend on all other packages. This is where marketplace logic lives.

services/cache — Redis caching and rate limiting. Used by server and agent.

#Adding a New Protocol Event

When you need to add a new event type to the protocol:

  • Define the schema in services/protocol/src/events/. Use Zod for the payload schema. The schema must be deterministic (no optional fields that affect validation).
typescript
export const MY_NEW_EVENT = z.object({
  type: z.literal("MY_NEW_EVENT"),
  payload: z.object({
    // your fields here
  }),
  nodeId: z.string(),
  timestamp: z.number(),
  signature: z.string(),
});
  • Add the event constant to the event type registry in services/protocol/src/events/index.ts.
  • Register the event in the protocol validator so it gets included in truth evaluation.
  • Add a retention tier. Events have different retention periods based on their importance. Critical events (settlements, attestations) are kept forever. Ephemeral events (heartbeats) are pruned aggressively.
  • Implement the handler in services/server/ that processes the event when received via gossip.
  • Add test vectors. Create test cases in both TypeScript and (if applicable) Rust to maintain parity.

#Adding a New API Route

  • Create the route file in the appropriate directory under services/server/src/.
  • Use tRPC. All routes are tRPC procedures with typed inputs and outputs.
typescript
export const myRouter = router({
  myEndpoint: protectedProcedure
    .input(z.object({ /* input schema */ }))
    .mutation(async ({ input, ctx }) => {
      // implementation
    }),
});
  • Add node authentication. Internal routes must use protectedProcedure which verifies the Ed25519 signature in the request headers.
  • Add rate limiting. Apply the appropriate rate limit tier based on the endpoint's sensitivity and expected call frequency.
  • Register the route in the main router composition.

#Testing

The project uses vitest for all testing:

- dev-cluster/ — Session attestation, UI integrity

- governance/ — Misbehavior strikes

- mpc/ — Key safety

- node-auth/ — Authentication edge cases

- verification/ — TX-plan quorum

  • Unit tests live alongside the code they test.
  • Integration tests in __tests__/ cover API routes and cross-package flows.
  • Security tests in services/server/__tests__/ cover specific attack vectors:

Run the full suite with pnpm test. Run a specific test file with pnpm vitest run path/to/test.ts.

#Environment Variables

Key environment variables (see .env.example for the full list):

VariableDescription
DATABASE_URLPostgreSQL connection string
REDIS_URLRedis connection string
NODE_IDUnique node identifier
NODE_PRIVATE_KEYEd25519 private key (hex)
BTC_RPC_URLBitcoin RPC endpoint
ETH_RPC_URLEthereum RPC endpoint
SOL_RPC_URLSolana RPC endpoint
FULL_NODE_CHATSet to 1 to store all chat threads (not just assigned shards)
FULL_NODE_MEDIASet to 1 to cache all media (not just assigned shards)
PreviousRust Node CoreNext Benchmarks

On this page

  • Getting Started (Developer)
  • Local Setup
  • Dev Commands
  • Package Guidelines
  • Adding a New Protocol Event
  • Adding a New API Route
  • Testing
  • Environment Variables