Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add eths inscriptions and add some new jsonrpc apis. #23

Closed
wants to merge 127 commits into from
Closed
Show file tree
Hide file tree
Changes from 125 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
b1b4c5c
add CommonResponse statuct
jonzhang708 Feb 3, 2024
be42706
opt code
jonzhang708 Feb 3, 2024
899230c
add new get txs api
jonzhang708 Feb 3, 2024
531824b
updage api json file
jonzhang708 Feb 3, 2024
5bdd689
opt code
jonzhang708 Feb 4, 2024
aef9e20
code style
jonzhang708 Feb 4, 2024
13e9058
add log
jonzhang708 Feb 4, 2024
4339542
add log
jonzhang708 Feb 4, 2024
9acee5a
fix log
jonzhang708 Feb 4, 2024
2932c66
fix log
jonzhang708 Feb 4, 2024
be711ea
fix
jonzhang708 Feb 4, 2024
7e1f210
fix
jonzhang708 Feb 4, 2024
6a15b20
json
jonzhang708 Feb 4, 2024
45dd5b2
add inds_getInscriptionsStats api
jonzhang708 Feb 4, 2024
70308c8
add inds_getInscriptionsStats
jonzhang708 Feb 4, 2024
2829a4f
fix
jonzhang708 Feb 4, 2024
5a97c56
fix
jonzhang708 Feb 4, 2024
2234604
add new code
jonzhang708 Feb 4, 2024
3b9f0e4
fix
jonzhang708 Feb 4, 2024
3ec5aea
fix
jonzhang708 Feb 4, 2024
e9600ec
opt handleGetLastBlockNumber,when chains is empty ,return all chain's…
jonzhang708 Feb 5, 2024
161af41
fix
jonzhang708 Feb 5, 2024
217fde6
fix bug
jonzhang708 Feb 5, 2024
e84e78b
opt code
jonzhang708 Feb 5, 2024
090cc04
opt code
jonzhang708 Feb 5, 2024
e452cfb
fix bug
jonzhang708 Feb 5, 2024
338a5d9
add new api
jonzhang708 Feb 6, 2024
eb9c36c
add catch for txs
jonzhang708 Feb 6, 2024
4709c5c
new code
jonzhang708 Feb 6, 2024
9b6614b
change api name
jonzhang708 Feb 6, 2024
e9834d2
new cdoe
jonzhang708 Feb 6, 2024
d03215e
fix bug
jonzhang708 Feb 6, 2024
02303bb
add log
jonzhang708 Feb 6, 2024
c2511a3
new api
jonzhang708 Feb 6, 2024
c931668
opt code
jonzhang708 Feb 6, 2024
dc6d040
fix bug
jonzhang708 Feb 6, 2024
9a21ec5
add new code
jonzhang708 Feb 6, 2024
cac9ec6
add search
SeriousVv Feb 6, 2024
0494483
Merge remote-tracking branch 'origin/main'
SeriousVv Feb 6, 2024
c07749e
add search
SeriousVv Feb 7, 2024
a8e2106
add search
SeriousVv Feb 7, 2024
926db50
add search
SeriousVv Feb 7, 2024
d6906a2
add search
SeriousVv Feb 7, 2024
2b56095
add search
SeriousVv Feb 7, 2024
2c0b322
add search
SeriousVv Feb 7, 2024
4074592
add search
SeriousVv Feb 7, 2024
510b46d
add search
SeriousVv Feb 7, 2024
4068630
add search
SeriousVv Feb 7, 2024
a9ec4f6
add search
SeriousVv Feb 7, 2024
45e8b52
add search
SeriousVv Feb 7, 2024
1222439
add chain id
jonzhang708 Feb 7, 2024
3f54b5d
add search
SeriousVv Feb 7, 2024
077fe48
fix
jonzhang708 Feb 7, 2024
e5d36b8
add search
SeriousVv Feb 7, 2024
e84f962
add eths
jonzhang708 Feb 8, 2024
a87eda5
Merge branch 'main' of github.com:bradzhang717/indexer into main
jonzhang708 Feb 8, 2024
2dc7036
tx hash to varbinary
jonzhang708 Feb 8, 2024
9ead7c0
add field
jonzhang708 Feb 8, 2024
a395b9a
merge v1 to v2
jonzhang708 Feb 13, 2024
9cd2698
opt code
jonzhang708 Feb 13, 2024
861af68
add .
jonzhang708 Feb 13, 2024
4d170f7
change
jonzhang708 Feb 13, 2024
5957db1
new code
jonzhang708 Feb 13, 2024
904e919
change api name
jonzhang708 Feb 13, 2024
b9848a4
opt code
jonzhang708 Feb 13, 2024
02f6637
fix
jonzhang708 Feb 13, 2024
0a14965
add new method
jonzhang708 Feb 13, 2024
3b67111
add new code
jonzhang708 Feb 13, 2024
bf02775
fix
jonzhang708 Feb 13, 2024
6b62be7
api
jonzhang708 Feb 13, 2024
7e92a21
fix api json file
jonzhang708 Feb 13, 2024
e1a28ed
new code
jonzhang708 Feb 13, 2024
ada1817
fix bug
jonzhang708 Feb 13, 2024
f076632
new code
jonzhang708 Feb 13, 2024
0baf1c1
new code
jonzhang708 Feb 13, 2024
3d3ea19
add log
jonzhang708 Feb 14, 2024
0b3b01b
opti api doc
SeriousVv Feb 15, 2024
b92b14c
add search
SeriousVv Feb 15, 2024
aa33996
add search
SeriousVv Feb 15, 2024
496232e
add task
jonzhang708 Feb 16, 2024
4ecc50b
add task
jonzhang708 Feb 16, 2024
f127fdc
task
jonzhang708 Feb 16, 2024
2fb4bfe
new code
jonzhang708 Feb 16, 2024
a0a8de8
opt code
jonzhang708 Feb 16, 2024
07346c1
new code
jonzhang708 Feb 16, 2024
decd41b
fix code
jonzhang708 Feb 16, 2024
79d9b61
add new code
jonzhang708 Feb 18, 2024
ed7da19
add env
jonzhang708 Feb 18, 2024
b5f18b2
add sql migration file
jonzhang708 Feb 18, 2024
4815077
opt read config file logic
jonzhang708 Feb 18, 2024
fdbd1fc
update readme doc
jonzhang708 Feb 18, 2024
107b0db
add shorthand cmd
jonzhang708 Feb 18, 2024
635a7e7
opt json rpc config file
jonzhang708 Feb 18, 2024
d9c9e77
delete func
jonzhang708 Feb 18, 2024
4b40a0e
add gitignore
jonzhang708 Feb 19, 2024
3d8961c
config file
jonzhang708 Feb 19, 2024
255bc37
max data length
jonzhang708 Feb 19, 2024
2478def
max data length
jonzhang708 Feb 19, 2024
e7b03d1
max data length
jonzhang708 Feb 19, 2024
27854d9
add search
SeriousVv Feb 20, 2024
67e83a1
Merge remote-tracking branch 'origin/main'
SeriousVv Feb 20, 2024
79e7ccc
code style
jonzhang708 Feb 20, 2024
357f4dc
code style
jonzhang708 Feb 20, 2024
beca3bf
opt code
jonzhang708 Feb 20, 2024
ceecac7
add search
SeriousVv Feb 20, 2024
22a777f
opt code
jonzhang708 Feb 20, 2024
7854b09
add search
SeriousVv Feb 20, 2024
48e4c0c
opt code
jonzhang708 Feb 20, 2024
61a58c8
opt code
jonzhang708 Feb 20, 2024
f7d7b71
opt code
jonzhang708 Feb 20, 2024
362365f
opt code
jonzhang708 Feb 20, 2024
f090821
merge code
jonzhang708 Feb 20, 2024
0d03239
add migrate sql file
jonzhang708 Feb 21, 2024
ec6fbea
task
jonzhang708 Feb 22, 2024
aa47cf4
add all chain & chain stat
SeriousVv Feb 22, 2024
145d77d
add all chain & chain stat
SeriousVv Feb 22, 2024
a8a5607
merge sql file
jonzhang708 Feb 22, 2024
dea3624
Merge branch 'main' of github.com:bradzhang717/indexer into main
jonzhang708 Feb 22, 2024
73b009e
add all chain & chain stat
SeriousVv Feb 22, 2024
f19694a
Merge branch 'main' of github.com:bradzhang717/indexer into main
jonzhang708 Feb 22, 2024
92faee8
add all chain & chain stat
SeriousVv Feb 22, 2024
4f73558
remove task from indexer
jonzhang708 Feb 22, 2024
f5349dd
update sql file
jonzhang708 Feb 22, 2024
64885e0
add all chain & chain stat
SeriousVv Feb 22, 2024
58db4d2
Merge remote-tracking branch 'origin/main'
SeriousVv Feb 22, 2024
a705244
rename struct name to RpcConfig
jonzhang708 Feb 23, 2024
ca296ae
Merge pull request #1 from bradzhang717/main
bradzhang717 Feb 23, 2024
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
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
/logs.txt
/config.ini
/bin/
./indexer
./indexer
indexer
build.sh
log
dev_config.json
test_config.json
dev_config_jsonrpc.json
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ make build install
### Build indexer
```
make build install-indexer
indexer -config config.json
indexer --config config.json or indexer -c config.json
```


