I'm learning ethereum blockchain.
I'm using web3.js with Ganache as a dev node and I want to query the information of a smart contract (i have the address and i want to get the code and the ABI)
I checked the documentation about web3.eth.Contract
and found nothing ,
Also knowing that a contract is a type of account (like EOA). I tried using web3.eth.accounts
, but didn't find a way to make it work
Any suggestion? If not possible via Web3.js please suggest a blockchain explorer for local nodes? Or should I use Truffle
?
Contract bytecode and ABI JSON are results of compilation of the source code.
Only the bytecode is stored onchain. So it's not possible to retrieve the source code nor the ABI JSON from just the bytecode.