- Updates `bn.js` from 4.12.0 to 4.12.3
- Updates `minimatch` from 3.1.2 to 3.1.5
- Updates `@angular/core` from 14.3.0 to 21.2.0
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Updates `js-yaml` from 3.14.1 to 3.14.2
- Updates `axios` from 1.11.0 to 1.13.5
- Updates `body-parser` from 2.2.0 to 2.2.2
- Updates `lodash` from 4.17.21 to 4.17.23
- Updates `qs` from 6.14.0 to 6.15.0
- Updates `tmp` from 0.0.33 to 0.2.5
- Updates `validator` from 13.11.0 to 13.15.26
- Updates `@angular/common` from 14.3.0 to 21.1.5
- Updates `@angular/compiler` from 14.3.0 to 21.1.5
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Updates to ESLint v10 and fixes lint failures.
- Aligns tsconfig on Node 20, which is the current minimum required Node
version.
- Adds package-lock.json files to source control to avoid future random
failures when dependencies update.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Updates `github.com/sirupsen/logrus` from 1.9.0 to 1.9.1
Updates `golang.org/x/crypto` from 0.40.0 to 0.45.0
Updates `github.com/sirupsen/logrus` from 1.8.1 to 1.8.3
Updates `github.com/consensys/gnark-crypto` from 0.12.1 to 0.18.1
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This PR replaces deprecated containerd registry.mirrors configuration with
config_path mode and hosts.toml, required for containerd 2.x
(KIND v0.27.0+). The old configuration prevents the CRI plugin
from loading, causing kubelet to fail on startup.
Also, this fixes CA enrollment in create_node_local_MSP() to specify
port 443 explicitly, and other minor issues, including removing
redundant throws from Java close() methods.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Co-authored-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Empty Docker Conpose YAML files can cause errors with old Docker Compose
versions due to bugs in their YAML handling. Since these files are empty
and have no functional purpose, this change removes the files and
references to them in scripts.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The Fabric Gateway client API v1.10.0 provides simplified access to Go
error details. This change updates sample client application to use this
latest version of the client API, and updates Go client applications to
reflect the error handling changes.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The build is only testing the Go chaincode for the
asset-transfer-private-data sample. The behavior of the TypeScript
chaincode implementation is not consistent with the Go and Java
versions, which prevents it from working correctly.
This change fixes the TypeScript chaincode implementation for the
asset-transfer-private-data sample so that it works correctly.
Additionally, some JSON property names are explicitly set in the Go
client application sample, which prevented it from working with the Java
and TypeScript chaincode implementations.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The version element is obsolete and unused since Compose v1 was
deprecated in favour of Compose v2 in 2022, and reached end-of-life in
2023. The version element generates warning messages running Docker
Compose commands when bringing up and down the test-network, which
adds unnecessary noise and can be confusing for users.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
- Node latest LTS
- Go latest stable
- Fabric 2.5.14, 3.1.3
- Just 1.43.0
- k9s 0.50.15
- Kind 0.30.0
- yq 4.48.1
- nvm 0.40.3
This addresses build breakages due to back-level versions.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
- Update Gradle to 9.1.0.
- Update shadow plugin to 9.2.2.
- Requires a minimum of Java 17 to run Gradle.
- Chaincode and applications still target Java 11.
- Use release option instead of Gradle toolchain since the toolchain
download can cause issues when building Docker images.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Build failures because the startFabric.sh script specified that the
chaincode required initialization, which is both legacy behavior and is
unnecessary.
The chaincode is updated to use the Contract API instead of the legacy /
low-level chaincode API. The client application is also simplified.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The CI script invoked Gradle directly, which could picker newer Gradle
versions not compatible with the build definition. This change uses the
Gradle wrapper included in the client application sample.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
- Updates `golang.org/x/net` from 0.34.0 to 0.38.0
- Updates `github.com/getkin/kin-openapi` from 0.120.0 to 0.131.0
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Updates `golang.org/x/net` from 0.38.0 to 0.42.0
- Updates `google.golang.org/protobuf` from 1.33.0 to 1.36.6
- Updates `github.com/golang/glog` from 1.2.4 to 1.2.5
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The high-throughput sample used the deprecated Go SDK. This change
updates the sample to use the currently supported Fabric Gateway client
API and adds some automated testing to ensure the sample works
correctly.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Node 20+ is now required. This is the oldest currently support LTS
version of Node.js.
Docker images are moved to Node 22, which is the current LTS release.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Add some methods to the parsing API within the Go off_chain_data sample
for consistency with the Node and Java implementations:
- ToProto() on Block, Transaction and NamespaceReadWriteSet.
- ValidationCode() on Transaction.
- Creator() on Transaction
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Make the CA script logging more readable for users
trying to understand the fabric-ca-client commands.
Print the actual command to the log and remove the
debug logging which adds noise.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Use the operations service health check to detect when nodes are started
in test-network-nano-bash instead of using arbitrary sleeps. Depending
on the host machine and whether CAs are used, this can reduce network
start time by up to 15 seconds.
Also ensure the Docker socket location is set correctly for Docker
contexts that use a non-default location. This is required to prevent
the health service from returning Docker connection errors.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
This commit implements the TypeScript version of the asset-transfer-ledger-queries Chaincode.
Resolves#1232
Signed-off-by: Satoshi Ito <satoshi.ito.tf@hitachi.com>
This patch bumps fabric to v2.5.12.
It also updates some parts of fabric-ca that were missed in the previous update.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
By default, Docker images are referenced from Docker Hub. This has now
applied rate limiting that is causing builds to fail. Current Fabric
v2.5 and chaincode container Docker images are also published to GitHub
Container Registry, which does not impose rate limits and will be
located closer to the GitHub Actions runners.
This change:
- Updates to latest Fabric component versions, which are available in
GHCR. The Fabric install script defaults to GHCR as the Docker
registry for versions that are available here.
- Pulls and re-tags chaincode container images from GHCR in advance of
running tests in the build. This avoids them being pulled from Docker
Hub during test execution.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
If CA server hasn't finished initialization then the initial register and enroll requests will fail.
Instead of waiting 3 seconds, actually check if CA service is ready.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
If CA server hasn't finished initialization then the initial
register and enroll requests will fail.
Waiting 3 seconds resolves the issue.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Fix test-network-nano-bash orderer4 enrollment.
Also improve error handling and messages in CA interaction.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
test-network-nano-bash is often used with locally built
fabric and fabric-ca binaries.
As such the intent is to first look for locally
built binaries and then fall back to binaries downloaded
with the samples.
This was correct for fabric binaries but not the fabric-ca binaries.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This patch adds BFT Orderer testing to the CI workflows.
The following test environments are updated:
- test-network
- test-network-k8s
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch adds initial support for BFT orderers in the test-network-k8s.
When `TEST_NETWORK_ORDERER_TYPE` is set to `bft`, the network launches
four orderers configured with SmartBFT.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
The existing orderer configuration file is incompatible with v3.0,
and the v3.0 configuration does not work with v2.5.
To support both versions, configuration settings have been updated to
use environment variables instead of referencing static configuration
files.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
The shadow plugin is now maintained by the GradleUp organization. Change
to use the current plugin ID and latest version.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
A behaviour change in microfab means that the orderer endpoint needs to
be explicitly specified when using the peer CLI to submit transactions.
Ideally the microfab environment would not require this but the
documented commands do not currently work without this.
This change updates the full-stack-asset-transfer-guide documentation so
that CLI commands include the orderer endpoint explicitly.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The new microfab release seems to start slower than the previous
release. This might be due to a change from solo to raft consensus. This
causes failures in the full-stack-asset-transfer appdev tests. Chaincode
deployment fails since the channel is not yet available.
Instead of increasing the sleep time after launching microfab, this
change attempts to wait however long is required by looking for the
"Microfab started" message in the container log before proceeding.
The test script is also updated to correctly stop the external chaincode
process when the script exits. Previously the process ID of the npm
command used to lauch the chaincode was captured rather than the actual
chaincode process.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Update maintainers to reflect activty from the past year.
- Retire Josh Kneubuhl, Matthew White, Arnaud Le Hors, Nikhil Gupta.
- Add Mark Lewis
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This patch updates chaincode container versions to 2.5 in the following
samples:
- test-network-k8s
- full-stack-asset-transfer-guide
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
The test-network peer configuration specifies $(TWO_DIGIT_VERSION) as
the tag for the Node and Java chaincode containers. For Fabric v3.0,
this requests fabric-nodeenv:3.0 and fabric-javaenv:3.0 Docker images to
host Node and Java chaincode respectively. These images do not exist,
which causes deployment of Node and Java chaincode to fail when using
Fabric v3.0. Fabric v3.0 continues to use fabric-nodeenv:2.5 and
fabric-javaenv:2.5.
This change updates the test-network peer configuration to explicitly
specify `2.5` as the Node and Java chaincode Docker image tags. This is
(currently) the correct version for both Fabric v2.5 and Fabric v3.0.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Created project directory, app.go and connect.go files. Reused the logic for
connect.go from the events application and added second organization setup.
Implemented private data transaction example in go as described in the main
documentation in "Tutorials/Using Private Data in Fabric".
Updated README.md with the command to run the go application and the script
which runs the application in the Github Actions workflow.
Fixed typos and punctuation in the private data typescript application.
Signed-off-by: Stanislav Jakuschevskij <stas@two-giants.com>
The latest fabric-gateway client API release (v1.7.0) includes the gRPC error
details in the GatewayExcetion stack trace so it is not necessary to
programmatically access them to demonstrate that they are present.
This change updates the asset-transfer-basic/application-gateway-java
sample to simplify the updateNonExistentAsset example method. It also:
- Updates all samples to use the latest fabric-gateway release.
- Adds equivalent Maven POM files for fabric-gateway application samples.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The repository currently uses Go 1.22 to test samples in the automated
build. This change sets the Go version in all go.mod (and go.work) files
to Go 1.22.0, and removes any Go toolchain entries.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
For some signing implementations, such as ed25519, a non-default hash
implementation must be specified when creating the Gateway connection in
client applications. Rather than relying on the default hash algorithm,
it is probably good practice in general to specify an algorithm that is
compatible with your signing implementation.
This change explicitly specifies the hash algorithm to raise visibility
of the option to select the hash algorithm.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Since Fabric v3.0 builds on ubuntu 22.04,
it is necessary for samples CI to run on ubuntu 22.04.
Both Fabric v2.5 components (ubuntu 20.04) and
Fabric v3.0 components (ubuntu 22.04) work on
ubuntu 22.04 runtime.
The update also requires shell script updates to pass linting.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This patch improves prereqs logic in test-network-k8s.
- Use the newer install script instead of bootstrap.sh
- Download binaries matching the Docker image versions, instead of the latest version
- Add checks for Fabric versions to ensure consistency between images and binaries
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Add document about how to benchmark the performance using Hyperledger Caliper
Signed-off-by: takayuki-nagai <takayuki.nagai.nu@hitachi.com>
Co-authored-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
While the TypeScript application sample is essentially identical (with
the addition of some type declarations), there seems to be sufficient
uncertainty amongst JavaScript developers not familiar with TypeScript
on how best to implement a JavaScript application that it is worthwhile
having one plain JavaScript sample using the current client API.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
The removed samples make use of deprecated legacy client SDKs. They all
have equivalent samples implemented using the currently supported Fabric
Gateway client API, and are therefore redundant.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
- Dependency updates
- ESLint flat configuration format, replacing deprecated configuration
- Minor fixes to compile and lint issues
- Consistent TypeScript formatting with .editorconfig
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
- Correct sh compability in ca_utils.sh
- Correct linux compatibility in external builder
Signed-off-by: Chris Elder <celder628@gmail.com>
Signed-off-by: Chris Elder <celder@Chriss-MacBook-Pro.local>
This demonstrates good practice in restricting the chaincode package
versions to those applicable for the specific Fabric (major/minor)
version targeted for deployment.
Also some corrections to the repository README. Particularly referring
to other branches for samples targeted at earlier Fabric versions, since
samples in the main branch may exploit features not available in older
Fabric releases, which can cause confusion for end users.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
This change adds:
- shell scripts to start CAs for each org
- optional flag (-c) to network.sh to start CAs
- generate crypto material in the same format as cryptogen using the CAs
- describe how to start the CAs using terminals
Signed-off-by: Chris Elder <celder@chriss-mbp.raleigh.ibm.com>
Add required permissions for upcoming k8s builder release
Also adds ttl to install jobs and configures the k8s builder prefix
Signed-off-by: James Taylor <jamest@uk.ibm.com>
This resolves mocking errors using the latest Java chaincode shim and
very old versions of Mockito.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
full-stack-asset-transfer points to an old image
that no longer exists.
Point to the hyperledger-labs microfab image instead.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
With removal of fabric-tools image, test-network
now depends on jq being installed locally.
This commit logs an error message if jq commands
fail due to jq not being installed locally.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Fix regression in network.sh and update peer scripts to allow
chaincodeListenAddress and chaincodeAddress to be overridden if
required
Also updates the nano test network readme to describe the new
environment variables for the k8s builder
Fixes#1198
Signed-off-by: James Taylor <jamest@uk.ibm.com>
This patch aims to refactor the test-network in several aspects,
following the decoupling of the fabric-tools image from fabric-samples.
- Rename 'test_network_home' env var to 'TEST_NETWORK_HOME'
- Dedicate the intermediate artifacts related to configtx to
channel-artifacts
- Refer to core.yaml in fabric-samples/config, similar to org1 and 2,
instead of adding a new core file
- Remove unnecessary functions and comments for CLI container
- Other minor modifications
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Change shell script to use single equals.
In my shell environment single bracket with double equals did not work.
It caused failure when running the chaincode-external tutorial README.
It looks like for maximum portability, it is best to use single bracket with single equals.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Allow client applications to work regardless of whether network was creating using a CA or cryptogen since they create different client certificate file names.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
* add support for docker compose v2 (fix#730)
Signed-off-by: uniform64 <jiny2048@gmail.com>
* add support for docker compose v2 (fix#730)
some missing places in the previous commit
Signed-off-by: uniform64 <jiny2048@gmail.com>
---------
Signed-off-by: uniform64 <jiny2048@gmail.com>
The default ForkJoinPool.commonPool may have limited capacity in some environments, risking deadlock. This implementation also better demonstrates handling of connection errors.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
Resolves a regression introduced in e73bb717db.
Previous change defaulted to "auto" as the sequence number but omitted the call to generate the correct sequence number for the "auto" value. This resulted in "auto" being used as the sequence number, which is an error since an integer is required.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
This change is meant to help cover end user functionality
that was previously covered by the blockchain VSCode Plugin.
Functions added:
- cc mode with package, list chaincode, invoke and query functions
- auto sequencing for chaincode deployment
- move variables into config file
Signed-off-by: Chris Elder <celder@Chriss-MacBook-Air.local>
The originally used image of Hyperledger Fabric Ansible Collection was
not compatible with K8s v1.25.x. This patch replaces the image with
the latest hyperledger-labs/fabric-ansible-collection.
Additionally, deprecated notations in the latest Kustomize,
patchesJson and patchesStrategicMerge, have been replaced with the
recommended syntax to prevent ansible task execution failures.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch updates fabric-operator to utilize PodSecurity Admission
controller for Kubernetes v1.25.x.
This change is based on the following PR:
https://github.com/hyperledger-labs/fabric-operator/pull/82
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch updates the versions of software used in CI tests to the latest:
- Fabric
- GO
- KIND, kubectl
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch moves publishing of REST sample image from AZP to GHA.
This was the last job running on AZP.
Also, this patch fixes an error encounterd during the image build.
Publishing of REST sample image is now only executed when pushing to main.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
- Update to Node 16.
- Simplify SKI code using Node standard packages and avoiding use of jsrsasign.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
This patch fixes the description of orderer2-4 in OrdererEndpoints
in test-network's bft-config/configtx.yaml.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch includes:
- Fixed a minor bug in the parsing of the BFT flag
- Added check for when a user attempts to use BFT orderer in
Fabric network with CA
- Update of printHelp for use of the BFT flag
- Fixed explanations
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Added a new option for creating channel:
Running ./network.sh createChannel -bft will initiate a channel running BFT orderers.
Using ./network.sh up -bft will initiate dockers for bft environment.
Added option for 4 orderers.
Add add_new_orderer_to_config.py which is referenced in the fabric official docs.
Signed-off-by: Arkadi Piven <arkadi.piven@ibm.com>
Signed-off-by: arkadipiven <arkadi7770@gmail.com>
The general overflow judgment condition for function sub is not in every case.
The judgment result is wrong in the condition of b < 0 && q >=0
for example, b = -3, q = 2, diff = -5, it's not overflow,
but if (diff > b) == (b >= 0 && q >= 0) wil be true.
for another example, b = -3, q = maxint, b-q is overflow,
but if (diff > b) == (b >= 0 && q >= 0) wil be false.
Signed-off-by: yjwxfq <112159687+yjwxfq@users.noreply.github.com>
This patch extends the sleep time to wait for starting
nginx by following the description on
full-stack-asset-transfer-guide/justfile
to stabilize the intergration test
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
- Use calculatepackageid to set CHAINCODE_ID
- Use waitForEvent to wait for commit event intead of 2s sleep
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Tatsuya has been helping to groom fabric-samples for multiple years.
More recently, Tatsuya has helped to keep test-network-k8s
and full-stack-asset-transfer samples working well.
Tatsuya has expressed interest in becoming a maintainer and
I would welcome the addition!
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Signed-off-by: YunusEmreKarakose <yemre05@hotmail.com.tr>
Signed-off-by: Ry Jones <ry@linux.com>
Signed-off-by: yunusemrekarakose <yemre05@hotmail.com.tr>
This patch updates full-stack-asset-transfer to Fabric 2.5 by default.
In particular, since k8s-builder-peer is set as the default value for
peer image, it needs to be updated to use 0.11.0, which is derived
from Fabric v2.5 image, as the version default value.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch updates k8s CC builder to 0.11.0 to resolve the
distribution mismatch between k8s-builder base image and fabric-peer
base image.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Include specific gRPC TLS implementation in dependencies instead of relying on an appropriate one to be present as a transitive dependency.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
- Set correct CERTIFICATE file name in application ChaincodeEvents exercise.
- Add required environment variables to application AssetTransfer exercise, rather than rely on the RunApplication exercise being run in the same terminal first.
Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
A typo in the 10-appdev-e2e.sh script caused the shell to exit with an error status, and the killall command appears to match some key processes in the runner so removing.
Also:
- Update sample application and smart contract to Node 18, using the latest fabric-contact-api release.
- Use release versions of Fabric v2.5 and update tool versions in workflow set up.
- Use GitHub Action to install just instead of curl of install script.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Fix npm problems on asset-transfer-basic/chaincode-typescript
This patch fixes npm problems on
asset-transfer-basic/chaincode-typescript.
- Sync npm-shrinkwrap.json with package.json to fix the npm ci error
- Update the version of TypeScript to avoid the type error on logform
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
* Update npm-shrinkwrap.json
Fix dependencies
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
---------
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Co-authored-by: Arnaud J Le Hors <lehors@us.ibm.com>
For the asset transfer example (https://hyperledger-fabric.readthedocs.io/en/release-2.5/private_data_tutorial.html#pd-use-case)
the are three private data collections, one per org and one shared between the orgs.
The shared collection didn't have an endorsement policy so inheritted the chaincodes; this was specifically set away from the default
to be OR(Org1MSP,Org2MSP). The documentation says this is to ensure that either organization can create and asset.
However this isn't really necassary, the endorsement policy should be lowest level; so this PR moves the endorsement policy to
the collection. The documentation does I believe lead to a false understanding
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Ensure that all sample applications return exit code 1 upon failure
so that github actions can report the failure.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Flag --csr.hosts is only relevant for tls enrollments, it adds the SAN to the TLS cert.
For msp enrollments, the cert is only used for identity, therefore there is no need for SAN and no need to pass --csr.hosts.
Having --csr.hosts for msp enrollments is misleading, this commit removes it.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Also:
- Tidy up README documentation.
- Add MacOS/Homebrew (Apple silicon) default SoftHSM library location to HSM scripts and sample applications to avoid the need to explicitly override the library location when running the sample.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Update go dependencies
Update go dependencies in sample chaincodes and applications
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* Update to Go 1.19.6
Update to Go 1.19.6
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
---------
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* Return exit(1) if application-java fails
If application-java fails, return an exit(1) code,
so that callers such as Github Actions CI can detect the failure.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* asset-transfer-basic CI improvements
- Application failure should result in CI failure
- Automatically remove wallet from prior runs
- Fix chaincode name issues, allow chaincode name to be passed from CI
- Fix appUser collisions (duplicate registration failures)
- Fix key create collisions across apps (in cases where same chaincode is used for multiple apps)
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
---------
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This patch fixes the gradle version used in asset-transfer-basic/
chaincode-java build to 7.
The reason is because the gradle version in the gradle:jdk11-alpine
image is updated from 7 to 8, which seems to cause the build to fail.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
The samples repository has been refactored to focus on an asset transfer series of samples.
The goal of the samples repository is to align with the fabric documentation tutorials
with minimal other distractions.
The heritage samples were left in place for a period of time until the asset transfer series stabilized.
It is now time to purge the heritage samples.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Rely on the dependencies of @hyperledger/fabric-gateway making these packages transitively available. Having explicit dependency versions in the application can cause type conflicts due to private member changes in the gRPC Client class across versions.
Also fix some missing or incorrect Node types and engines version contraints.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
The Commercial Paper example code hasn't kept pace with the state-of-the-art of writing applications and chaincode
Whilst the scenario is still a valid usecase, the example itself is not helping - in fact causing confusion.
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* Add in examples and notes on using PurgePrivateData
- Update the configtx.yaml to enable the 2.5 capabillity
- Added purge into the chancode
- Added pruge into the application client code.
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* Temporarily remove java cc test
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* run test suites with 2.5 binaries and images
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Swap to use the Helper Function to create policies (#907)
The old way used the direct protobuf functions, there is a helper function
in the chaincode does exactly that.
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Co-authored-by: Matthew B White <whitemat@uk.ibm.com>
The old way used the direct protobuf functions, there is a helper function
in the chaincode does exactly that.
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Late 2022 it was discovered that when used via the CA, the certificate had a fixed named covention. cert.pem
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Fixing TLS issues while using org1-peer-gateway-svc.${DOMAIN}.
This would be needed so there are no TLS issues when sending requests.
Signed-off-by: Deepak Singh <91736795+blockguardian@users.noreply.github.com>
Signed-off-by: Deepak Singh <91736795+blockguardian@users.noreply.github.com>
* fixed comment consistency problem with erc20 chaincode
Signed-off-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
* added more comment consistancy fix
Signed-off-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
* added more comment consistancy fix
Signed-off-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
* added more comment consistancy fix
Signed-off-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
* added more comment consistancy fix
Signed-off-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
Signed-off-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
Co-authored-by: Ali Shahverdi <ali@Alis-MacBook-Pro.local>
* REST api added for asset transfer in Golang
Signed-off-by: Basil K Y <techiebasil@gmail.com>
* add go.sum to git
Signed-off-by: Basil K Y <techiebasil@gmail.com>
* fix golint error
Signed-off-by: Basil K Y <techiebasil@gmail.com>
Signed-off-by: Basil K Y <techiebasil@gmail.com>
Error handling example used a transaction invocation with the wrong number of arguments and so did not demonstrate the same error condition as other language samples. The error handling code was also not as comprehensive as it should be.
Also changed the console output throughout to match the content and format of the Node and Java samples.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Import Full Stack Asset Transfer Guide at commit fb554befdbbeff9e69159b54fce0b811603f29c7
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Update the workshop with a new WORKSHOP_PATH under fabric-samples
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Update the workshop with a new WORKSHOP_PATH under fabric-samples
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* missed a .git ignored directory on add
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Updates to run the workshop on the Apple M1
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Workaround for https://github.com/eslint/eslint/issues/15299 in the contract tslinter
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Build an arch-specific CC images on M1
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* empty commit - force a build
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* revert an accidental commit that was building the top-level asset-transfer as arm64
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Refactor Go files
1. replace deprecated ioutil functions (ioutil is deprecated since Go 1.16)
2. fix variable names that collide with imported package name
3. fix typos
Also update Go version specified by Go modules to ensure a Go version is used in which ioutil is deprecated and replacement functions are available in os and io packages.
Signed-off-by: Tommy TIAN <xtianae@connect.ust.hk>
Co-authored-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Specify go 1.18 instead of go 1.19 in go.mod files
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Signed-off-by: Tommy TIAN <xtianae@connect.ust.hk>
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Co-authored-by: Tommy TIAN <xtianae@connect.ust.hk>
Correctly check for installed chaincode and enable the same chaincode to be deployed on different channels
Signed-off-by: James Taylor <jamest@uk.ibm.com>
Signed-off-by: James Taylor <jamest@uk.ibm.com>
Fix minor bugs, and add network.sh script to simplify standing up the network
Note: the updated peerNadmin.sh scripts no longer create or join a channel and now only configure the environment for the relevant peer
Signed-off-by: James Taylor <jamest@uk.ibm.com>
* seperate namespace for each organization
Signed-off-by: Basil K Y <techiebasil@gmail.com>
* rest server working
Signed-off-by: Basil K Y <techiebasil@gmail.com>
* use single namespace by default, fix k8s buider
Signed-off-by: Basil K Y <techiebasil@gmail.com>
* added ci test for testing k8s n/w on multiple namespaces
Signed-off-by: Basil K Y <techiebasil@gmail.com>
* fix: access rest server via gateway
Signed-off-by: Basil K Y <techiebasil@gmail.com>
Signed-off-by: Basil K Y <techiebasil@gmail.com>
This change fixes a few minor errors and adds a note to help the user.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
* Run RCAADMIN registration on the host OS, not in k8s
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Fix a typo that caused the log trailer to not exit cleanly on error
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* allow a node registration to have been previously created. This allows for multiple 'network up' targets to be run.
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
This changes the base image used to build the chaincode-as-a-service
java container to the alpine version which is sufficient and less
taxing than using the full gradle:jdk11 one.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
This change updates the test-network README with up-to-date information
about using podman on Mac and improves support for podman in deployCCAAS.sh
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
npm audit reveals several high and one critical vulnerabilities in the dependencies:
ansi-regex 4.0.0 - 4.1.0
Severity: high
Inefficient Regular Expression Complexity in chalk/ansi-regex - https://github.com/advisories/GHSA-93q8-gq69-wqmw
fix available via `npm audit fix`
node_modules/nyc/node_modules/ansi-regex
minimist <=1.2.5
Severity: critical
Prototype Pollution in minimist - https://github.com/advisories/GHSA-xvch-5gv4-984h
Prototype Pollution in minimist - https://github.com/advisories/GHSA-vh95-rmgr-6w4m
fix available via `npm audit fix --force`
Will install mocha@10.0.0, which is a breaking change
node_modules/minimist
node_modules/ts-node/node_modules/minimist
mkdirp 0.4.1 - 0.5.1
Depends on vulnerable versions of minimist
node_modules/mkdirp
mocha 1.21.5 - 6.2.2 || 7.0.0-esm1 - 7.1.0
Depends on vulnerable versions of mkdirp
node_modules/mocha
protobufjs 6.11.0 - 6.11.2
Severity: high
Prototype Pollution in protobufjs - https://github.com/advisories/GHSA-g954-5hwp-pp24
fix available via `npm audit fix`
node_modules/protobufjs
5 vulnerabilities (2 moderate, 2 high, 1 critical)
This change (from running npm audit fix --force) removes all of them:
npm audit
found 0 vulnerabilities
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
* bump CA to v1.5.5; Fabric to v2.4.4
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Reorganizes the kube test network environment default parameters to align on column boundaries.
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Run k8s sample network tests against latest MAJOR.MINOR release of fabric, CA docker hub images.
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
A recent commit added the potential buyer to an asset's state based endorsement policy.
That change was problematic because if the transfer fell through, the buyer lost control of the asset,
in that they could no longer update the asset or change the sell price or sell to somebody else.
The asset state based endorsement policy is now based on the seller only, and we document
that additional parties could be added such as a trusted third party (although no
such party exists in test network at this time).
This commit also re-adds some necessary verifications, and make other minor edits and
comments to help users understand the sample.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Issues:
1. When the name of NETWORK_NAME or NS in file "network" (i.e., the namespace in k8s) is changed from "test-network", the resources in the k8s cluster cannot be created successfully when the command "./network up" is executed.
Error message: error: the namespace from the provided object "test-network" does not match the namespace "xxxxxx". You must pass '--namespace=test-network' to perform this operation.
2. org2-cc.yaml is not completed.
Fix:
1. Replace "test-network" in yaml files in folder "kube" with "${NS}".
2. Complete "org2-cc-template.yaml" by referring to "org1-cc-template.yaml".
Signed-off-by: destinysky <kangrui10@126.com>
- chaincode-java Gradle project name did not match the instructions or the chaincode name used by the sample application code.
- Added test of Java chaincode to CI pipeline.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
- Updated build to use Go 1.18 since Go 1.16 is no longer supported.
- Use Java 11 in updated samples, and take advantage of new language features.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
This patch fixes errors in the document.
Fix errors as follows:
- Change shell script arguments
- Correct display results
Signed-off-by: Satoshi Ito <satoshi.ito.tf@hitachi.com>
* Support the fabric-builder-k8s for the chaincode "easy button."
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Run the CI/CD test suite using the correct matrix env for k8s builder
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Incorporate review feedback : remove zz_unused and pkgk8scc routines
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
Also minor implementation changes to TypeScript sample for better consistency between implementations.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
In chaincode debugging guidance, using the Docker host alias
`host.docker.internal` is assumed.
But, the alias is not yet supported for Linux.
So, this patch adds its alternate procedure for Linux.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
Use an .npmrc to enable engine-strict checks so that `npm install` will fail for projects when an incompatible Node version is used, rather than confusing errors about unsupported language features occuring at runtime.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Addresses Issue #548 by providing a simple guide for running Java chaincode as a service with a local debugger.
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* missed a couple of bash syntax errors
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Add metadata and activate examples to the CC README
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* move ccpackage/ contents into network script
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Fix CI test - Azure mounts git checkout at a different folder root path
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Update test-network-k8s README with updated cc deploy commands
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Run basic-asset transfer CI tests with Java + golang CC in Azure
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* remove (obsolete) test-net chaincode/ folder
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Address some PR review feedback points - README reorg
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Use the SDKs contract router Main, not a local entrypoint
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* bump the build - remove trailing newlines from a README
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
The Hyperledger provided Fabric peer images are only a sample so it would be good to make the k8s test network peer image configurable, for example to include a custom builder
Signed-off-by: James Taylor <jamest@uk.ibm.com>
This patch includes some minor improvements, such as:
- Fix typos and broken links
- Correct chaincode type of asset-transfer-basic-debug
(seems it should be ccaas)
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This patch supports for pulling all images to the local docker cache
and loading to KIND.
Also, this adds the missing docker image pulling (couchdb) for Fabric.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
After feedback from the community, this PR adds CORS support in, but as an option
to enable.
Along with warnings that the default wildcard origin might not be applicable
in a production use case
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* Access the test network services via a local Nginx ingress controller.
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Run E2E / CI test suite against the Ingress based k8s test network
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Improved wait for Nginx Ingress - this was causing some test flakes
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
1. The default chaincode use Capitalized JSON Names, whereas for new asset the REST validation didn't.. Adjusted
so it matches the chaincode
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
This PR fixes the followings to run the tutorial.
- Add an instruction to set PATH to call the `peer` command.
- Correct an option for `deployCCAAS` to debug Chaincode.
Signed-off-by: Yuki Kondo <yuki.kondo.ob@hitachi.com>
-Go chaincode - Paginated range query should return the bookmark so that next page can be requested
-Javascript chaincode - Make query return JSON consistent with Go chaincode
-Javascript app was broken at bookmark query due to invalid JSON parsing from inconsistent chaincode responses
-Javascript and Java app had incorrect comments
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Podman isn't as lenient as docker when it comes to the syntax of the
Dockerfile and insists on getting the ARG command properly scoped.
This fixes this error:
...
[2/2] STEP 12/15: EXPOSE $CC_SERVER_PORT
Error: error building at STEP "EXPOSE $CC_SERVER_PORT": EXPOSE requires at least one argument
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
This addresses Issue #504. This extends the test-network-nano-bash
sample to offer an option to run a fabric network without using any
containers at all. The chaincode is running as an external service
directly on the host machine.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Instead of using the Fabric and Fabric CA three digit version (2.4.3),
utilize the two digit version (2.4).
Each time a Fabric/FabricCA release is pushed to dockerhub the two digit version tag is updated.
This approach simplifies maintenance so that scripts don't have to be updated for every
third digit release.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
erc-721 Go chaincode was delivered to both /go and /chaincode-go directories.
This commit removes the /go implementation.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* impl for couchdb supports in test0network8s as hardcode
Signed-off-by: Sam Yuan <yy19902439@126.com>
* fix up according to pr review comments
Signed-off-by: Sam Yuan <yy19902439@126.com>
* check if running
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
* fix indent
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
better detection in create channel
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
bring network down first case
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
bring network down first case
changed count of containers to 4
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
add echo
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
typo
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
Co-authored-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
Also:
- Refactor application-gateway-java slightly to reflect more idiomatic Java class structure, in line with asset-transfer-events sample.
- Correctly handle unexpected error case where key file is missing.
- Update Gradle wrapper for application-gateway-java.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Co-authored-by: deeptiraom <41100100+deeptiraom@users.noreply.github.com>
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Co-authored-by: deeptiraom <41100100+deeptiraom@users.noreply.github.com>
* Experimental Support for using podman with the test-network
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* supplement podman with nerdctl
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* adds experimental support for nerdctl compose
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* install fabric images to containerd with 'nerdctl' pull
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Podman Support
Use a core set of compose files, with overlays for specific details.
In the case of podman, the overlays refer to a specific core.yaml for the peer that distables the use of teh
docker daemon
In the case of docker, the overlays add enable the docker daemon accesss for the peer to create chaincode
containers
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Co-authored-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
The network.sh is dependent onbeing executed from the test-network directory
This PR makes it a little more tolerant, and will add a bin directgory based on the location
of the script - not just the PWD
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Changed:
- Console output formatting
- Transaction arguments
- Readability and comments of code
- Linting rules
- Missing semicolons
- Package name and descrption
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Gateway Migration for events application
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
* Documentation Error Fix
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
* Updated ci pipelines to include the app
Readme update
Wait for events to complete
Refactor code for events replay
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
* updating readme with all samples
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
* add eol
Signed-off-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
Co-authored-by: Kieran O Mahony <Kieran.O.Mahony1@ibm.com>
- removed unused overrides
- addressed issue using $__interval which doesn't work as well as
$interval
- addressed issue where multiple channels may not give correct output
Signed-off-by: D <d_kelsey@uk.ibm.com>
Co-authored-by: D <d_kelsey@uk.ibm.com>
Although test network scripts functionally worked, they demonstrated
some strange patterns around use of the ca cert.
This change makes it clear that the ca cert is configured and used
at the org level, and not related to any individual peer or orderer node.
Also that when connecting to individual servers, clients can pass the
org level CA cert as the root of trust when establishing TLS connections.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Also fix the version of prometheus and grafana being used
to ensure the queries remain compatible as well as avoid
issues whether they may not work if latest images already
exist on machine but are not at a level that will work
Signed-off-by: D <d_kelsey@uk.ibm.com>
Co-authored-by: D <d_kelsey@uk.ibm.com>
This fixes several typos and more importantly add an instruction to
set FABRIC_CFG_PATH without which the peer command fails.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Fenced code blocks within a list were at the wrong level if indentation and so logically terminated the list.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Split boiler-plate connection code into a separate file since the basic sample already covers this aspect. The `app.go` file now only presents the main application code, making it much easier for readers to view.
Also changed the event replay code to use a different style of reading from the real-time eventing example, demonstrating the use of timeouts while reading events we expect to arrive quickly, and avoiding any possibility of the main application execution hanging indefinitely.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
* Added for client java application using gateway api in java sdk
Signed-off-by: deeptiraom <41100100+deeptiraom@users.noreply.github.com>
* removed eclipse plugin for gradle
Signed-off-by: deeptiraom <41100100+deeptiraom@users.noreply.github.com>
JCenter is deprecated, can no longer be published to, and is scheduled for removal. It is now causing build failures. Replace with Maven Central.
Also remove mavenLocal() as this is not recommended practice:
- https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:case-for-maven-local
Note that Jitpack still needs to be included as a package repository for Java chaincode since it has dependencies on an old version of com.github.everit-org.json-schema:org.everit.json.schema that is only published there.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
added promethesus-grafana server to test-network
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
changed image for cadvisor to version that works on Linux
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
improved documentation on README and tweaked docker-compose file
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
updated and fixed documentation for the prometheus/grafana sample for the test-network
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
final modification to grafana dashboard and prom/graf docs
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
Move signposts to sample source files from index.ts to the readme and reinforce the key aspects of the sample
Signed-off-by: James Taylor <jamest@uk.ibm.com>
* Changes to the test-network k8s deployment to use the
built-in as-a-service chaincode builder from the Peer Container
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* Remove the ccaas init container from org2 peer; tweak docs on ccaas config
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
Co-authored-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
- Updated the test-network with examples of runnig CCAAS
- Updating the asset transfer basic with how to run chaincode as a service.
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Match the versions required in asset-transfer-basic/application-typescript
Also update to latest version of fabric-network
Signed-off-by: James Taylor <jamest@uk.ibm.com>
“The app.locals object has properties that are local variables within the application.”
…which looks like a better option than app.get and app.set for app settings.
Also passes app to the initJobQueueWorker function for consistency.
Signed-off-by: James Taylor <jamest@uk.ibm.com>
Previously transactions were only retried after being successfully endorsed, and always with the same transaction ID
Transactions will now be added to a queue for processing and will also be retried if endorsement fails (with a different transaction id for invalid transactions)
Signed-off-by: James Taylor <jamest@uk.ibm.com>
- default command should be start, rather than start:dev in the docker image
- added a multistage build
- fixed node-gyp error
- removed dev dependencies
- added a start:dotenv script to support a .env file in production (may be useful for
k8s later)
- updated Readme and generateEnv script to simplify the setup
- updated external network in docker-compose.yaml to match the test network
Signed-off-by: James Taylor <jamest@uk.ibm.com>
Use more common X-Api-Key header with no prefix
Also updates Unauthorized response to include a json error body
and simplifies working with new API key via curl and the vscode
rest client
Signed-off-by: James Taylor <jamest@uk.ibm.com>
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
removed auth check from live,ready apis..
code format
http file changes for apikey
comments for getting api key
readme update for apikey usage
replaced -H with --header
apikey config made mandatory
fix linting
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
used fabric protos insted of blockdecoder
changed import statement
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
revert back eslintrc
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
function name change
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
format changes
Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
Also install goimports globally to run the linting check rather than installing to each gomodule, which was causing dependency conflicts.
Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
Fix CORE_PEER_ID for peer4.
This fix ensures that peer3 and peer4 don't share the
same chaincode container.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* Address Issue #511 with docs and better error handling
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Set the TEST_NETWORK_FABRIC_VERSION in documentation for local development.
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
- Add a new label to each peer to mark which org it is in
- Create new service per org, that matches this label - so the service can pick from one of multiple pods
- Update the kubeproxy to give more choice of ha stratergies
- Update the application configmaps and samples to refer to this new service rather than specific peers
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
Josh has been helping to update samples for the Kubernetes age.
He has contributed the test-network-k8s sample and has been active in
managing fabric-samples issues. Let's welcome Josh
as a fabric-samples maintainer!
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
The latest version (2.1.2) of sort-keys-recursive adds TypeScript
typing, which includes export default function.
This change has caused the TS2349 type error.
This patch modifies the import form in assetTransfer.ts to fix the error.
Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
- updated the logging for the application command; wasn't very good
- added some information to the help option. the current settings
useful if you're not sure what you've set
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
"Farewell! thou art too dear for my possessing,
And like enough thou knowst thy estimate.
The Charter of thy worth gives thee releasing;
My bonds in thee are all determinate.
For how do I hold thee but by thy granting,
And for that riches where is my deserving?
The cause of this fair gift in me is wanting,
And so my patent back again is swerving.
Thy self thou gav'st, thy own worth then not knowing,
Or me, to whom thou gav'st it, else mistaking,
So thy great gift, upon misprision growing,
Comes home again, on better judgement making.
Thus have I had thee as a dream doth flatter:
In sleep a king, but waking no such matter."
- bill
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Run the fabric test network on Kubernetes
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Re-LINT
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
CHAINCODEADDRESS is set to host.docker.internal which is
only available in MAC and Windows environments.
For that reason, it cannot launch chaincode on Linux.
This PR sets CHAINCODEADDRESS to 127.0.0.1 instead of
host.docker.internal.
Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com>
The functions BatchTransferFrom and BatchTransferFromMultiRecipient in ERC1155 sometimes give the error `ProposalResponsePayloads do not match`. This happens because iterating maps in Go is not deterministic. As a solution, I copied the keys of the map and sorted them and iterated over the sorted keys.
Signed-off-by: Baran Kılıç <baran.kilic@boun.edu.tr>
* This is the initial add of a test-network-kind
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
* Update the test-network-kind README; removes the local docker registry; updated 'clean' instructions
Signed-off-by: Josh Kneubuhl <jkneubuh@us.ibm.com>
Co-authored-by: Matthew B White <mbwhite@users.noreply.github.com>
Helper script to set environment variables, so make it eaiser to use the peer command
from the shell command line
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
* updated chaincodes for asset-trnsfer-basic in order to show good example on how achieving determinism in json
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* final fixes for chaincode-java of asset-tranfer-basic
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* removed extra unused excheptions
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* corrected indentation of contract in the chancode-javasript of asset-trnsfer-basic
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* last fixes for chaincode-javascript of asset-transfer-basic
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* last last fixes for chaincode-javascript of asset-transfer-basic
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
If ORDERER_KAFKA_VERBOSE is true, the output of /logspec will contain
the following kafka information even if it is raft orderer.
{"spec":"orderer.consensus.kafka.sarama=debug:info"}
This PR deletes environment valiable for kafka in docker-compose.
Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com>
* fixed json dependencies for java
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* updated dependency for asset-tranfer-sbe: now declaing also org.hyperledger.fabric.protos.common
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* "corrected typo of last commit and added testImplementation 'org.hyperledger.fabric.protos.common'"
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
* included correct dependecy for fabric-protos and added com.google.protobuf as well
Signed-off-by: fraVlaca <ocsenarf@outlook.com>
It's been some time since I've had the cycles available to review
anything here, so removing myself.
Signed-off-by: Jason Yellick <jason-github@unaddressable.org>
Test network Nano bash provides a set of minimal bash scripts
to run a Fabric network on your local machine.
The network is functionally equivalent to the docker-based Test Network,
you can therefore run all the tutorials and samples that target the Test Network.
The Fabric release binaries are utilized rather than using docker containers
to avoid all unnecessary layers. Only the chaincode and chaincode builder
runs in a docker container behind the scenes.
Using the Fabric binaries also makes it simple for Fabric developers
to iteratively and quickly modify Fabric code and test a Fabric network as a user.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* change docker-compose version from 2 to 2.4 on folder addOrg3/docker
Signed-off-by: Saliou <boomse@hotmail.fr>
* changing all docker-compose version from 2 to 2.4 under addOrg3/docker
Signed-off-by: Saliou <boomse@hotmail.fr>
Co-authored-by: Saliou <admin@example.com>
Docker version 20.10 support rootless mode. That features
changes a mount path of docker.sock.
This PR loads a mount path from DOCKER_HOST environment,
and if not set, a mount path will be /var/run/docker.sock
FAB-18481
Signed-off-by: Nao Nishijima <nao.nishijima.xt@hitachi.com>
The Golang and Java sample chaincode returned an error when trying to create an asset which already exists
JavaScript and TypeScript samples should now do the same
Signed-off-by: James Taylor <jamest@uk.ibm.com>
The off_chain_data sample fails to put data to the off-chain
database. The application does not read fetched blocks because
it uses the old interface of `addBlockListener()` to handle
block events.
This PR fixes the application to use the latest block listener
and build the off-chain database.
Signed-off-by: Yuki Kondo <yuki.kondo.ob@hitachi.com>
- In CreateAsset, await was never called on putState causing issues
especially with tools such as caliper and is not correct practice.
Unfortunately all the other examples use `return` which works but is
actually not the idiomatic way of handling promises, so here await is
chosen rather than return
Signed-off-by: D <d_kelsey@uk.ibm.com>
Co-authored-by: D <d_kelsey@uk.ibm.com>
Peers and Orderers by default disable Go pprof profiling, however test
network was enabling pprof in peers by default. As a good practice,
pprof should be disabled by default and only enabled when needed
for debug profiling.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
* Enable TLS on asset-transfer-basic external chaincode
1. Introduce environment variables to enable or disable TLS
at runtime. Also, introduce environment variables which carries
the server key, cert and the client machine's root CA cert
information.
2. Read the environment variables to decide with appropriate
assumptions on default values to work as is today.
Signed-off-by: S m, Aruna <arun.s.m.cse@gmail.com>
* Update the chaincode.env with new options
1. Introduce four new environment variables to the default
chaincode environment file.
2. Add two new environment files for easy/automation running
of the external chaincodes for different organizations.
Note that when TLS enabled, the package contents will change.
So each organization will have their own package ID
generated unlike earlier. Also, there will be two chaincode
containers running instead of one for the given example.
Signed-off-by: S m, Aruna <arun.s.m.cse@gmail.com>
* Add docker compose file for running chaincodes
The file will build and run the chaincode on the fly.
Also, it will make use of the available files which is
configured by the user as part of execution. This will
help in bringup/bringdown of the chaincode containers.
In addition, it will help in updating the environment
variables on the go.
Signed-off-by: S m, Aruna <arun.s.m.cse@gmail.com>
* Introduce crypto directory and ignore the pem contents
The directory is used by the docker-compose file for
automation. Instructions in the README.md file will
suffice the filling up of required files in this directory.
Signed-off-by: S m, Aruna <arun.s.m.cse@gmail.com>
* Instructions on TLS enabled external chaincode server
1. Add instructions to generate a chaincode server TLS
parameters.
2. Add instructions on different parameters that peer node
expects and the chaincode expects.
3. Add instructions on steps to be followed in asset-transfer
-basic to work with iTLS enabled exteral chaincode.
Signed-off-by: S m, Aruna <arun.s.m.cse@gmail.com>
* Enable chaincode to work without TLS as well
1. Root certificate is an optional parameter supplied for
chaincode to verify the peer's connection in response.
2. If TLS is enabled, then specify the key and cert
parameters. Do not expect it otherwise.
Signed-off-by: S m, Aruna <arun.s.m.cse@gmail.com>
Using the ERC-20 sample, you can submit a transfer to and from
the same account. Because the code doesn't handle this, it ends
up minting new tokens into that account.
The correct behaviour is not specified by the ERC-20 specification,
although the OpenZeppelin implementation seems to permit it.
IMO we should just block it with an error because I can't see a use
case for allowing it and it is most likely a user error.
Signed-off-by: Simon Stone <sstone1@uk.ibm.com>
This PR adds a new non-fungible token sample using ERC721
functionalities. It includes javascript Chaincode and the README
explaining how to mint and transfer a non-fungible token in the
Fabric's test-network.
Signed-off-by: Yuki Kondo <yuki.kondo.ob@hitachi.com>
The `-i` flag was originally added to support an
upgrade sample. Since that sample is no longer available
remove the `-i` flag to clean up the network.sh options
and avoid confusion as it's possible now to specify
an image version that is no longer backwards compatible
with the new test-network with osnadmin.
Signed-off-by: Brett Logan <lindluni@github.com>
The new lint.sh script no longer requires the use
of a matrix and instead dynamically finds and lints
directories.
Signed-off-by: Brett Logan <lindluni@github.com>
Fix a small linting issue and add the es6 tag to handle
the return of a Promise as it is not defined in the ECMA
spec.
Signed-off-by: Brett Logan <lindluni@github.com>
The auction example had no ESLint configuration.
This change adds a .eslintrc.js file that matches
the rest of the projects.
This change also fixes all the linting issue in
the auction example.
Signed-off-by: Brett Logan <lindluni@github.com>
Add a service label to all containers launch by compose.
This allows us to filter on the label for removing running
containers.
Use filtering for querying running containers and
images to make sure we only target the containers
and images we want to remove.
Signed-off-by: Brett Logan <lindluni@github.com>
There have been lots of changes and quirks with the
docker-compose .env file, this change removes the file
and explicitly creates and assigns the networks in the
compose yaml files.
Signed-off-by: Brett Logan <lindluni@github.com>
* Fix creating channel when ${PWD} contains space.
If the path of the project contains spaces, the "test-network/scripts/envVar.sh" script sets the value of "$ORDERER_CA" to a value containg "${PWD}" which, in turn, contains space(s).
When the variable used in "test-network/scripts/createChannel.sh", The first part of the value (before the first space) is handled as the whole value for "--cafile". Other parts are considered to be part of the command!
I tried putting (escaped) quotes in the "test-network/scripts/envVar.sh" definition for the variable "$ORDERER_CA" to make the fix more general, but the quotation marks were sometime interpreted to be part of the path that consisted of concatenated parts somewhere and it did not work.
While this edit will fix this issue, I belive this is just a work around. I expect that there is a better way to solve the root cause of the problem instead of just fixing it in one place. Moreover, All variables/paths that may include spaces should be properly handled as well.
Thanks
Signed-off-by: Waleed Mortaja <waleedmortaja@protonmail.com>
* Double quote variables evaluations that depends on $PWD
I tried to handle most (if not all) of the variables evaluations in the project that depends on $PWD by wrapping them in double-quotations to avoid values that contains white spaces.
Some lines I was not sure if they are Okay or not but I left them as they are. Samples (not all lines) as follows:
- commercial-paper/network-clean.sh:15:DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- commercial-paper/network-starter.sh:15:DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- asset-transfer-basic/chaincode-javascript/node_modules/fabric-shim/coverage/fabric-shim/lib/chaincode.js.html:997: optsCpy.pem = fs.readFileSync(process.env.CORE_PEER_TLS_ROOTCERT_FILE).toString();
- commercial-paper/organization/digibank/digibank.sh:29:export PEER_PARMS="${PEER_CONN_PARMS##*( )}"
The next sample I was not really sure, but still edited it:
- test-network/addOrg3/fabric-ca/registerEnroll.sh:68: cp ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/tlscacerts/* ${PWD}/../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt
I deliberately ignored some lines because I think they are not problem. These lines include:
- `export` sentences
- assignment sentences like: test-network/scripts/createChannel.sh:48: FABRIC_CFG_PATH=$PWD/../config/
- gradlew files: the line SAVED="`pwd`"
- gradlew files: the line APP_HOME="`pwd -P`"
- gradlew files: the line CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
Signed-off-by: Waleed Mortaja <waleedmortaja@protonmail.com>
* remove unnecessary leading space trimming
Signed-off-by: Waleed Mortaja <waleedmortaja@protonmail.com>
* resolved conflict with master
Co-authored-by: Arnaud J Le Hors <lehors@us.ibm.com>
Update all of the Node deps to 2.2.<latest>
and regenerate existing package-lock.json files
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Co-authored-by: Brett Logan <brett.t.logan@ibm.com>
* Remove Org3cli from test-network
FAB-18381
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
* Remove configtx.yaml anchor peers from test-network
These values were only used by configtxgen's --outputAnchorPeerUpdate
function and should not be set in a channel genesis block This is because
a peer cannot be an anchor peer for a channel until it has joined that
channel and it can't join a channel until the genesis block has been
created.
FAB-18381
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
* Stop using deprecated outputAnchorPeersUpdate in test-network
FAB-18381
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
* Improve consistency of test-network output
Signed-off-by: Will Lahti <wtlahti@us.ibm.com>
Instead of mounted the entire /var/run directory
explicitly mount the unix socket. Mounting the entire
directory causes issues with future versions of Docker
on some platforms.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
The chaincode packaging function wrongly implies that the packaging
operation is performed on a peer when it is in fact done locally.
This change fixes that.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
go chaincode now sets the Asset owner as client identity certificate string (instead of base64 str)
Reason for the update: "GetClientIdentity().GetID()" api in go chaincode returns base64 string, while same api in java chaincode returns the same data as string
go & java chaincode sets same owner string
updated js app verify method
Signed-off-by: Sijo Cherian <sijo@ibm.com>
Java chaincode that can be deployed via test-network, with shortname 'private'
Unit test for core transactions
Bugfix for QueryAsset txn function signature
Incorporated PR feedback
Signed-off-by: Sijo Cherian <sijo@ibm.com>
* commercial paper enhancements
Signed-off-by: Paul O'M <mahoney@uk.ibm.com>
* commercial paper enhancements
Signed-off-by: Paul O'M <mahoney@uk.ibm.com>
* commercial paper enhancements
Signed-off-by: Paul O'M <mahoney@uk.ibm.com>
* Add further README changes from #335
Signed-off-by: Paul O'M <mahoney@uk.ibm.com>
* Add further README changes from #335
Signed-off-by: Paul O'M <mahoney@uk.ibm.com>
* Add further README changes from #335
Signed-off-by: Paul O'M <mahoney@uk.ibm.com>
Update ERC-20 readme to indicate the new contract name
and add TransferFrom tutorial for Go chaincode.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This PR changes the auction sample to a simple blind auction with just a
single item to be sold to the highest bidder.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Added check to avoid double spent in token-utxo chaincode
In the transfer function it was possible to pass the same utxo more than once in the array of input utxos without any error. Making it possible to spend the same utxo more than once in the same transaction and like this create more tokens than minted. To fix this I changed the array that was used to store the input utxo states to a map and so utxos were stored in the map by there key, which made it possible to know if a key and so a utxo had already been used.
I tested this by setting up the test-network, deploying the token-utxo chaincode with my fix, minting a utxo and trying to spent this utxo more than once in the same transaction, which was not possible anymore. It can only be spent one time anymore with this fix.
Add new chaincode and javascript application to demostrate
the use of chaincode events and block events with private data.
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
This PR adds ERC20 capabilities to the token-account-based sample.
It includes javascript Chaincode and the updated README to explain
how to use tokens in the Fabric test-network.
Signed-off-by: Yuki Kondo <yuki.kondo.ob@hitachi.com>
The current scripts given to setup the user environment do not work
on Mac:
$ . ./magnetocorp.sh
-bash: cd: /Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed./../../../test-network: No such file or directory
-bash: ./scripts/envVar.sh: No such file or directory
[...truncated...]
export FABRIC_CFG_PATH="/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp"
export PATH="/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp"
export PEER_PARMS=""
Saving session...
Saving session...
The session history related output is actually captured when setting the environment variables:
$ echo $FABRIC_CFG_PATH
/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed./../../../config
With this simple change the scripts work:
$ echo $FABRIC_CFG_PATH
/Users/lehors/Projects/Go/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/../../../config
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
The user's PATH must be set on the first use of Terminal 2 for the
call to the fabric-ca-client command to succeed. The current README
only sets it later. This fix changes that.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
The user's PATH must be set on the first use of Terminal 2 for the
call to the fabric-ca-client command to succeed. The current README
only sets it later. This fix changes that.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
udpate artifact removal to include all .tar.gz
Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
Re-enable CI tests for asset-transfer-private-data JavaScript application.
Also re-add the error when private asset details are not found in the collection,
so that the CLI instructions work as desired, and to demonstrate error
handing in the client application.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This change makes the way the type property is extracted from the
metadata.json file much more robust, and therefore sets a better
example.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Adds the apps and chaincodes to linting and testing
CI that weren't added before.
Linting issues were corrected where necessary to make CI pass.
The Basic-Go application and Private-Javascript application
are currently disabled pending fixes currently being worked on.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Improve on the initial PR to expand on the README with detailed
information on how to run the external chaincode in a container
on the test network and use the node application against it.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Add the asset-transfer-ledger-queries javascript application.
Update the CI script to run it against go and javascript chaincode.
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
The InitLedger was not writing the composite key for the color index.
Therefore TransferAssetByColor was not working.
Now InitLedger will call CreateAsset which creates both the asset
and the color index entry.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
This script fails if chaincode version is higher than 9 as 'grep' does not match ex. version equal to '10'
Signed-off-by: Titas <titas.petravicius@gmail.com>
Signed-off-by: lehors <lehors@us.ibm.com>
Co-authored-by: Arnaud J Le Hors <lehors@us.ibm.com>
Use common code for reading a connection profile, enrolling the admin,
registering and enrolling a user, building a wallet, and
building a certificate authority client.
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
Although the current code works thanks to Go being quite
forgiving when it comes to pointers, it doesn't exhibit
the best coding style. This patch addresses this.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
We delete folders and files locally on the host system
today. If the user is not a super user the files can't
be deleted as they are created by a root user in the
containers. This change uses busybox to perform the
deletions instead so a root user can remove them.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Pushes the scripting logic into a standalone script
and adds tests for the applications which by side-effect
also test the invoke and query functions on the chaincode.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
GetAllAssets uses getStateByRange which returns an iterator.
Refactored code to make use of the iterator as this code did
not function in its previous state
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Short of creating a second application that calls
the lowerCase version of functions, since Go requires
the functions be exported, capitalizing them in the
Node and Typescript chaincode seems the simplest solution
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Add the contract-api specific annotations and
enable the experimental features.
Also properly format code according to the linter
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
Remove images from fabric-samples and move to docs.
Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
As the Typescript examples are essentially just reiterations
of the same Javascript code, there is no benefit to having
providing examples in both languages. The functional code
was exactly the same in both languages. On the contrary it
meant we widened the surface of maitainence and thus we are
removing due to the limited benefit provided by the example
chaincode and applications.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
* Improve asset-transfer-basic javascript app code by combining invoke & query.js
Adding a sample application workflow to demonstrate the chaincodes, similar to the WIP PR for basic go-application (https://github.com/hyperledger/fabric-samples/pull/211).
Simplify and document-in-code the app workflow of this sample, in a single app , instead of invoke & query setting up Gateway
Signed-off-by: Sijo Cherian <sijo@ibm.com>
improve javascript app code by combining invoke & query.js
Signed-off-by: Sijo Cherian <sijo@ibm.com>
reverted chaincode func signature
Signed-off-by: Sijo Cherian <sijo@ibm.com>
* create/updateAsset signature in sync with chaincode func change as in #227
Signed-off-by: Sijo Cherian <sijo@ibm.com>
* Tested with latest chaincode, Improved comments
Signed-off-by: Sijo Cherian <sijo@ibm.com>
Co-authored-by: Sijo Cherian <sijo@ibm.com>
There was no need for GetAllAssets to return a custom type,
it can simple return an array of all assets.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
options on the network script to deploy chaincode
-ccn The name to be used as the deployed name and used as
the short name of known chaincodes when the -ccp is not included.
known short names
'basic' - asset-transfer-basic
'secure' - asset-transfer-secured-agreement
'ledger' - asset-transfer-ledger-queries
'private' - asset-transfer-private-data
-ccl the language of the chaincode
-ccv the version
-ccs the sequence
-ccp [optional] the path to the chaincode, when provided
the -ccn will be the deployed name
-cci [optional] the chaincode function to call during deployment
that will perform an initialization of the channel state
required for this chaincode
Signed-off-by: Bret Harrison <beharrison@nc.rr.com>
Rewrites the chaincod in idiomatic Go and cleans up
the general implementation.
A future commit should push the chaincode logic itself
into a separate package as chaincode cannot be tested
when the logic is part of the main package.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Rewrites the chaincode in idiomatic Go and cleans up
the general implementation.
A future commit should push the chaincode logic itself
into a separate package as chaincode cannot be tested
when the logic is part of the main package.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Many users raise questions on how to test chaincode. It used
to be much easier with the old shim, as they could directly
use the old mock stub in the shim. Now that it no longer exists
the fabcar example can provide an example of how to test chaincode.
Also worth noting is our current directory structure of our Go
chaincodes prevents the creation of mocks due to import cycles.
This change also pushes the chaincode logic down into a `chaincode`
package.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
Cleans up the code and pushes the smart contract
implementation down into a `chaincode` package.
This is in prep for implementing unit testing in the
chaincode, as you cannot mock code that is part of
the main package.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
In Fabric v2.2, the gossip defaults are changed to make
peers org leaders instead of using leader election.
This change removes the config from the samples, so that
the samples simply inherit the new peer defaults.
This will simplify the sample configuration.
Signed-off-by: David Enyeart <enyeart@us.ibm.com>
Fabric 2.2 removes official support for CouchDB 2.x.
The migration to 3.1 was to address fsync issues
in the underlying storage implementation in Couch.
This change moves to CouchDB 3.1 which requires the
user to now set an admin identity at startup.
Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
- Update gradle version
- Switch to application plugin
(cc is started as an app not a lib, and java-library-distribution
is still incubating)
- make sure tests and coverage checks are run before installDist
Signed-off-by: James Taylor <jamest@uk.ibm.com>
- Add new generic asset transfer sample based on the existing marbles02 sample
- Add InitLedger() to create base assets
- Add AssetExists() to check for an assets existence in the world state
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
This patch adds missing config.yaml to msp folder for user1 in test-network
to make user1 work properly when using FabricCA.
Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
- Move go chaincode to chaincode-go subdirectory
- Add public description argument to CreateAsset()
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
- Rename marbles_transfer to a more generic and streamlined asset
- Move sample to new directory
- Remove TODO for marbles by size query
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
In queryInstalled()
Removing line: echo PackageID is ${PACKAGE_ID}
the ```peer lifecycle chaincode queryinstalled``` cmd already prints the Package ID when successfull.
Signed-off-by: Rob Murgai <murgai@us.ibm.com>
`--tls` option of the peer command does not require any argument.
On the other hand, some scripts assign the arguments.
This patch deletes the unnecessary arguments.
Also, this patch fixes a minor problem on private data tutorial instructions
for base64 (Related to FAB-13777).
Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
- Add query to verifies asset properties
- Delete price records from buyer and seller private data collections
when transfer is complete
- Add 'receipt' for asset transfer
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
To get rid of hard-coded versioning and use the latest version of fabric-ca
in test-network, this patch modifies the existence check logic of
the fabric-ca-client binary in the same way as peer and orderer.
Also, this patch updates addOrg3.sh to use cai <ca_imagetag> option.
Signed-off-by: Tatsuya Sato <Tatsuya.Sato@hal.hitachi.com>
Now that fabric-sdk-go beta2 has been released which contains the new programming model, update the dependency in the fabcar go sample
Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
- Add marbles proposed sale and bid prices queries
- Add marbles history query
- Add verification of ownership when selling marble
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
Signed-off-by: Dereck Luo <dereckluo@gmail.com>
This updates the fabcar java application to work with the fabric
gateway java version 2.1.1.
It also changes pom.xml to produce a jar file that is self contained
for ease of use.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
Nik has been the main source of progress in the fabric-samples
repository for several months, making significant improvements with
the introduction of test-network and updates of all the different
samples around it, among other things.
Signed-off-by: Arnaud J Le Hors <lehors@us.ibm.com>
before participating. It is important that we keep things civil.
before participating. It is important that we keep things civil.
<arel="license"href="http://creativecommons.org/licenses/by/4.0/"><imgalt="Creative Commons License"style="border-width:0"src="https://i.creativecommons.org/l/by/4.0/88x31.png"/></a><br/>This work is licensed under a <arel="license"href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
<arel="license"href="http://creativecommons.org/licenses/by/4.0/"><imgalt="Creative Commons License"style="border-width:0"src="https://i.creativecommons.org/l/by/4.0/88x31.png"/></a><br/>This work is licensed under a <arel="license"href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
| Jason Yellick | jyellick | jyellick | jyellick@us.ibm.com |
| Matthew B White | mbwhite | mbwhite | whitemat@uk.ibm.com |
| Simon Stone | sstone1 | sstone1 | sstone1@uk.ibm.com |
Also: Please see the [Release Manager section](https://github.com/hyperledger/fabric/blob/master/MAINTAINERS.md)
Also: Please see the [Release Manager section](https://github.com/hyperledger/fabric/blob/main/MAINTAINERS.md)
<arel="license"href="http://creativecommons.org/licenses/by/4.0/"><imgalt="Creative Commons License"style="border-width:0"src="https://i.creativecommons.org/l/by/4.0/88x31.png"/></a><br/>This work is licensed under a <arel="license"href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
<arel="license"href="http://creativecommons.org/licenses/by/4.0/"><imgalt="Creative Commons License"style="border-width:0"src="https://i.creativecommons.org/l/by/4.0/88x31.png"/></a><br/>This work is licensed under a <arel="license"href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
Please visit the [installation instructions](http://hyperledger-fabric.readthedocs.io/en/latest/install.html)
You can use Fabric samples to get started working with Hyperledger Fabric, explore important Fabric features, and learn how to build applications that can interact with blockchain networks using the Fabric SDKs. To learn more about Hyperledger Fabric, visit the [Fabric documentation](https://hyperledger-fabric.readthedocs.io/en/latest).
to ensure you have the correct prerequisites installed. Please use the
version of the documentation that matches the version of the software you
intend to use to ensure alignment.
## Download Binaries and Docker Images
Note that this branch contains samples for the latest Fabric release. For older Fabric versions, refer to the corresponding branches:
The installation instructions will utilize `scripts/bootstrap.sh` (available in the fabric repository)
images, and tag the images with the 'latest' tag. Optionally,
specify a version for fabric, fabric-ca and thirdparty images. If versions
are not passed, the latest available versions will be downloaded.
The script will also clone fabric-samples repository using the version tag that
## Getting started with the Fabric samples
is aligned with the Fabric version.
You can also download the script and execute locally:
To use the Fabric samples, you need to download the Fabric Docker images and the Fabric CLI tools. First, make sure that you have installed all of the [Fabric prerequisites](https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html). You can then follow the instructions to [Install the Fabric Samples, Binaries, and Docker Images](https://hyperledger-fabric.readthedocs.io/en/latest/install.html) in the Fabric documentation. In addition to downloading the Fabric images and tool binaries, the Fabric samples will also be cloned to your local machine.
## Test network
The [Fabric test network](test-network) in the samples repository provides a Docker Compose based test network with two
Organization peers and an ordering service node. You can use it on your local machine to run the samples listed below.
You can also use it to deploy and test your own Fabric chaincodes and applications. To get started, see
the [test network tutorial](https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html).
The [Kubernetes Test Network](test-network-k8s) sample builds upon the Compose network, constructing a Fabric
network with peer, orderer, and CA infrastructure nodes running on Kubernetes. In addition to providing a sample
Kubernetes guide, the Kube test network can be used as a platform to author and debug _cloud ready_ Fabric Client
applications on a development or CI workstation.
## Asset transfer samples and tutorials
The asset transfer series provides a series of sample smart contracts and applications to demonstrate how to store and transfer assets using Hyperledger Fabric.
Each sample and associated tutorial in the series demonstrates a different core capability in Hyperledger Fabric. The **Basic** sample provides an introduction on how
to write smart contracts and how to interact with a Fabric network using the Fabric SDKs. The **Ledger queries**, **Private data**, and **State-based endorsement**
samples demonstrate these additional capabilities. Finally, the **Secured agreement** sample demonstrates how to bring all the capabilities together to securely
transfer an asset in a more realistic transfer scenario.
| [Basic](asset-transfer-basic) | The Basic sample smart contract that allows you to create and transfer an asset by putting data on the ledger and retrieving it. This sample is recommended for new Fabric users. | [Writing your first application](https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html) | Go, JavaScript, TypeScript, Java | Go, TypeScript, Java |
| [Ledger queries](asset-transfer-ledger-queries) | The ledger queries sample demonstrates range queries and transaction updates using range queries (applicable for both LevelDB and CouchDB state databases), and how to deploy an index with your chaincode to support JSON queries (applicable for CouchDB state database only). | [Using CouchDB](https://hyperledger-fabric.readthedocs.io/en/latest/couchdb_tutorial.html) | Go, JavaScript | Java, JavaScript |
| [Private data](asset-transfer-private-data) | This sample demonstrates the use of private data collections, how to manage private data collections with the chaincode lifecycle, and how the private data hash can be used to verify private data on the ledger. It also demonstrates how to control asset updates and transfers using client-based ownership and access control. | [Using Private Data](https://hyperledger-fabric.readthedocs.io/en/latest/private_data_tutorial.html) | Go, TypeScript, Java | TypeScript |
| [State-Based Endorsement](asset-transfer-sbe) | This sample demonstrates how to override the chaincode-level endorsement policy to set endorsement policies at the key-level (data/asset level). | [Using State-based endorsement](https://github.com/hyperledger/fabric-samples/tree/main/asset-transfer-sbe) | Java, TypeScript | JavaScript |
| [Secured agreement](asset-transfer-secured-agreement) | Smart contract that uses implicit private data collections, state-based endorsement, and organization-based ownership and access control to keep data private and securely transfer an asset with the consent of both the current owner and buyer. | [Secured asset transfer](https://hyperledger-fabric.readthedocs.io/en/latest/secured_asset_transfer/secured_private_asset_transfer_tutorial.html) | Go | TypeScript |
| [Events](asset-transfer-events) | The events sample demonstrates how smart contracts can emit events that are read by the applications interacting with the network. | [README](asset-transfer-events/README.md) | Go, JavaScript, Java | Go, TypeScript, Java |
| [Attribute-based access control](asset-transfer-abac) | Demonstrates the use of attribute and identity based access control using a simple asset transfer scenario | [README](asset-transfer-abac/README.md) | Go | _None_ |
## Full stack asset transfer guide
The [full stack asset transfer guide](full-stack-asset-transfer-guide#readme) workshop demonstrates how a generic asset transfer solution for Hyperledger Fabric can be developed and deployed. This covers chaincode development, client application development, and deployment to a production-like environment.
## Additional samples
Additional samples demonstrate various Fabric use cases and application patterns.
| [Off chain data](off_chain_data) | Learn how to use block events to build an off-chain database for reporting and analytics. | [Peer channel-based event services](https://hyperledger-fabric.readthedocs.io/en/latest/peer_event_services.html) |
| [Token SDK](token-sdk) | Sample REST API around the Hyperledger Labs [Token SDK](https://github.com/hyperledger-labs/fabric-token-sdk) for privacy friendly (zero knowledge proof) UTXO transactions. | [README](token-sdk/README.md) |
| [Token ERC-20](token-erc-20) | Smart contract demonstrating how to create and transfer fungible tokens using an account-based model. | [README](token-erc-20/README.md) |
| [Token UTXO](token-utxo) | Smart contract demonstrating how to create and transfer fungible tokens using a UTXO (unspent transaction output) model. | [README](token-utxo/README.md) |
| [Token ERC-1155](token-erc-1155) | Smart contract demonstrating how to create and transfer multiple tokens (both fungible and non-fungible) using an account based model. | [README](token-erc-1155/README.md) |
| [Token ERC-721](token-erc-721) | Smart contract demonstrating how to create and transfer non-fungible tokens using an account-based model. | [README](token-erc-721/README.md) |
| [High throughput](high-throughput) | Learn how you can design your smart contract to avoid transaction collisions in high volume environments. | [README](high-throughput/README.md) |
| [Simple Auction](auction-simple) | Run an auction where bids are kept private until the auction is closed, after which users can reveal their bid. | [README](auction-simple/README.md) |
| [Dutch Auction](auction-dutch) | Run an auction in which multiple items of the same type can be sold to more than one buyer. This example also includes the ability to add an auditor organization. | [README](auction-dutch/README.md) |
@ -6,7 +6,6 @@ If you think you have discovered a security issue in any of the Hyperledger proj
There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at hyperledger dot org](mailto:security@hyperledger.org).
There are two ways to report a security bug. The easiest is to email a description of the flaw and any related information (e.g. reproduction steps, version) to [security at hyperledger dot org](mailto:security@hyperledger.org).
The other way is to file a confidential security bug in our [JIRA bug tracking system](https://jira.hyperledger.org). Be sure to set the “Security Level” to “Security issue”.
The other way is to file a confidential security bug in the repository's [security advisories page](https://github.com/hyperledger/fabric/security/advisories). Guidance can be found in the GitHub documentation on [privately reporting a security vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability).
The process by which the Hyperledger Security Team handles security bugs is documented further in our [Defect Response page](https://wiki.hyperledger.org/display/HYP/Defect+Response) on our [wiki](https://wiki.hyperledger.org).
The process by which the Hyperledger Security Team handles security bugs is documented further in our [Defect Response page](https://lf-hyperledger.atlassian.net/wiki/spaces/SEC/pages/20283618/Defect+Response) on our [wiki](https://lf-hyperledger.atlassian.net/wiki).
The `asset-transfer-abac` sample demonstrates the use of Attribute-based access control within the context of a simple asset transfer scenario. The sample also uses authorization based on individual client identities to allow the users that interact with the network to own assets on the blockchain ledger.
Attribute-Based Access Control (ABAC) refers to the ability to restrict access to certain functionality within a smart contract based on the attributes within a users certificate. For example, you may want certain functions within a smart contract to be used only by application administrators. ABAC allows organizations to provide elevated access to certain users without requiring those users be administrators of the network. For more information, see [Attribute-based access control](https://hyperledger-fabric-ca.readthedocs.io/en/latest/users-guide.html#attribute-based-access-control) in the Fabric CA users guide.
The `asset-transfer-abac` smart contract allows you to create assets that can be updated or transferred by the asset owner. However, the ability to create or remove assets from the ledger is restricted to identities with the `abac.creator=true` attribute. The identity that creates the asset is assigned as the asset owner. Only the owner can transfer the asset to a new owner or update the asset properties. In the course of the tutorial, we will use the Fabric CA client to create identities with the attribute required to create a new asset. We will then transfer the asset to another identity and demonstrate how the `GetID()` function can be used to enforce asset ownership. We will then use the owner identity to delete the asset. Both Attribute based access control and the `GetID()` function are provided by the [Client Identity Chaincode Library](https://github.com/hyperledger/fabric-chaincode-go/blob/master/pkg/cid/README.md).
## Start the network and deploy the smart contract
We can use the Fabric test network to deploy and interact with the `asset-transfer-abac` smart contract. Run the following command to change into the test network directory and bring down any running nodes:
```
cd fabric-samples/test-network
./network.sh down
```
Run the following command to deploy the test network using Certificate Authorities:
```
./network.sh up createChannel -ca
```
You can then use the test network script to deploy the `asset-transfer-abac` smart contract to a channel on the network:
```
./network.sh deployCC -ccn abac -ccp ../asset-transfer-abac/chaincode-go/ -ccl go
```
## Register identities with attributes
We can use the one of the test network Certificate Authorities to register and enroll identities with the attribute of `abac.creator=true`. First, we need to set the following environment variables in order to use the Fabric CA client.
```
export PATH=${PWD}/../bin:${PWD}:$PATH
export FABRIC_CFG_PATH=$PWD/../config/
```
We will create the identities using the Org1 CA. Set the Fabric CA client home to the MSP of the Org1 CA admin:
There are two ways to generate certificates with attributes added. We will use both methods and create two identities in the process. The first method is to specify that the attribute be added to the certificate by default when the identity is registered. The following command will register an identity named creator1 with the attribute of `abac.creator=true`.
The `ecert` suffix adds the attribute to the certificate automatically when the identity is enrolled. As a result, the following enroll command will contain the attribute that was provided in the registration command.
The second method is to request that the attribute be added upon enrollment. The following command will register an identity named creator2 with the same `abac.creator` attribute.
You can use either identity with the `abac.creator=true` attribute to create an asset using the `asset-transfer-abac` smart contract. We will set the following environment variables to use the first identity that was generated, creator1:
The result will list the creator1 identity as the asset owner. The `GetID()` API reads the name and issuer from the certificate of the identity that submitted the transaction and assigns that identity as the asset owner:
As the owner of Asset1, the creator1 identity has the ability to transfer the asset to another owner. In order to transfer the asset, the owner needs to provide the name and issuer of the new owner to the `TransferAsset` function. The `asset-transfer-abac` smart contract has a `GetSubmittingClientIdentity` function that allows users to retrieve their certificate information and provide it to the asset owner out of band (we omit this step). Issue the command below to transfer Asset1 to the user1 identity from Org1 that was created when the test network was deployed:
Now that the asset has been transferred, the new owner can update the asset properties. The smart contract uses the `GetID()` API to ensure that the update is being submitted by the asset owner. To demonstrate the difference between identity and attribute based access control, lets try to update the asset using the creator1 identity first:
Even though creator1 can create new assets, the smart contract detects that the transaction was not submitted by the identity that owns the asset, user1. The command returns the following error:
```
Error: endorsement failure during invoke. response: status:500 message:"submitting client not authorized to update asset, does not own asset"
```
Run the following command to operate as the asset owner by setting the MSP path to User1:
We can now update the asset. Run the following command to change the asset color from blue to green. All other aspects of the asset will remain unchanged.
While we are operating as User1, we can demonstrate attribute based access control by trying to create an asset using an identity without the `abac.creator=true` attribute. Run the following command to try to create Asset1 as User1:
The smart contract will return the following error:
```
Error: endorsement failure during invoke. response: status:500 message:"submitting client not authorized to create asset, does not have abac.creator role"
```
## Clean up
When you are finished, you can run the following command to bring down the test network:
- Connecting a client application to a Fabric blockchain network.
- Submitting smart contract transactions to update ledger state.
- Evaluating smart contract transactions to query ledger state.
- Handling errors in transaction invocation.
## About the sample
This sample includes smart contract and application code in multiple languages. This sample shows create, read, update, transfer and delete of an asset.
For a more detailed walk-through of the application code and client API usage, refer to the [Running a Fabric Application tutorial](https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html) in the main Hyperledger Fabric documentation.
### Application
Follow the execution flow in the client application code, and corresponding output on running the application. Pay attention to the sequence of:
- Transaction invocations (console output like "**--> Submit Transaction**" and "**--> Evaluate Transaction**").
- Results returned by transactions (console output like "**\*\*\* Result**").
### Smart Contract
The smart contract (in folder `chaincode-xyz`) implements the following functions to support the application:
- CreateAsset
- ReadAsset
- UpdateAsset
- DeleteAsset
- TransferAsset
Note that the asset transfer implemented by the smart contract is a simplified scenario, without ownership validation, meant only to demonstrate how to invoke transactions.
## Running the sample
The Fabric test network is used to deploy and run this sample. Follow these steps in order:
1. Create the test network and a channel (from the `test-network` folder).
```
./network.sh up createChannel -c mychannel -ca
```
1. Deploy one of the smart contract implementations (from the `test-network` folder).
- To deploy the **TypeScript** chaincode implementation:
1. Run the application (from the `asset-transfer-basic` folder).
- To run the **TypeScript** sample application:
```shell
cd application-gateway-typescript
npm install
npm start
```
- To run the **JavaScript** sample application:
```shell
cd application-gateway-javascript
npm install
npm start
```
- To run the **Go** sample application:
```shell
cd application-gateway-go
go run .
```
- To run the **Java** sample application:
```shell
cd application-gateway-java
./gradlew run
```
## Clean up
When you are finished, you can bring down the test network (from the `test-network` folder). The command will remove all the nodes of the test network, and delete any ledger data that you created.
// Submit transaction, passing in the wrong number of arguments ,expected to throw an error containing details of any error responses from the smart contract.
fmt.Printf("Timeout waiting for transaction %s commit status: %s\n",commitStatusErr.TransactionID,commitStatusErr)
}else{
fmt.Printf("Error obtaining commit status for transaction %s with gRPC status %v: %s\n",commitStatusErr.TransactionID,status.Code(commitStatusErr),commitStatusErr)
}
}elseiferrors.As(err,&transactionErr){
// The error could be an EndorseError, SubmitError or CommitError.
This sample provides an introduction to how to use external builder and launcher scripts to run chaincode as an external service to your peer. For more information, see the [Chaincode as an external service](https://hyperledger-fabric.readthedocs.io/en/latest/cc_service.html) topic in the Fabric documentation.
**Note:** each organization in a real network would need to setup and host their own instance of the external service. In this tutorial, we use the same instance for both organizations for simplicity.
## Setting up the external builder and launcher
External Builders and Launchers is an advanced feature that typically requires custom packaging of the peer image so that it contains all the tools your builder and launcher require. This sample uses very simple (and crude) shell scripts that can be run directly within the default Fabric peer images.
Open the `config/core.yaml` file at the top of the `fabric-samples` directory. If you do not have this file, follow the instructions to [Install the Samples, Binaries and Docker Images](https://hyperledger-fabric.readthedocs.io/en/latest/install.html) to download the Fabric binaries and configuration files alongside the Fabric samples.
Modify the `externalBuilders` field in the `core.yaml` file to resemble the configuration below:
This update sets the name of the external builder as `external-sample-builder`, and the path of the builder to the scripts provided in this sample. Note that this is the path within the peer container, not your local machine.
To set the path within the peer container, you will need to modify the docker compose file to mount a couple of additional volumes. Open the file `test-network/compose/docker/docker-compose-test-net.yaml`, and add to the `volumes` section of both `peer0.org1.example.com` and `peer0.org2.example.com` the following two lines:
This update will mount the `core.yaml` that you modified into the peer container and override the configuration file within the peer image. The update also mounts the fabric-sample builder so that it can be found at the location that you specified in `core.yaml`. You also have the option of commenting out the line `- /var/run/docker.sock:/host/var/run/docker.sock`, since we no longer need to access the docker daemon from inside the peer container to launch the chaincode.
## Packaging and installing Chaincode
The Asset-Transfer-Basic external chaincode requires two environment variables to run, `CHAINCODE_SERVER_ADDRESS` and `CHAINCODE_ID`, which are described and set in the `chaincode.env` file.
You need to provide a `connection.json` configuration file to your peer in order to connect to the external Asset-Transfer-Basic service. The address specified in the `connection.json` must correspond to the `CHAINCODE_SERVER_ADDRESS` value in `chaincode.env`, which is `asset-transfer-basic.org1.example.com:9999` in our example.
Because we will run our chaincode as an external service, the chaincode itself does not need to be included in the chaincode
package that gets installed to each peer. Only the configuration and metadata information needs to be included
in the package. Since the packaging is trivial, we can manually create the chaincode package.
Open a new terminal and navigate to the `fabric-samples/asset-transfer-basic/chaincode-external` directory.
```
cd fabric-samples/asset-transfer-basic/chaincode-external
```
First, create a `code.tar.gz` archive containing the `connection.json` file:
```
tar cfz code.tar.gz connection.json
```
Then, create the chaincode package, including the `code.tar.gz` file and the supplied `metadata.json` file:
```
tar cfz asset-transfer-basic-external.tgz metadata.json code.tar.gz
```
You are now ready to deploy the external chaincode sample.
## Starting the test network
We will use the Fabric test network to run the external chaincode. Open a new terminal and navigate to the `fabric-samples/test-network` directory.
```
cd fabric-samples/test-network
```
Run the following command to deploy the test network and create a new channel:
```
./network.sh up createChannel -c mychannel -ca
```
We are now ready to deploy the external chaincode.
## Installing the external chaincode
We can't use the test network script to install an external chaincode so we will have to do a bit more work. However, we can still leverage part of the test-network scripts to make this easier.
From the `test-network` directory, set the following environment variables to use the Fabric binaries:
```
export PATH=${PWD}/../bin:$PATH
export FABRIC_CFG_PATH=$PWD/../config/
```
Run the following command to import functions from the `envVar.sh` script into your terminal. These functions allow you to act as either test network organization.
```
. ./scripts/envVar.sh
```
Run the following commands to install the `asset-transfer-basic-external.tar.gz` chaincode on org1. The `setGlobals` function simply sets the environment variables that allow you to act as org1 or org2.
Save the package ID that was returned by the command as an environment variable. The ID will not be the same for all users, so you need to set the variable using the ID from your command window:
## Running the Asset-Transfer-Basic external service
We are going to run the smart contract as an external service by first building and then starting a docker container. Open a new terminal and navigate back to the `chaincode-external` directory:
```
cd fabric-samples/asset-transfer-basic/chaincode-external
```
In this directory, open the `chaincode.env` file to set the `CHAINCODE_ID` variable to the same package ID that was returned by the `peer lifecycle chaincode queryinstalled` command. The value should be the same as the environment variable that you set in the previous terminal.
After you edit the `chaincode.env` file, you can use the `Dockerfile` to build an image of the external Asset-Transfer-Basic chaincode:
This will start and run the external chaincode service within the container.
## Deploy the Asset-Transfer-Basic external chaincode definition to the channel
Navigate back to the `test-network` directory to finish deploying the chaincode definition of the external smart contract to the channel. Make sure that your environment variables are still set.
The commands above approve the chaincode definition for the external chaincode and commits the definition to the channel. The resulting output should be similar to the following:
```
2020-08-05 15:41:44.982 PDT [chaincodeCmd] ClientWait -> INFO 001 txid [6bdbe040b99a45cc90a23ec21f02ea5da7be8b70590eb04ff3323ef77fdedfc7] committed with status (VALID) at localhost:7051
2020-08-05 15:41:44.983 PDT [chaincodeCmd] ClientWait -> INFO 002 txid [6bdbe040b99a45cc90a23ec21f02ea5da7be8b70590eb04ff3323ef77fdedfc7] committed with status (VALID) at localhost:9051
```
Now that we have started the chaincode service and deployed it to the channel, we can submit transactions as we would with a normal chaincode.
## Using the Asset-Transfer-Basic external chaincode
Open yet another terminal and navigate to the `fabric-samples/asset-transfer-basic/application-gateway-go` directory:
```
cd fabric-samples/asset-transfer-basic/application-gateway-go
```
Run the following commands to use the node application in this directory to test the external smart contract:
```
go run .
```
If all goes well, the program should run exactly the same as described in the "Writing Your First Application" tutorial.
## Enabling TLS for chaincode and peer communication
**Note:** This section uses an example of self-signed certificate. You may use your organization hosted CA to issue the certificate and generate a key for production deployment.
In the sample so far, you connected both peers in `test-network` to the single instance of chaincode server. However, if you would like to enable TLS between the peer nodes and the chaincode server, each peer node needs to have its own CA certificate. Enabling TLS is made possible at runtime in the chaincode.
- As a first step generate a keypair that can be used. Run these commands from the `fabric-samples/asset-transfer-basic/chaincode-external` directory.
_Find instructions to install `openssl` in [openssl.org](https://www.openssl.org/)_
- Generate a client key and cert for auth purpose. You need a key and cert generated from the CA of each organization. Peer nodes act as clients to chaincode server.
- Change the `connection.json` with the below contents. The `root_cert` parameter is the root CA certificate which the chaincode server is run with. You may run the below commands to get the certificate file contents as strings and copy them when needed.
- Follow the instructions in [Package](#packaging-and-installing-chaincode) and [Install](#installing-the-external-chaincode) steps for each organization. Remember that the chaincode server's address for the second organization is `asset-transfer-basic.org2.example.com:9999`.
- Copy the appropriate `CHAINCODE_ID` to both [chaincode1.env](./chaincode1.env) and [chaincode2.env](./chaincode2.env) files. Bring up the chaincode containers using the docker-compose command below
```
docker-compose up -f docker-compose-chaincode.yaml up --build -d
```
- Follow the instructions in [Finish Deployment](#finish-deploying-the-asset-transfer-basic-external-chaincode-) for each organization seperately.