Wholesale CBDC Model

The enhanced version of Blockchain App Builder includes a model attribute that generates additional methods for the wholesale central bank digital currency (CBDC) scenario.

If you include the model: wcbdc parameter in the specification file for tokens that use the extended Token Taxonomy Framework standard, Blockchain App Builder application-specific chaincode, including the following additional methods and functionality for use with the wholesale CBDC application.

TypeScript Methods for Wholesale CBDC

The wholesale CBDC chaincode includes all methods available in the generic Token Taxonomy Framework NFT chaincode. The following additional methods that are specific to the wholesale CBDC scenario are available.
setApplicationGroups
This method sets the application_groups parameter in the account details for the specified application groups in the API. This method can be called only by a Token Admin or Org Admin of the specified organization.
public async setApplicationGroups (org_id: string, user_id: string, token_id: string, application_groups: string[])
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
  • token_id: string – The ID of the token.
  • application_groups: string[] – A list of application groups the user ID belongs to, which define the user's associations in the CBDC application.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "453821c7ffd477987ef8ccbd836b893969531ab768098cd4a99e3b89cd38a391",
        "payload": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~28ac774001f374064029d51af4fb67e26ea1ea9ef62828b7a72dbf3beb8efd8d",
            "user_id": "admin_user_cb",
            "org_id": "CB",
            "token_type": "fungible",
            "token_id": "",
            "token_name": "",
            "balance": 0,
            "onhold_balance": 0,
            "application_groups": [
                "CBDC_ADMINS"
            ],
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 100,
            "daily_transactions": 0,
            "current_date": "2024-12-09T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 188
    }
}
getAllActiveAccounts
This method returns all of the active accounts that are associated with the specified token ID. Any user can call this method.
public async getAllActiveAccounts(token_id: string)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                "non_account_role_name": [
                    "token_admin"
                ],
                "role_name": null,
                "valueJson": {
                    "bapAccountVersion": 0,
                    "assetType": "oaccount",
                    "account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                    "user_id": "admin_user_cb",
                    "org_id": "CB",
                    "token_type": "fungible",
                    "token_id": "USD",
                    "token_name": "cbdc",
                    "balance": 0,
                    "onhold_balance": 0,
                    "application_groups": [
                        "CBDC_ADMINS"
                    ],
                    "max_daily_amount": 10000,
                    "daily_amount": 0,
                    "max_daily_transactions": 1000,
                    "daily_transactions": 0,
                    "current_date": "2024-11-20T00:00:00.000Z"
                }
            }
        ],
        "encode": "JSON"
    }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
              "non_account_role_name": [
                  "token_admin"
              ],
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                  "org_id": "CB",
                  "user_id": "admin_user_cb",
                  "token_id": "USD",
                  "max_daily_amount": 10000,
                  "max_daily_transactions": 1000
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
              "non_account_role_name": [
                  "token_admin"
              ],
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                  "org_id": "CB",
                  "user_id": "admin_user_cb",
                  "token_id": "USD",
                  "max_daily_amount": 10000,
                  "max_daily_transactions": 1000
              }
          }
      ],
      "encode": "JSON"
  }
}
getAllSuspendedAccounts
This method returns all of the suspended accounts that are associated with the specified token ID. Any user can call this method.
func (t *Controller) GetAllSuspendedAccounts(token_id string) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                "non_account_role_name": null,
                "role_name": null,
                "valueJson": {
                    "assetType": "oaccount",
                    "bapAccountVersion": 1,
                    "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                    "user_id": "user1_fi1",
                    "org_id": "FI1",
                    "token_type": "fungible",
                    "token_id": "USD",
                    "token_name": "cbdc",
                    "balance": 5,
                    "onhold_balance": 0,
                    "application_groups": [
                        "FI_CBDC_USERS"
                    ],
                    "max_daily_amount": 10000,
                    "daily_amount": 0,
                    "max_daily_transactions": 1000,
                    "daily_transactions": 0,
                    "current_date": "2024-11-20T00:00:00.000Z"
                }
            }
        ],
        "encode": "JSON"
    }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
              "non_account_role_name": null,
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                  "org_id": "FI1",
                  "user_id": "user1_fi1",
                  "token_id": "USD",
                  "max_daily_amount": 10000,
                  "max_daily_transactions": 1000
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
              "non_account_role_name": null,
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                  "org_id": "FI1",
                  "user_id": "user1_fi1",
                  "token_id": "USD"
              }
          }
      ],
      "encode": "JSON"
  }
}
getBurnQuantity
This method returns the total quantity of burned tokens for a specified organization. This method can be called only by a Token Admin, Token Auditor, or a user with the burner role.
public async getBurnQuantity(token_id: string)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": {
          "burnt_quantity": 31
      },
      "encode": "JSON"
  }
}
getActionHistory
This method retrieves the history of approvals or rejections made by the caller for mint, burn, and transfer (issuance) operations, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
public async getActionHistory(token_id: string)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "from_account_id": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
              "from_org_id": "CB",
              "from_user_id": "retirer_user_cb",
              "holding_id": "ohold~cbdc~USD~eaf6",
              "holding_status": "REJECT_BURN",
              "last_updated_time": "2024-11-26T21:43:22.000Z",
              "notary_account_id": null,
              "notary_org_id": null,
              "notary_user_id": null,
              "operation_id": null,
              "quantity": 3,
              "timetoexpiration": null,
              "to_account_id": "",
              "to_org_id": null,
              "to_user_id": null,
              "token_id": "USD",
              "token_name": null
          },
          {
              "from_account_id": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
              "from_org_id": "CB",
              "from_user_id": "retirer_user_cb",
              "holding_id": "ohold~cbdc~USD~0031",
              "holding_status": "REJECT_BURN",
              "last_updated_time": "2024-11-26T21:43:15.000Z",
              "notary_account_id": null,
              "notary_org_id": null,
              "notary_user_id": null,
              "operation_id": null,
              "quantity": 2,
              "timetoexpiration": null,
              "to_account_id": "",
              "to_org_id": null,
              "to_user_id": null,
              "token_id": "USD",
              "token_name": null
          }
      ],
      "encode": "JSON"
  }
}
getPendingIssuance
This method retrieves all pending issuance (transfer) transactions where the caller is assigned as an approver, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary). This method can be called only by a Token Admin or Token Auditor of the chaincode, an Org Admin or Org Auditor of the specified organization, or the Notary.
public async getPendingIssuance(token_id: string)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "asset_type": "ONHOLD",
              "category": "category value",
              "from_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "from_org_id": "CB",
              "from_user_id": "creator_user_cb",
              "holding_id": "ohold~cbdc~USD~8e314",
              "notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
              "notary_org_id": "CB",
              "notary_user_id": "manager_user_cb",
              "operation_id": "8e314",
              "quantity": 10,
              "timetoexpiration": "0",
              "to_account_id": "oaccount~44b844deccc6c314e14b8b9b95b51db5c8de499dbdbd3def2a44ba54c899c142",
              "to_org_id": "FI1",
              "to_user_id": "officer_user1_fi1",
              "token_id": "USD",
              "token_name": "cbdc"
          },
          {
              "asset_type": "ONHOLD",
              "category": "category value",
              "from_account_id": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
              "from_org_id": "CB",
              "from_user_id": "issuer_user_cb",
              "holding_id": "ohold~cbdc~USD~8e315",
              "notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
              "notary_org_id": "CB",
              "notary_user_id": "manager_user_cb",
              "operation_id": "8e315",
              "quantity": 10,
              "timetoexpiration": "0",
              "to_account_id": "oaccount~44b844deccc6c314e14b8b9b95b51db5c8de499dbdbd3def2a44ba54c899c142",
              "to_org_id": "FI1",
              "to_user_id": "officer_user1_fi1",
              "token_id": "USD",
              "token_name": "cbdc"
          }
      ],
      "encode": "JSON"
  }
}
getPendingRequest
This method retrieves all pending requests of a specified type where the caller is assigned as an approver. This method can be called only by a Token Admin or Token Auditor of the chaincode, an Org Admin or Org Auditor of the specified organization, or the Notary.
public async getPendingRequest(token_id: string, request_type: string)
Parameters:
  • token_id: string – The ID of the token.
  • request_type: string – The transaction type. For example, mint or burn.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "valueJson": {
                  "assetType": "ohold",
                  "holding_id": "ohold~cbdc~USD~op123",
                  "operation_id": "op123",
                  "token_id": "USD",
                  "token_name": "cbdc",
                  "operation_type": "mint",
                  "status": "pending",
                  "from_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "to_account_id": "",
                  "notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
                  "quantity": 10,
                  "time_to_expiration": "0",
                  "category": "category value",
                  "description": "description value"
              }
          }
      ],
      "encode": "JSON"
  }
}
getTotalBalanceByCallerOrgId
This method retrieves the total balance of the caller's organization. It can be called by a Token Admin, Token Auditor, Org Admin, Org Auditor, or any account owner.
public async getTotalBalanceByCallerOrgId()
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "totalBalance": 704
          }
      ],
      "encode": "JSON"
  }
}
getTransactionWithBlockNumber
This method returns the details of the transaction for the specified transaction ID.
public async getTransactionWithBlockNumber(token_id: string, transaction_id: string)
Parameters:
  • token_id: string – The ID of the token.
  • transaction_id: string – The ID of the transaction.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "blockNo": 82,
              "key": "otransaction~24f391919a8837d654beaa7346148ea8b2b9704624aef482ce68078c485f5b1b",
              "metadata": null,
              "txnNo": 0,
              "value": null,
              "valueJson": {
                  "assetType": "otransaction",
                  "transaction_id": "otransaction~24f391919a8837d654beaa7346148ea8b2b9704624aef482ce68078c485f5b1b",
                  "token_id": "USD",
                  "from_account_id": "",
                  "from_account_balance": 0,
                  "from_account_onhold_balance": 0,
                  "to_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "to_account_balance": 100,
                  "to_account_onhold_balance": 0,
                  "transaction_type": "REQUEST_MINT",
                  "amount": 200,
                  "timestamp": "2024-11-20T06:48:42.000Z",
                  "number_of_sub_transactions": 0,
                  "holding_id": "",
                  "sub_transaction": "false",
                  "description": ""
              }
          }
      ],
      "encode": "JSON"
  }
}

The following API is modified for the wholesale CBDC model.

createAccount
This method creates an account for a specified user and token. An account must be created for any user who will have tokens at any point. Accounts track balances, on-hold balances, and transaction history. An account ID is formed by concatenating the asset type and token ID and then creating a SHA-256 hash over a concatenation of the organization ID and user ID. This method can be called only by a Token Admin of the chaincode.
public async createAccount(org_id: string, user_id: string, token_type: string, application_groups: string[], daily_limits?: DailyLimits)
Parameters:
  • orgId – The membership service provider (MSP) ID of the user to create the account for. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • userId – The user name or email ID of the user. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • tokenType: TokenType – The type of token, which must be fungible.
  • application_groups: string[] – A list of application groups the user Id belongs to, which define the user's associations in the CBDC application.
  • daily_limits: DailyLimits – A JSON object of the following type.
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    In the example, the max_daily_amount value is the maximum amount of tokens that can be transacted daily and max_daily_transactions value is the maximum number of transactions that can be completed daily.
  • endorsers: string[] – An array of the peers (for example, peer1, peer2) that must endorse the transaction.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "453821c7ffd477987ef8ccbd836b893969531ab768098cd4a99e3b89cd38a391",
        "payload": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~28ac774001f374064029d51af4fb67e26ea1ea9ef62828b7a72dbf3beb8efd8d",
            "user_id": "admin_user_cb",
            "org_id": "CB",
            "token_type": "fungible",
            "token_id": "",
            "token_name": "",
            "balance": 0,
            "onhold_balance": 0,
            "application_groups": [
                "CBDC_ADMINS"
            ],
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 100,
            "daily_transactions": 0,
            "current_date": "2024-12-09T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 188
    }
}

Go Methods for Wholesale CBDC

The wholesale CBDC chaincode includes all methods available in the generic Token Taxonomy Framework NFT chaincode. The following additional methods that are specific to the wholesale CBDC scenario are available.
SetApplicationGroups
This method sets the application_groups parameter in the account details for the specified application groups in the API. This method can be called only by a Token Admin or Org Admin of the specified organization.
func (t *Controller) SetApplicationGroups(token_id string, org_id string, user_id string, application_groups []string) (interface{}, error)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
  • token_id: string – The ID of the token.
  • application_groups: string[] – A list of application groups the user ID belongs to, which define the user's associations in the CBDC application.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "261c3da4bb6f1724bc8f674c7b001a9b986bc9900d0508363039424926b143ed",
        "payload": {
            "AssetType": "oaccount",
            "AccountId": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
            "UserId": "admin_user_cb",
            "OrgId": "CB",
            "TokenType": "fungible",
            "TokenId": "",
            "TokenName": "",
            "Balance": 0,
            "BalanceOnHold": 0,
            "BapAccountVersion": 0,
            "ApplicationGroups": [
                "CBDC_ADMINS"
            ],
            "MaxDailyAmount": 10000,
            "DailyAmount": 0,
            "MaxDailyTransactions": 100,
            "DailyTransactions": 0,
            "CurrentDate": "2024-12-09"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 246
    }
}
GetAllActiveAccounts
This method returns all of the active accounts that are associated with the specified token ID. Any user can call this method.
func (t *Controller) GetAllActiveAccounts(token_id string) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "NonAccountRoleName": "[\"token_admin\"]",
                "RoleName": null,
                "key": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                "valueJson": {
                    "AccountId": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                    "ApplicationGroups": [
                        "CBDC_ISSUERS"
                    ],
                    "AssetType": "oaccount",
                    "Balance": 0,
                    "BalanceOnHold": 0,
                    "BapAccountVersion": 0,
                    "CurrentDate": "2024-11-21",
                    "DailyAmount": 0,
                    "DailyTransactions": 0,
                    "MaxDailyAmount": 10000,
                    "MaxDailyTransactions": 100,
                    "OrgId": "CB",
                    "TokenId": "USD",
                    "TokenName": "cbdc",
                    "TokenType": "fungible",
                    "UserId": "admin_user_cb"
                }
            }
        ],
        "encode": "JSON"
    }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": "[\"token_auditor\"]",
              "RoleName": null,
              "key": "oaccount~bd6262ffdf582675dd9b2506c1d5488864feef0b9e297a9a3322b7c683ad6214",
              "valueJson": {
                  "AccountId": "oaccount~bd6262ffdf582675dd9b2506c1d5488864feef0b9e297a9a3322b7c683ad6214",
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "UserId": "auditor_user_cb",
                  "MaxDailyAmount": 10000,
                  "MaxDailyTransactions": 100,
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": "[\"token_admin\"]",
              "RoleName": null,
              "key": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
              "valueJson": {
                  "AccountId": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "UserId": "admin_user_cb"
              }
          }
      ],
      "encode": "JSON"
  }
}
GetAllSuspendedAccounts
This method returns all of the suspended accounts that are associated with the specified token ID. Any user can call this method.
public async getAllSuspendedAccounts(token_id: string)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": null,
              "RoleName": "minter",
              "key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "valueJson": {
                  "AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "ApplicationGroups": [
                      "CBDC_ADMINS"
                  ],
                  "AssetType": "oaccount",
                  "Balance": 140,
                  "BalanceOnHold": 0,
                  "BapAccountVersion": 8,
                  "CurrentDate": "2024-11-21",
                  "DailyAmount": 70,
                  "DailyTransactions": 3,
                  "MaxDailyAmount": 10000,
                  "MaxDailyTransactions": 100,
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "TokenName": "cbdc",
                  "TokenType": "fungible",
                  "UserId": "creator_user_cb"
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": null,
              "RoleName": "minter",
              "key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "valueJson": {
                  "AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "UserId": "creator_user_cb",
                  "MaxDailyAmount": 10000,
                  "MaxDailyTransactions": 100,
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "NonAccountRoleName": null,
                "RoleName": "minter",
                "key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "valueJson": {
                    "AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                    "OrgId": "CB",
                    "TokenId": "USD",
                    "UserId": "creator_user_cb"
                }
            }
        ],
        "encode": "JSON"
    }
}
GetBurnQuantity
This method returns the total quantity of burned tokens for a specified organization. This method can be called only by a Token Admin, Token Auditor, or a user with the burner role.
func (t *Controller) GetBurnQuantity(token_id string) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": {
          "BurnQuantity": 10
      },
      "encode": "JSON"
  }
}
GetActionHistory
This method retrieves the history of approvals or rejections made by the caller for mint, burn, and transfer (issuance) operations, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
func (t *Controller) GetActionHistory(token_id string) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "FromAccountId": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
              "FromOrgId": "CB",
              "FromUserId": "retirer_user_cb",
              "HoldingId": "ohold~cbdc~USD~6e1223",
              "HoldingStatus": "REJECT_BURN",
              "LastUpdatedTime": "2024-11-21T22:08:26Z",
              "NotaryAccountId": null,
              "NotaryOrgId": null,
              "NotaryUserId": null,
              "OperationId": null,
              "Quantity": 5,
              "TimeToExpiration": null,
              "ToAccountId": "",
              "ToOrgId": null,
              "ToUserId": null,
              "TokenId": "USD",
              "TokenName": null
          },
          {
              "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "FromOrgId": "CB",
              "FromUserId": "creator_user_cb",
              "HoldingId": "ohold~cbdc~USD~hold2",
              "HoldingStatus": "RELEASEHOLD",
              "LastUpdatedTime": "2024-11-21T21:54:33Z",
              "NotaryAccountId": null,
              "NotaryOrgId": null,
              "NotaryUserId": null,
              "OperationId": null,
              "Quantity": 10,
              "TimeToExpiration": null,
              "ToAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "ToOrgId": "CB",
              "ToUserId": "creator_user_cb",
              "TokenId": "USD",
              "TokenName": null
          }
      ],
      "encode": "JSON"
  }
}
GetPendingIssuance
This method retrieves all pending issuance (transfer) transactions where the caller is assigned as an approver, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary). This method can be called only by a Token Admin or Token Auditor of the chaincode, an Org Admin or Org Auditor of the specified organization, or the Notary.
func (t *Controller) GetPendingIssuance(token_id string) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "AssetType": "ONHOLD",
              "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "FromOrgId": "CB",
              "FromUserId": "creator_user_cb",
              "HoldingId": "ohold~cbdc~USD~h123",
              "NotaryAccountId": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
              "NotaryOrgId": "CB",
              "NotaryUserId": "manager_user_cb",
              "OperationId": "h123",
              "Quantity": 10,
              "TimeToExpiration": "0",
              "ToAccountId": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
              "ToOrgId": "CB",
              "ToUserId": "issuer_user_cb",
              "TokenId": "USD",
              "TokenName": "cbdc"
          }
      ],
      "encode": "JSON"
  }
}
GetPendingRequest
This method retrieves all pending requests of a specified type where the caller is assigned as an approver. This method can be called only by a Token Admin or Token Auditor of the chaincode, an Org Admin or Org Auditor of the specified organization, or the Notary.
func (t *Controller) GetPendingRequest(token_id string, request_type string) (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
  • request_type: string – The transaction type. For example, mint or burn.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "valueJson": {
                  "AssetType": "ohold",
                  "Category": "Category value",
                  "Description": "Description value",
                  "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "HoldingId": "ohold~cbdc~USD~8e1232",
                  "NotaryAccountId": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
                  "OperationId": "8e1232",
                  "OperationType": "mint",
                  "Quantity": 100,
                  "Status": "pending",
                  "TimeToExpiration": "0",
                  "ToAccountId": "",
                  "TokenId": "USD",
                  "TokenName": "cbdc"
              }
          }
      ],
      "encode": "JSON"
  }
}
GetTotalBalanceByCallerOrgId
This method retrieves the total balance of the caller's organization. It can be called by a Token Admin, Token Auditor, Org Admin, Org Auditor, or any account owner.
func (t *Controller) GetTotalBalanceByCallerOrgId() (interface{}, error)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "TotalBalance": 180
          }
      ],
      "encode": "JSON"
  }
}
GetTransactionWithBlockNumber
This method returns the details of the transaction for the specified transaction ID.
func (t *Controller) GetTransactionWithBlockNumber(token_id string, transaction_id string)
Parameters:
  • token_id: string – The ID of the token.
  • transaction_id: string – The ID of the transaction.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "blockNo": 152,
              "key": "otransaction~eee2de20b4b042884da83e3b7b85d8532ad56f26a546ee25d227acce33375c1c",
              "metadata": null,
              "txnNo": 0,
              "value": null,
              "valueJson": {
                  "Amount": 10,
                  "AssetType": "otransaction",
                  "Category": "Category value",
                  "Description": "",
                  "FromAccountBalance": 130,
                  "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "FromAccountOnHoldBalance": 10,
                  "HoldingId": "ohold~cbdc~USD~hold1",
                  "NumberOfSubTransactions": 0,
                  "SubTransaction": "false",
                  "SubTransactionType": "",
                  "Timestamp": "2024-11-21T20:43:59Z",
                  "ToAccountBalance": 10,
                  "ToAccountId": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
                  "ToAccountOnHoldBalance": 0,
                  "TokenId": "USD",
                  "TransactionId": "otransaction~eee2de20b4b042884da83e3b7b85d8532ad56f26a546ee25d227acce33375c1c",
                  "TransactionType": "EXECUTEHOLD"
              }
          }
      ],
      "encode": "JSON"
  }
}

The following API is modified for the wholesale CBDC model.

CreateAccount
This method creates an account for a specified user and token. An account must be created for any user who will have tokens at any point. Accounts track balances, on-hold balances, and transaction history. An account ID is formed by concatenating the asset type and token ID and then creating a SHA-256 hash over a concatenation of the organization ID and user ID. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) CreateAccount(org_id string, user_id string, token_type string, application_groups []string, daily_limits ...account.AccountDailyLimits) (interface{}, error)
Parameters:
  • orgId – The membership service provider (MSP) ID of the user to create the account for. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • userId – The user name or email ID of the user. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • tokenType: TokenType – The type of token, which must be fungible.
  • application_groups: string[] – A list of application groups the user Id belongs to, which define the user's associations in the CBDC application.
  • daily_limits: DailyLimits – A JSON object of the following type.
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    In the example, the max_daily_amount value is the maximum amount of tokens that can be transacted daily and max_daily_transactions value is the maximum number of transactions that can be completed daily.
  • endorsers: string[] – An array of the peers (for example, peer1, peer2) that must endorse the transaction.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "261c3da4bb6f1724bc8f674c7b001a9b986bc9900d0508363039424926b143ed",
        "payload": {
            "AssetType": "oaccount",
            "AccountId": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
            "UserId": "admin_user_cb",
            "OrgId": "CB",
            "TokenType": "fungible",
            "TokenId": "",
            "TokenName": "",
            "Balance": 0,
            "BalanceOnHold": 0,
            "BapAccountVersion": 0,
            "ApplicationGroups": [
                "CBDC_ADMINS"
            ],
            "MaxDailyAmount": 10000,
            "DailyAmount": 0,
            "MaxDailyTransactions": 100,
            "DailyTransactions": 0,
            "CurrentDate": "2024-12-09"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 246
    }
}

