<p>Users reduce btc miner fees for segwit txs.</p>
<p>Pre-segwit miners used to compare the tx fee to the tx size. Txs were selected by their fee/byte.<br>
Segwit brought the concept of "virtual size".<br>
virtual size of a tx = tx serialized without witness data size + witness (i.e. pub keys and signatures) / 4.<br>
The virtual size of a legacy tx is the same as its size.<br>
Segwit txs have similar sizes compared to legacy txs, but their virtual size is smaller.<br>
New terms are now used such as vsize, vbyte, fee/vbyte, etc.<br>
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)<br>
See <a href="https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#additional-definitions">https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#additional-definitions</a> for more info.</p>
<p>This PR does not include renaming size to vsize, feePerByte to feePerVbyte, etc.<br>
I expect this PR won't be merged to master for a long time<br>
The renames will introduce hundreds of changes all over the code, leading to merging hell.<br>
I plan to do the renames either when merging date is closer or as an independent PR.</p>
<p>I suggest to use this compare these branches <a class="commit-link" href="https://github.com/oscarguindzberg/bisq/compare/segwit...oscarguindzberg:fee-estimation">oscarguindzberg/bisq@<tt>segwit...oscarguindzberg:fee-estimation</tt></a> to understand the content of this PR until <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="718460002" data-permission-text="Title is private" data-url="https://github.com/bisq-network/bisq/issues/4612" data-hovercard-type="pull_request" data-hovercard-url="/bisq-network/bisq/pull/4612/hovercard" href="https://github.com/bisq-network/bisq/pull/4612">#4612</a> is merged. Otherwise you will find here the content for both PRs making understanding this PR more difficult</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/4710'>https://github.com/bisq-network/bisq/pull/4710</a></p>

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

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-49a96e7eea8a94af862798a45174e6ac43eb4f8b4bd40759b5da63ba31ec3ef7">build.gradle</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-2e7033ee8063a8c889ac6f9317f0dd411805e21ab2d45cb46ec707e3d9f12f4c">common/src/main/java/bisq/common/app/Version.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-9a6f03d75ea99c40f1246b9f34cabb964bea2fc57f7e7267deb2a90b05969e63">core/src/main/java/bisq/core/app/WalletAppSetup.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-9070a38d8e2357c5ea9b08422de7e7609d68b9d40ade97e96013e3d359afad07">core/src/main/java/bisq/core/btc/TxFeeEstimationService.java</a>
    (41)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-a0a115e1e0d8099694144619f5bf039ee2b038e9137c43bacfb62a7fb1602e4d">core/src/main/java/bisq/core/btc/model/AddressEntry.java</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-75820b5165905d1e3a47d5fe31e4b5dba017c6b25a322aad955ffa592a67b362">core/src/main/java/bisq/core/btc/wallet/BtcWalletService.java</a>
    (107)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-2208e815b409a18e37c6d0f1404c9df056762391ac619a3a64b957029dad68e1">core/src/main/java/bisq/core/btc/wallet/TradeWalletService.java</a>
    (194)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-7f839642c099f9c286c0f26df5f69ded7608f780f0ee5f3fbc59175c6ac7fbda">core/src/main/java/bisq/core/btc/wallet/WalletService.java</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-16884a0080a087466d0d81913fcb937fc4d576a83f807d0bbc82f209d9b84903">core/src/main/java/bisq/core/dao/governance/blindvote/MyBlindVoteListService.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-56c1ef7bad0acf4aaabd20d77fe9c3a1fcee2dd75665b605cb1d9217115ec0dd">core/src/main/java/bisq/core/dao/governance/bond/lockup/LockupTxService.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-149b20e6e9412d3da47778e9e0fde8fb014864693abd9e036df4154e86bb08b2">core/src/main/java/bisq/core/dao/governance/bond/unlock/UnlockTxService.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-5136dee3346fc07e6457578648abe309843351d37bc59985dbed539ffb781dd7">core/src/main/java/bisq/core/dao/state/model/governance/CompensationProposal.java</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-95bb9c97e4725f47689a3837dfaa17b0bfce65008b428817d31dbe76f2386aa4">core/src/main/java/bisq/core/dao/state/model/governance/ReimbursementProposal.java</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-38eafe82cc38b25275f642e84d91f7ec6d0c712caa99d88007d0a427c9d15cd1">core/src/main/java/bisq/core/trade/protocol/tasks/buyer/BuyerSignsDelayedPayoutTx.java</a>
    (6)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-d0a5e53be33cf20560e6d8256797a3857af012f05fe98f2572923e65ddb4a60c">core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerSignsDelayedPayoutTx.java</a>
    (5)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-da2cbcc91613834e53e279bb19b371462de951f7f1dc66992f270bc33ddda7a7">core/src/test/java/bisq/core/btc/TxFeeEstimationServiceTest.java</a>
    (18)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-a260e0e52aac2d85c449ae7c7a0a188277d24ffe4a1ac5ee10a8b369de594e71">desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-8332bb7ea0acacd9eeff8dbc0b0e375fa9021dd37822d8733ab28c125560c688">desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-63fe662c67bb89d2fb86c80b6bdc534d83f579990b6b15f5c24d96869c854db5">desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-129ab70d7a6a053bd296608a694f5ce120f764cb1c5ce4ec7d6a7d55a1efff92">desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java</a>
    (4)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-1899e161042b90cb20b10511f052d0c6237757c97ba32fb35dddb31fccb9cb4b">desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java</a>
    (2)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-e91ddc497f0b94a9a80cc234cbdcedaf05e8f40e6e1d5fc7e9c9794f97063495">desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java</a>
    (32)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-af2b2c049b2c688c7ef4461b998618ed316e9ca399d2ac232b0853cbea25c8b6">desktop/src/main/java/bisq/desktop/main/overlays/windows/ManualPayoutTxWindow.java</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-65f92457092a1f763ff7a26d29a61d375c33e4da29c24787053d247f32c366f2">desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-536fe25e2091858d61ac104efa99cdcf5c9a11e8cb6d1f89274b4f932edc57b6">feeEstimationStart.txt</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4710/files#diff-33fe0e084fc9da780801d3a024857640ac47aee9b96ad6ab7d866786a326ed26">gradle/witness/gradle-witness.gradle</a>
    (2)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/4710.patch'>https://github.com/bisq-network/bisq/pull/4710.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/4710.diff'>https://github.com/bisq-network/bisq/pull/4710.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/4710">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNXOH6XRF5UY4SOR46DSMYCJPANCNFSM4TAB2B5A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUX63EVKMSJUYARZHTSMYCJPA5CNFSM4TAB2B5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4K4CVIIA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/4710",
"url": "https://github.com/bisq-network/bisq/pull/4710",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>