Common Spacemesh grpcurl Commands
When running Spacemesh with CLI-only grpcurl can be your best friend. This article will quickly go over each of the commands. This is mainly for Ubuntu. If you need to install Go and grpcurl check out this article
Let’s jump in
Node Status
grpcurl --plaintext -d "{}" localhost:9092 spacemesh.v1.NodeService.Status
Example Output
{
"status": {
"connectedPeers": "25",
"isSynced": true,
"syncedLayer": {
"number": 28152
},
"topLayer": {
"number": 28152
},
"verifiedLayer": {
"number": 28152
}
}
}
Version
grpcurl --plaintext -d "{}" localhost:9092 spacemesh.v1.NodeService.Version
Example Output
{
"versionString": {
"value": "v1.2.2"
}
}
IsSmeshing
grpcurl --plaintext -d "{}" localhost:9093 spacemesh.v1.SmesherService.IsSmeshing
Example Output
{
"isSmeshing": true
}
PostSetupStatus
grpcurl --plaintext -d "{}" localhost:9093 spacemesh.v1.SmesherService.PostSetupStatus
Example Output
{
"status": {
"state": "STATE_COMPLETE",
"numLabelsWritten": "240518168576",
"opts": {
"dataDir": "/postdata",
"numUnits": 56,
"maxFileSize": "2147483648",
"providerId": 4294967295
}
}
}
EventStream
grpcurl -plaintext -d '' localhost:9093 spacemesh.v1.AdminService.EventsStream
Example Output (small sample as this can grow large)
{
"timestamp": "2023-10-20T00:24:56.731222588Z",
"help": "Node computed randomness beacon, which will be used to determine consensus eligibility.",
"beacon": {
"epoch": 5,
"beacon": "R6gKNg=="
}
}
Highest ATX
grpcurl --plaintext -d "{}" localhost:9092 spacemesh.v1.ActivationService.Highest
Example Output
{
"atx": {
"id": {
"id": "izORq4x+O0PV6UHsgcanjpEFThGtpIvexfLOB2+cpNo="
},
"layer": {
"number": 6
},
"smesherId": {
"id": "//9u9+LVqJZ2cueuxWcZwuGFjof9f6+Xy6HmFXW8Qas="
},
"coinbase": {
"address": "sm1qqqqqqze3lvcycjnwtpr0xlqelp6emrlhver7ag7runef"
},
"prevAtx": {
"id": "qfZdymb4UKgWmE9ZPuwvtnqAeuB4fKnmR88YjAPBu4U="
},
"numUnits": 4,
"sequence": "1"
}
}
Network Info
grpcurl -plaintext 127.0.0.1:9092 spacemesh.v1.DebugService.NetworkInfo
Example Output
{
"id": "12D3KooWLsh3D7xWqffUWSZLTcLqzU66VKZ2Gu6Ppbf7UxjJWQcC"
}
List
grpcurl --plaintext localhost:9093 list
grpcurl --plaintext localhost:9092 list
Example Output - This just lists the different services available
grpc.reflection.v1.ServerReflection
grpc.reflection.v1alpha.ServerReflection
spacemesh.v1.ActivationService
spacemesh.v1.DebugService
spacemesh.v1.GlobalStateService
spacemesh.v1.MeshService
spacemesh.v1.NodeService
spacemesh.v1.TransactionService
You can then take the service and run list again to see more detailed information. For example:
grpcurl --plaintext localhost:9092 list "spacemesh.v1.NodeService"
Example Output - These are the different functions you can call on that service.
spacemesh.v1.NodeService.Build
spacemesh.v1.NodeService.Echo
spacemesh.v1.NodeService.ErrorStream
spacemesh.v1.NodeService.NodeInfo
spacemesh.v1.NodeService.Status
spacemesh.v1.NodeService.StatusStream
spacemesh.v1.NodeService.Version
Conclusion
There are some more grpcurl functions - including onces where you can send data, however in today’s article we are just covering the basic ones.