aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug]Creating a new account with 0x1::aptos_account::create_account

Open 0x6368616e67 opened this issue 2 years ago • 4 comments

🐛 Documentation/aptos.dev Bug

In doc:

https://aptos.dev/guides/interacting-with-the-aptos-blockchain#creating-a-new-account

said:

The payload for instructing the blockchain to create a new account is:

{
  "type": "entry_function_payload",
  "function": "0x1::AptosAccount::create_account",
  "type_arguments": [],
  "arguments": [
    "0x0c7e09cd9185a27104fa218a0b26ea88",
    "0xaacf87ae9d8a5e523c7f1107c668cb28dec005933c4a3bf0465ffd8a9800a2d900",
  ]
}

This instructs the Move virtual machine to execute the script 0x1::AptosAccount::create_account. The first argument is the address of the account to create and the second is the authentication key pre-image (which is mentioned in Accounts). For single signer authentication, this is the public key concatenated with the 0 byte (or pubkey_A | 0x00). This is required to prevent account address land grabbing. The execution of this instruction verifies that the last 16-bytes of the authentication key are the same as the 16-byte account address. We are actively working on improving this API to support taking in a 32-byte account address that would eliminate concerns around land grabbing or account manipulation.

but the create_account may be 0x1::aptos_account::create_account of

https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/aptos_account.move#L20

and only one argument for the address of the new account

and the section before this

https://aptos.dev/guides/interacting-with-the-aptos-blockchain#sending-and-receiving-the-network-coin-coinaptoscoin

the function may be 0x1::coin::transfer

Steps to reproduce

** Error message or problem **

// Paste the output here

Expected Behavior

System information

Please complete the following information:

Additional context

0x6368616e67 avatar Oct 18 '22 15:10 0x6368616e67

Yes, the document is outdated. we already migrated to 32 byte address.

areshand avatar Oct 18 '22 16:10 areshand

I will update this doc. thanks for pointing it out!

gregnazario avatar Oct 18 '22 19:10 gregnazario

https://github.com/aptos-labs/aptos-core/pull/5123

gregnazario avatar Oct 18 '22 19:10 gregnazario

> https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/aptos_account.move#L20

https://github.com/aptos-labs/aptos-core/pull/5123#pullrequestreview-1146843897 do create_account use two arguments?

0x6368616e67 avatar Oct 19 '22 04:10 0x6368616e67