Flow Blockchain API

‍Flow is a fast, decentralized, and developer-friendly blockchain, designed as the foundation for a new generation of games, apps, and the digital assets that power them. It is based on a unique, multi-role architecture, and designed to scale without sharding, allowing for massive improvements in speed and throughput while preserving a developer-friendly, ACID-compliant environment.

Bitquery recently integrated the Flow environment in all it’s products. Using our GraphQL APIs you may now query across the Flow blockchain.

Balance of a Flow Token Address

Balance of a Flow Token can be found out by subtracting the “inputs” value from the “outputs” for a particular token/wallet address. The following GraphQL query does the work.

As of 21 May, 2022 13:44 IST the balance of 0x1e3c78c6d580273b token is 97.47810000 according to https://flowscan.org/account/0x1e3c78c6d580273b. According to the result returned from GraphQL query we get to see this result

{
  "flow": {
    "inputs": [
      {
        "amount": 32.53062,
        "currency": {
          "address": "A.1654653399040a61.FlowToken",
          "symbol": "FlowToken"
        }
      },
      {
        "amount": 1129013,
        "currency": {
          "address": "A.1e3c78c6d580273b.LNVCT",
          "symbol": "LNVCT"
        }
      }
    ],
    "outputs": [
      {
        "amount": 130.0111,
        "currency": {
          "address": "A.1654653399040a61.FlowToken",
          "symbol": "FlowToken"
        }
      },
      {
        "amount": 1295427,
        "currency": {
          "address": "A.1e3c78c6d580273b.LNVCT",
          "symbol": "LNVCT"
        }
      }
    ]
  }
}

where the value of the outputs is 130.0111 FLOW and the value of inputs is 32.53062 FLOW as returned by Bitquery. Hence, subtracting the two, we obtain the value of the balance as 97.48048 FLOW.

You can even get the value of the balance is a currency other than FLOW. In the above query, we also get the value of inputs and outputs in LNVCT where the value of balance turns out to be 166414 LNVCT.

Anatomy of a Flow Transaction

Due to the existence of weighted keys and split signing roles, Flow transactions sometimes need to be signed multiple times by one or more parties. That is, multiple unique signatures may be needed to authorize a single transaction.

A transaction can contain two types of signatures: payload signatures and envelope signatures. Signing a transaction for Flow is a multi-step process that can involve one or more accounts, each of which signs for a different purpose.

  • Proposer: the account that specifies a proposal key.
  • Payer: the account paying for the transaction fees.
  • Authorizers: zero or more accounts authorizing the transaction to mutate their state.


image source: Accounts | Flow Developer Portal

You can get the Script, Reference ID, Gas Limit, Proposal Key, Payer address through the following GraphQL query

The transaction payload is the innermost portion of a transaction and contains the data that uniquely identifies the operations applied by the transaction. In Flow, two transactions with the same payload will never be executed more than once.

The transaction proposer and authorizer are only required to sign the transaction payload. These signatures are the payload signatures .

You can get the Payload details through our transactionPayloadSignatures API

The transaction payer is required to sign the authorization envelope. These signatures are the envelope signatures . Get those details using the query below.

The above GraphQL query returns the Envelope signature along with the Key ID and address. The address and key ID fields declare the account key that generated the signature, which is required in order to verify the signature against the correct public key.

{
  "flow": {
    "transactionEnvelopeSignatures": [
      {
        "signature": "00000dc400e031545252e47ed48eee647fe699dad3a05374950efdb8ecec96210d4d84be73ac20a8a594334a83248e00157d766321b9d1d6fc44ba7c081c7804",
        "block": {
          "height": "29400864",
          "id": "dca19aa5afb54b924f0aa8e213e1b028ae4b122eb46e306c9a34f480d5eda3c3"
        },
        "keyId": 0,
        "address": {
          "address": "0x18eb4ee6b3c026d2"
        }
      },
      ....
      ....

Payer Details

For payer details, we have obtained the transaction where a particular payer token address has been used and queried for the proposer count, proposer address, proposer key id, proposer key sequence number along with the collection id to which the payer belonged as well as the transaction id. The GraphQL query for the same is as follows:

Authorizer Details

Get the Authorizer details from this GraphQL query

Flow Blocks and Collections with Bitquery

Blocks

The following are the attributes of a Flow block

FIELD DESCRIPTION
id SHA3-256 hash of the entire block payload
height Height of the block in the chain
parent_id ID of the previous block in the chain
timestamp Timestamp of when the proposer claims it constructed the block.
collection_guarantees List of collection guarantees
block_seals List of block seals
signatures BLS signatures of consensus nodes

Get the above data from our APIs using the below GraphQL query

Collection

A collection is a batch of transactions that have been included in a block. Collections are used to improve consensus throughput by increasing the number of transactions per block.

FIELD DESCRIPTION
id SHA3-256 hash of the collection contents
transaction_ids Ordered list of transaction IDs in the collection

Flow Events

Flow relies on a set of core contracts that define key portions of the Flow protocol. Those contracts are core contracts and are made to emit the events documented below.

  • Tokens Initialized : Event that is emitted when the contract gets created.
  • Tokens Minted: Event that is emitted when new tokens gets minted.
  • Tokens Burned: Event that is emitted when tokens get destroyed.

Get the above data from this GraphQL query

Comparison of Flow transactions over the years

Flow Transactions over the year of 2021

Flow Transactions over the year of 2022

As you can clearly notice that the transactions in Flow has drastically increased from 7M in the month of december 2021 to 11.7M in the month of february 2022.

Conclusion

Flow blockchain network has been tailored to address the congestion problem of existing blockchain networks. The features of blockchain are unique and play distinct roles in its functioning, thereby ensuring prolific value benefits

The flow network is also in the works of creating its own metaverse. All of this sounds amazing, and with that, the flow network has massive plans ahead of itself to provide gaming experiences beyond NFTs.

Also Read

About Bitquery

Bitquery is a set of software tools that parse, index, access, search, and use information across blockchain networks in a unified way. We are crossing the ‘chain-chasm’ by delivering set of products that can work across blockchains. Our products include:

Coinpath APIs provide blockchain money flow analysis for more than 24 blockchains. With Coinpath’s APIs, you can monitor blockchain transactions, investigate crypto crimes such as bitcoin money laundering, and create crypto forensics tools. You can refer to this article to get started with Coinpath

Digital Assets API provides index information related to all major cryptocurrencies, coins, and tokens.

DEX API provides real-time deposits and transactions, trades, and other related data on different DEX protocols like Uniswap, SushiSawap, Kyber Network, Airswap, Matching Network, etc.

If you have any questions about our products, ask them on our Telegram channel or email us at hello@bitquery.io . Also, subscribe to our newsletter and stay updated about the latest in the cryptocurrency world.

1 Like