account
What is an Account?
An account is different from addresses in BTC and ETH. It is a recognizable, readable, and easily recordable string, such as your game username “hellodmc”.
Account names have certain rules. The rules are as follows: They must be 12 characters long and can only contain lowercase letters (a-z) and numbers (1-5).
- DMC accounts can own resources and be associated with contracts. Owning resources means that resources like EOS, RAM, CPU, NET, etc., in DMC belong to the account. Associated contracts mean that contracts must be owned by an account. An account can be authorized to perform certain transactions, such as transfers and contract actions.
Generating Public and Private Keys
Tips: The generated public and private key pairs need to be kept secure and must not be shared with anyone! When asking someone to help register a DMC account, you only need to provide your public key. Anyone who claims to help register a DMC account and asks for your private key is a fraud!
Generating with dmc.js’s ECC
1 | var DMC = require('dmc.js'); |
Creating an Account
Creating a New Account
Call the newaccount
method with the following parameter explanations:
1 | var DMC = require('dmc.js'); |
Buy RAM
Storing account information on the blockchain requires the consumption of RAM. The creator needs to buy RAM for the account being created in order to store the new account’s information.
The buyrambytes
method is called with the following parameter names explained:
1 | var DMC = require('dmc.js'); |
Stake Resources
The creator delegates DMC to the new account to obtain CPU and NET resources, enabling the new account to perform transactions.
The delegatebw
method is called with the following parameter names explained:
1 | var DMC = require('dmc.js'); |
Instance
1 | var DMC = require('dmc.js'); |
To execute the code and successfully register an account for someone else.
The printed results are as follows (partial excerpt):
1 | "act": { |
Based on the printed information above, it can be seen that the account dmcofficial1
has created an account named testfhfdfde3
. The owner of the testfhfdfde3
account can now import the private key into the DMC wallet to access its various functionalities! Click here to download the DMC wallet and get started!