Create your bootstrap.dat
ethereum
Sing, which you have experienced, issued with Ethereum Netork, especially if Bitcoins settings will explore the alternative apprentice this driver will take you to your steps a separate filoty that can speed up the synchronization process.
WY CRATE Customized bootstrap.dat?
Intraditional settings, blockchain synchronizes from Ethereum RPC requests. Setting Bitcoin Clenniles or Testing Goals, this sync processing process can be slow for a number of reasons:
1
RPC latency : Every time you need to get the latest data from the Ethereum network, it happens.
- Network congestion
: If multiplied customers are sync, you have no slower updates.
Adjusted "bootstrap.dat" fillet cannot specify.
Gradual Instructions
- Create a new directory for your Ethereum Clien setting up.
- Copy this code into a new file:
Const network. '4'; // default to latent version (if not set)
Const rpcurl = process.env.rpc_url || ' // Leave with your infur project ID
Const BootstrapPath = './BootStrap.dat';
Re
Replacein your_ project_idwith your actual project ID.
- Interactive customer, setting,
Javacript
Const Must = Web3 ({{{
Repair: {
URL: rpcurl,
Opportunities: {NetworkVersion},
},
});
Re
- Set “BootstrappPath” to a specific directory, you will not return to save your custom data.
2.
Javacript
client.on ('oncomplete', () => {
// Writer bootstrap.dat filled with original data
Const Data = GetBootStrapdata ();
FS.Writefilesync (BootstrapPath, JSON.Stringify (Data));
});
Re
Getbootstrapdata ()-care start and turn to the top to return the desired boot data. You can use data sources (such as cache API or external storage solution).
- Set the lists of events lists for events that were probably needed.
Example of use of use
Here is an example of how you could create and popular your customsbootstrap.datfile:
Javacript
Const network. '4';
Const rpcurl = process.env.rpc_url || '
Const BootstrapPath = './BootStrap.dat';
Const Must = Web3 ({{{
Repair: {
URL: rpcurl,
Opportunities: {NetworkVersion},
},
});
client.on ('oncomplete', () => {
Const Data = GetBootStrapdata ();
FS.Writefilesync (BootstrapPath, JSON.Stringify (Data));
});
Function GetBootStrapdata () {
// Implementation of your custom boot data here gets logic
}
` Re
When performing these steps and using the “bootstrap.dat” file, you collect a faster synchronization process for setting up your Ethereum Clien.
Để lại một bình luận