Legend has it that in the time block 793,000, the ancient forefathers embarked upon a magnificent social experience, known as the great OICP mining. Within the earliest 10 blocks, a total of 881 genesis inscriptions were minted. However, only 100 of them were deemed valid and rewarded with $OICP.
Yet, to honor the valorous pioneers and venerable participants who carved the path of the $OICP protocol, at time block 794,500, the ancient god crafted an extraordinary ensemble of transcendental soul cards, known as GENE, within the ethereal META space. These celestial artifacts became forever entwined with the 881 inscriptions, symbolizing a timeless commemoration.
Each soul card is intricately linked to a specific inscription, and depending on its energy, the card manifests in one of six distinct colors: gold, orange, purple, blue, green, and white. However, regardless of the color, every card represents the supreme pinnacle of glory.
However, to complete the final binding, the gods require the assistance of Bit Energy. Therefore, the owners of the inscriptions are requested to deposit a minimum of 2100 sats into the location where these inscriptions were minted before time block 795,000.
Description
All "mint" inscriptions within the range of blocks 793000 to 793009 is eligible to bind with a gene card.
Users who meet the criteria must make a Bitcoin transfer to the address where they minted these inscriptions between block height 794500 and 795000. The Bitcoin amount transferred must be greater than 2100 sats. If an address owns multiple minted inscriptions, a single transfer is enough.
The cards have a property called "rank" which represents different levels of rarity. This property is calculated solely based on on-chain data using the formula
seq = the order of mint time, fr = fee rate, fd = the number of mints within this fee rate
If there is any discrepancy between above textual description and the actual results of the code, the results of the code should be considered authoritative.
Just to clarify, binding is not necessarily requires a money transfer. I added that condition just for fun in this particular example.
Deployment
{
"p": "mrc-721",
"op": "deploy",
"tick": "gene",
"max": "881",
"meta": {
"name": "GENE",
"description": "The first NFT collection in META layer",
"traits":"rank"
},
"code": {
"engine": "trino",
"version": "400",
"body": "with inputs as( select block_height, tx_id, array_join(witness_data,',') payload from bitcoin.inputs t where t.block_height>=793000 and t.block_height<793009 and t.index=0), txns as ( select t.id txid, t.index, fee, virtual_size from bitcoin.transactions t where t.block_height>=793000 and t.block_height<793009 ), output as ( select address as miner, tx_id as txid from bitcoin.outputs t where t.block_height>=793000 and t.block_height<793009 and index=0 ), rawdata as ( SELECT '{' || from_utf8( from_hex( substr( payload, position('2270223a226272632d3230' in payload), position('7d68' in payload) - position('2270223a226272632d3230' in payload) ) ) ) || '}' as body, block_height, t.tx_id as txid FROM inputs t WHERE 1=1 AND t.payload LIKE '%0063036f726401%' AND t.payload LIKE '%2270223a226272632d3230%' AND t.payload LIKE '%227469636b223a226f69637022%' ), formatted as ( select *, COALESCE(TRY(JSON_PARSE(body)), NULL) as data from rawdata ), parsed as ( SELECT t.txid, block_height, json_extract_scalar(t.data, '$.p') as p, json_extract_scalar(t.data, '$.tick') as tick, json_extract_scalar(t.data, '$.op') as op, COALESCE( TRY( CAST (json_extract_scalar(t.data, '$.amt') AS integer) ), 0 ) as amt FROM formatted t where t.data is not null ), filtered as ( select * from parsed t where (t.p='brc-20' or t.p='brc-20c') and t.tick='oicp' and t.op='mint' ), integrated as ( select t.*, f.index,f.fee,f.virtual_size,o.miner from filtered t join txns f on t.txid=f.txid join output o on t.txid=o.txid ), sequenced as ( select row_number() OVER (ORDER BY t.block_height ASC,t.index ASC) as seq, t.* from integrated t ), cal_fr as ( select FLOOR(fee / virtual_size * 100000000) as fr, SUBSTR(CAST(txid as varchar), 3) || 'i0' as id, * from sequenced ), cal_fd as ( select fr, count(1) as fd from cal_fr group by fr order by fd asc ), cal_point as ( select (1000-seq)+t.fr/f.fd as point, * from cal_fr t join cal_fd f on t.fr=f.fr ), cal_rank_seed as ( select row_number() OVER (ORDER BY point DESC) as rs, * from cal_point ), cal_rank as ( select *, CASE WHEN rs>0 and rs <= 6 then 'gold' WHEN rs>6 and rs <= 31 then 'orange' WHEN rs>31 and rs <= 106 then 'purple' WHEN rs>106 and rs <= 231 then 'blue' WHEN rs>231 and rs <= 481 then 'green' WHEN rs>481 then 'white' END as level from cal_rank_seed ), pre_final as ( select rs as id, id as bind, miner, json_object('rank':level) as traits, json_object('contentType':'image/jpeg', 'uri':'ipfs://QmWKtb65YtxHuiq6GR9C5cd3TquKnjQrWDWotRitNnfZMo/' || level || '.jpg' ) as payload from cal_rank ), actived as ( select DISTINCT address from bitcoin.outputs t where t.block_height>=794500 and t.block_height<795000 and t.value*10000*10000>=2100 and address in (select miner from pre_final) ), gene as ( select t.* from pre_final t left join actived f on t.miner=f.address where f.address is not null order by id asc )"
},
"oops": {
"bind": "select * from gene"
}
}
Verification
FAQ
I'm a bit confused. What do you mean by "mint" inscriptions?
The "mint" inscriptions refer to the specific inscription you created when you mint $OICP. According to the definition of the BRC-20 protocol, these inscriptions themselves can be freely transferred or moved without affecting the $OICP balance.
Does it mean that once I move the "mint" inscription, the associated soul card will also move?
Yes, once you move the "mint" inscription, the associated soul card will also move along with it. They are interconnected, so when you transfer the inscription, the corresponding soul card will move along with it.
Can I bind the soul card to other inscriptions?
Plz check previous chapter.
How can I determine if a certain gene is bound to an inscription?
You can use the dashboard Verification, and the "bind" field in the represents the inscription ID to which the gene is bound. Remember that the inscription ID is unique and immutable.
What does "binding" mean? It seems like a new airdrop method.
Yes, I agree, and I think "binding" sounds even cooler.
What do you want to illustrate with this example?
Good question. This example demonstrates how to create objects (referred to as souls) in the META layer. In this case, the collection called "gene" is created within the META space. These objects have names, images, and even rarity. It also illustrates how such objects can be distributed to users using binding.
Code
with inputs as (
select block_height, tx_id, array_join(witness_data,',') payload
from
bitcoin.inputs t
where t.block_height>=793000 and t.block_height<793009 and t.index=0
),
txns as (
select t.id txid,
t.index,
fee,
virtual_size
from bitcoin.transactions t
where t.block_height>=793000 and t.block_height<793009
),
output as (
select address as miner, tx_id as txid
from bitcoin.outputs t
where t.block_height>=793000 and t.block_height<793009 and index=0
),
rawdata as (
SELECT
'{' || from_utf8(
from_hex(
substr(
payload,
position('2270223a226272632d3230' in payload),
position('7d68' in payload) - position('2270223a226272632d3230' in payload)
)
)
) || '}' as body,
block_height,
t.tx_id as txid
FROM inputs t
WHERE 1=1
AND t.payload LIKE '%0063036f726401%'
AND t.payload LIKE '%2270223a226272632d3230%'
AND t.payload LIKE '%227469636b223a226f69637022%'
),
formatted as (
select *, COALESCE(TRY(JSON_PARSE(body)), NULL) as data from rawdata
),
parsed as (
SELECT t.txid,
block_height,
json_extract_scalar(t.data, '$.p') as p,
json_extract_scalar(t.data, '$.tick') as tick,
json_extract_scalar(t.data, '$.op') as op,
COALESCE(
TRY(
CAST (json_extract_scalar(t.data, '$.amt') AS integer)
),
0
) as amt
FROM formatted t
where t.data is not null
),
filtered as (
select * from parsed t where (t.p='brc-20' or t.p='brc-20c') and t.tick='oicp' and t.op='mint'
),
integrated as (
select
t.*, f.index,f.fee,f.virtual_size,o.miner
from
filtered t
join
txns f on t.txid=f.txid
join
output o on t.txid=o.txid
),
sequenced as (
select
row_number() OVER (ORDER BY t.block_height ASC,t.index ASC) as seq,
t.*
from
integrated t
),
cal_fr as (
select FLOOR(fee / virtual_size * 100000000) as fr, SUBSTR(CAST(txid as varchar), 3) || 'i0' as id, * from sequenced
),
cal_fd as (
select fr, count(1) as fd from cal_fr group by fr order by fd asc
),
cal_point as (
select (1000-seq)+t.fr/f.fd as point, * from
cal_fr t
join
cal_fd f
on
t.fr=f.fr
),
cal_rank_seed as (
select row_number() OVER (ORDER BY point DESC) as rs, * from cal_point
),
cal_rank as (
select *, CASE
WHEN rs>0 and rs <= 6 then 'gold'
WHEN rs>6 and rs <= 31 then 'orange'
WHEN rs>31 and rs <= 106 then 'purple'
WHEN rs>106 and rs <= 231 then 'blue'
WHEN rs>231 and rs <= 481 then 'green'
WHEN rs>481 then 'white' END as level
from cal_rank_seed
),
pre_final as (
select rs as id, id as bind,
miner,
json_object('rank':level) as traits,
json_object('contentType':'image/jpeg',
'uri':'ipfs://QmWKtb65YtxHuiq6GR9C5cd3TquKnjQrWDWotRitNnfZMo/' || level || '.jpg'
) as payload
from cal_rank
),
actived as (
select DISTINCT address from bitcoin.outputs t
where
t.block_height>=794500
and
t.block_height<795000
and
t.value*10000*10000>=2100
and
address in (select miner from pre_final)
),
gene as (
select t.* from pre_final t left join actived f on t.miner=f.address where f.address is not null order by id asc
)
select * from gene