Skip to content
CCPEDIAby Unity Nodes
App Development

Canton: how to set participant's ledger id

3 posts682 views1 likesLast activity Feb 2022

  1. Daniel_PorterOP

    I’m working on an application that creates a large number of ledgers with arbitrary ledgerids, and want to use canton.

    Looking in the docs, I inferred that I could

    1. explicitly set it via the ApiServiceWrapper, or
    2. implicitly set it via the static config, a la
    canton {
      participants {
        participant1 {
        }
      }
    }
    

    which, as far as I can tell, sets the ledger id to participant1. Would love to be able to set the ledgerid without having to roll my own image/construct conf files on the fly. Is this possible?

  2. Rafael_Guglielmetti

    Hi @Daniel_Porter ,
    The ledgerId is read from config and used as part of the initialization of the participant node when it starts (the two ways you mention are in fact the same one: the config populates the value in CantonLedgerApiServerWrapper.Config.ledgerId). Currently, there is no way to change the value once the participant is running.

    Maybe what you could do is to pass the config value via the command line?

    Cheers,

    Raf

  3. Ratko_Veprek 1

    The ledgerId in Canton is currently hard-coded to the participant.uid.id. You can configure your own .id by manually initializing your node: Canton Console — Canton 1.0.0-SNAPSHOT [0J documentation

    For this, you have to turn of auto-initialization by setting canton.participants.<p>.init.auto-init = false

    But then you need to manually allocate keys, issue the certificates etc. I actually wrote it up here: Canton offline key for static participant ID - #2 by Ratko_Veprek