public class ValueInstance extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ContractId |
| Constructor and Description |
|---|
ValueInstance(ByzCoinRPC bc,
DarcId spawnerDarcId,
Signer spawnerSigner,
byte[] value)
Instantiates a new value in ByzCoin by sending a spawn instruction to a darc
that has a "spawn:value" rule in it.
|
| Modifier and Type | Method and Description |
|---|---|
void |
evolveValue(byte[] newValue,
Signer owner) |
void |
evolveValueAndWait(byte[] newValue,
Signer owner,
int wait)
Asks byzcoin to update the value and waits until the new value has
been stored in the global state.
|
Instruction |
evolveValueInstruction(byte[] newValue,
Signer owner,
int pos,
int len)
Creates an instruction to evolve the value in byzcoin.
|
static ValueInstance |
fromByzcoin(ByzCoinRPC bc,
InstanceId id)
Instantiates a new ValueInstance given a working byzcoin service and
an instanceId.
|
static ValueInstance |
fromByzcoin(ByzCoinRPC bc,
Proof p)
Convenience function to connect to an existing ValueInstance.
|
InstanceId |
getId() |
Instance |
getInstance() |
byte[] |
getValue() |
void |
update()
Updates the value by getting the latest instance and updating it.
|
public static String ContractId
public ValueInstance(ByzCoinRPC bc, DarcId spawnerDarcId, Signer spawnerSigner, byte[] value) throws CothorityException
bc - a running ByzCoin servicespawnerDarcId - a darc Id with a "spawn:value" rule in itspawnerSigner - a signer having the right to sign for the "spawn:value" rulevalue - the value to store in the instanceCothorityException - if something goes wrongpublic void update()
throws CothorityException
CothorityException - if something goes wrongpublic Instruction evolveValueInstruction(byte[] newValue, Signer owner, int pos, int len) throws CothorityCryptoException
TODO: allow for evolution if the expression has more than one identity.
newValue - the value to replace the old value.owner - must have its identity in the "invoke:update" rulepos - position of the instruction in the ClientTransactionlen - total number of instructions in the ClientTransactionCothorityCryptoException - if there's a problem with the cryptographypublic void evolveValue(byte[] newValue,
Signer owner)
throws CothorityException
CothorityExceptionpublic void evolveValueAndWait(byte[] newValue,
Signer owner,
int wait)
throws CothorityException
newValue - the value to replace the old value.owner - is the owner that can sign to evolve the darcwait - how many blocks to wait for inclusion of the instructionCothorityException - if something goes wrongpublic InstanceId getId()
public byte[] getValue()
public Instance getInstance()
public static ValueInstance fromByzcoin(ByzCoinRPC bc, InstanceId id) throws CothorityException
bc - is a running ByzCoin serviceid - of the value-instance to connect toCothorityException - if something goes wrongpublic static ValueInstance fromByzcoin(ByzCoinRPC bc, Proof p) throws CothorityException
bc - a running ByzCoin servicep - the proof for the valueInstanceCothorityException - if something goes wrongCopyright © 2018. All rights reserved.