clone the java repo
git clone https://github.com/corda/cordapp-template-java.git ; cd cordapp-template-java
Create the file
cordapp-template-java/cordapp-contracts-states/src/main/java/com/template/IOUState.java
IOUState.java /* import com.google.common.collect.ImmutableList; import net.corda.core.identity.Party;
// Replace TemplateState's definition with: public class IOUState implements ContractState { private final int value; private final Party lender; private final Party borrower;
public IOUState(int value, Party lender, Party borrower) {
this.value = value;
this.lender = lender;
this.borrower = borrower;
}
public int getValue() {
return value;
}
public Party getLender() {
return lender;
}
public Party getBorrower() {
return borrower;
}
@Override
public List<AbstractParty> getParticipants() {
return ImmutableList.of(lender, borrower);
}
}
*/
Create the file IOUFLow.java in directory as
IOUFlow.java /* import net.corda.core.contracts.Command; import net.corda.core.contracts.CommandData; import net.corda.core.identity.Party; import net.corda.core.transactions.SignedTransaction; import net.corda.core.transactions.TransactionBuilder; import net.corda.core.utilities.ProgressTracker;
import static com.template.TemplateContract.TEMPLATE_CONTRACT_ID;
// Replace TemplateFlow's definition with: @InitiatingFlow @StartableByRPC public class IOUFlow extends FlowLogic { private final Integer iouValue; private final Party otherParty;
/**
* The progress tracker provides checkpoints indicating the progress of the flow to observers.
*/
private final ProgressTracker progressTracker = new ProgressTracker();
public IOUFlow(Integer iouValue, Party otherParty) {
this.iouValue = iouValue;
this.otherParty = otherParty;
}
@Override
public ProgressTracker getProgressTracker() {
return progressTracker;
}
/**
* The flow logic is encapsulated within the call() method.
*/
@Suspendable
@Override
public Void call() throws FlowException {
// We retrieve the notary identity from the network map.
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
// We create the transaction components.
IOUState outputState = new IOUState(iouValue, getOurIdentity(), otherParty);
CommandData cmdType = new TemplateContract.Commands.Action();
Command cmd = new Command<>(cmdType, getOurIdentity().getOwningKey());
// We create a transaction builder and add the components.
final TransactionBuilder txBuilder = new TransactionBuilder(notary)
.addOutputState(outputState, TEMPLATE_CONTRACT_ID)
.addCommand(cmd);
// Signing the transaction.
final SignedTransaction signedTx = getServiceHub().signInitialTransaction(txBuilder);
// Finalising the transaction.
subFlow(new FinalityFlow(signedTx));
return null;
}
} */
$ go to library and type on cmd ./gradlew clean deployNodes
Run bash file of deployNodes
Corda web app will start .