Giter Club home page Giter Club logo

eth-send's Introduction

eth-send

Simple way to send ether.

License NPM version

Install

npm install eth-send

Getting started

const send = require('eth-send')

;(async () => {
  const txHash = await send({
    from: '4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d',
    to: '0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0',
    amount: '0.01',
    network: 'rinkeby'
  })

  console.log(txHash) // 0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00
})()

example

CLI

Install:

npm install -g eth-send

Example of sending ether on testnet from an account loaded via the private key, to another address:

$ eth-send \
  --from 4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d \
  --to 0xffcf8fdee72ac11b5c542428b35eef5769c409f0 \
  --amount 0.01 \
  --network rinkeby

sending transaction:

network:  rinkeby
from:     0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1
to:       0xffcf8fdee72ac11b5c542428b35eef5769c409f0
amount:   0.01 ETH (10000000000000000 wei)
gas:      21000
gasPrice: 1 gwei

tx hash:  0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

https://rinkeby.etherscan.io/tx/0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

Use the silent flag to only return the transaction hash:

$ eth-send [...] --silent

0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

You may use a custom provider in the network flag:

$ eth-send [...] --network https://rinkeby.infura.io/

The sender private key can be set as an environment variable:

FROM=4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d eth-send [....]

Piping ETH amount to send:

$ echo 0.1 | eth-send [...]

0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

Show help:

$ eth-send --help

  Simple way to send ether.

  Usage
  $ eth-send --from <private-key> --to <address> --amount <ether> --network <network> [--silent]

  Options
    --from, -f Private key of sender (required)
    --to, -t Address to send to (required)
    --amount, -a Ether amount to send (required)
    --value , -v Wei amount to send (alternative to --amount)
    --network, -n Network name or network provider URI (default "mainnet")
    --gasPrice, -p Gas price in gwei
    --gas, -g Gas limit
    --data, -d Transaction data
    --silent, -s Silent output

  Examples
  $ eth-send --from 4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d --to 0xffcf8fdee72ac11b5c542428b35eef5769c409f0 --amount 0.01 --network rinkeby --silent

  0x8ee7ed489c7cb206cd9b4ff65a5d2977324b4f727b12cd2e0c0bbcaa59219e00

Test

npm test

License

MIT

eth-send's People

Contributors

miguelmota avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.