Expand All @@ -42,7 +42,7 @@ indexer -config config.json
### Build apiserver
```
make build install-jsonrpc
apiserver -config config_jsonrpc.json
apiserver --config config_jsonrpc.json or apiserver -c config_jsonrpc.json
```


Expand Down
5 changes: 4 additions & 1 deletion client/evm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package evm

import (
"context"
"encoding/json"
"errors"
"fmt"
"github.com/ethereum/go-ethereum"
Expand Down Expand Up @@ -57,7 +58,7 @@ func (ec *RawClient) Client() *rpc.Client {
}

func (ec *RawClient) doCallContext(retry int, result interface{}, method string, args ...interface{}) (err error) {
timeCtx, cancel := context.WithTimeout(context.Background(), time.Second*5)
timeCtx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()

t1 := time.Now()
Expand Down Expand Up @@ -88,6 +89,8 @@ func (ec *RawClient) CallContext(ctx context.Context, result interface{}, method
if result == nil {
return rpc.ErrNoResult
}
d, _ := json.Marshal(result)
xylog.Logger.Debugf("CallContext result=%v", string(d))
return nil
}

Expand Down
14 changes: 8 additions & 6 deletions cmd/indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import (
"context"
"flag"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"github.com/uxuycom/indexer/client"
"github.com/uxuycom/indexer/devents"
"github.com/uxuycom/indexer/protocol"
"github.com/uxuycom/indexer/xylog"

"github.com/uxuycom/indexer/config"
"github.com/uxuycom/indexer/dcache"
"github.com/uxuycom/indexer/devents"
"github.com/uxuycom/indexer/explorer"
"github.com/uxuycom/indexer/protocol"
"github.com/uxuycom/indexer/storage"
"github.com/uxuycom/indexer/xylog"
"net/http"
_ "net/http/pprof"
"os"
Expand Down Expand Up @@ -107,6 +107,8 @@ func main() {
}

func initArgs() {
flag.StringVar(&flagConfig, "config", "config.json", "config file")
flag.Parse()

pflag.StringVarP(&flagConfig, "config", "c", "config.json", "config file")
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
}
18 changes: 14 additions & 4 deletions cmd/jsonrpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
package main

import (
"encoding/json"
"flag"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
"github.com/uxuycom/indexer/config"
"github.com/uxuycom/indexer/jsonrpc"
"github.com/uxuycom/indexer/storage"
Expand All @@ -47,7 +49,13 @@ func main() {

config.LoadJsonRpcConfig(&cfg, flagConfig)

logLevel, _ := logrus.ParseLevel(cfg.LogLevel)
cfgJson, _ := json.Marshal(&cfg)
log.Printf("start server with config = %v\n", string(cfgJson))

logLevel, err := logrus.ParseLevel(cfg.LogLevel)
if err != nil {
log.Printf("start server parse log level err = %v\n", err)
}
xylog.InitLog(logLevel, cfg.LogPath)

//db client
Expand All @@ -57,7 +65,7 @@ func main() {
return
}
//init server
server, err := jsonrpc.NewRPCServer(dbc, cfg.CacheStore)
server, err := jsonrpc.NewRPCServer(dbc, &cfg)
if err != nil {
log.Fatalf("server init err[%v]", err)
}
Expand All @@ -83,6 +91,8 @@ func main() {
}

func initArgs() {
flag.StringVar(&flagConfig, "config", "config_jsonrpc.json", "config file")
flag.Parse()

pflag.StringVarP(&flagConfig, "config", "c", "config_jsonrpc.json", "config file")
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
}
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@
"profile": {
"enabled": false,
"listen": ":6060"
},
"stat": {
"address_start_id": 348870000,
"balance_start_id": 390790000
}
}
117 changes: 53 additions & 64 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,45 @@
package config

import (
"encoding/json"
"github.com/spf13/viper"
"github.com/uxuycom/indexer/model"
"log"
"os"
"path/filepath"
)

type ScanConfig struct {
StartBlock uint64 `json:"start_block"`
BlockBatchWorkers uint64 `json:"block_batch_workers"`
TxBatchWorkers uint64 `json:"tx_batch_workers"`
DelayedBlockNum uint64 `json:"delayed_block_num"`
StartBlock uint64 `json:"start_block" mapstructure:"start_block"`
BlockBatchWorkers uint64 `json:"block_batch_workers" mapstructure:"block_batch_workers"`
TxBatchWorkers uint64 `json:"tx_batch_workers" mapstructure:"tx_batch_workers"`
DelayedBlockNum uint64 `json:"delayed_block_num" mapstructure:"delayed_block_num"`
}

type ChainConfig struct {
ChainName string `json:"chain_name"`
ChainName string `json:"chain_name" mapstructure:"chain_name"`
Rpc string `json:"rpc"`
UserName string `json:"username"`
PassWord string `json:"password"`
ChainGroup model.ChainGroup `json:"chain_group"`
ChainGroup model.ChainGroup `json:"chain_group" mapstructure:"chain_group"`
}

type StatConfig struct {
AddressStartId uint64 `json:"address_start_id" mapstructure:"address_start_id"`
BalanceStartId uint64 `json:"balance_start_id" mapstructure:"balance_start_id"`
}

type IndexFilter struct {
Whitelist *struct {
Ticks []string `json:"ticks"`
Protocols []string `json:"protocols"`
} `json:"whitelist"`
EventTopics []string `json:"event_topics"`
EventTopics []string `json:"event_topics" mapstructure:"event_topics"`
}

// DatabaseConfig database config
type DatabaseConfig struct {
Type string `json:"type"`
Dsn string `json:"dsn"`
EnableLog bool `json:"enable_log"`
EnableLog bool `json:"enable_log" mapstructure:"enable_log"`
}

type ProfileConfig struct {
Expand All @@ -68,81 +72,66 @@ type ProfileConfig struct {
type Config struct {
Scan ScanConfig `json:"scan"`
Chain ChainConfig `json:"chain"`
LogLevel string `json:"log_level"`
LogPath string `json:"log_path"`
LogLevel string `json:"log_level" mapstructure:"log_level"`
LogPath string `json:"log_path" mapstructure:"log_path"`
Filters *IndexFilter `json:"filters"`
Database DatabaseConfig `json:"database"`
Profile *ProfileConfig `json:"profile"`
Stat *StatConfig `json:"stat"`
}

type JsonRcpConfig struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSONRPC is correct, JsonRcp is incorrect

RpcListen []string `json:"rpclisten"`
RpcMaxClients int64 `json:"rpcmaxclients"`
LogLevel string `json:"log_level"`
LogPath string `json:"log_path"`
Database DatabaseConfig `json:"database"`
Profile *ProfileConfig `json:"profile"`
CacheStore *CacheConfig `json:"cache_store"`
LogLevel string `json:"log_level" mapstructure:"log_level"`
LogPath string `json:"log_path" mapstructure:"log_path"`
Database DatabaseConfig `json:"database"`
Profile *ProfileConfig `json:"profile"`
CacheStore *CacheConfig `json:"cache_store" mapstructure:"cache_store"`
DebugLevel string `json:"debug_level" mapstructure:"debug_level"`
DisableTLS bool `json:"notls" description:"Disable TLS for the RPC server -- NOTE: This is only allowed if the RPC server is bound to localhost"`
RPCCert string `json:"rpccert" description:"File containing the certificate file"`
RPCKey string `json:"rpckey" description:"File containing the certificate key"`
RPCLimitPass string `json:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"`
RPCLimitUser string `json:"rpclimituser" description:"Username for limited RPC connections"`
RPCListeners []string `json:"rpclisten" mapstructure:"rpclisten" description:"Add an interface/port to listen for RPC
connections (default port: 6583, testnet: 16583)"`
RPCMaxClients int `json:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`
RPCMaxConcurrentReqs int `json:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"`
RPCMaxWebsockets int `json:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"`
RPCQuirks bool `json:"rpcquirks" description:"Mirror some JSON-RPC quirks of Bitcoin Core -- NOTE: Discouraged unless interoperability issues need to be worked around"`
RPCPass string `json:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
RPCUser string `json:"rpcuser" description:"Username for RPC connections"`
}

type CacheConfig struct {
Started bool `json:"started"`
MaxCapacity int64 `json:"max_capacity"`
MaxCapacity int64 `json:"max_capacity" mapstructure:"max_capacity"`
Duration uint32 `json:"duration"`
}

func LoadConfig(cfg *Config, filePath string) {
// Default config.
configFileName := "config.json"
if len(os.Args) > 1 {
configFileName = os.Args[1]
}

configFileName, _ = filepath.Abs(configFileName)
log.Printf("Loading config: %v", configFileName)
func LoadConfig(cfg *Config, configFile string) {
UnmarshalConfig(configFile, cfg)
}

if filePath != "" {
configFileName = filePath
}
configFile, err := os.Open(configFileName)
if err != nil {
log.Fatal("File error: ", err.Error())
}
defer func() {
_ = configFile.Close()
}()
jsonParser := json.NewDecoder(configFile)
if err := jsonParser.Decode(&cfg); err != nil {
log.Fatal("Config error: ", err.Error())
}
func LoadJsonRpcConfig(cfg *JsonRcpConfig, configFile string) {
UnmarshalConfig(configFile, cfg)
}

func LoadJsonRpcConfig(cfg *JsonRcpConfig, filePath string) {
// Default config.
configFileName := "config_jsonrpc.json"
if len(os.Args) > 1 {
configFileName = os.Args[1]
}
func UnmarshalConfig(configFile string, cfg interface{}) {
fileName := filepath.Base(configFile)
viper.SetConfigFile(fileName)
viper.SetConfigType("json")

configFileName, _ = filepath.Abs(configFileName)
log.Printf("Loading config: %v", configFileName)
dir := filepath.Dir(configFile)
viper.AddConfigPath(dir)

if filePath != "" {
configFileName = filePath
if err := viper.ReadInConfig(); err != nil {
log.Fatalf("Read file error, error:%v", err.Error())
}
configFile, err := os.Open(configFileName)
if err != nil {
log.Fatal("File error: ", err.Error())
}
defer func() {
_ = configFile.Close()
}()
jsonParser := json.NewDecoder(configFile)
if err := jsonParser.Decode(&cfg); err != nil {
log.Fatal("Config error: ", err.Error())
if err := viper.Unmarshal(&cfg); err != nil {
log.Fatalf("Unmarshal config fail! error:%v ", err)
}
viper.WatchConfig()
}

func (cfg *JsonRcpConfig) GetConfig() *JsonRcpConfig {
return cfg
}
Expand Down
2 changes: 1 addition & 1 deletion config_jsonrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
"enabled": false,
"listen": ":6060"
}
}
}
46 changes: 46 additions & 0 deletions db/20240221-create-chain-info-add-index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Use
tap_indexer;
-- chain statics by hour table ---------
CREATE TABLE `chain_stats_hour`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`chain` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'chain name',
`date_hour` int unsigned NOT NULL COMMENT 'date_hour',
`address_count` int unsigned NOT NULL COMMENT 'address_count',
`address_last_id` bigint unsigned NOT NULL COMMENT 'address_last_id',
`inscriptions_count` int unsigned NOT NULL COMMENT 'inscriptions_count',
`balance_sum` DECIMAL(38, 18) NOT NULL COMMENT 'balance_sum',
`balance_last_id` bigint unsigned NOT NULL COMMENT 'balance_last_id',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uqx_chain_date_hour` (`chain`, `date_hour`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

-- chain info ---------
CREATE TABLE `chain_info`
(
`id` int unsigned NOT NULL AUTO_INCREMENT,
`chain_id` int unsigned NOT NULL COMMENT 'chain id',
`chain` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'inner chain name',
`outer_chain` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'outer chain name',
`name` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'name',
`logo` varchar(1024) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'logo url',
`network_id` int unsigned NOT NULL COMMENT 'network id',
`ext` varchar(4098) NOT NUll COMMENT 'ext',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uqx_chain_id_chain_name` (`chain_id`, `chain`, `name`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;

INSERT INTO chain_info (chain_id, chain, outer_chain, name, logo, network_id,ext)VALUES (1, 'eth', 'eth', 'Ethereum', '', 1, '');
INSERT INTO chain_info (chain_id, chain, outer_chain, name, logo, network_id,ext)VALUES (43114, 'avalanche', 'avax', 'Avalanche', '', 43114, '');
INSERT INTO chain_info (chain_id, chain, outer_chain, name, logo, network_id,ext)VALUES (42161, 'arbitrum', 'ETH', 'Arbitrum One', '', 42161, '');
INSERT INTO chain_info (chain_id, chain, outer_chain, name, logo, network_id,ext)VALUES (56, 'bsc', 'BSC', 'BNB Smart Chain Mainnet', '', 56, '');
INSERT INTO chain_info (chain_id, chain, outer_chain, name, logo, network_id,ext)VALUES (250, 'fantom', 'FTM', 'Fantom Opera', '', 250, '');
INSERT INTO chain_info (chain_id, chain, outer_chain, name, logo, network_id,ext)VALUES (137, 'polygon', 'Polygon', 'Polygon Mainnet', '', 137, '');
11 changes: 11 additions & 0 deletions db/20240222_alter_tx_hash_chainid.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

Use
tap_indexer;

CREATE INDEX idx_tx_hash ON balance_txn (tx_hash(12));
ALTER TABLE txs MODIFY COLUMN tx_hash VARBINARY(128);
ALTER TABLE address_txs MODIFY COLUMN tx_hash VARBINARY(128);
ALTER TABLE balance_txn MODIFY COLUMN tx_hash VARBINARY(128);
ALTER TABLE address_txs ADD related_address varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL
COMMENT 'related address';
ALTER TABLE block ADD chain_id BIGINT NOT NULL DEFAULT 0 COMMENT "chain id";
2 changes: 1 addition & 1 deletion db/init_mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ CREATE TABLE `block`
UNIQUE KEY `uqx_chain` (`chain`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;
COLLATE = utf8mb4_general_ci;
Loading
Loading