Skip to content

Instantly share code, notes, and snippets.

View qbig's full-sized avatar

Liang qbig

View GitHub Profile
@qbig
qbig / config.yml
Created November 25, 2020 16:02 — forked from asselstine/config.yml
Run Truffle Tests on CircleCI 2.0
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
@qbig
qbig / btc_miner.rb
Created September 18, 2020 12:29
Bitcoin Mining Ruby
require 'digest/sha2'
# -----------------
# Utility Functions
# -----------------
# The hash function used in mining (convert hexadecimal to binary first, then SHA256 twice)
def hash256(data)
binary = [data].pack("H*")
hash1 = Digest::SHA256.digest(binary)
@qbig
qbig / Mac.c
Created November 26, 2018 06:34
Minimalist VM in C
/**
This is almost identical to the articles
VM
https://github.com/felixangell/mac/blob/master/mac.c
**/
#include <stdio.h>
#include <stdbool.h>
@qbig
qbig / Glossary.md
Created November 5, 2018 07:49
Glossary

Glossary

Addresses

Used to receive and send transactions on the network. An address is a string of alphanumeric characters, but can also be represented as a scannable QR code. They are derived from the public/private ECDSA key pair.

Agreement Ledgers

Distributed ledgers used by two or more parties to negotiate and reach and agreement.

@qbig
qbig / util.go
Created November 5, 2018 07:47
Go-ethereum create utility functions
package util
import (
"math/big"
"reflect"
"regexp"
"strconv"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
@qbig
qbig / run-geth-with-whisper.md
Created November 5, 2018 07:46
Whisper: Whisper is a simple peer-to-peer identity-based messaging system designed to be a building block in the next generation of decentralized applications

geth --rpc --shh --ws

@qbig
qbig / commands.md
Last active November 5, 2018 07:42
Swarm: Swarm in Ethereum's decentralized and distributed storage solution, comparable to IPFS.
go get -d github.com/ethereum/go-ethereum
go install github.com/ethereum/go-ethereum/cmd/geth
go install github.com/ethereum/go-ethereum/cmd/swarm
geth account new
export BZZKEY=970ef9790b54425bea2c02e25cab01e48cf92573
swarm --bzzaccount $BZZKEY
@qbig
qbig / simulated-backend.go
Created November 5, 2018 07:37
Use a simulated backend for testing
package main
import (
"context"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
@qbig
qbig / verify-sign-hello.go
Created November 5, 2018 07:35
Verify signature with go-ethereum
package main
import (
"bytes"
"crypto/ecdsa"
"fmt"
"log"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
@qbig
qbig / sign-hello.go
Created November 5, 2018 07:33
Sign with go-ethereum
package main
import (
"fmt"
"log"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)