Repository navigation
Description
Internal/External
Internal
Area
Other: Certificates (stake pool registration, delegation, governance)
Describe the feature you'd like
A command, similar to cardano-cli debug transaction view, that takes a certificate file, decodes its CBOR, and prints the contents in a human-readable format (JSON or YAML). Users could then inspect a certificate before including it in a transaction.
Today a certificate file is a text envelope with a hex-encoded CBOR payload:
{
"type": "Certificate",
"description": "Stake Pool Registration Certificate",
"cborHex": "8a03581c..."
}The CLI has no way to see what this certificate says without building a transaction around it and running debug transaction view on the result.
Motivating use case: stake pool registration
The pool operator and the pool owners are often different people. The operator creates the certificate with stake-pool registration-certificate, using the pool parameters (pledge, cost, margin, reward account, owners, relays, metadata). Later, the owners witness the transaction that registers the pool. Before that, they should be able to check the certificate's contents directly, without waiting for a transaction to be built. An owner should be able to run:
cardano-cli debug certificate view --certificate-file pool-registration.cert
and see, for example:
{
"Pool registration": {
"pool id": "pool1...",
"vrf key hash": "...",
"pledge": 100000000000,
"cost": 170000000,
"margin": "1/100",
"reward account": "stake1...",
"owners": [
"<stake key hash>"
],
"relays": [
{ "single host name": { "dnsName": "relay1.example.com", "port": 3001 } }
],
"metadata": {
"url": "https://example.com/pool.json",
"hash": "..."
}
}
}With this output the owner can check that:
- the pledge is what they agreed to, and their stake covers it,
- the reward account, margin and cost are as agreed,
- the metadata URL and hash point to the expected file.
Proposed interface
Mirror the options of debug transaction view:
Usage: cardano-cli debug certificate view [--output-json | --output-yaml]
[--out-file FILEPATH]
--certificate-file FILEPATH
Print a certificate.
Available options:
--output-json Format certificate view output to JSON (default).
--output-yaml Format certificate view output to YAML.
--out-file FILEPATH Optional output file. Default is to write to stdout.
--certificate-file FILEPATH
Input filepath of the certificate.
- JSON is the default output format and YAML is optional, as in
debug transaction view. --certificate-fileshould accept-/ pipes (viafileOrPipe) like the tx view input does.- The command should support every certificate type the CLI can create: stake address registration/deregistration/delegation, pool registration/retirement, DRep registration/update/retirement, committee hot key authorization/cold key resignation, and the combined registration+delegation certificates.
Acceptance criteria
-
cardano-cli debug certificate viewor similar exists with--output-json(default),--output-yaml,--out-file,--certificate-file. - All certificate types produced by the CLI in the supported eras decode and render without falling through to
"unsupported certificate". - Pool registration output shows pool id, VRF key hash, pledge, cost, margin, reward account, owners, relays and metadata (URL + hash) in a readable form.
-
debug transaction viewand the new command render a given certificate identically. - Golden tests cover each certificate type in JSON and YAML; help goldens updated.
- Changelog fragment added.
Describe alternatives you've considered
- Build a transaction and run
debug transaction view. This works, but it means building a throwaway transaction (inputs, fee, etc.) only to inspect a certificate. The certificate also ends up next to unrelated transaction fields, and the pool params rendering is still the raw ledger form. - Decode the CBOR manually (e.g. with
cbor.meorcbor-diag). This needs knowledge of the ledger CDDL, gives no field names, and is error-prone. It isn't a reasonable expectation for pool owners. - Put the command under
stake-pool(e.g.stake-pool registration-certificate view). This is too narrow; the same need applies to delegation and governance certificate.
Activity