What Will We Do In Brief?
We will first set up a node for Ava-Denali testnet. We need a server to install this node. In this guide, we will get a server through Google Cloud, as it grants free use for a while. After installing our Node, we will get nAVA (nano-AVA) from Ava Faucet to our X-Chain Wallet address to become a Validator on the network. We will send this NAVA to our P-Chain address to create a stake. And then we will become a validator in the Network.
So What Is This X-Chain and P-Chain?
Ava Üzerinde default 3 adet subnet var. Bunlar X-Chain(eXchange Chain), P-Chain(Platform Chain) ve C-Chain(Contract Chain).
X-Chain
X-Chain acts as a decentralized platform for creating and trading smart digital assets. One of the assets traded in the X-Chain is AVA.
P-Chain
It is the chain that manages metadata about the AVA network. The P-Chain API allows clients to create subnets, add validators to subnets, and create blockchains. )
C-Chain
C-Chain is an example of the Ethereum Virtual Machine powered by Avalanche . Smart contracts can be made on C-Chain and anything that can be done on Ethereum using the C-Chain's API can be done here.
Requirements for Installation
Ubuntu 18.04 or 20.04
OSX Catalina or higher versions
Minimum Hardware Requirements
CPU: 2 GHz
RAM: 3 GB
Storage: 250 MB free space
Recommended Hardware Requirements
CPU: > 2 GHz
RAM: > 3 GB
Storage:> 5 GB of free space on SSD
Setup
First of all, you can install VM ( virtual machine ) on Google Cloud from here . Do n't forget to choose the boot partition as Ubuntu 18.4 LTS .
After installing our virtual machine, go to the Virtual machine samples page and click the SSH in the row where the virtual machine instance you want to connect to.
We now have a terminal window to interact with our Virtual machine instance. All our work will be done with this terminal window.
After clicking on SSH, a terminal like the one below should be opened.
Let's start entering our commands now
We paste the commands one by one and in turn and press enter.
wget https://github.com/ava-labs/gecko/releases/download/v0.5.0/gecko-linux-0.5.0.tar.gz
tar -xvf gecko-linux-0.5.0.tar.gz
cd gecko-0.5.0
./ava
With the commands above, we downloaded the latest Denali version and opened the file we downloaded in a folder called gecko-0.5.0. We entered the folder with the command that started with cd. (cd: Change Drictory. We can switch between folders with this command.). Yes, our Node is working now. It should look like the one below.
#Being a Validator
To be a validator in the AVA network, it is necessary to deposit AVA on the platform (P-Chain) first. The minimum stake for Denali is 10,000 nAVA (nano-AVA). This amount will not be the same as in Mainnet.
Step 1 - Creating Users and Addresses
First of all, without closing the window where we run the Node (if we close it, it will close in the node. At the end of the article, I will give a command for this), we open a new terminal window by clicking SSH from my virtual machine examples and we start pasting the commands.
Here you have to paste and edit the commands we will use in a text editor. The point to be aware of is that text editors can sometimes leave nonsensical gaps and most of the errors you get will be due to these overlooked gaps. I recommend using Microsoft Word. Because the "Show All" button, which we see in the picture below, performs the function of showing or hiding the tab marks for us to see the spaces.
We will create a user to be a validator. The following command creates a user with the username and password we set.
curl -X POST --data '{
"jsonrpc": "2.0",
"id": 1,
"method": "keystore.createUser",
"params": {
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore
Now that we have an account, we need to create an address on the X-Chain. This address will receive AVA from Faucet. We create a wallet on the X-Chain with the avm.createAddress command below.
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :2,
"method" :"avm.createAddress",
"params" :{
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
will return a result like below. Do not forget to write down the address given. We will request faucet from this faucet to this X-Chain address soon
{
"jsonrpc": "2.0",
"result": {
"address": "YOUR X-CHAIN ADDRESS"
},
"id": 1
}
Now, let's create an account on the P-Chain with the platform.createAccount command below.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.createAccount",
"params": {
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD"
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
This command returns our P-Chain address as you can see below. We should note this as we will use it in the next steps.
{
"jsonrpc": "2.0",
"result": {
"address": "YOUR P-CHAIN ADDRESS"
},
"id": 1
}
We now have a wallet to request nAVA on X-Chain and a wallet on P-Chain to send and stake. Now it's time to get nava.
Getting NAVA from Faucet
We go to AVA Testnet Faucet Address. As you can see below, we write our X-Chain address in the Address section and we want 20 thousand NAVA after confirming that we are human.
Within a few seconds, the nAVas should be in our account. We check our account with the command below. Don't forget to write your X-Chain address in YOUR X-CHAIN ADDRESS HERE.
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :7,
"method" :"avm.getBalance",
"params" :{
"address":"YOUR X-CHAIN ADDRESS HERE",
"assetID" :"AVA"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
We will see the answer below confirming that we have received our NAVA.
{
"jsonrpc":"2.0",
"id" :2,
"result" :{
"balance":20000
}
}
Send to P-Chain
Yes, we now have 20 thousand NAVA. Now we have to send these hunts to our P-Chain address to Stake. At least 10,000 NAVA is required for stake processing. We will send 10 thousand nAVA to our P-Chain address with the avm.exportAVA command below. Do not forget to enter your own information in the sections starting with YOUR.
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.exportAVA",
"params" :{
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD",
"to":"YOUR PLATFORM ADDRESS HERE",
"amount": 10000
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X
This command returns a TxID. We don't need to keep this TxID.
The next step is to accept this submission on the P-Chain. To do this, we will use the platform.importAVA command below.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.importAVA",
"params": {
"username": "YOUR USERNAME",
"password": "YOUR PASSWORD",
"to":"YOUR PLATFORM ADDRESS HERE",
"payerNonce":1
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P
This command returns a string representing a process similar to below.
{
"jsonrpc": "2.0",
"result": {
"tx": "1117xBwcr5fo1Ch4umyzjYgnuoFhSwBHdMCam2wRe8SxcJJvQRKSmufXM8aSqKaDmX4TjvzPaUbSn33TAQsbZDhzcHEGviuthncY5VQfUJogyMoFGXUtu3M8NbwNhrYtmSRkFdmN4w933janKvJYKNnsDMvMkmasxrFj8fQxE6Ej8eyU2Jqj2gnTxU2WD3NusFNKmPfgJs8DRCWgYyJVodnGvT43hovggVaWHHD8yYi9WJ64pLCvtCcEYkQeEeA5NE8eTxPtWJrwSMTciHHVdHMpxdVAY6Ptr2rMcYSacr8TZzw59XJfbQT4R6DCsHYQAPJAUfDNeX2JuiBk9xonfKmGcJcGXwdJZ3QrvHHHfHCeuxqS13AfU"
},
"id": 1
}
We take this tx and paste it into THE ISSUE TRANSFER TX HERE part of the platform.issueTx command below.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.issueTx",
"params": {
"tx":"THE ISSUE TRANSFER TX HERE"
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P
P-Chain must have enough nAVA (10 thousand) to participate and participate in the Denali test network as a validator. To verify this, we verify the balance with the platform.getAccount command below. Don't forget to write your own P-Chain address in YOUR PLATFORM ADDRESS HERE.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getAccount",
"params":{
"address":"YOUR PLATFORM ADDRESS HERE"
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P
Validation
Now that we have funds in P-Chain, we are ready to sign up to become a validator on the network. Each node has a node id used to uniquely identify the node on the network. In order to be a validator, we must commit this node id as the node that does the job. Let's take our nodeID. Do not forget to take note of the Node Id aside.
We are running the following command admin.getNodeID.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "admin.getNodeID",
"params":{},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
The next step is to create a process that adds our node to the network with the platform.addDefaultSubnetValidator command. In the example below, we set a start time of 15 minutes and end on June 15 at 23:59 (GMT).
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.addDefaultSubnetValidator",
"params": {
"id":"YOUR NODEID HERE",
"payerNonce":2,
"destination":"YOUR PLATFORM ADDRESS HERE",
"startTime":'$(date --date="15 minutes" +%s)',
"endTime":1592265599,
"stakeAmount":10000
},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
This command returns an unsigned tx that adds our node to the list of validators for the Denali network, as you can see below.
"jsonrpc":"2.0",
"id" :1,
"result" :{
"unsignedTx": "1115K3jV5Yxr145wi6kEYpN1nPz3GEBkzG8mpF2s2959VsR54YGenLJrgdg3UEE7vFPNDE5n3Cq9Vs71HEjUUoVSyrt9Z3X7M5sKLCX5WScTcQocxjnXfFowZxFe4uH8iJU7jnCZgeKK5bWsfnWy2b9PbCQMN2uNLvwyKRp4ZxcgRptkuXRMCKHfhbHVKBYmr5e2VbBBht19be57uFUP5yVdMxKnxecs"
}
}
We copy this unsigned transaction and replace it in the platform.sign command below. Do not forget to fill the places starting with YOUR with your own information.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.sign",
"params": {
"username": "YOUR USERNAME HERE",
"password": "YOUR PASSWORD HERE",
"tx":"THE VALIDATION UNSIGNED TX HERE",
"signer":"YOUR PLATFORM ADDRESS HERE"
},
"id": 2
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
You will see an answer like the one below.
{
"jsonrpc": "2.0",
"result": {
"Tx": "111Bit5JNASbJyTLrd2kWkYRoc96swEWoWdmEhuGAFK3rCAyTnTzomuFwgx1SCUdUE71KbtXPnqj93KGr3CeftpPN37kVyqBaAQ5xaDjr7wVBTUYi9iV7kYJnHF61yovViJF74mJJy7WWQKeRMDRTiPuii5gsd11gtNahCCsKbm9seJtk2h1wAPZn9M1eL84CGVPnLUiLP"
},
"id": 1
}
Now we will take this signed transaction and send it to P-Chain to be a validator in the Denali network with the platform.issueTx command.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.issueTx",
"params": {
"tx":"YOUR VALIDATION SIGNED TX HERE"
},
"id": 3
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
That's it. We should see ourselves in the list of pending verifiers now, and within 15 minutes we will be in the current verifiers list. We can see the verifiers with the command below.
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getPendingValidators",
"params": {},
"id": 4
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
curl -X POST --data '{
"jsonrpc": "2.0",
"method": "platform.getCurrentValidators",
"params": {},
"id": 1
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P
From https://explorer.ava.network , we can check with our node id from the validator section.
Running Node in the Background
Now let's come to the command to run the Node in the background, which I mentioned at the beginning of the article. There are multiple ways to do this. I'll give a command. I will leave a source below in more different and healthy methods.
we switch to the window we first opened (we run the node with ./ ava) and stop the node with the ctrl + c key combination. Then we start the node with the nohup ./ava & command. This command outputs "nohup: ignoring input and appending output to 'nohup.out'". You can now close the terminal windows.
SOURCE
https://medium.com/avalabs/how-to-join-avas-denali-test-network-9bbfb353207b
@id-bet9jaa, Поздравляю!
Ваш пост был упомянут в моем хит-параде в следующих категориях: