Offloading expensive computation to off-chain for saving gas, as simple & fast as possiblePhoto by Shubham Dhage on Unsplash, more artworks at http://guerrillabuzz.com/ Table of Contents i. Introductionii. Practical exampleiii. Conclusion Introduction Ethereum’s high gas problem should not be unfamiliar to you, as a crypto trader, a blockchain developer, or just an enthusiast in the space. With Ether's price standing strong in the $3000 area and gas price on the rise averaging 50–70 Gwei, the gas fee for every transaction is getting more expensive and takes about $4 USD for a simple transfer. There is a way to go around the gas problem, is to put this computation off-chain and let the server do the work. A lot of tutorials online teaching ECDSA involves the use of maths, something about s, r, v, which we all developers (code monkeys) can agree, is boring and difficult to implement without bugs. So in this article, we are just gonna use the built-in functions from contracts written by OpenZeppelin and Ethers.js to build this feature. Practical example In this project, we are going to use a common use case for ECDSA to demonstrate the method, which is setting up a whitelist for an NFT project, and include code snippets to help you get started. This project is written in JavaScript and Solidity. 1. Setup To prepare for ECDSA, you should create a new wallet and use it only for this project as the signature signer. Do not use this wallet for any other purpose but only for signing the message in this project. After creating the wallet, save its private key for later use. 2. Off-chain Signature 2.1. To get started, we will need to first install Ether.js by running: npm run ethers and importing it into the project by: import ethers from ethers 2.2. Then we can initialize the signer instance by creating a new Wallet using the library: const signer = new ethers.Wallet("0x" + "<your private key>"); Remember to add 0x in the prefix of your private key if you exported directly from Metamask. 2.3. Pack the message together, and we can try to pack the address and the nonce for whitelisting: let message = ethers.utils.solidityPack(["address", "uint256"], ["0xabc", "0"]); This is to concatenate the message together to be hashed in the next section. Ethers.js supports a wide range of variables, including string and array like uint256[]: 2.4. Hash the message with keccak256 and sign with the signer wallet: message = ethers.utils.solidityKeccak256(["bytes"], [message]);const signature = await signer.signMessage(ethers.utils.arrayify(message)); This signature is the signature signed for the message with the signer's private key. We can pass this signature along with the verified parameters into the blockchain to ensure that the parameters are valid. The whole code snippet:https://medium.com/media/b7bf0931c9291dc5ff9d222c2f8a4753/href 3. On-chain Verification 3.1. To verify the signature on-chain, we can make use of the contract EDCSA written by OpenZeppelin. To use it, install Openzepplin locally or use it in Remix: npm install @openzeppelin/contracts 3.2. Set up the storage for signer on-chain with a setter: address signer; function setSigner(address _signer) external { signer = _signer;} 3.3. Then pack the values together by abi.encodePacked and hash it with keccack256: bytes32 hash = keccak256(abi.encodePacked(msg.sender, nonce)); 3.4. Turn the signature to an Ethereum signed message: bytes32 message = ECDSA.toEthSignedMessageHash(hash); 3.5. Recover the signer address from the signature: address receivedAddress = ECDSA.recover(message, signature); 3.6. Check if the signer of the message matches the signer store on-chain, only approve if the signer matches: require(receivedAddress != address(0) && receivedAddress == signer); The whole code snippet is:https://medium.com/media/9d470e1a4f48d90b838f2c876555677c/href Conclusion And now you learned how to use ECDSA as simply as possible, without the use of any complex maths. However, there are also tradeoffs of putting computation off-chain but that is beyond the scope of this article. I am going to explain more on this so follow to stay tuned! Want to Connect? You can find me at Twitter Github Discord. Verify Off-chain Results and Whitelist With ECDSA in Solidity Using OpenZeppelin and Ethers.js was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this storyOffloading expensive computation to off-chain for saving gas, as simple & fast as possiblePhoto by Shubham Dhage on Unsplash, more artworks at http://guerrillabuzz.com/ Table of Contents i. Introductionii. Practical exampleiii. Conclusion Introduction Ethereum’s high gas problem should not be unfamiliar to you, as a crypto trader, a blockchain developer, or just an enthusiast in the space. With Ether's price standing strong in the $3000 area and gas price on the rise averaging 50–70 Gwei, the gas fee for every transaction is getting more expensive and takes about $4 USD for a simple transfer. There is a way to go around the gas problem, is to put this computation off-chain and let the server do the work. A lot of tutorials online teaching ECDSA involves the use of maths, something about s, r, v, which we all developers (code monkeys) can agree, is boring and difficult to implement without bugs. So in this article, we are just gonna use the built-in functions from contracts written by OpenZeppelin and Ethers.js to build this feature. Practical example In this project, we are going to use a common use case for ECDSA to demonstrate the method, which is setting up a whitelist for an NFT project, and include code snippets to help you get started. This project is written in JavaScript and Solidity. 1. Setup To prepare for ECDSA, you should create a new wallet and use it only for this project as the signature signer. Do not use this wallet for any other purpose but only for signing the message in this project. After creating the wallet, save its private key for later use. 2. Off-chain Signature 2.1. To get started, we will need to first install Ether.js by running: npm run ethers and importing it into the project by: import ethers from ethers 2.2. Then we can initialize the signer instance by creating a new Wallet using the library: const signer = new ethers.Wallet("0x" + "<your private key>"); Remember to add 0x in the prefix of your private key if you exported directly from Metamask. 2.3. Pack the message together, and we can try to pack the address and the nonce for whitelisting: let message = ethers.utils.solidityPack(["address", "uint256"], ["0xabc", "0"]); This is to concatenate the message together to be hashed in the next section. Ethers.js supports a wide range of variables, including string and array like uint256[]: 2.4. Hash the message with keccak256 and sign with the signer wallet: message = ethers.utils.solidityKeccak256(["bytes"], [message]);const signature = await signer.signMessage(ethers.utils.arrayify(message)); This signature is the signature signed for the message with the signer's private key. We can pass this signature along with the verified parameters into the blockchain to ensure that the parameters are valid. The whole code snippet:https://medium.com/media/b7bf0931c9291dc5ff9d222c2f8a4753/href 3. On-chain Verification 3.1. To verify the signature on-chain, we can make use of the contract EDCSA written by OpenZeppelin. To use it, install Openzepplin locally or use it in Remix: npm install @openzeppelin/contracts 3.2. Set up the storage for signer on-chain with a setter: address signer; function setSigner(address _signer) external { signer = _signer;} 3.3. Then pack the values together by abi.encodePacked and hash it with keccack256: bytes32 hash = keccak256(abi.encodePacked(msg.sender, nonce)); 3.4. Turn the signature to an Ethereum signed message: bytes32 message = ECDSA.toEthSignedMessageHash(hash); 3.5. Recover the signer address from the signature: address receivedAddress = ECDSA.recover(message, signature); 3.6. Check if the signer of the message matches the signer store on-chain, only approve if the signer matches: require(receivedAddress != address(0) && receivedAddress == signer); The whole code snippet is:https://medium.com/media/9d470e1a4f48d90b838f2c876555677c/href Conclusion And now you learned how to use ECDSA as simply as possible, without the use of any complex maths. However, there are also tradeoffs of putting computation off-chain but that is beyond the scope of this article. I am going to explain more on this so follow to stay tuned! Want to Connect? You can find me at Twitter Github Discord. Verify Off-chain Results and Whitelist With ECDSA in Solidity Using OpenZeppelin and Ethers.js was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story

