congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Contract.setCreatorKeys
Code IndexAdd Tabnine to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: UniversaBlockchain/universa

/**
 * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy
 * of this contract, with all fields and references correctly set. After this call one need to change mutable
 * fields, add signing keys, seal it and then apss to Universa network for approval.
 *
 * @param keys initially added and signer keys. Role "creator" is set to anonymous ids of these keys
 * @param transactional is {@link Transactional} section to create new revision with
 * @return new revision of this contract, identical to this one, to be modified.
 */
public synchronized Contract createRevisionAnonymously(Collection<?> keys, Transactional transactional) {
  Contract newRevision = createRevision(transactional);
  Set<AnonymousId> aids = new HashSet<>();
  AtomicBoolean returnNull = new AtomicBoolean(false);
  keys.forEach(k -> {
    if (k instanceof AbstractKey)
      aids.add(AnonymousId.fromBytes(((AbstractKey) k).createAnonymousId()));
    else if (k instanceof AnonymousId)
      aids.add((AnonymousId)k);
    else
      returnNull.set(true);
  });
  newRevision.setCreatorKeys(aids);
  if (returnNull.get())
    return null;
  return newRevision;
}
origin: UniversaBlockchain/universa

/**
 * Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contract is a copy
 * of this contract, with all fields and references correctly set. After this call one need to change mutable
 * fields, add signing keys, seal it and then apss to Universa network for approval.
 *
 * @param keys initially added and signer keys. Role "creator" is set to addresses of these keys
 * @param transactional is {@link Transactional} section to create new revision with
 * @return new revision of this contract, identical to this one, to be modified.
 */
