From abdcb0c9d87ca3bce66f1ca2ff118b2772404531 Mon Sep 17 00:00:00 2001 From: Gheis Mohammadi Date: Mon, 11 Feb 2019 11:54:00 +0800 Subject: [PATCH] first release version --- .gitignore | 66 +- Makefile | 59 + README.md | 16 +- blockchain/adapter.go | 84 ++ blockchain/gallactic.go | 280 ++++ blockchain/utils.go | 110 ++ config.toml | 15 + config/config.go | 144 ++ database/adapter.go | 29 + database/postgre.go | 210 +++ explorer/engine.go | 165 ++ main.go | 47 + proto3/blockchain.pb.go | 3080 ++++++++++++++++++++++++++++++++++++++ proto3/blockchain.proto | 227 +++ script/HubbleScan.sql | 250 ++++ tests/accounts_test.go | 32 + tests/blockchain_test.go | 41 + 17 files changed, 4797 insertions(+), 58 deletions(-) create mode 100644 Makefile create mode 100644 blockchain/adapter.go create mode 100644 blockchain/gallactic.go create mode 100644 blockchain/utils.go create mode 100755 config.toml create mode 100644 config/config.go create mode 100644 database/adapter.go create mode 100644 database/postgre.go create mode 100644 explorer/engine.go create mode 100644 main.go create mode 100644 proto3/blockchain.pb.go create mode 100644 proto3/blockchain.proto create mode 100644 script/HubbleScan.sql create mode 100644 tests/accounts_test.go create mode 100644 tests/blockchain_test.go diff --git a/.gitignore b/.gitignore index ad46b30..ca8853c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,61 +1,15 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* +# Temporary / cached +.idea +.vscode -# Runtime data -pids -*.pid -*.seed -*.pid.lock +.DS_Store -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov +Gopkg.lock -# Coverage directory used by tools like istanbul -coverage +tests/config.toml -# nyc test coverage -.nyc_output +# vendors +vendor/* -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - -# next.js build output -.next +# builds +main \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1326da5 --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ + +GOTOOLS = \ + github.com/golang/dep/cmd/dep \ + gopkg.in/alecthomas/gometalinter.v2 \ + github.com/golang/protobuf/proto \ + github.com/golang/protobuf/ptypes/struct \ + google.golang.org/grpc \ + github.com/gogo/protobuf/proto \ + github.com/gogo/protobuf/jsonpb \ + github.com/gogo/protobuf/protoc-gen-gogo \ + github.com/gogo/protobuf/gogoproto \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \ + github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \ + github.com/lib/pq + +PROTOPATH = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf:. -I=${GOPATH}/src/github.com/gallactic/gallactic/rpc/grpc/proto3 -I=${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis +#--proto_path=${GOPATH}/src:${GOPATH}/src/github.com/gogo/protobuf/protobuf:. +HUBBLE = ${GOPATH}/src/github.com/gallactic/hubble_server + +######################################## +### make all +all: tools deps build + +######################################## +### Tools & dependencies +deps: + + dep ensure + +tools: + + go get $(GOTOOLS) + @gometalinter.v2 --install + +######################################## +### Protobuf +proto: + + --protoc $(PROTOPATH) --gogo_out=plugins=grpc:$(HUBBLE) ./proto3/blockchain.proto + +######################################## +### Formatting, linting, and vetting +fmt: + @go fmt ./... + +######################################## +### building +build: + @go build main.go + +run: + @go run main.go + +# To avoid unintended conflicts with file names, always add to .PHONY +# unless there is a reason not to. +# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html +.PHONY: tools deps +.PHONY: build +.PHONY: fmt metalinter \ No newline at end of file diff --git a/README.md b/README.md index f4fdd0a..5a105aa 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ -# hubble-server -API server for hubble scan block explorer +# Hubble Scan Server + +*Hubble Scan Server that checks blocks of [Gallactic Blockchain](https://github.com/gallactic/gallactic) and saves them in Postgre database. + +## Compiling the code + +You need to make sure you have install [Go](https://golang.org/) (version 1.10.1 or higher) and [postgre](https://www.postgresql.org). After installing them, import HubbleScan.sql from script folder into postgre to create database and then you can follow these steps to compile and build the project: + +```bash +mkdir -p $GOPATH/src/github.com/gallactic/hubbleServer +cd $GOPATH/src/github.com/gallactic/hubbleServer +git clone https://github.com/gallactic/HUBBLE_SERVER.git . +make +``` diff --git a/blockchain/adapter.go b/blockchain/adapter.go new file mode 100644 index 0000000..c45ed18 --- /dev/null +++ b/blockchain/adapter.go @@ -0,0 +1,84 @@ +package blockchain + +import ( + "time" +) + +//Account struct +type Account struct { + Address string + Balance uint64 + Permission string + Sequence uint64 + Code string + ID uint64 +} + +//BlockInfo struct in blocks +type BlockInfo struct { + //block ID + BlockHash string + // basic block info + VersionBlock uint64 + VersionApp uint64 + ChainID string + Height int64 + Time time.Time + NumTxs int64 + TotalTxs int64 + // prev block info + LastBlockHash string + // hashes of block data + LastCommitHash string + DataHash string + // hashes from the app output from the prev block + ValidatorsHash string + NextValidatorsHash string + ConsensusHash string + AppHash string + LastResultsHash string + // consensus info + EvidenceHash string + ProposerAddress string +} + +//Block struct +type Block struct { + Height int64 + Hash string + ChainID string + Time time.Time + LastBlockHash string + TxCounts int64 +} + +//Transaction struct +type Transaction struct { + BlockID int64 + Hash string + GasUsed int64 + GasWanted int64 + Data string + Time time.Time +} + +//Adapter for data base +type Adapter interface { + CreateGRPCClient() error + + Update() error + + GetAccountsCount() int + GetAccount(id int) (*Account, error) + GetAccounts() ([]*Account, error) + + GetBlocksLastHeight() (uint64, error) + GetBlockInfo(height uint64) (*BlockInfo, error) + GetBlock(height uint64) (*Block, error) + GetBlocksInfo(from uint64, to uint64) ([]*BlockInfo, error) + GetBlocks(from uint64, to uint64) ([]*Block, error) + + GetTXsCount(height uint64) int + GetTx(height uint64, hash []byte) (*Transaction, error) + GetTXs(height uint64) ([]Transaction, error) +} diff --git a/blockchain/gallactic.go b/blockchain/gallactic.go new file mode 100644 index 0000000..28b1ddb --- /dev/null +++ b/blockchain/gallactic.go @@ -0,0 +1,280 @@ +package blockchain + +import ( + "context" + "encoding/hex" + "fmt" + + config "github.com/gallactic/hubble_server/config" + pb "github.com/gallactic/hubble_server/proto3" + "google.golang.org/grpc" +) + +//Gallactic class for connecting to Gallactic block chain +type Gallactic struct { + client *pb.BlockChainClient + blocks *pb.BlocksResponse + accounts *pb.AccountsResponse + chain *pb.BlockchainInfoResponse + Config *config.Config +} + +//CreateGRPCClient creates a client for communicating with gallactic blockchain +func (g *Gallactic) CreateGRPCClient() error { + var connURL string + connURL = g.Config.GRPC.URL + ":" + g.Config.GRPC.Port + conn, err := grpc.Dial(connURL, grpc.WithInsecure()) + if err != nil { + return err + } + client := pb.NewBlockChainClient(conn) + g.client = &client + return nil +} + +//Update will refresh all data and sync with block chain +func (g *Gallactic) Update() error { + client := *g.client + var chainInfoErr error + g.chain, chainInfoErr = client.GetBlockchainInfo(context.Background(), &pb.Empty{}) + if chainInfoErr != nil { + return chainInfoErr + } + + return nil +} + +//GetBlocksLastHeight return last height +func (g *Gallactic) GetBlocksLastHeight() (uint64, error) { + return g.chain.GetLastBlockHeight(), nil +} + +//GetBlockInfo returns specified block +func (g *Gallactic) GetBlockInfo(height uint64) (*BlockInfo, error) { + + client := *g.client + blockRes, getBlockErr := client.GetBlock(context.Background(), &pb.BlockRequest{Height: height}) + if getBlockErr != nil { + return nil, getBlockErr + } + + header := blockRes.GetBlock().GetHeader() + var inf BlockInfo + toBlockInfo(header, &inf) + return &inf, nil +} + +//GetBlock returns specified block +func (g *Gallactic) GetBlock(height uint64) (*Block, error) { + + lastID, lastIDErr := g.GetBlocksLastHeight() + if lastIDErr != nil { + return nil, lastIDErr + } + if height > lastID { + return nil, fmt.Errorf("block height out of range (max is " + string(lastID) + ")") + } + + client := *g.client + blockRes, getBlockErr := client.GetBlock(context.Background(), &pb.BlockRequest{Height: height}) + if getBlockErr != nil { + return nil, getBlockErr + } + var b Block + toBlock(blockRes, &b) + + return &b, nil +} + +//GetAccountsCount returns number of accounts +func (g *Gallactic) GetAccountsCount() int { + l := len(g.accounts.Accounts) + return l +} + +//GetAccount returns specified account +func (g *Gallactic) GetAccount(id int) (*Account, error) { + acc := g.accounts.Accounts[id].Account + ID := uint64(id) + var retAcc Account + toAccount(acc, &retAcc) + retAcc.ID = ID + return &retAcc, nil +} + +//GetAccounts returns all accounts in array of accounts +func (g *Gallactic) GetAccounts() ([]*Account, error) { + l := len(g.accounts.Accounts) + + retAccounts := make([]*Account, l) + + for i := 0; i < l; i++ { + acc := g.accounts.Accounts[i].Account + ID := uint64(i) + toAccount(acc, retAccounts[i]) + retAccounts[i].ID = ID + } + + return retAccounts, nil +} + +//GetBlocksInfo returns a group of blocks for faster access them +func (g *Gallactic) GetBlocksInfo(from uint64, to uint64) ([]*BlockInfo, error) { + client := *g.client + blocks, getBlocksErr := client.GetBlocks(context.Background(), &pb.BlocksRequest{MinHeight: from, MaxHeight: to}) + if getBlocksErr != nil { + return nil, getBlocksErr + } + + n := len(blocks.GetBlocks()) + retBlocks := make([]*BlockInfo, 0, n) + for i := 0; i < n; i++ { + toBlockInfo(blocks.GetBlocks()[i].GetHeader(), retBlocks[i]) + } + + return retBlocks, nil +} + +//GetBlocks returns a group of blocks for faster access them +func (g *Gallactic) GetBlocks(from uint64, to uint64) ([]*Block, error) { + client := *g.client + blocks, getBlocksErr := client.GetBlocks(context.Background(), &pb.BlocksRequest{MinHeight: from, MaxHeight: to}) + if getBlocksErr != nil { + return nil, getBlocksErr + } + + n := len(blocks.GetBlocks()) + retBlocks := make([]*Block, n) + + for i := 0; i < n; i++ { + retBlocks[i] = new(Block) + BlockInfoToBlock(blocks.GetBlocks()[i].GetHeader(), retBlocks[i]) + } + + return retBlocks, nil +} + +/* +type BlockTxsResponse struct { + Count int32 `protobuf:"varint,1,opt,name=Count,proto3" json:"Count,omitempty"` + Txs []github_com_gallactic_gallactic_txs.Envelope `protobuf:"bytes,3,rep,name=Txs,proto3,customtype=github.com/gallactic/gallactic/txs.Envelope" json:"Txs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +type Envelope struct { + ChainID string `json:"chainId"` + Type tx.Type `json:"type"` + Tx tx.Tx `json:"tx"` + Signatories []crypto.Signatory `json:"signatories,omitempty"` + hash []byte +} + +type Signatory struct { + PublicKey PublicKey `json:"publicKey"` + Signature Signature `json:"signature"` +} +type Signature struct { + data signatureData +} + +type signatureData struct { + Signature []byte `json:"signature"` +} + + +type Tx interface { + Signers() []TxInput + Type() Type + Amount() uint64 + Fee() uint64 + EnsureValid() error +} + + +type TxInput struct { + Address crypto.Address `json:"address"` + Amount uint64 `json:"amount"` + Sequence uint64 `json:"sequence"` +} + + + if txs.Txs[0].Tx.Type() == 1 { + sndTx := txs.Txs[0].Tx + println(sndTx.Amount()) + } + println("TX Count: ", txs.Count) + println("TX Chain ID: ", txs.Txs[0].ChainID) + println("TX Hash: ", hex.EncodeToString(txs.Txs[0].Hash())) + println("TX Signatories Public Key: ", txs.Txs[0].Signatories[0].PublicKey.String()) + println("TX Signatories ACC Address: ", txs.Txs[0].Signatories[0].PublicKey.AccountAddress().String()) + println("TX Signatories VAL Address: ", txs.Txs[0].Signatories[0].PublicKey.ValidatorAddress().String()) + println("TX Signatories Signature: ", txs.Txs[0].Signatories[0].Signature.String()) + println("Num Signers: ", len(txs.Txs[0].Tx.Signers())) + println("TX Signers Address: ", txs.Txs[0].Tx.Signers()[0].Address.String()) + println("TX Signers Amount: ", txs.Txs[0].Tx.Signers()[0].Amount) + println("TX Signers Sequence: ", txs.Txs[0].Tx.Signers()[0].Sequence) + println("TX Amount: ", txs.Txs[0].Tx.Amount()) + println("TX Type: ", txs.Txs[0].Tx.Type()) + println("TX Type Striing: ", txs.Txs[0].Tx.Type().String()) + println("TX Fee: ", txs.Txs[0].Tx.Fee()) + println("TX Err: ", txs.Txs[0].Tx.EnsureValid()) +*/ + +//GetTXsCount returns number of TXs +func (g *Gallactic) GetTXsCount(height uint64) int { + client := *g.client + txs, _ := client.GetBlockTxs(context.Background(), &pb.BlockRequest{Height: height}) + n := int(txs.Count) + return n +} + +//GetTx returns specified TX +func (g *Gallactic) GetTx(height uint64, hash []byte) (*Transaction, error) { + + client := *g.client + + blockRes, getBlockErr := client.GetBlock(context.Background(), &pb.BlockRequest{Height: height}) + if getBlockErr != nil { + return nil, getBlockErr + } + var b Block + toBlock(blockRes, &b) + + findHash := hex.EncodeToString(hash) + txRes, getTxErr := client.GetTx(context.Background(), &pb.TxRequest{TxHash: findHash}) + if getTxErr != nil { + return nil, getTxErr + } + + var tx Transaction + toTx(txRes, &tx) + tx.Time = b.Time + tx.BlockID = int64(height) + + return &tx, nil +} + +//GetTXs returns all transaction of specific block +func (g *Gallactic) GetTXs(height uint64) ([]Transaction, error) { + client := *g.client + txs, getTXsErr := client.GetBlockTxs(context.Background(), &pb.BlockRequest{Height: height}) + if getTXsErr != nil { + return nil, getTXsErr + } + + block, _ := g.GetBlock(height) + n := int(txs.Count) + retTXs := make([]Transaction, n) + for i := 0; i < n; i++ { + retTXs[i].BlockID = int64(height) + retTXs[i].Hash = txs.Txs[i].Hash + retTXs[i].GasUsed = txs.Txs[i].GetGasUsed() + retTXs[i].GasWanted = txs.Txs[i].GetGasWanted() + retTXs[i].Data = "" //TODO: fix data + retTXs[i].Time = block.Time + } + + return retTXs, nil +} diff --git a/blockchain/utils.go b/blockchain/utils.go new file mode 100644 index 0000000..cb47dd6 --- /dev/null +++ b/blockchain/utils.go @@ -0,0 +1,110 @@ +package blockchain + +import ( + "encoding/hex" + "fmt" + + github_com_gallactic_gallactic_core_account "github.com/gallactic/gallactic/core/account" + pb "github.com/gallactic/hubble_server/proto3" + proto3 "github.com/gallactic/hubble_server/proto3" +) + +func toAccount(acc *github_com_gallactic_gallactic_core_account.Account, retAccount *Account) { + code := fmt.Sprintf("%s", acc.Code()) + //ID := uint64(i) + + retAccount.Address = acc.Address().String() + retAccount.Balance = acc.Balance() + retAccount.Permission = acc.Permissions().String() + retAccount.Sequence = acc.Sequence() + retAccount.Code = code + //retAccount.ID = ID +} + +//BlockInfoToBlock convert blockmeta struct to block struct +func BlockInfoToBlock(header pb.HeaderInfo, dest *Block) { + dest.Hash = hex.EncodeToString(header.BlockHash) + dest.ChainID = header.ChainID + dest.Height = header.Height + dest.Time = header.Time + dest.TxCounts = header.NumTxs + dest.LastBlockHash = hex.EncodeToString(header.GetLastBlockId()) +} + +//toBlock convert BlockResponse to Block struct +func toBlock(blockRes *proto3.BlockResponse, b *Block) { + header := blockRes.GetBlock().GetHeader() + + b.Hash = hex.EncodeToString(header.BlockHash) + b.ChainID = header.ChainID + b.Height = header.Height + b.Time = header.Time + b.LastBlockHash = hex.EncodeToString(header.GetLastBlockId()) + b.TxCounts = header.NumTxs +} + +//toBlockInfo convert BlockMeta from tendermint to BlockMeta struct +func toBlockInfo(header pb.HeaderInfo, b *BlockInfo) { + /* Tendermint Block Meta Structure + // basic block info + Version version.Consensus `json:"version"` + ChainID string `json:"chain_id"` + Height int64 `json:"height"` + Time time.Time `json:"time"` + NumTxs int64 `json:"num_txs"` + TotalTxs int64 `json:"total_txs"` + + // prev block info + LastBlockID BlockID `json:"last_block_id"` + + // hashes of block data + LastCommitHash cmn.HexBytes `json:"last_commit_hash"` // commit from validators from the last block + DataHash cmn.HexBytes `json:"data_hash"` // transactions + + // hashes from the app output from the prev block + ValidatorsHash cmn.HexBytes `json:"validators_hash"` // validators for the current block + NextValidatorsHash cmn.HexBytes `json:"next_validators_hash"` // validators for the next block + ConsensusHash cmn.HexBytes `json:"consensus_hash"` // consensus params for current block + AppHash cmn.HexBytes `json:"app_hash"` // state after txs from the previous block + LastResultsHash cmn.HexBytes `json:"last_results_hash"` // root hash of all results from the txs from the previous block + + // consensus info + EvidenceHash cmn.HexBytes `json:"evidence_hash"` // evidence included in the block + ProposerAddress Address `json:"proposer_address"` // original proposer of the block + */ + + // block ID + b.BlockHash = hex.EncodeToString(header.BlockHash) + // basic block info + b.VersionBlock = header.GetVersion().Block + b.VersionApp = header.GetVersion().App + b.ChainID = header.ChainID + b.Height = header.Height + b.Time = header.Time + b.NumTxs = header.NumTxs + b.TotalTxs = header.TotalTxs + // prev block info + b.LastBlockHash = hex.EncodeToString(header.LastBlockId) + // hashes of block data + b.LastCommitHash = hex.EncodeToString(header.LastCommitHash) + b.DataHash = hex.EncodeToString(header.DataHash) + // hashes from the app output from the prev block + b.ValidatorsHash = hex.EncodeToString(header.ValidatorsHash) + b.NextValidatorsHash = hex.EncodeToString(header.NextValidatorsHash) + b.ConsensusHash = hex.EncodeToString(header.ConsensusHash) + b.AppHash = hex.EncodeToString(header.AppHash) + b.LastResultsHash = hex.EncodeToString(header.LastResultsHash) + // consensus info + b.EvidenceHash = hex.EncodeToString(header.EvidenceHash) + b.ProposerAddress = header.GetProposerAddress() +} + +//toBlock convert BlockResponse to Block struct +func toTx(TxRes *proto3.TxResponse , tx *Transaction) { + + tx.BlockID=TxRes.GetTx().GetHeight() + tx.GasUsed=TxRes.GetTx().GetGasUsed() + tx.GasWanted=TxRes.GetTx().GetGasWanted() + tx.Hash=TxRes.GetTx().GetHash() + +} \ No newline at end of file diff --git a/config.toml b/config.toml new file mode 100755 index 0000000..a73d00d --- /dev/null +++ b/config.toml @@ -0,0 +1,15 @@ +[grpc] + name = "Gallactic" + host = "68.183.183.19" + port = "50052" + +[database] + type = "Postgre" + dbname = "HubbleScan" + host = "localhost" + port = 5432 + user = "postgres" + password = "123456" + +[app] + "checking interval" = 1000 diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..5e95de7 --- /dev/null +++ b/config/config.go @@ -0,0 +1,144 @@ +package config + +import ( + "bytes" + "fmt" + "io/ioutil" + "os" + "path/filepath" + + "github.com/BurntSushi/toml" + "github.com/monax/bosmarmot/monax/log" +) + +const Config_File string = "config.toml" + +type Config struct { + GRPC *GRPCConfig `toml:"grpc"` + DataBase *DataBaseConfig `toml:"database"` + App *AppConfig `toml:"app"` +} + +type GRPCConfig struct { + Name string `toml:"name"` + URL string `toml:"host"` + Port string `toml:"port"` +} + +type DataBaseConfig struct { + Type string `toml:"type"` + DBName string `toml:"dbname"` + Host string `toml:"host"` + Port int `toml:"port"` + User string `toml:"user"` + Password string `toml:"password"` +} + +type AppConfig struct { + CheckingInterval int `toml:"checking interval"` +} + +func DefaultGRPCConfig() *GRPCConfig { + return &GRPCConfig{ + Name: "Gallactic", + URL: "68.183.183.19", + Port: "50052", + } +} + +func DefaultDataBaseConfig() *DataBaseConfig { + return &DataBaseConfig{ + Type: "Postgre", + DBName: "HubbleScan", + Host: "localhost", + Port: 5432, + User: "postgres", + Password: "123456", + } +} + +func DefaultAppConfig() *AppConfig { + return &AppConfig{ + CheckingInterval: 1000, + } +} + +func LoadConfigFile(create bool) (*Config, error) { + conf, err := LoadFromFile(Config_File) + if err != nil { + log.Warn(err.Error()) + if create { + conf = DefaultConfig() + conf.SaveToFile(Config_File) + } else { + return nil, err + } + + } + return conf, nil +} + +func (conf *Config) ToTOML() ([]byte, error) { + buf := new(bytes.Buffer) + encoder := toml.NewEncoder(buf) + err := encoder.Encode(conf) + if err != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +func (conf *Config) SaveToFile(file string) error { + toml, err := conf.ToTOML() + if err != nil { + return err + } + if err := WriteFile(file, toml); err != nil { + return err + } + + return nil +} + +func DefaultConfig() *Config { + return &Config{ + GRPC: DefaultGRPCConfig(), + DataBase: DefaultDataBaseConfig(), + App: DefaultAppConfig(), + } +} + +func FromTOML(t string) (*Config, error) { + conf := DefaultConfig() + + if _, err := toml.Decode(t, conf); err != nil { + return nil, err + } + return conf, nil +} + +func LoadFromFile(file string) (*Config, error) { + dat, err := ioutil.ReadFile(file) + if err != nil { + return nil, err + } + return FromTOML(string(dat)) +} + +func WriteFile(filename string, data []byte) error { + if err := Mkdir(filepath.Dir(filename)); err != nil { + return err + } + if err := ioutil.WriteFile(filename, data, 0777); err != nil { + return fmt.Errorf("config file (%s) writing failed. error: %s", filename, err.Error()) + } + return nil +} + +func Mkdir(dir string) error { + if err := os.MkdirAll(dir, 0777); err != nil { + return fmt.Errorf("Creating directory failed. error: %s", err.Error()) + } + return nil +} diff --git a/database/adapter.go b/database/adapter.go new file mode 100644 index 0000000..25d7b30 --- /dev/null +++ b/database/adapter.go @@ -0,0 +1,29 @@ +package database + +import ( + hsBC "github.com/gallactic/hubble_server/blockchain" +) + +//Adapter for data base +type Adapter interface { + Connect() error + Disconnect() error + + //Account Handling + InsertAccount(acc *hsBC.Account) error + UpdateAccount(id int, acc *hsBC.Account) error + GetAccount(id int) (*hsBC.Account, error) + GetAccountsTableLastID() (uint64, error) + + //Blocks Handling + InsertBlock(b *hsBC.Block) error + UpdateBlock(id int, b *hsBC.Block) error + GetBlock(id int) (*hsBC.Block, error) + GetBlocksTableLastID() (uint64, error) + + //Transactions Handling + InsertTx(b *hsBC.Transaction) error + UpdateTx(id int, b *hsBC.Transaction) error + GetTx(hash string) (*hsBC.Transaction, error) + GetTXsTableLastID() (uint64, error) +} diff --git a/database/postgre.go b/database/postgre.go new file mode 100644 index 0000000..8cfb155 --- /dev/null +++ b/database/postgre.go @@ -0,0 +1,210 @@ +package database + +import ( + "database/sql" + "fmt" + + hsBC "github.com/gallactic/hubble_server/blockchain" + config "github.com/gallactic/hubble_server/config" + _ "github.com/lib/pq" //dependency for postgre +) + +//Postgre adapter +type Postgre struct { + Config *config.Config + ObjDB *sql.DB //Opened DB +} + +//Connect to database +func (obe *Postgre) Connect() error { + psqlInfo := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", + obe.Config.DataBase.Host, obe.Config.DataBase.Port, obe.Config.DataBase.User, + obe.Config.DataBase.Password, obe.Config.DataBase.DBName) + + var err error + obe.ObjDB, err = sql.Open("postgres", psqlInfo) + if err != nil { + obe.ObjDB.Close() + return err + } + + err = obe.ObjDB.Ping() + if err != nil { + obe.ObjDB.Close() + return err + } + return nil +} + +//Disconnect close connection to database +func (obe *Postgre) Disconnect() error { + closeError := obe.ObjDB.Close() + return closeError +} + +//InsertAccount add new Account to accounts table +func (obe *Postgre) InsertAccount(acc *hsBC.Account) error { + + sqlStatement := `INSERT INTO accounts (address, balance, permission,sequence,code) + VALUES ($1, $2, $3, $4, $5) + RETURNING id` + id := 0 + err := obe.ObjDB.QueryRow(sqlStatement, acc.Address, acc.Balance, acc.Permission, acc.Sequence, acc.Code).Scan(&id) + if err != nil { + return err + } + return nil +} + +//UpdateAccount modifies all fields for selected account +func (obe *Postgre) UpdateAccount(id int, acc *hsBC.Account) error { + sqlStatement := `UPDATE accounts + SET address = $2, balance = $3, permission = $4, sequence = $5, code = $6 + WHERE id = $1 + RETURNING id, address;` + var retAddress string + var retID int + err := obe.ObjDB.QueryRow(sqlStatement, id, acc.Address, acc.Balance, acc.Permission, acc.Sequence, acc.Code).Scan(&retID, &retAddress) + + if err != nil { + return err + } + + return nil +} + +//GetAccount finds account in db and returns its data +func (obe *Postgre) GetAccount(id int) (*hsBC.Account, error) { + sqlStatement := `SELECT * FROM accounts + WHERE id=$1;` + acc := &hsBC.Account{Address: "", Balance: 0.0, Permission: "", Sequence: 0, Code: ""} + row := obe.ObjDB.QueryRow(sqlStatement, id) + err := row.Scan(&acc.Address, &acc.ID, &acc.Balance, &acc.Permission, &acc.Sequence, &acc.Code) + switch err { + case sql.ErrNoRows: + return nil, err + case nil: + return acc, nil + default: + return nil, err + } +} + +//GetAccountsTableLastID returns last block number +func (obe *Postgre) GetAccountsTableLastID() (uint64, error) { + sqlStatement := `SELECT MAX(id) FROM accounts;` + + row := obe.ObjDB.QueryRow(sqlStatement) + var LastID uint64 + err := row.Scan(&LastID) + switch err { + case sql.ErrNoRows: + return 0, err + case nil: + return LastID, nil + default: + return 0, err + } +} + +//InsertBlock add a block in database +func (obe *Postgre) InsertBlock(b *hsBC.Block) error { + sqlStatement := `INSERT INTO blocks (id, height, hash, chainID, time, lastblockhash, txcounts) + VALUES ($1, $2, $3, $4, $5, $6, $7) + RETURNING id` + id := 0 + row := obe.ObjDB.QueryRow(sqlStatement, b.Height, b.Height, b.Hash, b.ChainID, b.Time, b.LastBlockHash, b.TxCounts) + err := row.Scan(&id) + if err != nil { + return err + } + return nil +} + +//UpdateBlock modifies a block data in database +func (obe *Postgre) UpdateBlock(id int, b *hsBC.Block) error { + //TODO: + return nil +} + +//GetBlock returns a block +func (obe *Postgre) GetBlock(id int) (*hsBC.Block, error) { + //TODO: + return nil, nil +} + +//GetBlocksTableLastID returns last block number +func (obe *Postgre) GetBlocksTableLastID() (uint64, error) { + sqlStatement := `SELECT MAX(id) FROM blocks + WHERE id=height;` + + row := obe.ObjDB.QueryRow(sqlStatement) + var LastID uint64 + err := row.Scan(&LastID) + switch err { + case sql.ErrNoRows: + return 0, err + case nil: + return LastID, nil + default: + return 0, err + } +} + +//InsertTx add a transaction in database +func (obe *Postgre) InsertTx(b *hsBC.Transaction) error { + sqlStatement := `INSERT INTO transactions (block_id, txhash, gas_used,gas_wanted,data, time) + VALUES ($1, $2, $3, $4, $5, $6) + RETURNING id` + id := 0 + row := obe.ObjDB.QueryRow(sqlStatement, b.BlockID, b.Hash, b.GasUsed, b.GasWanted, b.Data, b.Time) + err := row.Scan(&id) + if err != nil { + return err + } + return nil +} + +//UpdateTx modifies a transaction data in database +func (obe *Postgre) UpdateTx(id int, b *hsBC.Transaction) error { + sqlStatement := `UPDATE transactions + SET block_id = $2, txhash = $3, gas_used = $4, gas_wanted = $5, data = $6, time = $7 + WHERE id = $1 + RETURNING id, txhash;` + var retHash string + var retID int + err := obe.ObjDB.QueryRow(sqlStatement, id, b.BlockID, b.Hash, b.GasUsed, b.GasWanted, b.Data, b.Time).Scan(&retID, &retHash) + + if err != nil { + return err + } + + return nil +} + +//GetTx returns a transaction data +func (obe *Postgre) GetTx(hash string) (*hsBC.Transaction, error) { + sqlStatement := `SELECT block_id,txhash,gas_used,gas_wanted,data,time FROM transactions + WHERE txhash=$1;` + var tx hsBC.Transaction + obe.ObjDB.QueryRow(sqlStatement, hash).Scan(&tx.BlockID, &tx.Hash, &tx.GasUsed, &tx.GasWanted, &tx.Data, &tx.Time) + + return &tx, nil +} + +//GetTXsTableLastID returns last saved transaction number +func (obe *Postgre) GetTXsTableLastID() (uint64, error) { + sqlStatement := `SELECT MAX(id) FROM transactions;` + + row := obe.ObjDB.QueryRow(sqlStatement) + var LastID uint64 + err := row.Scan(&LastID) + switch err { + case sql.ErrNoRows: + return 0, err + case nil: + return LastID, nil + default: + return 0, err + } +} diff --git a/explorer/engine.go b/explorer/engine.go new file mode 100644 index 0000000..5cf6053 --- /dev/null +++ b/explorer/engine.go @@ -0,0 +1,165 @@ +package explorer + +import ( + "fmt" + + bc "github.com/gallactic/hubble_server/blockchain" + config "github.com/gallactic/hubble_server/config" + db "github.com/gallactic/hubble_server/database" +) + +var numDots int + +//Explorer class for connecting block chain to data base +type Explorer struct { + BCAdapter bc.Adapter + DBAdapter db.Adapter + Config *config.Config +} + +//Init to initialize database and block chain +func (e *Explorer) Init() error { + //connect to gallactic blockchain by gRPC + bcAdapter := e.BCAdapter + clientErr := bcAdapter.CreateGRPCClient() + if clientErr == nil { + println("Blockchain client created successfully!") + } else { + return clientErr + } + bcAdapter.Update() + + //connect to database + dbAdapter := e.DBAdapter + connErr := dbAdapter.Connect() + if connErr != nil { + return connErr + } + println("Connected to database successfully!") + + return nil +} + +//Update to Sync database with blockchain +func (e *Explorer) Update() error { + + //defer dbAdapter.Disconnect() + bcAdapter := e.BCAdapter + dbAdapter := e.DBAdapter + + //Sync data with blockchain + updateErr := bcAdapter.Update() + if updateErr != nil { + return updateErr + } + + //Get current height of last block + currentHeight, getLastHeightErr := bcAdapter.GetBlocksLastHeight() + if getLastHeightErr != nil { + return getLastHeightErr + } + + //Get last block ID that is saved + lastBlockIDInDB, getLastIDError := dbAdapter.GetBlocksTableLastID() + if getLastIDError != nil { + lastBlockIDInDB = 0 + } + + if currentHeight > lastBlockIDInDB { + d := currentHeight - lastBlockIDInDB + n := int(d / 1000) + if d > 1000 { + println("Saving new blocks number", lastBlockIDInDB, " to ", currentHeight, " in database...") + } + + var startIndex uint64 + var endIndex uint64 + + startBlockID := lastBlockIDInDB + 1 + if lastBlockIDInDB == 0 { + startBlockID = 0 + } + + for i := 0; i <= n; i++ { + startIndex = startBlockID + uint64(i*1000) + endIndex = startIndex + 999 + if endIndex > currentHeight { + endIndex = currentHeight + } + blocks, _ := bcAdapter.GetBlocks(startIndex, endIndex) + savingErr := e.saveBlocksInDB(blocks, bcAdapter, dbAdapter) + if savingErr != nil { + return savingErr + } + + perc := (int)((float64(i+1) / float64(n+1)) * 100.0) + fmt.Printf("\r%d%% saved! (%d/%d)", perc, startIndex-lastBlockIDInDB, d) + + } + + if d > 1000 { + println("\r", d, "new blocks saved! ") + println("Checking new blocks...") + } else { + e.writeAnim(currentHeight) + } + } else { + e.writeAnim(currentHeight) + } + + return nil +} + +func (e *Explorer) saveBlocksInDB(blocks []*bc.Block, bcAdapter bc.Adapter, dbAdapter db.Adapter) error { + l := len(blocks) + if l <= 0 { + return fmt.Errorf("Empty Blocks Array") + } + for i := l - 1; i >= 0; i-- { + block := blocks[i] + err := dbAdapter.InsertBlock(block) + if err != nil { + return err + } + if block.TxCounts > 0 { + errTxSave := e.saveBlockTXsInDB(block, bcAdapter, dbAdapter) + if errTxSave != nil { + return errTxSave + } + } + } + return nil +} + +func (e *Explorer) saveBlockTXsInDB(block *bc.Block, bcAdapter bc.Adapter, dbAdapter db.Adapter) error { + l := block.TxCounts + if l <= 0 { + return fmt.Errorf("Empty Transactions Array") + } + + height := uint64(block.Height) + txs, errTXs := bcAdapter.GetTXs(height) + if errTXs != nil { + return errTXs + } + + for i := l - 1; i >= 0; i-- { + err := dbAdapter.InsertTx(&txs[i]) + if err != nil { + return err + } + } + return nil +} + +func (e *Explorer) writeAnim(currentHeight uint64) { + numDots++ + if numDots > 3 { + numDots = 0 + } + dotStr := "" + for nDot := 1; nDot <= numDots; nDot++ { + dotStr += "." + } + fmt.Printf("\r%d blocks saved"+dotStr+" ", currentHeight) +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..42b8968 --- /dev/null +++ b/main.go @@ -0,0 +1,47 @@ +package main + +import ( + "time" + + bc "github.com/gallactic/hubble_server/blockchain" + config "github.com/gallactic/hubble_server/config" + db "github.com/gallactic/hubble_server/database" + ex "github.com/gallactic/hubble_server/explorer" +) + +var explorerEngine ex.Explorer +var gConfig *config.Config + +func main() { + + Init() + SyncLoop() + +} + +//Init initializes engine +func Init() { + gConfig, _ = config.LoadConfigFile(true) + bcAdapter := bc.Gallactic{Config: gConfig} + dbAdapter := db.Postgre{Config: gConfig} + explorerEngine = ex.Explorer{BCAdapter: &bcAdapter, DBAdapter: &dbAdapter, Config: gConfig} + + explorerEngine.Init() +} + +//SyncLoop goes in loop for syncing blockchain and database +func SyncLoop() { + + interval := time.Duration(gConfig.App.CheckingInterval) + println("syncing every", interval, "miliseconds...") + + for { + + errUpdate := explorerEngine.Update() + if errUpdate != nil { + println("Updating engine erro: ", errUpdate.Error()) + } + time.Sleep(interval * time.Millisecond) + + } +} diff --git a/proto3/blockchain.pb.go b/proto3/blockchain.pb.go new file mode 100644 index 0000000..437932a --- /dev/null +++ b/proto3/blockchain.pb.go @@ -0,0 +1,3080 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto3/blockchain.proto + +package proto3 + +import ( + context "context" + fmt "fmt" + //_ "google/protobuf" + math "math" + time "time" + + github_com_gallactic_gallactic_common_binary "github.com/gallactic/gallactic/common/binary" + github_com_gallactic_gallactic_core_account "github.com/gallactic/gallactic/core/account" + github_com_gallactic_gallactic_core_consensus_tendermint_p2p "github.com/gallactic/gallactic/core/consensus/tendermint/p2p" + github_com_gallactic_gallactic_core_proposal "github.com/gallactic/gallactic/core/proposal" + github_com_gallactic_gallactic_crypto "github.com/gallactic/gallactic/crypto" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + golang_proto "github.com/golang/protobuf/proto" + github_com_tendermint_tendermint_consensus_types "github.com/tendermint/tendermint/consensus/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = golang_proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +type Empty struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Empty) Reset() { *m = Empty{} } +func (m *Empty) String() string { return proto.CompactTextString(m) } +func (*Empty) ProtoMessage() {} +func (*Empty) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{0} +} +func (m *Empty) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Empty.Unmarshal(m, b) +} +func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Empty.Marshal(b, m, deterministic) +} +func (m *Empty) XXX_Merge(src proto.Message) { + xxx_messageInfo_Empty.Merge(m, src) +} +func (m *Empty) XXX_Size() int { + return xxx_messageInfo_Empty.Size(m) +} +func (m *Empty) XXX_DiscardUnknown() { + xxx_messageInfo_Empty.DiscardUnknown(m) +} + +var xxx_messageInfo_Empty proto.InternalMessageInfo + +func (*Empty) XXX_MessageName() string { + return "proto3.Empty" +} + +type AddressRequest struct { + Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AddressRequest) Reset() { *m = AddressRequest{} } +func (m *AddressRequest) String() string { return proto.CompactTextString(m) } +func (*AddressRequest) ProtoMessage() {} +func (*AddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{1} +} +func (m *AddressRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AddressRequest.Unmarshal(m, b) +} +func (m *AddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AddressRequest.Marshal(b, m, deterministic) +} +func (m *AddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddressRequest.Merge(m, src) +} +func (m *AddressRequest) XXX_Size() int { + return xxx_messageInfo_AddressRequest.Size(m) +} +func (m *AddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AddressRequest proto.InternalMessageInfo + +func (m *AddressRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (*AddressRequest) XXX_MessageName() string { + return "proto3.AddressRequest" +} + +type AccountResponse struct { + Account *github_com_gallactic_gallactic_core_account.Account `protobuf:"bytes,1,opt,name=Account,proto3,customtype=github.com/gallactic/gallactic/core/account.Account" json:"Account,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccountResponse) Reset() { *m = AccountResponse{} } +func (m *AccountResponse) String() string { return proto.CompactTextString(m) } +func (*AccountResponse) ProtoMessage() {} +func (*AccountResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{2} +} +func (m *AccountResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AccountResponse.Unmarshal(m, b) +} +func (m *AccountResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AccountResponse.Marshal(b, m, deterministic) +} +func (m *AccountResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountResponse.Merge(m, src) +} +func (m *AccountResponse) XXX_Size() int { + return xxx_messageInfo_AccountResponse.Size(m) +} +func (m *AccountResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AccountResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountResponse proto.InternalMessageInfo + +func (*AccountResponse) XXX_MessageName() string { + return "proto3.AccountResponse" +} + +type AccountsResponse struct { + BlockHeight uint64 `protobuf:"varint,1,opt,name=BlockHeight,proto3" json:"BlockHeight,omitempty"` + Accounts []*AccountResponse `protobuf:"bytes,2,rep,name=Accounts,proto3" json:"Accounts,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AccountsResponse) Reset() { *m = AccountsResponse{} } +func (m *AccountsResponse) String() string { return proto.CompactTextString(m) } +func (*AccountsResponse) ProtoMessage() {} +func (*AccountsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{3} +} +func (m *AccountsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AccountsResponse.Unmarshal(m, b) +} +func (m *AccountsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AccountsResponse.Marshal(b, m, deterministic) +} +func (m *AccountsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AccountsResponse.Merge(m, src) +} +func (m *AccountsResponse) XXX_Size() int { + return xxx_messageInfo_AccountsResponse.Size(m) +} +func (m *AccountsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AccountsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AccountsResponse proto.InternalMessageInfo + +func (m *AccountsResponse) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *AccountsResponse) GetAccounts() []*AccountResponse { + if m != nil { + return m.Accounts + } + return nil +} + +func (*AccountsResponse) XXX_MessageName() string { + return "proto3.AccountsResponse" +} + +type ValidatorResponse struct { + Validator *ValidatorInfo `protobuf:"bytes,1,opt,name=Validator,proto3" json:"Validator,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ValidatorResponse) Reset() { *m = ValidatorResponse{} } +func (m *ValidatorResponse) String() string { return proto.CompactTextString(m) } +func (*ValidatorResponse) ProtoMessage() {} +func (*ValidatorResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{4} +} +func (m *ValidatorResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ValidatorResponse.Unmarshal(m, b) +} +func (m *ValidatorResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ValidatorResponse.Marshal(b, m, deterministic) +} +func (m *ValidatorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorResponse.Merge(m, src) +} +func (m *ValidatorResponse) XXX_Size() int { + return xxx_messageInfo_ValidatorResponse.Size(m) +} +func (m *ValidatorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorResponse proto.InternalMessageInfo + +func (m *ValidatorResponse) GetValidator() *ValidatorInfo { + if m != nil { + return m.Validator + } + return nil +} + +func (*ValidatorResponse) XXX_MessageName() string { + return "proto3.ValidatorResponse" +} + +type ValidatorsResponse struct { + BlockHeight uint64 `protobuf:"varint,1,opt,name=BlockHeight,proto3" json:"BlockHeight,omitempty"` + Validators []*ValidatorInfo `protobuf:"bytes,2,rep,name=Validators,proto3" json:"Validators,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ValidatorsResponse) Reset() { *m = ValidatorsResponse{} } +func (m *ValidatorsResponse) String() string { return proto.CompactTextString(m) } +func (*ValidatorsResponse) ProtoMessage() {} +func (*ValidatorsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{5} +} +func (m *ValidatorsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ValidatorsResponse.Unmarshal(m, b) +} +func (m *ValidatorsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ValidatorsResponse.Marshal(b, m, deterministic) +} +func (m *ValidatorsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorsResponse.Merge(m, src) +} +func (m *ValidatorsResponse) XXX_Size() int { + return xxx_messageInfo_ValidatorsResponse.Size(m) +} +func (m *ValidatorsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorsResponse proto.InternalMessageInfo + +func (m *ValidatorsResponse) GetBlockHeight() uint64 { + if m != nil { + return m.BlockHeight + } + return 0 +} + +func (m *ValidatorsResponse) GetValidators() []*ValidatorInfo { + if m != nil { + return m.Validators + } + return nil +} + +func (*ValidatorsResponse) XXX_MessageName() string { + return "proto3.ValidatorsResponse" +} + +type ListAccountsParam struct { + Query string `protobuf:"bytes,1,opt,name=Query,proto3" json:"Query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListAccountsParam) Reset() { *m = ListAccountsParam{} } +func (m *ListAccountsParam) String() string { return proto.CompactTextString(m) } +func (*ListAccountsParam) ProtoMessage() {} +func (*ListAccountsParam) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{6} +} +func (m *ListAccountsParam) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListAccountsParam.Unmarshal(m, b) +} +func (m *ListAccountsParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListAccountsParam.Marshal(b, m, deterministic) +} +func (m *ListAccountsParam) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListAccountsParam.Merge(m, src) +} +func (m *ListAccountsParam) XXX_Size() int { + return xxx_messageInfo_ListAccountsParam.Size(m) +} +func (m *ListAccountsParam) XXX_DiscardUnknown() { + xxx_messageInfo_ListAccountsParam.DiscardUnknown(m) +} + +var xxx_messageInfo_ListAccountsParam proto.InternalMessageInfo + +func (m *ListAccountsParam) GetQuery() string { + if m != nil { + return m.Query + } + return "" +} + +func (*ListAccountsParam) XXX_MessageName() string { + return "proto3.ListAccountsParam" +} + +type StorageRequest struct { + Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageRequest) Reset() { *m = StorageRequest{} } +func (m *StorageRequest) String() string { return proto.CompactTextString(m) } +func (*StorageRequest) ProtoMessage() {} +func (*StorageRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{7} +} +func (m *StorageRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageRequest.Unmarshal(m, b) +} +func (m *StorageRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageRequest.Marshal(b, m, deterministic) +} +func (m *StorageRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageRequest.Merge(m, src) +} +func (m *StorageRequest) XXX_Size() int { + return xxx_messageInfo_StorageRequest.Size(m) +} +func (m *StorageRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StorageRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageRequest proto.InternalMessageInfo + +func (m *StorageRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (*StorageRequest) XXX_MessageName() string { + return "proto3.StorageRequest" +} + +type StorageResponse struct { + StorageItems []StorageItem `protobuf:"bytes,1,rep,name=StorageItems,proto3" json:"StorageItems"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageResponse) Reset() { *m = StorageResponse{} } +func (m *StorageResponse) String() string { return proto.CompactTextString(m) } +func (*StorageResponse) ProtoMessage() {} +func (*StorageResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{8} +} +func (m *StorageResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageResponse.Unmarshal(m, b) +} +func (m *StorageResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageResponse.Marshal(b, m, deterministic) +} +func (m *StorageResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageResponse.Merge(m, src) +} +func (m *StorageResponse) XXX_Size() int { + return xxx_messageInfo_StorageResponse.Size(m) +} +func (m *StorageResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StorageResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageResponse proto.InternalMessageInfo + +func (m *StorageResponse) GetStorageItems() []StorageItem { + if m != nil { + return m.StorageItems + } + return nil +} + +func (*StorageResponse) XXX_MessageName() string { + return "proto3.StorageResponse" +} + +type StorageItem struct { + Key github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,1,opt,name=Key,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"Key"` + Value github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,2,opt,name=Value,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"Value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageItem) Reset() { *m = StorageItem{} } +func (m *StorageItem) String() string { return proto.CompactTextString(m) } +func (*StorageItem) ProtoMessage() {} +func (*StorageItem) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{9} +} +func (m *StorageItem) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageItem.Unmarshal(m, b) +} +func (m *StorageItem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageItem.Marshal(b, m, deterministic) +} +func (m *StorageItem) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageItem.Merge(m, src) +} +func (m *StorageItem) XXX_Size() int { + return xxx_messageInfo_StorageItem.Size(m) +} +func (m *StorageItem) XXX_DiscardUnknown() { + xxx_messageInfo_StorageItem.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageItem proto.InternalMessageInfo + +func (*StorageItem) XXX_MessageName() string { + return "proto3.StorageItem" +} + +type StorageAtRequest struct { + Address string `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` + Key github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,2,opt,name=Key,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"Key"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageAtRequest) Reset() { *m = StorageAtRequest{} } +func (m *StorageAtRequest) String() string { return proto.CompactTextString(m) } +func (*StorageAtRequest) ProtoMessage() {} +func (*StorageAtRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{10} +} +func (m *StorageAtRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageAtRequest.Unmarshal(m, b) +} +func (m *StorageAtRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageAtRequest.Marshal(b, m, deterministic) +} +func (m *StorageAtRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageAtRequest.Merge(m, src) +} +func (m *StorageAtRequest) XXX_Size() int { + return xxx_messageInfo_StorageAtRequest.Size(m) +} +func (m *StorageAtRequest) XXX_DiscardUnknown() { + xxx_messageInfo_StorageAtRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageAtRequest proto.InternalMessageInfo + +func (m *StorageAtRequest) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (*StorageAtRequest) XXX_MessageName() string { + return "proto3.StorageAtRequest" +} + +type StorageAtResponse struct { + Key github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,1,opt,name=Key,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"Key"` + Value github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,2,opt,name=Value,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"Value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StorageAtResponse) Reset() { *m = StorageAtResponse{} } +func (m *StorageAtResponse) String() string { return proto.CompactTextString(m) } +func (*StorageAtResponse) ProtoMessage() {} +func (*StorageAtResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{11} +} +func (m *StorageAtResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StorageAtResponse.Unmarshal(m, b) +} +func (m *StorageAtResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StorageAtResponse.Marshal(b, m, deterministic) +} +func (m *StorageAtResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StorageAtResponse.Merge(m, src) +} +func (m *StorageAtResponse) XXX_Size() int { + return xxx_messageInfo_StorageAtResponse.Size(m) +} +func (m *StorageAtResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StorageAtResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StorageAtResponse proto.InternalMessageInfo + +func (*StorageAtResponse) XXX_MessageName() string { + return "proto3.StorageAtResponse" +} + +type ConsensusResponse struct { + RoundState github_com_tendermint_tendermint_consensus_types.RoundStateSimple `protobuf:"bytes,1,opt,name=RoundState,proto3,customtype=github.com/tendermint/tendermint/consensus/types.RoundStateSimple" json:"RoundState"` + PeerRoundStates []github_com_tendermint_tendermint_consensus_types.PeerRoundState `protobuf:"bytes,2,rep,name=PeerRoundStates,proto3,customtype=github.com/tendermint/tendermint/consensus/types.PeerRoundState" json:"PeerRoundStates"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConsensusResponse) Reset() { *m = ConsensusResponse{} } +func (m *ConsensusResponse) String() string { return proto.CompactTextString(m) } +func (*ConsensusResponse) ProtoMessage() {} +func (*ConsensusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{12} +} +func (m *ConsensusResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConsensusResponse.Unmarshal(m, b) +} +func (m *ConsensusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConsensusResponse.Marshal(b, m, deterministic) +} +func (m *ConsensusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusResponse.Merge(m, src) +} +func (m *ConsensusResponse) XXX_Size() int { + return xxx_messageInfo_ConsensusResponse.Size(m) +} +func (m *ConsensusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ConsensusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsensusResponse proto.InternalMessageInfo + +func (*ConsensusResponse) XXX_MessageName() string { + return "proto3.ConsensusResponse" +} + +type ChainResponse struct { + ChainName string `protobuf:"bytes,1,opt,name=ChainName,proto3" json:"ChainName,omitempty"` + ChainId string `protobuf:"bytes,2,opt,name=ChainId,proto3" json:"ChainId,omitempty"` + GenesisHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,3,opt,name=GenesisHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"GenesisHash"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ChainResponse) Reset() { *m = ChainResponse{} } +func (m *ChainResponse) String() string { return proto.CompactTextString(m) } +func (*ChainResponse) ProtoMessage() {} +func (*ChainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{13} +} +func (m *ChainResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ChainResponse.Unmarshal(m, b) +} +func (m *ChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ChainResponse.Marshal(b, m, deterministic) +} +func (m *ChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ChainResponse.Merge(m, src) +} +func (m *ChainResponse) XXX_Size() int { + return xxx_messageInfo_ChainResponse.Size(m) +} +func (m *ChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ChainResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ChainResponse proto.InternalMessageInfo + +func (m *ChainResponse) GetChainName() string { + if m != nil { + return m.ChainName + } + return "" +} + +func (m *ChainResponse) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (*ChainResponse) XXX_MessageName() string { + return "proto3.ChainResponse" +} + +type StatusResponse struct { + NodeInfo github_com_gallactic_gallactic_core_consensus_tendermint_p2p.GNodeInfo `protobuf:"bytes,1,opt,name=NodeInfo,proto3,customtype=github.com/gallactic/gallactic/core/consensus/tendermint/p2p.GNodeInfo" json:"NodeInfo"` + GenesisHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,2,opt,name=GenesisHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"GenesisHash"` + PubKey github_com_gallactic_gallactic_crypto.PublicKey `protobuf:"bytes,3,opt,name=PubKey,proto3,customtype=github.com/gallactic/gallactic/crypto.PublicKey" json:"PubKey"` + LatestBlockHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,4,opt,name=LatestBlockHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"LatestBlockHash"` + LatestBlockHeight uint64 `protobuf:"varint,5,opt,name=LatestBlockHeight,proto3" json:"LatestBlockHeight,omitempty"` + LatestBlockTime int64 `protobuf:"varint,6,opt,name=LatestBlockTime,proto3" json:"LatestBlockTime,omitempty"` + NodeVersion string `protobuf:"bytes,7,opt,name=NodeVersion,proto3" json:"NodeVersion,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StatusResponse) Reset() { *m = StatusResponse{} } +func (m *StatusResponse) String() string { return proto.CompactTextString(m) } +func (*StatusResponse) ProtoMessage() {} +func (*StatusResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{14} +} +func (m *StatusResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StatusResponse.Unmarshal(m, b) +} +func (m *StatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StatusResponse.Marshal(b, m, deterministic) +} +func (m *StatusResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_StatusResponse.Merge(m, src) +} +func (m *StatusResponse) XXX_Size() int { + return xxx_messageInfo_StatusResponse.Size(m) +} +func (m *StatusResponse) XXX_DiscardUnknown() { + xxx_messageInfo_StatusResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_StatusResponse proto.InternalMessageInfo + +func (m *StatusResponse) GetLatestBlockHeight() uint64 { + if m != nil { + return m.LatestBlockHeight + } + return 0 +} + +func (m *StatusResponse) GetLatestBlockTime() int64 { + if m != nil { + return m.LatestBlockTime + } + return 0 +} + +func (m *StatusResponse) GetNodeVersion() string { + if m != nil { + return m.NodeVersion + } + return "" +} + +func (*StatusResponse) XXX_MessageName() string { + return "proto3.StatusResponse" +} + +type BlockRequest struct { + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockRequest) Reset() { *m = BlockRequest{} } +func (m *BlockRequest) String() string { return proto.CompactTextString(m) } +func (*BlockRequest) ProtoMessage() {} +func (*BlockRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{15} +} +func (m *BlockRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockRequest.Unmarshal(m, b) +} +func (m *BlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockRequest.Marshal(b, m, deterministic) +} +func (m *BlockRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockRequest.Merge(m, src) +} +func (m *BlockRequest) XXX_Size() int { + return xxx_messageInfo_BlockRequest.Size(m) +} +func (m *BlockRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BlockRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockRequest proto.InternalMessageInfo + +func (m *BlockRequest) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (*BlockRequest) XXX_MessageName() string { + return "proto3.BlockRequest" +} + +type BlocksRequest struct { + MinHeight uint64 `protobuf:"varint,1,opt,name=minHeight,proto3" json:"minHeight,omitempty"` + MaxHeight uint64 `protobuf:"varint,2,opt,name=maxHeight,proto3" json:"maxHeight,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlocksRequest) Reset() { *m = BlocksRequest{} } +func (m *BlocksRequest) String() string { return proto.CompactTextString(m) } +func (*BlocksRequest) ProtoMessage() {} +func (*BlocksRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{16} +} +func (m *BlocksRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlocksRequest.Unmarshal(m, b) +} +func (m *BlocksRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlocksRequest.Marshal(b, m, deterministic) +} +func (m *BlocksRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlocksRequest.Merge(m, src) +} +func (m *BlocksRequest) XXX_Size() int { + return xxx_messageInfo_BlocksRequest.Size(m) +} +func (m *BlocksRequest) XXX_DiscardUnknown() { + xxx_messageInfo_BlocksRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_BlocksRequest proto.InternalMessageInfo + +func (m *BlocksRequest) GetMinHeight() uint64 { + if m != nil { + return m.MinHeight + } + return 0 +} + +func (m *BlocksRequest) GetMaxHeight() uint64 { + if m != nil { + return m.MaxHeight + } + return 0 +} + +func (*BlocksRequest) XXX_MessageName() string { + return "proto3.BlocksRequest" +} + +type BlockResponse struct { + Block *BlockInfo `protobuf:"bytes,1,opt,name=Block,proto3" json:"Block,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockResponse) Reset() { *m = BlockResponse{} } +func (m *BlockResponse) String() string { return proto.CompactTextString(m) } +func (*BlockResponse) ProtoMessage() {} +func (*BlockResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{17} +} +func (m *BlockResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockResponse.Unmarshal(m, b) +} +func (m *BlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockResponse.Marshal(b, m, deterministic) +} +func (m *BlockResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockResponse.Merge(m, src) +} +func (m *BlockResponse) XXX_Size() int { + return xxx_messageInfo_BlockResponse.Size(m) +} +func (m *BlockResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BlockResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockResponse proto.InternalMessageInfo + +func (m *BlockResponse) GetBlock() *BlockInfo { + if m != nil { + return m.Block + } + return nil +} + +func (*BlockResponse) XXX_MessageName() string { + return "proto3.BlockResponse" +} + +type BlocksResponse struct { + Blocks []BlockInfo `protobuf:"bytes,1,rep,name=Blocks,proto3" json:"Blocks"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlocksResponse) Reset() { *m = BlocksResponse{} } +func (m *BlocksResponse) String() string { return proto.CompactTextString(m) } +func (*BlocksResponse) ProtoMessage() {} +func (*BlocksResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{18} +} +func (m *BlocksResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlocksResponse.Unmarshal(m, b) +} +func (m *BlocksResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlocksResponse.Marshal(b, m, deterministic) +} +func (m *BlocksResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlocksResponse.Merge(m, src) +} +func (m *BlocksResponse) XXX_Size() int { + return xxx_messageInfo_BlocksResponse.Size(m) +} +func (m *BlocksResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BlocksResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BlocksResponse proto.InternalMessageInfo + +func (m *BlocksResponse) GetBlocks() []BlockInfo { + if m != nil { + return m.Blocks + } + return nil +} + +func (*BlocksResponse) XXX_MessageName() string { + return "proto3.BlocksResponse" +} + +type GenesisResponse struct { + Genesis *github_com_gallactic_gallactic_core_proposal.Genesis `protobuf:"bytes,1,opt,name=Genesis,proto3,customtype=github.com/gallactic/gallactic/core/proposal.Genesis" json:"Genesis,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GenesisResponse) Reset() { *m = GenesisResponse{} } +func (m *GenesisResponse) String() string { return proto.CompactTextString(m) } +func (*GenesisResponse) ProtoMessage() {} +func (*GenesisResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{19} +} +func (m *GenesisResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GenesisResponse.Unmarshal(m, b) +} +func (m *GenesisResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GenesisResponse.Marshal(b, m, deterministic) +} +func (m *GenesisResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisResponse.Merge(m, src) +} +func (m *GenesisResponse) XXX_Size() int { + return xxx_messageInfo_GenesisResponse.Size(m) +} +func (m *GenesisResponse) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisResponse proto.InternalMessageInfo + +func (*GenesisResponse) XXX_MessageName() string { + return "proto3.GenesisResponse" +} + +type BlockTxsResponse struct { + Count int32 `protobuf:"varint,1,opt,name=Count,proto3" json:"Count,omitempty"` + Txs []TxInfo `protobuf:"bytes,2,rep,name=Txs,proto3" json:"Txs"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockTxsResponse) Reset() { *m = BlockTxsResponse{} } +func (m *BlockTxsResponse) String() string { return proto.CompactTextString(m) } +func (*BlockTxsResponse) ProtoMessage() {} +func (*BlockTxsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{20} +} +func (m *BlockTxsResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockTxsResponse.Unmarshal(m, b) +} +func (m *BlockTxsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockTxsResponse.Marshal(b, m, deterministic) +} +func (m *BlockTxsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockTxsResponse.Merge(m, src) +} +func (m *BlockTxsResponse) XXX_Size() int { + return xxx_messageInfo_BlockTxsResponse.Size(m) +} +func (m *BlockTxsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BlockTxsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockTxsResponse proto.InternalMessageInfo + +func (m *BlockTxsResponse) GetCount() int32 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *BlockTxsResponse) GetTxs() []TxInfo { + if m != nil { + return m.Txs + } + return nil +} + +func (*BlockTxsResponse) XXX_MessageName() string { + return "proto3.BlockTxsResponse" +} + +type BlockchainInfoResponse struct { + LastBlockHeight uint64 `protobuf:"varint,1,opt,name=LastBlockHeight,proto3" json:"LastBlockHeight,omitempty"` + LastBlockTime time.Time `protobuf:"bytes,2,opt,name=LastBlockTime,proto3,stdtime" json:"LastBlockTime"` + LastBlockHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,3,opt,name=LastBlockHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"LastBlockHash"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockchainInfoResponse) Reset() { *m = BlockchainInfoResponse{} } +func (m *BlockchainInfoResponse) String() string { return proto.CompactTextString(m) } +func (*BlockchainInfoResponse) ProtoMessage() {} +func (*BlockchainInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{21} +} +func (m *BlockchainInfoResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockchainInfoResponse.Unmarshal(m, b) +} +func (m *BlockchainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockchainInfoResponse.Marshal(b, m, deterministic) +} +func (m *BlockchainInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockchainInfoResponse.Merge(m, src) +} +func (m *BlockchainInfoResponse) XXX_Size() int { + return xxx_messageInfo_BlockchainInfoResponse.Size(m) +} +func (m *BlockchainInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_BlockchainInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockchainInfoResponse proto.InternalMessageInfo + +func (m *BlockchainInfoResponse) GetLastBlockHeight() uint64 { + if m != nil { + return m.LastBlockHeight + } + return 0 +} + +func (m *BlockchainInfoResponse) GetLastBlockTime() time.Time { + if m != nil { + return m.LastBlockTime + } + return time.Time{} +} + +func (*BlockchainInfoResponse) XXX_MessageName() string { + return "proto3.BlockchainInfoResponse" +} + +type TxRequest struct { + TxHash string `protobuf:"bytes,1,opt,name=TxHash,proto3" json:"TxHash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TxRequest) Reset() { *m = TxRequest{} } +func (m *TxRequest) String() string { return proto.CompactTextString(m) } +func (*TxRequest) ProtoMessage() {} +func (*TxRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{22} +} +func (m *TxRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TxRequest.Unmarshal(m, b) +} +func (m *TxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TxRequest.Marshal(b, m, deterministic) +} +func (m *TxRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxRequest.Merge(m, src) +} +func (m *TxRequest) XXX_Size() int { + return xxx_messageInfo_TxRequest.Size(m) +} +func (m *TxRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TxRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TxRequest proto.InternalMessageInfo + +func (m *TxRequest) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +func (*TxRequest) XXX_MessageName() string { + return "proto3.TxRequest" +} + +type TxResponse struct { + Tx *TxInfo `protobuf:"bytes,1,opt,name=Tx,proto3" json:"Tx,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TxResponse) Reset() { *m = TxResponse{} } +func (m *TxResponse) String() string { return proto.CompactTextString(m) } +func (*TxResponse) ProtoMessage() {} +func (*TxResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{23} +} +func (m *TxResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TxResponse.Unmarshal(m, b) +} +func (m *TxResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TxResponse.Marshal(b, m, deterministic) +} +func (m *TxResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxResponse.Merge(m, src) +} +func (m *TxResponse) XXX_Size() int { + return xxx_messageInfo_TxResponse.Size(m) +} +func (m *TxResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TxResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TxResponse proto.InternalMessageInfo + +func (m *TxResponse) GetTx() *TxInfo { + if m != nil { + return m.Tx + } + return nil +} + +func (*TxResponse) XXX_MessageName() string { + return "proto3.TxResponse" +} + +type BlockInfo struct { + Header HeaderInfo `protobuf:"bytes,1,opt,name=header,proto3" json:"header"` + LastCommitInfo CommitInfo `protobuf:"bytes,2,opt,name=last_commit_info,json=lastCommitInfo,proto3" json:"last_commit_info"` + ByzantineValidators []EvidenceInfo `protobuf:"bytes,3,rep,name=byzantine_validators,json=byzantineValidators,proto3" json:"byzantine_validators"` + Txs []TxInfo `protobuf:"bytes,4,rep,name=Txs,proto3" json:"Txs"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BlockInfo) Reset() { *m = BlockInfo{} } +func (m *BlockInfo) String() string { return proto.CompactTextString(m) } +func (*BlockInfo) ProtoMessage() {} +func (*BlockInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{24} +} +func (m *BlockInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BlockInfo.Unmarshal(m, b) +} +func (m *BlockInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BlockInfo.Marshal(b, m, deterministic) +} +func (m *BlockInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockInfo.Merge(m, src) +} +func (m *BlockInfo) XXX_Size() int { + return xxx_messageInfo_BlockInfo.Size(m) +} +func (m *BlockInfo) XXX_DiscardUnknown() { + xxx_messageInfo_BlockInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockInfo proto.InternalMessageInfo + +func (m *BlockInfo) GetHeader() HeaderInfo { + if m != nil { + return m.Header + } + return HeaderInfo{} +} + +func (m *BlockInfo) GetLastCommitInfo() CommitInfo { + if m != nil { + return m.LastCommitInfo + } + return CommitInfo{} +} + +func (m *BlockInfo) GetByzantineValidators() []EvidenceInfo { + if m != nil { + return m.ByzantineValidators + } + return nil +} + +func (m *BlockInfo) GetTxs() []TxInfo { + if m != nil { + return m.Txs + } + return nil +} + +func (*BlockInfo) XXX_MessageName() string { + return "proto3.BlockInfo" +} + +type HeaderInfo struct { + // basic block info + BlockHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"block_hash"` + Version Version `protobuf:"bytes,2,opt,name=version,proto3" json:"version"` + ChainID string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Height int64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` + Time time.Time `protobuf:"bytes,5,opt,name=time,proto3,stdtime" json:"time"` + NumTxs int64 `protobuf:"varint,6,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` + TotalTxs int64 `protobuf:"varint,7,opt,name=total_txs,json=totalTxs,proto3" json:"total_txs,omitempty"` + // prev block info + LastBlockId []byte `protobuf:"bytes,8,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id,omitempty"` + // hashes of block data + LastCommitHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,9,opt,name=last_commit_hash,json=lastCommitHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"last_commit_hash"` + DataHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,10,opt,name=data_hash,json=dataHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"data_hash"` + // hashes from the app output from the prev block + ValidatorsHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,11,opt,name=validators_hash,json=validatorsHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"validators_hash"` + NextValidatorsHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,12,opt,name=next_validators_hash,json=nextValidatorsHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"next_validators_hash"` + ConsensusHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,13,opt,name=consensus_hash,json=consensusHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"consensus_hash"` + AppHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,14,opt,name=app_hash,json=appHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"app_hash"` + LastResultsHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,15,opt,name=last_results_hash,json=lastResultsHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"last_results_hash"` + // consensus info + EvidenceHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,16,opt,name=evidence_hash,json=evidenceHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"evidence_hash"` + ProposerAddress string `protobuf:"bytes,17,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HeaderInfo) Reset() { *m = HeaderInfo{} } +func (m *HeaderInfo) String() string { return proto.CompactTextString(m) } +func (*HeaderInfo) ProtoMessage() {} +func (*HeaderInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{25} +} +func (m *HeaderInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HeaderInfo.Unmarshal(m, b) +} +func (m *HeaderInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HeaderInfo.Marshal(b, m, deterministic) +} +func (m *HeaderInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_HeaderInfo.Merge(m, src) +} +func (m *HeaderInfo) XXX_Size() int { + return xxx_messageInfo_HeaderInfo.Size(m) +} +func (m *HeaderInfo) XXX_DiscardUnknown() { + xxx_messageInfo_HeaderInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_HeaderInfo proto.InternalMessageInfo + +func (m *HeaderInfo) GetVersion() Version { + if m != nil { + return m.Version + } + return Version{} +} + +func (m *HeaderInfo) GetChainID() string { + if m != nil { + return m.ChainID + } + return "" +} + +func (m *HeaderInfo) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *HeaderInfo) GetTime() time.Time { + if m != nil { + return m.Time + } + return time.Time{} +} + +func (m *HeaderInfo) GetNumTxs() int64 { + if m != nil { + return m.NumTxs + } + return 0 +} + +func (m *HeaderInfo) GetTotalTxs() int64 { + if m != nil { + return m.TotalTxs + } + return 0 +} + +func (m *HeaderInfo) GetLastBlockId() []byte { + if m != nil { + return m.LastBlockId + } + return nil +} + +func (m *HeaderInfo) GetProposerAddress() string { + if m != nil { + return m.ProposerAddress + } + return "" +} + +func (*HeaderInfo) XXX_MessageName() string { + return "proto3.HeaderInfo" +} + +type Version struct { + Block uint64 `protobuf:"varint,1,opt,name=Block,proto3" json:"Block,omitempty"` + App uint64 `protobuf:"varint,2,opt,name=App,proto3" json:"App,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Version) Reset() { *m = Version{} } +func (m *Version) String() string { return proto.CompactTextString(m) } +func (*Version) ProtoMessage() {} +func (*Version) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{26} +} +func (m *Version) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Version.Unmarshal(m, b) +} +func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Version.Marshal(b, m, deterministic) +} +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) +} +func (m *Version) XXX_Size() int { + return xxx_messageInfo_Version.Size(m) +} +func (m *Version) XXX_DiscardUnknown() { + xxx_messageInfo_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_Version proto.InternalMessageInfo + +func (m *Version) GetBlock() uint64 { + if m != nil { + return m.Block + } + return 0 +} + +func (m *Version) GetApp() uint64 { + if m != nil { + return m.App + } + return 0 +} + +func (*Version) XXX_MessageName() string { + return "proto3.Version" +} + +type CommitInfo struct { + BlockHash github_com_gallactic_gallactic_common_binary.HexBytes `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3,customtype=github.com/gallactic/gallactic/common/binary.HexBytes" json:"block_hash"` + Votes []VoteInfo `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CommitInfo) Reset() { *m = CommitInfo{} } +func (m *CommitInfo) String() string { return proto.CompactTextString(m) } +func (*CommitInfo) ProtoMessage() {} +func (*CommitInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{27} +} +func (m *CommitInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CommitInfo.Unmarshal(m, b) +} +func (m *CommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CommitInfo.Marshal(b, m, deterministic) +} +func (m *CommitInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_CommitInfo.Merge(m, src) +} +func (m *CommitInfo) XXX_Size() int { + return xxx_messageInfo_CommitInfo.Size(m) +} +func (m *CommitInfo) XXX_DiscardUnknown() { + xxx_messageInfo_CommitInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_CommitInfo proto.InternalMessageInfo + +func (m *CommitInfo) GetVotes() []VoteInfo { + if m != nil { + return m.Votes + } + return nil +} + +func (*CommitInfo) XXX_MessageName() string { + return "proto3.CommitInfo" +} + +type VoteInfo struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Round int32 `protobuf:"varint,3,opt,name=round,proto3" json:"round,omitempty"` + Height int64 `protobuf:"varint,4,opt,name=Height,proto3" json:"Height,omitempty"` + Time time.Time `protobuf:"bytes,5,opt,name=time,proto3,stdtime" json:"time"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *VoteInfo) Reset() { *m = VoteInfo{} } +func (m *VoteInfo) String() string { return proto.CompactTextString(m) } +func (*VoteInfo) ProtoMessage() {} +func (*VoteInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{28} +} +func (m *VoteInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_VoteInfo.Unmarshal(m, b) +} +func (m *VoteInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_VoteInfo.Marshal(b, m, deterministic) +} +func (m *VoteInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteInfo.Merge(m, src) +} +func (m *VoteInfo) XXX_Size() int { + return xxx_messageInfo_VoteInfo.Size(m) +} +func (m *VoteInfo) XXX_DiscardUnknown() { + xxx_messageInfo_VoteInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_VoteInfo proto.InternalMessageInfo + +func (m *VoteInfo) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + +func (m *VoteInfo) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +func (m *VoteInfo) GetRound() int32 { + if m != nil { + return m.Round + } + return 0 +} + +func (m *VoteInfo) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *VoteInfo) GetTime() time.Time { + if m != nil { + return m.Time + } + return time.Time{} +} + +func (*VoteInfo) XXX_MessageName() string { + return "proto3.VoteInfo" +} + +type ValidatorInfo struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + PubKey string `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + Stake uint64 `protobuf:"varint,4,opt,name=stake,proto3" json:"stake,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ValidatorInfo) Reset() { *m = ValidatorInfo{} } +func (m *ValidatorInfo) String() string { return proto.CompactTextString(m) } +func (*ValidatorInfo) ProtoMessage() {} +func (*ValidatorInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{29} +} +func (m *ValidatorInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ValidatorInfo.Unmarshal(m, b) +} +func (m *ValidatorInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ValidatorInfo.Marshal(b, m, deterministic) +} +func (m *ValidatorInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorInfo.Merge(m, src) +} +func (m *ValidatorInfo) XXX_Size() int { + return xxx_messageInfo_ValidatorInfo.Size(m) +} +func (m *ValidatorInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorInfo proto.InternalMessageInfo + +func (m *ValidatorInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *ValidatorInfo) GetPubKey() string { + if m != nil { + return m.PubKey + } + return "" +} + +func (m *ValidatorInfo) GetPower() int64 { + if m != nil { + return m.Power + } + return 0 +} + +func (m *ValidatorInfo) GetStake() uint64 { + if m != nil { + return m.Stake + } + return 0 +} + +func (*ValidatorInfo) XXX_MessageName() string { + return "proto3.ValidatorInfo" +} + +type EvidenceInfo struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EvidenceInfo) Reset() { *m = EvidenceInfo{} } +func (m *EvidenceInfo) String() string { return proto.CompactTextString(m) } +func (*EvidenceInfo) ProtoMessage() {} +func (*EvidenceInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{30} +} +func (m *EvidenceInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EvidenceInfo.Unmarshal(m, b) +} +func (m *EvidenceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EvidenceInfo.Marshal(b, m, deterministic) +} +func (m *EvidenceInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_EvidenceInfo.Merge(m, src) +} +func (m *EvidenceInfo) XXX_Size() int { + return xxx_messageInfo_EvidenceInfo.Size(m) +} +func (m *EvidenceInfo) XXX_DiscardUnknown() { + xxx_messageInfo_EvidenceInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_EvidenceInfo proto.InternalMessageInfo + +func (m *EvidenceInfo) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *EvidenceInfo) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (*EvidenceInfo) XXX_MessageName() string { + return "proto3.EvidenceInfo" +} + +type TxInfo struct { + Height int64 `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"` + Hash string `protobuf:"bytes,2,opt,name=Hash,proto3" json:"Hash,omitempty"` + GasUsed int64 `protobuf:"varint,3,opt,name=GasUsed,proto3" json:"GasUsed,omitempty"` + GasWanted int64 `protobuf:"varint,4,opt,name=GasWanted,proto3" json:"GasWanted,omitempty"` + Envelope string `protobuf:"bytes,5,opt,name=Envelope,proto3" json:"Envelope,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TxInfo) Reset() { *m = TxInfo{} } +func (m *TxInfo) String() string { return proto.CompactTextString(m) } +func (*TxInfo) ProtoMessage() {} +func (*TxInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_82f68083e8c83698, []int{31} +} +func (m *TxInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TxInfo.Unmarshal(m, b) +} +func (m *TxInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TxInfo.Marshal(b, m, deterministic) +} +func (m *TxInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_TxInfo.Merge(m, src) +} +func (m *TxInfo) XXX_Size() int { + return xxx_messageInfo_TxInfo.Size(m) +} +func (m *TxInfo) XXX_DiscardUnknown() { + xxx_messageInfo_TxInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_TxInfo proto.InternalMessageInfo + +func (m *TxInfo) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *TxInfo) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +func (m *TxInfo) GetGasUsed() int64 { + if m != nil { + return m.GasUsed + } + return 0 +} + +func (m *TxInfo) GetGasWanted() int64 { + if m != nil { + return m.GasWanted + } + return 0 +} + +func (m *TxInfo) GetEnvelope() string { + if m != nil { + return m.Envelope + } + return "" +} + +func (*TxInfo) XXX_MessageName() string { + return "proto3.TxInfo" +} +func init() { + proto.RegisterType((*Empty)(nil), "proto3.Empty") + golang_proto.RegisterType((*Empty)(nil), "proto3.Empty") + proto.RegisterType((*AddressRequest)(nil), "proto3.AddressRequest") + golang_proto.RegisterType((*AddressRequest)(nil), "proto3.AddressRequest") + proto.RegisterType((*AccountResponse)(nil), "proto3.AccountResponse") + golang_proto.RegisterType((*AccountResponse)(nil), "proto3.AccountResponse") + proto.RegisterType((*AccountsResponse)(nil), "proto3.AccountsResponse") + golang_proto.RegisterType((*AccountsResponse)(nil), "proto3.AccountsResponse") + proto.RegisterType((*ValidatorResponse)(nil), "proto3.ValidatorResponse") + golang_proto.RegisterType((*ValidatorResponse)(nil), "proto3.ValidatorResponse") + proto.RegisterType((*ValidatorsResponse)(nil), "proto3.ValidatorsResponse") + golang_proto.RegisterType((*ValidatorsResponse)(nil), "proto3.ValidatorsResponse") + proto.RegisterType((*ListAccountsParam)(nil), "proto3.ListAccountsParam") + golang_proto.RegisterType((*ListAccountsParam)(nil), "proto3.ListAccountsParam") + proto.RegisterType((*StorageRequest)(nil), "proto3.StorageRequest") + golang_proto.RegisterType((*StorageRequest)(nil), "proto3.StorageRequest") + proto.RegisterType((*StorageResponse)(nil), "proto3.StorageResponse") + golang_proto.RegisterType((*StorageResponse)(nil), "proto3.StorageResponse") + proto.RegisterType((*StorageItem)(nil), "proto3.StorageItem") + golang_proto.RegisterType((*StorageItem)(nil), "proto3.StorageItem") + proto.RegisterType((*StorageAtRequest)(nil), "proto3.StorageAtRequest") + golang_proto.RegisterType((*StorageAtRequest)(nil), "proto3.StorageAtRequest") + proto.RegisterType((*StorageAtResponse)(nil), "proto3.StorageAtResponse") + golang_proto.RegisterType((*StorageAtResponse)(nil), "proto3.StorageAtResponse") + proto.RegisterType((*ConsensusResponse)(nil), "proto3.ConsensusResponse") + golang_proto.RegisterType((*ConsensusResponse)(nil), "proto3.ConsensusResponse") + proto.RegisterType((*ChainResponse)(nil), "proto3.ChainResponse") + golang_proto.RegisterType((*ChainResponse)(nil), "proto3.ChainResponse") + proto.RegisterType((*StatusResponse)(nil), "proto3.StatusResponse") + golang_proto.RegisterType((*StatusResponse)(nil), "proto3.StatusResponse") + proto.RegisterType((*BlockRequest)(nil), "proto3.BlockRequest") + golang_proto.RegisterType((*BlockRequest)(nil), "proto3.BlockRequest") + proto.RegisterType((*BlocksRequest)(nil), "proto3.BlocksRequest") + golang_proto.RegisterType((*BlocksRequest)(nil), "proto3.BlocksRequest") + proto.RegisterType((*BlockResponse)(nil), "proto3.BlockResponse") + golang_proto.RegisterType((*BlockResponse)(nil), "proto3.BlockResponse") + proto.RegisterType((*BlocksResponse)(nil), "proto3.BlocksResponse") + golang_proto.RegisterType((*BlocksResponse)(nil), "proto3.BlocksResponse") + proto.RegisterType((*GenesisResponse)(nil), "proto3.GenesisResponse") + golang_proto.RegisterType((*GenesisResponse)(nil), "proto3.GenesisResponse") + proto.RegisterType((*BlockTxsResponse)(nil), "proto3.BlockTxsResponse") + golang_proto.RegisterType((*BlockTxsResponse)(nil), "proto3.BlockTxsResponse") + proto.RegisterType((*BlockchainInfoResponse)(nil), "proto3.BlockchainInfoResponse") + golang_proto.RegisterType((*BlockchainInfoResponse)(nil), "proto3.BlockchainInfoResponse") + proto.RegisterType((*TxRequest)(nil), "proto3.TxRequest") + golang_proto.RegisterType((*TxRequest)(nil), "proto3.TxRequest") + proto.RegisterType((*TxResponse)(nil), "proto3.TxResponse") + golang_proto.RegisterType((*TxResponse)(nil), "proto3.TxResponse") + proto.RegisterType((*BlockInfo)(nil), "proto3.BlockInfo") + golang_proto.RegisterType((*BlockInfo)(nil), "proto3.BlockInfo") + proto.RegisterType((*HeaderInfo)(nil), "proto3.HeaderInfo") + golang_proto.RegisterType((*HeaderInfo)(nil), "proto3.HeaderInfo") + proto.RegisterType((*Version)(nil), "proto3.Version") + golang_proto.RegisterType((*Version)(nil), "proto3.Version") + proto.RegisterType((*CommitInfo)(nil), "proto3.CommitInfo") + golang_proto.RegisterType((*CommitInfo)(nil), "proto3.CommitInfo") + proto.RegisterType((*VoteInfo)(nil), "proto3.VoteInfo") + golang_proto.RegisterType((*VoteInfo)(nil), "proto3.VoteInfo") + proto.RegisterType((*ValidatorInfo)(nil), "proto3.ValidatorInfo") + golang_proto.RegisterType((*ValidatorInfo)(nil), "proto3.ValidatorInfo") + proto.RegisterType((*EvidenceInfo)(nil), "proto3.EvidenceInfo") + golang_proto.RegisterType((*EvidenceInfo)(nil), "proto3.EvidenceInfo") + proto.RegisterType((*TxInfo)(nil), "proto3.TxInfo") + golang_proto.RegisterType((*TxInfo)(nil), "proto3.TxInfo") +} + +func init() { proto.RegisterFile("proto3/blockchain.proto", fileDescriptor_82f68083e8c83698) } +func init() { golang_proto.RegisterFile("proto3/blockchain.proto", fileDescriptor_82f68083e8c83698) } + +var fileDescriptor_82f68083e8c83698 = []byte{ + // 2057 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x59, 0x4f, 0x73, 0x1b, 0x59, + 0x11, 0x8f, 0x64, 0xc9, 0xd2, 0xb4, 0x2c, 0x4b, 0x7a, 0x11, 0x89, 0x22, 0x5c, 0x76, 0x78, 0x54, + 0x65, 0xb3, 0x10, 0x34, 0x10, 0xb3, 0xb5, 0xb9, 0x2c, 0x60, 0x39, 0x59, 0xdb, 0x24, 0x24, 0x66, + 0x22, 0x0c, 0x6c, 0x51, 0xa8, 0x46, 0xd2, 0x8b, 0x3c, 0x1b, 0x69, 0x66, 0xd0, 0x3c, 0x19, 0x09, + 0x97, 0x39, 0x70, 0xe2, 0x00, 0x55, 0x50, 0x5c, 0x38, 0x72, 0xa2, 0xb8, 0x73, 0xe2, 0x40, 0x15, + 0x37, 0x72, 0xa4, 0x8a, 0x5b, 0x0e, 0x86, 0x4a, 0xf8, 0x06, 0x5c, 0x38, 0x52, 0xef, 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b, 0xa1, 0xaf, 0x6f, 0x2c, 0xbc, 0xe4, 0x69, 0x35, 0x1b, 0x5c, 0xcd, 0x35, + 0x54, 0xb7, 0x35, 0xcf, 0x38, 0xc9, 0x13, 0x28, 0x9b, 0x0a, 0x16, 0x3c, 0xde, 0x5c, 0x00, 0x8e, + 0x7d, 0x7e, 0x95, 0x23, 0x97, 0x51, 0xc9, 0x36, 0xe4, 0x77, 0xc1, 0xe2, 0xae, 0x61, 0xd3, 0x7d, + 0x1a, 0xcc, 0x88, 0x81, 0x39, 0xfc, 0xe3, 0x0a, 0x07, 0xb2, 0x50, 0xc1, 0x96, 0x72, 0xef, 0xf3, + 0xd0, 0xc9, 0x41, 0x25, 0x8d, 0x72, 0xd1, 0x4c, 0x84, 0xab, 0x1c, 0x06, 0x50, 0xd1, 0x56, 0x92, + 0xf7, 0x39, 0x8e, 0xec, 0xce, 0xd2, 0x38, 0xfa, 0xf5, 0x33, 0xf1, 0x6a, 0x62, 0xa0, 0x28, 0xb9, + 0x47, 0xb0, 0xbe, 0x47, 0xa8, 0x31, 0xd2, 0x5e, 0x88, 0x94, 0x18, 0x26, 0x71, 0x9d, 0x23, 0xad, + 0xa3, 0x35, 0xdb, 0x94, 0x3d, 0x82, 0x1a, 0xb3, 0x49, 0x5d, 0xbf, 0xe2, 0x2d, 0x29, 0x05, 0x78, + 0xf1, 0x03, 0x12, 0xbe, 0xce, 0x41, 0x6b, 0xa8, 0x62, 0xa7, 0x20, 0x0e, 0xa1, 0xb8, 0x47, 0xa4, + 0x8e, 0x7a, 0xca, 0x20, 0x91, 0x24, 0x17, 0x98, 0x19, 0x23, 0x72, 0xba, 0x7d, 0x2a, 0xea, 0xcf, + 0x19, 0xea, 0xf3, 0x50, 0x8a, 0x69, 0x15, 0x25, 0x85, 0x75, 0xe2, 0x5d, 0x4b, 0x93, 0x25, 0xe8, + 0x5b, 0x1c, 0xf4, 0x73, 0x68, 0x4b, 0x80, 0x46, 0xf6, 0xa9, 0x9e, 0xc9, 0xcf, 0xec, 0x53, 0x3d, + 0x81, 0x9f, 0xa1, 0x1f, 0x72, 0x77, 0x24, 0xa7, 0xc6, 0xb4, 0x3b, 0x36, 0x13, 0x4a, 0x16, 0x86, + 0x4b, 0xe3, 0x53, 0x5d, 0x84, 0xba, 0x0f, 0xf9, 0x3d, 0x42, 0x3b, 0x33, 0x54, 0x8b, 0x67, 0x0e, + 0x65, 0x3c, 0x32, 0x49, 0x0b, 0x41, 0xeb, 0xcc, 0xec, 0x53, 0x31, 0xbd, 0x9d, 0xa1, 0xaf, 0x71, + 0x57, 0x3c, 0xf2, 0x22, 0x86, 0x94, 0xb2, 0x2e, 0x35, 0xcc, 0x60, 0xc4, 0x11, 0xd6, 0x10, 0xd8, + 0xb1, 0xc8, 0x33, 0x5e, 0xd6, 0xd4, 0xb8, 0x7d, 0x41, 0x7c, 0x1a, 0x09, 0xaa, 0x31, 0x96, 0x6b, + 0x6f, 0x5a, 0xb6, 0x62, 0x7d, 0xc0, 0x4e, 0xab, 0x16, 0x3a, 0x64, 0xed, 0xc6, 0x8b, 0x57, 0x9b, + 0x57, 0xfe, 0xf6, 0x6a, 0xf3, 0xca, 0x3f, 0x5f, 0x6d, 0x66, 0x7e, 0xf7, 0x7a, 0xf3, 0xca, 0x5f, + 0x5e, 0x6f, 0x66, 0x5e, 0xbc, 0xde, 0xcc, 0xf4, 0xe4, 0xdf, 0x42, 0xff, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0xb4, 0xc2, 0xa7, 0xa9, 0x38, 0x1a, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// BlockChainClient is the client API for BlockChain service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type BlockChainClient interface { + GetAccount(ctx context.Context, in *AddressRequest, opts ...grpc.CallOption) (*AccountResponse, error) + GetAccounts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*AccountsResponse, error) + GetStorage(ctx context.Context, in *StorageRequest, opts ...grpc.CallOption) (*StorageResponse, error) + GetStorageAt(ctx context.Context, in *StorageAtRequest, opts ...grpc.CallOption) (*StorageAtResponse, error) + GetValidator(ctx context.Context, in *AddressRequest, opts ...grpc.CallOption) (*ValidatorResponse, error) + GetValidators(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ValidatorsResponse, error) + GetStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StatusResponse, error) + GetGenesis(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GenesisResponse, error) + GetChainID(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ChainResponse, error) + GetLatestBlock(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BlockResponse, error) + GetConsensusState(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConsensusResponse, error) + GetBlock(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockResponse, error) + GetBlocks(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (*BlocksResponse, error) + GetBlockchainInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BlockchainInfoResponse, error) + GetTx(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*TxResponse, error) + GetListTx(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TxInfo, error) + GetBlockTxs(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockTxsResponse, error) +} + +type blockChainClient struct { + cc *grpc.ClientConn +} + +func NewBlockChainClient(cc *grpc.ClientConn) BlockChainClient { + return &blockChainClient{cc} +} + +func (c *blockChainClient) GetAccount(ctx context.Context, in *AddressRequest, opts ...grpc.CallOption) (*AccountResponse, error) { + out := new(AccountResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetAccount", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetAccounts(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*AccountsResponse, error) { + out := new(AccountsResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetAccounts", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetStorage(ctx context.Context, in *StorageRequest, opts ...grpc.CallOption) (*StorageResponse, error) { + out := new(StorageResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetStorage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetStorageAt(ctx context.Context, in *StorageAtRequest, opts ...grpc.CallOption) (*StorageAtResponse, error) { + out := new(StorageAtResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetStorageAt", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetValidator(ctx context.Context, in *AddressRequest, opts ...grpc.CallOption) (*ValidatorResponse, error) { + out := new(ValidatorResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetValidator", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetValidators(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ValidatorsResponse, error) { + out := new(ValidatorsResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetValidators", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StatusResponse, error) { + out := new(StatusResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetGenesis(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GenesisResponse, error) { + out := new(GenesisResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetGenesis", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetChainID(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ChainResponse, error) { + out := new(ChainResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetChainID", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetLatestBlock(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BlockResponse, error) { + out := new(BlockResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetLatestBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetConsensusState(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*ConsensusResponse, error) { + out := new(ConsensusResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetConsensusState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetBlock(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockResponse, error) { + out := new(BlockResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetBlocks(ctx context.Context, in *BlocksRequest, opts ...grpc.CallOption) (*BlocksResponse, error) { + out := new(BlocksResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetBlocks", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetBlockchainInfo(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*BlockchainInfoResponse, error) { + out := new(BlockchainInfoResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetBlockchainInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetTx(ctx context.Context, in *TxRequest, opts ...grpc.CallOption) (*TxResponse, error) { + out := new(TxResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetListTx(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*TxInfo, error) { + out := new(TxInfo) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetListTx", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *blockChainClient) GetBlockTxs(ctx context.Context, in *BlockRequest, opts ...grpc.CallOption) (*BlockTxsResponse, error) { + out := new(BlockTxsResponse) + err := c.cc.Invoke(ctx, "/proto3.BlockChain/GetBlockTxs", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// BlockChainServer is the server API for BlockChain service. +type BlockChainServer interface { + GetAccount(context.Context, *AddressRequest) (*AccountResponse, error) + GetAccounts(context.Context, *Empty) (*AccountsResponse, error) + GetStorage(context.Context, *StorageRequest) (*StorageResponse, error) + GetStorageAt(context.Context, *StorageAtRequest) (*StorageAtResponse, error) + GetValidator(context.Context, *AddressRequest) (*ValidatorResponse, error) + GetValidators(context.Context, *Empty) (*ValidatorsResponse, error) + GetStatus(context.Context, *Empty) (*StatusResponse, error) + GetGenesis(context.Context, *Empty) (*GenesisResponse, error) + GetChainID(context.Context, *Empty) (*ChainResponse, error) + GetLatestBlock(context.Context, *Empty) (*BlockResponse, error) + GetConsensusState(context.Context, *Empty) (*ConsensusResponse, error) + GetBlock(context.Context, *BlockRequest) (*BlockResponse, error) + GetBlocks(context.Context, *BlocksRequest) (*BlocksResponse, error) + GetBlockchainInfo(context.Context, *Empty) (*BlockchainInfoResponse, error) + GetTx(context.Context, *TxRequest) (*TxResponse, error) + GetListTx(context.Context, *Empty) (*TxInfo, error) + GetBlockTxs(context.Context, *BlockRequest) (*BlockTxsResponse, error) +} + +func RegisterBlockChainServer(s *grpc.Server, srv BlockChainServer) { + s.RegisterService(&_BlockChain_serviceDesc, srv) +} + +func _BlockChain_GetAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetAccount(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetAccount", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetAccount(ctx, req.(*AddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetAccounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetAccounts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetAccounts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetAccounts(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetStorage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StorageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetStorage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetStorage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetStorage(ctx, req.(*StorageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetStorageAt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StorageAtRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetStorageAt(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetStorageAt", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetStorageAt(ctx, req.(*StorageAtRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetValidator_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetValidator(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetValidator", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetValidator(ctx, req.(*AddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetValidators_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetValidators(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetValidators", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetValidators(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetStatus(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetGenesis_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetGenesis(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetGenesis", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetGenesis(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetChainID_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetChainID(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetChainID", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetChainID(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetLatestBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetLatestBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetLatestBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetLatestBlock(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetConsensusState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetConsensusState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetConsensusState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetConsensusState(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetBlock(ctx, req.(*BlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetBlocks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BlocksRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetBlocks(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetBlocks", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetBlocks(ctx, req.(*BlocksRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetBlockchainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetBlockchainInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetBlockchainInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetBlockchainInfo(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetTx(ctx, req.(*TxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetListTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetListTx(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetListTx", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetListTx(ctx, req.(*Empty)) + } + return interceptor(ctx, in, info, handler) +} + +func _BlockChain_GetBlockTxs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(BlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(BlockChainServer).GetBlockTxs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto3.BlockChain/GetBlockTxs", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(BlockChainServer).GetBlockTxs(ctx, req.(*BlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _BlockChain_serviceDesc = grpc.ServiceDesc{ + ServiceName: "proto3.BlockChain", + HandlerType: (*BlockChainServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAccount", + Handler: _BlockChain_GetAccount_Handler, + }, + { + MethodName: "GetAccounts", + Handler: _BlockChain_GetAccounts_Handler, + }, + { + MethodName: "GetStorage", + Handler: _BlockChain_GetStorage_Handler, + }, + { + MethodName: "GetStorageAt", + Handler: _BlockChain_GetStorageAt_Handler, + }, + { + MethodName: "GetValidator", + Handler: _BlockChain_GetValidator_Handler, + }, + { + MethodName: "GetValidators", + Handler: _BlockChain_GetValidators_Handler, + }, + { + MethodName: "GetStatus", + Handler: _BlockChain_GetStatus_Handler, + }, + { + MethodName: "GetGenesis", + Handler: _BlockChain_GetGenesis_Handler, + }, + { + MethodName: "GetChainID", + Handler: _BlockChain_GetChainID_Handler, + }, + { + MethodName: "GetLatestBlock", + Handler: _BlockChain_GetLatestBlock_Handler, + }, + { + MethodName: "GetConsensusState", + Handler: _BlockChain_GetConsensusState_Handler, + }, + { + MethodName: "GetBlock", + Handler: _BlockChain_GetBlock_Handler, + }, + { + MethodName: "GetBlocks", + Handler: _BlockChain_GetBlocks_Handler, + }, + { + MethodName: "GetBlockchainInfo", + Handler: _BlockChain_GetBlockchainInfo_Handler, + }, + { + MethodName: "GetTx", + Handler: _BlockChain_GetTx_Handler, + }, + { + MethodName: "GetListTx", + Handler: _BlockChain_GetListTx_Handler, + }, + { + MethodName: "GetBlockTxs", + Handler: _BlockChain_GetBlockTxs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto3/blockchain.proto", +} + +func (m *Empty) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AccountResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Account != nil { + l = m.Account.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AccountsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeight != 0 { + n += 1 + sovBlockchain(uint64(m.BlockHeight)) + } + if len(m.Accounts) > 0 { + for _, e := range m.Accounts { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ValidatorResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Validator != nil { + l = m.Validator.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ValidatorsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeight != 0 { + n += 1 + sovBlockchain(uint64(m.BlockHeight)) + } + if len(m.Validators) > 0 { + for _, e := range m.Validators { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ListAccountsParam) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Query) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.StorageItems) > 0 { + for _, e := range m.StorageItems { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Key.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.Value.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageAtRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + l = m.Key.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StorageAtResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Key.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.Value.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ConsensusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.RoundState.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if len(m.PeerRoundStates) > 0 { + for _, e := range m.PeerRoundStates { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ChainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainName) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + l = m.GenesisHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *StatusResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.NodeInfo.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.GenesisHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.PubKey.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.LatestBlockHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if m.LatestBlockHeight != 0 { + n += 1 + sovBlockchain(uint64(m.LatestBlockHeight)) + } + if m.LatestBlockTime != 0 { + n += 1 + sovBlockchain(uint64(m.LatestBlockTime)) + } + l = len(m.NodeVersion) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlockRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovBlockchain(uint64(m.Height)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlocksRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.MinHeight != 0 { + n += 1 + sovBlockchain(uint64(m.MinHeight)) + } + if m.MaxHeight != 0 { + n += 1 + sovBlockchain(uint64(m.MaxHeight)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlockResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Block != nil { + l = m.Block.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlocksResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Blocks) > 0 { + for _, e := range m.Blocks { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *GenesisResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Genesis != nil { + l = m.Genesis.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlockTxsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Count != 0 { + n += 1 + sovBlockchain(uint64(m.Count)) + } + if len(m.Txs) > 0 { + for _, e := range m.Txs { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlockchainInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.LastBlockHeight != 0 { + n += 1 + sovBlockchain(uint64(m.LastBlockHeight)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime) + n += 1 + l + sovBlockchain(uint64(l)) + l = m.LastBlockHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TxRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TxResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Tx != nil { + l = m.Tx.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *BlockInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Header.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.LastCommitInfo.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if len(m.ByzantineValidators) > 0 { + for _, e := range m.ByzantineValidators { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if len(m.Txs) > 0 { + for _, e := range m.Txs { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *HeaderInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BlockHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.Version.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = len(m.ChainID) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovBlockchain(uint64(m.Height)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + n += 1 + l + sovBlockchain(uint64(l)) + if m.NumTxs != 0 { + n += 1 + sovBlockchain(uint64(m.NumTxs)) + } + if m.TotalTxs != 0 { + n += 1 + sovBlockchain(uint64(m.TotalTxs)) + } + l = len(m.LastBlockId) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + l = m.LastCommitHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.DataHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.ValidatorsHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.NextValidatorsHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.ConsensusHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.AppHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.LastResultsHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + l = m.EvidenceHash.Size() + n += 2 + l + sovBlockchain(uint64(l)) + l = len(m.ProposerAddress) + if l > 0 { + n += 2 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *Version) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Block != 0 { + n += 1 + sovBlockchain(uint64(m.Block)) + } + if m.App != 0 { + n += 1 + sovBlockchain(uint64(m.App)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CommitInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BlockHash.Size() + n += 1 + l + sovBlockchain(uint64(l)) + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovBlockchain(uint64(l)) + } + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *VoteInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.Round != 0 { + n += 1 + sovBlockchain(uint64(m.Round)) + } + if m.Height != 0 { + n += 1 + sovBlockchain(uint64(m.Height)) + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + n += 1 + l + sovBlockchain(uint64(l)) + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ValidatorInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + l = len(m.PubKey) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.Power != 0 { + n += 1 + sovBlockchain(uint64(m.Power)) + } + if m.Stake != 0 { + n += 1 + sovBlockchain(uint64(m.Stake)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *EvidenceInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovBlockchain(uint64(m.Height)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TxInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Height != 0 { + n += 1 + sovBlockchain(uint64(m.Height)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.GasUsed != 0 { + n += 1 + sovBlockchain(uint64(m.GasUsed)) + } + if m.GasWanted != 0 { + n += 1 + sovBlockchain(uint64(m.GasWanted)) + } + l = len(m.Envelope) + if l > 0 { + n += 1 + l + sovBlockchain(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovBlockchain(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozBlockchain(x uint64) (n int) { + return sovBlockchain(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} diff --git a/proto3/blockchain.proto b/proto3/blockchain.proto new file mode 100644 index 0000000..2298072 --- /dev/null +++ b/proto3/blockchain.proto @@ -0,0 +1,227 @@ +syntax = 'proto3'; + +package proto3; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option (gogoproto.marshaler_all) = false; +option (gogoproto.unmarshaler_all) = false; +option (gogoproto.sizer_all) = true; +option (gogoproto.goproto_registration) = true; +option (gogoproto.messagename_all) = true; +option (gogoproto.protosizer_all) =false; + + +// BlockChain Service definition +service BlockChain { + rpc GetAccount(AddressRequest) returns (AccountResponse) { option (google.api.http).get = "/Account/{Address}";} + rpc GetAccounts(Empty) returns (AccountsResponse) { option (google.api.http).get = "/Accounts";} + rpc GetStorage(StorageRequest) returns (StorageResponse) { option (google.api.http).get = "/Storage/{Address}";} + rpc GetStorageAt(StorageAtRequest) returns(StorageAtResponse) { option (google.api.http).get = "/StorageAt/{Address}/{Key}";} + rpc GetValidator(AddressRequest) returns (ValidatorResponse) { option (google.api.http).get = "/Validator/{Address}";} + rpc GetValidators(Empty) returns (ValidatorsResponse) { option (google.api.http).get = "/Validators";} + rpc GetStatus(Empty) returns(StatusResponse) { option (google.api.http).get = "/Status";} + rpc GetGenesis(Empty) returns(GenesisResponse) { option (google.api.http).get = "/Genesis";} + rpc GetChainID(Empty) returns(ChainResponse) { option (google.api.http).get = "/ChainID";} + rpc GetLatestBlock(Empty) returns(BlockResponse) { option (google.api.http).get = "/LatestBlock";} + rpc GetConsensusState(Empty) returns (ConsensusResponse) { option (google.api.http).get = "/ConsensusState";} + rpc GetBlock(BlockRequest) returns(BlockResponse) { option (google.api.http).get = "/Block/{height}";} + rpc GetBlocks(BlocksRequest) returns (BlocksResponse) { option (google.api.http).get = "/Blocks/{minHeight}/{maxHeight}";} + rpc GetBlockchainInfo(Empty) returns (BlockchainInfoResponse) { option (google.api.http).get = "/GetBlockchainInfo";} + rpc GetTx(TxRequest) returns(TxResponse) { option (google.api.http) = {get: "/Tx/{TxHash}";};}; + rpc GetListTx(Empty) returns(TxInfo) { option (google.api.http) = {get: "/GetListTx";};}; + rpc GetBlockTxs(BlockRequest)returns(BlockTxsResponse) { option (google.api.http) = { + get : "/BlockTxs"; + additional_bindings { + get : "/BlockTxs/{height}"; + } + }; + } + +} + +message Empty { +} + +message AddressRequest { + string Address = 1; +} + +message AccountResponse { + AccountResponse Account = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/core/account.Account"]; +} + +message AccountsResponse{ + uint64 BlockHeight = 1; + repeated AccountResponse Accounts = 2; +} + +message ValidatorResponse{ + ValidatorInfo Validator = 1 ; +} + +message ValidatorsResponse { + uint64 BlockHeight = 1 ; + repeated ValidatorInfo Validators = 2; +} + +message ListAccountsParam { + string Query = 1; +} + +message StorageRequest { + string Address = 1; +} + +message StorageResponse { + repeated StorageItem StorageItems = 1 [(gogoproto.nullable) = false]; +} + +message StorageItem { + bytes Key = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes",(gogoproto.nullable) = false]; + bytes Value = 2 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; +} + +message StorageAtRequest { + string Address = 1; + bytes Key = 2 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes",(gogoproto.nullable) = false]; +} + +message StorageAtResponse { + bytes Key = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; + bytes Value = 2 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; +} + +message ConsensusResponse{ + bytes RoundState = 1 [(gogoproto.customtype) = "github.com/tendermint/tendermint/consensus/types.RoundStateSimple",(gogoproto.nullable) = false]; + repeated ConsensusResponse PeerRoundStates = 2 [(gogoproto.customtype) = "github.com/tendermint/tendermint/consensus/types.PeerRoundState",(gogoproto.nullable) = false]; +} + +message ChainResponse{ + string ChainName = 1; + string ChainId = 2; + bytes GenesisHash = 3 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; +} + +message StatusResponse { + bytes NodeInfo = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/core/consensus/tendermint/p2p.GNodeInfo",(gogoproto.nullable) = false]; + bytes GenesisHash = 2 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes",(gogoproto.nullable) = false]; + bytes PubKey = 3 [(gogoproto.customtype) = "github.com/gallactic/gallactic/crypto.PublicKey",(gogoproto.nullable) = false]; + bytes LatestBlockHash = 4 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; + uint64 LatestBlockHeight = 5; + int64 LatestBlockTime = 6; + string NodeVersion = 7; +} + +message BlockRequest { + uint64 height = 1; +} + +message BlocksRequest { + uint64 minHeight = 1; + uint64 maxHeight = 2; +} + +message BlockResponse { + BlockInfo Block = 1 ; +} + +message BlocksResponse { + repeated BlockInfo Blocks = 1 [(gogoproto.nullable)=false]; +} + +message GenesisResponse { + GenesisResponse Genesis = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/core/proposal.Genesis"]; +} + +message BlockTxsResponse { + int32 Count = 1; + repeated TxInfo Txs = 2 [(gogoproto.nullable) = false];; +} + +message BlockchainInfoResponse { + uint64 LastBlockHeight = 1; + google.protobuf.Timestamp LastBlockTime = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; + bytes LastBlockHash = 3 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; + +} + +message TxRequest { + string TxHash = 1; +} + +message TxResponse { + TxInfo Tx = 1; +} + +message BlockInfo { + HeaderInfo header = 1 [(gogoproto.nullable)=false]; + CommitInfo last_commit_info = 2 [(gogoproto.nullable)=false]; + repeated EvidenceInfo byzantine_validators = 3 [(gogoproto.nullable)=false]; + repeated TxInfo Txs = 4 [(gogoproto.nullable) = false]; +} + +message HeaderInfo { + // basic block info + bytes block_hash = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; + Version version = 2 [(gogoproto.nullable)=false]; + string chain_id = 3 [(gogoproto.customname)="ChainID"]; + int64 height = 4; + google.protobuf.Timestamp time = 5 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; + int64 num_txs = 6; + int64 total_txs = 7; + // prev block info + bytes last_block_id = 8; + // hashes of block data + bytes last_commit_hash = 9 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // commit from validators from the last block + bytes data_hash = 10 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // transactions + // hashes from the app output from the prev block + bytes validators_hash = 11 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // validators for the current block + bytes next_validators_hash = 12 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // validators for the next block + bytes consensus_hash = 13 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // consensus params for current block + bytes app_hash = 14 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // state after txs from the previous block + bytes last_results_hash = 15 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false];// root hash of all results from the txs from the previous block + // consensus info + bytes evidence_hash = 16 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes", (gogoproto.nullable) = false]; // evidence included in the block + string proposer_address = 17; // original proposer of the block +} + +message Version { + uint64 Block = 1; + uint64 App = 2; +} +message CommitInfo { + bytes block_hash = 1 [(gogoproto.customtype) = "github.com/gallactic/gallactic/common/binary.HexBytes",(gogoproto.nullable)=false]; + repeated VoteInfo votes = 2 [(gogoproto.nullable)=false]; +} + +message VoteInfo { + string validator_address = 1; + bytes signature = 2; + int32 round = 3; + int64 Height = 4; + google.protobuf.Timestamp time = 5 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; +} + +message ValidatorInfo { + string address = 1; + string pub_key = 2; + int64 power = 3; + uint64 stake = 4 ; +} + +message EvidenceInfo { + string address = 1; + int64 height = 2; + +} + +message TxInfo { + int64 Height = 1; + string Hash = 2; + int64 GasUsed = 3; + int64 GasWanted = 4; + string Envelope = 5 ; +} \ No newline at end of file diff --git a/script/HubbleScan.sql b/script/HubbleScan.sql new file mode 100644 index 0000000..084fa61 --- /dev/null +++ b/script/HubbleScan.sql @@ -0,0 +1,250 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) +-- Dumped by pg_dump version 10.6 (Ubuntu 10.6-0ubuntu0.18.04.1) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET client_min_messages = warning; +SET row_security = off; + +-- +-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: +-- + +CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; + + +-- +-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; + + +SET default_tablespace = ''; + +SET default_with_oids = false; + +-- +-- Name: accounts; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.accounts ( + id integer NOT NULL, + address character varying(256), + balance double precision, + permission character varying(256), + sequence character varying(256), + code character varying(256) +); + + +ALTER TABLE public.accounts OWNER TO postgres; + +-- +-- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.accounts_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.accounts_id_seq OWNER TO postgres; + +-- +-- Name: accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.accounts_id_seq OWNED BY public.accounts.id; + + +-- +-- Name: blocks; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.blocks ( + id integer NOT NULL, + height integer, + hash character varying(256), + chainid text, + "time" timestamp without time zone, + lastblockhash character varying(256), + txcounts integer +); + + +ALTER TABLE public.blocks OWNER TO postgres; + +-- +-- Name: blocks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.blocks_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.blocks_id_seq OWNER TO postgres; + +-- +-- Name: blocks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.blocks_id_seq OWNED BY public.blocks.id; + + +-- +-- Name: transactions; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.transactions ( + id integer NOT NULL, + block_id integer, + txhash character varying(256), + gas_used bigint, + gas_wanted bigint, + data character varying(256), + "time" timestamp without time zone +); + + +ALTER TABLE public.transactions OWNER TO postgres; + +-- +-- Name: transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.transactions_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.transactions_id_seq OWNER TO postgres; + +-- +-- Name: transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.transactions_id_seq OWNED BY public.transactions.id; + + +-- +-- Name: txn_relation; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.txn_relation ( + id integer NOT NULL, + txn_id character varying(256), + "from" integer, + "to" integer +); + + +ALTER TABLE public.txn_relation OWNER TO postgres; + +-- +-- Name: txn_relation_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres +-- + +CREATE SEQUENCE public.txn_relation_id_seq + AS integer + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +ALTER TABLE public.txn_relation_id_seq OWNER TO postgres; + +-- +-- Name: txn_relation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres +-- + +ALTER SEQUENCE public.txn_relation_id_seq OWNED BY public.txn_relation.id; + + +-- +-- Name: accounts id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.accounts ALTER COLUMN id SET DEFAULT nextval('public.accounts_id_seq'::regclass); + + +-- +-- Name: blocks id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.blocks ALTER COLUMN id SET DEFAULT nextval('public.blocks_id_seq'::regclass); + + +-- +-- Name: transactions id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.transactions ALTER COLUMN id SET DEFAULT nextval('public.transactions_id_seq'::regclass); + + +-- +-- Name: txn_relation id; Type: DEFAULT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.txn_relation ALTER COLUMN id SET DEFAULT nextval('public.txn_relation_id_seq'::regclass); + + +-- +-- Name: accounts accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.accounts + ADD CONSTRAINT accounts_pkey PRIMARY KEY (id); + + +-- +-- Name: blocks blocks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.blocks + ADD CONSTRAINT blocks_pkey PRIMARY KEY (id); + + +-- +-- Name: transactions transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.transactions + ADD CONSTRAINT transactions_pkey PRIMARY KEY (id); + + +-- +-- Name: txn_relation txn_relation_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.txn_relation + ADD CONSTRAINT txn_relation_pkey PRIMARY KEY (id); + + +-- +-- PostgreSQL database dump complete +-- diff --git a/tests/accounts_test.go b/tests/accounts_test.go new file mode 100644 index 0000000..82101d6 --- /dev/null +++ b/tests/accounts_test.go @@ -0,0 +1,32 @@ +package tests + +import ( + "testing" + + config "github.com/gallactic/hubble_server/config" + db "github.com/gallactic/hubble_server/database" + "github.com/stretchr/testify/require" +) + +func TestAccountsInDataBase(t *testing.T) { + + gConfig, _ := config.LoadConfigFile(true) + dbe := db.Postgre{Config: gConfig} + connErr := dbe.Connect() + require.NoError(t, connErr) + + defer dbe.Disconnect() + + /* + acc := db.Account{Address: "Addr123456", PublicKey: "ABC", Balance: 1234.56, Permission: "Perm456", Sequence: 2, Code: "CodeF1F2"} + insertErr := dbe.InsertAccount(&acc) + require.NoError(t, insertErr) + + sAcc, GAccErr := dbe.GetAccount(7) + require.NoError(t, GAccErr) + require.Equal(t, sAcc.ID, 7) + + sAcc, GNoAccErr := dbe.GetAccount(10000000) + require.Error(t, GNoAccErr) + */ +} diff --git a/tests/blockchain_test.go b/tests/blockchain_test.go new file mode 100644 index 0000000..f4df6e9 --- /dev/null +++ b/tests/blockchain_test.go @@ -0,0 +1,41 @@ +package tests + +import ( + "testing" + + bc "github.com/gallactic/hubble_server/blockchain" + config "github.com/gallactic/hubble_server/config" + "github.com/stretchr/testify/require" +) + +func TestBlockChain(t *testing.T) { + + gConfig, _ := config.LoadConfigFile(true) + bc := bc.Gallactic{Config: gConfig} + + clientErr := bc.CreateGRPCClient() + require.NoError(t, clientErr) + + updateErr := bc.Update() + require.NoError(t, updateErr) + + _, getBlockErr := bc.GetBlock(uint64(14141)) + require.NoError(t, getBlockErr) + + _, getTXsErr := bc.GetTXs(uint64(14141)) + require.NoError(t, getTXsErr) + + /* + ret1, err := bc.GetAccounts() + require.NoError(t, err) + + numAccounts := len(ret1.Accounts) + require.NotEqual(t, numAccounts, 0) + + _, err2 := client.GetGenesis(context.Background(), &pb.Empty{}) + require.NoError(t, err2) + + _, err3 := client.GetBlocks(context.Background(), &pb.BlocksRequest{}) + require.NoError(t, err3) + */ +}