Wallet Structure

The custodial wallet of Bitcoin has the following structure.

  • Main Address
  • Child Address

TIP
Bitcoin does not use fee addresses.






Child Address

Generates child addresses by calling the Generate Child Address API. Generally, one child address is given to each end user. Generated child addresses can be checked from [Child Address Information] from the console or by calling the Access Child Address List API.

Response example

[
  {
    "address": "tb1qx4gh8ueatdggy0qf8vepvavd4pa02ajwfwvrah",
    "name": "테스트용 자식주소"
  }
]





Deposit

Deposit Status

When an asset from the outside arrives at the main or a child address, Octet recognizes it as a deposit. However, the deposit is not finalized even if the deposit transaction is included in the blocks. Additional blocks must be generated to finalize(FINALIZED) the transaction to ensure the integrity of the transaction. When an asset is sent to a main or a child address but has not arrived, that transaction is not recognized. Therefore, there is no FAILED status for the deposit transaction.

Status nameDescription
UNFINALIZEDDeposit transaction is included in the blocks
FINALIZEDDeposit transaction is included in the blocks and the next block is generated

The number of blocks required to finalize the deposit is different depending on the network. Testnet requires two blocks, and the mainnet requires one additional block to finalize the transaction.

TestnetMainnet
2 block (about 20 minute)1 block (about 10 minute)


Deposit Confirmation

1. Checking from the Console

You can check the deposit status from [Transaction History] on the console. UNFINALIZED deposits are displayed as ‘Processing’, and FINALIZED deposits are displayed as ‘Completed’.


2. Checking with Webhooks

When a deposit is finalized to a main or a child address, a deposit webhook will be sent. You can check the deposit status from the received webhook. For more information about how to use webhooks and their data structure, check the 'Webhook' page.






Gathering

Gathering Process and Fees

Assets stored in child addresses don’t move to the main address unless gathering is requested. Therefore, gatherings should be made regularly to avoid a deficit in the main address. When a gathering is requested, assets stored in every child address are transferred to the main address as one transaction (however, only UTXOs that are FINALIZED will be gathered).

A gathering fee occurs once for each transaction, and it is deducted from the asset to be gathered. When the sum of the assets to be gathered is less than 0.001BTC, the gathering will not be made. Gathering process is as follows.

  1. Request gathering.
  2. Gather assets from multiple child addresses and generates one transaction.
  3. Calculates the optimal fees and propagates the transactions.
  4. Gathering is completed when transactions are confirmed in the blocks.


Gathering Status

Gathering status can be specified into four statuses, depending on the gathering process. The asset stored in the child address is in AWAITING_GATHERING status.

When a gathering request is made and generated a gathering transaction, the asset status changes to GATHERING. When the transaction is included in the blocks, the status of the asset is processed to COMPLETED and finishes the gathering.

When a gathering is tried and failed, the status of the asset will be processed as GATHERING_FAILED. Assets with GATHERING_FAILED status are included in the gathering target again. When a gathering is tried but failed to generate a transaction due to insufficient fees, it remains in AWAITING_GATHERING status.

Status nameDescription
AWAITING_GATHERINGAwaiting gathering
GATHRINGGenerate gathering transaction
COMPLETEDComplete gathering transaction
GATHERING_FAILEDFailed gathering transaction


Gather

Transfers the assets stored in the child address to the main address. Gatherings can be processed by one of the following two methods.

1. Gathering from the Console

You can gather from Console - Select a wallet - [Gathering History]. Click the [Gather] button, check the assets and the amount to gather, then proceed with the gathering.


2. Gathering with API

The gathering will be processed by calling the Request Gathering API.

Response example

[
  {
    "success": true,
    "uuid": "97410344-a48b-4f7e-a1ee-2feff91bebaa",
    "childAddresses": [
      "0x42d0aAE9A2305D66d20bE4361535FdB44670F933"
    ]
  }
]


Gathering Status Confirmation

1. Checking from the Console

You can check the gathering history from Select a wallet - [Gathering History] - [Gathering History].


2. Checking with API

You can check the gathering history by calling the Access Gathering Request Information API.

Response example

