Commit graph

705 commits

Author SHA1 Message Date
Brett Logan
daa732d3d8 Revert "WIP (#253)"
This reverts commit d5ce443bee.

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-20 13:18:45 -04:00
Brett Logan
d5ce443bee
WIP (#253)
* WIP

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>

* WIP 2

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-20 12:49:16 -04:00
Tiffany Harris
cad6b90383 Fix unmarshaling asset in ReadAsset()
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
2020-07-20 11:51:32 -04:00
Naser Mirzaei
12b07b40a9
use mkdir -p for create directories (#248)
Signed-off-by: Naser Mirzaei <nasermirzaei89@gmail.com>
2020-07-20 11:37:16 -04:00
nikhil550
f4c439ce8a
Add endorsement policy to chaincode deployment script (#247)
Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>

Co-authored-by: NIKHIL E GUPTA <negupta@us.ibm.com>
2020-07-17 08:58:19 -04:00
Sijo Cherian
b4ed9e5afd
Simplify asset-transfer-basic javascript application (#241)
* 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>
2020-07-15 15:21:38 -04:00
Brett Logan
14e9ccf85b Remove QueryResult Type
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>
2020-07-15 13:22:56 -04:00
Brett Logan
c621ca9eb4 Fix constructQueryResponseFromIterator
constructQueryResponseFromIterator was returning a QueryResult
slice as opposed to an Asset slice.

Signed-off-by: Brett Logan <brett.t.logan@ibm.com>
2020-07-15 13:22:11 -04:00
Bret Harrison
1f27c327f3 Allow install of a chaincode
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>
2020-07-15 10:39:12 -04:00
Brett Logan
5f80da096c Refactor Asset Query Chaincode Into Idiomatic Go
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>
2020-07-15 10:36:04 -04:00
Chris Gabriel
621a2c263e Fix param sequence for typescript invoke function.
Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
2020-07-12 17:29:06 -04:00
Chris Gabriel
e83aecfe0c Fix param sequence for javascript invoke function.
Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
2020-07-12 17:28:43 -04:00
Chris Gabriel
aa3ae32afb Fix param sequence in smartcontract
smartcontract_test.

Signed-off-by: Chris Gabriel <chris_gabriel_98@yahoo.com>
2020-07-12 12:12:32 -04:00
NIKHIL E GUPTA
09ebf1c1ce Initialize new private data asset transfer CC
Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>
2020-07-11 08:04:37 -04:00
Brett Logan
a401bc92bc Refactor Asset Secured Chaincode Into Idiomatic Go
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>
2020-07-11 07:53:45 -04:00
Acmefocus
59acacbef1
run fabcar go (#232)
* add go/runfabcar.sh

Signed-off-by: Acmefocus <107723772@qq.com>

* add set hosts and env in go

Signed-off-by: Acmefocus <107723772@qq.com>

* Update fabcar/startFabric.sh

Co-authored-by: Sijo Cherian <sijocherian@users.noreply.github.com>
Signed-off-by: Acmefocus <107723772@qq.com>

* Update startFabric.sh

delete  set  /etc/hosts

Signed-off-by: Acmefocus <107723772@qq.com>

* add environment variable DISCOVERY_AS_LOCALHOST

Signed-off-by: Acmefocus <107723772@qq.com>

Co-authored-by: Sijo Cherian <sijocherian@users.noreply.github.com>
2020-07-10 16:18:05 +01:00
r2roC
1249207afd Update asset_transfer_ledger_chaincode.go
Small off-by-1 bug fix.

Signed-off-by: r2roC <arturo@IBM.com>
2020-07-10 07:39:46 -04:00
Brett Logan
426cdf1f98 Add Tests and Mocks To Asset Transfer Chaincode
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>
2020-07-10 05:59:22 -04:00
Brett Logan
a04db374aa Refactor Chaincode Into Idiomatic Go
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>
2020-07-10 05:59:22 -04:00
James Taylor
5fe1387a89
Fix java fabcar queryAllCars (#239)
Java chaincode still does not support open ended range queries

Signed-off-by: James Taylor <jamest@uk.ibm.com>
2020-07-09 17:32:08 +01:00
NIKHIL E GUPTA
df727853c8 Update tests for commercial paper
Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>
2020-07-03 13:46:01 -04:00
NIKHIL E GUPTA
a1b7da9b5c remove link to BYFN in README
Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>
2020-07-03 13:44:31 -04:00
denyeart
9291154f78
Remove gossip leader election config from samples (#223)
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>
2020-07-02 15:37:15 -04:00
Dereck
1eafa98a6f
Add application-typescript to asset-transfer-basci (#221)
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-07-02 13:43:48 -04:00
Dereck
fd98ec650a
Add filepath check for invoke (#222)
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-07-02 13:36:47 -04:00
Brett Logan
8b54e14ee4 Use Official CouchDB 3.1 Image
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>
2020-07-02 09:56:30 -04:00
James Taylor
7154ed8629
Update fabcar java sample build (#219)
- 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>
2020-07-01 17:12:11 +01:00
James Taylor
c0570df2f8
Fix fabcar Java chaincode test & coverage failures (#218)
Also updates queryAllCars to match other implementations

Signed-off-by: James Taylor <jamest@uk.ibm.com>
2020-07-01 11:25:08 +01:00
Dereck
2f58fb29c4
Adding NodeJS app for asset-transfer-basic sample. (#206)
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-06-30 15:36:47 -04:00
nikhil550
adfef198df
FAB-18015 (#214)
Remove first network sample if Fabric 2.2

Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>

Co-authored-by: NIKHIL E GUPTA <negupta@us.ibm.com>
2020-06-26 12:36:29 -04:00
Chongxin Luo
a42bbba2c5 Adding chaincode-typescript to asset-transfer-basic sample.
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-06-25 12:06:13 -04:00
Chongxin Luo
bee5f6e07f Adding chaincode-js to asset-transfer-basic
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-06-25 12:02:53 -04:00
Chongxin Luo
22bcf8cfa4 Fix go mod for chaincode-go
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-06-25 12:01:45 -04:00
Tiffany Harris
2bd1599d83 Add asset transfer ledger queries go chaincode sample
- 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>
2020-06-25 09:15:01 -04:00
Tatsuya Sato
fc0c2f81d9 [FAB-18020] Add config.yaml to msp folder for User1 in test-network
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>
2020-06-23 22:45:37 -04:00
zhuzeyu
6c29fa0118 modify query number in fabcar for golang
default query number for fabcar in other programming language is 1000 cars

Signed-off-by: zhuzeyu <zhuzeyu0409@gmail.com>
2020-06-19 13:09:45 -04:00
Tiffany Harris
7b2dcbf2ed Rename GetAsset to ReadAsset
Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
2020-06-10 08:43:33 -04:00
Tiffany Harris
f1775d7fdc Rename IssueAsset to CreateAsset
- Move go chaincode to chaincode-go subdirectory
- Add public description argument to CreateAsset()

Signed-off-by: Tiffany Harris <tiffany.harris@ibm.com>
2020-06-10 08:23:06 -04:00
Tiffany Harris
82eaaad954 Rename marbles_transfer to asset-transfer-secured-agreement
- 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>
2020-06-09 23:24:52 -04:00
Chongxin Luo
a228b16364 Initialize asset transfer basic sample.
Signed-off-by: Chongxin Luo <Chongxin.Luo@ibm.com>
2020-06-09 19:21:24 -04:00
NIKHIL E GUPTA
86c194615d Update private data marbes for smart contract api
Signed-off-by: NIKHIL E GUPTA <negupta@us.ibm.com>
2020-06-09 15:52:35 -04:00
robmurgai
045d9b69bc
Update deployCC.sh (#199)
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>
2020-06-05 16:07:14 -04:00
Tatsuya Sato
8c7e8e1b2f
[FAB-17957] Delete --tls extra arguments from fabric-samples (#198)
`--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>
2020-06-04 16:49:29 -04:00
Tiffany Harris
0d247f06b7 Add VerifyAssetProperties to marbles_transfer example
- 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>
2020-06-04 12:34:50 -04:00
Tatsuya Sato
808f035088
[FAB-17952] Fix test-network to use the latest version of fabric-ca (#195)
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>
2020-06-03 13:34:26 -04:00
Andrew Coleman
87a2bc7afd
FABG-935 Update Go fabcar sample use latest beta (#196)
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>
2020-06-03 07:47:43 +01:00
Andrew Coleman
cda88df4f6
FABG-935 GoSDK Fabcar sample (#192)
Fabcar sample demonstrating the use of the new Gateway package in the Go SDK

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
2020-05-27 15:19:16 +01:00
Pratik Patil
2759db2847
Disconnected from the gateway in fabcar query.js (#190)
Signed-off-by: pratikpatil024 <pratikspatil024@gmail.com>
2020-05-27 11:22:01 +02:00
Ry Jones
61107dbf84
FAB-17930: Update licenses (#191)
Signed-off-by: Ry Jones <ry@linux.com>
2020-05-26 21:43:33 +02:00
Tiffany Harris
df292e0e8d Implement sale, bid, and history queries
- 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>
2020-05-25 21:22:01 -04:00