CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

How bitcoin miners choose timestamp in block header when mining?

I did a statistic about the difference between the first announcement time in the network and the timestamp in block header for blocks within 2020. Surprisingly, most (93%) differences are less than 100 seconds. One of the possible reasons is my statistic is wrong, but if the result is accurate, I am really curious about the reason behind it.

My original understanding of mining is to pick a timestamp (the timestamp of when miners started mining) and then fix it. After that, the miner chooses different nonces to solve the puzzle. However, this strategy seems can not result in the distribution of differences above. So I am wondering how bitcoin miners choose timestamps when mining in the real world.

One of the strategies that can lead to the distribution above I can imagine is: Miners change the timestamp frequently according to real-time timestamp. But I failed to find any relevant information about this strategy…

Crypto Hats, Crypto Shirts, Crypto Socks, Crypto Clothing

Library function access-level

I have a contract A, which has an instance of contract B, i.e., B b. Contract A calls a function of contract B via the instance, i.e., b.func(). Contract B is stateless, i.e., no global non-constant variables. I therefore decided to redeclare it as a library. After that, when I compile contract A, I get::Listen

I have a contract A, which has an instance of contract B, i.e., B b.

Contract A calls a function of contract B via the instance, i.e., b.func().

Contract B is stateless, i.e., no global non-constant variables.

I therefore decided to redeclare it as a library.

After that, when I compile contract A, I get the following error:

TypeError: Member "func" not found or not visible after argument-dependent lookup in type(library B) 

I can resolve the problem by changing the access-level of func from external to internal.

However, that prevents me from calling the function via Web3 (Python).

Can someone please explain this odd behavior, i.e., why do I need to reduce the function’s access-level from external to internal after I “reduce” the contract to a library?

UPDATE:

I think I got it:

The library code is “embedded” into the contract which imports it (like a macro in C if you will).

Then, only functions that are either private, internal or public can be invoked from inside the contract, while external functions can be invoked only from outside the contract.

So my question really is:

How can I reconcile the fact that I want these functions to be internal when used by a contract, and external when accessed via Web3 (for testing purpose)?

Thank you!

How bitcoin miners choose timestamp in block header when mining?

Shopping cart
There are no products in the cart!
Continue shopping
0