This project allows you to mint NFTs of deployed smart contracts in a batch from single or multiple addresses. It supports Ethereum and Polygon, including test networks.
git clone https://github.com/kamsec/nft-minter.git
cd nft-minter
pip install -r requirements.txt
(or justpip install web3==5.25.0
)
-
Specify settings in
settings.json
(example values):{ "CHAIN_NAME": "Mumbai", "CONTRACT_ADDRESS": "0xF83C73a44C4a919aB3DF1B515B470e452032eeF4", "MINT_FUNCTION_NAME": "mint", "NUMBER_OF_MINTS": 6, "MINT_PRICE": 0.1, "EXTRA_MIXING_LAYERS": 0, "SEND_BACK": true, "LOGGING": true }
-
Specify secrets in
secrets.json
(replace***
):{ "PRIVATE_KEY": "0x***", "PROVIDER": "***" }
-
Run the program in one of the available modes, e.g.:
python minter.py -multi
It will display selected settings, estimate transaction fees, and ask if you want to proceed. Enter
y
to run the program or anything else to exit.
Settings (settings.json
):
CHAIN_NAME
- set to one of available chains:
Ethereum
,Ropsten
,Rinkeby
,Kovan
,Polygon
,Mumbai
If you need to add other chain, you can modifyCHAINS
dict insettings.py
CONTRACT_ADDRESS
- the address of smart contract deployed on selected chain, withverified
source code (available on corresponding blockchain explorer api)MINT_FUNCTION_NAME
- the exact name of the minting function of smart contract to executeNUMBER_OF_MINTS
- the number of times for minting function to be executed.
In Multi mode this is also the number of accounts derived, each account will execute mint function onceMINT_PRICE
- the minimum price of single mint in Ether (or MATIC if we are on Polygon/Mumbai blockchain), not including transaction feeEXTRA_MIXING_LAYERS
- only for-multi
option - creates additional sets of addresses to mix coins and hide slightly the origin of fundsSEND_BACK
- only for-multi
option - after minting, sends the remaining funds back to the master accountLOGGING
- enables printing transactions and logging inlogs/
directory
In settings.py
you can find additional advanced settings, but normally they don't require adjustments.
Secrets (secrets.json
):
PRIVATE_KEY
- Private key of an address, starting with 0x
You can generate new one by runningpython minter.py -newacc
PROVIDER
- Blockchain API provider key e.g. from Infura, Alchemy or similar
Modes (command-line arguments):
-h
- help page-newacc
- New account mode - generates a new account, displays keys and quits the program-single
- Single mode - initializes master_account fromPRIVATE_KEY
specified insecrets.json
and calls specified mint function from it multiple (NUMBER_OF_MINTS
) times.-multi
- Multi mode - initializes master_account like in Single mode, by hashing the private key derives anotherNUMBER_OF_MINTS
accounts, sends funds to them and mints once from every derived account
Example runs with different settings and modes can be found in logs/
directory.