1. Issue a trial key
Use the free trial endpoint to get a Bearer token for write access.
curl -sS -X POST \
https://api.frontiercompute.cash/trial-key
import requests
resp = requests.post("https://api.frontiercompute.cash/trial-key")
resp.raise_for_status()
print(resp.json())
const resp = await fetch("https://api.frontiercompute.cash/trial-key", {
method: "POST"
});
if (!resp.ok) throw new Error(`trial-key failed: ${resp.status}`);
console.log(await resp.json());
2. Submit an attestation leaf
Write a `CONTRACT_ANCHOR` event. Replace $KEY with the key returned by POST /trial-key.
curl -sS -X POST \
https://api.frontiercompute.cash/event \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{
"event_type": "CONTRACT_ANCHOR",
"wallet_hash": "docs_example_wallet",
"serial_number": "docs-example-001",
"contract_sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
}'
import requests
payload = {
"event_type": "CONTRACT_ANCHOR",
"wallet_hash": "docs_example_wallet",
"serial_number": "docs-example-001",
"contract_sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
}
resp = requests.post(
"https://api.frontiercompute.cash/event",
headers={"Authorization": f"Bearer {KEY}"},
json=payload,
)
resp.raise_for_status()
print(resp.json())
const payload = {
event_type: "CONTRACT_ANCHOR",
wallet_hash: "docs_example_wallet",
serial_number: "docs-example-001",
contract_sha256: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
};
const resp = await fetch("https://api.frontiercompute.cash/event", {
method: "POST",
headers: {
"Authorization": `Bearer ${key}`,
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
if (!resp.ok) throw new Error(`event failed: ${resp.status}`);
console.log(await resp.json());
3. Verify an anchored leaf
This example uses the leaf written during docs verification. It is anchored on-chain and returns txid and height.
curl -sS \
https://api.frontiercompute.cash/verify/187441d697cbb6256f9cb073bce90584e658d6f0c67a3e1ab907d13cb7cac5a4/check
import requests
leaf = "187441d697cbb6256f9cb073bce90584e658d6f0c67a3e1ab907d13cb7cac5a4"
resp = requests.get(f"https://api.frontiercompute.cash/verify/{leaf}/check")
resp.raise_for_status()
print(resp.json())
const leaf = "187441d697cbb6256f9cb073bce90584e658d6f0c67a3e1ab907d13cb7cac5a4";
const resp = await fetch(`https://api.frontiercompute.cash/verify/${leaf}/check`);
if (!resp.ok) throw new Error(`verify failed: ${resp.status}`);
console.log(await resp.json());