linera-explorer-new/README.md
A simple, modern blockchain explorer for the Linera protocol built with TypeScript and React.
Clone or navigate to the project directory:
cd linera-explorer-new
Install dependencies:
npm install
Set up environment variables:
cp .env.example .env
Edit .env to configure your database:
For PostgreSQL (recommended):
DATABASE_URL=postgresql://username:password@localhost:5432/database_name
For SQLite:
DB_PATH=../docker/indexer-data/indexer.db
The explorer uses a client-server architecture:
The backend supports two database types:
PostgreSQL (recommended for production):
DATABASE_URL environment variableDATABASE_URL=postgresql://postgres:postgres@localhost:5432/linera_indexerSQLite (for development/testing):
DB_PATH environment variableDB_PATH=../docker/indexer-data/indexer.dbThe backend connects to a SQLite database created by the Linera indexer. By default, it looks for the database at ../docker/indexer-data/indexer.db.
You can configure the database path by setting the DB_PATH environment variable:
export DB_PATH="/path/to/your/indexer.db"
Start the Rust API server and the frontend in separate terminals:
# Terminal 1 - Start the Rust API server (requires DATABASE_URL)
(cd server-rust && cargo run --release)
# Terminal 2 - Start the frontend
npm run dev
The explorer will be available at:
http://localhost:3001http://localhost:3002Build the application:
npm run build
The built files will be in the dist directory.
The explorer expects the following SQLite tables:
hash (TEXT, PRIMARY KEY)chain_id (TEXT)height (INTEGER)data (BLOB)created_at (DATETIME)id (INTEGER, PRIMARY KEY)block_hash (TEXT)bundle_index (INTEGER)origin_chain_id (TEXT)action (TEXT)source_height (INTEGER)source_timestamp (INTEGER)source_cert_hash (TEXT)transaction_index (INTEGER)created_at (DATETIME)id (INTEGER, PRIMARY KEY)bundle_id (INTEGER)message_index (INTEGER)authenticated_signer (BLOB)grant_amount (INTEGER)refund_grant_to (BLOB)message_kind (TEXT)message_data (BLOB)created_at (DATETIME)hash (TEXT, PRIMARY KEY)type (TEXT)data (BLOB)created_at (DATETIME)The backend provides the following REST API endpoints:
GET /api/health - Health checkGET /api/blocks - Get latest blocks (with pagination)GET /api/blocks/:hash - Get specific block by hashGET /api/blocks/:hash/bundles - Get incoming bundles for a blockGET /api/bundles/:id/messages - Get posted messages for a bundleGET /api/chains - Get all chains with statisticsGET /api/chains/:chainId/blocks - Get blocks for a specific chainGET /api/search?q=<query> - Search blocks by hash prefixGET /api/stats - Get database statisticsFor production deployment, consider:
This project follows the same license as the Linera protocol (Apache-2.0).
For issues related to the Linera protocol itself, please refer to the main Linera repository. For explorer-specific issues, please create an issue in this repository.