Account creation
Prerequirements to create an account
Account creation on Newcoin requires 3 things:
- a generated public and private key for the owner account
- a generated public and private key for the active account
- a name that is compliant with the naming convention
- a ticker symbol
- a sponsor (payer) for funding the resources needed to create the account
Active/Owner accounts
Newcoin has an advanced system for privacy preservation that enables you to have multiple identities with a single wallet. You can show to one dApp only a partial collection of your NFTs or give another dApp only a partial permission on your assets (e.g. post but not transfer). The Owner is the master account, and it's private key should be stored as good as possible (e.g. on a cold storage), as, if in any case, the active private key would potentially be compromised, you can reset it with your owner keys.
Read more in our Guide about Active Owner Accounts.
We strongly recommend generating 2 different keysets. It can also be both the same keyset.
Naming conventions
An account name on Newcoin has 2 parts: the Name, and the Extension.
- The default extension is ".io" - the extension is part of the length of the name.
- The payer needs to have authorization to create accounts with that extension.
- the name can be 13 chars long
- and it can contain a-z, 1-5 and "."
/(^[a-z1-5.]{1,11}[a-z1-5]$)|(^[a-z1-5.]{12}[a-j1-5]$) /g
You maybe spotted, that a name can actually be 13 chars, but the 13th has higher limitations.
Newcoin Features
On Newcoin, every account can have:
- exactly 1 pool
- exactly 1 DAO with a token
To create a pool and a Token, you first need to have $GNCO in your account.
Therefore to enable all account features, we recommend to use this order:
- Create Account
- Stake GNCO
- Create pool
- Create DAO
Full code example
Init blockchain referral object and create keys
const nco = new NCO_BlockchainAPI(
NCO_BlockchainAPI.defaults.devnet_urls, NCO_BlockchainAPI.defaults.devnet_services
);
let ownerKeypair = await nco.createKeyPair();
let activeKeypair = await nco.createKeyPair();
let name = "nakamoto.io";
console.log("Keys owner generated: \n Prv: %s \n Pub: %s\n", ownerKeypair.prv_key, ownerKeypair.pub_key);
console.log("Keys active generated: \n Prv: %s \n Pub: %s\n", activeKeypair.prv_key, activeKeypair.pub_key);
Create Account
nco.createUser({
newUser: name,
newacc_pub_active_key: activeKeypair.pub_key,
newacc_pub_owner_key: ownerKeypair.pub_key,
payer: "satoshi.io",
payer_prv_key: "<private key>",
ram_amt : 8196,
cpu_amount : "100.0000 NCO",
net_amount : "100.0000 NCO",
xfer : true, // stake or transfer CPU/NET to the account
}).catch((reason) => {
console.log("Blockchain Error: " + reason);
}).then((res: any ) => {
if(res){
console.log("transaction ID: " + res.TxID_createAcc)
console.log("full response: ",res)
} else {
console.log("NO RESULT seems error has occured")
}
})
Stake GNCO
nco.stakeMainDAO({
amt: "10.0000 NCO" //string;
payer: name //string;
payer_prv_key: activeKeypair.prv_key //string;
}).then((res) => {
console.log("Transaction ID: " + res.TxID_stakeMainDAO)
}).catch((error) => console.log("Error: "+error))
Create SubPool
nco.createPool({
owner: name, //string;
owner_prv_active_key: activeKeypair.prv_key, //string;
ticker: "NKA" //string - cannot be changed afterwards!!!;
}).then((res) => {
console.log("Transaction ID: " + res?.TxID_createPool)
}).catch((error) => console.log("Error: "+error))
Create DAO
nco.createDao({
author: name, //string;
author_prv_key: activeKeypair.prv_key, //string;
descr: "My first DAO" //string - cannot be changed afterwards!!!;
}).then((res) => {
console.log("Transaction ID: " + res?.TxID_createDao)
}).catch((error) => console.log("Error: "+error))
Stake into your pool
nco.stakePool({
owner: name, //string;
payer: name, //as it is my own pool, owner and payer are the same;
payer_prv_key: activeKeypair.prv_key, //string;
amt: "10.0000 GNCO" //string always in the format of "#.#### GNCO"
}).then((res) => {
console.log("Transaction ID: " + res?.TxID_stakePool)
console.log("Pool ID: " + res?.pool_id)
console.log("Pool Code: " + res?.pool_code)
}).catch((error) => console.log("Error: "+error))
Next Steps
Typically, after creating your DAO you maybe want to whitelist some potential DAO members to invite, or start minting NFTs for sale.