#StackBounty: #go-ethereum Looking for peer forever trying to connect peer from another VM

Bounty: 100

I have a virtual machine with VB where I have three nodes of ethereum the node Node01 is the miner and the rest are peers of it. They are interconnected between them and I can connect via rcp from Remix, deploy contracts, make calls to their functions, and from eth-scan see how blocks are being mined. Inside this machine everything is working. I have the following ports mapped to be able to access from my physical machine and from a second VM.


Now once everything is working from the same virtual machine. I am trying to connect a fourth node to the network from a second VM, for this I have copied the contents of the genesis file of the first machine and I have initialized the peer. Then I have launched geth and I have launched this command with the enode address of the Node01 machine (the one I used to connect the Node02 and Node03 machine). In the other ssh terminal, after launching the command with the enode as a parameter, the terminal shows me constant attempts to search for peer without satisfactory results.

geth --datadir "/home/user/test-network/node04" init "/home/user/test-network/genesis.json"
geth --identity "node04" --allow-insecure-unlock --rpc --rpcaddr "" --rpcport "8003" --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner,admin" --http --datadir "/home/user/test-network/node04" --port "30306" --nodiscover --networkid 1900 --nat "any"
geth attach

> admin.addPeer("enode://e33253033fcb3689ced690f492c25feccba0cb8af33fb1f8fdea91787e1bc1bd272959aba601d4a9704048e11abcb1e027ab91106ef4df31102842c183aaf659@")

Response from Node04

These are the open ports from the second VM


At this moment it does not connect with the Node01 peer and is constantly making requests. I read that it could be for some of the reasons that I will put below, and then I even have doubts whether I have the correct ports redirected, but no matter how hard I look, I would say that they are correct.

  • Discrepancy in the time of the machines
  • Ports configuration error

What I can be doing wrong? I leave an image with the summary of the network


Get this bounty!!!

#StackBounty: #go-ethereum #contract-deployment #ethereum-classic #hardforks #blockchain-fork Would it be possible to create a fork of …

Bounty: 50

I would like to know if it would be possible to create a Fork of Ethereum or Ethereum Classic where only few smart contracts can be deployed?

The goal is to create a fork and launch a brand new blockchain but I would like to limit the possibility to deploy smart contracts.

Do you think there is a way to make it possbile?
I thought about using a config file where the community would set the smart contracts hashs able to be deployed? But it is not possible to get a hash of a smart contract before it is deployed on mainnet right?
Or maybe by acting on the gas fee and make it prohibitive, and then create a rule that would lower the gas fee? Or just setting a very high fee for smart contract deployment so that only the smart contracts that gather community consensus and fund raising can be deployed?

Plus I want my chain to be proof of work. Would you recommend to fork Ethereu Classic or Ethereum? Because Ethereum has been implementing none reversible changes towards proof of stake for some time.

Thank you very much for your help!

Best regards

Get this bounty!!!

#StackBounty: #solidity #go-ethereum #contract-development #contract-invocation #opcode does using external over public in a library re…

Bounty: 100

I have a library


library Utils {
   struct UtilType {
      unit var1;
      bool var2;

  function addExtra(UtilType storage state, uint extra) public {
    state.var1 += extra;

notice the public visibility on addExtra function in utils.sol library.
and that function is being used as follows:


import "utils.sol"
contract MyContract {
   using Utils for UtilsType;
   UtilsType state;

  function foo(uint extra) public {
  1. will changing public to external in myutils.sol reduce external function call overhead and save any gas?
  2. if so, does the gas savings only occur due to uint variable and not struct type since it’s a storage memory?

Get this bounty!!!

#StackBounty: #go-ethereum #synchronization #genesis #bsc #binance What should be done first: extract snapshot or create genesis?

Bounty: 50

documentation describes a method of accelerating creation of a full-node using a snapshot.

However, it is not clear in which order these commands should be executed and if it makes any difference:

geth --datadir /srv/node init genesis.json
unzip geth.zip -d /srv/node/


unzip geth.zip -d /srv/node/
geth --datadir /srv/node init genesis.json

It is also not clear if there are any special attributes that should be used when syncing node using snapshot.

This is what I am using at the moment:

  --syncmode snap 
  --config ./config.toml 
  --datadir /srv/node 
  --cache 18000 
  # https://blog.ethereum.org/2021/03/03/geth-v1-10-0/
  --txlookuplimit 0 
  --ipcpath /srv/geth.ipc

Get this bounty!!!

#StackBounty: #go-ethereum #mining #etherscan #gas-limit #configuration Explain the relation between geth –miner.gaslimit and ethersca…

Bounty: 50

Geth command-line options

I am looking at geth command-line options for miners, specifically:

--miner.gastarget value
--miner.gaslimit value

The default value for both is 8000000 on Ethereum according to the documentation. However, I do not understand the documentation description of what they do.

What do these options do exactly when mining blocks?

Etherscan Gas Limit and Gas Used

Blocks on etherscan have a Gas Used and a Gas Limit value. By looking at random blocks, I see that those values are around 12500000. Gas Used is always a percentage of Gas Limit.

What do these values mean exactly?
What is their relation with the above geth options, if any?

You would think that both gas limits are the maximum gas that a block would include, but the value on etherscan does not match the geth default value.

You would also think that gas limit on etherscan is the sum of the gas limit of all the transactions in the block, but I do not think that it is the case.

Thanks for the help.

Get this bounty!!!

#StackBounty: #solidity #go-ethereum #contract-development #truffle #uniswap Transaction exited with an error 0 [pancakeswap]

Bounty: 100

I am trying to make a few transactions on binance test net using a script in solidity and truffle which is a clone of PANCAKESWAP. I was able to successfully compile and execute the script once. When I tried to do it again on different addresses for router and factory it gave me the following error:

StatusError: Transaction: 0xc94424b8c6037e75e0eaf5f21982e2f73f88e71e18e0e5e783c642d6210e686f exited with an error (status 0). 
    at module.exports (D:Blockchainpancakecreatepoolscriptsdeploypool.js:18:18)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  tx: '0xc94424b8c6037e75e0eaf5f21982e2f73f88e71e18e0e5e783c642d6210e686f',
  receipt: {
    blockHash: '0xc4bea040096811e809c18216d85fc82813b60db9545d4e1bf6ab7c4dd344fe87',
    blockNumber: 8023495,
    contractAddress: null,
    cumulativeGasUsed: 699140,
    from: '0xe95745a8f4e3cdb1cf5bffd4a94f0b249e99f489',
    gasUsed: 29046,
    logs: [],
    logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
    status: false,
    to: '0x7632ae832440032fb4ca93e56873a92a01b06e13',
    transactionHash: '0xc94424b8c6037e75e0eaf5f21982e2f73f88e71e18e0e5e783c642d6210e686f',
    transactionIndex: 2,
    rawLogs: []
  reason: undefined,
  hijackedStack: 'StatusError: Transaction: 0xc94424b8c6037e75e0eaf5f21982e2f73f88e71e18e0e5e783c642d6210e686f exited with an error (status 0). n' +
    '     Please check that the transaction:n' +
    '     - satisfies all conditions set by Solidity `require` statements.n' +
    '     - does not trigger a Solidity `revert` statement.n' +
    'n' +
    '    at Object.receipt (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\handlers.js:124:1)n' +
    '    at runMicrotasks (<anonymous>)n' +
    '    at processTicksAndRejections (internal/process/task_queues.js:97:5)n' +
    '    at Function.start (C:\Users\DELL\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\override.js:49:1)'

My truffle-config.js:

//SPDX-License-Identifier: MIT 
var HDWalletProvider = require("truffle-hdwallet-provider");

const infuraKey = process.env.infuraKey;
const mnemonic = process.env.mnemonic;

module.exports = {

  networks: {
    // Useful for testing. The `development` name is special - truffle uses it by default
    // if it's defined here and no other network is specified at the command line.
    // You should run a client (like ganache-cli, geth or parity) in a separate terminal
    // tab if you use this network and you must also set the `host`, `port` and `network_id`
    // options below to some value.
    development: {
      host: "",     // Localhost (default: none)
      port: 8545,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
    rinkeby: {
      provider: function () {
        return new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/" + infuraKey);

      network_id: 4,
      gas: 4500000,
      gasPrice: 10000000000,

    bscTestnet: {
      provider: () => new HDWalletProvider(
      from: '0xe95745a8F4E3cDb1cF5bfFD4A94F0B249e99f489',
      network_id: 97,
      gas: 4500000,
      gasPrice: 10000000000,
      skipDryRun: true
    mainnet: {
      provider: () => new HDWalletProvider(
      network_id: 56,
      gas: 4500000,
      gasPrice: 10000000000,
      skipDryRun: true


  mocha: {
    // timeout: 100000

  // Configure your compilers
  compilers: {
    solc: {
      version: "0.8.0",    // 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"
      // }

When i tried to do the same using a truffle command instead of the script it gave me the same error. The truffle command was:

pool.addLiquidity("0x84D2A9d0D51fd578c76908603bfdd91417F54915","0x22E692b514690757Bc26DE1C01d4Fc7207d30f90",4000,4000,7000,7000,"0xe95745a8F4E3cDb1cF5bfFD4A94F0B249e99f489",Math.floor(Date.now() / 1000) + 60 * 10).then(function(r){console.log(r);});

My liquidity functions are below:
I have even tried remove the assert statement and replacing it with an if but face the same error.

// **** ADD LIQUIDITY ****
    function _addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin
    ) private returns (uint amountA, uint amountB) {
        // create the pair if it doesn't exist yet
        if (INiftFactory(factory).getPair(tokenA, tokenB) == address(0)) {
            INiftFactory(factory).createPair(tokenA, tokenB);
        (uint reserveA, uint reserveB) = NiftLibrary.getReserves(factory, tokenA, tokenB);
        if (reserveA == 0 && reserveB == 0) {
            (amountA, amountB) = (amountADesired, amountBDesired);
        } else {
            uint amountBOptimal = NiftLibrary.quote(amountADesired, reserveA, reserveB);
            if (amountBOptimal <= amountBDesired) {
                require(amountBOptimal >= amountBMin, 'NiftRouter: INSUFFICIENT_B_AMOUNT');
                (amountA, amountB) = (amountADesired, amountBOptimal);
            } else {
                uint amountAOptimal = NiftLibrary.quote(amountBDesired, reserveB, reserveA);
                assert(amountAOptimal <= amountADesired);
                require(amountAOptimal >= amountAMin, 'NiftRouter: INSUFFICIENT_A_AMOUNT');
                (amountA, amountB) = (amountAOptimal, amountBDesired);
    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
        (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin);
        address pair = NiftLibrary.pairFor(factory, tokenA, tokenB);
        TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA);
        TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB);
        liquidity = INiftPair(pair).mint(to);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
        (amountToken, amountETH) = _addLiquidity(
        address pair = NiftLibrary.pairFor(factory, token, WETH);
        TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken);
        IWETH(WETH).deposit{value: amountETH}();
        assert(IWETH(WETH).transfer(pair, amountETH));
        liquidity = INiftPair(pair).mint(to);
        if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH); // refund dust eth, if any

My deploypool.js file:

const Factory = artifacts.require('Factory.sol');
const Router = artifacts.require('Router.sol');
const Pair = artifacts.require('Pair.sol');
const Token1 = artifacts.require('token1.sol');
const Token2 = artifacts.require('token2.sol');

module.exports = async done => {
  try {
    //const [admin, _] = await web3.eth.getAccounts();
    const factory = await Factory.at('0x78A47245BC7BDaa0DB7c19b7B6116E1E11e9fE20');
    const router = await Router.at('0xE1672640636a56E2905B8a303224b65A605286CF');
    const token1 = await Token1.new();
    const token2 = await Token2.new();
    const pairAddress = await factory.createPair.call(token1.address, token2.address);
    const tx = await factory.createPair(token1.address, token2.address);
    await token1.approve(router.address, 10000);
    await token2.approve(router.address, 10000);
    await router.addLiquidity(
      Math.floor(Date.now() / 1000) + 60 * 10
    const pair = await Pair.at(pairAddress);
    const balance = await pair.balanceOf("0xe95745a8F4E3cDb1cF5bfFD4A94F0B249e99f489");
    console.log(`balance LP: ${balance.toString()}`);
  } catch (e) {

Get this bounty!!!

#StackBounty: #solidity #go-ethereum #contract-development #truffle #remix Correctly compiled contract on remix returns empty ABI

Bounty: 50

I have two questions. My contract has compiled and deployed successfully both using remix and truffle. However:
q1) remix returns an empty array of ABI.

enter image description here

Also, after I hit compile the contract at the bottom left changes back to Context.sol instead of ww1.sol.

enter image description here

q2) in Truffle, the contract’s json file in build/contracts/ folder has the abi which is below:

[{ "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "delegator", "type": "address" }, { "indexed": true, "internalType": "address", "name": "fromDelegate", "type": "address" }, { "indexed": true, "internalType": "address", "name": "toDelegate", "type": "address" } ], "name": "DelegateChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "delegate", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "previousBalance", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "newBalance", "type": "uint256" } ], "name": "DelegateVotesChanged", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "inputs": [], "name": "DELEGATION_TYPEHASH", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [], "name": "DOMAIN_TYPEHASH", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" }, { "internalType": "uint32", "name": "", "type": "uint32" } ], "name": "checkpoints", "outputs": [ { "internalType": "uint32", "name": "fromBlock", "type": "uint32" }, { "internalType": "uint256", "name": "votes", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [], "name": "decimals", "outputs": [ { "internalType": "uint8", "name": "", "type": "uint8" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } ], "name": "decreaseAllowance", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "getOwner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "addedValue", "type": "uint256" } ], "name": "increaseAllowance", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "name", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "nonces", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "", "type": "address" } ], "name": "numCheckpoints", "outputs": [ { "internalType": "uint32", "name": "", "type": "uint32" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [], "name": "owner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "symbol", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "sender", "type": "address" }, { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "newOwner", "type": "address" } ], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" }, { "internalType": "uint256", "name": "_amount", "type": "uint256" } ], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "mint", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "delegator", "type": "address" } ], "name": "delegates", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "delegatee", "type": "address" } ], "name": "delegate", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "delegatee", "type": "address" }, { "internalType": "uint256", "name": "nonce", "type": "uint256" }, { "internalType": "uint256", "name": "expiry", "type": "uint256" }, { "internalType": "uint8", "name": "v", "type": "uint8" }, { "internalType": "bytes32", "name": "r", "type": "bytes32" }, { "internalType": "bytes32", "name": "s", "type": "bytes32" } ], "name": "delegateBySig", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "getCurrentVotes", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" }, { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } ], "name": "getPriorVotes", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function", "constant": true }]

When I use this abi and try to verify and publish my contract on testnet, I get the following error:

Error! Invalid constructor arguments provided. Please verify that they are in ABI-encoded format

How can I get the correct format abi, so that I can verify my contract.

I tried to use truffle-plugin-verify to verify the smart contract on truffle and it gives me the following error. It is again pointing towards the Context.sol file but I fail to understand why because the file is visible to me in the GSN folder.

Cannot find module '@pancakeswap/pancake-swap-lib/contracts/GSN/Context.sol'
Require stack:
- C:UsersDELLnode_modulestruffle-plugin-verifyverify.js
- C:UsersDELLAppDataRoamingnpmnode_modulestrufflenode_modulesoriginal-requireindex.js
- C:UsersDELLAppDataRoamingnpmnode_modulestrufflebuildcli.bundled.js
Failed to verify 1 contract(s): NiftToken

Get this bounty!!!

#StackBounty: #javascript #ethereum #web3js #go-ethereum how does ethereum web3js imports "crypto-js"?

Bounty: 100

I am a bit confused by the syntax used in the web3.js file of the ethereum repository, although there is no file named crypto-js nor any npm or yarn, how is this import is being done? https://github.com/ethereum/go-ethereum/blob/master/internal/jsre/deps/web3.js#L1828

and how can I change the usage of crypto-js library to another library for example sha3?

Get this bounty!!!