1
0
mirror of https://github.com/ACINQ/eclair.git synced 2024-11-19 01:43:22 +01:00
Commit Graph

143 Commits

Author SHA1 Message Date
Richard Myers
71bad3a210
Update Bitcoin Core to v27.1 (#2862)
Bitcoin Core 27.1 adds the coingrinder coin selection algorithm which will help lower on-chain fees during feerate spikes.
2024-06-18 14:41:37 +02:00
Bastien Teinturier
35295af73c
Update Bitcoin Core to v26.1 (#2851)
Bitcoin Core 26.1 contains ancestor-aware funding: it will automatically
fetch unconfirmed ancestors during funding and adapt the fee to apply
the target feerate to the whole unconfirmed package.

We had custom code to implement this entirely in eclair, which we can
now remove.
2024-04-23 10:28:25 +02:00
Fabrice Drouin
6f8713788c
Delegate Bitcoin Core's private key management to Eclair (#2613)
* Make Eclair manage bitcoin core's wallet private keys

We create an empty watch-only wallet and import public descriptors generated by Eclair.
Bitcoin Core can fund transaction and manage utxos, but can no longer sign transactions.

* Check that spent amounts and utxos are consistent before we sign a PSBT

PSBT utxo fields include the amount that are being spent by the PSBT inputs, but there is a "fee attack"
where using amounts that are lower than what is actually spent may make us sign a tx that spends much more
in fees than we think.

* Check that non-segwit uxto has been provided and inputs are signed with SIGHASH_ALL

* Verify that Bitcoin Core's fee match what we specified

When we call Bitcoin Core's `fundrawtransaction` RPC method, we check that the fee that we pay match the fee rate that we requested.
The fee is computed using the utxo information that Bitcoin Core adds to our PSBT before we sign it.

We can safely used this information because if Bitcoin Core lies about the value of the inputs that we're spending then the signature we produce will also not be valid (it commits to the value being spent).

When we're adding wallet inputs to "bump" the fees of a parent transaction we need to take the whole package into account when we verify the actual fee rate, which is why some internal methods were modified to return the package weight that was used as reference when `fundrawtransaction` was called.

* Check that fundrawtransaction does not add more than 1 change output

* Validate addresses and keys generated by bitcoin core

When eclair manages private keys, make sure that we can re-compute addresses and keys
generated by bitcoin core.

* Add a separate configuration file for Eclair's onchain signer

Eclair's onchain signer now has its own `eclair-signer.conf` configuration file in HOCON format.
It includes BIP39 mnemonic codes and passphrase, a wallet name and a timestamp.

When an `eclair-signer.conf` file is found, Eclair's API will return descriptors that can be imported into an
empty watch-only Bitcoin Wallet.
When wallet name in `eclair-signer.conf` matches the name of the Bitcoin Core wallet defined in `eclair.conf`
(`eclair.bitcoind.wallet`), Eclair will bypass Bitcoin Core and sign onchain transactions directly.

* Skip validation of local non-change outputs:

Local non-change outputs send to an external address, for splicing out funds for example.
We assume that these inputs are trusted i.e have been created by a trusted API call and our local
onchain key manager will not validate them during the signing process.

* Document why we use a separate, specific file for the onchain key manager

Using a new signer section is eclair.conf would be simpler but "leaks" because it becomes available everywhere
in the code through the actor system's settings instead of being contained to where it is actually needed
and could potentially be exposed through a bug that "exports" the configuration (through logs, ....)
though this is highly unlikely.

* Additional changes to delegate bitcoin core keys to eclair (#2726)

Refactor the `BitcoinCoreClient` and `LocalOnChainKeyManager` to:

- rely less on exceptions
- use more idiomatic scala (reduce dependency on kotlin types)
- provide more detailed logs

We also simplify the `useEclairSigner` field in `BitcoinCoreClient`.
The complexity of handling the case where there was an on-chain key
manager but for a different wallet than the one configured isn't
something that should be used, so it wasn't worth supporting.

Some checks were inconsistent and are now unified:

- checking the exact `scriptPubKey` in our outputs in TODO and TODO
- we allow using `fundTransaction` with a tx that already includes a
  change output (which may happen when RBF-ing a transaction)
- `getP2wpkhPubkeyHashForChange` didn't verify the returned key

We completely separate the two cases in `signPsbt`, because otherwise
in the non eclair-backed case, we were calling bitcoind's `processpsbt`
twice for no good reason, which is bad for performance.

We also decouple the `OnChainKeyManager` from the `BitcoinCoreClient`.
This lets users keep running their eclair node with a bitcoin client that
owns the private key while configuring the on-chain key manager for a
future bitcoin client that will leverage this on-chain key manager.

Users can use the eclair APIs to get the master xpub and descriptors to
properly configure their next bitcoin core node, and switch to it once it
has synchronized the descriptors.

* Simplify replaceable tx funding

We were previously signing twice (with makes a call to `bitcoind`),
just to get the final weights and adjust the change outputs. This was
unnecessary, as we can adjust the weights before adding inputs.

We were also duplicating the checks where we verify that `bitcoind` is
malicious. We only need to check that once, during the final signing step.

---------

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2023-09-21 15:54:28 +02:00
Bastien Teinturier
42249d5ffa
Update to bitcoind 24.1 (#2711)
This lets us use the new `gettxspendingprevout` instead of fetching the
whole mempool when looking for txs spending one of our channels.

A new feature was added to bitcoind 24.1+ that tries to make the change
output indistinguishable from the payment output. This is a great for
privacy, but it adds randomness to coin selection and uses a non-minimal
set of inputs sometimes. We work around this in tests by updating the
amount of the output we want bitcoind to use to make sure it's sufficient to
pay for both the channel funding and the change output.

This shouldn't be too much of an issue for normal operation, where we'll
sometimes use two inputs instead of one, which costs more fees, but
increases privacy.

See https://github.com/bitcoin/bitcoin/pull/24494 for details.
2023-08-16 17:10:03 +02:00
Bastien Teinturier
50178be6fa
Update to bitcoind 23.2 (#2664) 2023-05-22 10:04:43 +02:00
Bastien Teinturier
ee63c65a1c
Add cpfp-bump-fees API (#1783)
We add a `cpfpbumpfees` API that lets node operators bump the fees
of a package of unconfirmed transactions.

Node operators can for example ensure their funding txs confirm before
they hit the `2016` funding timeout. It's also very useful when you have
a long chain of unconfirmed funding transactions and/or mutual close
transactions and want to bump them all at once.

NB: the node operator needs to figure out which outpoints belong to him
(which should be fairly easy using existing APIs).
2023-05-04 18:20:27 +02:00
Bastien Teinturier
5967f72e64
Update to bitcoind 23.1 (#2551)
This bitcoind release contains a few bug fixes and improvements.
2023-01-04 14:27:46 +01:00
Bastien Teinturier
431df1fddb
Update various doc files (#2547)
- link to plugins repository
- remove android mention for eclair
- update other implementations (renamed)
- update docker CI action versions
- missing eclair-cli APIs in help
2022-12-30 11:14:56 +01:00
Bastien Teinturier
a230395f5f
Test change address type generation (#2513)
Starting with bitcoind 23.0, a new `changetype` parameter was introduced.
If not specified, bitcoind will generate a change output with a type that
matches the main output to make it harder for chain analysis to detect
which output is the change.

The issue is that lightning requires segwit utxos: if an on-chain payment
is sent to a non-segwit address, we still want our change output to use
segwit, otherwise we won't be able to use it. We thus must set
`addresstype` and `changetype` in `bitcoin.conf` to ensure we never
generate legacy change addresses.
2022-11-30 15:44:40 +01:00
Bastien Teinturier
7dbaa41f39
Update to bitcoind 23.x (#2466)
This release of bitcoind contains several bug fixes that let us simplify
our fee bumping logic:

- fixed a bug where bitcoind dropped non-wallet signatures
- added an option to fund transactions containing non-wallet inputs

It also has support for Taproot, which we want in eclair.
2022-11-14 13:47:48 +01:00
Fabrice Drouin
7c8bdb959b
Explain how and why we use bitcoin core (#2473)
* Explain how and why we use bitcoin core

Explain why we chose to delegate most on-chain tasks to bitcoin core (including on-chain wallet management), the additional requirements that it creates and also the benefits in terms of security.
2022-11-03 09:04:20 +01:00
Richard Myers
323aeec09c
Add support for the signet test network (#2387) 2022-08-19 11:15:05 +02:00
Fabrice Drouin
af79f44051
Move arm64 docker file to contrib and udpate README.md (#2327) 2022-06-23 16:11:21 +02:00
Richard Myers
553727cb22
Convert wiki pages in to files in the docs directory and general docs file cleanups (#2165)
Created new files for pages that were in the wiki, but not already in the docs directory. Also made following fixes to  README.md and existing files in the docs directory:

* update bolt links to avoid redirect
* link to logging guide from logging section (README.md)
* fixed typo in Backup section and capitalization of Bitcoin Core (README.md)
* Alice does not need trampoline feature enabled (TrampolinePayments.md)
* link to 2021 edition of Trampoline PR (TrampolinePayments.md)
* fixed API examples and removed quotes from password (API.md)
* use --nodeIds for sendtoroute examples (TrampolinePayments.md and MultipartPayments.md)
* update CLI example 3 to use jq (Usage.md)
* fix typo in docs/FAQ.md
* updated Guide.md to point to all pages that are guides
2022-02-06 20:28:50 +01:00
Fabrice Drouin
f3604cffaf
Document onchain wallet backup. (#2143)
Eclair does not include an onchain wallet and instead uses the wallet of the bitcoin node it is connected to.
Users must also backup this wallet.
2022-01-24 16:32:13 +01:00
Bastien Teinturier
fd565040d3
Remove the GUI (#1981)
So long old friend, and thanks for all the demos!
2021-10-01 14:46:27 +02:00
Dave Scotese
d5c0c73921
Clarify Bitcoin Core supported versions (#1960)
Installation instructions make it clear that only the versions of Bitcoin Core
listed are actively tested with eclair.
2021-09-29 08:49:03 +02:00
Bastien Teinturier
e93110b254
Use Github discussions instead of Gitter (#1954)
Remove references to Gitter, so that newcomers use Github discussions
instead.
2021-09-20 09:03:16 +02:00
Bastien Teinturier
4f93734fe3
Add warning about GUI deprecation (#1929)
The GUI has been deprecated a long time ago, and doesn't inform users about
potential risks, such as RBF-ing funding txs.

We should instead incentivize users to use the CLI and read the documentation,
which ensures they will know about potential pitfalls.
2021-09-03 14:11:48 +02:00
Bastien Teinturier
d53f57fed9
Switch ZMQ to block hash and improve resiliency (#1910)
* Disable ZMQ high watermark

This should prevent messages from being dropped.
We also configure the socket before subscribing to topics and connecting.

* Switch ZMQ raw block to block hash only

We were receiving raw blocks on the ZMQ socket, whereas we don't use it.
We only use this event as a trigger that a new block has been found, so we
can save bandwidth by switching to block hash subscriptions instead.

* Regularly check blocks

In case we haven't received block events on the ZMQ socket, we regularly
check whether we're behind.
2021-08-30 18:08:22 +02:00
llya Evdokimov
759c87fc09
Add advanced configuration details in README.md (#1915)
Add details about advanced bitcoin configuration options and JVM customization.
2021-08-25 09:14:20 +02:00
Pierre-Marie Padiou
79729c78c1
Update README (#1881) 2021-07-16 17:32:34 +02:00
Bastien Teinturier
d4b25d565d
Udpate to Bitcoin Core 0.21.1 (#1841)
Update the default version of `bitcoind` to 0.21.1.
Deprecate support for version 0.18.1 and 0.19.1.
2021-06-09 14:20:00 +02:00
Anton Kumaigorodski
3da0b80cb2
Add a list of community plugins (#1763)
I'll add two of mine later once documentation is there and it's made sure they work as intended.

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2021-04-12 16:37:04 +02:00
Bastien Teinturier
c4c0248ee3
Use bech32 addresses by default (#1717)
Drop mention of p2sh-segwit. We should encourage users to use bech32.
2021-03-05 17:47:37 +01:00
Aris
63d972bdc6
Fix a few typos (#1684)
Fix a few typos in the documentation and variable names.
2021-02-08 11:20:23 +01:00
Donovan
f32e75b006
Segregate the node seed from the channel seed (#1584)
* Segregate the node seed from the channel seed

- change getSeed signature
- change LocalKeyManager signature
- implement getSeeds to return both nodeSeed and channelSeed
- use separate seeds for node and channels
- update README
- create NodeKeyManager & ChannelKeyManager
- add migration tests
* add NodeParams.scala
* add Setup.scala
* remove KeyManager trait, add NodeKeyManager & ChannelKeyManager traits
* remove LocalKeyManager, add LocalNodeKeyManager & LocalChannelKeyManager
* remove LocalKeyManagerSpec, add LocalNodeKeyManagerSpec & LocalChannelKeyManagerSpec
* add Seeds class instead of ordering the seeds (fix by @t-bast)
* update usage of ChannelKeyManager class
* add signChannelAnnouncement method to each KeyManager
* fix seeds tests
* use snake_case for filename
* create crypto.keymanager package
* improve variables names
2020-11-05 11:33:50 +01:00
Bastien Teinturier
1f90e5b80a
Add per-node feerate tolerance (#1575)
When we have a trusted relationship with some of our peers (business
relations, family members, our own mobile wallet, etc) it makes sense to
relax the feerate mismatch constraint.

This must be done per-node, to avoid leaving the gates open for attackers.
2020-10-23 09:31:34 +02:00
Bastien Teinturier
36c9b9b5a5
Configure bitcoin wallet (#1540)
Don't swallow bitcoind exceptions: we wrap them but preserve the
original one.

Allow configuring bitcoin core wallet: it makes sense to allow users
to use a different wallet from the default one.
There's one important caveat: once set, users shouldn't change it while
they have open channels. We mention it clearly in the documentation.

Fixes #1538
2020-09-28 12:07:15 +02:00
Bastien Teinturier
b954defa28
Update to Bitcoin Core 0.20.1 (#1526)
The only impactful change is that by default on regtest and testnet
fallback fee (used when there is not enough historical data to correctly
estimate the feerate) is now set to 0, whereas it was set to 0.0002 btc
in previous versions.

We set it manually in tests `bitcoin.conf` to preserve the previous behavior.
2020-09-08 17:59:52 +02:00
Pierre-Marie Padiou
d22f840e6d
Replace Travis by Github Action (#1477)
Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2020-07-02 11:02:47 +02:00
Bastien Teinturier
7e223e5f5e
Update README (#1405)
Remove mentions of the demo GUI.
2020-05-05 11:51:39 +02:00
araspitzu
22d476774d
Support bitcoin-0.19.1 (#1380)
* Support bitcoin-0.19.1

* Update supported versions of bitcoind in README
2020-04-27 16:10:45 +02:00
araspitzu
8b64e238f2
Allow users to have multiple wallets in bitcoind (#1334)
* Change the bitcoind RPC URL to use the default wallet named ""
2020-03-09 10:32:52 +01:00
araspitzu
f978cfb75d
Avoid illegal reflective operation during startup (#1313)
* Rework plugin loading:

 We now require the plugin to supply a manifest entry for the "Main-Class" attribute, this is used to load the plugin without doing illegal reflection operations. We also get rid of the dependency org.clapper.classutil
2020-02-28 18:29:54 +01:00
araspitzu
a0286458c6
Rework packaging (#1307)
* Replace maven-capsule-plugin with maven-assembly-plugin in eclair-node and eclair-node-gui:
 The new packaging produces a zip file containing a launcher script and all the artifacts and dependencies in lib/.

* Add bash launcher scripts for eclair-node and eclair-node-gui, inspired by https://github.com/sbt/sbt-native-packager/blob/master/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bash-template

* Add windows launcher scripts, inspired by https://github.com/sbt/sbt-native-packager/blob/master/src/main/resources/com/typesafe/sbt/packager/archetypes/scripts/bat-template

* Add option to start kanela agent with eclair-node launcher scripts

* Force unix file ending in launcher scripts

* Add eclair-cli in the bin folder of packaged eclair-node and eclair-node-gui
2020-02-24 15:42:26 +01:00
Dave Scotese
c8dc9e7337 Provide solution to "non-segwit UTXO found." (#1256)
The term "non-segwit UTXOs" appears in the error message that results from having such outputs in your bitcoin core wallet, and now the readme contains that same term and the solution to make troubleshooting easier.
2020-01-21 09:45:14 +01:00
Pierre-Marie Padiou
8ee53bc97d
Drop support for Java 8 (#1135)
We already have Java 7 (for Android) and Java 11. Supporting Java 8
would require crossbuilding, which we are not doing (two recent PRs
broke the build on Java 8).
2019-09-16 11:04:10 +02:00
Bastien Teinturier
b9698f2230
Documentation update (#1092)
* Fix README style warnings
* Add documentation links to the wiki
* Update build instructions.
2019-07-31 13:35:26 +00:00
araspitzu
9afb26e09c
Add eclair-cli to eclair's docker image (#1063)
* Add eclair-cli to eclair's docker image

* Add instructions to use eclair-cli inside the docker container
2019-07-05 09:10:06 +02:00
araspitzu
94a526cc83
Update link for recommended JDK (#1054) 2019-07-01 09:31:37 +02:00
araspitzu
de50cc437e Remove old service and related docs (#1046) 2019-06-24 17:46:55 +02:00
araspitzu
604fd3170f
Add bot support for code coverage (codecov) (#982)
* Add scoverage-maven-plugin dependency

* Update travis build to generate a scoverage report

* Add custom codecov configuration to have nice PR comments

* Add badge for test coverage in readme
2019-05-09 11:42:38 +02:00
Fabrice Drouin
9f96b1b922 Set default chain to "mainnet" (#989)
Eclair is now configured to run on mainnet by default.
2019-05-09 11:30:26 +02:00
Pierre-Marie Padiou
65918ec0de
Rename eclair.bak to eclair.sqlite.bak (#968)
This removes any ambiguity about what the content of the file is about.
2019-04-25 16:34:05 +02:00
Pierre-Marie Padiou
764a1ae84c Update readme with bitcoin 0.17 instructions (#958)
This has somehow been missed by PR #826.
2019-04-23 16:50:39 +02:00
Fabrice Drouin
bed47de5e3
Live channel database backup (#951)
* Backup running channel database when needed

Every time our channel database needs to be persisted, we create a backup which is always
safe to copy even when the system is busy.

* Upgrade sqlite-jdbc to 3.27.2.1

* BackupHandler: use a specific bounded mailbox

BackupHandler is now private, users have to call BackupHandler.props() which always
specifies our custom bounded maibox.

* BackupHandler: use a specific threadpool with a single thread

* Add backup notification script

Once a new backup has been created, call an optional user defined script.
2019-04-19 22:35:12 +02:00
Pierre-Marie Padiou
c530b23175
Added simple plugin support (#927)
Using org.clapper:classutil library and a very simple `Plugin` interface.
2019-04-19 18:10:47 +02:00
araspitzu
fafda93e5b Move the JSON API section of the readme closer to the top (#918)
Also fixed the broken link to old API documentation
2019-03-26 18:29:23 +01:00
araspitzu
a4b94004e4 API: use form data instead of JSON-RPC (#894)
Port the existing API functionalities over a new structure of HTTP endpoints, with the biggest difference being the usage of **named parameters** for the requests (responses are unchanged). RPC methods have become endpoints and the parameters for each are now passed via form-params (clients must use the header "Content-Type" : "multipart/form-data"), this allows for a clearer interpretation of the parameters and results in more elegant parsing code on the server side. It is possible to still use the old API version via a configuration key.

Old API can be used by setting `eclair.api.use-old-api=true`.
2019-03-26 18:10:09 +01:00