I want to implement a feature in which users will send ether to wallet address(0x123) and on successful deposit, it needs to automatically transfer to my cold wallet(0x983).

I can able to achieve this features with the help of smart contract but how to achieve this with an only wallet address without including smart contracts?

  • Apart from smart contracts, an easier way might be writing a script that calls web3 to monitor the balance, calculates the transfer amount (minus gas cost), and sends out the transfer transaction. – Linmao Song Apr 17 '18 at 10:47
  • How to monitor the balance of an address continuously using web3? – Karthikeyan Thangavel Apr 18 '18 at 5:18

You can't. Wallets do not include functionality without smart contracts. I also don't see any reason why not to include smart contracts.

| improve this answer | |
  • In crypto exchanges, we will deposit the ether or bitcoin in wallet address after successful deposit it will be transferred to the cold wallet of the exchange. I want to achieve the same. – Karthikeyan Thangavel Apr 18 '18 at 5:18
  • That's not functionality which exists within the wallets. It's all done outside the blockchain - unless there's a smart contract. So whenever some system detects a payment to a wallet, it gets transferred to another (cold) wallet. This is all speculative of course, exchanges don't really share details about how their systems work. – Lauri Peltonen Apr 18 '18 at 5:49

Following discussions in the comments, I happened to have written a bash test script that does almost exact the same. Note this is a quick hack and it has the following issues

  • it is very unsafe (e.g. it leaves the personal accounts unlocked forever). I ran it for testing only, thus no issue for me. But please don't use in production without modifications.
  • The TO_ADDR must not be managed by geth (i.e. not among results of "geth account list"), otherwise it will be a dead loop. Again, it was a quick hack.
  • No performance consideration at all: a silly loop that does the check every 60 seconds.


GETH=<your geth path>
TO_ADDR=<destination addr>
for ADDR in $(${GETH} account list | grep -o -e'\{[^}]\+\}' | tr -d '}' | tr -d '{');do
    echo "unlocking '$ADDR'"
    echo "web3.personal.unlockAccount('$ADDR', '<your password>', null);" | ${GETH} attach http://localhost:8545

SRC=$(cat <<EOF
addrs = web3.eth.accounts;
to_addr = '$TO_ADDR';
cost = 21000 * gasPrc;
for (i = 0; i < addrs.length; i++) {
    balance = web3.eth.getBalance(addrs[i]);
    send_val = balance - cost;
    if (send_val > 0) {
        val=web3.fromWei(send_val, "ether");
        web3.eth.sendTransaction({from: addrs[i], to: to_addr, value: web3.toWei(val, "ether"), gasPrice: gasPrc, gas: 21000});
        console.log("Transferring ", web3.toWei(val, "ether"), " wei from ", addrs[i], " to ", to_addr, " gas price ", gasPrc);
    } else {
        console.log("Cannot Transfer ", send_val, " wei from ", addrs[i], " to ", to_addr);

while true; do
    if echo "${SRC}" | ${GETH} attach http://localhost:8545 | tee monitor.log | grep -e'Transferring ';then
        date | mail -s 'ether automatically transferred' <your email>
    sleep 60
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.