Getting Started with Teranode
Index
Introduction
This tutorial will guide you through your first steps with Teranode using Docker Compose. By the end of this guide, you'll have a running testnet Teranode instance suitable for testing and development.
Prerequisites
Before you begin, ensure you have:
- Basic understanding of blockchain technology
- Familiarity with command-line operations
- The AWS CLI
- Docker Engine 17.03+
- Docker Compose
- The Teranode Docker Compose file
- 100GB+ available disk space
- Stable internet connection
What is Teranode?
Teranode is a scalable Bitcoin SV node implementation that:
- Processes over 1 million transactions per second
- Uses a microservices architecture
- Maintains full Bitcoin protocol compatibility
Components Overview
Your Teranode Docker Compose setup will include:
-
Core Teranode Services
- Asset Server
- Block Assembly
- Block Validation
- Blockchain
- Legacy Gateway
- P2P
- Propagation
- Subtree Validation
-
Optional Services
- Block Persister
- UTXO Persister
-
Supporting Services
- Kafka for message queuing
- PostgreSQL for blockchain data
- Aerospike for UTXO storage
- Grafana and Prometheus for monitoring
First-Time Setup
Step 1: Prepare Your Environment
- Checkout the Teranode public repository:
cd $YOUR_WORKING_DIR
git clone git@github.com:bsv-blockchain/teranode.git
cd teranode
Step 2: Initial Setup
- Go to the testnet docker compose path:
cd $YOUR_WORKING_DIR/teranode/deploy/docker/testnet
- Pull required images:
docker-compose pull
Step 3: Start Teranode
- Launch all services:
docker-compose up -d
Force the node to transition to Run mode:
grpcurl -plaintext localhost:8087 blockchain_api.BlockchainAPI.Run
or LegacySync mode:
grpcurl -plaintext localhost:8087 blockchain_api.BlockchainAPI.LegacySync
- Verify services are running:
docker-compose ps
- Check individual service logs:
# Example commands
docker-compose logs asset
docker-compose logs blockchain
- Verify legacy sync status:
When the node is started for the first time, its first action is to perform a initial blockchain sync. You can check the sync progress by checking the Legacy service logs:
docker-compose logs legacy
Step 4: Verify Installation
- Check service health:
curl http://localhost:8090/health
-
Access monitoring dashboard:
- Open Grafana: http://localhost:3005
- Login with the default credentials: admin/admin
- Navigate to the "Teranode - Service Overview" dashboard for key metrics
- Explore other dashboards for detailed service metrics. For example, you can check the Legacy sync metrics in the "Teranode - Legacy Service" dashboard.
Common Issues
-
Services fail to start
- Check logs:
docker-compose logs
- Verify disk space:
df -h
- Ensure all ports are available
- Check logs:
-
Cannot connect to services
- Verify services are running:
docker-compose ps
- Check service logs for specific errors
- Ensure ports are not blocked by firewall
- Verify services are running:
Basic Operations
Checking Node Status
- View all services status:
docker-compose ps
- Check blockchain sync:
curl http://localhost:8090/api/v1/blockstats
- Monitor specific service logs:
docker-compose logs -f legacy
docker-compose logs -f blockchain
docker-compose logs -f asset
Working with Transactions
- Get transaction details:
curl http://localhost:8090/api/v1/tx/<txid>
Monitoring Your Node
-
Access Grafana dashboards:
- Open http://localhost:3005
- Navigate to "TERANODE Service Overview"
-
Key metrics to watch:
- Block queue length (should be near 0)
- Transaction processing rate
- Memory and CPU usage
- Disk space utilization
Basic Maintenance
- View logs:
# All services
docker-compose logs
# Specific service
docker-compose logs blockchain
- Check disk usage:
df -h
- Restart a specific service:
docker-compose restart blockchain
- Restart all services:
docker-compose down
docker-compose up -d
Common Operations
- Check current block height:
curl http://localhost:8090/api/v1/bestblockheader/json
- Get block information:
curl http://localhost:8090/api/v1/block/<blockhash>
- Check UTXO status:
curl http://localhost:8090/api/v1/utxo/<utxohash>
Next Steps
- Explore the How-to Guides for advanced tasks
- Review the Reference documentation for detailed endpoint information
Docker Compose Setup
- Installation Guide
- Starting and Stopping Teranode
- Configuration Guide
- Blockchain Synchronization
- Update Procedures
- Troubleshooting Guide
- Security Best Practices