calculate_dao_maximum_withdraw - Nervos

Calculates the maximum withdrawal one can get, given a referenced DAO cell, and a withdrawing block hash.

Parameters

  • out_point - Reference to the DAO cell, the depositing transaction’s output.
  • kind - Two kinds of dao withdrawal amount calculation option.

Option 1, the assumed reference block hash for withdrawing phase 1 transaction, this block must be in the canonical chain, the calculation of occupied capacity will be based on the depositing transaction’s output, assuming the output of phase 1 transaction is the same as the depositing transaction’s output.

Option 2, the out point of the withdrawing phase 1 transaction, the calculation of occupied capacity will be based on corresponding phase 1 transaction’s output.

Returns

The RPC returns the final capacity when the cell out_point is withdrawn using the block hash or withdrawing phase 1 transaction out point as the reference.

In CKB, scripts cannot get the information about in which block the transaction is committed. A workaround is letting the transaction reference a block hash so the script knows that the transaction is committed at least after the reference block.

Example

Request

curl --location --request POST 'https://ckb-mirana.unifra.io/v1/4fb36720a57340d39aee4cf68511064a' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": 42,
  "jsonrpc": "2.0",
  "method": "calculate_dao_maximum_withdraw",
  "params": [
    {
      "index": "0x0",
      "tx_hash": "0x42e82575740ec53e0b52ce8a36e212ad62beb58d1beac997996363e0bfe3d9e5"
    },
    "0xa5f5c85987a15de25661e5a214f2c1449cd803f071acc7999820f25246471f40"
  ]
}
'

Result

{
  "id": 42,
  "jsonrpc": "2.0",
  "result": "0x4a8b4e8a4"
}

🚧

The below parameter inputs do not work, please reference the section above instead.

Language
Click Try It! to start a request and see the response here!