Skip to content

HIP-25 reference: HACD staking (34/35), v3 supply-neutral economics, WASM wallet#13

Open
Moskyera wants to merge 35 commits into
hacash:mainfrom
Moskyera:hip-25-staking
Open

HIP-25 reference: HACD staking (34/35), v3 supply-neutral economics, WASM wallet#13
Moskyera wants to merge 35 commits into
hacash:mainfrom
Moskyera:hip-25-staking

Conversation

@Moskyera

@Moskyera Moskyera commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Reference implementation of HIP-25 HACD staking on legacy Hacash Rust architecture (Moskyera/rust fork). Intended for spec validation, audits, and future port to fullnodedev.

HIP-25 (actions 34/35)

  • Global reward index pool, v3 supply-neutral economics
  • 10% DiamondMint miner share (fee_got) → staking pool when active
  • Inscription fees: 100% burn (unchanged from pre-HIP-25)
  • Idle pool burn after 1008 blocks with zero stakers
  • Min stake ~90d (25714 blocks), cooldown ~3d (864 blocks)
  • 24 staking unit tests

HIP-2 v2.1 (actions 15/16) — on same branch, complementary

  • HAC IOU mortgage: 1% origination burn, 3% flat APR, mutual exclusion with staking
  • 15 unit + 9 E2E mortgage tests

Shared

  • Local WASM wallet at /hip25/wallet (client-side signing on mainnet)
  • Mainnet RPC hardening (loopback default, rate limits, no server prikey on chain_id=0)

Economics v3 (current)

Source v2 (superseded) v3
Staking pool 10% inscription protocol fees 10% DiamondMint miner share
Inscription Partial redirect to pool 100% burn
Supply vs baseline Higher circulating HAC Unchanged (reallocation only)

Details: docs/HIP25_ECONOMICS_V3.md · Formal spec: docs/HIP25_SPEC.md

Audit status

Audit HIP-25 @ a798094 HIP-2
Auth & secrets PASS PASS
Economics PASS PASS
API & DoS PASS PASS
Tx pipeline PASS PASS
WASM wallet PASS PASS

48 consensus tests pass. CI: .github/workflows/hip25-ci.yml.

Mainnet safety

  • chain_id=0 blocks server-side prikey signing RPCs
  • hip25_testnet_seed / demo flags panic on mainnet chain_id
  • Default listen_host=127.0.0.1, allow_public_rpc=false
  • P2P tx ingress: signature + try_execute_tx before relay

How to test

Testnet demo:

scripts\START_WALLET.bat

Mainnet wallet model:

scripts\BUILD_MAINNET_RELEASE.ps1
scripts\START_MAINNET_WALLET.bat

Breaking changes

None until staking_activation_height is reached on a network running this consensus.

Configuration

hacash_mainnet_hip25.config.ini.example:

[mint]
chain_id = 0
staking_activation_height = 0
hip25_testnet_seed = false
hip25_testnet_demo_periods = false

Activation height set only after community + maintainer consensus (≥30 day notice).

Documentation

  • HIP-25 spec: docs/HIP25_SPEC.md
  • Roadmap: docs/HIP25_ROADMAP.md
  • Community review: docs/HIP25_COMMUNITY_REVIEW.md
  • Economics v3: docs/HIP25_ECONOMICS_V3.md

Request for maintainers

  1. Should HIP-25 be ported to fullnodedev?
  2. Separate fork height or post-Istanbul (765432)?
  3. Parameter changes before port?

We treat this PR as discussion + reference, not legacy-rust mainnet merge.


Fork: https://github.com/Moskyera/rust/tree/hip-25-staking
Reference tag: v0.1.0-hip25-reference
Spec: https://github.com/Moskyera/rust/blob/hip-25-staking/docs/HIP25_SPEC.md

Moskyera added 23 commits June 15, 2026 21:39
- Add hip25_testnet_seed genesis HACD+HAC for dev testnet

- Fix load_config subcommand clash (poworker/diaworker)

- Add hacash.exe poworker and diaworker subcommands

- scripts/hip25_live_stake.ps1: full on-chain stake E2E

- Serve wallet MVP at GET /hip25/wallet (portfolio, badges, stake/unstake)
…ot docs

- Seed 5 HACD (WTYUIA,HXVMEK,VMEKBS,UIASHX,MEKUIA) for wallet label demos
- Fix and extend WASM SDK transfer.rs with hacd_stake/hacd_unstake (kinds 34/35)
- Add sdk_lib.rs + Cargo feature sdk for wasm32 builds
- Wallet: testnet preset, RPC/WASM tx modes, badge UI unchanged
- docs/hip25_testnet_boot.md + scripts/hip25_wallet_e2e.ps1 (verified E2E)
- try_state in ctx macros returns 503 instead of panic

- Rate-limit all POST submit/operate/create/util routes

- Fix origin_allowed, reject query secrets, allow_public_rpc guard

- JSON body signing on transfer/fee/sign; cap block/datas limit
Audit hacash#4: P2P sig+execute gate, tx timestamp in try_execute_tx, cumulative miner packing, sync pool insert, rebuild-safe pool sweep, 256KB P2P tx cap

Audit hacash#5: SDK loads from wallet origin only, SHA-256 integrity on /pkg/, DOM textContent, mainnet chain ID pin, stripped WASM exports, password clear

Also: fix get_id_range filter, miner GET rate limit, remove dead ApiCtx rate_limiter
@jojoin

jojoin commented Jun 16, 2026

Copy link
Copy Markdown
Member

Any additional issuance of HAC (or redistributing HAC that was originally meant to be destroyed) requires careful and long-term consideration. One acceptable economic model is: mortgage HACD to borrow back the bid fees that be destroyed, but when repaying, you need to return the principal plus interest (more HAC). It's recommended to check out "HIP-2: HACD Mortgage Loan HAC" and "HIP-11: HAC Issuance Rules Consensus."

The historical version of HIP-2 is implemented here:

https://github.com/hacash/core/blob/master/actions/diamondlending.go

@Moskyera

Moskyera commented Jun 16, 2026

Copy link
Copy Markdown
Author

Thanks @jojoin, agreed that redirecting burn-bound HAC needs HIP-11-level consideration. We updated HIP-25 v2 economics (commit 0500cb3) without changing stake/unstake mechanics:

Changes

  • Removed HACD transfer-fee redirect entirely (transfer fees follow original burn/miner rules)
  • 10% redirect only on HIP-15 inscription protocol fees (was 13% on two sources)
  • Idle pool burn: if total_staked_shares == 0 for 1008 consecutive blocks, undistributed pool is burned (diamond_insc_burn_zhu) not left outside circulation indefinitely
  • Supply transparency: cumulative_deposit_zhu, cumulative_paid_zhu, cumulative_pool_burned_zhu on /query_global_staking

Unchanged

  • No coinbase minting (not HIP-2 IOU model); HIP-25 remains lock-and-earn, complementary to HIP-2 mortgage+repay
  • Mutual exclusion with mortgaged HACD status

Docs: docs/HIP25_ECONOMICS_V2.md

Mainnet staking_activation_height will be set only after community economic consensus. Happy to adjust parameters further from review.

Moskyera added 4 commits June 16, 2026 14:16
Wallet: English labels/hints, signing address from password, portfolio mismatch warning, auto loan on HACD selection, mortgage preflight.

RPC: staking/summary optional offset/limit; principal returns origination_burn and hacd_count.

WASM: export create_account_by in browser builds.
- Add serde defaults to defineQueryObject for optional query params

- Split wallet JS into modules served via /hip25/wallet/js routes

- Preserve HACD selection on refresh; unified mortgage preflight

- Surface 64-contract owner index limit in RPC and wallet UI

- Add RPC query and principal quote unit tests

- Document mortgage RPC, WASM actions, and index limit
@kursatsufra

