Skip to content

Instantly share code, notes, and snippets.

@makoto
Last active March 27, 2019 22:16
Show Gist options
  • Save makoto/c1f2c987dc45a6cbb65b9f1040eff5c4 to your computer and use it in GitHub Desktop.
Save makoto/c1f2c987dc45a6cbb65b9f1040eff5c4 to your computer and use it in GitHub Desktop.
contenthash
const namehash = require('eth-ens-namehash').hash
document.querySelector('input').value = 'matoken.eth'
window.namehash = namehash
var sayHello = function(){
var name = document.querySelector('input').value
console.log(namehash(name))
}
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"eth-ens-namehash": "2.0.8"
}
}
<script>
var sayHello = function(){
var name = document.querySelector('input').value
document.querySelector('.answer').textContent = window.namehash(name)
}
</script>
<h1>ENS to Namehash</h1>
<input placeholder="eg: matoken.eth"></input>
<button onClick="sayHello()" >hash it!</button>
<hr/>
<div class="answer"><div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment