问题描述
无法在 BSC 测试网上启动 Storage.sol,但它可以在 Ropsten 上运行,我不知道为什么.使用 Brave Browser 和 Metamask 但是切换浏览器和钱包似乎没有帮助.已经在 Polygon 的孟买网络上成功启动,所以它必须是 BSC 测试网,但我可以看到其他人在测试浏览器上发布了新合同:/.有关如何解决此问题的任何想法?
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;
}
}
推荐答案
您可能像这样在 Metamask 上设置了 BSC 测试网:
You may have set BSC Testnet on Metamask like this:
新的 RPC URL:https://data-seed-prebsc-1-s1.binance.org:8545/
New RPC URL: https://data-seed-prebsc-1-s1.binance.org:8545/
链编号:97
但改成这样:
新的 RPC URL:https://data-seed-prebsc-2-s3.binance.org:8545/
New RPC URL: https://data-seed-prebsc-2-s3.binance.org:8545/
链编号:97
如果还是不行,把Chain ID也改成0x61
If still doesn't work, also change Chain ID into 0x61
这篇关于为什么合约在 ropsten 上发布,而不是在 BSC testnet 上通过 remix 发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!