1.3.7 • Published 5 months ago
@ethereum-sourcify/bytecode-utils v1.3.7
bytecode-utils
Decode the CBOR encoded data at the end of an Ethereum contract's bytecode.
Install
yarn add @ethereum-sourcify/bytecode-utils
Usage
Solidity Contracts
import { decode, AuxdataStyle } from "@ethereum-sourcify/bytecode-utils";
const bytecodeRaw = "0x60806040526004361061003f5760003560e01...7265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033"
// For Solidity contracts
decode(bytecodeRaw, AuxdataStyle.SOLIDITY);
Result example
{
"ipfs": "QmdD3hpMj6mEFVy9DP4QqjHaoeYbhKsYvApX1YZNfjTVWp",
"solcVersion": "0.6.11",
"experimental": true,
"bzzr0": "...",
"bzzr1": "..."
}
Vyper Contracts
import { decode, AuxdataStyle } from "@ethereum-sourcify/bytecode-utils";
const vyperBytecodeRaw = "0x..."; // Your Vyper contract bytecode
// For Vyper contracts
decode(vyperBytecodeRaw, AuxdataStyle.VYPER);
Result example
{
"integrity": "...",
"runtimeSize": 1234,
"dataSizes": [32, 64, 128],
"immutableSize": 256,
"vyperVersion": "0.3.10"
}
Vyper Version Compatibility Notes
Different Vyper compiler versions use different auxdata formats:
- Before v0.3.5: Auxdata only contains version information in cbor, without length data after it
- v0.3.5 to v0.3.9: Auxdata includes version and length information in cbor
- v0.3.10 to v0.4.0: Auxdata is stored as a cbor array with version object as last element
- v0.4.1 and later: Auxdata cbor array includes integrity check as first element
1.3.7
5 months ago
1.3.6
6 months ago
1.3.5
6 months ago
1.3.4
6 months ago
1.3.3
7 months ago
1.3.2
8 months ago
1.3.1
9 months ago
1.2.12
1 year ago
1.2.9
1 year ago
1.2.10
1 year ago
1.2.11
1 year ago
1.2.8
2 years ago
1.2.7
2 years ago
1.2.6
2 years ago
1.2.5
2 years ago
1.2.4
2 years ago
1.2.0
2 years ago
1.1.1
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.1.0
2 years ago
1.0.4
3 years ago