Branch: contracts
Module: client
Implement the Contract class in Contract.java. The class is based off of the Contract struct in Project Aurum.
The Contract Class will have the following instance variables.
- Version: An unsigned 16 bit integer.
- Sender Public Key: This will be have a type of
org.bouncycastle.crypto.params.ECPublicKeyParameters. Look at the Contract test to see an example.
- Signature: an array of bytes
- Recipient Public Key hash: an array of bytes.
- Value: an unsigned 64 bit int (use
java.math.BigInteger for this)
- State nonce: an unsigned 64 bit int (once again use
BigInteger for this)
All values must be valid (ex: version cannot be negative or exceed 2^16), so you will have to check these values and throw an IllegalArgumentException.
There should be the following getter functions:
BigInteger getValue();
BigInteger getStateNonce();
ECPublicKeyParameters getPublicKey();
byte[] getRecipientPublicKeyHash();
byte[] getSignature();
int getVersion();
The following setter functions:
setValue(String);
setStateNonce(String);
setSignature(byte[])
setVersion(int)
setRecipientPublicKeyHash(byte[])
setPublicKey(ECPublicKeyParameters)
Also have the following function
that returns true if signature is not null.
NOTE: Pass in strings for value and state nonce, so internally they can be passed into BigInteger. Look at
|
this.value = new BigInteger(value, 10); |
as an example.
All unit tests must pass (run .\gradlew test).
If you have any questions, don't be afraid to ask me.
Branch:
contractsModule:
clientImplement the Contract class in
Contract.java. The class is based off of the Contract struct in Project Aurum.The Contract Class will have the following instance variables.
org.bouncycastle.crypto.params.ECPublicKeyParameters. Look at the Contract test to see an example.java.math.BigIntegerfor this)BigIntegerfor this)All values must be valid (ex: version cannot be negative or exceed 2^16), so you will have to check these values and throw an IllegalArgumentException.
There should be the following getter functions:
The following setter functions:
Also have the following function
that returns true if signature is not null.
NOTE: Pass in strings for value and state nonce, so internally they can be passed into BigInteger. Look at
project_red/client/src/main/java/sigblockchain/projectred/client/Contract.java
Line 22 in dcc7b21
All unit tests must pass (run
.\gradlew test).If you have any questions, don't be afraid to ask me.