You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why is this bad: In a real zkApp, the private key won't be available. That means, the only option is to leave the fee payer undefined. However, it is a very common feature request to be able to access the public key of the fee payer of the current transaction within a zkApp method, analogous to msg.sender in Solidity which people are used to. However, if the fee payer isn't passed in anywhere, we can't provide this feature.
Solution: We change the fee payer argument to be a public key, instead of a private key. We also make sure zkApp devs can access this public key from a wallet. We also establish the standard practice of passing in this public key, and provide a convenient API to access it similar to msg.sender.
I think it's ok to keep the option of leaving it undefined: we could make msg.sender throw an error in that case. Which means that, if you want your zkApp to use msg.sender, make sure that the fee payer public key is passed in.
If the transaction like also needs to be signed by the fee payer (for testing / non-browser usage), then the private key will have to be passed in to tx.sign(), like other signed account updates:
I think we should change the way we pass fee payers to transactions.
Now: the fee payer in a transaction is either left undefined or passed in as a private key, or a more complicated object containing a private key:
Why is this bad: In a real zkApp, the private key won't be available. That means, the only option is to leave the fee payer undefined. However, it is a very common feature request to be able to access the public key of the fee payer of the current transaction within a zkApp method, analogous to
msg.sender
in Solidity which people are used to. However, if the fee payer isn't passed in anywhere, we can't provide this feature.Solution: We change the fee payer argument to be a public key, instead of a private key. We also make sure zkApp devs can access this public key from a wallet. We also establish the standard practice of passing in this public key, and provide a convenient API to access it similar to
msg.sender
.I think it's ok to keep the option of leaving it undefined: we could make
msg.sender
throw an error in that case. Which means that, if you want your zkApp to usemsg.sender
, make sure that the fee payer public key is passed in.Proposed API:
If the transaction like also needs to be signed by the fee payer (for testing / non-browser usage), then the private key will have to be passed in to
tx.sign()
, like other signed account updates:The text was updated successfully, but these errors were encountered: