When to use arrays vs mappings in Solidity?
Arrays are useful when you know the size of the collection in advance, and you need to be able to iterate over the elements in a specific order. Mappings are useful when you don't know the size of the collection in advance, and you need to be able to quickly lookup values. Here are a few specific scenarios where you might choose to use one over the other: 1. Use an array when you need to store a collection of items that need to be accessed by index. 2. Use a mapping when you need to asso...
Ethereum vanity addresses
Ethereum vanity address is a one-of-a-kind customized address that has portions of it chosen rather than being created at random. Why would you create a vanity address? First of all, it looks cool. The second thing it can help you with is to reinforce your brand and make you more noticeable. How to generate your own vanity address? Creating a vanity address is a straightforward trial-and-error process. When performing high-risk cryptographic operations, such as private key creation, it is imp...
Bored Ape Yacht Club: Smart Contract Breakdown
Bored Ape Yacht Club (BAYC) is a popular NFT collection created by Yuga Labs. In this post, we’ll go over BAYC smart contract code. The source code is available on EtherScan.ERC721BAYC is implemented as an ERC721 token, a standard that defines a set of functions that a smart contract must implement in order to be considered a compliant ERC721 token. These functions include the ability to transfer tokens, approve other addresses to manage your tokens, and check token ownership.ERC721 interface...
Co-founder & CTO of Blank. Building software and helping companies enter web3.
When to use arrays vs mappings in Solidity?
Arrays are useful when you know the size of the collection in advance, and you need to be able to iterate over the elements in a specific order. Mappings are useful when you don't know the size of the collection in advance, and you need to be able to quickly lookup values. Here are a few specific scenarios where you might choose to use one over the other: 1. Use an array when you need to store a collection of items that need to be accessed by index. 2. Use a mapping when you need to asso...
Ethereum vanity addresses
Ethereum vanity address is a one-of-a-kind customized address that has portions of it chosen rather than being created at random. Why would you create a vanity address? First of all, it looks cool. The second thing it can help you with is to reinforce your brand and make you more noticeable. How to generate your own vanity address? Creating a vanity address is a straightforward trial-and-error process. When performing high-risk cryptographic operations, such as private key creation, it is imp...
Bored Ape Yacht Club: Smart Contract Breakdown
Bored Ape Yacht Club (BAYC) is a popular NFT collection created by Yuga Labs. In this post, we’ll go over BAYC smart contract code. The source code is available on EtherScan.ERC721BAYC is implemented as an ERC721 token, a standard that defines a set of functions that a smart contract must implement in order to be considered a compliant ERC721 token. These functions include the ability to transfer tokens, approve other addresses to manage your tokens, and check token ownership.ERC721 interface...
Co-founder & CTO of Blank. Building software and helping companies enter web3.

Subscribe to 0xMarko

Subscribe to 0xMarko
<100 subscribers
<100 subscribers
Share Dialog
Share Dialog
Deploying multiple identical contracts costs a lot of gas.
Want to save gas? Consider using Proxies!
Here's how:
⚡Create implementation contact
⚡Create a Proxy contract that points to the implementation contract
⚡Deploy multiple proxy contracts when needed
The implementation contract is one that contains all the necessary logic for your app.
It may include numerous features, particularly if you are creating an NFT collection with several stages of minting and claiming.
The number of features in a smart contract implementation is directly proportional to the size of the bytecode, which, in turn, increases the gas required for deploying the contract.
We can reduce the deployment cost of new smart contracts by utilizing the Proxy contract.
The Proxy contract is a compact contract that utilizes the EVM instruction 'delegatecall' to delegate all function calls to another contract through its fallback function.
The Proxy contract stores the state variables and the logic contract stores the implementation code.
Check out this Proxy contract implementation I used for my ERC721 collection.

It delegates all calls to a hardcoded implementation contract address and initializes the state with an 'initialize' method that takes the collection name and symbol on deployment.
Btw, don't forget to initialize your implementation contract upon deployment.
It's a common mistake made by developers, and it can result in someone else taking ownership of the contract.
While it's generally not harmful, it depends on the type of proxy used to call it.
To learn about the various types of proxies, be sure to check out the documentation available on OpenZeppelin.
Deploying multiple identical contracts costs a lot of gas.
Want to save gas? Consider using Proxies!
Here's how:
⚡Create implementation contact
⚡Create a Proxy contract that points to the implementation contract
⚡Deploy multiple proxy contracts when needed
The implementation contract is one that contains all the necessary logic for your app.
It may include numerous features, particularly if you are creating an NFT collection with several stages of minting and claiming.
The number of features in a smart contract implementation is directly proportional to the size of the bytecode, which, in turn, increases the gas required for deploying the contract.
We can reduce the deployment cost of new smart contracts by utilizing the Proxy contract.
The Proxy contract is a compact contract that utilizes the EVM instruction 'delegatecall' to delegate all function calls to another contract through its fallback function.
The Proxy contract stores the state variables and the logic contract stores the implementation code.
Check out this Proxy contract implementation I used for my ERC721 collection.

It delegates all calls to a hardcoded implementation contract address and initializes the state with an 'initialize' method that takes the collection name and symbol on deployment.
Btw, don't forget to initialize your implementation contract upon deployment.
It's a common mistake made by developers, and it can result in someone else taking ownership of the contract.
While it's generally not harmful, it depends on the type of proxy used to call it.
To learn about the various types of proxies, be sure to check out the documentation available on OpenZeppelin.
No activity yet