onflow / flow

Flow is a fast, secure, and developer-friendly blockchain built to support the next generation of games, apps, and the digital assets that power them 🌊
https://onflow.org
Apache License 2.0
358 stars 163 forks source link

Documentation uses "Account Creation Fee" in multiple ways and should be clarified. #930

Open pgebheim opened 2 years ago

pgebheim commented 2 years ago

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:

I think to clear this up we should do two things:

pgebheim commented 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:

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
        )
    }   
}
alxflw commented 2 years ago

will add it to the backlog to review