1. Synchronize block nodes

After compiling a test chain, we need to synchronize the block data in the current test network. First, we start the compiled test chain by typing get_info


image.png


Note that “blockchain_head_block_age”: “6 seconds old”, if the time is too long, the blockchain is not fully synchronized. This can also be checked by blockchain_is_synced




image.png


If true is returned, synchronization has taken place

Create a wallet account

If we want to use some functions such as transfer, we need to create a wallet on the Achian node to manage the private keys and accounts through the wallet. On Achian, a wallet can be used for multiple accounts and addresses. We use the wallet_create command to create our own wallet on the node. Then you need to fill in two parameters “wallet_name” and “password”, respectively the wallet name and the corresponding password.




image.png


Here I create a wallet called Myachiantest.

3. Create an account

After we have a wallet, we need to have a block address to transfer and receive money, so we will take the concept of account on ACHIAN, one account corresponds to one address.

  1. Open the wallet

When we perform operations related to accounts, we first need to open the corresponding wallet. For example, if I want to operate an account with the ACTXXXXXX address under A wallet, I need to open A wallet before operating this account. Since we only have wallets at present, we need to open the wallet before creating an account. Wallet_open requires a parameter wallet_name, but since we created the wallet earlier, the default is to open the previously created wallet.




image.png

  1. Create account

To create an account, run the wallet_account_create command. You need one parameter, account_name, to create your account name.


image.png


Create success will return after a ACHAIN address: returns a ACTJfZ2Py5aSMi92czsjC9KtYwSgweS8Lqns address here This address is your address on the test chain. Put him away for us to use later. If you can’t remember the address, you can run the wallet_list_my_accounts command to query all the accounts in your wallet, and then pass in the account name through wallet_get_account_public_address to return the address of the account.


image.png

  1. Obtain the private key of the account

The private key is the only proof on the blockchain that an account is owned by you. How do we obtain the private key for the current account? We need to pass in two parameters: “account”,”key_type”, the first one is the account name, the last one is the private key type, there are three owner_key, active_key, signing_key, we just use owner_key.




{GJD[E}@]6I35Q$JU%PLFH9.png


It will then return the corresponding private key to your account and save it. At this point we have successfully created a complete account on the retest chain. Since it is a new account, if you need to use it, you can contact the official staff and ask for some ACT tokens on the test chain.

Third, transfer

For this demo, I will transfer to this account from my other account that already uses the test currency. First we open a wallet with tokens in it. Use wallet_open the same way as above, so I won’t repeat the demonstration here. Then we query the balance in an account. Wallet_account_balance This parameter is optional. If you do not specify account, the account balance in the wallet will be queried.




image.png


Notice the difference between the two. We can see that there are 12 acts under the account of Didixyy001. Let’s transfer this ACT to the account of Loveachian that we created just now.

  1. The purse to unlock

First of all, we need to unlock the wallet to transfer the account on ACHAIN. Use the wallet_unlock command to unlock the wallet.




image.png


There are two parameters, one is the unlock time, the other is the password.

  1. To transfer

“Amount_to_transfer “, “asset_symbol”, “from_account_name”, “to_address”, “Memo_message “, “strategy” he has these parameters, “Amount_to_transfer “, “asset_symbol”, “from_account_name”, “to_address”, these are mandatory parameters to complete a transfer, respectively. Transfer amount, transfer asset type, withdrawal account, transfer to account address.


image.png


Here to return to take note is 08 ee78db8dfc4d14b16b7bd63f3027e430d8e58f this is the transaction ID

  1. Query transaction Results

Through wallet_get_transaction then incoming we just deal ID 08 ee78db8dfc4d14b16b7bd63f3027e430d8e58f can view to specific information of the transaction, mean that you this data has been on the chain.




image.png


Then we can check if Loveachian’s account has received the money transferred by opening the previous wallet and checking the balance.


image.png


So we can complete the transfer operation in one go

Use of RPC services

1. Open PRC service

ACHAIN also provides RPC to call these instructions in the same way as normal interface calls. How to enable RPC service? There are two ways.

  1. Add some parameters to Achain –server –rpcuser a — rpcPassword b –rpcport 8298 –httpdendpoint 127.0.0.1:8299 –data-dir C: Users\33159\AppData\ Act-test \ Wallets: A is user name b is password 8298 is socket port 127.0.0.1:8299 is JSONRPC address C: Users\33159\AppData\Roaming\ acT-test \ Wallets is the address for saving block data


    image.png

  2. Modify the configuration file directly


    image.png

    When you’re done, save it, and then launch Achian directly which will load the base configuration by default

Call commands through RPC services

First we need to download a tool POSTMAN, easy to debug the interface. www.getpostman.com/ is a free tool that allows us to access Achian via POST.


image.png



Tool.oschina.net/encrypt?typ…








First parameter: is the name of the method value pair second parameter: is an array of parameters separated by commas third parameter: is the method ID (optional)Copy the code


image.png


Once the request is successful, the returned content is displayed in the new body below, which is basically the same as what you would see from the command line.




image.png

At the end of the article’s welfare

Recently, Chinese Valentine’s Day is not very popular. Many public chains have launched their own true love chain activities. In fact, Achain can also write down what people want to express and say on the chain. And it’s cheap and easy. I’m going to show you how to do it.

  1. Open browser.achain.com/wallet.html… . Or open your local wallet

To any address transfer 0.01 ACT, I used here is ACT8r86HUFHZwmDeyegc2nErKuGs8Ue2VWhk address.




IZCKHPB5%KIPRB_X8WIE7(6.png


After the transfer is successful, we can see the transfer record of this time on Achain’s browser, save the ID of this transaction, and your confession and love vow to your lover will be recorded on the blockchain forever.




image.png







image.png