Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TIC
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BY
TIC
Commits
45230e05
Commit
45230e05
authored
Feb 10, 2021
by
anandhakumarpalanisamy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added chaincode for the articonf bank app
- Refer README for more instructions
parent
c057c861
Changes
26
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
964 additions
and
0 deletions
+964
-0
.gitignore
articonf-bank-chaincode/.gitignore
+104
-0
LICENSE
articonf-bank-chaincode/LICENSE
+201
-0
README.md
articonf-bank-chaincode/README.md
+72
-0
get.sh
articonf-bank-chaincode/bank_chaincode/shell_scripts/get.sh
+12
-0
install.sh
...nf-bank-chaincode/bank_chaincode/shell_scripts/install.sh
+11
-0
instantiate.sh
...ank-chaincode/bank_chaincode/shell_scripts/instantiate.sh
+11
-0
put.sh
articonf-bank-chaincode/bank_chaincode/shell_scripts/put.sh
+14
-0
1_package.sh
...ncode/bank_chaincode/shell_scripts_lifecycle/1_package.sh
+22
-0
2_install.sh
...ncode/bank_chaincode/shell_scripts_lifecycle/2_install.sh
+22
-0
3_approve_chaincode_def_for_org.sh
...hell_scripts_lifecycle/3_approve_chaincode_def_for_org.sh
+30
-0
4_check_commit_readiness.sh
...ncode/shell_scripts_lifecycle/4_check_commit_readiness.sh
+27
-0
5_commit_chaincode_def_to_channel.sh
...ll_scripts_lifecycle/5_commit_chaincode_def_to_channel.sh
+29
-0
invoke_create_asset.sh
..._chaincode/shell_scripts_lifecycle/invoke_create_asset.sh
+20
-0
invoke_init_ledger.sh
...k_chaincode/shell_scripts_lifecycle/invoke_init_ledger.sh
+20
-0
invoke_transfer.sh
...bank_chaincode/shell_scripts_lifecycle/invoke_transfer.sh
+21
-0
query.sh
...chaincode/bank_chaincode/shell_scripts_lifecycle/query.sh
+21
-0
get.sh
...onf-bank-chaincode/bank_chaincode/shell_scripts_v2/get.sh
+13
-0
install.sh
...bank-chaincode/bank_chaincode/shell_scripts_v2/install.sh
+13
-0
instantiate.sh
...-chaincode/bank_chaincode/shell_scripts_v2/instantiate.sh
+15
-0
put.sh
...onf-bank-chaincode/bank_chaincode/shell_scripts_v2/put.sh
+13
-0
.eslintignore
articonf-bank-chaincode/bank_chaincode/src/.eslintignore
+5
-0
.eslintrc.js
articonf-bank-chaincode/bank_chaincode/src/.eslintrc.js
+37
-0
index.js
articonf-bank-chaincode/bank_chaincode/src/index.js
+13
-0
indexOwner.json
.../src/lib/META-INF/statedb/couchdb/indexes/indexOwner.json
+1
-0
chaincode.js
articonf-bank-chaincode/bank_chaincode/src/lib/chaincode.js
+198
-0
package.json
articonf-bank-chaincode/bank_chaincode/src/package.json
+19
-0
No files found.
articonf-bank-chaincode/.gitignore
0 → 100644
View file @
45230e05
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
articonf-bank-chaincode/LICENSE
0 → 100644
View file @
45230e05
This diff is collapsed.
Click to expand it.
articonf-bank-chaincode/README.md
0 → 100644
View file @
45230e05
# Smart bank Chaincodes
Chaincodes for Smart bank App
Get into CLI container
-
cd chaincodes/
-
git clone https://github.com/bityoga/articonf-bank-chaincode.git
-
cd articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/
**Set Environment Variables:**
export ORGANISATION_NAME="hlfMSP"
export PEER_HOST=peer2
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID=${ORGANISATION_NAME}
export CORE_PEER_TLS_ROOTCERT_FILE=/root/CLI/${ORGCA_HOST}/${PEER_HOST}/msp/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=/root/CLI/${ORGCA_HOST}/${ADMIN_USER}/msp
export CORE_PEER_ADDRESS=${PEER_HOST}:7051
export ORDERER_CA=/root/CLI/${ORGCA_HOST}/${ORDERER_HOST}/msp/tls/ca.crt
**Chaincode Lifecycle Install Steps**
1.
**Package Chaincode**
peer lifecycle chaincode package bank.tar.gz --path ../src/ --lang node --label bank_1.0
2)
**Install Chaincode**
peer lifecycle chaincode install bank.tar.gz
peer lifecycle chaincode queryinstalled --output json
**Set PACKAGE_ID environmental variable**
export CC_PACKAGE_ID="PACKAGE ID GOT IN PERVIOUS STEP"
3.
**Approve Chaincode definition for organisation**
peer lifecycle chaincode approveformyorg -o orderer:7050 --channelID appchannel --name bank --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt
4.
**Check Commit Readiness**
peer lifecycle chaincode checkcommitreadiness --channelID appchannel --name bank --version 1.0 --sequence 1 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt --output json
5.
**Commit Chaincode Definition to Channel**
peer lifecycle chaincode commit -o orderer:7050 --channelID appchannel --name bank --version 1.0 --sequence 1 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt
peer lifecycle chaincode querycommitted --channelID appchannel --name bank --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt
**Query Examples**
peer chaincode query -C appchannel -n bank -c '{"Args":["GetAllAssets"]}'
peer chaincode query -C appchannel -n bank -c '{"Args":["GetAssetHistory","ark"]}'
**Invoke Examples**
**Invoke InitLedger**
peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["InitLedger"]}'
**Invoke CreateAsset**
peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["CreateAsset","ark","1000","Initial Credit"]}'
peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["CreateAsset","srk","1000","Initial Credit"]}'
**Invoke TransferBalance**
peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["TransferBalance","ark","srk","5","Friendly Help"]}'
articonf-bank-chaincode/bank_chaincode/shell_scripts/get.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
export
CORE_PEER_ADDRESS
=
"peer2:7051"
export
CORE_PEER_MSPCONFIGPATH
=
"/root/admin/msp"
export
CORE_PEER_TLS_ROOTCERT_FILE
=
"/root/
${
PEER2_HOST
}
/tls-msp/tlscacerts/tls-
${
TLSCA_HOST
}
-7054.pem"
export
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
export
CORE_PEER_MSPCONFIGPATH
=
$CORE_PEER_MSPCONFIGPATH
export
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode query
-C
appchannel
-n
bankcccccc
-c
'{"Args":["readMarble","marble1"]}'
#peer chaincode query -C appchannel -n bankcccc -c '{"Args":["getHistoryForMarble","marble1"]}'
articonf-bank-chaincode/bank_chaincode/shell_scripts/install.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
export
CORE_PEER_ADDRESS
=
"peer2:7051"
export
CORE_PEER_MSPCONFIGPATH
=
"/root/admin/msp"
export
CORE_PEER_TLS_ROOTCERT_FILE
=
"/root/
${
PEER2_HOST
}
/tls-msp/tlscacerts/tls-
${
TLSCA_HOST
}
-7054.pem"
export
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
export
CORE_PEER_MSPCONFIGPATH
=
$CORE_PEER_MSPCONFIGPATH
export
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode
install
-n
bankcccccc
-v
1.0
-l
node
-p
/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src/
articonf-bank-chaincode/bank_chaincode/shell_scripts/instantiate.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
export
CORE_PEER_ADDRESS
=
"peer2:7051"
export
CORE_PEER_MSPCONFIGPATH
=
"/root/admin/msp"
export
CORE_PEER_TLS_ROOTCERT_FILE
=
"/root/
${
PEER2_HOST
}
/tls-msp/tlscacerts/tls-
${
TLSCA_HOST
}
-7054.pem"
export
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
export
CORE_PEER_MSPCONFIGPATH
=
$CORE_PEER_MSPCONFIGPATH
export
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode instantiate
-C
appchannel
-n
bankcccccc
-v
1.0
-c
'{"Args":["init"]}'
-o
${
ORDERER_HOST
}
:7050
--tls
--cafile
${
CORE_PEER_TLS_ROOTCERT_FILE
}
articonf-bank-chaincode/bank_chaincode/shell_scripts/put.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
export
CORE_PEER_ADDRESS
=
"peer2:7051"
export
CORE_PEER_MSPCONFIGPATH
=
"/root/admin/msp"
export
CORE_PEER_TLS_ROOTCERT_FILE
=
"/root/
${
PEER2_HOST
}
/tls-msp/tlscacerts/tls-
${
TLSCA_HOST
}
-7054.pem"
export
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
export
CORE_PEER_MSPCONFIGPATH
=
$CORE_PEER_MSPCONFIGPATH
export
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
#peer chaincode invoke -C appchannel -n bankcccccc -c '{"Args":["initMarble","marble1","blue","35","tom","1000"]}' --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE} &&
#peer chaincode invoke -C appchannel -n bankcccccc -c '{"Args":["initMarble","marble2","green","35","tom","1000"]}' --tls --cafile ${CORE_PEER_TLS_ROOTCERT_FILE}
peer chaincode invoke
-C
appchannel
-n
bankcccccc
-c
'{"Args":["buy_bank","marble1","marble2","45"]}'
--tls
--cafile
${
CORE_PEER_TLS_ROOTCERT_FILE
}
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/1_package.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer lifecycle chaincode package bank.tar.gz --path ../src/ --lang node --label bank_1.0
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
PACKAGE_NAME
=
"
${
CHAINCODE_NAME
}
.tar.gz"
CHAINCODE_LABEL
=
"
${
CHAINCODE_NAME
}
_
${
CHAINCODE_VERSION
}
"
CHAINCODE_SRC_CODE_PATH
=
"/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src"
CHANCODE_LANGUAGE
=
"node"
export
ORGANISATION_NAME
=
"hlfMSP"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
peer lifecycle chaincode package
${
PACKAGE_NAME
}
--path
${
CHAINCODE_SRC_CODE_PATH
}
--lang
${
CHANCODE_LANGUAGE
}
--label
${
CHAINCODE_LABEL
}
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/2_install.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer lifecycle chaincode install bank.tar.gz
# peer lifecycle chaincode queryinstalled --output json
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
PACKAGE_NAME
=
"
${
CHAINCODE_NAME
}
.tar.gz"
CHAINCODE_LABEL
=
"
${
CHAINCODE_NAME
}
_
${
CHAINCODE_VERSION
}
"
CHAINCODE_SRC_CODE_PATH
=
"/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src"
CHANCODE_LANGUAGE
=
"node"
export
ORGANISATION_NAME
=
"hlfMSP"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
peer lifecycle chaincode
install
${
PACKAGE_NAME
}
&&
peer lifecycle chaincode queryinstalled
--output
json
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/3_approve_chaincode_def_for_org.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer lifecycle chaincode queryinstalled --output json | jq .installed_chaincodes[0].package_id
# peer lifecycle chaincode approveformyorg -o orderer:7050 --channelID appchannel --name bank --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
PACKAGE_NAME
=
"
${
CHAINCODE_NAME
}
.tar.gz"
CHAINCODE_LABEL
=
"
${
CHAINCODE_NAME
}
_
${
CHAINCODE_VERSION
}
"
CHAINCODE_SRC_CODE_PATH
=
"/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src"
CHANCODE_LANGUAGE
=
"node"
export
ORGANISATION_NAME
=
"hlfMSP"
SIGNATURE_POLICY
=
"OR('
${
ORGANISATION_NAME
}
.member')"
CHANNEL_NAME
=
"appchannel"
SEQUENCE
=
"1"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CC_PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
peer lifecycle chaincode approveformyorg
-o
${
ORDERER_HOST
}
:7050
--channelID
${
CHANNEL_NAME
}
--name
${
CHAINCODE_NAME
}
--version
${
CHAINCODE_VERSION
}
--package-id
${
CC_PACKAGE_ID
}
--sequence
${
SEQUENCE
}
--tls
--cafile
${
ORDERER_CA
}
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/4_check_commit_readiness.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer lifecycle chaincode checkcommitreadiness --channelID appchannel --name bank --version 1.0 --sequence 1 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt --output json
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
PACKAGE_NAME
=
"
${
CHAINCODE_NAME
}
.tar.gz"
CHAINCODE_LABEL
=
"
${
CHAINCODE_NAME
}
_
${
CHAINCODE_VERSION
}
"
CHAINCODE_SRC_CODE_PATH
=
"/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src"
CHANCODE_LANGUAGE
=
"node"
export
ORGANISATION_NAME
=
"hlfMSP"
SIGNATURE_POLICY
=
"OR('
${
ORGANISATION_NAME
}
.peer')"
CHANNEL_NAME
=
"appchannel"
SEQUENCE
=
"1"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CC_PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
peer lifecycle chaincode checkcommitreadiness
--channelID
${
CHANNEL_NAME
}
--name
${
CHAINCODE_NAME
}
--version
${
CHAINCODE_VERSION
}
--sequence
${
SEQUENCE
}
--tls
--cafile
${
ORDERER_CA
}
--output
json
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/5_commit_chaincode_def_to_channel.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer lifecycle chaincode commit -o orderer:7050 --channelID appchannel --name bank --version 1.0 --sequence 1 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt
# peer lifecycle chaincode querycommitted --channelID appchannel --name bank --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
PACKAGE_NAME
=
"
${
CHAINCODE_NAME
}
.tar.gz"
CHAINCODE_LABEL
=
"
${
CHAINCODE_NAME
}
_
${
CHAINCODE_VERSION
}
"
CHAINCODE_SRC_CODE_PATH
=
"/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src"
CHANCODE_LANGUAGE
=
"node"
export
ORGANISATION_NAME
=
"hlfMSP"
SIGNATURE_POLICY
=
"OR('
${
ORGANISATION_NAME
}
.peer')"
CHANNEL_NAME
=
"appchannel"
SEQUENCE
=
"1"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CC_PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
peer lifecycle chaincode commit
-o
${
ORDERER_HOST
}
:7050
--channelID
${
CHANNEL_NAME
}
--name
${
CHAINCODE_NAME
}
--version
${
CHAINCODE_VERSION
}
--sequence
${
SEQUENCE
}
--tls
--cafile
${
ORDERER_CA
}
--peerAddresses
${
CORE_PEER_ADDRESS
}
--tlsRootCertFiles
${
CORE_PEER_TLS_ROOTCERT_FILE
}
&&
peer lifecycle chaincode querycommitted
--channelID
${
CHANNEL_NAME
}
--name
${
CHAINCODE_NAME
}
--cafile
${
ORDERER_CA
}
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/invoke_create_asset.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["CreateAsset","admin_test","1000","Initial Credit"]}'
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHANNEL_NAME
=
"appchannel"
INVOKE_PARAMS
=
'{"Args":["CreateAsset","admin_test","1000","Initial Credit"]}'
export
ORGANISATION_NAME
=
"hlfMSP"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
export
PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
peer chaincode invoke
-o
${
ORDERER_HOST
}
:7050
--tls
--cafile
${
ORDERER_CA
}
-C
${
CHANNEL_NAME
}
-n
${
CHAINCODE_NAME
}
--peerAddresses
${
CORE_PEER_ADDRESS
}
--tlsRootCertFiles
${
CORE_PEER_TLS_ROOTCERT_FILE
}
-c
${
INVOKE_PARAMS
}
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/invoke_init_ledger.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["InitLedger"]}'
set
-x
#echo on
CHAINCODE_NAME
=
"articonf-bank-demo"
CHANNEL_NAME
=
"appchannel"
INVOKE_PARAMS
=
'{"Args":["InitLedger"]}'
export
ORGANISATION_NAME
=
"hlfMSP"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
export
PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
peer chaincode invoke
-o
${
ORDERER_HOST
}
:7050
--tls
--cafile
${
ORDERER_CA
}
-C
${
CHANNEL_NAME
}
-n
${
CHAINCODE_NAME
}
--peerAddresses
${
CORE_PEER_ADDRESS
}
--tlsRootCertFiles
${
CORE_PEER_TLS_ROOTCERT_FILE
}
-c
${
INVOKE_PARAMS
}
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/invoke_transfer.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer chaincode invoke -o orderer:7050 --tls --cafile /root/CLI/orgca/orderer/msp/tls/ca.crt -C appchannel -n bank --peerAddresses peer2:7051 --tlsRootCertFiles /root/CLI/orgca/peer2/msp/tls/ca.crt -c '{"Args":["InitLedger"]}'
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHANNEL_NAME
=
"appchannel"
INVOKE_PARAMS
=
'{"Args":["TransferBalance","ark","srk","5"]}'
export
ORGANISATION_NAME
=
"hlfMSP"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
export
PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
#peer chaincode invoke -o ${ORDERER_HOST}:7050 --tls --cafile ${ORDERER_CA} -C ${CHANNEL_NAME} -n ${CHAINCODE_NAME} --peerAddresses ${CORE_PEER_ADDRESS} --tlsRootCertFiles ${CORE_PEER_TLS_ROOTCERT_FILE} -c ${INSTANTIATE_PARAMS}
peer chaincode invoke
-o
${
ORDERER_HOST
}
:7050
--tls
--cafile
${
ORDERER_CA
}
-C
${
CHANNEL_NAME
}
-n
${
CHAINCODE_NAME
}
--peerAddresses
${
CORE_PEER_ADDRESS
}
--tlsRootCertFiles
${
CORE_PEER_TLS_ROOTCERT_FILE
}
-c
${
INVOKE_PARAMS
}
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_lifecycle/query.sh
0 → 100644
View file @
45230e05
#!/bin/bash
# peer chaincode query -C appchannel -n bank -c '{"Args":["GetAllAssets"]}'
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHANNEL_NAME
=
"appchannel"
QUERY_PARAMS
=
'{"Args":["GetAllAssets"]}'
export
ORGANISATION_NAME
=
"hlfMSP"
export
PEER_HOST
=
peer2
export
CORE_PEER_TLS_ENABLED
=
true
export
CORE_PEER_LOCALMSPID
=
${
ORGANISATION_NAME
}
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
ORDERER_CA
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ORDERER_HOST
}
/msp/tls/ca.crt
export
PACKAGE_ID
=
$(
peer lifecycle chaincode queryinstalled
--output
json | jq .installed_chaincodes[0].package_id
)
peer chaincode query
-C
${
CHANNEL_NAME
}
-n
${
CHAINCODE_NAME
}
-c
${
QUERY_PARAMS
}
\ No newline at end of file
articonf-bank-chaincode/bank_chaincode/shell_scripts_v2/get.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHANNEL_NAME
=
"appchannel"
QUERY_PARAMS
=
'{"Args":["GetAllAssets"]}'
export
PEER_HOST
=
peer2
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode query
-C
$CHANNEL_NAME
-n
$CHAINCODE_NAME
-c
$QUERY_PARAMS
articonf-bank-chaincode/bank_chaincode/shell_scripts_v2/install.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
CHAINCODE_SRC_CODE_PATH
=
"/root/CLI/chaincodes/articonf-bank-chaincode/bank_chaincode/src"
export
PEER_HOST
=
peer2
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
CORE_PEER_MSPCONFIGPATH
=
$CORE_PEER_MSPCONFIGPATH
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode
install
-n
$CHAINCODE_NAME
-v
$CHAINCODE_VERSION
-l
node
-p
$CHAINCODE_SRC_CODE_PATH
articonf-bank-chaincode/bank_chaincode/shell_scripts_v2/instantiate.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHAINCODE_VERSION
=
"1.0"
INSTANTIATE_PARAMS
=
'{"Args":["InitLedger"]}'
CHANNEL_NAME
=
"appchannel"
export
PEER_HOST
=
peer2
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
CORE_PEER_MSPCONFIGPATH
=
$CORE_PEER_MSPCONFIGPATH
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode instantiate
-C
$CHANNEL_NAME
-n
$CHAINCODE_NAME
-v
$CHAINCODE_VERSION
-c
$INSTANTIATE_PARAMS
-o
${
ORDERER_HOST
}
:7050
--tls
--cafile
${
CORE_PEER_TLS_ROOTCERT_FILE
}
articonf-bank-chaincode/bank_chaincode/shell_scripts_v2/put.sh
0 → 100644
View file @
45230e05
#!/bin/bash
set
-x
#echo on
CHAINCODE_NAME
=
"bank"
CHANNEL_NAME
=
"appchannel"
INVOKE_PARAMS
=
'{"Args":["CreateAsset","srk","1000","InitialCredit"]}'
export
PEER_HOST
=
peer2
export
CORE_PEER_ADDRESS
=
${
PEER_HOST
}
:7051
export
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
ADMIN_USER
}
/msp
export
CORE_PEER_TLS_ROOTCERT_FILE
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp/tls/ca.crt
CORE_PEER_ADDRESS
=
$CORE_PEER_ADDRESS
CORE_PEER_MSPCONFIGPATH
=
/root/CLI/
${
ORGCA_HOST
}
/
${
PEER_HOST
}
/msp
CORE_PEER_TLS_ROOTCERT_FILE
=
$CORE_PEER_TLS_ROOTCERT_FILE
peer chaincode invoke
-C
$CHANNEL_NAME
-n
$CHAINCODE_NAME
-c
$INVOKE_PARAMS
-o
${
ORDERER_HOST
}
:7050
--tls
--cafile
${
CORE_PEER_TLS_ROOTCERT_FILE
}
articonf-bank-chaincode/bank_chaincode/src/.eslintignore
0 → 100644
View file @
45230e05
#
# SPDX-License-Identifier: Apache-2.0
#
coverage
articonf-bank-chaincode/bank_chaincode/src/.eslintrc.js
0 → 100644
View file @
45230e05
/*
* SPDX-License-Identifier: Apache-2.0
*/
'use strict'
;
module
.
exports
=
{
env
:
{
node
:
true
,
mocha
:
true
},
parserOptions
:
{
ecmaVersion
:
8
,
sourceType
:
'script'
},
extends
:
'eslint:recommended'
,
rules
:
{
indent
:
[
'error'
,
'tab'
],
'linebreak-style'
:
[
'error'
,
'unix'
],
quotes
:
[
'error'
,
'single'
],
semi
:
[
'error'
,
'always'
],
'no-unused-vars'
:
[
'error'
,
{
args
:
'none'
}],
'no-console'
:
'off'
,
curly
:
'error'
,
eqeqeq
:
'error'
,
'no-throw-literal'
:
'error'
,
strict
:
'error'
,
'no-var'
:
'error'
,
'dot-notation'
:
'error'
,
'no-trailing-spaces'
:
'error'
,
'no-use-before-define'
:
'error'
,
'no-useless-call'
:
'error'
,
'no-with'
:
'error'
,
'operator-linebreak'
:
'error'
,
yoda
:
'error'
,
'quote-props'
:
[
'error'
,
'as-needed'
]
}
};
articonf-bank-chaincode/bank_chaincode/src/index.js
0 → 100644
View file @
45230e05
/*
* Copyright IBM Corp. All Rights Reserved.
*
*
* SPDX-License-Identifier: Apache-2.0
*/
'use strict'
;
const
CC
=
require
(
'./lib/chaincode.js'
);
module
.
exports
.
CC
=
CC
;
module
.
exports
.
contracts
=
[
CC
];
articonf-bank-chaincode/bank_chaincode/src/lib/META-INF/statedb/couchdb/indexes/indexOwner.json
0 → 100644
View file @
45230e05
{
"index"
:{
"fields"
:[
"docType"
,
"owner"
]},
"ddoc"
:
"indexOwnerDoc"
,
"name"
:
"indexOwner"
,
"type"
:
"json"
}
articonf-bank-chaincode/bank_chaincode/src/lib/chaincode.js
0 → 100644
View file @
45230e05
/*
* Copyright IBM Corp. All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
"use strict"
;
const
{
Contract
}
=
require
(
"fabric-contract-api"
);
class
bankChaincode
extends
Contract
{
async
InitLedger
(
ctx
)
{
const
assets
=
[
{
ID
:
"demo1"
,
Balance
:
1000
,
Type
:
"Initial Credit"
,
},
{
ID
:
"demo2"
,
Balance
:
100
,
Type
:
"Initial Credit"
,
},
];
for
(
const
asset
of
assets
)
{
asset
.
docType
=
"asset"
;
await
ctx
.
stub
.
putState
(
asset
.
ID
,
Buffer
.
from
(
JSON
.
stringify
(
asset
)));
console
.
info
(
`User
${
asset
.
ID
}
initialized`
);
}
}
// CreateAsset issues a new asset to the world state with given details.
async
CreateAsset
(
ctx
,
id
,
balance
,
type
)
{
const
asset
=
{
ID
:
id
,
Balance
:
balance
,
Type
:
type
,
};
return
ctx
.
stub
.
putState
(
id
,
Buffer
.
from
(
JSON
.
stringify
(
asset
)));
}
// ReadAsset returns the asset stored in the world state with given id.
async
ReadAsset
(
ctx
,
id
)
{
const
assetJSON
=
await
ctx
.
stub
.
getState
(
id
);
// get the asset from chaincode state
if
(
!
assetJSON
||
assetJSON
.
length
===
0
)
{
throw
new
Error
(
`The user
${
id
}
does not exist`
);
}
return
assetJSON
.
toString
();
}
// UpdateAsset updates an existing asset in the world state with provided parameters.
async
UpdateAsset
(
ctx
,
id
,
balance
,
type
)
{
const
exists
=
await
this
.
AssetExists
(
ctx
,
id
);
if
(
!
exists
)
{
throw
new
Error
(
`The user
${
id
}
does not exist`
);
}
// overwriting original asset with new asset
const
updatedAsset
=
{
ID
:
id
,
Balance
:
balance
,
Type
:
type
,
};
return
ctx
.
stub
.
putState
(
id
,
Buffer
.
from
(
JSON
.
stringify
(
updatedAsset
)));
}
// DeleteAsset deletes an given asset from the world state.
async
DeleteAsset
(
ctx
,
id
)
{
const
exists
=
await
this
.
AssetExists
(
ctx
,
id
);
if
(
!
exists
)
{
throw
new
Error
(
`The user
${
id
}
does not exist`
);
}
return
ctx
.
stub
.
deleteState
(
id
);
}
// AssetExists returns true when asset with given ID exists in world state.
async
AssetExists
(
ctx
,
id
)
{
const
assetJSON
=
await
ctx
.
stub
.
getState
(
id
);
return
assetJSON
&&
assetJSON
.
length
>
0
;
}
// TransferAsset updates the owner field of asset with given id in the world state.
async
TransferAsset
(
ctx
,
id
,
newOwner
)
{
const
assetString
=
await
this
.
ReadAsset
(
ctx
,
id
);
const
asset
=
JSON
.
parse
(
assetString
);
asset
.
Owner
=
newOwner
;
return
ctx
.
stub
.
putState
(
id
,
Buffer
.
from
(
JSON
.
stringify
(
asset
)));
}
// GetAsset returns the asset stored in the world state with given id.
async
GetAsset
(
ctx
,
id
)
{
const
assetJSON
=
await
ctx
.
stub
.
getState
(
id
);
// get the asset from chaincode state
if
(
!
assetJSON
||
assetJSON
.
length
===
0
)
{
throw
new
Error
(
`The user
${
id
}
does not exist`
);
}
return
assetJSON
;
}
// TransferAsset updates the owner field of asset with given id in the world state.
async
TransferBalance
(
ctx
,
from_id
,
to_id
,
amount
,
reason
)
{
const
from_asset_string
=
await
this
.
ReadAsset
(
ctx
,
from_id
);
const
to_asset_string
=
await
this
.
ReadAsset
(
ctx
,
to_id
);
let
from_asset
=
JSON
.
parse
(
from_asset_string
);
let
to_asset
=
JSON
.
parse
(
to_asset_string
);
console
.
log
(
"from_asset"
);
console
.
log
(
from_asset
);
console
.
log
(
"to_asset"
);
console
.
log
(
to_asset
);
let
from_balance
=
parseInt
(
from_asset
[
"Balance"
].
toString
());
let
to_balance
=
parseInt
(
to_asset
[
"Balance"
].
toString
());
let
transfer_amount
=
parseInt
(
amount
);
let
updated_from_balance
=
from_balance
-
transfer_amount
;
let
updated_to_balance
=
to_balance
+
transfer_amount
;
if
(
updated_from_balance
<
0
)
{
throw
new
Error
(
`The user
${
from_id
}
does not have sufficient balance`
);
}
else
{
await
this
.
UpdateAsset
(
ctx
,
from_id
,
updated_from_balance
,
"Debit - "
+
reason
);
await
this
.
UpdateAsset
(
ctx
,
to_id
,
updated_to_balance
,
"Credit - "
+
reason
);
}
}
// GetAssetHistory returns the chain of custody for an asset since issuance.
async
GetAssetHistory
(
ctx
,
assetName
)
{
let
resultsIterator
=
await
ctx
.
stub
.
getHistoryForKey
(
assetName
);
let
results
=
await
this
.
GetAllResults
(
resultsIterator
,
true
);
return
JSON
.
stringify
(
results
);
}
// GetAllAssets returns all assets found in the world state.
async
GetAllAssets
(
ctx
)
{
const
allResults
=
[];
// range query with empty string for startKey and endKey does an open-ended query of all assets in the chaincode namespace.
const
iterator
=
await
ctx
.
stub
.
getStateByRange
(
""
,
""
);
let
result
=
await
iterator
.
next
();
while
(
!
result
.
done
)
{
const
strValue
=
Buffer
.
from
(
result
.
value
.
value
.
toString
()).
toString
(
"utf8"
);
let
record
;
try
{
record
=
JSON
.
parse
(
strValue
);
}
catch
(
err
)
{
console
.
log
(
err
);
record
=
strValue
;
}
allResults
.
push
({
Key
:
result
.
value
.
key
,
Record
:
record
});
result
=
await
iterator
.
next
();
}
return
JSON
.
stringify
(
allResults
);
}
async
GetAllResults
(
iterator
,
isHistory
)
{
let
allResults
=
[];
let
res
=
await
iterator
.
next
();
while
(
!
res
.
done
)
{
if
(
res
.
value
&&
res
.
value
.
value
.
toString
())
{
let
jsonRes
=
{};
console
.
log
(
res
.
value
.
value
.
toString
(
"utf8"
));
if
(
isHistory
&&
isHistory
===
true
)
{
jsonRes
.
TxId
=
res
.
value
.
tx_id
;
jsonRes
.
Timestamp
=
res
.
value
.
timestamp
;
try
{
jsonRes
.
Value
=
JSON
.
parse
(
res
.
value
.
value
.
toString
(
"utf8"
));
}
catch
(
err
)
{
console
.
log
(
err
);
jsonRes
.
Value
=
res
.
value
.
value
.
toString
(
"utf8"
);
}
}
else
{
jsonRes
.
Key
=
res
.
value
.
key
;
try
{
jsonRes
.
Record
=
JSON
.
parse
(
res
.
value
.
value
.
toString
(
"utf8"
));
}
catch
(
err
)
{
console
.
log
(
err
);
jsonRes
.
Record
=
res
.
value
.
value
.
toString
(
"utf8"
);
}
}
allResults
.
push
(
jsonRes
);
}
res
=
await
iterator
.
next
();
}
iterator
.
close
();
return
allResults
;
}
}
module
.
exports
=
bankChaincode
;
articonf-bank-chaincode/bank_chaincode/src/package.json
0 → 100644
View file @
45230e05
{
"name"
:
"smart-bank-chaincode"
,
"version"
:
"1.0.0"
,
"description"
:
"smart bank chaincode implemented in node.js"
,
"main"
:
"index.js"
,
"engines"
:
{
"node"
:
">=12"
,
"npm"
:
">=5.3.0"
},
"scripts"
:
{
"start"
:
"fabric-chaincode-node start"
},
"engine-strict"
:
true
,
"license"
:
"Apache-2.0"
,
"dependencies"
:
{
"fabric-contract-api"
:
"^2.0.0"
,
"fabric-shim"
:
"^2.0.0"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment