I have written a simple blog post contract in solidity.

contract  Blog {
    uint256 counter ;
    struct BlogPost {
        uint256 id;
        string title;
        string content;
        address user;
    BlogPost[] public posts;
    function createPost(string calldata _title, string calldata _content) external {
        BlogPost memory newPost;

I have deployed my contract on a localnode. I have a few questions on what's happening here:

  1. When I deploy the contract, how and what is getting stored on the blockchain?
  2. When I call the createPost() function, where is the array of structs(BlogPost struct) getting stored on the blockchain? Is it stored on a single block or shared between mulitple blocks?
  3. When I call the createPost() function, what happens on the blockchain?

1 Answer 1


There is that very useful article: https://jeancvllr.medium.com/solidity-tutorial-all-about-structs-b3e7ca398b1e

And you can also use the debugger on remix to see what's happening to the storage of your smart contract when you call 'createPost()'.

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.