Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
bsv-headers
Advanced tools
Determine longest bitcoin chain and query block order
You must use node.js v12+
npm i bsv-headers
const BsvHeaders = require("bsv-headers").default;
const headers = new BsvHeaders({
genesisHeader: "<Buffer or hex string of genesis header>",
invalidBlocks: [],
maxReorgDepth: 1000, // How far back to recalculate longest chain after adding new block headers. Set to 0 to always recalculate from genesis (slower)
});
// const buf = Buffer.from(/* <an 80 byte bitcoin block header> */)
// headers.addHeader({ buf, /* hash: <Optional: 32 byte buffer or 64 char string hex string of buf block hash. Used for performance> */ })
// // ...
// // Add all block headers
// // ...
// headers.addHeader({ buf, /* hash: <Optional: 32 byte buffer or 64 char string hex string of buf block hash. Used for performance> */ })
const tip = headers.getTip();
console.log(`Chain tip: ${tip.height} ${tip.hash}`);
const hash = headers.getHash(0);
console.log(`Block 0 hash: ${hash}`);
const height = headers.getHeight(
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"
);
console.log(
`Block 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height: ${height}`
);
const header1 = headers.getHeader({
hash: "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
});
const header2 = headers.getHeader({ height: 0 });
console.log(header1, header2);
headers.invalidateBlock(
"00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048"
);
console.log(headers.getTip());
npm test
FAQs
Determine longest bitcoin chain and query block order
The npm package bsv-headers receives a total of 0 weekly downloads. As such, bsv-headers popularity was classified as not popular.
We found that bsv-headers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.