Developers Forum for XinFin XDC Network

Discussion on: How to migrate any Dapp from Ethereum to XDC Network using Truffle

Collapse
hasha_netha profile image
Harshavardhan Gurram

Hey. Great one though.

I get this error while following the tutorial.
Error: Given address "xdc0000000000000000000000000000000000000000" is not a valid Ethereum address.

This is my config file

"use strict"
var HDWalletProvider = require("truffle-hdwallet-provider"); var mnemonic = "MNEMONIC"; module.exports = {
networks: {
development: {
provider: () => new HDWalletProvider(
mnemonic,
"127.0.0.1:8545",
),
host: "127.0.0.1",
port: "8545",
network_id: "*", // Match any network id
},
xinfinmainnet: {
provider: () => {
new HDWalletProvider(
mnemonic,
"erpc.xinfin.network",
0,
1,
true,
"m/44'/889'/0'/0/"
);
console.log(HDWalletProvider)
},
network_id: "50",
gas: 2000000,
gasPrice: 25000000000
},
xinfintestnet: {
provider: () => new HDWalletProvider(
mnemonic,
"rpc.apothem.network",
0,
1,
true,
"m/44'/889'/0'/0/",
),
// console.log(wall.wallets);
// console.log(wall.addresses);

// return wall
network_id: "51",
gas: 2000000,
gasPrice: 10000000000000,
networkCheckTimeout: 99999999,
}
},
compilers: {
solc: {
version: "0.8.16", // Fetch exact version from solc-bin (default: truffle's version)
// docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
// settings: { // See the solidity docs for advice about optimization and evmVersion
// optimizer: {
// enabled: false,
// runs: 200
// },
// evmVersion: "byzantium"
// }
}
}

};

Smart Contract File:
// SPDX-License-Identifier:MIT

pragma solidity ^0.8.16;
contract HelloWorld {
function sayHello() public view returns(uint){
return(20);
}
}

2_deploy_contracts.js File

var HelloWorld = artifacts.require("HelloWorld");
module.exports = function(deployer) {
deployer.deploy(HelloWorld, "hello");
// Additional contracts can be deployed here
};