This guide explains how to change and monitor Teranode's state. Note that Teranode instances start in IDLE state and require manual state transitions.
- Access to a running Teranode instance
- One of the following access methods:
- Admin Dashboard (easiest - web-based interface)
teranode-cli(recommended for scripting - available in all Teranode containers)grpcurl(advanced - requires network access to the RPC Server on port 18087)
The Admin Dashboard provides the easiest way to view and manage Teranode FSM states through a web interface.
Docker Compose:
# Access the dashboard in your browser
# http://localhost:8090/adminKubernetes:
# Port-forward the asset service
kubectl port-forward -n teranode-operator service/asset 8090:8090
# Then access http://localhost:8090/admin in your browser- Navigate to the FSM State section in the dashboard
- View the current state
- Use the state transition controls to change states
- Monitor state transition logs in real-time
Note: The dashboard must be enabled via the
dashboard_enabledsetting and may require authentication depending on your configuration (dashboard.auth.enabled).
The teranode-cli is recommended for scripting and automation. It provides a command-line interface that works directly with the blockchain service.
docker exec -it blockchain teranode-cli getfsmstatedocker exec -it blockchain teranode-cli setfsmstate --fsmstate RUNNINGAccess any Teranode pod and use teranode-cli directly:
# Get the name of a pod (blockchain or asset are good options)
kubectl get pods -n teranode-operator -l app=blockchain
# Access the pod and run the command
kubectl exec -it <pod-name> -n teranode-operator -- teranode-cli getfsmstate
# Alternative one-liner
kubectl exec -it $(kubectl get pods -n teranode-operator -l app=blockchain -o jsonpath='{.items[0].metadata.name}') -n teranode-operator -- teranode-cli getfsmstate# Change state to RUNNING
kubectl exec -it $(kubectl get pods -n teranode-operator -l app=blockchain -o jsonpath='{.items[0].metadata.name}') -n teranode-operator -- teranode-cli setfsmstate --fsmstate RUNNINGThe following states are valid for all environments:
- IDLE
- RUNNING
- LEGACYSYNCING
- CATCHINGBLOCKS
After each state change, verify the new state:
- Admin Dashboard: View the current state in the FSM State section
- teranode-cli: Use
getfsmstatecommand (see above) - Logs: Check the logs for transition messages
- Services: Verify that expected services are running/stopped according to the state
For advanced users or automated scripts, you can use grpcurl directly. This method requires network access to the blockchain gRPC service on port 18087.
Access the blockchain gRPC service directly:
Check Current State:
# Connect to blockchain service on port 18087
grpcurl -plaintext blockchain:18087 blockchain_api.BlockchainAPI.GetFSMCurrentStateTrigger State Transitions:
# Transition to RUNNING state
grpcurl -plaintext blockchain:18087 blockchain_api.BlockchainAPI.Run
# Transition to LEGACYSYNCING state
grpcurl -plaintext blockchain:18087 blockchain_api.BlockchainAPI.LegacySync
# Transition to CATCHINGBLOCKS state
grpcurl -plaintext blockchain:18087 blockchain_api.BlockchainAPI.CatchUpBlocks
# Transition to IDLE state
grpcurl -plaintext blockchain:18087 blockchain_api.BlockchainAPI.IdlePort-forward the blockchain service:
# Port forward the blockchain gRPC service
kubectl port-forward -n teranode-operator service/blockchain 18087:18087Check Current State:
grpcurl -plaintext localhost:18087 blockchain_api.BlockchainAPI.GetFSMCurrentStateExpected output:
{
"state": "Idle"
}Trigger State Transitions:
# Transition to RUNNING state
grpcurl -plaintext localhost:18087 blockchain_api.BlockchainAPI.Run
# Transition to LEGACYSYNCING state
grpcurl -plaintext localhost:18087 blockchain_api.BlockchainAPI.LegacySync
# Transition to CATCHINGBLOCKS state
grpcurl -plaintext localhost:18087 blockchain_api.BlockchainAPI.CatchUpBlocks
# Transition to IDLE state
grpcurl -plaintext localhost:18087 blockchain_api.BlockchainAPI.IdleYou can wait for a specific state transition to complete:
grpcurl -plaintext -d '{"state":"Running"}' localhost:18087 blockchain_api.BlockchainAPI.WaitFSMToTransitionToGivenState