https://github.com/settlemint/chaincode-typescript-empty-pdc
https://github.com/settlemint/chaincode-typescript-empty-pdc
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/settlemint/chaincode-typescript-empty-pdc
- Owner: settlemint
- License: mit
- Created: 2024-05-02T13:10:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-01T04:41:21.000Z (4 months ago)
- Last Synced: 2025-03-01T05:24:57.689Z (4 months ago)
- Language: TypeScript
- Size: 388 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hyperledger Fabric Empty Smart PDC Contract Set
An empty Hyperledger Fabric smart contract set using Typescript.
## Get started
Launch this smart contract set in the SettleMint Blockchain Transformation platform under the `Smart Contract Sets` section. This will automatically link it to your own blockchain node and make use of the private keys living in the platform.
## Prerequisites
1. Update `collection_config.json` with the right MSPId's of your network.
2. Update `.env` `CC_SIGNATURE_POLICY` to match the MSPId's of your network.## Usage
Creating an asset:
There are two ways to create an asset:
```bash
export ASSET_PROPERTIES=$(echo -n "{\"objectType\":\"ValuableAsset\",\"assetID\":\"asset1\",\"color\":\"green\",\"size\":20,\"appraisedValue\":100}" | base64 | tr -d \\n)
BTP_SERVICE_TOKEN= ./lib/btp-chaincode-lifecycle/chaincode.sh invoke 'CreateAsset' --transient "{ \"asset_properties\": \"${ASSET_PROPERTIES}\"}"
```Or let the api do the base64 encoding for you:
```bash
BTP_SERVICE_TOKEN= ./lib/btp-chaincode-lifecycle/chaincode.sh invoke 'CreateAsset' --transient '{ "asset_properties": { "objectType": "ValuableAsset", "assetID": "asset1", "color": "green", "size": "20", "appraisedValue": "100" }}'
```Query the newly created asset:
```bash
BTP_SERVICE_TOKEN= ./lib/btp-chaincode-lifecycle/chaincode.sh query 'ReadAsset' --arguments 'asset1'
```Here your access token is an application access token or a personal access token scoped to the nodes you wish to interact with.