File size: 6,825 Bytes
1ea4600 e79b60d 1ea4600 e79b60d 1ea4600 e79b60d 1ea4600 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ProofCore | AI Blockchain Notary Demo</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-[#050b14] text-slate-100 min-h-screen font-sans antialiased p-4 md:p-8 flex flex-col items-center justify-center">
<div class="max-w-2xl w-full bg-[#0a1324] border border-slate-800 rounded-2xl p-6 md:p-8 shadow-2xl space-y-6">
<!-- HEADER -->
<div class="text-center border-b border-slate-800 pb-6">
<div class="inline-block px-3 py-1 bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 text-xs font-bold rounded-full uppercase tracking-wider mb-2">
Live M2M Notarization Demo
</div>
<h1 class="text-2xl md:text-3xl font-black text-white tracking-wide">
Proof<span class="text-transparent bg-clip-text bg-gradient-to-r from-emerald-400 to-cyan-400">Core</span> Protocol
</h1>
<p class="text-xs text-slate-400 mt-2">
Cryptographically anchor AI outputs, contract audits, and predictions onto the TON Blockchain.
</p>
</div>
<!-- FORM -->
<div class="space-y-4">
<div>
<label class="block text-xs font-bold text-slate-300 uppercase tracking-wider mb-1">Agent ID / Model</label>
<input id="agentInput" type="text" value="HuggingFace-Demo" class="w-full bg-[#03070c] border border-slate-800 rounded-xl px-4 py-2.5 text-sm text-cyan-300 focus:outline-none focus:border-cyan-500 transition">
</div>
<div>
<label class="block text-xs font-bold text-slate-300 uppercase tracking-wider mb-1">Report or Content to Seal</label>
<textarea id="contentInput" rows="5" placeholder="Enter your text, prediction, or smart contract audit findings here..." class="w-full bg-[#03070c] border border-slate-800 rounded-xl p-4 text-sm text-slate-200 focus:outline-none focus:border-cyan-500 transition placeholder:text-slate-600"></textarea>
</div>
<button id="sealBtn" onclick="sealContent()" class="w-full py-3.5 bg-gradient-to-r from-emerald-400 to-cyan-500 hover:opacity-90 active:scale-[0.99] text-gray-950 font-black uppercase text-xs tracking-widest rounded-xl transition shadow-lg shadow-emerald-500/10 flex items-center justify-center gap-2">
<span>🛡️</span> Seal on TON Blockchain
</button>
</div>
<!-- RESULT -->
<div id="resultBox" class="hidden bg-[#03070c] border border-emerald-500/30 rounded-xl p-5 space-y-4">
<div class="flex items-center gap-2 text-emerald-400 font-bold text-sm">
<span>✓</span> Successfully Anchored to TON Blockchain
</div>
<div class="space-y-2 text-xs font-mono">
<div><span class="text-slate-500">Deal ID:</span> <span id="dealIdText" class="text-slate-200"></span></div>
<div><span class="text-slate-500">SHA-256:</span> <span id="hashText" class="text-cyan-300 break-all"></span></div>
</div>
<div class="pt-2 border-t border-slate-800">
<label class="block text-[10px] text-slate-500 uppercase font-bold tracking-wider mb-1">Live Dynamic SVG Badge</label>
<div id="badgeContainer" class="my-2"></div>
</div>
<div class="flex gap-2">
<a id="explorerBtn" target="_blank" class="flex-1 py-2.5 bg-slate-800 hover:bg-slate-700 text-cyan-300 text-xs font-bold text-center rounded-lg border border-slate-700 transition">
🔍 Open in Proof Explorer
</a>
</div>
</div>
<!-- FOOTER -->
<div class="text-center text-[11px] text-slate-500 pt-2 border-t border-slate-800/50">
Built for the M2M Economy by <a href="https://proofcore.org" target="_blank" class="text-cyan-400 hover:underline font-bold">ProofCore Protocol</a> • <a href="https://proofcore.org/openapi.json" target="_blank" class="text-slate-400 hover:underline">OpenAPI Spec</a>
</div>
</div>
<script>
async function sealContent() {
const content = document.getElementById('contentInput').value.trim();
const agentId = document.getElementById('agentInput').value.trim() || "HuggingFace-Demo";
const btn = document.getElementById('sealBtn');
const resultBox = document.getElementById('resultBox');
if (!content) {
alert("Please enter some text to seal.");
return;
}
btn.disabled = true;
btn.innerText = "⏳ Sealing onto Blockchain...";
try {
const res = await fetch("https://api.proofcore.org/api/v0.1/seal", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content: content, agent_id: agentId, title: "Hugging Face Demo Seal" })
});
const data = await res.json();
if (res.ok) {
document.getElementById('dealIdText').innerText = data.deal_id;
document.getElementById('hashText').innerText = data.sha256_hash;
document.getElementById('explorerBtn').href = data.verification_url;
// Даем картинке ID, чтобы потом её обновить
document.getElementById('badgeContainer').innerHTML = `
<img id="statusBadge" src="${data.badge_url}" alt="ProofCore Badge" class="inline-block shadow-md transition-all duration-500">
`;
resultBox.classList.remove('hidden');
// 🔄 ЗАПУСКАЕМ ОПРОС СТАТУСА (POLLING)
const dealId = data.deal_id;
const badgeUrl = data.badge_url;
const pollInterval = setInterval(async () => {
try {
const statusRes = await fetch(`https://api.proofcore.org/api/v0.1/proof/${dealId}`);
const statusData = await statusRes.json();
if (statusData.status === "anchored_onchain" || statusData.status === "cancelled") {
// Если запечаталось — обновляем картинку (добавляем ?t=время, чтобы сбросить кэш браузера)
document.getElementById('statusBadge').src = badgeUrl + "?t=" + new Date().getTime();
clearInterval(pollInterval); // Останавливаем опрос
}
} catch (e) {
console.error("Polling error:", e);
}
}, 5000); // Проверяем каждые 5 секунд
} else {
alert("Error: " + (data.error || "Failed to seal content"));
}
} catch (err) {
alert("Connection error: " + err.message);
} finally {
btn.disabled = false;
btn.innerHTML = "<span>🛡️</span> Seal on TON Blockchain";
}
}
</script>
</body>
</html> |