congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Contract.addSignatureToSeal
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: UniversaBlockchain/universa

/**
 * Add signature to sealed (before) contract. Do not deserializing or changing contract bytes,
 * but will change sealed and hashId.
 *
 * Useful if you got contracts from third-party (another computer) and need to sign it.
 * F.e. contracts that should be sign with two persons.
 *
 * @param privateKey - key to sign contract will with
 */
public void addSignatureToSeal(PrivateKey privateKey) {
  Set<PrivateKey> keys = new HashSet<>();
  keys.add(privateKey);
  addSignatureToSeal(keys);
}
origin: UniversaBlockchain/universa

private static void doSign() throws IOException {
  String source = (String) options.valueOf("sign");
  List<String> names = (List) options.valuesOf("output");
  Contract c = Contract.fromPackedTransaction(Files.readAllBytes(Paths.get(source)));
  if(c != null) {
    keysMap().values().forEach( k -> c.addSignatureToSeal(k));
    String name;
    if(names.size() > 0) {
      name = names.get(0);
    } else {
      String suffix = "_signedby_"+String.join("_",c.getSealedByKeys().stream().map(k->k.getShortAddress().toString()).collect(Collectors.toSet()));
      name = new FilenameTool(source).addSuffixToBase(suffix).toString();
    }
    saveContract(c,name,true,false);
  }
  finish();
}
origin: UniversaBlockchain/universa

    c.addSignatureToSeal(keys);
swapContract.addSignatureToSeal(keys);
origin: UniversaBlockchain/universa

/**
 * Add signature to sealed (before) contract. Do not deserializing or changing contract bytes,
 * but will change sealed and hashId.
 *
 * Useful if you got contracts from third-party (another computer) and need to sign it.
 * F.e. contracts that should be sign with two persons.
 *
 * @param privateKeys - key to sign contract will with
 */
public void addSignatureToSeal(Set<PrivateKey> privateKeys) {
  if (sealedBinary == null)
    throw new IllegalStateException("failed to add signature: sealed binary does not exist");
  keysToSignWith.addAll(privateKeys);
  Binder data = Boss.unpack(sealedBinary);
  byte[] contractBytes = data.getBinaryOrThrow("data");
  for (PrivateKey key : privateKeys) {
    byte[] signature = ExtendedSignature.sign(key, contractBytes);
    addSignatureToSeal(signature,key.getPublicKey());
  }
}
origin: UniversaBlockchain/universa

/**
 * Seal contract to binary. This call adds signatures from {@link #getKeysToSignWith()}
 * @return contract's sealed unicapsule
 */
public byte[] seal() {
  Object forPack = BossBiMapper.serialize(
      Binder.of(
          "contract", this,
          "revoking", revokingItems.stream()
              .map(i -> i.getId())
              .collect(Collectors.toList()),
          "new", newItems.stream()
              .map(i -> i.getId(true))
              .collect(Collectors.toList())
      )
  );
  byte[] theContract = Boss.pack(
      forPack
  );
  List<byte[]> signatures = new ArrayList<>();
  Binder result = Binder.of(
      "type", "unicapsule",
      "version", 3,
      "data", theContract,
      "signatures", signatures
  );
  setOwnBinary(result);
  addSignatureToSeal(keysToSignWith);
  return sealedBinary;
}
origin: UniversaBlockchain/universa

notaryContract.addSignatureToSeal(issuerKeys);
origin: UniversaBlockchain/universa

/**
 * Creates a token contract with possible additional emission.
 * <br><br>
 * The service creates a simple token contract with issuer, creator and owner roles;
 * with change_owner permission for owner, revoke permissions for owner and issuer and split_join permission for owner.
 * Split_join permission has by default following params: "minValue" for min_value and min_unit, "amount" for field_name,
 * "state.origin" for join_match_fields.
 * Modify_data permission has by default following params: fields: "amount".
 * By default expires at time is set to 60 months from now.
 *
 * @param issuerKeys is issuer private keys.
 * @param ownerKeys  is owner public keys.
 * @param amount     is start token number.
 * @param minValue   is minimum token value.
 * @return signed and sealed contract, ready for register.
 */
@Deprecated
public synchronized static Contract createTokenContractWithEmission(Set<PrivateKey> issuerKeys, Set<PublicKey> ownerKeys, BigDecimal amount, BigDecimal minValue) {
  Contract tokenContract = createTokenContract(issuerKeys, ownerKeys, amount, minValue);
  RoleLink issuerLink = new RoleLink("issuer_link", "issuer");
  tokenContract.registerRole(issuerLink);
  HashMap<String, Object> fieldsMap = new HashMap<>();
  fieldsMap.put("amount", null);
  Binder modifyDataParams = Binder.of("fields", fieldsMap);
  ModifyDataPermission modifyDataPermission = new ModifyDataPermission(issuerLink, modifyDataParams);
  tokenContract.addPermission(modifyDataPermission);
  tokenContract.seal();
  tokenContract.addSignatureToSeal(issuerKeys);
  return tokenContract;
}
origin: UniversaBlockchain/universa

c.addSignatureToSeal(keys);
contractHashId.put(c.getTransactional().getId(), c.getId());
c.addSignatureToSeal(keys);
origin: UniversaBlockchain/universa

public synchronized Contract finishSwap_wrongKey(Contract swapContract, Set<PrivateKey> keys, PrivateKey wrongKey) {
  List<Contract> swappingContracts = (List<Contract>) swapContract.getNew();
  // looking for contract that will be own
  for (Contract c : swappingContracts) {
    boolean willBeMine = c.getOwner().isAllowedForKeys(keys);
    System.out.println("willBeMine: " + willBeMine + " " + c.getSealedByKeys().size());
    if(willBeMine) {
      c.addSignatureToSeal(wrongKey);
    }
  }
  swapContract.seal();
  return swapContract;
}
origin: UniversaBlockchain/universa

twoSignContract.addSignatureToSeal(stepaPrivateKeys);
twoSignContract.addSignatureToSeal(martyPrivateKeys);
origin: UniversaBlockchain/universa

c.addSignatureToSeal(wrongKey);
contractHashId = c.getId();
c.addSignatureToSeal(wrongKey);
origin: UniversaBlockchain/universa

swapContract.getNew().get(iHack).getTransactional().getReferences().get(0).contract_id = HashId.createRandom();
swapContract.getNew().get(iHack).seal();
swapContract.getNew().get(iHack).addSignatureToSeal(stepaPrivateKeys);
swapContract.seal();
origin: UniversaBlockchain/universa

newLamborghini.addSignatureToSeal(stepaPrivateKeys);
swapContract.removeAllSignatures();
swapContract.addSignatureToSeal(stepaPrivateKeys);
origin: UniversaBlockchain/universa

twoSignContract.addSignatureToSeal(stepaPrivateKeys);
twoSignContract.addSignatureToSeal(martyPrivateKeys);
origin: UniversaBlockchain/universa

contractImported.addSignatureToSeal(creatorPrivateKey);
contractImported.addSignatureToSeal(TestKeys.privateKey(0));
origin: UniversaBlockchain/universa

newLamborghini.addSignatureToSeal(martyPrivateKeys);
origin: UniversaBlockchain/universa

tokenContract.addSignatureToSeal(issuerKeys);
origin: UniversaBlockchain/universa

swapContract.addNewItems(martyCoinsSplit, stepaCoinsSplit);
swapContract.seal();
swapContract.addSignatureToSeal(martyPrivateKeys);
origin: UniversaBlockchain/universa

shareContract.addSignatureToSeal(issuerKeys);
origin: UniversaBlockchain/universa

notaryContract.addSignatureToSeal(issuerKeys);
com.icodici.universa.contractContractaddSignatureToSeal

Javadoc

Add signature to sealed (before) contract. Do not deserializing or changing contract bytes, but will change sealed and hashId. Useful if you got contracts from third-party (another computer) and need to sign it. F.e. contracts that should be sign with two persons.

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()
  • 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
  • fromPackedTransaction
    Main .unicon read routine. Load any .unicon version and construct a linked Contract with counterpart
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Join (org.hibernate.mapping)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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