Algorand
$0.83202 2.68%
ALGO · 5w

I made my cat into an ASA then distributed him for free automatically [Tutorial/Writeup]

Using AlgoSDK to automatically send ASAs to wallets that Opt-In

Now that we’ve created the ASA, its time to distribute it to people who want it! There are plenty of ways to go about distributing them from trading/selling them on various community marketplaces like /r/AlgoNFTMarketplace but we’re going to use the Algorand Javascript SDK to automate this process. Much of the code below started from Algorand’s Asset Transfer example

Setting up our Code var algosdk = require('algosdk');//Establish Connection to Algorand Nodelet algodServer = ''; //Algorand Node Serverlet algodToken = ''; //Algorand Node Tokenlet algodPort = ''; //Algorand Node Portconst client = new algosdk.Algodv2(algodToken, algodServer, algodPort);//Establish Connection to Algorand Indexerlet indexerServer = ''; //Algorand Indexer Serverlet indexerToken = ''; //Algorand Indexer Tokenlet indexerPort = ''; //Algorand Indexer Portconst indexerClient = new algosdk.Indexer(indexerToken, indexerServer, algodPort);//Connect to the wallet herelet memekey = 'INSERT YOUR MNEMONIC KEY HERE'let key = algosdk.mnemonicToSecretKey(memekey);//Setup Distributionlet myBlock;let assetID = 'Your NFT Asset ID'let sentAmt = 0;let toSend = 1;let note = "Yay";

To get started, you’re going to need to connect to both an Algorand Node and an Algorand Indexer to view transactions. You can either run your own, register an account with Purestake or use Randlab’s Developer API. Next, you need the Mnemonic Key to the wallet that is holding the ASA you wish to distribute. Finally, fill in the asset ID, the amount you wish to send (as long as you have a balance that high. If you have 100 and you wish to send 90, it’ll stop before 90 but you can’t send 200 if you have 100) and a note you wish to include with the transaction.

Searching The Blockchain main = async () => {try{ let stats = (await client.status().do()); if(mycount == undefined){ mycount = stats[‘last-round’]; console.log(“init block: “ + my...
Continue on themintyexchange.medium.com
Recent news
ALGO +2.68% · youtu.be · 19h

Encode Club - Algorand Educate: Reach

On Monday 21st June, we were delighted to host the eighth event in our Algorand Educate series. A huge thank you to Jay from Reach for his great presentation...