The Ping half of Cyrus Adkisson's contract to contract call exercise
Historical Significance
The ping chapter of cyrusadkisson/solidity-baby-steps. It holds the address of a Pong contract and calls it two ways, once as a constant call and once as a transaction, to show that only the transactional form can change state. Deployed 25 August 2015 and later destroyed.
Context
Frontier era deployment by Cyrus Adkisson, from his Solidity teaching repository.
Key Facts
Description
The ping chapter of cyrusadkisson/solidity-baby-steps. It holds the address of a Pong contract and calls it two ways, once as a constant call and once as a transaction, to show that only the transactional form can change state. Deployed 25 August 2015 and later destroyed.
Source Verified
Exact creation bytecode match. Author Cyrus Adkisson published source at https://github.com/cyrusadkisson/solidity-baby-steps/blob/master/contracts/45_ping.sol. Batch-matched against 357 deploy TXs from deployer 0xcf684dfb8304729355b58315e8019b1aa2ad1bac.
Historian Categories
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)
// Contracts can get non-constant return values from functions in other contracts. (Whereas you can't from web3/geth.)
// These two contracts are meant to test this. Like so:
// 1. Deploy Pong with a pongval.
// 2. Deploy Ping, giving it the address of Pong.
// 3. Call Ping.getPongvalRemote() using a sendTransaction...
// 4. ... which retreives the value of pongval from Pong.
// 5. If successful Ping.getPongval() should return the value from step 1.
contract PongvalRetriever {
int8 pongval_tx_retrieval_attempted = 0;
function getPongvalTransactional() public returns (int8){ // tells Ping how to interact with Pong.
pongval_tx_retrieval_attempted = -1;
return pongval_tx_retrieval_attempted;
}
}
contract Ping is PongvalRetriever {
int8 pongval;
PongvalRetriever pvr;
address creator;
/*********
Step 2: Deploy Ping, giving it the address of Pong.
*********/
function Ping(PongvalRetriever _pongAddress)
{
creator = msg.sender;
pongval = -1;
pvr = _pongAddress;
}
/*********
Step 3: Transactionally retrieve pongval from Pong.
*********/
function getPongvalRemote()
{
pongval = pvr.getPongvalTransactional();
}
/*********
Step 5: Get pongval (which was previously retrieved from Pong via transaction)
*********/
function getPongvalConstant() constant returns (int8)
{
return pongval;
}
// -----------------------------------------------------------------------------------------------------------------
/*********
Functions to get and set pongAddress just in case
*********/
function setPongAddress(PongvalRetriever _pongAddress)
{
pvr = _pongAddress;
}
function getPongAddress() constant returns (address)
{
return pvr;
}
/****
For double-checking this contract's address
****/
function getAddress() returns (address)
{
return this;
}
/*********
Standard kill() function to recover funds
*********/
function kill()
{
if (msg.sender == creator)
suicide(creator); // kills this contract and sends remaining funds back to creator
}
}
// See Pong for deployment/use.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