Skip to content

Instantly share code, notes, and snippets.

View qbig's full-sized avatar

Liang qbig

  • @us3r-network
  • Singapore
View GitHub Profile
@qbig
qbig / go-solidity-binding.md
Created November 5, 2018 05:26
Generate solidity smart contract golang binding with go-ethereum devtool

Commands

go get -u github.com/ethereum/go-ethereum
cd $GOPATH/src/github.com/ethereum/go-ethereum/
make
make devtools

solc --abi Store.sol
solc --bin Store.sol
@qbig
qbig / subscribe_block.go
Created November 5, 2018 05:14
Subscribing to new block using go-ethereum
package main
import (
"context"
"fmt"
"log"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
)
@qbig
qbig / transfer_token.go
Created November 5, 2018 05:09
Transfer erc20 token with go-ethereum
package main
import (
"context"
"crypto/ecdsa"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum"
@qbig
qbig / sendeth.go
Created November 4, 2018 17:18
Send eth using go-ethereum
package main
import (
"context"
"crypto/ecdsa"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
@qbig
qbig / account-check.md
Created November 4, 2018 12:30
Check address is a EOA or Contract using go-ethereum
package main

import (
    "context"
    "fmt"
    "log"
    "regexp"

    "github.com/ethereum/go-ethereum/common"
@qbig
qbig / keystore-go-ethereum.md
Created November 4, 2018 12:23
create keystone with go-ethereum
package main

import (
    "fmt"
    "io/ioutil"
    "log"
    "os"

    "github.com/ethereum/go-ethereum/accounts/keystore"
@qbig
qbig / wallet-go-ethereum.md
Created November 4, 2018 12:07
Generate Private and private key with go-ethereum
package main

import (
    "crypto/ecdsa"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/common/hexutil"
    "github.com/ethereum/go-ethereum/crypto"
@qbig
qbig / erc20-contract-go-ethereum.md
Created November 4, 2018 11:57
Read a ERC20 token with Go-ethereum
pragma solidity ^0.4.24;

contract ERC20 {
    string public constant name = "";
    string public constant symbol = "";
    uint8 public constant decimals = 0;

    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
@qbig
qbig / go-ethereum-account-balance.md
Created November 4, 2018 11:36
Check account balance with go-ethereum
package main

import (
    "context"
    "fmt"
    "log"
    "math"
    "math/big"
@qbig
qbig / ethclient.md
Last active November 4, 2018 11:36
Connect to Ethereum blockchain from go
package main

import (
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/ethclient"
)