当我运行流程时,我确实收到一条完成的消息,但是当我查询库时,那里没有任何交易。我无法弄清楚我在做什么错。上周相同的代码正常工作。 我正在尝试将“ Hello”发送到另一个节点。类似于YO cordaAPP
这是我的流程课程
package java_bootcamp;
import co.paralleluniverse.fibers.Suspendable;
import net.corda.core.flows.*;
import net.corda.core.identity.Party;
import net.corda.core.transactions.SignedTransaction;
import net.corda.core.transactions.TransactionBuilder;
import net.corda.core.utilities.ProgressTracker;
/* Our flow, automating the process of updating the ledger.
* See src/main/java/examples/IAmAFlowPair.java for an example. */
@InitiatingFlow
@StartableByRPC
public class TokenIssueFlow extends FlowLogic<SignedTransaction> {
private final ProgressTracker progressTracker = new ProgressTracker();
private final Party receiver;
private final String text;
public TokenIssueFlow(Party receiver, String text) {
this.receiver = receiver;
this.text = text;
}
@Override
public ProgressTracker getProgressTracker() {
return progressTracker;
}
@Suspendable
@Override
public SignedTransaction call() throws FlowException {
// We choose our transaction's notary (the notary prevents double-spends).
Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
// We get a reference to our own identity.
Party issuer = getOurIdentity();
/* ============================================================================
* TODO 1 - Create our TokenState to represent on-ledger tokens!
* ===========================================================================*/
// We create our new TokenState.
TokenState tokenState = new TokenState(issuer,receiver,text);
/* ============================================================================
* TODO 3 - Build our token issuance transaction to update the ledger!
* ===========================================================================*/
// We build our transaction.
TransactionBuilder transactionBuilder = new TransactionBuilder(notary);
transactionBuilder.addCommand(new TokenContract.Issue(),issuer.getOwningKey());
transactionBuilder.addOutputState(tokenState,TokenContract.ID);
/* ============================================================================
* TODO 2 - Write our TokenContract to control token issuance!
* ===========================================================================*/
// We check our transaction is valid based on its contracts.
transactionBuilder.verify(getServiceHub());
// We sign the transaction with our private key, making it immutable.
SignedTransaction signedTransaction = getServiceHub().signInitialTransaction(transactionBuilder);
// We get the transaction notarised and recorded automatically by the platform.
return subFlow(new FinalityFlow(signedTransaction));
}
}
答案 0 :(得分:1)
向大家道歉。我没有注意。 在运行vaultQuery时,我将FLOW类指定为STATE类。
以前 运行vaultQuery contractStateType:com.template.HelloFlow:
正确方式: 运行vaultQuery contractStateType:java_bootcamp.TokenState