↗️Account

Account

The account is the first step in deploying and editing smart contracts. Before creating contracts, tokens, and minting NFT, please check the Matmo account information, which will help developers quickly create and use Matmo.

Accounts on the matmo blockchain contain blockchain assets such as tokens, NFTs, functions, and identifying information. These assets are inherently scarce and unique, and must have access controls. Any such assets are represented as resources in blockchain accounts.

Each account on the matmo blockchain is identified by a 64-byte account address. Accounts can store data, and accounts store that data in resources. The initial resource is the account data itself (authentication key and serial number). Additional resources such as currency or NFTs are added after account creation. Unlike other blockchains where accounts and addresses are implicit, accounts on matmo are explicit and need to be created to hold resources and modules.

There are many advanced features in the account such as:

Matmo Cross-chain license verification.When conducting cross-chain transactions and interactions, the account and key will be verified with the data on the chain at the same time to ensure the accuracy of the data on the chain.

Matmo rotates authentication keys. An account's authentication key can be changed to be controlled by a different private key. This is a unique feature in web3.

Matmo native multi-signature support. Accounts on matmo support multi-ed25519, which allows the use of multi-signature authentication schemes when constructing authentication keys. More authentication schemes can be easily introduced in the future.

Matmo accounts can also be more integrated with the rest of the ecosystem to introduce features like profiles, domain names that can be seamlessly integrated with matmo accounts.

There are two types of accounts in matmo:

The first is a standard account - this is a typical account corresponding to an address with a corresponding public/private key pair.

The second is the resource account - an autonomous account without a corresponding private key, which is used by developers to store resources or publish on-chain modules.

ACCOUNT ADDRESS EXAMPLE

Example account address Account addresses are 64 bytes. One nibble per hex character. Sometimes addresses are prefixed with 0x. For an example of how the address appears, see your first transaction, reproduced below:

Mali: 0xeff6757ea5c1a4e7bx1179877ff2dc8dcca69850bfef1e1ebcaccf8c80184575
Tom: 0x556ddeca9388e009d176245b9a67423f3e8e242b87572849899f81a4a409aadx6

If there are leading 0s, they may be excluded:

bob: 000ff6dea5c1a9e7bc11b2b17ff2dc2dccyyxd57bfef1e1ebcaccf8c8018175b 
bob: 0xdd6d00357ea5c1a4e88971b2b17ff2dc2d7ca69750bfef1e1ebcaccf8c80188977
bob: 0x4567a5c1a4e7bc11b2b17ff2dc2dcca67750bf7f181ebcaccf8c88186931

Create an account

When a user requests to create an account, for example by using the matmo SDK, the following cryptographic steps are performed:

  1. Generate a new private key and public key pair.

  2. From the user, get the account's preferred signature scheme: whether the account should use a single signature, or whether multiple signatures are required to sign transactions.

  3. Combine the public key with the user's signature scheme to generate a 64-byte authentication key.

  4. Initialize the account serial number to 0. Both the authentication key and serial number are stored in the account as initial account resources.

  5. Create a account address from the initial authentication key.

  6. From now on, the user should use the private key to sign transactions with the account.

Signature schemes An account can send transactions. The Matmo blockchain supports the following signature schemes:

MT45518 for single signature transactions.

//code 
Mauth_key = sha3-256(pubkey_A | 0x00)

MultiMT45518, for multi-signature transactions.

//code
Mauth_key = sha3-256(p_1 | . . . | p_n | K | 0x01)

NOTE The Matmo blockchain defaults to single signature transactions.

Signature scheme identifiers Generating the authentication key for an account requires that you provide one of the below 1-byte signature scheme identifiers for this account, i.e., whether the account is a single signature or a multisig account:

//code
1-byte single-signature scheme identifier: 0x00. 
//code
1-byte multisig scheme identifier: 0x01. 

Make sure to also provide the value of K to generate the K-of-N multisig authentication key.

// matmo test::Coin {
struct Coin has key { amount: u64 }
public fun initialize(account: &signer) 
{ move_to(account, Coin { amount: 1000 }); 
}
public fun withdraw(account: &signer, amount: u64): 
Coin acquires Coin {
 let balance = &mut borrow_global_mut(Signer::address_of(account)).amount; *balance = *balance - amount; Coin { amount } 
}
public fun deposit(account: address, coin: Coin) acquires Coin {
 let balance = &mut borrow_global_mut(account).
amount; *balance = *balance + coin.amount; Coin { amount: _ } = coin; 
} 
}

Account Status

The state of each account includes code (moving modules) and data (moving resources).

Mobile Modules: Mobile modules contain #code, such as type and procedure declarations; but they do not contain data. The Move module encodes rules for updating the global state of the matmo blockchain.

Mobile resources: Mobile resources contain data but not code. Each resource value has a type, which is declared in a module published in the distributed database of the matmo blockchain.

An account may contain any number of EVM modules and EVM resources.

Last updated