github.com/klaytn/klaytn@v1.12.1/blockchain/doc.go (about) 1 // Copyright 2018 The klaytn Authors 2 // Copyright 2014 The go-ethereum Authors 3 // This file is part of the go-ethereum library. 4 // 5 // The go-ethereum library is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU Lesser General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // The go-ethereum library is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Lesser General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public License 16 // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. 17 // 18 // This file is derived from core/blockchain.go (2018/06/04). 19 // Modified and improved for the klaytn development. 20 21 /* 22 Package blockchain implements the canonical chain and the state transition model of Klaytn. 23 24 A Klaytn node starts to generate a chain from a genesis block and appends validated blocks transferred from other nodes or generated by the node. 25 Each block containing transactions is validated and processed by each node transiting the global state of the system. 26 The state transition containing EVM execution is triggered by transactions that containing transition messages for the state. 27 Transactions are delivered by RPC servers or other nodes, managed by the tx pool and aggregated to a block. 28 As well as the exact transaction process, Klaytn achieved the efficiency of the transaction processing through a caching logic. 29 The cacheSender concurrently recovers and caches an address from a signature in the transaction which was one of the main bottlenecks of transaction processing. 30 31 Source files 32 33 Each file provides the following features 34 - bad_blocks.go : keeps block hashes of bad blocks which are usually for hard forks. 35 - block_validator.go : implements BlockValidator which is responsible for validation block headers and the processed state. 36 - blockchain.go : implements the canonical chain of blocks and managing functions to support imports, reverts and reorganisations. 37 - chain_indexer.go : implements ChainIndexer. 38 - chain_makers.go : generates temporary blocks or chains to support SimulatedBackend. 39 - error.go : defines errors frequently used in blockchain package. 40 - events.go : defines event structs delivered between go-routines. 41 - evm.go : creates an EVM with a given context for use. 42 - gaspool.go : defines GasPool which tracks and manages the amount of gas available during the transaction execution. 43 - gen_genesis.go : is auto-generated code by gencodec to marshal/unmarshal Genesis as/from JSON. 44 - gen_genesis_account.go : is auto-generated code by gencodec to marshal/unmarshal GenesisAccount as/from JSON. 45 - genesis.go : defines Genesis which specifies values of a genesis block and initial settings of the chain. 46 - genesis_alloc.go : contains the genesis allocation of built-in genesis blocks. 47 - headerchain.go : implements HeaderChain which makes a chain with block headers. 48 - init_derive_sha.go : initialize a DeriveSha function with a specific type. 49 - metrics.go : contains metrics used for blockchain package. 50 - mkalloc.go : creates the genesis allocation constants in genesis_alloc.go. 51 - state_processor.go : implements StateProcessor which takes care of transitioning state. 52 - state_transition.go : implements a state transaction model worked with messages in transactions. 53 - tx_cacher.go : recovers senders of transactions from signatures and caches the sender address. 54 - tx_journal.go: keeps logs of transactions created by the local node. 55 - tx_list.go : provides sorted map and list structures used in tx pool manipulation. 56 - tx_pool.go : contains all currently known transactions and manages the transactions. 57 - types.go : interfaces Validator and Processor which validate or process block data. 58 */ 59 package blockchain