Skip to content

cartoonitunes/hashreg-verify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

HashReg Bytecode Verification

Contract: 0x23bf622b5a65f6060d855fca401133ded3520620
Deployed: Block 282,885 (August 7, 2015 — day one of Ethereum Frontier)
Bytecode: 152 bytes runtime
Status: ✅ Exact bytecode match

What is HashReg?

HashReg is one of three interlinked Frontier-era name registrars deployed by the Ethereum Foundation on the first day of mainnet. It maps a code hash (keccak256 of contract bytecode) to a content hash (a Swarm manifest). Together with GlobalRegistrar and UrlHint, it formed Ethereum's original content discovery stack:

GlobalRegistrar: name → address
HashReg:         keccak256(bytecode) → content hash
UrlHint:         content hash → URL

The idea: you could look up a contract by name, find its address, hash its bytecode, find the content manifest, and resolve a URL to the original source code — all on-chain.

Source

The source was preserved verbatim in go-ethereum v1.0.0 common/registrar/contracts.go as HashRegSrc, alongside the hardcoded bytecode (HashRegCode).

Author: Gav Wood, Ethereum Foundation.

contract HashReg {
	function setowner() {
		if (owner == 0) {
			owner = msg.sender;
		}
	}
	function register(uint256 _key, uint256 _content) {
		if (msg.sender == owner) {
			content[_key] = _content;
  	}
	}
	address owner;
	mapping (uint256 => uint256) content;
}

Verification

The bytecode in HashRegCode (go-ethereum v1.0.0) exactly matches the on-chain runtime bytecode.

On-chain runtime:
60003560e060020a9004806331e12c2014601f578063d66d6c1014602b57005b6025603d565b6000
6000f35b6037600435602435605d565b60006000f35b600054600160a060020a03166000146053
57605b565b336000819055505b565b600054600160a060020a031633600160a060020a031614607b
576094565b8060016000848152602001908152602001600020819055505b505056

go-ethereum v1.0.0 HashRegCode (runtime, after stripping creation prefix):
[identical]

Notes

  • Uses the pre-release Solidity selector dispatch pattern (PUSH1 0xe0, PUSH1 0x02, EXP, SWAP1, DIV) rather than the later PUSH32 0x0100... form — consistent with a compiler predating v0.1.0.
  • The bytecode was hardcoded directly in go-ethereum, not compiled separately. The compiler and exact version are unknown but the source is authoritative.
  • Function signatures: setowner()0x31e12c20, register(uint256,uint256)0xd66d6c10
  • Storage: slot 0 = owner (address), slot 1 = content mapping

About

Bytecode verification for HashReg (0x23bf622b) — Frontier-era Ethereum code hash registry, deployed Aug 7 2015

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors