如何连接到Web3.py中的非埃特米姆链节点

发布于 2025-02-08 09:01:02 字数 440 浏览 2 评论 0原文

我正在使用web3.py!默认情况下,它连接到以太坊节点,但是我想将其连接到其他链节的节点,例如solanabitcoin

# Inbuilt
from json import loads

# site-packages
from web3 import Web3


web3_api = Web3(Web3.HTTPProvider('https://btc-mainnet.public.blastapi.io'))
print(web3_api.eth.chain_id)
print(web3_api.eth.getBalance('1GNgwA8JfG7Kc8akJ8opdNWJUihqUztfPe'))

这似乎没有连接,我不知道这里有什么错...

I am using web3.py! By default it connects to Ethereum nodes, but I want to connect it to nodes of other chains like SOLANA or BITCOIN.

# Inbuilt
from json import loads

# site-packages
from web3 import Web3


web3_api = Web3(Web3.HTTPProvider('https://btc-mainnet.public.blastapi.io'))
print(web3_api.eth.chain_id)
print(web3_api.eth.getBalance('1GNgwA8JfG7Kc8akJ8opdNWJUihqUztfPe'))

This doesn't seem to connect, I have no idea what's doing wrong here...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最舍不得你 2025-02-15 09:01:02

除了以太坊(EVM(以太坊虚拟机))外,它将与其他连锁店兼容,这意味着区块链使用与原始的以太坊主网相同的EVM架构,并且是其克隆。
比特币不是EVM兼容。

这里有一些出色的定义:
evm词汇表

It will work with other chains besides Ethereum that are EVM(ethereum virtual machine) compatible, which means that a blockchain uses the same EVM architecture as the original Ethereum mainnet and is its clone.
Bitcoin is not EVM Compatible.

There are some excellent definitions here:
EVM Glossary

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文