๐New Fee Mechanism in Pirichain
With the new version update, a dynamic system transition was made in the fee mechanism.
const EC = require('elliptic').ec;
const ec = new EC('secp256k1');
const sha = require('sha256');
const req = require('request');function toHexString(byteArray) {
return Array.from(byteArray, function (byte) {
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
}).join('');
}async function getEstimatedFee() {
return new Promise((resolve, reject) => {
const requestOptionsTransaction = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
};
req.post('https://core.pirichain.com/getEstimatedFee', requestOptionsTransaction, function (f, res) {
if (!res)
{
resolve(1);
return;
}
if (!res.body)
console.log(res)
else {
console.log(res.body);
const est=JSON.parse(res.body).estimatedBandWidthFee;
resolve(est);
}
});
})
}Last updated