public class SecureDarcInstance extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ContractId |
| Constructor and Description |
|---|
SecureDarcInstance(ByzCoinRPC bc,
DarcId spawnerBaseId,
Signer spawnerSigner,
Long signerCtr,
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,
Long ownerCtr)
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,
Long ownerCtr,
int wait)
Asks byzcoin to evolve the darc and waits until the new darc has
been stored in the global state.
|
ClientTransactionId |
evolveDarcAndWait(Darc newDarc,
Signer owner,
Long ownerCtr,
int wait,
boolean unrestricted)
Asks byzcoin to (unrestricted) evolve the darc and waits until the new darc has
been stored in the global state.
|
Instruction |
evolveDarcInstruction(Darc newDarc,
Identity id,
Long signerCtr)
Creates an instruction to evolve the darc in byzcoin.
|
Instruction |
evolveDarcInstruction(Darc newDarc,
Identity id,
Long signerCtr,
boolean unrestricted)
Creates an instruction to (unrestricted) evolve the darc in byzcoin.
|
static SecureDarcInstance |
fromByzCoin(ByzCoinRPC bc,
Darc d)
Instantiates a new DarcInstance given a working ByzCoin service and
an instanceId.
|
static SecureDarcInstance |
fromByzCoin(ByzCoinRPC bc,
DarcId baseId)
Instantiates a new DarcInstance given a working ByzCoin service and
an instanceId.
|
static SecureDarcInstance |
fromByzCoin(ByzCoinRPC bc,
InstanceId id)
Instantiates a new DarcInstance given a working ByzCoin service and
an instanceId.
|
Darc |
getDarc() |
DarcId |
getId() |
Instance |
getInstance() |
SecureDarcInstance |
spawnDarcAndWait(Darc d,
Signer s,
Long signerCounter,
int wait)
Spawns a new darc from the given darcInstance.
|
ClientTransactionId |
spawnInstance(String contractID,
Signer s,
Long signerCtr,
List<Argument> args)
Like spawnInstanceInstruction, but creates a ClientTransaction with only this instruction and sends it
to byzcoin.
|
Proof |
spawnInstanceAndWait(String contractID,
Signer s,
Long signerCtr,
List<Argument> args,
int wait)
Like spawnInstance but waits for the instance to be stored in byzcoin.
|
Instruction |
spawnInstanceInstruction(String contractID,
Identity id,
Long signerCtr,
List<Argument> args)
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 SecureDarcInstance(ByzCoinRPC bc, DarcId spawnerBaseId, Signer spawnerSigner, Long signerCtr, Darc newDarc) throws CothorityException
bc - a running ByzCoin servicespawnerBaseId - the base ID of a darc with the rights to spawn new darcsspawnerSigner - the signer with the rights to spawn new darcssignerCtr - the monotonically increasing counters for the spawnSignernewDarc - the new darc to spawnCothorityException - if something goes wrongpublic void update()
throws CothorityException
CothorityException - if something goes wrongpublic Instruction evolveDarcInstruction(Darc newDarc, Identity id, Long signerCtr)
newDarc - the darc to replace the old darc, the version, prevID and baseID attributes are ignored and set
automatically by this functionsignerCtr - is the monotonically increasing counter which must match the signer who will eventually
sign the returned instruction.public Instruction evolveDarcInstruction(Darc newDarc, Identity id, Long signerCtr, boolean unrestricted)
newDarc - the darc to replace the old darc, the version, prevID and baseID attributes are ignored and set
automatically by this functionsignerCtr - is the monotonically increasing counter which must match the signer who will eventually
sign the returned instruction.unrestricted - whether to use the unrestricted evolutionpublic void evolveDarc(Darc newDarc, Signer owner, Long ownerCtr) throws CothorityException
newDarc - the new darc, the version, prevID and baseID attributes are ignored and set
automatically by this functionowner - a signer allowed to evolve the darcownerCtr - a monotonically increasing counter which must map to the ownersCothorityException - if something goes wrongpublic ClientTransactionId evolveDarcAndWait(Darc newDarc, Signer owner, Long ownerCtr, int wait) throws CothorityException
newDarc - the darc to replace the old darc, the version, prevID and baseID attributes are ignored and set
automatically by this functionowner - is the owner that can sign to evolve the darcownerCtr - a monotonically increasing counter which must map to the ownerswait - the maximum number of blocks to waitCothorityException - if something goes wrongpublic ClientTransactionId evolveDarcAndWait(Darc newDarc, Signer owner, Long ownerCtr, int wait, boolean unrestricted) throws CothorityException
newDarc - the darc to replace the old darc, the version, prevID and baseID attributes are ignored and set
automatically by this functionowner - is the owner that can sign to evolve the darcownerCtr - a monotonically increasing counter which must map to the ownerswait - the maximum number of blocks to waitunrestricted - whether to use the unrestricted evolutionCothorityException - if something goes wrongpublic Instruction spawnInstanceInstruction(String contractID, Identity id, Long signerCtr, List<Argument> args)
TODO: allow for multi-signatures
contractID - the id of the instance to createsignerCtr - the next counter which the signer should useargs - arguments to give to the contractpublic ClientTransactionId spawnInstance(String contractID, Signer s, Long signerCtr, List<Argument> args) throws CothorityException
contractID - the id of the instance to creates - the signer that is authorized to spawn this contract-typesignerCtr - a monotonically increasing counter which must map to the signer sargs - arguments to give to the contractCothorityException - if something goes wrongpublic Proof spawnInstanceAndWait(String contractID, Signer s, Long signerCtr, List<Argument> args, int wait) throws CothorityException
contractID - the id of the instance to creates - the signer that is authorized to spawn this contractsignerCtr - a monotonically increasing counter which must map to the signer sargs - 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 SecureDarcInstance spawnDarcAndWait(Darc d, Signer s, Long signerCounter, 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()
public Darc getDarc()
public Instance getInstance()
public static SecureDarcInstance 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 SecureDarcInstance 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 SecureDarcInstance 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 © 2019. All rights reserved.