#2614·node

Bootstrapping the operator accounts at & after genesis

Author: mmagicianCreated Sep 11, 2026Updated Sep 28, 2026

USDCx Faucet Launch Plan

1. Generate the AccountId of the USDCx faucet

Needed for both testnet and mainnet.

1.1 Gather the AccountIds for all the roles

Roles, with the list of notes that each role should be capable of sending to the faucet:

  • ADMIN (4/5 multisig)
    • RBAC_CONFIG (grant / revoke / set-admin / renounce any of the five roles, incl. ADMIN itself)
    • FAUCET_METADATA_CONFIG (set_max_supply only; the other metadata fields are immutable)
    • MIN_BURN_AMOUNT_CONFIG (change the min. burn floor)
    • CONSTANT_FEE_POLICY_CONFIG (reprice accepted notes)
  • ATTEST_ADMIN (4/5 multisig)
    • SET_ATTESTER (enable / disable a Circle attester key commitment)
  • DOM_PAUSER (single-sig, 5x)
    • PAUSE_CONFIG, pause selector (halts mint and burn)
  • DOM_UNPAUSER (4/5 multisig)
    • PAUSE_CONFIG, unpause selector
  • BLK_MANAGER (single-sig)
    • BLOCKLIST_CONFIG (block / unblock an account)
  • RELAYER (single-sig, not part of the RBAC, we generate and hand to Gateway)
    • MINT (one per Circle deposit, carrying the attestation)

We need only the account ID of each holder to generate the AccountId for the faucet. Role holders accounts are not part of the genesis state (see step 7).

Depending on the auth scheme, we need to follow different procedures to gather the (final) account ID.

1.1.a Account generation via miden-client

We encourage the participant to use the miden-client CLI (version matching the network's protocol version).

  1. Install the CLI: cargo install miden-client-cli --version <CLI_VERSION> --locked.
  2. Create a directory dedicated to this account<>network pair: mkdir ~/.miden-<network>; cd ~/.miden-<network>, and initialise a local client home for the network the account is for:
  • miden-client init --local --network testnet
  • miden-client init --local --network <MAINNET_RPC_URL> for mainnet. Run every command below from that directory. The endpoint <MAINNET_RPC_URL> does not need to be reachable yet.
  1. Create the wallet: miden-client new-wallet --account-type public. This generates a Falcon512 key in the keystore and prints the account ID as a 0x hex value.
  2. Back up the directory. Its .miden-<network>/keystore holds the only copy of the signing key.

1.1.b Getting the AccountId and public key

For single signers, we need the AccountId. It would be printed at the end of the previous set of steps (as 0x hex). You can view it again: miden-client account -l.

For signers in the multisig (some signers will be single signers + multisig participants): A multisig account is assembled from the approvers' public-key commitments. To get the pubkey: miden-client keys --list

Send the coordinator the commitment and the scheme name (Falcon512Poseidon2).

1.1.c Account generation via Ledger

TBD

1.1.c Account generation via Bread Wallet

TBD


The coordinator assembling the multisig account, using the multisig interface (cc @Dominik1999).

1.2 Gather other data needed for seeding the account

This is only the attestation pubkey from Circle.

1.3 Derive the AccountId for the faucet itself

Done by the xusdc-genesis tool in miden-usdcx#222. It takes the five role IDs and the faucet parameters and writes usdcx-faucet.mac (nonce one, no seed), printing the ID in hex and in bech32 for each network. The ID depends only on the seed, code and storage, not on any chain state, so it can be derived and handed to Circle before any network exists.

2. Distributor account (DISTRIBUTOR)

To make the first tx on Miden, we need at least one account to hold the native token. This could be a burner distributor account, whose only role is to have funds seeded at genesis, and send them out to the RELAYER (who submits mint attestations) and other bridge role accounts (DOM_PAUSER, etc.).

This account needs to be created pre-genesis, because after the DISTRIBUTOR is actually funded via the Ethereum transfer in the next step 3., there is one more change we need to make to the state of the faucet account before we create the genesis config TOML (see step 4).

To create this account, we need to:

  1. Generate a fresh account
  2. Amend its vault, so that it contains init_amount of the USDCx token (using the AccountId from the previous step)
  3. Re-assemble it together to create distributor.mac account file
  4. Use that file later for the funding service in Step 8
  5. Print the AccountId of the distributor, and use it for Step 3.

3. Send funds to the Ethereum/Sepolia USDCx contract

Prerequisite: Circle has registered the Miden domain (10007) on the target network's xReserve contract, and registered the USDCx faucet from step 1.3 as its remote token.

The deposit goes to the DISTRIBUTOR (from step 2) and must equal faucet.token_supply in config.json exactly:

  • mainnet: 100 USDC (100000000 with 6 decimals)
  • testnet: 1,000,000,000 USDC (1000000000000000)

The deposit can be made with cast (3a) or from a browser wallet (3b).

3a. cast CLI

3a.1 Import the Ethereum account into cast

The account must hold enough ETH for gas (two transactions) and the full USDC amount.

bash
# private key from MetaMask: Account details -> Show private key
cast wallet import depositor --interactive
export FROM=$(cast wallet address --account depositor)

For a Ledger-backed account, skip the import and replace --account depositor with --ledger below.

3a.2 Set the network

Configure the RPC (e.g. Infura) and onchain addresses:

bash
# mainnet
export RPC=<mainnet rpc url> \
  XRESERVE=0x8888888199b2Df864bf678259607d6D5EBb4e3Ce \
  USDC=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \
  CIRCLE_API=https://xreserve-api.circle.com

# sepolia
export RPC=<sepolia rpc url> \
  XRESERVE=0x008888878f94C0d87defdf0B07f46B93C1934442 \
  USDC=0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238 \
  CIRCLE_API=https://xreserve-api-testnet.circle.com

export DOMAIN=10007
export AMOUNT=$(jq -r .faucet.token_supply config.json)
export RECIPIENT=<distributor "bytes32:" line printed by `xusdc-genesis new-distributor`>
export FAUCET=<faucet "bytes32:" line printed by `xusdc-genesis faucet`>

3a.3 Pre-flight checks

bash
cast call $XRESERVE "isRemoteDomainRegistered(uint32)(bool)" $DOMAIN --rpc-url $RPC          # should be true
cast call $XRESERVE "getRemoteToken(uint32,address)(bytes32)" $DOMAIN $USDC --rpc-url $RPC   # should == $FAUCET
cast call $XRESERVE "domainDepositsPaused(uint32)(bool)" $DOMAIN --rpc-url $RPC              # should be false
cast call $USDC "balanceOf(address)(uint256)" $FROM --rpc-url $RPC                           # should be >= $AMOUNT
cast balance $FROM --ether --rpc-url $RPC                                                    # enough be for gas

3a.4 Deposit

bash
cast send $USDC "approve(address,uint256)" $XRESERVE $AMOUNT \
  --account depositor --rpc-url $RPC

# dry run: must not revert
cast call $XRESERVE "depositToRemote(uint256,uint32,bytes32,address,uint256,bytes)" \
  $AMOUNT $DOMAIN $RECIPIENT $USDC 0 0x --from $FROM --rpc-url $RPC

cast send $XRESERVE "depositToRemote(uint256,uint32,bytes32,address,uint256,bytes)" \
  $AMOUNT $DOMAIN $RECIPIENT $USDC 0 0x --account depositor --rpc-url $RPC

3b. Alternative: deposit from a browser wallet (MetaMask or similar)

Instead of 3a, the same calls can be made from a browser wallet through a block explorer. Both xReserve implementations are verified on Blockscout. Switch the wallet to the target network, then open the contract pages:

On each page, in the Contract tab use "Read proxy" / "Write proxy" (connect the wallet for writes). All amounts are in base units (6 decimals).

  1. Pre-flight, on xReserve "Read proxy" (same expected outcomes as 3a.3):
    • isRemoteDomainRegistered(10007) -> true
    • getRemoteToken(10007, <USDC address>) -> the faucet's bytes32
    • domainDepositsPaused(10007) -> false
  2. On USDC "Write proxy", call approve:
    • spender: the xReserve address
    • value: the amount (100000000 on mainnet, 1000000000000000 on testnet)
  3. On xReserve "Write proxy", call depositToRemote:
    • value: the same amount
    • remoteDomain: 10007
    • remoteRecipient: the distributor's bytes32
    • localToken: the USDC address
    • maxFee: 0
    • hookData: 0x

Before confirming each transaction, check that the wallet's simulation doesn't show a revert.

4. Genesis state: re-generate faucet account

After the deposit from Step 3. is made on Ethereum, the relayer service, once booted, will query the Circle APIs and see one pending transfer - but since the distributor is funded at genesis, we should not process this first transfer, else we double book the amount.

The relayer needs to therefore skip this (and it would be rejected by the contract anyway) by inspecting the used_nonces storage of the faucet account. But since in Step 1.3 we didn't have the nonce yet, we need to "fix" this on the faucet account.

The overall flow is:

  • we generate the account without nonces as per Step 1.3
  • we send the funds as in Step 3 above
  • re-create the faucet account with the nonce (does not change the AccountId of the faucet). This is supported as of https://github.com/0xMiden/miden-usdcx/pull/232
  • discard the previous usdcx-faucet.mac in favor of the one generated here

4a. Get the deposit nonce

The nonce is assigned by Circle when it attests the deposit, so it only appears in Circle's attestation feed after the deposit is final on Ethereum. Re-run until the list is non-empty (set CIRCLE_API, DOMAIN and RECIPIENT from Step 3):

bash
curl -s "$CIRCLE_API/v1/remote-domains/$DOMAIN/attestations?pageSize=100" \
  | jq --arg r "${RECIPIENT#0x}" \
    '{used_nonces: [.attestations[].payload | ltrimstr("0x")
      | select(.[152:216] == ($r | ascii_downcase)) | "0x" + .[408:472]]}' \
  | tee nonces.json

