Back to Home

Fixed-Point Math Library

Unknown
0x258c09146b7a...27643f91115f
FrontierContract #201Exact Bytecode MatchEdit this contract
Deployed August 12, 2015 (10 years ago)Block 76,161

64.64 fixed-point library: e_exp, ln, floor_log2 for an early LMSR prediction market. Deployed Aug 12, 2015 — pre-Gnosis.

Frontier EraVerified Source

Historical Significance

Deployed on August 12, 2015 in block 76,161 — twelve days after Ethereum Frontier mainnet launched on July 30, 2015 — this is, to current knowledge, the earliest Solidity library on Ethereum mainnet implementing production-quality exponential and natural-logarithm functions over a fixed-point number representation. It is the math layer of a three-contract logarithmic-market-scoring-rule (LMSR) prediction-market system whose other components — a difficulty resolution oracle at 0x33cA8b5377c9776eb59863Fb63814dc00a5CB10D and an LMSR market-maker contract at 0xdb7c577b93baeb56dab50af4d6f86f99a06b96a2 — were deployed by the same wallet 0x77b97786b0fb73e55d9e92d4b182befbf346f979 in the same week. To our knowledge it predates every other on-chain LMSR or continuous-pricing prediction-market deployment on Ethereum, including those of Augur, Gnosis, and Polymarket.

Context

The contract exposes three constant pure-math functions over 64.64 fixed-point inputs: e_exp(x) for the natural exponential, ln(x) for the natural logarithm, and floor_log2(x) as a binary-search helper. Plus three ownership-guarded admin entry points — MarketsContract, changeCreator, and deleteContract — sharing a single creator address slot. The exponential is computed by splitting the argument as qln(2)+r with r in [0, ln(2)), then evaluating 2^q multiplied by a six-term Taylor expansion of e^r with a small Pade-style correction of +97423649007 added at the end. The logarithm normalises x to a mantissa in [1, 2) using floor_log2, evaluates a fifteen-term Chebyshev polynomial seeded with a 102^64 bias, and converts log2 to ln by dividing by log2(e) shifted left by 64 bits. These are the same algorithmic shapes that reappear, refined, in the later production LMSRMarketMaker contracts shipped by Gnosis from 2017 onward; the deployer at 0x77b97786b0fb73e55d9e92d4b182befbf346f979 is associated with the pre-Gnosis prediction-market team of Stefan George, who co-founded Gnosis in 2017. The contract was compiled with the native C++ solc 0.1.0 build (no soljson distribution exists for that version) with the optimizer disabled. The runtime is 1913 bytes; the creation bytecode is 1932 bytes; both verify byte-for-byte against the on-chain bytecode at 0x258c09146b7a28Dde8d3e230030e27643F91115F. Companion contracts: difficulty oracle at 0x33cA8b5377c9776eb59863Fb63814dc00a5CB10D (deployed four blocks later, runtime 477 bytes, byte-for-byte verified) and the LMSR market-maker contract at 0xdb7c577b93baeb56dab50af4d6f86f99a06b96a2 whose deployment transaction ran out of gas before any code was written — the LMSRMarketMaker source for that target therefore could not be deployed at that address.

Key Facts
Deployment Block
76,161
Deployment Date
Aug 12, 2015, 09:43 PM
Code Size
1.9 KB
Gas at Deploy
504,074

Description

64.64 fixed-point math library providing e_exp (natural exponential) and ln (natural logarithm) plus the floor_log2 binary-search helper. Used by an early-Frontier LMSR prediction market deployed by the same wallet (0x77b97786b0fb73e55d9e92d4b182befbf346f979) one week after Ethereum mainnet launch.

Source Verified

SolidityExact bytecode match(1,932 bytes)
Compiler: solc 0.

Byte-for-byte match. Compiler: solc 0.1.0 (frontier-jul29 native C++ build), optimizer OFF. Creation bytecode 1932 bytes and runtime bytecode 1913 bytes both reproduce exactly. Reproducible verification at github.com/cartoonitunes/frontier-math-library-verification.

Heuristic Analysis

The following characteristics were detected through bytecode analysis and may not be accurate.

Detected Type: Unknown
Contains SELFDESTRUCT opcode

Bytecode Overview

Opcodes1,932
Unique Opcodes184
Jump Instructions41
Storage Operations9

External Links