TypeScript SDK Methods for Wholesale CBDC

setApplicationGroups
This method sets the application_groups parameter in the account details for the specified application groups in the API.
this.Ctx.Account.setApplicationGroups (account_id, application_groups)
Parameters:
  • account_id: string – The ID of the account.
  • application_groups: string[] – A list of application groups the user ID belongs to, which define the user's associations in the CBDC application.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "453821c7ffd477987ef8ccbd836b893969531ab768098cd4a99e3b89cd38a391",
        "payload": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~28ac774001f374064029d51af4fb67e26ea1ea9ef62828b7a72dbf3beb8efd8d",
            "user_id": "admin_user_cb",
            "org_id": "CB",
            "token_type": "fungible",
            "token_id": "",
            "token_name": "",
            "balance": 0,
            "onhold_balance": 0,
            "application_groups": [
                "CBDC_ADMINS"
            ],
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 100,
            "daily_transactions": 0,
            "current_date": "2024-12-09T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 188
    }
}
getAllActiveAccounts
This method returns all of the active accounts that are associated with the specified token ID.
this.Ctx.CBDCToken.getAllActiveAccounts(token_id)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                "non_account_role_name": [
                    "token_admin"
                ],
                "role_name": null,
                "valueJson": {
                    "bapAccountVersion": 0,
                    "assetType": "oaccount",
                    "account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                    "user_id": "admin_user_cb",
                    "org_id": "CB",
                    "token_type": "fungible",
                    "token_id": "USD",
                    "token_name": "cbdc",
                    "balance": 0,
                    "onhold_balance": 0,
                    "application_groups": [
                        "CBDC_ADMINS"
                    ],
                    "max_daily_amount": 10000,
                    "daily_amount": 0,
                    "max_daily_transactions": 1000,
                    "daily_transactions": 0,
                    "current_date": "2024-11-20T00:00:00.000Z"
                }
            }
        ],
        "encode": "JSON"
    }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
              "non_account_role_name": [
                  "token_admin"
              ],
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                  "org_id": "CB",
                  "user_id": "admin_user_cb",
                  "token_id": "USD",
                  "max_daily_amount": 10000,
                  "max_daily_transactions": 1000
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
              "non_account_role_name": [
                  "token_admin"
              ],
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
                  "org_id": "CB",
                  "user_id": "admin_user_cb",
                  "token_id": "USD",
                  "max_daily_amount": 10000,
                  "max_daily_transactions": 1000
              }
          }
      ],
      "encode": "JSON"
  }
}
getAllSuspendedAccounts
This method returns all of the suspended accounts that are associated with the specified token ID.
this.Ctx.CBDCToken.getAllSuspendedAccounts(token_id)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                "non_account_role_name": null,
                "role_name": null,
                "valueJson": {
                    "assetType": "oaccount",
                    "bapAccountVersion": 1,
                    "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                    "user_id": "user1_fi1",
                    "org_id": "FI1",
                    "token_type": "fungible",
                    "token_id": "USD",
                    "token_name": "cbdc",
                    "balance": 5,
                    "onhold_balance": 0,
                    "application_groups": [
                        "FI_CBDC_USERS"
                    ],
                    "max_daily_amount": 10000,
                    "daily_amount": 0,
                    "max_daily_transactions": 1000,
                    "daily_transactions": 0,
                    "current_date": "2024-11-20T00:00:00.000Z"
                }
            }
        ],
        "encode": "JSON"
    }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
              "non_account_role_name": null,
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                  "org_id": "FI1",
                  "user_id": "user1_fi1",
                  "token_id": "USD",
                  "max_daily_amount": 10000,
                  "max_daily_transactions": 1000
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
              "non_account_role_name": null,
              "role_name": null,
              "valueJson": {
                  "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
                  "org_id": "FI1",
                  "user_id": "user1_fi1",
                  "token_id": "USD"
              }
          }
      ],
      "encode": "JSON"
  }
}
getBurnQuantity
This method returns the total quantity of burned tokens for a specified organization.
this.Ctx.CBDCToken.getBurnQuantity(token_id)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": {
          "burnt_quantity": 31
      },
      "encode": "JSON"
  }
}
getActionHistory
This method retrieves the history of approvals or rejections made by the caller for mint, burn, and transfer (issuance) operations, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
this.Ctx.CBDCToken.getActionHistory(token_id)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "from_account_id": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
              "from_org_id": "CB",
              "from_user_id": "retirer_user_cb",
              "holding_id": "ohold~cbdc~USD~eaf6",
              "holding_status": "REJECT_BURN",
              "last_updated_time": "2024-11-26T21:43:22.000Z",
              "notary_account_id": null,
              "notary_org_id": null,
              "notary_user_id": null,
              "operation_id": null,
              "quantity": 3,
              "timetoexpiration": null,
              "to_account_id": "",
              "to_org_id": null,
              "to_user_id": null,
              "token_id": "USD",
              "token_name": null
          },
          {
              "from_account_id": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
              "from_org_id": "CB",
              "from_user_id": "retirer_user_cb",
              "holding_id": "ohold~cbdc~USD~0031",
              "holding_status": "REJECT_BURN",
              "last_updated_time": "2024-11-26T21:43:15.000Z",
              "notary_account_id": null,
              "notary_org_id": null,
              "notary_user_id": null,
              "operation_id": null,
              "quantity": 2,
              "timetoexpiration": null,
              "to_account_id": "",
              "to_org_id": null,
              "to_user_id": null,
              "token_id": "USD",
              "token_name": null
          }
      ],
      "encode": "JSON"
  }
}
getPendingIssuance
This method retrieves all pending issuance (transfer) transactions where the caller is assigned as an approver, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
this.Ctx.CBDCToken.getPendingIssuance(token_id)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "asset_type": "ONHOLD",
              "category": "category value",
              "from_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "from_org_id": "CB",
              "from_user_id": "creator_user_cb",
              "holding_id": "ohold~cbdc~USD~8e314",
              "notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
              "notary_org_id": "CB",
              "notary_user_id": "manager_user_cb",
              "operation_id": "8e314",
              "quantity": 10,
              "timetoexpiration": "0",
              "to_account_id": "oaccount~44b844deccc6c314e14b8b9b95b51db5c8de499dbdbd3def2a44ba54c899c142",
              "to_org_id": "FI1",
              "to_user_id": "officer_user1_fi1",
              "token_id": "USD",
              "token_name": "cbdc"
          },
          {
              "asset_type": "ONHOLD",
              "category": "category value",
              "from_account_id": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
              "from_org_id": "CB",
              "from_user_id": "issuer_user_cb",
              "holding_id": "ohold~cbdc~USD~8e315",
              "notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
              "notary_org_id": "CB",
              "notary_user_id": "manager_user_cb",
              "operation_id": "8e315",
              "quantity": 10,
              "timetoexpiration": "0",
              "to_account_id": "oaccount~44b844deccc6c314e14b8b9b95b51db5c8de499dbdbd3def2a44ba54c899c142",
              "to_org_id": "FI1",
              "to_user_id": "officer_user1_fi1",
              "token_id": "USD",
              "token_name": "cbdc"
          }
      ],
      "encode": "JSON"
  }
}
getPendingRequest
This method retrieves all pending requests of a specified type where the caller is assigned as an approver.
this.Ctx.CBDCToken.getPendingRequest(token_id, request_type)
Parameters:
  • token_id: string – The ID of the token.
  • request_type: string – The transaction type. For example, mint or burn.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "valueJson": {
                  "assetType": "ohold",
                  "holding_id": "ohold~cbdc~USD~op123",
                  "operation_id": "op123",
                  "token_id": "USD",
                  "token_name": "cbdc",
                  "operation_type": "mint",
                  "status": "pending",
                  "from_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "to_account_id": "",
                  "notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
                  "quantity": 10,
                  "time_to_expiration": "0",
                  "category": "category value",
                  "description": "description value"
              }
          }
      ],
      "encode": "JSON"
  }
}
getTotalBalanceByCallerOrgId
This method retrieves the total balance of the caller's organization.
this.Ctx.CBDCToken.getTotalBalanceByCallerOrgId()
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "totalBalance": 704
          }
      ],
      "encode": "JSON"
  }
}
getTransactionWithBlockNumber
This method returns the details of the transaction for the specified transaction ID.
this.Ctx.CBDCToken.getTransactionWithBlockNumber(token_id, transaction_id)
Parameters:
  • token_id: string – The ID of the token.
  • transaction_id: string – The ID of the transaction.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "blockNo": 82,
              "key": "otransaction~24f391919a8837d654beaa7346148ea8b2b9704624aef482ce68078c485f5b1b",
              "metadata": null,
              "txnNo": 0,
              "value": null,
              "valueJson": {
                  "assetType": "otransaction",
                  "transaction_id": "otransaction~24f391919a8837d654beaa7346148ea8b2b9704624aef482ce68078c485f5b1b",
                  "token_id": "USD",
                  "from_account_id": "",
                  "from_account_balance": 0,
                  "from_account_onhold_balance": 0,
                  "to_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "to_account_balance": 100,
                  "to_account_onhold_balance": 0,
                  "transaction_type": "REQUEST_MINT",
                  "amount": 200,
                  "timestamp": "2024-11-20T06:48:42.000Z",
                  "number_of_sub_transactions": 0,
                  "holding_id": "",
                  "sub_transaction": "false",
                  "description": ""
              }
          }
      ],
      "encode": "JSON"
  }
}

