Skip to content

Instantly share code, notes, and snippets.

@ross-p
ross-p / transferEntireBalance.js
Last active August 24, 2023 08:04
Transfer ENTIRE balance from one Ethereum account to another
/**
* Transfer the ENTIRE BALANCE from one account to another.
*
* Before you call this, you must unlock your account:
* personal.unlockAccount(from)
*
* @see https://github.com/ethereum/go-ethereum/issues/1637
* @see https://github.com/ethereum/go-ethereum/issues/2173
*/
function transferEntireBalance(from, to) {
/**
* Ethereum Account Scanner
*
* To run this, you need your own geth node, accepting RPC
* connections on a port you can access.
*
* Install pre-requisites:
* sudo npm install -g web3
*
* Usage: