Skip to content

flphth/TRASH

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TRASH

A permissionless, censorship-resistant, multi-chain social board with on-chain AI moderation and privacy-preserving anonymous posting.

Every post is stored immutably on-chain — no operator, no moderator, and no government can delete it.


What is TRASH?

TRASH is a decentralised message board deployed on two independent blockchains (EVM + Solana). Posts are permanent by design. An automated AI moderation layer (Chainlink CRE + OpenAI) flags illegal content on-chain without any human operator involved. Users can optionally break the link between their wallet and their transaction using the Unlink privacy protocol.


Stack

Layer Tech
Frontend Next.js, React, TypeScript, Tailwind CSS
EVM Contracts Solidity 0.8.20, Foundry
Solana Program Rust, Anchor
Wallet connection WalletConnect (Reown AppKit), wagmi, viem
Privacy Unlink SDK
Moderation Chainlink CRE + OpenAI Moderation API

Project Structure

ethg9/
├── frontend/          # Next.js app (port 3000)
├── evm-contracts/     # Solidity contracts (Foundry)
├── svm-contracts/     # Solana program (Anchor)
├── cre-workflow/      # Chainlink moderation workflow
└── package.json       # Root scripts

Prerequisites

  • Node.js 18+
  • Foundry (forge, cast, anvil)
  • Anchor CLI + Solana CLI
  • A wallet with testnet funds (Base Sepolia + Solana Devnet)

Quick Start

1. Install dependencies

npm install
cd frontend && npm install && cd ..
cd evm-contracts && npm install && cd ..
cd svm-contracts && npm install && cd ..
cd cre-workflow && npm install && cd ..

2. Configure environment variables

Root — copy .env.example to .env:

PRIVATE_KEY=           # EVM private key (without 0x)
BASESCAN_API_KEY=      # For contract verification
RPC_URL_84532=         # Base Sepolia RPC

Frontend — copy frontend/.env.example to frontend/.env.local:

NEXT_PUBLIC_POST_BOARD_ADDRESS=       # Deployed PostBoard address
NEXT_PUBLIC_MODERATION_ADDRESS=       # Deployed Moderation address
NEXT_PUBLIC_UNLINK_POOL_ADDRESS=      # Unlink privacy pool address
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID= # Reown/WalletConnect project ID
NEXT_PUBLIC_SOLANA_PROGRAM_ID=        # Solana program ID
NEXT_PUBLIC_SOLANA_RPC=https://api.devnet.solana.com
NEXT_PUBLIC_INFURA_API_KEY=
OPENAI_API_KEY=
UNLINK_API_KEY=

3. Run the frontend

npm run dev
# → http://localhost:3000

Deploying Contracts

EVM (Base Sepolia)

npm run deploy:evm             # Deploy PostBoard
npm run deploy:evm:moderation  # Deploy Moderation contract

Or locally with Anvil:

npm run deploy:evm:local

Solana (Devnet)

npm run deploy:svm:build   # Build Anchor program
npm run deploy:svm         # Deploy to devnet
npm run deploy:svm:init    # Initialize board state

Deploy everything

npm run deploy:all

Chainlink Moderation Workflow

The CRE workflow listens for PostCreated events, calls the OpenAI Moderation API inside a TEE, and writes the result to the Moderation contract on-chain.

cd cre-workflow
npm run simulate   # Test locally
npm run deploy     # Deploy to Chainlink

Deployed Contracts (Base Sepolia Testnet)

Contract Address
PostBoard 0x8D3721BD54Fc416DF27a75531CEaedA4cC88feeC
Moderation 0x52487e8c3901dac85dacbda4da3f24c1d6b625c5

Solana Program ID (Devnet): 2VZ3wX7cZZnLmaEeSwcCDcLyQitHLzLshr91oe58dAjs


How it Works

  1. Post — Sign a transaction to call PostBoard.post(content, parentId). The post is emitted as a PostCreated event (EVM) or stored as a PDA (Solana).
  2. Read — The frontend scans event logs / Solana accounts to reconstruct the full post history.
  3. Anonymous posting — Optionally route the transaction through Unlink: a burner wallet funded via a privacy pool submits the post, the author field shows the pool address.
  4. Moderation — Chainlink CRE automatically detects illegal content and writes a flag to the Moderation contract. No human is involved.

Full technical details: White Paper


Scripts Reference

npm run dev                    # Start frontend dev server
npm run deploy:evm             # Deploy EVM contracts to Base Sepolia
npm run deploy:evm:local       # Deploy EVM contracts to local Anvil
npm run deploy:evm:moderation  # Deploy Moderation contract
npm run deploy:svm             # Deploy Solana program to devnet
npm run deploy:svm:build       # Build Anchor program
npm run deploy:svm:init        # Initialize Solana board state
npm run deploy:svm:test        # Run Anchor tests on localnet
npm run deploy:all             # Deploy EVM + SVM + init
npm run cre:simulate           # Simulate Chainlink moderation workflow

About

A permissionless, censorship-resistant, multi-chain social board

Topics

Resources

Stars

Watchers

Forks

Contributors