Merge pull request #5080 from ethereum/docMeta

[DOCS] Update metadata.
This commit is contained in:
Alex Beregszaszi 2018-09-26 18:10:48 +01:00 committed by GitHub
commit aa6fefc9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,19 +117,28 @@ to the end of the deployed bytecode::
So in order to retrieve the data, the end of the deployed bytecode can be checked So in order to retrieve the data, the end of the deployed bytecode can be checked
to match that pattern and use the Swarm hash to retrieve the file. to match that pattern and use the Swarm hash to retrieve the file.
.. note::
The compiler currently uses the "swarm version 0" hash of the metadata,
but this might change in the future, so do not rely on this sequence
to start with ``0xa1 0x65 'b' 'z' 'z' 'r' '0'``. We might also
add additional data to this CBOR structure, so the
best option is to use a proper CBOR parser.
Usage for Automatic Interface Generation and NatSpec Usage for Automatic Interface Generation and NatSpec
==================================================== ====================================================
The metadata is used in the following way: A component that wants to interact The metadata is used in the following way: A component that wants to interact
with a contract (e.g. Mist) retrieves the code of the contract, from that with a contract (e.g. Mist or any wallet) retrieves the code of the contract, from that
the Swarm hash of a file which is then retrieved. the Swarm hash of a file which is then retrieved.
That file is JSON-decoded into a structure like above. That file is JSON-decoded into a structure like above.
The component can then use the ABI to automatically generate a rudimentary The component can then use the ABI to automatically generate a rudimentary
user interface for the contract. user interface for the contract.
Furthermore, Mist can use the userdoc to display a confirmation message to the user Furthermore, the wallet can use the NatSpec user documentation to display a confirmation message to the user
whenever they interact with the contract. whenever they interact with the contract, together with requesting
authorization for the transaction signature.
Additional information about Ethereum Natural Specification (NatSpec) can be found `here <https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format>`_. Additional information about Ethereum Natural Specification (NatSpec) can be found `here <https://github.com/ethereum/wiki/wiki/Ethereum-Natural-Specification-Format>`_.