- Oracle Blockchain Platform Digital Assets Edition
- Generic Token Frameworks
- Fungible Token Framework
- Fungible Token Framework Wrapper API Package
Fungible Token Framework Wrapper API Package
Oracle Blockchain Platform Digital Assets Edition includes a wrapper API package that extends the REST API to support operations specific to a deposit token scenario.
The wrapper API package uses the API Gateway service and OCI Functions to deploy API routes specifically designed for the deposit token application. The fungible token framework wrapper API package is downloadable from the Oracle Blockchain
Platform console, and includes the following components.
DepositTokenWrapperAPI.zip
, an archive file that contains the wrapper API package including the Terraform scripts required for deployment. You deploy this file to a Resource Manager stack on Oracle Cloud Infrastructure (OCI) to create the necessary Oracle resources for the Wrapper APIs.DepositToken_WrapperAPI.postman_collection.json
, a Postman collection that enables you to test the deployed wrapper APIs. The collection includes pre-configured requests with endpoints and payloads that correspond to the APIs defined in the wrapper API package.
Wrapper APIs
-
activateAccount
- Original method name:
activateAccount
- This POST method activates a token account. This method can be called only by a
Token Admin
or theOrg Admin
of the specified organization. For any accounts created prior to the account status functionality, you must call this method to see the account status to active. - Payload:
{ "tokenId": "{{bc-token-id}}", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Returns:
- On success, a JSON representation of the account status object for the specified token account.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "db0738d4a44f6d9c80b24fce7c518c07023f7be19edaa69b272eaf7886b4b925", "payload": { "assetType": "oaccountStatus", "status_id": "oaccountStatus~d5814d96d8517ac31727d60aace0519c58a425892ab0d378fcfb0a35771f65ae", "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6", "status": "active" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 194 } }
-
addTokenAdmin
- Original method name:
addTokenAdmin
- This POST method adds a user as a
Token Admin
of the chaincode. This method can be called only by aToken Admin
of the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a message that includes details of the user who was added as a
Token Admin
of the chaincode.
- On success, a message that includes details of the user who was added as a
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "User (Org_Id: CB, User_Id: cb) is already Token Admin." }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } }
-
addTokenAuditor
- This POST method adds a user as a
Token Auditor
of the chaincode. This method can be called only by aToken Admin
of the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a message that includes details of the user who was added as a
Token Auditor
of the chaincode.
- On success, a message that includes details of the user who was added as a
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "cd81f6c4c9e7c18ece357dbf5c139ef66ef2d6566be3b14de5f6d0a3fd4bb2f0", "payload": { "msg": "Successfully added Token Auditor (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 196 } }
-
addOrgAdmin
- Original method name:
addOrgAdmin
- This POST method adds a user as a
Token Admin
of the chaincode. This method can be called only by aToken Admin
of the chaincode or by anOrg Admin
of the specified organization.. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a message that includes details of the user who was added as a
Org Admin
of the chaincode.
- On success, a message that includes details of the user who was added as a
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "96a84dffcb9156f7271dfb414e8c43b540595044cf9145f5fd56e9873797fc4a", "payload": { "msg": "Successfully added Org Admin (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 197 } }
-
addOrgAuditor
- This POST method adds a user as a
Org Auditor
of the chaincode. This method can be called only by aToken Admin
of the chaincode or anOrg Admin
of the specified organization. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a message that includes details of the user who was added as a
Org Auditor
of the chaincode.
- On success, a message that includes details of the user who was added as a
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "44bbad35a1478cb714e32f7cfd551897868a203520aab9cea5771d3aadc1cf03", "payload": { "msg": "Successfully added Org Auditor (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 198 } }
-
addRole
- Original method name:
addRole
- This method adds the role to the specified user and token.
- Payload:
{ "tokenId": "{{bc-token-id}}", "role": "role value (for example minter / burner / notary)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.role: string
– The name of the role to add to the specified user.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "29ea766dee8e6d273eba3c40a9fea75a1aa85dc3c280d40695f6224c5c52d93c", "payload": { "msg": "Successfully added role 'notary' to Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8 (Org-Id: CB, User-Id: manager_user_cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 201 } }
-
approveMint
- Original method name:
approveMint
- Notaries can call this POST method to approve a mint request.
- Payload:
{ "tokenId": "{{bc-token-id}}", "operationId": "operation_id value", "sameOrgEndorser": true }
- Parameters:
tokenId: string
– The ID of the token.operationId: string
– The unique operation ID of the mint request to approve.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "a4537ef34a955b023b7c205b9abf06a6c79e4fdd761fb24f41b8eb34126b66c0", "payload": { "msg": "Successfully minted 10 tokens to Account Id: oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB, User-Id: creator_user_cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 204 } }
-
executeHoldTokens
- Original method name:
executeHoldTokens
- Notaries call this method to approve a hold on tokens. The quantity of tokens put on hold previously by the token owner is now transferred to the recipient. If the
quantity
value is less than the actual hold value, the remaining amount is available again to the owner of the token. If theroles
behavior is specified in thebehaviors
section of the token model and thenotary_role_name
value is set, the caller account must have notary role. Otherwise, any caller with an account can function as a notary. - Payload:
{ "tokenId": "{{bc-token-id}}", "operationId": "operation_id value", "quantity": 1, "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.operationId: string
– The unique operation ID of the mint request to approve.quantity: number
– The number of held tokens to transfer.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "c1149aaa486abc4931d9024c18dfcb230bb321723d1160b0bf981c0011c4856a", "payload": { "msg": "Account Id: oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB, User-Id: issuer_user_cb) is successfully executed '10' tokens from Operation Id '8e3145'." }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 213 } }
-
associateTokenToAccount
- Original method name:
associateTokenToAccount
- This POST method associates a specified account ID to a specified token. It can be called by a
Token Admin
orOrg Admin
. - Payload:
{ "accountId": "account_id value", "tokenId": "{{bc-token-id}}", "endorsers": {{endorsers}} }
- Parameters:
accountId: string
– The ID of the account.tokenId: string
– The ID of the token.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "efc7381fb6fc6174a40e83ff5f09d2bbf7f6f490365e3bbf19d5502c2cfec474", "payload": { "bapAccountVersion": 0, "assetType": "oaccount", "account_id": "oaccount~1c6aa60e220b8fc70caf4cea1ed723ddb193a00321e5e0004def062816b77090", "user_id": "cb12", "org_id": "CB", "token_type": "fungible", "token_id": "USD", "token_name": "cbdc", "balance": 0, "onhold_balance": 0, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 100, "daily_transactions": 0, "current_date": "2024-12-11T00:00:00.000Z" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 216 } }
-
createAccount
- Original method name:
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. Account IDs are 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 or theOrg Admin
of the specified organization.. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenType": "fungible", "dailyLimits": "{\"max_daily_amount\":10000,\"max_daily_transactions\":100}", "endorsers": {{endorsers}} }
- 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 befungible
.daily_limits: DailyLimits
– A JSON object of the following type.
In the example, the{ "max_daily_amount": 100000 "max_daily_transactions": 10000 }
max_daily_amount
value is the maximum amount of tokens that can be transacted daily andmax_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, "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 } }
-
getAccount
- Original method name:
getAccount
- This method returns account details for a specified user. This method can be called only by a
Token Admin
of the chaincode or theAccount Owner
of the account. - Query:
/getAccount?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "bapAccountVersion": 0, "assetType": "oaccount", "status": "active", "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, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 1000, "daily_transactions": 0, "current_date": "2024-11-20T00:00:00.000Z" }, "encode": "JSON" } }
-
getAccountBalance
- Original method name:
getAccountBalance
- This GET method returns the current balance for a specified account and token. This method can be called only by a
Token Admin
or theAccountOwner
of the account. /getAccountBalance?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "msg": "Current Balance is: 100", "user_balance": 100 }, "encode": "JSON" } }
-
getAccountsByUser
- Original method name:
getAccountsByUser
- This method returns a list of all accounts for a specified user. This method can be called only by a
Token Admin
of the chaincode or theAccount Owner
of the account. - Query:
/getAccountsByUser?orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "bapAccountVersion": 0, "assetType": "oaccount", "account_id": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28", "user_id": "admin_user_cb", "org_id": "CB", "token_type": "fungible", "token_id": "", "token_name": "", "balance": 0, "onhold_balance": 0, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 1000, "daily_transactions": 0, "current_date": "2024-11-20T00:00:00.000Z" }, { "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, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 1000, "daily_transactions": 0, "current_date": "2024-11-20T00:00:00.000Z" }, { "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, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 100, "daily_transactions": 0, "current_date": "2024-12-09T00:00:00.000Z" } ], "encode": "JSON" } }
-
getAccountTransactionHistory
- Original method name:
getAccountTransactionHistory
- This GET method returns account transaction history. This method can be called only by a
Token Admin
of the chaincode or by the account owner. /getAccountTransactionHistory?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "transaction_id": "otransaction~64c5a4830949eae1424600f3d4a438c6f603a7c3ea31a68e374b899803999e22", "transacted_amount": 10, "timestamp": "2024-12-11T13:37:28.000Z", "balance": 550, "onhold_balance": 10, "token_id": "USD", "category": "category value", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "REJECT_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" }, { "transaction_id": "otransaction~a4537ef34a955b023b7c205b9abf06a6c79e4fdd761fb24f41b8eb34126b66c0", "transacted_amount": 10, "timestamp": "2024-12-11T13:36:32.000Z", "balance": 550, "onhold_balance": 10, "token_id": "USD", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "APPROVE_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" }, { "transaction_id": "otransaction~6237a759422bd9fb112742e8cd7e6450df5a74a32236d9b1005571afed8904a4", "transacted_amount": 10, "timestamp": "2024-12-11T13:36:18.000Z", "balance": 540, "onhold_balance": 10, "token_id": "USD", "category": "category value", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "REQUEST_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" }, { "transaction_id": "otransaction~06b35071415d74aa1a7c18449149c937d886cae76a832c44cf8d98e84586e76e", "transacted_amount": 10, "timestamp": "2024-12-11T13:35:46.000Z", "balance": 540, "onhold_balance": 10, "token_id": "USD", "category": "category value", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "REQUEST_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" } ], "encode": "JSON" } }
-
getAccountTransactionHistoryWithFiltersFromRichHistDB
- Original method name:
getAccountTransactionHistoryWithFiltersFromRichHistDB
- This method returns the account transaction history details from the rich history database. This method can be called only by a
Token Admin
or theAccountOwner
of the account. Before you can use this method, you must run Oracle Autonomous Database with Oracle REST Data Services (ORDS) and OAuth enabled, as described in Oracle Database View Definitions for Wholesale CBDC. /getAccountTransactionHistoryWithFiltersFromRichHistDB?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}&customEndpoint=custom_endpoint value&bearerToken=bearer_token value&filters={"pageSize":20,"bookmark":"","startTime":"2022-01-16T15:16:36+00:00","endTime":"2022-01-17T15:16:36+00:00"}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.customEndpoint
– The RESTful service endpoint of the rich history database to fetch the transaction history from.bearerToken
– The token to use to call the RESTful endpoint to ensure that the request is authorized.filters: string
– An optional parameter. If empty, all records are returned. ThePageSize
property determines the number of records to return. IfPageSize
is 0, the default page size is 20. TheBookmark
property determines the starting index of the records to return. TheStartTime
andEndTime
properties must be specified in RFC-3339 format.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "transaction_id": "otransaction~64c5a4830949eae1424600f3d4a438c6f603a7c3ea31a68e374b899803999e22", "transacted_amount": 10, "timestamp": "2024-12-11T13:37:28.000Z", "balance": 550, "onhold_balance": 10, "token_id": "USD", "category": "category value", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "REJECT_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" }, { "transaction_id": "otransaction~a4537ef34a955b023b7c205b9abf06a6c79e4fdd761fb24f41b8eb34126b66c0", "transacted_amount": 10, "timestamp": "2024-12-11T13:36:32.000Z", "balance": 550, "onhold_balance": 10, "token_id": "USD", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "APPROVE_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" }, { "transaction_id": "otransaction~6237a759422bd9fb112742e8cd7e6450df5a74a32236d9b1005571afed8904a4", "transacted_amount": 10, "timestamp": "2024-12-11T13:36:18.000Z", "balance": 540, "onhold_balance": 10, "token_id": "USD", "category": "category value", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "REQUEST_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" }, { "transaction_id": "otransaction~06b35071415d74aa1a7c18449149c937d886cae76a832c44cf8d98e84586e76e", "transacted_amount": 10, "timestamp": "2024-12-11T13:35:46.000Z", "balance": 540, "onhold_balance": 10, "token_id": "USD", "category": "category value", "description": "description value", "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0", "transaction_type": "REQUEST_MINT", "transacted_org_id": "CB", "transacted_user_id'": "creator_user_cb" } ], "encode": "JSON" } }
-
getNetTokens
- Original method name:
getNetTokens
- This GET method returns the total net number of tokens available in the system for a specified token. The net token total is the amount of tokens remaining after tokens are burned. This method can be called only by a
Token Admin
of the chaincode, or anOrg Admin
of the specified organization. /getNetCBDCTokens?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "msg": "Net supply of token for Token Id: USD is 878 tokens.", "quantity": 878 }, "encode": "JSON" } }
-
getOnHoldIds
- Original method name:
getOnHoldIds
- This GET method returns a list of all of the holding IDs for a specified user and token. This method can be called only by a
Token Admin
,Org Admin
, or theAccountOwner
of the account. /getOnHoldIds?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "msg": "Holding Ids are: ohold~cbdc~USD~8e3147,ohold~cbdc~USD~8e315", "holding_ids": [ "ohold~cbdc~USD~8e3147", "ohold~cbdc~USD~8e315" ] }, "encode": "JSON" } }
-
getTotalMintedTokens
- Original method name:
getTotalMintedTokens
- This GET method returns the total number of minted tokens for a specified token. This method can be called only by a
Token Admin
orOrg Admin
. - Query:
/getTotalMintedTokens?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "msg": "Total minted token for Token Id: USD is 910 tokens.", "quantity": 910 }, "encode": "JSON" } }
-
getUserByAccountId
- Original method name:
getUserByAccountId
- This GET method returns the user details for a specified account. This method can be called by the
Token Admin
,Token Auditor
, orOrg Auditor
. - Query:
/getUserByAccountId?accountId=account_id value
- Parameters:
accountId: string
– The ID of the account.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "token_id": "USD", "user_id": "admin_user_cb", "org_id": "CB" }, "encode": "JSON" } }
-
getUsersByRole
- Original method name:
getUsersByRole
- This method returns a list of all users for a specified role and token. This method can be called only by a
Token Admin
. /getUsersByRole?tokenId={{bc-token-id}}&role=role value (for example minter / burner / notary)
- Parameters:
tokenId: string
– The ID of the token.role: string
– The name of the role to search for.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "users": [ { "token_id": "USD", "user_id": "creator_user_cb", "org_id": "CB" }, { "token_id": "USD", "user_id": "cb4", "org_id": "CB" } ] }, "encode": "JSON" } }
-
holdTokens
- Original method name:
holdTokens
- This method creates a hold on behalf of the owner of the tokens with the
to_account_id
account. A notary account is specified, which is responsible to either complete or release the hold. When the hold is created, the specified token balance from the payer is put on hold. A held balance cannot be transferred until the hold is either completed or released. The caller of this method must have an account already created. - Payload:
{ "tokenId": "{{bc-token-id}}", "operationId": "operation_id value", "toOrgId": "to_org_id value", "toUserId": "to_user_id value", "notaryOrgId": "notary_org_id value", "notaryUserId": "notary_user_id value", "quantity": 1, "timeToExpiration": "time_to_expiration value", "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.operationId: string
– A unique ID to identify the hold operation. Typically this ID is passed by the client application.toOrgId: string
– The membership service provider (MSP) ID of the receiver in the current organization.toUserId: string
– The user name or email ID of the receiver.notaryOrgId: string
– The membership service provider (MSP) ID of the notary in the current organization.notaryUserId: string
– The user name or email ID of the notary.quantity: number
– The number of tokens to put on hold.timeToExpiration
– The time when the hold expires. Specify 0 for a permanent hold. Otherwise use the RFC-3339 format. For example, 2021-06-02T12:46:06Z.infoDetails: JSON
– The description and category as shown in the following example.{ "category" : "category input", "description" : "description input" }
endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e575d339299bb98afe83207e749cd07654f209673c84c6973738b6094da33062", "payload": { "msg": "AccountId oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB , User-Id: issuer_user_cb) is successfully holding 10 tokens" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 211 } }
-
init
- Original method name:
init
- This method is called when the chaincode is deployed. The user information is saved as the
Token Admin
of the chaincode. - Payload:
{ "adminList": "[{\"org_id\":\"{{bc-org-id}}\",\"user_id\":\"{{bc-admin-user}}\"}]" }
- Parameters:
adminList array
– An array of{user_id, org_id}
information that specifies the list of token admins. TheadminList
array is a mandatory parameter.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "fdb7dc89832c8045a333823b77fa24ae628178148dc93b3550040e070d7cd807", "payload": "", "encode": "UTF-8", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 263 } }
-
initializeDepositToken
- Original method name:
initializeDepositToken
- This method creates a token and initializes the token properties. The asset and its properties are saved in the state database. This method can be invoked only by a
Token Admin
of the chaincode. - Payload:
{ "tokenAsset": "{\"token_id\":\"{{bc-token-id}}\",\"token_desc\":\"token_desc value\"}", "sameOrgEndorser": true }
- Parameters:
tokenAsset: <Token Class>
– The token asset is passed as the parameter to this method. The properties of the token asset are described in the model file.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a JSON representation of the token asset that was created.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "aa7a4f4cc214e1a041a5a6fb7ca7530f08256559e538c9f9582e6fd12c9e65c8", "payload": { "assetType": "otoken", "events": false, "token_id": "t1", "token_name": "cbdc", "token_desc": "token_desc value", "token_standard": "ttf+", "token_type": "fungible", "token_unit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "holdable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner", "notary_role_name": "notary", "mint_approver_role_name": "notary", "burn_approver_role_name": "notary" }, "mintable": { "max_mint_quantity": 1000, "mint_approval_required": true }, "burnable": { "burn_approval_required": true }, "divisible": { "decimal": 2 }, "token_to_currency_ratio": 999 }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 267 } }
-
getAccountHistory
- Original method name:
getAccountHistory
- This GET method returns account history details for a specified user and token.
- Query:
/getAccountHistory?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "trxId":"2gsdh17fff222467e5667be042e33ce18e804b3e065cca15de306f837e416d7c3e", "timeStamp":1629718288, "value":{ "assetType":"oaccount", "account_id":"oaccount~digicur~b4f45440aa2a7942db64443d047027e9d714d62cba5c3d546d64f368642f622f", "user_id":"user1", "org_id":"Org1MSP", "token_id":"digiCurr101", "token_name":"digicur", "balance":100, "onhold_balance":0, "bapAccountVersion": 1 }, { "trxId":"9fd07fff222467e5667be042e33ce18e804b3e065cca15de306f837e416d7c3e", "timeStamp":1629718288, "value":{ "assetType":"oaccount", "account_id":"oaccount~digicur~b4f45440aa2a7942db64443d047027e9d714d62cba5c3d546d64f368642f622f", "user_id":"user1", "org_id":"Org1MSP", "token_id":"digiCurr101", "token_name":"digicur", "balance":0, "onhold_balance":0, "bapAccountVersion": 0 } } ], "encode": "JSON" } }
-
rejectMint
- Original method name:
rejectMint
- This method can be called by a notary to reject a minting request.
- Payload:
{ "tokenId": "{{bc-token-id}}", "operationId": "operation_id value", "sameOrgEndorser": true }
- Parameters:
token_id: string
– The ID of the token to reject minting.operation_id: string
– The unique operation ID that represents the mint request.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "64c5a4830949eae1424600f3d4a438c6f603a7c3ea31a68e374b899803999e22", "payload": { "msg": "Successfully rejected mint request with Operation Id 'op1234' to mint 10 tokens of token id USD" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 205 } }
-
releaseHoldTokens
- Original method name:
releaseHoldTokens
- This POST method releases a hold on tokens. The transfer is not completed and all held tokens are available again to the original owner.
- Payload:
{ "tokenId": "{{bc-token-id}}", "operationId": "operation_id value", "endorsers": {{endorsers}} }
- Parameters:
token_id: string
– The ID of the token.operation_id: string
– A unique ID to identify the hold operation. Typically this ID is passed by the client application.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "f04ba8895d52bc636d843f88476002bc99d01480c36be87c8fa259cd47a29380", "payload": { "msg": "Successfully released '10' tokens from Operation Id '8e3144' to Account Id: oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB, User-Id: issuer_user_cb)." }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 214 } }
-
removeTokenAdmin
- Original method name:
removeTokenAdmin
- This POST method removes a user as a
Token Admin
of the chaincode. This method can be called only by aToken Admin
of the chaincode. An admin cannot remove themselves. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- 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.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "6a3b9b568d04b5beb29830f91efe4e8c6310b6cf36940cecfb4ab690fbfde739", "payload": { "msg": "Successfully removed Token Admin (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 218 } }
-
removeTokenAuditor
- Original method name:
removeTokenAuditor
- This POST method removes a user as a
Token Auditor
of the chaincode. This method can be called only by aToken Admin
of the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- 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.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "a886a6040fbc76374a3c78c89ab0ffc9f7b8391cc5239b169bf3b878cf40c67b", "payload": { "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 219 } }
-
removeOrgAdmin
- Original method name:
removeOrgAdmin
- This POST method removes a user as a
Org Admin
of the chaincode. This method can be called only by aToken Admin
orOrg Admin
of the specified organization. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- 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.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e2a634f6093f89b1984e20ff86a513fabb7c3ade7cc9e27d9734b4aaf6c88597", "payload": { "msg": "Successfully removed Org Admin (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 220 } }
-
removeOrgAuditor
- Original method name:
removeOrgAuditor
- This POST method removes a user as a
Org Auditor
of the chaincode. This method can be called only by aToken Admin
orOrg Admin
of the specified organization. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- 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.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "c3bc720461004a53b37c68d4bb264858b88d980bc093a0a3ebb62a32974fb306", "payload": { "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 221 } }
-
removeRole
- Original method name:
removeRole
- This method removes a role from a specified user. This method can be called only by a
Token Admin
of the chaincode or anOrg Admin
of the specified organization. - Payload:
{ "tokenId": "{{bc-token-id}}", "role": "role value (for example minter / burner / notary)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.role: string
– The name of the role to remove from the specified user. Themintable
andburnable
behaviors correspond to theminter_role_name
andburner_role_name
properties of the specification file.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "274f0d0a2c4c3929817fb85b2e857519695c3c238ccf9903b084b87e9be7ee12", "payload": { "msg": "Successfully removed role 'notary' from Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8 (Org-Id: CB, User-Id: manager_user_cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 200 } }
-
requestMint
- Original method name:
requestMint
- This method can be called by a minter to send a request to the notary to create a specified amount of tokens.
- Payload:
{ "tokenId": "{{bc-token-id}}", "operationId": "operation_id value", "notaryOrgId": "notary_org_id value", "notaryUserId": "notary_user_id value", "quantity": 1, "timeToExpiration": "time_to_expiration value", "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}", "sameOrgEndorser": true }
- Parameters:
tokenId: string
– The ID of the token to mint.operationId: string
– The unique operation ID that represents the mint request.notaryOrgId: string
– The membership service provider (MSP) ID of the minter notary who will process the request.notaryUserId: string
– The user name or email ID of the minter notary who will process the request.quantity: number
– The amount of tokens to mint.timeToExpiration
– The time after which the minting request expires and is no longer valid.infoDetails: JSON
– An object specifying the category (category
) and description (description
) of the request, as shown in the following example.{ "category" : "category input", "description" : "description input" }
sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "06b35071415d74aa1a7c18449149c937d886cae76a832c44cf8d98e84586e76e", "payload": { "msg": "AccountId oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB , User-Id: creator_user_cb) has successfully submitted request to mint 10 tokens" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 202 } }
-
burnTokens
- Original method name:
burnTokens
- This POST method deactivates, or burns, tokens from the transaction caller's account. The caller of this method must have an account and the burner role. The quantity must be within the decimal values specified by the
decimal
parameter of thedivisible
behavior in the specification file. This method can be called by theAccountOwner
of the account with the burner role. - Payload:
{ "tokenId": "{{bc-token-id}}", "quantity": 1, "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}", "sameOrgEndorser": true }
- Parameters:
tokenId: string
– The ID of the token.quantity
– The number of tokens to burn.infoDetails: JSON
– An object specifying the category (category
) and description (description
) of the request, as shown in the following example.{ "category" : "category input", "description" : "description input" }
sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a success message with the quantity of tokens burned and the account ID.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "aff0b2dbb163ec8076747525db81fbe8f678ac88a277c5f234337f0747eb1a8d", "payload": { "msg": "Successfully burned 10 tokens from account id: oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB, User-Id: creator_user_cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 96 } }
-
setMaxDailyAmount
- Original method name:
setMaxDailyAmount
- This POST method is used to set the
maxDailyAmount
parameter in the account details for the specified amount. This method can be called only by aToken Admin
of the chaincode or by anOrg Admin
of the specified organization. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenId": "{{bc-token-id}}", "maxDailyAmount": 1, "endorsers": {{endorsers}} }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.tokenId: string
– The ID of the token.maxDailyAmount: number
– The maximum daily amount value for the specified account, which defines the maximum amount that can be transacted 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": "28682e0564e4721b6c1a8ec106f8c5c98319e9439959dbb9f83d8e6f111d9975", "payload": { "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, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 1000, "daily_transactions": 0, "current_date": "2024-11-20T00:00:00.000Z" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 222 } }
-
setMaxDailyTransactionCount
- Original method name:
setMaxDailyTransactionCount
- This POST method is used to set the
maxDailyTransactions
parameter in the account details for the specified amount. This method can be called only by aToken Admin
of the chaincode or by anOrg Admin
of the specified organization. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenId": "{{bc-token-id}}", "maxDailyTransactions": 1, "endorsers": {{endorsers}} }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.tokenId: string
– The ID of the token.maxDailyTransactions: number
– The maximum daily amount value for the specified account, which defines the maximum number of transactions allowed per day.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "8b6fb01de697562ee098110054f05d4a314933bd11ef471991cb43e25b68bad9", "payload": { "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, "max_daily_amount": 10000, "daily_amount": 0, "max_daily_transactions": 1000, "daily_transactions": 0, "current_date": "2024-11-20T00:00:00.000Z" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010", "blockNumber": 223 } }
-
suspendAccount
- Original method name:
suspendAccount
- This method suspends a fungible token account. It throws an error if an
accountStatus
value is not found in ledger. This method can be called only by aToken Admin
of the chaincode or by anOrg Admin
of the specified organization. - Payload:
{ "tokenId": "{{bc-token-id}}", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": { "assetType": "oaccountStatus", "status_id": "oaccountStatus~d5814d96d8517ac31727d60aace0519c58a425892ab0d378fcfb0a35771f65ae", "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6", "status": "suspended" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 195 } }
-
transferTokens
- Original method name:
transferTokens
- This method transfers tokens from the caller to a specified account. The caller of the method must have an account. The quantity must be within the decimal values specified by the
decimal
parameter of thedivisible
behavior in the specification file. - Payload:
{ "tokenId": "{{bc-token-id}}", "toOrgId": "to_org_id value", "toUserId": "to_user_id value", "quantity": 1, "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.toOrgId: string
– The membership service provider (MSP) ID of the receiver (payee) in the current organization.toUserId: string
– The user name or email ID of the receiver.quantity: number
– The number of tokens to transfer.infoDetails: JSON
– An object specifying the category (category
) and description (description
) of the request, as shown in the following example.{ "category" : "category input", "description" : "description input" }
endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "d613b2494b965811b2fa2106152b7085f2d6d7d43e949b10b8668722d3636fe7", "payload": { "msg": "Successfully transferred 10 tokens from account id: oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB, User-Id: creator_user_cb) to account id: oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB, User-Id: issuer_user_cb). Only 999 number of transactions and 1990 amount transfer left for today: 12/11/2024" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 224 } }
-
initializeExchangePoolUser
- Original method name:
initializeExchangePoolUser
- This method initializes the exchange pool user, which is a one-time activity. This method can be called only by the
Token Admin
. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": { "assetType": "oconversion", "convertor_id": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b", "org_id": "Org1MSP", "user_id": "exchangepooluser" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 196 } }
-
createExchangePoolAccounts
- Original method name:
createExchangePoolAccounts
- This method creates exchange pool token accounts for a given array of token IDs. This method can be called only by a
Token Admin
of the chaincode. - Payload:
{ "tokenIds": "[{{bc-token-id}}]", "sameOrgEndorser": true }
- Parameters:
token_ids: string []
– An array of token IDs.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": [ { "account_id": "oaccount~cc9d84f6d4a5976532493ef5200c9603e138adc35166ffd5fd1aad9c1647f034", "token_id": "USD", "status": "created" }, { "account_id": "oaccount~3d4933111ec8bd6cc1ebb43f2b2c390deb929cfa534f9c6ada8e63bac04a13c0", "token_id": "INR", "status": "created" } ], "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 197 } }
-
addConversionRate
- Original method name:
addConversionRate
- This method adds a conversion rate for a pair of tokens. The token conversion rate can be specified up to eight decimal places. This method can be called only by a
Token Admin
of the chaincode. - Payload:
{ "fromTokenId": "from_token_id value", "toTokenId": "to_token_id value", "tokenConversionRate": 10, "sameOrgEndorser": true }
- Parameters:
fromTokenId: string
– The ID of the token to convert from.toTokenId: string
– The ID of the token to convert to.tokenConversionRate: number
– The rate at which to convertfromTokenId
token to thetoTokenId
token.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": { "assetType": "oconversionRate", "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b", "from_token_id": "USD", "to_token_id": "INR", "conversion_rate": 10 }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 189 } }
-
updateConversionRate
- Original method name:
updateConversionRate
- This method updates the current conversion rate for a pair of tokens. The token conversion rate can be specified up to eight decimal places. This method can be called only by a
Token Admin
of the chaincode. - Payload:
{ "fromTokenId": "from_token_id value", "toTokenId": "to_token_id value", "tokenConversionRate": 20, "sameOrgEndorser": true }
- Parameters:
fromTokenId: string
– The ID of the token to convert from.toTokenId: string
– The ID of the token to convert to.tokenConversionRate: number
– The rate at which to convertfromTokenId
token to thetoTokenId
token.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": { "assetType": "oconversionRate", "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b", "from_token_id": "USD", "to_token_id": "INR", "conversion_rate": 20 }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 208 } }
-
mintWithFundingExchangePool
- Original method name:
mintWithFundingExchangePool
- This method mints tokens in the caller's account based on the specified token ID and quantity. A percentage of tokens from the minted quantity is then transferred to the exchange pool token account.
{ "tokenId": "{{bc-token-id}}", "tokenQuantity": 100, "percentageTokenToExchangePool": 20, "sameOrgEndorser": true }
- Parameters:
tokenId: string
– The ID of the token to mint.tokenQuantity: number
– The total number of tokens to mint.percentageTokenToExchangePool: number
– The percentage of minted tokens to transfer to the exchange pool token account.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": { "msg": "Successfully minted 100 tokens to Account Id: oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb (Org-Id: Org1MSP, User-Id: admin) and Successfully transfered 20 tokens to exchange pool Account with Account Id: oaccount~cc9d84f6d4a5976532493ef5200c9603e138adc35166ffd5fd1aad9c1647f034 (Org-Id: Org1MSP, User-Id: exchangepooluser) " }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 209 } }
-
tokenConversion
- Original method name:
tokenConversion
- This method converts tokens from the caller's account to the account specified by the
to_token_id
,to_org_id
andto_user_id
values. This method can be called by theToken Admin
of the chaincode and by any token account owner. An exchange pool user cannot call this method. { "fromTokenId": "from_token_id value", "toTokenId": "to_token_id value", "toOrgId": "to_org_id value", "toUserId": "to_user_id value", "tokenQuantity": 5, "endorsers": {{endorsers}} }
- Parameters:
fromTokenId: string
– The ID of the token to convert from.toTokenId: string
– The ID of the token to convert to.toOrgId: string
– The membership service provider (MSP) ID of the user in the current organization to receive the tokens.toUserId: string
– The user name or email ID of the user to receive the tokens.tokenQuantity: number
– The total number of tokens to transfer.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294", "payload": { "msg": "Succesfully converted 5 of tokens with tokenId: [USD] from AccountId: oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb (Org-Id: Org1MSP, User-Id: admin) to 100 of tokens with tokenId: [INR] to AccountId: oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e (Org-Id: Org1MSP, User-Id: user) as per the conversion rate of 20" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 213 } }
-
getConversionRate
- Original method name:
getConversionRate
- This GET method gets the current conversion rate for a pair of tokens. This method can be called by the
Token Admin
,Token Auditor
,Org Admin
, orOrg Auditor
. - Query:
/getConversionRate?fromTokenId=from_token_id value&toTokenId=to_token_id value
- Parameters:
fromTokenId: string
– The ID of the token to convert from.toTokenId: string
– The ID of the token to convert to.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "assetType": "oconversionRate", "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b", "from_token_id": "USD", "to_token_id": "INR", "conversion_rate": 20 }, "encode": "JSON" } }
-
getConversionHistory
- Original method name:
getConversionRate
- This GET method returns the token conversion history for a specified token account. This method can be called by the
Token Admin
,Token Auditor
,Org Admin
,Org Auditor
, or the token account owner. - Query:
/getConversionHistory?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "transaction_id": "otransaction~34edd19e03ec8bbbc77bc3372081410a824a5c10f9aa522b3a6390d7e8cb11cf", "from_account_id": "oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb", "to_account_id": "oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e", "transacted_amount": 5, "converted_amount": 100, "conversion_rate": "20", "from_token_id": "USD", "to_token_id": "INR", "balance": 75, "onhold_balance": 0, "timestamp": "2022-11-30T11:03:20.000Z", "transaction_type": "TOKEN_CONVERSION_DEBIT" } ], "encode": "JSON" } }
-
getConversionRateHistory
- Original method name:
getConversionRate
- This method returns the token conversion rate history for a pair of tokens. This method can be called by the
Token Admin
,Token Auditor
,Org Admin
,Org Auditor
, and by any token account owner. /getConversionRateHistory?fromTokenId=from_token_id value&toTokenId=to_token_id value
- Parameters:
fromTokenId: string
– The ID of the token to convert from, for the purpose of calculating the conversion rate.toTokenId: string
– The ID of the token to convert to, for the purpose of calculating the conversion rate.
- Returns:
- On success, a JSON object with conversion rate history details.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "trxId": "0b1ba7bc2620e1438b6580365e5c0ab852247ccfa5a3eb2157d3baca02c0e521", "timeStamp": "2022-11-30T10:23:38.000Z", "value": { "assetType": "oconversionRate", "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b", "from_token_id": "USD", "to_token_id": "INR", "conversion_rate": 20 } }, { "trxId": "36fc40ddb3d8308ee7e156af700da131d78d941fe390fc57985b7589e7035d5c", "timeStamp": "2022-11-30T10:13:18.000Z", "value": { "assetType": "oconversionRate", "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b", "from_token_id": "USD", "to_token_id": "INR", "conversion_rate": 10 } } ], "encode": "JSON" } }
-
getExchangePoolUser
- Original method name:
getExchangePoolUser
- This GET method returns the organization ID and user ID values for the exchange pool user. This method can be called only by a
Token Admin
orToken Auditor
of the chaincode. - Query:
/getExchangePoolUser
- Parameters:
- none
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "assetType": "oconversion", "convertor_id": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b", "org_id": "Org1MSP", "user_id": "exchangepooluser" }, "encode": "JSON" } }
-
getAccountOnHoldBalance
- Original method name:
getAccountOnHoldBalance
- This GET method returns the current on-hold balance for a specified account and token. This method can be called only by a
Token Admin
,Token Auditor
,Org Admin
,Org Auditor
, or theAccountOwner
of the account. - Query:
/getAccountOnHoldBalance?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "msg":"Total Holding Balance is: 0","holding_balance":0 }, "encode": "JSON" } }
-
getAccountStatus
- Original method name:
getAccountStatus
- This GET method retrieves the current status of the token account. This method can be called by the
Token Admin
,Token Auditor
,Org Admin
,Org Auditor
, or by the token account owner. - Query:
/getAccountStatus?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
- Parameters:
tokenId: string
– The ID of the token.orgId: string
– The membership service provider (MSP) ID of the user in the current organization.userId: string
– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" }, "encode": "JSON" } }
-
getAccountsByRole
- Original method name:
getAccountsByRole
- This method returns a list of all account IDs for a specified role. This method can be called only by a
Token Admin
of the chaincode. - Query:
/getAccountsByRole?tokenId={{bc-token-id}}&role=role value (for example minter / burner / notary)
- Parameters:
tokenId: string
– The ID of the token.role: string
– The name of the role to search for.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "accounts":["oaccount~digicur~b4f45440aa2a7942db64443d047027e9d714d62cba5c3d546d64f368642f622f"] }, "encode": "JSON" } }