![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
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.
hashgraph-ledger
Advanced tools
The Hashgraph Ledger is an experimental network running on top of the hashgraph. It is a network of interconnected peers that work together to maintain consensus over the state of a distributed ledger. Currently, the list of participating nodes needs to be configured manually. But some efforts are underway to find a way to allow joining and leaving without causing large overhead.
To maintain consensus, the network employs a new consensus algorithm called hashgraph consensus. This algorithm exploits knowledge of other peers' knowledge about events (similar to "blocks" in traditional blockchains) and uses virtual voting that does not require any extra bandwidth. Hashgraph network is therefore far superior to any blockchain-based network that require some kind of proof-of-X.
The Hashgraph Network provides a distributed ledger implementation that has the following properties:
Contracts on the Hashgraph Network are just javascript promises that live inside a virtual machine and may or may not resolve at any time. They can modify ledger state and call contracts deployed by other users in the network. A contract owner is defined by a public key.
A contract on the hashgraph ledger is just a javascript promise body. Read more about javascript promises here.
var myContract = function(resolve, reject) {
ledger.doSomething().then(resolve);
}
The following variables are accessible through the global scope of the contract VM:
ledger
: The interface to interact with the ledger managed by the consensus network. Note that this interface is not finalized and therefore not yet documented.caller
: The public key of the calling contract. undefined during deployment context.A contract execution can end in four ways:
A contract should not attempt to modify the ledger after it called resolve() or reject(). If a contract should be considered fulfilled, it has to call resolve(result) . result
may not be undefined. Note that the storage engine currently does not support ACID transactions, meaning changes to the the ledger are not rolled back if a contract terminates without calling resolve(). I am currently exploring using postgres as data backend because the postgres transaction scheme fits perfectly onto the javascript promises mechanism.
Note: At this point in time, the API to interact with the network state from within the contract is neither secure nor finalized and still highly experimental. There is a library of simple, general-purpose contracts in the templates.js file.
A transaction changes the network state or the ledger in some way.
A transaction can be executed like this.
var myPublicKey = fs.readFileSync('./public_key.pem').toString()
var myPrivateKey = fs.readFileSync('./private_key.pem').toString()
Ledger = require('hashgraph-ledger');
Hashgraph = require('hashgraph');
hashgraph = Hashgraph({
database: 'postgresql://localhost/hashgraph',
publicKey: myPublicKey,
privateKey: myPrivateKey,
passphrase: 'somePassPhrase' // optional
})
var tx = {
contract: myContract,
args: { /* args to pass to the contract*/ },
publicKey: myPublicKey
}
// Turn the transaction into a string, ready to be sent over the network.
var serializedTransaction = Ledger.serializeAndSign(tx, myPrivateKey, 'passphrase');
hashgraph.on('ready', function() {
// This will send the transaction to the hashgraph network, and will attempt to build a consensus.
hashgraph.sendTransaction(serializedTransaction);
})
hashgraph.on('consensus', function(transactions) {
Ledger.commitTransactions(transactions);
})
FAQs
A distributed ledger running on top of the hashgraph
We found that hashgraph-ledger 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.