public class Instruction extends Object
| Constructor and Description |
|---|
Instruction(ByzCoinProto.Instruction inst) |
Instruction(InstanceId instId,
byte[] nonce,
int index,
int length,
Delete delete)
Use this constructor if it is a delete instruction, i.e.
|
Instruction(InstanceId instId,
byte[] nonce,
int index,
int length,
Invoke invoke)
Use this constructor if it is an invoke instruction, i.e.
|
Instruction(InstanceId instId,
byte[] nonce,
int index,
int length,
Spawn spawn)
Use this constructor if it is a spawn instruction, i.e.
|
| Modifier and Type | Method and Description |
|---|---|
String |
action()
Outputs the action of the instruction, this action be the same as an action in the corresponding darc.
|
InstanceId |
deriveId(String what)
This function derives a contract ID from the instruction with the given string.
|
static byte[] |
genNonce()
TODO: define how nonces are used.
|
Delete |
getDelete() |
int |
getIndex() |
InstanceId |
getInstId()
Getter for the instance ID.
|
Invoke |
getInvoke() |
int |
getLength() |
byte[] |
getNonce() |
List<Signature> |
getSignatures() |
Spawn |
getSpawn() |
byte[] |
hash()
This method computes the sha256 hash of the instruction.
|
void |
setSignatures(List<Signature> signatures)
Setter for the signatures.
|
void |
signBy(DarcId darcId,
List<Signer> signers)
Have a list of signers sign the instruction.
|
Request |
toDarcRequest(DarcId darcId)
Converts the instruction to a Darc request representation.
|
ByzCoinProto.Instruction |
toProto()
Converts this object to the protobuf representation.
|
public Instruction(InstanceId instId, byte[] nonce, int index, int length, Spawn spawn)
instId - The instance ID.nonce - The nonce of the object.index - The index of the instruction in the atomic set.length - The length of the atomic set.spawn - The spawn object, which contains the value and the argument.public Instruction(InstanceId instId, byte[] nonce, int index, int length, Invoke invoke)
instId - The ID of the object, which must be unique.nonce - The nonce of the object.index - The index of the instruction in the atomic set.length - The length of the atomic set.invoke - The invoke object.public Instruction(InstanceId instId, byte[] nonce, int index, int length, Delete delete)
instId - The ID of the object, which must be unique.nonce - The nonce of the object.index - The index of the instruction in the atomic set.length - The length of the atomic set.delete - The delete object.public Instruction(ByzCoinProto.Instruction inst) throws CothorityCryptoException
CothorityCryptoExceptionpublic InstanceId getInstId()
public void setSignatures(List<Signature> signatures)
signatures - the signatures to setpublic byte[] hash()
public ByzCoinProto.Instruction toProto()
public String action()
public Request toDarcRequest(DarcId darcId)
darcId - the input darc IDpublic void signBy(DarcId darcId, List<Signer> signers) throws CothorityCryptoException
darcId - - the darcIdsigners - - the list of signers.CothorityCryptoException - if there's a problem with the cryptographypublic InstanceId deriveId(String what) throws CothorityCryptoException
what - - the string that gets mixed into the derived instance IDCothorityCryptoException - if there's a problem with the cryptographypublic byte[] getNonce()
public int getIndex()
public int getLength()
public Spawn getSpawn()
public Invoke getInvoke()
public Delete getDelete()
public static byte[] genNonce()
Copyright © 2018. All rights reserved.