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)

  • 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

/**
 * 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

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JFrame (javax.swing)
  • Runner (org.openjdk.jmh.runner)
  • Top 12 Jupyter Notebook Extensions
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