net.corda.confidential.SwapIdentitiesFlow;

ムハンマド・ムバシルラ・ドゥッラーニー

gradlew.batのコンソール出力cleandeployNodesJava

フロークラス(以下のコード)でSwapIdentitiesFlow(owner)を使用した後、プロジェクトが機能しません。Gradleを使用してプロジェクトを再インポートしましたが、何のメリットもありません。それでも次のように表示されます:「エラー:パッケージnet.corda.confidentialが存在しませんimportnet.corda.confidential.SwapIdentitiesFlow ;」

興味深いことに、外部ライブラリには同様の名前のファイルがあります(Gradle:net.corda:corda-confidential-identities:corda-3.0)これとimportステートメントも存在します。

プロジェクトの再インポートが機能しないことを述べたので、他の同様の問題は役に立ちませんでした。最初は、そのクラスで赤い波線が表示されます。そのクラスパスを追加するように求められます。ビルドではエラーは発生しませんが、gradlew.bat ....ではエラーが発生します。

助けてくれてありがとう。

package java_bootcamp;

import co.paralleluniverse.fibers.Suspendable;
import com.google.common.collect.ImmutableList;
import net.corda.confidential.SwapIdentitiesFlow;
import net.corda.core.contracts.StateAndRef;
import net.corda.core.flows.*;
import net.corda.core.identity.AbstractParty;
import net.corda.core.identity.AnonymousParty;
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 java.security.PublicKey;
import java.util.HashMap;
import java.util.List;

@InitiatingFlow
@StartableByRPC
public class BallotTransferFlow extends FlowLogic<SignedTransaction> {
private final Party owner;

public BallotTransferFlow(Party owner)
{
    this.owner = owner;
}

private final ProgressTracker progressTracker = new ProgressTracker();

@Override
public ProgressTracker getProgressTracker() {
    return progressTracker;
}


@Suspendable
public SignedTransaction call() throws FlowException {
    // We get a reference to our own identity.
    AbstractParty issuer = getOurIdentity();

    // We extract all the `VoteStates from the vault.
    List<StateAndRef<VoteState>> voteStateAndRefs = getServiceHub().getVaultService().queryBy(VoteState.class).getStates();

    // We find the `VoteState` of the issuer.
    StateAndRef<VoteState> inputVoteStateAndRef = voteStateAndRefs
            .stream().filter(voteStateAndRef -> {
                VoteState voteState = voteStateAndRef.getState().getData();
                return voteState.getOwner().equals(issuer) && voteState.getVote()==1;
            }).findAny().orElseThrow(() -> new IllegalArgumentException("The Ballot State for this owner was not found."));
    VoteState inputVoteState = inputVoteStateAndRef.getState().getData();


    // We find the `VoteState` of the candidate.
    StateAndRef<VoteState> inputVoteStateAndRef1 = voteStateAndRefs
            .stream().filter(voteStateAndRef -> {
                VoteState voteState = voteStateAndRef.getState().getData();
                return voteState.getOwner().equals(owner);
            }).findAny().orElseThrow(() -> new IllegalArgumentException("The Candidate State for this owner was not found."));
    VoteState oldCandidateState = inputVoteStateAndRef1.getState().getData();


    // We throw an exception if the flow was not started by the ballot's current owner.
    if (!(issuer.equals(inputVoteState.getOwner())))
        throw new IllegalStateException("This flow must be started by the current owner.");

    // We use the notary used by the input state.
    Party notary = inputVoteStateAndRef1.getState().getNotary();

    // We build a transaction using a `TransactionBuilder`.
    TransactionBuilder txBuilder = new TransactionBuilder(notary);


    VoteContract.Commands.Transfer commandData = new VoteContract.Commands.Transfer();
    final HashMap<Party, AnonymousParty> txKeys = subFlow(new SwapIdentitiesFlow(owner));
    if (txKeys.size() != 2) {
        throw new IllegalStateException("Something went wrong when generating confidential identities.");
    } else if (!txKeys.containsKey(getOurIdentity())) {
        throw new FlowException("Couldn't create our conf. identity.");
    } else if (!txKeys.containsKey(owner)) {
        throw new FlowException("Couldn't create lender's conf. identity.");
    }

    final AnonymousParty anonymousMe = txKeys.get(getOurIdentity());
    final AnonymousParty anonymousLender = txKeys.get(owner);

    // New Candidate State
    VoteState newCandidateState = new VoteState(oldCandidateState.getVote()+1, anonymousLender, anonymousMe);

    txBuilder.addInputState(inputVoteStateAndRef);
    txBuilder.addOutputState(newCandidateState, VoteContract.ID );
    List<PublicKey> requiredSigners = ImmutableList.of(inputVoteState.getOwner().getOwningKey());

    txBuilder.addCommand(commandData, requiredSigners);

    // We check that the transaction builder we've created meets the
    // contracts of the input and output states.
    txBuilder.verify(getServiceHub());


    // We sign the transaction with our private key, making it immutable.
    SignedTransaction signedTransaction = getServiceHub().signInitialTransaction(txBuilder);

    // We get the transaction notarised and recorded automatically by the platform.
    return subFlow(new FinalityFlow(signedTransaction));
}
}
ジョエル

Corda 3以降ファイルのブロックに次のcordaCompile依存関係を追加することでこれを修正できます。dependenciesbuild.gradle

cordaCompile "$corda_release_group:corda-confidential-identities:$corda_release_version"

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Observer node with confidential identities

分類Dev

Is google-services.json confidential?

分類Dev

Is google-services.json confidential?

分類Dev

Is google-services.json confidential?

分類Dev

How confidential are automatic crash reports made by apport?

分類Dev

How to run corda enterprise

分類Dev

tracking the Corda flows

分類Dev

How to create Parties in Corda?

分類Dev

DockerのCorda

分類Dev

How to design a domain model related to confidential documents management?

分類Dev

エンティティ「net.corda.finance.schemas.CashSchemaV1」を登録してください

分類Dev

プラグインの適用に失敗しました[id'net.corda.plugins.cordformation ']

分類Dev

Corda3のJavaOutOfMemoryError

分類Dev

Syntax for Notary change Transaction in Corda

分類Dev

Cross platform RPC integration for Corda?

分類Dev

net.corda.core.flows.UnexpectedFlowEndException-C = GB、L = London、O = NodeAのカウンターパーティフローに内部エラーがあり、終了しました

分類Dev

「シンボル「コードフォーム」を解決できません」がnet.corda.plugins.Cordformのbuild.gradleに表示されます

分類Dev

Corda, TestNet: Is it allowed to modify the X.500 name of a pre-configured Corda node downloaded from https://testnet.corda.network

分類Dev

Corda - Difference between ledger, vault and storage service

分類Dev

Corda 4.0 - Notary in cluster for High availability

分類Dev

CordaでGOSTを使用する

分類Dev

Unresolved reference: bind when building Corda

分類Dev

Corda3のVault用DBSQL

分類Dev

Is there any functionality in Corda Quickstart's Notary node?

分類Dev

How to change the Initiator of a flow within a flow in Corda?

分類Dev

Upload attachment using Corda shell not working?

分類Dev

Corda2からCorda3へのデータの移行

分類Dev

MongoDBのLaravelパスポートからBadMethodCallException "Client :: confidential()"を取得しています

分類Dev

Corda IsRelevant()は回避しますか?

Related 関連記事

  1. 1

    Observer node with confidential identities

  2. 2

    Is google-services.json confidential?

  3. 3

    Is google-services.json confidential?

  4. 4

    Is google-services.json confidential?

  5. 5

    How confidential are automatic crash reports made by apport?

  6. 6

    How to run corda enterprise

  7. 7

    tracking the Corda flows

  8. 8

    How to create Parties in Corda?

  9. 9

    DockerのCorda

  10. 10

    How to design a domain model related to confidential documents management?

  11. 11

    エンティティ「net.corda.finance.schemas.CashSchemaV1」を登録してください

  12. 12

    プラグインの適用に失敗しました[id'net.corda.plugins.cordformation ']

  13. 13

    Corda3のJavaOutOfMemoryError

  14. 14

    Syntax for Notary change Transaction in Corda

  15. 15

    Cross platform RPC integration for Corda?

  16. 16

    net.corda.core.flows.UnexpectedFlowEndException-C = GB、L = London、O = NodeAのカウンターパーティフローに内部エラーがあり、終了しました

  17. 17

    「シンボル「コードフォーム」を解決できません」がnet.corda.plugins.Cordformのbuild.gradleに表示されます

  18. 18

    Corda, TestNet: Is it allowed to modify the X.500 name of a pre-configured Corda node downloaded from https://testnet.corda.network

  19. 19

    Corda - Difference between ledger, vault and storage service

  20. 20

    Corda 4.0 - Notary in cluster for High availability

  21. 21

    CordaでGOSTを使用する

  22. 22

    Unresolved reference: bind when building Corda

  23. 23

    Corda3のVault用DBSQL

  24. 24

    Is there any functionality in Corda Quickstart's Notary node?

  25. 25

    How to change the Initiator of a flow within a flow in Corda?

  26. 26

    Upload attachment using Corda shell not working?

  27. 27

    Corda2からCorda3へのデータの移行

  28. 28

    MongoDBのLaravelパスポートからBadMethodCallException "Client :: confidential()"を取得しています

  29. 29

    Corda IsRelevant()は回避しますか?

ホットタグ

アーカイブ