我们在调用合约方法时,都可以传一些参数的,比如转账金额 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.的更多相关文章

  1. 异常-----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 ...

  2. 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 ...

  3. PHP Fatal error: Cannot pass parameter 2 by reference

    PHP Fatal error:  Cannot pass parameter 2 by reference in 这个错误的意思是:不能按引用传递第2个参数 我的理解是: 方法的第2个参数 需要传递 ...

  4. phpcms切换到php7.2后无法修改文章提示Uncaught Error: [] operator not supported for strings

    前段时间将客户的phpcms站点升级到php7.2,相对比较顺利,但是今天他反应文章无法修改了,提示Uncaught Error: [] operator not supported for stri ...

  5. [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 ...

  6. 信息: 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 ...

  7. 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 ...

  8. [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 ...

  9. leetcode@ [2/43] Add Two Numbers / Multiply Strings(大整数运算)

    https://leetcode.com/problems/multiply-strings/ Given two numbers represented as strings, return mul ...

  10. Numbers、Strings、Lists 笔记<一>

    下一篇:流程控制<二> 阅读链接:官方Python3.7教程 废话:最近开始阅读python3.7文档,希望把容易混淆的知识记下来. 除法总是返回一个浮点数 >>> 8/ ...

随机推荐

  1. HDFS Balancer负载均衡器

    目录 1.背景 2.什么是平衡 2.1 每个DataNode的利用率计算 2.2 集群的利用率 2.3 平衡 3.hdfs balancer语法 4.运行一个简单的balance案例 4.1 设置平衡 ...

  2. Anaconda使用教程

    0 写在前面 以下命令都是在命令行模式下进行操作,macOS和Linux用户可以直接打开Terminal终端,Windows用户如果配置了环境变量则可以直接打开cmd,否则需要打开Anaconda P ...

  3. 浅谈 KingbaseES 和 SQLServer 中的 instead of 触发器

    本文基于Kingbase和SqlServer的INSTEAD OF 触发器主要功能特点进行对比浅析,同时针对SqlServer 的INSTEAD OF 触发器提出了多种kingbase环境的等价代码方 ...

  4. KingbaseES 咨询锁

    传统的事务性锁,读/写会自动加锁,读/写完成后会自动解锁(加解锁机制在细节上复杂),这是一种隐式的锁机制.对于加锁后的并发控制,也就是默认的写不阻塞读,是通过MVCC机制解决的.这种锁完全不需要人为干 ...

  5. Selenium 八大元素定位方式

    UI自动化测本质无非就是: 定位元素 -> 操作元素 -> 模拟页面动作 -> 断言结果 -> 生成测试报告. 所以我们做UI自动化的第一步就是定位元素,如果连元素都定位不到就 ...

  6. NUMA 平台

    What is NUMA? This question can be answered from a couple of perspectives: the hardware view and the ...

  7. [Android开发学iOS系列] iOS项目环境搭建和依赖管理

    iOS项目环境搭建和依赖管理 一个项目总是会依赖一些库, 有些是第三方的, 有些可能是项目自身为了复用拆出去的. 现有主流的iOS依赖有多种形式, 比如CocoaPods, Carthage和swif ...

  8. #并查集#JZOJ 4223 旅游

    题目 多次询问有多少个无序点对\((x,y)\), 满足至少有一条最大边权\(\leq d\)的路径 分析 离线询问,用并查集加边,每次产生的贡献为\(2*siz[x]*siz[y]\) 代码 #in ...

  9. #线段树分治,凸壳#洛谷 5416 [CTSC2016]时空旅行

    题目链接 题目大意 有 \(n\) 个平行宇宙,由某些平行宇宙添加或删除一个点(三维坐标)得到, 现在有 \(m\) 组询问,形如对于某个平行宇宙,费用为从该平行宇宙内某个点出发 到达指定 \(x\) ...

  10. DevEco Studio的这些预览能力你都知道吗?

    在万物互联的今天,开发者在应用/服务开发过程中,需要考虑应用/服务在不同设备上的运行效果.为满足这一需求,DevEco Studio 作为 HarmonyOS 和 OpenAtom OpenHarmo ...