Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
fabric-shim
Advanced tools
A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other
The fabric-shim
provides the chaincode interface, a lower level API for implementing "Smart Contracts". To confirm that this is the same as the fabric-shim
in previous versions of Hyperledger Fabric.
Detailed explanation on the concept and programming model can be found here: http://hyperledger-fabric.readthedocs.io/en/latest/chaincode.html.
npm install --save fabric-shim
The chaincode interface contains two methods to be implemented:
const shim = require('fabric-shim');
const Chaincode = class {
async Init(stub) {
// use the instantiate input arguments to decide initial chaincode state values
// save the initial states
await stub.putState(key, Buffer.from(aStringValue));
return shim.success(Buffer.from('Initialized Successfully!'));
}
async Invoke(stub) {
// use the invoke input arguments to decide intended changes
// retrieve existing chaincode states
let oldValue = await stub.getState(key);
// calculate new state values and saves them
let newValue = oldValue + delta;
await stub.putState(key, Buffer.from(newValue));
return shim.success(Buffer.from(newValue.toString()));
}
};
Start the chaincode process and listen for incoming endorsement requests:
shim.start(new Chaincode());
Visit fabric-shim.github.io and click on "Classes" link in the navigation bar on the top to view the list of class APIs.
Tested with node.js 8.9.0 (LTS).
This package is distributed under the Apache License, Version 2.0, see LICENSE.txt for more information.
FAQs
A node.js implementation of Hyperledger Fabric chaincode shim, to allow endorsing peers and user-provided chaincodes to communicate with each other
The npm package fabric-shim receives a total of 17,201 weekly downloads. As such, fabric-shim popularity was classified as popular.
We found that fabric-shim demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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 threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.