Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check lwk compatibility with confidential transactions discount #48

Open
YusukeShimizu opened this issue Aug 3, 2024 · 8 comments
Open

Comments

@YusukeShimizu
Copy link
Contributor

Description

Elements version 23.2.2 and later introduce a discount for confidential transactions.
Would it be possible to add a way for users to check if their lwk version supports the confidential transactions discount?

Background

In peerswap, we're looking to implement a feature that adjusts the default fee rate based on whether confidential transactions are supported.
Having a way to verify lwk compatibility would be very helpful for this.

For your reference, I've attached a link to a pull request that addresses this in the context of elements.
ElementsProject/peerswap#304

@RCasatta
Copy link
Contributor

RCasatta commented Aug 5, 2024

If I understand correctly It doesn't depend on the lwk version but on the version of the consensus node lwk is connected to.

I don't think is currently possible to retrieve the version of the connected elements node without changes on the electrum server because there aren't electrum protocol methods returning information about the elements node they are connected to.

eg.

(echo '{ "id": 0, "method": "server.features", "params": [] }'; sleep 2) | ncat --ssl blockstream.info 995 
{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
    "genesis_hash": "1466275836220db2944ca059a3a10ef6fd2ea684b0688d2c379296888a206003",
    "hash_function": "sha256",
    "hosts": {
      "electrum.blockstream.info": {
        "ssl_port": 50402,
        "tcp_port": 50401
      },
      "explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion": {
        "ssl_port": null,
        "tcp_port": 195
      }
    },
    "protocol_max": "1.4",
    "protocol_min": "1.4",
    "pruning": null,
    "server_version": "electrs-esplora 0.4.1"
  }
}

Another approach at the user level may be the "Ask forgiveness not permission" one, trying to broadcast with the discounted fee and if the broadcast fail try with the non-discounted one.

@RCasatta
Copy link
Contributor

We should provide a method on the TxBuilder to opt in though...

@YusukeShimizu
Copy link
Contributor Author

YusukeShimizu commented Aug 21, 2024

@RCasatta
My understanding is that transactions created with the current send method do not have the CT discount applied.

In this case, can I expect that a parameter will be added that allows options to be applied?

@RCasatta
Copy link
Contributor

RCasatta commented Aug 21, 2024

Yes, current transactions are created without the discount. There will be an option in the tx builder to enable the discount. Will be default off until the discount isn't deployed in the live network and default on after.

@LeoComandini may work on that in the next days/weeks

@YusukeShimizu
Copy link
Contributor Author

YusukeShimizu commented Aug 22, 2024

Is it possible in LDK to test without actually broadcasting a tx, similar to the testmempoolaccept for elements?

Background:
In peerswap's Negotiation protocol, we need to calculate the estimated tx fee and send it to the peer, and I'm considering using it for that purpose.

@LeoComandini
Copy link
Contributor

@YusukeShimizu we have

lwk_cli wallet broadcast -w WALLET_NAME -p PSET --dry-run

however it does not allow you to get the fee out of the transaction.

Instead you should use

lwk_cli wallet pset-details -w WALLET_NAME -p PSET

and get the fee from that.

Note that in Liquid the fee is explicit, so it's not an estimate.

@YusukeShimizu
Copy link
Contributor Author

Thank you.

While I understand that pset-details can confirm the fee of the created transaction, it might be slightly different from my intention.

I'd like to check if the connected elements support ct discount. Is there a way to do this?
I believe the approach you suggested below is the way to go, so I think I need something similar to testmempoolaccept.

Another approach at the user level may be the "Ask forgiveness not permission" one, trying to broadcast with the discounted fee and if the broadcast fail try with the non-discounted one.

I'm not familiar with Rust, but from looking at the lwk code, I don't think lwk_cli wallet broadcast -w WALLET_NAME -p PSET --dry-run can tell whether the actually connected elements support ct discount.

@YusukeShimizu
Copy link
Contributor Author

In peerswap, we've decided to enforce CT discount settings by bumping the protocol version.
So, you can disregard the above issue.

I would appreciate it if you could let me know when the CT discount option is added to the send method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants