public class DarcInstance extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ContractId |
| Constructor and Description |
|---|
DarcInstance(ByzCoinRPC bc,
DarcId spawnerDarcId,
Signer spawnerSigner,
Darc newDarc)
Instantiates a new DarcInstance from an existing darc by sending a spawn instruction to
ByzCoin and then creating the instance from the existing darcInstance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
evolveDarc(Darc newDarc,
Signer owner)
Takes a new darc, increases its version, creates an instruction and sends it to ByzCoin, without
waiting an acknowledgement.
|
ClientTransactionId |
evolveDarcAndWait(Darc newDarc,
Signer owner,
int wait)
Asks byzcoin to evolve the darc and waits until the new darc has
been stored in the global state.
|
Instruction |
evolveDarcInstruction(Darc newDarc,
Signer owner,
int pos,
int len)
Creates an instruction to evolve the darc in byzcoin.
|
static DarcInstance |
fromByzCoin(ByzCoinRPC bc,
Darc d)
Instantiates a new DarcInstance given a working ByzCoin service and
an instanceId.
|
static DarcInstance |
fromByzCoin(ByzCoinRPC bc,
DarcId baseId)
Instantiates a new DarcInstance given a working ByzCoin service and
an instanceId.
|
static DarcInstance |
fromByzCoin(ByzCoinRPC bc,
InstanceId id)
Instantiates a new DarcInstance given a working ByzCoin service and
an instanceId.
|
Darc |
getDarc() |
DarcId |
getId() |
Instance |
getInstance() |
DarcInstance |
spawnDarcAndWait(Darc d,
Signer s,
int wait)
Spawns a new darc from the given darcInstance.
|
ClientTransactionId |
spawnInstance(String contractID,
Signer s,
List<Argument> args)
Like spawnInstanceInstruction, but creates a ClientTransaction with only this instruction and sends it
to byzcoin.
|
Proof |
spawnInstanceAndWait(String contractID,
Signer s,
List<Argument> args,
int wait)
Like spawnInstance but waits for the instance to be stored in byzcoin.
|
Instruction |
spawnInstanceInstruction(String contractID,
Signer s,
List<Argument> args,
int pos,
int len)
Creates an instruction for spawning an instance.
|
void |
update()
Update looks up the darc in ByzCoin and updates to the latest version, if available.
|
public static String ContractId
public DarcInstance(ByzCoinRPC bc, DarcId spawnerDarcId, Signer spawnerSigner, Darc newDarc) throws CothorityException
bc - a running ByzCoin servicespawnerDarcId - the darcId of a darc with the rights to spawn new darcsspawnerSigner - the signer with the rights to spawn new darcsnewDarc - the new darc to spawnCothorityException - if something goes wrongpublic void update()
throws CothorityException
CothorityException - if something goes wrongpublic Instruction evolveDarcInstruction(Darc newDarc, Signer owner, int pos, int len) throws CothorityCryptoException
TODO: allow for evolution if the expression has more than one identity.
newDarc - the darc to replace the old darc.owner - must have its identity in the "Invoke_Evolve" rulepos - position of the instruction in the ClientTransactionlen - total number of instructions in the ClientTransactionCothorityCryptoException - if there's a problem with the cryptographypublic void evolveDarc(Darc newDarc, Signer owner) throws CothorityException
newDarc - the new darc, it should have the same version as the current darcowner - a signer allowed to evolve the darcCothorityException - if something goes wrongpublic ClientTransactionId evolveDarcAndWait(Darc newDarc, Signer owner, int wait) throws CothorityException
newDarc - is the new darc to replace the old oneowner - is the owner that can sign to evolve the darcwait - the maximum number of blocks to waitCothorityException - if something goes wrongpublic Instruction spawnInstanceInstruction(String contractID, Signer s, List<Argument> args, int pos, int len) throws CothorityCryptoException
TODO: allow for multi-signatures
contractID - the id of the instance to creates - the signer that is authorized to spawn this instanceargs - arguments to give to the contractpos - position in the ClientTransactionlen - total length of the ClientTransactionCothorityCryptoException - if there's a problem with the cryptographypublic ClientTransactionId spawnInstance(String contractID, Signer s, List<Argument> args) throws CothorityException
contractID - the id of the instance to creates - the signer that is authorized to spawn this contract-typeargs - arguments to give to the contractCothorityException - if something goes wrongpublic Proof spawnInstanceAndWait(String contractID, Signer s, List<Argument> args, int wait) throws CothorityException
contractID - the id of the instance to creates - the signer that is authorized to spawn this contractargs - arguments to give to the contractwait - how many blocks to wait for the instance to be stored (0 = do not wait)CothorityException - if something goes wrongpublic DarcInstance spawnDarcAndWait(Darc d, Signer s, int wait) throws CothorityException
d - the new darc to store on ByzCoins - the signer allowed to spawn a new darcwait - how many blocks to wait. If it is 0, the call returns directlyCothorityException - if something goes wrong if something went wrongpublic DarcId getId() throws CothorityCryptoException
CothorityCryptoException - if there's a problem with the cryptographypublic Darc getDarc() throws CothorityCryptoException
CothorityCryptoException - if there's a problem with the cryptographypublic Instance getInstance()
public static DarcInstance fromByzCoin(ByzCoinRPC bc, InstanceId id) throws CothorityException
bc - is a running ByzCoin ledgerid - of the darc-instance to connect toCothorityException - if something goes wrongpublic static DarcInstance fromByzCoin(ByzCoinRPC bc, DarcId baseId) throws CothorityException
bc - is a running ByzCoin ledger that is runningbaseId - of the darc-instance to connect toCothorityException - if something goes wrongpublic static DarcInstance fromByzCoin(ByzCoinRPC bc, Darc d) throws CothorityException
bc - is a running ByzCoin ledgerd - of which the base id will be taken to search in ByzCoinCothorityException - if somethings goes wrongCopyright © 2018. All rights reserved.