Skip to content

Latest commit

 

History

History
70 lines (57 loc) · 4.23 KB

README.md

File metadata and controls

70 lines (57 loc) · 4.23 KB

Overview

This repo represents the implementation of a basic blockchain from scratch, and entirely in C, as part of the Holberton Training Program.

image

OS Linux distro Ubuntu Programming language C OpenSSL Crypto

Topics

  • What is a Blockchain?
  • 0x00. Blockchain - Crypto
  • 0x01. Blockchain - Data structures concepts
  • 0x02. Blockchain - Block mining

What is a Blockchain?

A blockchain is essentially a digital ledger of transactions that is duplicated and distributed across the entire network of computer systems on the blockchain, each block contains data and a reference to the previous one in the list. Visit this blog to learn more about it.

0x00. Blockchain - Crypto

Tasks

  • "0. SHA256" :Function that computes the hash of a sequence of bytes
  • "1. EC_KEY creation" : Function that creates a new EC key pair
  • "2. EC_KEY to public key": Function that extracts the public key from an EC_KEY opaque structure
  • "3. EC_KEY from public key": function that creates an EC_KEY structure given a public key
  • "4. EC_KEY - Save to file": function that saves an existing EC key pair on the disk.
  • "5. EC_KEY - Load from file": function that loads an EC key pair from the disk
  • "6. Signature": Implementing a function that signs a given set of bytes, using a given EC_KEY private key
  • "7. Signature verification": Implementing a function that verifies the signature of a given set of bytes, using a given EC_KEY public key
  • 8. Library: Creation of a Makefile that compiles all the previous functions and archives them into a static library for future use.
  • 0x01. Blockchain - Data structures concepts

    Tasks

  • "0. Create Blockchain":Write a function that creates a Blockchain structure, and initializes it
  • "1. Create Block":Write a function that creates a Block structure and initializes it.
  • "2. Delete Block": Write a function that deletes an existing Block
  • "3. Delete Blockchain": Write a function that deletes an existing Blockchain, along with all the Blocks it contains/li>
  • "4. Hash Block": Write a function that computes the hash of a Block
  • "5. Save Blockchain": Write a function that serializes a Blockchain into a file
  • "6. Load Blockchain": Write a function that deserializes a Blockchain from a file
  • "7. Block validity": Write a function that verifies that a Block is valid
  • 0x02. Blockchain - Block mining

    Tasks

  • "0. Proof of work": Write a function that checks whether a given hash matches a given difficulty
  • "1. Block is valid v0.2": check if a Block’s hash matches its difficulty
  • "2. Block mining": Write a function that mines a Block in order to insert it in the Blockchain
  • "3. Adjust difficulty": Write a function that computes the difficulty to assign to a potential next Block in the Blockchain.
  • Requirements

    References