Buidler local node: use a block explorer, execute payable functions in the console, change the address

  1. How can I install some kind of Etherscan, an interface for my local node?

  2. How can I execute payable functions, like this putting the Value in the Builder console?

  3. How can I change the address in the console?

1 Like

Hi @franco_villa_santana,

You could try using Ganache GUI (https://www.trufflesuite.com/docs/ganache/overview). There have been some simple block explorers (though I haven't looked for a couple of years) or you could even run BlockScout but I just deploy to a public testnet and use Etherscan.

Buidler is now Hardhat (https://hardhat.org/)

I don't know how to do this in Buidler. I will need to come back to you on this.

Which address are you referring to?


I recommend creating a topic per question, so that it is easier for the community to answer and for future community members to use as a knowledge base.

Hi @franco_villa_santana,

To send value of x wei in the console we can pass it using {value: x}

$ npx buidler console --network localhost
All contracts have already been compiled, skipping compilation.
> const MyContract = await ethers.getContractFactory("MyContract")
undefined
> const myContract = await MyContract.attach("0x7c2C195CD6D34B8F845992d380aADB2730bB9C6F")
undefined
> await myContract.doStuff({value:1})
{ hash:

MyContract.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

contract MyContract {
    // Emitted when value received
    event Received(uint256 value);

    // Stores a new value in the contract
    function doStuff() public payable {
        emit Received(msg.value);
    }
}