o1-labs / o1js

TypeScript framework for zk-SNARKs and zkApps

Home Page:https://docs.minaprotocol.com/en/zkapps/how-to-write-a-zkapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fetch `networkId` automatically from GraphQL endpoint

L-as opened this issue · comments

That way when using custom networks you don't have to set the salt for both account update hashing and signatures manually.

Right now, you will have to specify a custom network like this

Mina.Network({
    // ...
    networkId: 'mainnet',
});

// mina-signer
let client = new Client({ network: 'mainnet' });

Which the developer will have to do once they publish their zkApp on a website or somewhere else. Do you think fetching would still be better? I like the explicit declaration of the network, especially since it's a tiny change - it clearly marks what network you want to interact with (default being the testnet)

Even if it's made explicit, at the very least it should automatically be checked against what the endpoint returns. FWIW signatureKind might be the correct thing to fetch, since multiple networks might use same signatures, OTOH, that should optimally never be the case.