The following SDK method is modified for the wholesale CBDC model.

createAccount
This method creates an account for a specified user and token. An account must be created for any user who will have tokens at any point. Accounts track balances, on-hold balances, and transaction history. An account ID is formed by concatenating the asset type and token ID and then creating a SHA-256 hash over a concatenation of the organization ID and user ID.
this.Ctx.Account.createAccount(org_id, user_id, token_type, application_groups, daily_limits)
Parameters:
  • orgId – The membership service provider (MSP) ID of the user to create the account for. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • userId – The user name or email ID of the user. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • tokenType: TokenType – The type of token, which must be fungible.
  • application_groups: string[] – A list of application groups the user Id belongs to, which define the user's associations in the CBDC application.
  • daily_limits: DailyLimits – A JSON object of the following type.
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    In the example, the max_daily_amount value is the maximum amount of tokens that can be transacted daily and max_daily_transactions value is the maximum number of transactions that can be completed daily.
  • endorsers: string[] – An array of the peers (for example, peer1, peer2) that must endorse the transaction.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "453821c7ffd477987ef8ccbd836b893969531ab768098cd4a99e3b89cd38a391",
        "payload": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~28ac774001f374064029d51af4fb67e26ea1ea9ef62828b7a72dbf3beb8efd8d",
            "user_id": "admin_user_cb",
            "org_id": "CB",
            "token_type": "fungible",
            "token_id": "",
            "token_name": "",
            "balance": 0,
            "onhold_balance": 0,
            "application_groups": [
                "CBDC_ADMINS"
            ],
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 100,
            "daily_transactions": 0,
            "current_date": "2024-12-09T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 188
    }
}

