OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

hardhat ignition with script working with testnet but failed with localhost node network

  • Thread starter Thread starter Refaldy Bagas Anggana
  • Start date Start date
R

Refaldy Bagas Anggana

Guest
when i run with testnet i get this

(https://i.sstatic.net/7ozQi2Se.png)

but when i run with localhost node i get this

(https://i.sstatic.net/vkpQq4o7.png)

and this is my node console when i using localhost node network

(https://i.sstatic.net/X6jS0scg.png)

this is my deploy.js code

Code:
const SimpleStorage = require('../ignition/modules/SimpleStorage');

async function main() {
  console.log('Deploying contract...');
  const { simpleStorage } = await hre.ignition.deploy(SimpleStorage);
  console.log(`SimpleStorage deployed to: ${await simpleStorage.getAddress()}`);

  const currentValue = await simpleStorage.retrieve();
  const currentValueToString = currentValue.toString();

  console.log(`Current value is: ${currentValueToString}`);

  console.log('Updating value...');
  const transactionResponse = await simpleStorage.store(4);
  await transactionResponse.wait();

  const updatedValue = await simpleStorage.retrieve();
  const updatedValueToString = updatedValue.toString();

  console.log(`Updated value is: ${updatedValueToString}`);
}

main().catch(console.error);

i already read this documentation but it not helping

https://hardhat.org/hardhat-network/docs/overview

<p>when i run with testnet i get this</p>
<p>(<a href="https://i.sstatic.net/7ozQi2Se.png" rel="nofollow noreferrer">https://i.sstatic.net/7ozQi2Se.png</a>)</p>
<p>but when i run with localhost node i get this</p>
<p>(<a href="https://i.sstatic.net/vkpQq4o7.png" rel="nofollow noreferrer">https://i.sstatic.net/vkpQq4o7.png</a>)</p>
<p>and this is my node console when i using localhost node network</p>
<p>(<a href="https://i.sstatic.net/X6jS0scg.png" rel="nofollow noreferrer">https://i.sstatic.net/X6jS0scg.png</a>)</p>
<p>this is my deploy.js code</p>
<pre class="lang-js prettyprint-override"><code>const SimpleStorage = require('../ignition/modules/SimpleStorage');

async function main() {
console.log('Deploying contract...');
const { simpleStorage } = await hre.ignition.deploy(SimpleStorage);
console.log(`SimpleStorage deployed to: ${await simpleStorage.getAddress()}`);

const currentValue = await simpleStorage.retrieve();
const currentValueToString = currentValue.toString();

console.log(`Current value is: ${currentValueToString}`);

console.log('Updating value...');
const transactionResponse = await simpleStorage.store(4);
await transactionResponse.wait();

const updatedValue = await simpleStorage.retrieve();
const updatedValueToString = updatedValue.toString();

console.log(`Updated value is: ${updatedValueToString}`);
}

main().catch(console.error);

</code></pre>
<p>i already read this documentation but it not helping</p>
<p><a href="https://hardhat.org/hardhat-network/docs/overview" rel="nofollow noreferrer">https://hardhat.org/hardhat-network/docs/overview</a></p>
 

Latest posts

Top