PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, July 28, 2022

[FIXED] How to get smart contract info? like code and ABI in a local ganache node

 July 28, 2022     blockchain, ethereum, ganache, web3js     No comments   

Issue

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?


Solution

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.



Answered By - Petr Hejda
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing