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

✨ feat(Cryptography): History of keccak256 #209

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/wiki/Cryptography/keccak256.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,26 @@ The sponge function, central to Keccak's design, operates in two distinct phases
For a deeper understanding of Keccak's internal workings, the [Keccak reference](https://keccak.team/files/CSF-0.1.pdf) provides detailed insights into its algorithms and security features.

## EVM Implementation

The EVM (Ethereum Virtual Machine) processes the execution of transactions for the Ethereum blockchain with a stack based architecture. EVM opcodes are predefined instructions that the EVM interprets and subsequently executes to fulfill transaction and run the smart contracts. There are arithmetic, environmental, control flow, and stack operations Opcodes. Now there is no keccak256 opcode, but there is a SHA3 opcode. The SHA3 opcode is used to encrypt input data from the stack and outputs a Keccak256 hash.

The [Ethereum Yellow Paper](https://ethereum.github.io/yellowpaper/paper.pdf), outlines other implementations of Keccak256 in the Ethereum blockchain:

### Usage in Block Creation and Root Data Structure

- **Block Header Fields**: Various fields in the block header, such as `parentHash` and `stateRoot`, use the Keccak 256-bit hash. This includes hashing the entire header of the parent block, the root node of the state trie, and the root nodes of the trie structures for transactions and receipts.
- **Merkle Patricia Tree**: Ethereum employs a Merkle Patricia Tree to encode its state, where each node in the tree is identified through the Keccak 256-bit hash of its content. This structure underpins the stateRoot field in the block header.
- **Storage Contents Encoding**: The hash is used to encode the storage contents of accounts, mapping the Keccak 256-bit hash of integer keys to the RLP-encoded integer values.

In all these instances, Keccak256's role is critical for ensuring data integrity, facilitating efficient data retrieval, and supporting the blockchain's underlying security mechanisms.

## Keccak256 vs SHA3-256

[Quoting Nick Johnson from Ethereum](https://github.com/ethereum/go-ethereum/pull/2940#issuecomment-274809794):
> SHA3-256 is Keccak256, with the exception of a change in how data is padded. Keccak256 is used because Ethereum's protocol was defined after it was apparent that Keccak256 was the winner of the SHA3 competition, but before the padding change was made.

## References

- [NIST SHA-3 Competition](https://keccak.team/files/Keccak-submission-3.pdf)
- [Ethereum Yellow Paper](https://ethereum.github.io/yellowpaper/paper.pdf)
- [EVM Opcodes](https://www.evm.codes/?fork=shanghai)
10 changes: 5 additions & 5 deletions docs/wiki/EL/el-clients.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Execution Layer Implementations

Resources covering all current and historical execution clients. Overview of client unique features of each client, architecture, guides and resources.
Resources covering all current and historical execution clients. Overview of client unique features of each client, architecture, guides and resources.

## Clients in production

Expand All @@ -10,23 +10,23 @@ Developed by Hyperledger Foundation in Java

### Erigon

Originally fork of geth called turbo-geth
Originally fork of geth called turbo-geth

### Geth

Go-ethereum, developed by a team in EF

### Nethermind

Developed in C# dotnet
Developed in .NET

## Clients in development

### Reth

Developed by Paradigm, recently considered stable

### Silkwarm
### Silkworm

Modular C++ implementation by Erigon team

Expand All @@ -51,4 +51,4 @@ Rust client developed by Parity, later maintained and deprecated as OE

### Trinity

Experimental, prototyping client in Python developed by EF Snake Charmes
Experimental, prototyping client in Python developed by EF Snake Charmers
Loading
Loading