Created
March 12, 2016 21:36
-
-
Save 5chdn/a48931e659e10a3d6a8a to your computer and use it in GitHub Desktop.
homestead countdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Homestead Countdown</title> | |
| <script type="text/javascript" src="./web3.js"></script> | |
| <script type="text/javascript"> | |
| var Web3 = require('web3'); | |
| var web3 = new Web3(); | |
| web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545")); | |
| function count() { | |
| blockNumberCurrent = web3.eth.blockNumber; | |
| blockNumberHomestead = 1150000; | |
| blocksRemaining = blockNumberHomestead - blockNumberCurrent; | |
| blockTimeLower = web3.eth.getBlock(blockNumberCurrent - 1000).timestamp; | |
| blockTimeUpper = web3.eth.getBlock(blockNumberCurrent).timestamp; | |
| timeBetweenBlocks = (blockTimeUpper - blockTimeLower) / 1000; | |
| timeRemaining = blocksRemaining * timeBetweenBlocks; | |
| render = "Initializing..."; | |
| if (timeRemaining > 0) { | |
| unit = "seconds"; | |
| if (timeRemaining > 129600) { | |
| unit = "days"; | |
| timeRemaining = timeRemaining / (60*60*24); | |
| timeRemaining = Math.round(timeRemaining * 100) / 100; | |
| } else if (timeRemaining > 5400) { | |
| unit = "hours"; | |
| timeRemaining = timeRemaining / (60*60); | |
| timeRemaining = Math.round(timeRemaining * 100) / 100; | |
| } else if (timeRemaining > 180) { | |
| unit = "minutes"; | |
| timeRemaining = timeRemaining / 60; | |
| timeRemaining = Math.round(timeRemaining * 100) / 100; | |
| } | |
| render = `Time remaining ${blocksRemaining} blocks (${timeRemaining} ${unit}).`; | |
| } else { | |
| render = `Homestead is here since ${blocksRemaining * -1} blocks.`; | |
| } | |
| document.getElementsByClassName('counter')[0].innerText = render; | |
| } | |
| </script> | |
| <link rel="stylesheet" href="//ethereum.org/css/frontier.min.css"> | |
| <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.6/styles/default.min.css"> | |
| <style type="text/css"> | |
| body { | |
| background-image: url(homestead.jpg); | |
| background-repeat:no-repeat; | |
| background-position: top center; | |
| background-size: 100%; | |
| } | |
| .wrapper { | |
| width: auto; | |
| height: 1px; | |
| position: absolute; | |
| top:0; | |
| bottom: 0; | |
| left: 0; | |
| right: 0; | |
| margin: auto; | |
| text-align: center; | |
| } | |
| .counter { | |
| font-size: 40px; | |
| color: #FFFFFF; | |
| font-family: 'Source Sans Pro',Arial,sans-serif serif; | |
| letter-spacing: -1px; | |
| font-weight: 400; | |
| text-shadow: 0px 0px 8px #000000; | |
| } | |
| </style> | |
| </head> | |
| <body onload="count(); setInterval(count, 15000);"> | |
| <p><div class="wrapper"><img src="homestead-title.png" /><br /><h2 class="counter">Run geth with --rpc --rpccorsdomain "http://chaos.cach.co"...</h2></div></p> | |
| </body> | |
| </html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment