-
Notifications
You must be signed in to change notification settings - Fork 98
Feature/integrate with cc tools #779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mbrandenburger
merged 44 commits into
hyperledger:main
from
osamamagdy:feature/integrate-with-cc-tools
Dec 3, 2024
Merged
Changes from 14 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
9994daa
feat: integrate with cc-tools-demo
osamamagdy c6b9259
fix: resolve conflict
osamamagdy 5bf43ed
fix: export FPC and CCAAS envs
osamamagdy f369725
feat: ccapi is working
osamamagdy 1f860dc
add uodate external connection script
osamamagdy a13460d
handle corner cases
osamamagdy 8892936
edit script
osamamagdy c395ce2
add cc-tools-demo tutorial
osamamagdy 2838217
add readme for the cc-tools-demo tutorial
osamamagdy 237a3b1
rename ccapi and FPC_MODE
osamamagdy 9bf539a
fixing documentation
osamamagdy db0cb7f
edit
osamamagdy a064eb0
fix: fix go.mod
osamamagdy 5ed35d4
fix: upgrade fabric-sdk-go
osamamagdy 8250fbf
fix: resolve comments
osamamagdy 1ec09a9
revert go.mod and go.sum changes
osamamagdy ed720cd
fix: revert changes of the protos
osamamagdy 171ea9c
fix: add the right ccapi
osamamagdy 57a9ff3
fix: return Error for not implemented functions
osamamagdy c710be0
docs: add tutorial for ccapi
osamamagdy ae668f1
comments resolved
osamamagdy 1ae8062
Merge branch 'main' into feature/integrate-with-cc-tools
osamamagdy 934b941
move ccapi to another PR
osamamagdy e027bcf
fix: edit error message
osamamagdy 3c62109
fix: ignore the linter for protobuf
osamamagdy cdbf3d8
feat: edit readme
osamamagdy 6d8ac47
Merge branch 'feature/integrate-with-cc-tools' of https://github.com/…
osamamagdy 5f5eaa9
fix: update makefile variable setting
osamamagdy 60efa3a
docs: add note about org names
osamamagdy 63fe3dd
Merge branch 'main' into feature/integrate-with-cc-tools
osamamagdy 8bd3cfd
docs: edit readme
osamamagdy 31d982d
fix: rename enclave.json
osamamagdy ae77fce
fix: edit readme
osamamagdy 9c485b8
fix: remove unwanted step
osamamagdy 99ab55e
docs: edit note
osamamagdy 1085cd2
chore: change ccToolsDemoEnclave.json path
osamamagdy 42f1fef
feat: pass file paths to Makefile from terminal
osamamagdy c3150b6
fix: edit readme notes
osamamagdy e11d630
feat: relocate extra compose file
osamamagdy 06e1453
fix: sudo commands
osamamagdy 62409a0
Update samples/chaincode/cc-tools-demo/README.md
osamamagdy d16dc4b
Update samples/chaincode/cc-tools-demo/README.md
osamamagdy 2e80ab2
fix: fix typo
osamamagdy a23c4c1
feat: add setup script
osamamagdy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,3 +9,4 @@ cscope.* | |
| common/protos | ||
| internal/protos | ||
| coverage.out | ||
| vendor | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| # ############################## Commands in order ####################################### | ||
|
|
||
|
|
||
| # ################################### For CC-tools inside the fpc | ||
|
|
||
| # - Copy all chaincode files using the same way as simple-asset-go | ||
| # - replace the "CHAINCODE_ID" env with "CHAINCODE_PKG_ID" in main.go | ||
| # - Run `go get` inside the cc-tools-demo folder after putting it inside the fpc repo | ||
| # ------ There are huge problem with using FPC outside the FPC repository. Even go get doesn't work and you need to specify a certain version and there are conflicting packages-----------------' | ||
| # # - You have to add dummy implementation for the PurgePrivate data method in the MockStup of cc-tools but be careful you need to do it in the package installed inside the FPC dev env not your local | ||
| # # For example do: vim /project/pkg/mod/github.com/hyperledger-labs/cc-tools@v1.0.0/mock/mockstub.go and add this: | ||
| # # // PurgePrivateData ... | ||
| # # func (stub *MockStub) PurgePrivateData(collection, key string) error { | ||
| # # return errors.New("Not Implemented") | ||
| # # }. | ||
| # # A good idea is to use go mod vendor and download all go packages in the vendor directory and edit it one time there. | ||
| # # nano $FPC_PATH/vendor/github.com/hyperledger-labs/cc-tools/mock/mockstub.go | ||
| # # // PurgePrivateData ... | ||
| # # func (stub *MockStub) PurgePrivateData(collection, key string) error { | ||
| # # return errors.New("Not Implemented") | ||
| # # } | ||
|
|
||
| cd $FPC_PATH/samples/deployment/test-network | ||
| docker compose down | ||
|
|
||
| cd $FPC_PATH/samples/deployment/test-network/fabric-samples/test-network | ||
| ./network.sh down | ||
| docker system prune | ||
| sleep 5 | ||
|
|
||
| cd $FPC_PATH/samples/chaincode/cc-tools-demo/ | ||
| export CC_NAME=fpc-cc-tools-demo | ||
| make | ||
|
|
||
| # - run docker images | grep fpc-cc-tools-demo to make sure of the image | ||
| # - complete the tutorial normally: | ||
| cd $FPC_PATH/samples/deployment/test-network | ||
| ./setup.sh | ||
|
|
||
| cd $FPC_PATH/samples/deployment/test-network/fabric-samples/test-network | ||
| ./network.sh up createChannel -ca -c mychannel | ||
| sleep 5 | ||
|
|
||
| export CC_ID=cc-tools-demo | ||
| export CC_PATH="$FPC_PATH/samples/chaincode/cc-tools-demo/" | ||
| export CC_VER=$(cat "$FPC_PATH/samples/chaincode/cc-tools-demo/mrenclave") | ||
|
|
||
| cd $FPC_PATH/samples/deployment/test-network | ||
| ./installFPC.sh | ||
| sleep 5 | ||
| make ercc-ecc-start | ||
| sleep 5 | ||
|
|
||
| # # prepare connections profile | ||
| cd $FPC_PATH/samples/deployment/test-network | ||
| ./update-connection.sh | ||
|
|
||
| # # update the connection profile for external clients outside the fpc dev environment | ||
| cd $FPC_PATH/samples/deployment/test-network | ||
| ./update-external-connection.sh | ||
|
|
||
| # make fpcclient | ||
| cd $FPC_PATH/samples/application/simple-cli-go | ||
| make | ||
|
|
||
| # export fpcclient settings | ||
| export CC_NAME=cc-tools-demo | ||
| export CHANNEL_NAME=mychannel | ||
| export CORE_PEER_ADDRESS=localhost:7051 | ||
| export CORE_PEER_ID=peer0.org1.example.com | ||
| export CORE_PEER_LOCALMSPID=Org1MSP | ||
| export CORE_PEER_MSPCONFIGPATH=$FPC_PATH/samples/deployment/test-network/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp | ||
| export CORE_PEER_TLS_CERT_FILE=$FPC_PATH/samples/deployment/test-network/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt | ||
| export CORE_PEER_TLS_ENABLED="true" | ||
| export CORE_PEER_TLS_KEY_FILE=$FPC_PATH/samples/deployment/test-network/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key | ||
| export CORE_PEER_TLS_ROOTCERT_FILE=$FPC_PATH/samples/deployment/test-network/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt | ||
| export ORDERER_CA=$FPC_PATH/samples/deployment/test-network/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem | ||
| export GATEWAY_CONFIG=$FPC_PATH/samples/deployment/test-network/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/connection-org1.yaml | ||
|
|
||
| sleep 5 | ||
| # init our enclave | ||
| ./fpcclient init $CORE_PEER_ID | ||
| sleep 5 | ||
| # invoke the getSchema transaction which is implemented internally by cc-tools | ||
| ./fpcclient invoke getSchema | ||
|
|
||
| ########################## Some transactions to test #################################### | ||
| # sleep 5 | ||
| # ./fpcclient invoke createNewLibrary "{\"name\":\"samuel\"}" | ||
| # sleep 5 | ||
| # ./fpcclient invoke createAsset "{\"asset\":[{\"@assetType\":\"person\",\"id\":\"51027337023\",\"name\":\"samuel\"}]}" | ||
| # sleep 5 | ||
| # ./fpcclient invoke createAsset "{\"asset\":[{\"@assetType\":\"book\", \"title\": \"Fairy tail\" ,\"author\":\"Martin\",\"currentTenant\":{\"@assetType\": \"person\", \"@key\": \"person:f6c10e69-32ae-5dfb-b17e-9eda4a039cee\"}}]}" | ||
| # sleep 5 | ||
| # ./fpcclient invoke getBooksByAuthor "{\"authorName\":\"samuel\"}" # --> Fails as GetQueryResult is not implemented. I tried to implement it but the fabric implementation needs what's called handler and it's not ther | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.