Create and launch multiple four.meme tokens from Node.js.
Uploads your image, prepares the token on the four.meme API, calls the on-chain createToken (paying the 0.01 BNB creation fee + optional presale BNB), and (optionally) approves a spender to fast sell the supply for the deploying wallet.
-
See local references in docs/ for API/ABI details.
-
NEW: Blank template generator that can also prefill fresh BSC wallets.
-
Single command to launch one or many tokens FAST (from templates).
-
Sends 0.01 BNB creation fee +
presaleBNBin the same transaction. -
Optional post-create
approvefor fast selling later. -
Parallel or sequential launches (env-controlled).
- Node.js 18+ (works with ESM +
ethers@6). - Some BNB on each deployer wallet:
required ≈ 0.01 (fee) + presaleBNB + gas.
# Primary RPC used to SEND transactions (required)
BSC_RPC_URL=https://your-primary-bsc-rpc.example
# Optional: a different RPC used only for polling receipts (recommended for free tier rpc plans to avoid rate limits)
SECONDARY_RPC_URL=https://your-secondary-bsc-rpc.example
# Path to your templates file
TEMPLATES_PATH=./data/templates.json
# Polling cadence for receipt checks (tune if hitting rate limits)
POLL_INTERVAL_MS=3000
POLL_JITTER_MS=400
# How to launch multiple templates: 'parallel' or 'sequential'
LAUNCH_MODE=parallel
# If LAUNCH_MODE=parallel, cap concurrency (0 = unbounded)
CONCURRENCY=0Notes
- If you only have one RPC, you can omit
SECONDARY_RPC_URLand polling will useBSC_RPC_URL. - If you ever see provider rate-limit errors, increase
POLL_INTERVAL_MSor add aSECONDARY_RPC_URL.
An array of token templates. Each template includes both the token content and the wallet that will deploy it.
| Field | Type | Required | Example / Notes |
|---|---|---|---|
name |
string | ✅ | "CATJAM" |
symbol |
string | ✅ | "CJAM" |
desc |
string | ✅ | Short description |
imagePath |
string | ✅ | Local path to PNG/JPG |
label |
string | ✅ | One of: Meme/AI/Defi/Games/Infra/De-Sci/Social/Depin/Charity/Others |
presaleBNB |
string/number | ✅ | e.g. "0.01" (added to msg.value) |
onlyMPC |
boolean | ✅ | false for regular wallet |
webUrl |
string | ❌ | Optional, leave "" to omit |
twitterUrl |
string | ❌ | Optional |
telegramUrl |
string | ❌ | Optional |
launchDelayMs |
number | ❌ | Default 60000 (ms from “now”) |
rpcUrl |
string | ❌ | Per-template override (else uses BSC_RPC_URL) |
approveAfterCreate |
boolean | ❌ | Default true |
approveSpender |
string | ❌ | Address to receive allowance (defaults to TokenManager2) recommended NOT to change |
approveAmountTokens |
string/number | ❌ | Default "1000000000" (full supply) |
wallet.accountAddress |
string | ✅ | Must match private key |
wallet.privateKey |
string | ✅ | 0x... (keep secure!) |
[
{
"name": "Example Token", //required - token name
"symbol": "EXMPL", //required - token symbol (recommended to use CAPTIAL LETTERS)
"desc": "Demo token used to illustrate configuration fields.", //required - token description
"imagePath": "./assets/sample-token.png", //required - token image
"label": "Meme", //required - Choose one Meme/AI/Defi/Games/Infra/De-Sci/Social/Depin/Charity/Others
"presaleBNB": "0.01", //required - this is the amount in BNB the dev wallet buys
"onlyMPC": false, //DONT CHANGE FROM FALSE - read docs for more info - must be included in the json
"webUrl": "https://example.com", //optional - leave "" empty if not needed
"twitterUrl": "https://twitter.com/example",//optional - leave "" empty if not needed
"telegramUrl": "https://t.me/example",//optional - leave "" empty if not needed
"launchDelayMs": 6000, //delay between launches in ms (6000ms = 6 seconds)
"rpcUrl": "https://..quiknode.pro/<your-endpoint>/", //optional - you ca add differnt rpcUrl's per token or leave blank to use global rpcUrl in env
"approveAfterCreate": true, //optional - approve spending (allows you to sell tokens straight away)
"approveSpender": "0x5c952063c7fc8610FFDB798152D69F0B9550762b", //DONT CHANGE - TokenManager2 contract - Verfiy contract in docs/
"approveAmountTokens": "1000000000", //optional - amount of tokens to approve spending
"wallet": {
"accountAddress": "0xYourWalletAddress", //required
"privateKey": "0xYourPrivateKey" //required
}
}
]
⚠️ Security: This file contains private keys. Keep it out of source control; add it to.gitignoreand restrict file permissions.
These files document Four.meme�s API and on-chain ABIs used by this launcher:
docs/API-Documents.md� General API docs overview used while building the script.docs/API-CreateToken.md� Create-token REST flow and payload notes used to preparecreateArgand signatures.docs/TokenManager2.lite.abi� Minimal ABI for TokenManager2 used by on-chaincreateTokensubmission.docs/TokenManagerHelper3.abi� Helper ABI for related contract interactions and discovery.
Official documentation
- Four.meme Protocol Integration Guide: https://four-meme.gitbook.io/four.meme/protocol-integration
These references are included to make development auditable and to help users verify behavior against official docs.
npm installnode src/tokenCreator.jsnpm run launchRun this to append blank template entries to data/templates.json (or TEMPLATES_PATH if set). You choose how many to generate.
If you choose to generate new BSC wallets, the script writes the public and private keys into each new template and only logs the public keys. The private key log shows [REDEACTED] check templates.json.
npm run templateWallets are generated using ethers v6 via Wallet.createRandom(), which internally uses crypto.randomBytes from Node.js to produce cryptographically secure entropy. This means keys are created locally on your machine using standard, well-audited libraries.
- Sequential
LAUNCH_MODE=sequential - Parallel (unbounded)
LAUNCH_MODE=parallel CONCURRENCY=0
- Parallel (bounded)
LAUNCH_MODE=parallel CONCURRENCY=3
[1/3] launch TEST1 (TEST ONE) wallet 0x8D5e…8046
[0x8D5e…8046] submit TEST1: 0x2314…c2d3 (value 0.02 BNB)
[0x8D5e…8046] created TEST1: 0x81199A…4444 (block 66081179) https://four.meme/token/0x81199A…4444
[0x8D5e…8046] approve: 0x2705…0e8d → 0x5c9520…762b amount 1000000000
[0x8D5e…8046] approved TEST1 in block 66081183
A Summary of all results prints at the end.
- Auth with four.meme (message-signing).
- Upload the token image (returns hosted
imgUrl). - Prepare creation via API (returns
createArg+signature). - Send
createToken(createArg, sign)on TokenManager2 with
msg.value = 0.01 BNB (fee) + presaleBNB. - Poll for the receipt; decode
TokenCreateto get the token address. - Optional:
approve(spender, 1,000,000,000)on the new token.
BSC_RPC_URL– Primary RPC used to send transactions.SECONDARY_RPC_URL– Optional RPC used only to poll receipts.TEMPLATES_PATH– Path totemplates.json.POLL_INTERVAL_MS/POLL_JITTER_MS– Tune if you see rate limits.LAUNCH_MODE–parallelorsequential.CONCURRENCY– Cap parallel jobs (only used whenparallel).
-
Rate-limit errors from your RPC:
- Increase
POLL_INTERVAL_MS(e.g., 3000 → 5000). - Set a different
SECONDARY_RPC_URLfor polling. - Reduce
CONCURRENCYor switch tosequential.
- Increase
-
ACCOUNT_ADDRESS mismatchwallet.accountAddressmust match the providedprivateKey.
-
Insufficient funds
- Each wallet needs:
0.01 + presaleBNB + gas. Check balances.
- Each wallet needs:
- The script enforces the platform’s 0.01 BNB creation fee and includes
presaleBNBinmsg.valueby design. - The default approve spender is the four.meme TokenManager2 contract (
0x5c95…762b). You can set a differentapproveSpenderper template.