Skip to content

hacdlabs/stackprotocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

HACD Stack Protocol

This protocol parser interprets the inscribed content of HACD as operations such as the minting of Hybrid Stack Token. For a detailed explanation of the concepts, please refer to hacd.it.

The protocol uses a dictionary-like data format similar to JSON, but it is more concise and compact to save storage. For example, the format {i:floppydisk,p:hnft,m:21k,op:mint} is defined in detail as follows:

{
    p: '',  // protocol
    i: '',  // identifier
    t: '',  // ticket
    m: 0,   // maximum
    q: 0,   // quota
    d: '',  // deploy
    f: '',  // fee

    op: '', // operand
    s: 0,   // serial
    b: 0,   // batch
    h: ''   // hash    
}

Please refer to the core code of the protocol: ./src/scaner/protocol.rs.

Engraved Example: /diamond/ISBZVI.

Build & Compile

cargo build --release --no-default-features --features "db-leveldb-sys"

Can choose to compile using different databases:

--features "db-sled"
--features "db-rusty-leveldb"
--features "db-leveldb-sys"
--features "db-rocksdb"

Configuration

The protocol parser is essentially an "Enhanced Node" of Hacash, using the same configuration file as a Hacash full node, which defaults to hacdsp.config.ini. Add the [hacdsp] config section in the full node's configuration file:

[hacdsp]
data_dir = ./hacd_inscript_data
listen = 8810

Here, data_dir refers to the folder where the index data is stored, and listen refers to the port on which the API interface listens.

At the same time, by placing a genesis.ins file in the hacd_inscript_data database folder, the protocol can be initialized, configuring aspects such as the protocol's deploy. The file format follows the same format as HACD inscriptions, one entry per line, for example:

{i:floppydisk,p:hnft,m:21k}
{i:diamonster27,p:hart,t:DM27,m:27,d:1971Mo4v3EvrZMs4pdo3ryBFznuWvMN9uk}

The protocol will first read this initialization file at startup, parse the entries in it, and complete the pre-configuration of stack tikens.

API

This protocol parser will automatically retrieve all HACD inscriptions and record all assets that meet the protocol standards into the database. These assets' metadata and minting results can be accessed via an HTTP interface.

1. /query/hacdsp/collection

Get collection information list

  • limit [int]
  • page [int]
  • identifier [string]: Specified collection

Return example:

{
  "ret": 0,
  "list": [
    {
      "deploy": "",
      "fee": "",
      "id": 1,
      "identifier": "floppydisk",
      "maximum": "21000",
      "protocol": "hnft",
      "quota": "",
      "ticket": ""
    },
    {
      "deploy": "1971Mo4v3EvrZMs4pdo3ryBFznuWvMN9uk",
      "fee": "",
      "id": 2,
      "identifier": "diamonster27",
      "maximum": "27",
      "protocol": "hart",
      "quota": "",
      "ticket": "DM27"
    },
    {
      "deploy": "",
      "fee": "",
      "id": 3,
      "identifier": "cyberpunkdisk",
      "maximum": "1",
      "protocol": "hart",
      "quota": "",
      "ticket": "CBPK"
    }
  ]
}
2. /query/hacdsp/token

Get token mint list

  • limit [int]
  • page [int]
  • identifier [string]: Specified collection
  • diamond [string]: diamond name list

Return example:

{
  "ret": 0,
  "list": [
    {
      "collection_id": 1,
      "diamond": "BZTIBM",
      "id": 1,
      "name": "",
      "serial": 1,
      "timestamp": 1729343565
    },
    {
      "collection_id": 1,
      "diamond": "YXXMTI",
      "id": 2,
      "name": "",
      "serial": 2,
      "timestamp": 1729343544
    },
    {
      "collection_id": 1,
      "diamond": "MXBXZU",
      "id": 3,
      "name": "",
      "serial": 3,
      "timestamp": 1729343544
    }
}

HACD with cleared inscriptions will also be automatically deleted from the token database.

About

HACD Hybrid Stack Protocol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages