Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
This is a hashgraph implementation written in javascript. It is currently in development and not yet ready to be used.
This is a hashgraph implementation written in javascript. It is currently in development and not yet ready to be used.
NOTE: This code is NOT considered ready for usage before version 1.0.0. Don't use this code if you don't know what you're doing.
You can use hashgraph for any javascript project that is run on several nodes that require some kind of consensus. For example for a replicated log, or state machine.
First, install the hashgraph package.
npm install hashgraph --save
Each node in the hashgraph requires its own public/private keypair. It is using standard RFC 4716 keys.
Run the following commands to create a public/private keypair:
openssl genrsa -out private_key.pem 2048
openssl rsa -in private_key.pem -pubout -out public_key.pem
If you want to protect your private key with a passphrase, use:
openssl genrsa -passout pass:mypassphrase -out private_key.pem 2048
openssl rsa -in private_key.pem -passin pass:mypassphrase -pubout -out public_key.pem
NOTE: Do not lose your private key file or forget your passphrase. If you do, you will lose all value stored under your public key.
Once you created your keys, you can set up a node and optionally join another node on the network very easily.
var myPublicKey = fs.readFileSync('./public_key.pem').toString();
var myPrivateKey = fs.readFileSync('./private_key.pem').toString();
var hashgraph = require('hashgraph')({
database: 'postgresql://localhost/hashgraph',
publicKey: myPublicKey,
privateKey: myPrivateKey,
passphrase: 'somePassPhrase' // optional
});
// Optionally, join another node on the network
hashgraph.join(someIPv6Address);
After joining another node on the network you can submit transactions to the network like this:
hashgraph.on('ready', function() {
hashgraph.sendTransaction('somePayload');
})
After the transaction has been sent to the network, it will try to achieve consensus over the question where to place this transaction in the global order of all transactions in the network. Once consensus has been achieved, the hashgraph will emit an event that you can listen to:
hashgraph.on('consensus', function(transactions) {
// Apply transactions to state machine
})
This is all you need to know to use hashgraph with your own projects. Read on for information on how to use the hashgraph ledger.
FAQs
This is a hashgraph implementation written in javascript. It is currently in development and not yet ready to be used.
The npm package hashgraph receives a total of 0 weekly downloads. As such, hashgraph popularity was classified as not popular.
We found that hashgraph 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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.