Skip to content
CCPEDIAby Unity Nodes
App Development

Run script across multiple participant nodes when script is divided into two parts

5 posts257 viewsLast activity Nov 2022

  1. kctamOP

    Hi team,

    I am planning a script which will be used to initialize the ledger in a canton setup (with multiple participant nodes).

    Based on my previous experience I use allocatePartyWithHintOn plus the participant name, and a participant configuration file. This works well.

    However, for some reason I need to split this script into two parts, and using --output-file and --input-file to “bridge” the parties. How can I obtain the participant node information or specify the participant node information for these parties in this case, as I don’t need to redo the allocatePartyWithHintOn any more?

    Thanks in advance.

    kc

  2. cocreature

    The second script needs to know how the parties are mapped to participants. You can specify that in the party_participants section of your participants.json file. E.g., in this example alice is on participant 1 and bob is on participant 2.

    {
        "participants": {
            "one": {"host": "localhost", "port": 6866, "access_token": "jwt_for_alice", "application_id": "myapp"},
            "two": {"host": "localhost", "port": 6865, "access_token": "jwt_for_bob", "application_id": "myapp"}
        },
        "party_participants": {"alice": "one", "bob": "two"}
    }
    

    Take a look at the docs for more details.

  3. kctam

    Thanks @cocreature for your suggestion. Does it mean that I need to create this file manually after running the first script (then I can create the jwt with the right PartyID)? Is it possible to generate this automatically after running the first script? I am comparing the situation that if the scripts were not broken down, everything could be handled well in the daml script.

    Thanks again.

    kc

  4. cocreature

    There is nothing built in to generate this at this point. You could try writing the config of the second script via --output-file but you have to manually define the output here.

  5. kctam

    Thanks @cocreature . That’s pretty much what my understanding is.