kursatsufra commented Jun 17, 2026

Copy link
Copy Markdown

Ek HAC ihracı (veya başlangıçta imha edilmesi amaçlanan HAC'nin yeniden dağıtılması) dikkatli ve uzun vadeli bir değerlendirme gerektirir. Kabil edilebilir bir ekonomik model şudur: İmha edilecek ihale ücretlerini geri almak için HACD'yi ipotek edin, ancak geri ödeme yaparken anapara artı faizi (daha fazla HAC) geri ödemeniz gerekir. "HIP-2: HACD İpotek Kredisi HAC" ve "HIP-11: HAC İhraç Kuralları Mutabakatı"nı incelemeniz önerilir.

HIP-2'nin normal versiyonu burada gösteriliyor:

https://github.com/hacash/core/blob/master/actions/diamondlending.go

⚫ Hello.I have a proposal regarding this matter, and I hope you will consider it.
⚫ The Steaking feature serves as a safe haven that can be taken refuge in in case the market is bad for every coin community. Economically, passive income is an indispensable reality of all economic ecosystems. Many blockchains adapt interest to the blockchain with the steak feature, distributing previously minted, ready-made coins or tokens to people who steak. However, in terms of supply and distribution, this turns into a structure that locks the system, eventually causing the system to destroy itself. Since there is no burning mechanism for these coins or tokens newly participating in circulation, they disrupt market dynamics. The destroyable feature of Hac coin offers us advantages in this regard, especially when combined with a value asset like HACD, the subject requires a more comprehensive evaluation.
⚫ The average USD (American Dollar) interest rate in the world varies depending on the financial instrument (central bank, market funds or deposits) you look at, but ranges between %3,50 and %4,50 on a global scale.
⚫ My proposal is to convert the HACD value into a passive income with a variable interest rate, taking its circulation amount as an example.
⚫ Approximate Current Supply : 130.000 HACD
⚫ The return of 1 diamond for every new diamond produced : (The production average of the 50k quantity within the difficulty level it is in, such as 0-50k-100k-150k...) 50k Avarage burned / HACD Circulation amount (15 HAC/130000 HACD = 0.000115 HAC for every new minted HACD) (Today's 1 HACD would collect approximately 2000 HAC rewards in approximately 800 years.) (The reason for basing it on the last 50k diamonds is the inclusion of the difficulty mechanism.)
⚫ With today's numbers, if the number of people staking HACD increases, the highest reward that can be received is above.
⚫ With today's numbers, if the number of people staking HACD decreases, the reward amount may increase, which will keep the demand for HACD alive with new investors.
⚫ If the Avarage Bid amount increases, the distributed reward will increase, but since the circulation amount will also increase, it will not have a major impact. Since the demand for HACD increases, HAC circulation increases, thus the relationship between money and value is protected. (ex. For the Avarage Bid to be 30, 130000 more diamonds must participate in circulation and be produced with an average of 45 pieces.)
⚫ If the Avarage Bid amount decreases, it means demand has decreased. As the demand for HACD decreases, the reward given also decreases, thereby protecting the money and value relationship with HAC.
⚫ By adding the difficulty level to the equation, in case of future mints that could be more difficult, where auctions are monopolized by more powerful miners, the reward amount for HACD that can be produced at an affordable price is reduced.
⚫ In case more miners participate in production, the stake income will increase as the Avarage Bid will increase, which will attract more interest.
⚫ Since the reward distribution will take place at every HACD production, the stake pool will be alive and active.
⚫ The pool entry and exit time will be as long as 1 HACD production time.
⚫ The absence of a mandatory waiting period will constitute a trust for large balance holders. People avoid being locked up in an unpredictable market.
⚫ The awareness that owning HACD has a return and that it is a real store of value will be established.
⚫ This ecosystem, which will be established with the combination of the relationship between trust, money and capital with the average in each 50k production process, will be a big step for HACD.
⚫ The existence of a variable return will show the sustainability of the money and value unity with its similarity to today's economy.
⚫ In case HACD production stops, the demand for HACD is over. This means that the HAC supply will increase. Since there will be no pool reward (Avarage Bid = 0 for last 50k ), the HAC supply will not be increased any further. HACD to HAC
⚫ When HACD production starts again, the reward distribution starts again and money moves towards value. HAC to HACD
I would also like to point out that it would be beneficial to eliminate the 10% share currently given to HAC miners due to HACD production.
@Moskyera @jojoin

- Redirect DiamondMint fee_got (10% bid) to staking pool when active

- Remove inscription protocol fee redirect; full protocol cost burns

- RPC economics_version v3, fee_sources hacd_mint_miner_share

- Docs: HIP25_ECONOMICS_V3.md; idle pool sweep counts hacd_bid_burn_zhu
@Moskyera

Copy link
Copy Markdown
Author

Ek HAC ihracı (veya başlangıçta imha edilmesi amaçlanan HAC'nin yeniden dağıtılması) dikkatli ve uzun vadeli bir değerlendirme gerektirir. Kabil edilebilir bir ekonomik model şudur: İmha edilecek ihale ücretlerini geri almak için HACD'yi ipotek edin, ancak geri ödeme yaparken anapara artı faizi (daha fazla HAC) geri ödemeniz gerekir. "HIP-2: HACD İpotek Kredisi HAC" ve "HIP-11: HAC İhraç Kuralları Mutabakatı"nı incelemeniz önerilir.
HIP-2'nin normal versiyonu burada gösteriliyor:
https://github.com/hacash/core/blob/master/actions/diamondlending.go

⚫ Hello.I have a proposal regarding this matter, and I hope you will consider it. ⚫ The Steaking feature serves as a safe haven that can be taken refuge in in case the market is bad for every coin community. Economically, passive income is an indispensable reality of all economic ecosystems. Many blockchains adapt interest to the blockchain with the steak feature, distributing previously minted, ready-made coins or tokens to people who steak. However, in terms of supply and distribution, this turns into a structure that locks the system, eventually causing the system to destroy itself. Since there is no burning mechanism for these coins or tokens newly participating in circulation, they disrupt market dynamics. The destroyable feature of Hac coin offers us advantages in this regard, especially when combined with a value asset like HACD, the subject requires a more comprehensive evaluation. ⚫ The average USD (American Dollar) interest rate in the world varies depending on the financial instrument (central bank, market funds or deposits) you look at, but ranges between %3,50 and %4,50 on a global scale. ⚫ My proposal is to convert the HACD value into a passive income with a variable interest rate, taking its circulation amount as an example. ⚫ Approximate Current Supply : 130.000 HACD ⚫ The return of 1 diamond for every new diamond produced : (The production average of the 50k quantity within the difficulty level it is in, such as 0-50k-100k-150k...) 50k Avarage burned / HACD Circulation amount (15 HAC/130000 HACD = 0.000115 HAC for every new minted HACD) (Today's 1 HACD would collect approximately 2000 HAC rewards in approximately 800 years.) (The reason for basing it on the last 50k diamonds is the inclusion of the difficulty mechanism.) ⚫ With today's numbers, if the number of people staking HACD increases, the highest reward that can be received is above. ⚫ With today's numbers, if the number of people staking HACD decreases, the reward amount may increase, which will keep the demand for HACD alive with new investors. ⚫ If the Avarage Bid amount increases, the distributed reward will increase, but since the circulation amount will also increase, it will not have a major impact. Since the demand for HACD increases, HAC circulation increases, thus the relationship between money and value is protected. (ex. For the Avarage Bid to be 30, 130000 more diamonds must participate in circulation and be produced with an average of 45 pieces.) ⚫ If the Avarage Bid amount decreases, it means demand has decreased. As the demand for HACD decreases, the reward given also decreases, thereby protecting the money and value relationship with HAC. ⚫ By adding the difficulty level to the equation, in case of future mints that could be more difficult, where auctions are monopolized by more powerful miners, the reward amount for HACD that can be produced at an affordable price is reduced. ⚫ In case more miners participate in production, the stake income will increase as the Avarage Bid will increase, which will attract more interest. ⚫ Since the reward distribution will take place at every HACD production, the stake pool will be alive and active. ⚫ The pool entry and exit time will be as long as 1 HACD production time. ⚫ The absence of a mandatory waiting period will constitute a trust for large balance holders. People avoid being locked up in an unpredictable market. ⚫ The awareness that owning HACD has a return and that it is a real store of value will be established. ⚫ This ecosystem, which will be established with the combination of the relationship between trust, money and capital with the average in each 50k production process, will be a big step for HACD. ⚫ The existence of a variable return will show the sustainability of the money and value unity with its similarity to today's economy. ⚫ In case HACD production stops, the demand for HACD is over. This means that the HAC supply will increase. Since there will be no pool reward (Avarage Bid = 0 for last 50k ), the HAC supply will not be increased any further. HACD to HAC ⚫ When HACD production starts again, the reward distribution starts again and money moves towards value. HAC to HACD I would also like to point out that it would be beneficial to eliminate the 10% share currently given to HAC miners due to HACD production. @Moskyera @jojoin

Thanks for the detailed proposal, the dynamic formula tied to 50k bands and circulation is an interesting direction, and we agree on eliminating the 10% miner share on HACD mint (that’s what HIP-25 v3 does: redirect to stakers, supply-neutral).

On lock / cooldown, we’d keep a minimum stake period rather than “exit in one HACD production time.” Miners don’t need a protocol lock because hashrate is already sunk cost (hardware, power, time). Staking without lock is cheap to enter and exit, which opens mercenary staking: stake right before rewards or a big mint, then unstake yield without real commitment to HACD.

Our min stake (~90 days) + short cooldown (~3 days) is the staking equivalent of that commitment: it protects the pool from timing games and flash stake/unstake, keeps rewards for holders who actually stay, and still allows exit without a permanent trap. We’re open to discussing the exact durations, but zero lock would weaken the same money–value link the proposal aims to protect.

Moskyera added 2 commits June 21, 2026 00:40
Reframe fork as reference implementation for fullnodedev port, not legacy rust mainnet merge. Add formal HIP25_SPEC, roadmap, maintainer outreach templates, and community post.
Moskyera added a commit to Moskyera/rust that referenced this pull request Jun 20, 2026
@Moskyera Moskyera changed the title HIP-25: HACD staking (kinds 34/35), WASM wallet, mainnet security hardening HIP-25 reference: HACD staking (34/35), v3 supply-neutral economics, WASM wallet Jun 20, 2026
@Moskyera

Moskyera commented Jun 20, 2026

Copy link
Copy Markdown
Author

Reference implementation status (not a merge request for legacy rust)

Thanks again for the HIP-11 / HIP-2 economics note. Following that feedback we moved to v3 supply-neutral economics (eeee5da):

  • Funding: 10% of DiamondMint fee_got (miner share) staking pool when active
  • Inscription fees: 100% burn (unchanged from pre-HIP-25)
  • Supply: zero-sum vs current miner payout no extra circulating HAC from inscription redirect

We now treat this PR as a reference implementation + community review, not a request to merge into legacy hacash/rust. Per hacash.org/development, canonical mainnet path is fullnodedev / fullnode.

Formal spec draft: HIP25_SPEC.md

Questions for maintainers:

  1. Should HIP-25 be ported to fullnodedev? We can open a PR there if useful.
  2. Preferred activation: separate staking_activation_height or post-Istanbul (765432)?
  3. Any parameter changes required before port (min stake 25714 blocks, cooldown 864, idle sweep 1008)?

We will not set a mainnet activation height without community consensus and maintainer agreement.

Tag: v0.1.0-hip25-reference on the fork for a frozen reference point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants