API Explorer 896 endpoints

Create new carbon_credit_batch_on_chain

POST /obp/dynamic-entity/banks/ogcr/carbon_credit_batch_on_chain

OBPv4.0.0-dynamicEntity_createcarbon_credit_batch_on_chain_ogcr Roles: CanCreateDynamicEntityRecord_carbon_credit_batch_on_chain(per bank) _Carbon_credit_batch_on_chain(ogcr)Dynamic-EntityDynamic

Create new carbon_credit_batch_on_chain.

Cache of CarbonCreditBatchNFT data minted on the OGCR chain (chain id 20253). One record per carbon_credit_batch_id: the units of one unit type issued for an activity over one monitoring period. Each batch owns an ERC-6551 token-bound account that holds its CarbonCredit (ERC-20) balance. Populated by OGCR-chain-cache reading the chain. Join to activity_on_chain on activity_id (or activity_nft_id = token_id) to reach the OBP activity.

Property List:

  • activity_hash: activity_hash stored on-chain: keccak256 of the raw activity entity body.
  • activity_id: activity_id this batch was issued for, as stored on-chain.
  • activity_name: Activity name as stored on-chain.
  • activity_nft_id: ActivityNFT token id this batch was issued against. Join to activity_on_chain.token_id to reach the OBP activity_id.
  • activity_url: activity_url stored on-chain: link back to the OBP activity entity.
  • amount: Units issued for the batch, fixed at mint, in CarbonCredit base units (18 decimals): 6.5 tonnes is 6500000000000000000. Decimal string because a uint256 does not fit an integer field. The live balance is credit_balance.
  • batch_name: Display name of the batch by unit type, as stored on-chain.
  • block_number: Block number the mint was included in.
  • block_number_balance: Block height the credit_balance was read at. Unlike the mint fields, the balance is current-state, not historical, so it is only true as of this block.
  • carbon_credit_batch_id: Business key for this record, as stored on-chain. The contract permits one batch token per id (tokenIdByBatchId), so it is used to match records for upsert.
  • certificate_of_compliance_hash: certificate_of_compliance_hash stored on-chain: keccak256 of the raw certificate_of_compliance entity body.
  • certificate_of_compliance_uri: certificate_of_compliance_uri stored on-chain: link back to the OBP certificate_of_compliance entity.
  • certification_body_hash: certification_body_hash stored on-chain: keccak256 of the raw certification body entity body.
  • certification_body_url: certification_body_url stored on-chain: link back to the OBP certification body entity.
  • certification_scheme_hash: certification_scheme_hash stored on-chain: keccak256 of the raw certification scheme entity body.
  • certification_scheme_url: certification_scheme_url stored on-chain: link back to the OBP certification_scheme entity.
  • chain_id: EVM chain id (OGCR chain = 20253).
  • contract_address: CarbonCreditBatchNFT contract address the token was read from.
  • country_id: Country id as stored on-chain.
  • credit_balance: CarbonCredit (ERC-20) balance held by token_bound_account, in smallest units, as read at block_number_balance. Decimal string because a uint256 does not fit an integer field. Divide by 10^credit_decimals for tonnes CO2e. Empty when no CarbonCredit contract address is configured.
  • credit_contract_address: CarbonCredit ERC-20 contract address the balance was read from.
  • credit_decimals: Decimals of the CarbonCredit ERC-20, for rendering credit_balance. 0 when no CarbonCredit contract address is configured.
  • expiry_date: Batch expiry date as stored on-chain.
  • issue_date: Batch issue date as stored on-chain.
  • monitoring_period_end_date: Monitoring period end date as stored on-chain.
  • monitoring_period_start_date: Monitoring period start date as stored on-chain.
  • operator_hash: operator_hash stored on-chain: keccak256 of the raw operator entity body.
  • operator_url: operator_url stored on-chain: link back to the OBP operator entity.
  • owner_address: Current owner of the batch NFT (operator OGCR wallet address). Owning the NFT gates the right to move the credits held in its token-bound account.
  • status_code: Batch status as stored on-chain.
  • token_bound_account: ERC-6551 token-bound account for this batch. This address holds the batch's CarbonCredit (ERC-20) balance.
  • token_id: CarbonCreditBatchNFT token id, unique per contract. Records are matched on carbon_credit_batch_id rather than this, so that the match uses a string field.
  • token_uri: tokenURI of the NFT (ERC721 metadata data-URI, rendered on-chain from the batch data).
  • tx_hash: Mint transaction hash (from the BatchMinted event).
  • unit_type: CRCF unit type this batch represents, as stored on-chain.

MethodRouting settings example:

<details>

