Difference between revisions of "IT-SDK-Hyperledger-Fabric-Dev"
Jump to navigation
Jump to search
Samerhijazi (talk | contribs) (→Chaincode Deployment) |
Samerhijazi (talk | contribs) |
||
| Line 29: | Line 29: | ||
*Approval the chaincode definition. | *Approval the chaincode definition. | ||
*Commit the chaincode defintion to a channel. | *Commit the chaincode defintion to a channel. | ||
| + | =Chaincode Upgrade= | ||
| + | *Repackage the new chaincode. | ||
| + | *Install the new chaincode package. | ||
| + | *Approval the new chaincode definition. | ||
| + | *Commit the new chaincode defintion to a channel. | ||
=Commands= | =Commands= | ||
<pre class="code"> | <pre class="code"> | ||
| Line 40: | Line 45: | ||
peer chaincode invoke/query --orderer $ORDERER --channelID $CHANNEL_ID --name $CHAINCODE_NAME --ctor $MASSAGE | peer chaincode invoke/query --orderer $ORDERER --channelID $CHANNEL_ID --name $CHAINCODE_NAME --ctor $MASSAGE | ||
</pre> | </pre> | ||
| − | = | + | =Functions= |
| − | + | <pre class="code"> | |
| − | + | ctx.stub.getState(key); | |
| − | + | ctx.stub.deleteState(key); | |
| − | + | ctx.stub.putState(key,value); | |
| + | ctx.stub.getStateByRange(keyFrom, keyTo); | ||
| + | ------------------------------------------- | ||
| + | ctx.stub.createCompositeKey(objType, [key]); | ||
| + | ctx.stub.splitCompositeKey(key); | ||
| + | ctx.stub.getStateByPartialCompositeKey(objType, []); | ||
| + | -------------------------------------------- | ||
| + | ctx.stub.getQueryResult(queryString); | ||
| + | ctx.stub.getHistoryForKey(compositeKey); | ||
| + | </pre> | ||
Revision as of 19:19, 16 December 2021
Contents
Resources Allowed for Certification
Hyperledger Fabric
- https://hyperledger-fabric.readthedocs.io/en/release-2.2/ (Documentation)
- https://hyperledger-fabric.readthedocs.io/en/release-2.2/command_ref.html (Command Reference)
- https://hyperledger.github.io/fabric-chaincode-node/release-2.2/api/index.html (Fabric-Contract API)
- https://hyperledger.github.io/fabric-sdk-node/release-2.2/index.html (Fabric-Application API)
- https://wiki.hyperledger.org/display/fabric/Hyperledger+Fabric (WIKI)
Node.js / JavaScript
- https://nodejs.org/docs/latest-v12.x/api/ (Node.js)
- https://developer.mozilla.org/en-US/docs/Web/JavaScript (MDN)
Components
- MSP (Memberahip Service Provider)
- Leger: Record of all state transitions, result of chaincode invocations "transactions".One Leger per Channel. Ledger consists of (world state/blockchain)
- Channel:
- Smart-Contract: defines business logic
- Chaincode: SmartContracts packaged in Chaincode then deployed to blockchain-network.
- Blockchain-Network:
- Ordering-Service:
Begriffe
- Client Application: interact with blockchain network on behalf of useres.
- Wallet: contains a sset of user identities to connects to a channel
- Gateway: manges the network interactions on behalf of application.
Chaincode Deployment
- Package the chaincode.
- Install the chaincode package.
- Approval the chaincode definition.
- Commit the chaincode defintion to a channel.
Chaincode Upgrade
- Repackage the new chaincode.
- Install the new chaincode package.
- Approval the new chaincode definition.
- Commit the new chaincode defintion to a channel.
Commands
peer lifecycle chaincode package $PACKAGE_NAME.tar.gz --path $PATH_SOURCECODE --lang $LANG --label $LABEL peer lifecycle chaincode install $PACKAGE_NAME.tat.gz peer lifecycle chaincode queryinstalled peer lifecycle chaincode approveformyorg --orderer $ORDERER --channelID $CHANNEL_ID --name $CHAINCOD_NAME --version 1.0 --package-id $PACKAGE_ID --sequence 1 peer lifecycle chaincode checkcommitreadiness --channelID $CHANNEL_ID --name $CHAINCOD_NAME --version 1.0 --sequence 1 --output json peer lifecycle chaincode commit --orderer $ORDERER --channelID $CHANNEL_ID --name $CHAINCODE_NAME --version 1.0 --sequence 1 --peerAddresses $PEER_ADDRESSE peer lifecycle chaincode querycommitted --channelID $CHANNEL_ID --name $CHAINCODE_NAME peer chaincode invoke/query --orderer $ORDERER --channelID $CHANNEL_ID --name $CHAINCODE_NAME --ctor $MASSAGE
Functions
ctx.stub.getState(key); ctx.stub.deleteState(key); ctx.stub.putState(key,value); ctx.stub.getStateByRange(keyFrom, keyTo); ------------------------------------------- ctx.stub.createCompositeKey(objType, [key]); ctx.stub.splitCompositeKey(key); ctx.stub.getStateByPartialCompositeKey(objType, []); -------------------------------------------- ctx.stub.getQueryResult(queryString); ctx.stub.getHistoryForKey(compositeKey);