Setting up a peer syncode on true
As administrator or network development, ensuring that the Ethereum Turkish connection is correctly configured for synchronization with others notes that the consistency of data and the prevention of orphaned blocks. In this article.
** What is the synchronization node?
In Ethereum, a synchronization node
.
** Why set the synchronization node on True?
Set the synchronization node of a peer on True guarantees that:
.
- The data of each client are propagated through the network and made available for synchronization by other clients.
- The network.
Passing-step guide
The synchronization node of a peer on True on the testnet connection
1.
Get information peer
First of all, you have to recover information on the peer with whom you want to synchronize. You
`Bash
Eth Console -Q Getpeerinfo
`
Replacewith the peer testnet address.
2
The Output from theGetperinfoCommand will contain a Json object containing various information on Peer, including its addresses and services.
Json
{
"Addr": "172.20.61.111:6379",
"Services": "00000001",
"Lastsend": ...
}
In this example:
- ADDRIS is the address of peer.
.
Lastsend
provides information on the last time this customer sent a message.
3.
Create synchronized knot
Syncodeclass that connects to the Testet connection. :
Javascript
Const Network = Requirements (‘Ehers’);
Const {Syncode} = Requirements (‘./ Sync-Node.js’);
Async Main () {function
Const NetworkConfig = New Network.Web3.providers.httpprovider (‘
Const Client = New Network.Client (Networkconfig);
// Create and synchronize the application of the knot
Const Syncode = New Syncode (client, ‘0x00000001’, 1); // Replace with your services
// Set the synchronization node on True
Syncode.settsyncode (True);
}
Main ().
`
Make sure you replace your_project_id with your Ethereum Turkish Ethereum Turkish project.
4.
Update Peer information
Finally, it is necessary to update the Peer information in Json (or another valid service code). Javascript function:
`Javascript
Settservices functions (peerinfo) {
If (! Peerinfo.Services ||! Peerinfo.Services.includes (‘Eth’) {
// Set the services on ETH, if not already present
peerinfo.services = [‘eth’];
}
Return peerinfo;
}
// Update Peer information with the services set to 1
Const Updatedpeerinfo = settservices ({… peerinfo});
Console.log (Updatopederinfo);
`
Conclusion
Syncode Syncode` Class,