Ethereum: Draw the distribution of all paid rates of Bitcoin transactions
Introduction
Bitcoin transaction rates are a key aspect of the cryptocurrency economy. As the second largest altcoin for market capitalization, the high rates of bitcoin led to concern about the scalability and usability of the network. In this article, we will deepen the world of blockchain analysis and explore ways of drawing distribution of all paid Bitcoin transactions.
Understand the rates of transactions
Bitcoin price structure is designed to encourage miners to confirm network transactions. Each block has a set of rules that regulate the creation and check of new transactions. The miners are rewarded with the newly elected bitcoins (MB) and transaction rates to process these transactions. The rates are calculated depending on the number of transactions, the level of difficulty of the block and other factors.
The speed calculation formula is as follows:
F = (T \ 10^9 + D \ 0.00001 \* P) / 1
Where:
– F
: Transaction rate
– T
: Number of transactions in the block
– D
: a block of difficulty
– P
: Block reward by MB
Analysis of the distribution of transactions rates
To obtain information on distribution of all transaction transactions rates, we can use several blockchain analysis techniques. Access is to analyze the structure of the rates over time, identifying patterns and trends.
Use ether.js and line
We will use ethers.js, the popular JavaScript Library for Interact with the Ethereum Block and Plotly, a powerful data visualization library, to withdraw the distribution of all bitcoin transaction rates of paid bitcoin.
First, we have to get a list of all Bitcoin transactions, including rates. We can use the Ethersjs' library to obtain this information. Here is a fragment of the code examples:
Javascript
Const ether = demand ('ethersjs');
const fs = required ('fs');
Async Gettransationfees () Function
const txhas = alea ether.getransacticount ();
Const transaction = [];
it (leave i = 0; i
const txhash = txhahes [i];
Const Tx = etherS.Gettransation (txhash);
Consta stop = tx.fee;
Transalke.push (cartes);
Iche
Restore Maris transaction;
Iche
Gettransactione (). Then ((txfeelist) => {
Const Freibness = Platly.ploottxf (txfeelist, {{
Title: 'Distribution of the Bitcoin Transaction rate',
Xaxistitle: 'Block number',
Yaxistitle: 'rate (mb)',
});
});
This fragment of the code receives a list of all bitcoin transactions and calculates its rates. Then draw the distribution of all transaction rates paid by drawing.
Another approach is the use of time series analysis library, such as 'Plotly' or 'Lodash' to analyze the distribution of rates over time. We can create matrices for each block number, store the appropriate values of the rate, and then calculate the average and standard deviation of each matrix.
Using 'Lodash
Here’s a fragment of the code examples using Lodash:
`Javascript
const _ = demand ('Lodash');
Async Gettransationfees () Function
const txhas = alea ether.getransacticount ();
Const transaction = [];
it (leave i = 0; i
const txhash = txhahes [i];
Const Tx = etherS.Gettransation (txhash);
Consta stop = tx.fee;
Transalke.push (cartes);
Iche
// Calculate an average and standard deviation
Const feemean = _.mean (transaction fees);
Const festdev = _.stddev (transaction panels);
Return {Feemean, Festddev};
Iche
Gettransactione (). Then ((Farestats) => {
Console.log (average: $ {fiestats.feemean}, standard deviation: $ {festats.Feestddev});
});
`
This fragment of the code calculates the average and standard deviation of all transaction rates paid over time using Lodash.