-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Client diversity piechart update #15251
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
base: dev
Are you sure you want to change the base?
Changes from 6 commits
4bb1a87
11827ed
1553d14
fb4c103
84292b1
480a1e1
45761c8
0c8ac7c
99615fa
202418c
f8d0a70
171eefa
f689074
1ce8c30
73091d9
1f0116e
cbe8b2e
7cfd42c
352ed27
c57d2c2
8c7ad14
c112033
a6b359b
57ec8f0
8ffc3da
7e6926d
ce7e234
d8b85c6
64c2c57
d2b2910
003b4d0
b697fe3
e0d3b85
9724d25
dfdfc39
8273f9f
4975d85
a7545d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is not needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,27 @@ lang: en | |
sidebarDepth: 2 | ||
--- | ||
|
||
import { PieChart } from "@/components/PieChart" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This import is redundant now that we are injecting the component in the MdComponents file. Also, I think the easiest would be to pass the data array inline like this: <PieChart data={[ { name: "Geth", value: 43 }, ... ]} title="Execution Clients" /> To clarify more, you can't use variables like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @pettinarip for the clarification, it was an oversight pushing the yarn file. Thanks again. |
||
|
||
const executionData = [ | ||
{ name: "Geth", value: 43 }, | ||
{ name: "Nethermind", value: 36 }, | ||
{ name: "Besu", value: 16 }, | ||
{ name: "Erigon", value: 3 }, | ||
{ name: "Reth", value: 2 }, | ||
{ name: "Other", value: 0 }, | ||
] | ||
|
||
const consensusData = [ | ||
{ name: "Lighthouse", value: 32.59 }, | ||
{ name: "Prysm", value: 31.31 }, | ||
{ name: "Teku", value: 27.06 }, | ||
{ name: "Nimbus", value: 5.63 }, | ||
{ name: "Grandine", value: 2.0 }, | ||
{ name: "Lodestar", value: 1.42 }, | ||
{ name: "Others", value: 0.15 }, | ||
] | ||
|
||
The behavior of an Ethereum node is controlled by the client software it runs. There are several production-level Ethereum clients, each one developed and maintained in different languages by separate teams. The clients are built to a common spec that ensures the clients seamlessly communicate with each other and have the same functionality and provide an equivalent user experience. However, at the moment the distribution of clients across nodes is not equal enough to realize this network fortification to its full potential. Ideally, users divide roughly equally across the various clients to bring as much client diversity as possible to the network. | ||
|
||
## Prerequisites {#prerequisites} | ||
|
@@ -41,7 +62,19 @@ There is also a human cost to having majority clients. It puts excess strain and | |
|
||
## Current client diversity {#current-client-diversity} | ||
|
||
|
||
|
||
<div style={{ display: 'flex', gap: '1rem' }}> | ||
<div style={{ flex: 1 }}> | ||
<PieChart data={executionData} title="Execution Clients" /> | ||
</div> | ||
<div style={{ flex: 1 }}> | ||
<PieChart data={consensusData} title="Consensus Clients" /> | ||
</div> | ||
</div> | ||
|
||
 | ||
|
||
_Diagram data from [ethernodes.org](https://ethernodes.org) and [clientdiversity.org](https://clientdiversity.org/)_ | ||
|
||
The two pie charts above show snapshots of the current client diversity for the execution and consensus layers (at time of writing in January 2022). The execution layer is overwhelmingly dominated by [Geth](https://geth.ethereum.org/), with [Open Ethereum](https://openethereum.github.io/) a distant second, [Erigon](https://github.com/ledgerwatch/erigon) third and [Nethermind](https://nethermind.io/) fourth, with other clients comprising less than 1 % of the network. The most commonly used client on the consensus layer - [Prysm](https://prysmaticlabs.com/#projects) - is not as dominant as Geth but still represents over 60% of the network. [Lighthouse](https://lighthouse.sigmaprime.io/) and [Teku](https://consensys.net/knowledge-base/ethereum-2/teku/) make up ~20% and ~14% respectively, and other clients are rarely used. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
"use client" | ||
|
||
import { FaArrowTrendUp } from "react-icons/fa6" | ||
import { Pie, PieChart as RechartsPieChart } from "recharts" | ||
|
||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardFooter, | ||
CardHeader, | ||
CardTitle, | ||
} from "@/components/ui/card" | ||
import { | ||
ChartConfig, | ||
ChartContainer, | ||
ChartTooltip, | ||
ChartTooltipContent, | ||
} from "@/components/ui/chart" | ||
|
||
type PieChartDataPoint = { name: string; value: number } | ||
|
||
/** | ||
* PieChartProps defines the properties for the PieChart component. | ||
* | ||
* @property {PieChartDataPoint[]} data - The data to be displayed in the chart. Each object should have a `name` and `value` property. | ||
* @property {string} [title] - The title of the chart. | ||
* @property {string} [description] - The description of the chart. | ||
* @property {string} [footerText] - The footer text of the chart. | ||
* @property {string} [footerSubText] - The footer subtext of the chart. | ||
*/ | ||
|
||
type PieChartProps = { | ||
data: PieChartDataPoint[] | ||
title?: string | ||
description?: string | ||
footerText?: string | ||
footerSubText?: string | ||
} | ||
|
||
const defaultChartConfig = { | ||
value: { | ||
label: "Value", | ||
color: "hsl(var(--accent-a))", | ||
}, | ||
} satisfies ChartConfig | ||
|
||
/** | ||
* PieChart component renders a pie chart with the provided data and optional title, description, footer text, and footer subtext. | ||
* | ||
* @param {PieChartProps} props - The properties for the PieChart component. | ||
* @returns {JSX.Element} The rendered PieChart component. | ||
*/ | ||
|
||
export function PieChart({ | ||
data, | ||
title, | ||
description, | ||
footerText, | ||
footerSubText, | ||
}: PieChartProps) { | ||
return ( | ||
<Card> | ||
<CardHeader> | ||
{title && <CardTitle>{title}</CardTitle>} | ||
{description && <CardDescription>{description}</CardDescription>} | ||
</CardHeader> | ||
<CardContent> | ||
<ChartContainer config={defaultChartConfig}> | ||
<RechartsPieChart | ||
accessibilityLayer | ||
data={data} | ||
margin={{ | ||
left: 12, | ||
right: 12, | ||
top: 12, | ||
bottom: 12, | ||
}} | ||
> | ||
<ChartTooltip cursor={false} content={<ChartTooltipContent />} /> | ||
<Pie | ||
data={data} | ||
dataKey="value" | ||
nameKey="name" | ||
cx="50%" | ||
cy="50%" | ||
outerRadius={80} | ||
fill="hsl(var(--accent-a))" | ||
label | ||
/> | ||
</RechartsPieChart> | ||
</ChartContainer> | ||
</CardContent> | ||
{(footerText || footerSubText) && ( | ||
<CardFooter> | ||
<div className="flex w-full items-start gap-2 text-sm"> | ||
<div className="grid gap-2"> | ||
{footerText && ( | ||
<div className="flex items-center gap-2 font-medium leading-none"> | ||
{footerText} <FaArrowTrendUp className="h-4 w-4" /> | ||
</div> | ||
)} | ||
{footerSubText && ( | ||
<div className="text-muted-foreground flex items-center gap-2 leading-none"> | ||
{footerSubText} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
</CardFooter> | ||
)} | ||
</Card> | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved.