Skip to content

Instantly share code, notes, and snippets.

@oskarth
Last active Aug 2, 2019
Embed
What would you like to do?
Geth Nimbus mapping

Geth Nimbus mapping

These are all the things we use from go-ethereum in status-console-client right now.

Note that this doesn't include transitive dependencies in vendor, such as status-go etc.

Packages

> ag "ethereum/go-ethereum/" --ignore vendor *.go --nofilename | sort -r | uniq
	"github.com/ethereum/go-ethereum/rpc"
	"github.com/ethereum/go-ethereum/p2p/enode"
	"github.com/ethereum/go-ethereum/crypto/secp256k1"
	"github.com/ethereum/go-ethereum/crypto"
	"github.com/ethereum/go-ethereum/common/hexutil"
	"github.com/ethereum/go-ethereum/common"
	gethnode "github.com/ethereum/go-ethereum/node"

Functions

Summary

common.Hash
crypto.CompressPubkey(id)
crypto.FromECDSA(key)
crypto.FromECDSAPub(myPublicKey)
crypto.HexToECDSA(strings.TrimPrefix(*keyHex, "0x"))
crypto.GenerateKey()
crypto.UnmarshalPubkey(pubKey)
enode.ID
gethnode.Service
gethnode.ServiceConstructor
*gethnode.ServiceContext
hexutil.Decode(pubKeyHex)
hexutil.Encode(crypto.FromECDSAPub(pubKey))
*secp256k1.BitCurve
secp256k1.CompressPubkey(pub.X, pub.Y)
secp256k1.DecompressPubkey(buf[1:])
secp256k1.S256()

Raw

> ag "crypto\.|hexutil\.|gethnode\.|common\.|secp256k1\.|enode\." --ignore vendor *.go --nofilename | sort -r | uniq
			sigBytes := crypto.FromECDSAPub(m.SigPubKey)
	services := []gethnode.ServiceConstructor{
	return hexutil.Encode(crypto.FromECDSAPub(pubKey))
	RequestID        common.Hash `json:"requestID"`
		pub.X, pub.Y = secp256k1.DecompressPubkey(buf[1:])
	publicKeyBytes := crypto.FromECDSAPub(c.PublicKey())
		pubKey, err := hexutil.Decode(item.PublicKey)
	pubKeyBytes, err := hexutil.Decode(pubKeyHex)
		pub.Curve = secp256k1.S256()
	myPublicKeyBytes := crypto.FromECDSAPub(myPublicKey)
	log.Printf("chat address: %#x", crypto.FromECDSAPub(&privateKey.PublicKey))
	LastEnvelopeHash common.Hash `json:"lastEnvelopeHash"`
		key, err := crypto.GenerateKey()
		k, err := crypto.HexToECDSA(strings.TrimPrefix(*keyHex, "0x"))
		k, err := crypto.GenerateKey()
		item.ChatAlias.publicKey, err = crypto.UnmarshalPubkey(pubKey)
			hex.EncodeToString(crypto.FromECDSAPub(&privateKey.PublicKey)[:20]),
	Hash             common.Hash `json:"hash"`
func (s *server) Connected(id enode.ID) (bool, error) {
		func(ctx *gethnode.ServiceContext) (gethnode.Service, error) {
		fmt.Printf("Your private key: %#x\n", crypto.FromECDSA(key))
		fmt.Printf("Starting with a new private key: %#x\n", crypto.FromECDSA(privateKey))
	fmt.Printf("Chat address: %#x\n", crypto.FromECDSAPub(&privateKey.PublicKey))
				crypto.FromECDSAPub(&privateKey.PublicKey),
	c.publicKey, err = crypto.UnmarshalPubkey(pubKeyBytes)
		copy(rst[1:], secp256k1.CompressPubkey(pub.X, pub.Y))
	case *secp256k1.BitCurve:
		author = "0x" + hex.EncodeToString(crypto.CompressPubkey(id))[:7]

Packages

> ag "ethereum/go-ethereum/" . --ignore vendor . *.go --nofilename | sort -r | uniq
ERR: Error stat()ing: *.go
ERR: Error opening directory *.go: No such file or directory
	-X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=$(ENABLE_METRICS)'")
	// see vendor/github.com/ethereum/go-ethereum/rpc/errors.go:L27
	// see `vendor/github.com/ethereum/go-ethereum/internal/ethapi/api.go:1107`
	rpc "github.com/ethereum/go-ethereum/rpc"
	keystore "github.com/ethereum/go-ethereum/accounts/keystore"
import "github.com/ethereum/go-ethereum/rpc"
import "github.com/ethereum/go-ethereum/p2p/discv5"
import "github.com/ethereum/go-ethereum/metrics"
https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal
	hexutil "github.com/ethereum/go-ethereum/common/hexutil"
	"github.com/ethereum/go-ethereum/rpc"
	"github.com/ethereum/go-ethereum/rlp"
	"github.com/ethereum/go-ethereum/params"
	"github.com/ethereum/go-ethereum/p2p/nat"
	"github.com/ethereum/go-ethereum/p2p/enr"
	"github.com/ethereum/go-ethereum/p2p/enode"
	"github.com/ethereum/go-ethereum/p2p/discv5"
	"github.com/ethereum/go-ethereum/p2p"
	"github.com/ethereum/go-ethereum/node"
	"github.com/ethereum/go-ethereum/metrics"
	"github.com/ethereum/go-ethereum/log"
	"github.com/ethereum/go-ethereum/les"
	"github.com/ethereum/go-ethereum/event"
	"github.com/ethereum/go-ethereum/eth/filters"
	"github.com/ethereum/go-ethereum/eth/downloader"
	"github.com/ethereum/go-ethereum/ethclient"
	"github.com/ethereum/go-ethereum/ethapi"
	"github.com/ethereum/go-ethereum/eth"
	"github.com/ethereum/go-ethereum/crypto/ecies"
	"github.com/ethereum/go-ethereum/crypto"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/core"
	"github.com/ethereum/go-ethereum/contracts/ens/contract"
	"github.com/ethereum/go-ethereum/consensus/ethash"
	"github.com/ethereum/go-ethereum/common/mclock"
	"github.com/ethereum/go-ethereum/common/hexutil"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/accounts/keystore"
	"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
	"github.com/ethereum/go-ethereum/accounts/abi/bind"
	"github.com/ethereum/go-ethereum/accounts/abi"
	"github.com/ethereum/go-ethereum/accounts"
	gethrpc "github.com/ethereum/go-ethereum/rpc"
	gethparams "github.com/ethereum/go-ethereum/params"
	gethnode "github.com/ethereum/go-ethereum/node"
	gethmetrics "github.com/ethereum/go-ethereum/metrics"
	gethcommon "github.com/ethereum/go-ethereum/common"
	ethcrypto "github.com/ethereum/go-ethereum/crypto"
	// don't change the name of this flag, https://github.com/ethereum/go-ethereum/blob/master/metrics/metrics.go#L41
	common "github.com/ethereum/go-ethereum/common"
	accounts "github.com/ethereum/go-ethereum/accounts"

Functions

TBD

status-go usage

Packages

> ag "status-go" *.go --nofilename | sort -r | uniq
	"github.com/status-im/status-go/signal"
	"github.com/status-im/status-go/params"
	"github.com/status-im/status-go/node"
	"github.com/status-im/status-go/logutils"

Functions

Summary

logutils.FileOptions{Filename: nodeLogPath}
logutils.OverrideRootLog(true, *logLevel, logutils.FileOptions{Filename: nodeLogPath}, false)
node.New()
*node.StatusNode
params.FleetBeta
params.FleetStaging
params.MainNetworkID
params.NewNodeConfigWithDefaultsAndFiles
*params.NodeConfig
params.Option
params.WithFleet(fleet)
s.node.AddPeer(peer)
s.node.GethNode()
s.node.Server().PrivateKey
statusNode.Start(nodeConfig, services...)
statusNode.WhisperService()

Raw

> ag "signals\.|params\.|node\.|logutils\." *.go --nofilename | sort -r | uniq
	statusNode := node.New()
	shhService, err := statusNode.WhisperService()
	services := []gethnode.ServiceConstructor{
	return s.node.Server().PrivateKey
	return s.node.AddPeer(peer)
	return func(c *params.NodeConfig) error {
			params.WithFleet(fleet),
		[]params.Option{
		params.MainNetworkID,
	node *node.StatusNode
	if err := statusNode.Start(nodeConfig, services...); err != nil {
	geth := s.node.GethNode()
func withListenAddr(listenAddr string) params.Option {
func (s *server) Connected(id enode.ID) (bool, error) {
func generateStatusNodeConfig(dataDir, fleet, listenAddr string, configFile string) (*params.NodeConfig, error) {
		func(ctx *gethnode.ServiceContext) (gethnode.Service, error) {
	fleet                 = fs.String("fleet", params.FleetBeta, fmt.Sprintf("Status nodes cluster to connect to: %s", []string{params.FleetBeta, params.FleetStaging}))
	err = logutils.OverrideRootLog(true, *logLevel, logutils.FileOptions{Filename: nodeLogPath}, false)
	config, err := params.NewNodeConfigWithDefaultsAndFiles(
@oskarth

This comment has been minimized.

Copy link
Owner Author

@oskarth oskarth commented Aug 2, 2019

big deps that i remember:

  1. all services are tightly coupled with geth node (e.g. it manages services lifecycle and exposes rpc)
  2. peerpool uses discovery v5 exposed by geth node and server to add/drop connections
  3. some non-documented changes in our whisper version (e.g. mail server improvements, confirmation that message was sent into the network, and back-propagating errors)
    so modules in status-go are : discovery, peers, mailserver
    -- Dmitry S

Probably need to triage the geth in status-go modules a bit, depending on how clean the status-console-client using status-go interface is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment