Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Liam Aharon liamaharon

:shipit:
View GitHub Profile
@miguelmota
miguelmota / build_create2_address.js
Created Nov 17, 2018
JavaScript build ethereum create2 address (counterfactual smart contract address)
View build_create2_address.js
function buildCreate2Address(creatorAddress, saltHex, byteCode) {
const parts = [
'ff',
creatorAddress.slice(2),
saltHex.slice(2),
web3.utils.sha3(byteCode).slice(2),
]
const partsHash = web3.utils.sha3(`0x${parts.join('')}`)
return `0x${partsHash.slice(-40)}`.toLowerCase()
View tiny-url-api.php
<?php
echo file_get_contents('http://tinyurl.com/api-create.php?url='.'http://www.example.com/');
/* For example
http://tinyurl.com/api-create.php?url=http://www.fullondesign.co.uk/
Would return:
http://tinyurl.com/d4px9f
*/
?>