ARC: 0032: Adding BlockHash and BlockHeight #23
evanmarshall
started this conversation in
ARCs
Replies: 1 comment
-
Thanks for the proposal! This would be a useful addition but there are some technical challenges. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
arc: 0032
title: Add block_hash and block_height keywords
authors: [email protected] [email protected]
discussion: #23
topic: Application
status: Draft
created: 12/2/2022
Abstract
Currently, it's not possible to get the
block_height
orblockhash
within an Aleo program.These opcodes would enable Aleo Dapps to take advantage of time without a Time Oracle.
For example, if you have a game like Battleship, a Time Oracle is required to handle the case where one of the players fails to respond. Using
block_height
orblockhash
, a game could introduce timeouts to handle such edge cases.Specification
We should also considering mirroring Solidity global variables:
Dependencies
This impacts snarkVM, snarkOS, aleo, & leo repositories. As a new opcode determined from consensus, it will impact all parts of the Aleo ecosystem.
Backwards Compatibility
Adding new opcodes seems to require a regeneration of the genesis block.
Existing programs should not be impacted.
Security & Compliance
There should not be any security or compliance considerations.
DApp developers should not use these variables as a source of randomness as they could be influenced by validators.
Depending on the usecase, validators may have trouble influencing results if the programs are sufficiently private.
References
Global variables in Solidity: https://docs.soliditylang.org/en/v0.8.17/units-and-global-variables.html
Beta Was this translation helpful? Give feedback.
All reactions