Skip to content

Instantly share code, notes, and snippets.

View merlox's full-sized avatar
😄
Building great things together!

merlox merlox

😄
Building great things together!
View GitHub Profile
0x7461CCF1FD55c069ce13E07D163C65c78c8b48D1
@merlox
merlox / gist:f35dcf84a035d6f6ee17ddf4c899a35f
Created October 25, 2017 15:43
docker-compose run feed-chain
PS C:\Users\merunas\Desktop\api-node> docker-compose run feed-chain
Starting apinode_localchain_1 ...
Starting apinode_localchain_1 ... done
npm info it worked if it ends with ok
npm info using npm@3.10.8
npm info using node@v6.9.1
npm info attempt registry request try #1 at 3:41:41 PM
npm http request GET https://registry.npmjs.org/fsevents
npm http 200 https://registry.npmjs.org/fsevents
npm info lifecycle 0x-smart-contracts@1.0.0~preinstall: 0x-smart-contracts@1.0.0
@merlox
merlox / Rinkeby
Created September 16, 2018 16:18
0x5912d3e530201d7b3ff7e140421f03a7cdb386a3
let Contract
let contractInstance
let contractAddress
function start() {
document.querySelector('#new-game').addEventListener('click', () => {
...
})
document.querySelector('#join-game').addEventListener('click', () => {
...
})
@merlox
merlox / index.js
Created September 25, 2018 20:57
This is how the index.js file looks like
function start() {
document.querySelector('#new-game').addEventListener('click', () => {
const classNewGameBox = document.querySelector('.new-game-setup').className
// Toggle hidden box to display it or hide it
if(classNewGameBox === 'new-game-setup') {
// To hide the box
document.querySelector('.new-game-setup').className = 'hidden new-game-setup'
document.querySelector('#button-continue').className = 'hidden'
document.querySelector('#join-game').disabled = false
} else {
const abi = [
{
"constant": true,
"inputs": [],
"name": "player2Escrow",
"outputs": [
{
"name": "",
"type": "uint256"
}
const abi = [
{
"constant": true,
"inputs": [],
"name": "player2Escrow",
"outputs": [
{
"name": "",
"type": "uint256"
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="index.css">
<title>Dice ethereum game</title>
</head>
<body>
<div class="main-content">
<h1>Ethereum Dice</h1>
Contract = web3.eth.contract(abi)
contractInstance = Contract.new({
value: web3.toWei(valueSelected),
data: bytecode.object,
gas: 7e6
}, (err, result) => {
// This callback will be called twice, the second time includes the contract address
if(!result.address) {
console.log('wait until the block is mined with the contract creation transaction')
let Contract
let contractInstance
function start() {
document.querySelector('#new-game').addEventListener('click', () => {
const classNewGameBox = document.querySelector('.new-game-setup').className
// Toggle hidden box to display it or hide it
if(classNewGameBox === 'new-game-setup') {
// To hide the box