@@ -4,28 +4,28 @@ Contract Metadata
4
4
5
5
.. index :: metadata, contract verification
6
6
7
- The Solidity compiler automatically generates a JSON file, the
8
- contract metadata, that contains information about the current contract.
9
- It can be used to query the compiler version, the sources used, the ABI
10
- and NatSpec documentation in order to more safely interact with the contract
11
- and to verify its source code.
7
+ The Solidity compiler automatically generates a JSON file, the contract
8
+ metadata, that contains information about the current contract. You can use
9
+ this file to query the compiler version, the sources used, the ABI and NatSpec
10
+ documentation to more safely interact with the contract and verify its source
11
+ code.
12
12
13
13
The compiler appends a Swarm hash of the metadata file to the end of the
14
14
bytecode (for details, see below) of each contract, so that you can retrieve
15
15
the file in an authenticated way without having to resort to a centralized
16
16
data provider.
17
17
18
- Of course, you have to publish the metadata file to Swarm (or some other service)
19
- so that others can access it. The file can be output by using ``solc --metadata ``
20
- and the file will be called ``ContractName_meta.json ``.
21
- It will contain Swarm references to the source code, so you have to upload
22
- all source files and the metadata file.
18
+ You have to publish the metadata file to Swarm (or another service) so that
19
+ others can access it. You create the file by using the ``solc --metadata ``
20
+ command that generates a file called ``ContractName_meta.json ``. It contains
21
+ Swarm references to the source code, so you have to upload all source files and
22
+ the metadata file.
23
23
24
24
The metadata file has the following format. The example below is presented in a
25
25
human-readable way. Properly formatted metadata should use quotes correctly,
26
26
reduce whitespace to a minimum and sort the keys of all objects to arrive at a
27
- unique formatting.
28
- Comments are of course also not permitted and used here only for explanatory purposes.
27
+ unique formatting. Comments are not permitted and used here only for
28
+ explanatory purposes.
29
29
30
30
.. code-block :: none
31
31
@@ -96,11 +96,11 @@ Comments are of course also not permitted and used here only for explanatory pur
96
96
.. note ::
97
97
Note the ABI definition above has no fixed order. It can change with compiler versions.
98
98
99
- .. note ::
100
- Since the bytecode of the resulting contract contains the metadata hash, any change to
101
- the metadata will result in a change of the bytecode. Furthermore, since the metadata
102
- includes a hash of all the sources used, a single whitespace change in any of the source
103
- codes will result in a different metadata, and subsequently a different bytecode.
99
+ Since the bytecode of the resulting contract contains the metadata hash, any
100
+ change to the metadata results in a change of the bytecode. This includes
101
+ changes to a filename or path, and since the metadata includes a hash of all the
102
+ sources used, a single whitespace change results in different metadata, and
103
+ different bytecode.
104
104
105
105
Encoding of the Metadata Hash in the Bytecode
106
106
=============================================
0 commit comments