[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/ ...
随机推荐
- 3DCAT首届行业生态交流会|升大科技CEO邱杰:5G云渲染助力企业培训
2021年12月17日下午,由深圳市瑞云科技有限公司主办,深圳市虚拟现实产业联合会协办的 云XR如何赋能元宇宙--3DCAT实时云渲染首届行业生态合作交流会 圆满落幕 .此次活动围绕"云XR ...
- JS(简单数据类型、数据类型转换)
一. 数据类型简介 1.1 为什么需要数据类型 在计算机中,不同的数据所需占用的存储空间是不同的,为了便于把数据分成所需内存大小不同的数据,充分利用存储空间,于是定义了不同的数据类型.简单来说,数据类 ...
- MapReduce的基础知识
1.什么是MapReduce Hadoop MapReduce 是一个 分布式计算框架,用于轻松编写分布式应用程序,这些应用程序以可靠,容错的方式并行处理大型硬件集群(数千个节点)上的大量数据(多TB ...
- KingbaseES V8R6备份恢复系列之 -- system-Id不匹配备份故障
KingbaseES V8R6备份恢复案例之---system-Id不匹配备份故障 案例说明: 在KingbaseES V8R6执行备份时,在sys_log日志中出现system-id不一致的故障 ...
- 数仓调优实战:GUC参数调优
本文分享自华为云社区<GaussDB(DWS)性能调优系列实战篇七:十八般武艺之GUC参数调优>,作者: 黎明的风. 1. 前言 适用版本:[8.1.1及以上] GaussDB(DWS)性 ...
- Windows下Net6开源akstream项目vs2022调试GB28181协议对接摄像头全流程
一.背景介绍 笔者经历多个项目对接摄像头需求,不同项目具体要求又有所不同,碰到的摄像头对接开发问题,整理记录.此篇主要用于记录备用及给有缘人提供解决思路等. 1. 同一局域网对接(海康摄像头),如 ...
- 爱奇艺携手HMS Core,为用户打造更流畅的沉浸式观影体验
本文分享于HMS Core开发者论坛<[开发者说]爱奇艺携手HMS Core,为用户打造更流畅.更沉浸的观影体验>采访稿整理. 爱奇艺是国内领先的视频播放平台,通过接入HMS Core H ...
- oracle database recover database (下篇)
1. recover database 恢复级别一共三个:recover database > recover tablespace > recover datafile ,最高级别 da ...
- 在centOS上配置web服务器
centos,web服务,apache,ftp服务器,mysql,makefile (1). 检查系统是否正常 # more /var/log/messages //检查有无系统内核级错误信息 # d ...
- 禅道统计BUG解决时长过滤节假日和跨天问题
之前发过禅道的各种数据统计报表,使用过程中优化了一些,反映最多的是项目bug的解决时长统计问题: 1.比如当天下班左右提交的bug,研发第二天来解决,晚上这段时间应该去掉,不应计算在内 2.节假日.周 ...