Blockchain Technologies – ScroogeCoin project

Note that the starter code does NOT run itself. The main() function is located at TestTxHandler.java which is provided to you as an auto grader. In ScroogeCoin the central authority Scrooge receives transactions from users. You will implement the logic used by Scrooge to process transactions and produce the ledger. Scrooge organizes transactions into time periods or blocks. In each block Scrooge will receive a list of transactions validate the transactions he receives and publish a list of validated transactions. Note that a transaction can reference another in the same block. Also among the transactions received by Scrooge in a single block more than one transaction may spend the same output. This would of course be a double-spend and hence invalid. This means that transactions can’t be validated in isolation; it is a tricky problem to choose a subset of transactions that are together valid. You will be provided with a Transaction class that represents a ScroogeCoin transaction and has inner classes Transaction.Output and Transaction.Input. A transaction output consists of a value and a public key to which it is being paid. For the public keys we use the built-in Java PublicKey class. A transaction input consists of the hash of the transaction that contains the corresponding output the index of this output in that transaction (indices are simply integers starting from 0) and a digital signature. For the input to be valid the signature it contains must be a valid signature over the current transaction with the public key in the spent output. More specifically the raw data that is signed is obtained from the getRawDataToSign(int index) method. You will be provided with an rsa.jar file for using the RSAKey class. The public key in a transaction output and the private key used to create signatures in transaction inputs are both represented by an RSAKey and an RSAKeyPair is a public/private key pair. The RSAKey class API is as follows: public class RSAKey { public RSAKey(BigInteger theExponent BigInteger theModulus) public BigInteger getExponent() public BigInteger getModulus() public byte[] encrypt(byte[] plaintext) public byte[] decrypt(byte[] ciphertext) public byte[] sign(byte[] message) public boolean verifySignature(byte[] message byte[] signature) public int maxPlaintextLength() } The verifySignature() method should be used by a public RSAKey object to verify a signature generated by the corresponding private RSAKeys sign() method. Note that you are only given code to verify signatures and this is all that you will need for this assignment. The computation of signatures is done outside the Transaction class by an entity that knows the appropriate private keys. A transaction consists of a list of inputs a list of outputs and a unique ID (see the getRawTx() method). The class also contains methods to add and remove an input add an output compute digests to sign/hash add a signature to an input and compute and store the hash of the transaction once all inputs/outputs/signatures have been added. You will also be provided with a UTXO class that represents an unspent transaction output. A UTXO contains the hash of the transaction from which it originates as well as its index within that transaction. We have included equals hashCode and compareTo functions in UTXO that allow the testing of equality and comparison between two UTXOs based on their indices and the contents of their txHash arrays. Further you will be provided with a UTXOPool class that represents the current set of outstanding UTXOs and contains a map from each UTXO to its corresponding transaction output. This class contains constructors to create a new empty UTXOPool or a copy of a given UTXOPool and methods to add and remove UTXOs from the pool get the output corresponding to a given UTXO check if a UTXO is in the pool and get a list of all UTXOs in the pool. You will be provided with a file called TxHandler.java that implements the following API: Your implementation of handleTxs() should return a mutually valid transaction set of maximal size (one that can’t be enlarged simply by adding more transactions). It need NOT compute a set of maximum size (one for which there is no larger mutually valid transaction set). Based on the transactions it has chosen to accept handleTxs should also update its internal UTXOPool to reflect the current set of unspent transaction outputs so that future calls to handleTxs() and isValidTx() are able to correctly process/validate transactions that claim outputs from transactions that were accepted in a previous call to handleTxs(). Extra Credit: Create a second file called MaxFeeTxHandler.java whose handleTxs() method finds a set of transactions with maximum total transaction fees — i.e. maximize the sum over all transactions in the set of (sum of input values – sum of output values). Autograder: Download autograder here An autograder is provided to you to self check the correctness of your program. Follow the following steps: Step 1. Copy TxHandler.java into grading folder. Step 2. While holding down Windows key press R (or click Start) and then type cmd. Press Enter. Step 3. Move into the folder that contains the ScroogeCoin-related classes by typing this command: cd C:grading Step 4. Compile the classes with this command (Replace ; with : for Linux or Mac OS): javac -cp scroogeCoinGrader.jar;rsa.jar;algs4.jar;. TestTxHandler.java Step 5. Finally run the tests with this command: java -cp scroogeCoinGrader.jar;rsa.jar;algs4.jar;. TestTxHandler There are 15 tests in total and the test files are located in files folder. Example output: Test 1: test isValidTx() with valid transactions==> passed … Testing MaxFeeTxHandler.java (extra credit): Enter the following commands in your terminal from the current working directory ( Replace ; with : for Linux or Mac OS). javac -cp scroogeCoinGrader.jar;rsa.jar;algs4.jar;. TestMaxFeeTxHandler.java java -cp scroogeCoinGrader.jar;rsa.jar;algs4.jar;. TestMaxFeeTxHandler Note: If you are using IDE like eclipse just add jar files to your build path and create a folder for all text files within the working directory of your code. To import jar file in your Eclipse IDE follow the steps given below. Jar Files: 1) rsa.jar: Contains classes for using RSAKeys 2) algs4.jar: Contains some useful classes like defining priority queues stacks etc. 3) scroogeCoinGrader.java: Contains classes used for grading the submitted files. Requirements: Do the project including Extra credit part dont forget comments for explanation. | .doc file | Java Right click on your project Select Build Path Click on Configure Build Path Click on Libraries and select Add External JARs Select the jar file from the required folder Click and Apply and Ok Right click on your projectSelect Build PathClick on Configure Build PathClick on Libraries and select Add External JARsSelect the jar file from the required folderClick and Apply and Ok

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!
Open chat
1
You can contact our live agent via WhatsApp! Via + 1 3234125597

Feel free to ask questions, clarifications, or discounts available when placing an order.

Order your essay today and save 25% with the discount code CLASS