<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ali Nasirlou</title>
    <description>The latest articles on DEV Community by Ali Nasirlou (@alinasirlou).</description>
    <link>https://dev.to/alinasirlou</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4093883%2Fd9055755-e0ad-42f9-8daa-95abacab9a87.png</url>
      <title>DEV Community: Ali Nasirlou</title>
      <link>https://dev.to/alinasirlou</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alinasirlou"/>
    <language>en</language>
    <item>
      <title>5 Solidity Mistakes I Made While Learning Smart Contract Development</title>
      <dc:creator>Ali Nasirlou</dc:creator>
      <pubDate>Mon, 31 Aug 2026 18:09:30 +0000</pubDate>
      <link>https://dev.to/alinasirlou/5-solidity-mistakes-i-made-while-learning-smart-contract-development-46ad</link>
      <guid>https://dev.to/alinasirlou/5-solidity-mistakes-i-made-while-learning-smart-contract-development-46ad</guid>
      <description>&lt;h1&gt;
  
  
  5 Solidity Mistakes I Made While Learning Smart Contract Development
&lt;/h1&gt;

&lt;p&gt;When I started learning Solidity, I thought smart contract development was mainly about learning syntax and writing functions.&lt;/p&gt;

&lt;p&gt;I was wrong.&lt;/p&gt;

&lt;p&gt;Solidity looks simple at first, but building secure contracts requires a completely different mindset.&lt;/p&gt;

&lt;p&gt;Here are five mistakes I made while learning smart contract development.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Thinking "it works" means "it is correct"
&lt;/h2&gt;

&lt;p&gt;One of my biggest mistakes was focusing only on functionality.&lt;/p&gt;

&lt;p&gt;If a function executed successfully, I considered it done.&lt;/p&gt;

&lt;p&gt;But smart contracts are not normal applications.&lt;/p&gt;

&lt;p&gt;A small mistake can lead to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lost funds&lt;/li&gt;
&lt;li&gt;Unauthorized access&lt;/li&gt;
&lt;li&gt;Broken state&lt;/li&gt;
&lt;li&gt;Unexpected behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, after writing a function, I don't only ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Does this work?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"What happens if someone tries to abuse this?"&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. Ignoring access control
&lt;/h2&gt;

&lt;p&gt;At first, access control seemed like a simple topic.&lt;/p&gt;

&lt;p&gt;Something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;require(msg.sender == owner);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But in real projects, authorization is much more important.&lt;/p&gt;

&lt;p&gt;You need to carefully think about:&lt;/p&gt;

&lt;p&gt;Who can call this function?&lt;br&gt;
Who can change important variables?&lt;br&gt;
Who can withdraw funds?&lt;br&gt;
Who can update contract settings?&lt;/p&gt;

&lt;p&gt;A missing access control check can completely compromise a contract.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Not thinking about state transitions
&lt;/h2&gt;

&lt;p&gt;Smart contracts are basically state machines.&lt;/p&gt;

&lt;p&gt;Every transaction changes the state.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Active Listing&lt;br&gt;
        |&lt;br&gt;
        ↓&lt;br&gt;
Purchased Listing&lt;br&gt;
        |&lt;br&gt;
        ↓&lt;br&gt;
Completed&lt;/p&gt;

&lt;p&gt;A good contract should carefully control how states can change.&lt;/p&gt;

&lt;p&gt;Questions I now ask:&lt;/p&gt;

&lt;p&gt;Can this state be reached incorrectly?&lt;br&gt;
Can a function be called twice?&lt;br&gt;
What happens after failure?&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Writing tests only for successful scenarios
&lt;/h2&gt;

&lt;p&gt;When I started testing, I mostly tested:&lt;/p&gt;

&lt;p&gt;"User does something correctly → Contract works"&lt;/p&gt;

&lt;p&gt;But security testing requires another mindset.&lt;/p&gt;

&lt;p&gt;You should also test:&lt;/p&gt;

&lt;p&gt;Invalid inputs&lt;br&gt;
Unauthorized users&lt;br&gt;
Repeated calls&lt;br&gt;
Edge cases&lt;br&gt;
Unexpected behavior&lt;/p&gt;

&lt;p&gt;The best tests are often the ones that try to break your contract.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Learning security after development
&lt;/h2&gt;

&lt;p&gt;This was probably my biggest mindset change.&lt;/p&gt;

&lt;p&gt;At first, I thought:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build the contract&lt;/li&gt;
&lt;li&gt;Finish the features&lt;/li&gt;
&lt;li&gt;Check security&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Design with security in mind&lt;/li&gt;
&lt;li&gt;Build carefully&lt;/li&gt;
&lt;li&gt;Test possible attack scenarios&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security is not a final step.&lt;/p&gt;

&lt;p&gt;It is part of development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Learning Solidity changed the way I think about programming.&lt;/p&gt;

&lt;p&gt;A smart contract is not just code that runs on the blockchain.&lt;/p&gt;

&lt;p&gt;It is code that manages value.&lt;/p&gt;

&lt;p&gt;That means every decision matters.&lt;/p&gt;

&lt;p&gt;The more I learn about Solidity and smart contract security, the more I realize:&lt;/p&gt;

&lt;p&gt;Writing smart contracts is easy. Writing secure smart contracts is the real challenge.&lt;/p&gt;

&lt;p&gt;I'm continuing my journey into smart contract development, security research, and auditing.&lt;/p&gt;

&lt;p&gt;More lessons coming soon.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>security</category>
      <category>smartcontract</category>
      <category>solidity</category>
    </item>
    <item>
      <title>3 Things I Learned Building a Smart Contract Project with Foundry</title>
      <dc:creator>Ali Nasirlou</dc:creator>
      <pubDate>Wed, 26 Aug 2026 11:19:35 +0000</pubDate>
      <link>https://dev.to/alinasirlou/3-things-i-learned-building-a-smart-contract-project-with-foundry-21he</link>
      <guid>https://dev.to/alinasirlou/3-things-i-learned-building-a-smart-contract-project-with-foundry-21he</guid>
      <description>&lt;p&gt;When I started building my NFT marketplace in Solidity, my main goal was simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Make it work.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But as the project grew, I realized that writing Solidity code that works is only part of the job.&lt;/p&gt;

&lt;p&gt;Here are three things I learned while building the project with &lt;strong&gt;Solidity, Foundry, and OpenZeppelin&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Working code doesn't mean secure code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A function can work perfectly and still be vulnerable.&lt;/p&gt;

&lt;p&gt;For example, a marketplace purchase function may look simple:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function buy(uint256 listingId) external payable {
    Listing storage listing = listings[listingId];

    require(msg.value == listing.price);

    // Transfer NFT
    // Transfer payment
    // Update listing
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But then you have to ask:&lt;/p&gt;

&lt;p&gt;What if the listing was already purchased?&lt;br&gt;
What if the seller no longer owns the NFT?&lt;br&gt;
What if approval was revoked?&lt;br&gt;
What happens during an external call?&lt;br&gt;
Can the function be reentered?&lt;/p&gt;

&lt;p&gt;This changed the way I approach smart contracts.&lt;/p&gt;

&lt;p&gt;I don't just ask:&lt;/p&gt;

&lt;p&gt;"Does this function work?"&lt;/p&gt;

&lt;p&gt;I also ask:&lt;/p&gt;

&lt;p&gt;"How could someone break it?"&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Architecture becomes important very quickly&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the beginning, putting everything into one contract seems fine.&lt;/p&gt;

&lt;p&gt;But an NFT marketplace can eventually include:&lt;/p&gt;

&lt;p&gt;Listings&lt;br&gt;
Purchases&lt;br&gt;
Offers&lt;br&gt;
Auctions&lt;br&gt;
Rentals&lt;br&gt;
Fees&lt;br&gt;
Administration&lt;br&gt;
Queries&lt;/p&gt;

&lt;p&gt;Putting all of this into one huge contract quickly becomes difficult to maintain.&lt;/p&gt;

&lt;p&gt;For my project, I started separating responsibilities into different components:&lt;/p&gt;

&lt;p&gt;MarketCore.sol&lt;br&gt;
MarketAdmin.sol&lt;br&gt;
MarketValidation.sol&lt;br&gt;
MarketEvents.sol&lt;br&gt;
MarketErrors.sol&lt;br&gt;
MarketQuery.sol&lt;br&gt;
MarketplaceStorage.sol&lt;/p&gt;

&lt;p&gt;The important lesson wasn't simply "use more contracts."&lt;/p&gt;

&lt;p&gt;It was:&lt;/p&gt;

&lt;p&gt;Give each part of the system a clear responsibility.&lt;/p&gt;

&lt;p&gt;This makes the code easier to understand, test, and audit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Testing shouldn't only prove that things work&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With Foundry, it's easy to write tests for the happy path:&lt;/p&gt;

&lt;p&gt;Create listing&lt;br&gt;
      ↓&lt;br&gt;
Buy NFT&lt;br&gt;
      ↓&lt;br&gt;
NFT transferred&lt;/p&gt;

&lt;p&gt;But smart contract testing should go further.&lt;/p&gt;

&lt;p&gt;I also want to know what happens when:&lt;/p&gt;

&lt;p&gt;Wrong payment&lt;br&gt;
Unauthorized caller&lt;br&gt;
Invalid listing&lt;br&gt;
Revoked approval&lt;br&gt;
Already purchased NFT&lt;br&gt;
Repeated calls&lt;br&gt;
Failed external call&lt;/p&gt;

&lt;p&gt;This is where testing starts becoming security research.&lt;/p&gt;

&lt;p&gt;Instead of only testing:&lt;/p&gt;

&lt;p&gt;"Can a user do this?"&lt;/p&gt;

&lt;p&gt;I try to test:&lt;/p&gt;

&lt;p&gt;"Can a malicious user make this behave differently than intended?"&lt;/p&gt;

&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;Building this project taught me that smart contract development isn't just about writing Solidity.&lt;/p&gt;

&lt;p&gt;It's about thinking about:&lt;/p&gt;

&lt;p&gt;Architecture → State → Edge cases → Testing → Security&lt;/p&gt;

&lt;p&gt;And the biggest lesson I've learned so far is:&lt;/p&gt;

&lt;p&gt;A smart contract isn't good just because it works. You need to understand how it behaves when someone tries to break it.&lt;/p&gt;

&lt;p&gt;I'm continuing to improve the project and dive deeper into smart contract security and auditing.&lt;/p&gt;

&lt;p&gt;More experiments and lessons coming soon.&lt;/p&gt;

</description>
      <category>security</category>
      <category>solidity</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
  </channel>
</rss>
