Skip to content

Commit d84107e

Browse files
authored
smaller README (#6)
1 parent 273a0e9 commit d84107e

3 files changed

Lines changed: 273 additions & 239 deletions

File tree

README.md

Lines changed: 29 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11
# Atlas
22

3-
A lightweight Ethereum L2 blockchain explorer with NFT support.
4-
5-
## Overview
6-
7-
Atlas is a minimal, fast blockchain explorer designed for custom Ethereum L2 networks. It provides:
8-
9-
- Block and transaction browsing
10-
- Address tracking with labels
11-
- ERC-721 NFT indexing with metadata
12-
- ERC-20 token indexing and balances
13-
- Event log decoding
14-
- Contract verification
15-
- Proxy contract detection
16-
- Etherscan-compatible API
17-
- Universal search
18-
19-
## Architecture
20-
21-
```
22-
atlas/
23-
├── backend/ # Rust backend services
24-
│ ├── crates/
25-
│ │ ├── atlas-common/ # Shared types and database models
26-
│ │ ├── atlas-indexer/ # Blockchain indexer + metadata fetcher
27-
│ │ └── atlas-api/ # REST API server (Axum)
28-
│ └── migrations/ # PostgreSQL migrations
29-
├── frontend/ # React frontend (Vite + Tailwind)
30-
├── docker-compose.yml # Container orchestration
31-
└── docs/
32-
└── PRD.md # Product requirements
33-
```
3+
A lightweight Ethereum L2 blockchain explorer.
344

355
## Quick Start
366

@@ -42,19 +12,14 @@ atlas/
4212

4313
### Running with Docker
4414

45-
1. Set your RPC endpoint:
46-
47-
```bash
48-
export RPC_URL=https://your-l2-rpc.example.com
49-
```
50-
51-
2. Start all services:
15+
```bash
16+
cp .env.example .env
17+
# Edit .env with your RPC endpoint
5218

53-
```bash
54-
docker-compose up -d
55-
```
19+
docker-compose up -d
20+
```
5621

57-
3. Access the explorer at <http://localhost:3000>
22+
Access the explorer at http://localhost:3000
5823

5924
### Local Development
6025

@@ -66,15 +31,13 @@ cd backend
6631
# Start PostgreSQL
6732
docker-compose up -d postgres
6833

69-
# Set environment variables
34+
# Set environment
7035
export DATABASE_URL=postgres://atlas:atlas@localhost/atlas
7136
export RPC_URL=https://your-l2-rpc.example.com
7237

73-
# Run the indexer
38+
# Run services
7439
cargo run --bin atlas-indexer
75-
76-
# In another terminal, run the API server
77-
cargo run --bin atlas-api
40+
cargo run --bin atlas-api # in another terminal
7841
```
7942

8043
**Frontend:**
@@ -87,198 +50,25 @@ bun run dev
8750

8851
## Configuration
8952

90-
### Environment Variables
91-
92-
| Variable | Description | Default |
93-
|---------------------------|-------------------------------------|-------------------------|
94-
| `DATABASE_URL` | PostgreSQL connection string | Required |
95-
| `RPC_URL` | Ethereum JSON-RPC endpoint | Required |
96-
| `START_BLOCK` | Block number to start indexing from | `0` |
97-
| `BATCH_SIZE` | Number of blocks to index per batch | `100` |
98-
| `REINDEX` | Set to `true` to wipe and reindex | `false` |
99-
| `RPC_REQUESTS_PER_SECOND` | Rate limit for RPC calls | `100` |
100-
| `IPFS_GATEWAY` | IPFS gateway for NFT metadata | `https://ipfs.io/ipfs/` |
101-
| `METADATA_FETCH_WORKERS` | Concurrent metadata fetch workers | `4` |
102-
| `API_HOST` | API server bind address | `0.0.0.0` |
103-
| `API_PORT` | API server port | `3000` |
104-
| `SOLC_PATH` | Path to solc binary for verification| `solc` |
105-
106-
## API Reference
107-
108-
### Blocks
109-
110-
| Endpoint | Description |
111-
|----------------------------------------|---------------------------|
112-
| `GET /api/blocks` | List blocks (paginated) |
113-
| `GET /api/blocks/:number` | Get block by number |
114-
| `GET /api/blocks/:number/transactions` | Get transactions in block |
115-
116-
### Transactions
117-
118-
| Endpoint | Description |
119-
|-------------------------------|-------------------------|
120-
| `GET /api/transactions/:hash` | Get transaction by hash |
121-
122-
### Addresses
123-
124-
| Endpoint | Description |
125-
|--------------------------------------------|---------------------------|
126-
| `GET /api/addresses/:address` | Get address info |
127-
| `GET /api/addresses/:address/transactions` | Get address transactions |
128-
| `GET /api/addresses/:address/nfts` | Get NFTs owned by address |
129-
130-
### NFTs
131-
132-
| Endpoint | Description |
133-
|-----------------------------------------------------------|----------------------------|
134-
| `GET /api/nfts/collections` | List NFT collections |
135-
| `GET /api/nfts/collections/:address` | Get collection details |
136-
| `GET /api/nfts/collections/:address/tokens` | List tokens in collection |
137-
| `GET /api/nfts/collections/:address/tokens/:id` | Get token details |
138-
| `GET /api/nfts/collections/:address/tokens/:id/transfers` | Get token transfer history |
139-
140-
### Tokens (ERC-20)
141-
142-
| Endpoint | Description |
143-
|---------------------------------------|--------------------------------|
144-
| `GET /api/tokens` | List ERC-20 tokens |
145-
| `GET /api/tokens/:address` | Get token details |
146-
| `GET /api/tokens/:address/holders` | Get token holders |
147-
| `GET /api/tokens/:address/transfers` | Get token transfers |
148-
| `GET /api/addresses/:address/tokens` | Get address token balances |
149-
150-
### Event Logs
151-
152-
| Endpoint | Description |
153-
|-----------------------------------------|--------------------------------|
154-
| `GET /api/transactions/:hash/logs` | Get transaction logs |
155-
| `GET /api/transactions/:hash/logs/decoded` | Get decoded transaction logs |
156-
| `GET /api/addresses/:address/logs` | Get logs emitted by contract |
157-
| `GET /api/logs?topic0=:sig` | Filter logs by event signature |
158-
159-
### Address Labels
160-
161-
| Endpoint | Description |
162-
|----------------------------|--------------------------------|
163-
| `GET /api/labels` | List address labels |
164-
| `GET /api/labels/:address` | Get label for address |
165-
| `GET /api/labels/tags` | List all tags |
166-
| `POST /api/labels` | Create/update label |
167-
| `DELETE /api/labels/:address` | Delete label |
168-
169-
### Proxy Contracts
170-
171-
| Endpoint | Description |
172-
|-------------------------------------------|--------------------------------|
173-
| `GET /api/proxies` | List proxy contracts |
174-
| `GET /api/contracts/:address/proxy` | Get proxy info |
175-
| `GET /api/contracts/:address/combined-abi`| Get combined ABI |
176-
| `POST /api/contracts/:address/detect-proxy` | Trigger proxy detection |
177-
178-
### Contract Verification
179-
180-
| Endpoint | Description |
181-
|-----------------------------------|--------------------------------|
182-
| `POST /api/contracts/verify` | Submit source for verification |
183-
| `GET /api/contracts/:address/abi` | Get verified ABI |
184-
| `GET /api/contracts/:address/source` | Get verified source code |
185-
186-
### Etherscan-Compatible API
187-
188-
| Endpoint | Description |
189-
|-------------------------------------------------------|--------------------------------|
190-
| `GET /api?module=account&action=balance` | Get address balance |
191-
| `GET /api?module=account&action=txlist` | Get address transactions |
192-
| `GET /api?module=account&action=tokentx` | Get token transfers |
193-
| `GET /api?module=contract&action=getabi` | Get contract ABI |
194-
| `GET /api?module=contract&action=getsourcecode` | Get contract source |
195-
| `POST /api?module=contract&action=verifysourcecode` | Verify contract source |
196-
197-
### Search
198-
199-
| Endpoint | Description |
200-
|----------------------------|-------------------------------------------------|
201-
| `GET /api/search?q=:query` | Universal search (blocks, txs, addresses, NFTs) |
202-
203-
### Pagination
204-
205-
All list endpoints support pagination:
206-
207-
- `page` - Page number (default: 1)
208-
- `limit` - Items per page (default: 20, max: 100)
209-
210-
Response format:
211-
212-
```json
213-
{
214-
"data": [...],
215-
"page": 1,
216-
"limit": 20,
217-
"total": 1000,
218-
"total_pages": 50
219-
}
220-
```
221-
222-
## Database Schema
223-
224-
### Tables
225-
226-
- `blocks` - Block headers
227-
- `transactions` - Transaction data
228-
- `addresses` - Known addresses
229-
- `nft_contracts` - ERC-721 contract registry
230-
- `nft_tokens` - NFT token ownership and metadata
231-
- `nft_transfers` - NFT transfer history
232-
- `erc20_contracts` - ERC-20 token registry
233-
- `erc20_transfers` - ERC-20 transfer events
234-
- `erc20_balances` - Token balances per address
235-
- `event_logs` - All emitted events
236-
- `event_signatures` - Known event signatures for decoding
237-
- `address_labels` - Curated address labels
238-
- `contract_abis` - Verified contract ABIs and source
239-
- `indexer_state` - Indexer progress tracking
240-
241-
## Development
242-
243-
### Running Tests
244-
245-
```bash
246-
cd backend
247-
cargo test
248-
```
249-
250-
### Building for Production
251-
252-
```bash
253-
cd backend
254-
cargo build --release
255-
```
256-
257-
Binaries will be at:
258-
259-
- `backend/target/release/atlas-indexer`
260-
- `backend/target/release/atlas-api`
261-
262-
### Frontend Build
263-
264-
```bash
265-
cd frontend
266-
bun run build
267-
```
268-
269-
Build output will be in `frontend/dist/`.
270-
271-
## Reindexing
272-
273-
To reindex the chain from scratch:
274-
275-
```bash
276-
# Option 1: Environment variable
277-
REINDEX=true docker-compose up atlas-indexer
278-
279-
# Option 2: Truncate tables manually
280-
psql $DATABASE_URL -c "TRUNCATE blocks, transactions, addresses, nft_contracts, nft_tokens, nft_transfers, indexer_state CASCADE;"
281-
```
53+
Copy `.env.example` to `.env` and set your RPC endpoint. Available options:
54+
55+
| Variable | Description | Default |
56+
|----------|-------------|---------|
57+
| `RPC_URL` | Ethereum JSON-RPC endpoint | Required |
58+
| `DATABASE_URL` | PostgreSQL connection string | Set in docker-compose |
59+
| `START_BLOCK` | Block to start indexing from | `0` |
60+
| `BATCH_SIZE` | Blocks per indexing batch | `100` |
61+
| `RPC_REQUESTS_PER_SECOND` | RPC rate limit | `100` |
62+
| `FETCH_WORKERS` | Parallel block fetch workers | `10` |
63+
| `RPC_BATCH_SIZE` | Blocks per RPC batch request | `20` |
64+
| `IPFS_GATEWAY` | Gateway for NFT metadata | `https://ipfs.io/ipfs/` |
65+
| `REINDEX` | Wipe and reindex from start | `false` |
66+
67+
## Documentation
68+
69+
- [API Reference](docs/API.md)
70+
- [Architecture](docs/ARCHITECTURE.md)
71+
- [Product Requirements](docs/PRD.md)
28272

28373
## License
28474

0 commit comments

Comments
 (0)