EtherTweet – Microblogging on the Ethereum Blockchain


Decentralized Twitter

This repository contains the code of a decentralized microblogging service running on the Ethereum blockchain.

The service provides basic Twitter-like functionality to tweet messages of up to one hundred sixty characters.

Here, decentralization means there is no company or central authority in control of what is being published.

The system is censorship resistant in the sense that once a message is published, it can only be liquidated by the publisher.

All accounts can receive donations in Ethereum’s Ether crypto currency. Being able to receive donations can be an incentive to run a decentralized microblogging feed.

To not expose the user’s social graph to the world, following other accounts is not supported on purpose.

If you want to edit the source files, you can use Ethereum’s Mix IDE which can be found here. In the repository, there is a Mix IDE project file called .mix , it also contains some test cases used during development. Mix can simulate a local blockchain for testing.



Install geth and embark it by injecting

geth –rpc –rpccorsdomain=””

Read Tweets in the Web Browser

With geth running, open in your web browser.

You should see a menu of existing accounts and the corresponding tweets, as shown in this picture:

Using the Geth Directive Line

Posting tweets is not yet supported using the web browser. Instead, you have to use the geth instruction line.

After embarking geth as shown above, open a 2nd shell and begin the interactive geth interface by running

Your prompt should switch to >

As a test, get the status by injecting:

You should see various ethereum statistics like the current block number.

All guidelines below assume you are in the interactive geth interface.

Read Tweets on the Directive Line

An example how to read tweets of an existing account.

See section Browse Accounts below, to learn how to explore all existing accounts.

Create a local variable TweetAccount to point to the existing account. Here, the address of the test account 0x9e82d1745c6c9c04a

6cfcde102837cf0f25efc56 is used. Switch this address in the code block below to read tweets of other accounts.

Copy the following code block and paste it into the interactive geth interface:

Get latest tweet of the account with:

Expected result is:

[“hello world”, 1446832323, 1]

The resulting JSON array contains: .

Use a instrument like to convert timestamps.

Get total number of tweets:

Get a specific tweet. For example, get the very first tweet, tweet number 0:


For account creation, registration and tweeting, you have to get Ethereum’s crypto currency Ether . You can either buy Ether for Dollar/Euro or trade Ether for Bitcoin. Instructions can be found here: For example, you can use the crypto currency exchange.

At time of writing (December 2015), pricing is as goes after:

Price of account creation and registration: 0.02384905 ether or $0.020271693 or €0,018392864 or toughly two cents

Price per Tweet: 0.00420185 ether or $0.0035715725 or €0.0032405508 or toughly one third of a cent

For current rates see the currency pairs eth/usd or eth/eur on

If you like this project, please consider sending donations in Ether to 0x93a4a6c05c5cfb945

f6ccaea223723561670c204 or donations in Bitcoin to 3PyW7MNRJzpw13JFVendeTFt7dcXmFq4pd .

Create an Account

Create a fresh account and make it known to the world by registering an account name in the registry.

To be able to create an account, you have to own some Ether in the local account created by geth. Check local account balance:

Copy and paste the following block into the geth interface to deploy your account code to the ethereum blockchain:

If you are nosey how this ethereum byte code was created, have a look at the deploy directory in this repository. Also, have a look at the TweetAccount.sol source file, it contains a lot of comments to explain what the code does.

After some time, you should see a message like:

Contract mined! address: 0x9e82d1745c6c9c04a6c

fcde102837cf0f25efc56 transactionHash: 0xd458166ead4d6d398fd0c76616d57

Congratulations! You just wrote your very first code to the blockchain and successfully created your account!

You can use the adminRetrieveDonations() function to withdraw donations your account received, see Solidity API section below.

Section Register Account Name explains how you can assign a name to this account address so others can find your account by name.

Post a fresh Tweet

This example tweets hello world with the MyTweetAccount created above:

Note that you have to own Ether to be able to tweet. See previous example how to check your account balance.

You should see a message like I1210 13:33:35.411646 fifty eight thousand six hundred eighteen xeth.go:1028] Tx(0x8b253799a87efd08133e4f2b7dcec

e785a05d6de075c92435da48cb61009ac7e) to: 0x9e82d1745c6c9c04a6

cfcde102837cf0f25efc56 in the geth logs.

Should display [“hello world”, 1449750863, 1] . That means latest tweet is hello world , tweetet at unix timestamp one billion four hundred forty nine million seven hundred fifty thousand eight hundred sixty three with a total of one tweets for this account. Use a contraption like to convert timestamps.

Should comeback 1

Should come back [“hello world”, 1449750863, 1]

If you want to post another tweet at a later time, do the following:

  • Define a variable for your tweet account as described in section Reading Tweets on the Instruction Line .
  • Post a fresh tweet by creating a transaction with tweet.sendTransaction as descibed in this section.

Register Account Name

To make your account known to the world, give it a name and register it in the account registry.

Then, others only have to reminisce your account name and do not need to write down the long and complicated account address.

Create a variable for the account registry. Copy and paste the following block into the geth interface:

Register account name test for the account MyTweetAccount (from the previous example) into the TweetRegistry . Please note you have to use a different account name than “test” since it is already taken.

Browse Accounts

Access accounts by name without having to use the account address directly. You can also look up all existing accounts.

Use the TweetRegistry variable created in the previous section to look up accounts. Once you know the address of the account you want to read, use instructions in section Read Tweets to proceed.

Get address of account called test : TweetRegistry.getAddressOfName(“test”)

Get total amount of accounts registered: TweetRegistry.getNumberOfAccounts()

Get address of the very first account registered ever: TweetRegistry.getAddressOfId(0) . Switch ID to iterate over all accounts.

Get name of account address: TweetRegistry.getNameOfAddress

Solidity API

This decentralized app is written in the Solidity programming language. Documentation is available at

Have a look at the in the deploy directory of this repository. It explains how compilation from Solidity source code to the Ethereum byte code was done.

The TweetAccount.sol source file contains a lot of comments to explain what the code does.

Web3 Javascript API

Geth uses javascript in its interactive interface. Documentation is available here.

The javascript code used in the examples above was created automatically on deploy. See the in the deploy directory for more information

The files deploy/tweet-account.deploy/interface.txt and deploy/tweet-registry.deploy/interface.txt contain the actual javascript interface.

More Geth Directions

Get your account address (called coinbase):

You should see an ethereum account address kicking off with 0x .

Related video:

Leave a Reply

Your email address will not be published. Required fields are marked *