Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
Empty file added LICENSE
Empty file.
36 changes: 36 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package cmd

import (
"os"

"github.com/Conflux-Chain/go-conflux-util/config"
"github.com/Conflux-Chain/go-conflux-util/log"
"github.com/spf13/cobra"
)

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "data-house",
Short: "Conflux blockchain data infrastructure.",
Long: `Access all data of conflux blockchain.`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
}

// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}

func init() {
cobra.OnInitialize(func() {
config.MustInit("DH")
})

log.BindFlags(rootCmd)
}
46 changes: 46 additions & 0 deletions cmd/startEvmSync.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package cmd

import (
"context"
"sync"

"github.com/Conflux-Chain/data-house/common"
"github.com/Conflux-Chain/data-house/model"
"github.com/Conflux-Chain/data-house/sync/evm"
"github.com/Conflux-Chain/go-conflux-util/cmd"
"github.com/Conflux-Chain/go-conflux-util/store"
"github.com/Conflux-Chain/go-conflux-util/viper"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

// startEvmSyncCmd represents the startEvmSync command
var startEvmSyncCmd = &cobra.Command{
Use: "startEvmSync",
Short: "start evm sync",
Run: start,
}

func init() {
rootCmd.AddCommand(startEvmSyncCmd)
}

func start(*cobra.Command, []string) {
logrus.Info("Starting evm sync ...")

ctx, cancel := context.WithCancel(context.Background())
var wg sync.WaitGroup

storeConfig := store.MustNewConfigFromViper()
db := storeConfig.MustOpenOrCreate(model.EvmTables...)

var config common.EvmConfig
viper.MustUnmarshalKey("evm", &config)

if err := evm.StartSync(ctx, &wg, &config, db); err != nil {
logrus.WithError(err).Fatal("failed to start evm sync")
}
logrus.Info("Evm sync started")

cmd.GracefulShutdown(&wg, cancel)
}
8 changes: 8 additions & 0 deletions common/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package common

import "github.com/Conflux-Chain/go-conflux-util/blockchain/sync/evm"

type EvmConfig struct {
FirstBlock uint64
evm.Config
}
21 changes: 21 additions & 0 deletions common/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package common

import (
"fmt"
"strings"
)

func GetMethodID(input []byte) string {
if len(input) < 4 {
return ""
}

var builder strings.Builder
builder.WriteString("0x")

for _, b := range input[:4] {
builder.WriteString(fmt.Sprintf("%02x", b))
}

return builder.String()
}
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#placeholder file
107 changes: 107 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
module github.com/Conflux-Chain/data-house

go 1.23.10

require (
github.com/Conflux-Chain/go-conflux-util v0.6.9-0.20251226095241-429733610f4c
github.com/openweb3/web3go v0.3.0
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.10.2
gorm.io/gorm v1.30.0
)

require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/DmitriyVTitov/size v1.5.0 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/PagerDuty/go-pagerduty v1.8.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/bits-and-blooms/bitset v1.20.0 // indirect
github.com/btcsuite/btcd v0.24.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/consensys/bavard v0.1.27 // indirect
github.com/consensys/gnark-crypto v0.16.0 // indirect
github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/c-kzg-4844/v2 v2.1.0 // indirect
github.com/ethereum/go-ethereum v1.15.11 // indirect
github.com/ethereum/go-verkle v0.2.2 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/go-telegram/bot v1.2.2 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/huin/goupnp v1.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/mcuadros/go-defaults v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/openweb3/go-ethereum-hdwallet v0.1.0 // indirect
github.com/openweb3/go-rpc-provider v0.3.5 // indirect
github.com/openweb3/go-sdk-common v0.0.0-20240627072707-f78f0155ab34 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pion/dtls/v2 v2.2.7 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/stun/v2 v2.0.0 // indirect
github.com/pion/transport/v2 v2.2.1 // indirect
github.com/pion/transport/v3 v3.0.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/spf13/viper v1.10.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.40.0 // indirect
golang.org/x/crypto v0.35.0 // indirect
golang.org/x/sync v0.11.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/driver/mysql v1.6.0 // indirect
gorm.io/driver/sqlite v1.6.0 // indirect
gotest.tools v2.2.0+incompatible // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading