memoriesadrift / tuw-cryptocurrencies-blockchain

Blockchain created for the Cryptocurrencies course at TU Wien
0 stars 0 forks source link

T2: Object Exchange and Gossiping #15

Closed memoriesadrift closed 1 year ago

memoriesadrift commented 1 year ago

Useful links

DB interface documentation

Scope:

  1. Maintain a local database of known objects. The database should survive reboots.
  2. Implement a function to map objects to objectids. The objectid is obtained by taking the blake2s hash of the canonical JSON representation of the object. You can test your function using the Genesis block and its blockid given in the protocol description.
  3. Implement object exchange using the getobject, ihaveobject, object messages. a) On receiving an ihaveobject message, request the sender for the object using a getobject message if the object is not already in your database. b) On receiving an object, ignore objects that are already in your database. Accept objects that are new and store them in your database if they are valid. c) Implement gossiping: Broadcast the knowledge of newly received valid objects to your peers by sending an ihaveobject message to all your connected peers. d) On receiving a getobject message, send the requested object if you have it in your database