1
0
Commit Graph

51 Commits

Author SHA1 Message Date
SomberNight
4c63d8729b add sanity checks we don't sign tx including dummy addr
Somewhat a follow-up to 649ce979ab.

This adds some safety belts so we don't accidentally sign a tx that
contains a dummy address.
Specifically we check that tx does not contain output for dummy addr:
- in wallet.sign_transaction
- in network.broadcast_transaction

The second one is perhaps redundant, but I think it does not hurt.
2023-09-16 04:36:08 +00:00
ThomasV
649ce979ab send tx change to lightning 2023-09-09 14:14:43 +02:00
ThomasV
2b1199647e bitcoin.construct_script: add values parameter
(to be used in swapserver plugin)
2023-06-26 09:33:36 +02:00
SomberNight
a80bef8421 follow-up descriptor.py: small clean-up 2023-03-03 16:40:45 +00:00
SomberNight
f1f39f0e82 descriptors: wallet/transaction: construct intermediate osd 2023-03-01 17:53:52 +00:00
SomberNight
373db76ac9 util: kill bh2u
no longer useful, and the name is so confusing...
2023-02-17 11:43:11 +00:00
SomberNight
6a6391c6a3 bitcoin.py: (trivial) rm redundant "net=" defaults 2023-02-14 15:05:34 +00:00
SomberNight
0037053d73 bitcoin: 3x speedup for DecodeBase58Check
(compared to HEAD~2)

rewrite base_{decode,encode} based on 2fae7065e3/base58/__init__.py
2022-12-23 09:14:18 +00:00
SomberNight
4f20e4a21f bitcoin: trivial speedup for DecodeBase58Check (down to ~80% time) 2022-12-23 09:14:14 +00:00
ghost43
8acda5f48d Merge pull request #7693 from benma/bb02
bitbox02: bump dependency to v6.0.0, support sending to taproot
2022-03-02 13:29:24 +00:00
Marko Bencun
01b4b35f9f bitbox02: bump dependency to v6.0.0, support sending to taproot 2022-03-02 14:14:24 +01:00
bitromortac
947693c90d check dust limits
* on channel opening we verify that the peer's dust limit is above 354
  sat, the limit for unknown segwit versions
* we constrain the allowed scriptpubkey types for channel closing
* we check that the remote's output is above the relay dust limit for
  the collaborative close case
