Cave of Secrets ( Part III )Welcome to the technical guide 1) Setting up the Circuit in Circom ( The Wizards setting up the cave magic) // cave_circuit.circom pragma circom 2.1.4; // This circuit represents our magical Cave of Secrets template CaveOfSecrets() { // Private ...Feb 10, 2025·4 min read
Demystifying Memory in EVM (Part II)Alright Let’s Continue from where we left , Previous One : Demystifying Memory in EVM (Part I) Memory Initialization When a contract is executed , the EVM initializes a free memory pointer to 0×80. This is done to provide some space for stack operati...Nov 28, 2024·3 min read
Demystifying Memory in EVM (Part I)Let’s look at the architecture of the Memory in EVM. Scratch Space : Ephemeral space to write values ( used for instance by the sha3 opcode) Free Memory Pointer : It contains the address of the last byte accessed in memory . Memory never gets clean...Nov 26, 2024·2 min read
Storing Mappings in Solidity's StorageOkay let’s first look at the code contract Demo { uint256 a = 0x1a01; // Slot 0 uint256 b = 0x2a01; // Slot 1 mapping(uint => uint) c; // Slot 2 uint256 d = 0x5a01; // Sot 3 constructor(){ c[10] = 0xfe3f; c[100] =...Nov 23, 2024·2 min read
Storing Dynamic Type in SolidityWhen Storing Dynamic type data , We don’t explicitly store the data in the next immediate slot, instead we only store the address of the slot where the element of that index is , In simpler words we are basically storing the “Pointer” to the actual a...Nov 21, 2024·2 min read
Storing Static Type in Solidity's StorageLet’s first have a look at the Code contract Demo{ uint256 a 1234 // slot 0 uint8 b = 0x12; // slot 1 uint8[6] c = [1,2,3,4,5,6]; // line 4 (slot 2) uint256[2] d = [10,20] // line 5 slot(3 & 4) function getSlotvalue(uint slot) public...Nov 19, 2024·1 min read
Storage in Structs (Solidity)Lets first look at the code contract A { struct SomeStruct{ uint256 val1; uint16 val2; bool val3; } uint256 a = 3; // slot 0 uint256 b = 0x555 // slot 1 SomeStruct structVar = SomeStruct(0x2345,5,true) // Line 10 function getSlotVal(u...Nov 18, 2024·1 min read