Custom Bitshares airdrop spotlight #002 & #003: Airdrop onto witnesses & committee members

in BitShareslast year

Check out these new custom airdrop examples!

Recently the Bitshares Airdrop tool introduced support for custom airdrops, enabling users to craft airdrops from input JSON.

So, rather than having to calculate an airdrop based on the ticket selection process, or limiting scope of the airdrop recipients to just the ticket holders you can craft airdrops based on anything.

The following new example custom airdrop input scripts are written in node 18 and work on multiple Bitshares based blockchains!

Committee members

Includes all created committee members, sets value to current total committee votes.

const fs = require('fs');
const { humanReadableFloat } = require('./lib/common');

const url = 'https://api.bitshares.ws/openexplorer/committee_members';
const outputFile = './airdrops/committee_members.json';

const getCommittee = async () => {
  const response = await fetch(url);
  return response.json();
};

const writeToFile = (data) => {
  console.log(`Writing to ${outputFile}`);
  fs.writeFileSync(outputFile, JSON.stringify(data));
};

const main = async () => {
  const committee = await getCommittee();
  const committeeAirdrop = committee.map((member) => ({
    id: member.committee_member_account,
    qty: 1,
    value: humanReadableFloat(member.total_votes, 5)
  }));
  //console.log({ committeeAirdrop });
  writeToFile(committeeAirdrop);
};

main();

Witnesses

Includes all created witnesses, sets value to current total witness votes.

const fs = require('fs');
const { humanReadableFloat } = require('./lib/common');

const url = 'https://api.bitshares.ws/openexplorer/witnesses?status=all';
const outputFile = './airdrops/witnesses.json';

const getWitnesses = async () => {
  const response = await fetch(url);
  return response.json();
};

const writeToFile = (data) => {
  console.log(`Writing to ${outputFile}`);
  fs.writeFileSync(outputFile, JSON.stringify(data));
};

const main = async () => {
  const witnesses = await getWitnesses();
  const witnessesAirdrop = witnesses.map((witness) => ({
    id: witness.witness_account,
    qty: 1,
    value: humanReadableFloat(witness.total_votes, 5)
  }));
  //console.log({ witnessesAirdrop });
  writeToFile(witnessesAirdrop);
};

main();


The output files can be uploaded via the custom airdrop feature in the Airdrop Tool:

Once you've broadcast the airdrop via the Beet multiwallet, you'll have an optional receipt like the following for your airdrop:

image.png


These developments were brought to you by the NFTEA Gallery.
Consider collecting an NFTEA NFT to support continued Bitshares developments.

Don't have a Bitshares account? Make one today!

Sort:  


The rewards earned on this comment will go directly to the people sharing the post on Reddit as long as they are registered with @poshtoken. Sign up at https://hiveposh.com. Otherwise, rewards go to the author of the blog post.