Questions tagged [immutable]

The immutable keyword can be used on state variables which causes them to be read-only, but assignable in the constructor. The value will be stored directly in the code.

Filter by
Sorted by
Tagged with
0 votes
1 answer
16 views

Spotting Admin keys

Doing some research on a few different Ethereum contracts. Is there a good way to tell if a contract has admin keys to invalidate tokens in a wallet or change the code after deployment? Basically I ...
user avatar
0 votes
2 answers
45 views

Solidity immutable equivalent in huff

In the huff language, I am able to specify a constant variable with the constant keyword. (huff docs) #define constant NUM = 0x420 #define constant HELLO_WORLD = 0x48656c6c6f2c20576f726c6421 #define ...
user avatar
0 votes
1 answer
49 views

Why can immutable state variable not be initialised inside an if else statement?

I would like to initialise an immutable state variable inside an if else statement as follows: contract Simple { bool immutable isNatural; constructor(uint number) { if (number != 0) { ...
user avatar
  • 240
1 vote
0 answers
20 views

does solidity compiler convert to immutable implicitly?

I was wondering if the solidity compiler automatically sets a state variable to immutable if it is never modified? example contract MyContract { uint256 myNumber; constructor(uint256 _myNumber){ ...
user avatar
0 votes
1 answer
117 views

Why are functions that access immutable variables not pure?

My understanding is that immutable variables are basically equivalent to constant variables however the former is initialised in the constructor whereas the later at declaration, however both are ...
user avatar
  • 240
0 votes
1 answer
307 views

Is it possible to have an immutable or constant struct?

Is it possible to have a struct that is or has fields that are constant or immutable? // struct with constant or immutable fields: struct MyStruct { uint constant number; int immutable integer; } ...
user avatar
  • 240
0 votes
1 answer
730 views

Is the gas cost for constant and immutable about equal?

According to this question the Solidity 0.5.0 Compiler cannot compute a constant state variable that invokes a function, however I'm also experiencing this issue on Solidity 0.8.10 using the ...
user avatar
  • 240
1 vote
0 answers
33 views

How Ethereum NFT Protect Artist Work ( How NFT IMMUTABILITY works on BLOCKCHAIN)?

Hi Guys let discuss how NFT Immutable works on ethereum blockchain I'm new to nft, just created my first one with opensea:) as in image1. My question https://imgur.com/a/KX6TRgi Is my art piece on ...
user avatar
0 votes
1 answer
62 views

How to verify that a smart contract was deployed by us?

I would like a method called from Solidity to either verify the hash of an entire smart contract's code, or read some immutable EVM property that contracts expose that say who deployed them, e.g. a ...
user avatar
1 vote
1 answer
76 views

Cannot reproduce Etherscan verified compilation for 0.6.6 contract

I'm trying to reproduce the following contract compilation on Etherscan: https://etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb4c659f2488d#code. Runtime bytecode on-chain I can get the runtime ...
user avatar
  • 885
0 votes
1 answer
56 views

Is Ethereum blockchain really temper proof or immutable?

Suppose there is a user A which transfers some ethers to user B through a proper transaction. So is it possible to alter the transaction. Something like going back to the block which contains the ...
user avatar
  • 43
2 votes
1 answer
419 views

What is the best way to store data/information while writing smartcontract?

Smart contracts are immutable. Unless we're 100% sure that our smart-contract is fully functional without any exception we never want to push that in the main net. That's why we have public test net. ...
user avatar
  • 359
0 votes
1 answer
242 views

Is it feasible to write a DApp that targets multiple blockchains

This question does not target Ethereum specifically, but I hope you can help me out! If my questions are too specific, I apologize in advance. I'm trying to utilize Blockchain's immutable + provable ...
user avatar
  • 3
23 votes
3 answers
6k views

What is the difference between the constant and immutable keywords in Solidity?

What is the difference between the constant and immutable keywords in Solidity and how do I use them?
user avatar
18 votes
2 answers
10k views

What is the immutable keyword in Solidity?

What is the immutable keyword in Solidity and how do I use it?
user avatar