Contract 0xf20c9fa34847...8bec65676af7
UtilityThe Etheria hex bounds check paired with the byte extractor
Context
Frontier era deployment by Cyrus Adkisson, the author of Etheria.
Key Facts
Description
The last of four standalone blockHexCoordsValid deployments on 14 October 2015, carrying the corrected validator alongside getUint8FromByte32, the helper Etheria uses to pull a single byte out of a bytes32 by index. Both functions are in the form that reached Etheria v0.85 and v0.9.
Source Verified
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract HexValidator
{
function blockHexCoordsValid(int8 x, int8 y) constant returns (bool)
{
if(-33 <= y && y <= 33)
{
if(y % 2 != 0 ) // odd
{
if(-50 <= x && x <= 49)
return true;
}
else // even
{
if(-49 <= x && x <= 49)
return true;
}
}
else
{
uint8 absx;
uint8 absy;
if(x < 0)
absx = uint8(x*-1);
else
absx = uint8(x);
if(y < 0)
absy = uint8(y*-1);
else
absy = uint8(y);
if((y >= 0 && x >= 0) || (y < 0 && x > 0)) // first or 4th quadrants
{
if(y % 2 != 0 ) // odd
{
if (((absx*2) + (absy*3)) <= 198)
return true;
}
else // even
{
if ((((absx+1)*2) + ((absy-1)*3)) <= 198)
return true;
}
}
else
{
if(y % 2 == 0 ) // even
{
if (((absx*2) + (absy*3)) <= 198)
return true;
}
else // odd
{
if ((((absx+1)*2) + ((absy-1)*3)) <= 198)
return true;
}
}
}
return false;
}
function getUint8FromByte32(bytes32 _b32, uint8 byteindex) public constant returns(uint8) {
uint numdigits = 64;
uint buint = uint(_b32);
uint upperpowervar = 16 ** (numdigits - (byteindex*2)); // @i=0 upperpowervar=16**64 (SEE EXCEPTION BELOW), @i=1 upperpowervar=16**62, @i upperpowervar=16**60
uint lowerpowervar = 16 ** (numdigits - 2 - (byteindex*2)); // @i=0 upperpowervar=16**62, @i=1 upperpowervar=16**60, @i upperpowervar=16**58
uint postheadchop;
if(byteindex == 0)
postheadchop = buint; //for byteindex 0, buint is just the input number. 16^64 is out of uint range, so this exception has to be made.
else
postheadchop = buint % upperpowervar; // @i=0 _b32=a1b2c3d4... postheadchop=a1b2c3d4, @i=1 postheadchop=b2c3d4, @i=2 postheadchop=c3d4
uint remainder = postheadchop % lowerpowervar; // @i=0 remainder=b2c3d4, @i=1 remainder=c3d4, @i=2 remainder=d4
uint evenedout = postheadchop - remainder; // @i=0 evenedout=a1000000, @i=1 remainder=b20000, @i=2 remainder=c300
uint b = evenedout / lowerpowervar; // @i=0 b=a1 (to uint), @i=1 b=b2, @i=2 b=c3
return uint8(b);
}
}External Links
Related contracts
GetBalance
Same deployerCyrus Adkisson experimental getter (Sep 2015) exposing the ether balance of a hardcoded address via getMyBalance(). Verified byte-for-byte with soljson v0.1.1.
0x759ad4...239a87August 26, 2015Contract 0xddcd64...a08e7b
Same deployerThe greeter tutorial contract: it stores a greeting set at deployment and can be shut down by its owner.
0xddcd64...a08e7bAugust 26, 2015basicInfoGetter
Same deployerA tour of the EVM globals, carrying the constructor of the file it was copied from
0xad826c...d33547August 31, 2015Contract 0x3ea0db...b922e0
Same deployerThe basic info getter from the solidity-baby-steps tutorials, a read only window onto the block and message globals.
0x3ea0db...b922e0August 31, 2015Contract 0xba575c...78733f
Same deployerA contract built to probe what the msg globals actually return, endowed with 5 ETH, deployed 1 September 2015.
0xba575c...78733fSeptember 1, 2015Contract 0x8b180c...c084df
Same deployerA third deployment of the msgExaminer that records its own creation message
0x8b180c...c084dfSeptember 1, 2015