fisco bcos キャリパー展開エラー

蔙误1、デポリエラー: エラー: 文字列をバッファに変換できません。toBuffer は 0x の接頭辞が付いた 16 進文字列のみをサポートしており、この文字列が指定されました

2023.04.12-19:28:39.062 error [caliper] [installSmartContract.js]       Depolying error: Error: Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: 7611fa175dd54150b1aa8784b1bc6444
2023.04.12-19:28:39.062 error [caliper] [installSmartContract.js]       Failed to install smart contract helloworld, path=/root/benchmarks/caliper-benchmarks/src/fisco-bcos/helloworld/HelloWorld.sol

ソースコードの処理を変更する必要がある

変更 1: https://github.com/hyperledger/caliper/pull/677/files :

画像-20230412194119731

変更 2: https://github.com/hyperledger/caliper/pull/647/files

画像-20230412194148756

注意 2:デポリイング エラー: TypeError: secp256k1.sign は関数ではありません

2023.04.12-19:37:53.799 error [caliper] [installSmartContract.js]       Depolying error: TypeError: secp256k1.sign is not a function
2023.04.12-19:37:53.799 error [caliper] [installSmartContract.js]       Failed to install smart contract helloworld, path=/root/benchmarks/caliper-benchmarks/src/fisco-bcos/helloworld/HelloWorld.sol
2023.04.12-19:37:53.799 error [caliper] [fiscoBcos.js]  FISCO BCOS smart contract install failed: TypeError: secp256k1.sign is not a function
    at Object.ecsign (/root/benchmarks/node_modules/@hyperledger/caliper-fisco-bcos/lib/web3lib/utils.js:141:29)
    at Transaction.sign (/root/benchmarks/node_modules/@hyperledger/caliper-fisco-bcos/lib/web3lib/transactionObject.js:272:23)
    at signTransaction (/root/benchmarks/node_modules/@hyperledger/caliper-fisco-bcos/lib/web3lib/web3sync.js:42:8)
    at Object.getSignDeployTx (/root/benchmarks/node_modules/@hyperledger/caliper-fisco-bcos/lib/web3lib/web3sync.js:121:12)
    at Object.module.exports.deploy (/root/benchmarks/node_modules/@hyperledger/caliper-fisco-bcos/lib/fiscoBcosApi.js:165:27)
    at <anonymous>

これは愚かなバグで、secp256k1 の依存パッケージを指定する際にバージョン制限が正しく書かれておらず、バインディング時にバージョン 4.0 のパッケージが自動的にインストールされるのですが、最新の 4.0 パッケージの API がすべて変更されておりsecp256k1、実行エラー。

一時的な解決策としては、node_modules/@hyperledger/caliper-fisco-bcosディレクトリに入り、このディレクトリ内のファイルを編集しpackage.json、「依存関係」に項目を追加して"secp256k1": "^3.8.0"、このディレクトリ内で実行することnpm iで、更新が完了するとテストプログラムを起動できるようになります。

おすすめ

転載: blog.csdn.net/dzdzdzd12347/article/details/130249566