The filter keeps only deposits to the distributor account. For each entry, bytes 76..108 of the DepositIntent payload are the recipient and bytes 204..236 are the nonce. The resulting nonces.json is the input to xusdc-genesis record-nonces in the next step.

4b. Re-configure the faucet with the nonce

Once we have the initial nonce, regenerate the faucet account (same AccountId as step 1.3; reads the faucet from step 1.3 and nonces.json from 4a):

bash
xusdc-genesis record-nonces --faucet usdcx-faucet.mac --nonces nonces.json

This writes a new usdcx-faucet.genesis.mac. Do not use the pre-deposit-generated account from before.

Now, we can include this account, together with the DISTRIBUTOR account, in the genesis config file:

toml
native_faucet = "usdcx-faucet.genesis.mac"

[[account]]
path = "distributor.mac"

This step happens ahead of launch.

5. Batch builder

Since we don't have a BATCH_FEE note, nor the collection thereof by the block builder, implemented, we don't need to worry about pre-funding the batch builder account at this point.

The batch builder's wallet account doesn't need to be pre-funded: it collects P2ID notes in the native asset, so it can pay the TX_FEE.

6. Launch

7. Post-genesis fund distribution to the operator roles

Aside from the relayer that submits mint requests to the faucet, the other operational bridge roles like ADMIN, ATTEST_ADMIN, etc. need to hold funds as well, so that they can be operational as soon as the network is up and running.

The role accounts will not exist onchain at genesis. Each holder deploys their own account with its first transaction, which consumes the P2ID note sent by the DISTRIBUTOR.

Ideally this would be scripted, so that all the required funds are distributed at once. I created https://github.com/0xMiden/infrastructure/issues/238 to track this.

USDCx

The accounts to be funded are as listed in 1.1 above.

AggLayer

The list of role accounts, and the list of notes that each role should be capable of sending to the faucet:

  • BRIDGE_ADMIN (4/5 multisig)
    • RBAC_CONFIG (grant / revoke / set-admin / renounce the five bridge roles and itself)
    • NETWORK_ACCOUNT_CONFIG (add / remove allowed note scripts, tx scripts and fee policies; select the active fee policy)
    • PAUSE_CONFIG, unpause selector (resume a paused bridge; PAUSER cannot)
  • PAUSER(s) - potentially several accounts (single-sig, 5x)
    • PAUSE_CONFIG, pause selector (halts bridge-out, claim, GER injection and faucet registration)
  • FAUCET_ADMIN, technically per faucet, but each faucet can set the same account as its admin. Same account as BRIDGE_ADMIN by default (4/5 multisig)
    • RBAC_CONFIG, to each faucet (rotate that faucet's ADMIN and FEE_MNGR)
    • NETWORK_ACCOUNT_CONFIG, to each faucet (allowlist and fee-policy changes)
  • FAUCET_MNGR (managed by Gateway)
    • CONFIG_AGG_BRIDGE (register a faucet and its metadata hash; one per bridged token at launch)
    • DEREGISTER_AGG_FAUCET (remove a faucet from the registry)
  • GER_INJECTOR (managed by Gateway)
    • UPDATE_GER (one per L1 global exit root update)
    • CLAIM (one per bridge-in; permissionless)
  • GER_REMOVER (managed by Gateway)
    • REMOVE_GER (revoke a registered GER)
  • FEE_MNGR (managed by Gateway)
    • CONSTANT_FEE_POLICY_CONFIG, to the bridge (reprice accepted notes)
    • CONSTANT_FEE_POLICY_CONFIG, to each faucet (account-local role; each faucet has its own FEE_MNGR members)

cc @mandrigin — could you confirm the list please?

[!NOTE] This initial funding step only covers the first few transactions - though we can make sure to cover a few thousand transactions e.g. with 10 USDC. Going forward, the operators need to ensure their accounts always remain funded (cc @mandrigin for AggLayer; @Keinberger for USDCx).

8. Funding service

For the partner mainnet, we want to have a funding service that sends funds to the allowlisted accounts, as described in 0xMiden/node#2561.

The funding service (node#2561) should be started with the DISTRIBUTOR account file from step 2 as --account-file.

This account can be funded in the same manner as the bridge operator roles in step 7.

Local deployment & devnet

As discussed offline with @Mirko-von-Leipzig, it might be easiest if in v0.17+, local and devnet environments also use the USDCx faucet as the native faucet, to keep things in sync.

Since there is no accounting to be tracked with Circle, we can:

  • In genesis, seed with a large amount of funds.
  • Set ourselves as the minting authority. This requires creating a service that submits signed MINT attestations against the USDCx faucet, thus adding a bit of operational setup. Perhaps this could be the role of the faucet operator service itself — TBD.