Unlike most blockchain platforms, accounts on Radix (once Radix Engine v2 and Scrypto move onto the public network) are not simply keypairs. In Scrypto, an account is a component that manages the resources owned by an external actor. It allows and/or disallows resources to be deposited into and withdrawn from it.
An account keeps track of all owned resources in a single place (in its vaults), which makes it easier for end-users to view and manage their assets. Also, because an account exposes the same interface as other components, it can also be programmatically accessed.
The account component described on this page is an early form to get developers started in this new model. Additional features are anticipated to be added to the account component before Scrypto moves onto the Radix network at the Babylon release.
Account components are instantiated from a special blueprint. However the Scrypto CLI tools also provide short cuts to make it easy to create accounts for use in development and testing.
You can programmatically create an account by calling the
with_bucketfunction on the
newfunction instantiate an
Accountcomponent with no initial resource;
with_bucketis similar to
newexcept that it accepts a
Bucketof initial resource.
You can also create an account using the
To withdraw resources from an account, one needs to sign the transaction with the corresponding private keys, as part of the
resim CLI automatically withdraws resources if needed from the default account, and signs the transactions with the default private key.
To change the default account, run:
resim set-default-account <ADDRESS> <PUBLIC_KEY>
Currently each account is associated with one key-pair, but one anticipated extension of the account component before Babylon is support for multi-signature usage.
resim CLI provides a convenience method to transfer resources to another account:
USAGE: resim transfer [FLAGS] [OPTIONS] <RESOURCE> <RECIPIENT_ADDRESS> FLAGS: --trace Turn on tracing. -h, --help Prints help information -V, --version Prints version information OPTIONS: --signers <SIGNERS> Specify the transaction signers, separated by comma. ARGS: <RESOURCE> Specify the resource to transfer, e.g. "amount,resource_address" or "#nft_id1,#nft_id2,..,resource_address". <RECIPIENT_ADDRESS> Specify the recipient address.
In the current Scrypto release for local development, the account blueprint is published at a fixed location:
To see the latest Account ABI:
resim export-abi 010000000000000000000000000000000000000000000000000003 Account