Open pgebheim opened 2 years ago
For more information on how the "AuthAccount" fee is used vs "Create Account" in the colloquial sense.
When a wallet or dapp creates an account for a user two things occur:
payer
account, which covers the cost of the storage minimums (0.001 flow)The change that is introduced in Segmented Transaction Fees doesn't change any of the above workflow, it simply increases the amount of "execution effort" (gas) used by the AuthAccount function.
For example, here is a simple cadence script to create an account and add 1 key.
import Crypto
transaction(publicKey: String, signatureAlgorithm: UInt8, hashAlgorithm: UInt8, weight: UFix64) {
prepare(signer: AuthAccount) {
let key = PublicKey(
publicKey: publicKey.decodeHex(),
signatureAlgorithm: SignatureAlgorithm(rawValue: signatureAlgorithm)!
)
// THIS LINE now uses a different amount of execution effort
// than it would have previously.
// BEFORE segmented fees: "1 gas"
// AFTER segmented fees: "43 gas"
// the *payer* here is the account from which the account minimum (0.001 flow) is transferred.
let account = AuthAccount(payer: signer)
account.keys.add(
publicKey: key,
hashAlgorithm: HashAlgorithm(rawValue: hashAlgorithm)!,
weight: weight
)
}
}
will add it to the backlog to review
Portions of the documentation site use the phrase "account creation fee" in an overloaded manner, which can be quite confusing to reconcile. This is particularly true now that the Segmented Transaction Fees documentation is live.
Examples:
AuthAccount(payer)
function call, and doesn't mention the storage minimum at all.I think to clear this up we should do two things: