GithubHelp home page GithubHelp logo

coding-challenge's Introduction

Coding Challenge - Blockchain React Demo

For this challenge we are making a block chain demo in react. If you don't know any react or typescript, there is no need to worry, some code has already been done for you which can serve as a good reference point, especially when writing tests in step 3. Part of this challenge is to test how well you pick up new technology and concepts.

What is a block chain? Blockchain is a system of recording information in a way that makes it difficult or impossible to change, hack, or cheat the system.

A good demo of this, can be found here: https://andersbrownworth.com/blockchain/blockchain

However we also want to change it up a bit. We want a similar product using typescript and react, as well as some stylistic changes. A skeleton of the code has been provided aswell as a set of step by step instructions on how to get started.

Please create your own git repository to keep track of your work. For submission, just email the repository link back to us.

If you have any issues, please email me at [email protected]

Goodluck!

Setup

Install all packages using npm

npm install

Start

npm run dev

Open http://localhost:9000/

Tests

npm run test

Instructions

To keep track of your work, please setup a git and commit after each step.


Step 1 - Create Block Chain

Please complete the functions in the src/components/BlockChain/index.tsx

  • onAdd
  • onDelete
  • onHash

The render method of this component currently only renders one block. This needs to be updatted to allow for dynamic rendering of a list of blocks. Note that the hashes are linked (hence block chain), so the hash of block 2 includes the previous hash of block 1, the hash of block 3 includes the hash of block 2 and so on. You'll most likely need to add more functions to fix the render method. Figure out a way you can go about this.

Tests for the Block Chain are provided, and given that you've done everything correctly, they should pass. To run the tests only for this component, run npm run tests BlockChain.


Step 2 - Block and Block Chain Style Fixes

  • The block should be red if not a valid block with colour #ff9c9c
  • The block should have border radius of 24px
  • The blocks in the block chain should be aligned with the center
  • The blocks should be 24px apart from each other
  • The block should have a shadow (any will do)
  • The block should 2px solid black border

Step 3 - Block Testing

An essential part of coding is also testing your own code, please complete the testing for the block code that was initially provided in src/components/Block/Block.test.tsx. You'll need to complete 5 tests:

  • Hash is set on load
  • Shows not valid text
  • Delete is called correctly
  • Mining works correctly
  • Changing data effects hash

Resources

Here are some resources that might come in handy when trying to use the technologies required for this challange:

coding-challenge's People

Contributors

jakenhelfrich avatar oscarbarrett avatar zollf avatar

Watchers

 avatar  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.