I used an Array in my contract that just store Addresses, without any looping around that, is there any gas fee issue about storing data in Array? or is there any limitation about this storage?
Thank you for attention.
I am guessing you are talking about the arrays such as 'arr1' in the Smart Contract below. This one will store the arr1 in Ethereum Virtual Machine's 'storage' - which will use some gas. Remember that any calculation or data storage will always cost some gas in Solidity. The array 'arr2', which is defined inside the function, will use significantly less gas however since it is stored in the 'memory'.
contract test {
address[] arr1 = [0x778E08a594887B208d18a429cfD30d740e0fea71, 0xE8088D6c465Eaa58E123aa08623abaAFFBBBB55B];
function arrayFunction() public pure{
address[] memory arr2 = new address[](2);
arr2[0] = 0x778E08a594887B208d18a429cfD30d740e0fea71;
arr2[1] = 0xE8088D6c465Eaa58E123aa08623abaAFFBBBB55B;
}
}
Ethereum Virtual Machine (EVM) has three areas where it can store data:
Important thing to remember is that variables that are stored in 'memory'/'stack' is always going to use less gas than storing the variable in 'storage'.
A great resource that I would recommend is the gas consumption of the various Opcodes in EVM. Click here.