-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Add developing chaincode tutorial
See #127 Signed-off-by: James Taylor <[email protected]>
- Loading branch information
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,56 @@ | ||
# Developing and debuging chaincode | ||
|
||
TODO: Check chaincode/contract api implementations all support automatic switching between client and server mode... | ||
- [Go contracts](https://github.com/hyperledger/fabric-contract-api-go/commit/7c7666d5dd3bdc23ace194784d123697669a3558)✅ | ||
- Java (tbc) | ||
- Node (tbc) | ||
|
||
|
||
Use ccaas.env file? Might be easier to set chaincode ID outside file? | ||
|
||
``` | ||
# CHAINCODE_SERVER_ADDRESS must be set to the host and port where the peer can | ||
# connect to the chaincode server | ||
CHAINCODE_SERVER_ADDRESS= | ||
# CHAINCODE_ID must be set to the Package ID that is assigned to the chaincode | ||
# on install. The `peer lifecycle chaincode queryinstalled` command can be | ||
# used to get the ID after install if required | ||
CHAINCODE_ID= | ||
# Optional parameters that will be used for TLS connection between peer node | ||
# and the chaincode. | ||
# TLS is disabled by default, uncomment the following line to enable TLS connection | ||
# CHAINCODE_TLS_DISABLED=false | ||
# Following variables will be ignored if TLS is not enabled. | ||
# They need to be in PEM format | ||
# CHAINCODE_TLS_KEY=/path/to/private/key/file | ||
# CHAINCODE_TLS_CERT=/path/to/public/cert/file | ||
# The following variable will be used by the chaincode server to verify the | ||
# connection from the peer node. | ||
# Note that when this is set a single chaincode server cannot be shared | ||
# across organizations unless their root CA is same. | ||
# CHAINCODE_CLIENT_CA_CERT=/path/to/peer/organization/root/ca/cert/file | ||
``` | ||
|
||
Run the chaincode... use docker? What networking would be required to get to peer inside k8s test network? | ||
|
||
``` | ||
docker pull ghcr.io/hyperledger-labs/fabric-builder-k8s/sample-go-contract:latest | ||
docker pull ghcr.io/hyperledger-labs/fabric-builder-k8s/sample-node-contract:latest | ||
docker pull ghcr.io/hyperledger-labs/fabric-builder-k8s/sample-java-contract:latest | ||
``` | ||
|
||
``` | ||
docker run -it --rm --name sample-contract --env-file ccaas.env ghcr.io/hyperledger-labs/fabric-builder-k8s/sample-go-contract | ||
``` | ||
|
||
TBC, that seemed to run the peer!!! | ||
|
||
Maybe don't use docker! :) | ||
|
||
See also: | ||
- https://github.com/hyperledger/fabric-samples/blob/main/full-stack-asset-transfer-guide/docs/SmartContractDev/03-Test-And-Debug-Reference.md | ||
|
This file contains 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 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,24 @@ | ||
# CHAINCODE_SERVER_ADDRESS must be set to the host and port where the peer can | ||
# connect to the chaincode server | ||
CHAINCODE_SERVER_ADDRESS=localhost | ||
|
||
# CHAINCODE_ID must be set to the Package ID that is assigned to the chaincode | ||
# on install. The `peer lifecycle chaincode queryinstalled` command can be | ||
# used to get the ID after install if required | ||
CHAINCODE_ID=test | ||
|
||
# Optional parameters that will be used for TLS connection between peer node | ||
# and the chaincode. | ||
# TLS is disabled by default, uncomment the following line to enable TLS connection | ||
# CHAINCODE_TLS_DISABLED=false | ||
|
||
# Following variables will be ignored if TLS is not enabled. | ||
# They need to be in PEM format | ||
# CHAINCODE_TLS_KEY=/path/to/private/key/file | ||
# CHAINCODE_TLS_CERT=/path/to/public/cert/file | ||
|
||
# The following variable will be used by the chaincode server to verify the | ||
# connection from the peer node. | ||
# Note that when this is set a single chaincode server cannot be shared | ||
# across organizations unless their root CA is same. | ||
# CHAINCODE_CLIENT_CA_CERT=/path/to/peer/organization/root/ca/cert/file |