caliper icon indicating copy to clipboard operation
caliper copied to clipboard

About whether it is possible to specify an account for testing in Caliper for fisco-bcos

Open roc0723 opened this issue 2 years ago • 1 comments

this is my fisco-bcos.json { "caliper": { "blockchain": "fisco-bcos" }, "fisco-bcos": { "config": { "privateKey": "902df8337bdaecd05377ec646e54305d82d691fc61c14552955737aefab3da42", "account": "0x82a25c9a26cda8600820309dd90b425946a0003b" }, "network": { "nodes": [ { "ip": "127.0.0.1", "rpcPort": "8545", "channelPort": "20200" }, { "ip": "127.0.0.1", "rpcPort": "8546", "channelPort": "20201" }, { "ip": "127.0.0.1", "rpcPort": "8547", "channelPort": "20202" }, { "ip": "127.0.0.1", "rpcPort": "8548", "channelPort": "20203" } ],

I want to repeat a certain API test using this account, but when I was debugging, I found out that it always ends up having a random user send the transaction. When I debugged this method and checked the hexadecimal private key passed in, it was correct. I thought this was the final step to generate the signature, and then send the transaction based on the signature. However, after sending the transaction and checking the block, all users appeared to be random.

`/**

  • Sign a transaction with private key and callback

  • @param {String} txData transaction data

  • @param {Buffer} privKey private key

  • @param {callback} callback callback function

  • @return {String} signed transaction data */ function signTransaction(txData, privKey, callback) { let tx = new Transaction(txData); let privateKey = Buffer.from(privKey, 'hex');

    tx.sign(privateKey);

    // Build a serialized hex version of the tx let serializedTx = '0x' + tx.serialize().toString('hex'); if (callback !== null) { callback(serializedTx); } else { return serializedTx; } }

` in /node_modules/@hyperledger/caliper-fisco-bcos/lib/web3lib/web3sync.js

roc0723 avatar Apr 21 '23 04:04 roc0723

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 08 '23 06:06 stale[bot]

Closing as fisco-bcos is unsupported. Available as is only now.

davidkel avatar Apr 10 '24 17:04 davidkel