256hax
0
Anatomy of Mad Mints
by 256hax
What is Mad Mints?
Improves the speed of minting transactions. With this approach, you'll be able to handle high demand and experience incredible UX. Armani found this approach and named "Mad Mints".
256hax
2
Source: Mad Armani 🎒 Twitter
https://twitter.com/armaniferrante/status/1644755048436736001
JST Jul 2 2023
Detailed Explanation by ChatGPT-3.5
3 STEPs to Implement Mad Mints.
256hax
3
JST May 24 2023
STEP1
Allocate Durable Nonces
STEP2
Buffer transactions into queue
STEP3
Async process
Allocate 10,000 durable nonces: Nonces are integer values used to differentiate transactions with the same key. By allocating 10,000 durable nonces, you ensure that transactions can be easily tracked and duplicates can be avoided. These nonces are stored in persistent memory and won't be deleted even during reboots or upgrades.
Docs: https://solanacookbook.com/references/offline-transactions.html
Use web2 infrastructure to buffer transactions into a queue: Employ web2 infrastructure, which refers to traditional web infrastructure, to buffer incoming transactions into a queue. Instead of sending transactions directly to the chain, you add them to the queue for processing. This helps handle sudden bursts of transactions and enhances scalability.
Asynchronously process the queue one by one: Process the transaction queue asynchronously, meaning you handle each transaction one by one. This allows you to manage the order in which transactions are processed. You won't move on to the next transaction until the current one has completed all its processing steps.
Process Overview
256hax
4
STEP1
Allocate Durable Nonces
STEP2
Buffer transactions into queue
STEP3
Async process
Queue
JST May 24 2023
Function
Data
Action
Create Durable Nonce
Async request
Sign Transaction
Sign
Add
Send Transaction
Nonce Account
Buffer Transaction
Buffer Transaction
Signature
Conclusion of Mad Mints
If you need fine-tuning speed, you should use Mad Mints.
256hax
5
Pros
(Value)
Example Case
Cons
JST Jun 12 2023
This conclusion is unofficial, in my opinion.
Mint NFTs - Speed Test Result (rough estimate)
256hax
6
Number of Mint NFTs *1 | Mad Mints | Standard (Request directly) | Results | |
Average *2 | Average | |||
Transactions | 1 NFT | 50 ms | 800 ms | Mad Mints 16 times faster |
100 NFTs | 1,900 ms | 46,000 ms | Mad Mints 24 times faster | |
1,000 NFTs | 17,000 ms | 460,000 ms | Mad Mints 27 times faster | |
*1 Create Mint Account and Metadata Account Using Metaplex JavaScript SDK. It's not including upload Metadata JSON and image, verify collection.
*2 Use performance.now method of JS using Solana Test Validator v 1.15.2. macOS Monterey 12.6.5, MacBook Pro (13-inch, 2018), 2.7 GHz Core i7, Memory 16 GB
JST May 28 2023
Speed test scope of Mad Mints
Transfer SOL - Speed Test Result (rough estimate)
256hax
7
Number of Instructions per transaction *1 | Mad Mints | Standard (Request directly) | Results | |
Average *2 | Average | |||
Transactions | 1 Instruction | 10 ms | 20 ms | Mad Mints 2 times faster |
10 Instructions | 13 ms | 29 ms | Mad Mints 2.2 times faster | |
40 Instructions | 20 ms | 53 ms | Mad Mints 2.6 times faster | |
JST May 28 2023
Speed test scope of Mad Mints
*1 Transfer SOL instructions using Solana web3.js.
*2 Use performance.now method of JS using Solana Test Validator v 1.15.2. macOS Monterey 12.6.5, MacBook Pro (13-inch, 2018), 2.7 GHz Core i7, Memory 16 GB
Transaction Processing Bottleneck
Speed bottleneck is "create and use Nonce" process in Sign Transaction.
256hax
8
Sign Transaction
(ToBe)
Mad Mints
(AsIs)
Standard
Create Nonce in advance
Create Instructions
Sign Transaction
Send Transaction
Create Instructions
Send Transaction
Speed Bottleneck
Use Nonce
Create Instructions
Create Durable Nonce
JST Jul 2 2023
Create and Use Nonce
Difference Between Mad Mints and Standard Transaction (Transfer SOL Instruction)
256hax
9
Mad Mints
Standard
Use Nonce ->
JST May 21 2023
Example Codes
256hax
10
JST May 21 2023
Directory Structure and Overview of Example Codes
256hax
11
mad-mints
+--- anchor
+--- docs
+--- packages
+--- queue
...
anchor
(example codes and validator)
packages
(private packages for utility)
queue
(queueing example codes)
common
script
(e.g. create durable nonce)
example code
(including speed test)
example code
(mint large amount NFTs)
queue system
(serverless queueing)
local validator
(clone Metaplex programs for NFT)
JST Jul 2 2023
call
call
request
request
request
Note
I made only Mad Mints example codes.
If you need to inquire "Mad Mints" brand, please contact Armani (@armaniferrante).
Mad Mints logo(fan art) was created by Designer @shiroperu.
256hax
12
JST Nov 22 2023