Home > Blockchain >  Article 6 hair chain stone blocks a key chain chain (application) to build tutorial (a)
Article 6 hair chain stone blocks a key chain chain (application) to build tutorial (a)

Time:09-23

A key chain three levels, this paper is the official script first level, the second level is to perfect the
1, the official script
Needless to say, from the official documents, and provide the AST, advance the ASM script, with simple input, can build a good chain
2, an automated build script
Problem with SCS books need to be synchronized, maybe need two days, this improved method derived from existing on the SCS books, imported into the new SCS node, synchronization time will be shorten, users can set up his application as soon as possible chain
3, establish
Official team registered good SCS first, the user to use directly, equivalent to his fine decoration rough
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Beijing time on June 30, 2018, MOAC application chain is launched open beta,
Beijing time on July 12, 2019, MOAC Nuwa1.0.10, this version is suitable for the main (mainnet) and test (testnet),

Following are MOAC testnet chain installation and application tutorial, mainnet application chain construction process is the same (MOAC oh to pay money),

1. The preparation work

From MOAC release page: https://github.com/MOACChain/moac-core/releases

Download the Windows version of system software package nuwa1.0.10. Win. Zip,

This version is suitable for the 64 m bit/32-bit Windows 7 and above system, in this paper, the actual operating environment for: 10 Chinese version 64 - bit Windows,

In this paper, the main content from MOAC Chinese wiki, website: https://github.com/delida/MoacDocs/wiki



2. Generate local MOAC node

Unpack the system software package nuwa1.0.10. Win. Zip to the local hard disk,

Installation node to MOAC test network, install command:

D: \ nuwa1.0.10. Win, win, vnode> Moac - testnet \ \ the corresponding version of the executable program was renamed moac. Exe, after with
Note: in moac test network, any situation use moac command to start the nodes are need to add - testnet,

Nodes automatically installed to the directory: C: \ Users \ \ AppData \ Roaming \ [user] MoacNode \ testnet

Test locations net height can be achieved by testing locations the block browser queries,

Browser web site: http://47.75.144.55:3000/home,

Special note: all the operations in order to complete this document, need to use the following way: start node

D: \ nuwa1.0.10. Win, win, vnode> Moac - testnet - RPC - rpcaddr 0.0.0.0 - rpccorsdomain "*" -- rpcapi="db, MC,.net, chain3, personal, vnode, debug, SCS"
Use this command to start node, this title document used behind the web version of the purse is: http://wallet.moac.io,

3. The basic operation node

This section reference document "the third block chain locations (MOAC BlockChain) node installation tutorial",

3.1 enter the console interface

System shutdown or take the initiative to shut down the node, if you need to restart the node, and executed on the command line:

D: \ nuwa1.0.10. Win, win, vnode> Moac testnet - RPC
After the command execution, interface has been scrolling to the data synchronization module,

3.2 attach into the interface

Open another command (CMD) terminal, turn to the current directory, executed on the command line:

D: \ nuwa1.0.10. Win, win, vnode> Moac attach
This command depends on the node is started, after the command execution does not take the initiative in the volume, but for order,

3.3 create account

After entering MOAC console interface, execute the command:

The personal newAccount ()
System will be in the following directory: C: \ Users \ \ AppData \ Roaming \ [userName] MoacNode \ testnet \ keystore, records an account files,

Please save the file, and keep in mind the password,

3.4 dig

In the test network, can try to dig for operating gas fee, after entering moac attach after interface:

Began to dig, execute the command:

Miner. The start ()
Stop dig, execute the command:

Miner. Stop ()
View the mining state, execute the command:

MC. Mining,
Check the balance changes, execute the command:

LoadScript (" McTest. Js ")
CheckBalance ()


4. The SCS registration

"Here refer to Chinese wiki content SCS miners participation method",

4.1 deploy application chain mineral pool

Deploy application chain intelligent mine pool contract for SCS application chain nodes to join the pool miners,

From MOAC release page download contracts SubChainProtocolBase. Sol, deployment of contracts,

Here content reference document "the fourth article in block chain locations (MOAC BlockChain) deployment ERC - 20 contracts",

Deployment time choose "Sub Chain Protocol Base", fill in the parameters of the Protocol (POS), Bmin (1), and Protocol type (0 said POS, 1 ipfs), as shown,



After successful deployment



Note: this step is not must, can directly join test network existing miners pool, only in the network, the node can't sync, you have to deploy application chain mineral pools,

4.2 start the SCS

In node file, download it a SCS directory, directory has a configuration file userconfig. Json, the Beneficiary account for miners, to be on the safe side, recommended and scsid different accounts used to access application chain at the bottom of the scholars earnings (scsid will talk behind),

Enter the directory SCS \ scsserver start SCS:

D: \ nuwa1.0.10. Win, win, scs> Scsserver - verbosity 4
///
D: \ nuwa1.0.10. Win, win, scs> Scsserver -p "password" -- verbosity 4
Command: if scsserver run directly, the default password for moacscsofflineaccountpwd, using parameter - p, you can set their SCS account password,

After start-up, SCS will generate a keystore directory in the current directory, and create a new account, in the directory is scsid this account, if you want to change a scsid, you need to delete the directory of all the new content, only to leave the two files, restart,



According to actual needs, in accordance with the above steps to start one or more of the SCS,

4.3 registered SCS

Application in the SCS and already know a chain under the condition of ore contract address pool (see section 4.1), can be registered,

Write a scsRegister js, HTML code is as follows,

Var Chain3=the require (' Chain3 ');
Var chain3=new chain3 (new chain3. Will. HttpProvider (' http://localhost:8545 '));
//SCS registration
The console. The log (' SCS Register start! ');
Var baseAddr="0 x7610fd66c272332edd59a43460ad24eee1973bfe";
Var basePasswd="password";
Var protocolAddr="0 x225ebb0b9df76e3d48ea0614943340611f635ea0";
Var scsAddr="755 a37ec5ba302cd0022af2b8e3ff97c1996601b";//don't begin with 0 x
Chain3. Personal. UnlockAccount (baseAddr, basePasswd, 0);
Sendtx (baseAddr, protocolAddr, '5', '0 x4420e486000000000000000000000000 + scsAddr);
The function sendtx (SRC, tgtaddr, amount, strData) {
Chain3. MC. SendTransaction (
{
From: SRC,
Value: chain3. ToSha (amount, 'MC'),
To: tgtaddr,
Gas: "9000000",
GasPrice: chain3. MC. GasPrice,
Data: strData
});
The console. The log (' sending the from: '+ SRC +', '+ tgtaddr +' with data: '+ strData);
}
Main parameters are as follows:

BaseAddr basePasswd: provids an account and password, the transaction to pay the gas fee and SCS registration required a deposit of 5 MC (in this case);
Chain protocolAddr: step 4.1 application pool contract subchainprotocolbase address;
ScsAddr: step 4.2 scsid address, put in ".../scsserver scskeystore "directory;
Registered number of MC, the case for the 5 MC, contract setting value must be greater than mine pool here, SCS submit the deposit, the more to participate in the application of the chain, the more
Special note: scsAddr address don't add "0 x",

In the file directory performs the registration file scsRegister. Js:

D: \ nuwa1.0.10. Win, win, scs> The node scsRegister. Js
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related