merkle Trees (JAVA)
Goal: The purpose of this assignment is to write a Java program that implements a MerkleTree to be
used in a blockchain. Then you will write a brief report describing your results, in the comments of your
program; see the end of this document.
1. This assignment is self-contained. We do not expect you to know how Blockchain works. However, by
the end of this assignment, if you read the code well enough, you will learn Blockchain in detail.
2. You will be surprised how this Blockchain technology, considered revolutionary, is built on such simple
ideas that a beginner student can code. And later in life you can mention that you were writing
blockchains in your second year of undergraduate.
3. A transaction is a transfer of coins from a set of addresses (i.e., senders) to another set of addresses
2
(i.e., receivers).
4. Each sender or receiver is an address, which is stored in a String variable (see Transaction.java). In
real life, people can create and use many addresses. We cannot know the owner of an address by just
looking at the string.
5. A Bitcoin transaction can have many senders and receivers. This is why transactions in Figure 1 have
dierent shape sizes. For this assignment, we simplify the transaction model to only one sender and
one receiver (see Transaction.java).
6. A transaction has sender, receiver and amount attributes. In Bitcoin, transactions are created by ordi-
nary users and sent to a Peer to Peer network. Miners listen to the network, discover new transactions
and create blocks out of them. In this assignment, we will not have a real Peer to Peer network.
The PeerToPeerNetwork.java simulates this, and returns a random number of articial transactions
whenever someone calls the collectNewTransactions() function.
7. A miner is a user (anyone can choose to be a miner) who wants to create a block. The process of
getting transactions, putting them into a block and solving the Proof-of-Work puzzle is called mining
a block.
8. Proof-of-Work (see mineTheBlock() in Blockchain.java) involves creating a string from the block-
Hash of the previous block, topHash of the MerkleTree, and a long integer (called nonce). Once the
SHA256 hash is applied to this string, a 256 bit integer is computed. If the integer is less than a
predened diculty, the nonce is said to satisfy the diculty. The block is said to be mined.
9. Any helper function that you need (e.g., to hash SHA256) is already given in the les.
What you should implement: Implement the following algorithms and methods (you can
You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.
Latest completed orders:
# | topic title | discipline | academic level | pages | delivered |
---|---|---|---|---|---|
6
|
Writer's choice
|
Business
|
University
|
2
|
1 hour 32 min
|
7
|
Wise Approach to
|
Philosophy
|
College
|
2
|
2 hours 19 min
|
8
|
1980's and 1990
|
History
|
College
|
3
|
2 hours 20 min
|
9
|
pick the best topic
|
Finance
|
School
|
2
|
2 hours 27 min
|
10
|
finance for leisure
|
Finance
|
University
|
12
|
2 hours 36 min
|