manbytesgnu_site

Source files for manbytesgnu.org
git clone git://holbrook.no/manbytesgnu_site.git
Log | Files | Refs

20220124_clique_openethereum.rst (2057B)


      1 The clique extra data secret
      2 ############################
      3 
      4 :date: 2022-01-24 20:05
      5 :category: code
      6 :author: Louis Holbrook
      7 :tags: rust,blockchain,openethereum,ethereum
      8 :slug: openethereum-clique-extradata
      9 :summary: Unlocking the extra data in the clique configuration
     10 :lang: en
     11 :status: draft
     12 
     13 
     14 ..
     15 
     16         extradata: 0x536172616675204b61726962752053616e6100000000000000000000000000005C5aB0D602EEF41f82B6fc087A24e61383589C398c6f7b75d90c3b32bdc9b4fcfbb4ad43c853446a2c0c9d3a9590a3349c8e45ce50446bd276cbb99c1f38132cd7e520d6be0ccba78acc59ab50a82f711ff7cb9d00
     17         
     18         32 bytes vanity
     19         20 bytes address
     20         65 bytes signature 
     21 
     22 
     23 .. code-block:: rust
     24 
     25         ethcore/src/engines/clique/mod.rs
     26 
     27         // Protocol constants                                                                                                               
     28         /// Fixed number of extra-data prefix bytes reserved for signer vanity                                                             
     29         pub const VANITY_LENGTH: usize = 32;                                                                                                
     30         /// Fixed number of extra-data suffix bytes reserved for signer signature                                                           
     31         pub const SIGNATURE_LENGTH: usize = 65;     
     32 
     33 
     34 .. code-block:: rust
     35 
     36         ethcore/src/engines/clique/util.rs
     37 
     38          pub fn extract_signers(header: &Header) -> Result<BTreeSet<Address>, Error> {    
     39 
     40         ie data.len() <= VANITY_LENGTH + SIGNATURE_LENGTH {                                                                                   
     41         /// Nonce value for DROP vote                                                                                                       |        Err(EngineError::CliqueCheckpointNoSigner)?                                                                                       
     42         pub const NONCE_DROP_VOTE: H64 = H64([0; 8]);                                                                                       |    }  
     43