public class ValueInstance extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ContractId |
| Constructor and Description |
|---|
ValueInstance(ByzCoinRPC bc,
DarcId spawnerDarcId,
Signer spawnerSigner,
Long signerCtr,
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,
Long ownerCtr)
Asks byzcoin to update the value but does not wait for the transaction to be confirmed.
|
void |
evolveValueAndWait(byte[] newValue,
Signer owner,
Long ownerCtr,
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,
Identity owner,
Long signerCtr)
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, Long signerCtr, 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" rulesignerCtr - the monotonically increasing counters for the spawnSignervalue - the value to store in the instanceCothorityException - if something goes wrongpublic void update()
throws CothorityException
CothorityException - if something goes wrongpublic Instruction evolveValueInstruction(byte[] newValue, Identity owner, Long signerCtr)
TODO: allow for evolution if the expression has more than one identity.
newValue - the value to replace the old value.signerCtr - the monotonically increasing counters which must map to the signers who will
eventually sign the instructionCothorityCryptoException - if there's a problem with the cryptographypublic void evolveValue(byte[] newValue,
Signer owner,
Long ownerCtr)
throws CothorityException
newValue - the value to replace the old value.owner - is the owner that can sign to evolve the darcownerCtr - the monotonically increasing counters for the ownerCothorityException - if something goes wrongpublic void evolveValueAndWait(byte[] newValue,
Signer owner,
Long ownerCtr,
int wait)
throws CothorityException
newValue - the value to replace the old value.owner - is the owner that can sign to evolve the darcownerCtr - the monotonically increasing counters for the ownerwait - 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 © 2019. All rights reserved.