Verify Off-chain Results and Whitelist With ECDSA in Solidity Using OpenZeppelin and Ethers.js

2025/09/09 21:02

Offloading expensive computation to off-chain for saving gas, as simple & fast as possible

Photo by Shubham Dhage on Unsplash, more artworks at http://guerrillabuzz.com/
Table of Contents
i.   Introduction
ii. Practical example
iii. Conclusion

Introduction

Ethereum’s high gas problem should not be unfamiliar to you, as a crypto trader, a blockchain developer, or just an enthusiast in the space. With Ether's price standing strong in the $3000 area and gas price on the rise averaging 50–70 Gwei, the gas fee for every transaction is getting more expensive and takes about $4 USD for a simple transfer.

There is a way to go around the gas problem, is to put this computation off-chain and let the server do the work.

A lot of tutorials online teaching ECDSA involves the use of maths, something about s, r, v, which we all developers (code monkeys) can agree, is boring and difficult to implement without bugs. So in this article, we are just gonna use the built-in functions from contracts written by OpenZeppelin and Ethers.js to build this feature.

Practical example

In this project, we are going to use a common use case for ECDSA to demonstrate the method, which is setting up a whitelist for an NFT project, and include code snippets to help you get started.

This project is written in JavaScript and Solidity.

1. Setup

To prepare for ECDSA, you should create a new wallet and use it only for this project as the signature signer. Do not use this wallet for any other purpose but only for signing the message in this project.

After creating the wallet, save its private key for later use.

2. Off-chain Signature

2.1. To get started, we will need to first install Ether.js by running:

npm run ethers

and importing it into the project by:

