package main
import (
"context"
"encoding/hex"
"fmt"
"log"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
client, err := ethclient.Dial("https://rinkeby.infura.io")
if err != nil {
log.Fatal(err)
}
contractAddress := common.HexToAddress("0x147B8eb97fD247D06C4006D269c90C1908Fb5D54")
bytecode, err := client.CodeAt(context.Background(), contractAddress, nil) // nil is latest block
if err != nil {
log.Fatal(err)
}
fmt.Println(hex.EncodeToString(bytecode)) // 60806...10029
}
Created
November 5, 2018 07:20
-
-
Save qbig/1306fc6598791bb43a742d0d2169b319 to your computer and use it in GitHub Desktop.
Reading Smart Contract Bytecode
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment