From 573fe3515a14e35c319c01cc276b0e9f723defdb Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Tue, 31 Jan 2023 00:27:06 -0500 Subject: [PATCH 1/4] Add block health faq --- frontend/src/app/docs/api-docs/api-docs-data.ts | 7 +++++++ .../src/app/docs/api-docs/api-docs.component.html | 13 +++++++++++++ .../src/app/docs/api-docs/api-docs.component.scss | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/frontend/src/app/docs/api-docs/api-docs-data.ts b/frontend/src/app/docs/api-docs/api-docs-data.ts index 8cbf03dfb..f4b4602ad 100644 --- a/frontend/src/app/docs/api-docs/api-docs-data.ts +++ b/frontend/src/app/docs/api-docs/api-docs-data.ts @@ -8667,6 +8667,13 @@ export const faqData = [ fragment: "why-dont-fee-ranges-match", title: "Why doesn't the fee range shown for a block match the feerates of transactions within the block?", }, + { + type: "endpoint", + category: "advanced", + showConditions: bitcoinNetworks, + fragment: "what-is-block-health", + title: "What is block health?", + }, { type: "category", category: "self-hosting", diff --git a/frontend/src/app/docs/api-docs/api-docs.component.html b/frontend/src/app/docs/api-docs/api-docs.component.html index c343d24c8..9f0b9fc2d 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.html +++ b/frontend/src/app/docs/api-docs/api-docs.component.html @@ -218,6 +218,19 @@

For unconfirmed CPFP transactions, Mempool will show the effective feerate (along with descendent & ancestor transaction information) on the transaction page. For confirmed transactions, CPFP relationships are not stored, so this additional information is not shown.

+ +

Block health indicates the extent of potential censorship in a block. This is determined by counting how many expected transactions a block is missing—a block that is not missing any expected transactions will have 100% health, while a block missing 1 or more expected transactions will have sub-100% health.

+

How does this work? Let sexpected be the set of all transactions Mempool expected to be in a block and let sactual be the set of all transactions actually in a block. Let n be the number of all transactions in both sexpected and sactual.

+

Then let r be the number of all transactions expected to be in sactual but not actually in it (excluding those that have been recently broadcast; see below).

+

Block health is calculated as n / ( n + r ).

+

Transactions appearing in both sexpected and sactual are used (instead of a block's full transaction count) in order to minimize chances that block health is impacted by missing transactions that don't imply censorship:

+ +

Mempool uses a re-implementation of Bitcoin Core's transaction selection algorithm to determine the transactions it expects to see in the next block.

+
+ The official mempool.space website is operated by The Mempool Open Source Project. See more information on our About page. There are also many unofficial instances of this website operated by individual members of the Bitcoin community. diff --git a/frontend/src/app/docs/api-docs/api-docs.component.scss b/frontend/src/app/docs/api-docs/api-docs.component.scss index 7392d1f55..db6d51cf2 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.scss +++ b/frontend/src/app/docs/api-docs/api-docs.component.scss @@ -21,6 +21,12 @@ code { font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New; } +.math { + font-family: monospace; + margin-left: 4px; + margin-right: 4px; +} + tr { white-space: inherit; } From ff3af3a159d60aea661f6948912bd7eb76ce0c16 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Tue, 31 Jan 2023 01:06:33 -0500 Subject: [PATCH 2/4] Add link to faq next to block health metric --- frontend/src/app/components/block/block.component.html | 4 ++-- frontend/src/app/components/block/block.component.scss | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/block/block.component.html b/frontend/src/app/components/block/block.component.html index 828493736..c3b58c4ee 100644 --- a/frontend/src/app/components/block/block.component.html +++ b/frontend/src/app/components/block/block.component.html @@ -53,7 +53,7 @@ - Health + Health - +

diff --git a/frontend/src/app/components/block/block.component.scss b/frontend/src/app/components/block/block.component.scss index 97b5a24f3..e5ac03727 100644 --- a/frontend/src/app/components/block/block.component.scss +++ b/frontend/src/app/components/block/block.component.scss @@ -34,6 +34,10 @@ text-align: left; } } + .info-link { + color: rgba(255, 255, 255, 0.4); + margin-left: 5px; + } } } @@ -227,4 +231,4 @@ h1 { .ng-fa-icon { margin-right: 1em; } -} \ No newline at end of file +} From e3c1343a24e5c014c71953df2d63773f5bbf908a Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Tue, 31 Jan 2023 10:30:16 -0500 Subject: [PATCH 3/4] Remove merge conflict cruft --- frontend/src/app/components/block/block.component.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/src/app/components/block/block.component.scss b/frontend/src/app/components/block/block.component.scss index 3d96495e6..71d5fa6fb 100644 --- a/frontend/src/app/components/block/block.component.scss +++ b/frontend/src/app/components/block/block.component.scss @@ -232,8 +232,6 @@ h1 { margin-right: 1em; } } -<<<<<<< hunicus/block-health-faq -======= .beta { font-size: 10px; @@ -243,4 +241,3 @@ h1 { top: 11px; margin-left: 10px; } ->>>>>>> master From 3f0cbcab636bdeed98538b15d07b65851eeb8f65 Mon Sep 17 00:00:00 2001 From: hunicus <93150691+hunicus@users.noreply.github.com> Date: Tue, 31 Jan 2023 10:50:16 -0500 Subject: [PATCH 4/4] Add 'removed' so meaning of r is more clear --- frontend/src/app/docs/api-docs/api-docs.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/docs/api-docs/api-docs.component.html b/frontend/src/app/docs/api-docs/api-docs.component.html index 9f0b9fc2d..48e9b48eb 100644 --- a/frontend/src/app/docs/api-docs/api-docs.component.html +++ b/frontend/src/app/docs/api-docs/api-docs.component.html @@ -221,7 +221,7 @@

Block health indicates the extent of potential censorship in a block. This is determined by counting how many expected transactions a block is missing—a block that is not missing any expected transactions will have 100% health, while a block missing 1 or more expected transactions will have sub-100% health.

How does this work? Let sexpected be the set of all transactions Mempool expected to be in a block and let sactual be the set of all transactions actually in a block. Let n be the number of all transactions in both sexpected and sactual.

-

Then let r be the number of all transactions expected to be in sactual but not actually in it (excluding those that have been recently broadcast; see below).

+

Then let r be the number of removed transactions—all transactions expected to be in sactual but not actually in it (excluding those that have been recently broadcast; see below).

Block health is calculated as n / ( n + r ).

Transactions appearing in both sexpected and sactual are used (instead of a block's full transaction count) in order to minimize chances that block health is impacted by missing transactions that don't imply censorship: