Search code examples
storageethereumsolidityremixbinance-smart-chain

Why does contract launch on ropsten but not BSC testnet with remix?


Unable to launch Storage.sol on BSC Testnet but it works on Ropsten and I have no idea why. Using Brave Browser and Metamask however switching browsers and wallets doesn't seem to help. Have successfully launched on Polygon's Mumbai network so it has to be BSC Testnet, but I can see other people posting new contracts on the test explorer :/. Any ideas on how to resolve this?

    // SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

/**
 * @title Storage
 * @dev Store & retrieve value in a variable
 */
contract Storage {

    uint256 number;

    /**
     * @dev Store value in variable
     * @param num value to store
     */
    function store(uint256 num) public {
        number = num;
    }

    /**
     * @dev Return value 
     * @return value of 'number'
     */
    function retrieve() public view returns (uint256){
        return number;
    }
}

enter image description here


Solution

  • You may have set BSC Testnet on Metamask like this:

    New RPC URL: https://data-seed-prebsc-1-s1.binance.org:8545/

    Chain id: 97

    But change into this:

    New RPC URL: https://data-seed-prebsc-2-s3.binance.org:8545/

    Chain id: 97

    If still doesn't work, also change Chain ID into 0x61