Skip to main content

TLDR: New functionality just dropped in the Tellor system enabling users to bridge balances from Bitcoin to any Tellor enabled chain.  The BTCBalance query type revolutionizes how users and dapps can leverage Bitcoin’s vast value across Defi.

What are query types?

In order for Tellor to provide flexibility and allow anyone to utilize the protocol, we developed a system of data specifications for defining “query types”.  A query type, like “SpotPrice” for example, contains a name, output type, and arguments like “asset” and “currency.” The hash of the query type and its elements form unique identifiers, or queryIds, for every Tellor data interaction, streamlining communication about specific data requests, reports, disputes, and retrievals.

BTCBalance: Seamless Bitcoin Balance Data Retrieval

The BTCBalance* query type provides a straightforward yet powerful tool for querying Bitcoin balances from Tellor and receiving them on any tellor-enabled chain. By simply inputting a Bitcoin address timestamp users can initiate Tellor reporters to bridge BTC balance information to any Tellor-enabled chain.

Query Parameters and Execution

  • btcAddress: The Bitcoin address of interest.
  • timestamp: The specific timestamp for the balance query, adjusted to the nearest Bitcoin block time.

This approach ensures accurate, up-to-date balance information, enabling a myriad of applications from collateral verification to liquidity assessment for decentralized finance (DeFi) protocols.

Integrating BTCBalance

To utilize BTCBalance, developers encode the query parameters (Bitcoin address and timestamp) using Solidity, forming a unique query ID through the keccak hash function. This ID serves as the cornerstone for retrieving and verifying the queried balance data within the Tellor ecosystem.

Application Scenarios

  • Asset Verification: Confirm the existence and magnitude of Bitcoin assets for cross-chain financial products, enhancing transparency and trust.
  • Cross-chain Collateralization: Leverage Bitcoin as collateral in lending platforms across EVM chains by verifying BTC balances in real-time.
  • Insurance Products: Insurance products that cover cryptocurrency holdings could use the BTC balance data to assess coverage needs, calculate premiums, or verify claims related to the theft or loss of Bitcoin

Getting Started with BTCBalance

Users are free to integrate tellor BTCBalance data by following our documentation using best practices found here.  Or better yet, reach out to us in the discord!

Here’s a quick example for querying a Bitcoin address at a specific timestamp:


string btcAddress = "3Cyd2ExaAEoTzmLNyixJxBsJ4X16t1VePc";

bytes queryData = abi.encode("BTCBalance", abi.encode(btcAddress,1705954706)); 

bytes32 queryId = keccak256(queryData);

Response Handling and Dispute Prevention

Users and developers are encouraged to engage with Tellor reporters and monitor data accuracy actively to mitigate disputes and ensure data integrity. Make sure to use timestamps old enough that the block won’t be reverted or rolled back (you will be disputed).

Conclusion

BTCBalance is another step in bridging the gap between Bitcoin and the vast ecosystem of EVM-compatible chains. By facilitating seamless access to Bitcoin balance data, Tellor enhances the interoperability and utility of blockchain as whole, empowering developers and users alike to innovate and expand the boundaries of decentralized finance.

To dive deeper into BTCBalance or to start integrating this query type into your applications, visit the Tellor documentation, join our Discord community, or reach out to us directly for support. Embrace the future of cross-chain data today with Tellor’s BTCBalance.

 —–

*Please note that here are currently two separate query types for bitcoin balances, BTCBalance and BTCBalanceCurrent, for the sake of simplicity this article didn’t get into those specifics;  BTCBalCurrent requires a balance that is exactly 6 blocks ago.