Home About John Resume/CV References Writing Research

Ethereum 1.0

Overview

Consensus Mechanism

Ethereum 1.0 Proof Of Work

Existing Blockchain technology is working on the core concept of ‘Proof Of Work’ (POW). A proof-of-work (PoW) is a protocol that is difficult to compute but easy to verify. It can be verified in far less time than it took to compute in first place. The process involves scanning for a value that when hashed, (such as with SHA-256), the hash begins with a number of zero bits. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash. In simple words, Proof of work is an expensive computation done by all miners to compete to find a number that, when added to the block of transactions, causes this block to hash to a code with certain rare properties. Finding such a rare number is hard (based on the cryptographic features of the hash function used in this process), but verifying its validity when it’s found is relatively easy. One can take the challenge, the proof string and hash them together and check if the hash begins with a number of zero bits. This requires to apply the hash function just once and verify the output indeed has requisite numbers of 0’s in front. If so, then the proof of work is considered valid under the application of that cryptographic hash function. Every block in the participating network should contain such rare number.

Proof Of Work

Block Structure from go-ethereum

// SealHash returns the hash of a block prior to it being sealed.
func (ethash *Ethash) SealHash(header *types.Header) (hash common.Hash) {
 hasher := sha3.NewLegacyKeccak256()

 rlp.Encode(hasher, []interface{}{
  header.ParentHash,
  header.UncleHash,
  header.Coinbase,
  header.Root,
  header.TxHash,
  header.ReceiptHash,
  header.Bloom,
  header.Difficulty,
  header.Number,
  header.GasLimit,
  header.GasUsed,
  header.Time,
  header.Extra,
 })
 hasher.Sum(hash[:0])
 return hash
}

Signing Mechanism

Transactions are signed using recoverable ECDSA signatures. This method utilises the SECP-256k1 curve. (see the Ethereum Yellow Paper Appendix F. Signing Transactions). go-ethereum utilizes the secp256k1 package which wraps the bitcoin secp256k1 C library. Signing is handled by the signer receives a request and produces a signature. Note, the produced signature conforms to the secp256k1 curve R, S and V values, where the V value will be 27 or 28 for legacy reasons, if legacyV==true.

Code Review

Signing

Consensus

Cryptographic Primitives

general primitives

hash functions

encryption

random number generators

serilization/deserialization

threading

virtual machine

compiler

References

Consensus

Staking

Additional