[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/ ...
随机推荐
- 恶意软件开发(四)通过查找进程名进行DLL注入
通过进程名查找PID 当我们编写注入器的时候,肯定是希望直接通过进程名进行注入,而不是像上一篇笔记一样通过手动输入PID进行查找. 通过进程名查找PID的步骤如下: (1)创建系统中所有进程的快照 ( ...
- 网页端实现Excel转JSON
1. 引言 有时工作中拿到的数据是Excel表格,要在前端网页上使用,通常需要把文件转为JSON 微软的Microsoft Excel没有导出为JSON的功能,其他的第三方网站又不太信任 开源的Exc ...
- 记录--前端路由 hash 与 history 差异
这里给大家分享我在网上总结出来的一些知识,希望对大家有所帮助 简单介绍 Vue Router Vue Router 是 Vue.js 官方的路由插件,它和 Vue.js 是深度集成的,适合用于构建单页 ...
- 手机,IPAD查看eagle素材库
把eagle素材库塞进手机里是一种什么样的体验?手机和ipad也能查看eagle素材库,随时随地查询浏览素材. 先看使用截图 实现原理: 在任意电脑,服务器或者nas中安装PicHome系统.在Pic ...
- Linux编写Shell脚本获取指定目录下所有文件并处理
Linux编写Shell脚本获取指定目录下所有文件进行处理并保存到新目录 #!/bin/bash app_name="shell" path="/dir" #原 ...
- Scala 中断循环
一.采用 Scala 自带的函数,退出循环 1 package com.atguigu.break 2 3 object TestBreak { 4 import scala.util.control ...
- #位运算#CF959E Mahmoud and Ehab and the xor-MST
题目 \(n\)个点的完全图标号为\([0,n-1]\),\(i\)和\(j\)连边权值为\(i\: xor\:j\),求MST的值 分析 考虑MST有两种解法一种是Prim一种是Kruskal,Pr ...
- 为 Hugging Face 用户带来无服务器 GPU 推理服务
今天,我们非常兴奋地宣布 部署到 Cloudflare Workers AI 功能正式上线,这是 Hugging Face Hub 平台上的一项新服务,它使得通过 Cloudflare 边缘数据中心部 ...
- 知识图谱在RAG中的应用探讨
在这篇文章中,我们来详细探讨知识图谱(KG)在RAG流程中的具体应用场景. 缘起 关于知识图谱在现在的RAG中能发挥出什么样的作用,之前看了360 刘焕勇的一个分享,简单的提了使用知识图谱增强大模型的 ...
- 在 Visual Studio 2022 中创建一个类似于旧版本 Visual Studio 中的 Win32 Console Application 项目
在 Visual Studio 2022 中创建一个项目,其自动生成的源文件内容包含 #include "stdafx.h" 和使用_tmain 作为入口点,意味着你需要创建一个基 ...