openapi: 3.0.3
info:
  title: MicrovisionChain API Document
  description: API definition for MicrovisionChain provided apis
  version: 3.0.11
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  contact:
    email: heqiming@metasv.com
    name: MicrovisionChain team

servers:
  - url: "https://mainnet.mvcapi.com"

tags:
  - name: block
    description: block related apis
  - name: treasury
    description: treasury related apis for auditing
  - name: tx
    description: transaction related apis
  - name: address
    description: address related apis
  - name: outpoint
    description: output spent status (outpoint of vin) apis
  - name: merchant
    description: merchant apis
  - name: xpub
    description: xpub related apis
  - name: contract
    description: contract related apis
  - name: user
    description: user account related apis

paths:
  /block/info:
    get:
      security:
        - bearerAuth: []
      tags:
        - block
      summary: Get current blockchain info from full node.
      responses:
        "200":
          description: Get blockchain info success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BlockchainInfo"

  /block:
    get:
      security:
        - bearerAuth: []
      tags:
        - block
      summary: Get recent block list by paging. 30 items per page.
      parameters:
        - in: query
          name: last
          required: false
          description: paging flag, height of last item in last page
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: successfully get lists
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/BlockHeaderPage"

  "/block/{blockId}":
    get:
      security:
        - bearerAuth: []
      tags:
        - block
      summary: Get block request by height or hash
      parameters:
        - name: blockId
          in: path
          description: The block id, height or hash acceptable.
          required: true
          schema:
            type: string

      responses:
        "200":
          description: get block info success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BlockHeaderIndex"
        "404":
          description: block info not found

  "/treasury":
    get:
      security:
        - bearerAuth: []
      tags:
        - treasury
      summary: Get current treasury info.
      responses:
        "200":
          description: Get treasury info success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TreasuryInfo"
  "/treasury/history":
    get:
      security:
        - bearerAuth: []
      tags:
        - treasury
      summary: Get all treasury history.
      responses:
        "200":
          description: successfully get lists
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/TreasuryHistory"

  "/tx/{txid}":
    get:
      security:
        - bearerAuth: []
      tags:
        - tx
      summary: Get transaction detail by specific txid.
      description: This api is parsed from raw hex, you can use /tx/{txid}/raw to parse tx by yourself, If you want detail input info, use '/vin/{txid}' to get detailed input info including address and value.
      parameters:
        - name: txid
          in: path
          description: the request ID to search, txhash
          required: true
          schema:
            type: string
        - name: showScript
          in: query
          description: Return source script code or not (default false).
          required: false
          schema:
            type: boolean
      responses:
        "200":
          description: Get transaction detail success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TxDetail"
        "404":
          description: Transaction not found

  "/tx/{txid}/raw":
    get:
      security:
        - bearerAuth: []
      tags:
        - tx
      summary: Get transaction raw hex by specific txid.
      parameters:
        - name: txid
          in: path
          description: the request ID to search, txhash
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get transaction raw hex success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TxRaw"
        "404":
          description: Transaction not found

  "/tx/{txid}/seen":
    get:
      security:
        - bearerAuth: []
      tags:
        - tx
      summary: Whether MvcApi have seen this tx before. This is a fast approach to know if the tx exist or not.
      parameters:
        - name: txid
          in: path
          description: the request ID to search, txhash
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Return true if the transaction is found.
          content:
            application/json:
              schema:
                type: boolean
        "404":
          description: Transaction not found.

  "/tx/broadcast":
    post:
      security:
        - bearerAuth: []
      tags:
        - tx
      summary: Broadcast tx to MvcApi fullnode.
      description: This api will broadcast to MvcApi fullnode directly. This endpoint use rpc sendrawtransaction.
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TxRaw"
      responses:
        "201":
          description: Broadcast success, txid returned
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BroadcastResult"
        "403":
          description: Broadcast Failed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BroadcastResult"

  "/tx/broadcast/batch":
    post:
      security:
        - bearerAuth: []
      tags:
        - tx
      summary: Broadcast a batch of tx to MvcApi fullnode. This endpoint use rpc sendrawtransactions.
      description: This api will broadcast to MvcApi fullnode directly.
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: "#/components/schemas/TxRaw"
      responses:
        "200":
          description: Broadcast result list, txid returned with the original order
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BatchBroadcastResult"

  "/address/{address}/balance":
    get:
      security:
        - bearerAuth: []
      tags:
        - address
      summary: Get address balance by specific address.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get address detail success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AddressBalance"

  "/address/{address}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - address
      summary: Get address utxos by specific address(100 per page).
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: flag
          in: query
          description: The last id of the last query(Paging flag)
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Get address utxos success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/AddressUtxo"

  "/address/{address}/tx":
    get:
      security:
        - bearerAuth: []
      tags:
        - address
      summary: Get address history by specific address(recent 10 days available).
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: limit
          in: query
          description: The max items returned in this query(max 100).
          required: false
          schema:
            type: integer
            format: int64
        - name: flag
          in: query
          description: The last id of the last query(Paging flag)
          required: false
          schema:
            type: string
        - name: confirmed
          in: query
          description: (default true) fetch confirmed tx, fetch unconfirmed tx if false
          required: false
          schema:
            type: boolean
      responses:
        "200":
          description: Get address transaction history success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/AddressTx"

  "/outpoint/{txid}/{index}":
    get:
      security:
        - bearerAuth: []
      tags:
        - outpoint
      summary: Get tx output(outpoint for vin) spent status.
      description: Get detailed info for a utxo(or txo if spent), Only outputs spent no longer than one month are available. (Premium feature will support full history)
      parameters:
        - name: txid
          in: path
          description: The txid of the output
          required: true
          schema:
            type: string
        - name: index
          in: path
          description: The index of the output in the tx.
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Get outpoint success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OutputInfo"

  "/vin/{txid}/detail":
    get:
      security:
        - bearerAuth: []
      tags:
        - tx
      summary: Get all output point of vins in the tx with detailed output script.
      description: Search output points by spent txid. Use this api to get detailed inputs for the tx.
      parameters:
        - name: txid
          in: path
          description: The txid of the vins
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get vin list success.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/OutputInfoDetail"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/merchant/utxo":
    post:
      security:
        - bearerAuth: []
      tags:
        - merchant
      summary: Pick utxos by addresses and amount.
      description: Selects a set of Utxos with total value higher than the given amount from a given address list . In case of HD wallets, multiple addresses can be specified.
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UtxoPickRequest"
      responses:
        "200":
          description: utxo pick success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AddressUtxo"

  "/xpubLite/{xpub}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - xpub
      summary: Get xpub utxos by specific xpub(300 per page).
      parameters:
        - name: xpub
          in: path
          description: the requested xpub
          required: true
          schema:
            type: string
        - name: limit
          in: query
          description: The max items returned in this query(default 300), not bigger than 5000.
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: Get xpub utxos success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/XpubUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/xpubLite/{xpub}/address/{address}":
    get:
      security:
        - bearerAuth: []
      tags:
        - xpub
      summary: Get xpub address type and index. Only index under /0/70 /1/30 is valid. Otherwise not found.
      parameters:
        - name: xpub
          in: path
          description: the requested xpub
          required: true
          schema:
            type: string
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get xpub address success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/XpubAddress"

        "401":
          $ref: "#/components/responses/UnauthorizedError"
        "404":
          description: Address not found in the xpub.
  "/xpubLite/{xpub}/balance":
    get:
      security:
        - bearerAuth: []
      tags:
        - xpub
      summary: Get xpub balances including confirmed and unconfirmed.
      description: This api returns confirmed balance(same as address balance), not sumed utxos.
      parameters:
        - name: xpub
          in: path
          description: the xpub to search
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get xpub balance success.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/XpubLiteBalance"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/unique/genesis/{codeHash}/{genesis}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get contract unique utxos by codeHash and genesisId.
      parameters:
        - name: codeHash
          in: path
          description: Code hash of the token.
          required: true
          schema:
            type: string
        - name: genesis
          in: path
          description: Contract genesis
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get contract unique utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractUniqueUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/ft/address/{address}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract token utxos for specific address.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: codeHash
          in: query
          description: Filter by contract code hash
          required: false
          schema:
            type: string
        - name: genesis
          in: query
          description: Filter by contract genesis
          required: false
          schema:
            type: string
        - name: flag
          in: query
          description: The flag of the last query Item(Paging flag)
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Get contract ft utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/ContractFtUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/ft/address/{address}/balance":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract token balances for specific address.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: codeHash
          in: query
          description: Filter by contract code hash
          required: false
          schema:
            type: string
        - name: genesis
          in: query
          description: Filter by contract genesis
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Get contract ft balances success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/ContractFtBalance"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/ft/address/{address}/balance/confirmed":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract token balances for specific address ignoring all unconfirmed txs.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: codeHash
          in: query
          description: Filter by contract code hash
          required: true
          schema:
            type: string
        - name: genesis
          in: query
          description: Filter by contract genesis
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get contract ft balances succes（ingore unconfirmed txs）.
          content:
            application/json:
              schema:
                type: integer
                format: int64
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/ft/address/{address}/{codeHash}/{genesis}/tx":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract token balances for specific address.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: codeHash
          in: path
          description: Filter by contract code hash
          required: true
          schema:
            type: string
        - name: genesis
          in: path
          description: Filter by contract genesis
          required: true
          schema:
            type: string
        - name: limit
          in: query
          description: The max items returned in this query(max 100).
          required: false
          schema:
            type: integer
            format: int64
        - name: flag
          in: query
          description: The last id of the last query(Paging flag)
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Get contract ft history success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 100
                items:
                  $ref: "#/components/schemas/ContractFtAddressTx"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/ft/genesis/{codeHash}/{genesis}/circulation":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all sum of circulation ft token utxos by codeHash and genesisId(10min cached).
      parameters:
        - name: codeHash
          in: path
          description: Code hash of the token.
          required: true
          schema:
            type: string
        - name: genesis
          in: path
          description: Contract genesis
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get circulation successful.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractFtGenesisCirculation"

  "/contract/nft/address/{address}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract nft token utxos for specific address.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: codeHash
          in: query
          description: Filter by contract code hash
          required: false
          schema:
            type: string
        - name: genesis
          in: query
          description: Filter by contract genesis
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Limit the return count(no more than 300)
          required: false
          schema:
            type: integer
        - name: flag
          in: query
          description: The flag of the last query Item(Paging flag)
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Get contract nft utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractNftUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"
  "/contract/nft/address/{address}/summary":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get nft summary(NFT count group by genesis) for address.
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get contract nft utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractNftAddressSummary"
        "401":
          $ref: "#/components/responses/UnauthorizedError"
  "/contract/nft/address/{address}/count/confirmed":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get confirmed utxo count for specific nft(ignore all unconfirmed txs).
      parameters:
        - name: address
          in: path
          description: the requested address
          required: true
          schema:
            type: string
        - name: codeHash
          in: query
          description: Filter by contract code hash
          required: true
          schema:
            type: string
        - name: genesis
          in: query
          description: Filter by contract genesis
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get contract nft utxo success.
          content:
            application/json:
              schema:
                type: integer
        "401":
          $ref: "#/components/responses/UnauthorizedError"
  "/contract/nft/genesis/{codeHash}/{genesis}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract nft token utxos by codeHash and genesisId.
      parameters:
        - name: codeHash
          in: path
          description: Code hash of the token.
          required: true
          schema:
            type: string
        - name: genesis
          in: path
          description: Contract genesis
          required: true
          schema:
            type: string
        - name: tokenIndex
          in: query
          description: Find exact token Index.
          required: false
          schema:
            type: integer
            format: int64
        - name: max
          in: query
          description: Token index not bigger than this(include this).
          required: false
          schema:
            type: integer
            format: int64
        - name: min
          in: query
          description: Token index not less than this(include this).
          required: false
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Get contract nft utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractNftUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"
  "/contract/nft/genesis/{codeHash}/{genesis}/summary":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get nft summary(count group by address) for specific codeHash and genesisId(result cached for 60s).
      parameters:
        - name: codeHash
          in: path
          description: Code hash of the token.
          required: true
          schema:
            type: string
        - name: genesis
          in: path
          description: Contract genesis
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Get contract nft utxo success(result cached for 60s)..
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractNftGenesisSummary"
        "401":
          $ref: "#/components/responses/UnauthorizedError"

  "/contract/nft/sell/address/{address}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract sell sell utxos for specific address.
      parameters:
        - name: address
          in: path
          description: Owner address.
          required: true
          schema:
            type: string
        - name: codeHash
          in: query
          description: Filter by contract code hash
          required: false
          schema:
            type: string
        - name: genesis
          in: query
          description: Filter by contract genesis
          required: false
          schema:
            type: string
        - name: limit
          in: query
          description: Limit the return count(no more than 300)
          required: false
          schema:
            type: integer
        - name: flag
          in: query
          description: The flag of the last query Item(Paging flag)
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Get contract nft sell utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractNftSellUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"
  "/contract/nft/sell/genesis/{codeHash}/{genesis}/utxo":
    get:
      security:
        - bearerAuth: []
      tags:
        - contract
      summary: Get all contract nft token utxos by codeHash and genesisId.
      parameters:
        - name: codeHash
          in: path
          description: Code hash of the token.
          required: true
          schema:
            type: string
        - name: genesis
          in: path
          description: Contract genesis
          required: true
          schema:
            type: string
        - name: tokenIndex
          in: query
          description: Find exact token Index.
          required: false
          schema:
            type: integer
            format: int64
        - name: max
          in: query
          description: Token index not bigger than this(include this).
          required: false
          schema:
            type: integer
            format: int64
        - name: min
          in: query
          description: Token index not less than this(include this).
          required: false
          schema:
            type: integer
            format: int64
      responses:
        "200":
          description: Get contract nft sell utxo success.
          content:
            application/json:
              schema:
                type: array
                maxItems: 300
                items:
                  $ref: "#/components/schemas/ContractNftSellUtxo"
        "401":
          $ref: "#/components/responses/UnauthorizedError"
