Блокировать

Блок представляет собой комбинацию партии транзакций и содержит хэш предыдущего блока в цепи.Это соединяет блоки вместе (в цепочку), потому что хэш получен из шифрования данных блока.Это предотвращает мошенничество, потому что любое изменение в любом предыдущем блоке недействительным все последующие блоки, и все хэши изменяются и замечены всеми, кто запускает блокчейн.

Зачем нам нужны блоки?

TЧтобы убедиться, что все участники в сети Polysmatchain остаются в синхронизации и согласны с точной историей транзакции, разделим транзакцию на несколько блоков.Это означает, что десятки (или сотни) транзакций представлены, согласованы и синхронизированы одновременно.

При расстоянии коммита мы можем дать всем участникам сети достаточно времени, чтобы достичь консенсуса, даже если запросы на транзакцию происходят десятки раз в секунду.Блоки на Polysmartchain совершаются примерно каждые 3 секунды.

Как работают блоки

Чтобы сохранить историю транзакций, блоки строго заказываются (каждый новый блок создан содержит ссылку на его родительский блок), а транзакции в блоке строго заказываются.За исключением случаев в редких случаях, в любой момент времени все участники сети соответствуют точным номеру и истории блоков, и работают над пакетными оперативными запросами активной транзакции на следующий блок.

Once a block is put together (mined) by one of the miners on the network, it propagates to the rest of the network; All nodes add this block to the end of their block chain and continue mining.

What does the block contain?

  • timestamp – Time to mine the block.

  • blockNumber – The length of a block in the blockchain.

  • baseFeePerGas -The minimum cost per gas required to include a transaction in the block.

  • difficulty – The effort required for mining.

  • mixHash – A unique identifier for the block.

  • parentHash – The unique identifier of the previous block (this is how the block forms the chain).

  • transactions –The transactions contained in the block.

  • stateRoot –The entire state of the system: account balance, contract storage, contract codes and account random numbers.

  • nonce – Hash, when used in combination with mixHash, proves that the block has passed the workload proof.

Block Time

Block time refers to the time it takes to mine a new block. In PolySmartChain, the average block time is at 3 seconds and is evaluated after each block. The expected block time is set as a constant at the protocol level and is used to secure the network when miners increase their computing power. The average block time is compared to the expected block time and if the average block time is higher, the block header will be less difficult. If the average block time is lower, the difficulty in the block header is increased.

Block Size

One last important point is that the size of the blocks themselves is bounded. The target size for each block is 15 million gas, but the block size will increase or decrease depending on the network demand. The block limit is limited to a maximum of 30 million (twice the target block size). The total amount of gas consumed by all transactions in the block must be below the block's gas limit. This is important because it ensures that the block does not grow arbitrarily large. If blocks can be arbitrarily large, less capable full nodes will gradually fail to keep up with the network due to space and speed requirements.

Last updated