alan-turing-institute / trustchain

Trustworthy decentralised PKI
https://alan-turing-institute.github.io/trustchain/
Apache License 2.0
11 stars 5 forks source link

CLI command to check node status #206

Open thobson88 opened 4 days ago

thobson88 commented 4 days ago

A new command:

trustchain-cli --status

that reports something like:

IPFS...... ✅
MongoDB... ✅
Bitcoin... ❌ [Synching blocks: 3191562/3193183]

or

IPFS......... ✅
MongoDB...... ✅
Bitcoin...... ✅
ION.......... ✅
HTTP Server.. ✅
thobson88 commented 4 days ago

Check whether the IPFS daemon is running with the query_ipfs function in trustchain-ion::utils (and a known CID). The result will be an error:

Client(hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })))
thobson88 commented 3 days ago

To check for MongoDB, use the query_mongodb function in trustchain-ion::utils (with a known DID). It returns TrustchainMongodbError::QueryReturnedError if the daemon is not running.

thobson88 commented 3 days ago

Get Bitcoin node status by calling get_blockchain_info on the rpc_client in trustchain-ion::utils. This returns a struct containing fields for the number of blocks and headers.

thobson88 commented 3 days ago

Get ION status by resolving a known DID.