fabric-samples/full-stack-asset-transfer-guide/applications/conga-cards
Mark S. Lewis bdaeac199d
Update Go error handling for v1.10 client API (#1362)
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>
2025-11-10 09:53:58 +09:00
..
assets Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
hooks Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
images Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
src Explicitly specify hash in client applications 2024-10-07 12:25:40 -04:00
.eslintrc.js Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
.gitignore Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
.npmrc Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
package.json Update Go error handling for v1.10 client API (#1362) 2025-11-10 09:53:58 +09:00
README.md Moves the Full Stack Asset Transfer Development Guide to fabric-samples (#852) 2022-11-10 10:40:27 -05:00
tsconfig.json Use fabric-gateway v1.4 2023-10-25 17:30:29 +09:00

Conga Cards

This Gateway Client application will listen for chaincode events, invoking a #discord webhook to post a channel message when Conga Cards are created, deleted, and exchanged on a channel.

Conga Comics | Life on the chain, one block at a time by Ed Moffatt & some friends

This project is based on the trader-typescript sample Gateway Client application.

Prerequisites

The client application requires Node.js 16 or later.

Set up

The following steps prepare the client application for execution:

  1. Ensure the asset-transfer smart contract is deployed to a running Fabric network.
  2. Run npm install to download dependencies and compile the application code.

Note: After making any code changes to the application, be sure to recompile the application code. This can be done by explicitly running npm install again, or you can leave npm run build:watch running in a terminal window to automatically rebuild the application on any code change.

The client application uses environment variables to supply configuration options. You must set the following environment variables when running the application:

  • ENDPOINT - endpoint address for the Gateway service to which the client will connect in the form hostname:port. Depending on your environment, this can be the address of a specific peer within the user's organization, or an ingress endpoint that dispatches to any available peer in the user's organization.
  • MSP_ID - member service provider ID for the user's organization.
  • CERTIFICATE - PEM file containing the user's X.509 certificate.
  • PRIVATE_KEY - PEM file containing the user's private key.

The following environment variables are optional and can be set if required by your environment:

  • CHANNEL_NAME - Channel to which the chaincode is deployed. (Default: mychannel)

  • CHAINCODE_NAME - Channel to which the chaincode is deployed. (Default: asset-transfer)

  • TLS_CERT - PEM file containing the CA certificate used to authenticate the TLS connection to the Gateway peer. Only required if using a TLS connection and a private CA.

  • HOST_ALIAS - the name of the Gateway peer as it appears in its TLS certificate. Only required if the endpoint address used by the client does not match the address in the Gateway peer's TLS certificate.

  • WEBHOOK_URL - the #discord webhook to which the channel events will be relayed.

Run

The sample application is run as a command-line application, and is lauched using npm start <command> [<arg> ...]. The following commands are available:

  • npm start create <assetId> <ownerName> <color> to create a new asset.
  • npm start delete <assetId> to delete an existing asset.
  • npm start getAllAssets to list all assets.
  • npm start read <assetId> to view an existing asset.
  • npm start transfer <assetId> <ownerName> <ownerMspId> to transfer an asset to a new owner within an organization MSP ID.
  • npm start discord starts an event loop, relaying channel events to ${WEBHOOK_URL}

Sample Interaction:

  • Submit some transactions to a ledger:
npm start create blockbert SeanB orange

npm start create count-blockula jkneubuhl Org1MSP purple

npm start transfer count-blockula davidboswell Org1MSP 
  • Run the discord event listener:
export WEBHOOK_URL="https://discord.com/api/webhooks/123456789/xyzzy-abcdef-12345"

npm start discord

Sample Interaction