Go SDK Methods for Wholesale CBDC

SetApplicationGroups
This method sets the application_groups parameter in the account details for the specified application groups in the API.
t.Ctx.CbdcToken.SetApplicationGroups(account_id, application_groups)
Parameters:
  • account_id: string – The ID of the account.
  • application_groups: string[] – A list of application groups the user ID belongs to, which define the user's associations in the CBDC application.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "261c3da4bb6f1724bc8f674c7b001a9b986bc9900d0508363039424926b143ed",
        "payload": {
            "AssetType": "oaccount",
            "AccountId": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
            "UserId": "admin_user_cb",
            "OrgId": "CB",
            "TokenType": "fungible",
            "TokenId": "",
            "TokenName": "",
            "Balance": 0,
            "BalanceOnHold": 0,
            "BapAccountVersion": 0,
            "ApplicationGroups": [
                "CBDC_ADMINS"
            ],
            "MaxDailyAmount": 10000,
            "DailyAmount": 0,
            "MaxDailyTransactions": 100,
            "DailyTransactions": 0,
            "CurrentDate": "2024-12-09"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 246
    }
}
GetAllActiveAccounts
This method returns all of the active accounts that are associated with the specified token ID.
t.Ctx.CbdcToken.GetAllActiveAccounts(token_id)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "NonAccountRoleName": "[\"token_admin\"]",
                "RoleName": null,
                "key": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                "valueJson": {
                    "AccountId": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                    "ApplicationGroups": [
                        "CBDC_ISSUERS"
                    ],
                    "AssetType": "oaccount",
                    "Balance": 0,
                    "BalanceOnHold": 0,
                    "BapAccountVersion": 0,
                    "CurrentDate": "2024-11-21",
                    "DailyAmount": 0,
                    "DailyTransactions": 0,
                    "MaxDailyAmount": 10000,
                    "MaxDailyTransactions": 100,
                    "OrgId": "CB",
                    "TokenId": "USD",
                    "TokenName": "cbdc",
                    "TokenType": "fungible",
                    "UserId": "admin_user_cb"
                }
            }
        ],
        "encode": "JSON"
    }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": "[\"token_auditor\"]",
              "RoleName": null,
              "key": "oaccount~bd6262ffdf582675dd9b2506c1d5488864feef0b9e297a9a3322b7c683ad6214",
              "valueJson": {
                  "AccountId": "oaccount~bd6262ffdf582675dd9b2506c1d5488864feef0b9e297a9a3322b7c683ad6214",
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "UserId": "auditor_user_cb",
                  "MaxDailyAmount": 10000,
                  "MaxDailyTransactions": 100,
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": "[\"token_admin\"]",
              "RoleName": null,
              "key": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
              "valueJson": {
                  "AccountId": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "UserId": "admin_user_cb"
              }
          }
      ],
      "encode": "JSON"
  }
}
GetAllSuspendedAccounts
This method returns all of the suspended accounts that are associated with the specified token ID.
t.Ctx.CbdcToken.GetAllSuspendedAccounts(token_id)
Parameters:
  • token_id: string – The ID of the token.
Returns:
  • On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
