0
votes

I'm trying to deploy smart contracts in my local Blockchain Network with Hyperledger Besu. But when I'm trying to deploy a smart contract I still get "Wrong chainId" as output..

Here are my config files:

genesis config from Besu:

"config" : {
"chainId" : 1337,
"constantinoplefixblock" : 0,
"ibft2" : {
  "blockperiodseconds" : 2,
  "epochlength" : 30000,
  "requesttimeoutseconds" : 10
}

}

truffle config:

const PrivateKeyProvider = require("@truffle/hdwallet-provider");
// insert the private key of the account used in metamask eg: Account 1 (Miner Coinbase Account)
const privateKeys = [
  '0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3',
  '0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63',
  '0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f'
];

const privateKeyProvider = new PrivateKeyProvider(
  privateKeys,
  'http://127.0.0.1:8545',
  0,
  3
);

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    besuKDO: {
     provider: privateKeyProvider,
     network_id: '*'
    }
  }
}

Migration:

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

Output: [root@mtibesvtc01 pet-shop-box]# truffle migrate --network besuKDO

Compiling your contracts...

Everything is up to date, there is nothing to compile.

Starting migrations...

Network name: 'besuKDO' Network id: 1337 Block gas limit: 16234336 (0xf7b760)

1_initial_migration.js

Deploying 'Migrations'

Error: *** Deployment Failed ***

"Migrations" -- Wrong chainId.

at /root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:365:1
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Migration._deploy (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:74:1)
at Migration._load (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:61:1)
at Migration.run (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
at Object.runMigrations (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
at Object.runFrom (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
at Object.run (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
at runMigrations (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
at Object.run (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:228:1)
at Command.run (/root/.nvm/versions/node/v14.16.1/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:140:1)
2

2 Answers

0
votes

It seems a bug in the truffle HD wallet.. it works when i start my Blockchain with ChainId 1

0
votes

Could you try it with v1.2.6 please and see if you still have issues?

npm install @truffle/[email protected]

The Quorum Dev Quickstart has it now locked to the above version which works. I'll look at the the changelog tomorrow to try and figure out what's broken in the latest version the Truffle HdWallet provider, but the above should get you going

Cheers