Skip to content

Instantly share code, notes, and snippets.

@zed-wong
Created December 6, 2023 03:28
Show Gist options
  • Save zed-wong/e39c54efc29faecd782ac0aa3de9d41b to your computer and use it in GitHub Desktop.
Save zed-wong/e39c54efc29faecd782ac0aa3de9d41b to your computer and use it in GitHub Desktop.
sol-inscription
// sol inscription
// change secret to yours
// change rpc is needed
// change public key and data
const { Connection, Keypair, PublicKey, sendAndConfirmTransaction, Transaction, TransactionInstruction } = require("@solana/web3.js");
const bs58 = require("bs58");
var secret = ""
const keypair = Keypair.fromSecretKey(
bs58.decode(secret)
);
const QUICKNODE_RPC = 'https://api.mainnet-beta.solana.com/';
const SOLANA_CONNECTION = new Connection(QUICKNODE_RPC);
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
async function logMemo(message) {
let tx = new Transaction();
await tx.add(
new TransactionInstruction({
keys: [{ pubkey: keypair.publicKey, isSigner: true, isWritable: true }],
data: Buffer.from(message, "utf-8"),
programId: new PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"),
})
)
let result = await sendAndConfirmTransaction(SOLANA_CONNECTION, tx, [keypair]);
console.log("complete: ", `https://solscan.io/tx/${result}`);
return result;
}
var data = `{"p":"src-20","op":"mint","tick":"lamp","amt":"1000"}`
var mintCount = 1000
async function x() {
for (i = 0; i < mintCount; i++) {
logMemo(data)
}
}
try{
x()
} catch(e){
console.log('error:', e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment