Codota Logo
Contract.getKeysToSignWith
Code IndexAdd Codota to your IDE (free)

How to use
getKeysToSignWith
method
in
com.icodici.universa.contract.Contract

Best Java code snippets using com.icodici.universa.contract.Contract.getKeysToSignWith (Showing top 16 results out of 315)

  • Common ways to obtain Contract
private void myMethod () {
Contract c =
  • Codota Iconnew Contract()
  • Codota IconString fileName;Contract.fromDslFile(fileName)
  • Codota IconParcel parcel;parcel.getPaymentContract()
  • Smart code suggestions by Codota
}
origin: UniversaBlockchain/universa

private Contract joinAndRemoveFromContracts(List<Contract> selectedContracts) throws Exception {
  Contract result = selectedContracts.get(0).copy();
  result.getRevokingItems().addAll(selectedContracts);
  this.contracts.removeAll(selectedContracts);
  result.setKeysToSignWith(selectedContracts.get(0).getKeysToSignWith());
  return result;
}
origin: UniversaBlockchain/universa

/**
 * Add contract that already includes all its subItems, referenced items and keys. It will be added as a contract
 * per transaction, while its subItems will be added to subItems if not already included and refrenced items and keys too.
 * <p>
 * This is extremely important that the contract is properly sealed as well as its possibly new items, revoking
 * items and referenced items have binary image attached. <b>Do not ever seal the approved contract</b>:
 * it will break it's id and cancel the approval blockchain, so the new state will not be approved.
 * If it was done by mistake, reload the packed contract to continue.
 *
 * @param c is a contract to append to the list of transactions.
 */
public void setContract(Contract c) {
  if (contract != null)
    throw new IllegalArgumentException("the contract is already added");
  contract = c;
  packedBinary = null;
  extractAllSubItemsAndReferenced(c);
  c.setTransactionPack(this);
  for (PrivateKey key : c.getKeysToSignWith())
    addKeys(key.getPublicKey());
}
origin: UniversaBlockchain/universa

c.setKeysToSignWith(new HashSet<>(getKeysToSignWith()));
origin: UniversaBlockchain/universa

Contract createComplexConctract(PrivateKey key,int subcontracts) {
  Contract root = new Contract(key);
  for(int i = 0; i < subcontracts; i++) {
    Contract c = new Contract(key);
    c.getKeysToSignWith().clear();
    root.addNewItems(c);
  }
  root.seal();
  return root;
}
origin: UniversaBlockchain/universa

  data = contract.getLastSealedBinary();
int count = contract.getKeysToSignWith().size();
if (count > 0)
  report("Contract is sealed with " + count + " key(s)");
origin: UniversaBlockchain/universa

@Test
public void probeFile() throws Exception {
  Contract c = Contract.fromDslFile(rootPath + "simple_root_contract.yml");
  c.addSignerKeyFromFile(rootPath+"_xer0yfe2nn1xthc.private.unikey");
  c.addSignerKeyFromFile(rootPath + "keys/u_key.private.unikey");
  PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
  // let's make this key among owners
  ((SimpleRole)c.getRole("owner")).addKeyRecord(new KeyRecord(goodKey.getPublicKey()));
  c.seal();
  Files.write(Paths.get(basePath + "probeFile.unicon"),c.getPackedTransaction(), StandardOpenOption.CREATE, StandardOpenOption.WRITE);
  System.out.println("---");
  System.out.println("register contract");
  System.out.println("---");
  CLIMain.registerContract(c);
  Thread.sleep(1500);
  System.out.println("---");
  System.out.println("check contract");
  System.out.println("---");
  callMain("--probe-file", basePath + "probeFile.unicon");
  System.out.println(output);
  assertTrue (output.indexOf(ItemState.APPROVED.name()) >= 0);
}
origin: UniversaBlockchain/universa

PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
origin: UniversaBlockchain/universa

Contract c = Contract.fromDslFile(rootPath + "simple_root_contract.yml");
c.addSignerKeyFromFile(rootPath + "_xer0yfe2nn1xthc.private.unikey");
PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
origin: UniversaBlockchain/universa

PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
origin: UniversaBlockchain/universa

c.addSignerKeyFromFile(rootPath+"_xer0yfe2nn1xthc.private.unikey");
c.addSignerKeyFromFile(rootPath + "keys/u_key.private.unikey");
PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
origin: UniversaBlockchain/universa

twoSignContract.getKeysToSignWith().clear();
origin: UniversaBlockchain/universa

  @Test
  public void goodRevoke() throws Exception {
    Contract c = Contract.fromDslFile(rootPath + "simple_root_contract.yml");
    c.addSignerKeyFromFile(rootPath+"_xer0yfe2nn1xthc.private.unikey");
    PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
    c.setOwnerKeys(new KeyRecord(goodKey.getPublicKey()));
    c.seal();

    Contract revokeContract = c.createRevocation(goodKey);

    revokeContract.check();
    assertTrue(revokeContract.isOk());
//        tc.traceErrors();
  }

origin: UniversaBlockchain/universa

PrivateKey goodKey = c.getKeysToSignWith().iterator().next();
origin: UniversaBlockchain/universa

PrivateKey goodKey1 = c1.getKeysToSignWith().iterator().next();
PrivateKey goodKey2 = c2.getKeysToSignWith().iterator().next();
PrivateKey goodKey3 = c3.getKeysToSignWith().iterator().next();
origin: UniversaBlockchain/universa

  @Test
  public void newRevision() throws Exception {
    Contract c = Contract.fromDslFile(ROOT_CONTRACT);
    c.addSignerKeyFromFile(PRIVATE_KEY_PATH);
    byte[] sealed = c.seal();
    assertTrue(c.check());

    Contract c2 = c.createRevision(TestKeys.privateKey(0), TestKeys.privateKey(3));
    assertEquals(1, c2.getRevokingItems().size());
    assertEquals(c, c2.getRevokingItems().iterator().next());
    assertEquals(2, c2.getKeysToSignWith().size());
    assertEquals(2, c2.getRevision());
    assertEquals(c.getId(), c2.getParent());
    assertEquals(c.getId(), c2.getRawOrigin());

    c2.seal();

    Contract c3 = c2.createRevision(TestKeys.privateKey(0), TestKeys.privateKey(3));
    assertEquals(1, c3.getRevokingItems().size());
    assertEquals(c2, c3.getRevokingItems().iterator().next());
    assertEquals(2, c3.getKeysToSignWith().size());
    assertEquals(3, c3.getRevision());
    assertEquals(c2.getId(), c3.getParent());
    assertEquals(c.getId(), c3.getRawOrigin());


//        c2.check();
//        c2.traceErrors();
  }

origin: UniversaBlockchain/universa

martyCoinsSplit.getKeysToSignWith().clear();
martyCoinsSplit.removeAllSignatures();
martyCoinsSplit.seal();
com.icodici.universa.contractContractgetKeysToSignWith

Javadoc

Get private keys contract binary to be signed with when sealed next time. It is called before seal()

Popular methods of Contract

  • <init>
    Extract old, deprecated v2 self-contained binary partially unpacked by the TransactionPack, and fill
  • addNewItems
    Add one or more siblings to the contract. Note that those must be sealed before calling #seal() or #
  • addSignerKey
    Add private key to keys contract binary to be signed with when sealed next time. It is called before
  • getExpiresAt
    Get contract expiration time
  • getId
    Get the id sealing self if need
  • getPackedTransaction
    Pack the contract to the most modern .unicon format, same as TransactionPack#pack(). Uses bounded Tr
  • registerRole
    Register new role. Name must be unique otherwise existing role will be overwritten
  • seal
    Seal contract to binary. This call adds signatures from #getKeysToSignWith()
  • addSignatureToSeal
    Add signature to sealed (before) contract. Do not deserializing or changing contract bytes, but will
  • check
  • createRevision
    Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contr
  • fromDslFile
    Create contract importing its parameters with passed .yaml file. No signatures are added automatical
  • createRevision,
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • KeyStore (java.security)
    This class represents an in-memory collection of keys and certificates. It manages two types of entr
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now