简体   繁体   English

如何在智能合约中获取比特币余额

[英]How to get bitcoin balance in smart contract

I am making a smart contract and want to know the bitcoin balance of a metamask address.How can I do this?我正在制定智能合约并想知道元掩码地址的比特币余额。我该怎么做? Since BTC is not ERC-20.由于 BTC 不是 ERC-20。

Have you considered using a block explorer (something like blockstream.info )你有没有考虑过使用区块浏览器(比如blockstream.info

All you need to know is the address you want to query.您只需要知道您要查询的地址即可。

I assume want to do automate this, and in this case you can search for an api - http://blockchain.info/api You will have to implement the API, but that's the only way as far as I know from a smart contract running on Etherium.我假设想要自动执行此操作,在这种情况下,您可以搜索 api - http://blockchain.info/api您将必须实施 API,但据我所知,这是智能合约中的唯一方法在以太坊上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM