the contract or library bytecode to test for metadata hash.
An object where the bytecode
is the executable code and
metadata
is the metadata hash when the metadata is present.
The executable code without metadata when it is present.
Otherwise, the original bytecode
.
The metadata if present. Otherwise undefined
.
See https://docs.soliditylang.org/en/latest/metadata.html#encoding-of-the-metadata-hash-in-the-bytecode.
Generated using TypeDoc v0.25.2
Splits
buffer
into the executable EVM bytecode and the embedded metadata hash. The metadata hash may be placed by the Solidity compiler as a compilation fingerprint. It may include the compiler version and the hash of the compilation input, i.e. the source code and compilation settings.The bytecode might have been compiled with no metadata or with a different language that does not include metadata. In this case the
metadata
property isundefined
and thebytecode
property is the originalbuffer
.The metadata hash is placed at the end of the EVM bytecode and encoded using CBOR. We use
cbor-js
to decode the metadata hash. Ifmetadata
contains an IPFS hash, it is encoded using base 58. We usebase58-js
to encode the IPFS hash. If metadata contains a Swarm hash, i.e.bzzr0
orbzzr1
, it is encoded using hexadecimal.