Coder Social home page Coder Social logo

blockchain-todo's Introduction

PrivaTO-DO

This api is a TODO list and note-taking. The main difference of this app is that the tasks are stored in a blockchain that creates a history with all the changes and modifications of the different notes/tasks.

How it works?

This api allows the user add new notes and mark them as completed. The flow is always the same, first we need to add new note/task and then these are saved on the Blockchain. In order to make the blockchain data persistent we need to store Blockchain in a file.

You could find the API description on the OpenAPI description file

Workflow

The workflow of the api is as follows:

  1. Send request to the API to add or mark as completed any task
  2. Load the Blockchain data from the file, if exists
  3. Create a Block with the new todo/task data
  4. Add the new Block to the Blockchain
  5. Save the Blockchain with the new data on a file

Technical Considerations

Keep in mind the following:

  1. Related with the blockchain:
    1. Every Block has multiple properties:
      1. timestamp: the timestamp for the moment when the block was created
      2. lastHash: hash of the previous block on the Blockchain
      3. data: information we want to store in the block (in our case the description of the task)
      4. hash: a SHA256 string for the block, calculated concatenating the timestamp, lastHash and data.
    2. The implementation of the Blockchain must follow these contract:
    interface Blockchain {
      /** Adds new block to blockchain */
      addBlock(block: Block): Block
      /**
       * Validates the chain by checking if:
       * - every element's last hash value matches previous block's hash
       * - data hasn't been tampered (which will produce a different hash value)
       */
      isValid(blockchain: Blockchain): boolean
      /** The new blockchain that is a candidate for replacing the current blockchain */
      replace(blockchain: Blockchain): boolean
    }
    
    interface Block {
      /** Generate the hash for the given block */
      static generateHashFromBlock(block: Block): string
    }
    

Tips

  • You can think about the Blockchain as a sort of Linked List, which have some extra properties to ensure the validity of the items and the list as a whole.
  • When you have to update a task or note of the application (i.e. when mark it as completed), you will have to create a new Block with this information, but the previous one will remain in the Blockchain with the outdated information.

Technical requirements

  • Create a clean, maintainable and well-designed code. We expect to see a good and clear architecture that allows to add or modify the solution without so much troubles.
  • Test your code until you are comfortable with it. We don't expect a 100% of Code Coverage but some tests that helps to have a more stable and confident base code.

To understand how you take decisions during the implementation, please write a COMMENTS.md file explaining some of the most important parts of the application. You would also be able to defend your code through Rviewer, once you submit your solution.


How to submit your solution

  • Push your code to the devel branch - we encourage you to commit regularly to show your thinking process was.
  • Create a new Pull Request to main branch & merge it.

Once merged you won't be able to change or add anything to your solution, so double-check that everything is as you expected!

Remember that there is no countdown, so take your time and implement a solution that you are proud!


If you have any feedback or problem, let us know! ๐Ÿค˜

Made with โค๏ธ by Rviewer

blockchain-todo's People

Contributors

rviewer-team avatar

Watchers

James Cloos avatar Wilfredo Morales avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.