Skip to main content

Scripting examples

# Count DIDs on the pilot network
ebsi --env pilot --output json did-registry identifiers list | jq '.total'

# List all trusted issuer DIDs
ebsi --output json issuers-registry issuers list | jq -r '.items[].did'

# Check health: the command exits with a non-zero code on failure (useful in CI)
ebsi health

# Persist pilot as default, then query without options
ebsi config set env pilot
ebsi did-registry identifiers list

# Write to the DID Registry: create a key, get a token (saved in the config file
# and used automatically by ledger write), add a controller
ebsi wallet create --save
ebsi auth token --scope did-registry:write --save
ebsi ledger write did-registry addController \
'["did:ebsi:z123", "did:ebsi:zNewController"]' \
--to 0xContractAddress

A saved token expires, so a script that runs it later (or a long CI job) can fail with an authentication error. In scripts and CI, prefer --auto-token, which mints a fresh token for each write. It reads the key from EBSI_ES256K_PRIVATE_KEY instead of the plaintext config file written by wallet create --save:

export EBSI_ES256K_PRIVATE_KEY=0x...
ebsi ledger write did-registry addController \
'["did:ebsi:z123", "did:ebsi:zNewController"]' \
--to 0xContractAddress \
--auto-token