当前位置:网站首页>Summary of solid problems
Summary of solid problems
2022-04-23 08:45:00 【ling1998】
1、 Query contract account balance (address(this).balance) Report errors
In their own Geth When querying the contract account balance on the private chain, there is an error , But use Remix Of Javascript VM Normal during execution , Use the test network Goerli It's normal , Be able to view the contract balance .
(1) Execute function
// Query contract account balance , Use view Modifier
function getContractAccountBalance() public view returns (uint256){
return address(this).balance; //this Is the object of this contract
}
(2) error message
call to functionModifier.getContractAccountBalancecall to functionModifier.getContractAccountBalance errored: Internal JSON-RPC error. { "code": -32000, "message": "invalid opcode: SELFBALANCE" }
As shown in the figure :
(3) Solution
stay genesis.json Medium config increase ”istanbulBlock“ Set up , As shown below :
{
"config": {
"chainId": 1422,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock":0,
"ethash": {}
},
"difficulty": "1",
"gasLimit": "8000000",
"alloc": {
"7df9a875a174b3bc565e6424a0050ebc1b2d1d82": { "balance": "300000" },
"f41c74c9ae680c1aa78f42e5647a62f353b7bdde": { "balance": "400000" }
}
}
Close all nodes , Rerun init Command enables the new chain configuration . Tested , You can query the contract account balance normally
May refer to :blockchain - Geth private network return error "invalid opcode: SELFBALANCE" when executing a simple contract - Stack Overflow
Or official website :Private Networks | Go Ethereum
版权声明
本文为[ling1998]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230842141867.html
边栏推荐
- Ear acupoint diagnosis and treatment essay 0421
- Star Trek强势来袭 开启元宇宙虚拟与现实的梦幻联动
- idea底栏打开services
- Record: JS several methods to delete one or more items in the array
- 洋桃电子STM32物联网入门30步笔记三、CubeMX图形化编程、设置开发板上的IO口
- 【IndexOf】【lastIndexOf】【split】【substring】用法详解
- L2-3 romantic silhouette (25 points)
- 根据字节码获取类的绝对路径
- 基于点云凸包的凹包获取方法
- 扣缴义务人
猜你喜欢

Yangtao electronic STM32 Internet of things introduction 30 steps notes 1. The difference between Hal library and standard library

Excle plus watermark

Reference passing 1

第一性原理 思维导图

MATLAB入门资料

RCC introduction of Hal Library

DJ音乐管理软件Pioneer DJ rekordbox

ONEFLOW learning notes: from functor to opexprinter

MATLAB 画五星红旗

根据字节码获取类的绝对路径
随机推荐
应纳税所得额
匿名類型(C# 指南 基礎知識)
2022-04-22 OpenEBS云原生存储
LINQ Learning Series ----- 1.4 anonymous objects
完全二叉搜索树 (30 分)
Failed to prepare device for development
【精品】利用动态代理实现事务统一管理 二
JVM工具之Arthas使用
'恶霸' Oracle 又放大招,各大企业连夜删除 JDK。。。
cadence的工艺角仿真、蒙特卡洛仿真、PSRR
Output first order traversal according to second order and middle order traversal (25 points)
MATLAB入门资料
Yangtao electronic STM32 Internet of things introduction 30 steps notes 1. The difference between Hal library and standard library
求简单类型的矩阵和
什么是RPC
Knowledge points and problem solutions related to information collection
Introduction to protobuf
Shell script advanced
《深度学习》学习笔记(八)
Study notes of deep learning (8)