2017-07-27 5 views

答えて

5

全てのシステムchaincodesは、特定のVSCC及びESCCにおいて、Chaincodeインタフェースを実装しなければなりません。さらに、彼らは例えば、chaincodeセクション内core.yamlファイルで有効にする必要があります。

chaincode: 

    # system chaincodes whitelist. To add system chaincode "myscc" to the 
    # whitelist, add "myscc: enable" to the list below, and register in 
    # chaincode/importsysccs.go 
    system: 
     cscc: enable 
     lscc: enable 
     escc: enable 
     vscc: enable 
     qscc: enable 

次へ]を、あなたはあなたのchaincodeをインスタンス化し、あなたがLSCCに自分の名前を提供する必要があるカスタムVSCCとESCCを提供したいと思います。たとえば、ピアCLIを使用する場合は、次のようにしてください。

peer chaincode instantiate -o localhost:7050 -n myCC -v 1.0 -C mychannel -c '{"Args": ["init"]}' --vscc myVSCC --escc myESCC 
2

VSCCとESCCはシステムチェーンコードであり、インターフェイスはチェーンコードとまったく同じですので、チェーンコードドキュメントを参照するか、VSCC source codeにアクセスしてください。独自の検証システムチェーンコードを追加し、チェーンコードと関連付けることができます。

システムチェーンコードは、ピア実行可能ファイルで構築され、トランザクションインストール/インスタンス化プロセスを実行しません。ピアが起動されるとロードされるため、core/scc/importsysccs.goに何らかの登録が必要です。 systemChaincodes変数を見てください。あなたは他人の登録方法を知ることができます。すべてのシステムchaincodes静的ピア・コードにコンパイルされ、ファイルにリストされているとき

// Chaincode interface must be implemented by all chaincodes. The fabric runs 
// the transactions by calling these functions as specified. 
type Chaincode interface { 
    // Init is called during Instantiate transaction after the chaincode container 
    // has been established for the first time, allowing the chaincode to 
    // initialize its internal data 
    Init(stub ChaincodeStubInterface) pb.Response 

    // Invoke is called to update or query the ledger in a proposal transaction. 
    // Updated state variables are not committed to the ledger until the 
    // transaction is committed. 
    Invoke(stub ChaincodeStubInterface) pb.Response 
} 

関連する問題