bitcoin-transfer-relabels-the-amount-as-btc.md (4323B)
1 <!-- 2 This file is part of GNU Taler 3 (C) 2026 Taler Systems S.A. 4 5 GNU Taler is free software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 --> 16 17 # The Bitcoin transfer screen relabels the amount as BTC 18 19 Found by the `withdraw_account_tabs` scenario once the exchange advertised a 20 `payto://bitcoin/…` account: the wire transfer instructions tell the user to 21 send **5.00 BTC** for a withdrawal of **EUR 5.00**. 22 23 **Severity: low**, with a caveat about the configuration — see below. 24 25 ## What happens 26 27 A manual withdrawal of EUR:5.00 from an exchange whose account for this 28 withdrawal is a Bitcoin address shows: 29 30 ``` 31 Now make a split transaction with the following three outputs. 32 bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq 5.00 BTC 33 bc1qwtsq3knjuqyd4uqlh9ma373s4445j77m57zs6l 0.00000294 BTC 34 bc1q7tsq3kketks3deyfjqd43t20zy3r3rlcx2y8sf 0.00000294 BTC 35 ``` 36 37 The two dust outputs are right — 294 satoshi each, which is how the reserve 38 public key is encoded into the transaction. The first line is not: the amount 39 is EUR 5.00 and the screen says BTC. 40 41 The app is told the currency and overwrites it: 42 43 ```kotlin 44 // wallet/src/main/java/net/taler/wallet/transfer/TransferBitcoin.kt:82 45 text = if (segwitAddress == address) 46 amount.withCurrency("BTC").toString() 47 ``` 48 49 and again in the text the "Copy" button puts on the clipboard: 50 51 ```kotlin 52 // …:107 53 return "$addr ${amount.withCurrency("BTC")}\n$sr" 54 ``` 55 56 `withCurrency` relabels; it does not convert. Whatever the exchange said the 57 transfer amount was, this screen calls it BTC. 58 59 ## The caveat 60 61 For this to be visible, an exchange has to offer a Bitcoin account for a 62 currency that is not BTC, which is what the simulator does deliberately 63 (`SIM_EXTRA_PAYTOS` in `backend/stack.sh` signs a `payto://bitcoin/…` address 64 on a EUR exchange, so that the Bitcoin screens can be reached at all). Whether 65 that configuration is meaningful is an exchange-operator question. 66 67 What does not depend on the caveat: the wallet has the transfer amount's real 68 currency in hand and prints a different one. On a genuinely Bitcoin-wired 69 exchange the relabelling is invisible because the two agree; the moment they 70 do not, the screen states a confident wrong unit for an amount the user is 71 about to transfer, and so does the clipboard. 72 73 ## Reproduce by hand 74 75 Needs an exchange with a signed Bitcoin account; against the simulator's stack 76 that is the default (see `backend/stack.sh`, `EXTRA_PAYTOS`). On another 77 deployment: 78 79 ```bash 80 taler-exchange-offline -c <conf> \ 81 enable-account 'payto://bitcoin/bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq' upload 82 taler-exchange-offline -c <conf> \ 83 wire-fee now bitcoin EUR:0.01 EUR:0.01 upload 84 ``` 85 86 (the wire fee matters: wallet-core hides an account whose method has none). 87 Then, in the wallet: 88 89 1. **Withdraw**, enter 5, **Confirm withdrawal** — the manual flow, not the 90 bank's own button. 91 2. On the pending withdrawal tap **Wire transfer instructions**. 92 3. Select the account tab for the Bitcoin account ("Account #3"). 93 4. The first output reads "5.00 BTC". 94 95 ## Reproduce with the simulator 96 97 ```bash 98 ssh root@tripwire.taler.net 99 cd /opt/taler-sim/driver 100 SIM_WORKER=4 python3 suite.py withdraw_account_tabs 101 ``` 102 103 The notes quote each wire account's instructions, the Bitcoin one included. 104 105 ## Suggested fix 106 107 Print the amount in the currency it came in — `amount.toString()`, with the 108 currency specification applied the way the other transfer screens do (see 109 [`amounts-without-currency-specification.md`](amounts-without-currency-specification.md)) — 110 and keep `withCurrency("BTC")` for the segwit dust, which really is satoshi. 111 If an exchange offering a Bitcoin account for a non-BTC currency is to be 112 treated as a misconfiguration, the screen should say so rather than render it.