Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the example that fetches rps of bNEO using given blockcount #10

Open
dusmart opened this issue Nov 3, 2021 · 0 comments
Open

the example that fetches rps of bNEO using given blockcount #10

dusmart opened this issue Nov 3, 2021 · 0 comments

Comments

@dusmart
Copy link
Contributor

dusmart commented Nov 3, 2021

V17 has built a robot processing all rPS history data. The data is located in Azure Storage. Here is an example that fetches rPS from Azure.

async function burger_gas_per_neo_per_second(block, duration) {
    const start = `https://neoburger.blob.core.windows.net/status/${block}.json`;
    const stop = `https://neoburger.blob.core.windows.net/status/${block - duration}.json`;
    const resp = await Promise.all([fetch(start, { method: 'GET' }), fetch(stop, { method: 'GET' })])
    const [jx, jy] = await Promise.all(resp.map(v => v.json()))
    const drps = jx.rps - jy.rps
    const dtime = jx.timestamp - jy.timestamp
    return drps * 1000 / dtime;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant