Skip to content

A simple library for performing conversion between various Ethereum units

License

Notifications You must be signed in to change notification settings

mbezhanov/ethereum-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum Unit Converter

A simple library for performing easy conversion between various Ethereum units.

The conversion logic has been modelled after web3.js

This library requires the bcmath PHP extension.

Installation:

composer require mbezhanov/ethereum-converter

Usage:

$converter = new Bezhanov\Ethereum\Converter();

// convert from Wei to another unit:
$value = $converter->fromWei('21000000000000', 'finney');
echo $value; // "0.021"

// convert from another unit to Wei:
$value = $converter->toWei('1', 'ether');
echo $value; // "1000000000000000000"

Supported units:

  • kwei / ada
  • mwei / babbage
  • gwei / shannon
  • szabo
  • finney
  • ether
  • kether / grand / einstein
  • mether
  • gether
  • tether

About

A simple library for performing conversion between various Ethereum units

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages