Skip to main content

Prerequisites

Before you begin, make sure you have:
  • Node.js v18 or higher
  • Yarn package manager
  • Git for cloning the repository

Quick Start

1

Clone the Repository

git clone https://github.com/Gutslabs/blockmsg.git
cd blockmsg
2

Install Dependencies

yarn install
3

Set Environment Variables

cp packages/nextjs/.env.example packages/nextjs/.env.local
Edit .env.local with your configuration
4

Start Development Server

yarn start
App runs at http://localhost:3000

Project Structure

blockmsg/
├── packages/
│   ├── hardhat/           # Smart contracts
│   │   ├── contracts/     # Solidity contracts
│   │   ├── deploy/        # Deployment scripts
│   │   └── test/          # Contract tests
│   └── nextjs/            # Frontend application
│       ├── app/           # Next.js pages
│       ├── components/    # React components
│       └── hooks/         # Custom hooks
└── docs/                  # This documentation

Smart Contracts

SecretCircles.sol

The main contract handling encrypted messaging:
// Key functions
function sendDM(
    address _to,
    externalEuint32[] calldata _encryptedContent,
    bytes[] calldata _proofs,
    uint256 _expiresInSeconds
) external;

function dmMessages(
    address _user1,
    address _user2,
    uint256 _index
) external view returns (DirectMessage memory);

Deploying Contracts

# Deploy to Ethereum Sepolia testnet
cd packages/hardhat
yarn deploy --network sepolia

# Verify contract
yarn verify --network sepolia

Environment Variables

VariableDescription
NEXT_PUBLIC_CHAIN_IDTarget chain ID (Sepolia: 11155111)
NEXT_PUBLIC_CONTRACT_ADDRESSDeployed SecretCircles contract
DEPLOYER_PRIVATE_KEYPrivate key for contract deployment

Testing

Contract Tests

cd packages/hardhat
yarn test

Frontend Development

cd packages/nextjs
yarn dev

Deployment

Frontend (Vercel)

  1. Push to GitHub
  2. Connect repo to Vercel
  3. Set environment variables
  4. Deploy

Contracts (Zama fhEVM)

yarn deploy --network zama

Contributing

Fork & Clone

Fork the repo, make changes, submit a PR

Issues

Report bugs or request features on GitHub
All contributions are welcome! Check the GitHub issues for good first issues.