Commit graph

97 commits

Author SHA1 Message Date
Kristaps Kaupe
085ef0822a
Merge JoinMarket-Org/joinmarket-clientserver#1676: Multiple (batch) payment support in direct_send()
f3f4f0a4fb Multiple (batch) payment support in `direct_send()` (Kristaps Kaupe)

Pull request description:

  Work towards #1012. Changes `direct_send()` to instead of single `amount` and `destination` to accept `dest_and_amounts` which is list of tuples of addresses and amounts instead. Haven't yet implemented and tested actual payments to multiple recipients, but tested that this doesn't break existing stuff.

Top commit has no ACKs.

Tree-SHA512: 02195a28d071c9537cb5297e63854ad2571e0ae9b5e06b850d6173c47d53caae953e9d7671ff861a6584a104d7a59da2293781d4440f7db4814f9b2fc4116c46
2024-04-25 15:49:14 +03:00
Kristaps Kaupe
f3f4f0a4fb
Multiple (batch) payment support in direct_send() 2024-02-24 02:05:50 +02:00
Kristaps Kaupe
904b780b80
Unify cli user input code where limited range of answers are allowed 2024-02-22 20:29:38 +02:00
Kristaps Kaupe
196a097667
Allow absurd fee override when setting tx fee manually 2024-01-17 16:45:23 +02:00
Kristaps Kaupe
34c0c451d5
Add -l/--label-change option to sendpayment.py to automatically label change address 2023-04-12 23:11:28 +03:00
Kristaps Kaupe
907f1b0603
Signal BIP125 opt-in RBF for non-cj sends by default 2023-03-20 01:52:13 +02:00
Kristaps Kaupe
d6d40df606
Allow amounts below DUST_THRESHOLD (0.00027300 BTC) for non-cj direct sends 2022-09-28 17:20:29 +03:00
Kristaps Kaupe
9d9035b43f
Fix sendpayment without amount argument, BIP21 only
Fixes bug introduced with 83c6bc053a
2022-09-25 15:08:24 +03:00
Kristaps Kaupe
83c6bc053a
Allow bitcoin: prefix for addresses with sendpayment.py 2022-07-08 17:21:43 +03:00
Kristaps Kaupe
7a88781648
Add support to build and autostart local Tor instance in jmvenv 2022-03-03 14:01:07 +02:00
Kristaps Kaupe
f741fdd11a
Use get_txtype() / get_outtype() for address type detection 2022-02-16 21:47:19 +02:00
Kristaps Kaupe
0e80b2dee7
Show fidelity bond value in manual order picking 2021-09-25 22:04:40 +03:00
Tim Akinbo
b19888e24f add opt-in rbf support for direct sends
bugfix: use enumerate instead of len

reviewed estimation of transaction sizes

estimates are still a bit conservative with room for improvement;
signatures could still save up to one byte each if using low-r
values. python-bitcointx==1.1.2-dev already supports grinding for
low-r values so when it's stable and referenced version is updated,
this should be reviewed again so as to utilize that benefit.

added utility method `estimate_extra_bytes`

the purpose of this method is for the computation
of extra bytes when the coinjoin or direct send output
type is different from that of the wallet

updated tests to reflect new transaction size
computation

p2pkh transactions are now 1 byte larger for
the inputs hence the change amount should be
less 4 * 30 sats.

add private keys for utxos that we may not be
tracking

some transactions (e.g. opt-in rbf) may require signing
with private keys for utxos that we may have stopped
tracking. this commit will search through all inputs
and for those we own and retrieve their private keys
so we can sign with them.

added support for p2wsh output scripts in

refactored the estimation of the transaction size
when outputs of a different type is the target

Previously, a different method was employed which
was kind of kludgy considering the fact that the
`extra_bytes` parameter is really for `OP_RETURN`
outputs. This method modifies the `estimate_tx_size`
method to accept an optional extra parameter called
`outtype` which is used to estimate the correct
transaction size if the target output is different
from that of the wallet.

added missing import

added a note about preserving the order of wallet type constants

Fix bug with timelocked addrs in receive payjoin

Previously there would be a crash if the wallet receiving a payjoin
had a timelocked UTXO.
2021-08-25 00:35:16 +00:00
Adam Gibson
24f3aabf9e
Consistent dust threshold in client and obwatch
Fixes #899.
Before this commit, the dust threshold used to filter
orders in `jmdaemon.OrderbookWatch` was different than
that used in `jmclient`. This is corrected by setting
the threshold in client config and passing this as a
parameter in the `JMInit` command (since the daemon
does not know the client config).
2021-07-29 22:35:34 +01:00
csH7KmCC9
ad8cd74ee9
Enable external/custom change addresses.
Fixes #797.

Adds `custom_change_addr` argument to `direct_send()`
joinmarket-qt: Adds input field for optional external change address
joinmarket-qt: Better handle PayJoin/CoinJoin state changes for changeInput widget
Adds `custom_change_address` argument to Taker constructor and use it in joinmarket-qt
Custom change also allowed in sendpayment CLI with `-u` flag (not
supported in tumbler).
Explicitly disallows using custom change with BIP78 Payjoin, though that
could change later.
Both sendpayment and CLI provide detailed warnings to avoid misuse. In
particular, they have an extra warning for using a nonstandard or
non-wallet scriptpubkey type.
Setting custom change to the recipient address is explicitly forbidden.

Tests: Adds custom_change usage test in test_taker.
2021-06-01 12:29:59 +01:00
Kristaps Kaupe
fde23c3cc5
Remove unused imports 2021-04-14 15:54:18 +03:00
Adam Gibson
b6e2576c3a
BIP78 sender protocol via daemon
This PR creates a client-daemon protocol for
the BIP78 sender, using the base protocol
`HTTPPassThrough` which provides tor and non-tor
agents with POST and GET request functionality.
As for Joinmarket coinjoins, the use of an in-process
daemon is the default option, but it can be isolated
by changing the `[DAEMON]` section of the config.
The receiver side of BIP78 will be addressed in a
future PR.
2021-03-14 11:53:51 +00:00
Adam Gibson
462a95db1e
Allow schedule files without payment arguments.
Fixes #778. Prior to this commit, attempting to run
sendpayment with a schedule specified with -S would
fail due to a bug. This is now fixed, and the
sendpayment help message now accurately reflects the
facts that no arguments other than the wallet name are
needed in case -S is used.
2021-01-13 16:47:41 +00:00
Adam Gibson
8cdf3e0a4a
address comments of @kristapsk and @PulpCattel 2020-12-01 16:25:45 +00:00
Adam Gibson
bb15aa0312
Quiet/make more accurate fee information in sends
Fixes #736. Prior to this commit, the 'relay fee floor'
was being shown at INFO level in the command line output,
but not the actual feerate paid (in direct send scenarios;
the coinjoin scenario is rather more complex since fees are
not known before negotiation flow, but estimates are printed).
After this commit, the output at INFO level for direct
sends shows specifically the feerate and then the actual fee,
with min relay feerate relegated to DEBUG messages only, for
cases of manual feerate setting.
There is also some minor cleanup in comments and coinjoin fee
estimate messages are removed for non-coinjoins.
2020-11-30 16:43:50 +00:00
Kristaps Kaupe
44c9dcde65
Remove twisted logging on testnet 2020-11-11 04:33:41 +02:00
Jules Comte
ab87db2477 Create native segwit v0 order type
Note: The defaults for the fake offer and yg-privacyenhanced remain
on nested segwit
2020-11-06 18:34:27 -05:00
Adam Gibson
5604857ec1
quit scripts gracefully on walletservice rpc startup failure 2020-10-07 16:05:37 +02:00
Adam Gibson
23d0b8f39c
BIP78 receiver over a Tor hidden service.
This commit implements a command line script and a GUI
dialog to receive a payment using the BIP78 protocol,
by setting up an ephemeral hidden service.

It also deprecates the pre-existing inter-Joinmarket
protocol for payjoin payments, since we now have
both sending and receiving support for BIP78. Thus,
much code in Maker, Taker and client-daemon protocol
is removed, as is some documentation in docs/PAYJOIN.md.
Also the script `sendpayment.py` is altered to support
only the BIP78 variant.

The test in jmclient/test/test_payjoin now implements
BIP78 over a TCP connection, while the custom tests in
test/payjoinserver.py can support hidden service based
tests, but the latter is not included in the test suite
and may not always work (it is only for manual
investigations).

The following features of BIP78 are supported:
minfeerate
additionalfeeoutputindex - but *only* for single
change output transactions
maxadditionalfeecontribution

The receiver does not have nor request payment
output substitution.

Utxo selection is no longer sophisticated, instead
we only choose a single utxo to keep the size
increase of the transaction minimal. Thus UIH is
not addressed at the moment.

Errors returned are in line with BIP78.

Sequence numbers are checked by receiver, and
kept identical if uniform, otherwise respected.
Receiver uses transaction monitor to shut down
when the payment is seen.

The workflow is almost entirely implemented in
jmclient/payjoin.py and the command line script
is in scripts/receive-payjoin.py. The setup, including
configuration changes for Tor, are documented in
docs/PAYJOIN.md, including a user guide video linked.
2020-09-23 15:04:59 +01:00
Kristaps Kaupe
2401c83c45
Implement BIP78 payjoin in JoinMarketQt GUI
Co-authored-by: Adam Gibson <ekaggata@gmail.com>
2020-08-19 22:20:17 +03:00
Adam Gibson
41540ab53e
Modify Payjoin code for BIP78 changes.
This is now tested as compatible with BIP78 as
implemented by BTCPayServer.
An additional config section [PAYJOIN] is added to
manage settings for fee control in payjoin as
described in the BIP. These settings are marked as
advanced usage as they're rather complex for users
to understand and the defaults should be very safe.
2020-07-10 12:32:42 +01:00
Adam Gibson
4cf77ed774
Various bugfixes:
Fix bug in Coins tab, get_utxos_by_mixdepth calls

Fix bug in jmbitcoin.mktx, now respects nVersion choice

Fix bug in tumbler restart wait

Fix bug in makercount for payjoin for fee check, set to 0:
The value of `options.makercount` is set to zero
so that the fee sanity check in the sendpayment script
operates approximately correctly (the receiver will bump
the fee to keep the fee rate the same if necessary).
Also the `bip79` variable is better named `payjoinurl`.

Fix bug in "freeze" context menu function in Qt
2020-07-06 16:51:12 +01:00
Adam Gibson
ca0de5c312
Add bip78 payjoin module and client-server test:
See:
https://github.com/bitcoin/bips/blob/master/bip-0078.mediawiki

Adds a new module jmclient.payjoin which implements
the full sender workflow from a BIP21 uri to a
payjoin broadcast, state is managed in JMPayjoinManager,
includes all checks as per documentation of
btcpayserver (and later, BIP78).
Added simple client and server implementations in
test/payjoinclient.py and test/payjoinserver.py
which allow a full end to end test on regtest.

Add TLS support to payjoin tests:
Note: the jmclient.payjoin module already
supports TLS by default (Agent object), but
here we add the ability to test without
certificate verification. Both test/payjoinclient.py
and test/payjoinserver.py now support TLS, but
the server needs a key and certificate in its
directory to run.

Adds BIP78 payjoin option to sendpayment.py

Users can use a bip21 uri with the "pj" field to
send a payment to a remote server.

Removes require_path_templates setting from KeyStore call
in PSBTWalletMixin.sign_psbt
2020-07-06 16:46:50 +01:00
Adam Gibson
de3ad53226
Support output of PSBT instead of broadcast in direct_send 2020-07-06 16:36:29 +01:00
chris-belcher
c1f34f08c5
Merge #544: Fidelity bond wallets
6b41b8b Disable creation of fidelity bond wallets (chris-belcher)
869ef55 Disable loading of fidelity bond wallets by Qt (chris-belcher)
14f086b Add usage guide for fidelity bond wallets (chris-belcher)
2860c4f Freeze timelocked UTXOs with locktimes in future (chris-belcher)
ddb32ce Rename functions to say "key" instead of "privkey" (chris-belcher)
c70183b Create tests for fidelity bond wallets (chris-belcher)
a0a0d28 Add support for spending timelocked UTXOs (chris-belcher)
762b1f6 Add watch only wallets for fidelity bonds (chris-belcher)
a937c44 Add wallet-tool addtxoutproof method (chris-belcher)
97216d3 Sync burner outputs and display in wallet-tool (chris-belcher)
255d155 Add merkle proof functions to BitcoinCoreInterface (chris-belcher)
2271ce0 Add support for burning coins with sendpayment (chris-belcher)
dc715c9 Add timelock fidelity bond wallet sync and display (chris-belcher)
ee70cd7 Add support for OP_CLTV timelock addresses (chris-belcher)
d86df33 Rename functions which create multisig scripts (chris-belcher)
53b056e Rename variable internal to address_type (chris-belcher)

Tree-SHA512: 9f24000b0ebb4524b30c8afaa4416e516c7241c565dd21a96f83b70d6b6c42e83ad20bfd4f6e85545a855af4fcfd6065feb674f5ed270ca51ac814b4c3684ab4
2020-06-02 22:25:36 +01:00
chris-belcher
2271ce05d7
Add support for burning coins with sendpayment
Users burn coins by passing "BURN" as an address to sendpayment
2020-06-02 21:33:17 +01:00
Adam Gibson
ec2fd725ad
Change initial fee guess logic in taker scripts
As per discussion in #569 the use of options.txfee
to set fee rates conflicted with its earlier use
to make a first guess of fees for user warnings.
Now this connection is removed, the guess for warning
calculation is done independent of this option setting.
2020-05-11 11:22:11 +01:00
Kristaps Kaupe
3876c1cf97 Change shebang to python3 and +x for scripts 2020-05-04 23:48:19 +03:00
Kristaps Kaupe
4eced504b2
Add BIP21 support for Payjoin 2020-05-03 12:13:55 +03:00
Kristaps Kaupe
faaf51eada
Add BIP21 bitcoin payment URI support to sendpayment.py 2020-04-26 23:34:11 +03:00
Kristaps Kaupe
5976db7d4f
Abort single join early if maker count below minimum_makers 2020-03-29 02:19:48 +02:00
James Hilliard
b3e9a6f270 Fix sweep in scripts/sendpayment.py 2020-03-05 13:16:23 -07:00
Kristaps Kaupe
f51990900f
Check against dust threshold for single joins 2020-02-29 19:04:58 +02:00
James Hilliard
4bf1f50d4e Remove Python 2 compatibility imports and disable Python 2 installation in setuptools. 2020-01-19 11:31:57 -07:00
Adam Gibson
8c8e6e2fa8
Move all user data to home directory
To facilitate easier management by users and to
follow generally accepted standards, this PR moves
the following all to user home directory, subdir
.joinmarket :
joinmarket.cfg file
wallets/ directory
logs/ directory
cmtdata/ directory
commitmentlist file

User can override location with --datadir option.
An info message is added on startup showing location.
2020-01-06 13:49:47 +00:00
chris-belcher
c52d1fb0d6
Merge #387: Implement 2/2019 plan to improve tumbler privacy
32479ae Modify tumbler defaults to improve privacy (chris-belcher)
b79d34a Remove amountpower and use uniform distn instead (chris-belcher)
f40ef2c Occasionally round amounts in tumbler schedule (chris-belcher)
35f23eb Add sweep coinjoins to start of tumbler schedule (chris-belcher)

Tree-SHA512: 8b1dc978b69deccc62cec43d22254a18f4860aae6fd87026e7b86d8f537a302ec5ed34f26efa04e1e29648cabe9dac57e0b452fa9fe6f74f6a22b0ce6b2be04a
2019-11-23 11:07:27 +00:00
Adam Gibson
d9bcca3901
Allow custom schedules to work again after #367
PR #367 and follow up edits were designed to give a sanity
check to users for fees, but require specifying a payment
amount, this could be generalised to custom schedules but
for now the simplest change is to remove this check for
schedules. Thanks to @roshii for flagging the error.
2019-11-18 17:17:46 +00:00
cindiv
52108b62d8 Update exit codes
Many exit codes were 0 (success) when they should have been 1
(general failure) or 2 (argument error). This corrects that.

Related: #409
2019-11-17 03:51:04 +00:00
chris-belcher
f40ef2c795
Occasionally round amounts in tumbler schedule
The schedule format gets an extra field added denoting the number of
significant figures to round the coinjoin amounts to, with 16 meaning
no rounding.

This is part of the 2/2019 Plan to improve the privacy of JoinMarket's
tumbler script:
https://gist.github.com/chris-belcher/7e92810f07328fdfdef2ce444aad0968
2019-11-14 17:49:06 +00:00
Kristaps Kaupe
b2e4308a90
Allow both BTC and sat amounts for single send / CJ 2019-11-08 00:37:09 +02:00
cindiv
b83e27c391 Add --wallet-password-stdin
Related: Issue #409
2019-11-02 19:01:08 +00:00
AlexCato
0ab5b6560c Redefine cli-option --txfee: Treat it as txfee to be used
in the JM TX's instead of just for preliminary
    estimations. Now it is a way to temporarily override
    the tx_fees setting in joinmarket.cfg and behaves
    exactly the same way as describes there.
2019-10-30 08:58:13 +01:00
AdamISZ
c654de05ff
Wallet and blockchain refactoring
Introduces WalletService object which is in control of
blockchain and wallet access.
The service manages a single transaction monitoring loop,
instead of multiple, and allows updates to the wallet from
external sources to be handled in real time, so that both Qt
and other apps (yg) can respond to deposits or withdrawals
automatically.
The refactoring also controls access to both wallet and
blockchain so that client apps (Taker, Maker) will not need
to be changed for future new versions e.g. client-side filtering.
Also updates and improves Wallet Tab behaviour in Qt (memory
of expansion state).
Additionally, blockchain sync is now --fast by default, with
the former default of detailed sync being renamed --recoversync.
2019-10-25 11:33:39 +01:00
AlexCato
d62a3001bc Fix sweeps with N=0 counterparties, which otherwise fails because the amount was changed from 0 too early 2019-08-21 17:24:30 +02:00
AlexCato
b656f85344 Sendpayment/Tumbler: fix division by 0 error on sweeps 2019-08-20 22:42:17 +02:00