[bisq-network/bisq] [WIP] Fee estimation (#4710)

Oscar Guindzberg notifications at github.com
Mon Oct 26 23:41:11 UTC 2020


Users reduce btc miner fees for segwit txs.

Pre-segwit miners used to compare the tx fee to the tx size. Txs were selected by their fee/byte.
Segwit brought the concept of "virtual size".
virtual size of a tx = tx serialized without witness data size + witness (i.e. pub keys and signatures) / 4.
The virtual size of a legacy tx is the same as its size.
Segwit txs have similar sizes compared to legacy txs, but their virtual size is smaller.
New terms are now used such as vsize, vbyte, fee/vbyte, etc.
Miners will compare txs by its fee/vbyte (This is not entirely true, since they use tx weight, but we can do our math using fee/vbyte which is roughly equivalent)
See https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#additional-definitions for more info.

This PR does not include renaming size to vsize, feePerByte to feePerVbyte, etc.
I expect this PR won't be merged to master for a long time
The renames will introduce hundreds of changes all over the code, leading to merging hell.
I plan to do the renames either when merging date is closer or as an independent PR.

I suggest to use this compare these branches https://github.com/oscarguindzberg/bisq/compare/segwit...oscarguindzberg:fee-estimation to understand the content of this PR until https://github.com/bisq-network/bisq/pull/4612 is merged. Otherwise you will find here the content for both PRs making understanding this PR more difficult

You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/4710

-- Commit Summary --

  * Use bitcoinj 0.15.8 (commit fcec3da)
  * BtcWalletService: Use segwit addresses
  * TradeWalletService use P2WSH
  * Revert "Construct dummy outputs with LegacyAddress"
  * Explain why bitcoinSerialize(false) is used
  * Create the scriptCode the right way
  * Deal with P2WPKH has empty scriptSig
  * Revert "Validate AddressEntry.segwit"
  * Set TRADE_PROTOCOL_VERSION to 3
  * Remove unused imports
  * Fee estimation start
  * Use bitcoinj 0.15.8 (commit 60b4f2f)
  * Use tx.getVsize()
  * Use SegwitAddress for fee estimation
  * Use segwit tx sizes
  * Split segwit from legacy inputs

-- File Changes --

    M build.gradle (2)
    M common/src/main/java/bisq/common/app/Version.java (7)
    M core/src/main/java/bisq/core/app/WalletAppSetup.java (2)
    M core/src/main/java/bisq/core/btc/TxFeeEstimationService.java (41)
    M core/src/main/java/bisq/core/btc/model/AddressEntry.java (4)
    M core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java (107)
    M core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java (194)
    M core/src/main/java/bisq/core/btc/wallet/WalletService.java (8)
    M core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java (2)
    M core/src/main/java/bisq/core/dao/governance/bond/lockup/LockupTxService.java (2)
    M core/src/main/java/bisq/core/dao/governance/bond/unlock/UnlockTxService.java (2)
    M core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java (1)
    M core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java (1)
    M core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSignsDelayedPayoutTx.java (6)
    M core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSignsDelayedPayoutTx.java (5)
    M core/src/test/java/bisq/core/btc/TxFeeEstimationServiceTest.java (18)
    M desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java (2)
    M desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java (2)
    M desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java (2)
    M desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java (4)
    M desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java (2)
    M desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java (32)
    M desktop/src/main/java/bisq/desktop/main/overlays/windows/ManualPayoutTxWindow.java (8)
    M desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java (2)
    A feeEstimationStart.txt (1)
    M gradle/witness/gradle-witness.gradle (2)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/4710.patch
https://github.com/bisq-network/bisq/pull/4710.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4710
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201026/47ddd177/attachment-0001.html>


More information about the bisq-github mailing list