Skip to content
This repository was archived by the owner on Sep 24, 2026. It is now read-only.
This repository was archived by the owner on Sep 24, 2026. It is now read-only.

Report networkId from the connected ledger instead of the NETWORK variable #10

Description

@gabitoesmiapodo

User story / Problem statement

Caution

Do not deploy before BootNodeDev/carpincho-wallet#30 is released. Carpincho's vault filters accounts by this exact value, so deploying first hides every account in every installed wallet. This binds automated agents as much as people.

Settle the mapping below before #30 starts, since #30 cannot be written without it. #30 may also close unstarted if BootNodeDev/carpincho-wallet#29 stops the wallet keying accounts on the label.

networkId comes from the NETWORK environment variable, so it is whatever someone typed on the host. Carpincho scopes accounts by it and dApps read it through listAccounts. A stale or wrong value describes the wrong network and nothing notices.

Expected outcome

status and getActiveNetwork report the network the service is connected to, as a CAIP-2 label nobody can set to something the ledger disagrees with.

Acceptance criteria

  • network.networkId is derived from the synchronizer the service is connected to
  • Known synchronizers map through the table below
  • An unknown synchronizer falls back to the derived form, never to a typed value
  • Every value is valid CAIP-2
  • NETWORK is dropped, or kept as an override the service refuses when the ledger disagrees
  • status and getActiveNetwork return the same value
  • .env.example and the README match the new behaviour
  • Migrate stored account.network before wallet-service changes what it reports carpincho-wallet#30 is released, or closed as unnecessary, before this deploys

Technical notes

The namespace is canton. The reference is operator-defined, so this is ours:

Synchronizer networkId
Canton MainNet global synchronizer canton:da-mainnet
Canton TestNet global synchronizer canton:da-testnet
Canton DevNet global synchronizer canton:da-devnet
anything else canton:<alias>-<first 8 characters of the fingerprint>

Read the real synchronizer ids off each ledger to fill the left column. Do not guess them.

  • da- follows the CIP-0103 example, canton:da-mainnet, and marks the networks Digital Asset runs
  • The fallback needs no entry for a LocalNet, and changes on reset, which is right because a reset is a new network
  • CAIP-2 references allow [-_a-zA-Z0-9]{1,32}, so truncate to fit
  • network() returns { networkId: config.network } in src/rpc.ts
  • config.network reads NETWORK in src/config.ts, defaulting to canton:local or canton:external

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions