An account on eth-tweet, a decentralised microblogging dapp: its owner posts short tweets stored on chain.
Key Facts
Description
Only the account's admin can tweet. Each tweet is stored with its timestamp, and anyone can read the latest tweet or any earlier one by number.
Source Verified
Exact runtime and creation bytecode match with soljson v0.1.6+commit.d41f8b7c, optimizer on. Source: github.com/yep/eth-tweet, revision blob 9ee5978619 (author original, verbatim). Verified on Etherscan. Not submitted to Sourcify: its oldest supported compiler is v0.1.7.
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)
/*
decentralized microblogging
Copyright (C) 2015 Jahn Bertsch
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation in version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// "class" TweetAccount
contract TweetAccount {
// data structure of a single tweet
struct Tweet {
uint timestamp;
string tweetString;
}
// "array" of all tweets of this account: maps the tweet id to the actual tweet
mapping (uint => Tweet) _tweets;
// total number of tweets in the above _tweets mapping
uint _numberOfTweets;
// "owner" of this account: only admin is allowed to tweet
address _adminAddress;
// constructor
function TweetAccount() {
_numberOfTweets = 0;
_adminAddress = msg.sender;
}
// returns true if caller of function ("sender") is admin
function isAdmin() constant returns (bool isAdmin) {
return msg.sender == _adminAddress;
}
// create new tweet
function tweet(string tweetString) returns (int result) {
if (!isAdmin()) {
// only owner is allowed to create tweets for this account
result = -1;
} else if (bytes(tweetString).length > 160) {
// tweet contains more than 160 bytes
result = -2;
} else {
_tweets[_numberOfTweets].timestamp = now;
_tweets[_numberOfTweets].tweetString = tweetString;
_numberOfTweets++;
result = 0; // success
}
}
function getTweet(uint tweetId) constant returns (string tweetString, uint timestamp) {
// returns two values
tweetString = _tweets[tweetId].tweetString;
timestamp = _tweets[tweetId].timestamp;
}
function getLatestTweet() constant returns (string tweetString, uint timestamp, uint numberOfTweets) {
// returns three values
tweetString = _tweets[_numberOfTweets - 1].tweetString;
timestamp = _tweets[_numberOfTweets - 1].timestamp;
numberOfTweets = _numberOfTweets;
}
function getOwnerAddress() constant returns (address adminAddress) {
return _adminAddress;
}
function getNumberOfTweets() constant returns (uint numberOfTweets) {
return _numberOfTweets;
}
// other users can send donations to your account: use this function for donation withdrawal
function adminRetrieveDonations(address receiver) {
if (isAdmin()) {
receiver.send(this.balance);
}
}
function adminDeleteAccount() {
if (isAdmin()) {
suicide(_adminAddress); // this is a predefined function, it deletes the contract and returns all funds to the owner's address
}
}
}External Links
Related contracts
TweetRegistry
Same deployerThe registry of eth-tweet, a decentralised microblogging dapp: maps account names to TweetAccount contracts.
0x492200...40085eNovember 15, 2015TweetRegistry
Same deployerThe registry of eth-tweet, a decentralised microblogging dapp: maps account names to TweetAccount contracts.
0xe0f278...e83298December 10, 2015Greeter
Same eraA HelloWorld greeter deployed at block 51,909 on 8 August 2015, one of a run of contracts from the same account that week.
0x412fda...7267edAugust 8, 2015Greeter
Same eraA Greeter with the message 'Ethereum will change the world smarter' - deployed Aug 8, 2015 by a developer connected to the Tokyo Smart Contract meetup.
0xda0c1c...7a68ebAugust 8, 2015MessageStore
Same eraA 6-line contract storing a single public string, deployed Day 9 of Ethereum by a prolific early experimenter who shipped 18 contracts in one week.
0xd2eccd...ff3d6bAugust 8, 2015Greeter
Same eraThe go-ethereum Contract Tutorial greeter, deployed with the greeting: Hello World!
0x506f4b...466983August 8, 2015