Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use web3.toWei

Shulou Source: shulou.com Published: 2022-06-01 08:02:06 10月02日 Update

This article mainly explains "how to use web3.toWei". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use web3.toWei.

Converts a given fund to a value in wei.

Call:

Web3.toWei (number, unit)

Parameters:

Number:Number | String | BigNumber-numeric or BigNumber

Unit: String-string unit

The optional units are as follows:

Kwei/ada

Mwei/babbage

Gwei/shannon

Szabo

Finney

Ether

Kether/grand/einstein

Mether

Gether

Tether

Return value:

String | BigNumber-A string in the form of a string or BigNumber, depending on the parameters passed in.

Example:

Var value = web3.toWei ('1customers,' ether'); console.log (value); / / "10000000000000000000000". I believe you have a better understanding of "how to use web3.toWei". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Units characters strings content parameters learning different practical deeper interest practicality practicality form simple operation numerical values numbers methods more friends examples Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Shulou Tech Info Shulou Technology Redmi