Skip to content

Instantly share code, notes, and snippets.

View p4u's full-sized avatar

Pau p4u

View GitHub Profile
package main
import (
"fmt"
"os"
"go.vocdoni.io/proto/build/go/models"
"google.golang.org/protobuf/proto"
"go.vocdoni.io/dvote/crypto/ethereum"
package api
import (
"fmt"
"net/http"
"time"
"github.com/emprius/emprius-app-backend/db"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
@p4u
p4u / README.txt
Created May 3, 2021 12:54
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@p4u
p4u / 1_Storage.sol
Created January 22, 2021 21:14
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.26+commit.4563c3fc.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.8.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
2020-05-29T10:10:01Z INFO service/storage.go:34 [ipfs info] peers:189 addresses:48302 pins:1309
2020-05-29T10:10:03Z INFO ipfssync/ipfssync.go:280 [ipfsSync info] pins:1309 hash:0x6630e4ef5b8b8b2d07d28272a5c8b2005136a4b9de14c3fd9a4c7b6eac6a8b1c
2020-05-29T10:10:08Z INFO router/router.go:267 api method getBlockHeight
2020-05-29T10:10:09Z INFO router/router.go:267 api method getBlockHeight
2020-05-29T10:10:10Z INFO middleware/logger.go:150 "GET https://gw1.vocdoni.net:443/metrics HTTP/1.1" from 95.217.216.185 - 200 2085B in 2.603947ms
2020-05-29T10:10:15Z INFO service/vochain.go:122 [vochain info] height:149391 mempool:0 processTree:45 voteTree:1076 blockTime:{1m:12.0 10m:11.0 1h:12.0 6h:12.0 24h:12.0}
2020-05-29T10:10:16Z INFO chain/chain.go:246 [ethereum info] synced:true height:2780914/2780734 peers:49 mode:fast
2020-05-29T10:10:17Z INFO subpub/subpub.go:234 [subPub info] dhtPeers:135 dhtKnown:5726 clusterPeers:3
2020-05-29T10:10:19Z INFO router/router.go:267 api method getBlockHeight
2020-05-29T10:10:19Z IN
### Keybase proof
I hereby claim:
* I am p4u on github.
* I am paues (https://keybase.io/paues) on keybase.
* I have a public key ASCSyKM6SCMuW76HahbJOD8f7lI90lCOsgm3fQhKjmPEPgo
To claim this, I am signing this object:
package main
import (
"fmt"
hexutil "github.com/ethereum/go-ethereum/common/hexutil"
crypto "github.com/ethereum/go-ethereum/crypto"
)
const SigningPrefix = "\u0019Ethereum Signed Message:\n"