Bit by Bitcoin

Problem 1

A blockchain is a data structure that can be utilized to provide a cryptographically-verified historical set of data. Bitcoin uses its blockchain to record all transactions adhering to its algorithm and, upon the “mining” of a new block onto the chain (as by completing a proof of work) also inject new Bitcoin currency into the economy.

Problem 2

Sample Solution

Cryptographic hash functions map arbitrary amounts of data into, typically, fixed-length bit strings called digests. These mappings should be irreversible (or, at least, computationally infeasible to reverse), and the set of potential hash codes should be so large that a collision should be effectively impossible.

Problem 3

It neither utilizes all of the data being hashed, nor does it have a set of possible hash codes that makes collisions unlikely.

Problem 4

typedef struct block
{
   digest prev_block;
   int transaction_id;
   int sender;
   int recipient;
   double amount;
   digest dig_sig;
   int proof;
   struct block *next;
}
block;