components:
  securitySchemes:
    # arbitrary name for the security scheme
    bearerAuth:
      type: http
      scheme: bearer
      # optional, arbitrary value for documentation purposes
      bearerFormat: JWT
  responses:
    UnauthorizedError:
      description: Access token is missing or invalid
      content:
        application/json:
          schema:
            type: string
            items:
              $ref: "#/components/schemas/ErrorResponse"
  schemas:
    ErrorResponse:
      description: Error response.
      type: object
      properties:
        message:
          type: string
          description: The reason for this error.
    BlockchainInfo:
      type: object
      properties:
        chain:
          type: string
          description: mainnet or testnet
        blocks:
          type: integer
          description: current block count
        headers:
          type: integer
          description: current block header count
        bestBlockHash:
          type: string
          description: current highest blockhash
        difficulty:
          type: string
          description: decimal string for current difficulty
        medianTime:
          type: integer
          format: int64
          description: current median time
        chainwork:
          type: string
          description: current pow
        networkHashPerSecond:
          type: string
          description: estimated current network hash rate.
        mempoolTxCount:
          type: integer
          description: current mempool transaction count.
        mempoolUsage:
          type: integer
          format: int64
          description: current mempool usage.
        estimatedBlockSize:
          type: integer
          format: int64
          description: next estimated block size.
    BlockHeaderPage:
      type: object
      description: block header saved by partition page
      properties:
        height:
          type: integer
          format: int64
          description: Block height.
        blockHash:
          type: string
          description: Block hash.
        timestamp:
          type: integer
          format: int64
          description: Block timestamp.
        medianTime:
          type: integer
          format: int64
          description: current median time
        reward:
          type: integer
          format: int64
          description: Miner total rewards, including miner fee.
        miner:
          type: string
          description: Guessed miner name.
        txCount:
          type: integer
          description: Total txs count included in the block.
        size:
          type: integer
          format: int64
          description: Size of the block

    BlockHeaderIndex:
      type: object
      description: Detailed block header info.
      properties:
        blockHash:
          type: string
          description: Block hash.
        height:
          type: integer
          format: int64
          description: Block height.
        version:
          type: integer
          format: int64
          description: Block version.
        prevBlockHash:
          type: string
          description: The block hash of the previous block.
        merkleRoot:
          type: string
          description: Hex formatted block merkle root.
        timestamp:
          type: integer
          format: int64
          description: Block timestamp.
        medianTime:
          type: integer
          format: int64
          description: Block median timestamp.
        reward:
          type: integer
          format: int64
          description: Miner total rewards, including miner fee.
        miner:
          type: string
          description: Guessed miner name.
        minerAddress:
          type: string
          description: Miner address that received rewards.
        txCount:
          type: integer
          description: Total txs count included in the block.
        inputCount:
          type: integer
          description: Total input count in the block.
        outputCount:
          type: integer
          description: Total output count in the block
        size:
          type: integer
          format: int64
          description: Size of the block
        bits:
          type: integer
          format: int64
          description: Target bits.
        nonce:
          type: integer
          format: int64
          description: Block nonce
        coinbase:
          type: string
          description: Hex formated coinbase info.

    BlockTx:
      type: object
      description: Tx simple info for block tx list.
      properties:
        txid:
          type: string
          description: Transaction hash.
        height:
          type: integer
          format: int64
          description: Block height of this tx.
        blockHash:
          type: string
          description: Hash of the block
        size:
          type: integer
          format: int64
          description: transaction size
        inputCount:
          type: integer
          description: Input count in this transaction
        outputCount:
          type: integer
          description: Output count in this transaction.
        lockTime:
          type: integer
          format: int64
          description: Lock time of this transaction
        fee:
          type: integer
          format: int64
          description: Trasaction fee.
        confirmations:
          type: integer
          format: int64
          description: Confirmations of this transaction, -1 if unconfirmed.
        timestamp:
          type: integer
          format: int64
          description: Block timestamp for the transaction, confirmed tx only.

    TreasuryInfo:
      type: object
      description: current treasury utxo info
      properties:
        txid:
          type: string
          description: current treasury utxo txid
        index:
          type: integer
          description: current treasury utxo index
        amount:
          type: integer
          format: int64
          description: current treasury amount
        height:
          type: integer
          format: int64
          description: current treasury utxo height
        blockHash:
          type: string
          description: current treasury utxo block hash
        timestamp:
          type: integer
          format: int64
          description: current treasury utxo timestamp
    TreasuryHistory:
      type: object
      description: treasury transaction history
      properties:
        txid:
          type: string
          description: treasury transaction txid.
        outcome:
          type: integer
          format: int64
          description: treasury transaction spent outcome in satoshi.
        timestamp:
          type: integer
          format: int64
          description: treasury transaction timestamp.
        reason:
          type: string
          description: Reason for treasury transaction.
        announcementUrl:
          type: string
          description: Announcement link for treasury transaction.

    TxDetail:
      type: object
      description: Parsed tx info
      properties:
        txDetail:
          $ref: "#/components/schemas/BlockTx"
        inputs:
          type: array
          items:
            $ref: "#/components/schemas/TxInput"
        outputs:
          type: array
          items:
            $ref: "#/components/schemas/TxOutput"
    TxInput:
      type: object
      description: Parsed inputs from raw tx. Use output api to get value and spent info.
      properties:
        index:
          type: integer
          description: Input index of the tx.
        utxoTxid:
          type: string
          description: The outpoint utxo txid that this input spent
        utxoIndex:
          type: integer
          description: The outpoint utxo index that this input spent
        address:
          type: string
          description: Parsed address from pubkey(P2PKH input only).
        value:
          type: integer
          format: int64
          description: satoshi value of this input.
        unlockScript:
          type: string
          description: The hex of the input script.
    TxOutput:
      type: object
      description: Parsed outputs from raw tx.
      properties:
        index:
          description: Output index of the tx.
          type: integer
        value:
          description: Bitcoin Value in this output.
          type: integer
          format: int64
        address:
          description: Parsed address from output
          type: string
        lockScript:
          description: Hex formatted lockScript
          type: string
    TxRaw:
      type: object
      description: Raw hex formatted Tx returned.
      properties:
        hex:
          description: hex formatted raw tx.
          type: string

    BroadcastResult:
      type: object
      description: Broadcast result
      properties:
        txid:
          description: return txid if broadcast success
          type: string
        message:
          description: return messages if broadcast failed
          type: string
    BatchBroadcastResult:
      type: object
      description: Batch broadcast result
      properties:
        known:
          description: Already known transactions detected during processing (if there are any)
          type: array
          items:
            type: string
        evicted:
          description: Transactions accepted by the mempool and then evicted due to insufficient fee (if there are any)
          type: array
          items:
            type: string
        invalid:
          description: Transactions that failed to be accepted by the mempool (if there are any)
          type: array
          items:
            $ref: "#/components/schemas/InvalidBroadCast"
    InvalidBroadCast:
      type: object
      description: Invalid transactions detected during validation (if there are any)
      properties:
        txid:
          description: return txid if broadcast success
          type: string
        reject_code:
          description: return messages if broadcast failed
          type: integer
        reject_reason:
          description: return messages if broadcast failed
          type: string
        collideWith:
          description: return messages if broadcast failed
          type: array
          items:
            $ref: "#/components/schemas/InvalidBroadcastCollide"

    InvalidBroadcastCollide:
      type: object
      description: This field is only present in case of double spent transaction and contains transactions we collided with
      properties:
        txid:
          description: The transaction id
          type: string
        size:
          description: Transaction size in bytes
          type: integer
        hex:
          description: Whole transaction in hex
          type: string

    AsyncBroadcastResult:
      type: object
      description: Broadcast result
      properties:
        txid:
          description: the txid of this tx
          type: string
        state:
          description: the state of this tx, possible values PENDING, BROADCASTED, INVALID, UNKNOWN
          type: string
        message:
          description: return messages if broadcast failed
          type: string

    AddressBalance:
      type: object
      description: The current balance for a particular address
      properties:
        address:
          description: current address
          type: string
        confirmed:
          description: confirmed balance
          type: integer
          format: int64
        unconfirmed:
          description: unconfirmed balance
          type: integer
          format: int64

    AddressUtxo:
      type: object
      description: Utxos by address(or addresses) order by height asc.
      properties:
        flag:
          type: string
          description: paging flag
        address:
          type: string
          description: Address of the utxo
        txid:
          type: string
          description: txid of the utxo
        outIndex:
          type: integer
          description: output index in the tx
        value:
          type: integer
          format: int64
          description: Value of the utxo
        height:
          type: integer
          format: int64
          description: Height of the utxo, -1 if not confirmed

    AddressTx:
      type: object
      description: Transaction history of the address.
      properties:
        flag:
          type: string
          description: Paging flag
        address:
          type: string
          description: The address of the record
        time:
          type: integer
          format: int64
          description: timestamp of the tx
        height:
          type: integer
          format: int64
          description: Block Height of the tx, -1 if not confirmed
        income:
          type: integer
          format: int64
          description: total income of the address from this tx
        outcome:
          type: integer
          format: int64
          description: total outcome of the address from this tx
        txid:
          type: string
          description: txid of this record

    OutputInfo:
      description: spent status and value info of the output.
      type: object
      properties:
        txid:
          description: txid that this output is in.
          type: string
        index:
          description: index of this output in the tx.
          type: integer
        address:
          description: parsed address of this output, empty for non standard.
          type: string
        value:
          description: value of this output
          type: integer
          format: int64
        spent:
          description: this output is spent or not, true if spent
          type: boolean
        spentTxid:
          description: txid that spent this output
          type: string
        spentIndex:
          description: vin index of the spent tx
          type: integer
        spentHeight:
          description: height of the spent tx(-1 if unconfirmed, 0 if unspent)
          type: integer
          format: int64

    OutputInfoDetail:
      description: spent status and value info of the output with detailed output script.
      type: object
      properties:
        txid:
          description: txid that this output is in.
          type: string
        index:
          description: index of this output in the tx.
          type: integer
        script:
          description: output scrypt in hex format
          type: string
        address:
          description: parsed address of this output, empty for non standard.
          type: string
        value:
          description: value of this output
          type: integer
          format: int64
        spent:
          description: this output is spent or not, true if spent
          type: boolean
        spentTxid:
          description: txid that spent this output
          type: string
        spentIndex:
          description: vin index of the spent tx
          type: integer
        spentHeight:
          description: height of the spent tx(-1 if unconfirmed, 0 if unspent)
          type: integer
          format: int64

    UtxoPickRequest:
      description: Request object to batch pick utxo
      type: object
      properties:
        addresses:
          type: array
          description: The address list to pick utxo from
          items:
            type: string
        amount:
          type: integer
          format: int64
          description: The total amount you want to pick

    XpubRequest:
      description: Request object to register(or delete) a new xpub
      type: object
      properties:
        xpub:
          type: string
          description: The xpub to register.
        skipHeight:
          type: integer
          format: int64
          description: Skip transactions before this height. Default is 0. Ignore this while deleting xpub.
        initReceiveIndex:
          type: integer
          description: Set the init maxReceiveIndex to {initReceiveIndex}(less than 5000) before the initial crawl , default is 200. This could increase cost.
        initChangeIndex:
          type: integer
          description: Set the init maxChangeIndex(less than 5000) before the initial crawl , default is 200. This could increase cost.

    XpubResult:
      type: object
      description: XpubRegister result
      properties:
        xpub:
          description: return xpub if broadcast success
          type: string
        message:
          description: return messages if broadcast failed
          type: string

    XpubDetail:
      description: Registered Xpub detail
      type: object
      properties:
        xpub:
          description: String encoded extended pubkey (xpub)
          type: string
        receiveIndex:
          description: Next unused receive index, path /0/index
          type: integer
        maxReceiveIndex:
          description: Max lookahead receive index.
          type: integer
        changeIndex:
          description: Next unused change index, path /1/index
          type: integer
        maxChangeIndex:
          description: Max lookahead change index.
          type: integer
        mode:
          description: Current xpub process mode, 0 means preparing(not ready), 1 means synchronizing(ready)
          type: integer
        skipHeight:
          description: Skip blocks before skipHeight while searching transactions. This will speed up sync time.
          type: integer
          format: int64
        processHeight:
          description: Xpub current processed height.
          type: integer
          format: int64

    XpubBalance:
      description: Registered Xpub balance including confirmed and unconfirmed
      type: object
      properties:
        confirmed:
          description: confirmed balance
          type: integer
          format: int64
        unconfirmed:
          description: unconfirmed balance
          type: integer
          format: int64

    XpubLiteBalance:
      description: Balance for xpub lite wallet
      type: object
      properties:
        balance:
          description: confirmed balance plus unconfirmed balance
          type: integer
          format: int64

    XpubUtxo:
      description: Utxo belongs to the specified xpub
      type: object
      properties:
        xpub:
          description: xpub of the utxo
          type: string
        address:
          description: Address string of this utxo
          type: string
        addressType:
          description: Address type, 0 for receive address, 1 for change address. path is {{addressType}}/{{addressIndex}}
          type: integer
        addressIndex:
          description: Address index. Address path in the xpub is {{addressType}}/{{addressIndex}}
          type: integer
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        value:
          description: Satoshi value of the utxo.
          type: integer
          format: int64
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        flag:
          description: The paging flag of utxo
          type: integer
          format: int64

    XpubAddress:
      description: Address detail in the wallet
      type: object
      properties:
        xpub:
          description: xpub in the query
          type: string
        address:
          description: Address in the query
          type: string
        addressType:
          description: Address type, 0 for receive address, 1 for change address. path is {{addressType}}/{{addressIndex}}
          type: integer
        addressIndex:
          description: Address index. Address path in the xpub is {{addressType}}/{{addressIndex}}
          type: integer

    XPubTransaction:
      description: Xpub transaction history
      type: object
      properties:
        xpub:
          description: query xpub
          type: string
        txid:
          description: Txid for this transaction.
          type: string
        maxReceiveIndex:
          description: Max lookahead receive index when processing this transaction.
          type: integer
        maxChangeIndex:
          description: Max lookahead change index when processing this transaction.
          type: integer
        income:
          description: Total received satoshis(Including all address)
          type: integer
          format: int64
        outcome:
          description: Total spent satoshis(Including all address)
          type: integer
          format: int64
        height:
          description: Height for this transaction. -1 for unconfirmed
          type: integer
          format: int64
        blockIndex:
          description: Block index for this transaction, -1 for unconfirmed
          type: integer
        blockTime:
          description: Block timestamp for this transaction, if unconfirmed, the time is first seen time.
          type: integer
          format: int64
        flag:
          description: Paging flag, format blockTimestamp_blockIndex
          type: string

    ClientPubkeyRequest:
      description: Request object to register(or delete) a new client public key.
      type: object
      properties:
        pubkey:
          type: string
          description: The hex format public key to register. (i.e. 02fd17dd0c52e54e5eed4ebe1e75df5e48df422f81c26520d44380bef1691fdd98)

    ClientPubkeyResult:
      type: object
      description: Client public key result
      properties:
        pubkey:
          description: return pubkey if created successfully
          type: string
        message:
          description: return messages if broadcast failed
          type: string

    ContractUniqueUtxo:
      description: Contract unique Utxo indexed by codeHash and genesis.
      type: object
      properties:
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        codeHash:
          description: Codehash of this utxo.
          type: string
        genesis:
          description: Genesis of this utxo.
          type: string
        sensibleId:
          description: SensibleId of the token
          type: string
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        customData:
          description: The hex encoded customData
          type: string
        satoshi:
          description: Mvc value of the utxo(Irrelavant to token value)
          type: integer
          format: int64
        satoshiString:
          description: Mvc value of the utxo(In string format)
          type: string

    ContractFtUtxo:
      description: Contract fungible token Utxo belongs to the specified address
      type: object
      properties:
        address:
          description: Address string of this utxo
          type: string
        codeHash:
          description: Codehash of this utxo.
          type: string
        genesis:
          description: Genesis of this utxo.
          type: string
        name:
          description: Name of the token.
          type: string
        symbol:
          description: Symbol of the token.
          type: string
        sensibleId:
          description: SensibleId of the token
          type: string
        decimal:
          description: The decimal position.
          type: integer
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        value:
          description: Token value of the utxo(Irrelavant to satoshi value).
          type: integer
          format: int64
        valueString:
          description: Token value of the utxo(In string format)
          type: string
        satoshi:
          description: Mvc value of the utxo(Irrelavant to token value)
          type: integer
          format: int64
        satoshiString:
          description: Mvc value of the utxo(In string format)
          type: string
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        flag:
          description: Flag used for paging
          type: string

    ContractFtBalance:
      description: Contract fungible token balance
      type: object
      properties:
        codeHash:
          description: Codehash of the token.
          type: string
        genesis:
          description: Genesis of the token.
          type: string
        name:
          description: Name of the token.
          type: string
        symbol:
          description: Symbol of the token.
          type: string
        decimal:
          description: The decimal position.
          type: integer
        sensibleId:
          description: SensibleId of the token
          type: string
        utxoCount:
          description: Number of utxos for this token.
          type: integer
        confirmed:
          description: Confirmed balance of the token.
          type: integer
          format: int64
        confirmedString:
          description: Confirmed balance of the token(In string format).
          type: string
        unconfirmed:
          description: Unconfirmed balance of the token.
          type: integer
          format: int64
        unconfirmedString:
          description: Unconfirmed balance of the token(In string format).
          type: string

    ContractFtAddressTx:
      type: object
      description: Transaction history of the address for specific ft.
      properties:
        flag:
          type: string
          description: Paging flag
        address:
          type: string
          description: The address of the record
        codeHash:
          type: string
          description: Specific codeHash
        genesis:
          type: string
          description: specific genesis
        time:
          type: integer
          format: int64
          description: timestamp of the tx
        height:
          type: integer
          format: int64
          description: Block Height of the tx, -1 if not confirmed
        income:
          type: integer
          format: int64
          description: total income of the address from this tx
        outcome:
          type: integer
          format: int64
          description: total outcome of the address from this tx
        txid:
          type: string
          description: txid of this record
    ContractFtGenesisCirculation:
      description: Get total circulation for specific genesis of ft token.
      type: object
      properties:
        confirmed:
          description: Confirmed circulation of the token(Sum of confirmed amount).
          type: integer
          format: int64
        unconfirmed:
          description: Unconfirmed circulation of the token(Unconfirmed new token - Unconfirmed spent).
          type: integer
          format: int64

    ContractNftUtxo:
      description: Contract non fungible token Utxo belongs to the specified address
      type: object
      properties:
        address:
          description: Address string of this utxo
          type: string
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        codeHash:
          description: Codehash of this utxo.
          type: string
        genesis:
          description: Genesis of this utxo.
          type: string
        sensibleId:
          description: SensibleId of the token
          type: string
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        metaTxid:
          description: The metanet tx describing the nft.
          type: string
        metaOutputIndex:
          description: Symbol of the token.
          type: integer
        tokenSupply:
          description: The total supply of this NFT.
          type: integer
          format: int64
        tokenIndex:
          description: The index of this NFT.
          type: integer
          format: int64
        satoshi:
          description: Mvc value of the utxo(Irrelavant to token value)
          type: integer
          format: int64
        satoshiString:
          description: Mvc value of the utxo(In string format)
          type: string
        flag:
          description: Flag used for paging
          type: string

    ContractNftAddressSummary:
      description: Get nft summary(count group by genesis) for specific address.
      type: object
      properties:
        codeHash:
          description: Codehash of this NFT series.
          type: string
        genesis:
          description: Genesis of this NFT series..
          type: string
        sensibleId:
          description: SensibleId of the token
          type: string
        metaTxid:
          description: The metanet tx describing the nft.
          type: string
        metaOutputIndex:
          description: Symbol of the token.
          type: integer
        tokenSupply:
          description: The total supply of this NFT.
          type: integer
          format: int64
        count:
          description: The count of this nft that the address owns.
          type: integer

    ContractNftGenesisSummary:
      description: Get summary(count group by address) for specific genesis.
      type: object
      properties:
        address:
          description: Owner address.
          type: string
        sensibleId:
          description: SensibleId of the token
          type: string
        metaTxid:
          description: The metanet tx describing the nft.
          type: string
        metaOutputIndex:
          description: Symbol of the token.
          type: integer
        tokenSupply:
          description: The total supply of this NFT.
          type: integer
          format: int64
        count:
          description: The count of this nft that the address owns.
          type: integer

    ContractNftSellUtxo:
      description: Contract nft sell Utxo belongs to the specified address
      type: object
      properties:
        address:
          description: Address string of this utxo
          type: string
        contractAddress:
          description: Address calculated from contract hash(p2ch).
          type: string
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        codeHash:
          description: Codehash of this utxo.
          type: string
        genesis:
          description: Genesis of this utxo.
          type: string
        tokenIndex:
          description: The index of this NFT.
          type: integer
          format: int64
        price:
          description: the price of nft.
          type: integer
          format: int64
        satoshi:
          description: Mvc value of the utxo(Irrelavant to token value)
          type: integer
          format: int64
        satoshiString:
          description: Mvc value of the utxo(In string format)
          type: string
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        isReady:
          description: Is current nft transfered into sell contract, If not ready, the following fields will be null
          type: boolean
        sensibleId:
          description: SensibleId of the token
          type: string
        metaTxid:
          description: The metanet tx describing the nft.
          type: string
        metaOutputIndex:
          description: Symbol of the token.
          type: integer
        tokenSupply:
          description: The total supply of this NFT.
          type: integer
          format: int64
        flag:
          description: Flag used for paging
          type: string

    ContractNftSellV2Utxo:
      description: Contract nft sell v2 Utxo belongs to the specified address
      type: object
      properties:
        address:
          description: Address string of this utxo
          type: string
        contractAddress:
          description: Address calculated from contract hash(p2ch).
          type: string
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        codeHash:
          description: Codehash of this utxo.
          type: string
        genesis:
          description: Genesis of this utxo.
          type: string
        tokenIndex:
          description: The index of this NFT.
          type: integer
          format: int64
        price:
          description: the price of nft.
          type: integer
          format: int64
        feeAddressPkh:
          description: The address to receive fees.
          type: string
        feeRate:
          description: feeRate
          type: integer
        nftId:
          description: nftId
          type: string
        sellerAddressPkh:
          description: The address pkh of seller
          type: string
        satoshi:
          description: Mvc value of the utxo(Irrelavant to token value)
          type: integer
          format: int64
        satoshiString:
          description: Mvc value of the utxo(In string format)
          type: string
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        isReady:
          description: Is current nft transfered into sell contract, If not ready, the following fields will be null
          type: boolean
        sensibleId:
          description: SensibleId of the token
          type: string
        metaTxid:
          description: The metanet tx describing the nft.
          type: string
        metaOutputIndex:
          description: Symbol of the token.
          type: integer
        tokenSupply:
          description: The total supply of this NFT.
          type: integer
          format: int64
        flag:
          description: Flag used for paging
          type: string

    ContractNftAuctionUtxo:
      description: Contract nft auction Utxo belongs to the specified address
      type: object
      properties:
        address:
          description: Address string of this utxo
          type: string
        txid:
          description: Txid for this utxo.
          type: string
        txIndex:
          description: Output index for the Utxo.
          type: integer
        bidMvcPrice:
          description: bidMvcPrice
          type: integer
          format: int64
        bidTimestamp:
          description: bidTimestamp
          type: integer
          format: int64
        bidderAddressPkh:
          description: bidderAddressPkh
          type: string
        codeHash:
          description: Codehash of this utxo.
          type: string
        genesis:
          description: Genesis of this utxo.
          type: string
        endTimestamp:
          description: endTimestamp
          type: integer
          format: int64
        feeAddressPkh:
          description: feeAddressPkh
          type: string
        feeAmount:
          description: feeAmount
          type: integer
          format: int64
        feeRate:
          description: feeRate
          type: integer
        height:
          description: The height of this utxo, -1 for unconfirmed utxo.
          type: integer
          format: int64
        nftCodeHash:
          description: nftCodeHash
          type: string
        nftId:
          description: nftId of the auctioning fnt
          type: string
        senderAddressPkh:
          description: senderAddressPkh
          type: string
        sensibleId:
          description: SensibleId of the utxo
          type: string
        startMvcPrice:
          description: startMvcPrice
          type: integer
          format: int64
        satoshi:
          description: Mvc value of the utxo(Irrelavant to token value)
          type: integer
          format: int64
        satoshiString:
          description: Mvc value of the utxo(In string format)
          type: string
        contractAddress:
          description: The hash160 of the script(p2ch address)
          type: string
        isReady:
          description: this the nft send to this contract address
          type: boolean
        flag:
          description: Flag used for paging
          type: string

