I'm new on web3. Recently I'm trying to decode some logs on Ethereum according to this article. But when I try to use code like receipt=web3.eth.get_transaction(transaction_hash). It keeps showing me that module 'web3.eth' has no attribute 'get_transaction'.
But apparently, my computer has this file. And, doesn't this kind of statement mean "I'm trying to call a function in web3.eth"? Why is it regarded as "calling an attribute"?
Here are my codes:
import json
import requests
from web3 import Web3
w3=Web3(Web3.HTTPProvider(infura_project))
receipt=web3.eth.get_transcation(transaction Hash) //always show error "web3.eth has no attribute get_transaction"
log=receipt["logs"][2]
smart_contract=log["address"]
mykey="MY API Key of Etherscan"
adi_endpoint=f"https://api.etherscan.io/api?module=contract&action=getabi&address={smart_contract} & apikey={mykey}" //problem (2)
abi=json.load(requests.get(adi_endpoint).text)
//decode info
And if I directly put my API key of Etherscan at the end of line 10, pycharm will mark an error in there. So I enclose the API key in double quotes and assign it to the variable "mykey". Honestly, I don't think this will work. How to solve this problem?
