[FAQ] web3js, Error: Please pass numbers as strings or BN objects to avoid precision errors.
我们在调用合约方法时,都可以传一些参数的,比如转账金额 value。
value 的单位是 wei,这是一个很小的单位,所以一般数值很大。
注意,把 ether 转 wei 需要先把 ether 的值转成字符串,不然就会报出标题中的错误。
比如 0.1 ether 转 wei 使用 web3.utils.toWei(this.inputEther.toString(), 'ether')。
反过来 wei 转 ether 使用 web3.utils.fromWei(xx, 'ether')
另外,这里有一个相关的错误,https://www.cnblogs.com/farwish/p/12424108.html
Refer:什么是Web3
Link:https://www.cnblogs.com/farwish/p/12424066.html
[FAQ] web3js, Error: Please pass numbers as strings or BN objects to avoid precision errors.的更多相关文章
- 异常-----freemarker.template.TemplateException: The only legal comparisons are between two numbers, two strings, or two dates
1.错误描述 六月 26, 2014 10:44:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...
- The only legal comparisons are between two numbers, two strings, or two dates.
The only legal comparisons are between two numbers, two strings, or two dates. Left hand operand is ...
- PHP Fatal error: Cannot pass parameter 2 by reference
PHP Fatal error: Cannot pass parameter 2 by reference in 这个错误的意思是:不能按引用传递第2个参数 我的理解是: 方法的第2个参数 需要传递 ...
- phpcms切换到php7.2后无法修改文章提示Uncaught Error: [] operator not supported for strings
前段时间将客户的phpcms站点升级到php7.2,相对比较顺利,但是今天他反应文章无法修改了,提示Uncaught Error: [] operator not supported for stri ...
- [Java Web]Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors
手机客户端向服务器提交Http请求时,Tomcat抛出错误: 十二月 31, 2014 2:32:45 下午 org.apache.coyote.http11.AbstractHttp11Proces ...
- 信息: Error parsing HTTP request header Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level
四月 , :: 下午 org.apache.coyote.http11.AbstractHttp11Processor process 信息: Error parsing HTTP request h ...
- log4j报错ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only err ...
- [MyBatis]问题:ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
错误信息 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging onl ...
- leetcode@ [2/43] Add Two Numbers / Multiply Strings(大整数运算)
https://leetcode.com/problems/multiply-strings/ Given two numbers represented as strings, return mul ...
- Numbers、Strings、Lists 笔记<一>
下一篇:流程控制<二> 阅读链接:官方Python3.7教程 废话:最近开始阅读python3.7文档,希望把容易混淆的知识记下来. 除法总是返回一个浮点数 >>> 8/ ...
随机推荐
- C++ memcpy、memmove
函数原型: void *memcpy(void *dest, const void* src, size_t count ); void *memmove(void *dest, const void ...
- C++正则表达式 <regex>
一 简介 概括而言,使用正则表达式处理字符串的流程包括: 用正则表达式定义要匹配的字符串的规则, 然后对目标字符串进行匹配, 最后对匹配到的结果进行操作. C++ 的 regex 库提供了用于表示正则 ...
- 【论文阅读】NIDS对抗性机器学习综述
基本信息 题目:Adversarial Machine Learning for Network Intrusion Detection Systems: A Comprehensive Survey ...
- windows系统cmd切换盘符路径命令失效
问题描述:比如当我在C盘想切换到D盘的某个文件夹路径下时 只是输出了那个路径 但是并没有真的切换 这时候需要再多操作一步就会成功了
- 【Java面试题】Hibernate
六.Hibernate 50)简述一下 hibernate 的开发流程 第一步:加载 hibernate 的配置文件,读取配置文件的参数(jdbc 连接参数,数据 库方言,hbm 表与对象关系映射文件 ...
- Scala Reduce操作(简化归约)reduce和fold
1 package chapter07 2 3 object Test15_HighLevelFunction_Reduce { 4 def main(args: Array[String]): Un ...
- python 1992和2006年国家标准学科分类和代码标准化并存入MySQL数据库
数据表 代码 1 import pandas as pd 2 import pymysql 3 4 5 def get_subject_1992(): 6 res={} 7 the_former_co ...
- #斜率优化,二分#CF631E Product Sum
题目 有一个数列 \(a\),其权值为 \(\sum_{i=1}^ni*a_i\), 现在可以任意选择其中一个数字扔到任意位置,使权值和最大. \(n\leq 2*10^5,|a_i|\leq 10^ ...
- #Kruskal重构树,主席树,倍增#洛谷 4197 Peaks
题目传送门 分析 首先第\(k\)大一般都是主席树 问题是困难值的限制有点束手无措 又是\(\text{Kruskal重构树}\) 将困难值为边权跑最小生成树,重新建树,实际上让困难值跳到尽量大的位置 ...
- #背包#洛谷 4026 [SHOI2008]循环的债务
题目 分析 设\(dp[t][n][m]\)表示前\(t\)种钞票\(\text{Alice,Bob}\)分别拥有\(n,m\)元所需最小交换钞票数, 枚举\(\text{Alice,Bob}\)最后 ...