[
  {
    "idx": 66,
    "status": "COMPLETED",
    "createdDate": "2021-12-29T08:09:03.777Z",
    "modifiedDate": "2021-12-29T08:20:00.000Z",
    "coin": {
      "idx": 1,
      "symbol": "BTC",
      "nameKo": "비트코인",
      "nameEn": "Bitcoin",
      "status": "ACTIVATED",
      "type": "DEFAULT",
      "contractAddress": null,
      "decimals": 8,
      "iconUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png",
      "deleteWalletMinAmount": "0.00010000000000000000",
      "createdDate": "2021-09-20T07:40:18.511Z",
      "modifiedDate": "2021-12-23T06:13:37.636Z"
    },
    "feeInjectionTransaction": null,
    "feeInjectionFee": null,
    "gatheringTransaction": {
      "idx": 8965,
      "uuid": "32c266f2-b395-4e82-b737-670ae7767600",
      "type": "GATHERING",
      "txid": "5cfc6af79bbfe2bef92c96e148bf73bffbdacd84a0d2b2468f1ac7cd57cde666",
      "fromAddress": "tb1q493qlgvg7qfy3k7pan5nv006chxrz2dxmunthr",
      "toAddress": "tb1quzmru5wx8d6y96f0mv508lycyemq8vydcly6hf",
      "amount": "0.00005971000000000000",
      "usedFee": "0.00049029000000000000",
      "nonce": null,
      "blockHeight": "2133581",
      "serialized": null,
      "memo": null,
      "status": "FINALIZED",
      "outputIndex": null,
      "createdDate": "2021-12-29T08:10:00.262Z",
      "modifiedDate": "2021-12-29T08:20:00.000Z",
      "unfinalizedDate": "2021-12-29T08:20:00.000Z",
      "finalizedDate": "2021-12-29T08:20:00.000Z",
      "failedDate": null,
      "coin": {
        "idx": 1,
        "symbol": "BTC",
        "nameKo": "비트코인",
        "nameEn": "Bitcoin",
        "status": "ACTIVATED",
        "type": "DEFAULT",
        "contractAddress": null,
        "decimals": 8,
        "iconUrl": "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png",
        "deleteWalletMinAmount": "0.00010000000000000000",
        "createdDate": "2021-09-20T07:40:18.511Z",
        "modifiedDate": "2021-12-23T06:13:37.636Z"
      }
    },
    "gatheringFee": {
      "idx": 151,
      "gasLimit": null,
      "gasPrice": "277.00000000000000000000",
      "unit": "satoshi",
      "schedulerData": null,
      "createdDate": "2021-12-29T08:09:03.769Z",
      "modifiedDate": "2021-12-29T08:09:03.769Z"
    }
  }
]

3. Checking with Webhooks

When the gathering to the main address is finished, a gathering webhook will be sent. You can check the gathering status from the webhook. For more information about how to use webhooks and their data structure, check the 'Webhook' page.






Withdrawal

Withdrawal Process

Assets must be withdrawn from the main address to transfer them from a custodial wallet to the outside. An asset cannot be transferred outside from the child address.

  1. Request withdrawal.
  2. Generate transaction.
  3. Calculates the optimal fees and propagates the transactions.
  4. Withdrawal is completed when the transactions are confirmed in the blocks.


Withdrawal Status

Unlike a deposit, a withdrawal is finalized(FINALIZED) at the moment when the transaction is included in the blocks.

Status nameDescription
AWAITING_DECISIONAwaiting withdrawal approval
REJECTEDWithdrawal is denied
AWAITING_WITHDRAWALApproved and awaiting withdrawal
PENDINGWithdrawal transaction is generated
FINALIZEDWithdrawal transaction is included in the blocks
FAILEDWithdrawal transaction failed


Withdraw

You can request a withdrawal from the main address to the outside by calling the Request Withdrawal API. The uuid value will be returned when the withdrawal request is successful. The value can be used to access the withdrawal process.

Response example

{
  "uuid": "18012e3f-07f3-45ec-862b-f020c0ca935a"
}


Withdrawal Confirmation

1. Checking from the Console

You can check the withdrawal status from [Transaction History] on the console. AWAITING_WITHDRAWAL or PENDING withdrawals are displayed as ‘Processing’, and FINALIZED withdrawals are displayed as ‘Completed’.


2. Checking with API

You can check the progress of a specific withdrawal transaction by calling the Access Withdrawal Transaction Information API.

Response example

{
  "idx": 490,
  "uuid": "07efdcb2-b3fd-4fe7-bf47-c0b460b289e3",
  "fromAddress": "0x71b5De2970A32eEf6362AE7Bc3B73103b4392bB0",
  "toAddress": "0x295909dC67B76f936BD4119aDd877088602cCaD3",
  "amount": "2.00000000000000000000",
  "memo": null,
  "requestId": "25",
  "type": "API",
  "description": "",
  "requiredApprovalCount": 1,
  "useApiAutoApproval": true,
  "status": "SENT",
  "createdDate": "2022-01-25T09:25:02.383Z",
  "modifiedDate": "2022-01-25T09:25:10.000Z",
  "rejectedDate": null
}

3. Checking with Webhooks

When the withdrawal from the main address is finished, a withdrawal webhook will be sent. You can check the withdrawal status from the webhook. For more information about how to use webhooks and their data structure, check the Webhook page.






Balance Access Criteria

You can check the balance of the asset stored in a specific address by calling the Access Address Balance API. The accessed balances are specified into total balances and liquid balances.

  • Total balance is the sum of assets awaiting to be deposited, deposited assets, UTXO awaiting to be withdrawn, and UTXO under the withdrawal process. It means all assets with confirmation of 1 or above.
  • Liquid balance calculates only the assets awaiting to be deposited from the total balance. The liquid balance of a child address represents the assets that can be gathered, while the liquid balance of the main address represents the assets that can be withdrawn.





Faucet

In the case of the testnet, you must obtain a testing BTC from the faucet website and deposit it. When an actual BTC is deposited in the testnet, it will not be recognized.