This project implements the [Coinbase Mesh API specification](https://docs.cdp.coinbase.com/mesh/docs/getting-started) for the Hive blockchain, enabling standardized integration with exchanges and other blockchain infrastructure.
## Architecture
The project consists of several components:
1. **API Server**: Express.js application implementing the Mesh API endpoints
2. **Hived Node**: Core blockchain node feeding ops into a HAF database and supplying endpoints (eg: peer api)
3. **PostgreSQL**
4. **HAfAH**: Account history api, used mostly to get block operations
5. **Drone**: Middleware service to route calls to the various components
### Docker Setup
1. Start the Hive node, PostgreSQL, Drone, and HAfAH services:
```bash
cd docker
docker-compose up -d
```
This will:
- Start an Ubuntu container
- Download postgresql 17
- Build HiveD and HAF
- Run HAfAH and run it
- Run Drone
- Run the mesh api and expose it outside of the docker on port 4001
## API Endpoints
The Mesh API is divided into several groups of endpoints:
### Network Endpoints
- `POST /network/list`: List available networks (blockchain/network combinations)
- `POST /network/status`: Get the current status of the specified network
- `POST /network/options`: Get network-specific options
### Account Endpoints
- `POST /account/balance`: Get the balance of an account
- `POST /account/coins`: (Not supported for account-based blockchains like Hive)
### Block Endpoints
- `POST /block`: Get a block by index or hash
- `POST /block/transaction`: Get a transaction in a block by its hash
### Mempool Endpoints
- `POST /mempool`: (Not supported for Hive)
- `POST /mempool/transaction`: (Not supported for Hive)
### Construction Endpoints
- `POST /construction/derive`: (Not supported for Hive - accounts need on-chain action to be created)
- `POST /construction/preprocess`: Prepare information for transaction construction
- `POST /construction/metadata`: Get metadata needed for transaction construction
- `POST /construction/payloads`: Generate an unsigned transaction and signing payloads
- `POST /construction/parse`: Parse an unsigned or signed transaction
- `POST /construction/combine`: Combine signatures and an unsigned transaction
- `POST /construction/hash`: Get the hash of a signed transaction
- `POST /construction/submit`: Submit a signed transaction
## Supported Operations
The API supports the following Hive operations for tracking balance changes: