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
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
Have you ever heard of tight variable packing in Solidity?
It's a technique that allows you to save gas when deploying a smart contract and storing or loading statically-sized variables.
Tight variable packing involves carefully arranging your contract's data structures and variables in a way that maximizes the use of available storage space. This means that you can store more information in the same amount of storage space, reducing the amount of gas required for deployment.
To achieve tight variable packing, you need to pay attention to the order and size of your variables. For example, larger variables should be placed before smaller ones.
Tight variable packing is especially important for large and complex contracts, where the savings can be significant.
If you're interested in learning more about tight variable packing, check out this post with code examples-
https://fravoll.github.io/solidity-patterns/tight_variable_packing.html
Don't forget to consider tight variable packing when designing your next Solidity contract! It could save a lot of gas in the long run
Have you ever heard of tight variable packing in Solidity?
It's a technique that allows you to save gas when deploying a smart contract and storing or loading statically-sized variables.
Tight variable packing involves carefully arranging your contract's data structures and variables in a way that maximizes the use of available storage space. This means that you can store more information in the same amount of storage space, reducing the amount of gas required for deployment.
To achieve tight variable packing, you need to pay attention to the order and size of your variables. For example, larger variables should be placed before smaller ones.
Tight variable packing is especially important for large and complex contracts, where the savings can be significant.
If you're interested in learning more about tight variable packing, check out this post with code examples-
https://fravoll.github.io/solidity-patterns/tight_variable_packing.html
Don't forget to consider tight variable packing when designing your next Solidity contract! It could save a lot of gas in the long run
No activity yet