Skip to content

How to mint FIGHT token on bitcoin

Updated: at 01:05 PM

This is a step by step tutorial to learn how to get NOTE assets on the bitcoin network, we will use a token called FIGHT as an example.

In this tutorial we will teach you how to set up the environment, how to download the code, modify the code, every step of the way there is a detailed instruction, our goal is to let more people understand the note protocol, a greater degree of bitcoin on the power of defi.

Table of contents

Open Table of contents

Understanding the note protocol and smart contracts on bitcoin

Setting up the mining environment for nodejs version minter

System environment

Install Node Manager

use this script install node version 20+

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

install node

nvm install v20.16.0 && source ~/.bashrc

install pnpm

npm install -g pnpm

Modifying the mining program to accommodate new assets

git clone the code

git clone https://github.com/NoteProtocol/NoteWallet.git && cd NoteWallet

In NoteWallet folder, open the code use vscode

code .

Find mint.ts at src/mint.ts

Modify before

const bitwork = "20";
const tick = "NOTE";

const deployData: IDeployN20Data = {
  p: "n20",
  op: "deploy",
  tick,
  max: 2100n * 10000n * 10n ** 8n,
  lim: 5000n * 10n ** 8n,
  dec: 8,
  sch: "50b13619d4d936d7c5c7fb7dfbe752e33b85b33774e9e2b3779f16791fb1c749",
  start: 27530, //start height
  bitwork: stringToBytes(bitwork), //tx must start with bitwork
};

const mintData: IMintN20Data = {
  p: "n20",
  op: "mint",
  tick,
  amt: 5000n * 10n ** 8n,
};

after

const bitwork = "20";
const tick = "FIGHT";

const deployData: IDeployN20Data = {
  p: "n20",
  op: "deploy",
  tick,
  max: 2100n * 10000n * 10n ** 8n,
  lim: 16384n * 10n ** 8n,
  dec: 8,
  sch: "50b13619d4d936d7c5c7fb7dfbe752e33b85b33774e9e2b3779f16791fb1c749",
  start: 854555, //start height
  bitwork: stringToBytes(bitwork), //tx must start with bitwork
};

const mintData: IMintN20Data = {
  p: "n20",
  op: "mint",
  tick,
  amt: 1024n * 10n ** 8n,
};

Or download the modified mining code

git clone https://github.com/FIGHTMAGAonBitcoin/FIGHT-NoteWallet-MINTER.git && cd FIGHT-NoteWallet-MINTER

Install dependencies

run command

pnpm install

Generating a wallet and some notes

the env file

cp .env.example .env

create keys

modify the .env file like this

WALLET_MNEMONIC=""

BTC_URCHAIN_HOST=https://btc.urchain.com/api/
BTC_URCHAIN_HOST_TESTNET=https://btc-testnet4.urchain.com/api/

URCHAIN_KEY="1234567890"
pnpm start
use BTClivenet
info

this action will generate a new address, keep the MNEMONIC safe

Some command operations for mining

fund the mainaddress which start with bc1q…

Wait for 1 Confirmation

balance

The balance command will display the BTC and Token balances in the account. When the account balance is sufficient, you can start mining.

mint

When mining is working properly, there will be the following output

checking 8e63a7b587b66e2ad95c1ccd462a367b3daaa110c6f5e71c4a90377e97dbcf73 31920
checking d7e5f39ca2073dbd5f6ab3fa370d4df3bf175331a5de144adbc4a355052b97f8 31921
checking 3ef2f31d5c3b35febff392c25f4c8c4241af2b10dab813800100dbbd6e6d066b 31922
checking a1e356f33693eabcaf83c5878224602a0d702344d74e172a3682833709d083cb 31923
checking f7a35b927f0c67cc209f3c56f7408544c392078ecfb9356ef8f23957c6151d32 31924
checking 8f84b7fb5b490c677262d0c52362eb68ebeafdd28b24d8ba6aae711753a43ea0 31925
checking 80c1bf8e90f9b2ed482d42f1c03df6dcc3be89aa72ec127d124d7a9c843533e4 31926
checking e3e82f529736493851f5fe1d5e996103956fb329a68e856c5b7a631b19e42224 31927
checking c5786ca50fc362d8c2b48b0429eef0240d9919f99b2f03f10c041dc4b9524beb 31928
checking e5c7afba7f169a61992c7c5ec45a26d84ad8d30d06dc3559f484de9ea83be41a 31929
checking e7bdb9da37d2f308d881c9bc6f2e35e0f547273d6f619476abcc2c504f73ba21 31930
checking 9b2f9f7b1d1976fcea74c5886083a6c9c2cd17a1f7d4db631c1aac745609468c 31931
checking 65ce061e6b72347457b4f069950d38f599ad3e6040f024e4c1e6cf86e0866948 31932

Each successful mining of FULL tokens takes from a few minutes to dozens of minutes.

Mint $FIGHT USE PYTHON VERSION MINTER.

For windows users

Follow the original tutorial to successfully mint

https://github.com/NoteScan/pyNoteMinter

For linux users

install libsecp256k1-dev use these commands.

sudo apt update

sudo apt install libsecp256k1-dev

Finally, you can start mining

python3 note_cmd.py livenet

> balance
> mint fight --loop 6 --amount 1024

notemarket

https://notemarket.io/n20/FIGHT

wallet on your mobile

ChainBow Wallet for ios/android

Wallet on your browser

note market wallet

NOTE Explorer

Note protocol asset browser

Token Economics

https://github.com/NoteProtocol/note-contract/blob/main/src/contracts/n20-pow.ts

The halving time defined in the following code is 1000 blcoks

// Iterate up to 7 times to prevent the mining amount from becoming too small
halvings = halvings > 7n ? 7n : halvings
// Subsidy is cut in half every 1000 blocks which will occur approximately every 1 week.
const subsidy = rshift(this.lim, halvings)

Therefore, the mining returns in the initial state and after each halving are.

>>> 2 ** 14
16384
>>> 2 ** 13
8192
>>> 2 ** 12
4096
>>> 2 ** 11
2048
>>> 2 ** 10
1024
>>> 2 ** 9
512
>>> 2 ** 8
256
    getAmountLimit(currentMined: bigint): bigint {
        let miningAmount = this.lim // Initial mining amount per operation

        // Set the initial halving threshold
        let threshold = this.max / 2n

        // Iterate up to 7 times to prevent the mining amount from becoming too small
        for (let halving = 0n; halving < 7n; halving++) {
            if (currentMined >= threshold) {
                miningAmount /= 2n // Halve the mining amount
                threshold += rshift(this.max, halving + 2n) // Update the next threshold
            }
        }

        return miningAmount
    }

This function of N20_POW defines a halving strategy based on the mining progress. It also undergoes 7 halvings. Whether it is halved based on blocks or mining progress depends on which condition is triggered first.

Do you have any plans for FIGHT Token?

FIGHT is a spirit, a meme culture that gathers the strength of the entire community. Everyone can contribute their own strength to enhance the cohesion of the community. My plan is to enhance the spread of the community through the construction of infrastructure, including but not limited to developing some telegram mini game apps to attract traffic, and promoting on mainstream social media such as X.

Conclusion

This is one of our tutorials on how to mine the note protocol assets on bitcoin, if you are still confused you can Join the FIGHT telegram Group to get a more detailed answer. Thanks for reading.✌🏻