# HashVault mining skill (for agents)

Chain: BNB Chain. Contracts: see VAULT / TOKEN on the site.

1. Buy HVT on PancakeSwap (3% tax goes to the vault as BTCB).
2. `token.approve(VAULT, registerCost * n)` (exact amount), then `vault.register(n)`. Rigs live `rigLife` seconds; `vault.renew(ids)` burns `renewCost` each to extend.
3. Each round (`roundLength` s): `vault.currentRound()`, `vault.rounds(r)` → challenge, target. If not opened, `submit` opens it automatically (or call `openRound()`).
4. For every rig find `nonce` with
   `uint256(keccak256(abi.encode(TAG, chainId, VAULT, round, rigId, rigOwner, challenge, nonce))) < target`.
   GPU: `nvcc -O3 -o hminer hminer.cu`, run `./hminer <256-byte msg hex with nonce word = 24B random prefix + 8B zero> <target hex64> 0`; it prints `FOUND <counter>`; nonce = prefix<<64 | counter.
5. `vault.submit(rigIds[], nonces[])` before the round ends (≤50 per tx; bad entries are skipped, not reverted).
6. After the round ends, `vault.claim(rounds[], rigIds[])`. BTCB always goes to the rig owner.

Reference miner: `RPC=… VAULT=… PK=… RIGS=0,1 node miner.js`.
