Alex Van de Sande's post-DAO-fork ETH/ETC replay-protection splitter. Routes ether or ERC20 tokens to different recipients depending on which chain it runs on.
Key Facts
Description
Deployed on 2016-07-27, the week after the DAO hard fork that split Ethereum into ETH and ETC. The constructor records a known main-chain blockhash into a public chainSignature, and the etherSplit and tokenSplit functions route value to one recipient on the main chain and a different recipient on the other fork, so a single signed transaction cannot replay value across both chains. I cracked it to a byte-for-byte runtime match with soljson v0.3.5 (optimizer ON); two of the deployer's sibling ReplayProtection contracts are verified on Etherscan.
Source Verified
Byte-for-byte runtime match. soljson v0.3.5+commit.5f97274a, optimizer ON. Runtime SHA-256 a6e5ae070945319e9e945dd8bb0cfe9ededeef0ee1453dbfc25600244fec04be. Reproduce with verify.js in the proof folder.
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
DAO Fork Era
The controversial fork to recover funds from The DAO hack.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
contract Token {
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
}
// replay protection
contract ReplayProtection {
bytes32 public chainSignature;
function ReplayProtection() {
bytes32 blockHash = 0xcf9055c648b3689a2b74e980fc6fa27817622fa9ac0749d60a6489a7fbcfe831;
for (uint i = 1; i < 64; i++) {
if (blockHash == block.blockhash(block.number - i)) chainSignature = blockHash;
}
}
function etherSplit(address recipient, address altChainRecipient, bytes32 _chainSignature) returns(bool) {
if (chainSignature == _chainSignature && recipient.send(msg.value)) {
return true;
} else if (chainSignature != _chainSignature && altChainRecipient.send(msg.value)) {
return true;
}
throw;
}
function tokenSplit(address recipient, address altChainRecipient, address tokenAddress, uint amount, bytes32 _chainSignature) returns (bool) {
if (msg.value > 0 ) throw;
Token token = Token(tokenAddress);
if (chainSignature == _chainSignature && token.transferFrom(msg.sender, recipient, amount)) {
return true;
} else if (chainSignature != _chainSignature && token.transferFrom(msg.sender, altChainRecipient, amount)) {
return true;
}
throw;
}
function () {
throw;
}
}