걸레이튼 블록 높이 계산기
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>걸레이튼 블록 높이 계산기</title> <style> * { box-sizing: border-box; margin: 0; padding: 0; } .page-title {visibility: hidden;} .container { text-align: center; padding: 20px; background: #2e2f30; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); width: 80%; } h1 { margin-bottom: 20px; } input, button { padding: 10px; background-color: #3f4041; border: none; border-radius: 3px; color: #e5e5e5; font-weight: 500; } input { margin-bottom: 20px; width: 80%; height: 45px; } button { cursor: pointer; width: 100%; margin-top: 10px; width: 80px; height: 45px; } button:hover { background: #575859; } @font-face { font-family: 'D2Coding'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_three@1.0/D2Coding.woff') format('woff'); font-weight: normal; font-style: normal; } body{font-family: 'D2Coding'; font-weight: 300;} </style> <script> const accessKeyId = "KASKHZRGOENSFT8OO9EKO7MA"; const secretAccessKey = "t_yRTcXq-Fy1PHRyJW8OepjxJDEraoJGYGvvPSq-"; const headers = { Authorization: "Basic " + btoa(accessKeyId + ":" + secretAccessKey), "x-chain-id": "8217", "Content-Type": "application/json", }; async function fetchBlockHeight() { const dateElem = document.getElementById("date"); const targetDate = new Date(dateElem.value); const now = new Date(); const secondsDiff = (now - targetDate) / 1000; const avgBlockTime = 1; const currentBlockNumber = await getCurrentBlockNumber(); const blockHeight = currentBlockNumber - Math.floor(secondsDiff / avgBlockTime); alert(`Block Height at ${targetDate.toLocaleString()} is: ${blockHeight}`); } async function getCurrentBlockNumber() { const response = await fetch("https://node-api.klaytnapi.com/v1/klaytn", { headers: headers, method: "POST", body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "klay_blockNumber", params: [], }), }); const data = await response.json(); if (!data.result) { throw new Error("Failed to get block number"); } return data.result; } </script> </head> <body> <div class="container"> <h1>🧹걸레이튼 블록 높이 계산기</h1> <input id="date" type="datetime-local"> <button onclick="fetchBlockHeight()">확인</button> </div> </body> </html>