Skip to content

Latest commit

 

History

History
1626 lines (1517 loc) · 24.8 KB

File metadata and controls

1626 lines (1517 loc) · 24.8 KB

BTC API List

中文版文档请猛击 btc.cn.md

Raw Query also tells us the shape of the response

Table of Contents

Queries

accountByAddress

Arguments

  • address, required, The address generated based on the public key of the account.

Raw Query

{
  accountByAddress(address: "abc") {
    address
    balance
    numberTxsReceived
    numberTxsSent
    priceInUsd
    pubKey
    scriptType
    subKeys
    totalAmountReceived
    totalAmountSent
    transactions {
      data {
        blockHash
        blockHeight
        fees
        feesOverWeight
        hash
        historyPrice
        index
        lockTime
        numberInputs
        numberOutputs
        priceInUsd
        size
        strippedSize
        time
        total
        version
        virtualSize
        weight
        witnessHash
        inputs {
          data {
            account
            blockHash
            blockHeight
            index
            preOutput
            preTx
            script
            scriptType
            sequence
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
        outputs {
          data {
            account
            blockHash
            blockHeight
            index
            script
            scriptType
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

blockByHash

Arguments

  • hash, required, The hash of the block.

Raw Query

{
  blockByHash(hash: "abc") {
    bits
    fees
    hash
    height
    historyPrice
    medianTime
    merkleRoot
    nonce
    numberTxs
    preHash
    priceInUsd
    reward
    size
    strippedSize
    time
    total
    version
    weight
    miner {
      address
      balance
      numberTxsReceived
      numberTxsSent
      priceInUsd
      pubKey
      scriptType
      subKeys
      totalAmountReceived
      totalAmountSent
    }
    transactions {
      data {
        blockHash
        blockHeight
        fees
        feesOverWeight
        hash
        historyPrice
        index
        lockTime
        numberInputs
        numberOutputs
        priceInUsd
        size
        strippedSize
        time
        total
        version
        virtualSize
        weight
        witnessHash
        inputs {
          data {
            account
            blockHash
            blockHeight
            index
            preOutput
            preTx
            script
            scriptType
            sequence
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
        outputs {
          data {
            account
            blockHash
            blockHeight
            index
            script
            scriptType
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

blockByHeight

Arguments

  • height, required, The number of blocks ahead of this block.

Raw Query

{
  blockByHeight(height: 123) {
    bits
    fees
    hash
    height
    historyPrice
    medianTime
    merkleRoot
    nonce
    numberTxs
    preHash
    priceInUsd
    reward
    size
    strippedSize
    time
    total
    version
    weight
    miner {
      address
      balance
      numberTxsReceived
      numberTxsSent
      priceInUsd
      pubKey
      scriptType
      subKeys
      totalAmountReceived
      totalAmountSent
    }
    transactions {
      data {
        blockHash
        blockHeight
        fees
        feesOverWeight
        hash
        historyPrice
        index
        lockTime
        numberInputs
        numberOutputs
        priceInUsd
        size
        strippedSize
        time
        total
        version
        virtualSize
        weight
        witnessHash
        inputs {
          data {
            account
            blockHash
            blockHeight
            index
            preOutput
            preTx
            script
            scriptType
            sequence
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
        outputs {
          data {
            account
            blockHash
            blockHeight
            index
            script
            scriptType
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

blockchainInfo

Arguments

  • instance, required, The name of the blockchain instance.

Raw Query

{
  blockchainInfo(instance: "abc") {
    avgBlockGap
    avgFees
    avgFeesOverWeight
    avgTotal
    consensus
    instance
    latestHash
    latestHeight
    latestUpdateTime
    name
    blocks {
      data {
        bits
        fees
        hash
        height
        historyPrice
        medianTime
        merkleRoot
        nonce
        numberTxs
        preHash
        priceInUsd
        reward
        size
        strippedSize
        time
        total
        version
        weight
        miner {
          address
          balance
          numberTxsReceived
          numberTxsSent
          priceInUsd
          pubKey
          scriptType
          subKeys
          totalAmountReceived
          totalAmountSent
        }
        transactions {
          data {
            blockHash
            blockHeight
            fees
            feesOverWeight
            hash
            historyPrice
            index
            lockTime
            numberInputs
            numberOutputs
            priceInUsd
            size
            strippedSize
            time
            total
            version
            virtualSize
            weight
            witnessHash
          }
          page {
            cursor
            next
            total
          }
        }
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

cryptoHistoryPrice

Arguments

  • endDate, required, the end_date of the interval
  • paging, optional, Describes which page of data to return.
  • startDate, required, the start_date of the interval
  • token, required, the name of the token

Raw Query

{
  cryptoHistoryPrice(endDate: "2019-02-15T06:47:33.250Z", startDate: "2019-02-15T06:47:33.250Z", token: "abc") {
    data {
      date
      price
    }
    page {
      cursor
      next
      total
    }
  }
}

emptyBlocks

Arguments

  • paging, optional, Describes which page of data to return.
  • timeFilter, optional, Filters the records by block height or time.

Raw Query

{
  emptyBlocks {
    data {
      bits
      fees
      hash
      height
      historyPrice
      medianTime
      merkleRoot
      nonce
      numberTxs
      preHash
      priceInUsd
      reward
      size
      strippedSize
      time
      total
      version
      weight
      miner {
        address
        balance
        numberTxsReceived
        numberTxsSent
        priceInUsd
        pubKey
        scriptType
        subKeys
        totalAmountReceived
        totalAmountSent
      }
      transactions {
        data {
          blockHash
          blockHeight
          fees
          feesOverWeight
          hash
          historyPrice
          index
          lockTime
          numberInputs
          numberOutputs
          priceInUsd
          size
          strippedSize
          time
          total
          version
          virtualSize
          weight
          witnessHash
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

genesisBlock

Arguments

No arguments

Raw Query

{
  genesisBlock {
    bits
    fees
    hash
    height
    historyPrice
    medianTime
    merkleRoot
    nonce
    numberTxs
    preHash
    priceInUsd
    reward
    size
    strippedSize
    time
    total
    version
    weight
    miner {
      address
      balance
      numberTxsReceived
      numberTxsSent
      priceInUsd
      pubKey
      scriptType
      subKeys
      totalAmountReceived
      totalAmountSent
    }
    transactions {
      data {
        blockHash
        blockHeight
        fees
        feesOverWeight
        hash
        historyPrice
        index
        lockTime
        numberInputs
        numberOutputs
        priceInUsd
        size
        strippedSize
        time
        total
        version
        virtualSize
        weight
        witnessHash
        inputs {
          data {
            account
            blockHash
            blockHeight
            index
            preOutput
            preTx
            script
            scriptType
            sequence
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
        outputs {
          data {
            account
            blockHash
            blockHeight
            index
            script
            scriptType
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

listBlocks

Arguments

  • paging, optional, Describes which page of data to return.
  • timeFilter, optional, Filters the records by block height or time.

Raw Query

{
  listBlocks {
    data {
      bits
      fees
      hash
      height
      historyPrice
      medianTime
      merkleRoot
      nonce
      numberTxs
      preHash
      priceInUsd
      reward
      size
      strippedSize
      time
      total
      version
      weight
      miner {
        address
        balance
        numberTxsReceived
        numberTxsSent
        priceInUsd
        pubKey
        scriptType
        subKeys
        totalAmountReceived
        totalAmountSent
      }
      transactions {
        data {
          blockHash
          blockHeight
          fees
          feesOverWeight
          hash
          historyPrice
          index
          lockTime
          numberInputs
          numberOutputs
          priceInUsd
          size
          strippedSize
          time
          total
          version
          virtualSize
          weight
          witnessHash
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

listTransactions

Arguments

  • addressFilter, optional, Filter the records by addresses.
  • paging, optional, Describes which page of data to return.
  • timeFilter, optional, Filters the records by block height or time.

Raw Query

{
  listTransactions {
    data {
      blockHash
      blockHeight
      fees
      feesOverWeight
      hash
      historyPrice
      index
      lockTime
      numberInputs
      numberOutputs
      priceInUsd
      size
      strippedSize
      time
      total
      version
      virtualSize
      weight
      witnessHash
      inputs {
        data {
          account
          blockHash
          blockHeight
          index
          preOutput
          preTx
          script
          scriptType
          sequence
          txHash
          txIndex
          value
        }
        page {
          cursor
          next
          total
        }
      }
      outputs {
        data {
          account
          blockHash
          blockHeight
          index
          script
          scriptType
          txHash
          txIndex
          value
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

richestAccounts

Arguments

  • paging, optional, Describes which page of data to return.

Raw Query

{
  richestAccounts {
    data {
      address
      balance
      numberTxsReceived
      numberTxsSent
      priceInUsd
      pubKey
      scriptType
      subKeys
      totalAmountReceived
      totalAmountSent
      transactions {
        data {
          blockHash
          blockHeight
          fees
          feesOverWeight
          hash
          historyPrice
          index
          lockTime
          numberInputs
          numberOutputs
          priceInUsd
          size
          strippedSize
          time
          total
          version
          virtualSize
          weight
          witnessHash
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

transactionByHash

Arguments

  • hash, required, The hash of the transaction to return.

Raw Query

{
  transactionByHash(hash: "abc") {
    blockHash
    blockHeight
    fees
    feesOverWeight
    hash
    historyPrice
    index
    lockTime
    numberInputs
    numberOutputs
    priceInUsd
    size
    strippedSize
    time
    total
    version
    virtualSize
    weight
    witnessHash
    inputs {
      data {
        account
        blockHash
        blockHeight
        index
        preOutput
        preTx
        script
        scriptType
        sequence
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
    outputs {
      data {
        account
        blockHash
        blockHeight
        index
        script
        scriptType
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

transactionByIndex

Arguments

  • blockHash, optional, The hash of the block containing the target transaction.
  • blockHeight, optional, The height of the block containing the target transaction.
  • index, required, The index of the transaction insdie the block.

Raw Query

{
  transactionByIndex(index: 123) {
    blockHash
    blockHeight
    fees
    feesOverWeight
    hash
    historyPrice
    index
    lockTime
    numberInputs
    numberOutputs
    priceInUsd
    size
    strippedSize
    time
    total
    version
    virtualSize
    weight
    witnessHash
    inputs {
      data {
        account
        blockHash
        blockHeight
        index
        preOutput
        preTx
        script
        scriptType
        sequence
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
    outputs {
      data {
        account
        blockHash
        blockHeight
        index
        script
        scriptType
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

transactionsByAddress

Arguments

  • paging, optional, Describes which page of data to return.
  • receiver, optional, Specifies the receiver's address.
  • sender, optional, Specifies the sender's address.

Raw Query

{
  transactionsByAddress {
    data {
      blockHash
      blockHeight
      fees
      feesOverWeight
      hash
      historyPrice
      index
      lockTime
      numberInputs
      numberOutputs
      priceInUsd
      size
      strippedSize
      time
      total
      version
      virtualSize
      weight
      witnessHash
      inputs {
        data {
          account
          blockHash
          blockHeight
          index
          preOutput
          preTx
          script
          scriptType
          sequence
          txHash
          txIndex
          value
        }
        page {
          cursor
          next
          total
        }
      }
      outputs {
        data {
          account
          blockHash
          blockHeight
          index
          script
          scriptType
          txHash
          txIndex
          value
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

transactionsByIndex

Arguments

  • blockHash, optional, The hash of the block containing the target transactions.
  • blockHeight, optional, The height of the block containing the target transactions.
  • fromIndex, optional, The index of the transaction from which to return.
  • paging, optional, Describes which page of data to return.
  • toIndex, optional, The index of the transaction to which to return.

Raw Query

{
  transactionsByIndex {
    data {
      blockHash
      blockHeight
      fees
      feesOverWeight
      hash
      historyPrice
      index
      lockTime
      numberInputs
      numberOutputs
      priceInUsd
      size
      strippedSize
      time
      total
      version
      virtualSize
      weight
      witnessHash
      inputs {
        data {
          account
          blockHash
          blockHeight
          index
          preOutput
          preTx
          script
          scriptType
          sequence
          txHash
          txIndex
          value
        }
        page {
          cursor
          next
          total
        }
      }
      outputs {
        data {
          account
          blockHash
          blockHeight
          index
          script
          scriptType
          txHash
          txIndex
          value
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

zeroFeesBlocks

Arguments

  • paging, optional, Describes which page of data to return.
  • timeFilter, optional, Filters the records by block height or time.

Raw Query

{
  zeroFeesBlocks {
    data {
      bits
      fees
      hash
      height
      historyPrice
      medianTime
      merkleRoot
      nonce
      numberTxs
      preHash
      priceInUsd
      reward
      size
      strippedSize
      time
      total
      version
      weight
      miner {
        address
        balance
        numberTxsReceived
        numberTxsSent
        priceInUsd
        pubKey
        scriptType
        subKeys
        totalAmountReceived
        totalAmountSent
      }
      transactions {
        data {
          blockHash
          blockHeight
          fees
          feesOverWeight
          hash
          historyPrice
          index
          lockTime
          numberInputs
          numberOutputs
          priceInUsd
          size
          strippedSize
          time
          total
          version
          virtualSize
          weight
          witnessHash
        }
        page {
          cursor
          next
          total
        }
      }
    }
    page {
      cursor
      next
      total
    }
  }
}

Subscriptions

bigTransactionExecuted

Arguments

No arguments

Raw Query

subscription {
  bigTransactionExecuted {
    blockHash
    blockHeight
    fees
    feesOverWeight
    hash
    historyPrice
    index
    lockTime
    numberInputs
    numberOutputs
    priceInUsd
    size
    strippedSize
    time
    total
    version
    virtualSize
    weight
    witnessHash
    inputs {
      data {
        account
        blockHash
        blockHeight
        index
        preOutput
        preTx
        script
        scriptType
        sequence
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
    outputs {
      data {
        account
        blockHash
        blockHeight
        index
        script
        scriptType
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

coinReceived

Arguments

  • address, required,

Raw Query

subscription {
  coinReceived(address: "abc") {
    blockHash
    blockHeight
    fees
    feesOverWeight
    hash
    historyPrice
    index
    lockTime
    numberInputs
    numberOutputs
    priceInUsd
    size
    strippedSize
    time
    total
    version
    virtualSize
    weight
    witnessHash
    inputs {
      data {
        account
        blockHash
        blockHeight
        index
        preOutput
        preTx
        script
        scriptType
        sequence
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
    outputs {
      data {
        account
        blockHash
        blockHeight
        index
        script
        scriptType
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

coinSent

Arguments

  • address, required,

Raw Query

subscription {
  coinSent(address: "abc") {
    blockHash
    blockHeight
    fees
    feesOverWeight
    hash
    historyPrice
    index
    lockTime
    numberInputs
    numberOutputs
    priceInUsd
    size
    strippedSize
    time
    total
    version
    virtualSize
    weight
    witnessHash
    inputs {
      data {
        account
        blockHash
        blockHeight
        index
        preOutput
        preTx
        script
        scriptType
        sequence
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
    outputs {
      data {
        account
        blockHash
        blockHeight
        index
        script
        scriptType
        txHash
        txIndex
        value
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

newBlockMined

Arguments

No arguments

Raw Query

subscription {
  newBlockMined {
    bits
    fees
    hash
    height
    historyPrice
    medianTime
    merkleRoot
    nonce
    numberTxs
    preHash
    priceInUsd
    reward
    size
    strippedSize
    time
    total
    version
    weight
    miner {
      address
      balance
      numberTxsReceived
      numberTxsSent
      priceInUsd
      pubKey
      scriptType
      subKeys
      totalAmountReceived
      totalAmountSent
    }
    transactions {
      data {
        blockHash
        blockHeight
        fees
        feesOverWeight
        hash
        historyPrice
        index
        lockTime
        numberInputs
        numberOutputs
        priceInUsd
        size
        strippedSize
        time
        total
        version
        virtualSize
        weight
        witnessHash
        inputs {
          data {
            account
            blockHash
            blockHeight
            index
            preOutput
            preTx
            script
            scriptType
            sequence
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
        outputs {
          data {
            account
            blockHash
            blockHeight
            index
            script
            scriptType
            txHash
            txIndex
            value
          }
          page {
            cursor
            next
            total
          }
        }
      }
      page {
        cursor
        next
        total
      }
    }
  }
}

Mutations

No Mutations supported yet.

Contributors

Name Website
wangshijun https://ocap.arcblock.io