{
  "is_bank_id_exact_match":false,
  "method_name":"dynamicEntityProcess",
  "connector_name":"rest_vMar2019",
  "bank_id_pattern":".*",
  "parameters":[
    {
        "key":"entityName",
        "value":"carbon_credit_batch_on_chain"
    }
    {
        "key":"url",
        "value":"http://mydomain.com/xxx"
    }
  ]
}

</details>

User Authentication is Required. The User must be logged in. The Application must also be authenticated.

Example request body
{
  "activity_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "activity_id": "activity_AB12CD34EF",
  "activity_name": "Reforestation 2024",
  "activity_nft_id": 1,
  "activity_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/activity/activity_AB12CD34EF",
  "amount": "6500000000000000000",
  "batch_name": "Permanent Removals Carbon Credit Batch",
  "block_number": 12345,
  "block_number_balance": 12400,
  "carbon_credit_batch_id": "verification_AB12:permanent_removal",
  "certificate_of_compliance_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "certificate_of_compliance_uri": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/banks/ogcr/certificate_of_compliance/coc_AB12CD34EF",
  "certification_body_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "certification_body_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/certification_body/body_VERRA",
  "certification_scheme_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "certification_scheme_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/certification_scheme/scheme_SALUS",
  "chain_id": 20253,
  "contract_address": "0x38cF23C52Bb4B13F051Aec09580a2dE845a7FA35",
  "country_id": "DK",
  "credit_balance": "1000000000000000000",
  "credit_contract_address": "0x1B4bC0dE8b6A1A2b3C4d5E6f7A8b9C0d1E2f3A4b",
  "credit_decimals": 18,
  "expiry_date": "2030-01-01",
  "issue_date": "2025-01-01",
  "monitoring_period_end_date": "2024-12-31",
  "monitoring_period_start_date": "2024-01-01",
  "operator_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "operator_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/operator/op_01JS0347FKH",
  "owner_address": "0x30753E4A8aad7F8597332E813735Def5dD395028",
  "status_code": "issued",
  "token_bound_account": "0x9F2fCc7C4E1C0eA0dB1A0EbD79b0Cc7Ee4c3e5a1",
  "token_id": 1,
  "token_uri": "data:application/json;base64,eyJuYW1lIjoiQmF0Y2gifQ==",
  "tx_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "unit_type": "Permanent Removal"
}
Example success response
{
  "bank_id": "ogcr",
  "carbon_credit_batch_on_chain": {
    "carbon_credit_batch_on_chain_id": "d8839721-ad8f-45dd-9f78-2080414b93f9",
    "activity_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "activity_id": "activity_AB12CD34EF",
    "activity_name": "Reforestation 2024",
    "activity_nft_id": 1,
    "activity_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/activity/activity_AB12CD34EF",
    "amount": "6500000000000000000",
    "batch_name": "Permanent Removals Carbon Credit Batch",
    "block_number": 12345,
    "block_number_balance": 12400,
    "carbon_credit_batch_id": "verification_AB12:permanent_removal",
    "certificate_of_compliance_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "certificate_of_compliance_uri": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/banks/ogcr/certificate_of_compliance/coc_AB12CD34EF",
    "certification_body_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "certification_body_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/certification_body/body_VERRA",
    "certification_scheme_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "certification_scheme_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/certification_scheme/scheme_SALUS",
    "chain_id": 20253,
    "contract_address": "0x38cF23C52Bb4B13F051Aec09580a2dE845a7FA35",
    "country_id": "DK",
    "credit_balance": "1000000000000000000",
    "credit_contract_address": "0x1B4bC0dE8b6A1A2b3C4d5E6f7A8b9C0d1E2f3A4b",
    "credit_decimals": 18,
    "expiry_date": "2030-01-01",
    "issue_date": "2025-01-01",
    "monitoring_period_end_date": "2024-12-31",
    "monitoring_period_start_date": "2024-01-01",
    "operator_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "operator_url": "https://dcr.ogcr.tesobe.com/obp/dynamic-entity/operator/op_01JS0347FKH",
    "owner_address": "0x30753E4A8aad7F8597332E813735Def5dD395028",
    "status_code": "issued",
    "token_bound_account": "0x9F2fCc7C4E1C0eA0dB1A0EbD79b0Cc7Ee4c3e5a1",
    "token_id": 1,
    "token_uri": "data:application/json;base64,eyJuYW1lIjoiQmF0Y2gifQ==",
    "tx_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "unit_type": "Permanent Removal"
  }
}
Possible errors (4)
  • OBP-20001: User not logged in. Authentication is required!
  • OBP-20006: User is missing one or more roles:
  • OBP-10001: Incorrect json format.
  • OBP-50000: Unknown Error.
Implemented by OBPv4.0.0 dynamicEntity_createcarbon_credit_batch_on_chain_ogcr Originally /banks/ogcr/carbon_credit_batch_on_chain