如何连接到Web3.py中的非埃特米姆链节点
我正在使用web3.py!默认情况下,它连接到以太坊节点,但是我想将其连接到其他链节的节点,例如solana
或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'))
这似乎没有连接,我不知道这里有什么错...
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了以太坊(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