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. Apr 17, 2018 at 10:47
  • How to monitor the balance of an address continuously using web3? Apr 18, 2018 at 5:18

3 Answers 3


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

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

  • 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. Apr 18, 2018 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. Apr 18, 2018 at 5:49

Could you explain this a little more to me like how to run this script within a cold wallet like atomic wallet is this possible? I could surely use the help 2 of my wallets where hacked somehow and in one them I had uni token 800 of them and they where withdrawn as of today that's like 25k I lost this guy still deposits daily in the two wallets I'd sure like to catch him and hopefully if I do it's a lot of ethereum he owes me 25k worth please if you could share this with me computer literate only know a little c c++ phython I'm a older guy so I was around computer when they had the apple ones comadores hey I'd appreciate your help if you could thanks kev


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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