use of org.eclipse.winery.accountability.blockchain.ethereum.generated.Provenance in project winery by eclipse.
the class SmartContractProvider method buildProvenanceSmartContract.
public static Provenance buildProvenanceSmartContract(final Web3j web3j, final Credentials credentials, String smartContractAddress) throws BlockchainException {
final Provenance contract = Provenance.load(smartContractAddress, web3j, credentials, DefaultGasProvider.GAS_PRICE, DefaultGasProvider.GAS_LIMIT);
validateSmartContract(contract, smartContractAddress);
return contract;
}
use of org.eclipse.winery.accountability.blockchain.ethereum.generated.Provenance in project winery by eclipse.
the class ContractDeployer method deployProvenance.
/**
* Deploys the provenance smart contract
*
* @return Address of the smart Contract that was deployed
*/
public String deployProvenance() throws Exception {
final StaticGasProvider provider = new DefaultGasProvider();
Provenance provenance = Provenance.deploy(web3j, credentials, provider).send();
LOGGER.debug("Provenance SC Address: " + provenance.getContractAddress());
return provenance.getContractAddress();
}
use of org.eclipse.winery.accountability.blockchain.ethereum.generated.Provenance in project winery by eclipse.
the class ProvenanceSmartContractWrapper method saveState.
public CompletableFuture<String> saveState(final String identifier, final String state) {
LocalDateTime start = LocalDateTime.now();
byte[] compressed = CompressionUtils.compress(state.getBytes());
LOGGER.debug("Compressing fingerprint lasted {}", Duration.between(LocalDateTime.now(), start).toString());
return ((Provenance) contract).addResourceVersion(identifier, compressed).sendAsync().thenApply(TransactionReceipt::getTransactionHash);
}
Aggregations