Have your wallet address and a miner that implements the HashWX mining procedure ready before you request work. Send each request to the API host for your wallet’s network.
Request a job
Section titled “Request a job”Send POST /wallets/{address}/mining/jobs with your wallet address in the path. Give the miner the seed and target from the response. Keep the ticket to submit your proof. The job lasts one hour. Submit before expires_at.
Find a qualifying nonce
Section titled “Find a qualifying nonce”A nonce is a number the miner tries. For each nonce, the miner computes a hash using the job’s seed. Keep searching until the hash is strictly below the target, comparing both as unsigned numbers.
Here are two consecutive attempts for the example seed 38520a69288fba8020dc5806d5f6662f77de60bf38104654b124d90a072a44e9 and target 0000000800000000. All values are hexadecimal.
| Nonce | Hash | Result |
|---|---|---|
0000000022e1e902 |
2d72205c756d36c1 |
Above the target. The search continues. |
0000000022e1e903 |
0000000032334e20 |
Below the target. This nonce qualifies for the example job. |
Submit the proof
Section titled “Submit the proof”Send your job’s ticket and the nonce your miner found to POST /wallets/{address}/mining/proofs as JSON. Write the nonce as 16 lowercase hexadecimal digits, including any leading zeros.
{ "ticket": "<ticket from your job>", "nonce": "<qualifying nonce from that same job>"}If you lose the response, resend the original ticket and nonce. If the wallet already received the credit, the API returns the same transaction reference and reward, even after the job expires. Each accepted proof earns one credit.
If your job expires
Section titled “If your job expires”If the job expires while you’re searching, or submitting your proof returns 410, request a new job for the same wallet with POST /wallets/{address}/mining/jobs. Start a new search with its seed and target, then submit the nonce you find with its ticket.
Verify the credit
Section titled “Verify the credit”The proof receipt gives the amount of synthetic USD credited in data.public.asset.units. To check the wallet’s current balance, send GET /wallets/{address}/balances and look for fiat-USD. Its units field shows the total synthetic USD the wallet holds.