import ethers from ethers

2.2. Then we can initialize the signer instance by creating a new Wallet using the library:

const signer = new ethers.Wallet("0x" + "<your private key>");

Remember to add 0x in the prefix of your private key if you exported directly from Metamask.

2.3. Pack the message together, and we can try to pack the address and the nonce for whitelisting:

let message = ethers.utils.solidityPack(["address", "uint256"], ["0xabc", "0"]);

This is to concatenate the message together to be hashed in the next section. Ethers.js supports a wide range of variables, including string and array like uint256[]:

2.4. Hash the message with keccak256 and sign with the signer wallet:

message = ethers.utils.solidityKeccak256(["bytes"], [message]);
const signature = await signer.signMessage(ethers.utils.arrayify(message));

This signature is the signature signed for the message with the signer's private key.

We can pass this signature along with the verified parameters into the blockchain to ensure that the parameters are valid.

The whole code snippet:

https://medium.com/media/b7bf0931c9291dc5ff9d222c2f8a4753/href

3. On-chain Verification

3.1. To verify the signature on-chain, we can make use of the contract EDCSA written by OpenZeppelin. To use it, install Openzepplin locally or use it in Remix:

npm install @openzeppelin/contracts

3.2. Set up the storage for signer on-chain with a setter:

address signer;
function setSigner(address _signer) external { 
signer = _signer;
}

3.3. Then pack the values together by abi.encodePacked and hash it with keccack256:

bytes32 hash = keccak256(abi.encodePacked(msg.sender, nonce));

3.4. Turn the signature to an Ethereum signed message:

bytes32 message = ECDSA.toEthSignedMessageHash(hash);

3.5. Recover the signer address from the signature:

address receivedAddress = ECDSA.recover(message, signature);

3.6. Check if the signer of the message matches the signer store on-chain, only approve if the signer matches:

require(receivedAddress != address(0) && receivedAddress == signer);

The whole code snippet is:

https://medium.com/media/9d470e1a4f48d90b838f2c876555677c/href

Conclusion

And now you learned how to use ECDSA as simply as possible, without the use of any complex maths. However, there are also tradeoffs of putting computation off-chain but that is beyond the scope of this article. I am going to explain more on this so follow to stay tuned!

Want to Connect?
You can find me at Twitter Github Discord.

Verify Off-chain Results and Whitelist With ECDSA in Solidity Using OpenZeppelin and Ethers.js was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.

Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact service@support.mexc.com for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

Mitosis Price Flashes a Massive Breakout Hope; Cup-And-Handle Pattern Signals MITO Targeting 50% Rally To $0.115305 Level

Mitosis Price Flashes a Massive Breakout Hope; Cup-And-Handle Pattern Signals MITO Targeting 50% Rally To $0.115305 Level

The analyst identified a formation of a cup-and-handle pattern on Mitosis’s chart, suggesting that MITO is preparing to see a looming price explosion.
Share
Blockchainreporter2026/01/18 09:00
Spot ETH ETFs Surge: Remarkable $48M Inflow Streak Continues

Spot ETH ETFs Surge: Remarkable $48M Inflow Streak Continues

