Flowee the Hub — API documentation

Service/Live Transactions

Live Transaction Service

Whereas most of the APIs are about historical (unchanging) records, this service provides several APIs for live data, data that can change as time moves on.

Transactions in Bitcoin Cash are collected in a mempool before they are mined in a block, this service allows you to fetch transactions from that pool (and recently mined blocks) and to submit new transactions you want to submit for mining.

Transactions that have been mined create outputs that hold money which can be spent by the owner of that money. This information is collected in the unspent-transaction-outputs database (in short UTXO DB). This service provides querying features for the UTXO.

This service uses service ID 2.

Messages

GetTransaction

Allow fetching a transaction from the mempool. You can fetch either on the txid, in which case a direct match is expected either in the mempool or in the most recent (last 6) blocks.

When searching on txid and nothing is found, an error message is returned via command failed message-type).

Alternatively, since Hub version 2021.02 you can pass in a BitcoinScriptHashed value as a representing a bitcoin-address, and search the mempool based on it. If nothing is found, an empty message will be returned.

To use a BitcoinScriptHashed tag which is a sha256, send as a 32-byte bytearray. matches happen not exactly on address, but on the entire output-script. The entire output script is hashed giving a nice constant size identifier we use instead of an address.

This fetches a transaction, returning an error (see hub) message if it is not found.

GetTransactionReply

When a transaction was found it is returned using this reply message. Notice that we never return more than one transaction, use SearchMempool to get more detailed results.

Since Hub version 2021.02 the blockHeight field has been added.

SendTransaction

Offer to the network this message. The node will fully validate (check if it is well formatted, fully complete and spending existing money) before it will continue to share the message with the rest of the Bitcoin Cash network.

If the transaction could not be accepted for any reason, we reply with a command failed message from the Hub service.

SendTransactionReply

To confirm sending of the transaction a reply is created with the txid (sha256 hash) that has been accepted by the peer.

IsUnspent

Since 2019.06

The UTXO database can be queried using this method.

All queries have to be done based on the spending transaction ID (a sha256) combined with the output index (base-zero). If the output has been spent (or never existed) you will get a simple ‘false’ in your reply, if the output is unspent you will receive the block-height and the offset-in-block pair which you can use to get the full transaction from the historical record using GetTransaction method from the Blockchain service.

Also notice the GetUnspentOutput request below which gives you the actual output data in one go.

In one message many requests can be stored, each separated by a Separator flag (which is a single byte).

IsUnspentReply

Since 2019.06

For each request the Unspent bool will always be returned, and the BlockHeight and Tx_OffsetInBlock will be included only when the output was found in the UTXO.

The request could have multiple lookups, each separated by a Separator. The answer will have the same number in the same order.

GetUnspentOutput

Since 2019.06

This message is identical to the one in IsUnspent, except that it will result in a reply that includes more data.

GetUnspentOutputReply

Since 2019.06

For each request the Unspent bool will always be returned, the other values will only be included when the output was found in the UTXO.

The request could have multiple lookups, each separated by a Separator. The answer will have the same number in the same order.

SearchMempool

Since 2021.01

This allows a search based on TxId or output-script-hash for mempool transactions. We include double spend proof info when available in the reply.

SearchMempoolReply

The answer includes all results, delimited by a Separator item.

GetMempoolInfo

Since 2021.01

The request does not take any options.

GetMempoolInfoReply

This reply contains several fields.