Home > Blockchain >  The fourth article block chain locations (MOAC BlockChain) deployment ERC - 20 contracts
The fourth article block chain locations (MOAC BlockChain) deployment ERC - 20 contracts

Time:09-23

Based on block chain locations (MOAC BlockChain), using MOAC web wallet deployment ERC - 20 contracts,

Environment:

Stone block chain version: nvwa - vnode1.0.2. Win. Zip.

Operating system: 64 - bit Windows 10 home edition,



1. Install and start a local node

1.1 installation moac node

Please refer to the document "the third block chain locations (MOAC BlockChain) node installation tutorial",

1.2 start moac node

Open a command terminal (CMD), go to the current directory locations, executed on the command line:

D: \ nuwa1.0.2. Win> Moac, RPC, rpccorsdomain "http://wallet.moac.io"
Note:

- the RPC start RPC service, native access node

- rpccorsdomain starts the browser to access the service, the native access node

"Http://wallet.moac.io" moac wallet online web site, will be automatically connected to the machine start moac node and display the existing accounts, if the machine has not started, displays the following message,



Start normal, displays the following account information, to ensure that one of the account has enough moac for intelligent deployment contract,




2. Write and compile intelligence

2.1 the following is based on erc - 20 a scrip written contract

In this paper, the actual test code TestToken20. Sol attached at the end of the article,

Note: the code to use for test case, the standard deployment of intelligent contract code,

2.2 compile, deploy

The web wallet click CONTRACTS button "CONTRACTS"



Then click DEPLOY NEW contracts button "DEPLOY NEW CONTRACT
"
Choose a moac balance account,



Put smart contracts to write your own code in the code area "Solidity contract source code", the code will automatically compile, if compiled through, will be displayed on the right side "the Select contract to deploy,"

If the compiler does not pass, does not show the corresponding contents,



In the "Select contract to deploy" drop-down box to Select the corresponding token type, this case is "token Demo", input box below will automatically pop up parameters, mainly includes four items:

Initial Amount to 256 bits unsigned integer/issued/token Amount, this case is "10000"
Token Name - the String//token Name, this case is "KongFuZi token"
A decimal Units - 8 bits unsigned integer//token is the smallest unit which decimal places
Token Symbol - the String//token, this case is "KFZT
"

After choose gas fee, click on the "DEPLOY" deployment of contracts, contract confirmation screen released will be displayed at this time,

If prompted for unlock (sending tokens) account, enter the moac command line interface, enter the command:

The personal unlockAccount (MC) accounts [0], "passwd", 300)
There are three parameters: the command

The first parameter to unlock account,
The second parameter is the account password,
The third parameter is the time to unlock, this example is 300 seconds, will lock the account again after 300 seconds;
If the unlock time to 0, said has been unlocked, accounts at this time there are risks, careful,

In order to hide the password, can enter the command:

The personal unlockAccount (MC) accounts [0])
After enter prompted for a password, the password is not displayed, this command will default to account unlock 300 seconds,

Success will unlock returns true, released at this time will show the contract confirmation interface,



Note: must have the Data in the Data, otherwise can't normal deployment

Click on "OK", started deploying contracts, interface beneath the progress bar will display the current deployment contracts



Click on the successful deployment of the contract, you can see the basic content, including contract address hash, are included in the block number, etc.,



Login moac block chain browser: http://explorer.moac.io/home, in tokens drop-down box to choose "View ERC20",


In the search bar enter contracts address, can search to the corresponding contents of the contract,



Click go in, you can see basic information about contract, Token Transfers and Token Holders information,

Note: this step may need to have a trade to the query browser,


At this point, can confirm contract deployment is successful,



3. The token of the transaction

3.1 check the contract status

Click the contract progress bar deployed on the "Test Token (management page)", enter the contract management interface,



The upper part shows the basic information of the management interface, the contract is address, general function button on the right, mainly includes: receiving and painters and token, the browser view, copy the address, qr code and display interface,

Click on "browser", will jump to block a browser and automatic display the query results interface contract,

Click on "display interface", jump out of the following interface, display "contract JSON interface", if there are others need to manage or operate this smart contract, you need the interface content along with contract address a and sent to him,



The lower part of the management interface according to the contract itself function,



One on the left shows the read operation contract, in this case, including name, total distribution, etc.,

The right to write operation of contracts, unless there is a definition of its function, for erc - 20 contracts is not frequently used,

3.2 check the token

Click into the wallet "CONTRACT" interface, automatically check CONTRACT (WATCH CONTRACT) and check the certificate (WATCH TOKEN) shows all the nodes deployment of contracts and TOKEN, click and view the interface, all can enter the corresponding management



In account interface, also can see that each account has a token,



Enter to the MAIN ACCOUNT of the issuing the intelligent contract MAIN ACCOUNT, will display a token information, and the ACCOUNT has token balance and so on,

3.3 trade

From the wallet have KFZT token's main account, click the "SEND" to SEND trading interface,

Fill in TO receive account (" TO "), and choose TO SEND the Token name (" KongFuZi Token "), fill in the number of Token TO deal (" AMOUNT "), click the "SEND"



Send information display interface,



Here if you need to unlock the account, refer to the previous section 2.2 unlockAccount command,



nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related