Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityAnybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
I have tried with the commands below
sendtoaddress <address> `bitcoin-cli getbalance` "" "" true sendtoaddress <address> "bitcoin-cli getbalance" "" "" true sendtoaddress <address> bitcoin-cli getbalance "" "" true sendtoaddress <address> getbalance "" "" true sendtoaddress <address> *.* "" "" true
But none worked
error: Error parsing JSON:
It sounds like you want to send all wallet funds in a single-line command.
In a Unix shell, this should work:
bitcoin-cli sendtoaddress <address> $(bitcoin-cli getbalance) "" "" true
The Windows command prompt doesn't support the substitution via backticks or $(…), but I'm reading that you should be able to use a FOR /F
loop with the usebackq
option to emulate it:
for /F "usebackq delims=" %A in (`bitcoin-cli getbalance`) do bitcoin-cli sendtoaddress <address> %A "" "" true
I have no Windows machine and have not tested this, I suggest you verify carefully and use at own risk.
Starting with the next release, Bitcoin Core v24, you will be able to use sendall
:
bitcoin-cli sendall '["<address>"]' null "unset" <feerate (s/vB)>
You can get bonuses upto $100 FREE BONUS when you:
💰 Install these recommended apps:
💲 SocialGood - 100% Crypto Back on Everyday Shopping
💲 xPortal - The DeFi For The Next Billion
💲 CryptoTab Browser - Lightweight, fast, and ready to mine!
💰 Register on these recommended exchanges:
🟡 Binance🟡 Bitfinex🟡 Bitmart🟡 Bittrex🟡 Bitget
🟡 CoinEx🟡 Crypto.com🟡 Gate.io🟡 Huobi🟡 Kucoin.
Comments