Tweeter DAPPS - skanakakorn/eth-nonode GitHub Wiki

Here we are going to implement tweeter using Ethereum contract. Tweeter Contract The file is named tweet_storage.sol.

Exercise

  • Tweet at least 3 messages
  • Read the latest tweet
  • Read tweet id 0
  • Read tweet id 1

Now we want to associate sender's address with some name. Therefore we need name registration system. Please take a look at name registry contract name_registry.sol.

Exercise

  1. Register at least 3 names.
  2. Try to unregister 2 names. How do you execute contract? (Hint) Who is the sender of the transaction?
  3. Use adminUnregister to unregister someone. Execute contract as admin and not admin.

With name registration we need new contract tweet_storage2.sol

Exercise with tweet_storage2

  1. Tweet some messages from accounts registered with the name registry.
  2. Read tweet index 1. Show the message.
  3. Show the owner of the message.

Programming exercise

  1. Modify TweetStorage.sol to allow admin to be different from contract creator.
  2. Modify TweetStorage.sol to allow admin to ban only one address from tweeting.
  3. Inspect your code to make sure only admin would have privileges to ban or change admin.
  4. Modify TweetStorage.sol to allow admin to ban certain address from using the contract. Hint: Use mapping(address => bool) _ban_address