public synchronized Contract createRevisionWithAddress(Collection<?> keys, Transactional transactional) {
  Contract newRevision = createRevision(transactional);
  Set<KeyAddress> aids = new HashSet<>();
  AtomicBoolean returnNull = new AtomicBoolean(false);
  keys.forEach(k -> {
    if (k instanceof AbstractKey)
      aids.add(((AbstractKey) k).getPublicKey().getShortAddress());
    else if (k instanceof KeyAddress)
      aids.add((KeyAddress)k);
    else
      returnNull.set(true);
  });
  newRevision.setCreatorKeys(aids);
  if (returnNull.get())
    return null;
  return newRevision;
}
origin: UniversaBlockchain/universa

      SimpleRole role = new SimpleRole("owner", asList(new KeyAddress((String) owners.get(i))));
      partContracts[i].registerRole(role);
      partContracts[i].setCreatorKeys(keysMap().values());
    } catch (KeyAddress.IllegalAddressException e) {
      System.out.println("Not a valid address: " + owners.get(i));
contract.setCreatorKeys(keysMap().values());
origin: UniversaBlockchain/universa

public void asd() throws Exception {
  PrivateKey key = new PrivateKey(Do.read("/Users/romanu/Downloads/ru/roman.uskov.privateKey.unikey"));
  Set<PrivateKey> issuers = new HashSet<>();
  issuers.add(key);
  Set<PublicKey> owners = new HashSet<>();
  owners.add(key.getPublicKey());
  TestSpace testSpace = prepareTestSpace();
  testSpace.nodes.forEach(n->n.config.setIsFreeRegistrationsAllowedFromYaml(true));
  for(int i = 109; i < 110; i++) {
    Contract c = ContractsService.createTokenContract(issuers, owners, new BigDecimal("100000.9"), new BigDecimal("0.01"));
    c.setIssuerKeys(key.getPublicKey().getShortAddress());
    c.setCreatorKeys(key.getPublicKey().getShortAddress());
    c.setExpiresAt(ZonedDateTime.now().plusDays(10));
    c.seal();
    new FileOutputStream("/Users/romanu/Downloads/ru/token"+i+".unicon").write(c.getPackedTransaction());
    assertEquals(testSpace.client.register(Contract.fromPackedTransaction(Do.read("/Users/romanu/Downloads/ru/token"+i+".unicon")).getPackedTransaction(),10000).state,ItemState.APPROVED);
  }
}
origin: UniversaBlockchain/universa

anonSignedContract.setCreatorKeys(stepaAddress);
anonSignedContract.addSignerKey(stepaPrivateKeys.iterator().next());
anonSignedContract.seal();
origin: UniversaBlockchain/universa

anonSignedContract.setCreatorKeys(stepaAnonId);
anonSignedContract.addSignerKey(stepaPrivateKeys.iterator().next());
anonSignedContract.seal();
origin: UniversaBlockchain/universa

@Test
public void jsInContract() throws Exception {
  Contract contract = new Contract(TestKeys.privateKey(0));
  contract.setOwnerKeys(TestKeys.publicKey(1), TestKeys.publicKey(2), TestKeys.publicKey(3));
  contract.setCreatorKeys(TestKeys.publicKey(4), TestKeys.publicKey(5).getLongAddress());
  System.out.println("testKey[10].getShortAddress: " + TestKeys.publicKey(10).getShortAddress().toString());
  System.out.println("testKey[11].getShortAddress: " + TestKeys.publicKey(11).getShortAddress().toString());
  contract.getStateData().set("some_value", HashId.createRandom().toBase64String());
  contract.getStateData().set("some_hash_id", HashId.createRandom());
  String js = "";
  js += "print('hello world');";
  js += "var currentContract = jsApi.getCurrentContract();";
  js += "print('currentContract.getId(): ' + currentContract.getId());";
  js += "print('currentContract.getRevision(): ' + currentContract.getRevision());";
  js += "print('currentContract.getCreatedAt(): ' + currentContract.getCreatedAt());";
  js += "print('currentContract.getOrigin(): ' + currentContract.getOrigin());";
  js += "print('currentContract.getParent(): ' + currentContract.getParent());";
  js += "print('currentContract.getStateDataField(some_value): ' + currentContract.getStateDataField('some_value'));";
  js += "print('currentContract.getStateDataField(some_hash_id): ' + currentContract.getStateDataField('some_hash_id'));";
  js += "print('currentContract.getDefinitionDataField(scripts): ' + currentContract.getDefinitionDataField('scripts'));";
  js += "print('currentContract.getIssuer(): ' + currentContract.getIssuer());";
  js += "print('currentContract.getOwner(): ' + currentContract.getOwner());";
  js += "print('currentContract.getCreator(): ' + currentContract.getCreator());";
  js += "print('call currentContract.setOwner()...');";
  js += "currentContract.setOwner(['ZastWpWNPMqvVJAMocsMUTJg45i8LoC5Msmr7Lt9EaJJRwV2xV', 'a1sxhjdtGhNeji8SWJNPkwV5m6dgWfrQBnhiAxbQwZT6Y5FsXD']);";
  js += "print('currentContract.getOwner(): ' + currentContract.getOwner());";
  contract.getDefinition().setJS(js.getBytes(), "client script.js", new JSApiScriptParameters());
  contract.seal();
  contract.execJS(js.getBytes());
}
origin: UniversaBlockchain/universa

@Test
public void jsInStateAndDefinition() throws Exception {
  Contract contract = new Contract(TestKeys.privateKey(0));
  contract.setOwnerKeys(TestKeys.publicKey(1), TestKeys.publicKey(2), TestKeys.publicKey(3));
  contract.setCreatorKeys(TestKeys.publicKey(4), TestKeys.publicKey(5).getLongAddress());
  String jsDefinitionA = "print('hello world from definition A'); result = 'dA';";
  String jsDefinitionB = "print('hello world from definition B'); result = 'dB';";
  String jsStateA = "print('hello world from state A'); result = 'sA';";
  String jsStateB = "print('hello world from state B'); result = 'sB';";
  contract.getDefinition().setJS(jsDefinitionA.getBytes(), "script1.js", new JSApiScriptParameters(), true);
  contract.getDefinition().setJS(jsDefinitionB.getBytes(), "script2.js", new JSApiScriptParameters(), true);
  contract.getState().setJS(jsStateA.getBytes(), "script3.js", new JSApiScriptParameters(), true);
  contract.getState().setJS(jsStateB.getBytes(), "script4.js", new JSApiScriptParameters(), true);
  contract.seal();
  String res1 = (String)contract.execJSByName("script1.js");
  String res2 = (String)contract.execJSByName("script2.js");
  String res3 = (String)contract.execJSByName("script3.js");
  String res4 = (String)contract.execJSByName("script4.js");
  assertEquals("dA", res1);
  assertEquals("dB", res2);
  assertEquals("sA", res3);
  assertEquals("sB", res4);
}
origin: UniversaBlockchain/universa

@Test
public void issuerTest() throws Exception {
  KeyAddress keyAddress1 = TestKeys.privateKey(0).getPublicKey().getShortAddress();
  KeyAddress keyAddress2 = TestKeys.privateKey(1).getPublicKey().getShortAddress();
  Contract contract = new Contract(TestKeys.privateKey(2));
  contract.setCreatorKeys(keyAddress1);
  contract.setIssuerKeys(keyAddress2);
  contract.addSignerKey(TestKeys.privateKey(0));
  contract.seal();
  assertFalse(contract.check());
  contract.setIssuerKeys(keyAddress1);
  contract.getErrors().clear();
  contract.seal();
  assertTrue(contract.check());
}
origin: UniversaBlockchain/universa

badReferencedContract.setCreatorKeys(TestKeys.privateKey(1));
badReferencedContract.seal();
com.icodici.universa.contractContractsetCreatorKeys

Javadoc

Set "creator" role to given keys

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,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • setContentView (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Menu (java.awt)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Permission (java.security)
    Legacy security code; do not use.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ImageIO (javax.imageio)
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now