2021-10-27 16:27:15 +02:00
krzysobo
7ea7e7cec9 bitcoin.address_to_scripthash: add net param (#7143)
closes #7141
2021-03-26 20:54:26 +00:00
ThomasV
64a931f21e Deterministic NodeID:
- use_recoverable_channel is a user setting, available
   only in standard wallets with a 'segwit' seed_type
 - if enabled, 'lightning_xprv' is derived from seed
 - otherwise, wallets use the existing 'lightning_privkey2'

Recoverable channels:
 - channel recovery data is added funding tx using an OP_RETURN
 - recovery data = 4 magic bytes + node id[0:16]
 - recovery data is chacha20 encrypted using funding_address as nonce.
   (this will allow to fund multiple channels in the same tx)

GUI:
  - whether channels are recoverable is shown in wallet info dialog.
  - if the wallet can have recoverable channels but has an old node_id,
    users are told to close their channels and restore from seed
    to have that feature.
2021-03-19 10:17:02 +01:00
SomberNight
4315fa4371 BIP-0350: use bech32m for witness version 1+ addresses
We have supported sending to any witness version since Electrum 3.0, using
addresses as specified in BIP-0173 (bech32 encoding).
BIP-0350 makes a breaking change in address encoding, and recommends using
(and using only) a new encoding (bech32m) for sending to witness version 1
and later. The address encoding for currently in use witness v0 addresses
remains the same, as in BIP-0173; following the BIP-0350 spec.

closes https://github.com/spesmilo/electrum/issues/6949

related:
cd3885c0fb/bip-0350.mediawiki
https://github.com/bitcoin/bitcoin/pull/20861
2021-03-17 18:11:55 +01:00
SomberNight
4c7a92f39c bitcoin: implement construct_script and use it 2020-10-24 07:49:06 +02:00
SomberNight
89bd520185 bitcoin: move construct_witness from transaction.py to bitcoin.py 2020-10-24 05:18:16 +02:00
SomberNight
9eb152ed98 keystore: improve check_password.
and add tests that exercise it

maybe fixes #4128
2020-09-11 13:42:12 +02:00
SomberNight
fc39295d20 lnpeer: review safety check re channel open flow, and tweak params 2020-06-08 21:17:23 +02:00
SomberNight
66c264f613 bitcoin.py: change API of address_to_hash 2020-04-12 15:34:19 +02:00
TheCharlatan
a4fe14bb82 BitBox02 Electrum plugin support
This commit adds support for the BitBox02 hardware wallet.
It supports both single and multisig for the electrum gui wallet.

To use the plugin a local installation of the BitBox02 python library is
required. It can be found on PiPy under the name 'bitbox02' and can be
installed from the bitbox02-firmware repository in the py/bitbox02
directory.

All communication to and from the BitBox02 is noise encrypted, the keys
required for this are stored in the wallet config file under the
bitbox02 key.

The BitBox02 registers a multisig configuration before allowing
transaction signing. This multisig configuration includes the threshold,
cosigner xpubs, keypath, a variable to indicate for mainnet and testnet,
and a name that the user can choose during configuration registration.
The user is asked to register the multisig configuration either during
address verification or during transaction signing.

The check the xpub of the BitBox02 for other hardware wallets, a button
is added in the wallet info dialog.

The wallet encryption key is fetched in a separate api call, requiring a
slightly tweaked override version of the wallet encryption password.
2020-04-12 15:34:37 +02:00
SomberNight
900a7631cf commands: add new cmd "getprivatekeyforpath" to export a WIF for a path
related: #6061
2020-03-31 05:50:18 +02:00
SomberNight
510399d3d2 wallet: dust limit calculation should round up (not down)
related to prev commit

closes #6035
2020-03-15 17:42:02 +01:00
SomberNight
a500db371d wallet: put hard limit on minimum of relayfee: 1 sat/byte
(note that the dust limit is calculated based on the relayfee)

closes #6035
2020-03-15 01:26:26 +01:00
SomberNight
6f2cd8b4f5 Qt tx dialog: allow setting custom locktime
closes #2405
closes #1685
2020-03-01 09:14:50 +01:00
SomberNight
5f6f7da2a1 bitcoin.py: base58 address: make sure all public methods test checksum
Note: the checksum was already being checked in practically all cases, by the caller.
Moved the check here, to the lower level (but still public) method for sanity.
2019-12-08 06:56:19 +01:00
SomberNight
8cf3587aeb base_encode/base_decode: change to saner API 2019-12-08 06:19:51 +01:00
SomberNight
01f94fcf58 base_encode/base_decode: performance improvement
For example, for 50 KB of random data, and base 43,
previously,
- base_encode took ~38 seconds
- base_decode took ~270 seconds
now,
- base_encode takes ~7.5 seconds
- base_decode takes ~6 seconds
2019-12-08 06:07:01 +01:00
SomberNight
83740c1a78 psbt: implement CompactSize key types (previously single-byte types)
based on latest BIP-0174 update: bitcoin/bips#849
2019-11-07 03:27:38 +01:00
SomberNight
bafe8a2fff integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
e9a1c05d23 bitcoin.relayfee: minor clean-up 2019-09-18 22:08:19 +02:00
SomberNight
b3da13420b bitcoin.py: SCRIPT-related clean-up. transaction.py: construct_witness 2019-08-20 09:03:09 +02:00
SomberNight
98f46dbaf5 implement script_num_to_hex. fix encoding of argument for CSV in make_commitment 2019-08-20 09:03:09 +02:00
SomberNight
8390da9b7b bitcoin.py: dedupe pubkeyhash_to_p2pkh_script 2019-07-31 01:18:51 +02:00
SomberNight
7584cebbe3 bitcoin: stricter check on WIF for compressed pubkeys
fixes #5290
2019-04-25 14:35:16 +02:00
SomberNight
d4a2e9634f bitcoin: disallow importing/sweeping segwit scripts with uncompressed pubkey
fixes #4638
2019-04-19 00:37:28 +02:00
SomberNight
a1d98d4331 sweep/import key: show error in Qt GUI to user as tooltip 2019-04-19 00:15:45 +02:00
SomberNight
b39c51adf7 mv "electrum seed" stuff from bitcoin.py to mnemonic.py 2019-02-22 18:01:54 +01:00
SomberNight
e7f38467d7 move opcodes to bitcoin.py 2019-02-22 17:39:58 +01:00
SomberNight
53310690a5 version notifications: sig check would always fail on testnet 2019-01-26 15:30:30 +01:00
ThomasV
5a93bf054e 2fa segwit (from ghost43's PR) 2018-12-11 09:28:35 +01:00
SomberNight
a53dded50f bitcoin: avoid floating point in int_to_hex 2018-11-26 01:34:23 +01:00
SomberNight
36f64d1ad9 bitcoin/ecc: some more type annotations 2018-11-18 22:07:27 +01:00
SomberNight
e37da62a1c fix most "scripts"
related: #4754
2018-11-02 20:14:59 +01:00
SomberNight
791e0e1a67 move relayfee and dust_threshold to bitcoin.py 2018-10-25 23:08:59 +02:00
SomberNight
082a83dd85 rename crypto.Hash to sha256d 2018-10-25 22:28:24 +02:00
SomberNight
a88a2dea82 split bip32 from bitcoin.py 2018-10-25 22:20:33 +02:00
SomberNight
1af225015a fix some type annotations involving tuples 2018-10-13 05:16:36 +02:00
SomberNight
04c1b522d6 minor fixes for prev
use TxOutputHwInfo namedtuple

warn user if device is set to wrong chain

undo parts of prev re testnet. fix p2wpkh.

testnet support. and minor stuff
2018-08-22 21:52:28 +02:00
SomberNight
b4b1de088a move TrezorClient.expand_path to bitcoin.py
and allow its input to end with a '/' slash
2018-08-14 18:19:16 +02:00