A decentralized news platform built with React, IPFS, and Ethereum. Articles are stored on IPFS and indexed on the blockchain, creating a censorship-resistant news platform.
- Decentralized content storage using IPFS (Helia)
- On-chain article indexing using Ethereum
- Web3 authentication with MetaMask
- Local caching for fast development
- Tag-based article organization
- Hacker News-inspired minimalist UI
- Terminal-inspired theme
- Frontend: React + TypeScript + Vite
- Smart Contracts: Solidity + Hardhat
- Storage: IPFS (Helia)
- Blockchain: Ethereum (Local/Sepolia/Mainnet)
- Web3: ethers.js + MetaMask
- Clean, minimalist article listing
- Numbered entries like Hacker News
- Full-screen article view
- Tag system for categorization
- Terminal-inspired dark theme
- Responsive design
- Node.js 16+
- MetaMask browser extension
- Git
-
Clone the repository:
git clone https://github.com/yourusername/cipherpress.git cd cipherpress -
Install dependencies:
npm install
-
Create environment files:
cp .env.example .env cp .env.example .env.development
-
Update environment variables in
.env:PRIVATE_KEY=your_private_key_here SEPOLIA_RPC_URL=your_rpc_url ETHERSCAN_API_KEY=your_api_key
-
Start a local Hardhat blockchain:
npm run node
-
Deploy the contract:
npm run deploy:local
-
Configure MetaMask:
- Network Name:
Hardhat Local - RPC URL:
http://127.0.0.1:8545 - Chain ID:
31337 - Currency:
ETH
- Network Name:
-
Start the development server:
npm run dev
-
Connect Your Wallet:
- Click the profile icon in the top right
- Connect with MetaMask
- Ensure you're on the Hardhat Local network
-
Create an Article:
- Click the upload icon in the header
- Fill in the title and content
- Add some tags (press Enter after each tag)
- Click "Publish to IPFS"
- Confirm the transaction in MetaMask
-
View Articles:
- Return to the feed (click CipherPress logo)
- Your article should appear at the top
- Click the title to view full article
- Articles are numbered like Hacker News
-
Run Tests:
# Start local blockchain npm run node # Deploy contract (in new terminal) npm run deploy:local # Run contract tests npm run test:contract # Test IPFS integration npm run test:ipfs # Run full integration test npm run test:all
-
Contract Testing Details:
- Tests contract deployment
- Validates article publishing
- Checks title and CID requirements
- Verifies article retrieval
- Tests pagination functionality
-
Manual Testing:
// In browser console // Get total articles const count = await contract.getNewsCount(); console.log('Total articles:', count.toString()); // Get latest 5 articles const latest = await contract.getLatestArticles(5); console.log('Latest articles:', latest);
If you encounter CORS errors or issues with article loading:
- Open browser console (F12)
- Clear the cache:
import { clearIPFSCache } from './utils/debug'; clearIPFSCache();
MIT