Using Truffle
npm install -g trufflemkdir metacoin
cd metacoin
truffle unbox metacoin
npm install --save-dev @truffle/hdwallet-providerconst HDWalletProvider = require('@truffle/hdwallet-provider');
const mnemonic = '<ADD-YOUR-MNEMONIC-HERE>';
const privateKeyTest = '<ADD-YOUR-PRIVATE-KEY-HERE>';
module.exports = {
networks: {
testnet: {
provider: () => {
return new HDWalletProvider({
mnemonic,
providerOrUrl: 'https://api.s0.b.hmny.io', // https://api.s0.t.hmny.io for mainnet
derivationPath: `m/44'/1023'/0'/0/`
});
},
network_id: 1666700000, // 1666600000 for mainnet
},
testnetHar: {
provider: () => {
if (!privateKeyTest.trim()) {
throw new Error(
'Please enter a private key with funds, you can use the default one'
);
}
return new HDWalletProvider({
privateKeys: [privateKeyTest],
providerOrUrl: 'https://api.s0.b.hmny.io',
});
},
network_id: 1666700000,
},
},
compilers: {
solc: {
version: "0.8.13", // Fetch exact version from solc-bin
}
}
};Last updated
Was this helpful?