Return Value Example (Token Admin, Token Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": null,
              "RoleName": "minter",
              "key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "valueJson": {
                  "AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "ApplicationGroups": [
                      "CBDC_ADMINS"
                  ],
                  "AssetType": "oaccount",
                  "Balance": 140,
                  "BalanceOnHold": 0,
                  "BapAccountVersion": 8,
                  "CurrentDate": "2024-11-21",
                  "DailyAmount": 70,
                  "DailyTransactions": 3,
                  "MaxDailyAmount": 10000,
                  "MaxDailyTransactions": 100,
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "TokenName": "cbdc",
                  "TokenType": "fungible",
                  "UserId": "creator_user_cb"
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (Organization Admin, Organization Auditor):
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "NonAccountRoleName": null,
              "RoleName": "minter",
              "key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "valueJson": {
                  "AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "OrgId": "CB",
                  "TokenId": "USD",
                  "UserId": "creator_user_cb",
                  "MaxDailyAmount": 10000,
                  "MaxDailyTransactions": 100,
              }
          }
      ],
      "encode": "JSON"
  }
}
Return Value Example (all other users):
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "NonAccountRoleName": null,
                "RoleName": "minter",
                "key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "valueJson": {
                    "AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                    "OrgId": "CB",
                    "TokenId": "USD",
                    "UserId": "creator_user_cb"
                }
            }
        ],
        "encode": "JSON"
    }
}
GetBurnQuantity
This method returns the total quantity of burned tokens for a specified organization.
t.Ctx.CbdcToken.GetBurnQuantity(token_id)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": {
          "BurnQuantity": 10
      },
      "encode": "JSON"
  }
}
GetActionHistory
This method retrieves the history of approvals or rejections made by the caller for mint, burn, and transfer (issuance) operations, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
t.Ctx.CbdcToken.GetActionHistory(token_id)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "FromAccountId": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
              "FromOrgId": "CB",
              "FromUserId": "retirer_user_cb",
              "HoldingId": "ohold~cbdc~USD~6e1223",
              "HoldingStatus": "REJECT_BURN",
              "LastUpdatedTime": "2024-11-21T22:08:26Z",
              "NotaryAccountId": null,
              "NotaryOrgId": null,
              "NotaryUserId": null,
              "OperationId": null,
              "Quantity": 5,
              "TimeToExpiration": null,
              "ToAccountId": "",
              "ToOrgId": null,
              "ToUserId": null,
              "TokenId": "USD",
              "TokenName": null
          },
          {
              "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "FromOrgId": "CB",
              "FromUserId": "creator_user_cb",
              "HoldingId": "ohold~cbdc~USD~hold2",
              "HoldingStatus": "RELEASEHOLD",
              "LastUpdatedTime": "2024-11-21T21:54:33Z",
              "NotaryAccountId": null,
              "NotaryOrgId": null,
              "NotaryUserId": null,
              "OperationId": null,
              "Quantity": 10,
              "TimeToExpiration": null,
              "ToAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "ToOrgId": "CB",
              "ToUserId": "creator_user_cb",
              "TokenId": "USD",
              "TokenName": null
          }
      ],
      "encode": "JSON"
  }
}
GetPendingIssuance
This method retrieves all pending issuance (transfer) transactions where the caller is assigned as an approver, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
t.Ctx.CbdcToken.GetPendingIssuance(token_id)
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "AssetType": "ONHOLD",
              "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
              "FromOrgId": "CB",
              "FromUserId": "creator_user_cb",
              "HoldingId": "ohold~cbdc~USD~h123",
              "NotaryAccountId": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
              "NotaryOrgId": "CB",
              "NotaryUserId": "manager_user_cb",
              "OperationId": "h123",
              "Quantity": 10,
              "TimeToExpiration": "0",
              "ToAccountId": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
              "ToOrgId": "CB",
              "ToUserId": "issuer_user_cb",
              "TokenId": "USD",
              "TokenName": "cbdc"
          }
      ],
      "encode": "JSON"
  }
}
GetPendingRequest
This method retrieves all pending requests of a specified type where the caller is assigned as an approver.
t.Ctx.CbdcToken.GetPendingRequest(token_id, request_type)
Parameters:
  • token_id: string – The ID of the token.
  • request_type: string – The transaction type. For example, mint or burn.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "valueJson": {
                  "AssetType": "ohold",
                  "Category": "Category value",
                  "Description": "Description value",
                  "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "HoldingId": "ohold~cbdc~USD~8e1232",
                  "NotaryAccountId": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
                  "OperationId": "8e1232",
                  "OperationType": "mint",
                  "Quantity": 100,
                  "Status": "pending",
                  "TimeToExpiration": "0",
                  "ToAccountId": "",
                  "TokenId": "USD",
                  "TokenName": "cbdc"
              }
          }
      ],
      "encode": "JSON"
  }
}
GetTotalBalanceByCallerOrgId
This method retrieves the total balance of the caller's organization.
t.Ctx.CbdcToken.GetTotalBalanceByCallerOrgId()
Parameters:
  • token_id: string – The ID of the token.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "TotalBalance": 180
          }
      ],
      "encode": "JSON"
  }
}
GetTransactionWithBlockNumber
This method returns the details of the transaction for the specified transaction ID.
t.Ctx.CbdcToken.GetTransactionWithBlockNumber(token_id, transaction_id)
Parameters:
  • token_id: string – The ID of the token.
  • transaction_id: string – The ID of the transaction.
Return Value Example:
{
  "returnCode": "Success",
  "error": "",
  "result": {
      "payload": [
          {
              "blockNo": 152,
              "key": "otransaction~eee2de20b4b042884da83e3b7b85d8532ad56f26a546ee25d227acce33375c1c",
              "metadata": null,
              "txnNo": 0,
              "value": null,
              "valueJson": {
                  "Amount": 10,
                  "AssetType": "otransaction",
                  "Category": "Category value",
                  "Description": "",
                  "FromAccountBalance": 130,
                  "FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                  "FromAccountOnHoldBalance": 10,
                  "HoldingId": "ohold~cbdc~USD~hold1",
                  "NumberOfSubTransactions": 0,
                  "SubTransaction": "false",
                  "SubTransactionType": "",
                  "Timestamp": "2024-11-21T20:43:59Z",
                  "ToAccountBalance": 10,
                  "ToAccountId": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
                  "ToAccountOnHoldBalance": 0,
                  "TokenId": "USD",
                  "TransactionId": "otransaction~eee2de20b4b042884da83e3b7b85d8532ad56f26a546ee25d227acce33375c1c",
                  "TransactionType": "EXECUTEHOLD"
              }
          }
      ],
      "encode": "JSON"
  }
}

The following SDK method is modified for the wholesale CBDC model.

CreateAccount
This method creates an account for a specified user and token. An account must be created for any user who will have tokens at any point. Accounts track balances, on-hold balances, and transaction history. An account ID is formed by concatenating the asset type and token ID and then creating a SHA-256 hash over a concatenation of the organization ID and user ID.
t.Ctx.Account.CreateAccount(org_id, user_id, token_type, application_groups, daily_limits...)
Parameters:
  • orgId – The membership service provider (MSP) ID of the user to create the account for. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • userId – The user name or email ID of the user. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).
  • tokenType: TokenType – The type of token, which must be fungible.
  • application_groups: string[] – A list of application groups the user Id belongs to, which define the user's associations in the CBDC application.
  • daily_limits: DailyLimits – A JSON object of the following type.
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    In the example, the max_daily_amount value is the maximum amount of tokens that can be transacted daily and max_daily_transactions value is the maximum number of transactions that can be completed daily.
  • endorsers: string[] – An array of the peers (for example, peer1, peer2) that must endorse the transaction.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "261c3da4bb6f1724bc8f674c7b001a9b986bc9900d0508363039424926b143ed",
        "payload": {
            "AssetType": "oaccount",
            "AccountId": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
            "UserId": "admin_user_cb",
            "OrgId": "CB",
            "TokenType": "fungible",
            "TokenId": "",
            "TokenName": "",
            "Balance": 0,
            "BalanceOnHold": 0,
            "BapAccountVersion": 0,
            "ApplicationGroups": [
                "CBDC_ADMINS"
            ],
            "MaxDailyAmount": 10000,
            "DailyAmount": 0,
            "MaxDailyTransactions": 100,
            "DailyTransactions": 0,
            "CurrentDate": "2024-12-09"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 246
    }
}