问题描述
我决定运行我自己的以太坊/bsc 全节点。我下载了 geth-linux-amd64-1.1.0 并像这样运行:
geth --syncmode "full" --http --http.port 8545 --http.corsdomain "*" --http.addr "127.0.0.1" --http.api "admin,debug,web3,eth,txpool,personal,ethash,miner,net" --cache 18000 --maxpeers 500 --datadir /someplace
geth attach 和 eth.syncing
给我看
{ currentBlock: 9606766,highestBlock: 9606883,kNownStates: 345833179,pulledStates: 345782057,startingBlock: 9604320 }
所以我想我已经同步了。但是,当我运行 w3.eth.getBalance(some_address)
时,它返回 0。当我使用 Metamask 或 infura 时,我得到不同的值。
我也无法在以太坊(或任何其他代币)上与 Tether 交互:
ERC20_ABI = [..] tether_contract = w3.eth.contract('0xdAC17F958D2ee523a2206206994597C13D831ec7',abi=ERC20_ABI) tether_contract.functions.balanceOf(that_address).call()
结果:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/web3/contract.py",line 1513,in call_contract_function
output_data = web3.codec.decode_abi(output_types,return_data)
File "/usr/local/lib/python3.8/dist-packages/eth_abi/codec.py",line 181,in decode_abi
return decoder(stream)
File "/usr/local/lib/python3.8/dist-packages/eth_abi/decoding.py",line 127,in __call__
return self.decode(stream)
File "/usr/local/lib/python3.8/dist-packages/eth_utils/functional.py",line 45,in inner
return callback(fn(*args,**kwargs))
File "/usr/local/lib/python3.8/dist-packages/eth_abi/decoding.py",line 173,in decode
yield decoder(stream)
File "/usr/local/lib/python3.8/dist-packages/eth_abi/decoding.py",in __call__
return self.decode(stream)
File "/usr/local/lib/python3.8/dist-packages/eth_abi/decoding.py",line 142,in decode
start_pos = decode_uint_256(stream)
File "/usr/local/lib/python3.8/dist-packages/eth_abi/decoding.py",line 198,in decode
raw_data = self.read_data_from_stream(stream)
File "/usr/local/lib/python3.8/dist-packages/eth_abi/decoding.py",line 305,in read_data_from_stream
raise InsufficientDataBytes(
eth_abi.exceptions.InsufficientDataBytes: Tried to read 32 bytes. Only got 0 bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>",line 1,in <module>
File "/usr/local/lib/python3.8/dist-packages/web3/contract.py",line 957,in call
return call_contract_function(
File "/usr/local/lib/python3.8/dist-packages/web3/contract.py",line 1530,in call_contract_function
raise BadFunctionCallOutput(msg) from e
web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function,is contract deployed correctly and chain synced?
我做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)