Smart Contracts header file ?

If it's already quesitoned somewhere sorry, but I would like to know how to see what properties and methods the smart contract has after published.

I think a contract has only private properties and private functions. (functionID can't be seen after published) In that case how should I share the contract information with people who will send message to the contracts ?

Comments

  • GlasswalkerGlasswalker CanadaMember Posts: 7
    In the case of solidity, with the binary solc compiler, this his handled with the ABI.

    The ABI data can be generated either in Solidity code, or in JSON format. using the solc compiler.

    So for example if your solidity code defines a bunch of public (and some private) functions, you can then compile it using solc with the --json-abi and/or --sol-abi output flags. These will output the JSON and Solidity ABI definitions accordingly. Someone who wanted to then call your contract from the JS api, could import the JDON ABI data and use it to define a contract object, which would then allow named function calls from the js in a simple intelligble way. In addition if another contract (Solidity) wanted to leverage your contract's published methods, they would include the Solidity ABI code, which has skeleton definitions of the methods allowing them to call it, without having the full code present in their contract.

    A few wiki articles that cover some of these topics:
    https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
    https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract
    https://github.com/ethereum/wiki/wiki/Solidity-Tutorial

    Hope that helps!
  • TOMOAKI12345TOMOAKI12345 Member Posts: 12
    Thank you for nice tutorial, with --json-abi and/or --sol-abi output flags, and using JS-API then will be possible. I should be closer to ABI. Thanks!
Sign In or Register to comment.