BitcoinWorld Spot ETH ETFs Surge: Remarkable $48M Inflow Streak Continues The cryptocurrency world is buzzing with exciting news as Spot ETH ETFs continue to capture significant investor attention. For the second consecutive day, these innovative investment vehicles have seen substantial positive flows, reinforcing confidence in the Ethereum ecosystem. This consistent performance signals a growing appetite for regulated crypto exposure among traditional investors. What’s Fueling the Latest Spot ETH ETF Inflows? On September 19, U.S. Spot ETH ETFs collectively recorded a net inflow of an impressive $48 million. This marked another day of positive momentum, building on previous gains. Such figures are not just numbers; they represent tangible capital moving into the Ethereum market through accessible investment products. BlackRock’s ETHA Leads the Charge: A standout performer was BlackRock’s ETHA, which alone attracted a staggering $140 million in inflows. This substantial figure highlights the significant influence of major financial institutions in driving the adoption of crypto-backed ETFs. Institutional Confidence: The consistent inflows, particularly from prominent asset managers like BlackRock, suggest increasing institutional comfort and conviction in Ethereum’s long-term potential. Why Are Consecutive Spot ETH ETF Inflows So Significant? Two consecutive days of net inflows into Spot ETH ETFs are more than just a fleeting trend; they indicate a strengthening pattern of investor interest. This sustained positive movement suggests that initial hesitancy might be giving way to broader acceptance and strategic positioning within the digital asset space. Understanding the implications of these inflows is crucial: Market Validation: Continuous inflows serve as a strong validation for Ethereum as a legitimate and valuable asset class within traditional finance. Liquidity and Stability: Increased capital flowing into these ETFs can contribute to greater market liquidity and potentially enhance price stability for Ethereum itself, reducing volatility over time. Paving the Way: The success of Spot ETH ETFs could also pave the way for other cryptocurrency-based investment products, further integrating digital assets into mainstream financial portfolios. Are All Spot ETH ETFs Experiencing the Same Momentum? While the overall picture for Spot ETH ETFs is overwhelmingly positive, it’s important to note that individual fund performances can vary. The market is dynamic, and different funds may experience unique flow patterns based on investor preferences, fund structure, and underlying strategies. Mixed Performance: On the same day, Fidelity’s FETH saw net outflows of $53.4 million, and Grayscale’s Mini ETH recorded outflows of $11.3 million. Normal Market Fluctuations: These outflows, while notable, are a normal part of market dynamics. Investors might be rebalancing portfolios, taking profits, or shifting capital between different investment vehicles. The net positive inflow across the entire sector indicates that new money is still entering faster than it is leaving. This nuanced view helps us appreciate the complex interplay of forces shaping the market for Spot ETH ETFs. What’s Next for Spot ETH ETFs and the Ethereum Market? The sustained interest in Spot ETH ETFs suggests a potentially bright future for Ethereum’s integration into traditional financial markets. As more investors gain access to ETH through regulated products, the demand for the underlying asset could increase, influencing its price and overall market capitalization. For investors looking to navigate this evolving landscape, here are some actionable insights: Stay Informed: Keep an eye on daily inflow and outflow data, as these can provide early indicators of market sentiment. Understand Diversification: While Spot ETH ETFs offer exposure, remember the importance of a diversified investment portfolio. Monitor Regulatory Developments: The regulatory environment for cryptocurrencies is constantly evolving, which can impact the performance and availability of these investment products. Conclusion: A Promising Horizon for Ethereum The consistent positive net inflows into Spot ETH ETFs for a second straight day underscore a significant shift in how institutional and retail investors view Ethereum. This growing confidence, spearheaded by major players like BlackRock, signals a maturing market where digital assets are increasingly seen as viable components of a modern investment strategy. As the ecosystem continues to develop, these ETFs will likely play a crucial role in shaping Ethereum’s future trajectory and its broader acceptance in global finance. It’s an exciting time to watch the evolution of these groundbreaking financial instruments. Frequently Asked Questions (FAQs) Q1: What is a Spot ETH ETF? A Spot ETH ETF (Exchange-Traded Fund) is an investment product that directly holds Ethereum. It allows investors to gain exposure to Ethereum’s price movements without needing to buy, store, or manage the actual cryptocurrency themselves. Q2: Why are these recent inflows into Spot ETH ETFs important? The recent inflows signify growing institutional and retail investor confidence in Ethereum as an asset. Consistent positive flows can lead to increased market liquidity, potential price stability, and broader acceptance of cryptocurrencies in traditional financial portfolios. Q3: Which funds are leading the inflows for Spot ETH ETFs? On September 19, BlackRock’s ETHA led the group with a substantial $140 million in inflows, demonstrating strong interest from a major financial institution. Q4: Do all Spot ETH ETFs experience inflows simultaneously? No, not all Spot ETH ETFs experience inflows at the same time. While the overall sector may see net positive flows, individual funds like Fidelity’s FETH and Grayscale’s Mini ETH can experience outflows due to various factors such as rebalancing or profit-taking by investors. Q5: What does the success of Spot ETH ETFs mean for Ethereum’s price? Increased demand through Spot ETH ETFs can potentially drive up the price of Ethereum by increasing buying pressure on the underlying asset. However, numerous factors influence crypto prices, so it’s not a guaranteed outcome. If you found this article insightful, consider sharing it with your network! Your support helps us continue to provide valuable insights into the dynamic world of cryptocurrency. Spread the word and help others understand the exciting developments in Spot ETH ETFs! To learn more about the latest crypto market trends, explore our article on key developments shaping Ethereum institutional adoption. This post Spot ETH ETFs Surge: Remarkable $48M Inflow Streak Continues first appeared on BitcoinWorld.
Share
Coinstats2025/09/20 11:10
Trump imposes 10% tariffs on eight European countries over Greenland.

Trump imposes 10% tariffs on eight European countries over Greenland.

PANews reported on January 18th that, according to Jinshi News, on January 17th local time, US President Trump announced via social media that, due to the Greenland
Share
PANews2026/01/18 08:46