The registry of eth-tweet, a decentralised microblogging dapp: maps account names to TweetAccount contracts.
Key Facts
Description
TweetRegistry lets a user register a unique name for a TweetAccount and look accounts up by name, address or id. Its admin can disable registration so users move to a newer registry.
Source Verified
Exact runtime and creation bytecode match with soljson v0.2.0+commit.4dc2445e, optimizer on. Source: github.com/yep/eth-tweet, revision blob cb5c7e4637 (author original, verbatim). Verified on Etherscan.
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" TweetRegistry
contract TweetRegistry {
// mappings to look up account names, account ids and addresses
mapping (address => string) _addressToAccountName;
mapping (uint => address) _accountIdToAccountAddress;
mapping (string => address) _accountNameToAddress;
// might be interesting to see how many people use the system
uint _numberOfAccounts;
// owner
address _registryAdmin;
// allowed to administrate accounts only, not everything
address _accountAdmin;
// if a newer version of this registry is available, force users to use it
bool _registrationDisabled;
function TweetRegistry() {
_registryAdmin = msg.sender;
_accountAdmin = msg.sender; // can be changed later
_numberOfAccounts = 0;
_registrationDisabled = false;
}
function register(string name, address accountAddress) returns (int result) {
if (_accountNameToAddress[name] != address(0)) {
// name already taken
result = -1;
} else if (bytes(_addressToAccountName[accountAddress]).length != 0) {
// account address is already registered
result = -2;
} else if (bytes(name).length >= 64) {
// name too long
result = -3;
} else if (_registrationDisabled){
// registry is disabled because a newer version is available
result = -4;
} else {
_addressToAccountName[accountAddress] = name;
_accountNameToAddress[name] = accountAddress;
_accountIdToAccountAddress[_numberOfAccounts] = accountAddress;
_numberOfAccounts++;
result = 0; // success
}
}
function getNumberOfAccounts() constant returns (uint numberOfAccounts) {
numberOfAccounts = _numberOfAccounts;
}
function getAddressOfName(string name) constant returns (address addr) {
addr = _accountNameToAddress[name];
}
function getNameOfAddress(address addr) constant returns (string name) {
name = _addressToAccountName[addr];
}
function getAddressOfId(uint id) constant returns (address addr) {
addr = _accountIdToAccountAddress[id];
}
function unregister() returns (string unregisteredAccountName) {
unregisteredAccountName = _addressToAccountName[msg.sender];
_addressToAccountName[msg.sender] = "";
_accountNameToAddress[unregisteredAccountName] = address(0);
// _accountIdToAccountAddress is never deleted on purpose
}
function adminUnregister(string name) {
if (msg.sender == _registryAdmin || msg.sender == _accountAdmin) {
address addr = _accountNameToAddress[name];
_addressToAccountName[addr] = "";
_accountNameToAddress[name] = address(0);
// _accountIdToAccountAddress is never deleted on purpose
}
}
function adminSetRegistrationDisabled(bool registrationDisabled) {
// currently, the code of the registry can not be updated once it is
// deployed. if a newer version of the registry is available, account
// registration can be disabled
if (msg.sender == _registryAdmin) {
_registrationDisabled = registrationDisabled;
}
}
function adminSetAccountAdministrator(address accountAdmin) {
if (msg.sender == _registryAdmin) {
_accountAdmin = accountAdmin;
}
}
function adminRetrieveDonations() {
if (msg.sender == _registryAdmin) {
_registryAdmin.send(this.balance);
}
}
function adminDeleteRegistry() {
if (msg.sender == _registryAdmin) {
suicide(_registryAdmin); // this is a predefined function, it deletes the contract and returns all funds to the admin'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, 2015TweetAccount
Same deployerAn account on eth-tweet, a decentralised microblogging dapp: its owner posts short tweets stored on chain.
0x9e82d1...5efc56November 15, 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