INJS
  • Introduction
  • Mint INJS
  • Protocol
    • INJRC-20
      • Deploy
      • Mint
      • Transfer
    • Indexer
    • Marketplace
      • Inscribe
      • List/Delist
      • Buy
      • Batch
Powered by GitBook
On this page
  • Mint Rules
  • Mint Process

Mint INJS

PreviousIntroductionNextINJRC-20

Last updated 1 year ago

INJS is an implementation of the INJRC-20 protocol on the Injective blockchain

Info
Detail

Tick

INJS

Max Supply

1,000,000,000

Limit Per Mint

5000

Mint Rules

Send any value to any address using the base64 encoded operation in memo

Mint Process

  1. The frontend computes and obtains a nonce, such that sha256(seed+address+nonce) < HASH_TARGET, where the HASH_TARGET is a fixed value of 0x000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff. The seed is the hash of the block where the tick Deploy operation is located

  2. A nonce could only be used once by an address

  3. The user submits a mint operation with base64 encode: data:,{"p":"injrc-20","op":"mint","tick":"INJS","amt":"5000", "non": "0xabc..."}

  4. The indexer verifies the legitimacy of the user's mint operation

Sample code to generate the nonce:

const {sha256} = require('js-sha256');

function generateNonce() {
  let nonce = '';
  const characters = '0123456789abcdef';
  for (let i = 0; i < 20; i++) {
    nonce += characters.charAt(Math.floor(Math.random() * characters.length));
  }
  return nonce;
}

// Function to compute Proof of Work
async function computeProofOfWork(seed,address,target) {
    let nonce = 0;
    let hash;
    do {
        nonce = generateNonce();
        hash = sha256(seed + address + nonce);
    } while (BigInt('0x'+hash) >= target);
    return nonce;
}

// Example usage
(async () => {
    const address = 'userAddress';
    const seed = 'Block Hash Of Deploy Operation';
    const target = 0x000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn; 

    const nonce = await computeProofOfWork(seed, address, target);
    console.log('Found nonce:', nonce);
})();

The user opens and connect with wallet, initiating the random generation of nonce

injs.ink
INJS Pow Mint Process