Ethereum: Calculate hash of block header

Put the Hesha Block Ethereum #502871

As a stretching or investigator, the predators, the internship of the blockchain can be in the wicked. In this state, we dissatisfied with the ethhereum #502871 hash.

What is the cloak block?

The block of the block – this is the first to write in the block in the blockchain. He consists information, which allows the network to verify and turn transaction. Easions of the block of the block have several important flights:

  • Hash: Hash Sha-256 All Block.

  • Result: Structure, Contemporary Valuations, Included Academic Affiliates (Subtracts'), Time Time and Large others.

  • Index: Index of a tacit block in blockchain.

** Hasha filament

To clear the hash of the block of the block, you need to use the cryptographic algorithm. In this case, we will be able to use the SHA-256 (algorithm of the colored hasha 256).

Here is a plaque:

1.

  • Available Tip Data in Bytes : Object Json in Bytes, Using Library, such asJson-Stringify-Safein JavaScript, or Json.dumps ()in Python.

3.

Here are a few realization:

Javascript

Ethereum: Calculate hash of block header

Javascript

Const Blockheader = {

Result: {

// ... other values ​​...

}

Index: 502871,

};

// Available json in bytes

const blockbytes = buffer.from (json.stringify (blockheader), 'utf8');

// Read the hash shah-256 with using the biblioteration Openssl

Const Crypto = Require ('Crypto');

Const Sha256hash = crypto.Createhash ('SHA256'). Area ('HEX');

Console.log (Sha256hash);

Python

`Python

JSON IMport

Import hashlib

Blockheader = {

'Result': {

... other values ​​...

}

"Index": 502871,

}

#Dracet stack json in bytes

block_bytes = json.dumps (blockheader, sort_keys = True) .encode ('utf8')

Read the hash sha-256 with the biblioteration pycrypto

That's cryptography.hazmat.primitives havehi

That's cryptography.hazmat.primitives.Symmetric Import Padding

Deculute_ha256_hash (Data):

Avairats Hashes.Sha256 (Data) .Digest ()

Block_hash = Countulate_ha256_hash (block_bytes)

PRINT (Block_hash.he ())

conclusion

Eat the hash of the ethhereum block is an important trauma in the transaction of transaction and impact of the blockchain. The follow-up of these stages, you can easily touch the hash sha-256 any annual block, using your pre-proclaming tongue programing or the method of inter-formation of the data.

Do not forget to use the authoritative library, so as OpenSSL for cryptographic operations, and all the follow -up techniques with confidal data. Happy Coding!

BITCOIN SATOSHI ALGORITHM HELP MINERS

上部へスクロール