Count new Mina accounts when funding a zkApp transaction

The o1js account-creation helper funds a count of new accounts. It does not name which recipients the protocol will create during the transaction.

Inspect the account updates

Suppose a transaction credits three recipients and two of the targeted ledger accounts do not yet exist. Build the account updates, identify the network and token IDs involved, and fund two creations from the authorized fee payer. Counting public keys alone can miss a distinct token account associated with the same key.

new recipient accounts in this transaction = 2
AccountUpdate.fundNewAccount(feePayer, 2);

Recheck a delayed transaction

The protocol determines which accounts are new from ledger state when applying the updates. Another transaction can create a recipient account while a proof is being built. If the set changes, rebuild and examine the balance effects before requesting a replacement signature. Keep the account-creation amount distinct from the ordinary transaction fee.

Sources