Questions tagged [blocknumber]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer

Call function when block is initialized

I want to call function on every block in ink smart contract? So when new block is initialized, function is called automatically. Is that possible in ink?
jvn's user avatar
  • 55
2 votes
1 answer

What type should an ink! contract use to store a `uint256` block number retrieved from a Solidity contract?

In Solidity, if we get the block.number it returns type uint256 (alias uint), so I use type uint256 to store the block number in a Solidity contract. However, in ink! the equivalent u256 is not ...
Luke Schoen's user avatar
  • 2,292
4 votes
1 answer

How to stub ink! contract environment to produce fake values for use in tests?

In an ink! contract I need to use Self.env().block_number() to get the current block number to compare it with a block_number_guessed value that I provide when instantiating the contract and check ...
Luke Schoen's user avatar
  • 2,292
0 votes
0 answers

Get block number range for selected era in polkadot.js/api [duplicate]

I want to get block number range for selected era. So, I want to get start, end block number for specific era. How can I get them using polkadot.js/api? I can know from explorer, I need to get from ...
Heindrick's user avatar
  • 183
3 votes
1 answer

Block number in the benchmark code is 0, but is 1 in the running code

If I'm running a benchmark and I get the current block number from inside the benchmark code (i.e. in the setup before I actually call the call I'm trying to benchmark) using frame_system::Pallet::<...
Kyle's user avatar
  • 299
1 vote
1 answer

Get BlockNumber from Pallet

I have struct that holds when it's created as BlockNumber. #[derive(Encode, Decode, Default, Clone, PartialEq, RuntimeDebug, TypeInfo)] #[scale_info(skip_type_params(BlockTime, MaxContentLength))] pub ...
Burak's user avatar
  • 893
4 votes
2 answers

How do you tell which block number the last runtime upgrade happened on a chain?

How do you efficiently tell which block number the last runtime upgrade happened on for a particular chain (without reading every block)? A couple of people have hinted to me that the answer is in a ...
Squirrel's user avatar
  • 3,759
7 votes
1 answer

From a parachain, how to get the current relay chain block number?

From a parachain, how to get the current relay chain block number? I would like to write a hook using the relay chain block as a trigger.
Timothée Delabrouille's user avatar
1 vote
2 answers

How do I access current block number within Benchmarks

Trying to establish this function to be able to run to a specific block to test progressive extrinsics across blocks to simulate real execution within benchmarks: while System::block_number() < ...
Kanthan's user avatar
  • 37
3 votes
2 answers

How get eraIndex by blockNumber?

How can I get the eraIndex by having a blockNumber, or get date of an era? whichever works. like: const eraIndex = getEraIndex(blockNumber); or const date = getDate(eraIndex); Thank you.
Kami's user avatar
  • 537