diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..2048f1d1ec --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*.md] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false +max_line_length = 80 +insert_final_newline = true +charset = utf-8 +end_of_line = lf diff --git a/.gitignore b/.gitignore index 98fe00b344..5cc7d1f1b5 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ build/*.deb .bin-image .deb-image \.idea/ +__debug* \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 779d22370a..4baa49503d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -146,7 +146,7 @@ backend-deploy-and-test-bitcoin_testnet: - configs/coins/bitcoin_testnet.json tags: - blockbook - script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin_testnet bitcoin-testnet bitcoin=test testnet3/debug.log + script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin_testnet bitcoin-testnet bitcoin=test testnet3/debug.log backend-deploy-and-test-zcash_testnet: stage: backend-deploy-and-test @@ -157,15 +157,4 @@ backend-deploy-and-test-zcash_testnet: - configs/coins/zcash_testnet.json tags: - blockbook - script: ./contrib/scripts/backend-deploy-and-test.sh zcash_testnet zcash-testnet zcash=test testnet3/debug.log - -backend-deploy-and-test-ethereum_testnet_ropsten: - stage: backend-deploy-and-test - only: - refs: - - master - changes: - - configs/coins/ethereum_testnet_ropsten.json - tags: - - blockbook - script: ./contrib/scripts/backend-deploy-and-test.sh ethereum_testnet_ropsten ethereum-testnet-ropsten ethereum=test ethereum_testnet_ropsten.log + script: ./contrib/scripts/backend-deploy-and-test.sh zcash_testnet zcash-testnet zcash=test testnet3/debug.log \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..ccb2431d24 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,11 @@ +{ + "printWidth": 100, + "arrowParens": "avoid", + "bracketSpacing": true, + "singleQuote": true, + "semi": true, + "trailingComma": "all", + "tabWidth": 4, + "useTabs": false, + "bracketSameLine": false +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8dd2c2f878..43fe3f9f5b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,7 +75,7 @@ also in [build guide](/docs/build.md#on-naming-conventions-and-versioning). You *mainnet* option. In the section *blockbook* update information how to build and configure Blockbook service. Usually they are only -*package_name*, *system_user* and *explorer_url* options. Naming conventions are are described +*package_name*, *system_user* and *explorer_url* options. Naming conventions are described [here](/docs/build.md#on-naming-conventions-and-versioning). Update *package_maintainer* and *package_maintainer_email* options in the section *meta*. diff --git a/Makefile b/Makefile index dfe5b5f395..d384f37990 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ BIN_IMAGE = blockbook-build DEB_IMAGE = blockbook-build-deb PACKAGER = $(shell id -u):$(shell id -g) +DOCKER_VERSION = $(shell docker version --format '{{.Client.Version}}') BASE_IMAGE = $$(awk -F= '$$1=="ID" { print $$2 ;}' /etc/os-release):$$(awk -F= '$$1=="VERSION_ID" { print $$2 ;}' /etc/os-release | tr -d '"') NO_CACHE = false -TCMALLOC = +TCMALLOC = PORTABLE = 0 ARGS ?= @@ -27,13 +28,13 @@ test-all: .bin-image docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" --network="host" $(BIN_IMAGE) make test-all ARGS="$(ARGS)" deb-backend-%: .deb-image - docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh backend $* $(ARGS) + docker run -t --rm -e PACKAGER=$(PACKAGER) -v /var/run/docker.sock:/var/run/docker.sock -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh backend $* $(ARGS) deb-blockbook-%: .deb-image docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh blockbook $* $(ARGS) deb-%: .deb-image - docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh all $* $(ARGS) + docker run -t --rm -e PACKAGER=$(PACKAGER) -v /var/run/docker.sock:/var/run/docker.sock -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh all $* $(ARGS) deb-blockbook-all: clean-deb $(addprefix deb-blockbook-, $(TARGETS)) @@ -55,7 +56,7 @@ build-images: clean-images .deb-image: .bin-image @if [ $$(build/tools/image_status.sh $(DEB_IMAGE):latest build/docker) != "ok" ]; then \ echo "Building image $(DEB_IMAGE)..."; \ - docker build --no-cache=$(NO_CACHE) -t $(DEB_IMAGE) build/docker/deb; \ + docker build --no-cache=$(NO_CACHE) --build-arg DOCKER_VERSION=$(DOCKER_VERSION) -t $(DEB_IMAGE) build/docker/deb; \ else \ echo "Image $(DEB_IMAGE) is up to date"; \ fi @@ -79,3 +80,6 @@ clean-bin-image: clean-deb-image: - docker rmi $(DEB_IMAGE) + +style: + find . -name "*.go" -exec gofmt -w {} \; diff --git a/README.md b/README.md index 541dec0378..d5933f115a 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ # Blockbook -**Blockbook** is back-end service for Trezor wallet. Main features of **Blockbook** are: +**Blockbook** is a back-end service for Trezor Suite. The main features of **Blockbook** are: -- index of addresses and address balances of the connected block chain -- fast index search -- simple blockchain explorer -- websocket, API and legacy Bitcore Insight compatible socket.io interfaces -- support of multiple coins (Bitcoin and Ethereum type) with easy extensibility to other coins -- scripts for easy creation of debian packages for backend and blockbook +- index of addresses and address balances of the connected block chain +- fast index search +- simple blockchain explorer +- websocket, API and legacy Bitcore Insight compatible socket.io interfaces +- support of multiple coins (Bitcoin and Ethereum type) with easy extensibility to other coins +- scripts for easy creation of debian packages for backend and blockbook ## Build and installation instructions @@ -19,7 +19,7 @@ Memory and disk requirements for initial synchronization of **Bitcoin mainnet** Other coins should have lower requirements, depending on the size of their block chain. Note that fast SSD disks are highly recommended. -User installation guide is [here](https://wiki.trezor.io/User_manual:Running_a_local_instance_of_Trezor_Wallet_backend_(Blockbook)). +User installation guide is [here](). Developer build guide is [here](/docs/build.md). @@ -27,14 +27,15 @@ Contribution guide is [here](CONTRIBUTING.md). ## Implemented coins -Blockbook currently supports over 30 coins. The Trezor team implemented +Blockbook currently supports over 30 coins. The Trezor team implemented -- Bitcoin, Bitcoin Cash, Zcash, Dash, Litecoin, Bitcoin Gold, Ethereum, Ethereum Classic, Dogecoin, Namecoin, Vertcoin, DigiByte, Liquid +- Bitcoin, Bitcoin Cash, Zcash, Dash, Litecoin, Bitcoin Gold, Ethereum, Ethereum Classic, Dogecoin, Namecoin, Vertcoin, DigiByte, Liquid the rest of coins were implemented by the community. Testnets for some coins are also supported, for example: -- Bitcoin Testnet, Bitcoin Cash Testnet, ZCash Testnet, Ethereum Testnet Ropsten + +- Bitcoin Testnet, Bitcoin Cash Testnet, ZCash Testnet, Ethereum Testnets (Sepolia, Hoodi) List of all implemented coins is in [the registry of ports](/docs/ports.md). @@ -42,19 +43,19 @@ List of all implemented coins is in [the registry of ports](/docs/ports.md). #### Out of memory when doing initial synchronization -How to reduce memory footprint of the initial sync: +How to reduce memory footprint of the initial sync: -- disable rocksdb cache by parameter `-dbcache=0`, the default size is 500MB -- run blockbook with parameter `-workers=1`. This disables bulk import mode, which caches a lot of data in memory (not in rocksdb cache). It will run about twice as slowly but especially for smaller blockchains it is no problem at all. +- disable rocksdb cache by parameter `-dbcache=0`, the default size is 500MB +- run blockbook with parameter `-workers=1`. This disables bulk import mode, which caches a lot of data in memory (not in rocksdb cache). It will run about twice as slowly but especially for smaller blockchains it is no problem at all. Please add your experience to this [issue](https://github.com/trezor/blockbook/issues/43). #### Error `internalState: database is in inconsistent state and cannot be used` -Blockbook was killed during the initial import, most commonly by OOM killer. -By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all data immediately to the database. If Blockbook is killed during this phase, the database is left in an inconsistent state. +Blockbook was killed during the initial import, most commonly by OOM killer. +By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all data immediately to the database. If Blockbook is killed during this phase, the database is left in an inconsistent state. -See above how to reduce the memory footprint, delete the database files and run the import again. +See above how to reduce the memory footprint, delete the database files and run the import again. Check [this](https://github.com/trezor/blockbook/issues/89) or [this](https://github.com/trezor/blockbook/issues/147) issue for more info. @@ -66,16 +67,6 @@ Check [this](https://github.com/trezor/blockbook/issues/89) or [this](https://gi Your coin's block/transaction data may not be compatible with `BitcoinParser` `ParseBlock`/`ParseTx`, which is used by default. In that case, implement your coin in a similar way we used in case of [zcash](https://github.com/trezor/blockbook/tree/master/bchain/coins/zec) and some other coins. The principle is not to parse the block/transaction data in Blockbook but instead to get parsed transactions as json from the backend. -#### Cannot build Blockbook using `go build` command - -When building Blockbook I get error `not enough arguments in call to _Cfunc_rocksdb_approximate_sizes`. - -RocksDB version 6.16.0 changed the API in a backwards incompatible way. It is necessary to build Blockbook with the `rocksdb_6_16` tag to fix the compatibility problem. The correct way to build Blockbook is: - -``` -go build -tags rocksdb_6_16 -``` - ## Data storage in RocksDB Blockbook stores data the key-value store RocksDB. Database format is described [here](/docs/rocksdb.md). @@ -83,3 +74,7 @@ Blockbook stores data the key-value store RocksDB. Database format is described ## API Blockbook API is described [here](/docs/api.md). + +## Environment variables + +List of environment variables that affect Blockbook's behavior is [here](/docs/env.md). diff --git a/api/embed/about b/api/embed/about index 71c44dc9b0..79156218b0 100644 --- a/api/embed/about +++ b/api/embed/about @@ -1 +1 @@ -Blockbook - blockchain indexer for Trezor wallet https://trezor.io/. Do not use for any other purpose. +Blockbook - blockchain indexer for Trezor Suite https://trezor.io/trezor-suite. Do not use for any other purpose. diff --git a/api/embed/tos_link b/api/embed/tos_link index 9b16245e61..8c90089b92 100644 --- a/api/embed/tos_link +++ b/api/embed/tos_link @@ -1 +1 @@ -https://shop.trezor.io/static/shared/about/terms-of-use.pdf +https://trezor.io/terms-of-use diff --git a/api/ethereumtype.go b/api/ethereumtype.go new file mode 100644 index 0000000000..1f98f2eea0 --- /dev/null +++ b/api/ethereumtype.go @@ -0,0 +1,92 @@ +package api + +import ( + "sync" + + "github.com/golang/glog" + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/db" +) + +// refetch internal data +var refetchingInternalData = false +var refetchInternalDataMux sync.Mutex + +func (w *Worker) IsRefetchingInternalData() bool { + refetchInternalDataMux.Lock() + defer refetchInternalDataMux.Unlock() + return refetchingInternalData +} + +func (w *Worker) RefetchInternalData() error { + refetchInternalDataMux.Lock() + defer refetchInternalDataMux.Unlock() + if !refetchingInternalData { + refetchingInternalData = true + go w.RefetchInternalDataRoutine() + } + return nil +} + +const maxNumberOfRetires = 25 + +func (w *Worker) incrementRefetchInternalDataRetryCount(ie *db.BlockInternalDataError) { + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + err := w.db.StoreBlockInternalDataErrorEthereumType(wb, &bchain.Block{ + BlockHeader: bchain.BlockHeader{ + Hash: ie.Hash, + Height: ie.Height, + }, + }, ie.ErrorMessage, ie.Retries+1) + if err != nil { + glog.Errorf("StoreBlockInternalDataErrorEthereumType %d %s, error %v", ie.Height, ie.Hash, err) + } else { + w.db.WriteBatch(wb) + } +} + +func (w *Worker) RefetchInternalDataRoutine() { + internalErrors, err := w.db.GetBlockInternalDataErrorsEthereumType() + if err == nil { + for i := range internalErrors { + ie := &internalErrors[i] + if ie.Retries >= maxNumberOfRetires { + glog.Infof("Refetching internal data for %d %s, retries exceeded", ie.Height, ie.Hash) + continue + } + glog.Infof("Refetching internal data for %d %s, retries %d", ie.Height, ie.Hash, ie.Retries) + block, err := w.chain.GetBlock(ie.Hash, ie.Height) + var blockSpecificData *bchain.EthereumBlockSpecificData + if block != nil { + blockSpecificData, _ = block.CoinSpecificData.(*bchain.EthereumBlockSpecificData) + } + if err != nil || block == nil || (blockSpecificData != nil && blockSpecificData.InternalDataError != "") { + glog.Errorf("Refetching internal data for %d %s, error %v, retrying", ie.Height, ie.Hash, err) + // try for second time to fetch the data - the 2nd attempt after the first unsuccessful has many times higher probability of success + // probably something to do with data preloaded to cache on the backend + block, err = w.chain.GetBlock(ie.Hash, ie.Height) + if err != nil || block == nil { + glog.Errorf("Refetching internal data for %d %s, error %v", ie.Height, ie.Hash, err) + continue + } + } + blockSpecificData, _ = block.CoinSpecificData.(*bchain.EthereumBlockSpecificData) + if blockSpecificData != nil && blockSpecificData.InternalDataError != "" { + glog.Errorf("Refetching internal data for %d %s, internal data error %v", ie.Height, ie.Hash, blockSpecificData.InternalDataError) + w.incrementRefetchInternalDataRetryCount(ie) + } else { + err = w.db.ReconnectInternalDataToBlockEthereumType(block) + if err != nil { + glog.Errorf("ReconnectInternalDataToBlockEthereumType %d %s, error %v", ie.Height, ie.Hash, err) + } else { + glog.Infof("Refetching internal data for %d %s, success", ie.Height, ie.Hash) + } + } + } + } + refetchInternalDataMux.Lock() + refetchingInternalData = false + refetchInternalDataMux.Unlock() +} diff --git a/api/types.go b/api/types.go index eb0fad76aa..3a0fe913d2 100644 --- a/api/types.go +++ b/api/types.go @@ -3,8 +3,10 @@ package api import ( "encoding/json" "errors" + "fmt" "math/big" "sort" + "strings" "time" "github.com/trezor/blockbook/bchain" @@ -40,8 +42,8 @@ var ErrUnsupportedXpub = errors.New("XPUB not supported") // APIError extends error by information if the error details should be returned to the end user type APIError struct { - Text string - Public bool + Text string `ts_doc:"Human-readable error message describing the issue."` + Public bool `ts_doc:"Whether the error message can safely be shown to the end user."` } func (e *APIError) Error() string { @@ -56,14 +58,29 @@ func NewAPIError(s string, public bool) error { } } -// Amount is datatype holding amounts +// Amount is a datatype holding amounts type Amount big.Int -// IsZeroBigInt if big int has zero value +// IsZeroBigInt checks if big int has zero value func IsZeroBigInt(b *big.Int) bool { return len(b.Bits()) == 0 } +// Compare returns an integer comparing two Amounts. The result will be 0 if a == b, -1 if a < b, and +1 if a > b. +// Nil Amount is always less then non-nil amount, two nil Amounts are equal +func (a *Amount) Compare(b *Amount) int { + if b == nil { + if a == nil { + return 0 + } + return 1 + } + if a == nil { + return -1 + } + return (*big.Int)(a).Cmp((*big.Int)(b)) +} + // MarshalJSON Amount serialization func (a *Amount) MarshalJSON() (out []byte, err error) { if a == nil { @@ -72,6 +89,21 @@ func (a *Amount) MarshalJSON() (out []byte, err error) { return []byte(`"` + (*big.Int)(a).String() + `"`), nil } +func (a *Amount) UnmarshalJSON(data []byte) error { + s := strings.Trim(string(data), "\"") + if len(s) > 0 { + bigValue, parsed := new(big.Int).SetString(s, 10) + if !parsed { + return fmt.Errorf("couldn't parse number: %s", s) + } + *a = Amount(*bigValue) + } else { + // assuming empty string means zero + *a = Amount{} + } + return nil +} + func (a *Amount) String() string { if a == nil { return "" @@ -104,118 +136,184 @@ func (a *Amount) AsInt64() int64 { // Vin contains information about single transaction input type Vin struct { - Txid string `json:"txid,omitempty"` - Vout uint32 `json:"vout,omitempty"` - Sequence int64 `json:"sequence,omitempty"` - N int `json:"n"` - AddrDesc bchain.AddressDescriptor `json:"-"` - Addresses []string `json:"addresses,omitempty"` - IsAddress bool `json:"isAddress"` - IsOwn bool `json:"isOwn,omitempty"` - ValueSat *Amount `json:"value,omitempty"` - Hex string `json:"hex,omitempty"` - Asm string `json:"asm,omitempty"` - Coinbase string `json:"coinbase,omitempty"` + Txid string `json:"txid,omitempty" ts_doc:"ID/hash of the originating transaction (where the UTXO comes from)."` + Vout uint32 `json:"vout,omitempty" ts_doc:"Index of the output in the referenced transaction."` + Sequence int64 `json:"sequence,omitempty" ts_doc:"Sequence number for this input (e.g. 4294967293)."` + N int `json:"n" ts_doc:"Relative index of this input within the transaction."` + AddrDesc bchain.AddressDescriptor `json:"-" ts_doc:"Internal address descriptor for backend usage (not exposed via JSON)."` + Addresses []string `json:"addresses,omitempty" ts_doc:"List of addresses associated with this input."` + IsAddress bool `json:"isAddress" ts_doc:"Indicates if this input is from a known address."` + IsOwn bool `json:"isOwn,omitempty" ts_doc:"Indicates if this input belongs to the wallet in context."` + ValueSat *Amount `json:"value,omitempty" ts_doc:"Amount (in satoshi or base units) of the input."` + Hex string `json:"hex,omitempty" ts_doc:"Raw script hex data for this input."` + Asm string `json:"asm,omitempty" ts_doc:"Disassembled script for this input."` + Coinbase string `json:"coinbase,omitempty" ts_doc:"Data for coinbase inputs (when mining)."` } // Vout contains information about single transaction output type Vout struct { - ValueSat *Amount `json:"value,omitempty"` - N int `json:"n"` - Spent bool `json:"spent,omitempty"` - SpentTxID string `json:"spentTxId,omitempty"` - SpentIndex int `json:"spentIndex,omitempty"` - SpentHeight int `json:"spentHeight,omitempty"` - Hex string `json:"hex,omitempty"` - Asm string `json:"asm,omitempty"` - AddrDesc bchain.AddressDescriptor `json:"-"` - Addresses []string `json:"addresses"` - IsAddress bool `json:"isAddress"` - IsOwn bool `json:"isOwn,omitempty"` - Type string `json:"type,omitempty"` -} - -// TokenType specifies type of token -type TokenType string - -// ERC20TokenType is Ethereum ERC20 token -const ERC20TokenType TokenType = "ERC20" - -// XPUBAddressTokenType is address derived from xpub -const XPUBAddressTokenType TokenType = "XPUBAddress" + ValueSat *Amount `json:"value,omitempty" ts_doc:"Amount (in satoshi or base units) of the output."` + N int `json:"n" ts_doc:"Relative index of this output within the transaction."` + Spent bool `json:"spent,omitempty" ts_doc:"Indicates whether this output has been spent."` + SpentTxID string `json:"spentTxId,omitempty" ts_doc:"Transaction ID in which this output was spent."` + SpentIndex int `json:"spentIndex,omitempty" ts_doc:"Index of the input that spent this output."` + SpentHeight int `json:"spentHeight,omitempty" ts_doc:"Block height at which this output was spent."` + Hex string `json:"hex,omitempty" ts_doc:"Raw script hex data for this output - aka ScriptPubKey."` + Asm string `json:"asm,omitempty" ts_doc:"Disassembled script for this output."` + AddrDesc bchain.AddressDescriptor `json:"-" ts_doc:"Internal address descriptor for backend usage (not exposed via JSON)."` + Addresses []string `json:"addresses" ts_doc:"List of addresses associated with this output."` + IsAddress bool `json:"isAddress" ts_doc:"Indicates whether this output is owned by valid address."` + IsOwn bool `json:"isOwn,omitempty" ts_doc:"Indicates if this output belongs to the wallet in context."` + Type string `json:"type,omitempty" ts_doc:"Output script type (e.g., 'P2PKH', 'P2SH')."` +} + +// MultiTokenValue contains values for contracts with multiple token IDs +type MultiTokenValue struct { + Id *Amount `json:"id,omitempty" ts_doc:"Token ID (for ERC1155)."` + Value *Amount `json:"value,omitempty" ts_doc:"Amount of that specific token ID."` +} // Token contains info about tokens held by an address type Token struct { - Type TokenType `json:"type"` - Name string `json:"name"` - Path string `json:"path,omitempty"` - Contract string `json:"contract,omitempty"` - Transfers int `json:"transfers"` - Symbol string `json:"symbol,omitempty"` - Decimals int `json:"decimals,omitempty"` - BalanceSat *Amount `json:"balance,omitempty"` - TotalReceivedSat *Amount `json:"totalReceived,omitempty"` - TotalSentSat *Amount `json:"totalSent,omitempty"` - ContractIndex string `json:"-"` + // Deprecated: Use Standard instead. + Type bchain.TokenStandardName `json:"type" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'" ts_doc:"@deprecated: Use standard instead."` + Standard bchain.TokenStandardName `json:"standard" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'"` + Name string `json:"name" ts_doc:"Readable name of the token."` + Path string `json:"path,omitempty" ts_doc:"Derivation path if this token is derived from an XPUB-based address."` + Contract string `json:"contract,omitempty" ts_doc:"Contract address on-chain."` + Transfers int `json:"transfers" ts_doc:"Total number of token transfers for this address."` + Symbol string `json:"symbol,omitempty" ts_doc:"Symbol for the token (e.g., 'ETH', 'USDT')."` + Decimals int `json:"decimals,omitempty" ts_doc:"Number of decimals for this token."` + BalanceSat *Amount `json:"balance,omitempty" ts_doc:"Current token balance (in minimal base units)."` + BaseValue float64 `json:"baseValue,omitempty" ts_doc:"Value in the base currency (e.g. ETH for ERC20 tokens)."` + SecondaryValue float64 `json:"secondaryValue,omitempty" ts_doc:"Value in a secondary currency (e.g. fiat), if available."` + Ids []Amount `json:"ids,omitempty" ts_doc:"List of token IDs (for ERC721, each ID is a unique collectible)."` + MultiTokenValues []MultiTokenValue `json:"multiTokenValues,omitempty" ts_doc:"Multiple ERC1155 token balances (id + value)."` + TotalReceivedSat *Amount `json:"totalReceived,omitempty" ts_doc:"Total amount of tokens received."` + TotalSentSat *Amount `json:"totalSent,omitempty" ts_doc:"Total amount of tokens sent."` + ContractIndex string `json:"-"` +} + +// Tokens is array of Token +type Tokens []Token + +func (a Tokens) Len() int { return len(a) } +func (a Tokens) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a Tokens) Less(i, j int) bool { + ti := &a[i] + tj := &a[j] + // sort by BaseValue descending and then Name and then by Contract + if ti.BaseValue < tj.BaseValue { + return false + } else if ti.BaseValue > tj.BaseValue { + return true + } + if ti.Name == "" { + if tj.Name != "" { + return false + } + } else { + if tj.Name == "" { + return true + } + return ti.Name < tj.Name + } + return ti.Contract < tj.Contract } // TokenTransfer contains info about a token transfer done in a transaction type TokenTransfer struct { - Type TokenType `json:"type"` - From string `json:"from"` - To string `json:"to"` - Token string `json:"token"` - Name string `json:"name"` - Symbol string `json:"symbol"` - Decimals int `json:"decimals"` - Value *Amount `json:"value"` -} - -// EthereumSpecific contains ethereum specific transaction data + // Deprecated: Use Standard instead. + Type bchain.TokenStandardName `json:"type" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'" ts_doc:"@deprecated: Use standard instead."` + Standard bchain.TokenStandardName `json:"standard" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'"` + From string `json:"from" ts_doc:"Source address of the token transfer."` + To string `json:"to" ts_doc:"Destination address of the token transfer."` + Contract string `json:"contract" ts_doc:"Contract address of the token."` + Name string `json:"name,omitempty" ts_doc:"Token name."` + Symbol string `json:"symbol,omitempty" ts_doc:"Token symbol."` + Decimals int `json:"decimals,omitempty" ts_doc:"Number of decimals for this token (if applicable)."` + Value *Amount `json:"value,omitempty" ts_doc:"Amount (in base units) of tokens transferred."` + MultiTokenValues []MultiTokenValue `json:"multiTokenValues,omitempty" ts_doc:"List of multiple ID-value pairs for ERC1155 transfers."` +} + +// EthereumInternalTransfer represents internal transaction data in Ethereum-like blockchains +type EthereumInternalTransfer struct { + Type bchain.EthereumInternalTransactionType `json:"type" ts_doc:"Type of internal transfer (CALL, CREATE, etc.)."` + From string `json:"from" ts_doc:"Address from which the transfer originated."` + To string `json:"to" ts_doc:"Address to which the transfer was sent."` + Value *Amount `json:"value" ts_doc:"Value transferred internally (in Wei or base units)."` +} + +// EthereumSpecific contains ethereum-specific transaction data type EthereumSpecific struct { - Status eth.TxStatus `json:"status"` // 1 OK, 0 Fail, -1 pending - Nonce uint64 `json:"nonce"` - GasLimit *big.Int `json:"gasLimit"` - GasUsed *big.Int `json:"gasUsed"` - GasPrice *Amount `json:"gasPrice"` - Data string `json:"data,omitempty"` -} + Type bchain.EthereumInternalTransactionType `json:"type,omitempty" ts_doc:"High-level type of the Ethereum tx (e.g., 'call', 'create')."` + CreatedContract string `json:"createdContract,omitempty" ts_doc:"Address of contract created by this transaction, if any."` + Status eth.TxStatus `json:"status" ts_doc:"Execution status of the transaction (1: success, 0: fail, -1: pending)."` + Error string `json:"error,omitempty" ts_doc:"Error encountered during execution, if any."` + Nonce uint64 `json:"nonce" ts_doc:"Transaction nonce (sequential number from the sender)."` + GasLimit *big.Int `json:"gasLimit" ts_doc:"Maximum gas allowed by the sender for this transaction."` + GasUsed *big.Int `json:"gasUsed,omitempty" ts_doc:"Actual gas consumed by the transaction execution."` + GasPrice *Amount `json:"gasPrice,omitempty" ts_doc:"Price (in Wei or base units) per gas unit."` + MaxPriorityFeePerGas *Amount `json:"maxPriorityFeePerGas,omitempty"` + MaxFeePerGas *Amount `json:"maxFeePerGas,omitempty"` + BaseFeePerGas *Amount `json:"baseFeePerGas,omitempty"` + L1Fee *big.Int `json:"l1Fee,omitempty" ts_doc:"Fee used for L1 part in rollups (e.g. Optimism)."` + L1FeeScalar string `json:"l1FeeScalar,omitempty" ts_doc:"Scaling factor for L1 fees in certain Layer 2 solutions."` + L1GasPrice *Amount `json:"l1GasPrice,omitempty" ts_doc:"Gas price for L1 component, if applicable."` + L1GasUsed *big.Int `json:"l1GasUsed,omitempty" ts_doc:"Amount of gas used in L1 for this tx, if applicable."` + Data string `json:"data,omitempty" ts_doc:"Hex-encoded input data for the transaction."` + ParsedData *bchain.EthereumParsedInputData `json:"parsedData,omitempty" ts_doc:"Decoded transaction data (function name, params, etc.)."` + InternalTransfers []EthereumInternalTransfer `json:"internalTransfers,omitempty" ts_doc:"List of internal (sub-call) transfers."` +} + +// AddressAlias holds a specialized alias for an address +type AddressAlias struct { + Type string `ts_doc:"Type of alias, e.g., user-defined name or contract name."` + Alias string `ts_doc:"Alias string for the address."` +} + +// AddressAliasesMap is a map of address strings to their alias definitions +type AddressAliasesMap map[string]AddressAlias // Tx holds information about a transaction type Tx struct { - Txid string `json:"txid"` - Version int32 `json:"version,omitempty"` - Locktime uint32 `json:"lockTime,omitempty"` - Vin []Vin `json:"vin"` - Vout []Vout `json:"vout"` - Blockhash string `json:"blockHash,omitempty"` - Blockheight int `json:"blockHeight"` - Confirmations uint32 `json:"confirmations"` - Blocktime int64 `json:"blockTime"` - Size int `json:"size,omitempty"` - ValueOutSat *Amount `json:"value"` - ValueInSat *Amount `json:"valueIn,omitempty"` - FeesSat *Amount `json:"fees,omitempty"` - Hex string `json:"hex,omitempty"` - Rbf bool `json:"rbf,omitempty"` - CoinSpecificData json.RawMessage `json:"coinSpecificData,omitempty"` - TokenTransfers []TokenTransfer `json:"tokenTransfers,omitempty"` - EthereumSpecific *EthereumSpecific `json:"ethereumSpecific,omitempty"` + Txid string `json:"txid" ts_doc:"Transaction ID (hash)."` + Version int32 `json:"version,omitempty" ts_doc:"Version of the transaction (if applicable)."` + Locktime uint32 `json:"lockTime,omitempty" ts_doc:"Locktime indicating earliest time/height transaction can be mined."` + Vin []Vin `json:"vin" ts_doc:"Array of inputs for this transaction."` + Vout []Vout `json:"vout" ts_doc:"Array of outputs for this transaction."` + Blockhash string `json:"blockHash,omitempty" ts_doc:"Hash of the block containing this transaction."` + Blockheight int `json:"blockHeight" ts_doc:"Block height in which this transaction was included."` + Confirmations uint32 `json:"confirmations" ts_doc:"Number of confirmations (blocks mined after this tx's block)."` + ConfirmationETABlocks uint32 `json:"confirmationETABlocks,omitempty" ts_doc:"Estimated blocks remaining until confirmation (if unconfirmed)."` + ConfirmationETASeconds int64 `json:"confirmationETASeconds,omitempty" ts_doc:"Estimated seconds remaining until confirmation (if unconfirmed)."` + Blocktime int64 `json:"blockTime" ts_doc:"Unix timestamp of the block in which this transaction was included. 0 if unconfirmed."` + Size int `json:"size,omitempty" ts_doc:"Transaction size in bytes."` + VSize int `json:"vsize,omitempty" ts_doc:"Virtual size in bytes, for SegWit-enabled chains."` + ValueOutSat *Amount `json:"value" ts_doc:"Total value of all outputs (in satoshi or base units)."` + ValueInSat *Amount `json:"valueIn,omitempty" ts_doc:"Total value of all inputs (in satoshi or base units)."` + FeesSat *Amount `json:"fees,omitempty" ts_doc:"Transaction fee (inputs - outputs)."` + Hex string `json:"hex,omitempty" ts_doc:"Raw hex-encoded transaction data."` + Rbf bool `json:"rbf,omitempty" ts_doc:"Indicates if this transaction is replace-by-fee (RBF) enabled."` + CoinSpecificData json.RawMessage `json:"coinSpecificData,omitempty" ts_type:"any" ts_doc:"Blockchain-specific extended data."` + TokenTransfers []TokenTransfer `json:"tokenTransfers,omitempty" ts_doc:"List of token transfers that occurred in this transaction."` + EthereumSpecific *EthereumSpecific `json:"ethereumSpecific,omitempty" ts_doc:"Ethereum-like blockchain specific data (if applicable)."` + AddressAliases AddressAliasesMap `json:"addressAliases,omitempty" ts_doc:"Aliases for addresses involved in this transaction."` } // FeeStats contains detailed block fee statistics type FeeStats struct { - TxCount int `json:"txCount"` - TotalFeesSat *Amount `json:"totalFeesSat"` - AverageFeePerKb int64 `json:"averageFeePerKb"` - DecilesFeePerKb [11]int64 `json:"decilesFeePerKb"` + TxCount int `json:"txCount" ts_doc:"Number of transactions in the given block."` + TotalFeesSat *Amount `json:"totalFeesSat" ts_doc:"Sum of all fees in satoshi or base units."` + AverageFeePerKb int64 `json:"averageFeePerKb" ts_doc:"Average fee per kilobyte in satoshi or base units."` + DecilesFeePerKb [11]int64 `json:"decilesFeePerKb" ts_doc:"Fee distribution deciles (0%..100%) in satoshi or base units per kB."` } // Paging contains information about paging for address, blocks and block type Paging struct { - Page int `json:"page,omitempty"` - TotalPages int `json:"totalPages,omitempty"` - ItemsOnPage int `json:"itemsOnPage,omitempty"` + Page int `json:"page,omitempty" ts_doc:"Current page index."` + TotalPages int `json:"totalPages,omitempty" ts_doc:"Total number of pages available."` + ItemsOnPage int `json:"itemsOnPage,omitempty" ts_doc:"Number of items returned on this page."` } // TokensToReturn specifies what tokens are returned by GetAddress and GetXpubAddress @@ -241,48 +339,74 @@ const ( // AddressFilter is used to filter data returned from GetAddress api method type AddressFilter struct { - Vout int - Contract string - FromHeight uint32 - ToHeight uint32 - TokensToReturn TokensToReturn + Vout int `ts_doc:"Specifies which output index we are interested in filtering (or use the special constants)."` + Contract string `ts_doc:"Contract address to filter by, if applicable."` + FromHeight uint32 `ts_doc:"Starting block height for filtering transactions."` + ToHeight uint32 `ts_doc:"Ending block height for filtering transactions."` + TokensToReturn TokensToReturn `ts_doc:"Which tokens to include in the result set."` // OnlyConfirmed set to true will ignore mempool transactions; mempool is also ignored if FromHeight/ToHeight filter is specified - OnlyConfirmed bool + OnlyConfirmed bool `ts_doc:"If true, ignores mempool (unconfirmed) transactions."` +} + +// StakingPool holds data about address participation in a staking pool contract +type StakingPool struct { + Contract string `json:"contract" ts_doc:"Staking pool contract address on-chain."` + Name string `json:"name" ts_doc:"Name of the staking pool contract."` + PendingBalance *Amount `json:"pendingBalance" ts_doc:"Balance pending deposit or withdrawal, if any."` + PendingDepositedBalance *Amount `json:"pendingDepositedBalance" ts_doc:"Any pending deposit that is not yet finalized."` + DepositedBalance *Amount `json:"depositedBalance" ts_doc:"Currently deposited/staked balance."` + WithdrawTotalAmount *Amount `json:"withdrawTotalAmount" ts_doc:"Total amount withdrawn from this pool by the address."` + ClaimableAmount *Amount `json:"claimableAmount" ts_doc:"Rewards or principal currently claimable by the address."` + RestakedReward *Amount `json:"restakedReward" ts_doc:"Total rewards that have been restaked automatically."` + AutocompoundBalance *Amount `json:"autocompoundBalance" ts_doc:"Any balance automatically reinvested into the pool."` } -// Address holds information about address and its transactions +// Address holds information about an address and its transactions type Address struct { Paging - AddrStr string `json:"address"` - BalanceSat *Amount `json:"balance"` - TotalReceivedSat *Amount `json:"totalReceived,omitempty"` - TotalSentSat *Amount `json:"totalSent,omitempty"` - UnconfirmedBalanceSat *Amount `json:"unconfirmedBalance"` - UnconfirmedTxs int `json:"unconfirmedTxs"` - Txs int `json:"txs"` - NonTokenTxs int `json:"nonTokenTxs,omitempty"` - Transactions []*Tx `json:"transactions,omitempty"` - Txids []string `json:"txids,omitempty"` - Nonce string `json:"nonce,omitempty"` - UsedTokens int `json:"usedTokens,omitempty"` - Tokens []Token `json:"tokens,omitempty"` - Erc20Contract *bchain.Erc20Contract `json:"erc20Contract,omitempty"` + AddrStr string `json:"address" ts_doc:"The address string in standard format."` + BalanceSat *Amount `json:"balance" ts_doc:"Current confirmed balance (in satoshi or base units)."` + TotalReceivedSat *Amount `json:"totalReceived,omitempty" ts_doc:"Total amount ever received by this address."` + TotalSentSat *Amount `json:"totalSent,omitempty" ts_doc:"Total amount ever sent by this address."` + UnconfirmedBalanceSat *Amount `json:"unconfirmedBalance" ts_doc:"Unconfirmed balance for this address."` + UnconfirmedTxs int `json:"unconfirmedTxs" ts_doc:"Number of unconfirmed transactions for this address."` + UnconfirmedSending *Amount `json:"unconfirmedSending,omitempty" ts_doc:"Unconfirmed outgoing balance for this address."` + UnconfirmedReceiving *Amount `json:"unconfirmedReceiving,omitempty" ts_doc:"Unconfirmed incoming balance for this address."` + Txs int `json:"txs" ts_doc:"Number of transactions for this address (including confirmed)."` + AddrTxCount int `json:"addrTxCount,omitempty" ts_doc:"Historical total count of transactions, if known."` + NonTokenTxs int `json:"nonTokenTxs,omitempty" ts_doc:"Number of transactions not involving tokens (pure coin transfers)."` + InternalTxs int `json:"internalTxs,omitempty" ts_doc:"Number of internal transactions (e.g., Ethereum calls)."` + Transactions []*Tx `json:"transactions,omitempty" ts_doc:"List of transaction details (if requested)."` + Txids []string `json:"txids,omitempty" ts_doc:"List of transaction IDs (if detailed data is not requested)."` + Nonce string `json:"nonce,omitempty" ts_doc:"Current transaction nonce for Ethereum-like addresses."` + UsedTokens int `json:"usedTokens,omitempty" ts_doc:"Number of tokens with any historical usage at this address."` + Tokens Tokens `json:"tokens,omitempty" ts_doc:"List of tokens associated with this address."` + SecondaryValue float64 `json:"secondaryValue,omitempty" ts_doc:"Total value of the address in secondary currency (e.g. fiat)."` + TokensBaseValue float64 `json:"tokensBaseValue,omitempty" ts_doc:"Sum of token values in base currency."` + TokensSecondaryValue float64 `json:"tokensSecondaryValue,omitempty" ts_doc:"Sum of token values in secondary currency (fiat)."` + TotalBaseValue float64 `json:"totalBaseValue,omitempty" ts_doc:"Address's entire value in base currency, including tokens."` + TotalSecondaryValue float64 `json:"totalSecondaryValue,omitempty" ts_doc:"Address's entire value in secondary currency, including tokens."` + ContractInfo *bchain.ContractInfo `json:"contractInfo,omitempty" ts_doc:"Extra info if the address is a contract (ABI, type)."` + // Deprecated: replaced by ContractInfo + Erc20Contract *bchain.ContractInfo `json:"erc20Contract,omitempty" ts_doc:"@deprecated: replaced by contractInfo"` + AddressAliases AddressAliasesMap `json:"addressAliases,omitempty" ts_doc:"Aliases assigned to this address."` + StakingPools []StakingPool `json:"stakingPools,omitempty" ts_doc:"List of staking pool data if address interacts with staking."` // helpers for explorer - Filter string `json:"-"` - XPubAddresses map[string]struct{} `json:"-"` + Filter string `json:"-" ts_doc:"Filter used internally for data retrieval."` + XPubAddresses map[string]struct{} `json:"-" ts_doc:"Set of derived XPUB addresses (internal usage)."` } // Utxo is one unspent transaction output type Utxo struct { - Txid string `json:"txid"` - Vout int32 `json:"vout"` - AmountSat *Amount `json:"value"` - Height int `json:"height,omitempty"` - Confirmations int `json:"confirmations"` - Address string `json:"address,omitempty"` - Path string `json:"path,omitempty"` - Locktime uint32 `json:"lockTime,omitempty"` - Coinbase bool `json:"coinbase,omitempty"` + Txid string `json:"txid" ts_doc:"Transaction ID in which this UTXO was created."` + Vout int32 `json:"vout" ts_doc:"Index of the output in that transaction."` + AmountSat *Amount `json:"value" ts_doc:"Value of this UTXO (in satoshi or base units)."` + Height int `json:"height,omitempty" ts_doc:"Block height in which the UTXO was confirmed."` + Confirmations int `json:"confirmations" ts_doc:"Number of confirmations for this UTXO."` + Address string `json:"address,omitempty" ts_doc:"Address to which this UTXO belongs."` + Path string `json:"path,omitempty" ts_doc:"Derivation path for XPUB-based wallets, if applicable."` + Locktime uint32 `json:"lockTime,omitempty" ts_doc:"If non-zero, locktime required before spending this UTXO."` + Coinbase bool `json:"coinbase,omitempty" ts_doc:"Indicates if this UTXO originated from a coinbase transaction."` } // Utxos is array of Utxo @@ -305,13 +429,13 @@ func (a Utxos) Less(i, j int) bool { // BalanceHistory contains info about one point in time of balance history type BalanceHistory struct { - Time uint32 `json:"time"` - Txs uint32 `json:"txs"` - ReceivedSat *Amount `json:"received"` - SentSat *Amount `json:"sent"` - SentToSelfSat *Amount `json:"sentToSelf"` - FiatRates map[string]float64 `json:"rates,omitempty"` - Txid string `json:"txid,omitempty"` + Time uint32 `json:"time" ts_doc:"Unix timestamp for this point in the balance history."` + Txs uint32 `json:"txs" ts_doc:"Number of transactions in this interval."` + ReceivedSat *Amount `json:"received" ts_doc:"Amount received in this interval (in satoshi or base units)."` + SentSat *Amount `json:"sent" ts_doc:"Amount sent in this interval (in satoshi or base units)."` + SentToSelfSat *Amount `json:"sentToSelf" ts_doc:"Amount sent to the same address (self-transfer)."` + FiatRates map[string]float32 `json:"rates,omitempty" ts_doc:"Exchange rates at this point in time, if available."` + Txid string `json:"txid,omitempty" ts_doc:"Transaction ID if the time corresponds to a specific tx."` } // BalanceHistories is array of BalanceHistory @@ -373,76 +497,131 @@ func (a BalanceHistories) SortAndAggregate(groupByTime uint32) BalanceHistories // Blocks is list of blocks with paging information type Blocks struct { Paging - Blocks []db.BlockInfo `json:"blocks"` + Blocks []db.BlockInfo `json:"blocks" ts_doc:"List of blocks."` } // BlockInfo contains extended block header data and a list of block txids type BlockInfo struct { - Hash string `json:"hash"` - Prev string `json:"previousBlockHash,omitempty"` - Next string `json:"nextBlockHash,omitempty"` - Height uint32 `json:"height"` - Confirmations int `json:"confirmations"` - Size int `json:"size"` - Time int64 `json:"time,omitempty"` - Version common.JSONNumber `json:"version"` - MerkleRoot string `json:"merkleRoot"` - Nonce string `json:"nonce"` - Bits string `json:"bits"` - Difficulty string `json:"difficulty"` - Txids []string `json:"tx,omitempty"` + Hash string `json:"hash" ts_doc:"Block hash."` + Prev string `json:"previousBlockHash,omitempty" ts_doc:"Hash of the previous block in the chain."` + Next string `json:"nextBlockHash,omitempty" ts_doc:"Hash of the next block, if known."` + Height uint32 `json:"height" ts_doc:"Block height (0-based index in the chain)."` + Confirmations int `json:"confirmations" ts_doc:"Number of confirmations of this block (distance from best chain tip)."` + Size int `json:"size" ts_doc:"Size of the block in bytes."` + Time int64 `json:"time,omitempty" ts_doc:"Timestamp of when this block was mined."` + Version common.JSONNumber `json:"version" ts_doc:"Block version (chain-specific meaning)."` + MerkleRoot string `json:"merkleRoot" ts_doc:"Merkle root of the block's transactions."` + Nonce string `json:"nonce" ts_doc:"Nonce used in the mining process."` + Bits string `json:"bits" ts_doc:"Compact representation of the target threshold."` + Difficulty string `json:"difficulty" ts_doc:"Difficulty target for mining this block."` + Txids []string `json:"tx,omitempty" ts_doc:"List of transaction IDs included in this block."` } // Block contains information about block type Block struct { Paging BlockInfo - TxCount int `json:"txCount"` - Transactions []*Tx `json:"txs,omitempty"` + TxCount int `json:"txCount" ts_doc:"Total count of transactions in this block."` + Transactions []*Tx `json:"txs,omitempty" ts_doc:"List of full transaction details (if requested)."` + AddressAliases AddressAliasesMap `json:"addressAliases,omitempty" ts_doc:"Optional aliases for addresses found in this block."` } // BlockRaw contains raw block in hex type BlockRaw struct { - Hex string `json:"hex"` + Hex string `json:"hex" ts_doc:"Hex-encoded block data."` } // BlockbookInfo contains information about the running blockbook instance type BlockbookInfo struct { - Coin string `json:"coin"` - Host string `json:"host"` - Version string `json:"version"` - GitCommit string `json:"gitCommit"` - BuildTime string `json:"buildTime"` - SyncMode bool `json:"syncMode"` - InitialSync bool `json:"initialSync"` - InSync bool `json:"inSync"` - BestHeight uint32 `json:"bestHeight"` - LastBlockTime time.Time `json:"lastBlockTime"` - InSyncMempool bool `json:"inSyncMempool"` - LastMempoolTime time.Time `json:"lastMempoolTime"` - MempoolSize int `json:"mempoolSize"` - Decimals int `json:"decimals"` - DbSize int64 `json:"dbSize"` - DbSizeFromColumns int64 `json:"dbSizeFromColumns,omitempty"` - DbColumns []common.InternalStateColumn `json:"dbColumns,omitempty"` - About string `json:"about"` + Coin string `json:"coin" ts_doc:"Coin name, e.g. 'Bitcoin'."` + Network string `json:"network" ts_doc:"Network shortcut, e.g. 'BTC'."` + Host string `json:"host" ts_doc:"Hostname of the blockbook instance, e.g. 'backend5'."` + Version string `json:"version" ts_doc:"Running blockbook version, e.g. '0.4.0'."` + GitCommit string `json:"gitCommit" ts_doc:"Git commit hash of the running blockbook, e.g. 'a0960c8e'."` + BuildTime string `json:"buildTime" ts_doc:"Build time of running blockbook, e.g. '2024-08-08T12:32:50+00:00'."` + SyncMode bool `json:"syncMode" ts_doc:"If true, blockbook is syncing from scratch or in a special sync mode."` + InitialSync bool `json:"initialSync" ts_doc:"Indicates if blockbook is in its initial sync phase."` + InSync bool `json:"inSync" ts_doc:"Indicates if the backend is fully synced with the blockchain."` + BestHeight uint32 `json:"bestHeight" ts_doc:"Best (latest) block height according to this instance."` + LastBlockTime time.Time `json:"lastBlockTime" ts_doc:"Timestamp of the latest block in the chain."` + InSyncMempool bool `json:"inSyncMempool" ts_doc:"Indicates if mempool info is synced as well."` + LastMempoolTime time.Time `json:"lastMempoolTime" ts_doc:"Timestamp of the last mempool update."` + MempoolSize int `json:"mempoolSize" ts_doc:"Number of unconfirmed transactions in the mempool."` + Decimals int `json:"decimals" ts_doc:"Number of decimals for this coin's base unit."` + DbSize int64 `json:"dbSize" ts_doc:"Size of the underlying database in bytes."` + HasFiatRates bool `json:"hasFiatRates,omitempty" ts_doc:"Whether this instance provides fiat exchange rates."` + HasTokenFiatRates bool `json:"hasTokenFiatRates,omitempty" ts_doc:"Whether this instance provides fiat exchange rates for tokens."` + CurrentFiatRatesTime *time.Time `json:"currentFiatRatesTime,omitempty" ts_doc:"Timestamp of the latest fiat rates update."` + HistoricalFiatRatesTime *time.Time `json:"historicalFiatRatesTime,omitempty" ts_doc:"Timestamp of the latest historical fiat rates update."` + HistoricalTokenFiatRatesTime *time.Time `json:"historicalTokenFiatRatesTime,omitempty" ts_doc:"Timestamp of the latest historical token fiat rates update."` + SupportedStakingPools []string `json:"supportedStakingPools,omitempty" ts_doc:"List of contract addresses supported for staking."` + DbSizeFromColumns int64 `json:"dbSizeFromColumns,omitempty" ts_doc:"Optional calculated DB size from columns."` + DbColumns []common.InternalStateColumn `json:"dbColumns,omitempty" ts_doc:"List of columns/tables in the DB for internal state."` + About string `json:"about" ts_doc:"Additional human-readable info about this blockbook instance."` } // SystemInfo contains information about the running blockbook and backend instance type SystemInfo struct { - Blockbook *BlockbookInfo `json:"blockbook"` - Backend *common.BackendInfo `json:"backend"` + Blockbook *BlockbookInfo `json:"blockbook" ts_doc:"Blockbook instance information."` + Backend *common.BackendInfo `json:"backend" ts_doc:"Information about the connected backend node."` } // MempoolTxid contains information about a transaction in mempool type MempoolTxid struct { - Time int64 `json:"time"` - Txid string `json:"txid"` + Time int64 `json:"time" ts_doc:"Timestamp when the transaction was received in the mempool."` + Txid string `json:"txid" ts_doc:"Transaction hash for this mempool entry."` } // MempoolTxids contains a list of mempool txids with paging information type MempoolTxids struct { Paging - Mempool []MempoolTxid `json:"mempool"` - MempoolSize int `json:"mempoolSize"` + Mempool []MempoolTxid `json:"mempool" ts_doc:"List of transactions currently in the mempool."` + MempoolSize int `json:"mempoolSize" ts_doc:"Number of unconfirmed transactions in the mempool."` +} + +// FiatTicker contains formatted CurrencyRatesTicker data +type FiatTicker struct { + Timestamp int64 `json:"ts,omitempty" ts_doc:"Unix timestamp for these fiat rates."` + Rates map[string]float32 `json:"rates" ts_doc:"Map of currency codes to their exchange rate."` + Error string `json:"error,omitempty" ts_doc:"Any error message encountered while fetching rates."` +} + +// FiatTickers contains a formatted CurrencyRatesTicker list +type FiatTickers struct { + Tickers []FiatTicker `json:"tickers" ts_doc:"List of fiat tickers with timestamps and rates."` +} + +// AvailableVsCurrencies contains formatted data about available versus currencies for exchange rates +type AvailableVsCurrencies struct { + Timestamp int64 `json:"ts,omitempty" ts_doc:"Timestamp for the available currency list."` + Tickers []string `json:"available_currencies" ts_doc:"List of currency codes (e.g., USD, EUR) supported by the rates."` + Error string `json:"error,omitempty" ts_doc:"Error message, if any, when fetching the available currencies."` +} + +// Eip1559Fee +type Eip1559Fee struct { + MaxFeePerGas *Amount `json:"maxFeePerGas"` + MaxPriorityFeePerGas *Amount `json:"maxPriorityFeePerGas"` + MinWaitTimeEstimate int `json:"minWaitTimeEstimate,omitempty"` + MaxWaitTimeEstimate int `json:"maxWaitTimeEstimate,omitempty"` +} + +// Eip1559Fees +type Eip1559Fees struct { + BaseFeePerGas *Amount `json:"baseFeePerGas,omitempty"` + Low *Eip1559Fee `json:"low,omitempty"` + Medium *Eip1559Fee `json:"medium,omitempty"` + High *Eip1559Fee `json:"high,omitempty"` + Instant *Eip1559Fee `json:"instant,omitempty"` + NetworkCongestion float64 `json:"networkCongestion,omitempty"` + LatestPriorityFeeRange []*Amount `json:"latestPriorityFeeRange,omitempty"` + HistoricalPriorityFeeRange []*Amount `json:"historicalPriorityFeeRange,omitempty"` + HistoricalBaseFeeRange []*Amount `json:"historicalBaseFeeRange,omitempty"` + PriorityFeeTrend string `json:"priorityFeeTrend,omitempty" ts_type:"'up' | 'down'"` + BaseFeeTrend string `json:"baseFeeTrend,omitempty" ts_type:"'up' | 'down'"` +} + +type LongTermFeeRate struct { + FeePerUnit string `json:"feePerUnit" ts_doc:"Long term fee rate (in sat/kByte)."` + Blocks uint64 `json:"blocks" ts_doc:"Amount of blocks used for the long term fee rate estimation."` } diff --git a/api/types_test.go b/api/types_test.go index fcf8a76abf..12bb8fec9f 100644 --- a/api/types_test.go +++ b/api/types_test.go @@ -6,6 +6,7 @@ import ( "encoding/json" "math/big" "reflect" + "sort" "testing" ) @@ -46,6 +47,15 @@ func TestAmount_MarshalJSON(t *testing.T) { if !reflect.DeepEqual(string(b), tt.want) { t.Errorf("json.Marshal() = %v, want %v", string(b), tt.want) } + var parsed amounts + err = json.Unmarshal(b, &parsed) + if err != nil { + t.Errorf("json.Unmarshal() error = %v", err) + return + } + if !reflect.DeepEqual(parsed, tt.a) { + t.Errorf("json.Unmarshal() = %v, want %v", parsed, tt.a) + } }) } } @@ -172,3 +182,151 @@ func TestBalanceHistories_SortAndAggregate(t *testing.T) { }) } } + +func TestAmount_Compare(t *testing.T) { + tests := []struct { + name string + a *Amount + b *Amount + want int + }{ + { + name: "nil-nil", + a: nil, + b: nil, + want: 0, + }, + { + name: "20-nil", + a: (*Amount)(big.NewInt(20)), + b: nil, + want: 1, + }, + { + name: "nil-20", + a: nil, + b: (*Amount)(big.NewInt(20)), + want: -1, + }, + { + name: "18-20", + a: (*Amount)(big.NewInt(18)), + b: (*Amount)(big.NewInt(20)), + want: -1, + }, + { + name: "20-20", + a: (*Amount)(big.NewInt(20)), + b: (*Amount)(big.NewInt(20)), + want: 0, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := tt.a.Compare(tt.b); got != tt.want { + t.Errorf("Amount.Compare() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestTokens_Sort(t *testing.T) { + tests := []struct { + name string + unsorted Tokens + sorted Tokens + }{ + { + name: "one", + unsorted: Tokens{ + { + Name: "a", + Contract: "0x1", + BaseValue: 12.34, + }, + }, + sorted: Tokens{ + { + Name: "a", + Contract: "0x1", + BaseValue: 12.34, + }, + }, + }, + { + name: "mix", + unsorted: Tokens{ + { + Name: "", + Contract: "0x6", + BaseValue: 0, + }, + { + Name: "", + Contract: "0x5", + BaseValue: 0, + }, + { + Name: "b", + Contract: "0x2", + BaseValue: 1, + }, + { + Name: "d", + Contract: "0x4", + BaseValue: 0, + }, + { + Name: "a", + Contract: "0x1", + BaseValue: 12.34, + }, + { + Name: "c", + Contract: "0x3", + BaseValue: 0, + }, + }, + sorted: Tokens{ + { + Name: "a", + Contract: "0x1", + BaseValue: 12.34, + }, + { + Name: "b", + Contract: "0x2", + BaseValue: 1, + }, + { + Name: "c", + Contract: "0x3", + BaseValue: 0, + }, + { + Name: "d", + Contract: "0x4", + BaseValue: 0, + }, + { + Name: "", + Contract: "0x5", + BaseValue: 0, + }, + { + Name: "", + Contract: "0x6", + BaseValue: 0, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + sort.Sort(tt.unsorted) + if !reflect.DeepEqual(tt.unsorted, tt.sorted) { + t.Errorf("Tokens Sort got %v, want %v", tt.unsorted, tt.sorted) + } + }) + } +} diff --git a/api/worker.go b/api/worker.go index 74b086ea24..135417a609 100644 --- a/api/worker.go +++ b/api/worker.go @@ -19,31 +19,39 @@ import ( "github.com/trezor/blockbook/bchain/coins/eth" "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/fiat" ) // Worker is handle to api worker type Worker struct { - db *db.RocksDB - txCache *db.TxCache - chain bchain.BlockChain - chainParser bchain.BlockChainParser - chainType bchain.ChainType - mempool bchain.Mempool - is *common.InternalState - metrics *common.Metrics + db *db.RocksDB + txCache *db.TxCache + chain bchain.BlockChain + chainParser bchain.BlockChainParser + chainType bchain.ChainType + useAddressAliases bool + mempool bchain.Mempool + is *common.InternalState + fiatRates *fiat.FiatRates + metrics *common.Metrics } +// contractInfoCache is a temporary cache of contract information for ethereum token transfers +type contractInfoCache = map[string]*bchain.ContractInfo + // NewWorker creates new api worker -func NewWorker(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState) (*Worker, error) { +func NewWorker(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState, fiatRates *fiat.FiatRates) (*Worker, error) { w := &Worker{ - db: db, - txCache: txCache, - chain: chain, - chainParser: chain.GetChainParser(), - chainType: chain.GetChainParser().GetChainType(), - mempool: mempool, - is: is, - metrics: metrics, + db: db, + txCache: txCache, + chain: chain, + chainParser: chain.GetChainParser(), + chainType: chain.GetChainParser().GetChainType(), + useAddressAliases: chain.GetChainParser().UseAddressAliases(), + mempool: mempool, + is: is, + fiatRates: fiatRates, + metrics: metrics, } if w.chainType == bchain.ChainBitcoinType { w.initXpubCache() @@ -99,8 +107,21 @@ func (w *Worker) setSpendingTxToVout(vout *Vout, txid string, height uint32) err // GetSpendingTxid returns transaction id of transaction that spent given output func (w *Worker) GetSpendingTxid(txid string, n int) (string, error) { + if w.db.HasExtendedIndex() { + tsp, err := w.db.GetTxAddresses(txid) + if err != nil { + return "", err + } else if tsp == nil { + glog.Warning("DB inconsistency: tx ", txid, ": not found in txAddresses") + return "", NewAPIError(fmt.Sprintf("Txid %v not found", txid), false) + } + if n >= len(tsp.Outputs) || n < 0 { + return "", NewAPIError(fmt.Sprintf("Passed incorrect vout index %v for tx %v, len vout %v", n, txid, len(tsp.Outputs)), false) + } + return tsp.Outputs[n].SpentTxid, nil + } start := time.Now() - tx, err := w.GetTransaction(txid, false, false) + tx, err := w.getTransaction(txid, false, false, nil) if err != nil { return "", err } @@ -115,8 +136,84 @@ func (w *Worker) GetSpendingTxid(txid string, n int) (string, error) { return tx.Vout[n].SpentTxID, nil } +func aggregateAddress(m map[string]struct{}, a string) { + if m != nil && len(a) > 0 { + m[a] = struct{}{} + } +} + +func aggregateAddresses(m map[string]struct{}, addresses []string, isAddress bool) { + if m != nil && isAddress { + for _, a := range addresses { + if len(a) > 0 { + m[a] = struct{}{} + } + } + } +} + +func (w *Worker) newAddressesMapForAliases() map[string]struct{} { + // return non nil map only if the chain supports address aliases + if w.useAddressAliases { + return make(map[string]struct{}) + } + // returning nil disables the processing of the address aliases + return nil +} + +func (w *Worker) getAddressAliases(addresses map[string]struct{}) AddressAliasesMap { + if len(addresses) > 0 { + aliases := make(AddressAliasesMap) + var t string + if w.chainType == bchain.ChainEthereumType { + t = "ENS" + } else { + t = "Alias" + } + for a := range addresses { + if w.chainType == bchain.ChainEthereumType { + addrDesc, err := w.chainParser.GetAddrDescFromAddress(a) + if err != nil || addrDesc == nil { + continue + } + ci, err := w.db.GetContractInfo(addrDesc, bchain.UnknownTokenStandard) + if err == nil && ci != nil { + if ci.Standard == bchain.UnhandledTokenStandard { + ci, _, err = w.getContractDescriptorInfo(addrDesc, bchain.UnknownTokenStandard) + } + if err == nil && ci != nil && ci.Name != "" { + aliases[a] = AddressAlias{Type: "Contract", Alias: ci.Name} + } + } + } + n := w.db.GetAddressAlias(a) + if len(n) > 0 { + aliases[a] = AddressAlias{Type: t, Alias: n} + } + } + return aliases + } + return nil +} + // GetTransaction reads transaction data from txid func (w *Worker) GetTransaction(txid string, spendingTxs bool, specificJSON bool) (*Tx, error) { + addresses := w.newAddressesMapForAliases() + tx, err := w.getTransaction(txid, spendingTxs, specificJSON, addresses) + if err != nil { + return nil, err + } + tx.AddressAliases = w.getAddressAliases(addresses) + return tx, nil +} + +// GetRawTransaction gets raw transaction data in hex format from txid +func (w *Worker) GetRawTransaction(txid string) (string, error) { + return w.chain.EthereumTypeGetRawTransaction(txid) +} + +// getTransaction reads transaction data from txid +func (w *Worker) getTransaction(txid string, spendingTxs bool, specificJSON bool, addresses map[string]struct{}) (*Tx, error) { bchainTx, height, err := w.txCache.GetTransaction(txid) if err != nil { if err == bchain.ErrTxNotFound { @@ -124,11 +221,71 @@ func (w *Worker) GetTransaction(txid string, spendingTxs bool, specificJSON bool } return nil, NewAPIError(fmt.Sprintf("Transaction '%v' not found (%v)", txid, err), true) } - return w.GetTransactionFromBchainTx(bchainTx, height, spendingTxs, specificJSON) + return w.getTransactionFromBchainTx(bchainTx, height, spendingTxs, specificJSON, addresses) } -// GetTransactionFromBchainTx reads transaction data from txid -func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spendingTxs bool, specificJSON bool) (*Tx, error) { +func (w *Worker) getParsedEthereumInputData(data string) *bchain.EthereumParsedInputData { + var err error + var signatures *[]bchain.FourByteSignature + fourBytes := eth.GetSignatureFromData(data) + if fourBytes != 0 { + signatures, err = w.db.GetFourByteSignatures(fourBytes) + if err != nil { + glog.Errorf("GetFourByteSignatures(%v) error %v", fourBytes, err) + return nil + } + if signatures == nil { + return nil + } + } + return eth.ParseInputData(signatures, data) +} + +// getConfirmationETA returns confirmation ETA in seconds and blocks +func (w *Worker) getConfirmationETA(tx *Tx) (int64, uint32) { + var etaBlocks uint32 + var etaSeconds int64 + if w.chainType == bchain.ChainBitcoinType && tx.FeesSat != nil { + _, _, mempoolSize := w.is.GetMempoolSyncState() + // if there are a few transactions in the mempool, the estimate fee does not work well + // and the tx is most probably going to be confirmed in the first block + if mempoolSize < 32 { + etaBlocks = 1 + } else { + var txFeePerKB int64 + if tx.VSize > 0 { + txFeePerKB = 1000 * tx.FeesSat.AsInt64() / int64(tx.VSize) + } else if tx.Size > 0 { + txFeePerKB = 1000 * tx.FeesSat.AsInt64() / int64(tx.Size) + } + if txFeePerKB > 0 { + // binary search the estimate, split it to more common first 7 blocks and the rest up to 70 blocks + var b int + fee, _ := w.cachedEstimateFee(7, true) + if fee.Int64() <= txFeePerKB { + b = sort.Search(7, func(i int) bool { + // fee is in sats/kB + fee, _ := w.cachedEstimateFee(i+1, true) + return fee.Int64() <= txFeePerKB + }) + b += 1 + } else { + b = sort.Search(63, func(i int) bool { + fee, _ := w.cachedEstimateFee(i+7, true) + return fee.Int64() <= txFeePerKB + }) + b += 7 + } + etaBlocks = uint32(b) + } + } + etaSeconds = int64(etaBlocks * w.is.AvgBlockPeriod) + } + return etaSeconds, etaBlocks +} + +// getTransactionFromBchainTx reads transaction data from txid +func (w *Worker) getTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spendingTxs bool, specificJSON bool, addresses map[string]struct{}) (*Tx, error) { var err error var ta *db.TxAddresses var tokens []TokenTransfer @@ -182,6 +339,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe if err != nil { glog.Warning("GetAddressesFromAddrDesc tx ", bchainVin.Txid, ", addrDesc ", vin.AddrDesc, ": ", err) } + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) continue } return nil, errors.Annotatef(err, "txCache.GetTransaction %v", bchainVin.Txid) @@ -198,6 +356,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe if err != nil { glog.Errorf("getAddressesFromVout error %v, vout %+v", err, vout) } + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) } } else { if len(tas.Outputs) > int(vin.Vout) { @@ -208,6 +367,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe if err != nil { glog.Errorf("output.Addresses error %v, tx %v, output %v", err, bchainVin.Txid, i) } + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) } } if vin.ValueSat != nil { @@ -222,6 +382,7 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe } vin.Addresses = bchainVin.Addresses vin.IsAddress = true + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) } } } @@ -237,12 +398,19 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe if err != nil { glog.V(2).Infof("getAddressesFromVout error %v, %v, output %v", err, bchainTx.Txid, bchainVout.N) } + aggregateAddresses(addresses, vout.Addresses, vout.IsAddress) if ta != nil { vout.Spent = ta.Outputs[i].Spent - if spendingTxs && vout.Spent { - err = w.setSpendingTxToVout(vout, bchainTx.Txid, uint32(height)) - if err != nil { - glog.Errorf("setSpendingTxToVout error %v, %v, output %v", err, vout.AddrDesc, vout.N) + if vout.Spent { + if w.db.HasExtendedIndex() { + vout.SpentTxID = ta.Outputs[i].SpentTxid + vout.SpentIndex = int(ta.Outputs[i].SpentIndex) + vout.SpentHeight = int(ta.Outputs[i].SpentHeight) + } else if spendingTxs { + err = w.setSpendingTxToVout(vout, bchainTx.Txid, uint32(height)) + if err != nil { + glog.Errorf("setSpendingTxToVout error %v, %v, output %v", err, vout.AddrDesc, vout.N) + } } } } @@ -255,30 +423,67 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe } pValInSat = &valInSat } else if w.chainType == bchain.ChainEthereumType { - ets, err := w.chainParser.EthereumTypeGetErc20FromTx(bchainTx) + tokenTransfers, err := w.chainParser.EthereumTypeGetTokenTransfersFromTx(bchainTx) if err != nil { - glog.Errorf("GetErc20FromTx error %v, %v", err, bchainTx) + glog.Errorf("GetTokenTransfersFromTx error %v, %v", err, bchainTx) } - tokens = w.getTokensFromErc20(ets) + tokens = w.getEthereumTokensTransfers(tokenTransfers, addresses) ethTxData := eth.GetEthereumTxData(bchainTx) + + var internalData *bchain.EthereumInternalData + if eth.ProcessInternalTransactions { + internalData, err = w.db.GetEthereumInternalData(bchainTx.Txid) + if err != nil { + return nil, err + } + } + + parsedInputData := w.getParsedEthereumInputData(ethTxData.Data) + // mempool txs do not have fees yet if ethTxData.GasUsed != nil { feesSat.Mul(ethTxData.GasPrice, ethTxData.GasUsed) + if ethTxData.L1Fee != nil { + feesSat.Add(&feesSat, ethTxData.L1Fee) + } } if len(bchainTx.Vout) > 0 { valOutSat = bchainTx.Vout[0].ValueSat } ethSpecific = &EthereumSpecific{ - GasLimit: ethTxData.GasLimit, - GasPrice: (*Amount)(ethTxData.GasPrice), - GasUsed: ethTxData.GasUsed, - Nonce: ethTxData.Nonce, - Status: ethTxData.Status, - Data: ethTxData.Data, + GasLimit: ethTxData.GasLimit, + GasPrice: (*Amount)(ethTxData.GasPrice), + MaxPriorityFeePerGas: (*Amount)(ethTxData.MaxPriorityFeePerGas), + MaxFeePerGas: (*Amount)(ethTxData.MaxFeePerGas), + BaseFeePerGas: (*Amount)(ethTxData.BaseFeePerGas), + GasUsed: ethTxData.GasUsed, + L1Fee: ethTxData.L1Fee, + L1FeeScalar: ethTxData.L1FeeScalar, + L1GasPrice: (*Amount)(ethTxData.L1GasPrice), + L1GasUsed: ethTxData.L1GasUsed, + Nonce: ethTxData.Nonce, + Status: ethTxData.Status, + Data: ethTxData.Data, + ParsedData: parsedInputData, + } + if internalData != nil { + ethSpecific.Type = internalData.Type + ethSpecific.CreatedContract = internalData.Contract + ethSpecific.Error = internalData.Error + ethSpecific.InternalTransfers = make([]EthereumInternalTransfer, len(internalData.Transfers)) + for i := range internalData.Transfers { + f := &internalData.Transfers[i] + t := ðSpecific.InternalTransfers[i] + t.From = f.From + aggregateAddress(addresses, t.From) + t.To = f.To + aggregateAddress(addresses, t.To) + t.Type = f.Type + t.Value = (*Amount)(&f.Value) + } } + } - // for now do not return size, we would have to compute vsize of segwit transactions - // size:=len(bchainTx.Hex) / 2 var sj json.RawMessage // return CoinSpecificData for all mempool transactions or if requested if specificJSON || bchainTx.Confirmations == 0 { @@ -287,10 +492,6 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe return nil, err } } - // for mempool transaction get first seen time - if bchainTx.Confirmations == 0 { - bchainTx.Blocktime = int64(w.mempool.GetTransactionTime(bchainTx.Txid)) - } r := &Tx{ Blockhash: blockhash, Blockheight: height, @@ -302,6 +503,8 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe ValueInSat: (*Amount)(pValInSat), ValueOutSat: (*Amount)(&valOutSat), Version: bchainTx.Version, + Size: len(bchainTx.Hex) >> 1, + VSize: int(bchainTx.VSize), Hex: bchainTx.Hex, Rbf: rbf, Vin: vins, @@ -310,6 +513,10 @@ func (w *Worker) GetTransactionFromBchainTx(bchainTx *bchain.Tx, height int, spe TokenTransfers: tokens, EthereumSpecific: ethSpecific, } + if bchainTx.Confirmations == 0 { + r.Blocktime = int64(w.mempool.GetTransactionTime(bchainTx.Txid)) + r.ConfirmationETASeconds, r.ConfirmationETABlocks = w.getConfirmationETA(r) + } return r, nil } @@ -321,6 +528,7 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, var pValInSat *big.Int var tokens []TokenTransfer var ethSpecific *EthereumSpecific + addresses := w.newAddressesMapForAliases() vins := make([]Vin, len(mempoolTx.Vin)) rbf := false for i := range mempoolTx.Vin { @@ -345,6 +553,7 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, if vin.ValueSat != nil { valInSat.Add(&valInSat, (*big.Int)(vin.ValueSat)) } + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) } } else if w.chainType == bchain.ChainEthereumType { if len(bchainVin.Addresses) > 0 { @@ -354,6 +563,7 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, } vin.Addresses = bchainVin.Addresses vin.IsAddress = true + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) } } } @@ -369,6 +579,7 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, if err != nil { glog.V(2).Infof("getAddressesFromVout error %v, %v, output %v", err, mempoolTx.Txid, bchainVout.N) } + aggregateAddresses(addresses, vout.Addresses, vout.IsAddress) } if w.chainType == bchain.ChainBitcoinType { // for coinbase transactions valIn is 0 @@ -381,15 +592,18 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, if len(mempoolTx.Vout) > 0 { valOutSat = mempoolTx.Vout[0].ValueSat } - tokens = w.getTokensFromErc20(mempoolTx.Erc20) + tokens = w.getEthereumTokensTransfers(mempoolTx.TokenTransfers, addresses) ethTxData := eth.GetEthereumTxDataFromSpecificData(mempoolTx.CoinSpecificData) ethSpecific = &EthereumSpecific{ - GasLimit: ethTxData.GasLimit, - GasPrice: (*Amount)(ethTxData.GasPrice), - GasUsed: ethTxData.GasUsed, - Nonce: ethTxData.Nonce, - Status: ethTxData.Status, - Data: ethTxData.Data, + GasLimit: ethTxData.GasLimit, + GasPrice: (*Amount)(ethTxData.GasPrice), + MaxPriorityFeePerGas: (*Amount)(ethTxData.MaxPriorityFeePerGas), + MaxFeePerGas: (*Amount)(ethTxData.MaxFeePerGas), + BaseFeePerGas: (*Amount)(ethTxData.BaseFeePerGas), + GasUsed: ethTxData.GasUsed, + Nonce: ethTxData.Nonce, + Status: ethTxData.Status, + Data: ethTxData.Data, } } r := &Tx{ @@ -400,46 +614,163 @@ func (w *Worker) GetTransactionFromMempoolTx(mempoolTx *bchain.MempoolTx) (*Tx, ValueInSat: (*Amount)(pValInSat), ValueOutSat: (*Amount)(&valOutSat), Version: mempoolTx.Version, + Size: len(mempoolTx.Hex) >> 1, + VSize: int(mempoolTx.VSize), Hex: mempoolTx.Hex, Rbf: rbf, Vin: vins, Vout: vouts, TokenTransfers: tokens, EthereumSpecific: ethSpecific, + AddressAliases: w.getAddressAliases(addresses), } + r.ConfirmationETASeconds, r.ConfirmationETABlocks = w.getConfirmationETA(r) return r, nil } -func (w *Worker) getTokensFromErc20(erc20 []bchain.Erc20Transfer) []TokenTransfer { - tokens := make([]TokenTransfer, len(erc20)) - for i := range erc20 { - e := &erc20[i] - cd, err := w.chainParser.GetAddrDescFromAddress(e.Contract) - if err != nil { - glog.Errorf("GetAddrDescFromAddress error %v, contract %v", err, e.Contract) - continue +func (w *Worker) GetContractInfo(contract string, standardFromContext bchain.TokenStandardName) (*bchain.ContractInfo, bool, error) { + cd, err := w.chainParser.GetAddrDescFromAddress(contract) + if err != nil { + return nil, false, err + } + return w.getContractDescriptorInfo(cd, standardFromContext) +} + +func (w *Worker) getContractDescriptorInfo(cd bchain.AddressDescriptor, standardFromContext bchain.TokenStandardName) (*bchain.ContractInfo, bool, error) { + var err error + validContract := true + contractInfo, err := w.db.GetContractInfo(cd, standardFromContext) + if err != nil { + return nil, false, err + } + if contractInfo == nil { + // log warning only if the contract should have been known from processing of the internal data + if eth.ProcessInternalTransactions { + glog.Warningf("Contract %v %v not found in DB", cd, standardFromContext) } - erc20c, err := w.chain.EthereumTypeGetErc20ContractInfo(cd) + contractInfo, err = w.chain.GetContractInfo(cd) if err != nil { - glog.Errorf("GetErc20ContractInfo error %v, contract %v", err, e.Contract) + glog.Errorf("GetContractInfo from chain error %v, contract %v", err, cd) + } + if contractInfo == nil { + contractInfo = &bchain.ContractInfo{Standard: bchain.UnknownTokenStandard, Decimals: w.chainParser.AmountDecimals()} + addresses, _, _ := w.chainParser.GetAddressesFromAddrDesc(cd) + if len(addresses) > 0 { + contractInfo.Contract = addresses[0] + } + + validContract = false + } else { + if standardFromContext != bchain.UnknownTokenStandard && contractInfo.Standard == bchain.UnknownTokenStandard { + contractInfo.Standard = standardFromContext + contractInfo.Type = standardFromContext + } + if err = w.db.StoreContractInfo(contractInfo); err != nil { + glog.Errorf("StoreContractInfo error %v, contract %v", err, cd) + } } - if erc20c == nil { - erc20c = &bchain.Erc20Contract{Name: e.Contract} + } else if (contractInfo.Standard == bchain.UnhandledTokenStandard || len(contractInfo.Name) > 0 && contractInfo.Name[0] == 0) || (len(contractInfo.Symbol) > 0 && contractInfo.Symbol[0] == 0) { + // fix contract name/symbol that was parsed as a string consisting of zeroes + blockchainContractInfo, err := w.chain.GetContractInfo(cd) + if err != nil { + glog.Errorf("GetContractInfo from chain error %v, contract %v", err, cd) + } else { + if blockchainContractInfo != nil && len(blockchainContractInfo.Name) > 0 && blockchainContractInfo.Name[0] != 0 { + contractInfo.Name = blockchainContractInfo.Name + } else { + contractInfo.Name = "" + } + if blockchainContractInfo != nil && len(blockchainContractInfo.Symbol) > 0 && blockchainContractInfo.Symbol[0] != 0 { + contractInfo.Symbol = blockchainContractInfo.Symbol + } else { + contractInfo.Symbol = "" + } + if blockchainContractInfo != nil { + contractInfo.Decimals = blockchainContractInfo.Decimals + } + if contractInfo.Standard == bchain.UnhandledTokenStandard { + glog.Infof("Contract %v %v [%s] handled", cd, standardFromContext, contractInfo.Name) + contractInfo.Standard = standardFromContext + contractInfo.Type = standardFromContext + } + if err = w.db.StoreContractInfo(contractInfo); err != nil { + glog.Errorf("StoreContractInfo error %v, contract %v", err, cd) + } } - tokens[i] = TokenTransfer{ - Type: ERC20TokenType, - Token: e.Contract, - From: e.From, - To: e.To, - Decimals: erc20c.Decimals, - Value: (*Amount)(&e.Tokens), - Name: erc20c.Name, - Symbol: erc20c.Symbol, + } + return contractInfo, validContract, nil +} + +func (w *Worker) getEthereumTokensTransfers(transfers bchain.TokenTransfers, addresses map[string]struct{}) []TokenTransfer { + tokens := make([]TokenTransfer, len(transfers)) + if len(transfers) > 0 { + sort.Sort(transfers) + contractCache := make(contractInfoCache) + for i := range transfers { + t := transfers[i] + standard := bchain.EthereumTokenStandardMap[t.Standard] + var contractInfo *bchain.ContractInfo + if info, ok := contractCache[t.Contract]; ok { + contractInfo = info + } else { + info, _, err := w.GetContractInfo(t.Contract, standard) + if err != nil { + glog.Errorf("getContractInfo error %v, contract %v", err, t.Contract) + continue + } + contractInfo = info + contractCache[t.Contract] = info + } + var value *Amount + var values []MultiTokenValue + if t.Standard == bchain.MultiToken { + values = make([]MultiTokenValue, len(t.MultiTokenValues)) + for j := range values { + values[j].Id = (*Amount)(&t.MultiTokenValues[j].Id) + values[j].Value = (*Amount)(&t.MultiTokenValues[j].Value) + } + } else { + value = (*Amount)(&t.Value) + } + aggregateAddress(addresses, t.From) + aggregateAddress(addresses, t.To) + tokens[i] = TokenTransfer{ + Type: standard, + Standard: standard, + Contract: t.Contract, + From: t.From, + To: t.To, + Value: value, + MultiTokenValues: values, + Decimals: contractInfo.Decimals, + Name: contractInfo.Name, + Symbol: contractInfo.Symbol, + } } } return tokens } +func (w *Worker) GetEthereumTokenURI(contract string, id string) (string, *bchain.ContractInfo, error) { + cd, err := w.chainParser.GetAddrDescFromAddress(contract) + if err != nil { + return "", nil, err + } + tokenId, ok := new(big.Int).SetString(id, 10) + if !ok { + return "", nil, errors.New("Invalid token id") + } + uri, err := w.chain.GetTokenURI(cd, tokenId) + if err != nil { + return "", nil, err + } + ci, _, err := w.getContractDescriptorInfo(cd, bchain.UnknownTokenStandard) + if err != nil { + return "", nil, err + } + return uri, ci, nil +} + func (w *Worker) getAddressTxids(addrDesc bchain.AddressDescriptor, mempool bool, filter *AddressFilter, maxResults int) ([]string, error) { var err error txids := make([]string, 0, 4) @@ -549,7 +880,7 @@ func GetUniqueTxids(txids []string) []string { return ut[0:i] } -func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockInfo, bestheight uint32) *Tx { +func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockInfo, bestheight uint32, addresses map[string]struct{}) *Tx { var err error var valInSat, valOutSat, feesSat big.Int vins := make([]Vin, len(ta.Inputs)) @@ -563,6 +894,11 @@ func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockIn if err != nil { glog.Errorf("tai.Addresses error %v, tx %v, input %v, tai %+v", err, txid, i, tai) } + if w.db.HasExtendedIndex() { + vin.Txid = tai.Txid + vin.Vout = tai.Vout + } + aggregateAddresses(addresses, vin.Addresses, vin.IsAddress) } vouts := make([]Vout, len(ta.Outputs)) for i := range ta.Outputs { @@ -576,6 +912,12 @@ func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockIn glog.Errorf("tai.Addresses error %v, tx %v, output %v, tao %+v", err, txid, i, tao) } vout.Spent = tao.Spent + if vout.Spent && w.db.HasExtendedIndex() { + vout.SpentTxID = tao.SpentTxid + vout.SpentIndex = int(tao.SpentIndex) + vout.SpentHeight = int(tao.SpentHeight) + } + aggregateAddresses(addresses, vout.Addresses, vout.IsAddress) } // for coinbase transactions valIn is 0 feesSat.Sub(&valInSat, &valOutSat) @@ -594,6 +936,11 @@ func (w *Worker) txFromTxAddress(txid string, ta *db.TxAddresses, bi *db.BlockIn Vin: vins, Vout: vouts, } + if w.chainParser.SupportsVSize() { + r.VSize = int(ta.VSize) + } else { + r.Size = int(ta.VSize) + } return r } @@ -618,21 +965,76 @@ func computePaging(count, page, itemsOnPage int) (Paging, int, int, int) { }, from, to, page } -func (w *Worker) getEthereumToken(index int, addrDesc, contract bchain.AddressDescriptor, details AccountDetails, txs int) (*Token, error) { - var b *big.Int - validContract := true - ci, err := w.chain.EthereumTypeGetErc20ContractInfo(contract) +func (w *Worker) getEthereumContractBalance(addrDesc bchain.AddressDescriptor, index int, c *db.AddrContract, details AccountDetails, ticker *common.CurrencyRatesTicker, secondaryCoin string) (*Token, error) { + standard := bchain.EthereumTokenStandardMap[c.Standard] + ci, validContract, err := w.getContractDescriptorInfo(c.Contract, standard) if err != nil { - return nil, errors.Annotatef(err, "EthereumTypeGetErc20ContractInfo %v", contract) + return nil, errors.Annotatef(err, "getEthereumContractBalance %v", c.Contract) + } + t := Token{ + Contract: ci.Contract, + Name: ci.Name, + Symbol: ci.Symbol, + Type: standard, + Standard: standard, + Transfers: int(c.Txs), + Decimals: ci.Decimals, + ContractIndex: strconv.Itoa(index), } - if ci == nil { - ci = &bchain.Erc20Contract{} - addresses, _, _ := w.chainParser.GetAddressesFromAddrDesc(contract) - if len(addresses) > 0 { - ci.Contract = addresses[0] - ci.Name = addresses[0] + // return contract balances/values only at or above AccountDetailsTokenBalances + if details >= AccountDetailsTokenBalances && validContract { + if c.Standard == bchain.FungibleToken { + // get Erc20 Contract Balance from blockchain, balance obtained from adding and subtracting transfers is not correct + b, err := w.chain.EthereumTypeGetErc20ContractBalance(addrDesc, c.Contract) + if err != nil { + // return nil, nil, nil, errors.Annotatef(err, "EthereumTypeGetErc20ContractBalance %v %v", addrDesc, c.Contract) + glog.Warningf("EthereumTypeGetErc20ContractBalance addr %v, contract %v, %v", addrDesc, c.Contract, err) + } else { + t.BalanceSat = (*Amount)(b) + if secondaryCoin != "" { + baseRate, found := w.GetContractBaseRate(ticker, t.Contract, 0) + if found { + value, err := strconv.ParseFloat(t.BalanceSat.DecimalString(t.Decimals), 64) + if err == nil { + t.BaseValue = value * baseRate + if ticker != nil { + secondaryRate, found := ticker.Rates[secondaryCoin] + if found { + t.SecondaryValue = t.BaseValue * float64(secondaryRate) + } + } + } + } + } + } + } else { + if len(c.Ids) > 0 { + ids := make([]Amount, len(c.Ids)) + for j := range ids { + ids[j] = (Amount)(c.Ids[j]) + } + t.Ids = ids + } + if len(c.MultiTokenValues) > 0 { + idValues := make([]MultiTokenValue, len(c.MultiTokenValues)) + for j := range idValues { + idValues[j].Id = (*Amount)(&c.MultiTokenValues[j].Id) + idValues[j].Value = (*Amount)(&c.MultiTokenValues[j].Value) + } + t.MultiTokenValues = idValues + } } - validContract = false + } + + return &t, nil +} + +// a fallback method in case internal transactions are not processed and there is no indexed info about contract balance for an address +func (w *Worker) getEthereumContractBalanceFromBlockchain(addrDesc, contract bchain.AddressDescriptor, details AccountDetails) (*Token, error) { + var b *big.Int + ci, validContract, err := w.getContractDescriptorInfo(contract, bchain.UnknownTokenStandard) + if err != nil { + return nil, errors.Annotatef(err, "GetContractInfo %v", contract) } // do not read contract balances etc in case of Basic option if details >= AccountDetailsTokenBalances && validContract { @@ -645,40 +1047,74 @@ func (w *Worker) getEthereumToken(index int, addrDesc, contract bchain.AddressDe b = nil } return &Token{ - Type: ERC20TokenType, + Type: ci.Standard, + Standard: ci.Standard, BalanceSat: (*Amount)(b), Contract: ci.Contract, Name: ci.Name, Symbol: ci.Symbol, - Transfers: txs, + Transfers: 0, Decimals: ci.Decimals, - ContractIndex: strconv.Itoa(index), + ContractIndex: "0", }, nil } -func (w *Worker) getEthereumTypeAddressBalances(addrDesc bchain.AddressDescriptor, details AccountDetails, filter *AddressFilter) (*db.AddrBalance, []Token, *bchain.Erc20Contract, uint64, int, int, error) { - var ( - ba *db.AddrBalance - tokens []Token - ci *bchain.Erc20Contract - n uint64 - nonContractTxs int - ) - // unknown number of results for paging - totalResults := -1 +// GetContractBaseRate returns contract rate in base coin from the ticker or DB at the timestamp. Zero timestamp means now. +func (w *Worker) GetContractBaseRate(ticker *common.CurrencyRatesTicker, token string, timestamp int64) (float64, bool) { + if ticker == nil { + return 0, false + } + rate, found := ticker.GetTokenRate(token) + if !found { + if timestamp == 0 { + ticker = w.fiatRates.GetCurrentTicker("", token) + } else { + tickers, err := w.fiatRates.GetTickersForTimestamps([]int64{timestamp}, "", token) + if err != nil || tickers == nil || len(*tickers) == 0 { + ticker = nil + } else { + ticker = (*tickers)[0] + } + } + if ticker == nil { + return 0, false + } + rate, found = ticker.GetTokenRate(token) + } + + return float64(rate), found +} + +type ethereumTypeAddressData struct { + tokens Tokens + contractInfo *bchain.ContractInfo + nonce string + nonContractTxs int + internalTxs int + totalResults int + tokensBaseValue float64 + tokensSecondaryValue float64 + stakingPools []StakingPool +} + +func (w *Worker) getEthereumTypeAddressBalances(addrDesc bchain.AddressDescriptor, details AccountDetails, filter *AddressFilter, secondaryCoin string) (*db.AddrBalance, *ethereumTypeAddressData, error) { + var ba *db.AddrBalance + var n uint64 + // unknown number of results for paging initially + d := ethereumTypeAddressData{totalResults: -1} ca, err := w.db.GetAddrDescContracts(addrDesc) if err != nil { - return nil, nil, nil, 0, 0, 0, NewAPIError(fmt.Sprintf("Address not found, %v", err), true) + return nil, nil, NewAPIError(fmt.Sprintf("Address not found, %v", err), true) } b, err := w.chain.EthereumTypeGetBalance(addrDesc) if err != nil { - return nil, nil, nil, 0, 0, 0, errors.Annotatef(err, "EthereumTypeGetBalance %v", addrDesc) + return nil, nil, errors.Annotatef(err, "EthereumTypeGetBalance %v", addrDesc) } var filterDesc bchain.AddressDescriptor if filter.Contract != "" { filterDesc, err = w.chainParser.GetAddrDescFromAddress(filter.Contract) if err != nil { - return nil, nil, nil, 0, 0, 0, NewAPIError(fmt.Sprintf("Invalid contract filter, %v", err), true) + return nil, nil, NewAPIError(fmt.Sprintf("Invalid contract filter, %v", err), true) } } if ca != nil { @@ -690,79 +1126,118 @@ func (w *Worker) getEthereumTypeAddressBalances(addrDesc bchain.AddressDescripto } n, err = w.chain.EthereumTypeGetNonce(addrDesc) if err != nil { - return nil, nil, nil, 0, 0, 0, errors.Annotatef(err, "EthereumTypeGetNonce %v", addrDesc) + return nil, nil, errors.Annotatef(err, "EthereumTypeGetNonce %v", addrDesc) } + ticker := w.fiatRates.GetCurrentTicker("", "") if details > AccountDetailsBasic { - tokens = make([]Token, len(ca.Contracts)) + d.tokens = make([]Token, len(ca.Contracts)) var j int - for i, c := range ca.Contracts { + for i := range ca.Contracts { + c := &ca.Contracts[i] if len(filterDesc) > 0 { if !bytes.Equal(filterDesc, c.Contract) { continue } // filter only transactions of this contract - filter.Vout = i + 1 + filter.Vout = i + db.ContractIndexOffset } - t, err := w.getEthereumToken(i+1, addrDesc, c.Contract, details, int(c.Txs)) + t, err := w.getEthereumContractBalance(addrDesc, i+db.ContractIndexOffset, c, details, ticker, secondaryCoin) if err != nil { - return nil, nil, nil, 0, 0, 0, err + return nil, nil, err } - tokens[j] = *t + d.tokens[j] = *t + d.tokensBaseValue += t.BaseValue + d.tokensSecondaryValue += t.SecondaryValue j++ } - // special handling if filter has contract - // if the address has no transactions with given contract, check the balance, the address may have some balance even without transactions - if len(filterDesc) > 0 && j == 0 && details >= AccountDetailsTokens { - t, err := w.getEthereumToken(0, addrDesc, filterDesc, details, 0) - if err != nil { - return nil, nil, nil, 0, 0, 0, err - } - tokens = []Token{*t} - // switch off query for transactions, there are no transactions - filter.Vout = AddressFilterVoutQueryNotNecessary - } else { - tokens = tokens[:j] - } + d.tokens = d.tokens[:j] + sort.Sort(d.tokens) } - ci, err = w.chain.EthereumTypeGetErc20ContractInfo(addrDesc) + d.contractInfo, err = w.db.GetContractInfo(addrDesc, bchain.UnknownTokenStandard) if err != nil { - return nil, nil, nil, 0, 0, 0, err + return nil, nil, err + } + if d.contractInfo != nil && d.contractInfo.Standard == bchain.UnhandledTokenStandard { + d.contractInfo, _, err = w.getContractDescriptorInfo(addrDesc, bchain.UnknownTokenStandard) + if err != nil { + return nil, nil, err + } } if filter.FromHeight == 0 && filter.ToHeight == 0 { // compute total results for paging if filter.Vout == AddressFilterVoutOff { - totalResults = int(ca.TotalTxs) + d.totalResults = int(ca.TotalTxs) } else if filter.Vout == 0 { - totalResults = int(ca.NonContractTxs) - } else if filter.Vout > 0 && filter.Vout-1 < len(ca.Contracts) { - totalResults = int(ca.Contracts[filter.Vout-1].Txs) + d.totalResults = int(ca.NonContractTxs) + } else if filter.Vout == db.InternalTxIndexOffset { + d.totalResults = int(ca.InternalTxs) + } else if filter.Vout >= db.ContractIndexOffset && filter.Vout-db.ContractIndexOffset < len(ca.Contracts) { + d.totalResults = int(ca.Contracts[filter.Vout-db.ContractIndexOffset].Txs) } else if filter.Vout == AddressFilterVoutQueryNotNecessary { - totalResults = 0 + d.totalResults = 0 } } - nonContractTxs = int(ca.NonContractTxs) + d.nonContractTxs = int(ca.NonContractTxs) + d.internalTxs = int(ca.InternalTxs) } else { - // addresses without any normal transactions can have internal transactions and therefore balance + // addresses without any normal transactions can have internal transactions that were not processed and therefore balance if b != nil { ba = &db.AddrBalance{ BalanceSat: *b, } } - // special handling if filtering for a contract, check the ballance of it - if len(filterDesc) > 0 && details >= AccountDetailsTokens { - t, err := w.getEthereumToken(0, addrDesc, filterDesc, details, 0) + } + // returns 0 for unknown address + d.nonce = strconv.Itoa(int(n)) + // special handling if filtering for a contract, return the contract details even though the address had no transactions with it + if len(d.tokens) == 0 && len(filterDesc) > 0 && details >= AccountDetailsTokens { + t, err := w.getEthereumContractBalanceFromBlockchain(addrDesc, filterDesc, details) + if err != nil { + return nil, nil, err + } + d.tokens = []Token{*t} + // switch off query for transactions, there are no transactions + filter.Vout = AddressFilterVoutQueryNotNecessary + d.totalResults = -1 + } + // if staking pool enabled, fetch the staking pool details + if details >= AccountDetailsBasic { + if len(w.chain.EthereumTypeGetSupportedStakingPools()) > 0 { + d.stakingPools, err = w.getStakingPoolsData(addrDesc) if err != nil { - return nil, nil, nil, 0, 0, 0, err + return nil, nil, err } - tokens = []Token{*t} - // switch off query for transactions, there are no transactions - filter.Vout = AddressFilterVoutQueryNotNecessary } } - return ba, tokens, ci, n, nonContractTxs, totalResults, nil + return ba, &d, nil +} + +func (w *Worker) getStakingPoolsData(addrDesc bchain.AddressDescriptor) ([]StakingPool, error) { + var pools []StakingPool + if len(w.chain.EthereumTypeGetSupportedStakingPools()) > 0 { + sp, err := w.chain.EthereumTypeGetStakingPoolsData(addrDesc) + if err != nil { + return nil, err + } + for i := range sp { + p := &sp[i] + pools = append(pools, StakingPool{ + Contract: p.Contract, + Name: p.Name, + PendingBalance: (*Amount)(&p.PendingBalance), + PendingDepositedBalance: (*Amount)(&p.PendingDepositedBalance), + DepositedBalance: (*Amount)(&p.DepositedBalance), + WithdrawTotalAmount: (*Amount)(&p.WithdrawTotalAmount), + ClaimableAmount: (*Amount)(&p.ClaimableAmount), + RestakedReward: (*Amount)(&p.RestakedReward), + AutocompoundBalance: (*Amount)(&p.AutocompoundBalance), + }) + } + } + return pools, nil } -func (w *Worker) txFromTxid(txid string, bestheight uint32, option AccountDetails, blockInfo *db.BlockInfo) (*Tx, error) { +func (w *Worker) txFromTxid(txid string, bestHeight uint32, option AccountDetails, blockInfo *db.BlockInfo, addresses map[string]struct{}) (*Tx, error) { var tx *Tx var err error // only ChainBitcoinType supports TxHistoryLight @@ -774,9 +1249,9 @@ func (w *Worker) txFromTxid(txid string, bestheight uint32, option AccountDetail if ta == nil { glog.Warning("DB inconsistency: tx ", txid, ": not found in txAddresses") // as fallback, get tx from backend - tx, err = w.GetTransaction(txid, false, false) + tx, err = w.getTransaction(txid, false, false, addresses) if err != nil { - return nil, errors.Annotatef(err, "GetTransaction %v", txid) + return nil, errors.Annotatef(err, "getTransaction %v", txid) } } else { if blockInfo == nil { @@ -790,12 +1265,12 @@ func (w *Worker) txFromTxid(txid string, bestheight uint32, option AccountDetail blockInfo = &db.BlockInfo{} } } - tx = w.txFromTxAddress(txid, ta, blockInfo, bestheight) + tx = w.txFromTxAddress(txid, ta, blockInfo, bestHeight, addresses) } } else { - tx, err = w.GetTransaction(txid, false, false) + tx, err = w.getTransaction(txid, false, false, addresses) if err != nil { - return nil, errors.Annotatef(err, "GetTransaction %v", txid) + return nil, errors.Annotatef(err, "getTransaction %v", txid) } } return tx, nil @@ -845,7 +1320,7 @@ func setIsOwnAddress(tx *Tx, address string) { } // GetAddress computes address value and gets transactions for given address -func (w *Worker) GetAddress(address string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter) (*Address, error) { +func (w *Worker) GetAddress(address string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter, secondaryCoin string) (*Address, error) { start := time.Now() page-- if page < 0 { @@ -853,30 +1328,28 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco } var ( ba *db.AddrBalance - tokens []Token - erc20c *bchain.Erc20Contract txm []string txs []*Tx txids []string pg Paging uBalSat big.Int + uBalSending big.Int + uBalReceiving big.Int totalReceived, totalSent *big.Int - nonce string unconfirmedTxs int - nonTokenTxs int totalResults int ) + ed := ðereumTypeAddressData{} addrDesc, address, err := w.getAddrDescAndNormalizeAddress(address) if err != nil { return nil, err } if w.chainType == bchain.ChainEthereumType { - var n uint64 - ba, tokens, erc20c, n, nonTokenTxs, totalResults, err = w.getEthereumTypeAddressBalances(addrDesc, option, filter) + ba, ed, err = w.getEthereumTypeAddressBalances(addrDesc, option, filter, secondaryCoin) if err != nil { return nil, err } - nonce = strconv.Itoa(int(n)) + totalResults = ed.totalResults } else { // ba can be nil if the address is only in mempool! ba, err = w.db.GetAddrDescBalance(addrDesc, db.AddressBalanceDetailNoUTXO) @@ -897,6 +1370,7 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco ba = &db.AddrBalance{} page = 0 } + addresses := w.newAddressesMapForAliases() // process mempool, only if toHeight is not specified if filter.ToHeight == 0 && !filter.OnlyConfirmed { txm, err = w.getAddressTxids(addrDesc, true, filter, maxInt) @@ -904,7 +1378,7 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco return nil, errors.Annotatef(err, "getAddressTxids %v true", addrDesc) } for _, txid := range txm { - tx, err := w.GetTransaction(txid, false, true) + tx, err := w.getTransaction(txid, false, true, addresses) // mempool transaction may fail if err != nil || tx == nil { glog.Warning("GetTransaction in mempool: ", err) @@ -912,12 +1386,12 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco // skip already confirmed txs, mempool may be out of sync if tx.Confirmations == 0 { unconfirmedTxs++ - uBalSat.Add(&uBalSat, tx.getAddrVoutValue(addrDesc)) + uBalReceiving.Add(&uBalReceiving, tx.getAddrVoutValue(addrDesc)) // ethereum has a different logic - value not in input and add maximum possible fees if w.chainType == bchain.ChainEthereumType { - uBalSat.Sub(&uBalSat, tx.getAddrEthereumTypeMempoolInputValue(addrDesc)) + uBalSending.Add(&uBalSending, tx.getAddrEthereumTypeMempoolInputValue(addrDesc)) } else { - uBalSat.Sub(&uBalSat, tx.getAddrVinValue(addrDesc)) + uBalSending.Add(&uBalSending, tx.getAddrVinValue(addrDesc)) } if page == 0 { if option == AccountDetailsTxidHistory { @@ -955,7 +1429,7 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco if option == AccountDetailsTxidHistory { txids = append(txids, txid) } else { - tx, err := w.txFromTxid(txid, bestheight, option, nil) + tx, err := w.txFromTxid(txid, bestheight, option, nil, addresses) if err != nil { return nil, err } @@ -968,6 +1442,23 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco totalReceived = ba.ReceivedSat() totalSent = &ba.SentSat } + var secondaryRate, totalSecondaryValue, totalBaseValue, secondaryValue float64 + if secondaryCoin != "" { + ticker := w.fiatRates.GetCurrentTicker("", "") + balance, err := strconv.ParseFloat((*Amount)(&ba.BalanceSat).DecimalString(w.chainParser.AmountDecimals()), 64) + if ticker != nil && err == nil { + r, found := ticker.Rates[secondaryCoin] + if found { + secondaryRate = float64(r) + } + } + secondaryValue = secondaryRate * balance + if w.chainType == bchain.ChainEthereumType { + totalBaseValue += balance + ed.tokensBaseValue + totalSecondaryValue = secondaryRate * totalBaseValue + } + } + uBalSat.Sub(&uBalReceiving, &uBalSending) r := &Address{ Paging: pg, AddrStr: address, @@ -975,19 +1466,41 @@ func (w *Worker) GetAddress(address string, page int, txsOnPage int, option Acco TotalReceivedSat: (*Amount)(totalReceived), TotalSentSat: (*Amount)(totalSent), Txs: int(ba.Txs), - NonTokenTxs: nonTokenTxs, + NonTokenTxs: ed.nonContractTxs, + InternalTxs: ed.internalTxs, UnconfirmedBalanceSat: (*Amount)(&uBalSat), UnconfirmedTxs: unconfirmedTxs, + UnconfirmedSending: amountOrNil(&uBalSending), + UnconfirmedReceiving: amountOrNil(&uBalReceiving), Transactions: txs, Txids: txids, - Tokens: tokens, - Erc20Contract: erc20c, - Nonce: nonce, - } - glog.Info("GetAddress ", address, ", ", time.Since(start)) + Tokens: ed.tokens, + SecondaryValue: secondaryValue, + TokensBaseValue: ed.tokensBaseValue, + TokensSecondaryValue: ed.tokensSecondaryValue, + TotalBaseValue: totalBaseValue, + TotalSecondaryValue: totalSecondaryValue, + ContractInfo: ed.contractInfo, + Nonce: ed.nonce, + AddressAliases: w.getAddressAliases(addresses), + StakingPools: ed.stakingPools, + } + // keep address backward compatible, set deprecated Erc20Contract value if ERC20 token + if ed.contractInfo != nil && ed.contractInfo.Standard == bchain.ERC20TokenStandard { + r.Erc20Contract = ed.contractInfo + } + glog.Info("GetAddress-", option, " ", address, ", ", time.Since(start)) return r, nil } +// Returns either the Amount or nil if the number is zero +func amountOrNil(num *big.Int) *Amount { + if num.Cmp(big.NewInt(0)) == 0 { + return nil + } + return (*Amount)(num) +} + func (w *Worker) balanceHistoryHeightsFromTo(fromTimestamp, toTimestamp int64) (uint32, uint32, uint32, uint32) { fromUnix := uint32(0) toUnix := maxUint32 @@ -1095,6 +1608,35 @@ func (w *Worker) balanceHistoryForTxid(addrDesc bchain.AddressDescriptor, txid s } } } + // process internal transactions + if eth.ProcessInternalTransactions { + internalData, err := w.db.GetEthereumInternalData(txid) + if err != nil { + return nil, err + } + if internalData != nil { + for i := range internalData.Transfers { + f := &internalData.Transfers[i] + txAddrDesc, err := w.chainParser.GetAddrDescFromAddress(f.From) + if err != nil { + return nil, err + } + if bytes.Equal(addrDesc, txAddrDesc) { + (*big.Int)(bh.SentSat).Add((*big.Int)(bh.SentSat), &f.Value) + if f.From == f.To { + (*big.Int)(bh.SentToSelfSat).Add((*big.Int)(bh.SentToSelfSat), &f.Value) + } + } + txAddrDesc, err = w.chainParser.GetAddrDescFromAddress(f.To) + if err != nil { + return nil, err + } + if bytes.Equal(addrDesc, txAddrDesc) { + (*big.Int)(bh.ReceivedSat).Add((*big.Int)(bh.ReceivedSat), &f.Value) + } + } + } + } } for i := range bchainTx.Vin { bchainVin := &bchainTx.Vin[i] @@ -1129,18 +1671,19 @@ func (w *Worker) balanceHistoryForTxid(addrDesc bchain.AddressDescriptor, txid s func (w *Worker) setFiatRateToBalanceHistories(histories BalanceHistories, currencies []string) error { for i := range histories { bh := &histories[i] - t := time.Unix(int64(bh.Time), 0) - ticker, err := w.db.FiatRatesFindTicker(&t) - if err != nil { - glog.Errorf("Error finding ticker by date %v. Error: %v", t, err) + tickers, err := w.fiatRates.GetTickersForTimestamps([]int64{int64(bh.Time)}, "", "") + if err != nil || tickers == nil || len(*tickers) == 0 { + glog.Errorf("Error finding ticker by date %v. Error: %v", bh.Time, err) continue - } else if ticker == nil { + } + ticker := (*tickers)[0] + if ticker == nil { continue } if len(currencies) == 0 { bh.FiatRates = ticker.Rates } else { - rates := make(map[string]float64) + rates := make(map[string]float32) for _, currency := range currencies { currency = strings.ToLower(currency) if rate, found := ticker.Rates[currency]; found { @@ -1164,6 +1707,17 @@ func (w *Worker) GetBalanceHistory(address string, fromTimestamp, toTimestamp in if err != nil { return nil, err } + // do not get balance history for contracts + if w.chainType == bchain.ChainEthereumType { + ci, err := w.db.GetContractInfo(addrDesc, bchain.UnknownTokenStandard) + if err != nil { + return nil, err + } + if ci != nil { + glog.Info("GetBalanceHistory ", address, " is a contract, skipping") + return nil, NewAPIError("GetBalanceHistory for a contract not allowed", true) + } + } fromUnix, fromHeight, toUnix, toHeight := w.balanceHistoryHeightsFromTo(fromTimestamp, toTimestamp) if fromHeight >= toHeight { return bhs, nil @@ -1193,12 +1747,12 @@ func (w *Worker) GetBalanceHistory(address string, fromTimestamp, toTimestamp in func (w *Worker) waitForBackendSync() { // wait a short time if blockbook is synchronizing with backend - inSync, _, _ := w.is.GetSyncState() + inSync, _, _, _ := w.is.GetSyncState() count := 30 for !inSync && count > 0 { time.Sleep(time.Millisecond * 100) count-- - inSync, _, _ = w.is.GetSyncState() + inSync, _, _, _ = w.is.GetSyncState() } } @@ -1381,17 +1935,42 @@ func removeEmpty(stringSlice []string) []string { } // getFiatRatesResult checks if CurrencyRatesTicker contains all necessary data and returns formatted result -func (w *Worker) getFiatRatesResult(currencies []string, ticker *db.CurrencyRatesTicker) (*db.ResultTickerAsString, error) { - currencies = removeEmpty(currencies) +func (w *Worker) getFiatRatesResult(currencies []string, ticker *common.CurrencyRatesTicker, token string) (*FiatTicker, error) { + if token != "" { + rates := make(map[string]float32) + if len(currencies) == 0 { + for currency := range ticker.Rates { + currency = strings.ToLower(currency) + rate := ticker.TokenRateInCurrency(token, currency) + if rate <= 0 { + rate = -1 + } + rates[currency] = rate + } + } else { + for _, currency := range currencies { + currency = strings.ToLower(currency) + rate := ticker.TokenRateInCurrency(token, currency) + if rate <= 0 { + rate = -1 + } + rates[currency] = rate + } + } + return &FiatTicker{ + Timestamp: ticker.Timestamp.UTC().Unix(), + Rates: rates, + }, nil + } if len(currencies) == 0 { // Return all available ticker rates - return &db.ResultTickerAsString{ + return &FiatTicker{ Timestamp: ticker.Timestamp.UTC().Unix(), Rates: ticker.Rates, }, nil } // Check if currencies from the list are available in the ticker rates - rates := make(map[string]float64) + rates := make(map[string]float32) for _, currency := range currencies { currency = strings.ToLower(currency) if rate, found := ticker.Rates[currency]; found { @@ -1400,56 +1979,44 @@ func (w *Worker) getFiatRatesResult(currencies []string, ticker *db.CurrencyRate rates[currency] = -1 } } - return &db.ResultTickerAsString{ + return &FiatTicker{ Timestamp: ticker.Timestamp.UTC().Unix(), Rates: rates, }, nil } -// GetFiatRatesForBlockID returns fiat rates for block height or block hash -func (w *Worker) GetFiatRatesForBlockID(bid string, currencies []string) (*db.ResultTickerAsString, error) { - var ticker *db.CurrencyRatesTicker - bi, err := w.getBlockInfoFromBlockID(bid) - if err != nil { - if err == bchain.ErrBlockNotFound { - return nil, NewAPIError(fmt.Sprintf("Block %v not found", bid), true) - } - return nil, NewAPIError(fmt.Sprintf("Block %v not found, error: %v", bid, err), false) - } - dbi := &db.BlockInfo{Time: bi.Time} // get Unix timestamp from block - tm := time.Unix(dbi.Time, 0) // convert it to Time object - ticker, err = w.db.FiatRatesFindTicker(&tm) - if err != nil { - return nil, NewAPIError(fmt.Sprintf("Error finding ticker: %v", err), false) - } else if ticker == nil { - return nil, NewAPIError(fmt.Sprintf("No tickers available for %s", tm), true) - } - result, err := w.getFiatRatesResult(currencies, ticker) - if err != nil { - return nil, err - } - return result, nil -} - // GetCurrentFiatRates returns last available fiat rates -func (w *Worker) GetCurrentFiatRates(currencies []string) (*db.ResultTickerAsString, error) { - ticker, err := w.db.FiatRatesFindLastTicker() - if err != nil { - return nil, NewAPIError(fmt.Sprintf("Error finding ticker: %v", err), false) - } else if ticker == nil { - return nil, NewAPIError(fmt.Sprintf("No tickers found!"), true) +func (w *Worker) GetCurrentFiatRates(currencies []string, token string) (*FiatTicker, error) { + vsCurrency := "" + currencies = removeEmpty(currencies) + if len(currencies) == 1 { + vsCurrency = currencies[0] } - result, err := w.getFiatRatesResult(currencies, ticker) + ticker := w.fiatRates.GetCurrentTicker(vsCurrency, token) + var err error + if ticker == nil { + if token == "" { + // fallback - get last fiat rate from db if not in current ticker + // not for tokens, many tokens do not have fiat rates at all and it is very costly to do DB search for token without an exchange rate + ticker, err = w.db.FiatRatesFindLastTicker(vsCurrency, token) + } + if err != nil { + return nil, NewAPIError(fmt.Sprintf("Error finding ticker: %v", err), false) + } else if ticker == nil { + return nil, NewAPIError("No tickers found!", true) + } + } + result, err := w.getFiatRatesResult(currencies, ticker, token) if err != nil { return nil, err } return result, nil } -// makeErrorRates returns a map of currrencies, with each value equal to -1 +// makeErrorRates returns a map of currencies, with each value equal to -1 // used when there was an error finding ticker -func makeErrorRates(currencies []string) map[string]float64 { - rates := make(map[string]float64) +func makeErrorRates(currencies []string) map[string]float32 { + rates := make(map[string]float32) for _, currency := range currencies { rates[strings.ToLower(currency)] = -1 } @@ -1457,54 +2024,80 @@ func makeErrorRates(currencies []string) map[string]float64 { } // GetFiatRatesForTimestamps returns fiat rates for each of the provided dates -func (w *Worker) GetFiatRatesForTimestamps(timestamps []int64, currencies []string) (*db.ResultTickersAsString, error) { +func (w *Worker) GetFiatRatesForTimestamps(timestamps []int64, currencies []string, token string) (*FiatTickers, error) { if len(timestamps) == 0 { return nil, NewAPIError("No timestamps provided", true) } + vsCurrency := "" currencies = removeEmpty(currencies) - - ret := &db.ResultTickersAsString{} - for _, timestamp := range timestamps { - date := time.Unix(timestamp, 0) - date = date.UTC() - ticker, err := w.db.FiatRatesFindTicker(&date) - if err != nil { - glog.Errorf("Error finding ticker for date %v. Error: %v", date, err) - ret.Tickers = append(ret.Tickers, db.ResultTickerAsString{Timestamp: date.Unix(), Rates: makeErrorRates(currencies)}) - continue - } else if ticker == nil { - ret.Tickers = append(ret.Tickers, db.ResultTickerAsString{Timestamp: date.Unix(), Rates: makeErrorRates(currencies)}) + if len(currencies) == 1 { + vsCurrency = currencies[0] + } + tickers, err := w.fiatRates.GetTickersForTimestamps(timestamps, vsCurrency, token) + if err != nil { + return nil, err + } + if tickers == nil { + return nil, NewAPIError("No tickers found", true) + } + if len(*tickers) != len(timestamps) { + glog.Error("GetFiatRatesForTimestamps: number of tickers does not match timestamps ", len(*tickers), ", ", len(timestamps)) + return nil, NewAPIError("No tickers found", false) + } + fiatTickers := make([]FiatTicker, len(*tickers)) + for i, t := range *tickers { + if t == nil { + fiatTickers[i] = FiatTicker{Timestamp: timestamps[i], Rates: makeErrorRates(currencies)} continue } - result, err := w.getFiatRatesResult(currencies, ticker) + result, err := w.getFiatRatesResult(currencies, t, token) if err != nil { - ret.Tickers = append(ret.Tickers, db.ResultTickerAsString{Timestamp: date.Unix(), Rates: makeErrorRates(currencies)}) + if apiErr, ok := err.(*APIError); ok { + if apiErr.Public { + return nil, err + } + } + fiatTickers[i] = FiatTicker{Timestamp: timestamps[i], Rates: makeErrorRates(currencies)} continue } - ret.Tickers = append(ret.Tickers, *result) + fiatTickers[i] = *result } - return ret, nil + return &FiatTickers{Tickers: fiatTickers}, nil } -// GetFiatRatesTickersList returns the list of available fiatRates tickers -func (w *Worker) GetFiatRatesTickersList(timestamp int64) (*db.ResultTickerListAsString, error) { - date := time.Unix(timestamp, 0) - date = date.UTC() +// GetFiatRatesForBlockID returns fiat rates for block height or block hash +func (w *Worker) GetFiatRatesForBlockID(blockID string, currencies []string, token string) (*FiatTicker, error) { + bi, err := w.getBlockInfoFromBlockID(blockID) + if err != nil { + if err == bchain.ErrBlockNotFound { + return nil, NewAPIError(fmt.Sprintf("Block %v not found", blockID), true) + } + return nil, NewAPIError(fmt.Sprintf("Block %v not found, error: %v", blockID, err), false) + } + tickers, err := w.GetFiatRatesForTimestamps([]int64{bi.Time}, currencies, token) + if err != nil || tickers == nil || len(tickers.Tickers) == 0 { + return nil, err + } + return &tickers.Tickers[0], nil +} - ticker, err := w.db.FiatRatesFindTicker(&date) +// GetAvailableVsCurrencies returns the list of available versus currencies for exchange rates +func (w *Worker) GetAvailableVsCurrencies(timestamp int64, token string) (*AvailableVsCurrencies, error) { + tickers, err := w.fiatRates.GetTickersForTimestamps([]int64{timestamp}, "", token) if err != nil { return nil, NewAPIError(fmt.Sprintf("Error finding ticker: %v", err), false) - } else if ticker == nil { - return nil, NewAPIError(fmt.Sprintf("No tickers found for date %v.", date), true) } - + if tickers == nil || len(*tickers) == 0 { + return nil, NewAPIError("No tickers found", true) + } + ticker := (*tickers)[0] keys := make([]string, 0, len(ticker.Rates)) for k := range ticker.Rates { keys = append(keys, k) } sort.Strings(keys) // sort to get deterministic results - return &db.ResultTickerListAsString{ + return &AvailableVsCurrencies{ Timestamp: ticker.Timestamp.Unix(), Tickers: keys, }, nil @@ -1670,8 +2263,9 @@ func (w *Worker) GetBlock(bid string, page int, txsOnPage int) (*Block, error) { pg, from, to, page := computePaging(txCount, page, txsOnPage) txs := make([]*Tx, to-from) txi := 0 + addresses := w.newAddressesMapForAliases() for i := from; i < to; i++ { - txs[txi], err = w.txFromTxid(bi.Txids[i], bestheight, AccountDetailsTxHistoryLight, dbi) + txs[txi], err = w.txFromTxid(bi.Txids[i], bestheight, AccountDetailsTxHistoryLight, dbi, addresses) if err != nil { return nil, err } @@ -1703,12 +2297,13 @@ func (w *Worker) GetBlock(bid string, page int, txsOnPage int) (*Block, error) { Txids: bi.Txids, Version: bi.Version, }, - TxCount: txCount, - Transactions: txs, + TxCount: txCount, + Transactions: txs, + AddressAliases: w.getAddressAliases(addresses), }, nil } -// GetBlock returns paged data about block +// GetBlockRaw returns paged data about block func (w *Worker) GetBlockRaw(bid string) (*BlockRaw, error) { hash := w.getBlockHashBlockID(bid) if hash == "" { @@ -1724,6 +2319,48 @@ func (w *Worker) GetBlockRaw(bid string) (*BlockRaw, error) { return &BlockRaw{Hex: hex}, err } +// GetBlockFiltersBatch returns array of block filter data in the format ["height:hash:filter",...] if blocks greater than bestKnownBlockHash +func (w *Worker) GetBlockFiltersBatch(bestKnownBlockHash string, pageSize int) ([]string, error) { + if w.is.BlockGolombFilterP == 0 { + return nil, NewAPIError("Not supported", true) + } + if pageSize > 10000 { + return nil, NewAPIError("pageSize max 10000", true) + } + if pageSize <= 0 { + pageSize = 1000 + } + bi, err := w.chain.GetBlockInfo(bestKnownBlockHash) + if err != nil { + return nil, err + } + bestHeight, _, err := w.db.GetBestBlock() + if err != nil { + return nil, err + } + from := bi.Height + 1 + to := bestHeight + 1 + if from >= to { + return []string{}, nil + } + if to-from > uint32(pageSize) { + to = from + uint32(pageSize) + } + r := make([]string, 0, to-from) + for i := from; i < to; i++ { + blockHash, err := w.db.GetBlockHash(uint32(i)) + if err != nil { + return nil, err + } + blockFilter, err := w.db.GetBlockFilter(blockHash) + if err != nil { + return nil, err + } + r = append(r, fmt.Sprintf("%d:%s:%s", i, blockHash, blockFilter)) + } + return r, err +} + // ComputeFeeStats computes fee distribution in defined blocks and logs them to log func (w *Worker) ComputeFeeStats(blockFrom, blockTo int, stopCompute chan os.Signal) error { bestheight, _, err := w.db.GetBestBlock() @@ -1759,7 +2396,7 @@ func (w *Worker) ComputeFeeStats(blockFrom, blockTo int, stopCompute chan os.Sig glog.Info("ComputeFeeStats interrupted at height ", block) return db.ErrOperationInterrupted default: - tx, err := w.txFromTxid(txid, bestheight, AccountDetailsTxHistoryLight, dbi) + tx, err := w.txFromTxid(txid, bestheight, AccountDetailsTxHistoryLight, dbi, nil) if err != nil { return err } @@ -1784,11 +2421,25 @@ func (w *Worker) ComputeFeeStats(blockFrom, blockTo int, stopCompute chan os.Sig return nil } +func nonZeroTime(t time.Time) *time.Time { + if t.IsZero() { + return nil + } + return &t +} + // GetSystemInfo returns information about system func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) { - start := time.Now() + start := time.Now().UTC() vi := common.GetVersionInfo() - inSync, bestHeight, lastBlockTime := w.is.GetSyncState() + inSync, bestHeight, lastBlockTime, startSync := w.is.GetSyncState() + blockPeriod := w.is.GetAvgBlockPeriod() + if !inSync && !w.is.InitialSync { + // if less than 5 seconds into syncing, return inSync=true to avoid short time not in sync reports that confuse monitoring + if startSync.Add(5 * time.Second).After(start) { + inSync = true + } + } inSyncMempool, lastMempoolTime, mempoolSize := w.is.GetMempoolSyncState() ci, err := w.chain.GetChainInfo() var backendError string @@ -1800,46 +2451,66 @@ func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) { inSync = false inSyncMempool = false } + // for networks with stable block period, set not in sync if last sync more than 12 block periods ago + if inSync && blockPeriod > 0 && w.chainType == bchain.ChainEthereumType { + threshold := 12 * time.Duration(blockPeriod) * time.Second + if lastBlockTime.Add(threshold).Before(time.Now().UTC()) { + inSync = false + } + } var columnStats []common.InternalStateColumn var internalDBSize int64 if internal { columnStats = w.is.GetAllDBColumnStats() internalDBSize = w.is.DBSizeTotal() } + var currentFiatRatesTime time.Time + ct := w.fiatRates.GetCurrentTicker("", "") + if ct != nil { + currentFiatRatesTime = ct.Timestamp + } blockbookInfo := &BlockbookInfo{ - Coin: w.is.Coin, - Host: w.is.Host, - Version: vi.Version, - GitCommit: vi.GitCommit, - BuildTime: vi.BuildTime, - SyncMode: w.is.SyncMode, - InitialSync: w.is.InitialSync, - InSync: inSync, - BestHeight: bestHeight, - LastBlockTime: lastBlockTime, - InSyncMempool: inSyncMempool, - LastMempoolTime: lastMempoolTime, - MempoolSize: mempoolSize, - Decimals: w.chainParser.AmountDecimals(), - DbSize: w.db.DatabaseSizeOnDisk(), - DbSizeFromColumns: internalDBSize, - DbColumns: columnStats, - About: Text.BlockbookAbout, + Coin: w.is.Coin, + Network: w.is.GetNetwork(), + Host: w.is.Host, + Version: vi.Version, + GitCommit: vi.GitCommit, + BuildTime: vi.BuildTime, + SyncMode: w.is.SyncMode, + InitialSync: w.is.InitialSync, + InSync: inSync, + BestHeight: bestHeight, + LastBlockTime: lastBlockTime, + InSyncMempool: inSyncMempool, + LastMempoolTime: lastMempoolTime, + MempoolSize: mempoolSize, + Decimals: w.chainParser.AmountDecimals(), + HasFiatRates: w.is.HasFiatRates, + HasTokenFiatRates: w.is.HasTokenFiatRates, + CurrentFiatRatesTime: nonZeroTime(currentFiatRatesTime), + HistoricalFiatRatesTime: nonZeroTime(w.is.HistoricalFiatRatesTime), + HistoricalTokenFiatRatesTime: nonZeroTime(w.is.HistoricalTokenFiatRatesTime), + SupportedStakingPools: w.chain.EthereumTypeGetSupportedStakingPools(), + DbSize: w.db.DatabaseSizeOnDisk(), + DbSizeFromColumns: internalDBSize, + DbColumns: columnStats, + About: Text.BlockbookAbout, } backendInfo := &common.BackendInfo{ - BackendError: backendError, - BestBlockHash: ci.Bestblockhash, - Blocks: ci.Blocks, - Chain: ci.Chain, - Difficulty: ci.Difficulty, - Headers: ci.Headers, - ProtocolVersion: ci.ProtocolVersion, - SizeOnDisk: ci.SizeOnDisk, - Subversion: ci.Subversion, - Timeoffset: ci.Timeoffset, - Version: ci.Version, - Warnings: ci.Warnings, - Consensus: ci.Consensus, + BackendError: backendError, + BestBlockHash: ci.Bestblockhash, + Blocks: ci.Blocks, + Chain: ci.Chain, + Difficulty: ci.Difficulty, + Headers: ci.Headers, + ProtocolVersion: ci.ProtocolVersion, + SizeOnDisk: ci.SizeOnDisk, + Subversion: ci.Subversion, + Timeoffset: ci.Timeoffset, + Version: ci.Version, + Warnings: ci.Warnings, + ConsensusVersion: ci.ConsensusVersion, + Consensus: ci.Consensus, } w.is.SetBackendInfo(backendInfo) glog.Info("GetSystemInfo, ", time.Since(start)) @@ -1875,12 +2546,18 @@ type bitcoinTypeEstimatedFee struct { lock sync.Mutex } -const bitcoinTypeEstimatedFeeCacheSize = 300 +const estimatedFeeCacheSize = 300 -var bitcoinTypeEstimatedFeeCache [bitcoinTypeEstimatedFeeCacheSize]bitcoinTypeEstimatedFee -var bitcoinTypeEstimatedFeeConservativeCache [bitcoinTypeEstimatedFeeCacheSize]bitcoinTypeEstimatedFee +var estimatedFeeCache [estimatedFeeCacheSize]bitcoinTypeEstimatedFee +var estimatedFeeConservativeCache [estimatedFeeCacheSize]bitcoinTypeEstimatedFee -func (w *Worker) cachedBitcoinTypeEstimateFee(blocks int, conservative bool, s *bitcoinTypeEstimatedFee) (big.Int, error) { +func (w *Worker) cachedEstimateFee(blocks int, conservative bool) (big.Int, error) { + var s *bitcoinTypeEstimatedFee + if conservative { + s = &estimatedFeeConservativeCache[blocks] + } else { + s = &estimatedFeeCache[blocks] + } s.lock.Lock() defer s.lock.Unlock() // 10 seconds cache @@ -1892,18 +2569,22 @@ func (w *Worker) cachedBitcoinTypeEstimateFee(blocks int, conservative bool, s * if err == nil { s.timestamp = time.Now().Unix() s.fee = fee + // store metrics for the first 32 block estimates + if blocks < 33 { + w.metrics.EstimatedFee.With(common.Labels{ + "blocks": strconv.Itoa(blocks), + "conservative": strconv.FormatBool(conservative), + }).Set(float64(fee.Int64())) + } } return fee, err } -// BitcoinTypeEstimateFee returns a fee estimation for given number of blocks +// EstimateFee returns a fee estimation for given number of blocks // it uses 10 second cache to reduce calls to the backend -func (w *Worker) BitcoinTypeEstimateFee(blocks int, conservative bool) (big.Int, error) { - if blocks >= bitcoinTypeEstimatedFeeCacheSize { +func (w *Worker) EstimateFee(blocks int, conservative bool) (big.Int, error) { + if blocks >= estimatedFeeCacheSize { return w.chain.EstimateSmartFee(blocks, conservative) } - if conservative { - return w.cachedBitcoinTypeEstimateFee(blocks, conservative, &bitcoinTypeEstimatedFeeConservativeCache[blocks]) - } - return w.cachedBitcoinTypeEstimateFee(blocks, conservative, &bitcoinTypeEstimatedFeeCache[blocks]) + return w.cachedEstimateFee(blocks, conservative) } diff --git a/api/xpub.go b/api/xpub.go index b5af25d3a1..ca1c4c009c 100644 --- a/api/xpub.go +++ b/api/xpub.go @@ -4,6 +4,7 @@ import ( "fmt" "math/big" "sort" + "strconv" "sync" "time" @@ -266,7 +267,9 @@ func (w *Worker) tokenFromXpubAddress(data *xpubData, ad *xpubAddress, changeInd } } return Token{ - Type: XPUBAddressTokenType, + // Deprecated: Use Standard instead. + Type: bchain.XPUBAddressStandard, + Standard: bchain.XPUBAddressStandard, Name: address, Decimals: w.chainParser.AmountDecimals(), BalanceSat: (*Amount)(balance), @@ -387,7 +390,7 @@ func (w *Worker) getXpubData(xd *bchain.XpubDescriptor, page int, txsOnPage int, } // GetXpubAddress computes address value and gets transactions for given address -func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter, gap int) (*Address, error) { +func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option AccountDetails, filter *AddressFilter, gap int, secondaryCoin string) (*Address, error) { start := time.Now() page-- if page < 0 { @@ -437,6 +440,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc } filtered = true } + addresses := w.newAddressesMapForAliases() // process mempool, only if ToHeight is not specified if filter.ToHeight == 0 && !filter.OnlyConfirmed { txmMap = make(map[string]*Tx) @@ -452,7 +456,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc // the same tx can have multiple addresses from the same xpub, get it from backend it only once tx, foundTx := txmMap[txid.txid] if !foundTx { - tx, err = w.GetTransaction(txid.txid, false, true) + tx, err = w.getTransaction(txid.txid, false, true, addresses) // mempool transaction may fail if err != nil || tx == nil { glog.Warning("GetTransaction in mempool: ", err) @@ -529,7 +533,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc if option == AccountDetailsTxidHistory { txids = append(txids, xpubTxid.txid) } else { - tx, err := w.txFromTxid(xpubTxid.txid, bestheight, option, nil) + tx, err := w.txFromTxid(xpubTxid.txid, bestheight, option, nil, addresses) if err != nil { return nil, err } @@ -539,6 +543,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc } else { txCount = int(data.txCountEstimate) } + addrTxCount := int(data.txCountEstimate) usedTokens := 0 var tokens []Token var xpubAddresses map[string]struct{} @@ -553,7 +558,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc usedTokens++ } if option > AccountDetailsBasic { - token := w.tokenFromXpubAddress(data, ad, ci, i, option) + token := w.tokenFromXpubAddress(data, ad, int(xd.ChangeIndexes[ci]), i, option) if filter.TokensToReturn == TokensToReturnDerived || filter.TokensToReturn == TokensToReturnUsed && ad.balance != nil || filter.TokensToReturn == TokensToReturnNonzeroBalance && ad.balance != nil && !IsZeroBigInt(&ad.balance.BalanceSat) { @@ -566,6 +571,20 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc setIsOwnAddresses(txs, xpubAddresses) var totalReceived big.Int totalReceived.Add(&data.balanceSat, &data.sentSat) + + var secondaryValue float64 + if secondaryCoin != "" { + ticker := w.fiatRates.GetCurrentTicker("", "") + balance, err := strconv.ParseFloat((*Amount)(&data.balanceSat).DecimalString(w.chainParser.AmountDecimals()), 64) + if ticker != nil && err == nil { + r, found := ticker.Rates[secondaryCoin] + if found { + secondaryRate := float64(r) + secondaryValue = secondaryRate * balance + } + } + } + addr := Address{ Paging: pg, AddrStr: xpub, @@ -573,13 +592,16 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc TotalReceivedSat: (*Amount)(&totalReceived), TotalSentSat: (*Amount)(&data.sentSat), Txs: txCount, + AddrTxCount: addrTxCount, UnconfirmedBalanceSat: (*Amount)(&uBalSat), UnconfirmedTxs: unconfirmedTxs, Transactions: txs, Txids: txids, UsedTokens: usedTokens, Tokens: tokens, + SecondaryValue: secondaryValue, XPubAddresses: xpubAddresses, + AddressAliases: w.getAddressAliases(addresses), } glog.Info("GetXpubAddress ", xpub[:xpubLogPrefix], ", cache ", inCache, ", ", txCount, " txs, ", time.Since(start)) return &addr, nil diff --git a/bchain/basechain.go b/bchain/basechain.go index 26ea6a5e1b..7e34c988ca 100644 --- a/bchain/basechain.go +++ b/bchain/basechain.go @@ -39,27 +39,59 @@ func (b *BaseChain) GetMempoolEntry(txid string) (*MempoolEntry, error) { return nil, errors.New("GetMempoolEntry: not supported") } +// LongTermFeeRate returns smallest fee rate from historic blocks. +func (b *BaseChain) LongTermFeeRate() (*LongTermFeeRate, error) { + return nil, errors.New("not supported") +} + // EthereumTypeGetBalance is not supported func (b *BaseChain) EthereumTypeGetBalance(addrDesc AddressDescriptor) (*big.Int, error) { - return nil, errors.New("Not supported") + return nil, errors.New("not supported") } // EthereumTypeGetNonce is not supported func (b *BaseChain) EthereumTypeGetNonce(addrDesc AddressDescriptor) (uint64, error) { - return 0, errors.New("Not supported") + return 0, errors.New("not supported") } // EthereumTypeEstimateGas is not supported func (b *BaseChain) EthereumTypeEstimateGas(params map[string]interface{}) (uint64, error) { - return 0, errors.New("Not supported") + return 0, errors.New("not supported") +} + +// EthereumTypeGetEip1559Fees is not supported +func (b *BaseChain) EthereumTypeGetEip1559Fees() (*Eip1559Fees, error) { + return nil, errors.New("not supported") } -// EthereumTypeGetErc20ContractInfo is not supported -func (b *BaseChain) EthereumTypeGetErc20ContractInfo(contractDesc AddressDescriptor) (*Erc20Contract, error) { - return nil, errors.New("Not supported") +// GetContractInfo is not supported +func (b *BaseChain) GetContractInfo(contractDesc AddressDescriptor) (*ContractInfo, error) { + return nil, errors.New("not supported") } // EthereumTypeGetErc20ContractBalance is not supported func (b *BaseChain) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc AddressDescriptor) (*big.Int, error) { - return nil, errors.New("Not supported") + return nil, errors.New("not supported") +} + +// GetTokenURI returns URI of non fungible or multi token defined by token id +func (p *BaseChain) GetTokenURI(contractDesc AddressDescriptor, tokenID *big.Int) (string, error) { + return "", errors.New("not supported") +} + +func (b *BaseChain) EthereumTypeGetSupportedStakingPools() []string { + return nil +} + +func (b *BaseChain) EthereumTypeGetStakingPoolsData(addrDesc AddressDescriptor) ([]StakingPoolData, error) { + return nil, errors.New("not supported") +} + +// EthereumTypeRpcCall calls eth_call with given data and to address +func (b *BaseChain) EthereumTypeRpcCall(data, to, from string) (string, error) { + return "", errors.New("not supported") +} + +func (b *BaseChain) EthereumTypeGetRawTransaction(txid string) (string, error) { + return "", errors.New("not supported") } diff --git a/bchain/basemempool.go b/bchain/basemempool.go index 79fe3b183c..4561ca8898 100644 --- a/bchain/basemempool.go +++ b/bchain/basemempool.go @@ -14,11 +14,13 @@ type addrIndex struct { type txEntry struct { addrIndexes []addrIndex time uint32 + filter string } type txidio struct { - txid string - io []addrIndex + txid string + io []addrIndex + filter string } // BaseMempool is mempool base handle @@ -70,19 +72,27 @@ func (a MempoolTxidEntries) Less(i, j int) bool { // removeEntryFromMempool removes entry from mempool structs. The caller is responsible for locking! func (m *BaseMempool) removeEntryFromMempool(txid string, entry txEntry) { delete(m.txEntries, txid) + // store already processed addrDesc - it can appear multiple times as a different outpoint + processedAddrDesc := make(map[string]struct{}) for _, si := range entry.addrIndexes { outpoints, found := m.addrDescToTx[si.addrDesc] if found { - newOutpoints := make([]Outpoint, 0, len(outpoints)-1) - for _, o := range outpoints { - if o.Txid != txid { - newOutpoints = append(newOutpoints, o) + _, processed := processedAddrDesc[si.addrDesc] + if !processed { + processedAddrDesc[si.addrDesc] = struct{}{} + j := 0 + for i := 0; i < len(outpoints); i++ { + if outpoints[i].Txid != txid { + outpoints[j] = outpoints[i] + j++ + } + } + outpoints = outpoints[:j] + if len(outpoints) > 0 { + m.addrDescToTx[si.addrDesc] = outpoints + } else { + delete(m.addrDescToTx, si.addrDesc) } - } - if len(newOutpoints) > 0 { - m.addrDescToTx[si.addrDesc] = newOutpoints - } else { - delete(m.addrDescToTx, si.addrDesc) } } } @@ -122,6 +132,7 @@ func (m *BaseMempool) txToMempoolTx(tx *Tx) *MempoolTx { Blocktime: time.Now().Unix(), LockTime: tx.LockTime, Txid: tx.Txid, + VSize: tx.VSize, Version: tx.Version, Vout: tx.Vout, CoinSpecificData: tx.CoinSpecificData, diff --git a/bchain/basemempool_test.go b/bchain/basemempool_test.go new file mode 100644 index 0000000000..5842456d1f --- /dev/null +++ b/bchain/basemempool_test.go @@ -0,0 +1,176 @@ +package bchain + +import ( + reflect "reflect" + "strconv" + "testing" +) + +func generateAddIndexes(count int) []addrIndex { + rv := make([]addrIndex, count) + for i := range count { + rv[i] = addrIndex{ + addrDesc: "ad" + strconv.Itoa(i), + } + } + return rv +} + +func generateTxEntries(count int, skipTx int) map[string]txEntry { + rv := make(map[string]txEntry) + for i := range count { + if i != skipTx { + tx := "tx" + strconv.Itoa(i) + rv[tx] = txEntry{ + addrIndexes: generateAddIndexes(count), + } + } + } + return rv +} + +func generateAddrDescToTx(count int, skipTx int) map[string][]Outpoint { + rv := make(map[string][]Outpoint) + for i := range count { + ad := "ad" + strconv.Itoa(i) + op := []Outpoint{} + for j := range count { + if j != skipTx { + tx := "tx" + strconv.Itoa(j) + op = append(op, Outpoint{ + Txid: tx, + }) + } + } + if len(op) > 0 { + rv[ad] = op + } + } + return rv +} + +func TestBaseMempool_removeEntryFromMempool(t *testing.T) { + tests := []struct { + name string + m *BaseMempool + want *BaseMempool + txid string + entry txEntry + }{ + { + name: "test1", + m: &BaseMempool{ + txEntries: map[string]txEntry{ + "tx1": { + addrIndexes: []addrIndex{{addrDesc: "ad1", n: 0}, {addrDesc: "ad1", n: 1}}, + }, + "tx2": { + addrIndexes: []addrIndex{{addrDesc: "ad1"}}, + }, + }, + addrDescToTx: map[string][]Outpoint{ + "ad1": { + {Txid: "tx1", Vout: 0}, + {Txid: "tx1", Vout: 1}, + {Txid: "tx2"}, + }, + }, + }, + want: &BaseMempool{ + txEntries: map[string]txEntry{ + "tx2": { + addrIndexes: []addrIndex{{addrDesc: "ad1"}}, + }, + }, + addrDescToTx: map[string][]Outpoint{ + "ad1": {{Txid: "tx2"}}}, + }, + txid: "tx1", + entry: txEntry{ + addrIndexes: []addrIndex{ + {addrDesc: "ad1"}, + {addrDesc: "ad2"}, + }, + }, + }, + { + name: "test2", + m: &BaseMempool{ + txEntries: map[string]txEntry{ + "tx1": { + addrIndexes: []addrIndex{{addrDesc: "ad1"}, {addrDesc: "ad1", n: 1}}, + }, + }, + addrDescToTx: map[string][]Outpoint{ + "ad1": { + {Txid: "tx1", Vout: 0}, + {Txid: "tx1", Vout: 1}, + }, + }, + }, + want: &BaseMempool{ + txEntries: map[string]txEntry{}, + addrDescToTx: map[string][]Outpoint{}, + }, + txid: "tx1", + entry: txEntry{ + addrIndexes: []addrIndex{ + {addrDesc: "ad1"}, + }, + }, + }, + { + name: "generated1", + m: &BaseMempool{ + txEntries: generateTxEntries(1, -1), + addrDescToTx: generateAddrDescToTx(1, -1), + }, + want: &BaseMempool{ + txEntries: generateTxEntries(1, 0), + addrDescToTx: generateAddrDescToTx(1, 0), + }, + txid: "tx0", + entry: txEntry{ + addrIndexes: generateAddIndexes(1), + }, + }, + { + name: "generated2", + m: &BaseMempool{ + txEntries: generateTxEntries(2, -1), + addrDescToTx: generateAddrDescToTx(2, -1), + }, + want: &BaseMempool{ + txEntries: generateTxEntries(2, 1), + addrDescToTx: generateAddrDescToTx(2, 1), + }, + txid: "tx1", + entry: txEntry{ + addrIndexes: generateAddIndexes(2), + }, + }, + { + name: "generated5000", + m: &BaseMempool{ + txEntries: generateTxEntries(5000, -1), + addrDescToTx: generateAddrDescToTx(5000, -1), + }, + want: &BaseMempool{ + txEntries: generateTxEntries(5000, 2), + addrDescToTx: generateAddrDescToTx(5000, 2), + }, + txid: "tx2", + entry: txEntry{ + addrIndexes: generateAddIndexes(5000), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.m.removeEntryFromMempool(tt.txid, tt.entry) + if !reflect.DeepEqual(tt.m, tt.want) { + t.Errorf("removeEntryFromMempool() got = %+v, want %+v", tt.m, tt.want) + } + }) + } +} diff --git a/bchain/baseparser.go b/bchain/baseparser.go index 0f1ebe57f3..9a7dcbea91 100644 --- a/bchain/baseparser.go +++ b/bchain/baseparser.go @@ -6,16 +6,17 @@ import ( "math/big" "strings" - "github.com/gogo/protobuf/proto" "github.com/golang/glog" "github.com/juju/errors" "github.com/trezor/blockbook/common" + "google.golang.org/protobuf/proto" ) // BaseParser implements data parsing/handling functionality base for all other parsers type BaseParser struct { BlockAddressesToKeep int AmountDecimalPoint int + AddressAliases bool } // ParseBlock parses raw block to our Block struct - currently not implemented @@ -46,10 +47,7 @@ func (p *BaseParser) AmountToBigInt(n common.JSONNumber) (big.Int, error) { var r big.Int s := string(n) i := strings.IndexByte(s, '.') - d := p.AmountDecimalPoint - if d > len(zeros) { - d = len(zeros) - } + d := min(p.AmountDecimalPoint, len(zeros)) if i == -1 { s = s + zeros[:d] } else { @@ -103,6 +101,11 @@ func (p *BaseParser) AmountDecimals() int { return p.AmountDecimalPoint } +// UseAddressAliases returns true if address aliases are enabled +func (p *BaseParser) UseAddressAliases() bool { + return p.AddressAliases +} + // ParseTxFromJson parses JSON message containing transaction and returns Tx struct func (p *BaseParser) ParseTxFromJson(msg json.RawMessage) (*Tx, error) { var tx Tx @@ -167,6 +170,11 @@ func (p *BaseParser) MinimumCoinbaseConfirmations() int { return 0 } +// SupportsVSize returns true if vsize of a transaction should be computed and returned by API +func (p *BaseParser) SupportsVSize() bool { + return false +} + // PackTx packs transaction to byte array using protobuf func (p *BaseParser) PackTx(tx *Tx, height uint32, blockTime int64) ([]byte, error) { var err error @@ -210,6 +218,7 @@ func (p *BaseParser) PackTx(tx *Tx, height uint32, blockTime int64) ([]byte, err Vin: pti, Vout: pto, Version: tx.Version, + VSize: tx.VSize, } if pt.Hex, err = hex.DecodeString(tx.Hex); err != nil { return nil, errors.Annotatef(err, "Hex %v", tx.Hex) @@ -270,6 +279,7 @@ func (p *BaseParser) UnpackTx(buf []byte) (*Tx, uint32, error) { Vin: vin, Vout: vout, Version: pt.Version, + VSize: pt.VSize, } return &tx, pt.Height, nil } @@ -300,7 +310,12 @@ func (p *BaseParser) DeriveAddressDescriptorsFromTo(descriptor *XpubDescriptor, return nil, errors.New("Not supported") } -// EthereumTypeGetErc20FromTx is unsupported -func (p *BaseParser) EthereumTypeGetErc20FromTx(tx *Tx) ([]Erc20Transfer, error) { +// EthereumTypeGetTokenTransfersFromTx is unsupported +func (p *BaseParser) EthereumTypeGetTokenTransfersFromTx(tx *Tx) (TokenTransfers, error) { return nil, errors.New("Not supported") } + +// FormatAddressAlias makes possible to do coin specific formatting to an address alias +func (p *BaseParser) FormatAddressAlias(address string, name string) string { + return name +} diff --git a/bchain/coins/arbitrum/arbitrumrpc.go b/bchain/coins/arbitrum/arbitrumrpc.go new file mode 100644 index 0000000000..d862e4b8af --- /dev/null +++ b/bchain/coins/arbitrum/arbitrumrpc.go @@ -0,0 +1,79 @@ +package arbitrum + +import ( + "context" + "encoding/json" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" +) + +const ( + ArbitrumOneMainNet eth.Network = 42161 + ArbitrumNovaMainNet eth.Network = 42170 +) + +// ArbitrumRPC is an interface to JSON-RPC arbitrum service. +type ArbitrumRPC struct { + *eth.EthereumRPC +} + +// NewArbitrumRPC returns new ArbitrumRPC instance. +func NewArbitrumRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + c, err := eth.NewEthereumRPC(config, pushHandler) + if err != nil { + return nil, err + } + + s := &ArbitrumRPC{ + EthereumRPC: c.(*eth.EthereumRPC), + } + + return s, nil +} + +// Initialize arbitrum rpc interface +func (b *ArbitrumRPC) Initialize() error { + b.OpenRPC = eth.OpenRPC + + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + // set chain specific + b.Client = ec + b.RPC = rc + b.NewBlock = eth.NewEthereumNewBlock() + b.NewTx = eth.NewEthereumNewTx() + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + id, err := b.Client.NetworkID(ctx) + if err != nil { + return err + } + + // parameters for getInfo request + switch eth.Network(id.Uint64()) { + case ArbitrumOneMainNet: + b.MainNetChainID = ArbitrumOneMainNet + b.Testnet = false + b.Network = "livenet" + case ArbitrumNovaMainNet: + b.MainNetChainID = ArbitrumNovaMainNet + b.Testnet = false + b.Network = "livenet" + default: + return errors.Errorf("Unknown network id %v", id) + } + + b.InitAlternativeProviders() + + glog.Info("rpc: block chain ", b.Network) + + return nil +} diff --git a/bchain/coins/avalanche/avalancherpc.go b/bchain/coins/avalanche/avalancherpc.go new file mode 100644 index 0000000000..916c4c2f45 --- /dev/null +++ b/bchain/coins/avalanche/avalancherpc.go @@ -0,0 +1,133 @@ +package avalanche + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + + jsontypes "github.com/ava-labs/avalanchego/utils/json" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" +) + +const ( + // MainNet is production network + MainNet eth.Network = 43114 +) + +// AvalancheRPC is an interface to JSON-RPC avalanche service. +type AvalancheRPC struct { + *eth.EthereumRPC + info *rpc.Client +} + +// NewAvalancheRPC returns new AvalancheRPC instance. +func NewAvalancheRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + c, err := eth.NewEthereumRPC(config, pushHandler) + if err != nil { + return nil, err + } + + s := &AvalancheRPC{ + EthereumRPC: c.(*eth.EthereumRPC), + } + + return s, nil +} + +// Initialize avalanche rpc interface +func (b *AvalancheRPC) Initialize() error { + b.OpenRPC = func(url string) (bchain.EVMRPCClient, bchain.EVMClient, error) { + r, err := rpc.Dial(url) + if err != nil { + return nil, nil, err + } + rc := &AvalancheRPCClient{Client: r} + c := &AvalancheClient{Client: ethclient.NewClient(r), AvalancheRPCClient: rc} + return rc, c, nil + } + + rpcClient, client, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + rpcUrl, err := url.Parse(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + scheme := "http" + if rpcUrl.Scheme == "wss" || rpcUrl.Scheme == "https" { + scheme = "https" + } + + infoClient, err := rpc.DialHTTP(fmt.Sprintf("%s://%s/ext/info", scheme, rpcUrl.Host)) + if err != nil { + return err + } + + // set chain specific + b.Client = client + b.RPC = rpcClient + b.info = infoClient + b.MainNetChainID = MainNet + b.NewBlock = &AvalancheNewBlock{channel: make(chan *Header)} + b.NewTx = &AvalancheNewTx{channel: make(chan common.Hash)} + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + id, err := b.Client.NetworkID(ctx) + if err != nil { + return err + } + + // parameters for getInfo request + switch eth.Network(id.Uint64()) { + case MainNet: + b.Testnet = false + b.Network = "livenet" + default: + return errors.Errorf("Unknown network id %v", id) + } + + b.InitAlternativeProviders() + + glog.Info("rpc: block chain ", b.Network) + + return nil +} + +// GetChainInfo returns information about the connected backend +func (b *AvalancheRPC) GetChainInfo() (*bchain.ChainInfo, error) { + ci, err := b.EthereumRPC.GetChainInfo() + if err != nil { + return nil, err + } + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + var v struct { + Version string `json:"version"` + DatabaseVersion string `json:"databaseVersion"` + RPCProtocolVersion jsontypes.Uint32 `json:"rpcProtocolVersion"` + GitCommit string `json:"gitCommit"` + VMVersions map[string]string `json:"vmVersions"` + } + + if err := b.info.CallContext(ctx, &v, "info.getNodeVersion"); err == nil { + if avm, ok := v.VMVersions["avm"]; ok { + ci.Version = avm + } + } + + return ci, nil +} diff --git a/bchain/coins/avalanche/evm.go b/bchain/coins/avalanche/evm.go new file mode 100644 index 0000000000..ffff75559c --- /dev/null +++ b/bchain/coins/avalanche/evm.go @@ -0,0 +1,143 @@ +package avalanche + +import ( + "context" + "math/big" + "strings" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" + "github.com/trezor/blockbook/bchain" +) + +// AvalancheClient wraps a client to implement the EVMClient interface +type AvalancheClient struct { + *ethclient.Client + *AvalancheRPCClient +} + +// HeaderByNumber returns a block header that implements the EVMHeader interface +func (c *AvalancheClient) HeaderByNumber(ctx context.Context, number *big.Int) (bchain.EVMHeader, error) { + var head *Header + err := c.AvalancheRPCClient.CallContext(ctx, &head, "eth_getBlockByNumber", bchain.ToBlockNumArg(number), false) + if err == nil && head == nil { + err = ethereum.NotFound + } + return &AvalancheHeader{Header: head}, err +} + +// EstimateGas returns the current estimated gas cost for executing a transaction +func (c *AvalancheClient) EstimateGas(ctx context.Context, msg interface{}) (uint64, error) { + return c.Client.EstimateGas(ctx, msg.(ethereum.CallMsg)) +} + +// BalanceAt returns the balance for the given account at a specific block, or latest known block if no block number is provided +func (c *AvalancheClient) BalanceAt(ctx context.Context, addrDesc bchain.AddressDescriptor, blockNumber *big.Int) (*big.Int, error) { + return c.Client.BalanceAt(ctx, common.BytesToAddress(addrDesc), blockNumber) +} + +// NonceAt returns the nonce for the given account at a specific block, or latest known block if no block number is provided +func (c *AvalancheClient) NonceAt(ctx context.Context, addrDesc bchain.AddressDescriptor, blockNumber *big.Int) (uint64, error) { + return c.Client.NonceAt(ctx, common.BytesToAddress(addrDesc), blockNumber) +} + +// AvalancheRPCClient wraps an rpc client to implement the EVMRPCClient interface +type AvalancheRPCClient struct { + *rpc.Client +} + +// EthSubscribe subscribes to events and returns a client subscription that implements the EVMClientSubscription interface +func (c *AvalancheRPCClient) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (bchain.EVMClientSubscription, error) { + sub, err := c.Client.EthSubscribe(ctx, channel, args...) + if err != nil { + return nil, err + } + + return &AvalancheClientSubscription{ClientSubscription: sub}, nil +} + +// CallContext performs a JSON-RPC call with the given arguments +func (c *AvalancheRPCClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error { + err := c.Client.CallContext(ctx, result, method, args...) + // unfinalized data cannot be queried error returned when trying to query a block height greater than last finalized block + // do not throw rpc error and instead treat as ErrBlockNotFound + // https://docs.avax.network/quickstart/exchanges/integrate-exchange-with-avalanche#determining-finality + if err != nil && !strings.Contains(err.Error(), "cannot query unfinalized data") { + return err + } + return nil +} + +// AvalancheHeader wraps a block header to implement the EVMHeader interface +type AvalancheHeader struct { + *Header +} + +// Hash returns the block hash as a hex string +func (h *AvalancheHeader) Hash() string { + return h.Header.Hash().Hex() +} + +// Number returns the block number +func (h *AvalancheHeader) Number() *big.Int { + return h.Header.Number +} + +// Difficulty returns the block difficulty +func (h *AvalancheHeader) Difficulty() *big.Int { + return h.Header.Difficulty +} + +// AvalancheHash wraps a transaction hash to implement the EVMHash interface +type AvalancheHash struct { + common.Hash +} + +// AvalancheClientSubscription wraps a client subcription to implement the EVMClientSubscription interface +type AvalancheClientSubscription struct { + *rpc.ClientSubscription +} + +// AvalancheNewBlock wraps a block header channel to implement the EVMNewBlockSubscriber interface +type AvalancheNewBlock struct { + channel chan *Header +} + +// Channel returns the underlying channel as an empty interface +func (s *AvalancheNewBlock) Channel() interface{} { + return s.channel +} + +// Read from the underlying channel and return a block header that implements the EVMHeader interface +func (s *AvalancheNewBlock) Read() (bchain.EVMHeader, bool) { + h, ok := <-s.channel + return &AvalancheHeader{Header: h}, ok +} + +// Close the underlying channel +func (s *AvalancheNewBlock) Close() { + close(s.channel) +} + +// AvalancheNewTx wraps a transaction hash channel to conform with the EVMNewTxSubscriber interface +type AvalancheNewTx struct { + channel chan common.Hash +} + +// Channel returns the underlying channel as an empty interface +func (s *AvalancheNewTx) Channel() interface{} { + return s.channel +} + +// Read from the underlying channel and return a transaction hash that implements the EVMHash interface +func (s *AvalancheNewTx) Read() (bchain.EVMHash, bool) { + h, ok := <-s.channel + return &AvalancheHash{Hash: h}, ok +} + +// Close the underlying channel +func (s *AvalancheNewTx) Close() { + close(s.channel) +} diff --git a/bchain/coins/avalanche/types.go b/bchain/coins/avalanche/types.go new file mode 100644 index 0000000000..c07ebab244 --- /dev/null +++ b/bchain/coins/avalanche/types.go @@ -0,0 +1,232 @@ +package avalanche + +import ( + "encoding/json" + "errors" + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/core/types" +) + +// Header represents a block header in the Avalanche blockchain. +type Header struct { + RpcHash common.Hash `json:"hash" gencodec:"required"` + ParentHash common.Hash `json:"parentHash" gencodec:"required"` + UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` + Coinbase common.Address `json:"miner" gencodec:"required"` + Root common.Hash `json:"stateRoot" gencodec:"required"` + TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` + ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` + Bloom types.Bloom `json:"logsBloom" gencodec:"required"` + Difficulty *big.Int `json:"difficulty" gencodec:"required"` + Number *big.Int `json:"number" gencodec:"required"` + GasLimit uint64 `json:"gasLimit" gencodec:"required"` + GasUsed uint64 `json:"gasUsed" gencodec:"required"` + Time uint64 `json:"timestamp" gencodec:"required"` + Extra []byte `json:"extraData" gencodec:"required"` + MixDigest common.Hash `json:"mixHash"` + Nonce types.BlockNonce `json:"nonce"` + ExtDataHash common.Hash `json:"extDataHash" gencodec:"required"` + + // BaseFee was added by EIP-1559 and is ignored in legacy headers. + BaseFee *big.Int `json:"baseFeePerGas" rlp:"optional"` + + // ExtDataGasUsed was added by Apricot Phase 4 and is ignored in legacy + // headers. + // + // It is not a uint64 like GasLimit or GasUsed because it is not possible to + // correctly encode this field optionally with uint64. + ExtDataGasUsed *big.Int `json:"extDataGasUsed" rlp:"optional"` + + // BlockGasCost was added by Apricot Phase 4 and is ignored in legacy + // headers. + BlockGasCost *big.Int `json:"blockGasCost" rlp:"optional"` + + // BlobGasUsed was added by EIP-4844 and is ignored in legacy headers. + BlobGasUsed *uint64 `json:"blobGasUsed" rlp:"optional"` + + // ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers. + ExcessBlobGas *uint64 `json:"excessBlobGas" rlp:"optional"` + + // ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers. + ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` +} + +// MarshalJSON marshals as JSON. +func (h Header) MarshalJSON() ([]byte, error) { + type Header struct { + ParentHash common.Hash `json:"parentHash" gencodec:"required"` + UncleHash common.Hash `json:"sha3Uncles" gencodec:"required"` + Coinbase common.Address `json:"miner" gencodec:"required"` + Root common.Hash `json:"stateRoot" gencodec:"required"` + TxHash common.Hash `json:"transactionsRoot" gencodec:"required"` + ReceiptHash common.Hash `json:"receiptsRoot" gencodec:"required"` + Bloom types.Bloom `json:"logsBloom" gencodec:"required"` + Difficulty *hexutil.Big `json:"difficulty" gencodec:"required"` + Number *hexutil.Big `json:"number" gencodec:"required"` + GasLimit hexutil.Uint64 `json:"gasLimit" gencodec:"required"` + GasUsed hexutil.Uint64 `json:"gasUsed" gencodec:"required"` + Time hexutil.Uint64 `json:"timestamp" gencodec:"required"` + Extra hexutil.Bytes `json:"extraData" gencodec:"required"` + MixDigest common.Hash `json:"mixHash"` + Nonce types.BlockNonce `json:"nonce"` + ExtDataHash common.Hash `json:"extDataHash" gencodec:"required"` + BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"` + ExtDataGasUsed *hexutil.Big `json:"extDataGasUsed" rlp:"optional"` + BlockGasCost *hexutil.Big `json:"blockGasCost" rlp:"optional"` + BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed" rlp:"optional"` + ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas" rlp:"optional"` + ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` + Hash common.Hash `json:"hash"` + } + var enc Header + enc.ParentHash = h.ParentHash + enc.UncleHash = h.UncleHash + enc.Coinbase = h.Coinbase + enc.Root = h.Root + enc.TxHash = h.TxHash + enc.ReceiptHash = h.ReceiptHash + enc.Bloom = h.Bloom + enc.Difficulty = (*hexutil.Big)(h.Difficulty) + enc.Number = (*hexutil.Big)(h.Number) + enc.GasLimit = hexutil.Uint64(h.GasLimit) + enc.GasUsed = hexutil.Uint64(h.GasUsed) + enc.Time = hexutil.Uint64(h.Time) + enc.Extra = h.Extra + enc.MixDigest = h.MixDigest + enc.Nonce = h.Nonce + enc.ExtDataHash = h.ExtDataHash + enc.BaseFee = (*hexutil.Big)(h.BaseFee) + enc.ExtDataGasUsed = (*hexutil.Big)(h.ExtDataGasUsed) + enc.BlockGasCost = (*hexutil.Big)(h.BlockGasCost) + enc.BlobGasUsed = (*hexutil.Uint64)(h.BlobGasUsed) + enc.ExcessBlobGas = (*hexutil.Uint64)(h.ExcessBlobGas) + enc.ParentBeaconRoot = h.ParentBeaconRoot + enc.Hash = h.Hash() + return json.Marshal(&enc) +} + +// UnmarshalJSON unmarshals from JSON. +func (h *Header) UnmarshalJSON(input []byte) error { + type Header struct { + RpcHash *common.Hash `json:"hash"` + ParentHash *common.Hash `json:"parentHash" gencodec:"required"` + UncleHash *common.Hash `json:"sha3Uncles" gencodec:"required"` + Coinbase *common.Address `json:"miner" gencodec:"required"` + Root *common.Hash `json:"stateRoot" gencodec:"required"` + TxHash *common.Hash `json:"transactionsRoot" gencodec:"required"` + ReceiptHash *common.Hash `json:"receiptsRoot" gencodec:"required"` + Bloom *types.Bloom `json:"logsBloom" gencodec:"required"` + Difficulty *hexutil.Big `json:"difficulty" gencodec:"required"` + Number *hexutil.Big `json:"number" gencodec:"required"` + GasLimit *hexutil.Uint64 `json:"gasLimit" gencodec:"required"` + GasUsed *hexutil.Uint64 `json:"gasUsed" gencodec:"required"` + Time *hexutil.Uint64 `json:"timestamp" gencodec:"required"` + Extra *hexutil.Bytes `json:"extraData" gencodec:"required"` + MixDigest *common.Hash `json:"mixHash"` + Nonce *types.BlockNonce `json:"nonce"` + ExtDataHash *common.Hash `json:"extDataHash" gencodec:"required"` + BaseFee *hexutil.Big `json:"baseFeePerGas" rlp:"optional"` + ExtDataGasUsed *hexutil.Big `json:"extDataGasUsed" rlp:"optional"` + BlockGasCost *hexutil.Big `json:"blockGasCost" rlp:"optional"` + BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed" rlp:"optional"` + ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas" rlp:"optional"` + ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot" rlp:"optional"` + } + var dec Header + if err := json.Unmarshal(input, &dec); err != nil { + return err + } + if dec.RpcHash == nil { + return errors.New("missing required field 'hash' for Header") + } + h.RpcHash = *dec.RpcHash + if dec.ParentHash == nil { + return errors.New("missing required field 'parentHash' for Header") + } + h.ParentHash = *dec.ParentHash + if dec.UncleHash == nil { + return errors.New("missing required field 'sha3Uncles' for Header") + } + h.UncleHash = *dec.UncleHash + if dec.Coinbase == nil { + return errors.New("missing required field 'miner' for Header") + } + h.Coinbase = *dec.Coinbase + if dec.Root == nil { + return errors.New("missing required field 'stateRoot' for Header") + } + h.Root = *dec.Root + if dec.TxHash == nil { + return errors.New("missing required field 'transactionsRoot' for Header") + } + h.TxHash = *dec.TxHash + if dec.ReceiptHash == nil { + return errors.New("missing required field 'receiptsRoot' for Header") + } + h.ReceiptHash = *dec.ReceiptHash + if dec.Bloom == nil { + return errors.New("missing required field 'logsBloom' for Header") + } + h.Bloom = *dec.Bloom + if dec.Difficulty == nil { + return errors.New("missing required field 'difficulty' for Header") + } + h.Difficulty = (*big.Int)(dec.Difficulty) + if dec.Number == nil { + return errors.New("missing required field 'number' for Header") + } + h.Number = (*big.Int)(dec.Number) + if dec.GasLimit == nil { + return errors.New("missing required field 'gasLimit' for Header") + } + h.GasLimit = uint64(*dec.GasLimit) + if dec.GasUsed == nil { + return errors.New("missing required field 'gasUsed' for Header") + } + h.GasUsed = uint64(*dec.GasUsed) + if dec.Time == nil { + return errors.New("missing required field 'timestamp' for Header") + } + h.Time = uint64(*dec.Time) + if dec.Extra == nil { + return errors.New("missing required field 'extraData' for Header") + } + h.Extra = *dec.Extra + if dec.MixDigest != nil { + h.MixDigest = *dec.MixDigest + } + if dec.Nonce != nil { + h.Nonce = *dec.Nonce + } + if dec.ExtDataHash == nil { + return errors.New("missing required field 'extDataHash' for Header") + } + h.ExtDataHash = *dec.ExtDataHash + if dec.BaseFee != nil { + h.BaseFee = (*big.Int)(dec.BaseFee) + } + if dec.ExtDataGasUsed != nil { + h.ExtDataGasUsed = (*big.Int)(dec.ExtDataGasUsed) + } + if dec.BlockGasCost != nil { + h.BlockGasCost = (*big.Int)(dec.BlockGasCost) + } + if dec.BlobGasUsed != nil { + h.BlobGasUsed = (*uint64)(dec.BlobGasUsed) + } + if dec.ExcessBlobGas != nil { + h.ExcessBlobGas = (*uint64)(dec.ExcessBlobGas) + } + if dec.ParentBeaconRoot != nil { + h.ParentBeaconRoot = dec.ParentBeaconRoot + } + return nil +} + +// Hash returns the block hash of the header +func (h *Header) Hash() common.Hash { + return h.RpcHash +} diff --git a/bchain/coins/base/baserpc.go b/bchain/coins/base/baserpc.go new file mode 100644 index 0000000000..f0d0192118 --- /dev/null +++ b/bchain/coins/base/baserpc.go @@ -0,0 +1,75 @@ +package base + +import ( + "context" + "encoding/json" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" +) + +const ( + // MainNet is production network + MainNet eth.Network = 8453 +) + +// BaseRPC is an interface to JSON-RPC base service. +type BaseRPC struct { + *eth.EthereumRPC +} + +// NewBaseRPC returns new BaseRPC instance. +func NewBaseRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + c, err := eth.NewEthereumRPC(config, pushHandler) + if err != nil { + return nil, err + } + + s := &BaseRPC{ + EthereumRPC: c.(*eth.EthereumRPC), + } + + return s, nil +} + +// Initialize base rpc interface +func (b *BaseRPC) Initialize() error { + b.OpenRPC = eth.OpenRPC + + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + // set chain specific + b.Client = ec + b.RPC = rc + b.MainNetChainID = MainNet + b.NewBlock = eth.NewEthereumNewBlock() + b.NewTx = eth.NewEthereumNewTx() + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + id, err := b.Client.NetworkID(ctx) + if err != nil { + return err + } + + // parameters for getInfo request + switch eth.Network(id.Uint64()) { + case MainNet: + b.Testnet = false + b.Network = "livenet" + default: + return errors.Errorf("Unknown network id %v", id) + } + + b.InitAlternativeProviders() + + glog.Info("rpc: block chain ", b.Network) + + return nil +} diff --git a/bchain/coins/bch/bcashparser_test.go b/bchain/coins/bch/bcashparser_test.go index a862f558f9..3aec739606 100644 --- a/bchain/coins/bch/bcashparser_test.go +++ b/bchain/coins/bch/bcashparser_test.go @@ -337,10 +337,15 @@ func Test_UnpackTx(t *testing.T) { t.Run(tt.name, func(t *testing.T) { b, _ := hex.DecodeString(tt.args.packedTx) got, got1, err := tt.args.parser.UnpackTx(b) + if (err != nil) != tt.wantErr { t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr) return } + // ignore witness unpacking + for i := range got.Vin { + got.Vin[i].Witness = nil + } if !reflect.DeepEqual(got, tt.want) { t.Errorf("unpackTx() got = %v, want %v", got, tt.want) } diff --git a/bchain/coins/bellcoin/bellcoinparser_test.go b/bchain/coins/bellcoin/bellcoinparser_test.go index 8ed7e2959b..e747fe0312 100644 --- a/bchain/coins/bellcoin/bellcoinparser_test.go +++ b/bchain/coins/bellcoin/bellcoinparser_test.go @@ -316,6 +316,10 @@ func Test_UnpackTx(t *testing.T) { t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr) return } + // ignore witness unpacking + for i := range got.Vin { + got.Vin[i].Witness = nil + } if !reflect.DeepEqual(got, tt.want) { t.Errorf("unpackTx() got = %v, want %v", got, tt.want) } diff --git a/bchain/coins/bitcore/bitcoreparser_test.go b/bchain/coins/bitcore/bitcoreparser_test.go index a7c7d8c9f6..d3330de6c1 100644 --- a/bchain/coins/bitcore/bitcoreparser_test.go +++ b/bchain/coins/bitcore/bitcoreparser_test.go @@ -81,7 +81,7 @@ func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) { var ( testTx1 bchain.Tx - testTxPacked1 = "0a20fcd4f2e45787a33571bc9b2ce939d6e8e51fa053296de9240f05455702bd954012e2010200000001f69bd1fd76e52a426f21332e3b7cfbc3350eacbd21c6e0c11a7ae11919803ef0010000006b483045022100d1fa62b9d7860a03e1dcd4734fe42457cb508ebb49e896d7a77748d997d09fba022005f1657b39451afe97076d8667fe5f6f18ca76391521ab84d09d5b82137d933b0121035aaf032f13761f27465467dc73f1998a80dd4d85a6353d2832a7244d7b591d3effffffff02a87322b3010000001976a914d0c320db3fbd0abe2b6fe31a3bca4fed8ce8669588ac94b94f37000000001976a9145584ee07090af59938e991c9d8e9e945c99a449f88ac0000000018858a8ce205200028f9f3133299010a001220f03e801919e17a1ac1e0c621bdac0e35c3fb7c3b2e33216f422ae576fdd19bf61801226b483045022100d1fa62b9d7860a03e1dcd4734fe42457cb508ebb49e896d7a77748d997d09fba022005f1657b39451afe97076d8667fe5f6f18ca76391521ab84d09d5b82137d933b0121035aaf032f13761f27465467dc73f1998a80dd4d85a6353d2832a7244d7b591d3e28ffffffff0f3a480a0501b32273a810001a1976a914d0c320db3fbd0abe2b6fe31a3bca4fed8ce8669588ac22223259336546797741414673617039757139726942474143684e326858356a6e7268753a470a04374fb99410011a1976a9145584ee07090af59938e991c9d8e9e945c99a449f88ac2222324c6f7a646b704450723562356b6a66445042315a76454c597735734475684139594002" + testTxPacked1 = "0a20fcd4f2e45787a33571bc9b2ce939d6e8e51fa053296de9240f05455702bd954012e2010200000001f69bd1fd76e52a426f21332e3b7cfbc3350eacbd21c6e0c11a7ae11919803ef0010000006b483045022100d1fa62b9d7860a03e1dcd4734fe42457cb508ebb49e896d7a77748d997d09fba022005f1657b39451afe97076d8667fe5f6f18ca76391521ab84d09d5b82137d933b0121035aaf032f13761f27465467dc73f1998a80dd4d85a6353d2832a7244d7b591d3effffffff02a87322b3010000001976a914d0c320db3fbd0abe2b6fe31a3bca4fed8ce8669588ac94b94f37000000001976a9145584ee07090af59938e991c9d8e9e945c99a449f88ac0000000018858a8ce20528f9f3133297011220f03e801919e17a1ac1e0c621bdac0e35c3fb7c3b2e33216f422ae576fdd19bf61801226b483045022100d1fa62b9d7860a03e1dcd4734fe42457cb508ebb49e896d7a77748d997d09fba022005f1657b39451afe97076d8667fe5f6f18ca76391521ab84d09d5b82137d933b0121035aaf032f13761f27465467dc73f1998a80dd4d85a6353d2832a7244d7b591d3e28ffffffff0f3a460a0501b32273a81a1976a914d0c320db3fbd0abe2b6fe31a3bca4fed8ce8669588ac22223259336546797741414673617039757139726942474143684e326858356a6e7268753a470a04374fb99410011a1976a9145584ee07090af59938e991c9d8e9e945c99a449f88ac2222324c6f7a646b704450723562356b6a66445042315a76454c597735734475684139594002" ) func init() { diff --git a/bchain/coins/blockchain.go b/bchain/coins/blockchain.go index 1fe7baae17..65b65d41a4 100644 --- a/bchain/coins/blockchain.go +++ b/bchain/coins/blockchain.go @@ -4,17 +4,21 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" "math/big" + "os" "reflect" "time" "github.com/juju/errors" "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/arbitrum" + "github.com/trezor/blockbook/bchain/coins/avalanche" + "github.com/trezor/blockbook/bchain/coins/base" "github.com/trezor/blockbook/bchain/coins/bch" "github.com/trezor/blockbook/bchain/coins/bellcoin" "github.com/trezor/blockbook/bchain/coins/bitcore" "github.com/trezor/blockbook/bchain/coins/bitzeny" + "github.com/trezor/blockbook/bchain/coins/bsc" "github.com/trezor/blockbook/bchain/coins/btc" "github.com/trezor/blockbook/bchain/coins/btg" "github.com/trezor/blockbook/bchain/coins/cpuchain" @@ -40,8 +44,10 @@ import ( "github.com/trezor/blockbook/bchain/coins/namecoin" "github.com/trezor/blockbook/bchain/coins/nuls" "github.com/trezor/blockbook/bchain/coins/omotenashicoin" + "github.com/trezor/blockbook/bchain/coins/optimism" "github.com/trezor/blockbook/bchain/coins/pivx" "github.com/trezor/blockbook/bchain/coins/polis" + "github.com/trezor/blockbook/bchain/coins/polygon" "github.com/trezor/blockbook/bchain/coins/qtum" "github.com/trezor/blockbook/bchain/coins/ravencoin" "github.com/trezor/blockbook/bchain/coins/ritocoin" @@ -63,14 +69,20 @@ var BlockChainFactories = make(map[string]blockChainFactory) func init() { BlockChainFactories["Bitcoin"] = btc.NewBitcoinRPC BlockChainFactories["Testnet"] = btc.NewBitcoinRPC + BlockChainFactories["Testnet4"] = btc.NewBitcoinRPC BlockChainFactories["Signet"] = btc.NewBitcoinRPC BlockChainFactories["Regtest"] = btc.NewBitcoinRPC BlockChainFactories["Zcash"] = zec.NewZCashRPC BlockChainFactories["Zcash Testnet"] = zec.NewZCashRPC BlockChainFactories["Ethereum"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Archive"] = eth.NewEthereumRPC BlockChainFactories["Ethereum Classic"] = eth.NewEthereumRPC - BlockChainFactories["Ethereum Testnet Ropsten"] = eth.NewEthereumRPC - BlockChainFactories["Ethereum Testnet Goerli"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Testnet Sepolia"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Testnet Sepolia Archive"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Testnet Holesky"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Testnet Holesky Archive"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Testnet Hoodi"] = eth.NewEthereumRPC + BlockChainFactories["Ethereum Testnet Hoodi Archive"] = eth.NewEthereumRPC BlockChainFactories["Bcash"] = bch.NewBCashRPC BlockChainFactories["Bcash Testnet"] = bch.NewBCashRPC BlockChainFactories["Bgold"] = btg.NewBGoldRPC @@ -126,29 +138,25 @@ func init() { BlockChainFactories["BitZeny"] = bitzeny.NewBitZenyRPC BlockChainFactories["Trezarcoin"] = trezarcoin.NewTrezarcoinRPC BlockChainFactories["ECash"] = ecash.NewECashRPC -} - -// GetCoinNameFromConfig gets coin name and coin shortcut from config file -func GetCoinNameFromConfig(configfile string) (string, string, string, error) { - data, err := ioutil.ReadFile(configfile) - if err != nil { - return "", "", "", errors.Annotatef(err, "Error reading file %v", configfile) - } - var cn struct { - CoinName string `json:"coin_name"` - CoinShortcut string `json:"coin_shortcut"` - CoinLabel string `json:"coin_label"` - } - err = json.Unmarshal(data, &cn) - if err != nil { - return "", "", "", errors.Annotatef(err, "Error parsing file %v", configfile) - } - return cn.CoinName, cn.CoinShortcut, cn.CoinLabel, nil + BlockChainFactories["Avalanche"] = avalanche.NewAvalancheRPC + BlockChainFactories["Avalanche Archive"] = avalanche.NewAvalancheRPC + BlockChainFactories["BNB Smart Chain"] = bsc.NewBNBSmartChainRPC + BlockChainFactories["BNB Smart Chain Archive"] = bsc.NewBNBSmartChainRPC + BlockChainFactories["Polygon"] = polygon.NewPolygonRPC + BlockChainFactories["Polygon Archive"] = polygon.NewPolygonRPC + BlockChainFactories["Optimism"] = optimism.NewOptimismRPC + BlockChainFactories["Optimism Archive"] = optimism.NewOptimismRPC + BlockChainFactories["Arbitrum"] = arbitrum.NewArbitrumRPC + BlockChainFactories["Arbitrum Archive"] = arbitrum.NewArbitrumRPC + BlockChainFactories["Arbitrum Nova"] = arbitrum.NewArbitrumRPC + BlockChainFactories["Arbitrum Nova Archive"] = arbitrum.NewArbitrumRPC + BlockChainFactories["Base"] = base.NewBaseRPC + BlockChainFactories["Base Archive"] = base.NewBaseRPC } // NewBlockChain creates bchain.BlockChain and bchain.Mempool for the coin passed by the parameter coin func NewBlockChain(coin string, configfile string, pushHandler func(bchain.NotificationType), metrics *common.Metrics) (bchain.BlockChain, bchain.Mempool, error) { - data, err := ioutil.ReadFile(configfile) + data, err := os.ReadFile(configfile) if err != nil { return nil, nil, errors.Annotatef(err, "Error reading file %v", configfile) } @@ -291,9 +299,14 @@ func (c *blockChainWithMetrics) EstimateFee(blocks int) (v big.Int, err error) { return c.b.EstimateFee(blocks) } -func (c *blockChainWithMetrics) SendRawTransaction(tx string) (v string, err error) { +func (c *blockChainWithMetrics) LongTermFeeRate() (v *bchain.LongTermFeeRate, err error) { + defer func(s time.Time) { c.observeRPCLatency("LongTermFeeRate", s, err) }(time.Now()) + return c.b.LongTermFeeRate() +} + +func (c *blockChainWithMetrics) SendRawTransaction(tx string, disableAlternativeRPC bool) (v string, err error) { defer func(s time.Time) { c.observeRPCLatency("SendRawTransaction", s, err) }(time.Now()) - return c.b.SendRawTransaction(tx) + return c.b.SendRawTransaction(tx, disableAlternativeRPC) } func (c *blockChainWithMetrics) GetMempoolEntry(txid string) (v *bchain.MempoolEntry, err error) { @@ -320,16 +333,47 @@ func (c *blockChainWithMetrics) EthereumTypeEstimateGas(params map[string]interf return c.b.EthereumTypeEstimateGas(params) } -func (c *blockChainWithMetrics) EthereumTypeGetErc20ContractInfo(contractDesc bchain.AddressDescriptor) (v *bchain.Erc20Contract, err error) { - defer func(s time.Time) { c.observeRPCLatency("EthereumTypeGetErc20ContractInfo", s, err) }(time.Now()) - return c.b.EthereumTypeGetErc20ContractInfo(contractDesc) +func (c *blockChainWithMetrics) EthereumTypeGetEip1559Fees() (v *bchain.Eip1559Fees, err error) { + defer func(s time.Time) { c.observeRPCLatency("EthereumTypeGetEip1559Fees", s, err) }(time.Now()) + return c.b.EthereumTypeGetEip1559Fees() +} + +func (c *blockChainWithMetrics) GetContractInfo(contractDesc bchain.AddressDescriptor) (v *bchain.ContractInfo, err error) { + defer func(s time.Time) { c.observeRPCLatency("GetContractInfo", s, err) }(time.Now()) + return c.b.GetContractInfo(contractDesc) } func (c *blockChainWithMetrics) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc bchain.AddressDescriptor) (v *big.Int, err error) { - defer func(s time.Time) { c.observeRPCLatency("EthereumTypeGetErc20ContractInfo", s, err) }(time.Now()) + defer func(s time.Time) { c.observeRPCLatency("EthereumTypeGetErc20ContractBalance", s, err) }(time.Now()) return c.b.EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc) } +// GetTokenURI returns URI of non fungible or multi token defined by token id +func (c *blockChainWithMetrics) GetTokenURI(contractDesc bchain.AddressDescriptor, tokenID *big.Int) (v string, err error) { + defer func(s time.Time) { c.observeRPCLatency("GetTokenURI", s, err) }(time.Now()) + return c.b.GetTokenURI(contractDesc, tokenID) +} + +func (c *blockChainWithMetrics) EthereumTypeGetSupportedStakingPools() []string { + return c.b.EthereumTypeGetSupportedStakingPools() +} + +func (c *blockChainWithMetrics) EthereumTypeGetStakingPoolsData(addrDesc bchain.AddressDescriptor) (v []bchain.StakingPoolData, err error) { + defer func(s time.Time) { c.observeRPCLatency("EthereumTypeStakingPoolsData", s, err) }(time.Now()) + return c.b.EthereumTypeGetStakingPoolsData(addrDesc) +} + +// EthereumTypeRpcCall calls eth_call with given data and to address +func (c *blockChainWithMetrics) EthereumTypeRpcCall(data, to, from string) (v string, err error) { + defer func(s time.Time) { c.observeRPCLatency("EthereumTypeRpcCall", s, err) }(time.Now()) + return c.b.EthereumTypeRpcCall(data, to, from) +} + +func (c *blockChainWithMetrics) EthereumTypeGetRawTransaction(txid string) (v string, err error) { + defer func(s time.Time) { c.observeRPCLatency("EthereumTypeGetRawTransaction", s, err) }(time.Now()) + return c.b.EthereumTypeGetRawTransaction(txid) +} + type mempoolWithMetrics struct { mempool bchain.Mempool m *common.Metrics @@ -370,3 +414,7 @@ func (c *mempoolWithMetrics) GetAllEntries() (v bchain.MempoolTxidEntries) { func (c *mempoolWithMetrics) GetTransactionTime(txid string) uint32 { return c.mempool.GetTransactionTime(txid) } + +func (c *mempoolWithMetrics) GetTxidFilterEntries(filterScripts string, fromTimestamp uint32) (bchain.MempoolTxidFilterEntries, error) { + return c.mempool.GetTxidFilterEntries(filterScripts, fromTimestamp) +} diff --git a/bchain/coins/bsc/bscrpc.go b/bchain/coins/bsc/bscrpc.go new file mode 100644 index 0000000000..2439e57cf5 --- /dev/null +++ b/bchain/coins/bsc/bscrpc.go @@ -0,0 +1,84 @@ +package bsc + +import ( + "context" + "encoding/json" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" +) + +const ( + // MainNet is production network + MainNet eth.Network = 56 + + // bsc token standard names + BEP20TokenStandard bchain.TokenStandardName = "BEP20" + BEP721TokenStandard bchain.TokenStandardName = "BEP721" + BEP1155TokenStandard bchain.TokenStandardName = "BEP1155" +) + +// BNBSmartChainRPC is an interface to JSON-RPC bsc service. +type BNBSmartChainRPC struct { + *eth.EthereumRPC +} + +// NewBNBSmartChainRPC returns new BNBSmartChainRPC instance. +func NewBNBSmartChainRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + c, err := eth.NewEthereumRPC(config, pushHandler) + if err != nil { + return nil, err + } + + // overwrite EthereumTokenStandardMap with bsc specific token standard names + bchain.EthereumTokenStandardMap = []bchain.TokenStandardName{BEP20TokenStandard, BEP721TokenStandard, BEP1155TokenStandard} + + s := &BNBSmartChainRPC{ + EthereumRPC: c.(*eth.EthereumRPC), + } + s.Parser.EnsSuffix = ".bnb" + + return s, nil +} + +// Initialize bnb smart chain rpc interface +func (b *BNBSmartChainRPC) Initialize() error { + b.OpenRPC = eth.OpenRPC + + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + // set chain specific + b.Client = ec + b.RPC = rc + b.MainNetChainID = MainNet + b.NewBlock = eth.NewEthereumNewBlock() + b.NewTx = eth.NewEthereumNewTx() + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + id, err := b.Client.NetworkID(ctx) + if err != nil { + return err + } + + // parameters for getInfo request + switch eth.Network(id.Uint64()) { + case MainNet: + b.Testnet = false + b.Network = "livenet" + default: + return errors.Errorf("Unknown network id %v", id) + } + + b.InitAlternativeProviders() + + glog.Info("rpc: block chain ", b.Network) + + return nil +} diff --git a/bchain/coins/btc/alternativefeeprovider.go b/bchain/coins/btc/alternativefeeprovider.go new file mode 100644 index 0000000000..7d72acdbdd --- /dev/null +++ b/bchain/coins/btc/alternativefeeprovider.go @@ -0,0 +1,75 @@ +package btc + +import ( + "fmt" + "math/big" + "sync" + "time" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" +) + +type alternativeFeeProviderFee struct { + blocks int + feePerKB int +} + +type alternativeFeeProvider struct { + fees []alternativeFeeProviderFee + lastSync time.Time + chain bchain.BlockChain + mux sync.Mutex + fallbackFeePerKBIfNotAvailable int +} + +type alternativeFeeProviderInterface interface { + compareToDefault() + estimateFee(blocks int) (big.Int, error) +} + +func (p *alternativeFeeProvider) compareToDefault() { + output := "" + for _, fee := range p.fees { + conservative, err := p.chain.(*BitcoinRPC).blockchainEstimateSmartFee(fee.blocks, true) + if err != nil { + glog.Error(err) + return + } + economical, err := p.chain.(*BitcoinRPC).blockchainEstimateSmartFee(fee.blocks, false) + if err != nil { + glog.Error(err) + return + } + output += fmt.Sprintf("Blocks %d: alternative %d, conservative %s, economical %s\n", fee.blocks, fee.feePerKB, conservative.String(), economical.String()) + } + glog.Info("alternativeFeeProviderCompareToDefault\n", output) +} + +func (p *alternativeFeeProvider) estimateFee(blocks int) (big.Int, error) { + var r big.Int + p.mux.Lock() + defer p.mux.Unlock() + if len(p.fees) == 0 { + return r, errors.New("alternativeFeeProvider: no fees") + } + if p.lastSync.Before(time.Now().Add(time.Duration(-10) * time.Minute)) { + return r, errors.Errorf("alternativeFeeProvider: Missing recent value, last sync at %v", p.lastSync) + } + for i := range p.fees { + if p.fees[i].blocks >= blocks { + r = *big.NewInt(int64(p.fees[i].feePerKB)) + return r, nil + } + } + + if p.fallbackFeePerKBIfNotAvailable > 0 { + r = *big.NewInt(int64(p.fallbackFeePerKBIfNotAvailable)) + return r, nil + } + + // use the last value as fallback + r = *big.NewInt(int64(p.fees[len(p.fees)-1].feePerKB)) + return r, nil +} diff --git a/bchain/coins/btc/bitcoinlikeparser.go b/bchain/coins/btc/bitcoinlikeparser.go index 3f168239b9..67a31d0c57 100644 --- a/bchain/coins/btc/bitcoinlikeparser.go +++ b/bchain/coins/btc/bitcoinlikeparser.go @@ -35,6 +35,7 @@ type BitcoinLikeParser struct { XPubMagicSegwitP2sh uint32 XPubMagicSegwitNative uint32 Slip44 uint32 + VSizeSupport bool minimumCoinbaseConfirmations int } @@ -44,6 +45,7 @@ func NewBitcoinLikeParser(params *chaincfg.Params, c *Configuration) *BitcoinLik BaseParser: &bchain.BaseParser{ BlockAddressesToKeep: c.BlockAddressesToKeep, AmountDecimalPoint: 8, + AddressAliases: c.AddressAliases, }, Params: params, XPubMagic: c.XPubMagic, @@ -203,6 +205,14 @@ func (p *BitcoinLikeParser) outputScriptToAddresses(script []byte) ([]string, bo // TxFromMsgTx converts bitcoin wire Tx to bchain.Tx func (p *BitcoinLikeParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx { + var vSize int64 + if p.VSizeSupport { + baseSize := t.SerializeSizeStripped() + totalSize := t.SerializeSize() + weight := int64((baseSize * (blockchain.WitnessScaleFactor - 1)) + totalSize) + vSize = (weight + (blockchain.WitnessScaleFactor - 1)) / blockchain.WitnessScaleFactor + } + vin := make([]bchain.Vin, len(t.TxIn)) for i, in := range t.TxIn { if blockchain.IsCoinBaseTx(t) { @@ -221,6 +231,7 @@ func (p *BitcoinLikeParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bcha Vout: in.PreviousOutPoint.Index, Sequence: in.Sequence, ScriptSig: s, + Witness: in.Witness, } } vout := make([]bchain.Vout, len(t.TxOut)) @@ -247,6 +258,7 @@ func (p *BitcoinLikeParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bcha Txid: t.TxHash().String(), Version: t.Version, LockTime: t.LockTime, + VSize: vSize, Vin: vin, Vout: vout, // skip: BlockHash, @@ -319,6 +331,11 @@ func (p *BitcoinLikeParser) MinimumCoinbaseConfirmations() int { return p.minimumCoinbaseConfirmations } +// SupportsVSize returns true if vsize of a transaction should be computed and returned by API +func (p *BitcoinLikeParser) SupportsVSize() bool { + return p.VSizeSupport +} + var tapTweakTagHash = sha256.Sum256([]byte("TapTweak")) func tapTweakHash(msg []byte) []byte { @@ -423,7 +440,7 @@ var ( ) func init() { - xpubDesriptorRegex, _ = regexp.Compile(`^(?P(sh\(wpkh|wpkh|pk|pkh|wpkh|wsh|tr))\((\[\w+/(?P\d+)'/\d+'?/\d+'?\])?(?P\w+)(/(({(?P\d+(,\d+)*)})|(<(?P\d+(;\d+)*)>)|(?P\d+))/\*)?\)+`) + xpubDesriptorRegex, _ = regexp.Compile(`^(?P(sh\(wpkh|wpkh|pk|pkh|wpkh|wsh|tr))\((\[\w+/(?P\d+)['h]/\d+['h]?/\d+['h]?\])?(?P\w+)(/(({(?P\d+(,\d+)*)})|(<(?P\d+(;\d+)*)>)|(?P\d+))/\*)?\)+`) typeSubexpIndex = xpubDesriptorRegex.SubexpIndex("type") bipSubexpIndex = xpubDesriptorRegex.SubexpIndex("bip") xpubSubexpIndex = xpubDesriptorRegex.SubexpIndex("xpub") diff --git a/bchain/coins/btc/bitcoinparser.go b/bchain/coins/btc/bitcoinparser.go index 29e573bd5f..a022c18e0d 100644 --- a/bchain/coins/btc/bitcoinparser.go +++ b/bchain/coins/btc/bitcoinparser.go @@ -4,11 +4,28 @@ import ( "encoding/json" "math/big" + "github.com/martinboehm/btcd/wire" "github.com/martinboehm/btcutil/chaincfg" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/common" ) +// temp params for signet(wait btcd commit) +// magic numbers +const ( + Testnet4Magic wire.BitcoinNet = 0x283f161c +) + +// chain parameters +var ( + TestNet4Params chaincfg.Params +) + +func init() { + TestNet4Params = chaincfg.TestNet3Params + TestNet4Params.Net = Testnet4Magic +} + // BitcoinParser handle type BitcoinParser struct { *BitcoinLikeParser @@ -16,9 +33,11 @@ type BitcoinParser struct { // NewBitcoinParser returns new BitcoinParser instance func NewBitcoinParser(params *chaincfg.Params, c *Configuration) *BitcoinParser { - return &BitcoinParser{ + p := &BitcoinParser{ BitcoinLikeParser: NewBitcoinLikeParser(params, c), } + p.VSizeSupport = true + return p } // GetChainParams contains network parameters for the main Bitcoin network, @@ -31,6 +50,8 @@ func GetChainParams(chain string) *chaincfg.Params { switch chain { case "test": return &chaincfg.TestNet3Params + case "testnet4": + return &TestNet4Params case "regtest": return &chaincfg.RegressionNetParams case "signet": @@ -63,6 +84,7 @@ type Tx struct { Txid string `json:"txid"` Version int32 `json:"version"` LockTime uint32 `json:"locktime"` + VSize int64 `json:"vsize,omitempty"` Vin []bchain.Vin `json:"vin"` Vout []Vout `json:"vout"` BlockHeight uint32 `json:"blockHeight,omitempty"` @@ -88,6 +110,7 @@ func (p *BitcoinParser) ParseTxFromJson(msg json.RawMessage) (*bchain.Tx, error) tx.Txid = bitcoinTx.Txid tx.Version = bitcoinTx.Version tx.LockTime = bitcoinTx.LockTime + tx.VSize = bitcoinTx.VSize tx.Vin = bitcoinTx.Vin tx.BlockHeight = bitcoinTx.BlockHeight tx.Confirmations = bitcoinTx.Confirmations diff --git a/bchain/coins/btc/bitcoinparser_test.go b/bchain/coins/btc/bitcoinparser_test.go index 45edfd7b58..78d5ac4fbb 100644 --- a/bchain/coins/btc/bitcoinparser_test.go +++ b/bchain/coins/btc/bitcoinparser_test.go @@ -467,11 +467,12 @@ func TestGetAddressesFromAddrDescTestnet(t *testing.T) { } var ( - testTx1, testTx2, testTx3 bchain.Tx + testTx1, testTx2, testTx3, testTx4 bchain.Tx testTxPacked1 = "0001e2408ba8d7af5401000000017f9a22c9cbf54bd902400df746f138f37bcf5b4d93eb755820e974ba43ed5f42040000006a4730440220037f4ed5427cde81d55b9b6a2fd08c8a25090c2c2fff3a75c1a57625ca8a7118022076c702fe55969fa08137f71afd4851c48e31082dd3c40c919c92cdbc826758d30121029f6da5623c9f9b68a9baf9c1bc7511df88fa34c6c2f71f7c62f2f03ff48dca80feffffff019c9700000000000017a9146144d57c8aff48492c9dfb914e120b20bad72d6f8773d00700" testTxPacked2 = "0007c91a899ab7da6a010000000001019d64f0c72a0d206001decbffaa722eb1044534c74eee7a5df8318e42a4323ec10000000017160014550da1f5d25a9dae2eafd6902b4194c4c6500af6ffffffff02809698000000000017a914cd668d781ece600efa4b2404dc91fd26b8b8aed8870553d7360000000017a914246655bdbd54c7e477d0ea2375e86e0db2b8f80a8702473044022076aba4ad559616905fa51d4ddd357fc1fdb428d40cb388e042cdd1da4a1b7357022011916f90c712ead9a66d5f058252efd280439ad8956a967e95d437d246710bc9012102a80a5964c5612bb769ef73147b2cf3c149bc0fd4ecb02f8097629c94ab013ffd00000000" testTxPacked3 = "00003d818bfda9aa3e02000000000102deb1999a857ab0a13d6b12fbd95ea75b409edde5f2ff747507ce42d9986a8b9d0000000000fdffffff9fd2d3361e203b2375eba6438efbef5b3075531e7e583c7cc76b7294fe7f22980000000000fdffffff02a0860100000000001600148091746745464e7555c31e9a5afceac14a02978ae7fc1c0000000000160014565ea9ff4589d3e05ba149ae6e257752bfdc2a1e0247304402207d67d320a8e813f986b35e9791935fcb736754812b7038686f5de6cfdcda99cd02201c3bb2c178e0056016437ecfe365a7eef84aa9d293ebdc566177af82e22fcdd3012103abb30c1bbe878b07b58dc169b1d061d48c60be8107f632a59778b38bf7ceea5a02473044022044f54a478cfe086e870cb026c9dcd4e14e63778bef569a4d55a6332725cd9a9802202f0e94c04e6f328fc64ad9efe552888c299750d1b8d033324825a3ff29920e030121036fcd433428aa7dc65c4f5408fa31f208c54fe4b4c6c1ae9c39a825ed4f1ac039813d0000" + testTxPacked4 = "0000a2b98ced82b6400300000000010148f8f93ebb12407809920d2ab9cc1bf01289b314eb23028c83fdab21e5fefa690100000000fdffffff0150c3000000000000160014cb888de3c89670a3061fb6ef6590f187649cca060247304402206a9db8d7157e4b0a06a1f090b9de88cdc616028b431b80617a055117877e479a02202937d6d1658d4a8afde86b245325c3bb0e769a87cb09d802bcefaa21550065e201210374aa8f312de4ebccbef55609700a39764387aa4ff5d76f1ccb4d2382e454f05b00000000" ) func init() { @@ -480,6 +481,7 @@ func init() { Blocktime: 1519053802, Txid: "056e3d82e5ffd0e915fb9b62797d76263508c34fe3e5dbed30dd3e943930f204", LockTime: 512115, + VSize: 189, Version: 1, Vin: []bchain.Vin{ { @@ -510,6 +512,7 @@ func init() { Blocktime: 1235678901, Txid: "474e6795760ebe81cb4023dc227e5a0efe340e1771c89a0035276361ed733de7", LockTime: 0, + VSize: 166, Version: 1, Vin: []bchain.Vin{ { @@ -550,6 +553,7 @@ func init() { Blocktime: 1607805599, Txid: "24551a58a1d1fb89d7052e2bbac7cb69a7825ee1e39439befbec8c32148cf735", LockTime: 15745, + VSize: 208, Version: 2, Vin: []bchain.Vin{ { @@ -592,6 +596,37 @@ func init() { }, }, } + + testTx4 = bchain.Tx{ + Hex: "0300000000010148f8f93ebb12407809920d2ab9cc1bf01289b314eb23028c83fdab21e5fefa690100000000fdffffff0150c3000000000000160014cb888de3c89670a3061fb6ef6590f187649cca060247304402206a9db8d7157e4b0a06a1f090b9de88cdc616028b431b80617a055117877e479a02202937d6d1658d4a8afde86b245325c3bb0e769a87cb09d802bcefaa21550065e201210374aa8f312de4ebccbef55609700a39764387aa4ff5d76f1ccb4d2382e454f05b00000000", + Blocktime: 1724927392, + Txid: "8e3f38bf6854dd3c358be8d4f9a40a6dccc50de49616125d27af9fdbe65287eb", + LockTime: 0, + VSize: 110, + Version: 3, + Vin: []bchain.Vin{ + { + ScriptSig: bchain.ScriptSig{ + Hex: "", + }, + Txid: "69fafee521abfd838c0223eb14b38912f01bccb92a0d9209784012bb3ef9f848", + Vout: 1, + Sequence: 4294967293, + }, + }, + Vout: []bchain.Vout{ + { + ValueSat: *big.NewInt(50000), + N: 0, + ScriptPubKey: bchain.ScriptPubKey{ + Hex: "0014cb888de3c89670a3061fb6ef6590f187649cca06", + Addresses: []string{ + "tb1qewygmc7gjec2xpslkmhkty83sajfejsxqmy5dq", + }, + }, + }, + }, + } } func TestPackTx(t *testing.T) { @@ -640,6 +675,17 @@ func TestPackTx(t *testing.T) { want: testTxPacked3, wantErr: false, }, + { + name: "testnet4-1", + args: args{ + tx: testTx4, + height: 41657, + blockTime: 1724927392, + parser: NewBitcoinParser(GetChainParams("testnet4"), &Configuration{}), + }, + want: testTxPacked4, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -698,6 +744,16 @@ func TestUnpackTx(t *testing.T) { want1: 15745, wantErr: false, }, + { + name: "testnet4-1", + args: args{ + packedTx: testTxPacked4, + parser: NewBitcoinParser(GetChainParams("testnet4"), &Configuration{}), + }, + want: &testTx4, + want1: 41657, + wantErr: false, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -707,6 +763,10 @@ func TestUnpackTx(t *testing.T) { t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr) return } + // ignore witness unpacking + for i := range got.Vin { + got.Vin[i].Witness = nil + } if !reflect.DeepEqual(got, tt.want) { t.Errorf("unpackTx() got = %v, want %v", got, tt.want) } @@ -763,6 +823,18 @@ func TestParseXpubDescriptors(t *testing.T) { ChangeIndexes: []uint32{0, 1, 2}, }, }, + { + name: "tr([5c9e228d/86h/1h/0h]tpubD/{0,1,2}/*)#4rqwxvej", + xpub: "tr([5c9e228d/86h/1h/0h]tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/{0,1,2}/*)#4rqwxvej", + parser: btcTestnetParser, + want: &bchain.XpubDescriptor{ + XpubDescriptor: "tr([5c9e228d/86h/1h/0h]tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/{0,1,2}/*)#4rqwxvej", + Xpub: "tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN", + Type: bchain.P2TR, + Bip: "86", + ChangeIndexes: []uint32{0, 1, 2}, + }, + }, { name: "tr([5c9e228d/86'/1'/0']tpubD/<0;1;2>/*)#4rqwxvej", xpub: "tr([5c9e228d/86'/1'/0']tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/<0;1;2>/*)#4rqwxvej", diff --git a/bchain/coins/btc/bitcoinrpc.go b/bchain/coins/btc/bitcoinrpc.go index faac252877..f6daead229 100644 --- a/bchain/coins/btc/bitcoinrpc.go +++ b/bchain/coins/btc/bitcoinrpc.go @@ -5,12 +5,9 @@ import ( "context" "encoding/hex" "encoding/json" - "io" - "io/ioutil" "math/big" "net" "net/http" - "runtime/debug" "time" "github.com/golang/glog" @@ -23,16 +20,20 @@ import ( // BitcoinRPC is an interface to JSON-RPC bitcoind service. type BitcoinRPC struct { *bchain.BaseChain - client http.Client - rpcURL string - user string - password string - Mempool *bchain.MempoolBitcoinType - ParseBlocks bool - pushHandler func(bchain.NotificationType) - mq *bchain.MQ - ChainConfig *Configuration - RPCMarshaler RPCMarshaler + client http.Client + rpcURL string + user string + password string + Mempool *bchain.MempoolBitcoinType + ParseBlocks bool + pushHandler func(bchain.NotificationType) + mq *bchain.MQ + ChainConfig *Configuration + RPCMarshaler RPCMarshaler + mempoolGolombFilterP uint8 + mempoolFilterScripts string + mempoolUseZeroedKey bool + alternativeFeeProvider alternativeFeeProviderInterface } // Configuration represents json config file @@ -43,6 +44,7 @@ type Configuration struct { RPCUser string `json:"rpc_user"` RPCPass string `json:"rpc_pass"` RPCTimeout int `json:"rpc_timeout"` + AddressAliases bool `json:"address_aliases,omitempty"` Parse bool `json:"parse"` MessageQueueBinding string `json:"message_queue_binding"` Subversion string `json:"subversion"` @@ -59,6 +61,9 @@ type Configuration struct { AlternativeEstimateFee string `json:"alternative_estimate_fee,omitempty"` AlternativeEstimateFeeParams string `json:"alternative_estimate_fee_params,omitempty"` MinimumCoinbaseConfirmations int `json:"minimumCoinbaseConfirmations,omitempty"` + MempoolGolombFilterP uint8 `json:"mempool_golomb_filter_p,omitempty"` + MempoolFilterScripts string `json:"mempool_filter_scripts,omitempty"` + MempoolFilterUseZeroedKey bool `json:"mempool_filter_use_zeroed_key,omitempty"` } // NewBitcoinRPC returns new BitcoinRPC instance. @@ -95,15 +100,18 @@ func NewBitcoinRPC(config json.RawMessage, pushHandler func(bchain.NotificationT } s := &BitcoinRPC{ - BaseChain: &bchain.BaseChain{}, - client: http.Client{Timeout: time.Duration(c.RPCTimeout) * time.Second, Transport: transport}, - rpcURL: c.RPCURL, - user: c.RPCUser, - password: c.RPCPass, - ParseBlocks: c.Parse, - ChainConfig: &c, - pushHandler: pushHandler, - RPCMarshaler: JSONMarshalerV2{}, + BaseChain: &bchain.BaseChain{}, + client: http.Client{Timeout: time.Duration(c.RPCTimeout) * time.Second, Transport: transport}, + rpcURL: c.RPCURL, + user: c.RPCUser, + password: c.RPCPass, + ParseBlocks: c.Parse, + ChainConfig: &c, + pushHandler: pushHandler, + RPCMarshaler: JSONMarshalerV2{}, + mempoolGolombFilterP: c.MempoolGolombFilterP, + mempoolFilterScripts: c.MempoolFilterScripts, + mempoolUseZeroedKey: c.MempoolFilterUseZeroedKey, } return s, nil @@ -136,11 +144,30 @@ func (b *BitcoinRPC) Initialize() error { glog.Info("rpc: block chain ", params.Name) if b.ChainConfig.AlternativeEstimateFee == "whatthefee" { - if err = InitWhatTheFee(b, b.ChainConfig.AlternativeEstimateFeeParams); err != nil { - glog.Error("InitWhatTheFee error ", err, " Reverting to default estimateFee functionality") + glog.Info("Using WhatTheFee") + if b.alternativeFeeProvider, err = NewWhatTheFee(b, b.ChainConfig.AlternativeEstimateFeeParams); err != nil { + glog.Error("NewWhatTheFee error ", err, " Reverting to default estimateFee functionality") // disable AlternativeEstimateFee logic - b.ChainConfig.AlternativeEstimateFee = "" + b.alternativeFeeProvider = nil } + } else if b.ChainConfig.AlternativeEstimateFee == "mempoolspace" { + glog.Info("Using MempoolSpaceFee") + if b.alternativeFeeProvider, err = NewMempoolSpaceFee(b, b.ChainConfig.AlternativeEstimateFeeParams); err != nil { + glog.Error("MempoolSpaceFee error ", err, " Reverting to default estimateFee functionality") + // disable AlternativeEstimateFee logic + b.alternativeFeeProvider = nil + } + } else if b.ChainConfig.AlternativeEstimateFee == "mempoolspaceblock" { + glog.Info("Using MempoolSpaceBlockFee") + if b.alternativeFeeProvider, err = NewMempoolSpaceBlockFee(b, b.ChainConfig.AlternativeEstimateFeeParams); err != nil { + glog.Error("MempoolSpaceBlockFee error ", err, " Reverting to default estimateFee functionality") + // disable AlternativeEstimateFee logic + b.alternativeFeeProvider = nil + } + } else if len(b.ChainConfig.AlternativeEstimateFee) > 0 { + glog.Error("AlternativeEstimateFee ", b.ChainConfig.AlternativeEstimateFee, " not supported") + } else { + glog.Info("Using default estimateFee") } return nil @@ -149,7 +176,7 @@ func (b *BitcoinRPC) Initialize() error { // CreateMempool creates mempool if not already created, however does not initialize it func (b *BitcoinRPC) CreateMempool(chain bchain.BlockChain) (bchain.Mempool, error) { if b.Mempool == nil { - b.Mempool = bchain.NewMempoolBitcoinType(chain, b.ChainConfig.MempoolWorkers, b.ChainConfig.MempoolSubWorkers) + b.Mempool = bchain.NewMempoolBitcoinType(chain, b.ChainConfig.MempoolWorkers, b.ChainConfig.MempoolSubWorkers, b.mempoolGolombFilterP, b.mempoolFilterScripts, b.mempoolUseZeroedKey) } return b.Mempool, nil } @@ -765,8 +792,7 @@ func (b *BitcoinRPC) getRawTransaction(txid string) (json.RawMessage, error) { return res.Result, nil } -// EstimateSmartFee returns fee estimation -func (b *BitcoinRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, error) { +func (b *BitcoinRPC) blockchainEstimateSmartFee(blocks int, conservative bool) (big.Int, error) { // use EstimateFee if EstimateSmartFee is not supported if !b.ChainConfig.SupportsEstimateSmartFee && b.ChainConfig.SupportsEstimateFee { return b.EstimateFee(blocks) @@ -783,7 +809,6 @@ func (b *BitcoinRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, e req.Params.EstimateMode = "ECONOMICAL" } err := b.Call(&req, &res) - var r big.Int if err != nil { return r, err @@ -798,8 +823,31 @@ func (b *BitcoinRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, e return r, nil } +// EstimateSmartFee returns fee estimation +func (b *BitcoinRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, error) { + // use alternative estimator if enabled + if b.alternativeFeeProvider != nil { + r, err := b.alternativeFeeProvider.estimateFee(blocks) + // in case of error, fallback to default estimator + if err == nil { + return r, nil + } + } + return b.blockchainEstimateSmartFee(blocks, conservative) +} + // EstimateFee returns fee estimation. func (b *BitcoinRPC) EstimateFee(blocks int) (big.Int, error) { + var r big.Int + var err error + // use alternative estimator if enabled + if b.alternativeFeeProvider != nil { + r, err = b.alternativeFeeProvider.estimateFee(blocks) + // in case of error, fallback to default estimator + if err == nil { + return r, nil + } + } // use EstimateSmartFee if EstimateFee is not supported if !b.ChainConfig.SupportsEstimateFee && b.ChainConfig.SupportsEstimateSmartFee { return b.EstimateSmartFee(blocks, true) @@ -810,9 +858,8 @@ func (b *BitcoinRPC) EstimateFee(blocks int) (big.Int, error) { res := ResEstimateFee{} req := CmdEstimateFee{Method: "estimatefee"} req.Params.Blocks = blocks - err := b.Call(&req, &res) + err = b.Call(&req, &res) - var r big.Int if err != nil { return r, err } @@ -826,8 +873,23 @@ func (b *BitcoinRPC) EstimateFee(blocks int) (big.Int, error) { return r, nil } +// LongTermFeeRate returns smallest fee rate from historic blocks. +func (b *BitcoinRPC) LongTermFeeRate() (*bchain.LongTermFeeRate, error) { + blocks := 1008 // ~7 days of blocks, highest number estimatesmartfee supports + glog.V(1).Info("rpc: estimatesmartfee (long term fee rate) - ", blocks) + // Going for the ECONOMICAL mode, to get the lowest fee rate + feePerUnit, err := b.blockchainEstimateSmartFee(blocks, false) + if err != nil { + return nil, err + } + return &bchain.LongTermFeeRate{ + Blocks: uint64(blocks), + FeePerUnit: feePerUnit, + }, nil +} + // SendRawTransaction sends raw transaction -func (b *BitcoinRPC) SendRawTransaction(tx string) (string, error) { +func (b *BitcoinRPC) SendRawTransaction(tx string, disableAlternativeRPC bool) (string, error) { glog.V(1).Info("rpc: sendrawtransaction") res := ResSendRawTransaction{} @@ -871,26 +933,6 @@ func (b *BitcoinRPC) GetMempoolEntry(txid string) (*bchain.MempoolEntry, error) return res.Result, nil } -func safeDecodeResponse(body io.ReadCloser, res interface{}) (err error) { - var data []byte - defer func() { - if r := recover(); r != nil { - glog.Error("unmarshal json recovered from panic: ", r, "; data: ", string(data)) - debug.PrintStack() - if len(data) > 0 && len(data) < 2048 { - err = errors.Errorf("Error: %v", string(data)) - } else { - err = errors.New("Internal error") - } - } - }() - data, err = ioutil.ReadAll(body) - if err != nil { - return err - } - return json.Unmarshal(data, &res) -} - // Call calls Backend RPC interface, using RPCMarshaler interface to marshall the request func (b *BitcoinRPC) Call(req interface{}, res interface{}) error { httpData, err := b.RPCMarshaler.Marshal(req) @@ -914,11 +956,11 @@ func (b *BitcoinRPC) Call(req interface{}, res interface{}) error { // if server returns HTTP error code it might not return json with response // handle both cases if httpRes.StatusCode != 200 { - err = safeDecodeResponse(httpRes.Body, &res) + err = common.SafeDecodeResponseFromReader(httpRes.Body, &res) if err != nil { return errors.Errorf("%v %v", httpRes.Status, err) } return nil } - return safeDecodeResponse(httpRes.Body, &res) + return common.SafeDecodeResponseFromReader(httpRes.Body, &res) } diff --git a/bchain/coins/btc/mempoolspace.go b/bchain/coins/btc/mempoolspace.go new file mode 100644 index 0000000000..6de71db2d1 --- /dev/null +++ b/bchain/coins/btc/mempoolspace.go @@ -0,0 +1,136 @@ +package btc + +import ( + "bytes" + "encoding/json" + "net/http" + "strconv" + "time" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/common" +) + +// https://mempool.space/api/v1/fees/recommended returns +// {"fastestFee":41,"halfHourFee":39,"hourFee":36,"economyFee":36,"minimumFee":20} + +type mempoolSpaceFeeResult struct { + FastestFee int `json:"fastestFee"` + HalfHourFee int `json:"halfHourFee"` + HourFee int `json:"hourFee"` + EconomyFee int `json:"economyFee"` + MinimumFee int `json:"minimumFee"` +} + +type mempoolSpaceFeeParams struct { + URL string `json:"url"` + PeriodSeconds int `json:"periodSeconds"` +} + +type mempoolSpaceFeeProvider struct { + *alternativeFeeProvider + params mempoolSpaceFeeParams +} + +// NewMempoolSpaceFee initializes https://mempool.space provider +func NewMempoolSpaceFee(chain bchain.BlockChain, params string) (alternativeFeeProviderInterface, error) { + p := &mempoolSpaceFeeProvider{alternativeFeeProvider: &alternativeFeeProvider{}} + err := json.Unmarshal([]byte(params), &p.params) + if err != nil { + return nil, err + } + if p.params.URL == "" || p.params.PeriodSeconds == 0 { + return nil, errors.New("NewMempoolSpaceFee: Missing parameters") + } + p.chain = chain + go p.mempoolSpaceFeeDownloader() + return p, nil +} + +func (p *mempoolSpaceFeeProvider) mempoolSpaceFeeDownloader() { + period := time.Duration(p.params.PeriodSeconds) * time.Second + timer := time.NewTimer(period) + counter := 0 + for { + var data mempoolSpaceFeeResult + err := p.mempoolSpaceFeeGetData(&data) + if err != nil { + glog.Error("mempoolSpaceFeeGetData ", err) + } else { + if p.mempoolSpaceFeeProcessData(&data) { + if counter%60 == 0 { + p.compareToDefault() + } + counter++ + } + } + <-timer.C + timer.Reset(period) + } +} + +func (p *mempoolSpaceFeeProvider) mempoolSpaceFeeProcessData(data *mempoolSpaceFeeResult) bool { + if data.MinimumFee == 0 || data.EconomyFee == 0 || data.HourFee == 0 || data.HalfHourFee == 0 || data.FastestFee == 0 { + glog.Errorf("mempoolSpaceFeeProcessData: invalid data %+v", data) + return false + } + p.mux.Lock() + defer p.mux.Unlock() + p.fees = make([]alternativeFeeProviderFee, 5) + // map mempoool.space fees to blocks + + // FastestFee is for 1 block + p.fees[0] = alternativeFeeProviderFee{ + blocks: 1, + feePerKB: data.FastestFee * 1000, + } + + // HalfHourFee is for 2-6 blocks + p.fees[1] = alternativeFeeProviderFee{ + blocks: 6, + feePerKB: data.HalfHourFee * 1000, + } + + // HourFee is for 7-36 blocks + p.fees[2] = alternativeFeeProviderFee{ + blocks: 36, + feePerKB: data.HourFee * 1000, + } + + // EconomyFee is for 37-200 blocks + p.fees[3] = alternativeFeeProviderFee{ + blocks: 500, + feePerKB: data.EconomyFee * 1000, + } + + // MinimumFee is for over 500 blocks + p.fees[4] = alternativeFeeProviderFee{ + blocks: 1000, + feePerKB: data.MinimumFee * 1000, + } + + p.lastSync = time.Now() + // glog.Infof("mempoolSpaceFees: %+v", p.fees) + return true +} + +func (p *mempoolSpaceFeeProvider) mempoolSpaceFeeGetData(res interface{}) error { + var httpData []byte + httpReq, err := http.NewRequest("GET", p.params.URL, bytes.NewBuffer(httpData)) + if err != nil { + return err + } + httpRes, err := http.DefaultClient.Do(httpReq) + if httpRes != nil { + defer httpRes.Body.Close() + } + if err != nil { + return err + } + if httpRes.StatusCode != http.StatusOK { + return errors.New(p.params.URL + " returned status " + strconv.Itoa(httpRes.StatusCode)) + } + return common.SafeDecodeResponseFromReader(httpRes.Body, &res) +} diff --git a/bchain/coins/btc/mempoolspace_test.go b/bchain/coins/btc/mempoolspace_test.go new file mode 100644 index 0000000000..d27d1250b0 --- /dev/null +++ b/bchain/coins/btc/mempoolspace_test.go @@ -0,0 +1,53 @@ +package btc + +import ( + "math/big" + "strconv" + "testing" +) + +func Test_mempoolSpaceFeeProvider(t *testing.T) { + m := &mempoolSpaceFeeProvider{alternativeFeeProvider: &alternativeFeeProvider{}} + m.mempoolSpaceFeeProcessData(&mempoolSpaceFeeResult{ + MinimumFee: 10, + EconomyFee: 20, + HourFee: 30, + HalfHourFee: 40, + FastestFee: 50, + }) + + tests := []struct { + blocks int + want big.Int + }{ + {0, *big.NewInt(50000)}, + {1, *big.NewInt(50000)}, + {2, *big.NewInt(40000)}, + {5, *big.NewInt(40000)}, + {6, *big.NewInt(40000)}, + {7, *big.NewInt(30000)}, + {10, *big.NewInt(30000)}, + {18, *big.NewInt(30000)}, + {19, *big.NewInt(30000)}, + {36, *big.NewInt(30000)}, + {37, *big.NewInt(20000)}, + {100, *big.NewInt(20000)}, + {101, *big.NewInt(20000)}, + {200, *big.NewInt(20000)}, + {201, *big.NewInt(20000)}, + {500, *big.NewInt(20000)}, + {501, *big.NewInt(10000)}, + {5000000, *big.NewInt(10000)}, + } + for _, tt := range tests { + t.Run(strconv.Itoa(tt.blocks), func(t *testing.T) { + got, err := m.estimateFee(tt.blocks) + if err != nil { + t.Error("estimateFee returned error ", err) + } + if got.Cmp(&tt.want) != 0 { + t.Errorf("estimateFee(%d) = %v, want %v", tt.blocks, got, tt.want) + } + }) + } +} diff --git a/bchain/coins/btc/mempoolspaceblock.go b/bchain/coins/btc/mempoolspaceblock.go new file mode 100644 index 0000000000..1f7d4226d5 --- /dev/null +++ b/bchain/coins/btc/mempoolspaceblock.go @@ -0,0 +1,201 @@ +package btc + +import ( + "encoding/json" + "math" + "net/http" + "strconv" + "time" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/common" +) + +// https://mempool.space/api/v1/fees/mempool-blocks returns a list of upcoming blocks and their medianFee. +// Example response: +// [ +// { +// "blockSize": 1604493, +// "blockVSize": 997944.75, +// "nTx": 3350, +// "totalFees": 8333539, +// "medianFee": 3.0073509137538332, +// "feeRange": [ +// 2.0444444444444443, +// 2.2135922330097086, +// 2.608695652173913, +// 3.016042780748663, +// 4.0048289738430585, +// 9.27631139325092, +// 201.06951871657753 +// ] +// }, +// ... +// ] + +type mempoolSpaceBlockFeeResult struct { + BlockSize float64 `json:"blockSize"` + BlockVSize float64 `json:"blockVSize"` + NTx int `json:"nTx"` + TotalFees int `json:"totalFees"` + MedianFee float64 `json:"medianFee"` + // 2nd, 10th, 25th, 50th, 75th, 90th, 98th percentiles + FeeRange []float64 `json:"feeRange"` +} + +type mempoolSpaceBlockFeeParams struct { + URL string `json:"url"` + PeriodSeconds int `json:"periodSeconds"` + // Either number, then take the specified index. If null or missing, take the medianFee + FeeRangeIndex *int `json:"feeRangeIndex,omitempty"` + FallbackFeePerKB int `json:"fallbackFeePerKB,omitempty"` +} + +type mempoolSpaceBlockFeeProvider struct { + *alternativeFeeProvider + params mempoolSpaceBlockFeeParams +} + +// NewMempoolSpaceBlockFee initializes the provider completely. +func NewMempoolSpaceBlockFee(chain bchain.BlockChain, params string) (alternativeFeeProviderInterface, error) { + var paramsParsed mempoolSpaceBlockFeeParams + err := json.Unmarshal([]byte(params), ¶msParsed) + if err != nil { + return nil, err + } + + p, err := NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(paramsParsed) + if err != nil { + return nil, err + } + + p.chain = chain + go p.downloader() + return p, nil +} + +// NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain initializes the provider from already parsed parameters and without chain. +// Refactored like this for better testability. +func NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(params mempoolSpaceBlockFeeParams) (*mempoolSpaceBlockFeeProvider, error) { + // Check mandatory parameters + if params.URL == "" { + return nil, errors.New("NewMempoolSpaceBlockFee: Missing url") + } + if params.PeriodSeconds == 0 { + return nil, errors.New("NewMempoolSpaceBlockFee: Missing periodSeconds") + } + + // Report on what is used + if params.FeeRangeIndex == nil { + glog.Info("NewMempoolSpaceBlockFee: Using median fee") + } else { + index := *params.FeeRangeIndex + if index < 0 || index > 6 { + return nil, errors.New("NewMempoolSpaceBlockFee: feeRangeIndex must be between 0 and 6") + } + glog.Infof("NewMempoolSpaceBlockFee: Using feeRangeIndex %d", index) + } + + p := &mempoolSpaceBlockFeeProvider{ + alternativeFeeProvider: &alternativeFeeProvider{}, + params: params, + } + + if params.FallbackFeePerKB > 0 { + p.fallbackFeePerKBIfNotAvailable = params.FallbackFeePerKB + } + + return p, nil +} + +func (p *mempoolSpaceBlockFeeProvider) downloader() { + period := time.Duration(p.params.PeriodSeconds) * time.Second + timer := time.NewTimer(period) + counter := 0 + for { + var data []mempoolSpaceBlockFeeResult + err := p.getData(&data) + if err != nil { + glog.Error("getData ", err) + } else { + if p.processData(&data) { + if counter%60 == 0 { + p.compareToDefault() + } + counter++ + } + } + <-timer.C + timer.Reset(period) + } +} + +func (p *mempoolSpaceBlockFeeProvider) processData(data *[]mempoolSpaceBlockFeeResult) bool { + if len(*data) == 0 { + glog.Error("processData: empty data") + return false + } + + p.mux.Lock() + defer p.mux.Unlock() + + p.fees = make([]alternativeFeeProviderFee, 0, len(*data)) + + for i, block := range *data { + var fee float64 + + if p.params.FeeRangeIndex == nil { + fee = block.MedianFee + } else { + feeRange := block.FeeRange + index := *p.params.FeeRangeIndex + if len(feeRange) > index { + fee = feeRange[index] + } else { + glog.Warningf("Block %d has too short feeRange (len=%d, required=%d). Replacing by medianFee", i, len(feeRange), index) + fee = block.MedianFee + } + } + + if fee <= 0 { + glog.Warningf("Skipping block at index %d due to invalid fee: %f", i, fee) + continue + } + + // TODO: it might make sense to not include _every_ block, but only e.g. first 20 and then some hardcoded ones like 50, 100, 200, etc. + // But even storing thousands of elements in []alternativeFeeProviderFee should not make a big performance overhead + // Depends on Suite requirements + + // We want to convert the fee to 3 significant digits + feeRounded := common.RoundToSignificantDigits(fee, 3) + feePerKB := int(math.Round(feeRounded * 1000)) + + p.fees = append(p.fees, alternativeFeeProviderFee{ + blocks: i + 1, + feePerKB: feePerKB, + }) + } + + p.lastSync = time.Now() + return true +} + +func (p *mempoolSpaceBlockFeeProvider) getData(res interface{}) error { + httpReq, err := http.NewRequest("GET", p.params.URL, nil) + if err != nil { + return err + } + httpRes, err := http.DefaultClient.Do(httpReq) + if httpRes != nil { + defer httpRes.Body.Close() + } + if err != nil { + return err + } + if httpRes.StatusCode != http.StatusOK { + return errors.New(p.params.URL + " returned status " + strconv.Itoa(httpRes.StatusCode)) + } + return common.SafeDecodeResponseFromReader(httpRes.Body, res) +} diff --git a/bchain/coins/btc/mempoolspaceblock_test.go b/bchain/coins/btc/mempoolspaceblock_test.go new file mode 100644 index 0000000000..09e2bcfede --- /dev/null +++ b/bchain/coins/btc/mempoolspaceblock_test.go @@ -0,0 +1,198 @@ +//go:build unittest + +package btc + +import ( + "math/big" + "strconv" + "strings" + "testing" +) + +var testBlocks = []mempoolSpaceBlockFeeResult{ + { + BlockSize: 1800000, + BlockVSize: 997931, + NTx: 2500, + TotalFees: 6000000, + MedianFee: 25.1, + FeeRange: []float64{1, 5, 10, 20, 30, 50, 300}, + }, + { + BlockSize: 1750000, + BlockVSize: 997930, + NTx: 2200, + TotalFees: 4500000, + MedianFee: 7.31, + FeeRange: []float64{1, 2, 5, 10, 15, 20, 150}, + }, + { + BlockSize: 1700000, + BlockVSize: 997929, + NTx: 2000, + TotalFees: 3000000, + MedianFee: 3.14, + FeeRange: []float64{1, 1.5, 2, 5, 7, 10, 100}, + }, + { + BlockSize: 1650000, + BlockVSize: 997928, + NTx: 1800, + TotalFees: 2000000, + MedianFee: 1.34, + FeeRange: []float64{1, 1.2, 1.5, 3, 4, 5, 50}, + }, + { + BlockSize: 1600000, + BlockVSize: 997927, + NTx: 1500, + TotalFees: 1500000, + MedianFee: 1.11, + FeeRange: []float64{1, 1.05, 1.1, 1.5, 1.8, 2, 20}, + }, +} + +var estimateFeeTestCasesMedian = []struct { + blocks int + want big.Int +}{ + {0, *big.NewInt(25100)}, + {1, *big.NewInt(25100)}, + {2, *big.NewInt(7310)}, + {3, *big.NewInt(3140)}, + {4, *big.NewInt(1340)}, + {5, *big.NewInt(1110)}, + {6, *big.NewInt(1110)}, + {7, *big.NewInt(1110)}, + {10, *big.NewInt(1110)}, + {36, *big.NewInt(1110)}, + {100, *big.NewInt(1110)}, + {201, *big.NewInt(1110)}, + {501, *big.NewInt(1110)}, + {5000000, *big.NewInt(1110)}, +} + +var estimateFeeTestCasesFeeRangeIndex5FallbackSet = []struct { + blocks int + want big.Int +}{ + {0, *big.NewInt(50000)}, + {1, *big.NewInt(50000)}, + {2, *big.NewInt(20000)}, + {3, *big.NewInt(10000)}, + {4, *big.NewInt(5000)}, + {5, *big.NewInt(2000)}, + {6, *big.NewInt(1000)}, + {7, *big.NewInt(1000)}, + {10, *big.NewInt(1000)}, + {36, *big.NewInt(1000)}, + {100, *big.NewInt(1000)}, + {201, *big.NewInt(1000)}, + {501, *big.NewInt(1000)}, + {5000000, *big.NewInt(1000)}, +} + +func runEstimateFeeTest(t *testing.T, testName string, m *mempoolSpaceBlockFeeProvider, expected []struct { + blocks int + want big.Int +}) { + success := m.processData(&testBlocks) + if !success { + t.Fatalf("[%s] Expected data to be processed successfully", testName) + } + + for _, tt := range expected { + t.Run(testName+"_"+strconv.Itoa(tt.blocks), func(t *testing.T) { + got, err := m.estimateFee(tt.blocks) + if err != nil { + t.Errorf("[%s] estimateFee returned error: %v", testName, err) + } + if got.Cmp(&tt.want) != 0 { + t.Errorf("[%s] estimateFee(%d) = %v, want %v", testName, tt.blocks, got, tt.want) + } + }) + } +} + +func Test_mempoolSpaceBlockFeeProviderMedian(t *testing.T) { + // Taking the median explicitly + m, err := + NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(mempoolSpaceBlockFeeParams{ + URL: "https://mempool.space/api/v1/fees/mempool-blocks", + PeriodSeconds: 20, + FeeRangeIndex: nil, + }) + if err != nil { + t.Fatalf("NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain returned error: %v", err) + } + runEstimateFeeTest(t, "median", m, estimateFeeTestCasesMedian) +} + +func Test_mempoolSpaceBlockFeeProviderSecondLargestIndex(t *testing.T) { + // Taking the valid index + index := 5 + m, err := + NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(mempoolSpaceBlockFeeParams{ + URL: "https://mempool.space/api/v1/fees/mempool-blocks", + PeriodSeconds: 20, + FeeRangeIndex: &index, + FallbackFeePerKB: 1000, + }) + if err != nil { + t.Fatalf("NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain returned error: %v", err) + } + runEstimateFeeTest(t, "feeRangeIndex_5", m, estimateFeeTestCasesFeeRangeIndex5FallbackSet) +} + +func Test_mempoolSpaceBlockFeeProviderInvalidIndexTooHigh(t *testing.T) { + index := 555 + _, err := + NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(mempoolSpaceBlockFeeParams{ + URL: "https://mempool.space/api/v1/fees/mempool-blocks", + PeriodSeconds: 20, + FeeRangeIndex: &index, + }) + + if err == nil { + t.Fatalf("expected error, got nil") + } + + expectedSubstring := "feeRangeIndex must be between 0 and 6" + if !strings.Contains(err.Error(), expectedSubstring) { + t.Errorf("expected error message to contain %q, got: %v", expectedSubstring, err) + } +} + +func Test_mempoolSpaceBlockFeeProviderMissingUrl(t *testing.T) { + _, err := + NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(mempoolSpaceBlockFeeParams{ + PeriodSeconds: 20, + FeeRangeIndex: nil, + }) + + if err == nil { + t.Fatalf("expected error, got nil") + } + + expectedSubstring := "Missing url" + if !strings.Contains(err.Error(), expectedSubstring) { + t.Errorf("expected error message to contain %q, got: %v", expectedSubstring, err) + } +} + +func Test_mempoolSpaceBlockFeeProviderMissingPeriodSeconds(t *testing.T) { + _, err := + NewMempoolSpaceBlockFeeProviderFromParamsWithoutChain(mempoolSpaceBlockFeeParams{ + URL: "https://mempool.space/api/v1/fees/mempool-blocks", + FeeRangeIndex: nil, + }) + + if err == nil { + t.Fatalf("expected error, got nil") + } + + expectedSubstring := "Missing periodSeconds" + if !strings.Contains(err.Error(), expectedSubstring) { + t.Errorf("expected error message to contain %q, got: %v", expectedSubstring, err) + } +} diff --git a/bchain/coins/btc/whatthefee.go b/bchain/coins/btc/whatthefee.go index c0977f80d8..dba3193434 100644 --- a/bchain/coins/btc/whatthefee.go +++ b/bchain/coins/btc/whatthefee.go @@ -3,16 +3,15 @@ package btc import ( "bytes" "encoding/json" - "fmt" "math" "net/http" "strconv" - "sync" "time" "github.com/golang/glog" "github.com/juju/errors" "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/common" ) // https://whatthefee.io returns @@ -34,49 +33,40 @@ type whatTheFeeParams struct { PeriodSeconds int `periodSeconds:"url"` } -type whatTheFeeFee struct { - blocks int - feesPerKB []int -} - -type whatTheFeeData struct { +type whatTheFeeProvider struct { + *alternativeFeeProvider params whatTheFeeParams probabilities []string - fees []whatTheFeeFee - lastSync time.Time - chain bchain.BlockChain - mux sync.Mutex } -var whatTheFee whatTheFeeData - -// InitWhatTheFee initializes https://whatthefee.io handler -func InitWhatTheFee(chain bchain.BlockChain, params string) error { - err := json.Unmarshal([]byte(params), &whatTheFee.params) +// NewWhatTheFee initializes https://whatthefee.io provider +func NewWhatTheFee(chain bchain.BlockChain, params string) (alternativeFeeProviderInterface, error) { + var p whatTheFeeProvider + err := json.Unmarshal([]byte(params), &p.params) if err != nil { - return err + return nil, err } - if whatTheFee.params.URL == "" || whatTheFee.params.PeriodSeconds == 0 { - return errors.New("Missing parameters") + if p.params.URL == "" || p.params.PeriodSeconds == 0 { + return nil, errors.New("NewWhatTheFee: Missing parameters") } - whatTheFee.chain = chain - go whatTheFeeDownloader() - return nil + p.chain = chain + go p.whatTheFeeDownloader() + return &p, nil } -func whatTheFeeDownloader() { - period := time.Duration(whatTheFee.params.PeriodSeconds) * time.Second +func (p *whatTheFeeProvider) whatTheFeeDownloader() { + period := time.Duration(p.params.PeriodSeconds) * time.Second timer := time.NewTimer(period) counter := 0 for { var data whatTheFeeServiceResult - err := whatTheFeeGetData(&data) + err := p.whatTheFeeGetData(&data) if err != nil { glog.Error("whatTheFeeGetData ", err) } else { - if whatTheFeeProcessData(&data) { + if p.whatTheFeeProcessData(&data) { if counter%60 == 0 { - whatTheFeeCompareToDefault() + p.compareToDefault() } counter++ } @@ -86,15 +76,15 @@ func whatTheFeeDownloader() { } } -func whatTheFeeProcessData(data *whatTheFeeServiceResult) bool { +func (p *whatTheFeeProvider) whatTheFeeProcessData(data *whatTheFeeServiceResult) bool { if len(data.Index) == 0 || len(data.Index) != len(data.Data) || len(data.Columns) == 0 { glog.Errorf("invalid data %+v", data) return false } - whatTheFee.mux.Lock() - defer whatTheFee.mux.Unlock() - whatTheFee.probabilities = data.Columns - whatTheFee.fees = make([]whatTheFeeFee, len(data.Index)) + p.mux.Lock() + defer p.mux.Unlock() + p.probabilities = data.Columns + p.fees = make([]alternativeFeeProviderFee, len(data.Index)) for i, blocks := range data.Index { if len(data.Columns) != len(data.Data[i]) { glog.Errorf("invalid data %+v", data) @@ -104,19 +94,19 @@ func whatTheFeeProcessData(data *whatTheFeeServiceResult) bool { for j, l := range data.Data[i] { fees[j] = int(1000 * math.Exp(float64(l)/100)) } - whatTheFee.fees[i] = whatTheFeeFee{ - blocks: blocks, - feesPerKB: fees, + p.fees[i] = alternativeFeeProviderFee{ + blocks: blocks, + feePerKB: fees[len(fees)/2], } } - whatTheFee.lastSync = time.Now() - glog.Infof("%+v", whatTheFee.fees) + p.lastSync = time.Now() + glog.Infof("whatTheFees: %+v", p.fees) return true } -func whatTheFeeGetData(res interface{}) error { +func (p *whatTheFeeProvider) whatTheFeeGetData(res interface{}) error { var httpData []byte - httpReq, err := http.NewRequest("GET", whatTheFee.params.URL, bytes.NewBuffer(httpData)) + httpReq, err := http.NewRequest("GET", p.params.URL, bytes.NewBuffer(httpData)) if err != nil { return err } @@ -130,27 +120,5 @@ func whatTheFeeGetData(res interface{}) error { if httpRes.StatusCode != 200 { return errors.New("whatthefee.io returned status " + strconv.Itoa(httpRes.StatusCode)) } - return safeDecodeResponse(httpRes.Body, &res) -} - -func whatTheFeeCompareToDefault() { - output := "" - for _, fee := range whatTheFee.fees { - output += fmt.Sprint(fee.blocks, ",") - for _, wtf := range fee.feesPerKB { - output += fmt.Sprint(wtf, ",") - } - conservative, err := whatTheFee.chain.EstimateSmartFee(fee.blocks, true) - if err != nil { - glog.Error(err) - return - } - economical, err := whatTheFee.chain.EstimateSmartFee(fee.blocks, false) - if err != nil { - glog.Error(err) - return - } - output += fmt.Sprint(conservative.String(), ",", economical.String(), "\n") - } - glog.Info("whatTheFeeCompareToDefault\n", output) + return common.SafeDecodeResponseFromReader(httpRes.Body, &res) } diff --git a/bchain/coins/btg/bgoldparser.go b/bchain/coins/btg/bgoldparser.go index 2e33380dea..aca095e077 100644 --- a/bchain/coins/btg/bgoldparser.go +++ b/bchain/coins/btg/bgoldparser.go @@ -52,7 +52,9 @@ type BGoldParser struct { // NewBGoldParser returns new BGoldParser instance func NewBGoldParser(params *chaincfg.Params, c *btc.Configuration) *BGoldParser { - return &BGoldParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p := &BGoldParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p.VSizeSupport = true + return p } // GetChainParams contains network parameters for the main Bitcoin Cash network, diff --git a/bchain/coins/dash/dashparser_test.go b/bchain/coins/dash/dashparser_test.go index f420b08455..3d6c872689 100644 --- a/bchain/coins/dash/dashparser_test.go +++ b/bchain/coins/dash/dashparser_test.go @@ -159,7 +159,7 @@ var ( }, }, } - testTxPacked1 = "0a20ed732a404cdfd4e0475a7a016200b7eef191f2c9de0ffdef8a20091c0499299c12e2010100000001f85264d11a747bdba77d411e5e4a3d35e3aeb5843b34a95234a2121ac65496bd000000006b483045022100dfa158fbd9773fab4f6f329c807e040af0c3a40967cbe01667169b914ed5ad960220061c5876364caa3e3c9c990ad2b4cc8b1a53d4f954dbda8434b0e67cc8348ff6012103093865e1e132b33a2a5ed01c79d2edba3473826a66cb26b8311bfa42749c2190ffffffff02ec3f8a2a010000001976a91470dcef2a22575d7a8f0779fb1d6cdd48135bd22788ac3116491d000000001976a91471348f7780e955a2a60eba17ecc4c826ebc23a9888ac0000000018f6cad8e305200028c0e03e3299010a001220bd9654c61a12a23452a9343b84b5aee3353d4a5e1e417da7db7b741ad16452f81800226b483045022100dfa158fbd9773fab4f6f329c807e040af0c3a40967cbe01667169b914ed5ad960220061c5876364caa3e3c9c990ad2b4cc8b1a53d4f954dbda8434b0e67cc8348ff6012103093865e1e132b33a2a5ed01c79d2edba3473826a66cb26b8311bfa42749c219028ffffffff0f3a480a05012a8a3fec10001a1976a91470dcef2a22575d7a8f0779fb1d6cdd48135bd22788ac2222586b7963425831796b565858733932704169365a51775a50457265396b5348484b483a470a041d49163110011a1976a91471348f7780e955a2a60eba17ecc4c826ebc23a9888ac2222586d31523974684b426d32455a4b5a657658736d4d5834445677515175546f685a754001" + testTxPacked1 = "0a20ed732a404cdfd4e0475a7a016200b7eef191f2c9de0ffdef8a20091c0499299c12e2010100000001f85264d11a747bdba77d411e5e4a3d35e3aeb5843b34a95234a2121ac65496bd000000006b483045022100dfa158fbd9773fab4f6f329c807e040af0c3a40967cbe01667169b914ed5ad960220061c5876364caa3e3c9c990ad2b4cc8b1a53d4f954dbda8434b0e67cc8348ff6012103093865e1e132b33a2a5ed01c79d2edba3473826a66cb26b8311bfa42749c2190ffffffff02ec3f8a2a010000001976a91470dcef2a22575d7a8f0779fb1d6cdd48135bd22788ac3116491d000000001976a91471348f7780e955a2a60eba17ecc4c826ebc23a9888ac0000000018f6cad8e30528c0e03e3295011220bd9654c61a12a23452a9343b84b5aee3353d4a5e1e417da7db7b741ad16452f8226b483045022100dfa158fbd9773fab4f6f329c807e040af0c3a40967cbe01667169b914ed5ad960220061c5876364caa3e3c9c990ad2b4cc8b1a53d4f954dbda8434b0e67cc8348ff6012103093865e1e132b33a2a5ed01c79d2edba3473826a66cb26b8311bfa42749c219028ffffffff0f3a460a05012a8a3fec1a1976a91470dcef2a22575d7a8f0779fb1d6cdd48135bd22788ac2222586b7963425831796b565858733932704169365a51775a50457265396b5348484b483a470a041d49163110011a1976a91471348f7780e955a2a60eba17ecc4c826ebc23a9888ac2222586d31523974684b426d32455a4b5a657658736d4d5834445677515175546f685a754001" testTx2 = bchain.Tx{ Blocktime: 1551246710, @@ -195,7 +195,7 @@ var ( }, } - testTxPacked2 = "0a2071d6975e3b79b52baf26c3269896a34f3bedfb04561c692ffa31f64dada1f9c412b50103000500010000000000000000000000000000000000000000000000000000000000000000ffffffff170340b00f1291af3c09542bc8349901000000002f4e614effffffff024181f809000000001976a9146a341485a9444b35dc9cb90d24e7483de7d37e0088ac3581f809000000001976a9140d1156f6026bf975ea3553b03fb534d0959c294c88ac0000000026010040b00f00000000000000000000000000000000000000000000000000000000000000000018f6cad8e305200028c0e03e32380a2e30333430623030663132393161663363303935343262633833343939303130303030303030303266346536313465180028ffffffff0f3a470a0409f8814110001a1976a9146a341485a9444b35dc9cb90d24e7483de7d37e0088ac2222586b4e507242534a7472485a5576557162334a46346735724d4233757a614a66454c3a470a0409f8813510011a1976a9140d1156f6026bf975ea3553b03fb534d0959c294c88ac222258627377505868634c716d35414e35677763545479695547535032596e6457776b394003" + testTxPacked2 = "0a2071d6975e3b79b52baf26c3269896a34f3bedfb04561c692ffa31f64dada1f9c412b50103000500010000000000000000000000000000000000000000000000000000000000000000ffffffff170340b00f1291af3c09542bc8349901000000002f4e614effffffff024181f809000000001976a9146a341485a9444b35dc9cb90d24e7483de7d37e0088ac3581f809000000001976a9140d1156f6026bf975ea3553b03fb534d0959c294c88ac0000000026010040b00f00000000000000000000000000000000000000000000000000000000000000000018f6cad8e30528c0e03e32360a2e3033343062303066313239316166336330393534326263383334393930313030303030303030326634653631346528ffffffff0f3a450a0409f881411a1976a9146a341485a9444b35dc9cb90d24e7483de7d37e0088ac2222586b4e507242534a7472485a5576557162334a46346735724d4233757a614a66454c3a470a0409f8813510011a1976a9140d1156f6026bf975ea3553b03fb534d0959c294c88ac222258627377505868634c716d35414e35677763545479695547535032596e6457776b394003" ) func TestBaseParser_ParseTxFromJson(t *testing.T) { diff --git a/bchain/coins/dcr/decredrpc.go b/bchain/coins/dcr/decredrpc.go index 07cc459849..31c5810f81 100644 --- a/bchain/coins/dcr/decredrpc.go +++ b/bchain/coins/dcr/decredrpc.go @@ -791,7 +791,7 @@ func (d *DecredRPC) EstimateFee(blocks int) (big.Int, error) { return r, nil } -func (d *DecredRPC) SendRawTransaction(tx string) (string, error) { +func (d *DecredRPC) SendRawTransaction(tx string, disableAlternativeRPC bool) (string, error) { sendRawTxRequest := &GenericCmd{ ID: 1, Method: "sendrawtransaction", diff --git a/bchain/coins/deeponion/deeponionparser_test.go b/bchain/coins/deeponion/deeponionparser_test.go index cb1497922a..2dbb494a11 100644 --- a/bchain/coins/deeponion/deeponionparser_test.go +++ b/bchain/coins/deeponion/deeponionparser_test.go @@ -75,7 +75,7 @@ func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) { var ( testTx1 bchain.Tx - testTxPacked1 = "0a206ba18524d81af732d0226ffdb63d2bcdc0d58a35ac97b5ad731057932d324e1412b401010000001134415d0114caae2bf9a7808aee0798e6245a347405d46c8131dbf55cbbbc689bbee367e902000000484730440220280f3fa80b4e93834fe0a8d9884105310eaa8d36d77b9aff113b6c498138e5bb02204578409f0a14fa1950ea4951314fd495fd503b42a6325efb5c139a6c8253912401ffffffff0200000000000000000005f22f5904000000232102bdb95d89f07e3a29305f3c8de86ec211ed77b7e15cf314c85c532a6b71c2ce07ac000000001891e884ea05200028b88a5432760a001220e967e3be9b68bcbb5cf5db31816cd40574345a24e69807ee8a80a7f92baeca14180222484730440220280f3fa80b4e93834fe0a8d9884105310eaa8d36d77b9aff113b6c498138e5bb02204578409f0a14fa1950ea4951314fd495fd503b42a6325efb5c139a6c825391240128ffffffff0f3a0210003a520a0504583af7fb10011a232102bdb95d89f07e3a29305f3c8de86ec211ed77b7e15cf314c85c532a6b71c2ce07ac2222446d343835624e4a6169474a6d4556746832426e5a345931796763756644736934454001" + testTxPacked1 = "0a206ba18524d81af732d0226ffdb63d2bcdc0d58a35ac97b5ad731057932d324e1412b401010000001134415d0114caae2bf9a7808aee0798e6245a347405d46c8131dbf55cbbbc689bbee367e902000000484730440220280f3fa80b4e93834fe0a8d9884105310eaa8d36d77b9aff113b6c498138e5bb02204578409f0a14fa1950ea4951314fd495fd503b42a6325efb5c139a6c8253912401ffffffff0200000000000000000005f22f5904000000232102bdb95d89f07e3a29305f3c8de86ec211ed77b7e15cf314c85c532a6b71c2ce07ac000000001891e884ea0528b88a5432741220e967e3be9b68bcbb5cf5db31816cd40574345a24e69807ee8a80a7f92baeca14180222484730440220280f3fa80b4e93834fe0a8d9884105310eaa8d36d77b9aff113b6c498138e5bb02204578409f0a14fa1950ea4951314fd495fd503b42a6325efb5c139a6c825391240128ffffffff0f3a003a520a0504583af7fb10011a232102bdb95d89f07e3a29305f3c8de86ec211ed77b7e15cf314c85c532a6b71c2ce07ac2222446d343835624e4a6169474a6d4556746832426e5a345931796763756644736934454001" ) func init() { diff --git a/bchain/coins/digibyte/digibyteparser.go b/bchain/coins/digibyte/digibyteparser.go index 386796d5d9..705fee114f 100644 --- a/bchain/coins/digibyte/digibyteparser.go +++ b/bchain/coins/digibyte/digibyteparser.go @@ -39,7 +39,9 @@ type DigiByteParser struct { // NewDigiByteParser returns new DigiByteParser instance func NewDigiByteParser(params *chaincfg.Params, c *btc.Configuration) *DigiByteParser { - return &DigiByteParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p := &DigiByteParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p.VSizeSupport = true + return p } // GetChainParams contains network parameters for the main DigiByte network diff --git a/bchain/coins/digibyte/digibyteparser_test.go b/bchain/coins/digibyte/digibyteparser_test.go index 8f96165fdc..6ffe10cb00 100644 --- a/bchain/coins/digibyte/digibyteparser_test.go +++ b/bchain/coins/digibyte/digibyteparser_test.go @@ -90,6 +90,7 @@ func init() { Blocktime: 1532239774, Txid: "0dcf2530419b9ef525a69f6a15e4d699be1dc9a4ac643c9581b6c57acf25eabf", LockTime: 7000000, + VSize: 226, Version: 1, Vin: []bchain.Vin{ { diff --git a/bchain/coins/divi/diviparser_test.go b/bchain/coins/divi/diviparser_test.go index 5ad6eaccd4..1f95e025ba 100755 --- a/bchain/coins/divi/diviparser_test.go +++ b/bchain/coins/divi/diviparser_test.go @@ -105,11 +105,11 @@ func Test_GetAddressesFromAddrDesc(t *testing.T) { var ( // Mint transaction testTx1 bchain.Tx - testTxPacked1 = "0a20f7a5324866ba18058ab032196f34458d19f7ec5a4ac284670c3ef07bfa724644124201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603de3d060101ffffffff010000000000000000000000000018aefd9ce905200028defb1832160a0c303364653364303630313031180028ffffffff0f3a0210004000" + testTxPacked1 = "0a20f7a5324866ba18058ab032196f34458d19f7ec5a4ac284670c3ef07bfa724644124201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0603de3d060101ffffffff010000000000000000000000000018aefd9ce90528defb1832140a0c30336465336430363031303128ffffffff0f3a00" // Normal transaction testTx2 bchain.Tx - testTxPacked2 = "0a20eace41778a2940ff423b72a42033990eb5d6092810734a5806da6f3e5b34086412ea010100000001084b029489e1cddf726080c447c8a2b1d4bbe43024db31b8b19bc07585db9555010000006a473044022017422b9e3414d6233fa75f9eb7778469bebbb40686b0f7eb77d90a04c80149610220411f1063086fe205ea821ceb0de89e8158e202aba00f5ebb92b51f97381311fd012102ccb10a2f0603a0624b8708abefb5f4700631fc131c5de38b51e0359e2ffa7d1cffffffff03000000000000000000f260de1a580100001976a9145b1d583a4c270f2f14be77b298f0a9c6df97471388ac009ca6920c0000001976a914cb1196fb1b98d04b0cb8d2ffde3c2de3eb83d9fe88ac0000000018aefd9ce905200028defb183298010a0012205595db8575c09bb1b831db2430e4bbd4b1a2c847c4806072dfcde18994024b081801226a473044022017422b9e3414d6233fa75f9eb7778469bebbb40686b0f7eb77d90a04c80149610220411f1063086fe205ea821ceb0de89e8158e202aba00f5ebb92b51f97381311fd012102ccb10a2f0603a0624b8708abefb5f4700631fc131c5de38b51e0359e2ffa7d1c28ffffffff0f3a0210003a490a0601581ade60f210011a1976a9145b1d583a4c270f2f14be77b298f0a9c6df97471388ac222244445373426368576956667650566e364c6470316e4c376b344c3737635344714d373a480a050c92a69c0010021a1976a914cb1196fb1b98d04b0cb8d2ffde3c2de3eb83d9fe88ac2222445065706e4d6b614e484b436136635169376f425468726469464577535359467a764000" + testTxPacked2 = "0a20eace41778a2940ff423b72a42033990eb5d6092810734a5806da6f3e5b34086412ea010100000001084b029489e1cddf726080c447c8a2b1d4bbe43024db31b8b19bc07585db9555010000006a473044022017422b9e3414d6233fa75f9eb7778469bebbb40686b0f7eb77d90a04c80149610220411f1063086fe205ea821ceb0de89e8158e202aba00f5ebb92b51f97381311fd012102ccb10a2f0603a0624b8708abefb5f4700631fc131c5de38b51e0359e2ffa7d1cffffffff03000000000000000000f260de1a580100001976a9145b1d583a4c270f2f14be77b298f0a9c6df97471388ac009ca6920c0000001976a914cb1196fb1b98d04b0cb8d2ffde3c2de3eb83d9fe88ac0000000018aefd9ce90528defb1832960112205595db8575c09bb1b831db2430e4bbd4b1a2c847c4806072dfcde18994024b081801226a473044022017422b9e3414d6233fa75f9eb7778469bebbb40686b0f7eb77d90a04c80149610220411f1063086fe205ea821ceb0de89e8158e202aba00f5ebb92b51f97381311fd012102ccb10a2f0603a0624b8708abefb5f4700631fc131c5de38b51e0359e2ffa7d1c28ffffffff0f3a003a490a0601581ade60f210011a1976a9145b1d583a4c270f2f14be77b298f0a9c6df97471388ac222244445373426368576956667650566e364c6470316e4c376b344c3737635344714d373a480a050c92a69c0010021a1976a914cb1196fb1b98d04b0cb8d2ffde3c2de3eb83d9fe88ac2222445065706e4d6b614e484b436136635169376f425468726469464577535359467a76" ) func init() { diff --git a/bchain/coins/ecash/ecashparser.go b/bchain/coins/ecash/ecashparser.go index e4547ae8ce..2b4ef88184 100644 --- a/bchain/coins/ecash/ecashparser.go +++ b/bchain/coins/ecash/ecashparser.go @@ -3,11 +3,11 @@ package ecash import ( "fmt" - "github.com/pirk/ecashutil" "github.com/martinboehm/btcutil" "github.com/martinboehm/btcutil/chaincfg" "github.com/martinboehm/btcutil/txscript" "github.com/pirk/ecashaddr-converter/address" + "github.com/pirk/ecashutil" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/bchain/coins/btc" ) diff --git a/bchain/coins/ecash/ecashparser_test.go b/bchain/coins/ecash/ecashparser_test.go index 218299bd10..719ded6c2e 100644 --- a/bchain/coins/ecash/ecashparser_test.go +++ b/bchain/coins/ecash/ecashparser_test.go @@ -342,6 +342,10 @@ func Test_UnpackTx(t *testing.T) { t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr) return } + // ignore witness unpacking + for i := range got.Vin { + got.Vin[i].Witness = nil + } if !reflect.DeepEqual(got, tt.want) { t.Errorf("unpackTx() got = %v, want %v", got, tt.want) } diff --git a/bchain/coins/eth/alternativefeeprovider.go b/bchain/coins/eth/alternativefeeprovider.go new file mode 100644 index 0000000000..d361df8fbf --- /dev/null +++ b/bchain/coins/eth/alternativefeeprovider.go @@ -0,0 +1,29 @@ +package eth + +import ( + "sync" + "time" + + "github.com/trezor/blockbook/bchain" +) + +type alternativeFeeProvider struct { + eip1559Fees *bchain.Eip1559Fees + lastSync time.Time + staleSyncDuration time.Duration + chain bchain.BlockChain + mux sync.Mutex +} + +type alternativeFeeProviderInterface interface { + GetEip1559Fees() (*bchain.Eip1559Fees, error) +} + +func (p *alternativeFeeProvider) GetEip1559Fees() (*bchain.Eip1559Fees, error) { + p.mux.Lock() + defer p.mux.Unlock() + if p.lastSync.Add(p.staleSyncDuration).Before(time.Now()) { + return nil, nil + } + return p.eip1559Fees, nil +} diff --git a/bchain/coins/eth/alternativesendtx.go b/bchain/coins/eth/alternativesendtx.go new file mode 100644 index 0000000000..a1e0b85d33 --- /dev/null +++ b/bchain/coins/eth/alternativesendtx.go @@ -0,0 +1,206 @@ +package eth + +import ( + "context" + "encoding/json" + "os" + "strings" + "sync" + "time" + + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/rpc" + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" +) + +type storedTx struct { + tx *bchain.RpcTransaction + time uint32 +} + +// AlternativeSendTxProvider handles sending transactions to alternative providers +type AlternativeSendTxProvider struct { + urls []string + onlyAlternative bool + fetchMempoolTx bool + mempoolTxs map[string]storedTx + mempoolTxsMux sync.Mutex + mempoolTxsTimeout time.Duration + rpcTimeout time.Duration + mempool *bchain.MempoolEthereumType + removeTransactionFromMempool func(string) +} + +// NewAlternativeSendTxProvider creates a new alternative send tx provider if enabled +func NewAlternativeSendTxProvider(network string, rpcTimeout int, mempoolTxsTimeout int) *AlternativeSendTxProvider { + urls := strings.Split(os.Getenv(strings.ToUpper(network)+"_ALTERNATIVE_SENDTX_URLS"), ",") + onlyAlternative := strings.ToUpper(os.Getenv(strings.ToUpper(network)+"_ALTERNATIVE_SENDTX_ONLY")) == "TRUE" + fetchMempoolTx := strings.ToUpper(os.Getenv(strings.ToUpper(network)+"_ALTERNATIVE_FETCH_MEMPOOL_TX")) == "TRUE" + if len(urls) == 0 || urls[0] == "" { + return nil + } + + provider := &AlternativeSendTxProvider{ + urls: urls, + onlyAlternative: onlyAlternative, + fetchMempoolTx: fetchMempoolTx, + rpcTimeout: time.Duration(rpcTimeout) * time.Second, + mempoolTxsTimeout: time.Duration(mempoolTxsTimeout) * time.Hour, + mempoolTxs: make(map[string]storedTx), + } + + glog.Infof("Using alternative send transaction providers %v. Only alternative providers %v", urls, onlyAlternative) + if fetchMempoolTx { + glog.Infof("Alternative fetch mempool tx %v", fetchMempoolTx) + } + + return provider +} + +// SetupMempool sets up connection to the mempool +func (p *AlternativeSendTxProvider) SetupMempool(mempool *bchain.MempoolEthereumType, removeTransactionFromMempool func(string)) { + p.mempool = mempool + p.removeTransactionFromMempool = removeTransactionFromMempool +} + +// SendRawTransaction sends raw transaction to alternative providers +func (p *AlternativeSendTxProvider) SendRawTransaction(hex string) (string, error) { + var txid string + var retErr error + + for i := range p.urls { + r, err := p.callHttpStringResult(p.urls[i], "eth_sendRawTransaction", hex) + glog.Infof("eth_sendRawTransaction to %s, txid %s", p.urls[i], r) + // set success return value; or error only if there was no previous success + if err == nil || len(txid) == 0 { + txid = r + retErr = err + } + } + + if p.onlyAlternative && p.fetchMempoolTx { + p.handleMempoolTransaction(txid) + } + + return txid, retErr +} + +// handleMempoolTransaction handles the transaction when using only alternative providers +func (p *AlternativeSendTxProvider) handleMempoolTransaction(txid string) (string, error) { + hash := ethcommon.HexToHash(txid) + raw, err := p.callHttpRawResult(p.urls[0], "eth_getTransactionByHash", hash) + if err != nil || raw == nil { + glog.Errorf("eth_getTransactionByHash from %s returned error %v", p.urls[0], err) + return txid, err + } + + var tx bchain.RpcTransaction + if err := json.Unmarshal(raw, &tx); err != nil { + glog.Errorf("eth_getTransactionByHash from %s unmarshal returned error %v", p.urls[0], err) + return txid, err + } + + p.mempoolTxsMux.Lock() + // remove potential RBF transactions - with equal from and nonce + var rbfTxid string + for rbf, storedTx := range p.mempoolTxs { + if storedTx.tx.From == tx.From && storedTx.tx.AccountNonce == tx.AccountNonce { + rbfTxid = rbf + break + } + } + p.mempoolTxs[txid] = storedTx{tx: &tx, time: uint32(time.Now().Unix())} + p.mempoolTxsMux.Unlock() + + if rbfTxid != "" { + glog.Infof("eth_sendRawTransaction replacing txid %s by %s", rbfTxid, txid) + if p.removeTransactionFromMempool != nil { + p.removeTransactionFromMempool(rbfTxid) + } + } + + if p.mempool != nil { + p.mempool.AddTransactionToMempool(txid) + } + + return txid, nil +} + +// GetTransaction gets a transaction from alternative mempool cache +func (p *AlternativeSendTxProvider) GetTransaction(txid string) (*bchain.RpcTransaction, bool) { + if !p.fetchMempoolTx { + return nil, false + } + + var storedTx storedTx + var found bool + + p.mempoolTxsMux.Lock() + storedTx, found = p.mempoolTxs[txid] + p.mempoolTxsMux.Unlock() + + if found { + if time.Unix(int64(storedTx.time), 0).Before(time.Now().Add(-p.mempoolTxsTimeout)) { + p.mempoolTxsMux.Lock() + delete(p.mempoolTxs, txid) + p.mempoolTxsMux.Unlock() + return nil, false + } + return storedTx.tx, true + } + + return nil, false +} + +// RemoveTransaction removes a transaction from alternative mempool cache +func (p *AlternativeSendTxProvider) RemoveTransaction(txid string) { + if !p.fetchMempoolTx { + return + } + + p.mempoolTxsMux.Lock() + delete(p.mempoolTxs, txid) + p.mempoolTxsMux.Unlock() +} + +// UseOnlyAlternativeProvider returns true if only alternative providers should be used +func (p *AlternativeSendTxProvider) UseOnlyAlternativeProvider() bool { + return p.onlyAlternative +} + +// Helper function for calling ETH RPC over http with parameters. Creates and closes a new client for every call. +func (p *AlternativeSendTxProvider) callHttpRawResult(url string, rpcMethod string, args ...interface{}) (json.RawMessage, error) { + ctx, cancel := context.WithTimeout(context.Background(), p.rpcTimeout) + defer cancel() + client, err := rpc.DialContext(ctx, url) + if err != nil { + return nil, err + } + defer client.Close() + var raw json.RawMessage + err = client.CallContext(ctx, &raw, rpcMethod, args...) + if err != nil { + return nil, err + } else if len(raw) == 0 { + return nil, errors.New(url + " " + rpcMethod + " : failed") + } + return raw, nil +} + +// Helper function for calling ETH RPC over http with parameters and getting string result. Creates and closes a new client for every call. +func (p *AlternativeSendTxProvider) callHttpStringResult(url string, rpcMethod string, args ...interface{}) (string, error) { + raw, err := p.callHttpRawResult(url, rpcMethod, args...) + if err != nil { + return "", err + } + var result string + if err := json.Unmarshal(raw, &result); err != nil { + return "", errors.Annotatef(err, "%s %s raw result %v", url, rpcMethod, raw) + } + if result == "" { + return "", errors.New(url + " " + rpcMethod + " : failed, empty result") + } + return result, nil +} diff --git a/bchain/coins/eth/contract.go b/bchain/coins/eth/contract.go new file mode 100644 index 0000000000..682f4c2cd7 --- /dev/null +++ b/bchain/coins/eth/contract.go @@ -0,0 +1,392 @@ +package eth + +import ( + "context" + "math/big" + "strings" + + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" +) + +const erc20TransferMethodSignature = "0xa9059cbb" // transfer(address,uint256) +const erc721TransferFromMethodSignature = "0x23b872dd" // transferFrom(address,address,uint256) +const erc721SafeTransferFromMethodSignature = "0x42842e0e" // safeTransferFrom(address,address,uint256) +const erc721SafeTransferFromWithDataMethodSignature = "0xb88d4fde" // safeTransferFrom(address,address,uint256,bytes) +const erc721TokenURIMethodSignature = "0xc87b56dd" // tokenURI(uint256) +const erc1155URIMethodSignature = "0x0e89341c" // uri(uint256) + +const tokenTransferEventSignature = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" +const tokenERC1155TransferSingleEventSignature = "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62" +const tokenERC1155TransferBatchEventSignature = "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb" + +const nameRegisteredEventSignature = "0xca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f" + +const contractNameSignature = "0x06fdde03" +const contractSymbolSignature = "0x95d89b41" +const contractDecimalsSignature = "0x313ce567" +const contractBalanceOfSignature = "0x70a08231" + +func addressFromPaddedHex(s string) (string, error) { + var t big.Int + var ok bool + if has0xPrefix(s) { + _, ok = t.SetString(s[2:], 16) + } else { + _, ok = t.SetString(s, 16) + } + if !ok { + return "", errors.New("Data is not a number") + } + a := ethcommon.BigToAddress(&t) + return a.String(), nil +} + +func processTransferEvent(l *bchain.RpcLog) (transfer *bchain.TokenTransfer, err error) { + defer func() { + if r := recover(); r != nil { + err = errors.Errorf("processTransferEvent recovered from panic %v", r) + } + }() + tl := len(l.Topics) + var standard bchain.TokenStandard + var value big.Int + if tl == 3 { + standard = bchain.FungibleToken + _, ok := value.SetString(l.Data, 0) + if !ok { + return nil, errors.New("ERC20 log Data is not a number") + } + } else if tl == 4 { + standard = bchain.NonFungibleToken + _, ok := value.SetString(l.Topics[3], 0) + if !ok { + return nil, errors.New("ERC721 log Topics[3] is not a number") + } + } else { + return nil, nil + } + var from, to string + from, err = addressFromPaddedHex(l.Topics[1]) + if err != nil { + return nil, err + } + to, err = addressFromPaddedHex(l.Topics[2]) + if err != nil { + return nil, err + } + return &bchain.TokenTransfer{ + Standard: standard, + Contract: EIP55AddressFromAddress(l.Address), + From: EIP55AddressFromAddress(from), + To: EIP55AddressFromAddress(to), + Value: value, + }, nil +} + +func processERC1155TransferSingleEvent(l *bchain.RpcLog) (transfer *bchain.TokenTransfer, err error) { + defer func() { + if r := recover(); r != nil { + err = errors.Errorf("processERC1155TransferSingleEvent recovered from panic %v", r) + } + }() + tl := len(l.Topics) + if tl != 4 { + return nil, nil + } + var from, to string + from, err = addressFromPaddedHex(l.Topics[2]) + if err != nil { + return nil, err + } + to, err = addressFromPaddedHex(l.Topics[3]) + if err != nil { + return nil, err + } + var id, value big.Int + data := l.Data + if has0xPrefix(l.Data) { + data = data[2:] + } + _, ok := id.SetString(data[:64], 16) + if !ok { + return nil, errors.New("ERC1155 log Data id is not a number") + } + _, ok = value.SetString(data[64:128], 16) + if !ok { + return nil, errors.New("ERC1155 log Data value is not a number") + } + return &bchain.TokenTransfer{ + Standard: bchain.MultiToken, + Contract: EIP55AddressFromAddress(l.Address), + From: EIP55AddressFromAddress(from), + To: EIP55AddressFromAddress(to), + MultiTokenValues: []bchain.MultiTokenValue{{Id: id, Value: value}}, + }, nil +} + +func processERC1155TransferBatchEvent(l *bchain.RpcLog) (transfer *bchain.TokenTransfer, err error) { + defer func() { + if r := recover(); r != nil { + err = errors.Errorf("processERC1155TransferBatchEvent recovered from panic %v", r) + } + }() + tl := len(l.Topics) + if tl < 4 { + return nil, nil + } + var from, to string + from, err = addressFromPaddedHex(l.Topics[2]) + if err != nil { + return nil, err + } + to, err = addressFromPaddedHex(l.Topics[3]) + if err != nil { + return nil, err + } + data := l.Data + if has0xPrefix(l.Data) { + data = data[2:] + } + var b big.Int + _, ok := b.SetString(data[:64], 16) + if !ok || !b.IsInt64() { + return nil, errors.New("ERC1155 TransferBatch, not a number") + } + offsetIds := int(b.Int64()) * 2 + _, ok = b.SetString(data[64:128], 16) + if !ok || !b.IsInt64() { + return nil, errors.New("ERC1155 TransferBatch, not a number") + } + offsetValues := int(b.Int64()) * 2 + _, ok = b.SetString(data[offsetIds:offsetIds+64], 16) + if !ok || !b.IsInt64() { + return nil, errors.New("ERC1155 TransferBatch, not a number") + } + countIds := int(b.Int64()) + _, ok = b.SetString(data[offsetValues:offsetValues+64], 16) + if !ok || !b.IsInt64() { + return nil, errors.New("ERC1155 TransferBatch, not a number") + } + countValues := int(b.Int64()) + if countIds != countValues { + return nil, errors.New("ERC1155 TransferBatch, count values and ids does not match") + } + idValues := make([]bchain.MultiTokenValue, countValues) + for i := 0; i < countValues; i++ { + var id, value big.Int + o := offsetIds + 64 + 64*i + _, ok := id.SetString(data[o:o+64], 16) + if !ok { + return nil, errors.New("ERC1155 log Data id is not a number") + } + o = offsetValues + 64 + 64*i + _, ok = value.SetString(data[o:o+64], 16) + if !ok { + return nil, errors.New("ERC1155 log Data value is not a number") + } + idValues[i] = bchain.MultiTokenValue{Id: id, Value: value} + } + return &bchain.TokenTransfer{ + Standard: bchain.MultiToken, + Contract: EIP55AddressFromAddress(l.Address), + From: EIP55AddressFromAddress(from), + To: EIP55AddressFromAddress(to), + MultiTokenValues: idValues, + }, nil +} + +func contractGetTransfersFromLog(logs []*bchain.RpcLog) (bchain.TokenTransfers, error) { + var r bchain.TokenTransfers + var tt *bchain.TokenTransfer + var err error + for _, l := range logs { + tl := len(l.Topics) + if tl > 0 { + signature := l.Topics[0] + if signature == tokenTransferEventSignature { + tt, err = processTransferEvent(l) + } else if signature == tokenERC1155TransferSingleEventSignature { + tt, err = processERC1155TransferSingleEvent(l) + } else if signature == tokenERC1155TransferBatchEventSignature { + tt, err = processERC1155TransferBatchEvent(l) + } else { + continue + } + if err != nil { + return nil, err + } + if tt != nil { + r = append(r, tt) + } + } + } + return r, nil +} + +func contractGetTransfersFromTx(tx *bchain.RpcTransaction) (bchain.TokenTransfers, error) { + var r bchain.TokenTransfers + if len(tx.Payload) == 10+128 && strings.HasPrefix(tx.Payload, erc20TransferMethodSignature) { + to, err := addressFromPaddedHex(tx.Payload[10 : 10+64]) + if err != nil { + return nil, err + } + var t big.Int + _, ok := t.SetString(tx.Payload[10+64:], 16) + if !ok { + return nil, errors.New("Data is not a number") + } + r = append(r, &bchain.TokenTransfer{ + Standard: bchain.FungibleToken, + Contract: EIP55AddressFromAddress(tx.To), + From: EIP55AddressFromAddress(tx.From), + To: EIP55AddressFromAddress(to), + Value: t, + }) + } else if len(tx.Payload) >= 10+192 && + (strings.HasPrefix(tx.Payload, erc721TransferFromMethodSignature) || + strings.HasPrefix(tx.Payload, erc721SafeTransferFromMethodSignature) || + strings.HasPrefix(tx.Payload, erc721SafeTransferFromWithDataMethodSignature)) { + from, err := addressFromPaddedHex(tx.Payload[10 : 10+64]) + if err != nil { + return nil, err + } + to, err := addressFromPaddedHex(tx.Payload[10+64 : 10+128]) + if err != nil { + return nil, err + } + var t big.Int + _, ok := t.SetString(tx.Payload[10+128:10+192], 16) + if !ok { + return nil, errors.New("Data is not a number") + } + r = append(r, &bchain.TokenTransfer{ + Standard: bchain.NonFungibleToken, + Contract: EIP55AddressFromAddress(tx.To), + From: EIP55AddressFromAddress(from), + To: EIP55AddressFromAddress(to), + Value: t, + }) + } + return r, nil +} + +// EthereumTypeRpcCall calls eth_call with given data and to address +func (b *EthereumRPC) EthereumTypeRpcCall(data, to, from string) (string, error) { + args := map[string]interface{}{ + "data": data, + "to": to, + } + if from != "" { + args["from"] = from + } + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + var r string + err := b.RPC.CallContext(ctx, &r, "eth_call", args, "latest") + if err != nil { + return "", err + } + return r, nil +} + +func (b *EthereumRPC) fetchContractInfo(address string) (*bchain.ContractInfo, error) { + var contract bchain.ContractInfo + data, err := b.EthereumTypeRpcCall(contractNameSignature, address, "") + if err != nil { + // ignore the error from the eth_call - since geth v1.9.15 they changed the behavior + // and returning error "execution reverted" for some non contract addresses + // https://github.com/ethereum/go-ethereum/issues/21249#issuecomment-648647672 + // glog.Warning(errors.Annotatef(err, "Contract NameSignature %v", address)) + return nil, nil + // return nil, errors.Annotatef(err, "erc20NameSignature %v", address) + } + name := strings.TrimSpace(parseSimpleStringProperty(data)) + if name != "" { + data, err = b.EthereumTypeRpcCall(contractSymbolSignature, address, "") + if err != nil { + // glog.Warning(errors.Annotatef(err, "Contract SymbolSignature %v", address)) + return nil, nil + // return nil, errors.Annotatef(err, "erc20SymbolSignature %v", address) + } + symbol := strings.TrimSpace(parseSimpleStringProperty(data)) + data, _ = b.EthereumTypeRpcCall(contractDecimalsSignature, address, "") + // if err != nil { + // glog.Warning(errors.Annotatef(err, "Contract DecimalsSignature %v", address)) + // // return nil, errors.Annotatef(err, "erc20DecimalsSignature %v", address) + // } + contract = bchain.ContractInfo{ + Contract: address, + Name: name, + Symbol: symbol, + } + d := parseSimpleNumericProperty(data) + if d != nil { + contract.Decimals = int(uint8(d.Uint64())) + } else { + contract.Decimals = EtherAmountDecimalPoint + } + } else { + return nil, nil + } + return &contract, nil +} + +// GetContractInfo returns information about a contract +func (b *EthereumRPC) GetContractInfo(contractDesc bchain.AddressDescriptor) (*bchain.ContractInfo, error) { + address := EIP55Address(contractDesc) + return b.fetchContractInfo(address) +} + +// EthereumTypeGetErc20ContractBalance returns balance of ERC20 contract for given address +func (b *EthereumRPC) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc bchain.AddressDescriptor) (*big.Int, error) { + addr := hexutil.Encode(addrDesc)[2:] + contract := hexutil.Encode(contractDesc) + req := contractBalanceOfSignature + "0000000000000000000000000000000000000000000000000000000000000000"[len(addr):] + addr + data, err := b.EthereumTypeRpcCall(req, contract, "") + if err != nil { + return nil, err + } + r := parseSimpleNumericProperty(data) + if r == nil { + return nil, errors.New("Invalid balance") + } + return r, nil +} + +// GetTokenURI returns URI of non fungible or multi token defined by token id +func (b *EthereumRPC) GetTokenURI(contractDesc bchain.AddressDescriptor, tokenID *big.Int) (string, error) { + address := hexutil.Encode(contractDesc) + // CryptoKitties do not fully support ERC721 standard, do not have tokenURI method + if address == "0x06012c8cf97bead5deae237070f9587f8e7a266d" { + return "https://api.cryptokitties.co/kitties/" + tokenID.Text(10), nil + } + id := tokenID.Text(16) + if len(id) < 64 { + id = "0000000000000000000000000000000000000000000000000000000000000000"[len(id):] + id + } + // try ERC721 tokenURI method and ERC1155 uri method + for _, method := range []string{erc721TokenURIMethodSignature, erc1155URIMethodSignature} { + data, err := b.EthereumTypeRpcCall(method+id, address, "") + if err == nil && data != "" { + uri := parseSimpleStringProperty(data) + // try to sanitize the URI returned from the contract + i := strings.LastIndex(uri, "ipfs://") + if i >= 0 { + uri = strings.Replace(uri[i:], "ipfs://", "https://ipfs.io/ipfs/", 1) + // some contracts return uri ipfs://ifps/abcdef instead of ipfs://abcdef + uri = strings.Replace(uri, "https://ipfs.io/ipfs/ipfs/", "https://ipfs.io/ipfs/", 1) + } + i = strings.LastIndex(uri, "https://") + // allow only https:// URIs + if i >= 0 { + uri = strings.ReplaceAll(uri[i:], "{id}", id) + return uri, nil + } + } + } + return "", nil +} diff --git a/bchain/coins/eth/contract_test.go b/bchain/coins/eth/contract_test.go new file mode 100644 index 0000000000..ca70c85878 --- /dev/null +++ b/bchain/coins/eth/contract_test.go @@ -0,0 +1,291 @@ +//go:build unittest + +package eth + +import ( + "fmt" + "math/big" + "strings" + "testing" + + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/tests/dbtestdata" +) + +func Test_contractGetTransfersFromLog(t *testing.T) { + tests := []struct { + name string + args []*bchain.RpcLog + want bchain.TokenTransfers + wantErr bool + }{ + { + name: "ERC20 transfer 1", + args: []*bchain.RpcLog{ + { + Address: "0x76a45e8976499ab9ae223cc584019341d5a84e96", + Topics: []string{ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000002aacf811ac1a60081ea39f7783c0d26c500871a8", + "0x000000000000000000000000e9a5216ff992cfa01594d43501a56e12769eb9d2", + }, + Data: "0x0000000000000000000000000000000000000000000000000000000000000123", + }, + }, + want: bchain.TokenTransfers{ + { + Contract: "0x76a45e8976499ab9ae223cc584019341d5a84e96", + From: "0x2aacf811ac1a60081ea39f7783c0d26c500871a8", + To: "0xe9a5216ff992cfa01594d43501a56e12769eb9d2", + Value: *big.NewInt(0x123), + }, + }, + }, + { + name: "ERC20 transfer 2", + args: []*bchain.RpcLog{ + { // Transfer + Address: "0x0d0f936ee4c93e25944694d6c121de94d9760f11", + Topics: []string{ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000006f44cceb49b4a5812d54b6f494fc2febf25511ed", + "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d", + }, + Data: "0x0000000000000000000000000000000000000000000000006a8313d60b1f606b", + }, + { // Transfer + Address: "0xc778417e063141139fce010982780140aa0cd5ab", + Topics: []string{ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d", + "0x0000000000000000000000006f44cceb49b4a5812d54b6f494fc2febf25511ed", + }, + Data: "0x000000000000000000000000000000000000000000000000000308fd0e798ac0", + }, + { // not Transfer + Address: "0x479cc461fecd078f766ecc58533d6f69580cf3ac", + Topics: []string{ + "0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3", + "0x0000000000000000000000006f44cceb49b4a5812d54b6f494fc2febf25511ed", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x5af266c0a89a07c1917deaa024414577e6c3c31c8907d079e13eb448c082594f", + }, + Data: "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000", + }, + { // not Transfer + Address: "0x0d0f936ee4c93e25944694d6c121de94d9760f11", + Topics: []string{ + "0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3", + "0x0000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b", + "0xb0b69dad58df6032c3b266e19b1045b19c87acd2c06fb0c598090f44b8e263aa", + }, + Data: "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d000000000000000000000000c778417e063141139fce010982780140aa0cd5ab0000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f1100000000000000000000000000000000000000000000000000031855667df7a80000000000000000000000000000000000000000000000006a8313d60b1f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + }, + }, + want: bchain.TokenTransfers{ + { + Contract: "0x0d0f936ee4c93e25944694d6c121de94d9760f11", + From: "0x6f44cceb49b4a5812d54b6f494fc2febf25511ed", + To: "0x4bda106325c335df99eab7fe363cac8a0ba2a24d", + Value: *big.NewInt(0x6a8313d60b1f606b), + }, + { + Contract: "0xc778417e063141139fce010982780140aa0cd5ab", + From: "0x4bda106325c335df99eab7fe363cac8a0ba2a24d", + To: "0x6f44cceb49b4a5812d54b6f494fc2febf25511ed", + Value: *big.NewInt(0x308fd0e798ac0), + }, + }, + }, + { + name: "ERC721 transfer 1", + args: []*bchain.RpcLog{ + { // Approval + Address: "0x5689b918D34C038901870105A6C7fc24744D31eB", + Topics: []string{ + "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925", + "0x0000000000000000000000000a206d4d5ff79cb5069def7fe3598421cff09391", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000000000000000000000000000000000000000001396", + }, + Data: "0x", + }, + { // Transfer + Address: "0x5689b918D34C038901870105A6C7fc24744D31eB", + Topics: []string{ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000a206d4d5ff79cb5069def7fe3598421cff09391", + "0x0000000000000000000000006a016d7eec560549ffa0fbdb7f15c2b27302087f", + "0x0000000000000000000000000000000000000000000000000000000000001396", + }, + Data: "0x", + }, + { // OrdersMatched + Address: "0x7Be8076f4EA4A4AD08075C2508e481d6C946D12b", + Topics: []string{ + "0xc4109843e0b7d514e4c093114b863f8e7d8d9a458c372cd51bfe526b588006c9", + "0x0000000000000000000000000a206d4d5ff79cb5069def7fe3598421cff09391", + "0x0000000000000000000000006a016d7eec560549ffa0fbdb7f15c2b27302087f", + "0x0000000000000000000000000000000000000000000000000000000000000000", + }, + Data: "0x000000000000000000000000000000000000000000000000000000000000000069d3f0cc25f121f2aa96215f51ec4b4f1966f2d2ffbd3d8d8a45ad27b1c90323000000000000000000000000000000000000000000000000008e1bc9bf040000", + }, + }, + want: bchain.TokenTransfers{ + { + Standard: bchain.NonFungibleToken, + Contract: "0x5689b918D34C038901870105A6C7fc24744D31eB", + From: "0x0a206d4d5ff79cb5069def7fe3598421cff09391", + To: "0x6a016d7eec560549ffa0fbdb7f15c2b27302087f", + Value: *big.NewInt(0x1396), + }, + }, + }, + { + name: "ERC1155 TransferSingle", + args: []*bchain.RpcLog{ + { // Transfer + Address: "0x6Fd712E3A5B556654044608F9129040A4839E36c", + Topics: []string{ + "0x5f9832c7244497a64c11c4a4f7597934bdf02b0361c54ad8e90091c2ce1f9e3c", + }, + Data: "0x000000000000000000000000a3950b823cb063dd9afc0d27f35008b805b3ed530000000000000000000000004392faf3bb96b5694ecc6ef64726f61cdd4bb0ec000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001", + }, + { // TransferSingle + Address: "0x6Fd712E3A5B556654044608F9129040A4839E36c", + Topics: []string{ + "0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62", + "0x0000000000000000000000009248a6048a58db9f0212dc7cd85ee8741128be72", + "0x000000000000000000000000a3950b823cb063dd9afc0d27f35008b805b3ed53", + "0x0000000000000000000000004392faf3bb96b5694ecc6ef64726f61cdd4bb0ec", + }, + Data: "0x00000000000000000000000000000000000000000000000000000000000000960000000000000000000000000000000000000000000000000000000000000011", + }, + { // unknown + Address: "0x9248A6048a58db9f0212dC7CD85eE8741128be72", + Topics: []string{ + "0x0b7bef9468bee71526deef3cbbded0ec1a0aa3d5a3e81eaffb0e758552b33199", + }, + Data: "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000a3950b823cb063dd9afc0d27f35008b805b3ed530000000000000000000000004392faf3bb96b5694ecc6ef64726f61cdd4bb0ec0000000000000000000000000000000000000000000000000000000000000001", + }, + }, + want: bchain.TokenTransfers{ + { + Standard: bchain.MultiToken, + Contract: "0x6Fd712E3A5B556654044608F9129040A4839E36c", + From: "0xa3950b823cb063dd9afc0d27f35008b805b3ed53", + To: "0x4392faf3bb96b5694ecc6ef64726f61cdd4bb0ec", + MultiTokenValues: []bchain.MultiTokenValue{{Id: *big.NewInt(150), Value: *big.NewInt(0x11)}}, + }, + }, + }, + { + name: "ERC1155 TransferBatch", + args: []*bchain.RpcLog{ + { // TransferBatch + Address: "0x6c42C26a081c2F509F8bb68fb7Ac3062311cCfB7", + Topics: []string{ + "0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb", + "0x0000000000000000000000005dc6288b35e0807a3d6feb89b3a2ff4ab773168e", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x0000000000000000000000005dc6288b35e0807a3d6feb89b3a2ff4ab773168e", + }, + Data: "0x000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000006f0000000000000000000000000000000000000000000000000000000000000076a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a", + }, + }, + want: bchain.TokenTransfers{ + { + Standard: bchain.MultiToken, + Contract: "0x6c42c26a081c2f509f8bb68fb7ac3062311ccfb7", + From: "0x0000000000000000000000000000000000000000", + To: "0x5dc6288b35e0807a3d6feb89b3a2ff4ab773168e", + MultiTokenValues: []bchain.MultiTokenValue{ + {Id: *big.NewInt(1776), Value: *big.NewInt(1)}, + {Id: *big.NewInt(1898), Value: *big.NewInt(10)}, + }, + }, + }, + }} + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := contractGetTransfersFromLog(tt.args) + if (err != nil) != tt.wantErr { + t.Errorf("contractGetTransfersFromLog error = %v, wantErr %v", err, tt.wantErr) + return + } + if len(got) != len(tt.want) { + t.Errorf("contractGetTransfersFromLog len not same, %+v, want %+v", got, tt.want) + } + for i := range got { + // the addresses could have different case + if strings.ToLower(fmt.Sprint(got[i])) != strings.ToLower(fmt.Sprint(tt.want[i])) { + t.Errorf("contractGetTransfersFromLog %d = %+v, want %+v", i, got[i], tt.want[i]) + } + + } + }) + } +} + +func Test_contractGetTransfersFromTx(t *testing.T) { + p := NewEthereumParser(1, false) + b1 := dbtestdata.GetTestEthereumTypeBlock1(p) + b2 := dbtestdata.GetTestEthereumTypeBlock2(p) + bn, _ := new(big.Int).SetString("21e19e0c9bab2400000", 16) + tests := []struct { + name string + args *bchain.RpcTransaction + want bchain.TokenTransfers + }{ + { + name: "no contract transfer", + args: (b1.Txs[0].CoinSpecificData.(bchain.EthereumSpecificData)).Tx, + want: bchain.TokenTransfers{}, + }, + { + name: "ERC20 transfer", + args: (b1.Txs[1].CoinSpecificData.(bchain.EthereumSpecificData)).Tx, + want: bchain.TokenTransfers{ + { + Standard: bchain.FungibleToken, + Contract: "0x4af4114f73d1c1c903ac9e0361b379d1291808a2", + From: "0x20cd153de35d469ba46127a0c8f18626b59a256a", + To: "0x555ee11fbddc0e49a9bab358a8941ad95ffdb48f", + Value: *bn, + }, + }, + }, + { + name: "ERC721 transferFrom", + args: (b2.Txs[2].CoinSpecificData.(bchain.EthereumSpecificData)).Tx, + want: bchain.TokenTransfers{ + { + Standard: bchain.NonFungibleToken, + Contract: "0xcda9fc258358ecaa88845f19af595e908bb7efe9", + From: "0x837e3f699d85a4b0b99894567e9233dfb1dcb081", + To: "0x7b62eb7fe80350dc7ec945c0b73242cb9877fb1b", + Value: *big.NewInt(1), + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := contractGetTransfersFromTx(tt.args) + if err != nil { + t.Errorf("contractGetTransfersFromTx error = %v", err) + return + } + if len(got) != len(tt.want) { + t.Errorf("contractGetTransfersFromTx len not same, %+v, want %+v", got, tt.want) + } + for i := range got { + // the addresses could have different case + if strings.ToLower(fmt.Sprint(got[i])) != strings.ToLower(fmt.Sprint(tt.want[i])) { + t.Errorf("contractGetTransfersFromTx %d = %+v, want %+v", i, got[i], tt.want[i]) + } + + } + }) + } +} diff --git a/bchain/coins/eth/dataparser.go b/bchain/coins/eth/dataparser.go new file mode 100644 index 0000000000..1d06fdda80 --- /dev/null +++ b/bchain/coins/eth/dataparser.go @@ -0,0 +1,317 @@ +package eth + +import ( + "bytes" + "encoding/hex" + "math/big" + "runtime/debug" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/golang/glog" + "github.com/trezor/blockbook/bchain" +) + +func parseSimpleNumericProperty(data string) *big.Int { + if has0xPrefix(data) { + data = data[2:] + } + if len(data) > 64 { + data = data[:64] + } + if len(data) == 64 { + var n big.Int + _, ok := n.SetString(data, 16) + if ok { + return &n + } + } + return nil +} + +func parseSimpleStringProperty(data string) string { + if has0xPrefix(data) { + data = data[2:] + } + if len(data) > 128 { + n := parseSimpleNumericProperty(data[64:128]) + if n != nil { + l := n.Int64() + if l > 0 && int(l) <= ((len(data)-128)>>1) { + b, err := hex.DecodeString(data[128 : 128+2*l]) + if err == nil { + return string(b) + } + } + } + } + // allow string properties as UTF-8 data + b, err := hex.DecodeString(data) + if err == nil { + i := min(bytes.Index(b, []byte{0}), 32) + if i > 0 { + b = b[:i] + } + if utf8.Valid(b) { + return string(b) + } + } + return "" +} + +func decamel(s string) string { + var b bytes.Buffer + splittable := false + for i, v := range s { + if i == 0 { + b.WriteRune(unicode.ToUpper(v)) + } else { + if splittable && unicode.IsUpper(v) { + b.WriteByte(' ') + } + b.WriteRune(v) + // special handling of ETH to be able to convert "addETHToContract" to "Add ETH To Contract" + splittable = unicode.IsLower(v) || unicode.IsNumber(v) || (i >= 2 && s[i-2:i+1] == "ETH") + } + } + return b.String() +} + +func GetSignatureFromData(data string) uint32 { + if has0xPrefix(data) { + data = data[2:] + } + if len(data) < 8 { + return 0 + } + sig, err := strconv.ParseUint(data[:8], 16, 32) + if err != nil { + return 0 + } + return uint32(sig) +} + +const ErrorTy byte = 255 + +func processParam(data string, index int, dataOffset int, t *abi.Type, processed []bool) ([]string, int, bool) { + var retval []string + d := index << 6 + if d+64 > len(data) { + return nil, 0, false + } + block := data[d : d+64] + switch t.T { + // static types + case abi.IntTy, abi.UintTy, abi.BoolTy: + var n big.Int + _, ok := n.SetString(block, 16) + if !ok { + return nil, 0, false + } + if t.T == abi.BoolTy { + if n.Int64() != 0 { + retval = []string{"true"} + } else { + retval = []string{"false"} + } + } else { + retval = []string{n.String()} + } + processed[index] = true + index++ + case abi.AddressTy: + b, err := hex.DecodeString(block[24:]) + if err != nil { + return nil, 0, false + } + retval = []string{EIP55Address(b)} + processed[index] = true + index++ + case abi.FixedBytesTy: + retval = []string{"0x" + block[:t.Size<<1]} + processed[index] = true + index++ + case abi.ArrayTy: + for i := 0; i < t.Size; i++ { + var r []string + var ok bool + r, index, ok = processParam(data, index, dataOffset, t.Elem, processed) + if !ok { + return nil, 0, false + } + retval = append(retval, r...) + } + // dynamic types + case abi.StringTy, abi.BytesTy, abi.SliceTy: + // get offset of dynamic type + offset, err := strconv.ParseInt(block, 16, 64) + if err != nil { + return nil, 0, false + } + processed[index] = true + index++ + offset <<= 1 + d = int(offset) + dataOffset + dynIndex := d >> 6 + if d+64 > len(data) || d < 0 { + return nil, 0, false + } + // get element count of dynamic type + c, err := strconv.ParseInt(data[d:d+64], 16, 64) + if err != nil { + return nil, 0, false + } + count := int(c) + processed[dynIndex] = true + dynIndex++ + if t.T == abi.StringTy || t.T == abi.BytesTy { + d += 64 + de := d + (count << 1) + if de > len(data) || de < 0 { + return nil, 0, false + } + if count == 0 { + retval = []string{""} + } else { + block = data[d:de] + if t.T == abi.StringTy { + b, err := hex.DecodeString(block) + if err != nil { + return nil, 0, false + } + retval = []string{string(b)} + } else { + retval = []string{"0x" + block} + } + count = ((count - 1) >> 5) + 1 + for i := 0; i < count; i++ { + processed[dynIndex] = true + dynIndex++ + } + } + } else { + newOffset := dataOffset + dynIndex<<6 + for i := 0; i < count; i++ { + var r []string + var ok bool + r, dynIndex, ok = processParam(data, dynIndex, newOffset, t.Elem, processed) + if !ok { + return nil, 0, false + } + retval = append(retval, r...) + } + } + // types not processed + case abi.HashTy, abi.FixedPointTy, abi.FunctionTy, abi.TupleTy: + fallthrough + default: + return nil, 0, false + } + return retval, index, true +} + +func tryParseParams(data string, params []string, parsedParams []abi.Type) []bchain.EthereumParsedInputParam { + processed := make([]bool, len(data)/64) + parsed := make([]bchain.EthereumParsedInputParam, len(params)) + index := 0 + var values []string + var ok bool + for i := range params { + t := &parsedParams[i] + values, index, ok = processParam(data, index, 0, t, processed) + if !ok { + return nil + } + parsed[i] = bchain.EthereumParsedInputParam{Type: params[i], Values: values} + } + // all data must be processed, otherwise wrong signature + for _, p := range processed { + if !p { + return nil + } + } + return parsed +} + +// ParseInputData tries to parse transaction input data from known FourByteSignatures +// as there may be multiple signatures for the same four bytes, it tries to match the input to the known parameters +// it does not parse tuples for now +func ParseInputData(signatures *[]bchain.FourByteSignature, data string) *bchain.EthereumParsedInputData { + if len(data) <= 2 { // data is empty or 0x + return &bchain.EthereumParsedInputData{Name: "Transfer"} + } + if len(data) < 10 { + return nil + } + parsed := bchain.EthereumParsedInputData{ + MethodId: data[:10], + } + defer func() { + if r := recover(); r != nil { + glog.Error("ParseInputData recovered from panic: ", r, ", ", data, ",signatures ", signatures) + debug.PrintStack() + } + }() + if signatures != nil { + data = data[10:] + for i := range *signatures { + s := &(*signatures)[i] + // if not yet done, set DecamelName and Function and parse parameter types from string to abi.Type + // the signatures are stored in cache + if s.DecamelName == "" { + s.DecamelName = decamel(s.Name) + s.Function = s.Name + "(" + strings.Join(s.Parameters, ", ") + ")" + s.ParsedParameters = make([]abi.Type, len(s.Parameters)) + for j := range s.Parameters { + var t abi.Type + if len(s.Parameters[j]) > 0 && s.Parameters[j][0] == '(' { + // Tuple type is not supported for now + t = abi.Type{T: abi.TupleTy} + } else { + var err error + t, err = abi.NewType(s.Parameters[j], "", nil) + if err != nil { + t = abi.Type{T: ErrorTy} + } + } + s.ParsedParameters[j] = t + } + } + parsedParams := tryParseParams(data, s.Parameters, s.ParsedParameters) + if parsedParams != nil { + parsed.Name = s.DecamelName + parsed.Function = s.Function + parsed.Params = parsedParams + break + } + } + } + return &parsed +} + +// getEnsRecord processes transaction log entry and tries to parse ENS record from it +func getEnsRecord(l *rpcLogWithTxHash) *bchain.AddressAliasRecord { + if len(l.Topics) == 3 && l.Topics[0] == nameRegisteredEventSignature && len(l.Data) >= 322 { + address, err := addressFromPaddedHex(l.Topics[2]) + if err != nil { + return nil + } + c, err := strconv.ParseInt(l.Data[194:194+64], 16, 64) + if err != nil { + return nil + } + de := 194 + 64 + (int(c) << 1) + if de > len(l.Data) || de < 0 { + return nil + } + b, err := hex.DecodeString(l.Data[194+64 : de]) + if err != nil { + return nil + } + return &bchain.AddressAliasRecord{Address: address, Name: string(b)} + } + return nil +} diff --git a/bchain/coins/eth/dataparser_test.go b/bchain/coins/eth/dataparser_test.go new file mode 100644 index 0000000000..b13ecd167b --- /dev/null +++ b/bchain/coins/eth/dataparser_test.go @@ -0,0 +1,505 @@ +//go:build unittest + +package eth + +import ( + "reflect" + "testing" + + "github.com/trezor/blockbook/bchain" +) + +func Test_parseSimpleStringProperty(t *testing.T) { + tests := []struct { + name string + args string + want string + }{ + { + name: "1", + args: "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000758504c4f44444500000000000000000000000000000000000000000000000000", + want: "XPLODDE", + }, + { + name: "2", + args: "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000022426974436c617665202d20436f6e73756d657220416374697669747920546f6b656e00000000000000", + want: "BitClave - Consumer Activity Token", + }, + { + name: "short", + args: "0x44616920537461626c65636f696e2076312e3000000000000000000000000000", + want: "Dai Stablecoin v1.0", + }, + { + name: "short2", + args: "0x44616920537461626c65636f696e2076312e3020444444444444444444444444", + want: "Dai Stablecoin v1.0 DDDDDDDDDDDD", + }, + { + name: "long", + args: "0x556e6973776170205631000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + want: "Uniswap V1", + }, + { + name: "garbage", + args: "0x2234880850896048596206002535425366538144616734015984380565810000", + want: "", + }, + { + name: "garbage", + args: "6080604052600436106100225760003560e01c80630cbcae701461003957610031565b366100315761002f610077565b005b61002f610077565b34801561004557600080fd5b5061004e61014e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000061011c565b60043560601b60601c6bca11c0de15dead10cced00006000195460a01c036100e9577f696d706c6f63000000000000000000000000000000000000000000000000000060005260206000fd5b8060001955005b60405136810160405236600082376000803683600019545af43d6000833e80610117573d82fd5b503d81f35b80330361014357602436036101435763ca11c0de60003560e01c036101435761014361009d565b61014b6100f0565b50565b600073ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff541660005260206000f3fea2646970667358221220f27ad3f3b75609baa5d26d65ec1001c4a59f38e89088d6b47517c1cd1faf22ab64736f6c634300080d0033", + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := parseSimpleStringProperty(tt.args) + // the addresses could have different case + if got != tt.want { + t.Errorf("parseSimpleStringProperty = %v, want %v", got, tt.want) + } + }) + } +} + +func TestGetSignatureFromData(t *testing.T) { + tests := []struct { + name string + data string + want uint32 + }{ + { + name: "0x9e53a69a", + data: "0x9e53a69a000000000000000000000000000000000000000000000", + want: 2656282266, + }, + { + name: "9e53a69b", + data: "9e53a69b000000000000000000000000000000000000000000000", + want: 2656282267, + }, + { + name: "0x9e53 short", + data: "0x9e53", + want: 0, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := GetSignatureFromData(tt.data); got != tt.want { + t.Errorf("GetSignatureFromData() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestParseInputData(t *testing.T) { + signatures := []bchain.FourByteSignature{ + { + Name: "mintFighter", + Parameters: []string{}, + }, + { + Name: "cancelMultipleMakerOrders", + Parameters: []string{"uint256[]"}, + }, + { + Name: "mockRegisterFact", + Parameters: []string{"bytes32"}, + }, + { + Name: "vestingDeposits", + Parameters: []string{"address"}, + }, + { + Name: "addLiquidityETHToContract", + Parameters: []string{"address", "uint256", "uint256", "uint256", "address", "uint256"}, + }, + { + Name: "spread", + Parameters: []string{"uint256", "address[]"}, + }, + { + Name: "registerWithConfig", + Parameters: []string{"string", "address", "uint256", "bytes32", "address", "address"}, + }, + { + Name: "atomicMatch_", + Parameters: []string{"address[14]", "uint256[18]", "uint8[8]", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes", "uint8[2]", "bytes32[5]"}, + }, + { + Name: "transmitAndSellTokenForEth", + Parameters: []string{"address", "uint256", "uint256", "uint256", "address", "(uint8,bytes32,bytes32)", "bytes"}, + }, + { + Name: "execute", + Parameters: []string{"bytes", "bytes[]", "uint256"}, + }, + } + tests := []struct { + name string + signatures *[]bchain.FourByteSignature + data string + want *bchain.EthereumParsedInputData + wantErr bool + }{ + { + name: "transfer", + signatures: &signatures, + data: "", + want: &bchain.EthereumParsedInputData{ + Name: "Transfer", + }, + }, + { + name: "mintFighter", + signatures: &signatures, + data: "0xa19b9082", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xa19b9082", + Name: "Mint Fighter", + Function: "mintFighter()", + Params: []bchain.EthereumParsedInputParam{}, + }, + }, + { + name: "mockRegisterFact", + signatures: &signatures, + data: "0xf69507abdc8fa8fe57a22de66a1d5898496c524068cb04c31f72497b3ac9f3b449e58725", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xf69507ab", + Name: "Mock Register Fact", + Function: "mockRegisterFact(bytes32)", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "bytes32", + Values: []string{"0xdc8fa8fe57a22de66a1d5898496c524068cb04c31f72497b3ac9f3b449e58725"}, + }, + }, + }, + }, + { + name: "cancelMultipleMakerOrders", + signatures: &signatures, + data: "0x9e53a69a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000017f62f8db30", + want: &bchain.EthereumParsedInputData{ + MethodId: "0x9e53a69a", + Name: "Cancel Multiple Maker Orders", + Function: "cancelMultipleMakerOrders(uint256[])", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "uint256[]", + Values: []string{"1646632950576"}, + }, + }, + }, + }, + { + name: "addLiquidityETHToContract", + signatures: &signatures, + data: "0xf305d719000000000000000000000000b80e5aaa2131c07568128f68b8538ed3c8951234000000000000000000000000000000000000007e37be2022c0914b2680000000000000000000000000000000000000000000007e37be2022c0914b26800000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000009f64b014ca26f2def573246543dd1115b229e4f400000000000000000000000000000000000000000000000000000000623f56f8", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xf305d719", + Name: "Add Liquidity ETH To Contract", + Function: "addLiquidityETHToContract(address, uint256, uint256, uint256, address, uint256)", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "address", + Values: []string{"0xB80e5AaA2131c07568128f68b8538eD3C8951234"}, + }, + { + Type: "uint256", + Values: []string{"10000000000000000000000000000000"}, + }, + { + Type: "uint256", + Values: []string{"10000000000000000000000000000000"}, + }, + { + Type: "uint256", + Values: []string{"1000000000000000000"}, + }, + { + Type: "address", + Values: []string{"0x9f64B014CA26F2DeF573246543DD1115b229e4F4"}, + }, + { + Type: "uint256", + Values: []string{"1648318200"}, + }, + }, + }, + }, + { + name: "addLiquidityETHToContract data don't match - too long", + signatures: &signatures, + data: "0xf305d719000000000000000000000000b80e5aaa2131c07568128f68b8538ed3c8951234000000000000000000000000000000000000007e37be2022c0914b2680000000000000000000000000000000000000000000007e37be2022c0914b26800000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000009f64b014ca26f2def573246543dd1115b229e4f400000000000000000000000000000000000000000000000000000000623f56f800000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xf305d719", + }, + }, + { + name: "addLiquidityETHToContract data don't match - too short", + signatures: &signatures, + data: "0xf305d719000000000000000000000000b80e5aaa2131c07568128f68b8538ed3c8951234000000000000000000000000000000000000007e37be2022c0914b2680000000000000000000000000000000000000000000007e37be2022c0914b26800000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000009f64b014ca26f2def573246543dd1115b229e4f4", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xf305d719", + }, + }, + { + name: "spread", + signatures: &signatures, + data: "0xcd51b093000000000000000000000000000000000000000000000000016345785d8a00000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000048c999d9206fcf2a0ecde10049de6dc2d1704bb2000000000000000000000000d2dae6b2309ada5d4c983b4c7d2c942452adc759", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xcd51b093", + Name: "Spread", + Function: "spread(uint256, address[])", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "uint256", + Values: []string{"100000000000000000"}, + }, + { + Type: "address[]", + Values: []string{"0x48c999d9206fcf2A0ecdE10049de6Dc2d1704Bb2", "0xD2DAE6B2309aDa5d4c983B4c7D2c942452aDC759"}, + }, + }, + }, + }, + { + name: "atomicMatch_", // mainnet tx 0x57aff22b0f812e05467fb73caec8ac0364a535382496e5f64eb9df9fb32bd85f + signatures: &signatures, + data: "0xab834bab0000000000000000000000007f268357a8c2552623316e2562d90e642bb538e50000000000000000000000001676b0ab0aeb83122c58abc3d6a50b6c4a9d376300000000000000000000000024c57fbb5c260edf158583818177cfd5c2dec4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000baf2127b49fc93cbca6269fade0f7f31df4c88a7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007f268357a8c2552623316e2562d90e642bb538e500000000000000000000000024c57fbb5c260edf158583818177cfd5c2dec47000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005b3256965e7c3cf26e11fcaf296dfc8807c01073000000000000000000000000baf2127b49fc93cbca6269fade0f7f31df4c88a70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000062531f6400000000000000000000000000000000000000000000000000000000000000000227db897c05fe6409bc72c6bee932b99a92ca45e155cf85e763424e7a3ee61500000000000000000000000000000000000000000000000000000000000002ee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000625313f800000000000000000000000000000000000000000000000000000000627aa14b79166058af7dd96e2190730f926c56d6131af9d72b4dd2138b58c30e268c7f300000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000006a000000000000000000000000000000000000000000000000000000000000007c000000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b200000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001c77e6196859305642ea4751b9597a9507472acb04b9f1f4759aa0f27af41edd8960513f1649f58782cacce26b1341575b584594f940bba0614aff302d25b4b10477e6196859305642ea4751b9597a9507472acb04b9f1f4759aa0f27af41edd8960513f1649f58782cacce26b1341575b584594f940bba0614aff302d25b4b104000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4fb16a59500000000000000000000000000000000000000000000000000000000000000000000000000000000000000001676b0ab0aeb83122c58abc3d6a50b6c4a9d3763000000000000000000000000f25f4f4f6517101dc947d1c0370571ebdd25f14a00000000000000000000000000000000000000000000000000000000000002c7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4fb16a59500000000000000000000000024c57fbb5c260edf158583818177cfd5c2dec4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f25f4f4f6517101dc947d1c0370571ebdd25f14a00000000000000000000000000000000000000000000000000000000000002c7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e400000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e4000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xab834bab", + Name: "Atomic Match_", + Function: "atomicMatch_(address[14], uint256[18], uint8[8], bytes, bytes, bytes, bytes, bytes, bytes, uint8[2], bytes32[5])", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "address[14]", + Values: []string{ + "0x7f268357A8c2552623316e2562D90e642bB538E5", "0x1676b0AB0Aeb83122C58ABC3d6a50B6c4A9d3763", "0x24C57FBB5c260EDf158583818177Cfd5C2dec470", "0x0000000000000000000000000000000000000000", + "0xBAf2127B49fC93CbcA6269FAdE0F7F31dF4c88a7", "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000", "0x7f268357A8c2552623316e2562D90e642bB538E5", + "0x24C57FBB5c260EDf158583818177Cfd5C2dec470", "0x0000000000000000000000000000000000000000", "0x5b3256965e7C3cF26E11FCAf296DfC8807C01073", "0xBAf2127B49fC93CbcA6269FAdE0F7F31dF4c88a7", + "0x0000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000"}, + }, + { + Type: "uint256[18]", + Values: []string{ + "750", "0", "0", "0", "10000000000000000", "0", "1649614692", "0", "975047921716720136517384107537725863826800092678142650456874303300963329557", + "750", "0", "0", "0", "10000000000000000", "0", "1649611768", "1652203851", "54769390272606378508076535204478407261307419838517394120712398796227861053232"}, + }, + { + Type: "uint8[8]", + Values: []string{"1", "0", "0", "1", "1", "1", "0", "1"}, + }, + { + Type: "bytes", + Values: []string{"0xfb16a59500000000000000000000000000000000000000000000000000000000000000000000000000000000000000001676b0ab0aeb83122c58abc3d6a50b6c4a9d3763000000000000000000000000f25f4f4f6517101dc947d1c0370571ebdd25f14a00000000000000000000000000000000000000000000000000000000000002c7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000"}, + }, + { + Type: "bytes", + Values: []string{"0xfb16a59500000000000000000000000024c57fbb5c260edf158583818177cfd5c2dec4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f25f4f4f6517101dc947d1c0370571ebdd25f14a00000000000000000000000000000000000000000000000000000000000002c7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000"}, + }, + { + Type: "bytes", + Values: []string{"0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, + }, + { + Type: "bytes", + Values: []string{"0x000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"}, + }, + { + Type: "bytes", + Values: []string{""}, + }, + { + Type: "bytes", + Values: []string{""}, + }, + { + Type: "uint8[2]", + Values: []string{"28", "28"}, + }, + { + Type: "bytes32[5]", + Values: []string{"0x77e6196859305642ea4751b9597a9507472acb04b9f1f4759aa0f27af41edd89", "0x60513f1649f58782cacce26b1341575b584594f940bba0614aff302d25b4b104", + "0x77e6196859305642ea4751b9597a9507472acb04b9f1f4759aa0f27af41edd89", "0x60513f1649f58782cacce26b1341575b584594f940bba0614aff302d25b4b104", + "0x0000000000000000000000000000000000000000000000000000000000000000"}, + }, + }, + }, + }, + { + name: "registerWithConfig", + signatures: &signatures, + data: "0xf7a1696300000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000769cbf44073741ccb4c39c945402130b46fa8a70000000000000000000000000000000000000000000000000000000012cf35707a8c22626793047f41a428e815e2bb12ced6d5db4246a8b0bda488c541647bef0000000000000000000000004976fb03c32e5b8cfe2b6ccb31c09ba78ebaba410000000000000000000000000769cbf44073741ccb4c39c945402130b46fa8a700000000000000000000000000000000000000000000000000000000000000076d6f6e7369746100000000000000000000000000000000000000000000000000", + want: &bchain.EthereumParsedInputData{ + MethodId: "0xf7a16963", + Name: "Register With Config", + Function: "registerWithConfig(string, address, uint256, bytes32, address, address)", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "string", + Values: []string{"monsita"}, + }, + { + Type: "address", + Values: []string{"0x0769cBf44073741cCb4C39c945402130B46fa8A7"}, + }, + { + Type: "uint256", + Values: []string{"315569520"}, + }, + { + Type: "bytes32", + Values: []string{"0x7a8c22626793047f41a428e815e2bb12ced6d5db4246a8b0bda488c541647bef"}, + }, + { + Type: "address", + Values: []string{"0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"}, + }, + { + Type: "address", + Values: []string{"0x0769cBf44073741cCb4C39c945402130B46fa8A7"}, + }, + }, + }, + }, + { + name: "execute", + signatures: &signatures, + data: "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000063fd167b00000000000000000000000000000000000000000000000000000000000000010800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000021e19e0c9bab2400000000000000000000000000000000000000000000000000000000000002fa5e9a300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003000000000000000000000000cda4e840411c00a614ad9205caec807c7458a0e3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + want: &bchain.EthereumParsedInputData{ + MethodId: "0x3593564c", + Name: "Execute", + Function: "execute(bytes, bytes[], uint256)", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "bytes", + Values: []string{"0x08"}, + }, + { + Type: "bytes[]", + Values: []string{"0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000021e19e0c9bab2400000000000000000000000000000000000000000000000000000000000002fa5e9a300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003000000000000000000000000cda4e840411c00a614ad9205caec807c7458a0e3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"}, + }, + { + Type: "uint256", + Values: []string{"1677530747"}, + }, + }, + }, + }, + { + name: "execute2", + signatures: &signatures, + data: "0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000063ffd82300000000000000000000000000000000000000000000000000000000000000020b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000006f05b59d3b200000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000491478480c282e75df8b5700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000f0f9d895aca5c8678f706fb8216fa22957685a13", + want: &bchain.EthereumParsedInputData{ + MethodId: "0x3593564c", + Name: "Execute", + Function: "execute(bytes, bytes[], uint256)", + Params: []bchain.EthereumParsedInputParam{ + { + Type: "bytes", + Values: []string{"0x0b08"}, + }, + { + Type: "bytes[]", + Values: []string{ + "0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000006f05b59d3b20000", + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000491478480c282e75df8b5700000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000f0f9d895aca5c8678f706fb8216fa22957685a13", + }, + }, + { + Type: "uint256", + Values: []string{"1677711395"}, + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := ParseInputData(tt.signatures, tt.data) + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("ParseInputData() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_getEnsRecord(t *testing.T) { + tests := []struct { + name string + log rpcLogWithTxHash + want *bchain.AddressAliasRecord + }{ + { + name: "unraveled", + log: rpcLogWithTxHash{ + RpcLog: bchain.RpcLog{ + Address: "0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5", + Topics: []string{ + "0xca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f", + "0x40ce2aa8cd9ee9fef4bf3a68abab7fbcceb6bac89370518caf6a602cefe836bd", + "0x0000000000000000000000002c630b16aa53ae0189880e15c23323688acb607c", + }, + Data: "0x00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000017629245f5a86f0000000000000000000000000000000000000000000000000000000069dbb21d0000000000000000000000000000000000000000000000000000000000000009756e726176656c65640000000000000000000000000000000000000000000000", + }, + }, + want: &bchain.AddressAliasRecord{Address: "0x2C630b16Aa53ae0189880e15C23323688acb607c", Name: "unraveled"}, + }, + { + name: "4x unraveled", + log: rpcLogWithTxHash{ + RpcLog: bchain.RpcLog{ + Address: "0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5", + Topics: []string{ + "0xca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f", + "0x40ce2aa8cd9ee9fef4bf3a68abab7fbcceb6bac89370518caf6a602cefe836bd", + "0x0000000000000000000000002c630b16aa53ae0189880e15c23323688acb607c", + }, + Data: "0x00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000017629245f5a86f0000000000000000000000000000000000000000000000000000000069dbb21d0000000000000000000000000000000000000000000000000000000000000024756e726176656c6564756e726176656c6564756e726176656c6564756e726176656c656400000000000000000000000000000000000000000000000000000000", + }, + }, + want: &bchain.AddressAliasRecord{Address: "0x2C630b16Aa53ae0189880e15C23323688acb607c", Name: "unraveledunraveledunraveledunraveled"}, + }, + { + name: "no signature", + log: rpcLogWithTxHash{ + RpcLog: bchain.RpcLog{ + Address: "0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5", + Topics: []string{ + "0xca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404e", + "0x40ce2aa8cd9ee9fef4bf3a68abab7fbcceb6bac89370518caf6a602cefe836bd", + "0x0000000000000000000000002c630b16aa53ae0189880e15c23323688acb607c", + }, + Data: "0x00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000017629245f5a86f0000000000000000000000000000000000000000000000000000000069dbb21d0000000000000000000000000000000000000000000000000000000000000009756e726176656c65640000000000000000000000000000000000000000000000", + }, + }, + want: nil, + }, + { + name: "name length does not match", + log: rpcLogWithTxHash{ + RpcLog: bchain.RpcLog{ + Address: "0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5", + Topics: []string{ + "0xca6abbe9d7f11422cb6ca7629fbf6fe9efb1c621f71ce8f02b9f2a230097404f", + "0x40ce2aa8cd9ee9fef4bf3a68abab7fbcceb6bac89370518caf6a602cefe836bd", + "0x0000000000000000000000002c630b16aa53ae0189880e15c23323688acb607c", + }, + Data: "0x00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000017629245f5a86f0000000000000000000000000000000000000000000000000000000069dbb21d0000000000000000000000000000000000000000000000000000000000000ff9756e726176656c65640000000000000000000000000000000000000000000000", + }, + }, + want: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := getEnsRecord(&tt.log); !reflect.DeepEqual(got, tt.want) { + t.Errorf("getEnsRecord() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/bchain/coins/eth/erc20.go b/bchain/coins/eth/erc20.go deleted file mode 100644 index d660511a70..0000000000 --- a/bchain/coins/eth/erc20.go +++ /dev/null @@ -1,245 +0,0 @@ -package eth - -import ( - "bytes" - "context" - "encoding/hex" - "math/big" - "strings" - "sync" - "unicode/utf8" - - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/golang/glog" - "github.com/juju/errors" - "github.com/trezor/blockbook/bchain" -) - -var erc20abi = `[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","signature":"0x06fdde03"}, -{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","signature":"0x95d89b41"}, -{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"type":"function","signature":"0x313ce567"}, -{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function","signature":"0x18160ddd"}, -{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function","signature":"0x70a08231"}, -{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function","signature":"0xa9059cbb"}, -{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function","signature":"0x23b872dd"}, -{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function","signature":"0x095ea7b3"}, -{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function","signature":"0xdd62ed3e"}, -{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Transfer","type":"event","signature":"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"}, -{"anonymous":false,"inputs":[{"indexed":true,"name":"_owner","type":"address"},{"indexed":true,"name":"_spender","type":"address"},{"indexed":false,"name":"_value","type":"uint256"}],"name":"Approval","type":"event","signature":"0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"}, -{"inputs":[{"name":"_initialAmount","type":"uint256"},{"name":"_tokenName","type":"string"},{"name":"_decimalUnits","type":"uint8"},{"name":"_tokenSymbol","type":"string"}],"payable":false,"type":"constructor"}, -{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function","signature":"0xcae9ca51"}, -{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function","signature":"0x54fd4d50"}]` - -// doing the parsing/processing without using go-ethereum/accounts/abi library, it is simple to get data from Transfer event -const erc20TransferMethodSignature = "0xa9059cbb" -const erc20TransferEventSignature = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" -const erc20NameSignature = "0x06fdde03" -const erc20SymbolSignature = "0x95d89b41" -const erc20DecimalsSignature = "0x313ce567" -const erc20BalanceOf = "0x70a08231" - -var cachedContracts = make(map[string]*bchain.Erc20Contract) -var cachedContractsMux sync.Mutex - -func addressFromPaddedHex(s string) (string, error) { - var t big.Int - var ok bool - if has0xPrefix(s) { - _, ok = t.SetString(s[2:], 16) - } else { - _, ok = t.SetString(s, 16) - } - if !ok { - return "", errors.New("Data is not a number") - } - a := ethcommon.BigToAddress(&t) - return a.String(), nil -} - -func erc20GetTransfersFromLog(logs []*rpcLog) ([]bchain.Erc20Transfer, error) { - var r []bchain.Erc20Transfer - for _, l := range logs { - if len(l.Topics) == 3 && l.Topics[0] == erc20TransferEventSignature { - var t big.Int - _, ok := t.SetString(l.Data, 0) - if !ok { - return nil, errors.New("Data is not a number") - } - from, err := addressFromPaddedHex(l.Topics[1]) - if err != nil { - return nil, err - } - to, err := addressFromPaddedHex(l.Topics[2]) - if err != nil { - return nil, err - } - r = append(r, bchain.Erc20Transfer{ - Contract: EIP55AddressFromAddress(l.Address), - From: EIP55AddressFromAddress(from), - To: EIP55AddressFromAddress(to), - Tokens: t, - }) - } - } - return r, nil -} - -func erc20GetTransfersFromTx(tx *rpcTransaction) ([]bchain.Erc20Transfer, error) { - var r []bchain.Erc20Transfer - if len(tx.Payload) == 128+len(erc20TransferMethodSignature) && strings.HasPrefix(tx.Payload, erc20TransferMethodSignature) { - to, err := addressFromPaddedHex(tx.Payload[len(erc20TransferMethodSignature) : 64+len(erc20TransferMethodSignature)]) - if err != nil { - return nil, err - } - var t big.Int - _, ok := t.SetString(tx.Payload[len(erc20TransferMethodSignature)+64:], 16) - if !ok { - return nil, errors.New("Data is not a number") - } - r = append(r, bchain.Erc20Transfer{ - Contract: EIP55AddressFromAddress(tx.To), - From: EIP55AddressFromAddress(tx.From), - To: EIP55AddressFromAddress(to), - Tokens: t, - }) - } - return r, nil -} - -func (b *EthereumRPC) ethCall(data, to string) (string, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) - defer cancel() - var r string - err := b.rpc.CallContext(ctx, &r, "eth_call", map[string]interface{}{ - "data": data, - "to": to, - }, "latest") - if err != nil { - return "", err - } - return r, nil -} - -func parseErc20NumericProperty(contractDesc bchain.AddressDescriptor, data string) *big.Int { - if has0xPrefix(data) { - data = data[2:] - } - if len(data) > 64 { - data = data[:64] - } - if len(data) == 64 { - var n big.Int - _, ok := n.SetString(data, 16) - if ok { - return &n - } - } - if glog.V(1) { - glog.Warning("Cannot parse '", data, "' for contract ", contractDesc) - } - return nil -} - -func parseErc20StringProperty(contractDesc bchain.AddressDescriptor, data string) string { - if has0xPrefix(data) { - data = data[2:] - } - if len(data) > 128 { - n := parseErc20NumericProperty(contractDesc, data[64:128]) - if n != nil { - l := n.Uint64() - if l > 0 && 2*int(l) <= len(data)-128 { - b, err := hex.DecodeString(data[128 : 128+2*l]) - if err == nil { - return string(b) - } - } - } - } - // allow string properties as UTF-8 data - b, err := hex.DecodeString(data) - if err == nil { - i := bytes.Index(b, []byte{0}) - if i > 32 { - i = 32 - } - if i > 0 { - b = b[:i] - } - if utf8.Valid(b) { - return string(b) - } - } - if glog.V(1) { - glog.Warning("Cannot parse '", data, "' for contract ", contractDesc) - } - return "" -} - -// EthereumTypeGetErc20ContractInfo returns information about ERC20 contract -func (b *EthereumRPC) EthereumTypeGetErc20ContractInfo(contractDesc bchain.AddressDescriptor) (*bchain.Erc20Contract, error) { - cds := string(contractDesc) - cachedContractsMux.Lock() - contract, found := cachedContracts[cds] - cachedContractsMux.Unlock() - if !found { - address := EIP55Address(contractDesc) - data, err := b.ethCall(erc20NameSignature, address) - if err != nil { - // ignore the error from the eth_call - since geth v1.9.15 they changed the behavior - // and returning error "execution reverted" for some non contract addresses - // https://github.com/ethereum/go-ethereum/issues/21249#issuecomment-648647672 - glog.Warning(errors.Annotatef(err, "erc20NameSignature %v", address)) - return nil, nil - // return nil, errors.Annotatef(err, "erc20NameSignature %v", address) - } - name := parseErc20StringProperty(contractDesc, data) - if name != "" { - data, err = b.ethCall(erc20SymbolSignature, address) - if err != nil { - glog.Warning(errors.Annotatef(err, "erc20SymbolSignature %v", address)) - return nil, nil - // return nil, errors.Annotatef(err, "erc20SymbolSignature %v", address) - } - symbol := parseErc20StringProperty(contractDesc, data) - data, err = b.ethCall(erc20DecimalsSignature, address) - if err != nil { - glog.Warning(errors.Annotatef(err, "erc20DecimalsSignature %v", address)) - // return nil, errors.Annotatef(err, "erc20DecimalsSignature %v", address) - } - contract = &bchain.Erc20Contract{ - Contract: address, - Name: name, - Symbol: symbol, - } - d := parseErc20NumericProperty(contractDesc, data) - if d != nil { - contract.Decimals = int(uint8(d.Uint64())) - } else { - contract.Decimals = EtherAmountDecimalPoint - } - } else { - contract = nil - } - cachedContractsMux.Lock() - cachedContracts[cds] = contract - cachedContractsMux.Unlock() - } - return contract, nil -} - -// EthereumTypeGetErc20ContractBalance returns balance of ERC20 contract for given address -func (b *EthereumRPC) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc bchain.AddressDescriptor) (*big.Int, error) { - addr := EIP55Address(addrDesc) - contract := EIP55Address(contractDesc) - req := erc20BalanceOf + "0000000000000000000000000000000000000000000000000000000000000000"[len(addr)-2:] + addr[2:] - data, err := b.ethCall(req, contract) - if err != nil { - return nil, err - } - r := parseErc20NumericProperty(contractDesc, data) - if r == nil { - return nil, errors.New("Invalid balance") - } - return r, nil -} diff --git a/bchain/coins/eth/erc20_test.go b/bchain/coins/eth/erc20_test.go deleted file mode 100644 index f0a584f969..0000000000 --- a/bchain/coins/eth/erc20_test.go +++ /dev/null @@ -1,204 +0,0 @@ -//go:build unittest - -package eth - -import ( - "fmt" - "math/big" - "strings" - "testing" - - "github.com/trezor/blockbook/bchain" - "github.com/trezor/blockbook/tests/dbtestdata" -) - -func TestErc20_erc20GetTransfersFromLog(t *testing.T) { - tests := []struct { - name string - args []*rpcLog - want []bchain.Erc20Transfer - wantErr bool - }{ - { - name: "1", - args: []*rpcLog{ - { - Address: "0x76a45e8976499ab9ae223cc584019341d5a84e96", - Topics: []string{ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x0000000000000000000000002aacf811ac1a60081ea39f7783c0d26c500871a8", - "0x000000000000000000000000e9a5216ff992cfa01594d43501a56e12769eb9d2", - }, - Data: "0x0000000000000000000000000000000000000000000000000000000000000123", - }, - }, - want: []bchain.Erc20Transfer{ - { - Contract: "0x76a45e8976499ab9ae223cc584019341d5a84e96", - From: "0x2aacf811ac1a60081ea39f7783c0d26c500871a8", - To: "0xe9a5216ff992cfa01594d43501a56e12769eb9d2", - Tokens: *big.NewInt(0x123), - }, - }, - }, - { - name: "2", - args: []*rpcLog{ - { // Transfer - Address: "0x0d0f936ee4c93e25944694d6c121de94d9760f11", - Topics: []string{ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x0000000000000000000000006f44cceb49b4a5812d54b6f494fc2febf25511ed", - "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d", - }, - Data: "0x0000000000000000000000000000000000000000000000006a8313d60b1f606b", - }, - { // Transfer - Address: "0xc778417e063141139fce010982780140aa0cd5ab", - Topics: []string{ - "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", - "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d", - "0x0000000000000000000000006f44cceb49b4a5812d54b6f494fc2febf25511ed", - }, - Data: "0x000000000000000000000000000000000000000000000000000308fd0e798ac0", - }, - { // not Transfer - Address: "0x479cc461fecd078f766ecc58533d6f69580cf3ac", - Topics: []string{ - "0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3", - "0x0000000000000000000000006f44cceb49b4a5812d54b6f494fc2febf25511ed", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x5af266c0a89a07c1917deaa024414577e6c3c31c8907d079e13eb448c082594f", - }, - Data: "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000", - }, - { // not Transfer - Address: "0x0d0f936ee4c93e25944694d6c121de94d9760f11", - Topics: []string{ - "0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3", - "0x0000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b", - "0xb0b69dad58df6032c3b266e19b1045b19c87acd2c06fb0c598090f44b8e263aa", - }, - Data: "0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d000000000000000000000000c778417e063141139fce010982780140aa0cd5ab0000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f1100000000000000000000000000000000000000000000000000031855667df7a80000000000000000000000000000000000000000000000006a8313d60b1f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - }, - }, - want: []bchain.Erc20Transfer{ - { - Contract: "0x0d0f936ee4c93e25944694d6c121de94d9760f11", - From: "0x6f44cceb49b4a5812d54b6f494fc2febf25511ed", - To: "0x4bda106325c335df99eab7fe363cac8a0ba2a24d", - Tokens: *big.NewInt(0x6a8313d60b1f606b), - }, - { - Contract: "0xc778417e063141139fce010982780140aa0cd5ab", - From: "0x4bda106325c335df99eab7fe363cac8a0ba2a24d", - To: "0x6f44cceb49b4a5812d54b6f494fc2febf25511ed", - Tokens: *big.NewInt(0x308fd0e798ac0), - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := erc20GetTransfersFromLog(tt.args) - if (err != nil) != tt.wantErr { - t.Errorf("erc20GetTransfersFromLog error = %v, wantErr %v", err, tt.wantErr) - return - } - // the addresses could have different case - if strings.ToLower(fmt.Sprint(got)) != strings.ToLower(fmt.Sprint(tt.want)) { - t.Errorf("erc20GetTransfersFromLog = %+v, want %+v", got, tt.want) - } - }) - } -} - -func TestErc20_parseErc20StringProperty(t *testing.T) { - tests := []struct { - name string - args string - want string - }{ - { - name: "1", - args: "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000758504c4f44444500000000000000000000000000000000000000000000000000", - want: "XPLODDE", - }, - { - name: "2", - args: "0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000022426974436c617665202d20436f6e73756d657220416374697669747920546f6b656e00000000000000", - want: "BitClave - Consumer Activity Token", - }, - { - name: "short", - args: "0x44616920537461626c65636f696e2076312e3000000000000000000000000000", - want: "Dai Stablecoin v1.0", - }, - { - name: "short2", - args: "0x44616920537461626c65636f696e2076312e3020444444444444444444444444", - want: "Dai Stablecoin v1.0 DDDDDDDDDDDD", - }, - { - name: "long", - args: "0x556e6973776170205631000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - want: "Uniswap V1", - }, - { - name: "garbage", - args: "0x2234880850896048596206002535425366538144616734015984380565810000", - want: "", - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got := parseErc20StringProperty(nil, tt.args) - // the addresses could have different case - if got != tt.want { - t.Errorf("parseErc20StringProperty = %v, want %v", got, tt.want) - } - }) - } -} - -func TestErc20_erc20GetTransfersFromTx(t *testing.T) { - p := NewEthereumParser(1) - b := dbtestdata.GetTestEthereumTypeBlock1(p) - bn, _ := new(big.Int).SetString("21e19e0c9bab2400000", 16) - tests := []struct { - name string - args *rpcTransaction - want []bchain.Erc20Transfer - }{ - { - name: "0", - args: (b.Txs[0].CoinSpecificData.(completeTransaction)).Tx, - want: []bchain.Erc20Transfer{}, - }, - { - name: "1", - args: (b.Txs[1].CoinSpecificData.(completeTransaction)).Tx, - want: []bchain.Erc20Transfer{ - { - Contract: "0x4af4114f73d1c1c903ac9e0361b379d1291808a2", - From: "0x20cd153de35d469ba46127a0c8f18626b59a256a", - To: "0x555ee11fbddc0e49a9bab358a8941ad95ffdb48f", - Tokens: *bn, - }, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := erc20GetTransfersFromTx(tt.args) - if err != nil { - t.Errorf("erc20GetTransfersFromTx error = %v", err) - return - } - // the addresses could have different case - if strings.ToLower(fmt.Sprint(got)) != strings.ToLower(fmt.Sprint(tt.want)) { - t.Errorf("erc20GetTransfersFromTx = %+v, want %+v", got, tt.want) - } - }) - } -} diff --git a/bchain/coins/eth/ethparser.go b/bchain/coins/eth/ethparser.go index 884b6e64e4..e3d310cc73 100644 --- a/bchain/coins/eth/ethparser.go +++ b/bchain/coins/eth/ethparser.go @@ -4,31 +4,40 @@ import ( "encoding/hex" "math/big" "strconv" + "strings" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/golang/protobuf/proto" "github.com/juju/errors" "github.com/trezor/blockbook/bchain" "golang.org/x/crypto/sha3" + "google.golang.org/protobuf/proto" ) -// EthereumTypeAddressDescriptorLen - in case of EthereumType, the AddressDescriptor has fixed length +// EthereumTypeAddressDescriptorLen - the AddressDescriptor of EthereumType has fixed length const EthereumTypeAddressDescriptorLen = 20 +// EthereumTypeTxidLen - the length of Txid +const EthereumTypeTxidLen = 32 + // EtherAmountDecimalPoint defines number of decimal points in Ether amounts const EtherAmountDecimalPoint = 18 // EthereumParser handle type EthereumParser struct { *bchain.BaseParser + EnsSuffix string } // NewEthereumParser returns new EthereumParser instance -func NewEthereumParser(b int) *EthereumParser { - return &EthereumParser{&bchain.BaseParser{ - BlockAddressesToKeep: b, - AmountDecimalPoint: EtherAmountDecimalPoint, - }} +func NewEthereumParser(b int, addressAliases bool) *EthereumParser { + return &EthereumParser{ + BaseParser: &bchain.BaseParser{ + BlockAddressesToKeep: b, + AmountDecimalPoint: EtherAmountDecimalPoint, + AddressAliases: addressAliases, + }, + EnsSuffix: ".eth", + } } type rpcHeader struct { @@ -41,48 +50,13 @@ type rpcHeader struct { Nonce string `json:"nonce"` } -type rpcTransaction struct { - AccountNonce string `json:"nonce"` - GasPrice string `json:"gasPrice"` - GasLimit string `json:"gas"` - To string `json:"to"` // nil means contract creation - Value string `json:"value"` - Payload string `json:"input"` - Hash string `json:"hash"` - BlockNumber string `json:"blockNumber"` - BlockHash string `json:"blockHash,omitempty"` - From string `json:"from"` - TransactionIndex string `json:"transactionIndex"` - // Signature values - ignored - // V string `json:"v"` - // R string `json:"r"` - // S string `json:"s"` -} - -type rpcLog struct { - Address string `json:"address"` - Topics []string `json:"topics"` - Data string `json:"data"` -} - type rpcLogWithTxHash struct { - rpcLog + bchain.RpcLog Hash string `json:"transactionHash"` } -type rpcReceipt struct { - GasUsed string `json:"gasUsed"` - Status string `json:"status"` - Logs []*rpcLog `json:"logs"` -} - -type completeTransaction struct { - Tx *rpcTransaction `json:"tx"` - Receipt *rpcReceipt `json:"receipt,omitempty"` -} - type rpcBlockTransactions struct { - Transactions []rpcTransaction `json:"transactions"` + Transactions []bchain.RpcTransaction `json:"transactions"` } type rpcBlockTxids struct { @@ -96,7 +70,7 @@ func ethNumber(n string) (int64, error) { return 0, errors.Errorf("Not a number: '%v'", n) } -func (p *EthereumParser) ethTxToTx(tx *rpcTransaction, receipt *rpcReceipt, blocktime int64, confirmations uint32, fixEIP55 bool) (*bchain.Tx, error) { +func (p *EthereumParser) ethTxToTx(tx *bchain.RpcTransaction, receipt *bchain.RpcReceipt, internalData *bchain.EthereumInternalData, blocktime int64, confirmations uint32, fixEIP55 bool) (*bchain.Tx, error) { txid := tx.Hash var ( fa, ta []string @@ -121,9 +95,24 @@ func (p *EthereumParser) ethTxToTx(tx *rpcTransaction, receipt *rpcReceipt, bloc } } } - ct := completeTransaction{ - Tx: tx, - Receipt: receipt, + if internalData != nil { + // ignore empty internal data + if internalData.Type == bchain.CALL && len(internalData.Transfers) == 0 && len(internalData.Error) == 0 { + internalData = nil + } else { + if fixEIP55 { + for i := range internalData.Transfers { + it := &internalData.Transfers[i] + it.From = EIP55AddressFromAddress(it.From) + it.To = EIP55AddressFromAddress(it.To) + } + } + } + } + ct := bchain.EthereumSpecificData{ + Tx: tx, + InternalData: internalData, + Receipt: receipt, } vs, err := hexutil.DecodeBig(tx.Value) if err != nil { @@ -254,10 +243,11 @@ func hexEncodeBig(b []byte) string { } // PackTx packs transaction to byte array +// completeTransaction.InternalData are not packed, they are stored in a different table func (p *EthereumParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error) { var err error var n uint64 - r, ok := tx.CoinSpecificData.(completeTransaction) + r, ok := tx.CoinSpecificData.(bchain.EthereumSpecificData) if !ok { return nil, errors.New("Missing CoinSpecificData") } @@ -287,6 +277,21 @@ func (p *EthereumParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ( if pt.Tx.GasPrice, err = hexDecodeBig(r.Tx.GasPrice); err != nil { return nil, errors.Annotatef(err, "Price %v", r.Tx.GasPrice) } + if len(r.Tx.MaxPriorityFeePerGas) > 0 { + if pt.Tx.MaxPriorityFeePerGas, err = hexDecodeBig(r.Tx.MaxPriorityFeePerGas); err != nil { + return nil, errors.Annotatef(err, "MaxPriorityFeePerGas %v", r.Tx.MaxPriorityFeePerGas) + } + } + if len(r.Tx.MaxFeePerGas) > 0 { + if pt.Tx.MaxFeePerGas, err = hexDecodeBig(r.Tx.MaxFeePerGas); err != nil { + return nil, errors.Annotatef(err, "MaxFeePerGas %v", r.Tx.MaxFeePerGas) + } + } + if len(r.Tx.BaseFeePerGas) > 0 { + if pt.Tx.BaseFeePerGas, err = hexDecodeBig(r.Tx.BaseFeePerGas); err != nil { + return nil, errors.Annotatef(err, "BaseFeePerGas %v", r.Tx.BaseFeePerGas) + } + } // if pt.R, err = hexDecodeBig(r.R); err != nil { // return nil, errors.Annotatef(err, "R %v", r.R) // } @@ -345,6 +350,24 @@ func (p *EthereumParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ( } pt.Receipt.Log = ptLogs + if r.Receipt.L1Fee != "" { + if pt.Receipt.L1Fee, err = hexDecodeBig(r.Receipt.L1Fee); err != nil { + return nil, errors.Annotatef(err, "L1Fee %v", r.Receipt.L1Fee) + } + } + if r.Receipt.L1FeeScalar != "" { + pt.Receipt.L1FeeScalar = []byte(r.Receipt.L1FeeScalar) + } + if r.Receipt.L1GasPrice != "" { + if pt.Receipt.L1GasPrice, err = hexDecodeBig(r.Receipt.L1GasPrice); err != nil { + return nil, errors.Annotatef(err, "L1GasPrice %v", r.Receipt.L1GasPrice) + } + } + if r.Receipt.L1GasUsed != "" { + if pt.Receipt.L1GasUsed, err = hexDecodeBig(r.Receipt.L1GasUsed); err != nil { + return nil, errors.Annotatef(err, "L1GasUsed %v", r.Receipt.L1GasUsed) + } + } } return proto.Marshal(pt) } @@ -356,7 +379,7 @@ func (p *EthereumParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error) { if err != nil { return nil, 0, err } - rt := rpcTransaction{ + rt := bchain.RpcTransaction{ AccountNonce: hexutil.EncodeUint64(pt.Tx.AccountNonce), BlockNumber: hexutil.EncodeUint64(uint64(pt.BlockNumber)), From: EIP55Address(pt.Tx.From), @@ -371,32 +394,52 @@ func (p *EthereumParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error) { TransactionIndex: hexutil.EncodeUint64(uint64(pt.Tx.TransactionIndex)), Value: hexEncodeBig(pt.Tx.Value), } - var rr *rpcReceipt + if len(pt.Tx.MaxPriorityFeePerGas) > 0 { + rt.MaxPriorityFeePerGas = hexEncodeBig(pt.Tx.MaxPriorityFeePerGas) + } + if len(pt.Tx.MaxFeePerGas) > 0 { + rt.MaxFeePerGas = hexEncodeBig(pt.Tx.MaxFeePerGas) + } + if len(pt.Tx.BaseFeePerGas) > 0 { + rt.BaseFeePerGas = hexEncodeBig(pt.Tx.BaseFeePerGas) + } + var rr *bchain.RpcReceipt if pt.Receipt != nil { - logs := make([]*rpcLog, len(pt.Receipt.Log)) + rr = &bchain.RpcReceipt{ + GasUsed: hexEncodeBig(pt.Receipt.GasUsed), + Status: "", + Logs: make([]*bchain.RpcLog, len(pt.Receipt.Log)), + } for i, l := range pt.Receipt.Log { topics := make([]string, len(l.Topics)) for j, t := range l.Topics { topics[j] = hexutil.Encode(t) } - logs[i] = &rpcLog{ + rr.Logs[i] = &bchain.RpcLog{ Address: EIP55Address(l.Address), Data: hexutil.Encode(l.Data), Topics: topics, } } - status := "" // handle a special value []byte{'U'} as unknown state if len(pt.Receipt.Status) != 1 || pt.Receipt.Status[0] != 'U' { - status = hexEncodeBig(pt.Receipt.Status) + rr.Status = hexEncodeBig(pt.Receipt.Status) } - rr = &rpcReceipt{ - GasUsed: hexEncodeBig(pt.Receipt.GasUsed), - Status: status, - Logs: logs, + if len(pt.Receipt.L1Fee) > 0 { + rr.L1Fee = hexEncodeBig(pt.Receipt.L1Fee) + } + if len(pt.Receipt.L1FeeScalar) > 0 { + rr.L1FeeScalar = string(pt.Receipt.L1FeeScalar) + } + if len(pt.Receipt.L1GasPrice) > 0 { + rr.L1GasPrice = hexEncodeBig(pt.Receipt.L1GasPrice) + } + if len(pt.Receipt.L1GasUsed) > 0 { + rr.L1GasUsed = hexEncodeBig(pt.Receipt.L1GasUsed) } } - tx, err := p.ethTxToTx(&rt, rr, int64(pt.BlockTime), 0, false) + // TODO handle internal transactions + tx, err := p.ethTxToTx(&rt, rr, nil, int64(pt.BlockTime), 0, false) if err != nil { return nil, 0, err } @@ -405,7 +448,7 @@ func (p *EthereumParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error) { // PackedTxidLen returns length in bytes of packed txid func (p *EthereumParser) PackedTxidLen() int { - return 32 + return EthereumTypeTxidLen } // PackTxid packs txid to byte array @@ -442,7 +485,7 @@ func (p *EthereumParser) GetChainType() bchain.ChainType { // GetHeightFromTx returns ethereum specific data from bchain.Tx func GetHeightFromTx(tx *bchain.Tx) (uint32, error) { var bn string - csd, ok := tx.CoinSpecificData.(completeTransaction) + csd, ok := tx.CoinSpecificData.(bchain.EthereumSpecificData) if !ok { return 0, errors.New("Missing CoinSpecificData") } @@ -454,16 +497,16 @@ func GetHeightFromTx(tx *bchain.Tx) (uint32, error) { return uint32(n), nil } -// EthereumTypeGetErc20FromTx returns Erc20 data from bchain.Tx -func (p *EthereumParser) EthereumTypeGetErc20FromTx(tx *bchain.Tx) ([]bchain.Erc20Transfer, error) { - var r []bchain.Erc20Transfer +// EthereumTypeGetTokenTransfersFromTx returns contract transfers from bchain.Tx +func (p *EthereumParser) EthereumTypeGetTokenTransfersFromTx(tx *bchain.Tx) (bchain.TokenTransfers, error) { + var r bchain.TokenTransfers var err error - csd, ok := tx.CoinSpecificData.(completeTransaction) + csd, ok := tx.CoinSpecificData.(bchain.EthereumSpecificData) if ok { if csd.Receipt != nil { - r, err = erc20GetTransfersFromLog(csd.Receipt.Logs) + r, err = contractGetTransfersFromLog(csd.Receipt.Logs) } else { - r, err = erc20GetTransfersFromTx(csd.Tx) + r, err = contractGetTransfersFromTx(csd.Tx) } if err != nil { return nil, err @@ -472,6 +515,11 @@ func (p *EthereumParser) EthereumTypeGetErc20FromTx(tx *bchain.Tx) ([]bchain.Erc return r, nil } +// FormatAddressAlias adds .eth to a name alias +func (p *EthereumParser) FormatAddressAlias(address string, name string) string { + return name + p.EnsSuffix +} + // TxStatus is status of transaction type TxStatus int @@ -485,12 +533,19 @@ const ( // EthereumTxData contains ethereum specific transaction data type EthereumTxData struct { - Status TxStatus `json:"status"` // 1 OK, 0 Fail, -1 pending, -2 unknown - Nonce uint64 `json:"nonce"` - GasLimit *big.Int `json:"gaslimit"` - GasUsed *big.Int `json:"gasused"` - GasPrice *big.Int `json:"gasprice"` - Data string `json:"data"` + Status TxStatus `json:"status"` // 1 OK, 0 Fail, -1 pending, -2 unknown + Nonce uint64 `json:"nonce"` + GasLimit *big.Int `json:"gaslimit"` + GasUsed *big.Int `json:"gasused"` + GasPrice *big.Int `json:"gasprice"` + MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas,omitempty"` + MaxFeePerGas *big.Int `json:"maxFeePerGas,omitempty"` + BaseFeePerGas *big.Int `json:"baseFeePerGas,omitempty"` + L1Fee *big.Int `json:"l1Fee,omitempty"` + L1FeeScalar string `json:"l1FeeScalar,omitempty"` + L1GasPrice *big.Int `json:"l1GasPrice,omitempty"` + L1GasUsed *big.Int `json:"L1GasUsed,omitempty"` + Data string `json:"data"` } // GetEthereumTxData returns EthereumTxData from bchain.Tx @@ -501,12 +556,15 @@ func GetEthereumTxData(tx *bchain.Tx) *EthereumTxData { // GetEthereumTxDataFromSpecificData returns EthereumTxData from coinSpecificData func GetEthereumTxDataFromSpecificData(coinSpecificData interface{}) *EthereumTxData { etd := EthereumTxData{Status: TxStatusPending} - csd, ok := coinSpecificData.(completeTransaction) + csd, ok := coinSpecificData.(bchain.EthereumSpecificData) if ok { if csd.Tx != nil { etd.Nonce, _ = hexutil.DecodeUint64(csd.Tx.AccountNonce) etd.GasLimit, _ = hexutil.DecodeBig(csd.Tx.GasLimit) etd.GasPrice, _ = hexutil.DecodeBig(csd.Tx.GasPrice) + etd.MaxPriorityFeePerGas, _ = hexutil.DecodeBig(csd.Tx.MaxPriorityFeePerGas) + etd.MaxFeePerGas, _ = hexutil.DecodeBig(csd.Tx.MaxFeePerGas) + etd.BaseFeePerGas, _ = hexutil.DecodeBig(csd.Tx.BaseFeePerGas) etd.Data = csd.Tx.Payload } if csd.Receipt != nil { @@ -519,7 +577,53 @@ func GetEthereumTxDataFromSpecificData(coinSpecificData interface{}) *EthereumTx etd.Status = TxStatusFailure } etd.GasUsed, _ = hexutil.DecodeBig(csd.Receipt.GasUsed) + etd.L1Fee, _ = hexutil.DecodeBig(csd.Receipt.L1Fee) + etd.L1GasPrice, _ = hexutil.DecodeBig(csd.Receipt.L1GasPrice) + etd.L1GasUsed, _ = hexutil.DecodeBig(csd.Receipt.L1GasUsed) + etd.L1FeeScalar = csd.Receipt.L1FeeScalar } } return &etd } + +const errorOutputSignature = "08c379a0" + +// ParseErrorFromOutput takes output field from internal transaction data and extracts an error message from it +// the output must have errorOutputSignature to be parsed +func ParseErrorFromOutput(output string) string { + if has0xPrefix(output) { + output = output[2:] + } + if len(output) < 8+64+64+64 || output[:8] != errorOutputSignature { + return "" + } + return parseSimpleStringProperty(output[8:]) +} + +// PackInternalTransactionError packs common error messages to single byte to save DB space +func PackInternalTransactionError(e string) string { + if e == "execution reverted" { + return "\x01" + } + if e == "out of gas" { + return "\x02" + } + if e == "contract creation code storage out of gas" { + return "\x03" + } + if e == "max code size exceeded" { + return "\x04" + } + + return e +} + +// UnpackInternalTransactionError unpacks common error messages packed by PackInternalTransactionError +func UnpackInternalTransactionError(data []byte) string { + e := string(data) + e = strings.ReplaceAll(e, "\x01", "Reverted. ") + e = strings.ReplaceAll(e, "\x02", "Out of gas. ") + e = strings.ReplaceAll(e, "\x03", "Contract creation code storage out of gas. ") + e = strings.ReplaceAll(e, "\x04", "Max code size exceeded. ") + return strings.TrimSpace(e) +} diff --git a/bchain/coins/eth/ethparser_test.go b/bchain/coins/eth/ethparser_test.go index a9e29703ea..65b46c7d1a 100644 --- a/bchain/coins/eth/ethparser_test.go +++ b/bchain/coins/eth/ethparser_test.go @@ -54,7 +54,7 @@ func TestEthParser_GetAddrDescFromAddress(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - p := NewEthereumParser(1) + p := NewEthereumParser(1, false) got, err := p.GetAddrDescFromAddress(tt.args.address) if (err != nil) != tt.wantErr { t.Errorf("EthParser.GetAddrDescFromAddress() error = %v, wantErr %v", err, tt.wantErr) @@ -89,23 +89,26 @@ func init() { }, }, }, - CoinSpecificData: completeTransaction{ - Tx: &rpcTransaction{ - AccountNonce: "0xb26c", - GasPrice: "0x430e23400", - GasLimit: "0x5208", - To: "0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f", - Value: "0x1bc0159d530e6000", - Payload: "0x", - Hash: "0xcd647151552b5132b2aef7c9be00dc6f73afc5901dde157aab131335baaa853b", - BlockNumber: "0x41eee8", - From: "0x3E3a3D69dc66bA10737F531ed088954a9EC89d97", - TransactionIndex: "0xa", + CoinSpecificData: bchain.EthereumSpecificData{ + Tx: &bchain.RpcTransaction{ + AccountNonce: "0xb26c", + GasPrice: "0x430e23400", + MaxPriorityFeePerGas: "0x430e23401", + MaxFeePerGas: "0x430e23402", + BaseFeePerGas: "0x430e23403", + GasLimit: "0x5208", + To: "0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f", + Value: "0x1bc0159d530e6000", + Payload: "0x", + Hash: "0xcd647151552b5132b2aef7c9be00dc6f73afc5901dde157aab131335baaa853b", + BlockNumber: "0x41eee8", + From: "0x3E3a3D69dc66bA10737F531ed088954a9EC89d97", + TransactionIndex: "0xa", }, - Receipt: &rpcReceipt{ + Receipt: &bchain.RpcReceipt{ GasUsed: "0x5208", Status: "0x1", - Logs: []*rpcLog{}, + Logs: []*bchain.RpcLog{}, }, }, } @@ -127,22 +130,25 @@ func init() { }, }, }, - CoinSpecificData: completeTransaction{ - Tx: &rpcTransaction{ - AccountNonce: "0xd0", - GasPrice: "0x9502f9000", - GasLimit: "0x130d5", - To: "0x4af4114F73d1c1C903aC9E0361b379D1291808A2", - Value: "0x0", - Payload: "0xa9059cbb000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f00000000000000000000000000000000000000000000021e19e0c9bab2400000", - Hash: "0xa9cd088aba2131000da6f38a33c20169baee476218deea6b78720700b895b101", - BlockNumber: "0x41eee8", - From: "0x20cD153de35D469BA46127A0C8F18626b59a256A", - TransactionIndex: "0x0"}, - Receipt: &rpcReceipt{ + CoinSpecificData: bchain.EthereumSpecificData{ + Tx: &bchain.RpcTransaction{ + AccountNonce: "0xd0", + GasPrice: "0x9502f9000", + MaxPriorityFeePerGas: "0x9502f9001", + MaxFeePerGas: "0x9502f9002", + BaseFeePerGas: "0x9502f9003", + GasLimit: "0x130d5", + To: "0x4af4114F73d1c1C903aC9E0361b379D1291808A2", + Value: "0x0", + Payload: "0xa9059cbb000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f00000000000000000000000000000000000000000000021e19e0c9bab2400000", + Hash: "0xa9cd088aba2131000da6f38a33c20169baee476218deea6b78720700b895b101", + BlockNumber: "0x41eee8", + From: "0x20cD153de35D469BA46127A0C8F18626b59a256A", + TransactionIndex: "0x0"}, + Receipt: &bchain.RpcReceipt{ GasUsed: "0xcb39", Status: "0x1", - Logs: []*rpcLog{ + Logs: []*bchain.RpcLog{ { Address: "0x4af4114F73d1c1C903aC9E0361b379D1291808A2", Data: "0x00000000000000000000000000000000000000000000021e19e0c9bab2400000", @@ -174,8 +180,8 @@ func init() { }, }, }, - CoinSpecificData: completeTransaction{ - Tx: &rpcTransaction{ + CoinSpecificData: bchain.EthereumSpecificData{ + Tx: &bchain.RpcTransaction{ AccountNonce: "0xb26c", GasPrice: "0x430e23400", GasLimit: "0x5208", @@ -187,10 +193,10 @@ func init() { From: "0x3E3a3D69dc66bA10737F531ed088954a9EC89d97", TransactionIndex: "0xa", }, - Receipt: &rpcReceipt{ + Receipt: &bchain.RpcReceipt{ GasUsed: "0x5208", Status: "0x0", - Logs: []*rpcLog{}, + Logs: []*bchain.RpcLog{}, }, }, } @@ -212,8 +218,8 @@ func init() { }, }, }, - CoinSpecificData: completeTransaction{ - Tx: &rpcTransaction{ + CoinSpecificData: bchain.EthereumSpecificData{ + Tx: &bchain.RpcTransaction{ AccountNonce: "0xb26c", GasPrice: "0x430e23400", GasLimit: "0x5208", @@ -225,10 +231,10 @@ func init() { From: "0x3E3a3D69dc66bA10737F531ed088954a9EC89d97", TransactionIndex: "0xa", }, - Receipt: &rpcReceipt{ + Receipt: &bchain.RpcReceipt{ GasUsed: "0x5208", Status: "", - Logs: []*rpcLog{}, + Logs: []*bchain.RpcLog{}, }, }, } @@ -285,7 +291,7 @@ func TestEthereumParser_PackTx(t *testing.T) { want: dbtestdata.EthTx1NoStatusPacked, }, } - p := NewEthereumParser(1) + p := NewEthereumParser(1, false) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := p.PackTx(tt.args.tx, tt.args.height, tt.args.blockTime) @@ -338,7 +344,7 @@ func TestEthereumParser_UnpackTx(t *testing.T) { want1: 4321000, }, } - p := NewEthereumParser(1) + p := NewEthereumParser(1, false) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { b, err := hex.DecodeString(tt.args.hex) @@ -351,8 +357,8 @@ func TestEthereumParser_UnpackTx(t *testing.T) { return } // DeepEqual has problems with pointers in completeTransaction - gs := got.CoinSpecificData.(completeTransaction) - ws := tt.want.CoinSpecificData.(completeTransaction) + gs := got.CoinSpecificData.(bchain.EthereumSpecificData) + ws := tt.want.CoinSpecificData.(bchain.EthereumSpecificData) gc := *got wc := *tt.want gc.CoinSpecificData = nil @@ -400,3 +406,97 @@ func TestEthereumParser_GetEthereumTxData(t *testing.T) { }) } } + +func TestEthereumParser_ParseErrorFromOutput(t *testing.T) { + tests := []struct { + name string + output string + want string + }{ + { + name: "ParseErrorFromOutput 1", + output: "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000031546f74616c206e756d626572206f662067726f757073206d7573742062652067726561746572207468616e207a65726f2e000000000000000000000000000000", + want: "Total number of groups must be greater than zero.", + }, + { + name: "ParseErrorFromOutput 2", + output: "0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000126e6f7420656e6f7567682062616c616e63650000000000000000000000000000", + want: "not enough balance", + }, + { + name: "ParseErrorFromOutput empty", + output: "", + want: "", + }, + { + name: "ParseErrorFromOutput short", + output: "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000012", + want: "", + }, + { + name: "ParseErrorFromOutput invalid signature", + output: "0x08c379b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000126e6f7420656e6f7567682062616c616e63650000000000000000000000000000", + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := ParseErrorFromOutput(tt.output) + if got != tt.want { + t.Errorf("EthereumParser.ParseErrorFromOutput() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestEthereumParser_PackInternalTransactionError_UnpackInternalTransactionError(t *testing.T) { + tests := []struct { + name string + original string + packed string + unpacked string + }{ + { + name: "execution reverted", + original: "execution reverted", + packed: "\x01", + unpacked: "Reverted.", + }, + { + name: "out of gas", + original: "out of gas", + packed: "\x02", + unpacked: "Out of gas.", + }, + { + name: "contract creation code storage out of gas", + original: "contract creation code storage out of gas", + packed: "\x03", + unpacked: "Contract creation code storage out of gas.", + }, + { + name: "max code size exceeded", + original: "max code size exceeded", + packed: "\x04", + unpacked: "Max code size exceeded.", + }, + { + name: "unknown error", + original: "unknown error", + packed: "unknown error", + unpacked: "unknown error", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + packed := PackInternalTransactionError(tt.original) + if packed != tt.packed { + t.Errorf("EthereumParser.PackInternalTransactionError() = %v, want %v", packed, tt.packed) + } + unpacked := UnpackInternalTransactionError([]byte(packed)) + if unpacked != tt.unpacked { + t.Errorf("EthereumParser.UnpackInternalTransactionError() = %v, want %v", unpacked, tt.unpacked) + } + }) + } +} diff --git a/bchain/coins/eth/ethrpc.go b/bchain/coins/eth/ethrpc.go index 551c650cd0..c054f41526 100644 --- a/bchain/coins/eth/ethrpc.go +++ b/bchain/coins/eth/ethrpc.go @@ -4,15 +4,18 @@ import ( "context" "encoding/json" "fmt" + "io" "math/big" + "net/http" "strconv" + "strings" "sync" "time" - ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" "github.com/golang/glog" @@ -21,48 +24,70 @@ import ( "github.com/trezor/blockbook/common" ) -// EthereumNet type specifies the type of ethereum network -type EthereumNet uint32 +// Network type specifies the type of ethereum network +type Network uint32 const ( // MainNet is production network - MainNet EthereumNet = 1 - // TestNet is Ropsten test network - TestNet EthereumNet = 3 - // TestNetGoerli is Goerli test network - TestNetGoerli EthereumNet = 5 + MainNet Network = 1 + // TestNetSepolia is Sepolia test network + TestNetSepolia Network = 11155111 + // TestNetHolesky is Holesky test network + TestNetHolesky Network = 17000 + // TestNetHoodi is Hoodi test network + TestNetHoodi Network = 560048 ) // Configuration represents json config file type Configuration struct { - CoinName string `json:"coin_name"` - CoinShortcut string `json:"coin_shortcut"` - RPCURL string `json:"rpc_url"` - RPCTimeout int `json:"rpc_timeout"` - BlockAddressesToKeep int `json:"block_addresses_to_keep"` - MempoolTxTimeoutHours int `json:"mempoolTxTimeoutHours"` - QueryBackendOnMempoolResync bool `json:"queryBackendOnMempoolResync"` + CoinName string `json:"coin_name"` + CoinShortcut string `json:"coin_shortcut"` + Network string `json:"network"` + RPCURL string `json:"rpc_url"` + RPCTimeout int `json:"rpc_timeout"` + BlockAddressesToKeep int `json:"block_addresses_to_keep"` + AddressAliases bool `json:"address_aliases,omitempty"` + MempoolTxTimeoutHours int `json:"mempoolTxTimeoutHours"` + QueryBackendOnMempoolResync bool `json:"queryBackendOnMempoolResync"` + ProcessInternalTransactions bool `json:"processInternalTransactions"` + ProcessZeroInternalTransactions bool `json:"processZeroInternalTransactions"` + ConsensusNodeVersionURL string `json:"consensusNodeVersion"` + DisableMempoolSync bool `json:"disableMempoolSync,omitempty"` + Eip1559Fees bool `json:"eip1559Fees,omitempty"` + AlternativeEstimateFee string `json:"alternative_estimate_fee,omitempty"` + AlternativeEstimateFeeParams string `json:"alternative_estimate_fee_params,omitempty"` } // EthereumRPC is an interface to JSON-RPC eth service. type EthereumRPC struct { *bchain.BaseChain - client *ethclient.Client - rpc *rpc.Client - timeout time.Duration - Parser *EthereumParser - Mempool *bchain.MempoolEthereumType - mempoolInitialized bool - bestHeaderLock sync.Mutex - bestHeader *ethtypes.Header - bestHeaderTime time.Time - chanNewBlock chan *ethtypes.Header - newBlockSubscription *rpc.ClientSubscription - chanNewTx chan ethcommon.Hash - newTxSubscription *rpc.ClientSubscription - ChainConfig *Configuration + Client bchain.EVMClient + RPC bchain.EVMRPCClient + MainNetChainID Network + Timeout time.Duration + Parser *EthereumParser + PushHandler func(bchain.NotificationType) + OpenRPC func(string) (bchain.EVMRPCClient, bchain.EVMClient, error) + Mempool *bchain.MempoolEthereumType + mempoolInitialized bool + bestHeaderLock sync.Mutex + bestHeader bchain.EVMHeader + bestHeaderTime time.Time + NewBlock bchain.EVMNewBlockSubscriber + newBlockSubscription bchain.EVMClientSubscription + NewTx bchain.EVMNewTxSubscriber + newTxSubscription bchain.EVMClientSubscription + ChainConfig *Configuration + supportedStakingPools []string + stakingPoolNames []string + stakingPoolContracts []string + alternativeFeeProvider alternativeFeeProviderInterface + alternativeSendTxProvider *AlternativeSendTxProvider } +// ProcessInternalTransactions specifies if internal transactions are processed +var ProcessInternalTransactions bool + // NewEthereumRPC returns new EthRPC instance. func NewEthereumRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { var err error @@ -76,108 +101,108 @@ func NewEthereumRPC(config json.RawMessage, pushHandler func(bchain.Notification c.BlockAddressesToKeep = 100 } - rc, ec, err := openRPC(c.RPCURL) - if err != nil { - return nil, err - } - s := &EthereumRPC{ BaseChain: &bchain.BaseChain{}, - client: ec, - rpc: rc, ChainConfig: &c, } - // always create parser - s.Parser = NewEthereumParser(c.BlockAddressesToKeep) - s.timeout = time.Duration(c.RPCTimeout) * time.Second - - // new blocks notifications handling - // the subscription is done in Initialize - s.chanNewBlock = make(chan *ethtypes.Header) - go func() { - for { - h, ok := <-s.chanNewBlock - if !ok { - break - } - glog.V(2).Info("rpc: new block header ", h.Number) - // update best header to the new header - s.bestHeaderLock.Lock() - s.bestHeader = h - s.bestHeaderTime = time.Now() - s.bestHeaderLock.Unlock() - // notify blockbook - pushHandler(bchain.NotificationNewBlock) - } - }() + ProcessInternalTransactions = c.ProcessInternalTransactions - // new mempool transaction notifications handling - // the subscription is done in Initialize - s.chanNewTx = make(chan ethcommon.Hash) - go func() { - for { - t, ok := <-s.chanNewTx - if !ok { - break - } - hex := t.Hex() - if glog.V(2) { - glog.Info("rpc: new tx ", hex) - } - s.Mempool.AddTransactionToMempool(hex) - pushHandler(bchain.NotificationNewTx) - } - }() + // always create parser + s.Parser = NewEthereumParser(c.BlockAddressesToKeep, c.AddressAliases) + s.Timeout = time.Duration(c.RPCTimeout) * time.Second + s.PushHandler = pushHandler return s, nil } -func openRPC(url string) (*rpc.Client, *ethclient.Client, error) { - rc, err := rpc.Dial(url) +// OpenRPC opens RPC connection to ETH backend +var OpenRPC = func(url string) (bchain.EVMRPCClient, bchain.EVMClient, error) { + opts := []rpc.ClientOption{} + opts = append(opts, rpc.WithWebsocketMessageSizeLimit(0)) + r, err := rpc.DialOptions(context.Background(), url, opts...) if err != nil { return nil, nil, err } - ec := ethclient.NewClient(rc) + rc := &EthereumRPCClient{Client: r} + ec := &EthereumClient{Client: ethclient.NewClient(r)} return rc, ec, nil } // Initialize initializes ethereum rpc interface func (b *EthereumRPC) Initialize() error { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + b.OpenRPC = OpenRPC + + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + // set chain specific + b.Client = ec + b.RPC = rc + b.MainNetChainID = MainNet + b.NewBlock = &EthereumNewBlock{channel: make(chan *types.Header)} + b.NewTx = &EthereumNewTx{channel: make(chan ethcommon.Hash)} + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - id, err := b.client.NetworkID(ctx) + id, err := b.Client.NetworkID(ctx) if err != nil { return err } // parameters for getInfo request - switch EthereumNet(id.Uint64()) { + switch Network(id.Uint64()) { case MainNet: b.Testnet = false b.Network = "livenet" - break - case TestNet: + case TestNetSepolia: + b.Testnet = true + b.Network = "sepolia" + case TestNetHolesky: b.Testnet = true - b.Network = "testnet" - break - case TestNetGoerli: + b.Network = "holesky" + case TestNetHoodi: b.Testnet = true - b.Network = "goerli" + b.Network = "hoodi" default: return errors.Errorf("Unknown network id %v", id) } + + err = b.initStakingPools() + if err != nil { + return err + } + + b.InitAlternativeProviders() + glog.Info("rpc: block chain ", b.Network) return nil } +// InitAlternativeProviders initializes alternative providers +func (b *EthereumRPC) InitAlternativeProviders() { + b.initAlternativeFeeProvider() + + network := b.ChainConfig.Network + if network == "" { + network = b.ChainConfig.CoinShortcut + } + b.alternativeSendTxProvider = NewAlternativeSendTxProvider(network, b.ChainConfig.RPCTimeout, b.ChainConfig.MempoolTxTimeoutHours) +} + // CreateMempool creates mempool if not already created, however does not initialize it func (b *EthereumRPC) CreateMempool(chain bchain.BlockChain) (bchain.Mempool, error) { if b.Mempool == nil { b.Mempool = bchain.NewMempoolEthereumType(chain, b.ChainConfig.MempoolTxTimeoutHours, b.ChainConfig.QueryBackendOnMempoolResync) - glog.Info("mempool created, MempoolTxTimeoutHours=", b.ChainConfig.MempoolTxTimeoutHours, ", QueryBackendOnMempoolResync=", b.ChainConfig.QueryBackendOnMempoolResync) + glog.Info("mempool created, MempoolTxTimeoutHours=", b.ChainConfig.MempoolTxTimeoutHours, ", QueryBackendOnMempoolResync=", b.ChainConfig.QueryBackendOnMempoolResync, ", DisableMempoolSync=", b.ChainConfig.DisableMempoolSync) + if b.alternativeSendTxProvider != nil { + b.alternativeSendTxProvider.SetupMempool(b.Mempool, b.removeTransactionFromMempool) + } + } return b.Mempool, nil } @@ -188,11 +213,19 @@ func (b *EthereumRPC) InitializeMempool(addrDescForOutpoint bchain.AddrDescForOu return errors.New("Mempool not created") } + var err error + var txs []string // get initial mempool transactions - txs, err := b.GetMempoolTransactions() - if err != nil { - return err + // workaround for an occasional `decoding block` error from getBlockRaw - try 3 times with a delay and then proceed + for i := 0; i < 3; i++ { + txs, err = b.GetMempoolTransactions() + if err == nil { + break + } + glog.Error("GetMempoolTransaction ", err) + time.Sleep(time.Second * 5) } + for _, txid := range txs { b.Mempool.AddTransactionToMempool(txid) } @@ -210,13 +243,26 @@ func (b *EthereumRPC) InitializeMempool(addrDescForOutpoint bchain.AddrDescForOu } func (b *EthereumRPC) subscribeEvents() error { - // subscriptions - if err := b.subscribe(func() (*rpc.ClientSubscription, error) { + // new block notifications handling + go func() { + for { + h, ok := b.NewBlock.Read() + if !ok { + break + } + b.UpdateBestHeader(h) + // notify blockbook + b.PushHandler(bchain.NotificationNewBlock) + } + }() + + // new block subscription + if err := b.subscribe(func() (bchain.EVMClientSubscription, error) { // invalidate the previous subscription - it is either the first one or there was an error b.newBlockSubscription = nil - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - sub, err := b.rpc.EthSubscribe(ctx, b.chanNewBlock, "newHeads") + sub, err := b.RPC.EthSubscribe(ctx, b.NewBlock.Channel(), "newHeads") if err != nil { return nil, errors.Annotatef(err, "EthSubscribe newHeads") } @@ -227,27 +273,48 @@ func (b *EthereumRPC) subscribeEvents() error { return err } - if err := b.subscribe(func() (*rpc.ClientSubscription, error) { - // invalidate the previous subscription - it is either the first one or there was an error - b.newTxSubscription = nil - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) - defer cancel() - sub, err := b.rpc.EthSubscribe(ctx, b.chanNewTx, "newPendingTransactions") - if err != nil { - return nil, errors.Annotatef(err, "EthSubscribe newPendingTransactions") + // new mempool transaction notifications handling + go func() { + for { + t, ok := b.NewTx.Read() + if !ok { + break + } + hex := t.Hex() + if glog.V(2) { + glog.Info("rpc: new tx ", hex) + } + added := b.Mempool.AddTransactionToMempool(hex) + if added { + b.PushHandler(bchain.NotificationNewTx) + } + } + }() + + if !b.ChainConfig.DisableMempoolSync { + // new mempool transaction subscription + if err := b.subscribe(func() (bchain.EVMClientSubscription, error) { + // invalidate the previous subscription - it is either the first one or there was an error + b.newTxSubscription = nil + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + sub, err := b.RPC.EthSubscribe(ctx, b.NewTx.Channel(), "newPendingTransactions") + if err != nil { + return nil, errors.Annotatef(err, "EthSubscribe newPendingTransactions") + } + b.newTxSubscription = sub + glog.Info("Subscribed to newPendingTransactions") + return sub, nil + }); err != nil { + return err } - b.newTxSubscription = sub - glog.Info("Subscribed to newPendingTransactions") - return sub, nil - }); err != nil { - return err } return nil } // subscribe subscribes notification and tries to resubscribe in case of error -func (b *EthereumRPC) subscribe(f func() (*rpc.ClientSubscription, error)) error { +func (b *EthereumRPC) subscribe(f func() (bchain.EVMClientSubscription, error)) error { s, err := f() if err != nil { return err @@ -286,6 +353,27 @@ func (b *EthereumRPC) subscribe(f func() (*rpc.ClientSubscription, error)) error return nil } +func (b *EthereumRPC) initAlternativeFeeProvider() { + var err error + if b.ChainConfig.AlternativeEstimateFee == "1inch" { + if b.alternativeFeeProvider, err = NewOneInchFeesProvider(b, b.ChainConfig.AlternativeEstimateFeeParams); err != nil { + glog.Error("New1InchFeesProvider error ", err, " Reverting to default estimateFee functionality") + // disable AlternativeEstimateFee logic + b.alternativeFeeProvider = nil + } + } else if b.ChainConfig.AlternativeEstimateFee == "infura" { + if b.alternativeFeeProvider, err = NewInfuraFeesProvider(b, b.ChainConfig.AlternativeEstimateFeeParams); err != nil { + glog.Error("NewInfuraFeesProvider error ", err, " Reverting to default estimateFee functionality") + // disable AlternativeEstimateFee logic + b.alternativeFeeProvider = nil + } + } + if b.alternativeFeeProvider != nil { + glog.Info("Using alternative fee provider ", b.ChainConfig.AlternativeEstimateFee) + } + +} + func (b *EthereumRPC) closeRPC() { if b.newBlockSubscription != nil { b.newBlockSubscription.Unsubscribe() @@ -293,27 +381,28 @@ func (b *EthereumRPC) closeRPC() { if b.newTxSubscription != nil { b.newTxSubscription.Unsubscribe() } - if b.rpc != nil { - b.rpc.Close() + if b.RPC != nil { + b.RPC.Close() } } func (b *EthereumRPC) reconnectRPC() error { glog.Info("Reconnecting RPC") b.closeRPC() - rc, ec, err := openRPC(b.ChainConfig.RPCURL) + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) if err != nil { return err } - b.rpc = rc - b.client = ec + b.RPC = rc + b.Client = ec return b.subscribeEvents() } // Shutdown cleans up rpc interface to ethereum func (b *EthereumRPC) Shutdown(ctx context.Context) error { b.closeRPC() - close(b.chanNewBlock) + b.NewBlock.Close() + b.NewTx.Close() glog.Info("rpc: shutdown") return nil } @@ -328,30 +417,63 @@ func (b *EthereumRPC) GetSubversion() string { return "" } +func (b *EthereumRPC) getConsensusVersion() string { + if b.ChainConfig.ConsensusNodeVersionURL == "" { + return "" + } + httpClient := &http.Client{ + Timeout: 2 * time.Second, + } + resp, err := httpClient.Get(b.ChainConfig.ConsensusNodeVersionURL) + if err != nil || resp.StatusCode != http.StatusOK { + glog.Error("getConsensusVersion ", err) + return "" + } + body, err := io.ReadAll(resp.Body) + if err != nil { + glog.Error("getConsensusVersion ", err) + return "" + } + type consensusVersion struct { + Data struct { + Version string `json:"version"` + } `json:"data"` + } + var v consensusVersion + err = json.Unmarshal(body, &v) + if err != nil { + glog.Error("getConsensusVersion ", err) + return "" + } + return v.Data.Version +} + // GetChainInfo returns information about the connected backend func (b *EthereumRPC) GetChainInfo() (*bchain.ChainInfo, error) { h, err := b.getBestHeader() if err != nil { return nil, err } - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - id, err := b.client.NetworkID(ctx) + id, err := b.Client.NetworkID(ctx) if err != nil { return nil, err } var ver string - if err := b.rpc.CallContext(ctx, &ver, "web3_clientVersion"); err != nil { + if err := b.RPC.CallContext(ctx, &ver, "web3_clientVersion"); err != nil { return nil, err } + consensusVersion := b.getConsensusVersion() rv := &bchain.ChainInfo{ - Blocks: int(h.Number.Int64()), - Bestblockhash: h.Hash().Hex(), - Difficulty: h.Difficulty.String(), - Version: ver, + Blocks: int(h.Number().Int64()), + Bestblockhash: h.Hash(), + Difficulty: h.Difficulty().String(), + Version: ver, + ConsensusVersion: consensusVersion, } idi := int(id.Uint64()) - if idi == 1 { + if idi == int(b.MainNetChainID) { rv.Chain = "mainnet" } else { rv.Chain = "testnet " + strconv.Itoa(idi) @@ -359,7 +481,7 @@ func (b *EthereumRPC) GetChainInfo() (*bchain.ChainInfo, error) { return rv, nil } -func (b *EthereumRPC) getBestHeader() (*ethtypes.Header, error) { +func (b *EthereumRPC) getBestHeader() (bchain.EVMHeader, error) { b.bestHeaderLock.Lock() defer b.bestHeaderLock.Unlock() // if the best header was not updated for 15 minutes, there could be a subscription problem, reconnect RPC @@ -373,9 +495,9 @@ func (b *EthereumRPC) getBestHeader() (*ethtypes.Header, error) { } if b.bestHeader == nil { var err error - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - b.bestHeader, err = b.client.HeaderByNumber(ctx, nil) + b.bestHeader, err = b.Client.HeaderByNumber(ctx, nil) if err != nil { b.bestHeader = nil return nil, err @@ -385,13 +507,22 @@ func (b *EthereumRPC) getBestHeader() (*ethtypes.Header, error) { return b.bestHeader, nil } +// UpdateBestHeader keeps track of the latest block header confirmed on chain +func (b *EthereumRPC) UpdateBestHeader(h bchain.EVMHeader) { + glog.V(2).Info("rpc: new block header ", h.Number().Uint64()) + b.bestHeaderLock.Lock() + b.bestHeader = h + b.bestHeaderTime = time.Now() + b.bestHeaderLock.Unlock() +} + // GetBestBlockHash returns hash of the tip of the best-block-chain func (b *EthereumRPC) GetBestBlockHash() (string, error) { h, err := b.getBestHeader() if err != nil { return "", err } - return h.Hash().Hex(), nil + return h.Hash(), nil } // GetBestBlockHeight returns height of the tip of the best-block-chain @@ -400,23 +531,23 @@ func (b *EthereumRPC) GetBestBlockHeight() (uint32, error) { if err != nil { return 0, err } - return uint32(h.Number.Uint64()), nil + return uint32(h.Number().Uint64()), nil } // GetBlockHash returns hash of block in best-block-chain at given height func (b *EthereumRPC) GetBlockHash(height uint32) (string, error) { var n big.Int n.SetUint64(uint64(height)) - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - h, err := b.client.HeaderByNumber(ctx, &n) + h, err := b.Client.HeaderByNumber(ctx, &n) if err != nil { if err == ethereum.NotFound { return "", bchain.ErrBlockNotFound } return "", errors.Annotatef(err, "height %v", height) } - return h.Hash().Hex(), nil + return h.Hash(), nil } func (b *EthereumRPC) ethHeaderToBlockHeader(h *rpcHeader) (*bchain.BlockHeader, error) { @@ -464,51 +595,201 @@ func (b *EthereumRPC) computeConfirmations(n uint64) (uint32, error) { if err != nil { return 0, err } - bn := bh.Number.Uint64() + bn := bh.Number().Uint64() // transaction in the best block has 1 confirmation return uint32(bn - n + 1), nil } func (b *EthereumRPC) getBlockRaw(hash string, height uint32, fullTxs bool) (json.RawMessage, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() var raw json.RawMessage var err error if hash != "" { if hash == "pending" { - err = b.rpc.CallContext(ctx, &raw, "eth_getBlockByNumber", hash, fullTxs) + err = b.RPC.CallContext(ctx, &raw, "eth_getBlockByNumber", hash, fullTxs) } else { - err = b.rpc.CallContext(ctx, &raw, "eth_getBlockByHash", ethcommon.HexToHash(hash), fullTxs) + err = b.RPC.CallContext(ctx, &raw, "eth_getBlockByHash", ethcommon.HexToHash(hash), fullTxs) } } else { - err = b.rpc.CallContext(ctx, &raw, "eth_getBlockByNumber", fmt.Sprintf("%#x", height), fullTxs) + err = b.RPC.CallContext(ctx, &raw, "eth_getBlockByNumber", fmt.Sprintf("%#x", height), fullTxs) } if err != nil { return nil, errors.Annotatef(err, "hash %v, height %v", hash, height) - } else if len(raw) == 0 { + } else if len(raw) == 0 || (len(raw) == 4 && string(raw) == "null") { return nil, bchain.ErrBlockNotFound } return raw, nil } -func (b *EthereumRPC) getERC20EventsForBlock(blockNumber string) (map[string][]*rpcLog, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) +func (b *EthereumRPC) processEventsForBlock(blockNumber string) (map[string][]*bchain.RpcLog, []bchain.AddressAliasRecord, error) { + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() var logs []rpcLogWithTxHash - err := b.rpc.CallContext(ctx, &logs, "eth_getLogs", map[string]interface{}{ + var ensRecords []bchain.AddressAliasRecord + err := b.RPC.CallContext(ctx, &logs, "eth_getLogs", map[string]interface{}{ "fromBlock": blockNumber, "toBlock": blockNumber, - "topics": []string{erc20TransferEventSignature}, }) if err != nil { - return nil, errors.Annotatef(err, "blockNumber %v", blockNumber) + return nil, nil, errors.Annotatef(err, "eth_getLogs blockNumber %v", blockNumber) } - r := make(map[string][]*rpcLog) + r := make(map[string][]*bchain.RpcLog) for i := range logs { l := &logs[i] - r[l.Hash] = append(r[l.Hash], &l.rpcLog) + r[l.Hash] = append(r[l.Hash], &l.RpcLog) + ens := getEnsRecord(l) + if ens != nil { + ensRecords = append(ensRecords, *ens) + } } - return r, nil + return r, ensRecords, nil +} + +type rpcCallTrace struct { + // CREATE, CREATE2, SELFDESTRUCT, CALL, CALLCODE, DELEGATECALL, STATICCALL + Type string `json:"type"` + From string `json:"from"` + To string `json:"to"` + Value string `json:"value"` + Error string `json:"error"` + Output string `json:"output"` + Calls []rpcCallTrace `json:"calls"` +} + +type rpcTraceResult struct { + Result rpcCallTrace `json:"result"` +} + +func (b *EthereumRPC) getCreationContractInfo(contract string, height uint32) *bchain.ContractInfo { + // do not fetch fetchContractInfo in sync, it slows it down + // the contract will be fetched only when asked by a client + // ci, err := b.fetchContractInfo(contract) + // if ci == nil || err != nil { + ci := &bchain.ContractInfo{ + Contract: contract, + } + // } + ci.Standard = bchain.UnhandledTokenStandard + ci.Type = bchain.UnhandledTokenStandard + ci.CreatedInBlock = height + return ci +} + +func (b *EthereumRPC) processCallTrace(call *rpcCallTrace, d *bchain.EthereumInternalData, contracts []bchain.ContractInfo, blockHeight uint32) []bchain.ContractInfo { + value, err := hexutil.DecodeBig(call.Value) + if err != nil { + value = new(big.Int) + } + if call.Type == "CREATE" || call.Type == "CREATE2" { + d.Transfers = append(d.Transfers, bchain.EthereumInternalTransfer{ + Type: bchain.CREATE, + Value: *value, + From: call.From, + To: call.To, // new contract address + }) + contracts = append(contracts, *b.getCreationContractInfo(call.To, blockHeight)) + } else if call.Type == "SELFDESTRUCT" { + d.Transfers = append(d.Transfers, bchain.EthereumInternalTransfer{ + Type: bchain.SELFDESTRUCT, + Value: *value, + From: call.From, // destroyed contract address + To: call.To, + }) + contracts = append(contracts, bchain.ContractInfo{Contract: call.From, DestructedInBlock: blockHeight}) + } else if call.Type == "DELEGATECALL" { + // ignore DELEGATECALL (geth v1.11 the changed tracer behavior) + // https://github.com/ethereum/go-ethereum/issues/26726 + } else if err == nil && (value.BitLen() > 0 || b.ChainConfig.ProcessZeroInternalTransactions) { + d.Transfers = append(d.Transfers, bchain.EthereumInternalTransfer{ + Value: *value, + From: call.From, + To: call.To, + }) + } + if call.Error != "" { + d.Error = call.Error + } + for i := range call.Calls { + contracts = b.processCallTrace(&call.Calls[i], d, contracts, blockHeight) + } + return contracts +} + +// getInternalDataForBlock fetches debug trace using callTracer, extracts internal transfers and creations and destructions of contracts +func (b *EthereumRPC) getInternalDataForBlock(blockHash string, blockHeight uint32, transactions []bchain.RpcTransaction) ([]bchain.EthereumInternalData, []bchain.ContractInfo, error) { + data := make([]bchain.EthereumInternalData, len(transactions)) + contracts := make([]bchain.ContractInfo, 0) + if ProcessInternalTransactions { + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + var trace []rpcTraceResult + err := b.RPC.CallContext(ctx, &trace, "debug_traceBlockByHash", blockHash, map[string]interface{}{"tracer": "callTracer"}) + if err != nil { + glog.Error("debug_traceBlockByHash block ", blockHash, ", error ", err) + return data, contracts, err + } + if len(trace) != len(data) { + if len(trace) < len(data) { + for i := range transactions { + tx := &transactions[i] + // bridging transactions in Polygon do not create trace and cause mismatch between the trace size and block size, it is necessary to adjust the trace size + // bridging transaction that from and to zero address + if tx.To == "0x0000000000000000000000000000000000000000" && tx.From == "0x0000000000000000000000000000000000000000" { + if i >= len(trace) { + trace = append(trace, rpcTraceResult{}) + } else { + trace = append(trace[:i+1], trace[i:]...) + trace[i] = rpcTraceResult{} + } + } + } + } + if len(trace) != len(data) { + e := fmt.Sprint("trace length does not match block length ", len(trace), "!=", len(data)) + glog.Error("debug_traceBlockByHash block ", blockHash, ", error: ", e) + return data, contracts, errors.New(e) + } else { + glog.Warning("debug_traceBlockByHash block ", blockHash, ", trace adjusted to match the number of transactions in block") + } + } + for i, result := range trace { + r := &result.Result + d := &data[i] + if r.Type == "CREATE" || r.Type == "CREATE2" { + d.Type = bchain.CREATE + d.Contract = r.To + contracts = append(contracts, *b.getCreationContractInfo(d.Contract, blockHeight)) + } else if r.Type == "SELFDESTRUCT" { + d.Type = bchain.SELFDESTRUCT + } + for j := range r.Calls { + contracts = b.processCallTrace(&r.Calls[j], d, contracts, blockHeight) + } + if r.Error != "" { + baseError := PackInternalTransactionError(r.Error) + if len(baseError) > 1 { + // n, _ := ethNumber(transactions[i].BlockNumber) + // glog.Infof("Internal Data Error %d %s: unknown base error %s", n, transactions[i].Hash, baseError) + baseError = strings.ToUpper(baseError[:1]) + baseError[1:] + ". " + } + outputError := ParseErrorFromOutput(r.Output) + if len(outputError) > 0 { + d.Error = baseError + strings.ToUpper(outputError[:1]) + outputError[1:] + } else { + traceError := PackInternalTransactionError(d.Error) + if traceError == baseError { + d.Error = baseError + } else { + d.Error = baseError + traceError + } + } + // n, _ := ethNumber(transactions[i].BlockNumber) + // glog.Infof("Internal Data Error %d %s: %s", n, transactions[i].Hash, UnpackInternalTransactionError([]byte(d.Error))) + } + } + } + return data, contracts, nil } // GetBlock returns block with given hash or height, hash has precedence if both passed @@ -529,26 +810,46 @@ func (b *EthereumRPC) GetBlock(hash string, height uint32) (*bchain.Block, error if err != nil { return nil, errors.Annotatef(err, "hash %v, height %v", hash, height) } - // get ERC20 events - logs, err := b.getERC20EventsForBlock(head.Number) + // get block events + // TODO - could be possibly done in parallel to getInternalDataForBlock + logs, ens, err := b.processEventsForBlock(head.Number) if err != nil { return nil, err } + // error fetching internal data does not stop the block processing + var blockSpecificData *bchain.EthereumBlockSpecificData + internalData, contracts, err := b.getInternalDataForBlock(head.Hash, bbh.Height, body.Transactions) + // pass internalData error and ENS records in blockSpecificData to be stored + if err != nil || len(ens) > 0 || len(contracts) > 0 { + blockSpecificData = &bchain.EthereumBlockSpecificData{} + if err != nil { + blockSpecificData.InternalDataError = err.Error() + // glog.Info("InternalDataError ", bbh.Height, ": ", err.Error()) + } + if len(ens) > 0 { + blockSpecificData.AddressAliasRecords = ens + // glog.Info("ENS", ens) + } + if len(contracts) > 0 { + blockSpecificData.Contracts = contracts + // glog.Info("Contracts", contracts) + } + } + btxs := make([]bchain.Tx, len(body.Transactions)) for i := range body.Transactions { tx := &body.Transactions[i] - btx, err := b.Parser.ethTxToTx(tx, &rpcReceipt{Logs: logs[tx.Hash]}, bbh.Time, uint32(bbh.Confirmations), true) + btx, err := b.Parser.ethTxToTx(tx, &bchain.RpcReceipt{Logs: logs[tx.Hash]}, &internalData[i], bbh.Time, uint32(bbh.Confirmations), true) if err != nil { return nil, errors.Annotatef(err, "hash %v, height %v, txid %v", hash, height, tx.Hash) } btxs[i] = *btx - if b.mempoolInitialized { - b.Mempool.RemoveTransactionFromMempool(tx.Hash) - } + b.removeTransactionFromMempool(tx.Hash) } bbk := bchain.Block{ - BlockHeader: *bbh, - Txs: btxs, + BlockHeader: *bbh, + Txs: btxs, + CoinSpecificData: blockSpecificData, } return &bbk, nil } @@ -585,25 +886,43 @@ func (b *EthereumRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) return b.GetTransaction(txid) } +func (b *EthereumRPC) removeTransactionFromMempool(txid string) { + // remove tx from mempool + if b.mempoolInitialized { + b.Mempool.RemoveTransactionFromMempool(txid) + } + // remove tx from mempool txs fetched by alternative method + if b.alternativeSendTxProvider != nil { + b.alternativeSendTxProvider.RemoveTransaction(txid) + } +} + // GetTransaction returns a transaction by the transaction ID. func (b *EthereumRPC) GetTransaction(txid string) (*bchain.Tx, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - var tx *rpcTransaction + var tx *bchain.RpcTransaction + var txFound bool + var err error hash := ethcommon.HexToHash(txid) - err := b.rpc.CallContext(ctx, &tx, "eth_getTransactionByHash", hash) - if err != nil { - return nil, err - } else if tx == nil { - if b.mempoolInitialized { - b.Mempool.RemoveTransactionFromMempool(txid) + if b.alternativeSendTxProvider != nil { + tx, txFound = b.alternativeSendTxProvider.GetTransaction(txid) + } + if !txFound { + tx = &bchain.RpcTransaction{} + err = b.RPC.CallContext(ctx, tx, "eth_getTransactionByHash", hash) + if err != nil { + return nil, err } + } + if *tx == (bchain.RpcTransaction{}) { + b.removeTransactionFromMempool(txid) return nil, bchain.ErrTxNotFound } var btx *bchain.Tx if tx.BlockNumber == "" { // mempool tx - btx, err = b.Parser.ethTxToTx(tx, nil, 0, 0, true) + btx, err = b.Parser.ethTxToTx(tx, nil, nil, 0, 0, true) if err != nil { return nil, errors.Annotatef(err, "txid %v", txid) } @@ -614,7 +933,8 @@ func (b *EthereumRPC) GetTransaction(txid string) (*bchain.Tx, error) { return nil, err } var ht struct { - Time string `json:"timestamp"` + Time string `json:"timestamp"` + BaseFeePerGas string `json:"baseFeePerGas"` } if err := json.Unmarshal(raw, &ht); err != nil { return nil, errors.Annotatef(err, "hash %v", hash) @@ -623,8 +943,9 @@ func (b *EthereumRPC) GetTransaction(txid string) (*bchain.Tx, error) { if time, err = ethNumber(ht.Time); err != nil { return nil, errors.Annotatef(err, "txid %v", txid) } - var receipt rpcReceipt - err = b.rpc.CallContext(ctx, &receipt, "eth_getTransactionReceipt", hash) + tx.BaseFeePerGas = ht.BaseFeePerGas + var receipt bchain.RpcReceipt + err = b.RPC.CallContext(ctx, &receipt, "eth_getTransactionReceipt", hash) if err != nil { return nil, errors.Annotatef(err, "txid %v", txid) } @@ -636,27 +957,24 @@ func (b *EthereumRPC) GetTransaction(txid string) (*bchain.Tx, error) { if err != nil { return nil, errors.Annotatef(err, "txid %v", txid) } - btx, err = b.Parser.ethTxToTx(tx, &receipt, time, confirmations, true) + btx, err = b.Parser.ethTxToTx(tx, &receipt, nil, time, confirmations, true) if err != nil { return nil, errors.Annotatef(err, "txid %v", txid) } - // remove tx from mempool if it is there - if b.mempoolInitialized { - b.Mempool.RemoveTransactionFromMempool(txid) - } + b.removeTransactionFromMempool(txid) } return btx, nil } // GetTransactionSpecific returns json as returned by backend, with all coin specific data func (b *EthereumRPC) GetTransactionSpecific(tx *bchain.Tx) (json.RawMessage, error) { - csd, ok := tx.CoinSpecificData.(completeTransaction) + csd, ok := tx.CoinSpecificData.(bchain.EthereumSpecificData) if !ok { ntx, err := b.GetTransaction(tx.Txid) if err != nil { return nil, err } - csd, ok = ntx.CoinSpecificData.(completeTransaction) + csd, ok = ntx.CoinSpecificData.(bchain.EthereumSpecificData) if !ok { return nil, errors.New("Cannot get CoinSpecificData") } @@ -687,17 +1005,19 @@ func (b *EthereumRPC) EstimateFee(blocks int) (big.Int, error) { // EstimateSmartFee returns fee estimation func (b *EthereumRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() var r big.Int - gp, err := b.client.SuggestGasPrice(ctx) + gp, err := b.Client.SuggestGasPrice(ctx) if err == nil && b != nil { r = *gp } return r, err } -func getStringFromMap(p string, params map[string]interface{}) (string, bool) { +// GetStringFromMap attempts to return the value for a specific key in a map as a string if valid, +// otherwise returns an empty string with false indicating there was no key found, or the value was not a string +func GetStringFromMap(p string, params map[string]interface{}) (string, bool) { v, ok := params[p] if ok { s, ok := v.(string) @@ -708,70 +1028,212 @@ func getStringFromMap(p string, params map[string]interface{}) (string, bool) { // EthereumTypeEstimateGas returns estimation of gas consumption for given transaction parameters func (b *EthereumRPC) EthereumTypeEstimateGas(params map[string]interface{}) (uint64, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() msg := ethereum.CallMsg{} - s, ok := getStringFromMap("from", params) - if ok && len(s) > 0 { + if s, ok := GetStringFromMap("from", params); ok && len(s) > 0 { msg.From = ethcommon.HexToAddress(s) } - s, ok = getStringFromMap("to", params) - if ok && len(s) > 0 { + if s, ok := GetStringFromMap("to", params); ok && len(s) > 0 { a := ethcommon.HexToAddress(s) msg.To = &a } - s, ok = getStringFromMap("data", params) - if ok && len(s) > 0 { + if s, ok := GetStringFromMap("data", params); ok && len(s) > 0 { msg.Data = ethcommon.FromHex(s) } - s, ok = getStringFromMap("value", params) - if ok && len(s) > 0 { + if s, ok := GetStringFromMap("value", params); ok && len(s) > 0 { msg.Value, _ = hexutil.DecodeBig(s) } - s, ok = getStringFromMap("gas", params) - if ok && len(s) > 0 { + if s, ok := GetStringFromMap("gas", params); ok && len(s) > 0 { msg.Gas, _ = hexutil.DecodeUint64(s) } - s, ok = getStringFromMap("gasPrice", params) - if ok && len(s) > 0 { + if s, ok := GetStringFromMap("gasPrice", params); ok && len(s) > 0 { msg.GasPrice, _ = hexutil.DecodeBig(s) } - return b.client.EstimateGas(ctx, msg) + + if b.alternativeSendTxProvider != nil { + result, err := b.alternativeSendTxProvider.callHttpStringResult( + b.alternativeSendTxProvider.urls[0], + "eth_estimateGas", + params, + ) + if err == nil { + return hexutil.DecodeUint64(result) + } + } + return b.Client.EstimateGas(ctx, msg) +} + +// EthereumTypeGetEip1559Fees retrieves Eip1559Fees, if supported +func (b *EthereumRPC) EthereumTypeGetEip1559Fees() (*bchain.Eip1559Fees, error) { + if !b.ChainConfig.Eip1559Fees { + return nil, nil + } + // if there is an alternative provider, use it + if b.alternativeFeeProvider != nil { + return b.alternativeFeeProvider.GetEip1559Fees() + } + + // otherwise use algorithm from here https://docs.alchemy.com/docs/how-to-build-a-gas-fee-estimator-using-eip-1559 + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + var maxPriorityFeePerGas hexutil.Big + err := b.RPC.CallContext(ctx, &maxPriorityFeePerGas, "eth_maxPriorityFeePerGas") + if err != nil { + return nil, err + } + + var fees bchain.Eip1559Fees + + type history struct { + OldestBlock string `json:"oldestBlock"` + Reward [][]string `json:"reward"` + BaseFeePerGas []string `json:"baseFeePerGas"` + GasUsedRatio []float64 `json:"gasUsedRatio"` + } + var h history + percentiles := []int{ + 20, // low + 70, // medium + 90, // high + 99, // instant + } + blocks := 4 + + err = b.RPC.CallContext(ctx, &h, "eth_feeHistory", blocks, "pending", percentiles) + if err != nil { + return nil, err + } + if len(h.BaseFeePerGas) < blocks { + return nil, nil + } + + hs, _ := json.Marshal(h) + baseFee, _ := hexutil.DecodeUint64(h.BaseFeePerGas[blocks-1]) + fees.BaseFeePerGas = big.NewInt(int64(baseFee)) + maxBasePriorityFee := maxPriorityFeePerGas.ToInt().Int64() + glog.Info("eth_maxPriorityFeePerGas ", maxPriorityFeePerGas) + glog.Info("eth_feeHistory ", string(hs)) + + for i := 0; i < 4; i++ { + var f bchain.Eip1559Fee + priorityFee := int64(0) + for j := 0; j < len(h.Reward); j++ { + p, _ := hexutil.DecodeUint64(h.Reward[j][i]) + priorityFee += int64(p) + } + priorityFee = priorityFee / int64(len(h.Reward)) + f.MaxFeePerGas = big.NewInt(priorityFee) + f.MaxPriorityFeePerGas = big.NewInt(maxBasePriorityFee) + maxBasePriorityFee *= 2 + switch i { + case 0: + fees.Low = &f + case 1: + fees.Medium = &f + case 2: + fees.High = &f + default: + fees.Instant = &f + } + } + return &fees, err } // SendRawTransaction sends raw transaction -func (b *EthereumRPC) SendRawTransaction(hex string) (string, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) +func (b *EthereumRPC) SendRawTransaction(hex string, disableAlternativeRPC bool) (string, error) { + var txid string + var retErr error + + if !disableAlternativeRPC && b.alternativeSendTxProvider != nil { + txid, retErr = b.alternativeSendTxProvider.SendRawTransaction(hex) + if retErr == nil { + return txid, nil + } + if b.alternativeSendTxProvider.UseOnlyAlternativeProvider() { + return txid, retErr + } + } + + txid, retErr = b.callRpcStringResult("eth_sendRawTransaction", hex) + if b.ChainConfig.DisableMempoolSync { + // add transactions submitted by us to mempool if sync is disabled + b.Mempool.AddTransactionToMempool(txid) + } + return txid, retErr +} + +// EthereumTypeGetRawTransaction gets raw transaction in hex format +func (b *EthereumRPC) EthereumTypeGetRawTransaction(txid string) (string, error) { + return b.callRpcStringResult("eth_getRawTransactionByHash", txid) +} + +// Helper function for calling ETH RPC with parameters and getting string result +func (b *EthereumRPC) callRpcStringResult(rpcMethod string, args ...interface{}) (string, error) { + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() var raw json.RawMessage - err := b.rpc.CallContext(ctx, &raw, "eth_sendRawTransaction", hex) + err := b.RPC.CallContext(ctx, &raw, rpcMethod, args...) if err != nil { return "", err } else if len(raw) == 0 { - return "", errors.New("SendRawTransaction: failed") + return "", errors.New(rpcMethod + " : failed") } var result string if err := json.Unmarshal(raw, &result); err != nil { return "", errors.Annotatef(err, "raw result %v", raw) } if result == "" { - return "", errors.New("SendRawTransaction: failed, empty result") + return "", errors.New(rpcMethod + " : failed, empty result") } return result, nil } // EthereumTypeGetBalance returns current balance of an address func (b *EthereumRPC) EthereumTypeGetBalance(addrDesc bchain.AddressDescriptor) (*big.Int, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) defer cancel() - return b.client.BalanceAt(ctx, ethcommon.BytesToAddress(addrDesc), nil) + return b.Client.BalanceAt(ctx, addrDesc, nil) } // EthereumTypeGetNonce returns current balance of an address func (b *EthereumRPC) EthereumTypeGetNonce(addrDesc bchain.AddressDescriptor) (uint64, error) { - ctx, cancel := context.WithTimeout(context.Background(), b.timeout) - defer cancel() - return b.client.NonceAt(ctx, ethcommon.BytesToAddress(addrDesc), nil) + var result string + var err error + var usedAlternative bool + + ethAddress := ethcommon.BytesToAddress(addrDesc) + + if b.alternativeSendTxProvider != nil { + result, err = b.alternativeSendTxProvider.callHttpStringResult( + b.alternativeSendTxProvider.urls[0], + "eth_getTransactionCount", + ethAddress, + "pending", + ) + if err == nil && result != "" { + usedAlternative = true + } else { + glog.Errorf("Alternative provider failed for eth_getTransactionCount: %v, falling back to primary RPC", err) + } + } + + if !usedAlternative { + result, err = b.callRpcStringResult("eth_getTransactionCount", ethAddress, "pending") + if err != nil { + glog.Errorf("Primary RPC failed for eth_getTransactionCount: %v", err) + return 0, err + } + } + + nonce, err := hexutil.DecodeUint64(result) + if err != nil { + glog.Errorf("Failed to parse nonce result '%s': %v", result, err) + return 0, err + } + + return nonce, nil } // GetChainParser returns ethereum BlockChainParser diff --git a/bchain/coins/eth/ethtx.pb.go b/bchain/coins/eth/ethtx.pb.go index 6023a259b5..500d5a16ba 100644 --- a/bchain/coins/eth/ethtx.pb.go +++ b/bchain/coins/eth/ethtx.pb.go @@ -1,261 +1,506 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.5 +// protoc v3.21.5 // source: bchain/coins/eth/ethtx.proto -/* -Package eth is a generated protocol buffer package. +package eth -It is generated from these files: - bchain/coins/eth/ethtx.proto +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) -It has these top-level messages: - ProtoCompleteTransaction -*/ -package eth +type ProtoCompleteTransaction struct { + state protoimpl.MessageState `protogen:"open.v1"` + BlockNumber uint32 `protobuf:"varint,1,opt,name=BlockNumber,proto3" json:"BlockNumber,omitempty"` + BlockTime uint64 `protobuf:"varint,2,opt,name=BlockTime,proto3" json:"BlockTime,omitempty"` + Tx *ProtoCompleteTransaction_TxType `protobuf:"bytes,3,opt,name=Tx,proto3" json:"Tx,omitempty"` + Receipt *ProtoCompleteTransaction_ReceiptType `protobuf:"bytes,4,opt,name=Receipt,proto3" json:"Receipt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +func (x *ProtoCompleteTransaction) Reset() { + *x = ProtoCompleteTransaction{} + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf +func (x *ProtoCompleteTransaction) String() string { + return protoimpl.X.MessageStringOf(x) +} -// 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.ProtoPackageIsVersion2 // please upgrade the proto package +func (*ProtoCompleteTransaction) ProtoMessage() {} -type ProtoCompleteTransaction struct { - BlockNumber uint32 `protobuf:"varint,1,opt,name=BlockNumber" json:"BlockNumber,omitempty"` - BlockTime uint64 `protobuf:"varint,2,opt,name=BlockTime" json:"BlockTime,omitempty"` - Tx *ProtoCompleteTransaction_TxType `protobuf:"bytes,3,opt,name=Tx" json:"Tx,omitempty"` - Receipt *ProtoCompleteTransaction_ReceiptType `protobuf:"bytes,4,opt,name=Receipt" json:"Receipt,omitempty"` +func (x *ProtoCompleteTransaction) ProtoReflect() protoreflect.Message { + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *ProtoCompleteTransaction) Reset() { *m = ProtoCompleteTransaction{} } -func (m *ProtoCompleteTransaction) String() string { return proto.CompactTextString(m) } -func (*ProtoCompleteTransaction) ProtoMessage() {} -func (*ProtoCompleteTransaction) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +// Deprecated: Use ProtoCompleteTransaction.ProtoReflect.Descriptor instead. +func (*ProtoCompleteTransaction) Descriptor() ([]byte, []int) { + return file_bchain_coins_eth_ethtx_proto_rawDescGZIP(), []int{0} +} -func (m *ProtoCompleteTransaction) GetBlockNumber() uint32 { - if m != nil { - return m.BlockNumber +func (x *ProtoCompleteTransaction) GetBlockNumber() uint32 { + if x != nil { + return x.BlockNumber } return 0 } -func (m *ProtoCompleteTransaction) GetBlockTime() uint64 { - if m != nil { - return m.BlockTime +func (x *ProtoCompleteTransaction) GetBlockTime() uint64 { + if x != nil { + return x.BlockTime } return 0 } -func (m *ProtoCompleteTransaction) GetTx() *ProtoCompleteTransaction_TxType { - if m != nil { - return m.Tx +func (x *ProtoCompleteTransaction) GetTx() *ProtoCompleteTransaction_TxType { + if x != nil { + return x.Tx } return nil } -func (m *ProtoCompleteTransaction) GetReceipt() *ProtoCompleteTransaction_ReceiptType { - if m != nil { - return m.Receipt +func (x *ProtoCompleteTransaction) GetReceipt() *ProtoCompleteTransaction_ReceiptType { + if x != nil { + return x.Receipt } return nil } type ProtoCompleteTransaction_TxType struct { - AccountNonce uint64 `protobuf:"varint,1,opt,name=AccountNonce" json:"AccountNonce,omitempty"` - GasPrice []byte `protobuf:"bytes,2,opt,name=GasPrice,proto3" json:"GasPrice,omitempty"` - GasLimit uint64 `protobuf:"varint,3,opt,name=GasLimit" json:"GasLimit,omitempty"` - Value []byte `protobuf:"bytes,4,opt,name=Value,proto3" json:"Value,omitempty"` - Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` - Hash []byte `protobuf:"bytes,6,opt,name=Hash,proto3" json:"Hash,omitempty"` - To []byte `protobuf:"bytes,7,opt,name=To,proto3" json:"To,omitempty"` - From []byte `protobuf:"bytes,8,opt,name=From,proto3" json:"From,omitempty"` - TransactionIndex uint32 `protobuf:"varint,9,opt,name=TransactionIndex" json:"TransactionIndex,omitempty"` -} - -func (m *ProtoCompleteTransaction_TxType) Reset() { *m = ProtoCompleteTransaction_TxType{} } -func (m *ProtoCompleteTransaction_TxType) String() string { return proto.CompactTextString(m) } -func (*ProtoCompleteTransaction_TxType) ProtoMessage() {} + state protoimpl.MessageState `protogen:"open.v1"` + AccountNonce uint64 `protobuf:"varint,1,opt,name=AccountNonce,proto3" json:"AccountNonce,omitempty"` + GasPrice []byte `protobuf:"bytes,2,opt,name=GasPrice,proto3" json:"GasPrice,omitempty"` + GasLimit uint64 `protobuf:"varint,3,opt,name=GasLimit,proto3" json:"GasLimit,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=Value,proto3" json:"Value,omitempty"` + Payload []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"` + Hash []byte `protobuf:"bytes,6,opt,name=Hash,proto3" json:"Hash,omitempty"` + To []byte `protobuf:"bytes,7,opt,name=To,proto3" json:"To,omitempty"` + From []byte `protobuf:"bytes,8,opt,name=From,proto3" json:"From,omitempty"` + TransactionIndex uint32 `protobuf:"varint,9,opt,name=TransactionIndex,proto3" json:"TransactionIndex,omitempty"` + MaxPriorityFeePerGas []byte `protobuf:"bytes,10,opt,name=MaxPriorityFeePerGas,proto3,oneof" json:"MaxPriorityFeePerGas,omitempty"` + MaxFeePerGas []byte `protobuf:"bytes,11,opt,name=MaxFeePerGas,proto3,oneof" json:"MaxFeePerGas,omitempty"` + BaseFeePerGas []byte `protobuf:"bytes,12,opt,name=BaseFeePerGas,proto3,oneof" json:"BaseFeePerGas,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ProtoCompleteTransaction_TxType) Reset() { + *x = ProtoCompleteTransaction_TxType{} + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ProtoCompleteTransaction_TxType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtoCompleteTransaction_TxType) ProtoMessage() {} + +func (x *ProtoCompleteTransaction_TxType) ProtoReflect() protoreflect.Message { + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtoCompleteTransaction_TxType.ProtoReflect.Descriptor instead. func (*ProtoCompleteTransaction_TxType) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{0, 0} + return file_bchain_coins_eth_ethtx_proto_rawDescGZIP(), []int{0, 0} } -func (m *ProtoCompleteTransaction_TxType) GetAccountNonce() uint64 { - if m != nil { - return m.AccountNonce +func (x *ProtoCompleteTransaction_TxType) GetAccountNonce() uint64 { + if x != nil { + return x.AccountNonce } return 0 } -func (m *ProtoCompleteTransaction_TxType) GetGasPrice() []byte { - if m != nil { - return m.GasPrice +func (x *ProtoCompleteTransaction_TxType) GetGasPrice() []byte { + if x != nil { + return x.GasPrice } return nil } -func (m *ProtoCompleteTransaction_TxType) GetGasLimit() uint64 { - if m != nil { - return m.GasLimit +func (x *ProtoCompleteTransaction_TxType) GetGasLimit() uint64 { + if x != nil { + return x.GasLimit } return 0 } -func (m *ProtoCompleteTransaction_TxType) GetValue() []byte { - if m != nil { - return m.Value +func (x *ProtoCompleteTransaction_TxType) GetValue() []byte { + if x != nil { + return x.Value } return nil } -func (m *ProtoCompleteTransaction_TxType) GetPayload() []byte { - if m != nil { - return m.Payload +func (x *ProtoCompleteTransaction_TxType) GetPayload() []byte { + if x != nil { + return x.Payload } return nil } -func (m *ProtoCompleteTransaction_TxType) GetHash() []byte { - if m != nil { - return m.Hash +func (x *ProtoCompleteTransaction_TxType) GetHash() []byte { + if x != nil { + return x.Hash } return nil } -func (m *ProtoCompleteTransaction_TxType) GetTo() []byte { - if m != nil { - return m.To +func (x *ProtoCompleteTransaction_TxType) GetTo() []byte { + if x != nil { + return x.To } return nil } -func (m *ProtoCompleteTransaction_TxType) GetFrom() []byte { - if m != nil { - return m.From +func (x *ProtoCompleteTransaction_TxType) GetFrom() []byte { + if x != nil { + return x.From } return nil } -func (m *ProtoCompleteTransaction_TxType) GetTransactionIndex() uint32 { - if m != nil { - return m.TransactionIndex +func (x *ProtoCompleteTransaction_TxType) GetTransactionIndex() uint32 { + if x != nil { + return x.TransactionIndex } return 0 } +func (x *ProtoCompleteTransaction_TxType) GetMaxPriorityFeePerGas() []byte { + if x != nil { + return x.MaxPriorityFeePerGas + } + return nil +} + +func (x *ProtoCompleteTransaction_TxType) GetMaxFeePerGas() []byte { + if x != nil { + return x.MaxFeePerGas + } + return nil +} + +func (x *ProtoCompleteTransaction_TxType) GetBaseFeePerGas() []byte { + if x != nil { + return x.BaseFeePerGas + } + return nil +} + type ProtoCompleteTransaction_ReceiptType struct { - GasUsed []byte `protobuf:"bytes,1,opt,name=GasUsed,proto3" json:"GasUsed,omitempty"` - Status []byte `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"` - Log []*ProtoCompleteTransaction_ReceiptType_LogType `protobuf:"bytes,3,rep,name=Log" json:"Log,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + GasUsed []byte `protobuf:"bytes,1,opt,name=GasUsed,proto3" json:"GasUsed,omitempty"` + Status []byte `protobuf:"bytes,2,opt,name=Status,proto3" json:"Status,omitempty"` + Log []*ProtoCompleteTransaction_ReceiptType_LogType `protobuf:"bytes,3,rep,name=Log,proto3" json:"Log,omitempty"` + L1Fee []byte `protobuf:"bytes,4,opt,name=L1Fee,proto3,oneof" json:"L1Fee,omitempty"` + L1FeeScalar []byte `protobuf:"bytes,5,opt,name=L1FeeScalar,proto3,oneof" json:"L1FeeScalar,omitempty"` + L1GasPrice []byte `protobuf:"bytes,6,opt,name=L1GasPrice,proto3,oneof" json:"L1GasPrice,omitempty"` + L1GasUsed []byte `protobuf:"bytes,7,opt,name=L1GasUsed,proto3,oneof" json:"L1GasUsed,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ProtoCompleteTransaction_ReceiptType) Reset() { + *x = ProtoCompleteTransaction_ReceiptType{} + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *ProtoCompleteTransaction_ReceiptType) Reset() { *m = ProtoCompleteTransaction_ReceiptType{} } -func (m *ProtoCompleteTransaction_ReceiptType) String() string { return proto.CompactTextString(m) } -func (*ProtoCompleteTransaction_ReceiptType) ProtoMessage() {} +func (x *ProtoCompleteTransaction_ReceiptType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtoCompleteTransaction_ReceiptType) ProtoMessage() {} + +func (x *ProtoCompleteTransaction_ReceiptType) ProtoReflect() protoreflect.Message { + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtoCompleteTransaction_ReceiptType.ProtoReflect.Descriptor instead. func (*ProtoCompleteTransaction_ReceiptType) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{0, 1} + return file_bchain_coins_eth_ethtx_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *ProtoCompleteTransaction_ReceiptType) GetGasUsed() []byte { + if x != nil { + return x.GasUsed + } + return nil +} + +func (x *ProtoCompleteTransaction_ReceiptType) GetStatus() []byte { + if x != nil { + return x.Status + } + return nil +} + +func (x *ProtoCompleteTransaction_ReceiptType) GetLog() []*ProtoCompleteTransaction_ReceiptType_LogType { + if x != nil { + return x.Log + } + return nil } -func (m *ProtoCompleteTransaction_ReceiptType) GetGasUsed() []byte { - if m != nil { - return m.GasUsed +func (x *ProtoCompleteTransaction_ReceiptType) GetL1Fee() []byte { + if x != nil { + return x.L1Fee } return nil } -func (m *ProtoCompleteTransaction_ReceiptType) GetStatus() []byte { - if m != nil { - return m.Status +func (x *ProtoCompleteTransaction_ReceiptType) GetL1FeeScalar() []byte { + if x != nil { + return x.L1FeeScalar } return nil } -func (m *ProtoCompleteTransaction_ReceiptType) GetLog() []*ProtoCompleteTransaction_ReceiptType_LogType { - if m != nil { - return m.Log +func (x *ProtoCompleteTransaction_ReceiptType) GetL1GasPrice() []byte { + if x != nil { + return x.L1GasPrice + } + return nil +} + +func (x *ProtoCompleteTransaction_ReceiptType) GetL1GasUsed() []byte { + if x != nil { + return x.L1GasUsed } return nil } type ProtoCompleteTransaction_ReceiptType_LogType struct { - Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` - Topics [][]byte `protobuf:"bytes,3,rep,name=Topics,proto3" json:"Topics,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Address []byte `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=Data,proto3" json:"Data,omitempty"` + Topics [][]byte `protobuf:"bytes,3,rep,name=Topics,proto3" json:"Topics,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (m *ProtoCompleteTransaction_ReceiptType_LogType) Reset() { - *m = ProtoCompleteTransaction_ReceiptType_LogType{} +func (x *ProtoCompleteTransaction_ReceiptType_LogType) Reset() { + *x = ProtoCompleteTransaction_ReceiptType_LogType{} + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -func (m *ProtoCompleteTransaction_ReceiptType_LogType) String() string { - return proto.CompactTextString(m) + +func (x *ProtoCompleteTransaction_ReceiptType_LogType) String() string { + return protoimpl.X.MessageStringOf(x) } + func (*ProtoCompleteTransaction_ReceiptType_LogType) ProtoMessage() {} + +func (x *ProtoCompleteTransaction_ReceiptType_LogType) ProtoReflect() protoreflect.Message { + mi := &file_bchain_coins_eth_ethtx_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtoCompleteTransaction_ReceiptType_LogType.ProtoReflect.Descriptor instead. func (*ProtoCompleteTransaction_ReceiptType_LogType) Descriptor() ([]byte, []int) { - return fileDescriptor0, []int{0, 1, 0} + return file_bchain_coins_eth_ethtx_proto_rawDescGZIP(), []int{0, 1, 0} } -func (m *ProtoCompleteTransaction_ReceiptType_LogType) GetAddress() []byte { - if m != nil { - return m.Address +func (x *ProtoCompleteTransaction_ReceiptType_LogType) GetAddress() []byte { + if x != nil { + return x.Address } return nil } -func (m *ProtoCompleteTransaction_ReceiptType_LogType) GetData() []byte { - if m != nil { - return m.Data +func (x *ProtoCompleteTransaction_ReceiptType_LogType) GetData() []byte { + if x != nil { + return x.Data } return nil } -func (m *ProtoCompleteTransaction_ReceiptType_LogType) GetTopics() [][]byte { - if m != nil { - return m.Topics +func (x *ProtoCompleteTransaction_ReceiptType_LogType) GetTopics() [][]byte { + if x != nil { + return x.Topics } return nil } -func init() { - proto.RegisterType((*ProtoCompleteTransaction)(nil), "eth.ProtoCompleteTransaction") - proto.RegisterType((*ProtoCompleteTransaction_TxType)(nil), "eth.ProtoCompleteTransaction.TxType") - proto.RegisterType((*ProtoCompleteTransaction_ReceiptType)(nil), "eth.ProtoCompleteTransaction.ReceiptType") - proto.RegisterType((*ProtoCompleteTransaction_ReceiptType_LogType)(nil), "eth.ProtoCompleteTransaction.ReceiptType.LogType") -} - -func init() { proto.RegisterFile("bchain/coins/eth/ethtx.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 409 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xdf, 0x8a, 0xd4, 0x30, - 0x18, 0xc5, 0xe9, 0x9f, 0x99, 0xd9, 0xfd, 0xa6, 0x8a, 0x04, 0x91, 0x30, 0xec, 0x45, 0x59, 0xbc, - 0x18, 0xbd, 0xe8, 0xe2, 0xea, 0x0b, 0xac, 0x23, 0xae, 0xc2, 0xb0, 0x0e, 0x31, 0x7a, 0x9f, 0x49, - 0xc3, 0x36, 0x38, 0x6d, 0x4a, 0x93, 0x42, 0xf7, 0x8d, 0x7c, 0x21, 0xdf, 0xc5, 0x4b, 0xc9, 0xd7, - 0x74, 0x1d, 0x11, 0x65, 0x2f, 0x0a, 0xf9, 0x9d, 0x7e, 0xa7, 0x39, 0x27, 0x29, 0x9c, 0xed, 0x65, - 0x25, 0x74, 0x73, 0x21, 0x8d, 0x6e, 0xec, 0x85, 0x72, 0x95, 0x7f, 0xdc, 0x50, 0xb4, 0x9d, 0x71, - 0x86, 0x24, 0xca, 0x55, 0xe7, 0xdf, 0x67, 0x40, 0x77, 0x1e, 0x37, 0xa6, 0x6e, 0x0f, 0xca, 0x29, - 0xde, 0x89, 0xc6, 0x0a, 0xe9, 0xb4, 0x69, 0x48, 0x0e, 0xcb, 0xb7, 0x07, 0x23, 0xbf, 0xdd, 0xf4, - 0xf5, 0x5e, 0x75, 0x34, 0xca, 0xa3, 0xf5, 0x23, 0x76, 0x2c, 0x91, 0x33, 0x38, 0x45, 0xe4, 0xba, - 0x56, 0x34, 0xce, 0xa3, 0x75, 0xca, 0x7e, 0x0b, 0xe4, 0x0d, 0xc4, 0x7c, 0xa0, 0x49, 0x1e, 0xad, - 0x97, 0x97, 0xcf, 0x0b, 0xe5, 0xaa, 0xe2, 0x5f, 0x5b, 0x15, 0x7c, 0xe0, 0x77, 0xad, 0x62, 0x31, - 0x1f, 0xc8, 0x06, 0x16, 0x4c, 0x49, 0xa5, 0x5b, 0x47, 0x53, 0xb4, 0xbe, 0xf8, 0xbf, 0x35, 0x0c, - 0xa3, 0x7f, 0x72, 0xae, 0x7e, 0x46, 0x30, 0x1f, 0xbf, 0x49, 0xce, 0x21, 0xbb, 0x92, 0xd2, 0xf4, - 0x8d, 0xbb, 0x31, 0x8d, 0x54, 0x58, 0x23, 0x65, 0x7f, 0x68, 0x64, 0x05, 0x27, 0xd7, 0xc2, 0xee, - 0x3a, 0x2d, 0xc7, 0x1a, 0x19, 0xbb, 0xe7, 0xf0, 0x6e, 0xab, 0x6b, 0xed, 0xb0, 0x4b, 0xca, 0xee, - 0x99, 0x3c, 0x85, 0xd9, 0x57, 0x71, 0xe8, 0x15, 0x26, 0xcd, 0xd8, 0x08, 0x84, 0xc2, 0x62, 0x27, - 0xee, 0x0e, 0x46, 0x94, 0x74, 0x86, 0xfa, 0x84, 0x84, 0x40, 0xfa, 0x41, 0xd8, 0x8a, 0xce, 0x51, - 0xc6, 0x35, 0x79, 0x0c, 0x31, 0x37, 0x74, 0x81, 0x4a, 0xcc, 0x8d, 0x9f, 0x79, 0xdf, 0x99, 0x9a, - 0x9e, 0x8c, 0x33, 0x7e, 0x4d, 0x5e, 0xc2, 0x93, 0xa3, 0xca, 0x1f, 0x9b, 0x52, 0x0d, 0xf4, 0x14, - 0xaf, 0xe3, 0x2f, 0x7d, 0xf5, 0x23, 0x82, 0xe5, 0xd1, 0x99, 0xf8, 0x34, 0xd7, 0xc2, 0x7e, 0xb1, - 0xaa, 0xc4, 0xea, 0x19, 0x9b, 0x90, 0x3c, 0x83, 0xf9, 0x67, 0x27, 0x5c, 0x6f, 0x43, 0xe7, 0x40, - 0x64, 0x03, 0xc9, 0xd6, 0xdc, 0xd2, 0x24, 0x4f, 0xd6, 0xcb, 0xcb, 0x57, 0x0f, 0x3e, 0xfd, 0x62, - 0x6b, 0x6e, 0xf1, 0x16, 0xbc, 0x7b, 0xf5, 0x09, 0x16, 0x81, 0x7d, 0x82, 0xab, 0xb2, 0xec, 0x94, - 0xb5, 0x53, 0x82, 0x80, 0xbe, 0xeb, 0x3b, 0xe1, 0x44, 0xd8, 0x1f, 0xd7, 0x3e, 0x15, 0x37, 0xad, - 0x96, 0x16, 0x03, 0x64, 0x2c, 0xd0, 0x7e, 0x8e, 0xbf, 0xed, 0xeb, 0x5f, 0x01, 0x00, 0x00, 0xff, - 0xff, 0xc2, 0x69, 0x8d, 0xdf, 0xd6, 0x02, 0x00, 0x00, +var File_bchain_coins_eth_ethtx_proto protoreflect.FileDescriptor + +var file_bchain_coins_eth_ethtx_proto_rawDesc = string([]byte{ + 0x0a, 0x1c, 0x62, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x2f, 0x65, + 0x74, 0x68, 0x2f, 0x65, 0x74, 0x68, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa6, + 0x08, 0x0a, 0x18, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x52, 0x0b, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, + 0x09, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x09, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x02, 0x54, + 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, + 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x54, 0x78, 0x54, 0x79, 0x70, 0x65, 0x52, 0x02, 0x54, 0x78, 0x12, 0x3f, 0x0a, + 0x07, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, + 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x1a, 0xc1, + 0x03, 0x0a, 0x06, 0x54, 0x78, 0x54, 0x79, 0x70, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x0c, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x08, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x73, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x47, 0x61, 0x73, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x50, 0x61, + 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x48, 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x54, 0x6f, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x54, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x46, 0x72, 0x6f, + 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x46, 0x72, 0x6f, 0x6d, 0x12, 0x2a, 0x0a, + 0x10, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, + 0x78, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x37, 0x0a, 0x14, 0x4d, 0x61, 0x78, + 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, 0x61, + 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x14, 0x4d, 0x61, 0x78, 0x50, 0x72, + 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, 0x61, 0x73, 0x88, + 0x01, 0x01, 0x12, 0x27, 0x0a, 0x0c, 0x4d, 0x61, 0x78, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, + 0x61, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x0c, 0x4d, 0x61, 0x78, 0x46, + 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, 0x61, 0x73, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x0d, 0x42, + 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, 0x61, 0x73, 0x18, 0x0c, 0x20, 0x01, + 0x28, 0x0c, 0x48, 0x02, 0x52, 0x0d, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, + 0x47, 0x61, 0x73, 0x88, 0x01, 0x01, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x4d, 0x61, 0x78, 0x50, 0x72, + 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, 0x61, 0x73, 0x42, + 0x0f, 0x0a, 0x0d, 0x5f, 0x4d, 0x61, 0x78, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, 0x61, 0x73, + 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x42, 0x61, 0x73, 0x65, 0x46, 0x65, 0x65, 0x50, 0x65, 0x72, 0x47, + 0x61, 0x73, 0x1a, 0x92, 0x03, 0x0a, 0x0b, 0x52, 0x65, 0x63, 0x65, 0x69, 0x70, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x07, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x3f, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2d, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, + 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x52, 0x65, 0x63, + 0x65, 0x69, 0x70, 0x74, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, + 0x52, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x19, 0x0a, 0x05, 0x4c, 0x31, 0x46, 0x65, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x4c, 0x31, 0x46, 0x65, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x25, 0x0a, 0x0b, 0x4c, 0x31, 0x46, 0x65, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x0b, 0x4c, 0x31, 0x46, 0x65, 0x65, 0x53, 0x63, + 0x61, 0x6c, 0x61, 0x72, 0x88, 0x01, 0x01, 0x12, 0x23, 0x0a, 0x0a, 0x4c, 0x31, 0x47, 0x61, 0x73, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x02, 0x52, 0x0a, 0x4c, + 0x31, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x21, 0x0a, 0x09, + 0x4c, 0x31, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, + 0x03, 0x52, 0x09, 0x4c, 0x31, 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x88, 0x01, 0x01, 0x1a, + 0x4f, 0x0a, 0x07, 0x4c, 0x6f, 0x67, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x54, 0x6f, 0x70, 0x69, + 0x63, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x06, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x73, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x4c, 0x31, 0x46, 0x65, 0x65, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x4c, + 0x31, 0x46, 0x65, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x4c, + 0x31, 0x47, 0x61, 0x73, 0x50, 0x72, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x4c, 0x31, + 0x47, 0x61, 0x73, 0x55, 0x73, 0x65, 0x64, 0x42, 0x12, 0x5a, 0x10, 0x62, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x73, 0x2f, 0x65, 0x74, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +}) + +var ( + file_bchain_coins_eth_ethtx_proto_rawDescOnce sync.Once + file_bchain_coins_eth_ethtx_proto_rawDescData []byte +) + +func file_bchain_coins_eth_ethtx_proto_rawDescGZIP() []byte { + file_bchain_coins_eth_ethtx_proto_rawDescOnce.Do(func() { + file_bchain_coins_eth_ethtx_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_bchain_coins_eth_ethtx_proto_rawDesc), len(file_bchain_coins_eth_ethtx_proto_rawDesc))) + }) + return file_bchain_coins_eth_ethtx_proto_rawDescData +} + +var file_bchain_coins_eth_ethtx_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_bchain_coins_eth_ethtx_proto_goTypes = []any{ + (*ProtoCompleteTransaction)(nil), // 0: ProtoCompleteTransaction + (*ProtoCompleteTransaction_TxType)(nil), // 1: ProtoCompleteTransaction.TxType + (*ProtoCompleteTransaction_ReceiptType)(nil), // 2: ProtoCompleteTransaction.ReceiptType + (*ProtoCompleteTransaction_ReceiptType_LogType)(nil), // 3: ProtoCompleteTransaction.ReceiptType.LogType +} +var file_bchain_coins_eth_ethtx_proto_depIdxs = []int32{ + 1, // 0: ProtoCompleteTransaction.Tx:type_name -> ProtoCompleteTransaction.TxType + 2, // 1: ProtoCompleteTransaction.Receipt:type_name -> ProtoCompleteTransaction.ReceiptType + 3, // 2: ProtoCompleteTransaction.ReceiptType.Log:type_name -> ProtoCompleteTransaction.ReceiptType.LogType + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_bchain_coins_eth_ethtx_proto_init() } +func file_bchain_coins_eth_ethtx_proto_init() { + if File_bchain_coins_eth_ethtx_proto != nil { + return + } + file_bchain_coins_eth_ethtx_proto_msgTypes[1].OneofWrappers = []any{} + file_bchain_coins_eth_ethtx_proto_msgTypes[2].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_bchain_coins_eth_ethtx_proto_rawDesc), len(file_bchain_coins_eth_ethtx_proto_rawDesc)), + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_bchain_coins_eth_ethtx_proto_goTypes, + DependencyIndexes: file_bchain_coins_eth_ethtx_proto_depIdxs, + MessageInfos: file_bchain_coins_eth_ethtx_proto_msgTypes, + }.Build() + File_bchain_coins_eth_ethtx_proto = out.File + file_bchain_coins_eth_ethtx_proto_goTypes = nil + file_bchain_coins_eth_ethtx_proto_depIdxs = nil } diff --git a/bchain/coins/eth/ethtx.proto b/bchain/coins/eth/ethtx.proto index ef7c4ce09d..3a3cbfe2ce 100644 --- a/bchain/coins/eth/ethtx.proto +++ b/bchain/coins/eth/ethtx.proto @@ -1,30 +1,37 @@ syntax = "proto3"; - package eth; - - message ProtoCompleteTransaction { - message TxType { - uint64 AccountNonce = 1; - bytes GasPrice = 2; - uint64 GasLimit = 3; - bytes Value = 4; - bytes Payload = 5; - bytes Hash = 6; - bytes To = 7; - bytes From = 8; - uint32 TransactionIndex = 9; - } - message ReceiptType { - message LogType { - bytes Address = 1; - bytes Data = 2; - repeated bytes Topics = 3; - } - bytes GasUsed = 1; - bytes Status = 2; - repeated LogType Log = 3; - } - uint32 BlockNumber = 1; - uint64 BlockTime = 2; - TxType Tx = 3; - ReceiptType Receipt = 4; - } \ No newline at end of file +option go_package = "bchain/coins/eth"; + +message ProtoCompleteTransaction { + message TxType { + uint64 AccountNonce = 1; + bytes GasPrice = 2; + uint64 GasLimit = 3; + bytes Value = 4; + bytes Payload = 5; + bytes Hash = 6; + bytes To = 7; + bytes From = 8; + uint32 TransactionIndex = 9; + optional bytes MaxPriorityFeePerGas = 10; + optional bytes MaxFeePerGas = 11; + optional bytes BaseFeePerGas = 12; + } + message ReceiptType { + message LogType { + bytes Address = 1; + bytes Data = 2; + repeated bytes Topics = 3; + } + bytes GasUsed = 1; + bytes Status = 2; + repeated LogType Log = 3; + optional bytes L1Fee = 4; + optional bytes L1FeeScalar = 5; + optional bytes L1GasPrice = 6; + optional bytes L1GasUsed = 7; + } + uint32 BlockNumber = 1; + uint64 BlockTime = 2; + TxType Tx = 3; + ReceiptType Receipt = 4; +} \ No newline at end of file diff --git a/bchain/coins/eth/evm.go b/bchain/coins/eth/evm.go new file mode 100644 index 0000000000..6276a9c237 --- /dev/null +++ b/bchain/coins/eth/evm.go @@ -0,0 +1,140 @@ +package eth + +import ( + "context" + "math/big" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rpc" + "github.com/trezor/blockbook/bchain" +) + +// EthereumClient wraps a client to implement the EVMClient interface +type EthereumClient struct { + *ethclient.Client +} + +// HeaderByNumber returns a block header that implements the EVMHeader interface +func (c *EthereumClient) HeaderByNumber(ctx context.Context, number *big.Int) (bchain.EVMHeader, error) { + h, err := c.Client.HeaderByNumber(ctx, number) + if err != nil { + return nil, err + } + + return &EthereumHeader{Header: h}, nil +} + +// EstimateGas returns the current estimated gas cost for executing a transaction +func (c *EthereumClient) EstimateGas(ctx context.Context, msg interface{}) (uint64, error) { + return c.Client.EstimateGas(ctx, msg.(ethereum.CallMsg)) +} + +// BalanceAt returns the balance for the given account at a specific block, or latest known block if no block number is provided +func (c *EthereumClient) BalanceAt(ctx context.Context, addrDesc bchain.AddressDescriptor, blockNumber *big.Int) (*big.Int, error) { + return c.Client.BalanceAt(ctx, common.BytesToAddress(addrDesc), blockNumber) +} + +// NonceAt returns the nonce for the given account at a specific block, or latest known block if no block number is provided +func (c *EthereumClient) NonceAt(ctx context.Context, addrDesc bchain.AddressDescriptor, blockNumber *big.Int) (uint64, error) { + return c.Client.NonceAt(ctx, common.BytesToAddress(addrDesc), blockNumber) +} + +// EthereumRPCClient wraps an rpc client to implement the EVMRPCClient interface +type EthereumRPCClient struct { + *rpc.Client +} + +// EthSubscribe subscribes to events and returns a client subscription that implements the EVMClientSubscription interface +func (c *EthereumRPCClient) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (bchain.EVMClientSubscription, error) { + sub, err := c.Client.EthSubscribe(ctx, channel, args...) + if err != nil { + return nil, err + } + + return &EthereumClientSubscription{ClientSubscription: sub}, nil +} + +// EthereumHeader wraps a block header to implement the EVMHeader interface +type EthereumHeader struct { + *types.Header +} + +// Hash returns the block hash as a hex string +func (h *EthereumHeader) Hash() string { + return h.Header.Hash().Hex() +} + +// Number returns the block number +func (h *EthereumHeader) Number() *big.Int { + return h.Header.Number +} + +// Difficulty returns the block difficulty +func (h *EthereumHeader) Difficulty() *big.Int { + return h.Header.Difficulty +} + +// EthereumHash wraps a transaction hash to implement the EVMHash interface +type EthereumHash struct { + common.Hash +} + +// EthereumClientSubscription wraps a client subcription to implement the EVMClientSubscription interface +type EthereumClientSubscription struct { + *rpc.ClientSubscription +} + +// EthereumNewBlock wraps a block header channel to implement the EVMNewBlockSubscriber interface +type EthereumNewBlock struct { + channel chan *types.Header +} + +// NewEthereumNewBlock returns an initialized EthereumNewBlock struct +func NewEthereumNewBlock() *EthereumNewBlock { + return &EthereumNewBlock{channel: make(chan *types.Header)} +} + +// Channel returns the underlying channel as an empty interface +func (s *EthereumNewBlock) Channel() interface{} { + return s.channel +} + +// Read from the underlying channel and return a block header that implements the EVMHeader interface +func (s *EthereumNewBlock) Read() (bchain.EVMHeader, bool) { + h, ok := <-s.channel + return &EthereumHeader{Header: h}, ok +} + +// Close the underlying channel +func (s *EthereumNewBlock) Close() { + close(s.channel) +} + +// EthereumNewTx wraps a transaction hash channel to implement the EVMNewTxSubscriber interface +type EthereumNewTx struct { + channel chan common.Hash +} + +// NewEthereumNewTx returns an initialized EthereumNewTx struct +func NewEthereumNewTx() *EthereumNewTx { + return &EthereumNewTx{channel: make(chan common.Hash)} +} + +// Channel returns the underlying channel as an empty interface +func (s *EthereumNewTx) Channel() interface{} { + return s.channel +} + +// Read from the underlying channel and return a transaction hash that implements the EVMHash interface +func (s *EthereumNewTx) Read() (bchain.EVMHash, bool) { + h, ok := <-s.channel + return &EthereumHash{Hash: h}, ok +} + +// Close the underlying channel +func (s *EthereumNewTx) Close() { + close(s.channel) +} diff --git a/bchain/coins/eth/infurafees.go b/bchain/coins/eth/infurafees.go new file mode 100644 index 0000000000..53443e6160 --- /dev/null +++ b/bchain/coins/eth/infurafees.go @@ -0,0 +1,192 @@ +package eth + +import ( + "bytes" + "encoding/json" + "math/big" + "net/http" + "os" + "strconv" + "strings" + "time" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/common" +) + +// https://gas.api.infura.io/v3/${api_key}/networks/1/suggestedGasFees returns +// { +// "low": { +// "suggestedMaxPriorityFeePerGas": "0.01128", +// "suggestedMaxFeePerGas": "9.919888552", +// "minWaitTimeEstimate": 15000, +// "maxWaitTimeEstimate": 60000 +// }, +// "medium": { +// "suggestedMaxPriorityFeePerGas": "1.148315423", +// "suggestedMaxFeePerGas": "15.317625653", +// "minWaitTimeEstimate": 15000, +// "maxWaitTimeEstimate": 45000 +// }, +// "high": { +// "suggestedMaxPriorityFeePerGas": "2", +// "suggestedMaxFeePerGas": "24.78979967", +// "minWaitTimeEstimate": 15000, +// "maxWaitTimeEstimate": 30000 +// }, +// "estimatedBaseFee": "9.908608552", +// "networkCongestion": 0.004, +// "latestPriorityFeeRange": [ +// "0.05", +// "4" +// ], +// "historicalPriorityFeeRange": [ +// "0.006381976", +// "155.777346207" +// ], +// "historicalBaseFeeRange": [ +// "9.243163495", +// "16.734915363" +// ], +// "priorityFeeTrend": "up", +// "baseFeeTrend": "up", +// "version": "0.0.1" +// } + +type infuraFeeResult struct { + MaxPriorityFeePerGas string `json:"suggestedMaxPriorityFeePerGas"` + MaxFeePerGas string `json:"suggestedMaxFeePerGas"` + MinWaitTimeEstimate int `json:"minWaitTimeEstimate"` + MaxWaitTimeEstimate int `json:"maxWaitTimeEstimate"` +} + +type infuraFeesResult struct { + BaseFee string `json:"estimatedBaseFee"` + Low infuraFeeResult `json:"low"` + Medium infuraFeeResult `json:"medium"` + High infuraFeeResult `json:"high"` + NetworkCongestion float64 `json:"networkCongestion"` + LatestPriorityFeeRange []string `json:"latestPriorityFeeRange"` + HistoricalPriorityFeeRange []string `json:"historicalPriorityFeeRange"` + HistoricalBaseFeeRange []string `json:"historicalBaseFeeRange"` + PriorityFeeTrend string `json:"priorityFeeTrend"` + BaseFeeTrend string `json:"baseFeeTrend"` +} + +type infuraFeeParams struct { + URL string `json:"url"` + PeriodSeconds int `json:"periodSeconds"` +} + +type infuraFeeProvider struct { + *alternativeFeeProvider + params infuraFeeParams + apiKey string +} + +// NewInfuraFeesProvider initializes https://gas.api.infura.io provider +func NewInfuraFeesProvider(chain bchain.BlockChain, params string) (alternativeFeeProviderInterface, error) { + p := &infuraFeeProvider{alternativeFeeProvider: &alternativeFeeProvider{}} + err := json.Unmarshal([]byte(params), &p.params) + if err != nil { + return nil, err + } + if p.params.URL == "" || p.params.PeriodSeconds == 0 { + return nil, errors.New("NewInfuraFeesProvider: missing config parameters 'url' or 'periodSeconds'.") + } + p.apiKey = os.Getenv("INFURA_API_KEY") + if p.apiKey == "" { + return nil, errors.New("NewInfuraFeesProvider: missing INFURA_API_KEY env variable.") + } + p.params.URL = strings.Replace(p.params.URL, "${api_key}", p.apiKey, -1) + p.chain = chain + // if the data are not successfully downloaded 10 times, stop providing data + p.staleSyncDuration = time.Duration(p.params.PeriodSeconds*10) * time.Second + go p.FeeDownloader() + return p, nil +} + +func (p *infuraFeeProvider) FeeDownloader() { + period := time.Duration(p.params.PeriodSeconds) * time.Second + timer := time.NewTimer(period) + for { + var data infuraFeesResult + err := p.getData(&data) + if err != nil { + glog.Error("infuraFeeProvider.FeeDownloader ", err) + } else { + p.processData(&data) + } + <-timer.C + timer.Reset(period) + } +} + +func bigIntFromFloatString(s string) *big.Int { + f, err := strconv.ParseFloat(s, 64) + if err != nil { + return nil + } + return big.NewInt(int64(f * 1e9)) +} + +func infuraFeesFromResult(result *infuraFeeResult) *bchain.Eip1559Fee { + fee := bchain.Eip1559Fee{} + fee.MaxFeePerGas = bigIntFromFloatString(result.MaxFeePerGas) + fee.MaxPriorityFeePerGas = bigIntFromFloatString(result.MaxPriorityFeePerGas) + fee.MinWaitTimeEstimate = result.MinWaitTimeEstimate + fee.MaxWaitTimeEstimate = result.MaxWaitTimeEstimate + return &fee +} + +func rangeFromString(feeRange []string) []*big.Int { + if feeRange == nil { + return nil + } + result := make([]*big.Int, len(feeRange)) + for i := range feeRange { + result[i] = bigIntFromFloatString(feeRange[i]) + } + return result +} + +func (p *infuraFeeProvider) processData(data *infuraFeesResult) bool { + fees := bchain.Eip1559Fees{} + fees.BaseFeePerGas = bigIntFromFloatString(data.BaseFee) + fees.High = infuraFeesFromResult(&data.High) + fees.Medium = infuraFeesFromResult(&data.Medium) + fees.Low = infuraFeesFromResult(&data.Low) + fees.NetworkCongestion = data.NetworkCongestion + fees.LatestPriorityFeeRange = rangeFromString(data.LatestPriorityFeeRange) + fees.HistoricalPriorityFeeRange = rangeFromString(data.HistoricalPriorityFeeRange) + fees.HistoricalBaseFeeRange = rangeFromString(data.HistoricalBaseFeeRange) + fees.PriorityFeeTrend = data.PriorityFeeTrend + fees.BaseFeeTrend = data.BaseFeeTrend + p.mux.Lock() + defer p.mux.Unlock() + p.lastSync = time.Now() + p.eip1559Fees = &fees + return true +} + +func (p *infuraFeeProvider) getData(res interface{}) error { + var httpData []byte + httpReq, err := http.NewRequest("GET", p.params.URL, bytes.NewBuffer(httpData)) + if err != nil { + return err + } + httpReq.Header.Set("Content-Type", "application/json") + httpRes, err := http.DefaultClient.Do(httpReq) + if httpRes != nil { + defer httpRes.Body.Close() + } + if err != nil { + return err + } + if httpRes.StatusCode != http.StatusOK { + return errors.New(p.params.URL + " returned status " + strconv.Itoa(httpRes.StatusCode)) + } + return common.SafeDecodeResponseFromReader(httpRes.Body, &res) +} diff --git a/bchain/coins/eth/oneinchfees.go b/bchain/coins/eth/oneinchfees.go new file mode 100644 index 0000000000..e7bcecabcb --- /dev/null +++ b/bchain/coins/eth/oneinchfees.go @@ -0,0 +1,144 @@ +package eth + +import ( + "bytes" + "encoding/json" + "math/big" + "net/http" + "os" + "strconv" + "time" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/common" +) + +// https://api.1inch.dev/gas-price/v1.5/1 returns +// { +// "baseFee": "12456587953", +// "low": { +// "maxPriorityFeePerGas": "1000000", +// "maxFeePerGas": "14948905543" +// }, +// "medium": { +// "maxPriorityFeePerGas": "2000000", +// "maxFeePerGas": "14949905543" +// }, +// "high": { +// "maxPriorityFeePerGas": "5000000", +// "maxFeePerGas": "14952905543" +// }, +// "instant": { +// "maxPriorityFeePerGas": "10000000", +// "maxFeePerGas": "29905811086" +// } +// } + +type oneInchFeeFeeResult struct { + MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas"` + MaxFeePerGas string `json:"maxFeePerGas"` +} + +type oneInchFeeFeesResult struct { + BaseFee string `json:"baseFee"` + Low oneInchFeeFeeResult `json:"low"` + Medium oneInchFeeFeeResult `json:"medium"` + High oneInchFeeFeeResult `json:"high"` + Instant oneInchFeeFeeResult `json:"instant"` +} + +type oneInchFeeParams struct { + URL string `json:"url"` + PeriodSeconds int `json:"periodSeconds"` +} + +type oneInchFeeProvider struct { + *alternativeFeeProvider + params oneInchFeeParams + apiKey string +} + +// NewOneInchFeesProvider initializes https://api.1inch.dev provider +func NewOneInchFeesProvider(chain bchain.BlockChain, params string) (alternativeFeeProviderInterface, error) { + p := &oneInchFeeProvider{alternativeFeeProvider: &alternativeFeeProvider{}} + err := json.Unmarshal([]byte(params), &p.params) + if err != nil { + return nil, err + } + if p.params.URL == "" || p.params.PeriodSeconds == 0 { + return nil, errors.New("NewOneInchFeesProvider: missing config parameters 'url' or 'periodSeconds'.") + } + p.apiKey = os.Getenv("ONE_INCH_API_KEY") + if p.apiKey == "" { + return nil, errors.New("NewOneInchFeesProvider: missing ONE_INCH_API_KEY env variable.") + } + p.chain = chain + go p.FeeDownloader() + return p, nil +} + +func (p *oneInchFeeProvider) FeeDownloader() { + period := time.Duration(p.params.PeriodSeconds) * time.Second + timer := time.NewTimer(period) + for { + var data oneInchFeeFeesResult + err := p.getData(&data) + if err != nil { + glog.Error("oneInchFeeProvider.FeeDownloader", err) + } else { + p.processData(&data) + } + <-timer.C + timer.Reset(period) + } +} + +func bigIntFromString(s string) *big.Int { + b := big.NewInt(0) + b, _ = b.SetString(s, 10) + return b +} + +func oneInchFeesFromResult(result *oneInchFeeFeeResult) *bchain.Eip1559Fee { + fee := bchain.Eip1559Fee{} + fee.MaxFeePerGas = bigIntFromString(result.MaxFeePerGas) + fee.MaxPriorityFeePerGas = bigIntFromString(result.MaxPriorityFeePerGas) + return &fee +} + +func (p *oneInchFeeProvider) processData(data *oneInchFeeFeesResult) bool { + fees := bchain.Eip1559Fees{} + fees.BaseFeePerGas = bigIntFromString(data.BaseFee) + fees.Instant = oneInchFeesFromResult(&data.Instant) + fees.High = oneInchFeesFromResult(&data.High) + fees.Medium = oneInchFeesFromResult(&data.Medium) + fees.Low = oneInchFeesFromResult(&data.Low) + p.mux.Lock() + defer p.mux.Unlock() + p.lastSync = time.Now() + p.eip1559Fees = &fees + return true +} + +func (p *oneInchFeeProvider) getData(res interface{}) error { + var httpData []byte + httpReq, err := http.NewRequest("GET", p.params.URL, bytes.NewBuffer(httpData)) + if err != nil { + return err + } + httpReq.Header.Set("Content-Type", "application/json") + httpReq.Header.Set("Authorization", " Bearer "+p.apiKey) + httpRes, err := http.DefaultClient.Do(httpReq) + if httpRes != nil { + defer httpRes.Body.Close() + } + if err != nil { + return err + } + if httpRes.StatusCode != http.StatusOK { + return errors.New(p.params.URL + " returned status " + strconv.Itoa(httpRes.StatusCode)) + } + return common.SafeDecodeResponseFromReader(httpRes.Body, &res) +} diff --git a/bchain/coins/eth/stakingpool.go b/bchain/coins/eth/stakingpool.go new file mode 100644 index 0000000000..659307c877 --- /dev/null +++ b/bchain/coins/eth/stakingpool.go @@ -0,0 +1,146 @@ +package eth + +import ( + "math/big" + "os" + "strings" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" +) + +func (b *EthereumRPC) initStakingPools() error { + network := b.ChainConfig.Network + if network == "" { + network = b.ChainConfig.CoinShortcut + } + // for now only single staking pool + envVar := strings.ToUpper(network) + "_STAKING_POOL_CONTRACT" + envValue := os.Getenv(envVar) + if envValue != "" { + parts := strings.Split(envValue, "/") + if len(parts) != 2 { + glog.Errorf("Wrong format of environment variable %s=%s, expecting value '/', staking pools not enabled", envVar, envValue) + return nil + } + b.supportedStakingPools = []string{envValue} + b.stakingPoolNames = []string{parts[0]} + b.stakingPoolContracts = []string{parts[1]} + glog.Info("Support of staking pools enabled with these pools: ", b.supportedStakingPools) + } + return nil +} + +func (b *EthereumRPC) EthereumTypeGetSupportedStakingPools() []string { + return b.supportedStakingPools +} + +func (b *EthereumRPC) EthereumTypeGetStakingPoolsData(addrDesc bchain.AddressDescriptor) ([]bchain.StakingPoolData, error) { + // for now only single staking pool - Everstake + addr := hexutil.Encode(addrDesc)[2:] + if len(b.supportedStakingPools) == 1 { + data, err := b.everstakePoolData(addr, b.stakingPoolContracts[0], b.stakingPoolNames[0]) + if err != nil { + return nil, err + } + if data != nil { + return []bchain.StakingPoolData{*data}, nil + } + } + return nil, nil +} + +const everstakePendingBalanceOfMethodSignature = "0x59b8c763" // pendingBalanceOf(address) +const everstakePendingDepositedBalanceOfMethodSignature = "0x80f14ecc" // pendingDepositedBalanceOf(address) +const everstakeDepositedBalanceOfMethodSignature = "0x68b48254" // depositedBalanceOf(address) +const everstakeWithdrawRequestMethodSignature = "0x14cbc46a" // withdrawRequest(address) +const everstakeRestakedRewardOfMethodSignature = "0x0c98929a" // restakedRewardOf(address) +const everstakeAutocompoundBalanceOfMethodSignature = "0x2fec7966" // autocompoundBalanceOf(address) + +func isZeroBigInt(b *big.Int) bool { + return len(b.Bits()) == 0 +} + +func (b *EthereumRPC) everstakeBalanceTypeContractCall(signature, addr, contract string) (string, error) { + req := signature + "0000000000000000000000000000000000000000000000000000000000000000"[len(addr):] + addr + return b.EthereumTypeRpcCall(req, contract, "") +} + +func (b *EthereumRPC) everstakeContractCallSimpleNumeric(signature, addr, contract string) (*big.Int, error) { + data, err := b.everstakeBalanceTypeContractCall(signature, addr, contract) + if err != nil { + return nil, err + } + r := parseSimpleNumericProperty(data) + if r == nil { + return nil, errors.New("Invalid balance") + } + return r, nil +} + +func (b *EthereumRPC) everstakePoolData(addr, contract, name string) (*bchain.StakingPoolData, error) { + poolData := bchain.StakingPoolData{ + Contract: contract, + Name: name, + } + allZeros := true + + value, err := b.everstakeContractCallSimpleNumeric(everstakePendingBalanceOfMethodSignature, addr, contract) + if err != nil { + return nil, err + } + poolData.PendingBalance = *value + allZeros = allZeros && isZeroBigInt(value) + + value, err = b.everstakeContractCallSimpleNumeric(everstakePendingDepositedBalanceOfMethodSignature, addr, contract) + if err != nil { + return nil, err + } + poolData.PendingDepositedBalance = *value + allZeros = allZeros && isZeroBigInt(value) + + value, err = b.everstakeContractCallSimpleNumeric(everstakeDepositedBalanceOfMethodSignature, addr, contract) + if err != nil { + return nil, err + } + poolData.DepositedBalance = *value + allZeros = allZeros && isZeroBigInt(value) + + data, err := b.everstakeBalanceTypeContractCall(everstakeWithdrawRequestMethodSignature, addr, contract) + if err != nil { + return nil, err + } + value = parseSimpleNumericProperty(data) + if value == nil { + return nil, errors.New("Invalid balance") + } + poolData.WithdrawTotalAmount = *value + allZeros = allZeros && isZeroBigInt(value) + value = parseSimpleNumericProperty(data[64+2:]) + if value == nil { + return nil, errors.New("Invalid balance") + } + poolData.ClaimableAmount = *value + allZeros = allZeros && isZeroBigInt(value) + + value, err = b.everstakeContractCallSimpleNumeric(everstakeRestakedRewardOfMethodSignature, addr, contract) + if err != nil { + return nil, err + } + poolData.RestakedReward = *value + allZeros = allZeros && isZeroBigInt(value) + + value, err = b.everstakeContractCallSimpleNumeric(everstakeAutocompoundBalanceOfMethodSignature, addr, contract) + if err != nil { + return nil, err + } + poolData.AutocompoundBalance = *value + allZeros = allZeros && isZeroBigInt(value) + + if allZeros { + return nil, nil + } + return &poolData, nil +} diff --git a/bchain/coins/firo/firoparser.go b/bchain/coins/firo/firoparser.go index 4bb800e2df..cfdf9c4a7f 100644 --- a/bchain/coins/firo/firoparser.go +++ b/bchain/coins/firo/firoparser.go @@ -14,13 +14,14 @@ import ( ) const ( - OpZeroCoinMint = 0xc1 - OpZeroCoinSpend = 0xc2 - OpSigmaMint = 0xc3 - OpSigmaSpend = 0xc4 - OpLelantusMint = 0xc5 - OpLelantusJMint = 0xc6 - OpLelantusJoinSplit = 0xc7 + OpZeroCoinMint = 0xc1 + OpZeroCoinSpend = 0xc2 + OpSigmaMint = 0xc3 + OpSigmaSpend = 0xc4 + OpLelantusMint = 0xc5 + OpLelantusJMint = 0xc6 + OpLelantusJoinSplit = 0xc7 + OpLelantusJoinSplitPayload = 0xc9 MainnetMagic wire.BitcoinNet = 0xe3d9fef1 TestnetMagic wire.BitcoinNet = 0xcffcbeea @@ -122,6 +123,8 @@ func (p *FiroParser) GetAddressesFromAddrDesc(addrDesc bchain.AddressDescriptor) return []string{"LelantusJMint"}, false, nil case OpLelantusJoinSplit: return []string{"LelantusJoinSplit"}, false, nil + case OpLelantusJoinSplitPayload: + return []string{"LelantusJoinSplit"}, false, nil } } @@ -170,7 +173,7 @@ func (p *FiroParser) ParseBlock(b []byte) (*bchain.Block, error) { } else { if isMTP(header) { mtpHeader := MTPBlockHeader{} - mtpHashData := MTPHashData{} + mtpHashDataRoot := MTPHashDataRoot{} // header err = binary.Read(reader, binary.LittleEndian, &mtpHeader) @@ -178,28 +181,45 @@ func (p *FiroParser) ParseBlock(b []byte) (*bchain.Block, error) { return nil, err } - // hash data - err = binary.Read(reader, binary.LittleEndian, &mtpHashData) + // hash data root + err = binary.Read(reader, binary.LittleEndian, &mtpHashDataRoot) if err != nil { return nil, err } - // proof - for i := 0; i < MTPL*3; i++ { - var numberProofBlocks uint8 + isAllZero := true + for i := 0; i < 16; i++ { + if mtpHashDataRoot.HashRootMTP[i] != 0 { + isAllZero = false + break + } + } - err = binary.Read(reader, binary.LittleEndian, &numberProofBlocks) + if !isAllZero { + // hash data + mtpHashData := MTPHashData{} + err = binary.Read(reader, binary.LittleEndian, &mtpHashData) if err != nil { return nil, err } - for j := uint8(0); j < numberProofBlocks; j++ { - var mtpData [16]uint8 + // proof + for i := 0; i < MTPL*3; i++ { + var numberProofBlocks uint8 - err = binary.Read(reader, binary.LittleEndian, mtpData[:]) + err = binary.Read(reader, binary.LittleEndian, &numberProofBlocks) if err != nil { return nil, err } + + for j := uint8(0); j < numberProofBlocks; j++ { + var mtpData [16]uint8 + + err = binary.Read(reader, binary.LittleEndian, mtpData[:]) + if err != nil { + return nil, err + } + } } } } @@ -318,9 +338,12 @@ func isProgPow(h *wire.BlockHeader, isTestNet bool) bool { return isTestNet && epoch >= SwitchToProgPowBlockHeaderTestnet || !isTestNet && epoch >= SwitchToProgPowBlockHeaderMainnet } -type MTPHashData struct { +type MTPHashDataRoot struct { HashRootMTP [16]uint8 - BlockMTP [128][128]uint64 +} + +type MTPHashData struct { + BlockMTP [128][128]uint64 } type MTPBlockHeader struct { diff --git a/bchain/coins/firo/testdata/packedtxs.hex b/bchain/coins/firo/testdata/packedtxs.hex index 6b42f4ae80..11acad5433 100644 --- a/bchain/coins/firo/testdata/packedtxs.hex +++ b/bchain/coins/firo/testdata/packedtxs.hex @@ -1,6 +1,6 @@ -0a209d9e759dd970d86df9e105a7d4f671543bc16a03b6c5d2b48895f2a00aa7dd2312ce0201000000011687b1470de50d78794fdd86d7d903345f4209497235da14a03646b0662d3a46010000006a47304402205b7d9c9aae790b69017651e10134735928df3b4a4a2feacc9568eb4fa133ed5902203f21a399385ce29dd79831ea34aa535612aa4314c5bd0b002bbbc9bcd2de1436012102b8d462740c99032a00083ac7028879acec244849e54ad0a04ea87f632f54b1d2feffffff0200e1f5050000000086c10280004c80f767f3ee79953c67a7ed386dcccf1243619eb4bbbe414a3982dd94a83c1b69ac52d6ab3b653a3e05c4e4516c8dfe1e58ada40461bc5835a4a0d0387a51c29ac11b72ae25bbcdef745f50ad08f08b3e9bc2c31a35444398a490e65ac090e9f341f1abdebe47e57e8237ac25d098e951b4164a35caea29f30acb50b12e4425df2880faf633000000001976a914c963f917c7f23cb4243e079db33107571b87690588ac6885010018b2dfbadb0520e88a0628a28d063298010a001220463a2d66b04636a014da35724909425f3403d9d786dd4f79780de50d47b187161801226a47304402205b7d9c9aae790b69017651e10134735928df3b4a4a2feacc9568eb4fa133ed5902203f21a399385ce29dd79831ea34aa535612aa4314c5bd0b002bbbc9bcd2de1436012102b8d462740c99032a00083ac7028879acec244849e54ad0a04ea87f632f54b1d228feffffff0f3a91010a0405f5e10010001a8601c10280004c80f767f3ee79953c67a7ed386dcccf1243619eb4bbbe414a3982dd94a83c1b69ac52d6ab3b653a3e05c4e4516c8dfe1e58ada40461bc5835a4a0d0387a51c29ac11b72ae25bbcdef745f50ad08f08b3e9bc2c31a35444398a490e65ac090e9f341f1abdebe47e57e8237ac25d098e951b4164a35caea29f30acb50b12e4425df283a470a0433f6fa8010011a1976a914c963f917c7f23cb4243e079db33107571b87690588ac2222614b354b4b693871714462737063584666446a78385542474d6f75685962595a56704000 +0a209d9e759dd970d86df9e105a7d4f671543bc16a03b6c5d2b48895f2a00aa7dd2312ce0201000000011687b1470de50d78794fdd86d7d903345f4209497235da14a03646b0662d3a46010000006a47304402205b7d9c9aae790b69017651e10134735928df3b4a4a2feacc9568eb4fa133ed5902203f21a399385ce29dd79831ea34aa535612aa4314c5bd0b002bbbc9bcd2de1436012102b8d462740c99032a00083ac7028879acec244849e54ad0a04ea87f632f54b1d2feffffff0200e1f5050000000086c10280004c80f767f3ee79953c67a7ed386dcccf1243619eb4bbbe414a3982dd94a83c1b69ac52d6ab3b653a3e05c4e4516c8dfe1e58ada40461bc5835a4a0d0387a51c29ac11b72ae25bbcdef745f50ad08f08b3e9bc2c31a35444398a490e65ac090e9f341f1abdebe47e57e8237ac25d098e951b4164a35caea29f30acb50b12e4425df2880faf633000000001976a914c963f917c7f23cb4243e079db33107571b87690588ac6885010018b2dfbadb0520e88a0628a28d063296011220463a2d66b04636a014da35724909425f3403d9d786dd4f79780de50d47b187161801226a47304402205b7d9c9aae790b69017651e10134735928df3b4a4a2feacc9568eb4fa133ed5902203f21a399385ce29dd79831ea34aa535612aa4314c5bd0b002bbbc9bcd2de1436012102b8d462740c99032a00083ac7028879acec244849e54ad0a04ea87f632f54b1d228feffffff0f3a8f010a0405f5e1001a8601c10280004c80f767f3ee79953c67a7ed386dcccf1243619eb4bbbe414a3982dd94a83c1b69ac52d6ab3b653a3e05c4e4516c8dfe1e58ada40461bc5835a4a0d0387a51c29ac11b72ae25bbcdef745f50ad08f08b3e9bc2c31a35444398a490e65ac090e9f341f1abdebe47e57e8237ac25d098e951b4164a35caea29f30acb50b12e4425df283a470a0433f6fa8010011a1976a914c963f917c7f23cb4243e079db33107571b87690588ac2222614b354b4b693871714462737063584666446a78385542474d6f75685962595a5670 01000000010000000000000000000000000000000000000000000000000000000000000000fffffffffdb65cc202b25c3200000046551190596d29fb87ee282c1e2204bee5aeb7a1b1c1c28f1d507ca1b5d4f4a351f4af3663d653f8b1061fc77b2b7f72c168414574007b360b3c59f2dddc39519ec1ab30bf290181d1dcd37f4a1e35a24d64937a05be7efbba8c418fe877092be132ec83c77c4098f059ddf947e1aec7e64022acc17bf8cfced88d37da3cb2b2e0105c555a26e42f89f842b219d60ef390a8e998967adf46f06900dd42059810b56112cb23660ed591f4de1eea034fe181a6b1a8285e35212cbc3e0c3f29a138ff6aae9c91ea7abf4e20ce2dd27d7182696963ba53fa57d1eaceafbef2cc814d0b17b19b560a48cfee21fd69025902c23b8ea9fab931a60cf041c09418560020d47a746358826da947e16206a1d35d9879a9d785988bf300a1ee6641d12fea79a3991102d6d8f9b628e5402b0c357de333f9d752df7288ae0e8a60ab910694ee28a04889c52ab6eabc8b890c93fd8129d211357013ead3a8603be4843460cb25856936078045b5b07d1e2570fc2d0f45341827642c3a725a86e07352b2b8f52748e2be7adcfadde26eb9508a93fc5305551b9fda4fa819c1256d868c9b01857bc3a5ef1db57b6351557a53c1409425343abc40754cd121920eb99c92c711c730d838a129b801b2b152ff3b940c83c70addee716160951503eba21720f9859454cab7785cd7f25ecf3846cca6e6c92dd993268c268a3cd1f3d3c3818687f50f5423e658ebb7afdf3f6de96baf2e61b344103c2d16f20e31873d30b38e4a19856a8f510f98e74b819de5f2d208ede4bb3066e8a91d71f4a68f5901755a5faaf54a68316a09fd835f495018f2455f01b6470f8be72360d18baec83e89ed5064a87dd0cee41f57d09f87eecc3dc012f4d2d316544126959484d625a7922f288e1699a5b5b672c44cfaf1ceefd0b4683b1e7a62e9a33bf32412f1a49f1f8a0570dcfee53b9db948e35b9cd545e74e0d024ceb04bf726fe3c323ce002683447beb33788180dcad0a15569e968f185b907b24f0a91a00a237d92a5c2be6d752b27e06fe7238987cf7ee3ed0415a1cd0cc69b8eb586fd6f7b83e01692d9d28b59b9c98c231eb38165d42e62c10cbe4246bfba35cac79f0e002fda3b06941f4ebadba9109d81355ca6d9b0ec463ab4f41542b9cdacbc3c7303b66e5ce54fdb33f1a4e12d069a3154df189ce2f7340d95433de251da4ddf967e000fd69022b80e7bd4378a9be93d9558d63c8b2829c80e9ba75e4603bdcd45a9e100db330dd8017a00cf3d317c770b6d6dcb05cb2cace0e296ce2e8a96b71b0b6ea48be0e2e81cb66e76713a5877020a98acea1230eed97bf80b519b5dca15f724dfc754fd3150d2056ff113c9ffca161e13603f0acdb311614a44a47a2178f46a2017e73fba20d07a1da0a9792080875aafae252a7047154ad590aa34242cc5a76c2bb97c6e1f464d65abb5be84c64589496449f08d066267af9bd40ac5b7b55160f1d2f9933ceec99b3b5a4915776c7d1f5dc2d0226c0742e0c5376bc116aa571cbb692fe53e7bd9c05aa8160d8476d40f5208abf58bae2508bdc5e52ec25fb3a037d17a162646bcf82b6c2dd8560ed86c9a67668a8ade7cce1540d7742400e05d091058fd60396dbd0ac83b54134d64f76303f022da8765a67bd00a0d178a1e97dcf747551decbae17c89c2db17de96220a82f5364504ce7114794de930a35648fbcaeabaf06a329e8e0c3c87f2cae56134acdee0d86b3941d7846e6bbe424e89d8cff510057143547dff7c06ad7326d5bed5de75ec34b3163c3c58a96cca18afe399cef35341d588ff9c15c0c8f5a5a63727ee52311e3f28e3536292ddceb48018b6035113cbb3e838c668b2725f12978e5ab9d8f808dc64ccc0ca48a02c2344e8be8689740c60cd58159e45592c55da593f5f52b1d370a5d6fc364f03fc0ac094f528a67503cbb6fe49513db62596080b728be309f4ada27ead0923de2e89ff8ccea5a00c74f7d106928214e2feeb4ca2bc475cbf3bd7b3458f4d10db64c9abc350e244922519f2d13ddcbeea3f3b2e366eeb00d9d989142faf860823fb5fac1a3e0a72a102c69bfe4ff00fd68023299eb15b9c2892d691c8f439064db72f10d485fb32bc10bedf746bdd83e33f6a56978f66b0f89427a84ffb3f2521841d75a1ef262fbad0547a76deea1151a71b9a39f0d1c8df6c0fa6a66136daafe0b4a205f84df8edb19db8cc069aad6605178c7dd49e9e1af87de1b1ede3fd1ceea73f973ece91ad8ced139754cca4cffa5597bb9fab5fab3d836ee0e04c1ba1077500cf49543bbe5c986a8194b9cb5be63721c4d597c7082d456b23a20ad036c21f416b970a344305217f455925db751f52b0559bd986dd35192f639ee698c9468ba338a7e46ac9e50368eb86e5666af8431e7ae273e14d8202a557d93e3a93cbc1261a4bb13898c9fb15ceb3211f6f7d7adaa30b4baa6c4fea881b84c43f4ee2b9a9111a55fd502fefd95501dedffebebe4fca78fff7c6dd70e90adb7b8f2f611344791968aa3a0bfa06bc759721c622c8f2a4a67851c2acdd586952b84e287f086f60540934d05faf5a267f4ba3f6c17eb15c5fe6f302094247dc9c3d1d42a0017ac8e97400361c94f01c398ad4c9c3f88e21268203e3b52086d796a7147dd039329859e618f7054ca899219485c31bbf460a1b359df1c3a025bff338a365f33f48f71763647e48cc24472edb962d435afd64f394ddab6c6f64e6f54a3568f38ae45ce599fba9314f121eb1c6b8ad3e5964557a058186829a12002b2a9220a1ab55ff478562cb333ef6bb69d4ed4dffd9ebf39ca15f5eecde297afbfd7061e17eda335cf7212389abf1fc13053298cbfd6aa6402a323d5051947347e9fba76b059206a916a4ee84ff1f48c98d9be5ace61a2fef441c44587bae69770f69567ee8f52cd91adcc76250951be53462207cf27746c225e13c2164663cb0ace257902fd5815b878e4f19ff10499acd3700828a051f8c1ec33d421135089001547dc1df5cf9a43da6877472c6496ae65ec1e7b91bc3494769a03cfc6e350c588de0045bf26d0b418e08ffdae019bfb19f510e0e530d66f8173b13826b1281575a5aa703bb86cef598a99b9546e1a241fe86acc5a8f7156542fba23ff41c1db9267708f44dbce1f75465a7befa3e135393b1d5faae4f7d90c480656b0f012d1a66a03c76a58754b22e42f234de46e7f4f05192dc734f497d7d9a1989d657fd1bdb4e2379e4f576c5ee72be808dba602fd3501319e81fe1211176143ac5d9b76a06951a6a0413db2f4ae33d0f7d9a216fe8a5c5828c5af6778cae6464dea07262b1e64f18db9daf24fae038494836e7f96f8056a42f5966ac53f1e3bd7e2a39f129ded3d223908e64e020b7df2fdc275b993ac951921549d0b1cfe6464e8a3600f21714108f5c1aacdeaffd3416e28db6321b761f973ed338e95b559ae9ff6cfcd65e62d5e92b72cb244dda8ab5babaea6b992d7dc5ddb8bcfd189b2f564de4b57e03016f578c3d0adf004232f2f2ee155af2d6d0224799732c61513f10a51405be7b07ccce65f99f0eac9e3ae73a2782e34226508fee3c4effda657412c2bfeae4e4f2b63037db545bb7353b69654dab3f5da6e05e6c801828301e705eed65de092fc7081807643d9d3a84c2c0f00e460e4a7803f8fbc60c1803783f2a2c378e07531ce57bbb700fd3401139803deba8b83a31f7a90a52292c7b44d8c854a7dcdb835a2ee349fd4034792c0e62fe57a845f2927a74f363bf8f01a8a34266c8c3901c32b69f954e08e08e455f19775d92ee0114ead8da754f4403db89cdbf7e2a26d5560b060cfcfca049fc0b4b6a284f3c8b2ca99b0a53e1fbfffe5375cdb81242e758eb5fe13482030b78cf85d1dceb18833fd999d7f2b99a59961c12b8cd5e7cf8b0aa0212334023a28dd3a1211961fc7b7d8583a35d3a89b591e085eb2c63a111dd5ed4fa7b940733658a17e4ebdfb86a9132803d71a9a8b999fd9084a309214eaa5d12c6ade1d5afecf98cdb590d5d67ad79523ab29343643f9d6fe45afb34db61d0d7575f3fa21eac819d3663c5c868b32c0b5fee74ca11dc907de348029cc4f8b9db1008defc55f5f2f7f161d8249f5a5c4e7b643526f176d901a50fd3501be7ca3cbab1bfafd3e532d3cff08a4e43615ccfe9b5c75d661abb778188b62340f9a2f91c7b4e8f921f94fd023695364ce23a1a128cf630a36e69460c732cf514bb3a6512b23878d36505dae42b2680fb5bd293883938fc4964ce807d00a3d5b5bd93eb5328ba05c4ece7a62a6ce579ea0301c8cb04f359d93a68f4752de9641463fa9ae07d1b8ea2c21015539f5687be2977116e4ee99b1230ced94c52486e6ae38badebf88859df164e18ea343305d7153ebf5c6bb8fbbebf3c47cd23411961558edf12b57bf180819412bcc84fbc999fea2535efb01563c48313f12f3f42d3757c5da59e90948878b64f868be2604f8bccc4d103868ad3c9c346049a2c66c590067b890993f7de9b8b229cbe55b7d9c0d3716bb51c53188175fc7bc04bf4b744774ad7dce79d5bd21e4a4c294f8201c1c081602fd3501a925334ef2e47c0890a6a542f8321eef345b2cfd931a0c48c0296b20c1a22f741c3d7a133756ca24ca1455567fb99b6b6da19593a4dcdab7304b5963850e3b79442602217a64245cac37b1aea73afe494057b545324279d70041fe2977232b8a04ec926664ea4c10feb022da5e3ce3ec5a8725192c3d795a614dc479aa0c099f19d13bc97a30cf1ddb36182834deeb42e89b65a6b76cd00b934bd4bacbc9d7aeb0f544059f612d1c8837ebcfc2491fc5e9f1ae8a4b9f08d9877801b8f18c28da4bbcbbaeb8362fb18f6bec531557cdc5231f6ebd4fc73f97eaaeea338c62796b05e0b84b12c8c8de7b0444edd0420c2e5dfe1e6fc5a0c93b7e0ab7f005ae536e9b30a93679b9c5425aced70c1d60ac61d47705744e88b90697694a6b6f32a5eee6b60c4f96d0cfedb03ad96b8172aae6441e01c100a491037d637954ace3da0f416b9364be62df441262e33883df3ba56e9b6f665dbda14a45434e22edc692e0ef977f3d1f902084a3342833ac2ce396859131b64f0cd73bb1be3c22c99fc91dc3ffe07862cae7a34c4384d68d4f729b1b174d55b13e03dfa1fab5af8081d61291da97fd2a00762ae441ee631e242852bc20f5ed8b62a6e4725d977c66b16ebf4daa6511f7070e31b4446339c44d0a90dca22fb29085f2e02884fdd40110ab9262959ff2a85438df9126d869e3d4f7b85044344d4067c7af01979ffcb5598ff17cac8d6b588d9f82d87b8f144bd16149d9277ef00a79fa4d80ea97e7f7e7143246addf1e15e576789c0ad716c44f244d46a02110d413d456f8eb53da3d36589cf777172c14c5d3d56cb7d61471c0a6b22a6dd9f5928fa018ef0577c8dfd5cc5509da86e2a62cab87b5e757e0fbfde1cdf19edccc2d78636ae3ebacf75dbb1121c52ed86dda072db87ddfdabbcaf9b39fdf1fdc072af586e1a091fe00befb4572fac4c8fb4f9ff5f85c13f66f238f4f287c2e8e852729a1aab11188a942d8db8bb8e6483062c8e75166584e8ae11b6685026f8145951f6ac8ca9df676ce965c2f226e5d6c2cb482fd067f50030495d5826cf24d36516ca9894ad2303eda071956582eb6a60e6dbee56d472ec998b3dd3c5d08cf73ced73a7750c2936e23836f36e68544a3b7e02fc576de20e0a76fdb1c13fa6f4090bf91ace61373ccd5e573ee262daed75739f435121df7778313542421441c131cee9cc671fad72b2d1bd5748e6aed813e80f75ed6497522f75f1351ca859a922d1c122fcbd532c82d2a4853a1fb2ec698113421b5d6fc9dd429408c90051f8fab28f03cd7a86c61aefb1b1a833676a33df8ec52b3f697189db992758dfd580115f27596d43332bb625f4cfd5bd5e5545238aa31cc9b706d921f4d8b9184573b9249e3aa6d1d182d86c9a6de8f9b26b71d76d67cdd3638f2c48ade2b47dd60a95d119992c232a14ef05e053601c2a178647da59ad43eb5a4be732e1b8792d8a1d7d9259629ad7f882120b8f4f6984ab464183796bf5980d05bf32d85f61421ca4ff3dfd9c94c5dd3b1b33a0e3b113ab1dda8b2e6fe0daf32f72164a940c9dbbd9db8d460ea919e3f8338257f77ef3e884eb3254b5f60a92e0913d741acf9c173e92e3c0da33af70020649c004845c03018531c5394b3a53668b81eb539981c310270a3c7c4ec25567955eba73d9c37af67abab999f2bce0e14e19e835bda0cc7f5c58851fc4079f704ff8575d44e161f954e835e39ad1c5f9e2a414f890fbbdbfd1a50a1c73fd72ac36e4c2668ffbec8311c76a94340edca158d1acc2c0ea90042149a5b5d198081833bc3f1309fbb7cdf34de6e5dea2b04452f18f8714095ea9c9ab37aa003337a5c5c44a315d77ac8f7e35983106ac5ccee6c21534b87fcc7969e25caf720a6eb4b63cce609aaeec0dc0592340efb93ab426320bc035cfd5901f2ddb66c64b1198d80e619cc73ce127e86ddc9df078d3c71671333c7dad2f0089c65e83070efb0161a3014706337436131cc54e43f0e3484bf24661897bdfc34e64af6d49328f763c164c39e9041cdd3ddf43b1178869d9e4cdebd8e1592acd581a5402f3482c6ae63b34246592a35e9e220055f93c06f704b6484fb7f1b2eb0cc5e587cfa4d4dee683c3d412f4593873ba2191a218d5aadad29d7bea522307be7979158ab102f3e04329846f02793b775c271e7ab66c1d8582e53a2496a438188fde722c48e7f6bb6e91000b05c1553407622bfa2a9fb146dc169b163130baf7802ecbdf0bd059f32bd1a4549fefc9a3a03a99449c9cdbbd45206244fbd9792a69036e8eea32d82ac89694b65887a48308314c0efbf408c689d119ad46ed237c74c322407cc8d499c49bc454dd090802ffc33eff180ca0b3968b39e0df7f8b259cbe95b754ada17686e1530b0a702bca93b1ca42529d68000fd58013c59ca9ff207c4a2d57122e6c374b0c8125176b534bff226a91d7bbea935a07f8602c06eea81ed5ed388524c7a3fbe0dd4c850687652dae368a48bc8ce91711ced188b7da9a7ef1e7d8b96145b39faf8b2e95376cbd173bdeda632b792296dff0df80d4cb3e30fba1960cffb3492159938e0b61a632966284666f50223e3cd14bfb4cc1e95a707677d0ec770751860411b7fe90f4e2c078c11298ba2010c7410594b9de7e6fbe80aea2cb76f8be0c0572defb9d58cceb06dc1c84e197f867452e6a502bb7e0c18d5b1ec9004315563750ccefca4fb65aa1a51aa32773d6519281b7bf6ba826be6f5403b549c3e3646ddff159376c534fcc1e7e339af2ade2e992949d6f2d6362e1c26c70e60ae9669a3a73702afe1c06684794e75966612e9d99cbc7db18acb4a3f37baa1ede7bc419cf655499dac0d126ac3ba833e4aa4822c7bf2c49ed8d94b28055168f4ac738c042b6f21b4dd779539fdd4013688d933c2502cdaed2b4360fcef5c8173ef2c1f5a91604850ec2c81e706d1a2b0c87154380186b812304dcaa7363afe5cb6a52ed235690d746f1a070445fe4ab9a18df19f0d1e87b1a2e9bff724f6c77e2cbaac74a7694366f16620cf4a1d73e3fac311750c406c3fe6c5df4fa5d996d92673571550d694b47b69383e6251171010e3ac21f01f12fe2c764374a3457f34e83ec0c9e87f182f84bf72f1595714c8825a720545a865f223cc3863cb5631c8224bbbf3e082b2c07da33a0b180acb89db94127dbe3c060ef10a8b32298c153aafb1870464eba5414846330f5f274bb6b87e4a2613549853578b7024a249351fc54079737859c559ee066d6186ef6a06a94c19318ae8fd119998b8b8fba2990970a73ace570ae0dfd6a4976c7e240bc1224a410289793d0a97a71b6c60143b2f0163c69cdae4c7dacc707eec9d2de6820b47a6a900aec39f0157e729eece517ce5d1079f88811c6bd1647d32b1375eadd5bcd5b8ef6e9e05b79f4e9fb2497c2d0b1e886ef68b298af6421a7b527357a3cf8a10963d5503a0ed1355ad8e003abd987fb9fe9e26d919ffece2fd1f00fc87188e2a1fd0cfd122c58fab58ba37a61312c68f641908df7043b1b65fe52707eedce969a8a8dd245eb4694e9d01673b1e441d81609b0a91c4ae4f779c7b1838386632fcb1f1dc90d74a3920741c4c0c3ed4ca4b61a0b12195bc5e16f7ea637a38e63f52d0aeb3e4865d1650a2cebe2c14c5a4c2a155975755d0cdd2e65f9ea0dcbde187cad3a88544e0d9b4a4900a590d5a44ab0121ae1f4ac2eb65b5eda140899d5fa527deb95ca4176769f96a68ad3c506723860b0146eaa4360b738ceaf67292a88f4c15f5c91183fab11fa57427a87ccfb1b4214b44c0d2c6d9668e4abe6e4c43934934eb5c621d5b097508411896b343eab7a5acab87607386f907608f6bd3de45fa08183e01037f339cb3905fa8bdd791b8e7d9ee54fc2e424a1537f63e48ad2420d219b14c7025e7d32c0292867d30c023d3900e6aad9c768826c86467b1ebc2ef86774427eb433785f7b5d05db05b056195824d3e40bc2785e40250206fb1680814835100fe5a77ba4cc5816a80b1edd12ee960fc9fc898cc6051d625206d1663c4aad291b5a8b6f9aab95a0e60e9f12f3693f46958ef0fc5ec460d4a5121469a59ebc1b20742c238592976434be70e9406aa2900d31d637dc65fd2de61a80021c54f7dcf90aba4912a73a20038a951127348621ff65add2a75feea07162e63b10021ae0dc0278bcbb2968e8f6f2fa99216a614adcd38433b32b5481ff35082e6f19f002060b1d489bb9b3ee9f5670890d8bf329bdb906955ca9c9b1e23190c4af9b9251320f59505121fcf1a53150766b2b65e55e2b36cc7fc61da94746b17a9b7f97df86e2076dcbe98ccffeac440de898fafa058b7501b07691431b6d32ada652102d55b2820974a8dbc563de8510d65da16fdf79575b59fd2a490177a7f5bd63ff03d48a554201a31ebd30e8c013223a76725afe3d50caa5e1025925a4c03d19dffb17f5d175320e1bf7f439ea8079322a86024e1253cd71604d458c67e09929fe89394402d165020be0d25d6e004b1f86d249a8b4b9e06b5619d165c2057aec4c4bee1a0ee4eb240217beb32c9e29f2dee1bab88aa620d7ed7a7dae80d04f03c1c17ca78e1a9c803b70020b7b27036b274dd398eacccf27a1f8d67fdb3bba2819c5ef0aa94b7c3995464a220487edd3892385c68e0765cf86ac7379a6ba506c3d687615dfd1664a61e0df10620f6e44766be42266c3202569865c8341a8b4a9445769ba336cfacd7b8141f9a9a21f1e28f7a220f0caf78a9ce7a4524d87fb1a8cdccfe6dec364d94ebbba6dd93b2002115b207a64913e0303ec3915a67279f85002410dc25184f06a03b9177f3134695002022c96e73a8fbe87b7755f8f2181f91b5d5348bc861fd6ab35ee71b4ddc5d8a1f210837a3775e5e598150999a4706ec22526e8321f73f7e78d0693595aead84128900219538d13c754a2ac0f1ebbc737d7bd3a4468b7e91636f10bbd980d8253ba5f3a70021182188329afd23ba2916e46880a016b493538ee3ffc4438488fcf6a36d78e48900205add8ddabdab1dbbefb5c2439ff789e158197076ab6b8d99ab37ec4d23e0151f20c876fb7a9976e7b0e8b4fa2d40a26a1f88b5203a992c71f86c863f64409a6c9420ba46a5a64b38094cce0e477fcf526a371f81d98758305173ff85e5af9e9d713520a29a3995c535d10d2de254ce8dc6fdb52a0e6965d5faeec07548aa6b43a91159217f1341316ff39e8dfaffd537063c130f3dd19770d2b911eb407f1c05b42e398e0020d2b3667ad2def5e59fc37b22e196fbda8d2c41b886be1f3cbef4ba78e7fb1b18201d0e660c8294d3550ea90d2e976f0263209275ba6e277ccbec9daba6d361286c2028c77b1955f5cefdec1e35cc2e9121d07651200e90184d7cf32f40dc73432c41217769836ae0d553d95a53b045352d122ac2c489cfb66a172346a3de53801ca99e002094543d995a9f86fb5f49c78fa23d0868faeb3bcca002fd7604fbf81f38c44a712137ffe7281b281b17aa5419276642b8e69eb1b1eabe30ebbefebb022c21f268a300208092e548789ae3e160dbbcc8ad981f80804d9e485003a6c688fdecaeb277b500202d5b57d5d18194fea324bb7c742151f84f9fa7fdb69fac77ed936a56c80cdb5520015264325a4159703b2d38af540c0e680ae700f3b9bf3c069a80696bd322a95521ac7f435a2907331d8dc15dd9dc945807e3ee5ab5295bd574483300431612edbc00209836c6b63d43ee695f135717c85358663d39944bab412134cfd66db5762c9a442145dbfb1f0d944e7f7b6d4b3648659b3b12a4a2c53bd72f9f65e7198957db9f8a0021f8fa17536fd1f70702678ded21a1c7035ca8f088961c04af7c7a4a5df96f0ea60020b7b386e088b3bbb85f1840ff606079ac9ea7f9d0beb62f5c7c5a924913df2c4a20a977ef35ba6c8f89af4b16d5903a1f0d005982c2826797c6fddd0cd2bca1b94c205c0b1932340551606bc9e2602bbfaf633de59ad8fcfe19c4050dac8c664937312028b3e3013ab25c7815169231b9b724e8ae2ca3bdb5fd17487d1fa39046cb77482053b98d7674de0cbba37c37751a7adfbc9c0cbf1b40752921a7d91b08e584fe35205372487e10cc1f1e2d524bb76bc4422d97602f7893c62d28ddae4fc9a896d0372067c5cd6065fa02b76a852744f9cf0b97d32a14ae4cafc94a52087f726693e13921963c3293684a500a48267f5579e77eda8f877d15e4911936d0f8e74b4d38d98700208be980fa8c412eedc13df4b6231e3d2b564296825f490db1e2eac607a355113720397b07219a89c803defc3fc3ac5fc258c8b54b39f53184ee13242feb50a0c62420223706f83565ebce2acd2c18f4cfa79edaf67508da1d2472bfe325e5f20cde47213dee7fcac92a23e8c1c1325e6f086d1c8cd27e47535899399c6e1e4f8784f0bb002014a117fbf97976c0c7af3a56308a4dd19abf6f6a7afb4238e5cd2b41ff3d8b5321bd2e9d0964bab0a1e554eb0a1b350928f2810c4fcdab5ab4e875005cb4a9e69700200e9fee09a4bce859bb38e62a7c74941cb0376d118f1738f06b8a517fb618ec7a20f90381d08f1fa4eca24bccd2e979d0f28710375da371378f74f991439ae08132200b7166584e050832e699ec020e5ae55f07fe8ae4ba7c2c399ef302fb1abf064320eaf6573fcce33c66ea0aab58eef64a3efc1f637b738ee51a95b162eaa9cc476a20e6540cd1e230afdb93aebba474c269c423facf47f2bd500e08961f7c0a4af55320a8fe890159adee60472ed604e73b725c36b2e0a1dc9dc94138a95ab43b38152920d80414b480db1b23a83530d76b6ba4768b612856f328c5d1f481c392bd69f670205cbf3bf512e6647b24098affecb63045ba48ee161913cbea137d89f8c2317e18213ca2d715f1dbf2f7d1cd1843584cee3c6cb663830c2566d2375a8b7d4306a7b3002067451e9fa32a3f67f8940b3d5ed7356e532ab64588a30bc64e68bf0f1754eb6921aab661ffb9e2489a080b5dadf8b66a01b4da585f1d60fb19803d7870aab59f94002009a42d8c17bc201a7683473c104361db25afd272558b431c7205c1ad60e5275720b5259493fe51d34e9e9f13cd027324de99208f62fc7088503d065bbd22eb671e20c2a1ce148baeb48bc4074806162c5081bbc4636a01d2947e2e511a8e23f05010217f78c01cf3b1de88c2b5efe4f1a44da7b7ad1d70de3a9ee75de52c21f5d9dda10021b1e53880cf898cc3304af3330d0dc20424ccefb35751124b925e132d89ffbb840021ddada2ffe00b2b281c447b8d03562bdfaad7248bfd3b82ac74178258c17f629700209f39211210bbb04910304087e2907c3a8a12ed4142aaa866b6916b3f17d1c3232113567eae2f96882409da14e61072dc3941a7592b816b25b3d52f3ccf8ba5499500217e8262ee95708b1b40ea9644b6307ff3886fa0159a3e28d6155e3c4f737e2a9000208a5f96711ed5da026ea1c3e40ec96a8c5860e871ca599c9ea740e3ceaab2480720cb25ebb06c94ad22dc7d529f3296366d4f65781e165de8cab751d4fe464da97220269dcf06c230675b405eec3bd7b1e99d9191242bb0d8f089d31f5d41d61e4768214635add2924737b775e5c252b8ec10a1d072ac4ab941d8745ace8db5ca7c72a4002025a5b0916a1b7e739c6926915cbdba2f4fa3b8b2728a7030cca4946362e3e84d20c5b5d7283e047fd80f2281445463424ac2a6f1aaf2053bbc3c136254bbade21850801b49c2a7eeee02072a84d52810a6e308b5b895f082b83827d566722f46f9dcadcc7437e6a5df1f12cbb56bf34473a0bbd93b18b130a8a3b98a08ff3212094ecf6309aab5bb96fc39e51df0828b70ed423b3ea325d175f412bea1f96c89ae4459987ad12891d24e968ddfa4f4c00e2fd4ee2d08d2c0e6ad48129c32fa7bc99c3681e3f7996a1b93387a10520949c62c2c64a0ec1889c5eb5c1313291a78dd7213244c21eb9a9da1b77c9ea77880305bccd24ffbbad2883c52dc411485b64a291bcc1440f9eba8277d0d8db1ebc00f874f52b126e99fa1d1ea5174c2556085a46a0223466cdbc23a9e217afdd1de8a60be75e11faeda6091a37299745789b6ade6800081d69088cb8d7bb502ead5f1955391de9d7fdb577fb2da28195a81f6902612316ac9f15ae160b2977310cee6660ecdac2fe9f801f9188635c83ae12a89e3aaab5ac05d3b988fb6854f17faa24d0dd9d29d79489ce3d453903f951a6c83bd4c5874482dc6b0e4883ffa65e4a955c45f7fe7ef32f5ec034595c8216cbc62393ea19900818b43280d3245ce70caa22225803eb986dc3353c37d798f84761ef12a56e00ac6dcfb4350a8e6f108b0f10a1975d0e47508730903e94a2ee8d9f36561d1fd2802bcc103367e15e325eec1cb09c86f40d632e9bbde8b2f6006b4981fed1772729c17d1cf3859e4cdefe9246ff6f6285450b520180f04665c25527cfc85da4596bf00804399c22b05bd36cc68e8e7b5c2625bc34806eed211d86887cd37742f1108acf1f06278eb9028eee4673e0cadd2a5e1f5f257422afb0fcc199e65728ccd12fe689ba03b50dde3957bb674b01baad178efa863bcd10de5235f3fbac3062933488e9b4a60b2cb716c5c2a9648aeba59eb3e50ae3be842336355c36231630a918900fd0001c22157003bf3613cb4e60bc0842ef72d03c3927ace3e35f79e7975e6d93593c1727ece0f9734776e3fd8354869dd0c2e36d992e493524f97875a5798e45ad8800d288ff3c5ed1c656298547b3f386690d20d323daa40d684b557ffdc2fd64c2f3f71938ffad426211d4e0fa1ab71bf2eab2095a61868ad51bc622506f95d2186870b9fd55fadcab4734a96bb996948339408559f1ab3d0793b6ff3830c22dcf8387590bfee93005b5baf5890bf9e3c925d40906e714205aeddb42376eda4f4ac7d96bf9a74546ca377bece79b690d870a560c3b1c4416b06bcfba6904392ba19214fe91184b7545019fb8a5c65e0a6919720dd962c91f98992177eeaec4665b6fd000152c7953810a6139a35d9ab44951eacb6d7f88b6a2d0fd1a05cf109d8f9b8092d1e970d6ef12cbfd2f8f901baae01d8830b8cd521e63300bbc1bc623fa5c0e48017333a631d42b0e71d1508e7b8dcc53fb304d4480e2a4e440c9e53204482c72d97b4d8561306d64030846c9027bf218567d607c4a2304df183036f1861fed60942ba64961824b80fd8a828499888f80a11cf91ad2fe187aae73605bff8a4b004a2738d56a5abf11f9b82f8ddd501443545bb4aeb49fe39b64c7a768380892c6f00f8cfb49f4594e1c88ceec1125a3b70e890150dace647307c1cfe715642756d5d2f6c28218274ca5668a3c2a4af4b79e70af8b83de56337b841c94dcef0c89ffd000109c0d936c59e7b389dd374956c37ab4b8978cf0aa5b7050dc50510f381eabac6fa2e91934b72e798eae1f6f43be168ce1ef600e7b9bd1bbc2c2c963cc1c777c41ea9ce7cb85dbb140bb01cd90bef6298783d8c6c056955eb83b7b9df63ba4b9cb4201cfc83897e54e269398be9aea1e293fe7131f92d22b1fe8ecaa22cd934980f4f0e1b8a91dbfbec640010d91623780a2e7647391eadd5a10bedc3efbbdbf189c33057605f1cfee70d8ced664531535abace6d63bcbcd12774d461c91e4c836a9534b35a735f211cfa324d74febc41fc9ea3e6e953ef555deb6ad348e35ef3be21e32d2546006d43765fb7275d10c47618d109fe806a4f94fc67940ee02aabfd00017585f2e215c1912e88aad895e87882da714c625143b5f1a9ecb9764ef1e1a1e654c08c70a2208e371f9c4b2aca734bca273072eb9cf5621c73ed442efc85624c10b0564c96f488cd5ed697fb7ea414c8f49f5668c4b41227cd57df071e004675cfe16914c9e3e018ac7e0b720b9cb9496f2d0e176ab2d611ede6e80ef5803566bf698e09b80a81c0eebe58ecda39093f0c1651fff5aff860c4b2e70460bb95da3a74cae7e26139d1b257ed9aae65dd4d86e240f07ea77f1691be722bf9855ffa759afac8a1e6c91326da71a1120092a914507c2000a167966a74c8e5fa8533078be90087d59fa75405168d72126667458525b6406849bc1bc9a97db49a37d084fd000154e8d56136b6dab9d5fadb3065668dab000eda7d2a8c47b342ee5c95281fa8e2fcebcad5a0943f2ddbc46390eac974b4b27ab9da4fb3747917c22305d3ad91b5694b312dfeb392b55df60cc8d4f6950bfbf4d5dbccee860d9997d2de34bba2335733909110bb273c2e36c15315fb79a93d1bffe33c358e2da4c238e8ae734fda09936a758f0713f720bc556381e41f76c29b7a02bd44926d5b2a7d818c788315c253a90a03b9194fbd581603e03a34bb298d8a6f4021b887ce813f3cccc17a2a7f6bdc5b50a681723890250c4e9050694c9a66fc587187973f209c1962bbc5bc7ff64fed7d6a171981b814a80a1cf3123a8dc622008cfac1baebce0dfbe52ab080209b50f0445fcf9488fe4818e96d8556331f20c211c60e07f1f80e3ab23103281a07c5df8d85c6fa1767aa997ab2dc3bbbf1533ffa8729bc02f6ed3d9ec12441576ea311a1e30af774c92f70f5d4521b1a67d0b7c1571c45e23785e70bcbbae1da98f8e2eeccbc67ec771a30b68e37f8a385820bfdfc7af405bd5375df20557cfd000167f18545407c8f34edfe760a91ca58479b4caaa3964af57568e4fe511cdc94e99919ac76e43c423dd4024457896c2367cb62da0ebe7d8b98cf79981256d870421ef6adafa61bdd61a9fa752a3102bdbe90ec1f9ea1402c855c2a78c5c09ee8a4297dd815aba0b346eb3be92a04301c33c83b0d02ea26a4eebbfba0b71667354bd8e6c825eda303b05207062b3b909397026f469a3dba5dbb851bd28500322b2b898efba194e9c89a97e378691c6c3587f7fe4bf1a3c69d31fb9195ea9ad626406f33bb39e8083452035038c1714d2753ffd79f62643057bff804d7693e014a80a9e32d1db6e9219e55ae5d59ca7f9615b252132a559ae8f0ea9bb70947170fd3806fe1ed3b59b8df259900cb793dd2f745658cb2cae325e988ae4259bf3674b40d952737b874531487ad58a38fd6d01435d4e14a87b0fef4ba40a2c985cc62ea2d3b6c97453c8bfc61ded2026a403939615b94db3ed5388adf92480ebe647d9c209541b9ab97a67f8afa8ba2ddc4f6621eac975806f7a2935a4754ca1281407254fd0001ca584567228a05aff314a6bb8db5d77c64cdc98049e4fc4e8a0dd02e94d65e494a83fd0573bf26071fdfce8455a8586bedcc9ec3912fb93c28c97c76fd2bd8cf7c77eb032f1b3d5f18cacb4d6e46d1d636e5423de333171621ac4ddf00cd140c8a31cfe6e1720b702f5977426ba0f341c5c121fa41e5f9cf72c676d7d8840760047baeef41a85ee0f58650fffa0dfcf4a354b4fd635f65d533afdf68682c062fa1ef3ed0345e0e6a4a03b2dd3fb6c1918fd4c6ea2e88efc1223bf72d33a12ec9f10212abd8e0d323fefe127edc909daf018a59e7be84b92ad9506be6cc080fdaccba9d0e6153e49ebe546afa2c3a5fd37294b035eaeb5a46ffb1020a5fe683b0810df474b799476566c1a4287bbd112cf2fcedd1be2cdb8707c55db9af086106f66a061f2f39e2ea3bfd1cbc18dcc049d9011336b2bcc240f731b3f45955e15d228656e7d41424ed16096607d48dfe0e2456d877645b5ea8f006b797958aad495cf7d57408484038b87ec99653b7fdc5b8a1ebf47b7883218bb9cd52eb8a22e49300fd0001310d818741b56832a1a31e3aecde85d578e6bef95e0d3321278f243dcf81ec7e2e6780e1bd4de223b5835f57184ea2c2edab2b870fb13f620b3124f2fc83740c26aa30b917680eb4a61a3d1e455928a6325ca2c330a74f35c659dab9219fc1ad2dc4fac28a8055bbc1acf272e294b21d1c3083c105b107e9ddd14314926a5067dfad3ea37c54ed50a5ac96391dea5fb553fa689d4166b8547b0af7764d22b31deceb9d8b25bd2edda13de0b952e8c062504896af885bd026edb9708bdb23617f0fc68a726432ea1c929262c82bb2be5f1536c6f88d33b308f8c929560caaf74b8fe5f840706e3e0b81bee0e46cdb134867bf8b11655fa204759bdc88d492eeb18093dce3035bac48a26fee7f6f5ac66adf63876ef22300572f528d5f482480e951befca94ed142ce71d311a3000d7895f2d9f688edd34ca44a68a09cfc4b685ef9f5e8a6d75e956e99a6bd01bdc002c94cf87861518df3a5a0713d7ac072254ac1d68de90d6a521348969bc2d59fbbcdef6918c045701421c92ef733b3b7c4a3678026ef6ecbb093dd60690ab9b7d28280a81598793788de0272eb52423c3b5335c844fae3a69374757a3b41e3cb2250e36d5e185eb2e67950782ecc1d31398965fe54f680c52b1806bd764fa2926377fa6f7f909ade7774b8a91a65049bb6862048d389c3536be88e1800ce95c0ef3477fcb5317ac511b78dde2dee12fe305773188132574bb60a5e68118e2373411b35dd42ca882b7b833c4efc20f1f3bab6cc6ff7036d48b2051bae2ac95dda94cc330ec1d0e3e09f856c7e36c44020b01a5076268aa5ac517cb4c9e936f958b7ac6f8fd67e961e083487b2befc7f923c559f6c52309b677fb090a604a6e9454c2461b2fa1574403fc2438fdaa1318c606707c0c600fd000124940c5f2606ccd649a9988afb6775e60891f95b91773924d7017af430cafcbd0484929b049c7a8372852bb695ce1748bdfbc150a5ca6a1519c06e5982c990e6b22f509a606337a647d9d1643522264b5838390e716cc8bd4f47bb8a0de23577b998855752c434efe432595f63529bda7c7164b321304afaa6a4adb71dc05c25f5e5294b69b21c75a13edec9f8c0a31243aa73ce6592f1bbc84c4705daef99acba57280dc92de02e17f1b28473f200b3e4a8e577312e51f1f79c06ea49f9f1a27eef83ed0749d5eb6534f9d8ce773e94f21407cd17154c644d8099b4edbeebf4401601d3e3667c32186ae79c69abb3c72c0e8220b2ab9304d1307a686c9db992808823b2b219c9f81d5a641e40be3eb71e841db1e43d571d3b225b5d811e9a0101b37891b8a962be19c7b127961ac447a847de4782680d3ced69df0c4f032ddf36d9f7da47aebba193b703598c12c2214dd41953a8fd4c2956d261c989d560d09809e6471d71c5ccefb171e1b84b806e1ebb792b40fba818c40a8ccbd07ccd5301fd00011813eadc77aec30750c84dd27a1dd089ec245bb82d93aed9f343f7cacd9cd49a22a4b516df334c6981cf57d9038700ef0eb610a70bc71dfb1f4d74ae3359835b67090bcf46549a2f8eb5e9d9573d6f2900efa6164528cb2298d488b7ba8df39748f6fe41ae04028fe3e171c68cf7954b228e0e54f266f447d9a93ae944517fbc95d02e898ee7f3619a02abed25e78cdfdfd3ee09521a5a1067790117d5641cde06554e7aff909ad7f7d8f67dbf9fe0ebd1f75856dd0face6d53b10230d2f605b1c1b022376c2f569d9849bf094f7b47e5c1aa5f88d3cba904de9fc2299ce60672c59b6b951ec15809a78e2beb4b64db2768a44d253da8268ba4d6b1517b03ba980ea5c2231b957018bfcb1dcecf26ef89a5338976732dbdb6f7354da85b62d1f0064a9c99ffbc36228487ecd45f4d605bb3a2f0113b756f61bd2d5bd7a75019489fb9b4807f90c78004233c53031f7013ff3fbfe9f37cbd657c61e071dc1e48a5c15f5b1cde2ceae555497228b19d2be443ef59e89067504c76df6197e899aa833fd00016741248c9db871fe238a8fd2a153a21d659c82caa6d0d5597a900979d10862ef7bbb9643b8423a704cdfc787bad8b06f693e0279e399125db92681391a88cd1f8a3b9d620fa3d29071d4b540fdda7d24886beff41e9624955bef1eebb27505487c6b650f941c5487db2d6a9de360fac13754bf6bdcacf8f5162e78e1808c2021468b402d2de932a590a22371ae513e4f8385cc3d54d6d8112d30b5053dee2767bd5d68b1cef07c5dbe79be7a13b4dc761b303625a35ffd50cd1a7a7607c34f76b737cad0a77c991efcc0f48ec0baea05350643839073c4d912d7f6d18ef80f1c42320c5a1949abf9500e5e027f84dd326ddc25b796e885f878be522c987a47a1fd0001892880727994f3ef4cc7bc3b009d3ab0ba12e6fbec400d978a7b094fcbd63826e5a2dbbdddb37042f9d488f82e0f6d64bcf88d327aea5615c6445c13424544d45e12007f26b62408c19eba388bcb27a32b549f048cdf1a9df32817a926ab34e130848792f71cb81f0dc000f5b640972a5d1180b3876e2c170e3ef31e27610e5db6cf50077970504de9b6354284bf12106151876524752dc34024d7c353c8618c1a0f54b958edeb421d5d521470bc1edabdd5106b7f89c1a5d52b36c7491d76d6d52c153e17e692a1ad389a57564aaa352fabff8b65dd9b18b6e76feaece6bd76f09a88d60cc344d1865aa7b97dcd9b7ee5d869943a0aca6189289cbdfd9464cdfd0001ba441f650b1c2d89d985d28731ee44502b189fa4ea4e283e9ccc8f5aa2026a3b761d9c83d2823ac20f780b887d2487f900c5f568f2059f44c2014b08d7886be7d6654dd8c760d82a2f4bc80e06760211321638b0c676bfd4254fccb74b497e866d33885345ef0a990aaf150fc2d36ec3a7a2b21b3e10356b6d7ee5984273f34f295ad3c9ba5ec4af588da45a4b512587181a89d3cf11cccbecaa9a590396b63f27ac3e157a08df9aa19867a7729910a02ef994441cb0a733d957c5e41351f8784776b45246159733c6818c817f4b7f219a68c13dd02b0410b037135025fd5a07f320f44a21926c5c243636bbc3a0f437294bc019a8bc8e9e14795ea712ded2d28092f38d55599ff2c0dd2650de43a589a498fba4d1920cf9557aeef01575efb7139b8cf10b6ea5ab3ef9b40d4a90977ab89c55a5af3fbf0f8a72197abc38dc6d6df406cc7531260a8d5e36d3ec1ddb95486596b45977c1559892fe96ee1ec87d54083c8e88fb75590898be9bb956ad1593009b68285fcd60e29a392130fcdecf3680c4f08fc6aed56784e471ad4dd0d0146e0fd41c4e17d1e660daa6fd01634cc52a48fc71402242ad1b9a1a42f254b433769f44f895ec40119b40a9f731e07d5b5a08b65c2ab225a933a92889e4da908332a35de27bcf88db00ae7f7d4fc3270b4fbe1cddd3934864c12b77d6f109704e9c0835742abcc29dde4bcead8b0c0a1a08fd00019cd781470ffc9915bbffff9b297207280aedf02ae6ce1972e2ee4f5959aa022fe22098b388eb542ca03a1af83a0f526eeafc95b192c2695eb74d1e55f6c61a950402deadb11bab08257124b0ee26ee87e87570aa7c615eed73c12862708012e2ad8775444fda2687455a0c2e79d9c87e2c8b6eabcc3622c1bdf14f94747086ef33aeafb3b282b1cfbfe7e20bd20e57a00cce137c764a07a8f25e96cadf0ac678eb79938cc592b38b299d77d3d2dccf1bc3ad3da77d15bade71085176833fccb4f4d813b43fedfea06496c732f0ff2898fb0a13ccd272a51da2c7e2c92c0b47106deb290f12f1927efd87500483efc37b35bcad9aaac18b7676d4356e9080cead811cd4046723cc636a017890c78502f131ed1c4f2bb1c67f5a3095a1f39362b5b1d769e202127eefb4c36b280265946cb8519af11524abbd4d0d35b83d9516983b7053f3c5a583f7616ffdb271612030cb06448ce5aaa264ffa9dab04c64cb246fb188fd20ab61d2e39695d47564fb8485e003a517b2f6267c9147da7051ed4ec6008140c144235a6b9076e23b97a81e347c8a367d9c12e0d775a378337eb3b78647fee80b99107d47307ae73c15dd22a4210f98a5e4b7ff6ca8ea79286ee5acded439f8633ce730ee68947fb12a323854ae232ce75fdfa99d274926b14f81e93279f5ef42cf7abaf5e4db9dab5e1ae0442e9a4816d9df5fd1c671ffc2ff9886c50ca400807db6e16ac5cb6fabb094429a97f7ae57639537b30b12f634196798cde9c00a85fef093cd983ad3f4d9fa8cc2168a8331f07fbac52c2544defd008d5d31905a6b4f57e2b786c091b019dd4a23167a457f2adef68fdd71a4989921698a451c323faa2870b78f555c3c30a56319393d5ba640ee9b0c43a2daa29c5c080b4dabf229814d08f0c3c7e21b9fa04c76c7d6c3f12509c060015fe82ffff8eaed0caf49974478bd49b94e1f710945a0c233577808d97d435f09f9193b1e7abe8aeacd1f6f142c9eec20d7427cb919262b8a81372af0523fd6c219b427477da7715f7f07d48f890b751206819b8693faf2c8f6b1cd42735ec457051022d063446c58e9e23a940081d24e2fc309cf1390ca944179e6dbcd7cb4e39832f3c8cdec876f8d964cddf3c27f87802eafa33b2ef393e59fdf9028f1add7988eee4140257fd5b420273d9bef73715569b0001ec2cbcc13e70f3be6f0dfae99b504ff2fda3a3bb4974ea056e1fa739eea46d38af1f2cf3ebdf32887e7ecbb570a3633c5e2425f29d24a5ef1cf00fd00016100ce85d6fdca9575406f04fbad2d9cb4d7f6fa1393be3c3d6fbd5eaf7a99a02f42b8c373bdd03f7c76a9de409f943519dabf438788e2d96b34b7743af43a0b01bf8a080615013519a4424a5ebc90cfaf822719f1fe59ae708b726307243bf7cc399be43050e8b9115ddc1cf4c2e0c4b2a6a9674b1b45584d7b4ca779eaac889dd720bc46bfda1ba2af747a8e53c2b3b857e1e5b607ea5fb45ecf8980250056134dcdb481bd915bab49031c6ad7e3faaa58e39952119d8729e317e15e864512f0bbcc6898a71cfa619fd5753a5b32bf98dead20f99284042a0a661297d468445d982d9159c44fa344aa2cde29454c7b08f3ff4671f23a4d062ec8508b67dda681c0fcd0346c255f430aea7066ea78b6571e8493274db67d253968f033f88c42a90f40a8298aa3db289f0e5ec038201892272b636d947f6ae9c6342e5f081db2b188a9d3f50b2e8fb396fe189ec082fa63fefdb33d11dc2771fa1fe04b23438cce2bfedac58a1c6b6819cb7b02fed3d74e8fcfb839df07bc474ccd8ee76cdd35bd0081ea358b44b3840116487e3f85d40ccef06d78c631423996e991df95018dba5db3cd0c639c4e76122db272e4a59cba263a26cf5877481b93714bf9d78b019e7493443c73c5af84cb6e9837b6d809da037a573a6b68cfd8bda5d02da0c50743e889afd72406eccbfb255f957ad00fc76a8c117d182363dc9e914dd3d6cad81e32bf00fd000133a5e5ee9bcd22e54c18d8ac925859144d32339b2bd00c32e8f98b754cdc3495143c425da51b3db805aa3884ea27c2ac815e4f5575491bfff800fb5a3c1fc0120fbc33d53ca941115350be844493da6e3dc40847fab916235bdb3409a356b9528278102b4d96e93c27c88a081bf0bfc4462ae6a2e340832ee0c76aab12f192f58b4fb5fe386cf566a762f83bfbb88d1859a10d08ec78b01536c3dcb69e9a441f9d2e947e898dda40f57fce5f0e5184d93935fbde32cdb750c51d57cf7c2be917fa299a01c41f2a1018d435380632735f9ad2e958cefc8837c21172bfe67a574db3d8223eba4d0327850bd5fff38459d4fb6e00715ba7ee5355605ea0de209ac7fd000112ffd4061db7a6cc8477b6145a93f3e6fba20a368be255f4e435dfa8c746ffeda600b87dc3e5fef1ffb6e917b09319853adea9701d795e244c4937d25e0cb0c62bf4f69168aa82ca022f6a28a7b85eb1e8eebbbaab30a61c785e19f59232d273d936e4ce4b9c62ebb3ee2b96e90a5a4ab633e9b3704fc0f50ecc5b9ad6f3843576aae92928ca7c8d09e3b87a6281328a1482bb642005cec7dd57f3ef9b1a167387511eb339412c109bb94b57c4e46e3f33d6fbbdeee42e60ebc9f44f7530b86a94bd9a9acb974c76782e954e295770716cd216b83036fee452fb2f83ef077d673f1126ed412c8d9df216b0cbc72456ec8e2932de9539cfd562ada45a389a4d8f808cc78aed67e86adc2cabd1bdc0b21969cb52b9b1f1a1d808d67d8e8bd478f293d9b81bdd65949f5ea0bcf48c6fd5995ec992a273f6e335e7e6969d008590a961240af5ae24e4410dbe1c6dbd001f77406731348a0dc4ce2f8a683e4fc7a49c659207ca2bd8fdcb31d39e58a8c75f76031d5b65d96f0f1af90da9306f019332558135064b7f64dbea34cd68c039d4dcb703f63a0a1effa946cd1c9bed59a956cf85b358f4db3118070265f8aad6c540b066f29852e005003666316066b324cb037b9b5fb6ab8b2908b1b5509e9e0ece6345cc571c84f83dd0efc128ff27a1b5dadf0a0921544e9490d13fc82df1939382f1b6170e8ca99b38362228da418dd219970081840ec70b20c096e1be5b162d058c5c6db0b672d4e555effed3ec8ca85dd69afaca09d85cc206d179994b6a0443ceb4e65071ac7a64842c8a6b2eb8f89519dac433829865747586af18ed1d8d864b75baed59daf5d08931cf47dd2c802545505c9ae8d351ae00efb35c5725f8d3cfd87c7792b084096af67c7f63bccced4a038d00fd00013449e73edb7c7fbb2df81482f1d22d02eab854f7e7a1362e9a41a95d0a8ab7bb68816dd19776e0cde728b6cca402b4271b384f71053bf501ec8cf40167b76661d11aca1ddf4c47421be72577dff8be5ca3461dc8cfffcd99fbd7accce7ebfe12ac6c4f8d265b1416464f2b94cb93b40957eab9e01bfaa4e33948fb2de3cb093db74e914c3f048eca8699735e3693752fd59dcf48cc92b63594b8595052ca405ac9191c6ad3cf08c6d92c384a8eb0b643b57e8b9f91ad94ba1c7f5d8aeff0baf1a905ae1d722af5d1d4da2e56694a7857f99c114eb63d6914b0ad466b6ff0970457730cf6ebc607b1064ab3e792833de818ce7f47fd212d98dedc8602d90a08b281fc8f5ebc335769ddebdcc8fdb0507d0d814fe95333b151b6518abc1221bb431aa83abaf371451e4ade47142b1c1159b372fc95380aa1697935bda8ac28ef6bab6c69d6871ed0242087f1e69f4ebc71066bac94040f79e5fba35c0bc9085546634d5b1fd7f5c85577fd7b645845ec87623eefaca134432ab7663dc7f5a66f55a80081cdcb09b132c40a0e33f8f9c47fa993a3d3c78f5b4d8b7c0ccd2e343cfd78819fb9d6556e3ad0acf67c85cf5cdd9335665761a091200ce34bd81172e0bc87efdac66ed1d4d849f9b1e94ed2db44601b8f07d85a173a6ed9a76ead0a21d48421a608e17baea8e9a6b319c0c41fc5917263f6c93208f9fad8ae2b2eea2f702a2fb60080f98b3379369444ffa8fc207955e7b01575c7007ed19ec7291f28b93db7aa7148bffb9f98f7e3ec1e1f21568ad37f91c4603d3f276ff0fa7e9ee8ade05c277775c3ca2440d50d427a23f7aba81b8b1b9bf3ea8fcddcc3c3a7708601688fda8a6f41d0cf7b5aa4a03422f332012ede8fa6a9d8093980f07b87092bc6e48d5ab343fd0001840e370e28d6cfc75778bf5612efae6c33b4dea0c4964e810fec77ef1875956edcd2e22139a485fc4515fe44c57149905efd72b16f4b367735c1e91727632507aeece411a472e4f270e0bde542aeab9961d4fd0898b821a6f193dd42391de664331e33b9244e0598669269c73125b21765f048e0c2b9d17aeb0cb3c112a318040ea4126c43e0f46d1d9c1304d95f35b875cc2fc3964970e3602cc51f2c496f108f904e2dcc8113223a9a074c344b42662c3fa22490db6ac63a1b9abf0dbc97feb0f4447eed2e96f33f854f695ce54e24b9ec180cddc752cbe66fd361d874873ea3733a4ad92870b24efbd22e928deecd7d4293b680843d75127c0eec3f07f894fd0001266e0fc8977335a776a66b44c25dde8ac3f40f2d195dd3845a0019b5062043d1e1f24adaaa3052565db20717cdbd769bc1cbad88c0fc6a205fa4acf472f954d161c3450cfa0c622b3dbdbb2813af60d47870299c1f3d793302c678a2d4cc7705ee51b675dea5955fd7ddf184cad643fea3f1a428b6d49da35ae251744cca95446811aa79d4edbb1399734c3b3d71c7ef455eb73f72ff013938ff65ffe3d8cc8ec321328775db8884cdbf9645cedfb4d86bd54cda89c7a4da2da5dda4d4f459518e058d3614a4a9475426c64a16bb206d2a02decb9e301ede48dd0247d36d5b9fa1e449f44f6a3ea7999f31259bc49ea13b62cddc0f877435901da6f9cde2e4ce816565e8a37e36ddc7eb0d1363f2d0641db79c0da0fc7346cbaada28e859cc7bddea3653151df18260a7609aef925c9de21299857732ca58631eafe768ec58752d63a48b65895e428bb4054b8166e61beb6e8127488941601c0ee1092f695ca0fa9d7b965eaaa4dfdbb9fb2127a75447d02f64bd3c4f4e285e781b02d98b21089000fd000118a3777a8b2c2a8e5e9f7fd85ac71b6e843ae5ac31d3e192b73c830a33eaacd7ed6f9d5aed4754b9b6af55e60dd31ced5d74d2910c2e9a500dd3fd8e282136337919b3e8faf81a96315f04588f7a86786b922c6ada489eb90bbb8b1dcc85e8f6c6d3d5fc561f4ee579e9143fa4726cbf168119fa5e2b1539327327f00ab363eb065aed240f5d120096951933dd3e689118d2262e01e5827c120f53f80dc8c7207f2b633aaa0ebd350e65882d7e9069190163975682eaeb8570c6c297b614a72ab6a6c3276f754a7fec8ef86c50ebec46bf88701ce0c3037db989247de5ee7aa731ca30af5bfe9357e3f0de64160b9ccdbb0eee9885478a6e9aab6902227933c8800ae488d64c37f7e8713e92a1ef4da540c5da96b55f67bcc7e5b3a0950e75c0e75edea568a951e213d8713c034245f6d6e307cde14b2d7160bb2ee6628d3ab486d2a0a9c760478b56003f84f6ec15c6ecc44ceabd1d1007cbb891c005f62fce138af30cc236c0e31e0d93be2f94b9f3a7ecbff058bce5fedd4bd294ef8bbaa0588002c6177026c1525bf82d44c5458f84a9105b3f6eda233d83608b024ab3aa3646a9baa480c983df90f90be078d68a80292b8a609180fa075f93e99590018c49e8eda3098caef604bbb643ea3e4a0ce82407a80a13e5f5c786746571e74883e7548d881a9ad516d0b7ae5018ef44a5a93e227057169302cab4666a35b3b22ac678fd0001df3435a26f04bd17de1cf54277d5e8b52d4bd552f2b27115e6c65a252007b889c3d5178dd15259d2216e0e3fdbe065b38b5f638fbd77ade95f13882aeddcf59d508f0252647a0d705ecada91727ca37541f25aa4061a9ca2e3e3dd2169ac00a508db5661b41cd1b626a5d64e9a093b3509d86c122264b53c5fc95d013c6b8d58a9faf515af46d5d41610ab99555c2c3ab363d604fa147b0f1bc86a3da26ad8a4614e6a27f84f58b02b698c232d6a6d864e49d1fc95aac2fca78e1483c53c6344a731ea31261a19bd5b7190d9ccb8ed161d963d4949d17bdb8edf19d1bbd0fa9311b2d5f2b3febc5e4dd6e3c6f2e169ac81a671aaad0723ff8e6b0228ce57ef8e81423a9b6290dbbabe3ab5e8cba4c4e6453766806e946f6261557c2b23c05e7aace181919a12ac324fb26f709ee0eca8b746eeead2b12c13f01c39d5b117bdcdd39fe102d66bccda50456e8994ef9924e22ce634ae801c9cf7ae24d72fd568379bb6650f77af9dbaeacdee02719fffc07ad660fc01b84dd88f35e6f97ee3c977b40080a08b918b6a42c1e2cbf0231135b5a666a371bce41d2b53ccb47dac374dd8a1b9d0469281570672916c4841692a836200f9d4dc3d69b71fbf6a51ab597c6b11ee6d772fdcf02350817e4d85f79437b5aa21ed0407fe9689128f9166bc391ed499357d91b262930834e96b1fa8505ebd15eaf85ff38db7ff5e9897c1ee9f5f883afd000161acbe21f4e6258c082bcca1879e68a20989c95cd5f7fcd1817b807d6819263f1d32cd7882282db7bc2a94b5ad3ff053198fb7d89b51c0df65493652932b4af07023ac9a84793269798b2850d1296aaacde7fe3eac56b88ea9f6656e4576b58ab9eb13dbffa731c6c4a57c2d06fdae1ca33e1fd07851afcc9d5c6021a1e0b3524c72bac8c9ebce52290043b3596e9bd0639220d164fb41017e08c632fa32c798c61c643af591b15148d585dba6baf61948e53d74a42afe3e45505fa249c6b6429cb40108f107983b50c8acf42c9822527413d866f3605812c3665263b0796e7a0c632464c131963eb1b39eb54b6d117fd25fede83fcfdd5bfa3edcee638196ae80213f7ede12505476e213d56a89224818d5764679824cfb61f0365494e5a4f26901aec701421c83145e75008a4472d66f06ebb3af51b886a2325ec482969d59a86dfadd0073596b1d47545699252a94475324ac07619c4b2664ee6f3b83dfe1c7ef6ece6a73f1040016d887adbe9d8e076de14815f8ad6bbf89d82b11c8de622d8094d122e7cc525f099280b1d3bf5557fae729b8b4287fa3f8a92623ac0cd62ab57a10f3fcab1493385a909c09e80ae7f7f0d8bc7459ee95930455412ddada18aa6bf8f8d98e5b7402605066cb4b6b5ff5cab305771cec6fd000032a289a8722d0a402afc66696798c6106be690d05ada3add2ce5947851c79dbfd323dfeb194718127e1ab87badfedea9cf54d4cccdbabf719b5d4af7f3697343b59974b5e263687aa60953df4a207784484d8867fef51eee561964b4b085ba35e822c22bf33e7fe10480f5a63666a5c654c350390521cc06b63b9b215ab1626ab9bbb8fccfd1076140cc362ef54ac515a2c924781db8d102e9b8b64149ebdd98bb102cbe31305ba0081c572ecc50846a7dd2e812f5965e3b12f571dc933b0bbc7492e8d4a593191e01ff9895d3807afded49d76ebc51e0b2b0072cf3baadea00568925088a1a6b1d5c659fda5a6a9af46329b067f5ef1f80b2b5ac6bce86c909f96801fae3f620b9435f49621a88f47da90ca9d7c8bb3d52a01897b92f78f60c64c9b7d9b2e7a1503a000fd00012328fc8b7f3b07c470ed2a03147afb9dc212ab82e70241794f999e711ecfdc51da0413b06167d6873a91a8335a5b2df0cf067681355bce28f19f5fe2a5c74dbc334d077ceca07c981b94c89f5b6aaa03b70fa4a2691be52d76461356320efb66d1d30a771132b6dba09c35de3ac8d46e9894a44a5e3757f17d2c218962af03aeec834380e2137479343535fd8fce9f21cdc55b3ba54a8830892a1afe865c39804811be558a668764eb6c206306132bbec65d21de4da92d9da947e28bf1fd72dbb246f3d5a32bdb7c2c4c6554c80513858b8b863f66f90df7b84299ab692b4f638beced0e40179b25ca27cadae375e6494298f1af1a9c6c8ca4c27012bd5a578dfd000100a3219c72f3226a3dddbd68ee35facb6b68f03dd8224e56e3f09fb6c1e8a5828471890b83eacb0acb587e1dcada3daa1bcd82e86588a3bc4258cad212f965ab7b7b67f1a201c3fb65fea00edb539524c439bd574a52795c55307dd5c69303e9acbdd82d227a866708e391d39f30a450876879e9e96e1166af40843d022a98b6fed4a3a75768ba478c8c51937b0feb9e714901bfb03625225c8f6079fefef5116d58da16284e292538496390666b292add9794937abb940b69efc3689de9a1d881128212f3da736d62a629ee1b5f0d0b9f14f68619352a190694a31d7cbead5c6e88e92882d58ea2b4b2d7fbd9a21abc42fa72b751c30f4d1dcd2b1d538a9ac580ad45380cf5586d1862e7b5cc1f5406e07ed7c9f8e2d60b51fe478c8cb1d0419eb74699935bda7fd39e1bdf588eada0a34c61b50952c015c3348b140b862124143c5a6bff8a95d55e96af5282d0d6e75de6b4d018cbe8c314e0e6ddc58b3a9769629e7b668119695c7454a83e476dcde3e823545911058b4a3c63e34d1045296dfd0001a2656e2e929437093f84eb1f5bb7128ec028b07421266121318b060f0de4cc8a979142cb6d18ea76af9e768249b046b79e6c134300c686c706266386af960f5139cf50208344458dedf8427753aa31c102e5a9c27fded58c1be68b6eeb1e7486bf7ae4089f189ab4b2f4cea1390749082ad37909c56bbd385a3d0ca67777c50c31b60a9055f4655ea679c3fe517e9c230a83beb74707d7d3237343972259908c0844814e73c838a8f476238a764c89fdb7dcb41ea693d81e4dd679f51cc7563e0b317336eadf517a3835e2d23ced4b898a4263a37ba4c40655240d10cdfbd608e59a960b3bad9f86945c4123ae65fee8cd0b11b8b3e4ce9186fe40a0d184a7b2814d798b5e305448d9efd326751ac2b5135e377165ba43f41dce4d20a469df4d161006f30ebdf5964229057ea556cc9c94da42385223d8d4a9a68c98452eb4eed7efc9ac9aec7e115e6f0ee4dd8a59f0c3af9025c27263a0493704548204fcc9d9100493fab6bef47752ed0c197c7efec06868d5be4c6a7085e44142d0681f9cc600fd00015fbdb2b09918819b56dda812b5213c0b2ad01cf668900c07402e80b28de1286dc3d073e305f0ab61ce03c3b5dc6661e8607985e0db2494ef615d15200cd441a409d6b579352cf40d8afcb386f2d2e6b193a1d4107ec1dc395c5fa542518356a5d2e60281396b45373a88655a899f0440964b6897e59bc6e4975ca80cfab2329bb4ab9e64d55146acbae756fa01de037ba67f1b32c1e3bbe3c897d442d91f2fcec723eb41ad81ce587f89362480642981290750dacf2d89ca70b317520c13d535438e7b3baab43f0f9470750b3bbae829dda95da000ecffe01a4c78d0c62c15218a88a31afc3ef3f8af914c5975cd9d279491c849265822ee1acc28384e5fe0bf8037b0d912da535403f5b695565c69b8b0354f5ef2a7984ede9b647416cdac8e9693dbb793a8dd01624515b5839d8c9df43185e5a534b02cbf5211a5a76901a5f290d235514f7ede4c384033c438aeb13e916b0b3808af47a069d98c7558bb411464d4f6f47b9a27b0c108ee0105accc00990c74dca25dc8670406c9515b6f381d819ee591e0d496a46333f86fee821a2a99c57f033ddf7f5a5ae2ccad12fd802e2466086269dcd30d5bf166d0e75e78ffdb17314b500eecced0eb89fca7b80e7b072c1995b83aed72d5b033c20b31eff559d64541d17a97875da9075fbc3f2ba535b2cef3b7162a395d150634cab96a316c7c53d4ea11314a33afe53001e41ee3c50081cbf279e81c999aeb762f1ac725354d6e4b1fb7c81630dbeff0b04745dc66616ae25a2454e0f0360bb18079c1c76ad458ae27b904e5b878056d0e66ff205eacbecf2abc3742639611e2b638500423dd50fbc25f9972c1e4e9c2d0e84cd048e6c7cb22b11b3a2ff56cea64b7bd061ecc395a4d56c24be981db2975c234be0b2f81008005b631efbb2fa8782f143b7de38c0de7fd23c704c474c76ae0d36e8995db201572252634de4493f1e88f9abe2635e004a84d27294256a6515b003869890d730d1b9201d75b3fcbdbe0732d4c14543d1be2ecfc827546b7be930d1028972715e99693f7daa4a8a240248d07912d9fdeb64ab0683ea51c2f4d3dcc6787bae732528012df83c70e6e3600f7e891987318ad29b9289ea6b2e2bd82ace318eaa84c2fd8a490b6d34bbe6a75655a09a29835a26a53cb859c9930793f1ec0e3b178c58bb860145c5291f5cbed4c3eb998ac512c603964527e1e5a0f5356ed48b3d0a73adec895df93a5ef9284231cfa621ff60b936bebf4aef2a744a0fb7d47ee5f43085e802f80d547703739c5c00e8dc4a72cf3995aab570f821f775544c3901f2dce970d1b4129e4c28b57e8ff266329e0a37b6931fde5e5c54922291fd305a948afbb18f9effd5d0f60a60d35979ea239b80e249ef70b39f36ee312a4167e0aec0aaf23bdfcd7c53d64249c6351a87f066f8f9845901b7f757a05e0a463133e4df6571981a2c26bd1cbcde2cd0690917112f976ecd8be98df9d99fe49f98a11b45f5eabacda1ab4451ef9cd3d1abde3ab3961a3ad111786470e3ae064b5d3b5a16576834cd64ecab08e6749aa502ff3b7057b7ff751c234ec9b08ea5e4e0b55604114ce837b6718e2ebdd73d1b4cdd2307ed0f1a6123f4e3433d3c3fac7f08a89975ee59d00fd00019612c87cccbc8ece8380fb088fe8852362b7702d24848e60213f33efe5ef71b6d76dd868998e2533cb85964221e103dad6049dcaea215a58610ea64eb88bcf4570a5cec9c88ceaf735f4d77d676dd6cd2abdc1c2a9d5e8d625927294a464fabc08ed5a769e640320af871b6c10c0b36ca09c398de5de8932120719d2e71c481536250d2eac410ab88c4970c68b996f15e4fcbd4090ff80f8677d55a8eb1274436ead2f15cd0f0a141d0706fcb3eab92392ccaaa36bd7f4eb816062bf3539a4b5483191667b1db7d13b5d043ff2c4a105cbf74a5f8450e16ef9e56c521865117cee88c49480177b5507d2916af69654cf760c5c5ec886878c27c2d3c8188072c3fd0001dacf4c63a866d5c2bd21ecd5441afaa3767666957dede948dec007df174f22cd53c05bc5cd2a36ca827fcb8446cbbed912759302cd005ee6a2c69454a3477db36bfac8c9cb9c1bfa913cf4c43f72ee57ad9a4c9c8f5551af8385d855226e2f18a55291dfcc1ae5d60b8a79d840cc539b926be1983c2f16067b104e2c63d8253646c89d31ab4c50f166105a04c19a10ff75cb467ee83717ed391c72464a7fb3772eecc36434bf946de0d03a4d4a5de6c4bcf8ef8643322167d73b424828c43a14dd635cd9db1313e4d4ce5254746fe90672606a0ae15ee5dd388732ccc0d3a4aa489480e6ddf7e6e0556d469166a96181cc439500ee7823f496be42c2950808a4810f484d78b6727e793fb2bd80a89e39bd21df6fb17584aeacb871ddc341cc6b7d10e0a476619f4a1380db2776c4a166acb9109a9a4e3e0d1c722b1cfefc135947ad866938137a8d8af919f4010e380f0d4bfd086059207e5a6155a66325355282a7453cc87c698fa58dc8c3575cd81649ba8ec17ac529ca74957e55b9f4bb56bf00815b9bd44f0df8280a75a1c07da606fbaaa180fd975cf0fb680960c3c3e6574f5db9ee72aca6974ab6cd40306bfbaef658a3613045af4e85edb81331919d3b9fbaf742fd7873c20c7ea1460abf68aeb1af6f3cd8efa6e8c072220c3c5aa34f650d1d946e400bc038be346c92d63a2160048aae8acfd9d14b707333ebe2264080b700fd0001d720e0212231342c3102b8025ed9be48f49d2e97999df5268fe485db4b86020262c62548456cea96a3aaae658ec4fd624269d96faa62933bf6da9f251553dc3085f61ef29fa80e09d651423fdb6feb6ec0fbd5a0e5cb370aec10f239d2858111df0053151f4697104af362d12224e069e0efe3d23f3580fa7dbdbbe2021882b7236e1cb6e589c30427f5afcb414b96b5223fef25d08efe1cc1b94727d05abd7b5fd828d8be4658e0f4467314f3623fbce8484fb58258fffbb0dcd775c78eca1ba6d0a125412db9915de16e6a7bfc80ce05108d8a1a29ffad260498f3d7d505a729b6d80f78cd7c84176c02fd37188433a8481b1ccd90239fd7e7041e2e9bacc880eb7e639dfa8733cb68a4cfabfbd894e153b67e939cdd425a17ef4cdb3c77b204dce1479bc7205b856461de37523dfbf9ea529fec53f78e737ae178bdfc1ccf9eebb12eb9fe4dba614698043db45384cc80ea339e16b8ddca87fb472f2a9ccb2b5152cf06306e3fa48824e5a3fd37e9552feeb586f426737baa0cd20b922235638096033eedc83083b149b489f7cc907ebbaf77e0a7145e5aabe02dc425aee3602ee5a8e33a0af6f84cf8acdc541c7a1626974b21a88088e9f42fa879852ecbdae5df0c7be841051f73c86d5e9af4296da7b84756afe65101ad68ce8150a4f44894c9c3883c7db6b9a8cd7080842e712d37180485ab416d4e4a229270337f4c68491f5457ec9b3b6d4ffdd935903f8e4c036db95e032911714af527430baf622582e1fd97f6581822672800bba9ea246ea960aa19bb71102cea154dc463f4a020561e2a40e835f9506e2c1bbd37b14bf169fee9e41d94d6481153999c6486b28361ac1db2896543a42d0e8d1feb8c9f038e3226b19daf72d454dfd6d9928beccc3b3132d1f4e996ca49f276000e9f48d9ef6726c487c0fb0ede75c69464278892803a74fa9ae56044cea55931ab6c214fe440522aa3770963ae910e8656eb8abe6d1ba0f0633644071a1cb7dc1111eeceaa16a2c3ddb66a555db4c412337dcb28895cee7cfc1dc8304a16fedf2f7de4fd1160d528087c2f55ea33a2c7feca95ca24dc71e1a6f0d978bf0d36bded077f5d55490ee150f2f83ed8009cbe76ecf7f922b047052e83da4706ffc1e2a4f19b3ce0f1c1ca1279bb60d8b94069cfb3fb5c328d63bd821e47866b6902a3c85a02cfe1be4664418a32eed422709c5a536648805b726b053da8269fa65e5945c3f0897566fff4a9aabb4df74fc48378fcaf9cc69d7cd820d0dd682d41af39663e3a12ceb63a4f5a875d2a1df3aa924270ae2d4640e53f8edaadb3f53a8a460dd5c7d3c5cb54cafba1911314d809091d593083dcf397a2e4b9258ced80169c0d7728b869be03b5882045a1afbb0275b1073bef509f2db72fe133df00fbb27ee2ef6ce6fd0e2608387175de108b1fb40b74746a337531375bee5563b9b2ee6b9d803be7bf52b7013f87bf4b7481641b2ab5479fe5bab4409858506ebd120c8350a53ac86e15c8c12485ab9f58c218c9e2f44a39633abcc333017635b19af3330dd4dc275e9848912363a85e7cb3e91ec588b171e936af4a63768edffd74fa05a2fa9e281cff6eb2d801b2fbb8e208dbabdffd387331b9239f53a80414cc223a6230ad96143e624f210d541de65584ebee32586c31be681dd2527d2a52576744ebeb91735f4ec6cb2f4bc8f94dc0f810fbab5e14304c370ea8fa4c208376712cfedf6dff2c4cea55968d3316d87cc68f0ea97eb59e79a5822b9e6e69020000000100f2052a010000001976a914b9e262e30df03e88ccea312652bc83ca7290c8fc88ac00000000 -0a2096ae951083651f141d1fb2719c76d47e5a3ad421b81905f679c0edb60f2de0ff12e20101000000015d29bd6aaefc76d42e3f23340324be0d235a35ff6ab80187be75f3c3d9cf8c44010000006b483045022100bdc6b51c114617e29e28390dc9b3ad95b833ca3d1f0429ba667c58a667f9124702204ca2ed362dd9ef723ddbdcf4185b47c28b127a36f46bc4717662be863309b3e601210387e7ff08b953e3736955408fc6ebcd8aa84a04cc4b45758ea29cc2cfe1820535feffffff02002465c7090000001976a91429bef7962c5c65a2f0f4f7d9ec791866c54f851688ac001194fb180000001976a914e2cee7b71c3a4637dbdfe613f19f4b4f2d070d7f88acf8ec010018f5fedae10520f8d90728fad9073299010a001220448ccfd9c3f375be8701b86aff355a230dbe240334233f2ed476fcae6abd295d1801226b483045022100bdc6b51c114617e29e28390dc9b3ad95b833ca3d1f0429ba667c58a667f9124702204ca2ed362dd9ef723ddbdcf4185b47c28b127a36f46bc4717662be863309b3e601210387e7ff08b953e3736955408fc6ebcd8aa84a04cc4b45758ea29cc2cfe182053528feffffff0f3a480a0509c765240010001a1976a91429bef7962c5c65a2f0f4f7d9ec791866c54f851688ac222261345843445137416e5248396f705a3468364c63473367376f635356325362426d533a480a0518fb94110010011a1976a914e2cee7b71c3a4637dbdfe613f19f4b4f2d070d7f88ac2222614d50694b484233453141475069386b4b4c6b6e78366a314c344a6e4b43476b4c774000 -0a20914ccbdb72f593e5def15978cf5891e1384a1b85e89374fc1c440c074c6dd28612b90201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1803a1860104dba36e5b082a00077c00000000052f6d70682f000000000740a9e7a6000000001976a91436e086acf6561a68ba64196e7b92b606d0b8516688ac002f6859000000001976a914381a5dd1a279e8e63e67cde39ecfa61a99dd2ba288ac00e1f505000000001976a9147d9ed014fc4e603fca7c2e3f9097fb7d0fb487fc88ac00e1f505000000001976a914bc7e5a5234db3ab82d74c396ad2b2af419b7517488ac00e1f505000000001976a914ff71b0c9c2a90c6164a50a2fb523eb54a8a6b55088ac00a3e111000000001976a9140654dd9b856f2ece1d56cb4ee5043cd9398d962c88ac00e1f505000000001976a9140b4bfb256ef4bfa360e3b9e66e53a0bd84d196bc88ac0000000018dbc7badb05200028a18d0632360a30303361313836303130346462613336653562303832613030303737633030303030303030303532663664373036383266180028003a470a04a6e7a94010001a1976a91436e086acf6561a68ba64196e7b92b606d0b8516688ac2222613569644363484e385759787646436542585358764d50725a4875426b5a6d71454a3a470a0459682f0010011a1976a914381a5dd1a279e8e63e67cde39ecfa61a99dd2ba288ac2222613571374164346f6b534646566835616479717835445432315254784a796b70554d3a470a0405f5e10010021a1976a9147d9ed014fc4e603fca7c2e3f9097fb7d0fb487fc88ac22226143416754506774596341344579735534554b4338364551643563547448744363723a470a0405f5e10010031a1976a914bc7e5a5234db3ab82d74c396ad2b2af419b7517488ac222261487538393769767a6d6546754c4e4236393536583667794765564e4855425267443a470a0405f5e10010041a1976a914ff71b0c9c2a90c6164a50a2fb523eb54a8a6b55088ac22226151313846425646746e756575635a4b655667347372686d7a6270416562314b6f4e3a470a0411e1a30010051a1976a9140654dd9b856f2ece1d56cb4ee5043cd9398d962c88ac2222613148775464436d5156334e73705032517143477065686f467069384e59345a67333a470a0405f5e10010061a1976a9140b4bfb256ef4bfa360e3b9e66e53a0bd84d196bc88ac222261316b43434764646635704d585369704c564439684247324d4747564e614a3135554000 -0a208d1f32f35c32d2c127a7400dc1ec52049fbf0b8bcdf284cfaa3da59b6169a22d12d60203000600000000000000fd4901010094140000010001eb44148fbbe7c36e1406ea68701f9b9dd5e10f3aeecbbad9885d73846bf0891932000000000000003200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018adf080f70520002894294000 -0a20e5767d3606230a65f150837a6f28b4f0e4c2702a683045df3883d57702739c6112d70203000500010000000000000000000000000000000000000000000000000000000000000000ffffffff0502b4140101ffffffff07004e725300000000232103fb09a216761d5e7f248294970c2370f7f84ce1ad564b8e7096b1e19116af1d52ac80f0fa02000000001976a914296134d2415bf1f2b518b3f673816d7e603b160088ac80f0fa02000000001976a914e1e1dc06a889c1b6d3eb00eef7a96f6a7cfb884888ac80f0fa02000000001976a914ab03ecfddee6330497be894d16c29ae341c123aa88ac80d1f008000000001976a9144281a58a1d5b2d3285e00cb45a8492debbdad4c588ac80f0fa02000000001976a9141fd264c0bb53bd9fef18e2248ddf1383d6e811ae88ac8017b42c000000001976a91471a3892d164ffa3829078bf9ad5f114a3908ce5588ac00000000260100b414000037ff812f8ad1814d4acff9c45457873553fa2ef12602c1386ec6894e7fbb9b951881b981f705200028b42932140a0a30326234313430313031180028ffffffff0f3a510a0453724e0010001a232103fb09a216761d5e7f248294970c2370f7f84ce1ad564b8e7096b1e19116af1d52ac222254416e3947686b7033316d79585267656a436a3131775756485431344c736a3334393a470a0402faf08010011a1976a914296134d2415bf1f2b518b3f673816d7e603b160088ac222254446b313977504b59713931693138716d593655394665546454787750655376656f3a470a0402faf08010021a1976a914e1e1dc06a889c1b6d3eb00eef7a96f6a7cfb884888ac222254575a5a6344476b4e697854414d745242717a5a6b6b4d4862713147367655546b353a470a0402faf08010031a1976a914ab03ecfddee6330497be894d16c29ae341c123aa88ac222254525a5446644e434b434b624c4d515638635a446b514e3956777575713467447a543a470a0408f0d18010041a1976a9144281a58a1d5b2d3285e00cb45a8492debbdad4c588ac222254473272756a353945356231753947334637485156733670436356444278725176653a470a0402faf08010051a1976a9141fd264c0bb53bd9fef18e2248ddf1383d6e811ae88ac2222544373547a515a4b566e3466616f386a446d42397a51426b3959514e455a335866533a470a042cb4178010061a1976a91471a3892d164ffa3829078bf9ad5f114a3908ce5588ac2222544c4c354751554c58347542667a3779584c3656635a79767a644b5676315247786d4000 \ No newline at end of file +0a2096ae951083651f141d1fb2719c76d47e5a3ad421b81905f679c0edb60f2de0ff12e20101000000015d29bd6aaefc76d42e3f23340324be0d235a35ff6ab80187be75f3c3d9cf8c44010000006b483045022100bdc6b51c114617e29e28390dc9b3ad95b833ca3d1f0429ba667c58a667f9124702204ca2ed362dd9ef723ddbdcf4185b47c28b127a36f46bc4717662be863309b3e601210387e7ff08b953e3736955408fc6ebcd8aa84a04cc4b45758ea29cc2cfe1820535feffffff02002465c7090000001976a91429bef7962c5c65a2f0f4f7d9ec791866c54f851688ac001194fb180000001976a914e2cee7b71c3a4637dbdfe613f19f4b4f2d070d7f88acf8ec010018f5fedae10520f8d90728fad9073297011220448ccfd9c3f375be8701b86aff355a230dbe240334233f2ed476fcae6abd295d1801226b483045022100bdc6b51c114617e29e28390dc9b3ad95b833ca3d1f0429ba667c58a667f9124702204ca2ed362dd9ef723ddbdcf4185b47c28b127a36f46bc4717662be863309b3e601210387e7ff08b953e3736955408fc6ebcd8aa84a04cc4b45758ea29cc2cfe182053528feffffff0f3a460a0509c76524001a1976a91429bef7962c5c65a2f0f4f7d9ec791866c54f851688ac222261345843445137416e5248396f705a3468364c63473367376f635356325362426d533a480a0518fb94110010011a1976a914e2cee7b71c3a4637dbdfe613f19f4b4f2d070d7f88ac2222614d50694b484233453141475069386b4b4c6b6e78366a314c344a6e4b43476b4c77 +0a20914ccbdb72f593e5def15978cf5891e1384a1b85e89374fc1c440c074c6dd28612b90201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1803a1860104dba36e5b082a00077c00000000052f6d70682f000000000740a9e7a6000000001976a91436e086acf6561a68ba64196e7b92b606d0b8516688ac002f6859000000001976a914381a5dd1a279e8e63e67cde39ecfa61a99dd2ba288ac00e1f505000000001976a9147d9ed014fc4e603fca7c2e3f9097fb7d0fb487fc88ac00e1f505000000001976a914bc7e5a5234db3ab82d74c396ad2b2af419b7517488ac00e1f505000000001976a914ff71b0c9c2a90c6164a50a2fb523eb54a8a6b55088ac00a3e111000000001976a9140654dd9b856f2ece1d56cb4ee5043cd9398d962c88ac00e1f505000000001976a9140b4bfb256ef4bfa360e3b9e66e53a0bd84d196bc88ac0000000018dbc7badb0528a18d0632320a303033613138363031303464626133366535623038326130303037376330303030303030303035326636643730363832663a450a04a6e7a9401a1976a91436e086acf6561a68ba64196e7b92b606d0b8516688ac2222613569644363484e385759787646436542585358764d50725a4875426b5a6d71454a3a470a0459682f0010011a1976a914381a5dd1a279e8e63e67cde39ecfa61a99dd2ba288ac2222613571374164346f6b534646566835616479717835445432315254784a796b70554d3a470a0405f5e10010021a1976a9147d9ed014fc4e603fca7c2e3f9097fb7d0fb487fc88ac22226143416754506774596341344579735534554b4338364551643563547448744363723a470a0405f5e10010031a1976a914bc7e5a5234db3ab82d74c396ad2b2af419b7517488ac222261487538393769767a6d6546754c4e4236393536583667794765564e4855425267443a470a0405f5e10010041a1976a914ff71b0c9c2a90c6164a50a2fb523eb54a8a6b55088ac22226151313846425646746e756575635a4b655667347372686d7a6270416562314b6f4e3a470a0411e1a30010051a1976a9140654dd9b856f2ece1d56cb4ee5043cd9398d962c88ac2222613148775464436d5156334e73705032517143477065686f467069384e59345a67333a470a0405f5e10010061a1976a9140b4bfb256ef4bfa360e3b9e66e53a0bd84d196bc88ac222261316b43434764646635704d585369704c564439684247324d4747564e614a313555 +0a208d1f32f35c32d2c127a7400dc1ec52049fbf0b8bcdf284cfaa3da59b6169a22d12d60203000600000000000000fd4901010094140000010001eb44148fbbe7c36e1406ea68701f9b9dd5e10f3aeecbbad9885d73846bf0891932000000000000003200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018adf080f705289429 +0a20e5767d3606230a65f150837a6f28b4f0e4c2702a683045df3883d57702739c6112d70203000500010000000000000000000000000000000000000000000000000000000000000000ffffffff0502b4140101ffffffff07004e725300000000232103fb09a216761d5e7f248294970c2370f7f84ce1ad564b8e7096b1e19116af1d52ac80f0fa02000000001976a914296134d2415bf1f2b518b3f673816d7e603b160088ac80f0fa02000000001976a914e1e1dc06a889c1b6d3eb00eef7a96f6a7cfb884888ac80f0fa02000000001976a914ab03ecfddee6330497be894d16c29ae341c123aa88ac80d1f008000000001976a9144281a58a1d5b2d3285e00cb45a8492debbdad4c588ac80f0fa02000000001976a9141fd264c0bb53bd9fef18e2248ddf1383d6e811ae88ac8017b42c000000001976a91471a3892d164ffa3829078bf9ad5f114a3908ce5588ac00000000260100b414000037ff812f8ad1814d4acff9c45457873553fa2ef12602c1386ec6894e7fbb9b951881b981f70528b42932120a0a3032623431343031303128ffffffff0f3a4f0a0453724e001a232103fb09a216761d5e7f248294970c2370f7f84ce1ad564b8e7096b1e19116af1d52ac222254416e3947686b7033316d79585267656a436a3131775756485431344c736a3334393a470a0402faf08010011a1976a914296134d2415bf1f2b518b3f673816d7e603b160088ac222254446b313977504b59713931693138716d593655394665546454787750655376656f3a470a0402faf08010021a1976a914e1e1dc06a889c1b6d3eb00eef7a96f6a7cfb884888ac222254575a5a6344476b4e697854414d745242717a5a6b6b4d4862713147367655546b353a470a0402faf08010031a1976a914ab03ecfddee6330497be894d16c29ae341c123aa88ac222254525a5446644e434b434b624c4d515638635a446b514e3956777575713467447a543a470a0408f0d18010041a1976a9144281a58a1d5b2d3285e00cb45a8492debbdad4c588ac222254473272756a353945356231753947334637485156733670436356444278725176653a470a0402faf08010051a1976a9141fd264c0bb53bd9fef18e2248ddf1383d6e811ae88ac2222544373547a515a4b566e3466616f386a446d42397a51426b3959514e455a335866533a470a042cb4178010061a1976a91471a3892d164ffa3829078bf9ad5f114a3908ce5588ac2222544c4c354751554c58347542667a3779584c3656635a79767a644b5676315247786d \ No newline at end of file diff --git a/bchain/coins/fujicoin/fujicoinparser.go b/bchain/coins/fujicoin/fujicoinparser.go index 2132554394..7c4a72d90c 100644 --- a/bchain/coins/fujicoin/fujicoinparser.go +++ b/bchain/coins/fujicoin/fujicoinparser.go @@ -43,7 +43,9 @@ type FujicoinParser struct { // NewFujicoinParser returns new FujicoinParser instance func NewFujicoinParser(params *chaincfg.Params, c *btc.Configuration) *FujicoinParser { - return &FujicoinParser{BitcoinParser: btc.NewBitcoinParser(params, c)} + p := &FujicoinParser{BitcoinParser: btc.NewBitcoinParser(params, c)} + p.VSizeSupport = false + return p } // GetChainParams contains network parameters for the main Fujicoin network, diff --git a/bchain/coins/grs/grsparser_test.go b/bchain/coins/grs/grsparser_test.go index 8494ece22a..29ac6c5663 100644 --- a/bchain/coins/grs/grsparser_test.go +++ b/bchain/coins/grs/grsparser_test.go @@ -18,8 +18,8 @@ import ( var ( testTx1, testTx2 bchain.Tx - testTxPacked1 = "0a20f56521b17b828897f72b30dd21b0192fd942342e89acbb06abf1d446282c30f512bf0101000000014a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac0000000018ffff87da05200028a6f383013298010a001220cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a1800226a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e6728ffffffff0f3a460a030333a010001a1976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac222246744d347a416e39615659674867786d616d5742675750795a7362365268766b41394000" - testTxPacked2 = "0a209b5c4859a8a31e69788cb4402812bb28f14ad71cbd8c60b09903478bc56f79a312e00101000000000101d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed090018caa384da0520d9db2728dadb27322c0a0012204f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d1180028feffffff0f3a450a034c4b4010001a17a9147a55d61848e77ca266e79a39bfc85c580a6426c9872223324e345135466855323439374272794666556762716b414a453837614b4476335633653a4d0a036f38a810011a160014cc8067093f6f843d6d3e22004a4290cd0c0f336b222c746772733171656a7178777a666c64377a72366d663779677179357335736535787137766d74396c6b6435374000" + testTxPacked1 = "0a20f56521b17b828897f72b30dd21b0192fd942342e89acbb06abf1d446282c30f512bf0101000000014a9d1fdba915e0907ab02f04f88898863112a2b4fdcf872c7414588c47c874cb000000006a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e67ffffffff01a0330300000000001976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac0000000018ffff87da0528a6f383013294011220cb74c8478c5814742c87cffdb4a21231869888f8042fb07a90e015a9db1f9d4a226a47304402201fb96d20d0778f54520ab59afe70d5fb20e500ecc9f02281cf57934e8029e8e10220383d5a3e80f2e1eb92765b6da0f23d454aecbd8236f083d483e9a7430236876101210331693756f749180aeed0a65a0fab0625a2250bd9abca502282a4cf0723152e6728ffffffff0f3a440a030333a01a1976a914fe40329c95c5598ac60752a5310b320cb52d18e688ac222246744d347a416e39615659674867786d616d5742675750795a7362365268766b4139" + testTxPacked2 = "0a209b5c4859a8a31e69788cb4402812bb28f14ad71cbd8c60b09903478bc56f79a312e00101000000000101d1613f483f2086d076c82fe34674385a86beb08f052d5405fe1aed397f852f4f0000000000feffffff02404b4c000000000017a9147a55d61848e77ca266e79a39bfc85c580a6426c987a8386f0000000000160014cc8067093f6f843d6d3e22004a4290cd0c0f336b02483045022100ea8780bc1e60e14e945a80654a41748bbf1aa7d6f2e40a88d91dfc2de1f34bd10220181a474a3420444bd188501d8d270736e1e9fe379da9970de992ff445b0972e3012103adc58245cf28406af0ef5cc24b8afba7f1be6c72f279b642d85c48798685f862d9ed090018caa384da0520d9db2728dadb27322812204f2f857f39ed1afe05542d058fb0be865a387446e32fc876d086203f483f61d128feffffff0f3a430a034c4b401a17a9147a55d61848e77ca266e79a39bfc85c580a6426c9872223324e345135466855323439374272794666556762716b414a453837614b4476335633653a4d0a036f38a810011a160014cc8067093f6f843d6d3e22004a4290cd0c0f336b222c746772733171656a7178777a666c64377a72366d663779677179357335736535787137766d74396c6b643537" ) func init() { diff --git a/bchain/coins/koto/kotoparser_test.go b/bchain/coins/koto/kotoparser_test.go index c7008f2075..780ba1c8c6 100644 --- a/bchain/coins/koto/kotoparser_test.go +++ b/bchain/coins/koto/kotoparser_test.go @@ -18,8 +18,8 @@ import ( var ( testTx1, testTx2 bchain.Tx - testTxPacked1 = "0a2097f944e3558cc784f4013b3753ce9570fe4707893eda724b12eb4c69686113a612970f020000000001036b2048020000001976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac000000000100000000000000001392204802000000a8a3d9a54a3fe3b5ae208fa2d96faea96dac6cb76b03bb2e32c5dd892a5d6f6490f05d8f6fb4401228df1be9f22c5ad69706c461bbc9253ffbc3531770e5075e149ec6af7f2cda0cb87862620792340bc425095115adbf0f16f4d3ece3f5c467cbcb02b01ced7192ab644f96fa01f04a7a450a42da2bfad1748634f7bc141467d3c94961ed6250dd23fca62b30b4a2ca6fbad0724372a429bcb97a28954e1681c0bb974877dac26eb2b994eaa23d56ecfdedd93f8331f9432f12adc37da9f049585179b7bbb370b76c6c37a438a20bc3b410a6a72ff8d11408a337a37bbc73dd15df8a34f2c878dc6d6db4f0cee504680fe53e0a158f1e1c82b84e065a4764fc57f8bf75d28899126917a05bf3230036f2d6b38f8a51214d1c2d0588a95e82f0032c2dfa6916c689f8daa648c01517bbf0826d2d4082067b0d17071920eb6dab6c0307603b825f3aae347db349628d4fcaa97a155ef1a2c601170fe825609efa964f0a06700afc135542ea7b06fc989424d7e100652c0ad5be4ca01c1fd676530e6f60606c5feb7de5da0d69544d8b7be8de06b27ba96a1bfa6bc07cc0269982acb722032a938ab36089c0eeda7a4076cd258a1752486a3d52af16db8dff072bcc61f17503185b5bc8aa0ea3a181663bb0ddd3cca1a19293764b01569b9878a60c0ce82e21020751a4ecc1a2a9b9a123042ee8d8a5d4d3f4764b1cdb13d57d2a77c3b56bd89102302d118ebc14969ade27bf83f0e707a97b26c7292a6c20e850abce5fad0ab59d032fec0d6278bbe0f2fb3fbc61697ba10b6ec3f2c4196e46e98dfb65bb28ec6afff81de5a4be7be8c4f56ab4c03043a3cf9987b630ac4b6d8aa74ce8ed5b61040262239172c6450f9ab642e2f2d258c200c3bb4ad69011ef2dfe1dd63d758c86270ac4925b248b9bb4b6c9ff7bf2e56260cba02b2429648dc20eb034c8f9b18e1f6a38b8651c236554546585b4dd0f07fd5ee1696bf792527ce84b22012439300797103f22d3969df725e4414d899ec32a2ebbb857cc911e374e84738f4e007ee5260ff666a286e45c465525e2e3fc5e5e0e9ad82e53d364e4fd355619711c616d508470b997af44f62f283871cd892552128135aadb40c6f8cf69ee72acf349e9f4d33e8673450b9f69d4022a8d886b0cdbaba0798e0bf57b42dedfafb0bbd5495ca1c0030bbf460b48f9a138f6ab748df9046d9995f895062583ce0818e40afb9704653e11d58ca42bd3f60f4e908589ad9144c76067dc433cad13a5bbd9c168691b8c6cddb19d812f3e3f98e2cdd20dbb170936fd5cd2ef0bca72af8931a1b01d6081ffbef5be4416e696a7c762a375b368f71dc31362a4005750992a48e55311dde8d2013180d62e507ffc3e468c4a27acc763a9651b19f37e1ffca7e656225617368e79c1d18f9b14d770993d3d1dc42dcfd9adfa02a8ddf0ebc8fbb850fab307fd1d239cf6ad4e5ff40992dd974bc43fa351ce807cc0036c2f7d80bbd052f496216304fbc63e8d728bf129acaedb0073aff077e584ce04bc1ccf9c91f41f3c8804dd65da4ecdfdba32590e04b4d1b6895dea8edacd1f40313e8a1d4900d0dba54056eee72e3d155e9c67e7a51df581c33cbd39f16549d590ae5387fe2c5ad3484ad5c7da320066b79083c49879e45938b3bbb063726008a2ebb8847c9e57be6ec489c7aaa80f5e8e430040cb8d60298363df850cb7b4e98e97192882d10d2fd96cc490dd18b263d96aac6aa4f5583770e0917fa9b566dd0e0b218c6684007ec10cf11747e8f039fac5250170de2835ab88fea356b6a7d0f5e81ffe9b78d191a745e0237a256a2a840880689d83503b72462e3955b61e22afde947c1f1527ea94151c5b7d3a72ce68979603911c08bcec01097899fd30347be7f2e246f70d2af6a1e29b54988978a91f79b2ed8be76ffd62f79de5418933ed166be919d9bbb7524347d87d31afaed05e71a82b09c18c196b3ba6e226939b375903f7d889422863567203814484af89fd223ce1c959b1fdffaf26461630c630d2bbf99228a096ea6cb0d61df70d24414c76bf9371c4abff0ad257098189af6ea32200fbe092d875aa4d3f72a7ec138439e4b08fb1dcde6a90f25fde1498773e693c9b21c40505d42edcbcaed8a2dc4642750e9df73e169f9986ddb3a57991ac2cb3b540d788e2c2c22c2c51b2d74a98ed59a8cec89ba54342fb9660449a116f8691da60cb447afe4d5e80f37b4669e6007c1cadc41933fb27bab41afd312c37e5cb43715cb4013efcd91221ed06249540b733c05e81131aba75ba0f427d9bd975554b2d49a8048f0b3a84477e75290235fd3bbcaee6c4438ba72299dd960f3f6ee9241f7e399684e894d7bb1c302ecbe24d0f19dca982a82ee44f36211d23b0ea623c9c9f4f527f4e452fd06ebb943cadeea3d7fa42cabd25324bc5851e40f9952823f56b50b97729e6561f2100c2b5922860c6cf447a668324ca931f2f35a5edb7d306f8b8802f98cf67140a3fe73099ab86bb65c439a8593e64816bcd46aa4c254918f4a3a0f3f47b4ebcfb2824703f9a7d163824484ce6fe1852c4ba131ee2635de14822a8cb3782697fecc6f69514edd3f42fcf2751075b838bf14ae91e9dcff517bf3cec4db1b986b4c966a4fa40d38f2ebb7fc60218c397a2d705200028d09a0c3a490a050248206b0310001a1976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac22236b31323257767a46415565444b3667353238563376726547673870614a5137624248364000" - testTxPacked2 = "0a203aebcf5a223450bca3c0312d3d87b6070447e795d09a266a3a01c70e44c7cc4812e1010100000001cbc2c0b14b26f563ceee8201971b2caae2a4f964d0fd91267290c51a6a171411010000006a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c07467224ffffffff02c0c62d00000000001976a914dd985697513887236c484acc605ece839e2204ac88ac989e8ce0000000001976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac0000000018ff98a2d705200028d49a0c3298010a0012201114176a1ac590722691fdd064f9a4e2aa2c1b970182eece63f5264bb1c0c2cb1801226a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c0746722428ffffffff0f3a470a032dc6c010001a1976a914dd985697513887236c484acc605ece839e2204ac88ac22236b314a334461347236356653616b6571555953616a6f506f74656376633768384861513a480a04e08c9e9810011a1976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac22236b31396b7355666462355139584b556a3565645570314451686e6343503868396845374000" + testTxPacked1 = "0a2097f944e3558cc784f4013b3753ce9570fe4707893eda724b12eb4c69686113a612970f020000000001036b2048020000001976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac000000000100000000000000001392204802000000a8a3d9a54a3fe3b5ae208fa2d96faea96dac6cb76b03bb2e32c5dd892a5d6f6490f05d8f6fb4401228df1be9f22c5ad69706c461bbc9253ffbc3531770e5075e149ec6af7f2cda0cb87862620792340bc425095115adbf0f16f4d3ece3f5c467cbcb02b01ced7192ab644f96fa01f04a7a450a42da2bfad1748634f7bc141467d3c94961ed6250dd23fca62b30b4a2ca6fbad0724372a429bcb97a28954e1681c0bb974877dac26eb2b994eaa23d56ecfdedd93f8331f9432f12adc37da9f049585179b7bbb370b76c6c37a438a20bc3b410a6a72ff8d11408a337a37bbc73dd15df8a34f2c878dc6d6db4f0cee504680fe53e0a158f1e1c82b84e065a4764fc57f8bf75d28899126917a05bf3230036f2d6b38f8a51214d1c2d0588a95e82f0032c2dfa6916c689f8daa648c01517bbf0826d2d4082067b0d17071920eb6dab6c0307603b825f3aae347db349628d4fcaa97a155ef1a2c601170fe825609efa964f0a06700afc135542ea7b06fc989424d7e100652c0ad5be4ca01c1fd676530e6f60606c5feb7de5da0d69544d8b7be8de06b27ba96a1bfa6bc07cc0269982acb722032a938ab36089c0eeda7a4076cd258a1752486a3d52af16db8dff072bcc61f17503185b5bc8aa0ea3a181663bb0ddd3cca1a19293764b01569b9878a60c0ce82e21020751a4ecc1a2a9b9a123042ee8d8a5d4d3f4764b1cdb13d57d2a77c3b56bd89102302d118ebc14969ade27bf83f0e707a97b26c7292a6c20e850abce5fad0ab59d032fec0d6278bbe0f2fb3fbc61697ba10b6ec3f2c4196e46e98dfb65bb28ec6afff81de5a4be7be8c4f56ab4c03043a3cf9987b630ac4b6d8aa74ce8ed5b61040262239172c6450f9ab642e2f2d258c200c3bb4ad69011ef2dfe1dd63d758c86270ac4925b248b9bb4b6c9ff7bf2e56260cba02b2429648dc20eb034c8f9b18e1f6a38b8651c236554546585b4dd0f07fd5ee1696bf792527ce84b22012439300797103f22d3969df725e4414d899ec32a2ebbb857cc911e374e84738f4e007ee5260ff666a286e45c465525e2e3fc5e5e0e9ad82e53d364e4fd355619711c616d508470b997af44f62f283871cd892552128135aadb40c6f8cf69ee72acf349e9f4d33e8673450b9f69d4022a8d886b0cdbaba0798e0bf57b42dedfafb0bbd5495ca1c0030bbf460b48f9a138f6ab748df9046d9995f895062583ce0818e40afb9704653e11d58ca42bd3f60f4e908589ad9144c76067dc433cad13a5bbd9c168691b8c6cddb19d812f3e3f98e2cdd20dbb170936fd5cd2ef0bca72af8931a1b01d6081ffbef5be4416e696a7c762a375b368f71dc31362a4005750992a48e55311dde8d2013180d62e507ffc3e468c4a27acc763a9651b19f37e1ffca7e656225617368e79c1d18f9b14d770993d3d1dc42dcfd9adfa02a8ddf0ebc8fbb850fab307fd1d239cf6ad4e5ff40992dd974bc43fa351ce807cc0036c2f7d80bbd052f496216304fbc63e8d728bf129acaedb0073aff077e584ce04bc1ccf9c91f41f3c8804dd65da4ecdfdba32590e04b4d1b6895dea8edacd1f40313e8a1d4900d0dba54056eee72e3d155e9c67e7a51df581c33cbd39f16549d590ae5387fe2c5ad3484ad5c7da320066b79083c49879e45938b3bbb063726008a2ebb8847c9e57be6ec489c7aaa80f5e8e430040cb8d60298363df850cb7b4e98e97192882d10d2fd96cc490dd18b263d96aac6aa4f5583770e0917fa9b566dd0e0b218c6684007ec10cf11747e8f039fac5250170de2835ab88fea356b6a7d0f5e81ffe9b78d191a745e0237a256a2a840880689d83503b72462e3955b61e22afde947c1f1527ea94151c5b7d3a72ce68979603911c08bcec01097899fd30347be7f2e246f70d2af6a1e29b54988978a91f79b2ed8be76ffd62f79de5418933ed166be919d9bbb7524347d87d31afaed05e71a82b09c18c196b3ba6e226939b375903f7d889422863567203814484af89fd223ce1c959b1fdffaf26461630c630d2bbf99228a096ea6cb0d61df70d24414c76bf9371c4abff0ad257098189af6ea32200fbe092d875aa4d3f72a7ec138439e4b08fb1dcde6a90f25fde1498773e693c9b21c40505d42edcbcaed8a2dc4642750e9df73e169f9986ddb3a57991ac2cb3b540d788e2c2c22c2c51b2d74a98ed59a8cec89ba54342fb9660449a116f8691da60cb447afe4d5e80f37b4669e6007c1cadc41933fb27bab41afd312c37e5cb43715cb4013efcd91221ed06249540b733c05e81131aba75ba0f427d9bd975554b2d49a8048f0b3a84477e75290235fd3bbcaee6c4438ba72299dd960f3f6ee9241f7e399684e894d7bb1c302ecbe24d0f19dca982a82ee44f36211d23b0ea623c9c9f4f527f4e452fd06ebb943cadeea3d7fa42cabd25324bc5851e40f9952823f56b50b97729e6561f2100c2b5922860c6cf447a668324ca931f2f35a5edb7d306f8b8802f98cf67140a3fe73099ab86bb65c439a8593e64816bcd46aa4c254918f4a3a0f3f47b4ebcfb2824703f9a7d163824484ce6fe1852c4ba131ee2635de14822a8cb3782697fecc6f69514edd3f42fcf2751075b838bf14ae91e9dcff517bf3cec4db1b986b4c966a4fa40d38f2ebb7fc60218c397a2d70528d09a0c3a470a050248206b031a1976a9142df466d79cf4be0f7d1091512f1c297e4988fdd188ac22236b31323257767a46415565444b3667353238563376726547673870614a513762424836" + testTxPacked2 = "0a203aebcf5a223450bca3c0312d3d87b6070447e795d09a266a3a01c70e44c7cc4812e1010100000001cbc2c0b14b26f563ceee8201971b2caae2a4f964d0fd91267290c51a6a171411010000006a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c07467224ffffffff02c0c62d00000000001976a914dd985697513887236c484acc605ece839e2204ac88ac989e8ce0000000001976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac0000000018ff98a2d70528d49a0c32960112201114176a1ac590722691fdd064f9a4e2aa2c1b970182eece63f5264bb1c0c2cb1801226a473044022032dd5d573c3a7f729da1cb9d9ba02a08e05d50b4f74d5aeb7cb22284526f70340220661ca4a192d02684f0b6b52768b9e9ae5fad41b962aa918537b91bba275e92e70121024e98e62782ba44e5677b52b1e4e973a027c7d873915a6d62ba967b2c0746722428ffffffff0f3a450a032dc6c01a1976a914dd985697513887236c484acc605ece839e2204ac88ac22236b314a334461347236356653616b6571555953616a6f506f74656376633768384861513a480a04e08c9e9810011a1976a91482bfe75940a6d46238f55e258fcae5bef4e847ea88ac22236b31396b7355666462355139584b556a3565645570314451686e634350386839684537" ) func init() { diff --git a/bchain/coins/liquid/liquidparser_test.go b/bchain/coins/liquid/liquidparser_test.go index 6e1401b8e5..d76f15a294 100644 --- a/bchain/coins/liquid/liquidparser_test.go +++ b/bchain/coins/liquid/liquidparser_test.go @@ -137,7 +137,7 @@ func Test_GetAddressesFromAddrDesc(t *testing.T) { var ( testTx1 bchain.Tx - testTxPacked1 = "0a207aa1af9481f2d744c96015b1baea6ba753790971ff265adfd93775de0234bfd612b51a020000000101a99547d213b005f355da348de54f5eb370fbc6a5687e412897ef0ec4ce237d75020000006b483045022100ae926c96c746308e7488e022f4ad1db94d5d0c8683f6fa6ded3afb13d8e20578022074aa8ebfe20adaf25beed70c60cfb5007278bec17875f11f7a5b3c86eb60a96901210391abdcd113c40b56f13a548e8624d6ad8d7a162b33ef81020d046cadbda26637feffffff030af62b535fc393152f6d575708b271e3a53514cdcf65508c7d12e8fd06709ce24208e192e1315aa94c3bc0eddbb0ae195aff0a1ba2e19773b79e5d1b29fdd8df211b02f8b255b83fa13f40745fb5054b89dc7dcba497c850086a8726bac66ac22d4be31976a914d79c1c8b67a0275c60e33b67bbd0e19a79b9276388ac016d521c38ec1ea15734ae22b7c46064412829c0d0579f0a713d1c04ede979026f01000000000000000000256a23426c6f636b73747265616d2e696e666f206973206120636f6f6c206578706c6f726572016d521c38ec1ea15734ae22b7c46064412829c0d0579f0a713d1c04ede979026f0100000000000004800000000000000000000043010001db986007e38ccb7bdef1661fcf633cbde3d8850cd116736d9b0b0b027901921694954b26036eb51d9424c38083aa3d937998ea81077843925513523eb6ec3337fd4d0b602300000000000000011486003b49c8ab1a6aa09a8eaec4ed83dbda4cb4ef9651114513823a6eefb1dbf971631d88a229a3b027a94f9f15966765f6f5ce3245057c57aedf8f4c69e355f4264a10e2c7dad691879844074ae5e37152c828aba89035e928c63b1c1590638333d05ed08442538ebf7dff9c94ce11ab6bb6d5c9535fce99fab023aabc7215b52eed15454333428b065fb5d8b03aa2fe1de5004f9d8fca717bcd682f1f9caa6561bdafbe69c8423166f7e33867f0bc4fdd85224ff1533839762530d47a1f053c40c7e38f84a1431ad03398bc9d634384aec0f22e75ac4a94e3703ec8715d0791564a8b1509eab4bf7543ef2e5c20fe9fb6c2a85afe42fcdba64c628103ea5693287a28ded79f517a3e877fe287ca6f3d1229295abaf5c1b3b43ab54ec4697c941da47e0934718b697a414d8fd1a722eb23ceb554afb1b4c807a94507a35b153f19da10c6688c71efa0d1ad15c8ac2f3d786ae8c43136cacf333c2643e521322314346b201427f1ac975340cf3caf102245d8cf45709bb51e41fd357f1fb7316138f1992e5646842eb4fe18ef6a7096f7e4c1e69950285f30c64dc1da661c055944356f140d6298f5eaf733799bef034a8afb05f6f74239e572acf5d1c2f9e028b806caab13eb19148456b3db0f719ad76818eaea11e7989e74d858743ffba738a5f5c7d12ab1b049c594656821620e20817c6acc5b3d3725f9183d3c01a0190d5d991d1603682418f4a9c55b59cab8787f463123e1efd7d3e7f75dfb9ccf931ae2dc965b82cabf2af6b93293a4b00d7145d97a24679076157bade5ba4d7577922052c719ebf2493f5e9d0cf8e6f82666e8732dd91068395e528d0ea532e27ae8a84ed516dabd30dd990a1539d93f7b775039d53f1a12d7e7747a64f6aca9d7589330c8adf8854dce0fee0be212716d6c1b075fabb9d0c815e613c772f7c57e7efdb4e64a5ef47c9cf384deab55191d7b4b0cb27986649eca2c4286a01a7d3c304f008c6d3fe53abf320afc7602654cf4b69b87fd2b9b6794fe7cc77e92bbef572dc8ddb1530da6d82268cd32db112afb8c2db69651959c1ad39d804178cae05f856539559e3dd0e869d9985f41262c30058d1d3c2cd336649b3a893bd4b29c206c53eeb337025a7585fc4bc05d8fe71035ea082ea543cbc15f8e6f0658815c7553795917958b503779cf6a18f92c391769e846327d3cd8458c089cb1e342a590eb57a583365c4bd5de34dc17992f5309fb69b67aa8436c763183a8f11a543fdb8a376a30836013fff3a2d21b72e22f1d9d031a3cd467365256e120894e1489c238df5ce65183b93d68024697245be8c0a9d60e31452d247a98136ca559622e2f4b35569ec8ab8539528a09214f1d3862bc97b21b7bb2b66c654ebee00eb26ec57988ff174cab65d4864eea14f15b65252fe534750bea3b9b4400c811ccf3e6517ecf1f1585d908f21b91bfd223eddbb9b980bb65133934c8027fde78865ed4d969bc6de3be613730d3a0f179f0ed734c67900da53c230045d60d31980401e7fa1396891d42555af8152bb0e6557d3c7d718f7ba85b6848ab052fcf709c7aea676d8c00c787a7fb2a2b1972d245aa51a24ceb13d7dd38cd0c214727a1000561828a62c969afa60d36cfab21b8e6837a0e0ac325c6c20e3ccd09fd1f5400dd6a7dc861e050bcb47ee89670d807b514e5b59ea830ef885ac6a0371efdcbb09e676fd9790e00ab9686f59b2ce173896d4d451e6fd61f3b95b82e63a494d7853c78c2f03e45cbabd46a4586364c131000d9efdc71d30d3caf25cdfad63a6628e67d5f219a0cafc5509f556cec7ac110ce0b52b552be6780e8d0c31a068dc6607ebc9cac4471cb1e85e5b6a0bc2330062f6930e2ef623da059da02902fa28586614a053625ea5901dc6151e7fae3a63b444b9d53630dea6b90d3c2ca7dd8db69f39a2ad6bc2eec08a85c1c0d0a9b079825278cf0b6f415344b0b6e4c7a51947e98ada9149c8f427914d8245b152f8f3558178d16e35498649a34ceb2fdaafc0d303829ddd9412c9a2b5ed1ce060472a9a85ffa19a4ddfbdb89437e72b261472d2b8c70a01a96562b753692c7329d75057a9918dbb3a39a90c86b66ec745a14e9909b2eae6c46dcd8c8a666973ba356124d6444353f1a34f88f907af897ea8e642f8603aed400d3d8a75568baa96b26b8d04f5fb0d1ca1256e7057f93464d95d1994ac5189ca607c013637fa35879a6c67c4806b6c9f00ccedb953103bbec21f054d304b621e0eca771accf5181409642d58ea8d032e06c27295e57092b4e3a89f47f47f16dc82f07dfad44ca7077385f62b4ad2efecb97955759c31977719316545b6fc6a78b7e35206719fcba4c1dca5d0f7f9959f7bd1c117532a2f7fc3ca87820e38cfab558dc48adb1058964b6ea9dfde5e06bff6b5d7af19fe6b8a46d0ec76f8902e525082591b82c2f86a30341787a1da86ab517063b39ae076b3f10e78f6c79dd58041b99ab40824b598f6c815733d62d262abeb96b8224b56e4109d4d5c445cd055a9cd2aea7753fc0f6a55bcf4291551a0d9c852e19e0f0603eefc9a79a38bc07a73f6e0f88a9d3eac01ca57d5d55e2ef870743522c15841b4ea7a0d278922cc977724571c75b5039a20f5dad843941d91fb421944b54923ed8c5f71edafbdfaf4c12dbe1c2b2a9642bbc2bd07017a44cb402d6ae09248eb24b70d43f751d3bf761ecef51f1f15239de25222852f95607335b3410050e5bd65f8c9657f0a95185e48dcb2f711641c0994e352b0039d569ddbd27182c263649d3e27b3816acd5822b31c98661adf01ee62db361be1b0469de4fc1c6e10185203eb44abe3d077fcbc52bef6095ca30c81a22b6e7a64c1385e7dd11209fc073a29ef656769fbb24d4292d98379884a1a2b2c7f6fd895577d739a2f0411e8afcee4de40927443f28e72aebc763fd0315ee85d29a23bb235ce82a5a621c0d9021965673720be9057a26b1ff0380263b54777f6cc7b7531d284f5041d4480108e4b4986f1ddec9e65dd2392c7fa0349c2a39954e4aeec8fe8f40e66db57d29beaf0046d9387482bab71a9397d90611cf767637c8666da87d5f1d798558cbb7228844010510cb95b073cec3878893ba70549eb6d3428b8db6944118f6de2ee7107b593ef85441cba46238f7843c4e6e7497f14cc64c25653c87da756226ce774c2b5e43294f2ebab2f601e9fe3f2d1d3172cfcc7e6eb7ea9b237e5f093443b02f42b4ea85673a6a0000ef9a6ddf2263a1a75eb7b78d3f90b1de91a22d78aa06d9626b0f9090ee63d92418b084db647132e3b0b7f3ed583eec280d06b94a358daffcd333233fb390ba8bf2da3921b18adf6cd4901cbabf4f4e3c90f21eb3190c8c0e4f16ac25dd546859bc640354ab9769553aeda466191ba4b10f52da5342347685e52af5d20ba8c113e65663bcedc12c99e576c4e1bdde013017d16fc26e3f30418c21d72ad6507ef1c8d437342d0fc20ad102e6c49eb9a8e7a3df5366c9a75b6d95ab007a3d93bca0086414ac5bc44a872659f43f0f703b415ac0e9aeeedb2c0cb945938923dc0865c5d3ff673e068d2865b11c68774cd6c0be1caa40627425bdc4ecbbd0a642f9c6953464e2f20681994be8483d64ed6d2d8efa79c5b12776900e58b45bea18c2e0220ea27e9670485e2c6ce9f52ac08cad61ca57b839710209db8a5d4fe95a846960b126271e519545e5d4d15300fc0ef2f35b8def7ba6f639d85404b57bac35140bef1c4f3b455773bf2a2eae62118dcdc5474ec0900aca49300833417786d1fb0d76a56570cfa10d23dbab0305e1c9c48032b19fd2ec2e00b1528a248036590e26e8c75209d004e20bc7730b29cf3ed860848b83ab91ad6a635f2cc1eca89e16814f34f2c1c2766a28b2901170bb4839f08f5685e593b8a5ce2a801194818b4aeb0a01794f92c7bc4144808e997cfd1711485b60483cf4a310b23e0210c5c73e6956b9e1ae696f1ea79b3fab788bf229a349fd9caedebd5db99821b1cebdceafb011cfcd1c78f93774b35f25c7e69952b0bca1a0d40791b812614e996ca31548bc0000000018cfdaa0e0052000288781053299010a001220757d23cec40eef9728417e68a5c6fb70b35e4fe58d34da55f305b013d24795a91802226b483045022100ae926c96c746308e7488e022f4ad1db94d5d0c8683f6fa6ded3afb13d8e20578022074aa8ebfe20adaf25beed70c60cfb5007278bec17875f11f7a5b3c86eb60a96901210391abdcd113c40b56f13a548e8624d6ad8d7a162b33ef81020d046cadbda2663728feffffff0f3a4110001a1976a914d79c1c8b67a0275c60e33b67bbd0e19a79b9276388ac222251477652524658424d32666558755533394577484e75595953726e4d33486155794d3a2910011a256a23426c6f636b73747265616d2e696e666f206973206120636f6f6c206578706c6f7265723a060a02048010024002" + testTxPacked1 = "0a207aa1af9481f2d744c96015b1baea6ba753790971ff265adfd93775de0234bfd612b51a020000000101a99547d213b005f355da348de54f5eb370fbc6a5687e412897ef0ec4ce237d75020000006b483045022100ae926c96c746308e7488e022f4ad1db94d5d0c8683f6fa6ded3afb13d8e20578022074aa8ebfe20adaf25beed70c60cfb5007278bec17875f11f7a5b3c86eb60a96901210391abdcd113c40b56f13a548e8624d6ad8d7a162b33ef81020d046cadbda26637feffffff030af62b535fc393152f6d575708b271e3a53514cdcf65508c7d12e8fd06709ce24208e192e1315aa94c3bc0eddbb0ae195aff0a1ba2e19773b79e5d1b29fdd8df211b02f8b255b83fa13f40745fb5054b89dc7dcba497c850086a8726bac66ac22d4be31976a914d79c1c8b67a0275c60e33b67bbd0e19a79b9276388ac016d521c38ec1ea15734ae22b7c46064412829c0d0579f0a713d1c04ede979026f01000000000000000000256a23426c6f636b73747265616d2e696e666f206973206120636f6f6c206578706c6f726572016d521c38ec1ea15734ae22b7c46064412829c0d0579f0a713d1c04ede979026f0100000000000004800000000000000000000043010001db986007e38ccb7bdef1661fcf633cbde3d8850cd116736d9b0b0b027901921694954b26036eb51d9424c38083aa3d937998ea81077843925513523eb6ec3337fd4d0b602300000000000000011486003b49c8ab1a6aa09a8eaec4ed83dbda4cb4ef9651114513823a6eefb1dbf971631d88a229a3b027a94f9f15966765f6f5ce3245057c57aedf8f4c69e355f4264a10e2c7dad691879844074ae5e37152c828aba89035e928c63b1c1590638333d05ed08442538ebf7dff9c94ce11ab6bb6d5c9535fce99fab023aabc7215b52eed15454333428b065fb5d8b03aa2fe1de5004f9d8fca717bcd682f1f9caa6561bdafbe69c8423166f7e33867f0bc4fdd85224ff1533839762530d47a1f053c40c7e38f84a1431ad03398bc9d634384aec0f22e75ac4a94e3703ec8715d0791564a8b1509eab4bf7543ef2e5c20fe9fb6c2a85afe42fcdba64c628103ea5693287a28ded79f517a3e877fe287ca6f3d1229295abaf5c1b3b43ab54ec4697c941da47e0934718b697a414d8fd1a722eb23ceb554afb1b4c807a94507a35b153f19da10c6688c71efa0d1ad15c8ac2f3d786ae8c43136cacf333c2643e521322314346b201427f1ac975340cf3caf102245d8cf45709bb51e41fd357f1fb7316138f1992e5646842eb4fe18ef6a7096f7e4c1e69950285f30c64dc1da661c055944356f140d6298f5eaf733799bef034a8afb05f6f74239e572acf5d1c2f9e028b806caab13eb19148456b3db0f719ad76818eaea11e7989e74d858743ffba738a5f5c7d12ab1b049c594656821620e20817c6acc5b3d3725f9183d3c01a0190d5d991d1603682418f4a9c55b59cab8787f463123e1efd7d3e7f75dfb9ccf931ae2dc965b82cabf2af6b93293a4b00d7145d97a24679076157bade5ba4d7577922052c719ebf2493f5e9d0cf8e6f82666e8732dd91068395e528d0ea532e27ae8a84ed516dabd30dd990a1539d93f7b775039d53f1a12d7e7747a64f6aca9d7589330c8adf8854dce0fee0be212716d6c1b075fabb9d0c815e613c772f7c57e7efdb4e64a5ef47c9cf384deab55191d7b4b0cb27986649eca2c4286a01a7d3c304f008c6d3fe53abf320afc7602654cf4b69b87fd2b9b6794fe7cc77e92bbef572dc8ddb1530da6d82268cd32db112afb8c2db69651959c1ad39d804178cae05f856539559e3dd0e869d9985f41262c30058d1d3c2cd336649b3a893bd4b29c206c53eeb337025a7585fc4bc05d8fe71035ea082ea543cbc15f8e6f0658815c7553795917958b503779cf6a18f92c391769e846327d3cd8458c089cb1e342a590eb57a583365c4bd5de34dc17992f5309fb69b67aa8436c763183a8f11a543fdb8a376a30836013fff3a2d21b72e22f1d9d031a3cd467365256e120894e1489c238df5ce65183b93d68024697245be8c0a9d60e31452d247a98136ca559622e2f4b35569ec8ab8539528a09214f1d3862bc97b21b7bb2b66c654ebee00eb26ec57988ff174cab65d4864eea14f15b65252fe534750bea3b9b4400c811ccf3e6517ecf1f1585d908f21b91bfd223eddbb9b980bb65133934c8027fde78865ed4d969bc6de3be613730d3a0f179f0ed734c67900da53c230045d60d31980401e7fa1396891d42555af8152bb0e6557d3c7d718f7ba85b6848ab052fcf709c7aea676d8c00c787a7fb2a2b1972d245aa51a24ceb13d7dd38cd0c214727a1000561828a62c969afa60d36cfab21b8e6837a0e0ac325c6c20e3ccd09fd1f5400dd6a7dc861e050bcb47ee89670d807b514e5b59ea830ef885ac6a0371efdcbb09e676fd9790e00ab9686f59b2ce173896d4d451e6fd61f3b95b82e63a494d7853c78c2f03e45cbabd46a4586364c131000d9efdc71d30d3caf25cdfad63a6628e67d5f219a0cafc5509f556cec7ac110ce0b52b552be6780e8d0c31a068dc6607ebc9cac4471cb1e85e5b6a0bc2330062f6930e2ef623da059da02902fa28586614a053625ea5901dc6151e7fae3a63b444b9d53630dea6b90d3c2ca7dd8db69f39a2ad6bc2eec08a85c1c0d0a9b079825278cf0b6f415344b0b6e4c7a51947e98ada9149c8f427914d8245b152f8f3558178d16e35498649a34ceb2fdaafc0d303829ddd9412c9a2b5ed1ce060472a9a85ffa19a4ddfbdb89437e72b261472d2b8c70a01a96562b753692c7329d75057a9918dbb3a39a90c86b66ec745a14e9909b2eae6c46dcd8c8a666973ba356124d6444353f1a34f88f907af897ea8e642f8603aed400d3d8a75568baa96b26b8d04f5fb0d1ca1256e7057f93464d95d1994ac5189ca607c013637fa35879a6c67c4806b6c9f00ccedb953103bbec21f054d304b621e0eca771accf5181409642d58ea8d032e06c27295e57092b4e3a89f47f47f16dc82f07dfad44ca7077385f62b4ad2efecb97955759c31977719316545b6fc6a78b7e35206719fcba4c1dca5d0f7f9959f7bd1c117532a2f7fc3ca87820e38cfab558dc48adb1058964b6ea9dfde5e06bff6b5d7af19fe6b8a46d0ec76f8902e525082591b82c2f86a30341787a1da86ab517063b39ae076b3f10e78f6c79dd58041b99ab40824b598f6c815733d62d262abeb96b8224b56e4109d4d5c445cd055a9cd2aea7753fc0f6a55bcf4291551a0d9c852e19e0f0603eefc9a79a38bc07a73f6e0f88a9d3eac01ca57d5d55e2ef870743522c15841b4ea7a0d278922cc977724571c75b5039a20f5dad843941d91fb421944b54923ed8c5f71edafbdfaf4c12dbe1c2b2a9642bbc2bd07017a44cb402d6ae09248eb24b70d43f751d3bf761ecef51f1f15239de25222852f95607335b3410050e5bd65f8c9657f0a95185e48dcb2f711641c0994e352b0039d569ddbd27182c263649d3e27b3816acd5822b31c98661adf01ee62db361be1b0469de4fc1c6e10185203eb44abe3d077fcbc52bef6095ca30c81a22b6e7a64c1385e7dd11209fc073a29ef656769fbb24d4292d98379884a1a2b2c7f6fd895577d739a2f0411e8afcee4de40927443f28e72aebc763fd0315ee85d29a23bb235ce82a5a621c0d9021965673720be9057a26b1ff0380263b54777f6cc7b7531d284f5041d4480108e4b4986f1ddec9e65dd2392c7fa0349c2a39954e4aeec8fe8f40e66db57d29beaf0046d9387482bab71a9397d90611cf767637c8666da87d5f1d798558cbb7228844010510cb95b073cec3878893ba70549eb6d3428b8db6944118f6de2ee7107b593ef85441cba46238f7843c4e6e7497f14cc64c25653c87da756226ce774c2b5e43294f2ebab2f601e9fe3f2d1d3172cfcc7e6eb7ea9b237e5f093443b02f42b4ea85673a6a0000ef9a6ddf2263a1a75eb7b78d3f90b1de91a22d78aa06d9626b0f9090ee63d92418b084db647132e3b0b7f3ed583eec280d06b94a358daffcd333233fb390ba8bf2da3921b18adf6cd4901cbabf4f4e3c90f21eb3190c8c0e4f16ac25dd546859bc640354ab9769553aeda466191ba4b10f52da5342347685e52af5d20ba8c113e65663bcedc12c99e576c4e1bdde013017d16fc26e3f30418c21d72ad6507ef1c8d437342d0fc20ad102e6c49eb9a8e7a3df5366c9a75b6d95ab007a3d93bca0086414ac5bc44a872659f43f0f703b415ac0e9aeeedb2c0cb945938923dc0865c5d3ff673e068d2865b11c68774cd6c0be1caa40627425bdc4ecbbd0a642f9c6953464e2f20681994be8483d64ed6d2d8efa79c5b12776900e58b45bea18c2e0220ea27e9670485e2c6ce9f52ac08cad61ca57b839710209db8a5d4fe95a846960b126271e519545e5d4d15300fc0ef2f35b8def7ba6f639d85404b57bac35140bef1c4f3b455773bf2a2eae62118dcdc5474ec0900aca49300833417786d1fb0d76a56570cfa10d23dbab0305e1c9c48032b19fd2ec2e00b1528a248036590e26e8c75209d004e20bc7730b29cf3ed860848b83ab91ad6a635f2cc1eca89e16814f34f2c1c2766a28b2901170bb4839f08f5685e593b8a5ce2a801194818b4aeb0a01794f92c7bc4144808e997cfd1711485b60483cf4a310b23e0210c5c73e6956b9e1ae696f1ea79b3fab788bf229a349fd9caedebd5db99821b1cebdceafb011cfcd1c78f93774b35f25c7e69952b0bca1a0d40791b812614e996ca31548bc0000000018cfdaa0e005288781053297011220757d23cec40eef9728417e68a5c6fb70b35e4fe58d34da55f305b013d24795a91802226b483045022100ae926c96c746308e7488e022f4ad1db94d5d0c8683f6fa6ded3afb13d8e20578022074aa8ebfe20adaf25beed70c60cfb5007278bec17875f11f7a5b3c86eb60a96901210391abdcd113c40b56f13a548e8624d6ad8d7a162b33ef81020d046cadbda2663728feffffff0f3a3f1a1976a914d79c1c8b67a0275c60e33b67bbd0e19a79b9276388ac222251477652524658424d32666558755533394577484e75595953726e4d33486155794d3a2910011a256a23426c6f636b73747265616d2e696e666f206973206120636f6f6c206578706c6f7265723a060a02048010024002" ) func init() { diff --git a/bchain/coins/litecoin/litecoinparser.go b/bchain/coins/litecoin/litecoinparser.go index 6780054047..e95ca8d443 100644 --- a/bchain/coins/litecoin/litecoinparser.go +++ b/bchain/coins/litecoin/litecoinparser.go @@ -45,10 +45,12 @@ type LitecoinParser struct { // NewLitecoinParser returns new LitecoinParser instance func NewLitecoinParser(params *chaincfg.Params, c *btc.Configuration) *LitecoinParser { - return &LitecoinParser{ + p := &LitecoinParser{ BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c), baseparser: &bchain.BaseParser{}, } + p.VSizeSupport = true + return p } // GetChainParams contains network parameters for the main Litecoin network, diff --git a/bchain/coins/litecoin/litecoinparser_test.go b/bchain/coins/litecoin/litecoinparser_test.go index 94ed68ba59..9db208692a 100644 --- a/bchain/coins/litecoin/litecoinparser_test.go +++ b/bchain/coins/litecoin/litecoinparser_test.go @@ -224,7 +224,7 @@ func TestGetAddressesFromAddrDesc_Mainnet(t *testing.T) { var ( testTx1 bchain.Tx - testTxPacked1 = "0a201c50c1770374d7de2f81a87463a5225bb620d25fd467536223a5b715a47c9e3212c90102000000031e1977dc524bec5929e95d8d0946812944b7b5bda12f5b99fdf557773f2ee65e0100000000ffffffff8a398e44546dce0245452b90130e86832b21fd68f26662bc33aeb7c6c115d23c1900000000ffffffffb807ab93a7fcdff7af6d24581a4a18aa7c1db1ebecba2617a6805b009513940f0c00000000ffffffff020001a04a000000001976a9141ae882e788091732da6910595314447c9e38bd8d88ac27440f00000000001976a9146b474cbf0f6004329b630bdd4798f2c23d1751b688ac000000001890d5abd405200028d3c807322c0a0012205ee62e3f7757f5fd995b2fa1bdb5b744298146098d5de92959ec4b52dc77191e180128ffffffff0f322c0a0012203cd215c1c6b7ae33bc6266f268fd212b83860e13902b454502ce6d54448e398a181928ffffffff0f322c0a0012200f941395005b80a61726baecebb11d7caa184a1a58246daff7dffca793ab07b8180c28ffffffff0f3a470a044aa0010010001a1976a9141ae882e788091732da6910595314447c9e38bd8d88ac22224c4d67454e4e587a7a755078703776664d6a44724355343462736d72454d677176633a460a030f442710011a1976a9146b474cbf0f6004329b630bdd4798f2c23d1751b688ac22224c563142796a624a4e46544879465171777177644a584b4a7a6e59447a587a6734424002" + testTxPacked1 = "0a201c50c1770374d7de2f81a87463a5225bb620d25fd467536223a5b715a47c9e3212c90102000000031e1977dc524bec5929e95d8d0946812944b7b5bda12f5b99fdf557773f2ee65e0100000000ffffffff8a398e44546dce0245452b90130e86832b21fd68f26662bc33aeb7c6c115d23c1900000000ffffffffb807ab93a7fcdff7af6d24581a4a18aa7c1db1ebecba2617a6805b009513940f0c00000000ffffffff020001a04a000000001976a9141ae882e788091732da6910595314447c9e38bd8d88ac27440f00000000001976a9146b474cbf0f6004329b630bdd4798f2c23d1751b688ac000000001890d5abd40528d3c807322a12205ee62e3f7757f5fd995b2fa1bdb5b744298146098d5de92959ec4b52dc77191e180128ffffffff0f322a12203cd215c1c6b7ae33bc6266f268fd212b83860e13902b454502ce6d54448e398a181928ffffffff0f322a12200f941395005b80a61726baecebb11d7caa184a1a58246daff7dffca793ab07b8180c28ffffffff0f3a450a044aa001001a1976a9141ae882e788091732da6910595314447c9e38bd8d88ac22224c4d67454e4e587a7a755078703776664d6a44724355343462736d72454d677176633a460a030f442710011a1976a9146b474cbf0f6004329b630bdd4798f2c23d1751b688ac22224c563142796a624a4e46544879465171777177644a584b4a7a6e59447a587a6734424002489101" ) func init() { @@ -235,6 +235,7 @@ func init() { Txid: "1c50c1770374d7de2f81a87463a5225bb620d25fd467536223a5b715a47c9e32", LockTime: 0, Version: 2, + VSize: 145, Vin: []bchain.Vin{ { ScriptSig: bchain.ScriptSig{ diff --git a/bchain/coins/monetaryunit/monetaryunitparser_test.go b/bchain/coins/monetaryunit/monetaryunitparser_test.go index 47b5a42333..c4dc8b7e55 100644 --- a/bchain/coins/monetaryunit/monetaryunitparser_test.go +++ b/bchain/coins/monetaryunit/monetaryunitparser_test.go @@ -150,7 +150,7 @@ func Test_GetAddressesFromAddrDesc(t *testing.T) { var ( testTx1 bchain.Tx - testTxPacked1 = "0a20f05ba72a05c4900ff2a00a0403697750201e41267aeea8a589a7dc7bcc57076e12d30101000000010c396f3768565c707addf85ecf47e04cefb2721d95afd977e13f25904de8336a0100000049483045022100fe1b79f38ca4b9dc2fbc50eac6c9bf050ae5a3ee37da05b950918230eb0a8c7c0220477173b60ec00a8b4b28d5db9fc5d8259eea35f91bbdd60089c5ec1be7b05f3b01ffffffff03000000000000000000dd400def140000002321025d145b77df04c40ceb88ea36828755f8275dc5fecf19d3ecccce2d8198c3407cac00d2496b000000001976a914afe70b2e1bf4199298ed8281767bae22970b415088ac0000000018e6b092e605200028f48d1b32770a0012206a33e84d90253fe177d9af951d72b2ef4ce047cf5ef8dd7a705c5668376f390c18012249483045022100fe1b79f38ca4b9dc2fbc50eac6c9bf050ae5a3ee37da05b950918230eb0a8c7c0220477173b60ec00a8b4b28d5db9fc5d8259eea35f91bbdd60089c5ec1be7b05f3b0128ffffffff0f3a04100022003a520a0514ef0d40dd10011a2321025d145b77df04c40ceb88ea36828755f8275dc5fecf19d3ecccce2d8198c3407cac22223764396a4e79716835694b555a566e516a6d7a6d4541513878444b777a4536536e673a470a046b49d20010021a1976a914afe70b2e1bf4199298ed8281767bae22970b415088ac22223769536a6e57436f41556d4a347656584d6b61457561736e5658537a5a7166504c324001" + testTxPacked1 = "0a20f05ba72a05c4900ff2a00a0403697750201e41267aeea8a589a7dc7bcc57076e12d30101000000010c396f3768565c707addf85ecf47e04cefb2721d95afd977e13f25904de8336a0100000049483045022100fe1b79f38ca4b9dc2fbc50eac6c9bf050ae5a3ee37da05b950918230eb0a8c7c0220477173b60ec00a8b4b28d5db9fc5d8259eea35f91bbdd60089c5ec1be7b05f3b01ffffffff03000000000000000000dd400def140000002321025d145b77df04c40ceb88ea36828755f8275dc5fecf19d3ecccce2d8198c3407cac00d2496b000000001976a914afe70b2e1bf4199298ed8281767bae22970b415088ac0000000018e6b092e60528f48d1b327512206a33e84d90253fe177d9af951d72b2ef4ce047cf5ef8dd7a705c5668376f390c18012249483045022100fe1b79f38ca4b9dc2fbc50eac6c9bf050ae5a3ee37da05b950918230eb0a8c7c0220477173b60ec00a8b4b28d5db9fc5d8259eea35f91bbdd60089c5ec1be7b05f3b0128ffffffff0f3a0222003a520a0514ef0d40dd10011a2321025d145b77df04c40ceb88ea36828755f8275dc5fecf19d3ecccce2d8198c3407cac22223764396a4e79716835694b555a566e516a6d7a6d4541513878444b777a4536536e673a470a046b49d20010021a1976a914afe70b2e1bf4199298ed8281767bae22970b415088ac22223769536a6e57436f41556d4a347656584d6b61457561736e5658537a5a7166504c324001" ) func init() { diff --git a/bchain/coins/namecoin/namecoinparser.go b/bchain/coins/namecoin/namecoinparser.go index 9ec24c0826..9cf89e335e 100644 --- a/bchain/coins/namecoin/namecoinparser.go +++ b/bchain/coins/namecoin/namecoinparser.go @@ -34,7 +34,9 @@ type NamecoinParser struct { // NewNamecoinParser returns new NamecoinParser instance func NewNamecoinParser(params *chaincfg.Params, c *btc.Configuration) *NamecoinParser { - return &NamecoinParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p := &NamecoinParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p.VSizeSupport = true + return p } // GetChainParams contains network parameters for the main Namecoin network, diff --git a/bchain/coins/nuls/nulsrpc.go b/bchain/coins/nuls/nulsrpc.go index 001cb6dfd9..3c73bed8bc 100644 --- a/bchain/coins/nuls/nulsrpc.go +++ b/bchain/coins/nuls/nulsrpc.go @@ -471,7 +471,7 @@ func (n *NulsRPC) EstimateFee(blocks int) (big.Int, error) { return *big.NewInt(100000), nil } -func (n *NulsRPC) SendRawTransaction(tx string) (string, error) { +func (n *NulsRPC) SendRawTransaction(tx string, alternativeRPC bool) (string, error) { broadcast := CmdTxBroadcast{} req := struct { TxHex string `json:"txHex"` diff --git a/bchain/coins/omotenashicoin/omotenashicoinparser_test.go b/bchain/coins/omotenashicoin/omotenashicoinparser_test.go index 7359753224..1bf03c097f 100755 --- a/bchain/coins/omotenashicoin/omotenashicoinparser_test.go +++ b/bchain/coins/omotenashicoin/omotenashicoinparser_test.go @@ -151,11 +151,11 @@ func Test_GetAddressesFromAddrDesc(t *testing.T) { var ( // Block Height 600 testTx1 bchain.Tx - testTxPacked_testnet_1 = "0a2054af08185cf5c5d312ebd9865b4b224c6120801b209343cfb9dc3332af28a2a5126401000000010000000000000000000000000000000000000000000000000000000000000000ffffffff050258020101ffffffff0100e87648170000002321024a9c0d55966c7a46d8ac15830c6c26555a2b570a3e78c51534ccc8dadc7943c8ac000000001894e38ff105200028d80432140a0a30323538303230313031180028ffffffff0f3a520a05174876e80010001a2321024a9c0d55966c7a46d8ac15830c6c26555a2b570a3e78c51534ccc8dadc7943c8ac2222616e667766545642725934795a4e54543167625a61584e664854377951544856674d4000" + testTxPacked_testnet_1 = "0a2054af08185cf5c5d312ebd9865b4b224c6120801b209343cfb9dc3332af28a2a5126401000000010000000000000000000000000000000000000000000000000000000000000000ffffffff050258020101ffffffff0100e87648170000002321024a9c0d55966c7a46d8ac15830c6c26555a2b570a3e78c51534ccc8dadc7943c8ac000000001894e38ff10528d80432120a0a3032353830323031303128ffffffff0f3a500a05174876e8001a2321024a9c0d55966c7a46d8ac15830c6c26555a2b570a3e78c51534ccc8dadc7943c8ac2222616e667766545642725934795a4e54543167625a61584e664854377951544856674d" // Block Height 135001 testTx2 bchain.Tx - testTxPacked_mainnet_1 = "0a20a2eedb3990bddcace3a5211332e86f70d0195a2a7efaad2de18698172ff9fc6d128f0102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1803590f020445b8075e088104e0b22c0000007969696d70000000000002807c814a000000001976a91487bac515ab40891b58a05c913f908194c9d73bd588ac807584df000000001976a914a1441e207bd13f80b2142026ad39a58b5f47434d88ac0000000018c4f09ef005200028d99e0832360a30303335393066303230343435623830373565303838313034653062323263303030303030373936393639366437303030180028003a470a044a817c8010001a1976a91487bac515ab40891b58a05c913f908194c9d73bd588ac2222535a66667a6a666454486f7a394675684a5444453847704378455762544c433654743a470a04df84758010001a1976a914a1441e207bd13f80b2142026ad39a58b5f47434d88ac222253627a685264475855475245556b70557a67716877615847666f4244447565366b364000" + testTxPacked_mainnet_1 = "0a20a2eedb3990bddcace3a5211332e86f70d0195a2a7efaad2de18698172ff9fc6d128f0102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1803590f020445b8075e088104e0b22c0000007969696d70000000000002807c814a000000001976a91487bac515ab40891b58a05c913f908194c9d73bd588ac807584df000000001976a914a1441e207bd13f80b2142026ad39a58b5f47434d88ac0000000018c4f09ef00528d99e0832320a303033353930663032303434356238303735653038383130346530623232633030303030303739363936393664373030303a450a044a817c801a1976a91487bac515ab40891b58a05c913f908194c9d73bd588ac2222535a66667a6a666454486f7a394675684a5444453847704378455762544c433654743a450a04df8475801a1976a914a1441e207bd13f80b2142026ad39a58b5f47434d88ac222253627a685264475855475245556b70557a67716877615847666f4244447565366b36" ) func init() { diff --git a/bchain/coins/optimism/evm.go b/bchain/coins/optimism/evm.go new file mode 100644 index 0000000000..e1f7e51e21 --- /dev/null +++ b/bchain/coins/optimism/evm.go @@ -0,0 +1,45 @@ +package optimism + +import ( + "context" + + "github.com/ethereum/go-ethereum/rpc" + "github.com/trezor/blockbook/bchain" +) + +// OptimismRPCClient wraps an rpc client to implement the EVMRPCClient interface +type OptimismRPCClient struct { + *rpc.Client +} + +// EthSubscribe subscribes to events and returns a client subscription that implements the EVMClientSubscription interface +func (c *OptimismRPCClient) EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (bchain.EVMClientSubscription, error) { + sub, err := c.Client.EthSubscribe(ctx, channel, args...) + if err != nil { + return nil, err + } + + return &OptimismClientSubscription{ClientSubscription: sub}, nil +} + +// CallContext performs a JSON-RPC call with the given arguments +func (c *OptimismRPCClient) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error { + if err := c.Client.CallContext(ctx, result, method, args...); err != nil { + return err + } + + // special case to handle empty gas price for a valid rpc transaction + // (https://goerli-optimism.etherscan.io/tx/0x9b62094073147508471e3371920b68070979beea32100acdc49c721350b69cb9) + if r, ok := result.(*bchain.RpcTransaction); ok { + if *r != (bchain.RpcTransaction{}) && r.GasPrice == "" { + r.GasPrice = "0x0" + } + } + + return nil +} + +// OptimismClientSubscription wraps a client subcription to implement the EVMClientSubscription interface +type OptimismClientSubscription struct { + *rpc.ClientSubscription +} diff --git a/bchain/coins/optimism/optimismrpc.go b/bchain/coins/optimism/optimismrpc.go new file mode 100644 index 0000000000..3149bf6aae --- /dev/null +++ b/bchain/coins/optimism/optimismrpc.go @@ -0,0 +1,75 @@ +package optimism + +import ( + "context" + "encoding/json" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" +) + +const ( + // MainNet is production network + MainNet eth.Network = 10 +) + +// OptimismRPC is an interface to JSON-RPC optimism service. +type OptimismRPC struct { + *eth.EthereumRPC +} + +// NewOptimismRPC returns new OptimismRPC instance. +func NewOptimismRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + c, err := eth.NewEthereumRPC(config, pushHandler) + if err != nil { + return nil, err + } + + s := &OptimismRPC{ + EthereumRPC: c.(*eth.EthereumRPC), + } + + return s, nil +} + +// Initialize bnb smart chain rpc interface +func (b *OptimismRPC) Initialize() error { + b.OpenRPC = eth.OpenRPC + + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + // set chain specific + b.Client = ec + b.RPC = rc + b.MainNetChainID = MainNet + b.NewBlock = eth.NewEthereumNewBlock() + b.NewTx = eth.NewEthereumNewTx() + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + id, err := b.Client.NetworkID(ctx) + if err != nil { + return err + } + + // parameters for getInfo request + switch eth.Network(id.Uint64()) { + case MainNet: + b.Testnet = false + b.Network = "livenet" + default: + return errors.Errorf("Unknown network id %v", id) + } + + b.InitAlternativeProviders() + + glog.Info("rpc: block chain ", b.Network) + + return nil +} diff --git a/bchain/coins/pivx/pivxparser.go b/bchain/coins/pivx/pivxparser.go index 4dc92943f7..bd0c280086 100644 --- a/bchain/coins/pivx/pivxparser.go +++ b/bchain/coins/pivx/pivxparser.go @@ -2,8 +2,10 @@ package pivx import ( "bytes" + "encoding/binary" "encoding/hex" "encoding/json" + "fmt" "io" "math/big" @@ -13,7 +15,6 @@ import ( "github.com/martinboehm/btcutil/chaincfg" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/bchain/coins/btc" - "github.com/trezor/blockbook/bchain/coins/utils" ) // magic numbers @@ -100,7 +101,12 @@ func (p *PivXParser) ParseBlock(b []byte) (*bchain.Block, error) { r.Seek(32, io.SeekCurrent) } - err = utils.DecodeTransactions(r, 0, wire.WitnessEncoding, &w) + if h.Version > 7 { + // Skip new hashFinalSaplingRoot (block version 8 or newer) + r.Seek(32, io.SeekCurrent) + } + + err = p.PivxDecodeTransactions(r, 0, &w) if err != nil { return nil, errors.Annotatef(err, "DecodeTransactions") } @@ -255,6 +261,90 @@ func (p *PivXParser) GetAddrDescForUnknownInput(tx *bchain.Tx, input int) bchain return s } +func (p *PivXParser) PivxDecodeTransactions(r *bytes.Reader, pver uint32, blk *wire.MsgBlock) error { + maxTxPerBlock := uint64((wire.MaxBlockPayload / 10) + 1) + + txCount, err := wire.ReadVarInt(r, pver) + if err != nil { + return err + } + + // Prevent more transactions than could possibly fit into a block. + // It would be possible to cause memory exhaustion and panics without + // a sane upper bound on this count. + if txCount > maxTxPerBlock { + str := fmt.Sprintf("too many transactions to fit into a block "+ + "[count %d, max %d]", txCount, maxTxPerBlock) + return &wire.MessageError{Func: "utils.decodeTransactions", Description: str} + } + + blk.Transactions = make([]*wire.MsgTx, 0, txCount) + for i := uint64(0); i < txCount; i++ { + tx := wire.MsgTx{} + + // read version & seek back to original state + var version uint32 = 0 + if err = binary.Read(r, binary.LittleEndian, &version); err != nil { + return err + } + if _, err = r.Seek(-4, io.SeekCurrent); err != nil { + return err + } + + txVersion := version & 0xffff + enc := wire.WitnessEncoding + + // shielded transactions + if txVersion >= 3 { + enc = wire.BaseEncoding + } + + err := p.PivxDecode(&tx, r, pver, enc) + if err != nil { + return err + } + blk.Transactions = append(blk.Transactions, &tx) + } + + return nil +} + +func (p *PivXParser) PivxDecode(MsgTx *wire.MsgTx, r *bytes.Reader, pver uint32, enc wire.MessageEncoding) error { + if err := MsgTx.BtcDecode(r, pver, enc); err != nil { + return err + } + + // extra + version := uint32(MsgTx.Version) + txVersion := version & 0xffff + + if txVersion >= 3 { + // valueBalance + r.Seek(9, io.SeekCurrent) + + vShieldedSpend, err := wire.ReadVarInt(r, 0) + if err != nil { + return err + } + if vShieldedSpend > 0 { + r.Seek(int64(vShieldedSpend*384), io.SeekCurrent) + } + + vShieldOutput, err := wire.ReadVarInt(r, 0) + if err != nil { + return err + } + if vShieldOutput > 0 { + r.Seek(int64(vShieldOutput*948), io.SeekCurrent) + } + + // bindingSig + r.Seek(64, io.SeekCurrent) + } + + return nil +} + // Checks if script is OP_ZEROCOINMINT func isZeroCoinMintScript(signatureScript []byte) bool { return len(signatureScript) > 1 && signatureScript[0] == OP_ZEROCOINMINT diff --git a/bchain/coins/pivx/pivxparser_test.go b/bchain/coins/pivx/pivxparser_test.go index 3931f2947d..94e3f1e164 100644 --- a/bchain/coins/pivx/pivxparser_test.go +++ b/bchain/coins/pivx/pivxparser_test.go @@ -122,15 +122,15 @@ func Test_GetAddressesFromAddrDesc(t *testing.T) { var ( // regular transaction testTx1 bchain.Tx - testTxPacked1 = "0a2052b116d26f7c8b633c284f8998a431e106d837c0c5888f9ea5273d36c4556bec12f501010000000188557c816acd0a61579b701278c7dde85ea25d57877f9dbc65d3b2df2feacc42320000006b483045022100f5d0e98d064d5256852e420a4a3779527fb182c5edbfecf6143fc70eeba8eeef02202f0b2445185fbf846cca07c56c317733a9a4e46f960615f541da7aa27c33cfa201210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae73ffffffff03000000000000000000f06832fa0100000023210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae73aca038370e000000001976a914b4aa56c103b398f875bb8d15c3bb4136aa62725f88ac000000001883a8aacd0520002880ea303299010a00122042ccea2fdfb2d365bc9d7f87575da25ee8ddc77812709b57610acd6a817c55881832226b483045022100f5d0e98d064d5256852e420a4a3779527fb182c5edbfecf6143fc70eeba8eeef02202f0b2445185fbf846cca07c56c317733a9a4e46f960615f541da7aa27c33cfa201210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae7328ffffffff0f3a0210003a520a0501fa3268f010011a23210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae73ac2222444b4c33517a43624a71724870524b4148764571736f6d7344686b515076567a5a673a470a040e3738a010021a1976a914b4aa56c103b398f875bb8d15c3bb4136aa62725f88ac2222444d634e45393855667571454b32674746664b4234597057415771627748524154484000" + testTxPacked1 = "0a2052b116d26f7c8b633c284f8998a431e106d837c0c5888f9ea5273d36c4556bec12f501010000000188557c816acd0a61579b701278c7dde85ea25d57877f9dbc65d3b2df2feacc42320000006b483045022100f5d0e98d064d5256852e420a4a3779527fb182c5edbfecf6143fc70eeba8eeef02202f0b2445185fbf846cca07c56c317733a9a4e46f960615f541da7aa27c33cfa201210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae73ffffffff03000000000000000000f06832fa0100000023210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae73aca038370e000000001976a914b4aa56c103b398f875bb8d15c3bb4136aa62725f88ac000000001883a8aacd052880ea30329701122042ccea2fdfb2d365bc9d7f87575da25ee8ddc77812709b57610acd6a817c55881832226b483045022100f5d0e98d064d5256852e420a4a3779527fb182c5edbfecf6143fc70eeba8eeef02202f0b2445185fbf846cca07c56c317733a9a4e46f960615f541da7aa27c33cfa201210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae7328ffffffff0f3a003a520a0501fa3268f010011a23210251c5555ff3c684aebfca92f5329e2f660da54856299da067060a1bcf5e8fae73ac2222444b4c33517a43624a71724870524b4148764571736f6d7344686b515076567a5a673a470a040e3738a010021a1976a914b4aa56c103b398f875bb8d15c3bb4136aa62725f88ac2222444d634e45393855667571454b32674746664b423459705741577162774852415448" // transaction with OP_ZEROCOINMINT testTx2 bchain.Tx - testTxPacked2 = "0a20599d5d797a4575eb25e1c291c0e7630bd6fdc0e6ec5fa9b14147f929a4e41bf212ae020100000001b56a0fe242a8de7dcbb58ae1009e44e7f2ec25a65eeb8b815cf53393309741ca0100000049483045022100cc208a59341dca98207ec8a4a42c014d435192694a77c69d40e51467800c0a0802205ac1782d4ecefa260b33340d92c2ab2396b43c1073a67b4180aa8ef2aede8af801ffffffff0200e876481700000087c10281004c816f5ce1eeda911203319a256e8560c8dbfd47b569ff32c27559bda78854e63e49718ce43036e5120dce357b5630afd745d399f91e675a921adbb45224a6661656217fcfe32396fb25609b724646759116326964f2f1f7ddb7c340dc24be2b75a0a9dc05ca2fdf805c03c7a04d972456beb82a51de73d8842b39a553919dfa5d8e003e98dab7210000001976a914dda91c0396050d660f9c0e38f78064486bbfcb2c88ac00000000189dab96cf05200028b8dc3432770a001220ca4197309333f55c818beb5ea625ecf2e7449e00e18ab5cb7ddea842e20f6ab518012249483045022100cc208a59341dca98207ec8a4a42c014d435192694a77c69d40e51467800c0a0802205ac1782d4ecefa260b33340d92c2ab2396b43c1073a67b4180aa8ef2aede8af80128ffffffff0f3a93010a05174876e80010001a8701c10281004c816f5ce1eeda911203319a256e8560c8dbfd47b569ff32c27559bda78854e63e49718ce43036e5120dce357b5630afd745d399f91e675a921adbb45224a6661656217fcfe32396fb25609b724646759116326964f2f1f7ddb7c340dc24be2b75a0a9dc05ca2fdf805c03c7a04d972456beb82a51de73d8842b39a553919dfa5d8e003a480a0521b7da983e10011a1976a914dda91c0396050d660f9c0e38f78064486bbfcb2c88ac222244524d38546169593338716348626764797470386f455472656f62424c48747065454000" + testTxPacked2 = "0a20599d5d797a4575eb25e1c291c0e7630bd6fdc0e6ec5fa9b14147f929a4e41bf212ae020100000001b56a0fe242a8de7dcbb58ae1009e44e7f2ec25a65eeb8b815cf53393309741ca0100000049483045022100cc208a59341dca98207ec8a4a42c014d435192694a77c69d40e51467800c0a0802205ac1782d4ecefa260b33340d92c2ab2396b43c1073a67b4180aa8ef2aede8af801ffffffff0200e876481700000087c10281004c816f5ce1eeda911203319a256e8560c8dbfd47b569ff32c27559bda78854e63e49718ce43036e5120dce357b5630afd745d399f91e675a921adbb45224a6661656217fcfe32396fb25609b724646759116326964f2f1f7ddb7c340dc24be2b75a0a9dc05ca2fdf805c03c7a04d972456beb82a51de73d8842b39a553919dfa5d8e003e98dab7210000001976a914dda91c0396050d660f9c0e38f78064486bbfcb2c88ac00000000189dab96cf0528b8dc3432751220ca4197309333f55c818beb5ea625ecf2e7449e00e18ab5cb7ddea842e20f6ab518012249483045022100cc208a59341dca98207ec8a4a42c014d435192694a77c69d40e51467800c0a0802205ac1782d4ecefa260b33340d92c2ab2396b43c1073a67b4180aa8ef2aede8af80128ffffffff0f3a91010a05174876e8001a8701c10281004c816f5ce1eeda911203319a256e8560c8dbfd47b569ff32c27559bda78854e63e49718ce43036e5120dce357b5630afd745d399f91e675a921adbb45224a6661656217fcfe32396fb25609b724646759116326964f2f1f7ddb7c340dc24be2b75a0a9dc05ca2fdf805c03c7a04d972456beb82a51de73d8842b39a553919dfa5d8e003a480a0521b7da983e10011a1976a914dda91c0396050d660f9c0e38f78064486bbfcb2c88ac222244524d38546169593338716348626764797470386f455472656f62424c4874706545" // transaction with OP_ZEROCOINSPEND testTx3 bchain.Tx - testTxPacked3 = "0a20b65181decb00e684fef238776a0a129db4e1ffdfc454f6ef323e5f7a8deae6a812e1ab0101000000010000000000000000000000000000000000000000000000000000000000000000fffffffffd8a55c2028655e8030000dc8ce67bfe1851477371a9ac40b6ae0cb8571f6e2d5285855288f6079f1ce7239ee8c85f465b1820058b79554f41af297e9caf95ce0084b7c35dea0b95e15a2fb9f8e62c5427c1c36120cbc1fc11ff344909079335209c6b84b45a9211cac960f64e9432ba5eb6e4ecb2068223dfe3d85b345da17bf374f9140c9577c148bcc431c9ec3c7d13bd2363dba821381ed9fa0614416261e88330b3e74c40e6561310eab3f26f092e72f3cab761f373d02680dfb52937bd9515be242f6573754f8f665523cce3bd606c8ad190954f8181577fd0efe7cc64b711d03774958df4a5211e44870302056557777951d7ff8c002161a6a59e979f05469cb31770bd484be6525625359979220eb7e9912e835065fb00fd000216aefbae3525166510814d1636b76b0d48ea3cd54a3a17b136a84340989d75f74ff952966830e4c0d59daa006d5a7190978270ee9475a0778afaf002cdce7efdbfad630f72838b5c4a3b538ba61b94bbd9e353437a50725af5f16fbcbf36bb34e7da54e5c24dfc90b545f95c973877bfadc2703ee10585a1fc1c97d7377bf41c9cbcd5a313849a3c826e7c1301083694e6dc05f46899a901ab4a8d7f6b3600df280157fbef6eca4c28fc610957a42a9acf7c4d7f9846ab6b9b04fa6abb5fefc168d45f10078b97d4d6a39638588a1c19e1bfc472657861a902c2d52cd32fb0463746f649ae88bc0602dbf35816fbccf91dc249be809160cbc7f8b6702d6cc5b81fdebd283231f40758afc899f6fecedc51dc4e5d09cb8961092220541f75ddad45680ea92b4ee78c29f58c197a68420bbb25b450c72d02d7249f7facf9927378620eb36fbf9b4ccbcb55627eb9cf905b4a4c65fcb77a537f642f10901b6e94afa37e4afb0d6d91194454a9c2dd8ef8fe4316f8594c7822a7d58cab09657cf501da5be5a44f947bb957b71e4291a7fc60cd5cef9f0676f7c89123c7ff1ae2e6dc001b6f19785534e207fed2bade8597541b13714284f67d6986bc616ef1b0adbe415242fee85acbf482a6a48b3f142ef7ddb5dd1c97a4b0c53c6ac7aceb8c042d9c9ada1bc986b8c276d07fbf8512a3dae6a357fc02b167eb85000040e8693e45fd000200e23abd27b258f9827ed58545a507bd465e255e1156610da314bf7df68b6b55129df84c7b19e362751ebb9beba10790c9c26c5ddc7f087258d81b006c0d2e92be0178bf5edf6e78e89f73cd97746afbb2551dbc97eafe32ae62e7f9ebcd14ad69faf74d2011d16f2c50775f4f499c87c3c50d9d5d486394c2a7f462675d2a4885493332e0610a78fc0c8b08eda42e4bfe93b8c7f80a911a7992a1deb7cca2e40933e1559815688d4e5ae5e58d706bc513e5108449a8393928b5b77ae73cb03fe212c6375b6c5e61fce9db16360a147e7f7fcd49e05a99711d4d5799be77f7e39d9d1397388d6680d4931b48798ce013256a586781ba80168bae63bed4d150b64a73f7d0ab0c9ebb42f5d4db40eeee303783249af4bbf334c660f8c084ed9a2e5fff8be230940a4a08b59418676ef005192365e4e67757288791ce4992b903a31537596cf6dad0be2af2418a6b9cc2c33e99d874168f6a29df189a869b16eb5d24400ab30e4eca9274114d646aaaa8bad45832b6c0ded2bfa698939a8af9d0af380d2afc58966afe0f45483ecad0f114b904cc2fafcf470dd4fb8f193795e8afc3243b4c946d5eac82babac6feaf4ff10bf53acdf8347fb9fb7a5ac4efcf160f0a7ef3576f439404a3078ea092f46f408a955c965344023d847fad7374cf145cadbc8348eeb2c5aa999ebeeb8a5548bb14e0092b184caee354020c19d66cb213fd0002729bdb186c4c494e17fd6effe29cbe7fbc539caca738d54f9ffc6e52a35a27da134192e2f7f4ee2a86af281b78670e662677e97a1ef008f10f42349fa83bf7841d88b1a457d38164a383ae9c6b974137d58216f22d135d30b9d6e7a74952a7e905f385141f4df088415d704cc3b03b2cd600cb5507f8ea1b53fc0e73031a3946c0d6269f020c9c26a3be3bfdcd37f8d3b9fd42538ebd72029fa0bd8eb57a4fe6769e1b43b5d5d7be311e12e52ee9dad67aa988dedc80ad616d7540381993d9de91a7fac6d08e4414254b9d1d72940fec032833a6b1a5605f4b62c47a86d70dbec5ec913d0a613d438cad385fedf24566bf79edd17238e55421520b95772224623f145100e663b2ba20161784f688afcf07a900ade1d48060d21be9ba9297697891c2584cb99a44868efbdf65178592ecfbadc92f4883662d6b21b7f266eb21815c7401b8e7da061e3258dd685f8cf65f2c2e407c913f85d053b05f6f92ed1299186632ddcf175ccbbc933044bdac5e10916917dea1146f77a8ba4b4fc8ce260b5deed395ecae9b81baa6b385fecca5d2982041c131ce02a1dec517ad2d459434aa3a514e7a4c6c1362401b1ab62b4c89bd7705d5072e0be5250c60c2fdd946bc73050d3b8bcfaa73165eee3660063f279e824d1e15f87307a40bc9e1ccc0f7d7087ba84fe9275742455241b61d3687d23eb9d7a9cc18072ed8be1492db46a454464090750eb0a393499a73d23f4c552ec6ae425a77f97d4285a7f287066b2198bfaa99073da6f4009755e59838e48cd5fe692962b87da3ea7e14b34b352fb2a4673eaaaa594a094610bd0cc566acafc21891b7b0c2470bbb338f579231e01c064f275c5ac9c2748cc50e7f2e36f2768d2a59c22d14b6b9a431f7772e716731c55ccbf086187fb15bd07a5af3040d468d4088ba9e6383f1df6dead9384758f2da81ee96370d9055ce5a0db56bbdccb57ab490f42a01e083b61c5157b3c00e2011dda865c7294cdfd2be5c03a1a36a4deda9cf03b500fd0101b3c97046a717a2f38fe2265185f4411cc68cce6cf9885a7a8fe6292eb9e3eca69fb6249774a8c82b888d22d5fcdd549846c3ebcf054c6bf07aa4d6b1c0d4d9bd8e16501f65373ceda249e9c760848fc86ea92fae7142d211c8bb4a287c91eb08cef7678ef1f445f76f81d464eb1d29ce5c6d6286d73d49cd0ef03b65376eb146a3ff69a487ec90b53c11cce613a586f22cd56fd34df6f7ad64fa3c68a6ae5c9dad99d4a3d2b0974ea1f627be4f0153c7b5fe472d0c562556c4d8d1c7c592bea45bb7886b74f8639f9487b2f6aebf4848b5718f2ce65b8f5a4efcf140e2857bc9c503f0058f9b6af16e75f2d530fbba8979f81569e6cc0bc04a54e30de4e03a9300fd00019b881d73a78b86771d41c0c2a9ebdb3899727f33d2d4d81dd27b6a00b4c7db265999b8442800750abde7cd97be0c691ed06b5d40da115546d90d4803e82c61d43eb5e2bc684adcf180be47660870921fdedb2ce43f33564541fc0debe175c6c49bdfb51378902dc709594b9b7d34d0af70b67c3c608aeb5185e78c1c39cc3080b71a36115f623a07a4e1a3e1f3e17b6f9f695f1a1acd9dd1319d0a0d67b337e64f720e5168c09196244bc71b083f302e042be19b6aa1f8ad61755f4883c3a1ae615252b884ca3cca5e18a023ad6725f08f9e0ffd60e7a73ccd29afc910d60dc99c06f5953c3e398ef615fca45f6a83f8a0be653d31a7e1a1666cc7334d9cad51fd00016f7efa38c8f9f478a6ea1217d8be9b7f0b01c5d1fa483c26e403eb3a4875aeebbd0e7eb8aab8472a5bd80e8be38df13526042952f813b71f8aeb4a2281bfe5e5d9ba70f7e4c9f477706da922899f505dd172e260ce5f008b59c0590d498ac50810e9a38d35f1a2ea4e9ce8f77e46d0b5604dbf94629cfb8b65453a0295eeca9d992365309b7956481a8c5080510a09183bd3358fb26933e15c83fe2ca6d186e631d72889a09464f5dafdc8a93dd100329071e52beb522bef1af0fbae0516ad3b02011e19a2b2924791b3f22679b78039c8356c0e6676e2451487f056d0cff064f55a992afba08f59af7606a809394772ff85c4c40673dd54eb30020c6a5cde3cfd0001ecbc47845e4a1f3c05c4e9d0a47e5e8996326f48d7ee1bd0e432c5f33fecf8a94feaf03f2da65525bbcb119c7928456c28f31c183a21af1acfcd9615669cf47a077f861f694bfc1831f1a71ab66540906c62b85274f63abcc53a37e3fccdc8563ca2153818b6b796473848d765d1c81d4e6f78ef8fce804184e04664c5c6af7c3abe4d92aac3f6ea99b84a3e53a7bf7679c26dc96804ac9e1443b054e3c55fe89315106a14646d06b84122861ac0ac27fe64fbee3c9807b0264a90eb9602187f4df2cc0c62b025ba70bbb30a7e43d533f32546d2e6f97537bc2d623a7f545676a37cb511614037d77fe21a35ce4a2275e7ea1d85b7bc19e477c61033f5effe7fa5d8ff48e2873845157b7a29718e6692704a9d864301fa254798555172c6277cce4ed5aebdff9c27a1bb37071677c16da15d6c1547c5b708e1988eba68befff1f1743342ad7cb89ec8731b567198953d965ef6e395d38b410a326ef3e262937c763179f22a076d17f848dc4e36be38d838d5788f121d771f23209a0d50fb3d016c5cbc47cec31069f7d22bd78691662d8b609932b9533bf828e213e5ed4e61f2b80f05acbc00fda0017bdc59c8a6a23d261cdf1dd10e91523503c3375a803755c29b6a84bac626708b7db937ed39f4053b5c6376b3988fc9388cc64dc07466c67704a32b703d5dd86d8fb8597cc2ff7ca190044c66638028855f29fdf2a0943c64125e3ad2487de6928bc34088957eb32d843613e6b588a91cbfd8c37c24ba655739cefdb203bc3061ff93498160c7e949823b0947c68b6c51dcdf038c538f50413266680ee23817ed9cb840e0094f6fd2277012aa2c6f82b086242e6332a4e00bb9c12c153dfea9340e681e63d72551f8830b2bb2587e5937685252928894bf90bfa174f62bf7ccd43415a094bb4142fcfe639c62f6eda0e4d7ee033f49f51eaa6a35b0f7f400992d8367a275e9d018a547430083c41a35ef543bb92e159efad39c5b84d127bc68dd581c308afd5f81654ffcdb3317dd6e21d5251916214e873c83b6ac197dbac6c1b93d79b9dd5da090be204b9765fdcf662c9296295610e42a0570a1503dd67c44e17936946f3a6ce61f82b13cf00a0b47d06f2cd28651b6af32ffc58304593d5ce81159ccc952ed980f93182fb468ebccadae4dab4565d64a5bcb3aec7a09d681fd24016a4905a3a143e4d61b16898fddbb0f9d7602ce865716b62ae4f9a37e2f6ab89de930e066db6f4a8667ccc4e79e7ac760642c33e5f24266540c9b4fbadda4c0aa1b6a74d02bdf2324ebf9598d8ba918438de1e3343be0b057925bdd52304581ef621fd085dc55cf8b45d605cb0b60047bfa935c2968d554753a615e75f24086b4e40508ecdeb411ed26c007a1110f3e73f504d7fdefb275cbb59cf9cd68bf4784b8845467fac90275f3bbcc2c14a87fbbd7d111441d6ba0833b9045db43975317aee170242b291f8b07254d395472bd4b67db7576bcf2460bf0c182f745a6cbbec3f680b7c6e0a85308bc3af8af3302355757a77a2fe3f98350e4ea1b3074e37a638c630d529141843583ba4b802e089e0a7ecaeeeb42079e072e64fa5251782cbc67ba9d46e4c7f502d44a06e5212d09f4dc5bef1f1dfc376d4a042f608b860971c44caeb3735cd57e19401314af06a73180918af7693ec5204b3f858806e6919af05a1a8c6daea2ee3f08fd2401c082f09f7042a7a0b6b484287050a15f5d8c1011c200d42eb51aff5a484fe1de9feaa264ed3022b6f5b1b54a4a316d3d7e2635210ad83e2d3c497bed46f417ed22804682529b034925dc785a2d74361d1db395d1681d71bc1b0635908ec3e92f850577f35912fe5c173402e6e2ed8003c64a57bb65a2013014a3ce14ccc725f733a50457a696396cac0a551cdda03a2ec81597031feaddd801a9bceaeb5f862a4cdb3eda06dc317a96b29c27d78dd977cc6f25d62bb967814fd1d7e87c675042522c904fadf1cff80289374de8f98df511de975011d877058aa7ea9cdf186ccfa5cfa5258e581ee7ee73e16dcfaa82f079a16c95e6ca4f49c037b2423c12006b549a0b80c5dc9b93685fd2a4bda99e5aea74eafe9d28149e94adc538198d459c7a9a45a1fd24011c69aaa26aa94954fb7dfae2d63eac286b4979e7d513eac8144a7bccc34fb298b7c556a82e7450bf590f1ae658c474ac7c12b3fccaec877b6bdd11fd9655a27b7b69b922b1629a24a8d7f81a6827dd22cbab62d121f5cf96d59be904022360c5bf04d2435c52541ea4d7f932e19fc471a0afb38f2e84668d974c57c963346d790a670a699ff53b5557def1ce9650a8624bb2065f9ce99d6b5361a1b39629040fc897a5d0a07816618840f86601508e90198de64d7091a8bda406009948fa9ebbf2f56adc66e057ab23152504438062867c4237ce2b99c020add16bf66a0c06a072c4fabd9b9fd1146b73366535d934328188798ccc18ad37d30e06a39b8e14468d32820d912359323b7d474dbf507e894a448a4e921f70d1fb4d4ac03b178ae157814004fda0015c202cbc492bde212955236761fcad7de9ec8932946b5352f6c35a242d39b354a1f96a706bcb84174a5b11a7e51cf0adeec9c1e5c88a3f8f32ca81977db668650734398e6feb45cbe0ed5c5d8f77cfa67b78f8c7c856629e6731321126d12ebe70603fe28d4281f5c9165e60749bc8688d7ff3cd509d958dcd1ac7b068a3548af0a3e20b984bf4406a6c6d55c674bc83240757e3a0515bbb626b6b6b863fa7029c5043d67ebcd531601d39b8b6b7e507a176216a264fb80f574d7a6a587d5ebba7c355007630fc49127368f6b672bd12fba956db75f189bd438f5034badc04d396b04a021608a7888434eefffd082efb0c3196698d1b015b42eb6f5a2123c085d37841c0cd6c7a1d77c55d61d76426758cdadcad3d7b1037b5d94c29962d4fe218c9f98c89ecdd9a50a48bc534bc167d536e11906bf594876aea01683269255701b705ac454b250abd45d10f4f8b881c6f4a360014b450132d750099100e15c70ef65ab0eeea340604f3c7b3eb3c51292036a6cc2843989ea418631fb595ca9d7e23a88a3a7d0a8dd5ec1212fc786dcf7107214d5c4d3f2cffffe2b1fbef09816033fdb616b9318b80b32f045ec1bec678dd1500480154ccdd87365d602f0126b57015784abee6fdb9b7f22ba135cb882dfa738baa17233fa53c68d35e4102f185c07a1310b710ff2d63db7238d36487ab504e64e239d0641137cd75cb282e831621f101663efb2f9de2520049c0d08a7c965477fef9d575ba31e101faaea20f96e40046132cd3aa981e8f360cb6a9bac68844d07c7d1741e56b104f634fa1a0c31d64ca4526de4f1754effc40aa04b9dfdb6f53ef77540d66fc9d0a4058fb46518433a1467a71873a03600b47c81e0d452cc44728e3a625235c84f7f62d753faf91fdfa1aea056925168616516e5c4357a7e82c94127fe8a4626c868bb7bcc13a0422e15e31c82935a4e1b9cac496bb456d1318e2e3e704627f1dbe646f5f1590283833193cb03f28e00f5020fbd43c5fdc39fd35498cf4fb7471417e814974331500d8e4ec8af34af39b457d20843d897d0e015456600325ef702c1bdfa7bbb3f2e7a74dcd8fd77beb3df4022320108d0f48a7a9b2a32e1587eb01094e20cb7c002d3de08f481a1d7cdc6b3f9c7c20185bc7ee65a12aa6003a58b83aa90d90baef64c7d324c662ea5138fbb4bd063720f8f9111e20def54a90755537e44fd506737cf1fcc4d0b320bef16eedbd750f8b2002e3af2f477e9d2912e50e4f03e43742c19e6e94c1ccf84ab04f0eff342bfc1020a544d7e745fa08a740418aa6da398bf10870a860427dcdbb857b6b41cec8e1342059eabb84637e61530039918cca60b860ef24c0df9e586b7ee9ce89336d5f1f7a210f0385ce2ad9f83a8534ab0325a42495a9cc4cd4774c9e8910bbf4e7192c2e98001fc3aae0957bc822f2aca9be874e1493a0dbad2ceaf959996060a2bc1781c23520cd178b0cfdcaa92929b9daef0c4dc752225792454327bc351b63765208972820203954fb6c5f5fa020f757c1bac415fec7e1bad3b7c19a93ba5ba53dc12f5ffc6720e7572f4709fdb74cdf2dbbf50a7bec9c10ee302cc2c5dd878bd109d1c87bfe3e20883ea4bb25deffe4bed0029e066230311cd71a4beafa608d43d615652cf9c146204c98a01cfce1f0ab321105b2f2659d375f691e2f6cd9eb821adc512718acdd6120d5f64f7950ad04508b36baeadb52228ed3a1139512125834c1f449b2a9613d67204550d2bb9a9333d567b6c2ab154f1fb4bde51d4b5c50307989ed07100095485720109b0b89090c8a2fb0c51f3f9ca1eab0e36b4d9200396e7958523e57b705d11b209195a60cb9f034fced26b3336b0c49872fa13d56cc410f59463e4f312c93423d20f52bbd6ff9d724752b5ecdb148a47e86c1378111d76e77a2f4434816e325c62920510cf87382f2a4c1417203c4e17511170ac616fca2caa49b521dd721a8183f1120ee7ab5b0de3332ec1fb81c2d5baaf0509eda6de26147b081866c2a9aaa3435882011ce790ec01637ff533a68dfd8fa22733bd7e4fefe18a5796e9bfaf996adf54b20509ea869f679c1ae8b074619487fedad28874cf9c93d01003e9dd0df2f45b66b20380577ba031eb78adb2c71bedc8154056b157ae0d01203c19d7df420a424f71521d04f8ed62e7175b7e70d7f92dafff586e5a60be02901f9f67e97374bcecfe7830020c6be51acd068843922b23415a1c7b39f4846da7584a496483a36612dc295968c204e43611bdc897913427fae390deb145024077c5808238d960f93c62a62f70e6520e2f6ace6ca1e8b6b73dc2fc3c43f3d1e740f1c663e3e0ff9415b2d282e1d377420bf6b145630d553e8c6e40d84626f01964e3d6befc33ac284263ee2c35d76003721a9d895ebe788be0a6988027ae6b33a26bee33016d8f4b64255f320d34deba4900020c8bbe181b5482c9352b9d607eed48dde4a2759d765bc2da53cbc1c03d68da30a20818a0a41e03fcaf75f38766bfa81738f0c8ec2fabed7142e998e7b55e014300120b61bcde758db04bc126bc67a1c87b9fb4f8eb2c3958b9e4106306508e2b22c5220cec0548ab3977bd4bbc802483f0c2ce3b1d6dae43bc0f8c79167e4a76ee6f7522007f74fab71a89f6b94bdc8b5128de93ef2be214d04fbb8ac8c2832e1f2ea6371213c26fe406e69b2060b60c6d0eb7759fe85f19cb2288344239f2a398f04b2b8900020689efa2cc2baa15ce24852b1f71d08200fb1f2ab8e10be0c4db8c8263a85032220b1f2737db4e6e55370ce004319e7c5e137f3567bc4d5603e4ed1f5c636db6a6b206dc3dc994eb2ed126f1a76892117b18b24028dce73ab6d35924ec69df9bc361121fb6e92175d959528d8326cafddb4ee94fb9ffc2d9c8a413898f14cec99d4299a0020349eb2d5c10d69df3bfc41f99d6cafff21ce69323637565e1cefa60173ad0d78201818225053a5e2d51745c5002281935d4dca8ad82ff76c5ca2dee6be84fb767021e8d31f169295ce6052584692ed9e4da87e637ca0b52455f216d5036c55d45c85002100c51c6bcf08c0a3926b2be93b47d0ed8955386d369ab8d6849957efb23904a20020b4b64e35cfcbde2461db3ce57292361aa30d136b0e7bbc766f4aa3ab4a72b66821e802f9eb8168e002b64b2b7ccdaba46e73e5c422dda18311788b19eec7af5782002062e41e97d6c8f4c6ac4c0f978f6f8488c92a51eb5793ad109abee4d6c009256920009f7f1755459578897b027bc2b282466aa1d3b9b0983fe4cdf51c9090548d5120760bc9a32ab7facf7f3c1d1aea1b6cab28bb65276e269472cb24ded949256c0121ea8ed0306eb39aeefdd4f57e98d25cef9ee6288a915cc96207ddff402bc2fe81002138caf88bb834204209e39e6c9430ceda0294f1253f8be81917370a34eb28149200203aa2e1582961cbf9b22333ed51aa4512dddeb3cef2e4fdc3644dfa5145366618203a0ac51cf2e1a98ea343e9ca5fbead275516bc20e9bc421e967be939026677682164c2810712d79c82e75116a7e173af1208478e8ab6763c7ee58551b4f323f78200209943e959b9228e61e5def9b2ea18de1688565a2c49dd98f1c0a7d43e81a6800820c4ab26007fa076e1ecd22f104a860f10b22b1ce2ad1229eaa2cf204815f7246e204090f4ac3d42b2793d83aa79103e0d0488ae1297109a6f47bcb29d8c8b6d383d2058ceed8e9f61bca997b4fef220feba451f5401ff7186d1348aab81d7951b5e1d2014994a638981db8c53c2a364c744009050975bfc23fe7bcfc5c8c36b3df0bc2120e26863332f579b931156f0559025f7f96a4d72a9fd108fbfd5c29a71b13df72520e84680238c100c359efc6bfbb7e97d3ddd4d1d24ef3fe8a5208a714580e9aa552108c2aed76de2cc32cfd4d0fa02eea4be069e74da620ba09461e63b5127cf9d8e0020626acd1bbc9c821f30e5ad5b682272cc4b87a9e05323357a367e170ebdae283c20ff8a87793a1dd9996598d50333ace7856916b2add797fb4cd7cb7fdf24245a642165e43a1aa272317475fddbb370cb547766ee44842ab25d83cef370304213eb8b002121565e2ca6c09a263cfcd17fed20fb6aa06e1e798276a5f0ca8cc16dfc5c309600203e8034276a6f2379f8374e8fbc709a692b2dfdf271c0726c4f890282a40eec2920fa335f7d0543267026ecca4424d15cd07755568dc93c6557f850031098fa55572036cea7284ab1abcbe3c7a83ea779392fec2fd8c1524f95c5bb481c67e300600521444c7d18c458aa1e62e5efc656b27d6396c2fc9299befe67e3eef807711f948c0020829cf5a6319d4467027f9057dfa46e1de952a01233e068f7fd18cdadf9a3534820b622a3b592686cde240a056840080c5116582bf166f4655ace84b34145a78b0520fddc9480245d4ac36034ada99a182ada449373ea0fe16557c3c6d9d55b21942720e59aec0bc8b52c1ea0179ef1bece2bf3275164c8b14ef9528a1335dbe13def6620af95305f745778a84f8405956a82816f366957d31e74af5509ff0b7f7dee737221424e7838cbff036afc7e59ba67c6add560e242a1772ff069a31e5e320c08428e0020f4855f5217b4a20c250b75c69d494ec450321911f9d7841e489d43b3739eca792010f35a5fc740eccaa7fa007f33b028089dbb8bf539f560df19627d5bdba6fe3f213c35de64e6b2d64bdb6ba246a5c9b6a91047e35240db65c383a1be9210b7838c0050fd000184213201216f3c4d446f38e3733348efdc4a4dfd79febf41f03567e0ec2b5a8acb93639951dc506d8649ca6d1926a25b4f19549d2b3700cff07c100c47c456ae23df2e60e27f8822c427e2de12038e00293de92621bc4a27d104803e48d076e3ffcf8c31f549fe9f95c6b9233be396cbd3c557efdfca11fdd91397e52f35d6b3a2130fd46ae505dc66bc987d8e93689d41be09a1df024af243b843e18f298de218ab87e557c782bd20648dc4fd4a5e654f1e9fa59626663adb179f51fec2f5534f2f4929ceaccd34d6928ca3d42fcc5efa32490428abc3296147147eabffda85ec2be06be4512448aabe1829d0219902fe1e9cd2bef29a8f89ed8eb1966b89bffd00015e46cc825850532b9bd9d584441772b3963c554af1424ffa9ccc7d7de55dbef9456a3fbf7b4be985d185eb898e166ba646daa12cca359ea77bb7a59e45e8a6cf2708c16b5ccacb708839eef2ee4b5b6597ba3c5899c9f5214bdace3a521fe36cd39b77952d1bcc81f9e5edfae34f1cce40369b7ee492701351d34e231af8a3768cc158a796e900d0cac462f5204da5cde3abcf561ad60f91fc8951e4fb37166ce37261649f840aa51e6ff9be749d72f1f5b5ae3349f14d572860dcf36aa4655788b8cf5108dff7a4e231d2e2a3bec0a159a1e16c9bb38c4052439f2b6b1a62addf739772a1d51057c89751f7518a3b1cd7b37c4ff7d621a54bca5b3936b137c3fd0001b4a09bfe02e11668f8f6204cb9ffa9817ec412c820b6b394ce2cc3a12546ebc5052ec1c74876f3de8fa22e19158198cd04c1336a792ea47e63c2bf4e85dbe7460501606c97409a906dae4e7ad84517a7955793365ca4f49b5f6829efe61f52069fa19cb30ce0a74d415898e7e134ed8c4106cc9d6be32577e9a024b9dfd8129cb5efb1ef282802fe0066aa41e587ac9ee20d6416010e1b0772a44b6d6d1eb4ddb32b80b288952b26323bbec16614c227e4599cf721484443f56571c7b048e58fe48b1786c44e4979e105196eb9b5803795b8aa3d3e3a8f85e10abeb0f7b43b9a62dbd0905af620309ef74f281f39b241c4b4c109ca7e0ec55b13eef8ee0544c820b833fcfd65b4a897458cb9aa376c6bdccf1032e099598452130bd38d28096322fd0001b6c9b1d3d60a49cdf61f9031694f9f790a4e0118ae39cce789df472c13bba207d101410af89ba4b2a88cff5eb09e53593bfdc69a4e2706633a45c77a6d8f4baff22c7e5e6b32278dbfe97100271b1fd1e64463fa6a757c4cf4b19954d1d363494664750fcde0f0b6e35f9e0f08f4fb1e438669f78b10e800943840b15541a31c3090437364159681974adba314bcac37e6cb3ec97c3d8e0cd52241a4c162787c199a256599b97e488b8a75a46d2c3d8af1951ddac43b0d338e739deed1ba26a8616f04d124244f365573b602697aab0b427a8f26f1a22de77c563cda13fc03a030817a837c497732c6108eac62102641176f62d5b8e73d0e27e17586d6e2c2c3fd0001ca7e381637425fa77d95f92b8b491ea1398f53d763a6ce32a2b2ff972ab74bd377723dde5302c487fcf7eac93b089457761ca341f143b7c5aeb51b33cf103f2f4ce4c282bc5bb8c7290c2a9dcc82fce3dcd9669f660872f602de46e869fccdd99c85c06d1d7bc9af4e93502e4ffc385b9641df8f21a25a14b8e4cf99cca023da529f8689d86418c37dbe3d4116e08069f3d08b9c952f4e2164dada9e62908d57cc68b264df8fcbfe449c21cae576adb8169a97294a6bbd369a58654cd182c8403080b3a5a916c107d7271311a291841f3e35e065d48f6023ec4118a3a88d417507ae86b6c74e6ced02c768e0f879844e22862c357a9fe22574e30c179e2243e62192455f24a5c214eba9746d2a8f6a47625b53e5e62bcecade179907fccb08e4b200218a8694fa7fa94c9c174c8e1525bb14dd946981e66b1c02178cde818615e3b6910021fca3cbe539842d405545a71cdacd7a795b6f6fd1c1095497ee8ee215d5cb8eca002039f76b8f7067cd9cf8bde783c8ea6edee7638113ec6729093749c2cc0c15d13c2091ecd1eb4b171326a6a26d764e72e09160ff2112e577149bc7c24e6c0907324421cdebc7f780b73aef4358c6f7e5c9a78ee95dce81c4c1bbbf570cde3c43ff5ca00021c6955241d2f09d2e90e33601fc139d0603919a1011ea7ee89f0e5d53727c45a3002037be468901ac92d7c3481ad63d364a93e2daa023bbcfaf4f6fa40cc54974de19209178cde568ebc660a7698cdd7f83d5932364eb8ac144e62cdc045a00ccda5201fd0001a3347a2cd4b1f5337653554be5fea273a5bf0292c0fd60908c6e699802079912372435166baf2f71b35ec0e00a714e9f7c10096d0f39a65f66f220057f369ce7c8221dddd00e90604f9de897ebf9f06afd41814b57350ca2d7ff7e08f60c94dc1aa087b7975936832a7050ae4a14b47b1986e70d61223cdc37dfeabc5e4212a869d953450202c9c12db23f8819faad59252173ac11c54020fd7324b4d39673befd2b585437affe9398e7967772d408c6db860ec512f94d02b0cbe9c9d414bb4be4b08c3a420a549efaedaa6f0aed7c74044785b611b2d65abfa33374748adb690a54c8719131e9dda9d46afc9dd09c8abc498d6de657920642d3d47a55f17fd3fd000189cc7f3247c6ede0becf1ec89f5d92142d25a713e037454409ccd146dc18c58319550275149342c690f00b1e060db34bf6ea34473c661ff9f32a40214a4715bbcea59a9ad6ff976e43b325135ca16377be53be39255f9e45ab4b3652d629a30500f9e37671d56952b215628ef42c1e49046476e9a760041003742751b158aa85c4e95f70e267d2631491c60cf09a174816890a2dcc2f8a38f296389c3ea66a6d577301297c242a6b9ca7465d8282f2e72e7673f9e1f1c8f470949c970854134de397c08c06d5d21fc487b2b9529c901c052e838a087f15b802d081e869cbb311efed66ba31c17c73cce1e0fc32d58d35e54bc5524776ee3f45d7b8f81fdad4d621b95f023b2202f5d7c814aa89c27b5e0bf5cd64b444c711c2e1c4b805af4fd58300208214f56ae87b268fd16d6df77efaa715fccd1fb1e6298c1c4f7a4f18d39c2f75fd00013fddc975fb72a66d5a7f3ba6df9c1ff55c7abb5a8f08317c6b346875e850223d87d72d71d9b17c11bdbe6eca34b521fe98dc8d31bef6fcfacec74e5c4a6c5f00ac769363df4720e17c3b687a42f29e8edbc20184dc9274d8546368e3fd2408bb68dd224b73a1487c10f4e29b0d8b9823f7c73db26ed16baa4c5d75b162cb5a97caff3cc8957072902538e0e698fad2e90b471777c5e8d90e5cd313933c2f3b30e49b6cf7ae7dcc09ab2e5e464601f093973d99c0815c3ea587d1803b4ca1d9bcc2ac20cb818f95d9239fbbe62c3356ba41f7dc9d2232f6221447fc4858bbf11ee382bfc639d9101943d958a59ff9b81007508c0879c4bf16885bcd6eb2383898fd00018ef6741f57def1a55a42b565ebe0451f0208762da626acaf0cbaac6d9bcec14e22c15660c2a0c5a23b27c445ad968a7e6b2daab11463040eb50799858b7a5063965f947234beb0d42fe1c2dc7bdce7fcda3de1bae384b62e798995eba4836dbee41a8a4de269c026018a22687ad77985d049bda1d39b79528b320ad3d22d893c547b4dc4acb57fac4e0603468beafdf54408ddb7d4c5db0cf14162d0d735b3fad10888f0048035481e5713b846761838504a36c1f956b072b46f11c7c6fc86c766c36fc7dfd5068855335b96162d8b299e3cd21060fed730310d7748c3d16f228b0eea1f37f5eee5453e3a19ebe1e60e4f2834d3338bf1887969de57ef02a1bbfd0001b50e09d8212707f0035a46513208bdba63a5d1fd7a7ea88e181d7a3de81b8afb4ea4b0428eff67c04b27372d73896fd9df443aa9b2a42cdb8665271bb1c54833454504dbc80645bc02366dc998d334b2723bbf5ee1e139265c107db84774b4884f26b57818d39d05b47d5bdab25778965a0627a96ec303c743ba57c0d32d0337a6d3dbe982284109eb0a7976221816cf3fa7f2e3cf739f30be83f253564af7f411358d9c5340fa5578120c48b617c088d9a3d0811a575bb1e96b746e25312ff6d87b9705c04a10123c7606b4c5d6658244121310ce3f1d062250b57ee51e35e0d7b787d38206fd9d26c70ef94f337cc7108ae8ffddf5fa314e6c4e5e1538fbb0fd000192fa78c12fea8a45902ac86e2878e8327b5f4c2ad9bec7d6167bc5590df49cbddda4d4d652f6f087f2ddc7a2813aa5b33048adc5f900eb4acd983bc86ea7b89f630b647a9ef42ab1bb6484ebc20989603144912ffd80158aff7e7d40a1a76489afb21f5f711ecc3ba613868a7aac4f28f2cd5440dfd064c4874d4e398a4718e10de8f7055e452271f01b27544af7035aed32259796962035d7bc37ef843cdccfacf969a1659e354ec27efda8756b09c0bf855f4fbf7598273154b3f517303b6169bdbe4ede890a90d3b34c917311027afeaca7dcd27158b04886dfd81803594292cdb3dbb77ad3a8df97df63095fd28c275b956cc61faddf770608b898d74ca9fd000138b1c34ee04d01368d9cd8ec4d70b97633951ada508c031470cb4cfb15a62426276c7442e7679f926e93325e287ab9ed87446c144be02e559dd076c9c5e1d6a6a7de45438076b1bd7b9ff5a821070877c1d9626925c1f47838e56bb6982b54fb9e131741bab5ea38aabbe4003538c454980dc3be9a436283edc32a3de0321f114ad32cf34e860ca36f18d476980910e564af57da498cd16d08af8b4d4696a9962adeb298d7af4c8c4ad9cb911d80a2115e833f0856833232f92f94cc9c3a6a14270f4c30ada671bacc9aa35bcd3c945dacbb01f4556ebac4e52adf8790dd49fa799584d227ab95afd2da9e67e5642a90e54fc8b693a07384577d04cc40861cc9fd00012c7977632367de82810aecc22a1a802a1aeb6ac54a4a79d8e61606a6eb72effe1abd74a0a18ef83709355e77cef5666f16d94c0d710f5ae3973bb26d07c0a436aebca4d156d42952cc8cedca94162225b5b4780cf47a6426757758957dcf2f638ead2312e67e140ee8c380949c0885c68b396517ba122d90a0ed184564bbe67bf1d0115c77857fbb29945ea00d8e809c295295494dc8cca091d900837b60b31a79bacfae59fe638ee8a2208942e27f605c452be3a4a43cf21e8e0f78e7cc20ffd2c546a0bbcc404b415e4eae2c7b9c2f9121bc741a6f8c5c28c9df3e0169cd86809f5e235ce17fb625f913f94b75b360f9097b625a5305040c55a4057dc4a68efd0001d594cafd37d880576656265ebb737602d6f3b9d0feb3147d8c1f6e1514ca64e3ee046bea5e6892d8db9c094198fb3f697ae6fc880075bbd461e9aab7425ac3a7fad84071b170739e7815d0c76d2ae7fefb718ec132b32a842c58cde33605488043aad9c5df6e58401994a38dc50779e348cd18582ca74aaadcce6df39b221d4235a88000eb2e3efed6744abd0b68836d56ff5d9ec973be549d52a195195725caf3b8cb683da9b96868d35727bf4b74dcbee838d9c39a33d15609fde1c2b345974a93c030952f52da7ac20b8c26b340fd9c08f56b97ccce21004af28ebe4946a91682f9738085cdd9a53e160346cfcf396cfb59465d114c600d9571634aa3c880fd00016c714ccc93e995491adb6718e9ef69fb2cc36044d9e6b73130606b9c845dfdc56e9518a120237f58fb6f2546bec6f47ea6a11f3d898baa47682fe3f537542fe9f6d3679398064a48a3ef8abc92e89eea84c6d8ca956b3c40e9b82b2a496bb1230f8789fc7b0befc061468049d416aca3fb41d4272304a728322684f9ca6125b91dea97bbbba8c83045b5ce8b3110d429d65998b3aed570ecfedd176e98a91eb3410cd501ba52d176bd2c8d05e94acc8f352b3cbe12adefb82d34e174765ef1197f8a93fd4e03c98967ddd0332733e5aa0ce87f63aff78a2b44d10ac63c1549d9a9c6808b743e6f785173924d736bc0890f2e68c1df72b0fb1632bd4679e87690fd0001e736a64f64d58af8d43f0980d29ba57dccea56ff13040270c926a2703401b83859a94d6cbf4cd62109053c9e6ddd1cc61ac649ebb1243037adec455891642de8f43b57afe96cb63736e3e7d735bbeec8d1dc2c698f37f0bcd85bd84cc6b7e25eab500c03f1c62ec730c24208e2df2830d32842277d9e5c9416a91217cbdad60d6a77a7127b09e7463354266a1130d1f04de9041f0f83d41246766027700fa9a02d10d2b0fcb0bd534d22ed38278ce177bbc1c429c09030f105a67db70011d3eb24754bbb31f8a6a98bde215f635409e4cb8c3d769efdd7f1561976bd29876c8a11a130cbb8e3fdf15fd9ad0329852dffd794f499345c3fee09eee21997a5c8a021b993d7cea74a8935b42df2d55606a8841b1a4a8fc0321701d5de9bce1dd1bee100fd00016e510cf2b787c67956990655ca7ba97aaea25163317e7ebfbcf2681b29b0b821aedb8f9b2e309d37f660ac7169dc8234a7e7e4d01e79164eb75f28d284c52ea3d7edff718aa96db6b0b6781366ab985d202823130ca53c2a8e5186fc18862348952e967b1a3e3636517c3e3c48d8fe5e4ef1d5e230ab584964c888c61393ee3d6e34c50446b86e68ebfd048ac86065f9a9c4bbfc2474027b612dcafbbb0416f12d3d856a96557529d1144a852ade77f50f600ecf3c0e00296576eb49a0b211baaa815cea78e1b7a56a1c698ff58488378722f58fdb1ab8bb0063654a8de8344041fddd04be1b4b2b1944ce9d1ebda667caf9ca00e5c2de892a9063a449edd8c1fd00017140014f19e2474e1cc4b40a5a8033f3ddfd960ef33c7e35432deabd85a5b2c18a27b85477c9e6fbb2d8a5e6c686078009b1f7868768fbb5f569ae3429fd64e49cb3a62f32fada09059982a03a20494bd2fd2caa75a01b3ecdbc32acbbd648905d56cd2aefc714af1c24bd6e8f06b1ddbb85e9882ddf8f0e67c654402bfe2e0d9ba404bb3da2d58305184949ce513b3784c3234b39d25e0c6df741683750cb46d7856e67a0d45f4839b5305f9965808d41cbcfb2ad3ad18cdba6744eab0148dd0c1d5e687b6e76bdb9408766b57297be6fdbcf9d7e3e6918c194ef32bb776b5ab85f3a6a164baf866d93ecc3acaefbac43a9fa267bc623cc136ad712b00d788efd00016d3db1d97d5d429249f5cd6dc35f61d0b1b44f1e433cd5e01d28afa6cd6718fc1432b77e8eb6418b0a4b6fcc6707cd3d5c6661cf57b3b73b78feae7c89e25eff2ec1d465be91a18b2f3bc4311919f410cfafe8ae8a06b4b947f9b6fd8ac17453c2f558dfd67f71829be66250d40c3aad6e3ff52d1c0c455e7a4f646445405cf1ad45ba65392bb622a770ab0f5a57e73d32d98ee49d73ac7dde7dad9b9c8e1da9d1e6aef0f9cd120bc1d2cbc5ad819190b758be385f2b0dd736184382af8aa419ac7d734881ab4728ea927b6655b7d3faa4a1e14caf6d38cc706a940bff9c9021e4b6c3ce516d0257deda35d2ac4e0423f01ac849b19b919b773a58f34a06c6b1fd0001464885fd950d292d5aaa6155164216521d2113d795d9aff389771e8f39ff3d96afb5e2359fc52aa6d6cbc3921a7a21e6f3fab62e748337e2cd212456e2b2f52dcb352a75902ac6fdcce93dcf027138be788aad5e09490bbce637751cfd5bda9ec540d7daa92eed7b27ff1bf66585fbe3b39db3de9dd386ecd7671f2395522c1c9006908afd04fe68d88194cbbc3216377cfc27c4fce55c8e558ebc4943cbb477a1172aa8b344c08d6fb853e64ff0f986b7f3e7cc3b2c3d8b2abbc43e08eff15787bfd6a9a8f98b207d8e2530c0c37a37ffcec2fecbd726b4b845ff48a44c1ec7031e4e663ec0042663ff81b9a7fe7d599695737511a685148fce0c3eb01513bb20ffe083f86d11f3c552efeba225a93eb8ea756f45c2e49a4dd08467b79a14000220fd4b0ae4d4c5a165ab75af08922366e89721ba7ee52751e0b3e64017787b9445fd0001d0a8ddbc130bbf7bcd20bdbc8728e812a45cdbe602dcea5826f753b94e1220cf698c1212464a17ed846b29db82b1cf5373241d4117b07a8b7d279d4e8511d22c47be22291e9ab56454becf533b771e5e602542d07828952d5ef900e2548739d57cbb6254c667bc50a0f97c11b7f3dc1624111f9d32cb0d85ac4106b41cd6d82db7aea1135334220163c190744b6daefa456f69c331facf9083af360db6f2a2c80c423357c8fd1bc28fcfd42db69d733efa9ecdff9df079bde1b73a63ee74e5af5c75b67a4824a72466e17b501f6057a68efc19627d115f19fbcb48c0e0889857f0d9191db5875ad6d336adfbf7f09989b2aecfe868c2efc2cc64af46d07c44b9fd000151620fcd4091a3d3e78e8a1f1b5ac9ae8bdd3760320ed9bea2e1b237110d7747e9894704336b958fc92eb200f06507cb56a12f202a8b098bcec5b7b6941dccc18d2bd968538185dbfdbb6ea61eaee22aa8ad24d73df0adfcfafaec181fda3626479710bc19835a5aa7a3b9afd8166b89f5aee8d52589059eda61f19f6319335dfac7765a9a9e22cce0fb3236eeba6ce250ea0b7cfc4a021ca3c88859f556dc1137349a7ad5a628bc47267ad91ff86174a2fe74e3ab298ae8917d6a57a916f00b16bc0f3584b12b0d63141a20b1ed54c6551c6dfa5647783dd9acc68ed75044faf6745161c1ee4abcd9969ff9e01f14791de7d0c8e44e77a5b249e2da833ad3bbfd000119884821e74482b639ec1f8484eb6199a01d6e0a3606e25527d7a9fdbdabaad9f378a9aab04a153b1003d520d03f25a9e41c82504ad6de9fa6cda30a3ee1128c35f49d469a79b3c190ab0fab92d9977478c7ddabb6a66f291b58756e040892f44ebf6c8d0ba3cdf5d9335c8b05b0d34a8f4e832c54979274f5d4554af2d05aec3d51a3cbe03282c9c104f664fc39863c3a23396e762a5a8b5ba18b3c84f0f49f8b7cb6f627905a4fec65e5ab41e868561dba5cc8bcaa8c201d613eb678342aaba5e5d44f7ad7a58810129aaea2e6bb9850ef022e54a50b18e5fbbb76b93f050c31d279e66cd51a29c42591b18db05e88283e52070e6eeffd8fa447bce2f22eb921b2e3f53f38bb201511b9e1d5bbf22bf9e23be137543e34d81a0b194f373dbaa600fd00010ef2d9c59966c760260612842d16526b4352a5f05de655fd0bf50546be1d893d90f4b8264488467880be2c4d7f3c577e6b68335f1e0764fdb16d6fc44fc5bc2c1660798e6b31bdcafbd33a9edb44e48dc37306abe9ea761cd2077e977a6d5b92aff3cdc33f644f47d90fa9a4b172faf29e264c9d55d27cc4e7b7e5e891adb566d172207406ac400348c386e74716a518cfde36169e4cbd8d3093c8d85b99e54474fb7c7ebec5a3beb18b664b953f4d9037041c45738e87c53d55eb92fe862a78627a8f4f3f8f3ef01102b8df05c9c1d81da85e36bff90943e0dd93efc00edbec664fe16f03c8e79d3e105803c50a606f9812d3717921477e224efc9c38604e932116d048938c5e50af925d722ada7f78de5fb1020ef09d45e001364d0ac87ea4b800fd00015a2d2be1965546e9ffe759719faf9960648c9183812a7db83a24b0ea52bc26e3774ac36fcef82756ad386332d49551a147e87ca68fedb289b965a4088b3de6506378af1f858c1c995313e189684bbd3e484499dd7a26097ee6e89ff1d0b6d4c6c03917c53a95d9fd1b6f9a8e59e1687506a5499adea9c1bbf2f63b14207daebf64c8bd5742bec97f6364560cb3d687f8a1ce12a197e87df8b23eff607c97849672fcd5803b43bc8b6dc2090d7b99299248007a3207621c0b40e6fcecc3f68b2888f5abc842a44e6f019391449a7356f9e2637c77612b342fe61e76b307ffb780f529c6c84a6e6ad8d7553021070499e85542cd288a543bb0d318b7abca62c48721047951dd48307113449db6a3f997999f421c62b4524e5baebffef1ed21a6a1a800fd0001c4594030b3c64f25c491e6a5ab25b959438c11265e0fb2e5b2c58e3d59c86d642aff89f4e5137f08ee4871df4098a5748795d596baeadd2db0b006e02822ae2c5f6a93c5281b82a7d60f8c390a264d293f1769d55a5b1f78f0f65f7694477ca79ec16677993d5b6606298171df85a7a8c9bc74a2438618d2aeb384de706b797758dd418b2b5d59dff089f7d4f7f21a8390a3a707c08ea4a238682670a0d80297ba68febea9c4c5afccc241d9f95aa77366880ccf891174b33d95f462839d2820451611e8453d981a703595e8fc73df0a4963c1baab591b7f3dbbbf62b50dc7bbfeb05ec2ecdb1a63d06ec20c4311451b4129a08b94049263e180411ce7b8b7b120a96a6184af4c9ac706b2fb01d6389d94cc4e3930925a5b2bdac9e96dbfa42a78fd0001cb6e8b1c0da834c4fc0d797fc3521eda3ddacade8a4ecfeb518a2e2e8a234d2f6901a7eb4d117404328c70a5c24f36236e88eb1dd19a7e9cf4ec7582f472da053e283dc193d70bc71867d2a348521a860fccebe0b45958f1b5919cb833d79802640b7665b7ec45135b24108eac8a882121b6e6734dcd327b506a434cea9298e6067c36457858e3c18d88a320ce33cc3861f5329bc1f9a8f4af57caf2c134051b12dbb58e309d7bfe9028c3b9b4179759095fa531cf20bdf18134c517ceddfb38b4d94849c3d7eae9b46c353bc43d2f8345e345f818e328875c1bdcd754b706258779c7c30592d0a4c4b5cb557eaad484d1cef2bd4d98d12e70b8fda33f3a5e8320486c47e0fc0d0e679b413041e800ed28ca862ceec23c1a937954131b960fdb3320a3e4a1a7ded3a425d38b144b090d9fb0aeb9ba631622041a702626583d41142520f6fded7e7b2408e70ac4ab0b4d23bc2571cfb9048b0bc738dfd0d6507549a451fd0001656bbe84db36e12bf3c78c07ba3f561d2c2687aaeeef2e2da17cb00f060e025a993c12551c12bd4d75c4c116d18951515f42c5628b0858d85b8afe5deb0aa14a2e33d147eb62b9a52bd4769b6a97382d6c39e5f70e727ee0c9a4684fcf9a03e7232394b4ecc6a2d32e27fe2b436b1081bcb4f3c8bc844e9cb1cf9b828bfc155a2467d506be2f89c9a36bfe2d19125fb21666ed4625cf881ffba75e67d209fde2742d5a46634019cf1f96c1e649a9dd58edbc374b9d6220bccf20055104e8ae8917537fd07f69e12e0b8200af3d924997ee33a7d1e9eb3ebba741f0edd1b59f05e1f279d0c4f7106276968fac8055088bd5f57840438a2776bb21693d9587d188fd00011ae402863053cdeb79711a4c4e7472a1559d86f89bc4daaa6865eced1126197f3c43d78ba16fb2d6508632ab4712b13c3f45d674064a51867bcba96a71b7683fa69ad337fd0c50e7927b913f025fcc47adddf1376a053280cd0fc45bbf29767b4555bbc4054a824c11dc93c3648b3e1c2ca42a5dc5f536eca084370ef65c5a6229bcac295c3fa578fc22eab793205cdc8d37fe3cbf7dc6e1a7c53ff3c7e4d226f0a0d4667bad282c625695d4a1ad88931ca894d4931b19b09c56d2f72e72f62600c97348ed8814f0841baea716d1e0d90f26f8c3932a1e66dd1e8c8e039d3e891ab7be0a887c16ea9fbf3dd7f2c7200587ef56cd0e75e8e828aedcef6198e6d6fd0001a265b258bad27b42d12a12e43a25bf566f2b77f6f0924e8e0c32f294768fd6d9f92e5a15dcc94a2067c71a1f9740700ee0e7f626d35fad2c441b176a077fe681515cb0c8613b0b43c708895c9ca5a41745ca87cc5e8d02e272a484be75cd9afc7478b98bd4c030c3dd4885c5214efbe70cf9a1f8a2616e2eadc150f979e1ca8c389b6fa288889464886bbdaee7539c6bba71ad0927e455d45db2c7371a5b15ccd8c7e7e91592e9bd057d85a18a9a9d1165a84329a6c7beab031f2819cf36a26aeaa4cbef4e7871c472b9b363a1a5d597005cb98e6828a7b6b7ae81cbd036f8d8afbc6289efacedbe51c10f27462c81525b18d119ab4527d9c6db52cde19cfdddfd000143a024d1136d92c3d0de09ce4a3837fff20ce4c4307fca87b1a09acdba6a1df122cc69dca4ec3ca89118ade730ec8959d0dd84db0eff5ab2ff71793af68a2d6bf3a301edce9cf1088046b3177c18d90f6318e2bea3a071469873d1a320d5036a6ea1375ce17113721f01852e1c436745536bba80365d2ee1060a73098f99983d18511059ecac21b84131d845bddfc589a1a4c195ee1d89ba9845c09d681a87c3fe2322cdf571b4a31756d2de38276b97ecef325f4ada73b747d78899c3f84aeec26fc9732ef5843f8b2d7af0fee0f04e01f85731eb9fde3f0a69c4c0aad09f51db5cd03db3627cce5d2a1dfe9910817efc2e53ebf9f79afaf09521a3f14980cd20d6c0a0d48152ef8efbf7a58b809f5c28186addc9690ba0857cbf2c96e395e92afd0001781c2002615bfb1b7d35b2e208a1df0bd8f95f2d639422c213683828227885660bb231058546848fd01763a1ae99e0a7a1040a0f398d8171b45ffc4a58a4439a5addbad802fe79c71a4a27fea8ed229c51d6cb26c3e21127aeccd2f0e31ff1c7d38987c95b917d4c86439a7a0d54b3985ccc3072727c654bea4d473676a45f13ac693de273581cd6f864fba7ff00f3e61cabfb689689c49849419ca1cf489cf9db2138f65c1445b74a0e0cc83e8368e6e79149e699b6e64c77c70ac5156bfa98794cd0c561732fc7e3623673e1f0ebc09de026d9745c4986d498762be6799cf99143fca5d69d04283b504c8d8e325c8811853d467b72e204417c7e35064ce7bcfd0001e42f7a528e3e1de18bdde6e2d9888886aea8ab8eb149299c32c68f6c93a19889efc05e641037687a091933cc83bfbdfac77d48a2828bac6b0625260d4b9da29b0d215d403c6d3aaaf33addeeac4d46875cbc4e3edc1a865d6fe0b6a588631188897cfd131672a8c5d098c0ff8ec5b17bcaecac1d78f83b5296408c994c1e81f93021da25ca403ab6694fb3e82ed260e88067e3edcd8cd0e70ce4c79b49962096eeb1eeb2b17be69033a338ebfadaaa1293f7fe17fb7ddce051d9eb82c84d639bab4a415353ae82dfed2996a26d184189ff1f25d3196c67f34ae50a39bdc2f711ed6468b364d1f0ea8eb29f486dc6c2f6dc59a24acf4772bd542557e9ef4b5b93fd00015ea90490404b84482136f214f4497c09a0ca87dcebecc03ac3152ae1c3e87b945f721137c7a309e1036d0e5d94c6cce38c36b1645a62c7160ca45abcfb5c165eb696154ae38684002a150ab45f1b8f1bb69b28757e2503967a1432090b6c90ce7e3671860e40e95200f8a1ac1ad927b49bdc0a66472eac7123c383ba28578b149f121ad8b1ead1e1908858a640ebebd2e1b8a4f787e5f41d573168493115448edb0de580a8c281b783afe2b62ac6ea243d021187367df9fd28f97e2ca7c8856d89c64a4c3c5e2147aea8120b4bc8b2d0b8ec5b7edeed35d24a800760e82ab19cb7363c7b2fcde6200b8e63e2b698489e9dc0bc4c8f1ba9ff68b59a7277038eb920fe94cb66b60142227c026662ddbc3dc29b373c5c805c365b245c2f69152f1e2b2007e3634d06ba18b973add33bf3e23a7175729a9442fc4213adcb0e5a52e2cc272096af7547b4220ef6335cf5fe47c75896ef2d27e58acb6d7b444b3645ad1a9370fd0001f3642f6dab0eedbdf04e554106719fde491a9bfe00e8228f250e0035f5a95782bef5680a15e6148467d4c7db9e22d9a4bc766ba884940645845b25ace95d405744929adc2c63e41e4c807e33a0d514919c09e855c9d77690be00720d83dcf2b2276e157d39b7acb3ae262e65a8a09ff49478fcd67765dd03b545d7e83bf194ee6b0c5f83c41f7c470e0a1c3f1014a7afc2b7149c01b3f1181eeee4ce8a9be47f0f7f897a05683629d6164fb882e1b67765e7560e7f5c6be76ad9902a755c6af0c455156b93f14e618f533feb9d351bb956da352b7a9d63cc5082d6f9768d80f1bb703c84be2bd75b848f06925f47e226c424c0ae8ad4293b0e9c330cdb16bbddfd000158cc2778c31d0436228349fd19e0428de5916401bbed1f3668014cc51cc6b42381c32e5a7d5ec4d194037b0544284c52e151b652e2733b17065b2a98fc1f5ff30a8acf5dc7522b64eb94a8a71526e2aff0acba058b541fa412bb5344eaae4945ace66b4f9251e842e4b52feae5ad89ae1ce3617debbb551c09c87c6e6e69b7942f1178db84dd758fcb3f63d658e3f48c1a47b725cd2e003a59b8e318950a45fd908c6c4d53d706dfcc2041c046324e3925c9ca032f62cc825f0c11c9fff3fed99f616837244c7d71b3a8d79a8d5bba3284280b59ca1d0ed044801b7d4d6148f014c8c04e8859d9c3d074a7ad77b86ea0ae39fde03fb33eda53fe5c1728cf2daafd0001991691f21883d17fbf12b24e86f0f639967240dcf120c01713ad612ce32a7b8a9c911248414d8a2b836e82c827270f60f154d5de0efb7aec5b3db3f8b9cedbcda84aedea5fd0988ed0069871fda9db5ec2a1ba0f04592048f0040599023ac01e758886daa3fdd9190bb1c8ea29898cdc711e8e8e6c4497ae95ee2e5a6730bd8388d8fa812b21c9b97af84a7cc9f790139b0005dc86efe16436e63982fe8d8ca6bc5bea86b2297a0726dab7704fdcc8a3f6c273eb0f8aa008ad1e6c4a985d7cefe05d3b24cfd195d2fae5392a48be5bd50386244fa9002f95ce18efe97be356a3c5b3990172f812987d0fa10d7fdf9afcd20e165697e3e8f1fa564d1f03010f8f20d53cbea6789dd88800af410af54c3c346483fa085c6e02c088092372ce828e2afd0001f903226d53becf91fe3ee0e556a7ddd652e179dc3c2de5d7af38f380c9916791a37e149ec620429b47e5e0c016b898ee1dc45db857c93a718daeab3167c3c336b22692da51bbf7ef1bc42cba25af0b1fa89df2adcf41535803ad6e80ff1e1f57c80514f1d091040aec55e87c4810ea31ba22e4f93a101d71e324cfb2d84e381f1a59a601ea97907013e119a24a468b27558b68de170690e71bc3c2d7361ca7f77d116b642516d9cb128a70d6bfba83b2c22420059e8c22c9f794f2e144a3a065c942d3276253013efaa88a80e3d7f3c32dc249347a6df656df62d4f9482cc8470bd1bebda925d47c5cd9a54ce81d7bda23c2d0434a98a1f73911c6172facb08a21cb1b1935a2667416f5cb810c787fac55fe8e14146721452870f27b1d5a14fcce0021600ca51450ca3b29e9ff6b388f4df5286db585d027f68fbbd1d4a95fd756318700fd0001b941fa0b95cbce10d49d29c80ac6c45bb624fbcef94b9bcc75d3593a5e11ed85488b6332f9d059e0123d5df6486dd2f57a9239d137d46f3b9c0120d391d1f06cd48c13a0b847020d0832b15162461811662eadcaa2757e2b6b2240d478e7411c7e807e09ef824ecfb3681b49aa72a3319dd310d8efd930ffa7751a222e73f198032f2dfa00e978c9542dc476ca44b161fe470a5f63759de5086a18fc92aa375c608841c6ea41ebc6fb86dea22a8987f7d9abac948d5e67a173eee3b9b90c323c4f2624f53fcaaadd79427a36f560ce6cbd99872d8119acd2173935b0331217e33ceb4a0ef314e45c1a90ad06a46948a38a00feac8f58d8780e6d15ff6e013dbe214cc25d39b2def7e68e2d5c7afd69c5d629265f750b683dd660040dd3220a2ad600209901a1f845f602ecd4f341e7b68c6787561b4f18d7819c8b319dba6836a42517216578b022ea0911e03a47f0814046cea045fa63bb506730b0b491614417df91f900fd0001ab0bc038363d54f8e9e8ebed6a498b0f989c8ee56c81720bd66f71d0d97477d0db56d4481cc0e57c2316f4bd3a6843f86e5b28152436ba23f377dac267c7bb6501666efefb705be623d0491dd42a1a5397f45b6be6ceb1e0499842914f56296a34f304320f5b623ae7e16379d89394b7057d1b92de4c913265ba231d81dbf9e4b586704803baf1cf0fd474a721bd65206df02888dd77df03c831f8433f3b2c7cf7e1211c7c85a975d129f33734fcf77c09aaf68b681da7c506e8c89ac5394589d185117b722b757e307ccf31e9ddc1b9131633bd684ad458fdef09d346566eb4df920801ec4ac019081feda518cafe1ff9f9197b1473ddb18d3349652db870e0fd00014168b6756041ac27a58e4160cdc78c2cca30e144cfac7c58d40b5521c76ae171399e4e22bd3eb5a59d0a44666cbd8d38c4983f8e2bac6fa5ee84c86adbf9679bf8631dec545667463df5fbfdd5ff2d0f6f9021a4a03510e291253bd133520d5366e3c272bf8ec41a14b15aea97c420ff263bb52dacb3c3962359312e5a4690483434ba5f592057dc449727f03768f3756c24c85814e1204d2d90cad6e656d39e7dd7b9c4bfcd103dac62415b0d64901b01278602553c149f6d64342f16757b5ca1033494395404fe1ac7ae33d796be12b0d4f986de23186ecdbdc8477a742fdc973b34b312f5984b74faa42f5f62dd4938f76f5d7ec141249902825d81ab2d88fd000193a2f7ea915b7e506459b8484c43d305deca93a84b3c313a6cea7286d485395158806c3d7f3155f3ddadbfc913cbd7673193a951b356ae208319ecf406172cfbbad940f9fb6accde0c73ea5a19037d5d8644b4de22db968851a303717f473c491465712da34aba4e5dbc31361163ae1492bb3435779569598639943640b6e14233d8888aefa72580e22091b6848592d5b2273cd2df009d614da03d0c0803b4320800094dcbaaa337fd210820e07a8deabbd595d2b59b3bee5c7a27e585a1cef44e532de83f08f3df43d68f5934ca69776b8ee8ddc42969970d64145c093d4e989cf32ba71f750cd03b5c818c33462d05c6477ec1f0ec81c48e4b119d05d31cd5fd00010b1cbcbad09df7edcebe79a913033895c66686f078402893059e4a986fb76d28e89324f5b04ead2c2aa0a05786faa1e8f66fbaf66b7ca94bf52123e6afe4dab54bc33e5860e8766031dd256edf40b294f55062e613cafac04f77e284f5097e88cd7aaf46fd28f4fc24ef1ec1aa0bebbb3da5b504e4dca8dfc13ed99e4371dea6f3bc0f78cdf6ff47548e5a426c92095da045e5ccf45f446116e2c9567ed01d62c1fd3a78c62aa359118f77705174db6a4faacaa0b6d49b4da38e42b20e9cd2ed7979a0f6da28964e0b3fb755046f0a5477dda7465e00d13c8751c36255b7f922dbfe108a14e359257ad607dd7e1c9ccf330779135714b01746a25ddd11e565c821713c8702e50956f6f6ed9c283cfdd08938c8ccf08ada04309e47fe9ddf5cf5dc00fd0001f5e2772a310c56c1343104f8f618a6408dbdd5e421e31856f271fb33329d5055c4c73e06870feb8f7b298cb9b403dd6c4e87dd2137ac84df583c58ffd627b0c52996bea39da5959ccce7968455d3b4ac512c3d552cf63f2da74d6de8e8f037eca47a715d0d9398502b287e5f1034e536a84839bac21ae9958da81fe54c67165fc650f19679c9a628b74fb40c65257dc5b50f690263f9c1eaf41c3365c0e23f91aa7ade32a352c8b88b40b2d7acabbd085185f7737be6f5a7c342e2c908e8a4f997ec949e4bfd6ca7b3da894fd4581c81141cbfc01afc3eb86bc91c304c18c1dccde49d8b61e41d922fcb02162e444dd4931a076bb072ee3a6d5cebbe8683e992fd0001197c654987867c3fa8c71ce3718a70756063be0179e55bf302daafbbdfdd5669ec38e140e3204b260b1d54373f84657101147e672120d735c179fe2dc5fdf7dbb8aadee63b867e31d9d1242e45bd23ed510dc7a6d44ea7806159895a2293c0898bfa6d0018d9864f584a59003a8d4e3a38eae3ec7c9e35d1e5985acd544547ccc1e31024f05bfd5dc07ccbf535b2e0a0a703548e355eb9d1acd8a59684ba0fb674075011c7be7cc899c30ea6c1df0dc34c9366f47743aa12991192cc836db7fd5a3b0306d6905a82e13b729038c70fd3bea01def02b93cd2e71439a9fdd5fb93da6a72436ce9f5b431b7e18c76d8173964d5a02e24195e761d888a6a2532d785fd000177fcd4e94194a3c34efea9f8f04faccbdeae9f0eb8662b0195db08e2b41a08fed52ab7060465ecebdb2eeed7a768c4f65ed7b5193151a56c752cdf97cd4c6be8daf95c16c6703ec95b6cb541506c715983be6384031685d48190e611ddbded6fa377affb759a1f289523e56761857afb3c33b68f743c59a6bf2098a2f5bf3c1c8a3d41224dd12ef247874ff5ab6257cc3e29a65a1c16f3ecc26108142d1899a340be3db55556258a348f51ef61e8e73fa9db743f08df3d31919f2d9484603f0281422c2cfbd66959dc138c2176d6e242a5a04d5b1cbd8c39ed051486869f8b0f3ecdaf42498be6016dc9d49ae52220612a32f50259fb9a8be0cab88deafd56b12024a02c37de6161be5eee8cf63c3b0d16d0bdca07ad59fa0532678b864c13bc20c87f061046d5218e768801c69818dadd24e62aa4625d5a2af09b08f9eba8efb5e29fc2977184990fcd81a0a3f896691051da425d7b99292d8ad7a3bbae5ed9503c5b761907097dd6457a5444b9c85ccc829d5901d46cd917ead52a3316f96588a7b508501be9f69c73d97e0db9d615f20e50712f377663f6c47f42d005db72b225048abeb8d6e3a60afbe21cd13d4539b7d39806952d745a7c49a552175135d840a3f9b9e9ef6ba3c46e9f4bd42f9bbde0d5d5abda8cf06538d3492aa856d8708285c0aa99567adaf6e0d4b28feec0a55e49879ac8ee966e4520e5eeae3e6b4473cb710b4213973850ea6ff0331b04ccffab2c2c3f55ff28b8bdf644e4c19982916d01e28d745302b079066c61fc0e8e1c90931f122893f7f5eb86e9111f98cf36e719129668dcc4718c52d0c4c6a1a941b939e5e744d61aa9fb1aed6eca5fe062cd109b15abfc5851ff77c026e9ba7023b298d40acb1ae9884671ff1776aedabd859f2a481eb18b963afae2e2ec41e3f3671e9dfaeab234d6aaf97249f4702e706437d8e36f517b3b227bae68b79064a3fbe999bc2d75912d970826908dc17b815ec0f030e20b24f17c527557e36695abd05f67c60475a0c74aff42b5e7fd13efc3b1c3bf5ae6e3251731ffaad110c4210c9d6d78d69d6f68cc31ca99fe783a12fca506af01e28234f01e1b30dcdccdfbe696bd5703ddbf0554c8c4863edb0f252e2a9daa54d4900d8fd6aef61b8a8f1e165eea79a3f20663b08722762f2c548e0cd10cf0d2d8e8b9239b638d02c49749d55b721a6c81d2554b51b49191518150664b7e4dbde3ae02b36ab3ec9250290c8cee6b7371e0d3c7ad64d267cf463c4c82cc5a325aa72461345c4f45c8753de23bc148527b0e982511bed9e4bcd4cc37e1e3b5089373fcbfbef9a111c96cc79e9f37d619c0d68598541f2a37ea0fd614ca310c915c0d412d2eeee8f7d71e4a250bcc60d68ab3f296a5f75d75d627e5913aedf3646f733701218878049c420ce0089ded11b087f16111e397d0f2e354f1df0a858aaf07eeb8e80002210305cf1786fa950ae9b553390d6d62e2b285ebaeb978822439e0922403f9cc7dbc473045022100b807fa7bc196a7b2d7a3000e5e1870e2ff488bfd6e2850aeaefb3c606f28379e022009c3cec446550e5cb04483404a677c4b8406d85c62cb4d714e5ca3a50aa02f2600e80300000100e87648170000001976a914dbe6d470fa9fe4d037043533eff4f80aeef0c8d288ac0000000018b6dcbedb05200028a2ac4f32bbab010a001220000000000000000000000000000000000000000000000000000000000000000018ffffffff0f228aab01c2028655e8030000dc8ce67bfe1851477371a9ac40b6ae0cb8571f6e2d5285855288f6079f1ce7239ee8c85f465b1820058b79554f41af297e9caf95ce0084b7c35dea0b95e15a2fb9f8e62c5427c1c36120cbc1fc11ff344909079335209c6b84b45a9211cac960f64e9432ba5eb6e4ecb2068223dfe3d85b345da17bf374f9140c9577c148bcc431c9ec3c7d13bd2363dba821381ed9fa0614416261e88330b3e74c40e6561310eab3f26f092e72f3cab761f373d02680dfb52937bd9515be242f6573754f8f665523cce3bd606c8ad190954f8181577fd0efe7cc64b711d03774958df4a5211e44870302056557777951d7ff8c002161a6a59e979f05469cb31770bd484be6525625359979220eb7e9912e835065fb00fd000216aefbae3525166510814d1636b76b0d48ea3cd54a3a17b136a84340989d75f74ff952966830e4c0d59daa006d5a7190978270ee9475a0778afaf002cdce7efdbfad630f72838b5c4a3b538ba61b94bbd9e353437a50725af5f16fbcbf36bb34e7da54e5c24dfc90b545f95c973877bfadc2703ee10585a1fc1c97d7377bf41c9cbcd5a313849a3c826e7c1301083694e6dc05f46899a901ab4a8d7f6b3600df280157fbef6eca4c28fc610957a42a9acf7c4d7f9846ab6b9b04fa6abb5fefc168d45f10078b97d4d6a39638588a1c19e1bfc472657861a902c2d52cd32fb0463746f649ae88bc0602dbf35816fbccf91dc249be809160cbc7f8b6702d6cc5b81fdebd283231f40758afc899f6fecedc51dc4e5d09cb8961092220541f75ddad45680ea92b4ee78c29f58c197a68420bbb25b450c72d02d7249f7facf9927378620eb36fbf9b4ccbcb55627eb9cf905b4a4c65fcb77a537f642f10901b6e94afa37e4afb0d6d91194454a9c2dd8ef8fe4316f8594c7822a7d58cab09657cf501da5be5a44f947bb957b71e4291a7fc60cd5cef9f0676f7c89123c7ff1ae2e6dc001b6f19785534e207fed2bade8597541b13714284f67d6986bc616ef1b0adbe415242fee85acbf482a6a48b3f142ef7ddb5dd1c97a4b0c53c6ac7aceb8c042d9c9ada1bc986b8c276d07fbf8512a3dae6a357fc02b167eb85000040e8693e45fd000200e23abd27b258f9827ed58545a507bd465e255e1156610da314bf7df68b6b55129df84c7b19e362751ebb9beba10790c9c26c5ddc7f087258d81b006c0d2e92be0178bf5edf6e78e89f73cd97746afbb2551dbc97eafe32ae62e7f9ebcd14ad69faf74d2011d16f2c50775f4f499c87c3c50d9d5d486394c2a7f462675d2a4885493332e0610a78fc0c8b08eda42e4bfe93b8c7f80a911a7992a1deb7cca2e40933e1559815688d4e5ae5e58d706bc513e5108449a8393928b5b77ae73cb03fe212c6375b6c5e61fce9db16360a147e7f7fcd49e05a99711d4d5799be77f7e39d9d1397388d6680d4931b48798ce013256a586781ba80168bae63bed4d150b64a73f7d0ab0c9ebb42f5d4db40eeee303783249af4bbf334c660f8c084ed9a2e5fff8be230940a4a08b59418676ef005192365e4e67757288791ce4992b903a31537596cf6dad0be2af2418a6b9cc2c33e99d874168f6a29df189a869b16eb5d24400ab30e4eca9274114d646aaaa8bad45832b6c0ded2bfa698939a8af9d0af380d2afc58966afe0f45483ecad0f114b904cc2fafcf470dd4fb8f193795e8afc3243b4c946d5eac82babac6feaf4ff10bf53acdf8347fb9fb7a5ac4efcf160f0a7ef3576f439404a3078ea092f46f408a955c965344023d847fad7374cf145cadbc8348eeb2c5aa999ebeeb8a5548bb14e0092b184caee354020c19d66cb213fd0002729bdb186c4c494e17fd6effe29cbe7fbc539caca738d54f9ffc6e52a35a27da134192e2f7f4ee2a86af281b78670e662677e97a1ef008f10f42349fa83bf7841d88b1a457d38164a383ae9c6b974137d58216f22d135d30b9d6e7a74952a7e905f385141f4df088415d704cc3b03b2cd600cb5507f8ea1b53fc0e73031a3946c0d6269f020c9c26a3be3bfdcd37f8d3b9fd42538ebd72029fa0bd8eb57a4fe6769e1b43b5d5d7be311e12e52ee9dad67aa988dedc80ad616d7540381993d9de91a7fac6d08e4414254b9d1d72940fec032833a6b1a5605f4b62c47a86d70dbec5ec913d0a613d438cad385fedf24566bf79edd17238e55421520b95772224623f145100e663b2ba20161784f688afcf07a900ade1d48060d21be9ba9297697891c2584cb99a44868efbdf65178592ecfbadc92f4883662d6b21b7f266eb21815c7401b8e7da061e3258dd685f8cf65f2c2e407c913f85d053b05f6f92ed1299186632ddcf175ccbbc933044bdac5e10916917dea1146f77a8ba4b4fc8ce260b5deed395ecae9b81baa6b385fecca5d2982041c131ce02a1dec517ad2d459434aa3a514e7a4c6c1362401b1ab62b4c89bd7705d5072e0be5250c60c2fdd946bc73050d3b8bcfaa73165eee3660063f279e824d1e15f87307a40bc9e1ccc0f7d7087ba84fe9275742455241b61d3687d23eb9d7a9cc18072ed8be1492db46a454464090750eb0a393499a73d23f4c552ec6ae425a77f97d4285a7f287066b2198bfaa99073da6f4009755e59838e48cd5fe692962b87da3ea7e14b34b352fb2a4673eaaaa594a094610bd0cc566acafc21891b7b0c2470bbb338f579231e01c064f275c5ac9c2748cc50e7f2e36f2768d2a59c22d14b6b9a431f7772e716731c55ccbf086187fb15bd07a5af3040d468d4088ba9e6383f1df6dead9384758f2da81ee96370d9055ce5a0db56bbdccb57ab490f42a01e083b61c5157b3c00e2011dda865c7294cdfd2be5c03a1a36a4deda9cf03b500fd0101b3c97046a717a2f38fe2265185f4411cc68cce6cf9885a7a8fe6292eb9e3eca69fb6249774a8c82b888d22d5fcdd549846c3ebcf054c6bf07aa4d6b1c0d4d9bd8e16501f65373ceda249e9c760848fc86ea92fae7142d211c8bb4a287c91eb08cef7678ef1f445f76f81d464eb1d29ce5c6d6286d73d49cd0ef03b65376eb146a3ff69a487ec90b53c11cce613a586f22cd56fd34df6f7ad64fa3c68a6ae5c9dad99d4a3d2b0974ea1f627be4f0153c7b5fe472d0c562556c4d8d1c7c592bea45bb7886b74f8639f9487b2f6aebf4848b5718f2ce65b8f5a4efcf140e2857bc9c503f0058f9b6af16e75f2d530fbba8979f81569e6cc0bc04a54e30de4e03a9300fd00019b881d73a78b86771d41c0c2a9ebdb3899727f33d2d4d81dd27b6a00b4c7db265999b8442800750abde7cd97be0c691ed06b5d40da115546d90d4803e82c61d43eb5e2bc684adcf180be47660870921fdedb2ce43f33564541fc0debe175c6c49bdfb51378902dc709594b9b7d34d0af70b67c3c608aeb5185e78c1c39cc3080b71a36115f623a07a4e1a3e1f3e17b6f9f695f1a1acd9dd1319d0a0d67b337e64f720e5168c09196244bc71b083f302e042be19b6aa1f8ad61755f4883c3a1ae615252b884ca3cca5e18a023ad6725f08f9e0ffd60e7a73ccd29afc910d60dc99c06f5953c3e398ef615fca45f6a83f8a0be653d31a7e1a1666cc7334d9cad51fd00016f7efa38c8f9f478a6ea1217d8be9b7f0b01c5d1fa483c26e403eb3a4875aeebbd0e7eb8aab8472a5bd80e8be38df13526042952f813b71f8aeb4a2281bfe5e5d9ba70f7e4c9f477706da922899f505dd172e260ce5f008b59c0590d498ac50810e9a38d35f1a2ea4e9ce8f77e46d0b5604dbf94629cfb8b65453a0295eeca9d992365309b7956481a8c5080510a09183bd3358fb26933e15c83fe2ca6d186e631d72889a09464f5dafdc8a93dd100329071e52beb522bef1af0fbae0516ad3b02011e19a2b2924791b3f22679b78039c8356c0e6676e2451487f056d0cff064f55a992afba08f59af7606a809394772ff85c4c40673dd54eb30020c6a5cde3cfd0001ecbc47845e4a1f3c05c4e9d0a47e5e8996326f48d7ee1bd0e432c5f33fecf8a94feaf03f2da65525bbcb119c7928456c28f31c183a21af1acfcd9615669cf47a077f861f694bfc1831f1a71ab66540906c62b85274f63abcc53a37e3fccdc8563ca2153818b6b796473848d765d1c81d4e6f78ef8fce804184e04664c5c6af7c3abe4d92aac3f6ea99b84a3e53a7bf7679c26dc96804ac9e1443b054e3c55fe89315106a14646d06b84122861ac0ac27fe64fbee3c9807b0264a90eb9602187f4df2cc0c62b025ba70bbb30a7e43d533f32546d2e6f97537bc2d623a7f545676a37cb511614037d77fe21a35ce4a2275e7ea1d85b7bc19e477c61033f5effe7fa5d8ff48e2873845157b7a29718e6692704a9d864301fa254798555172c6277cce4ed5aebdff9c27a1bb37071677c16da15d6c1547c5b708e1988eba68befff1f1743342ad7cb89ec8731b567198953d965ef6e395d38b410a326ef3e262937c763179f22a076d17f848dc4e36be38d838d5788f121d771f23209a0d50fb3d016c5cbc47cec31069f7d22bd78691662d8b609932b9533bf828e213e5ed4e61f2b80f05acbc00fda0017bdc59c8a6a23d261cdf1dd10e91523503c3375a803755c29b6a84bac626708b7db937ed39f4053b5c6376b3988fc9388cc64dc07466c67704a32b703d5dd86d8fb8597cc2ff7ca190044c66638028855f29fdf2a0943c64125e3ad2487de6928bc34088957eb32d843613e6b588a91cbfd8c37c24ba655739cefdb203bc3061ff93498160c7e949823b0947c68b6c51dcdf038c538f50413266680ee23817ed9cb840e0094f6fd2277012aa2c6f82b086242e6332a4e00bb9c12c153dfea9340e681e63d72551f8830b2bb2587e5937685252928894bf90bfa174f62bf7ccd43415a094bb4142fcfe639c62f6eda0e4d7ee033f49f51eaa6a35b0f7f400992d8367a275e9d018a547430083c41a35ef543bb92e159efad39c5b84d127bc68dd581c308afd5f81654ffcdb3317dd6e21d5251916214e873c83b6ac197dbac6c1b93d79b9dd5da090be204b9765fdcf662c9296295610e42a0570a1503dd67c44e17936946f3a6ce61f82b13cf00a0b47d06f2cd28651b6af32ffc58304593d5ce81159ccc952ed980f93182fb468ebccadae4dab4565d64a5bcb3aec7a09d681fd24016a4905a3a143e4d61b16898fddbb0f9d7602ce865716b62ae4f9a37e2f6ab89de930e066db6f4a8667ccc4e79e7ac760642c33e5f24266540c9b4fbadda4c0aa1b6a74d02bdf2324ebf9598d8ba918438de1e3343be0b057925bdd52304581ef621fd085dc55cf8b45d605cb0b60047bfa935c2968d554753a615e75f24086b4e40508ecdeb411ed26c007a1110f3e73f504d7fdefb275cbb59cf9cd68bf4784b8845467fac90275f3bbcc2c14a87fbbd7d111441d6ba0833b9045db43975317aee170242b291f8b07254d395472bd4b67db7576bcf2460bf0c182f745a6cbbec3f680b7c6e0a85308bc3af8af3302355757a77a2fe3f98350e4ea1b3074e37a638c630d529141843583ba4b802e089e0a7ecaeeeb42079e072e64fa5251782cbc67ba9d46e4c7f502d44a06e5212d09f4dc5bef1f1dfc376d4a042f608b860971c44caeb3735cd57e19401314af06a73180918af7693ec5204b3f858806e6919af05a1a8c6daea2ee3f08fd2401c082f09f7042a7a0b6b484287050a15f5d8c1011c200d42eb51aff5a484fe1de9feaa264ed3022b6f5b1b54a4a316d3d7e2635210ad83e2d3c497bed46f417ed22804682529b034925dc785a2d74361d1db395d1681d71bc1b0635908ec3e92f850577f35912fe5c173402e6e2ed8003c64a57bb65a2013014a3ce14ccc725f733a50457a696396cac0a551cdda03a2ec81597031feaddd801a9bceaeb5f862a4cdb3eda06dc317a96b29c27d78dd977cc6f25d62bb967814fd1d7e87c675042522c904fadf1cff80289374de8f98df511de975011d877058aa7ea9cdf186ccfa5cfa5258e581ee7ee73e16dcfaa82f079a16c95e6ca4f49c037b2423c12006b549a0b80c5dc9b93685fd2a4bda99e5aea74eafe9d28149e94adc538198d459c7a9a45a1fd24011c69aaa26aa94954fb7dfae2d63eac286b4979e7d513eac8144a7bccc34fb298b7c556a82e7450bf590f1ae658c474ac7c12b3fccaec877b6bdd11fd9655a27b7b69b922b1629a24a8d7f81a6827dd22cbab62d121f5cf96d59be904022360c5bf04d2435c52541ea4d7f932e19fc471a0afb38f2e84668d974c57c963346d790a670a699ff53b5557def1ce9650a8624bb2065f9ce99d6b5361a1b39629040fc897a5d0a07816618840f86601508e90198de64d7091a8bda406009948fa9ebbf2f56adc66e057ab23152504438062867c4237ce2b99c020add16bf66a0c06a072c4fabd9b9fd1146b73366535d934328188798ccc18ad37d30e06a39b8e14468d32820d912359323b7d474dbf507e894a448a4e921f70d1fb4d4ac03b178ae157814004fda0015c202cbc492bde212955236761fcad7de9ec8932946b5352f6c35a242d39b354a1f96a706bcb84174a5b11a7e51cf0adeec9c1e5c88a3f8f32ca81977db668650734398e6feb45cbe0ed5c5d8f77cfa67b78f8c7c856629e6731321126d12ebe70603fe28d4281f5c9165e60749bc8688d7ff3cd509d958dcd1ac7b068a3548af0a3e20b984bf4406a6c6d55c674bc83240757e3a0515bbb626b6b6b863fa7029c5043d67ebcd531601d39b8b6b7e507a176216a264fb80f574d7a6a587d5ebba7c355007630fc49127368f6b672bd12fba956db75f189bd438f5034badc04d396b04a021608a7888434eefffd082efb0c3196698d1b015b42eb6f5a2123c085d37841c0cd6c7a1d77c55d61d76426758cdadcad3d7b1037b5d94c29962d4fe218c9f98c89ecdd9a50a48bc534bc167d536e11906bf594876aea01683269255701b705ac454b250abd45d10f4f8b881c6f4a360014b450132d750099100e15c70ef65ab0eeea340604f3c7b3eb3c51292036a6cc2843989ea418631fb595ca9d7e23a88a3a7d0a8dd5ec1212fc786dcf7107214d5c4d3f2cffffe2b1fbef09816033fdb616b9318b80b32f045ec1bec678dd1500480154ccdd87365d602f0126b57015784abee6fdb9b7f22ba135cb882dfa738baa17233fa53c68d35e4102f185c07a1310b710ff2d63db7238d36487ab504e64e239d0641137cd75cb282e831621f101663efb2f9de2520049c0d08a7c965477fef9d575ba31e101faaea20f96e40046132cd3aa981e8f360cb6a9bac68844d07c7d1741e56b104f634fa1a0c31d64ca4526de4f1754effc40aa04b9dfdb6f53ef77540d66fc9d0a4058fb46518433a1467a71873a03600b47c81e0d452cc44728e3a625235c84f7f62d753faf91fdfa1aea056925168616516e5c4357a7e82c94127fe8a4626c868bb7bcc13a0422e15e31c82935a4e1b9cac496bb456d1318e2e3e704627f1dbe646f5f1590283833193cb03f28e00f5020fbd43c5fdc39fd35498cf4fb7471417e814974331500d8e4ec8af34af39b457d20843d897d0e015456600325ef702c1bdfa7bbb3f2e7a74dcd8fd77beb3df4022320108d0f48a7a9b2a32e1587eb01094e20cb7c002d3de08f481a1d7cdc6b3f9c7c20185bc7ee65a12aa6003a58b83aa90d90baef64c7d324c662ea5138fbb4bd063720f8f9111e20def54a90755537e44fd506737cf1fcc4d0b320bef16eedbd750f8b2002e3af2f477e9d2912e50e4f03e43742c19e6e94c1ccf84ab04f0eff342bfc1020a544d7e745fa08a740418aa6da398bf10870a860427dcdbb857b6b41cec8e1342059eabb84637e61530039918cca60b860ef24c0df9e586b7ee9ce89336d5f1f7a210f0385ce2ad9f83a8534ab0325a42495a9cc4cd4774c9e8910bbf4e7192c2e98001fc3aae0957bc822f2aca9be874e1493a0dbad2ceaf959996060a2bc1781c23520cd178b0cfdcaa92929b9daef0c4dc752225792454327bc351b63765208972820203954fb6c5f5fa020f757c1bac415fec7e1bad3b7c19a93ba5ba53dc12f5ffc6720e7572f4709fdb74cdf2dbbf50a7bec9c10ee302cc2c5dd878bd109d1c87bfe3e20883ea4bb25deffe4bed0029e066230311cd71a4beafa608d43d615652cf9c146204c98a01cfce1f0ab321105b2f2659d375f691e2f6cd9eb821adc512718acdd6120d5f64f7950ad04508b36baeadb52228ed3a1139512125834c1f449b2a9613d67204550d2bb9a9333d567b6c2ab154f1fb4bde51d4b5c50307989ed07100095485720109b0b89090c8a2fb0c51f3f9ca1eab0e36b4d9200396e7958523e57b705d11b209195a60cb9f034fced26b3336b0c49872fa13d56cc410f59463e4f312c93423d20f52bbd6ff9d724752b5ecdb148a47e86c1378111d76e77a2f4434816e325c62920510cf87382f2a4c1417203c4e17511170ac616fca2caa49b521dd721a8183f1120ee7ab5b0de3332ec1fb81c2d5baaf0509eda6de26147b081866c2a9aaa3435882011ce790ec01637ff533a68dfd8fa22733bd7e4fefe18a5796e9bfaf996adf54b20509ea869f679c1ae8b074619487fedad28874cf9c93d01003e9dd0df2f45b66b20380577ba031eb78adb2c71bedc8154056b157ae0d01203c19d7df420a424f71521d04f8ed62e7175b7e70d7f92dafff586e5a60be02901f9f67e97374bcecfe7830020c6be51acd068843922b23415a1c7b39f4846da7584a496483a36612dc295968c204e43611bdc897913427fae390deb145024077c5808238d960f93c62a62f70e6520e2f6ace6ca1e8b6b73dc2fc3c43f3d1e740f1c663e3e0ff9415b2d282e1d377420bf6b145630d553e8c6e40d84626f01964e3d6befc33ac284263ee2c35d76003721a9d895ebe788be0a6988027ae6b33a26bee33016d8f4b64255f320d34deba4900020c8bbe181b5482c9352b9d607eed48dde4a2759d765bc2da53cbc1c03d68da30a20818a0a41e03fcaf75f38766bfa81738f0c8ec2fabed7142e998e7b55e014300120b61bcde758db04bc126bc67a1c87b9fb4f8eb2c3958b9e4106306508e2b22c5220cec0548ab3977bd4bbc802483f0c2ce3b1d6dae43bc0f8c79167e4a76ee6f7522007f74fab71a89f6b94bdc8b5128de93ef2be214d04fbb8ac8c2832e1f2ea6371213c26fe406e69b2060b60c6d0eb7759fe85f19cb2288344239f2a398f04b2b8900020689efa2cc2baa15ce24852b1f71d08200fb1f2ab8e10be0c4db8c8263a85032220b1f2737db4e6e55370ce004319e7c5e137f3567bc4d5603e4ed1f5c636db6a6b206dc3dc994eb2ed126f1a76892117b18b24028dce73ab6d35924ec69df9bc361121fb6e92175d959528d8326cafddb4ee94fb9ffc2d9c8a413898f14cec99d4299a0020349eb2d5c10d69df3bfc41f99d6cafff21ce69323637565e1cefa60173ad0d78201818225053a5e2d51745c5002281935d4dca8ad82ff76c5ca2dee6be84fb767021e8d31f169295ce6052584692ed9e4da87e637ca0b52455f216d5036c55d45c85002100c51c6bcf08c0a3926b2be93b47d0ed8955386d369ab8d6849957efb23904a20020b4b64e35cfcbde2461db3ce57292361aa30d136b0e7bbc766f4aa3ab4a72b66821e802f9eb8168e002b64b2b7ccdaba46e73e5c422dda18311788b19eec7af5782002062e41e97d6c8f4c6ac4c0f978f6f8488c92a51eb5793ad109abee4d6c009256920009f7f1755459578897b027bc2b282466aa1d3b9b0983fe4cdf51c9090548d5120760bc9a32ab7facf7f3c1d1aea1b6cab28bb65276e269472cb24ded949256c0121ea8ed0306eb39aeefdd4f57e98d25cef9ee6288a915cc96207ddff402bc2fe81002138caf88bb834204209e39e6c9430ceda0294f1253f8be81917370a34eb28149200203aa2e1582961cbf9b22333ed51aa4512dddeb3cef2e4fdc3644dfa5145366618203a0ac51cf2e1a98ea343e9ca5fbead275516bc20e9bc421e967be939026677682164c2810712d79c82e75116a7e173af1208478e8ab6763c7ee58551b4f323f78200209943e959b9228e61e5def9b2ea18de1688565a2c49dd98f1c0a7d43e81a6800820c4ab26007fa076e1ecd22f104a860f10b22b1ce2ad1229eaa2cf204815f7246e204090f4ac3d42b2793d83aa79103e0d0488ae1297109a6f47bcb29d8c8b6d383d2058ceed8e9f61bca997b4fef220feba451f5401ff7186d1348aab81d7951b5e1d2014994a638981db8c53c2a364c744009050975bfc23fe7bcfc5c8c36b3df0bc2120e26863332f579b931156f0559025f7f96a4d72a9fd108fbfd5c29a71b13df72520e84680238c100c359efc6bfbb7e97d3ddd4d1d24ef3fe8a5208a714580e9aa552108c2aed76de2cc32cfd4d0fa02eea4be069e74da620ba09461e63b5127cf9d8e0020626acd1bbc9c821f30e5ad5b682272cc4b87a9e05323357a367e170ebdae283c20ff8a87793a1dd9996598d50333ace7856916b2add797fb4cd7cb7fdf24245a642165e43a1aa272317475fddbb370cb547766ee44842ab25d83cef370304213eb8b002121565e2ca6c09a263cfcd17fed20fb6aa06e1e798276a5f0ca8cc16dfc5c309600203e8034276a6f2379f8374e8fbc709a692b2dfdf271c0726c4f890282a40eec2920fa335f7d0543267026ecca4424d15cd07755568dc93c6557f850031098fa55572036cea7284ab1abcbe3c7a83ea779392fec2fd8c1524f95c5bb481c67e300600521444c7d18c458aa1e62e5efc656b27d6396c2fc9299befe67e3eef807711f948c0020829cf5a6319d4467027f9057dfa46e1de952a01233e068f7fd18cdadf9a3534820b622a3b592686cde240a056840080c5116582bf166f4655ace84b34145a78b0520fddc9480245d4ac36034ada99a182ada449373ea0fe16557c3c6d9d55b21942720e59aec0bc8b52c1ea0179ef1bece2bf3275164c8b14ef9528a1335dbe13def6620af95305f745778a84f8405956a82816f366957d31e74af5509ff0b7f7dee737221424e7838cbff036afc7e59ba67c6add560e242a1772ff069a31e5e320c08428e0020f4855f5217b4a20c250b75c69d494ec450321911f9d7841e489d43b3739eca792010f35a5fc740eccaa7fa007f33b028089dbb8bf539f560df19627d5bdba6fe3f213c35de64e6b2d64bdb6ba246a5c9b6a91047e35240db65c383a1be9210b7838c0050fd000184213201216f3c4d446f38e3733348efdc4a4dfd79febf41f03567e0ec2b5a8acb93639951dc506d8649ca6d1926a25b4f19549d2b3700cff07c100c47c456ae23df2e60e27f8822c427e2de12038e00293de92621bc4a27d104803e48d076e3ffcf8c31f549fe9f95c6b9233be396cbd3c557efdfca11fdd91397e52f35d6b3a2130fd46ae505dc66bc987d8e93689d41be09a1df024af243b843e18f298de218ab87e557c782bd20648dc4fd4a5e654f1e9fa59626663adb179f51fec2f5534f2f4929ceaccd34d6928ca3d42fcc5efa32490428abc3296147147eabffda85ec2be06be4512448aabe1829d0219902fe1e9cd2bef29a8f89ed8eb1966b89bffd00015e46cc825850532b9bd9d584441772b3963c554af1424ffa9ccc7d7de55dbef9456a3fbf7b4be985d185eb898e166ba646daa12cca359ea77bb7a59e45e8a6cf2708c16b5ccacb708839eef2ee4b5b6597ba3c5899c9f5214bdace3a521fe36cd39b77952d1bcc81f9e5edfae34f1cce40369b7ee492701351d34e231af8a3768cc158a796e900d0cac462f5204da5cde3abcf561ad60f91fc8951e4fb37166ce37261649f840aa51e6ff9be749d72f1f5b5ae3349f14d572860dcf36aa4655788b8cf5108dff7a4e231d2e2a3bec0a159a1e16c9bb38c4052439f2b6b1a62addf739772a1d51057c89751f7518a3b1cd7b37c4ff7d621a54bca5b3936b137c3fd0001b4a09bfe02e11668f8f6204cb9ffa9817ec412c820b6b394ce2cc3a12546ebc5052ec1c74876f3de8fa22e19158198cd04c1336a792ea47e63c2bf4e85dbe7460501606c97409a906dae4e7ad84517a7955793365ca4f49b5f6829efe61f52069fa19cb30ce0a74d415898e7e134ed8c4106cc9d6be32577e9a024b9dfd8129cb5efb1ef282802fe0066aa41e587ac9ee20d6416010e1b0772a44b6d6d1eb4ddb32b80b288952b26323bbec16614c227e4599cf721484443f56571c7b048e58fe48b1786c44e4979e105196eb9b5803795b8aa3d3e3a8f85e10abeb0f7b43b9a62dbd0905af620309ef74f281f39b241c4b4c109ca7e0ec55b13eef8ee0544c820b833fcfd65b4a897458cb9aa376c6bdccf1032e099598452130bd38d28096322fd0001b6c9b1d3d60a49cdf61f9031694f9f790a4e0118ae39cce789df472c13bba207d101410af89ba4b2a88cff5eb09e53593bfdc69a4e2706633a45c77a6d8f4baff22c7e5e6b32278dbfe97100271b1fd1e64463fa6a757c4cf4b19954d1d363494664750fcde0f0b6e35f9e0f08f4fb1e438669f78b10e800943840b15541a31c3090437364159681974adba314bcac37e6cb3ec97c3d8e0cd52241a4c162787c199a256599b97e488b8a75a46d2c3d8af1951ddac43b0d338e739deed1ba26a8616f04d124244f365573b602697aab0b427a8f26f1a22de77c563cda13fc03a030817a837c497732c6108eac62102641176f62d5b8e73d0e27e17586d6e2c2c3fd0001ca7e381637425fa77d95f92b8b491ea1398f53d763a6ce32a2b2ff972ab74bd377723dde5302c487fcf7eac93b089457761ca341f143b7c5aeb51b33cf103f2f4ce4c282bc5bb8c7290c2a9dcc82fce3dcd9669f660872f602de46e869fccdd99c85c06d1d7bc9af4e93502e4ffc385b9641df8f21a25a14b8e4cf99cca023da529f8689d86418c37dbe3d4116e08069f3d08b9c952f4e2164dada9e62908d57cc68b264df8fcbfe449c21cae576adb8169a97294a6bbd369a58654cd182c8403080b3a5a916c107d7271311a291841f3e35e065d48f6023ec4118a3a88d417507ae86b6c74e6ced02c768e0f879844e22862c357a9fe22574e30c179e2243e62192455f24a5c214eba9746d2a8f6a47625b53e5e62bcecade179907fccb08e4b200218a8694fa7fa94c9c174c8e1525bb14dd946981e66b1c02178cde818615e3b6910021fca3cbe539842d405545a71cdacd7a795b6f6fd1c1095497ee8ee215d5cb8eca002039f76b8f7067cd9cf8bde783c8ea6edee7638113ec6729093749c2cc0c15d13c2091ecd1eb4b171326a6a26d764e72e09160ff2112e577149bc7c24e6c0907324421cdebc7f780b73aef4358c6f7e5c9a78ee95dce81c4c1bbbf570cde3c43ff5ca00021c6955241d2f09d2e90e33601fc139d0603919a1011ea7ee89f0e5d53727c45a3002037be468901ac92d7c3481ad63d364a93e2daa023bbcfaf4f6fa40cc54974de19209178cde568ebc660a7698cdd7f83d5932364eb8ac144e62cdc045a00ccda5201fd0001a3347a2cd4b1f5337653554be5fea273a5bf0292c0fd60908c6e699802079912372435166baf2f71b35ec0e00a714e9f7c10096d0f39a65f66f220057f369ce7c8221dddd00e90604f9de897ebf9f06afd41814b57350ca2d7ff7e08f60c94dc1aa087b7975936832a7050ae4a14b47b1986e70d61223cdc37dfeabc5e4212a869d953450202c9c12db23f8819faad59252173ac11c54020fd7324b4d39673befd2b585437affe9398e7967772d408c6db860ec512f94d02b0cbe9c9d414bb4be4b08c3a420a549efaedaa6f0aed7c74044785b611b2d65abfa33374748adb690a54c8719131e9dda9d46afc9dd09c8abc498d6de657920642d3d47a55f17fd3fd000189cc7f3247c6ede0becf1ec89f5d92142d25a713e037454409ccd146dc18c58319550275149342c690f00b1e060db34bf6ea34473c661ff9f32a40214a4715bbcea59a9ad6ff976e43b325135ca16377be53be39255f9e45ab4b3652d629a30500f9e37671d56952b215628ef42c1e49046476e9a760041003742751b158aa85c4e95f70e267d2631491c60cf09a174816890a2dcc2f8a38f296389c3ea66a6d577301297c242a6b9ca7465d8282f2e72e7673f9e1f1c8f470949c970854134de397c08c06d5d21fc487b2b9529c901c052e838a087f15b802d081e869cbb311efed66ba31c17c73cce1e0fc32d58d35e54bc5524776ee3f45d7b8f81fdad4d621b95f023b2202f5d7c814aa89c27b5e0bf5cd64b444c711c2e1c4b805af4fd58300208214f56ae87b268fd16d6df77efaa715fccd1fb1e6298c1c4f7a4f18d39c2f75fd00013fddc975fb72a66d5a7f3ba6df9c1ff55c7abb5a8f08317c6b346875e850223d87d72d71d9b17c11bdbe6eca34b521fe98dc8d31bef6fcfacec74e5c4a6c5f00ac769363df4720e17c3b687a42f29e8edbc20184dc9274d8546368e3fd2408bb68dd224b73a1487c10f4e29b0d8b9823f7c73db26ed16baa4c5d75b162cb5a97caff3cc8957072902538e0e698fad2e90b471777c5e8d90e5cd313933c2f3b30e49b6cf7ae7dcc09ab2e5e464601f093973d99c0815c3ea587d1803b4ca1d9bcc2ac20cb818f95d9239fbbe62c3356ba41f7dc9d2232f6221447fc4858bbf11ee382bfc639d9101943d958a59ff9b81007508c0879c4bf16885bcd6eb2383898fd00018ef6741f57def1a55a42b565ebe0451f0208762da626acaf0cbaac6d9bcec14e22c15660c2a0c5a23b27c445ad968a7e6b2daab11463040eb50799858b7a5063965f947234beb0d42fe1c2dc7bdce7fcda3de1bae384b62e798995eba4836dbee41a8a4de269c026018a22687ad77985d049bda1d39b79528b320ad3d22d893c547b4dc4acb57fac4e0603468beafdf54408ddb7d4c5db0cf14162d0d735b3fad10888f0048035481e5713b846761838504a36c1f956b072b46f11c7c6fc86c766c36fc7dfd5068855335b96162d8b299e3cd21060fed730310d7748c3d16f228b0eea1f37f5eee5453e3a19ebe1e60e4f2834d3338bf1887969de57ef02a1bbfd0001b50e09d8212707f0035a46513208bdba63a5d1fd7a7ea88e181d7a3de81b8afb4ea4b0428eff67c04b27372d73896fd9df443aa9b2a42cdb8665271bb1c54833454504dbc80645bc02366dc998d334b2723bbf5ee1e139265c107db84774b4884f26b57818d39d05b47d5bdab25778965a0627a96ec303c743ba57c0d32d0337a6d3dbe982284109eb0a7976221816cf3fa7f2e3cf739f30be83f253564af7f411358d9c5340fa5578120c48b617c088d9a3d0811a575bb1e96b746e25312ff6d87b9705c04a10123c7606b4c5d6658244121310ce3f1d062250b57ee51e35e0d7b787d38206fd9d26c70ef94f337cc7108ae8ffddf5fa314e6c4e5e1538fbb0fd000192fa78c12fea8a45902ac86e2878e8327b5f4c2ad9bec7d6167bc5590df49cbddda4d4d652f6f087f2ddc7a2813aa5b33048adc5f900eb4acd983bc86ea7b89f630b647a9ef42ab1bb6484ebc20989603144912ffd80158aff7e7d40a1a76489afb21f5f711ecc3ba613868a7aac4f28f2cd5440dfd064c4874d4e398a4718e10de8f7055e452271f01b27544af7035aed32259796962035d7bc37ef843cdccfacf969a1659e354ec27efda8756b09c0bf855f4fbf7598273154b3f517303b6169bdbe4ede890a90d3b34c917311027afeaca7dcd27158b04886dfd81803594292cdb3dbb77ad3a8df97df63095fd28c275b956cc61faddf770608b898d74ca9fd000138b1c34ee04d01368d9cd8ec4d70b97633951ada508c031470cb4cfb15a62426276c7442e7679f926e93325e287ab9ed87446c144be02e559dd076c9c5e1d6a6a7de45438076b1bd7b9ff5a821070877c1d9626925c1f47838e56bb6982b54fb9e131741bab5ea38aabbe4003538c454980dc3be9a436283edc32a3de0321f114ad32cf34e860ca36f18d476980910e564af57da498cd16d08af8b4d4696a9962adeb298d7af4c8c4ad9cb911d80a2115e833f0856833232f92f94cc9c3a6a14270f4c30ada671bacc9aa35bcd3c945dacbb01f4556ebac4e52adf8790dd49fa799584d227ab95afd2da9e67e5642a90e54fc8b693a07384577d04cc40861cc9fd00012c7977632367de82810aecc22a1a802a1aeb6ac54a4a79d8e61606a6eb72effe1abd74a0a18ef83709355e77cef5666f16d94c0d710f5ae3973bb26d07c0a436aebca4d156d42952cc8cedca94162225b5b4780cf47a6426757758957dcf2f638ead2312e67e140ee8c380949c0885c68b396517ba122d90a0ed184564bbe67bf1d0115c77857fbb29945ea00d8e809c295295494dc8cca091d900837b60b31a79bacfae59fe638ee8a2208942e27f605c452be3a4a43cf21e8e0f78e7cc20ffd2c546a0bbcc404b415e4eae2c7b9c2f9121bc741a6f8c5c28c9df3e0169cd86809f5e235ce17fb625f913f94b75b360f9097b625a5305040c55a4057dc4a68efd0001d594cafd37d880576656265ebb737602d6f3b9d0feb3147d8c1f6e1514ca64e3ee046bea5e6892d8db9c094198fb3f697ae6fc880075bbd461e9aab7425ac3a7fad84071b170739e7815d0c76d2ae7fefb718ec132b32a842c58cde33605488043aad9c5df6e58401994a38dc50779e348cd18582ca74aaadcce6df39b221d4235a88000eb2e3efed6744abd0b68836d56ff5d9ec973be549d52a195195725caf3b8cb683da9b96868d35727bf4b74dcbee838d9c39a33d15609fde1c2b345974a93c030952f52da7ac20b8c26b340fd9c08f56b97ccce21004af28ebe4946a91682f9738085cdd9a53e160346cfcf396cfb59465d114c600d9571634aa3c880fd00016c714ccc93e995491adb6718e9ef69fb2cc36044d9e6b73130606b9c845dfdc56e9518a120237f58fb6f2546bec6f47ea6a11f3d898baa47682fe3f537542fe9f6d3679398064a48a3ef8abc92e89eea84c6d8ca956b3c40e9b82b2a496bb1230f8789fc7b0befc061468049d416aca3fb41d4272304a728322684f9ca6125b91dea97bbbba8c83045b5ce8b3110d429d65998b3aed570ecfedd176e98a91eb3410cd501ba52d176bd2c8d05e94acc8f352b3cbe12adefb82d34e174765ef1197f8a93fd4e03c98967ddd0332733e5aa0ce87f63aff78a2b44d10ac63c1549d9a9c6808b743e6f785173924d736bc0890f2e68c1df72b0fb1632bd4679e87690fd0001e736a64f64d58af8d43f0980d29ba57dccea56ff13040270c926a2703401b83859a94d6cbf4cd62109053c9e6ddd1cc61ac649ebb1243037adec455891642de8f43b57afe96cb63736e3e7d735bbeec8d1dc2c698f37f0bcd85bd84cc6b7e25eab500c03f1c62ec730c24208e2df2830d32842277d9e5c9416a91217cbdad60d6a77a7127b09e7463354266a1130d1f04de9041f0f83d41246766027700fa9a02d10d2b0fcb0bd534d22ed38278ce177bbc1c429c09030f105a67db70011d3eb24754bbb31f8a6a98bde215f635409e4cb8c3d769efdd7f1561976bd29876c8a11a130cbb8e3fdf15fd9ad0329852dffd794f499345c3fee09eee21997a5c8a021b993d7cea74a8935b42df2d55606a8841b1a4a8fc0321701d5de9bce1dd1bee100fd00016e510cf2b787c67956990655ca7ba97aaea25163317e7ebfbcf2681b29b0b821aedb8f9b2e309d37f660ac7169dc8234a7e7e4d01e79164eb75f28d284c52ea3d7edff718aa96db6b0b6781366ab985d202823130ca53c2a8e5186fc18862348952e967b1a3e3636517c3e3c48d8fe5e4ef1d5e230ab584964c888c61393ee3d6e34c50446b86e68ebfd048ac86065f9a9c4bbfc2474027b612dcafbbb0416f12d3d856a96557529d1144a852ade77f50f600ecf3c0e00296576eb49a0b211baaa815cea78e1b7a56a1c698ff58488378722f58fdb1ab8bb0063654a8de8344041fddd04be1b4b2b1944ce9d1ebda667caf9ca00e5c2de892a9063a449edd8c1fd00017140014f19e2474e1cc4b40a5a8033f3ddfd960ef33c7e35432deabd85a5b2c18a27b85477c9e6fbb2d8a5e6c686078009b1f7868768fbb5f569ae3429fd64e49cb3a62f32fada09059982a03a20494bd2fd2caa75a01b3ecdbc32acbbd648905d56cd2aefc714af1c24bd6e8f06b1ddbb85e9882ddf8f0e67c654402bfe2e0d9ba404bb3da2d58305184949ce513b3784c3234b39d25e0c6df741683750cb46d7856e67a0d45f4839b5305f9965808d41cbcfb2ad3ad18cdba6744eab0148dd0c1d5e687b6e76bdb9408766b57297be6fdbcf9d7e3e6918c194ef32bb776b5ab85f3a6a164baf866d93ecc3acaefbac43a9fa267bc623cc136ad712b00d788efd00016d3db1d97d5d429249f5cd6dc35f61d0b1b44f1e433cd5e01d28afa6cd6718fc1432b77e8eb6418b0a4b6fcc6707cd3d5c6661cf57b3b73b78feae7c89e25eff2ec1d465be91a18b2f3bc4311919f410cfafe8ae8a06b4b947f9b6fd8ac17453c2f558dfd67f71829be66250d40c3aad6e3ff52d1c0c455e7a4f646445405cf1ad45ba65392bb622a770ab0f5a57e73d32d98ee49d73ac7dde7dad9b9c8e1da9d1e6aef0f9cd120bc1d2cbc5ad819190b758be385f2b0dd736184382af8aa419ac7d734881ab4728ea927b6655b7d3faa4a1e14caf6d38cc706a940bff9c9021e4b6c3ce516d0257deda35d2ac4e0423f01ac849b19b919b773a58f34a06c6b1fd0001464885fd950d292d5aaa6155164216521d2113d795d9aff389771e8f39ff3d96afb5e2359fc52aa6d6cbc3921a7a21e6f3fab62e748337e2cd212456e2b2f52dcb352a75902ac6fdcce93dcf027138be788aad5e09490bbce637751cfd5bda9ec540d7daa92eed7b27ff1bf66585fbe3b39db3de9dd386ecd7671f2395522c1c9006908afd04fe68d88194cbbc3216377cfc27c4fce55c8e558ebc4943cbb477a1172aa8b344c08d6fb853e64ff0f986b7f3e7cc3b2c3d8b2abbc43e08eff15787bfd6a9a8f98b207d8e2530c0c37a37ffcec2fecbd726b4b845ff48a44c1ec7031e4e663ec0042663ff81b9a7fe7d599695737511a685148fce0c3eb01513bb20ffe083f86d11f3c552efeba225a93eb8ea756f45c2e49a4dd08467b79a14000220fd4b0ae4d4c5a165ab75af08922366e89721ba7ee52751e0b3e64017787b9445fd0001d0a8ddbc130bbf7bcd20bdbc8728e812a45cdbe602dcea5826f753b94e1220cf698c1212464a17ed846b29db82b1cf5373241d4117b07a8b7d279d4e8511d22c47be22291e9ab56454becf533b771e5e602542d07828952d5ef900e2548739d57cbb6254c667bc50a0f97c11b7f3dc1624111f9d32cb0d85ac4106b41cd6d82db7aea1135334220163c190744b6daefa456f69c331facf9083af360db6f2a2c80c423357c8fd1bc28fcfd42db69d733efa9ecdff9df079bde1b73a63ee74e5af5c75b67a4824a72466e17b501f6057a68efc19627d115f19fbcb48c0e0889857f0d9191db5875ad6d336adfbf7f09989b2aecfe868c2efc2cc64af46d07c44b9fd000151620fcd4091a3d3e78e8a1f1b5ac9ae8bdd3760320ed9bea2e1b237110d7747e9894704336b958fc92eb200f06507cb56a12f202a8b098bcec5b7b6941dccc18d2bd968538185dbfdbb6ea61eaee22aa8ad24d73df0adfcfafaec181fda3626479710bc19835a5aa7a3b9afd8166b89f5aee8d52589059eda61f19f6319335dfac7765a9a9e22cce0fb3236eeba6ce250ea0b7cfc4a021ca3c88859f556dc1137349a7ad5a628bc47267ad91ff86174a2fe74e3ab298ae8917d6a57a916f00b16bc0f3584b12b0d63141a20b1ed54c6551c6dfa5647783dd9acc68ed75044faf6745161c1ee4abcd9969ff9e01f14791de7d0c8e44e77a5b249e2da833ad3bbfd000119884821e74482b639ec1f8484eb6199a01d6e0a3606e25527d7a9fdbdabaad9f378a9aab04a153b1003d520d03f25a9e41c82504ad6de9fa6cda30a3ee1128c35f49d469a79b3c190ab0fab92d9977478c7ddabb6a66f291b58756e040892f44ebf6c8d0ba3cdf5d9335c8b05b0d34a8f4e832c54979274f5d4554af2d05aec3d51a3cbe03282c9c104f664fc39863c3a23396e762a5a8b5ba18b3c84f0f49f8b7cb6f627905a4fec65e5ab41e868561dba5cc8bcaa8c201d613eb678342aaba5e5d44f7ad7a58810129aaea2e6bb9850ef022e54a50b18e5fbbb76b93f050c31d279e66cd51a29c42591b18db05e88283e52070e6eeffd8fa447bce2f22eb921b2e3f53f38bb201511b9e1d5bbf22bf9e23be137543e34d81a0b194f373dbaa600fd00010ef2d9c59966c760260612842d16526b4352a5f05de655fd0bf50546be1d893d90f4b8264488467880be2c4d7f3c577e6b68335f1e0764fdb16d6fc44fc5bc2c1660798e6b31bdcafbd33a9edb44e48dc37306abe9ea761cd2077e977a6d5b92aff3cdc33f644f47d90fa9a4b172faf29e264c9d55d27cc4e7b7e5e891adb566d172207406ac400348c386e74716a518cfde36169e4cbd8d3093c8d85b99e54474fb7c7ebec5a3beb18b664b953f4d9037041c45738e87c53d55eb92fe862a78627a8f4f3f8f3ef01102b8df05c9c1d81da85e36bff90943e0dd93efc00edbec664fe16f03c8e79d3e105803c50a606f9812d3717921477e224efc9c38604e932116d048938c5e50af925d722ada7f78de5fb1020ef09d45e001364d0ac87ea4b800fd00015a2d2be1965546e9ffe759719faf9960648c9183812a7db83a24b0ea52bc26e3774ac36fcef82756ad386332d49551a147e87ca68fedb289b965a4088b3de6506378af1f858c1c995313e189684bbd3e484499dd7a26097ee6e89ff1d0b6d4c6c03917c53a95d9fd1b6f9a8e59e1687506a5499adea9c1bbf2f63b14207daebf64c8bd5742bec97f6364560cb3d687f8a1ce12a197e87df8b23eff607c97849672fcd5803b43bc8b6dc2090d7b99299248007a3207621c0b40e6fcecc3f68b2888f5abc842a44e6f019391449a7356f9e2637c77612b342fe61e76b307ffb780f529c6c84a6e6ad8d7553021070499e85542cd288a543bb0d318b7abca62c48721047951dd48307113449db6a3f997999f421c62b4524e5baebffef1ed21a6a1a800fd0001c4594030b3c64f25c491e6a5ab25b959438c11265e0fb2e5b2c58e3d59c86d642aff89f4e5137f08ee4871df4098a5748795d596baeadd2db0b006e02822ae2c5f6a93c5281b82a7d60f8c390a264d293f1769d55a5b1f78f0f65f7694477ca79ec16677993d5b6606298171df85a7a8c9bc74a2438618d2aeb384de706b797758dd418b2b5d59dff089f7d4f7f21a8390a3a707c08ea4a238682670a0d80297ba68febea9c4c5afccc241d9f95aa77366880ccf891174b33d95f462839d2820451611e8453d981a703595e8fc73df0a4963c1baab591b7f3dbbbf62b50dc7bbfeb05ec2ecdb1a63d06ec20c4311451b4129a08b94049263e180411ce7b8b7b120a96a6184af4c9ac706b2fb01d6389d94cc4e3930925a5b2bdac9e96dbfa42a78fd0001cb6e8b1c0da834c4fc0d797fc3521eda3ddacade8a4ecfeb518a2e2e8a234d2f6901a7eb4d117404328c70a5c24f36236e88eb1dd19a7e9cf4ec7582f472da053e283dc193d70bc71867d2a348521a860fccebe0b45958f1b5919cb833d79802640b7665b7ec45135b24108eac8a882121b6e6734dcd327b506a434cea9298e6067c36457858e3c18d88a320ce33cc3861f5329bc1f9a8f4af57caf2c134051b12dbb58e309d7bfe9028c3b9b4179759095fa531cf20bdf18134c517ceddfb38b4d94849c3d7eae9b46c353bc43d2f8345e345f818e328875c1bdcd754b706258779c7c30592d0a4c4b5cb557eaad484d1cef2bd4d98d12e70b8fda33f3a5e8320486c47e0fc0d0e679b413041e800ed28ca862ceec23c1a937954131b960fdb3320a3e4a1a7ded3a425d38b144b090d9fb0aeb9ba631622041a702626583d41142520f6fded7e7b2408e70ac4ab0b4d23bc2571cfb9048b0bc738dfd0d6507549a451fd0001656bbe84db36e12bf3c78c07ba3f561d2c2687aaeeef2e2da17cb00f060e025a993c12551c12bd4d75c4c116d18951515f42c5628b0858d85b8afe5deb0aa14a2e33d147eb62b9a52bd4769b6a97382d6c39e5f70e727ee0c9a4684fcf9a03e7232394b4ecc6a2d32e27fe2b436b1081bcb4f3c8bc844e9cb1cf9b828bfc155a2467d506be2f89c9a36bfe2d19125fb21666ed4625cf881ffba75e67d209fde2742d5a46634019cf1f96c1e649a9dd58edbc374b9d6220bccf20055104e8ae8917537fd07f69e12e0b8200af3d924997ee33a7d1e9eb3ebba741f0edd1b59f05e1f279d0c4f7106276968fac8055088bd5f57840438a2776bb21693d9587d188fd00011ae402863053cdeb79711a4c4e7472a1559d86f89bc4daaa6865eced1126197f3c43d78ba16fb2d6508632ab4712b13c3f45d674064a51867bcba96a71b7683fa69ad337fd0c50e7927b913f025fcc47adddf1376a053280cd0fc45bbf29767b4555bbc4054a824c11dc93c3648b3e1c2ca42a5dc5f536eca084370ef65c5a6229bcac295c3fa578fc22eab793205cdc8d37fe3cbf7dc6e1a7c53ff3c7e4d226f0a0d4667bad282c625695d4a1ad88931ca894d4931b19b09c56d2f72e72f62600c97348ed8814f0841baea716d1e0d90f26f8c3932a1e66dd1e8c8e039d3e891ab7be0a887c16ea9fbf3dd7f2c7200587ef56cd0e75e8e828aedcef6198e6d6fd0001a265b258bad27b42d12a12e43a25bf566f2b77f6f0924e8e0c32f294768fd6d9f92e5a15dcc94a2067c71a1f9740700ee0e7f626d35fad2c441b176a077fe681515cb0c8613b0b43c708895c9ca5a41745ca87cc5e8d02e272a484be75cd9afc7478b98bd4c030c3dd4885c5214efbe70cf9a1f8a2616e2eadc150f979e1ca8c389b6fa288889464886bbdaee7539c6bba71ad0927e455d45db2c7371a5b15ccd8c7e7e91592e9bd057d85a18a9a9d1165a84329a6c7beab031f2819cf36a26aeaa4cbef4e7871c472b9b363a1a5d597005cb98e6828a7b6b7ae81cbd036f8d8afbc6289efacedbe51c10f27462c81525b18d119ab4527d9c6db52cde19cfdddfd000143a024d1136d92c3d0de09ce4a3837fff20ce4c4307fca87b1a09acdba6a1df122cc69dca4ec3ca89118ade730ec8959d0dd84db0eff5ab2ff71793af68a2d6bf3a301edce9cf1088046b3177c18d90f6318e2bea3a071469873d1a320d5036a6ea1375ce17113721f01852e1c436745536bba80365d2ee1060a73098f99983d18511059ecac21b84131d845bddfc589a1a4c195ee1d89ba9845c09d681a87c3fe2322cdf571b4a31756d2de38276b97ecef325f4ada73b747d78899c3f84aeec26fc9732ef5843f8b2d7af0fee0f04e01f85731eb9fde3f0a69c4c0aad09f51db5cd03db3627cce5d2a1dfe9910817efc2e53ebf9f79afaf09521a3f14980cd20d6c0a0d48152ef8efbf7a58b809f5c28186addc9690ba0857cbf2c96e395e92afd0001781c2002615bfb1b7d35b2e208a1df0bd8f95f2d639422c213683828227885660bb231058546848fd01763a1ae99e0a7a1040a0f398d8171b45ffc4a58a4439a5addbad802fe79c71a4a27fea8ed229c51d6cb26c3e21127aeccd2f0e31ff1c7d38987c95b917d4c86439a7a0d54b3985ccc3072727c654bea4d473676a45f13ac693de273581cd6f864fba7ff00f3e61cabfb689689c49849419ca1cf489cf9db2138f65c1445b74a0e0cc83e8368e6e79149e699b6e64c77c70ac5156bfa98794cd0c561732fc7e3623673e1f0ebc09de026d9745c4986d498762be6799cf99143fca5d69d04283b504c8d8e325c8811853d467b72e204417c7e35064ce7bcfd0001e42f7a528e3e1de18bdde6e2d9888886aea8ab8eb149299c32c68f6c93a19889efc05e641037687a091933cc83bfbdfac77d48a2828bac6b0625260d4b9da29b0d215d403c6d3aaaf33addeeac4d46875cbc4e3edc1a865d6fe0b6a588631188897cfd131672a8c5d098c0ff8ec5b17bcaecac1d78f83b5296408c994c1e81f93021da25ca403ab6694fb3e82ed260e88067e3edcd8cd0e70ce4c79b49962096eeb1eeb2b17be69033a338ebfadaaa1293f7fe17fb7ddce051d9eb82c84d639bab4a415353ae82dfed2996a26d184189ff1f25d3196c67f34ae50a39bdc2f711ed6468b364d1f0ea8eb29f486dc6c2f6dc59a24acf4772bd542557e9ef4b5b93fd00015ea90490404b84482136f214f4497c09a0ca87dcebecc03ac3152ae1c3e87b945f721137c7a309e1036d0e5d94c6cce38c36b1645a62c7160ca45abcfb5c165eb696154ae38684002a150ab45f1b8f1bb69b28757e2503967a1432090b6c90ce7e3671860e40e95200f8a1ac1ad927b49bdc0a66472eac7123c383ba28578b149f121ad8b1ead1e1908858a640ebebd2e1b8a4f787e5f41d573168493115448edb0de580a8c281b783afe2b62ac6ea243d021187367df9fd28f97e2ca7c8856d89c64a4c3c5e2147aea8120b4bc8b2d0b8ec5b7edeed35d24a800760e82ab19cb7363c7b2fcde6200b8e63e2b698489e9dc0bc4c8f1ba9ff68b59a7277038eb920fe94cb66b60142227c026662ddbc3dc29b373c5c805c365b245c2f69152f1e2b2007e3634d06ba18b973add33bf3e23a7175729a9442fc4213adcb0e5a52e2cc272096af7547b4220ef6335cf5fe47c75896ef2d27e58acb6d7b444b3645ad1a9370fd0001f3642f6dab0eedbdf04e554106719fde491a9bfe00e8228f250e0035f5a95782bef5680a15e6148467d4c7db9e22d9a4bc766ba884940645845b25ace95d405744929adc2c63e41e4c807e33a0d514919c09e855c9d77690be00720d83dcf2b2276e157d39b7acb3ae262e65a8a09ff49478fcd67765dd03b545d7e83bf194ee6b0c5f83c41f7c470e0a1c3f1014a7afc2b7149c01b3f1181eeee4ce8a9be47f0f7f897a05683629d6164fb882e1b67765e7560e7f5c6be76ad9902a755c6af0c455156b93f14e618f533feb9d351bb956da352b7a9d63cc5082d6f9768d80f1bb703c84be2bd75b848f06925f47e226c424c0ae8ad4293b0e9c330cdb16bbddfd000158cc2778c31d0436228349fd19e0428de5916401bbed1f3668014cc51cc6b42381c32e5a7d5ec4d194037b0544284c52e151b652e2733b17065b2a98fc1f5ff30a8acf5dc7522b64eb94a8a71526e2aff0acba058b541fa412bb5344eaae4945ace66b4f9251e842e4b52feae5ad89ae1ce3617debbb551c09c87c6e6e69b7942f1178db84dd758fcb3f63d658e3f48c1a47b725cd2e003a59b8e318950a45fd908c6c4d53d706dfcc2041c046324e3925c9ca032f62cc825f0c11c9fff3fed99f616837244c7d71b3a8d79a8d5bba3284280b59ca1d0ed044801b7d4d6148f014c8c04e8859d9c3d074a7ad77b86ea0ae39fde03fb33eda53fe5c1728cf2daafd0001991691f21883d17fbf12b24e86f0f639967240dcf120c01713ad612ce32a7b8a9c911248414d8a2b836e82c827270f60f154d5de0efb7aec5b3db3f8b9cedbcda84aedea5fd0988ed0069871fda9db5ec2a1ba0f04592048f0040599023ac01e758886daa3fdd9190bb1c8ea29898cdc711e8e8e6c4497ae95ee2e5a6730bd8388d8fa812b21c9b97af84a7cc9f790139b0005dc86efe16436e63982fe8d8ca6bc5bea86b2297a0726dab7704fdcc8a3f6c273eb0f8aa008ad1e6c4a985d7cefe05d3b24cfd195d2fae5392a48be5bd50386244fa9002f95ce18efe97be356a3c5b3990172f812987d0fa10d7fdf9afcd20e165697e3e8f1fa564d1f03010f8f20d53cbea6789dd88800af410af54c3c346483fa085c6e02c088092372ce828e2afd0001f903226d53becf91fe3ee0e556a7ddd652e179dc3c2de5d7af38f380c9916791a37e149ec620429b47e5e0c016b898ee1dc45db857c93a718daeab3167c3c336b22692da51bbf7ef1bc42cba25af0b1fa89df2adcf41535803ad6e80ff1e1f57c80514f1d091040aec55e87c4810ea31ba22e4f93a101d71e324cfb2d84e381f1a59a601ea97907013e119a24a468b27558b68de170690e71bc3c2d7361ca7f77d116b642516d9cb128a70d6bfba83b2c22420059e8c22c9f794f2e144a3a065c942d3276253013efaa88a80e3d7f3c32dc249347a6df656df62d4f9482cc8470bd1bebda925d47c5cd9a54ce81d7bda23c2d0434a98a1f73911c6172facb08a21cb1b1935a2667416f5cb810c787fac55fe8e14146721452870f27b1d5a14fcce0021600ca51450ca3b29e9ff6b388f4df5286db585d027f68fbbd1d4a95fd756318700fd0001b941fa0b95cbce10d49d29c80ac6c45bb624fbcef94b9bcc75d3593a5e11ed85488b6332f9d059e0123d5df6486dd2f57a9239d137d46f3b9c0120d391d1f06cd48c13a0b847020d0832b15162461811662eadcaa2757e2b6b2240d478e7411c7e807e09ef824ecfb3681b49aa72a3319dd310d8efd930ffa7751a222e73f198032f2dfa00e978c9542dc476ca44b161fe470a5f63759de5086a18fc92aa375c608841c6ea41ebc6fb86dea22a8987f7d9abac948d5e67a173eee3b9b90c323c4f2624f53fcaaadd79427a36f560ce6cbd99872d8119acd2173935b0331217e33ceb4a0ef314e45c1a90ad06a46948a38a00feac8f58d8780e6d15ff6e013dbe214cc25d39b2def7e68e2d5c7afd69c5d629265f750b683dd660040dd3220a2ad600209901a1f845f602ecd4f341e7b68c6787561b4f18d7819c8b319dba6836a42517216578b022ea0911e03a47f0814046cea045fa63bb506730b0b491614417df91f900fd0001ab0bc038363d54f8e9e8ebed6a498b0f989c8ee56c81720bd66f71d0d97477d0db56d4481cc0e57c2316f4bd3a6843f86e5b28152436ba23f377dac267c7bb6501666efefb705be623d0491dd42a1a5397f45b6be6ceb1e0499842914f56296a34f304320f5b623ae7e16379d89394b7057d1b92de4c913265ba231d81dbf9e4b586704803baf1cf0fd474a721bd65206df02888dd77df03c831f8433f3b2c7cf7e1211c7c85a975d129f33734fcf77c09aaf68b681da7c506e8c89ac5394589d185117b722b757e307ccf31e9ddc1b9131633bd684ad458fdef09d346566eb4df920801ec4ac019081feda518cafe1ff9f9197b1473ddb18d3349652db870e0fd00014168b6756041ac27a58e4160cdc78c2cca30e144cfac7c58d40b5521c76ae171399e4e22bd3eb5a59d0a44666cbd8d38c4983f8e2bac6fa5ee84c86adbf9679bf8631dec545667463df5fbfdd5ff2d0f6f9021a4a03510e291253bd133520d5366e3c272bf8ec41a14b15aea97c420ff263bb52dacb3c3962359312e5a4690483434ba5f592057dc449727f03768f3756c24c85814e1204d2d90cad6e656d39e7dd7b9c4bfcd103dac62415b0d64901b01278602553c149f6d64342f16757b5ca1033494395404fe1ac7ae33d796be12b0d4f986de23186ecdbdc8477a742fdc973b34b312f5984b74faa42f5f62dd4938f76f5d7ec141249902825d81ab2d88fd000193a2f7ea915b7e506459b8484c43d305deca93a84b3c313a6cea7286d485395158806c3d7f3155f3ddadbfc913cbd7673193a951b356ae208319ecf406172cfbbad940f9fb6accde0c73ea5a19037d5d8644b4de22db968851a303717f473c491465712da34aba4e5dbc31361163ae1492bb3435779569598639943640b6e14233d8888aefa72580e22091b6848592d5b2273cd2df009d614da03d0c0803b4320800094dcbaaa337fd210820e07a8deabbd595d2b59b3bee5c7a27e585a1cef44e532de83f08f3df43d68f5934ca69776b8ee8ddc42969970d64145c093d4e989cf32ba71f750cd03b5c818c33462d05c6477ec1f0ec81c48e4b119d05d31cd5fd00010b1cbcbad09df7edcebe79a913033895c66686f078402893059e4a986fb76d28e89324f5b04ead2c2aa0a05786faa1e8f66fbaf66b7ca94bf52123e6afe4dab54bc33e5860e8766031dd256edf40b294f55062e613cafac04f77e284f5097e88cd7aaf46fd28f4fc24ef1ec1aa0bebbb3da5b504e4dca8dfc13ed99e4371dea6f3bc0f78cdf6ff47548e5a426c92095da045e5ccf45f446116e2c9567ed01d62c1fd3a78c62aa359118f77705174db6a4faacaa0b6d49b4da38e42b20e9cd2ed7979a0f6da28964e0b3fb755046f0a5477dda7465e00d13c8751c36255b7f922dbfe108a14e359257ad607dd7e1c9ccf330779135714b01746a25ddd11e565c821713c8702e50956f6f6ed9c283cfdd08938c8ccf08ada04309e47fe9ddf5cf5dc00fd0001f5e2772a310c56c1343104f8f618a6408dbdd5e421e31856f271fb33329d5055c4c73e06870feb8f7b298cb9b403dd6c4e87dd2137ac84df583c58ffd627b0c52996bea39da5959ccce7968455d3b4ac512c3d552cf63f2da74d6de8e8f037eca47a715d0d9398502b287e5f1034e536a84839bac21ae9958da81fe54c67165fc650f19679c9a628b74fb40c65257dc5b50f690263f9c1eaf41c3365c0e23f91aa7ade32a352c8b88b40b2d7acabbd085185f7737be6f5a7c342e2c908e8a4f997ec949e4bfd6ca7b3da894fd4581c81141cbfc01afc3eb86bc91c304c18c1dccde49d8b61e41d922fcb02162e444dd4931a076bb072ee3a6d5cebbe8683e992fd0001197c654987867c3fa8c71ce3718a70756063be0179e55bf302daafbbdfdd5669ec38e140e3204b260b1d54373f84657101147e672120d735c179fe2dc5fdf7dbb8aadee63b867e31d9d1242e45bd23ed510dc7a6d44ea7806159895a2293c0898bfa6d0018d9864f584a59003a8d4e3a38eae3ec7c9e35d1e5985acd544547ccc1e31024f05bfd5dc07ccbf535b2e0a0a703548e355eb9d1acd8a59684ba0fb674075011c7be7cc899c30ea6c1df0dc34c9366f47743aa12991192cc836db7fd5a3b0306d6905a82e13b729038c70fd3bea01def02b93cd2e71439a9fdd5fb93da6a72436ce9f5b431b7e18c76d8173964d5a02e24195e761d888a6a2532d785fd000177fcd4e94194a3c34efea9f8f04faccbdeae9f0eb8662b0195db08e2b41a08fed52ab7060465ecebdb2eeed7a768c4f65ed7b5193151a56c752cdf97cd4c6be8daf95c16c6703ec95b6cb541506c715983be6384031685d48190e611ddbded6fa377affb759a1f289523e56761857afb3c33b68f743c59a6bf2098a2f5bf3c1c8a3d41224dd12ef247874ff5ab6257cc3e29a65a1c16f3ecc26108142d1899a340be3db55556258a348f51ef61e8e73fa9db743f08df3d31919f2d9484603f0281422c2cfbd66959dc138c2176d6e242a5a04d5b1cbd8c39ed051486869f8b0f3ecdaf42498be6016dc9d49ae52220612a32f50259fb9a8be0cab88deafd56b12024a02c37de6161be5eee8cf63c3b0d16d0bdca07ad59fa0532678b864c13bc20c87f061046d5218e768801c69818dadd24e62aa4625d5a2af09b08f9eba8efb5e29fc2977184990fcd81a0a3f896691051da425d7b99292d8ad7a3bbae5ed9503c5b761907097dd6457a5444b9c85ccc829d5901d46cd917ead52a3316f96588a7b508501be9f69c73d97e0db9d615f20e50712f377663f6c47f42d005db72b225048abeb8d6e3a60afbe21cd13d4539b7d39806952d745a7c49a552175135d840a3f9b9e9ef6ba3c46e9f4bd42f9bbde0d5d5abda8cf06538d3492aa856d8708285c0aa99567adaf6e0d4b28feec0a55e49879ac8ee966e4520e5eeae3e6b4473cb710b4213973850ea6ff0331b04ccffab2c2c3f55ff28b8bdf644e4c19982916d01e28d745302b079066c61fc0e8e1c90931f122893f7f5eb86e9111f98cf36e719129668dcc4718c52d0c4c6a1a941b939e5e744d61aa9fb1aed6eca5fe062cd109b15abfc5851ff77c026e9ba7023b298d40acb1ae9884671ff1776aedabd859f2a481eb18b963afae2e2ec41e3f3671e9dfaeab234d6aaf97249f4702e706437d8e36f517b3b227bae68b79064a3fbe999bc2d75912d970826908dc17b815ec0f030e20b24f17c527557e36695abd05f67c60475a0c74aff42b5e7fd13efc3b1c3bf5ae6e3251731ffaad110c4210c9d6d78d69d6f68cc31ca99fe783a12fca506af01e28234f01e1b30dcdccdfbe696bd5703ddbf0554c8c4863edb0f252e2a9daa54d4900d8fd6aef61b8a8f1e165eea79a3f20663b08722762f2c548e0cd10cf0d2d8e8b9239b638d02c49749d55b721a6c81d2554b51b49191518150664b7e4dbde3ae02b36ab3ec9250290c8cee6b7371e0d3c7ad64d267cf463c4c82cc5a325aa72461345c4f45c8753de23bc148527b0e982511bed9e4bcd4cc37e1e3b5089373fcbfbef9a111c96cc79e9f37d619c0d68598541f2a37ea0fd614ca310c915c0d412d2eeee8f7d71e4a250bcc60d68ab3f296a5f75d75d627e5913aedf3646f733701218878049c420ce0089ded11b087f16111e397d0f2e354f1df0a858aaf07eeb8e80002210305cf1786fa950ae9b553390d6d62e2b285ebaeb978822439e0922403f9cc7dbc473045022100b807fa7bc196a7b2d7a3000e5e1870e2ff488bfd6e2850aeaefb3c606f28379e022009c3cec446550e5cb04483404a677c4b8406d85c62cb4d714e5ca3a50aa02f260028e8073a480a05174876e80010001a1976a914dbe6d470fa9fe4d037043533eff4f80aeef0c8d288ac222244524271336345713233515955416d48736f634336664452764a453753723548455a4000" + testTxPacked3 = "0a20b65181decb00e684fef238776a0a129db4e1ffdfc454f6ef323e5f7a8deae6a812e1ab0101000000010000000000000000000000000000000000000000000000000000000000000000fffffffffd8a55c2028655e8030000dc8ce67bfe1851477371a9ac40b6ae0cb8571f6e2d5285855288f6079f1ce7239ee8c85f465b1820058b79554f41af297e9caf95ce0084b7c35dea0b95e15a2fb9f8e62c5427c1c36120cbc1fc11ff344909079335209c6b84b45a9211cac960f64e9432ba5eb6e4ecb2068223dfe3d85b345da17bf374f9140c9577c148bcc431c9ec3c7d13bd2363dba821381ed9fa0614416261e88330b3e74c40e6561310eab3f26f092e72f3cab761f373d02680dfb52937bd9515be242f6573754f8f665523cce3bd606c8ad190954f8181577fd0efe7cc64b711d03774958df4a5211e44870302056557777951d7ff8c002161a6a59e979f05469cb31770bd484be6525625359979220eb7e9912e835065fb00fd000216aefbae3525166510814d1636b76b0d48ea3cd54a3a17b136a84340989d75f74ff952966830e4c0d59daa006d5a7190978270ee9475a0778afaf002cdce7efdbfad630f72838b5c4a3b538ba61b94bbd9e353437a50725af5f16fbcbf36bb34e7da54e5c24dfc90b545f95c973877bfadc2703ee10585a1fc1c97d7377bf41c9cbcd5a313849a3c826e7c1301083694e6dc05f46899a901ab4a8d7f6b3600df280157fbef6eca4c28fc610957a42a9acf7c4d7f9846ab6b9b04fa6abb5fefc168d45f10078b97d4d6a39638588a1c19e1bfc472657861a902c2d52cd32fb0463746f649ae88bc0602dbf35816fbccf91dc249be809160cbc7f8b6702d6cc5b81fdebd283231f40758afc899f6fecedc51dc4e5d09cb8961092220541f75ddad45680ea92b4ee78c29f58c197a68420bbb25b450c72d02d7249f7facf9927378620eb36fbf9b4ccbcb55627eb9cf905b4a4c65fcb77a537f642f10901b6e94afa37e4afb0d6d91194454a9c2dd8ef8fe4316f8594c7822a7d58cab09657cf501da5be5a44f947bb957b71e4291a7fc60cd5cef9f0676f7c89123c7ff1ae2e6dc001b6f19785534e207fed2bade8597541b13714284f67d6986bc616ef1b0adbe415242fee85acbf482a6a48b3f142ef7ddb5dd1c97a4b0c53c6ac7aceb8c042d9c9ada1bc986b8c276d07fbf8512a3dae6a357fc02b167eb85000040e8693e45fd000200e23abd27b258f9827ed58545a507bd465e255e1156610da314bf7df68b6b55129df84c7b19e362751ebb9beba10790c9c26c5ddc7f087258d81b006c0d2e92be0178bf5edf6e78e89f73cd97746afbb2551dbc97eafe32ae62e7f9ebcd14ad69faf74d2011d16f2c50775f4f499c87c3c50d9d5d486394c2a7f462675d2a4885493332e0610a78fc0c8b08eda42e4bfe93b8c7f80a911a7992a1deb7cca2e40933e1559815688d4e5ae5e58d706bc513e5108449a8393928b5b77ae73cb03fe212c6375b6c5e61fce9db16360a147e7f7fcd49e05a99711d4d5799be77f7e39d9d1397388d6680d4931b48798ce013256a586781ba80168bae63bed4d150b64a73f7d0ab0c9ebb42f5d4db40eeee303783249af4bbf334c660f8c084ed9a2e5fff8be230940a4a08b59418676ef005192365e4e67757288791ce4992b903a31537596cf6dad0be2af2418a6b9cc2c33e99d874168f6a29df189a869b16eb5d24400ab30e4eca9274114d646aaaa8bad45832b6c0ded2bfa698939a8af9d0af380d2afc58966afe0f45483ecad0f114b904cc2fafcf470dd4fb8f193795e8afc3243b4c946d5eac82babac6feaf4ff10bf53acdf8347fb9fb7a5ac4efcf160f0a7ef3576f439404a3078ea092f46f408a955c965344023d847fad7374cf145cadbc8348eeb2c5aa999ebeeb8a5548bb14e0092b184caee354020c19d66cb213fd0002729bdb186c4c494e17fd6effe29cbe7fbc539caca738d54f9ffc6e52a35a27da134192e2f7f4ee2a86af281b78670e662677e97a1ef008f10f42349fa83bf7841d88b1a457d38164a383ae9c6b974137d58216f22d135d30b9d6e7a74952a7e905f385141f4df088415d704cc3b03b2cd600cb5507f8ea1b53fc0e73031a3946c0d6269f020c9c26a3be3bfdcd37f8d3b9fd42538ebd72029fa0bd8eb57a4fe6769e1b43b5d5d7be311e12e52ee9dad67aa988dedc80ad616d7540381993d9de91a7fac6d08e4414254b9d1d72940fec032833a6b1a5605f4b62c47a86d70dbec5ec913d0a613d438cad385fedf24566bf79edd17238e55421520b95772224623f145100e663b2ba20161784f688afcf07a900ade1d48060d21be9ba9297697891c2584cb99a44868efbdf65178592ecfbadc92f4883662d6b21b7f266eb21815c7401b8e7da061e3258dd685f8cf65f2c2e407c913f85d053b05f6f92ed1299186632ddcf175ccbbc933044bdac5e10916917dea1146f77a8ba4b4fc8ce260b5deed395ecae9b81baa6b385fecca5d2982041c131ce02a1dec517ad2d459434aa3a514e7a4c6c1362401b1ab62b4c89bd7705d5072e0be5250c60c2fdd946bc73050d3b8bcfaa73165eee3660063f279e824d1e15f87307a40bc9e1ccc0f7d7087ba84fe9275742455241b61d3687d23eb9d7a9cc18072ed8be1492db46a454464090750eb0a393499a73d23f4c552ec6ae425a77f97d4285a7f287066b2198bfaa99073da6f4009755e59838e48cd5fe692962b87da3ea7e14b34b352fb2a4673eaaaa594a094610bd0cc566acafc21891b7b0c2470bbb338f579231e01c064f275c5ac9c2748cc50e7f2e36f2768d2a59c22d14b6b9a431f7772e716731c55ccbf086187fb15bd07a5af3040d468d4088ba9e6383f1df6dead9384758f2da81ee96370d9055ce5a0db56bbdccb57ab490f42a01e083b61c5157b3c00e2011dda865c7294cdfd2be5c03a1a36a4deda9cf03b500fd0101b3c97046a717a2f38fe2265185f4411cc68cce6cf9885a7a8fe6292eb9e3eca69fb6249774a8c82b888d22d5fcdd549846c3ebcf054c6bf07aa4d6b1c0d4d9bd8e16501f65373ceda249e9c760848fc86ea92fae7142d211c8bb4a287c91eb08cef7678ef1f445f76f81d464eb1d29ce5c6d6286d73d49cd0ef03b65376eb146a3ff69a487ec90b53c11cce613a586f22cd56fd34df6f7ad64fa3c68a6ae5c9dad99d4a3d2b0974ea1f627be4f0153c7b5fe472d0c562556c4d8d1c7c592bea45bb7886b74f8639f9487b2f6aebf4848b5718f2ce65b8f5a4efcf140e2857bc9c503f0058f9b6af16e75f2d530fbba8979f81569e6cc0bc04a54e30de4e03a9300fd00019b881d73a78b86771d41c0c2a9ebdb3899727f33d2d4d81dd27b6a00b4c7db265999b8442800750abde7cd97be0c691ed06b5d40da115546d90d4803e82c61d43eb5e2bc684adcf180be47660870921fdedb2ce43f33564541fc0debe175c6c49bdfb51378902dc709594b9b7d34d0af70b67c3c608aeb5185e78c1c39cc3080b71a36115f623a07a4e1a3e1f3e17b6f9f695f1a1acd9dd1319d0a0d67b337e64f720e5168c09196244bc71b083f302e042be19b6aa1f8ad61755f4883c3a1ae615252b884ca3cca5e18a023ad6725f08f9e0ffd60e7a73ccd29afc910d60dc99c06f5953c3e398ef615fca45f6a83f8a0be653d31a7e1a1666cc7334d9cad51fd00016f7efa38c8f9f478a6ea1217d8be9b7f0b01c5d1fa483c26e403eb3a4875aeebbd0e7eb8aab8472a5bd80e8be38df13526042952f813b71f8aeb4a2281bfe5e5d9ba70f7e4c9f477706da922899f505dd172e260ce5f008b59c0590d498ac50810e9a38d35f1a2ea4e9ce8f77e46d0b5604dbf94629cfb8b65453a0295eeca9d992365309b7956481a8c5080510a09183bd3358fb26933e15c83fe2ca6d186e631d72889a09464f5dafdc8a93dd100329071e52beb522bef1af0fbae0516ad3b02011e19a2b2924791b3f22679b78039c8356c0e6676e2451487f056d0cff064f55a992afba08f59af7606a809394772ff85c4c40673dd54eb30020c6a5cde3cfd0001ecbc47845e4a1f3c05c4e9d0a47e5e8996326f48d7ee1bd0e432c5f33fecf8a94feaf03f2da65525bbcb119c7928456c28f31c183a21af1acfcd9615669cf47a077f861f694bfc1831f1a71ab66540906c62b85274f63abcc53a37e3fccdc8563ca2153818b6b796473848d765d1c81d4e6f78ef8fce804184e04664c5c6af7c3abe4d92aac3f6ea99b84a3e53a7bf7679c26dc96804ac9e1443b054e3c55fe89315106a14646d06b84122861ac0ac27fe64fbee3c9807b0264a90eb9602187f4df2cc0c62b025ba70bbb30a7e43d533f32546d2e6f97537bc2d623a7f545676a37cb511614037d77fe21a35ce4a2275e7ea1d85b7bc19e477c61033f5effe7fa5d8ff48e2873845157b7a29718e6692704a9d864301fa254798555172c6277cce4ed5aebdff9c27a1bb37071677c16da15d6c1547c5b708e1988eba68befff1f1743342ad7cb89ec8731b567198953d965ef6e395d38b410a326ef3e262937c763179f22a076d17f848dc4e36be38d838d5788f121d771f23209a0d50fb3d016c5cbc47cec31069f7d22bd78691662d8b609932b9533bf828e213e5ed4e61f2b80f05acbc00fda0017bdc59c8a6a23d261cdf1dd10e91523503c3375a803755c29b6a84bac626708b7db937ed39f4053b5c6376b3988fc9388cc64dc07466c67704a32b703d5dd86d8fb8597cc2ff7ca190044c66638028855f29fdf2a0943c64125e3ad2487de6928bc34088957eb32d843613e6b588a91cbfd8c37c24ba655739cefdb203bc3061ff93498160c7e949823b0947c68b6c51dcdf038c538f50413266680ee23817ed9cb840e0094f6fd2277012aa2c6f82b086242e6332a4e00bb9c12c153dfea9340e681e63d72551f8830b2bb2587e5937685252928894bf90bfa174f62bf7ccd43415a094bb4142fcfe639c62f6eda0e4d7ee033f49f51eaa6a35b0f7f400992d8367a275e9d018a547430083c41a35ef543bb92e159efad39c5b84d127bc68dd581c308afd5f81654ffcdb3317dd6e21d5251916214e873c83b6ac197dbac6c1b93d79b9dd5da090be204b9765fdcf662c9296295610e42a0570a1503dd67c44e17936946f3a6ce61f82b13cf00a0b47d06f2cd28651b6af32ffc58304593d5ce81159ccc952ed980f93182fb468ebccadae4dab4565d64a5bcb3aec7a09d681fd24016a4905a3a143e4d61b16898fddbb0f9d7602ce865716b62ae4f9a37e2f6ab89de930e066db6f4a8667ccc4e79e7ac760642c33e5f24266540c9b4fbadda4c0aa1b6a74d02bdf2324ebf9598d8ba918438de1e3343be0b057925bdd52304581ef621fd085dc55cf8b45d605cb0b60047bfa935c2968d554753a615e75f24086b4e40508ecdeb411ed26c007a1110f3e73f504d7fdefb275cbb59cf9cd68bf4784b8845467fac90275f3bbcc2c14a87fbbd7d111441d6ba0833b9045db43975317aee170242b291f8b07254d395472bd4b67db7576bcf2460bf0c182f745a6cbbec3f680b7c6e0a85308bc3af8af3302355757a77a2fe3f98350e4ea1b3074e37a638c630d529141843583ba4b802e089e0a7ecaeeeb42079e072e64fa5251782cbc67ba9d46e4c7f502d44a06e5212d09f4dc5bef1f1dfc376d4a042f608b860971c44caeb3735cd57e19401314af06a73180918af7693ec5204b3f858806e6919af05a1a8c6daea2ee3f08fd2401c082f09f7042a7a0b6b484287050a15f5d8c1011c200d42eb51aff5a484fe1de9feaa264ed3022b6f5b1b54a4a316d3d7e2635210ad83e2d3c497bed46f417ed22804682529b034925dc785a2d74361d1db395d1681d71bc1b0635908ec3e92f850577f35912fe5c173402e6e2ed8003c64a57bb65a2013014a3ce14ccc725f733a50457a696396cac0a551cdda03a2ec81597031feaddd801a9bceaeb5f862a4cdb3eda06dc317a96b29c27d78dd977cc6f25d62bb967814fd1d7e87c675042522c904fadf1cff80289374de8f98df511de975011d877058aa7ea9cdf186ccfa5cfa5258e581ee7ee73e16dcfaa82f079a16c95e6ca4f49c037b2423c12006b549a0b80c5dc9b93685fd2a4bda99e5aea74eafe9d28149e94adc538198d459c7a9a45a1fd24011c69aaa26aa94954fb7dfae2d63eac286b4979e7d513eac8144a7bccc34fb298b7c556a82e7450bf590f1ae658c474ac7c12b3fccaec877b6bdd11fd9655a27b7b69b922b1629a24a8d7f81a6827dd22cbab62d121f5cf96d59be904022360c5bf04d2435c52541ea4d7f932e19fc471a0afb38f2e84668d974c57c963346d790a670a699ff53b5557def1ce9650a8624bb2065f9ce99d6b5361a1b39629040fc897a5d0a07816618840f86601508e90198de64d7091a8bda406009948fa9ebbf2f56adc66e057ab23152504438062867c4237ce2b99c020add16bf66a0c06a072c4fabd9b9fd1146b73366535d934328188798ccc18ad37d30e06a39b8e14468d32820d912359323b7d474dbf507e894a448a4e921f70d1fb4d4ac03b178ae157814004fda0015c202cbc492bde212955236761fcad7de9ec8932946b5352f6c35a242d39b354a1f96a706bcb84174a5b11a7e51cf0adeec9c1e5c88a3f8f32ca81977db668650734398e6feb45cbe0ed5c5d8f77cfa67b78f8c7c856629e6731321126d12ebe70603fe28d4281f5c9165e60749bc8688d7ff3cd509d958dcd1ac7b068a3548af0a3e20b984bf4406a6c6d55c674bc83240757e3a0515bbb626b6b6b863fa7029c5043d67ebcd531601d39b8b6b7e507a176216a264fb80f574d7a6a587d5ebba7c355007630fc49127368f6b672bd12fba956db75f189bd438f5034badc04d396b04a021608a7888434eefffd082efb0c3196698d1b015b42eb6f5a2123c085d37841c0cd6c7a1d77c55d61d76426758cdadcad3d7b1037b5d94c29962d4fe218c9f98c89ecdd9a50a48bc534bc167d536e11906bf594876aea01683269255701b705ac454b250abd45d10f4f8b881c6f4a360014b450132d750099100e15c70ef65ab0eeea340604f3c7b3eb3c51292036a6cc2843989ea418631fb595ca9d7e23a88a3a7d0a8dd5ec1212fc786dcf7107214d5c4d3f2cffffe2b1fbef09816033fdb616b9318b80b32f045ec1bec678dd1500480154ccdd87365d602f0126b57015784abee6fdb9b7f22ba135cb882dfa738baa17233fa53c68d35e4102f185c07a1310b710ff2d63db7238d36487ab504e64e239d0641137cd75cb282e831621f101663efb2f9de2520049c0d08a7c965477fef9d575ba31e101faaea20f96e40046132cd3aa981e8f360cb6a9bac68844d07c7d1741e56b104f634fa1a0c31d64ca4526de4f1754effc40aa04b9dfdb6f53ef77540d66fc9d0a4058fb46518433a1467a71873a03600b47c81e0d452cc44728e3a625235c84f7f62d753faf91fdfa1aea056925168616516e5c4357a7e82c94127fe8a4626c868bb7bcc13a0422e15e31c82935a4e1b9cac496bb456d1318e2e3e704627f1dbe646f5f1590283833193cb03f28e00f5020fbd43c5fdc39fd35498cf4fb7471417e814974331500d8e4ec8af34af39b457d20843d897d0e015456600325ef702c1bdfa7bbb3f2e7a74dcd8fd77beb3df4022320108d0f48a7a9b2a32e1587eb01094e20cb7c002d3de08f481a1d7cdc6b3f9c7c20185bc7ee65a12aa6003a58b83aa90d90baef64c7d324c662ea5138fbb4bd063720f8f9111e20def54a90755537e44fd506737cf1fcc4d0b320bef16eedbd750f8b2002e3af2f477e9d2912e50e4f03e43742c19e6e94c1ccf84ab04f0eff342bfc1020a544d7e745fa08a740418aa6da398bf10870a860427dcdbb857b6b41cec8e1342059eabb84637e61530039918cca60b860ef24c0df9e586b7ee9ce89336d5f1f7a210f0385ce2ad9f83a8534ab0325a42495a9cc4cd4774c9e8910bbf4e7192c2e98001fc3aae0957bc822f2aca9be874e1493a0dbad2ceaf959996060a2bc1781c23520cd178b0cfdcaa92929b9daef0c4dc752225792454327bc351b63765208972820203954fb6c5f5fa020f757c1bac415fec7e1bad3b7c19a93ba5ba53dc12f5ffc6720e7572f4709fdb74cdf2dbbf50a7bec9c10ee302cc2c5dd878bd109d1c87bfe3e20883ea4bb25deffe4bed0029e066230311cd71a4beafa608d43d615652cf9c146204c98a01cfce1f0ab321105b2f2659d375f691e2f6cd9eb821adc512718acdd6120d5f64f7950ad04508b36baeadb52228ed3a1139512125834c1f449b2a9613d67204550d2bb9a9333d567b6c2ab154f1fb4bde51d4b5c50307989ed07100095485720109b0b89090c8a2fb0c51f3f9ca1eab0e36b4d9200396e7958523e57b705d11b209195a60cb9f034fced26b3336b0c49872fa13d56cc410f59463e4f312c93423d20f52bbd6ff9d724752b5ecdb148a47e86c1378111d76e77a2f4434816e325c62920510cf87382f2a4c1417203c4e17511170ac616fca2caa49b521dd721a8183f1120ee7ab5b0de3332ec1fb81c2d5baaf0509eda6de26147b081866c2a9aaa3435882011ce790ec01637ff533a68dfd8fa22733bd7e4fefe18a5796e9bfaf996adf54b20509ea869f679c1ae8b074619487fedad28874cf9c93d01003e9dd0df2f45b66b20380577ba031eb78adb2c71bedc8154056b157ae0d01203c19d7df420a424f71521d04f8ed62e7175b7e70d7f92dafff586e5a60be02901f9f67e97374bcecfe7830020c6be51acd068843922b23415a1c7b39f4846da7584a496483a36612dc295968c204e43611bdc897913427fae390deb145024077c5808238d960f93c62a62f70e6520e2f6ace6ca1e8b6b73dc2fc3c43f3d1e740f1c663e3e0ff9415b2d282e1d377420bf6b145630d553e8c6e40d84626f01964e3d6befc33ac284263ee2c35d76003721a9d895ebe788be0a6988027ae6b33a26bee33016d8f4b64255f320d34deba4900020c8bbe181b5482c9352b9d607eed48dde4a2759d765bc2da53cbc1c03d68da30a20818a0a41e03fcaf75f38766bfa81738f0c8ec2fabed7142e998e7b55e014300120b61bcde758db04bc126bc67a1c87b9fb4f8eb2c3958b9e4106306508e2b22c5220cec0548ab3977bd4bbc802483f0c2ce3b1d6dae43bc0f8c79167e4a76ee6f7522007f74fab71a89f6b94bdc8b5128de93ef2be214d04fbb8ac8c2832e1f2ea6371213c26fe406e69b2060b60c6d0eb7759fe85f19cb2288344239f2a398f04b2b8900020689efa2cc2baa15ce24852b1f71d08200fb1f2ab8e10be0c4db8c8263a85032220b1f2737db4e6e55370ce004319e7c5e137f3567bc4d5603e4ed1f5c636db6a6b206dc3dc994eb2ed126f1a76892117b18b24028dce73ab6d35924ec69df9bc361121fb6e92175d959528d8326cafddb4ee94fb9ffc2d9c8a413898f14cec99d4299a0020349eb2d5c10d69df3bfc41f99d6cafff21ce69323637565e1cefa60173ad0d78201818225053a5e2d51745c5002281935d4dca8ad82ff76c5ca2dee6be84fb767021e8d31f169295ce6052584692ed9e4da87e637ca0b52455f216d5036c55d45c85002100c51c6bcf08c0a3926b2be93b47d0ed8955386d369ab8d6849957efb23904a20020b4b64e35cfcbde2461db3ce57292361aa30d136b0e7bbc766f4aa3ab4a72b66821e802f9eb8168e002b64b2b7ccdaba46e73e5c422dda18311788b19eec7af5782002062e41e97d6c8f4c6ac4c0f978f6f8488c92a51eb5793ad109abee4d6c009256920009f7f1755459578897b027bc2b282466aa1d3b9b0983fe4cdf51c9090548d5120760bc9a32ab7facf7f3c1d1aea1b6cab28bb65276e269472cb24ded949256c0121ea8ed0306eb39aeefdd4f57e98d25cef9ee6288a915cc96207ddff402bc2fe81002138caf88bb834204209e39e6c9430ceda0294f1253f8be81917370a34eb28149200203aa2e1582961cbf9b22333ed51aa4512dddeb3cef2e4fdc3644dfa5145366618203a0ac51cf2e1a98ea343e9ca5fbead275516bc20e9bc421e967be939026677682164c2810712d79c82e75116a7e173af1208478e8ab6763c7ee58551b4f323f78200209943e959b9228e61e5def9b2ea18de1688565a2c49dd98f1c0a7d43e81a6800820c4ab26007fa076e1ecd22f104a860f10b22b1ce2ad1229eaa2cf204815f7246e204090f4ac3d42b2793d83aa79103e0d0488ae1297109a6f47bcb29d8c8b6d383d2058ceed8e9f61bca997b4fef220feba451f5401ff7186d1348aab81d7951b5e1d2014994a638981db8c53c2a364c744009050975bfc23fe7bcfc5c8c36b3df0bc2120e26863332f579b931156f0559025f7f96a4d72a9fd108fbfd5c29a71b13df72520e84680238c100c359efc6bfbb7e97d3ddd4d1d24ef3fe8a5208a714580e9aa552108c2aed76de2cc32cfd4d0fa02eea4be069e74da620ba09461e63b5127cf9d8e0020626acd1bbc9c821f30e5ad5b682272cc4b87a9e05323357a367e170ebdae283c20ff8a87793a1dd9996598d50333ace7856916b2add797fb4cd7cb7fdf24245a642165e43a1aa272317475fddbb370cb547766ee44842ab25d83cef370304213eb8b002121565e2ca6c09a263cfcd17fed20fb6aa06e1e798276a5f0ca8cc16dfc5c309600203e8034276a6f2379f8374e8fbc709a692b2dfdf271c0726c4f890282a40eec2920fa335f7d0543267026ecca4424d15cd07755568dc93c6557f850031098fa55572036cea7284ab1abcbe3c7a83ea779392fec2fd8c1524f95c5bb481c67e300600521444c7d18c458aa1e62e5efc656b27d6396c2fc9299befe67e3eef807711f948c0020829cf5a6319d4467027f9057dfa46e1de952a01233e068f7fd18cdadf9a3534820b622a3b592686cde240a056840080c5116582bf166f4655ace84b34145a78b0520fddc9480245d4ac36034ada99a182ada449373ea0fe16557c3c6d9d55b21942720e59aec0bc8b52c1ea0179ef1bece2bf3275164c8b14ef9528a1335dbe13def6620af95305f745778a84f8405956a82816f366957d31e74af5509ff0b7f7dee737221424e7838cbff036afc7e59ba67c6add560e242a1772ff069a31e5e320c08428e0020f4855f5217b4a20c250b75c69d494ec450321911f9d7841e489d43b3739eca792010f35a5fc740eccaa7fa007f33b028089dbb8bf539f560df19627d5bdba6fe3f213c35de64e6b2d64bdb6ba246a5c9b6a91047e35240db65c383a1be9210b7838c0050fd000184213201216f3c4d446f38e3733348efdc4a4dfd79febf41f03567e0ec2b5a8acb93639951dc506d8649ca6d1926a25b4f19549d2b3700cff07c100c47c456ae23df2e60e27f8822c427e2de12038e00293de92621bc4a27d104803e48d076e3ffcf8c31f549fe9f95c6b9233be396cbd3c557efdfca11fdd91397e52f35d6b3a2130fd46ae505dc66bc987d8e93689d41be09a1df024af243b843e18f298de218ab87e557c782bd20648dc4fd4a5e654f1e9fa59626663adb179f51fec2f5534f2f4929ceaccd34d6928ca3d42fcc5efa32490428abc3296147147eabffda85ec2be06be4512448aabe1829d0219902fe1e9cd2bef29a8f89ed8eb1966b89bffd00015e46cc825850532b9bd9d584441772b3963c554af1424ffa9ccc7d7de55dbef9456a3fbf7b4be985d185eb898e166ba646daa12cca359ea77bb7a59e45e8a6cf2708c16b5ccacb708839eef2ee4b5b6597ba3c5899c9f5214bdace3a521fe36cd39b77952d1bcc81f9e5edfae34f1cce40369b7ee492701351d34e231af8a3768cc158a796e900d0cac462f5204da5cde3abcf561ad60f91fc8951e4fb37166ce37261649f840aa51e6ff9be749d72f1f5b5ae3349f14d572860dcf36aa4655788b8cf5108dff7a4e231d2e2a3bec0a159a1e16c9bb38c4052439f2b6b1a62addf739772a1d51057c89751f7518a3b1cd7b37c4ff7d621a54bca5b3936b137c3fd0001b4a09bfe02e11668f8f6204cb9ffa9817ec412c820b6b394ce2cc3a12546ebc5052ec1c74876f3de8fa22e19158198cd04c1336a792ea47e63c2bf4e85dbe7460501606c97409a906dae4e7ad84517a7955793365ca4f49b5f6829efe61f52069fa19cb30ce0a74d415898e7e134ed8c4106cc9d6be32577e9a024b9dfd8129cb5efb1ef282802fe0066aa41e587ac9ee20d6416010e1b0772a44b6d6d1eb4ddb32b80b288952b26323bbec16614c227e4599cf721484443f56571c7b048e58fe48b1786c44e4979e105196eb9b5803795b8aa3d3e3a8f85e10abeb0f7b43b9a62dbd0905af620309ef74f281f39b241c4b4c109ca7e0ec55b13eef8ee0544c820b833fcfd65b4a897458cb9aa376c6bdccf1032e099598452130bd38d28096322fd0001b6c9b1d3d60a49cdf61f9031694f9f790a4e0118ae39cce789df472c13bba207d101410af89ba4b2a88cff5eb09e53593bfdc69a4e2706633a45c77a6d8f4baff22c7e5e6b32278dbfe97100271b1fd1e64463fa6a757c4cf4b19954d1d363494664750fcde0f0b6e35f9e0f08f4fb1e438669f78b10e800943840b15541a31c3090437364159681974adba314bcac37e6cb3ec97c3d8e0cd52241a4c162787c199a256599b97e488b8a75a46d2c3d8af1951ddac43b0d338e739deed1ba26a8616f04d124244f365573b602697aab0b427a8f26f1a22de77c563cda13fc03a030817a837c497732c6108eac62102641176f62d5b8e73d0e27e17586d6e2c2c3fd0001ca7e381637425fa77d95f92b8b491ea1398f53d763a6ce32a2b2ff972ab74bd377723dde5302c487fcf7eac93b089457761ca341f143b7c5aeb51b33cf103f2f4ce4c282bc5bb8c7290c2a9dcc82fce3dcd9669f660872f602de46e869fccdd99c85c06d1d7bc9af4e93502e4ffc385b9641df8f21a25a14b8e4cf99cca023da529f8689d86418c37dbe3d4116e08069f3d08b9c952f4e2164dada9e62908d57cc68b264df8fcbfe449c21cae576adb8169a97294a6bbd369a58654cd182c8403080b3a5a916c107d7271311a291841f3e35e065d48f6023ec4118a3a88d417507ae86b6c74e6ced02c768e0f879844e22862c357a9fe22574e30c179e2243e62192455f24a5c214eba9746d2a8f6a47625b53e5e62bcecade179907fccb08e4b200218a8694fa7fa94c9c174c8e1525bb14dd946981e66b1c02178cde818615e3b6910021fca3cbe539842d405545a71cdacd7a795b6f6fd1c1095497ee8ee215d5cb8eca002039f76b8f7067cd9cf8bde783c8ea6edee7638113ec6729093749c2cc0c15d13c2091ecd1eb4b171326a6a26d764e72e09160ff2112e577149bc7c24e6c0907324421cdebc7f780b73aef4358c6f7e5c9a78ee95dce81c4c1bbbf570cde3c43ff5ca00021c6955241d2f09d2e90e33601fc139d0603919a1011ea7ee89f0e5d53727c45a3002037be468901ac92d7c3481ad63d364a93e2daa023bbcfaf4f6fa40cc54974de19209178cde568ebc660a7698cdd7f83d5932364eb8ac144e62cdc045a00ccda5201fd0001a3347a2cd4b1f5337653554be5fea273a5bf0292c0fd60908c6e699802079912372435166baf2f71b35ec0e00a714e9f7c10096d0f39a65f66f220057f369ce7c8221dddd00e90604f9de897ebf9f06afd41814b57350ca2d7ff7e08f60c94dc1aa087b7975936832a7050ae4a14b47b1986e70d61223cdc37dfeabc5e4212a869d953450202c9c12db23f8819faad59252173ac11c54020fd7324b4d39673befd2b585437affe9398e7967772d408c6db860ec512f94d02b0cbe9c9d414bb4be4b08c3a420a549efaedaa6f0aed7c74044785b611b2d65abfa33374748adb690a54c8719131e9dda9d46afc9dd09c8abc498d6de657920642d3d47a55f17fd3fd000189cc7f3247c6ede0becf1ec89f5d92142d25a713e037454409ccd146dc18c58319550275149342c690f00b1e060db34bf6ea34473c661ff9f32a40214a4715bbcea59a9ad6ff976e43b325135ca16377be53be39255f9e45ab4b3652d629a30500f9e37671d56952b215628ef42c1e49046476e9a760041003742751b158aa85c4e95f70e267d2631491c60cf09a174816890a2dcc2f8a38f296389c3ea66a6d577301297c242a6b9ca7465d8282f2e72e7673f9e1f1c8f470949c970854134de397c08c06d5d21fc487b2b9529c901c052e838a087f15b802d081e869cbb311efed66ba31c17c73cce1e0fc32d58d35e54bc5524776ee3f45d7b8f81fdad4d621b95f023b2202f5d7c814aa89c27b5e0bf5cd64b444c711c2e1c4b805af4fd58300208214f56ae87b268fd16d6df77efaa715fccd1fb1e6298c1c4f7a4f18d39c2f75fd00013fddc975fb72a66d5a7f3ba6df9c1ff55c7abb5a8f08317c6b346875e850223d87d72d71d9b17c11bdbe6eca34b521fe98dc8d31bef6fcfacec74e5c4a6c5f00ac769363df4720e17c3b687a42f29e8edbc20184dc9274d8546368e3fd2408bb68dd224b73a1487c10f4e29b0d8b9823f7c73db26ed16baa4c5d75b162cb5a97caff3cc8957072902538e0e698fad2e90b471777c5e8d90e5cd313933c2f3b30e49b6cf7ae7dcc09ab2e5e464601f093973d99c0815c3ea587d1803b4ca1d9bcc2ac20cb818f95d9239fbbe62c3356ba41f7dc9d2232f6221447fc4858bbf11ee382bfc639d9101943d958a59ff9b81007508c0879c4bf16885bcd6eb2383898fd00018ef6741f57def1a55a42b565ebe0451f0208762da626acaf0cbaac6d9bcec14e22c15660c2a0c5a23b27c445ad968a7e6b2daab11463040eb50799858b7a5063965f947234beb0d42fe1c2dc7bdce7fcda3de1bae384b62e798995eba4836dbee41a8a4de269c026018a22687ad77985d049bda1d39b79528b320ad3d22d893c547b4dc4acb57fac4e0603468beafdf54408ddb7d4c5db0cf14162d0d735b3fad10888f0048035481e5713b846761838504a36c1f956b072b46f11c7c6fc86c766c36fc7dfd5068855335b96162d8b299e3cd21060fed730310d7748c3d16f228b0eea1f37f5eee5453e3a19ebe1e60e4f2834d3338bf1887969de57ef02a1bbfd0001b50e09d8212707f0035a46513208bdba63a5d1fd7a7ea88e181d7a3de81b8afb4ea4b0428eff67c04b27372d73896fd9df443aa9b2a42cdb8665271bb1c54833454504dbc80645bc02366dc998d334b2723bbf5ee1e139265c107db84774b4884f26b57818d39d05b47d5bdab25778965a0627a96ec303c743ba57c0d32d0337a6d3dbe982284109eb0a7976221816cf3fa7f2e3cf739f30be83f253564af7f411358d9c5340fa5578120c48b617c088d9a3d0811a575bb1e96b746e25312ff6d87b9705c04a10123c7606b4c5d6658244121310ce3f1d062250b57ee51e35e0d7b787d38206fd9d26c70ef94f337cc7108ae8ffddf5fa314e6c4e5e1538fbb0fd000192fa78c12fea8a45902ac86e2878e8327b5f4c2ad9bec7d6167bc5590df49cbddda4d4d652f6f087f2ddc7a2813aa5b33048adc5f900eb4acd983bc86ea7b89f630b647a9ef42ab1bb6484ebc20989603144912ffd80158aff7e7d40a1a76489afb21f5f711ecc3ba613868a7aac4f28f2cd5440dfd064c4874d4e398a4718e10de8f7055e452271f01b27544af7035aed32259796962035d7bc37ef843cdccfacf969a1659e354ec27efda8756b09c0bf855f4fbf7598273154b3f517303b6169bdbe4ede890a90d3b34c917311027afeaca7dcd27158b04886dfd81803594292cdb3dbb77ad3a8df97df63095fd28c275b956cc61faddf770608b898d74ca9fd000138b1c34ee04d01368d9cd8ec4d70b97633951ada508c031470cb4cfb15a62426276c7442e7679f926e93325e287ab9ed87446c144be02e559dd076c9c5e1d6a6a7de45438076b1bd7b9ff5a821070877c1d9626925c1f47838e56bb6982b54fb9e131741bab5ea38aabbe4003538c454980dc3be9a436283edc32a3de0321f114ad32cf34e860ca36f18d476980910e564af57da498cd16d08af8b4d4696a9962adeb298d7af4c8c4ad9cb911d80a2115e833f0856833232f92f94cc9c3a6a14270f4c30ada671bacc9aa35bcd3c945dacbb01f4556ebac4e52adf8790dd49fa799584d227ab95afd2da9e67e5642a90e54fc8b693a07384577d04cc40861cc9fd00012c7977632367de82810aecc22a1a802a1aeb6ac54a4a79d8e61606a6eb72effe1abd74a0a18ef83709355e77cef5666f16d94c0d710f5ae3973bb26d07c0a436aebca4d156d42952cc8cedca94162225b5b4780cf47a6426757758957dcf2f638ead2312e67e140ee8c380949c0885c68b396517ba122d90a0ed184564bbe67bf1d0115c77857fbb29945ea00d8e809c295295494dc8cca091d900837b60b31a79bacfae59fe638ee8a2208942e27f605c452be3a4a43cf21e8e0f78e7cc20ffd2c546a0bbcc404b415e4eae2c7b9c2f9121bc741a6f8c5c28c9df3e0169cd86809f5e235ce17fb625f913f94b75b360f9097b625a5305040c55a4057dc4a68efd0001d594cafd37d880576656265ebb737602d6f3b9d0feb3147d8c1f6e1514ca64e3ee046bea5e6892d8db9c094198fb3f697ae6fc880075bbd461e9aab7425ac3a7fad84071b170739e7815d0c76d2ae7fefb718ec132b32a842c58cde33605488043aad9c5df6e58401994a38dc50779e348cd18582ca74aaadcce6df39b221d4235a88000eb2e3efed6744abd0b68836d56ff5d9ec973be549d52a195195725caf3b8cb683da9b96868d35727bf4b74dcbee838d9c39a33d15609fde1c2b345974a93c030952f52da7ac20b8c26b340fd9c08f56b97ccce21004af28ebe4946a91682f9738085cdd9a53e160346cfcf396cfb59465d114c600d9571634aa3c880fd00016c714ccc93e995491adb6718e9ef69fb2cc36044d9e6b73130606b9c845dfdc56e9518a120237f58fb6f2546bec6f47ea6a11f3d898baa47682fe3f537542fe9f6d3679398064a48a3ef8abc92e89eea84c6d8ca956b3c40e9b82b2a496bb1230f8789fc7b0befc061468049d416aca3fb41d4272304a728322684f9ca6125b91dea97bbbba8c83045b5ce8b3110d429d65998b3aed570ecfedd176e98a91eb3410cd501ba52d176bd2c8d05e94acc8f352b3cbe12adefb82d34e174765ef1197f8a93fd4e03c98967ddd0332733e5aa0ce87f63aff78a2b44d10ac63c1549d9a9c6808b743e6f785173924d736bc0890f2e68c1df72b0fb1632bd4679e87690fd0001e736a64f64d58af8d43f0980d29ba57dccea56ff13040270c926a2703401b83859a94d6cbf4cd62109053c9e6ddd1cc61ac649ebb1243037adec455891642de8f43b57afe96cb63736e3e7d735bbeec8d1dc2c698f37f0bcd85bd84cc6b7e25eab500c03f1c62ec730c24208e2df2830d32842277d9e5c9416a91217cbdad60d6a77a7127b09e7463354266a1130d1f04de9041f0f83d41246766027700fa9a02d10d2b0fcb0bd534d22ed38278ce177bbc1c429c09030f105a67db70011d3eb24754bbb31f8a6a98bde215f635409e4cb8c3d769efdd7f1561976bd29876c8a11a130cbb8e3fdf15fd9ad0329852dffd794f499345c3fee09eee21997a5c8a021b993d7cea74a8935b42df2d55606a8841b1a4a8fc0321701d5de9bce1dd1bee100fd00016e510cf2b787c67956990655ca7ba97aaea25163317e7ebfbcf2681b29b0b821aedb8f9b2e309d37f660ac7169dc8234a7e7e4d01e79164eb75f28d284c52ea3d7edff718aa96db6b0b6781366ab985d202823130ca53c2a8e5186fc18862348952e967b1a3e3636517c3e3c48d8fe5e4ef1d5e230ab584964c888c61393ee3d6e34c50446b86e68ebfd048ac86065f9a9c4bbfc2474027b612dcafbbb0416f12d3d856a96557529d1144a852ade77f50f600ecf3c0e00296576eb49a0b211baaa815cea78e1b7a56a1c698ff58488378722f58fdb1ab8bb0063654a8de8344041fddd04be1b4b2b1944ce9d1ebda667caf9ca00e5c2de892a9063a449edd8c1fd00017140014f19e2474e1cc4b40a5a8033f3ddfd960ef33c7e35432deabd85a5b2c18a27b85477c9e6fbb2d8a5e6c686078009b1f7868768fbb5f569ae3429fd64e49cb3a62f32fada09059982a03a20494bd2fd2caa75a01b3ecdbc32acbbd648905d56cd2aefc714af1c24bd6e8f06b1ddbb85e9882ddf8f0e67c654402bfe2e0d9ba404bb3da2d58305184949ce513b3784c3234b39d25e0c6df741683750cb46d7856e67a0d45f4839b5305f9965808d41cbcfb2ad3ad18cdba6744eab0148dd0c1d5e687b6e76bdb9408766b57297be6fdbcf9d7e3e6918c194ef32bb776b5ab85f3a6a164baf866d93ecc3acaefbac43a9fa267bc623cc136ad712b00d788efd00016d3db1d97d5d429249f5cd6dc35f61d0b1b44f1e433cd5e01d28afa6cd6718fc1432b77e8eb6418b0a4b6fcc6707cd3d5c6661cf57b3b73b78feae7c89e25eff2ec1d465be91a18b2f3bc4311919f410cfafe8ae8a06b4b947f9b6fd8ac17453c2f558dfd67f71829be66250d40c3aad6e3ff52d1c0c455e7a4f646445405cf1ad45ba65392bb622a770ab0f5a57e73d32d98ee49d73ac7dde7dad9b9c8e1da9d1e6aef0f9cd120bc1d2cbc5ad819190b758be385f2b0dd736184382af8aa419ac7d734881ab4728ea927b6655b7d3faa4a1e14caf6d38cc706a940bff9c9021e4b6c3ce516d0257deda35d2ac4e0423f01ac849b19b919b773a58f34a06c6b1fd0001464885fd950d292d5aaa6155164216521d2113d795d9aff389771e8f39ff3d96afb5e2359fc52aa6d6cbc3921a7a21e6f3fab62e748337e2cd212456e2b2f52dcb352a75902ac6fdcce93dcf027138be788aad5e09490bbce637751cfd5bda9ec540d7daa92eed7b27ff1bf66585fbe3b39db3de9dd386ecd7671f2395522c1c9006908afd04fe68d88194cbbc3216377cfc27c4fce55c8e558ebc4943cbb477a1172aa8b344c08d6fb853e64ff0f986b7f3e7cc3b2c3d8b2abbc43e08eff15787bfd6a9a8f98b207d8e2530c0c37a37ffcec2fecbd726b4b845ff48a44c1ec7031e4e663ec0042663ff81b9a7fe7d599695737511a685148fce0c3eb01513bb20ffe083f86d11f3c552efeba225a93eb8ea756f45c2e49a4dd08467b79a14000220fd4b0ae4d4c5a165ab75af08922366e89721ba7ee52751e0b3e64017787b9445fd0001d0a8ddbc130bbf7bcd20bdbc8728e812a45cdbe602dcea5826f753b94e1220cf698c1212464a17ed846b29db82b1cf5373241d4117b07a8b7d279d4e8511d22c47be22291e9ab56454becf533b771e5e602542d07828952d5ef900e2548739d57cbb6254c667bc50a0f97c11b7f3dc1624111f9d32cb0d85ac4106b41cd6d82db7aea1135334220163c190744b6daefa456f69c331facf9083af360db6f2a2c80c423357c8fd1bc28fcfd42db69d733efa9ecdff9df079bde1b73a63ee74e5af5c75b67a4824a72466e17b501f6057a68efc19627d115f19fbcb48c0e0889857f0d9191db5875ad6d336adfbf7f09989b2aecfe868c2efc2cc64af46d07c44b9fd000151620fcd4091a3d3e78e8a1f1b5ac9ae8bdd3760320ed9bea2e1b237110d7747e9894704336b958fc92eb200f06507cb56a12f202a8b098bcec5b7b6941dccc18d2bd968538185dbfdbb6ea61eaee22aa8ad24d73df0adfcfafaec181fda3626479710bc19835a5aa7a3b9afd8166b89f5aee8d52589059eda61f19f6319335dfac7765a9a9e22cce0fb3236eeba6ce250ea0b7cfc4a021ca3c88859f556dc1137349a7ad5a628bc47267ad91ff86174a2fe74e3ab298ae8917d6a57a916f00b16bc0f3584b12b0d63141a20b1ed54c6551c6dfa5647783dd9acc68ed75044faf6745161c1ee4abcd9969ff9e01f14791de7d0c8e44e77a5b249e2da833ad3bbfd000119884821e74482b639ec1f8484eb6199a01d6e0a3606e25527d7a9fdbdabaad9f378a9aab04a153b1003d520d03f25a9e41c82504ad6de9fa6cda30a3ee1128c35f49d469a79b3c190ab0fab92d9977478c7ddabb6a66f291b58756e040892f44ebf6c8d0ba3cdf5d9335c8b05b0d34a8f4e832c54979274f5d4554af2d05aec3d51a3cbe03282c9c104f664fc39863c3a23396e762a5a8b5ba18b3c84f0f49f8b7cb6f627905a4fec65e5ab41e868561dba5cc8bcaa8c201d613eb678342aaba5e5d44f7ad7a58810129aaea2e6bb9850ef022e54a50b18e5fbbb76b93f050c31d279e66cd51a29c42591b18db05e88283e52070e6eeffd8fa447bce2f22eb921b2e3f53f38bb201511b9e1d5bbf22bf9e23be137543e34d81a0b194f373dbaa600fd00010ef2d9c59966c760260612842d16526b4352a5f05de655fd0bf50546be1d893d90f4b8264488467880be2c4d7f3c577e6b68335f1e0764fdb16d6fc44fc5bc2c1660798e6b31bdcafbd33a9edb44e48dc37306abe9ea761cd2077e977a6d5b92aff3cdc33f644f47d90fa9a4b172faf29e264c9d55d27cc4e7b7e5e891adb566d172207406ac400348c386e74716a518cfde36169e4cbd8d3093c8d85b99e54474fb7c7ebec5a3beb18b664b953f4d9037041c45738e87c53d55eb92fe862a78627a8f4f3f8f3ef01102b8df05c9c1d81da85e36bff90943e0dd93efc00edbec664fe16f03c8e79d3e105803c50a606f9812d3717921477e224efc9c38604e932116d048938c5e50af925d722ada7f78de5fb1020ef09d45e001364d0ac87ea4b800fd00015a2d2be1965546e9ffe759719faf9960648c9183812a7db83a24b0ea52bc26e3774ac36fcef82756ad386332d49551a147e87ca68fedb289b965a4088b3de6506378af1f858c1c995313e189684bbd3e484499dd7a26097ee6e89ff1d0b6d4c6c03917c53a95d9fd1b6f9a8e59e1687506a5499adea9c1bbf2f63b14207daebf64c8bd5742bec97f6364560cb3d687f8a1ce12a197e87df8b23eff607c97849672fcd5803b43bc8b6dc2090d7b99299248007a3207621c0b40e6fcecc3f68b2888f5abc842a44e6f019391449a7356f9e2637c77612b342fe61e76b307ffb780f529c6c84a6e6ad8d7553021070499e85542cd288a543bb0d318b7abca62c48721047951dd48307113449db6a3f997999f421c62b4524e5baebffef1ed21a6a1a800fd0001c4594030b3c64f25c491e6a5ab25b959438c11265e0fb2e5b2c58e3d59c86d642aff89f4e5137f08ee4871df4098a5748795d596baeadd2db0b006e02822ae2c5f6a93c5281b82a7d60f8c390a264d293f1769d55a5b1f78f0f65f7694477ca79ec16677993d5b6606298171df85a7a8c9bc74a2438618d2aeb384de706b797758dd418b2b5d59dff089f7d4f7f21a8390a3a707c08ea4a238682670a0d80297ba68febea9c4c5afccc241d9f95aa77366880ccf891174b33d95f462839d2820451611e8453d981a703595e8fc73df0a4963c1baab591b7f3dbbbf62b50dc7bbfeb05ec2ecdb1a63d06ec20c4311451b4129a08b94049263e180411ce7b8b7b120a96a6184af4c9ac706b2fb01d6389d94cc4e3930925a5b2bdac9e96dbfa42a78fd0001cb6e8b1c0da834c4fc0d797fc3521eda3ddacade8a4ecfeb518a2e2e8a234d2f6901a7eb4d117404328c70a5c24f36236e88eb1dd19a7e9cf4ec7582f472da053e283dc193d70bc71867d2a348521a860fccebe0b45958f1b5919cb833d79802640b7665b7ec45135b24108eac8a882121b6e6734dcd327b506a434cea9298e6067c36457858e3c18d88a320ce33cc3861f5329bc1f9a8f4af57caf2c134051b12dbb58e309d7bfe9028c3b9b4179759095fa531cf20bdf18134c517ceddfb38b4d94849c3d7eae9b46c353bc43d2f8345e345f818e328875c1bdcd754b706258779c7c30592d0a4c4b5cb557eaad484d1cef2bd4d98d12e70b8fda33f3a5e8320486c47e0fc0d0e679b413041e800ed28ca862ceec23c1a937954131b960fdb3320a3e4a1a7ded3a425d38b144b090d9fb0aeb9ba631622041a702626583d41142520f6fded7e7b2408e70ac4ab0b4d23bc2571cfb9048b0bc738dfd0d6507549a451fd0001656bbe84db36e12bf3c78c07ba3f561d2c2687aaeeef2e2da17cb00f060e025a993c12551c12bd4d75c4c116d18951515f42c5628b0858d85b8afe5deb0aa14a2e33d147eb62b9a52bd4769b6a97382d6c39e5f70e727ee0c9a4684fcf9a03e7232394b4ecc6a2d32e27fe2b436b1081bcb4f3c8bc844e9cb1cf9b828bfc155a2467d506be2f89c9a36bfe2d19125fb21666ed4625cf881ffba75e67d209fde2742d5a46634019cf1f96c1e649a9dd58edbc374b9d6220bccf20055104e8ae8917537fd07f69e12e0b8200af3d924997ee33a7d1e9eb3ebba741f0edd1b59f05e1f279d0c4f7106276968fac8055088bd5f57840438a2776bb21693d9587d188fd00011ae402863053cdeb79711a4c4e7472a1559d86f89bc4daaa6865eced1126197f3c43d78ba16fb2d6508632ab4712b13c3f45d674064a51867bcba96a71b7683fa69ad337fd0c50e7927b913f025fcc47adddf1376a053280cd0fc45bbf29767b4555bbc4054a824c11dc93c3648b3e1c2ca42a5dc5f536eca084370ef65c5a6229bcac295c3fa578fc22eab793205cdc8d37fe3cbf7dc6e1a7c53ff3c7e4d226f0a0d4667bad282c625695d4a1ad88931ca894d4931b19b09c56d2f72e72f62600c97348ed8814f0841baea716d1e0d90f26f8c3932a1e66dd1e8c8e039d3e891ab7be0a887c16ea9fbf3dd7f2c7200587ef56cd0e75e8e828aedcef6198e6d6fd0001a265b258bad27b42d12a12e43a25bf566f2b77f6f0924e8e0c32f294768fd6d9f92e5a15dcc94a2067c71a1f9740700ee0e7f626d35fad2c441b176a077fe681515cb0c8613b0b43c708895c9ca5a41745ca87cc5e8d02e272a484be75cd9afc7478b98bd4c030c3dd4885c5214efbe70cf9a1f8a2616e2eadc150f979e1ca8c389b6fa288889464886bbdaee7539c6bba71ad0927e455d45db2c7371a5b15ccd8c7e7e91592e9bd057d85a18a9a9d1165a84329a6c7beab031f2819cf36a26aeaa4cbef4e7871c472b9b363a1a5d597005cb98e6828a7b6b7ae81cbd036f8d8afbc6289efacedbe51c10f27462c81525b18d119ab4527d9c6db52cde19cfdddfd000143a024d1136d92c3d0de09ce4a3837fff20ce4c4307fca87b1a09acdba6a1df122cc69dca4ec3ca89118ade730ec8959d0dd84db0eff5ab2ff71793af68a2d6bf3a301edce9cf1088046b3177c18d90f6318e2bea3a071469873d1a320d5036a6ea1375ce17113721f01852e1c436745536bba80365d2ee1060a73098f99983d18511059ecac21b84131d845bddfc589a1a4c195ee1d89ba9845c09d681a87c3fe2322cdf571b4a31756d2de38276b97ecef325f4ada73b747d78899c3f84aeec26fc9732ef5843f8b2d7af0fee0f04e01f85731eb9fde3f0a69c4c0aad09f51db5cd03db3627cce5d2a1dfe9910817efc2e53ebf9f79afaf09521a3f14980cd20d6c0a0d48152ef8efbf7a58b809f5c28186addc9690ba0857cbf2c96e395e92afd0001781c2002615bfb1b7d35b2e208a1df0bd8f95f2d639422c213683828227885660bb231058546848fd01763a1ae99e0a7a1040a0f398d8171b45ffc4a58a4439a5addbad802fe79c71a4a27fea8ed229c51d6cb26c3e21127aeccd2f0e31ff1c7d38987c95b917d4c86439a7a0d54b3985ccc3072727c654bea4d473676a45f13ac693de273581cd6f864fba7ff00f3e61cabfb689689c49849419ca1cf489cf9db2138f65c1445b74a0e0cc83e8368e6e79149e699b6e64c77c70ac5156bfa98794cd0c561732fc7e3623673e1f0ebc09de026d9745c4986d498762be6799cf99143fca5d69d04283b504c8d8e325c8811853d467b72e204417c7e35064ce7bcfd0001e42f7a528e3e1de18bdde6e2d9888886aea8ab8eb149299c32c68f6c93a19889efc05e641037687a091933cc83bfbdfac77d48a2828bac6b0625260d4b9da29b0d215d403c6d3aaaf33addeeac4d46875cbc4e3edc1a865d6fe0b6a588631188897cfd131672a8c5d098c0ff8ec5b17bcaecac1d78f83b5296408c994c1e81f93021da25ca403ab6694fb3e82ed260e88067e3edcd8cd0e70ce4c79b49962096eeb1eeb2b17be69033a338ebfadaaa1293f7fe17fb7ddce051d9eb82c84d639bab4a415353ae82dfed2996a26d184189ff1f25d3196c67f34ae50a39bdc2f711ed6468b364d1f0ea8eb29f486dc6c2f6dc59a24acf4772bd542557e9ef4b5b93fd00015ea90490404b84482136f214f4497c09a0ca87dcebecc03ac3152ae1c3e87b945f721137c7a309e1036d0e5d94c6cce38c36b1645a62c7160ca45abcfb5c165eb696154ae38684002a150ab45f1b8f1bb69b28757e2503967a1432090b6c90ce7e3671860e40e95200f8a1ac1ad927b49bdc0a66472eac7123c383ba28578b149f121ad8b1ead1e1908858a640ebebd2e1b8a4f787e5f41d573168493115448edb0de580a8c281b783afe2b62ac6ea243d021187367df9fd28f97e2ca7c8856d89c64a4c3c5e2147aea8120b4bc8b2d0b8ec5b7edeed35d24a800760e82ab19cb7363c7b2fcde6200b8e63e2b698489e9dc0bc4c8f1ba9ff68b59a7277038eb920fe94cb66b60142227c026662ddbc3dc29b373c5c805c365b245c2f69152f1e2b2007e3634d06ba18b973add33bf3e23a7175729a9442fc4213adcb0e5a52e2cc272096af7547b4220ef6335cf5fe47c75896ef2d27e58acb6d7b444b3645ad1a9370fd0001f3642f6dab0eedbdf04e554106719fde491a9bfe00e8228f250e0035f5a95782bef5680a15e6148467d4c7db9e22d9a4bc766ba884940645845b25ace95d405744929adc2c63e41e4c807e33a0d514919c09e855c9d77690be00720d83dcf2b2276e157d39b7acb3ae262e65a8a09ff49478fcd67765dd03b545d7e83bf194ee6b0c5f83c41f7c470e0a1c3f1014a7afc2b7149c01b3f1181eeee4ce8a9be47f0f7f897a05683629d6164fb882e1b67765e7560e7f5c6be76ad9902a755c6af0c455156b93f14e618f533feb9d351bb956da352b7a9d63cc5082d6f9768d80f1bb703c84be2bd75b848f06925f47e226c424c0ae8ad4293b0e9c330cdb16bbddfd000158cc2778c31d0436228349fd19e0428de5916401bbed1f3668014cc51cc6b42381c32e5a7d5ec4d194037b0544284c52e151b652e2733b17065b2a98fc1f5ff30a8acf5dc7522b64eb94a8a71526e2aff0acba058b541fa412bb5344eaae4945ace66b4f9251e842e4b52feae5ad89ae1ce3617debbb551c09c87c6e6e69b7942f1178db84dd758fcb3f63d658e3f48c1a47b725cd2e003a59b8e318950a45fd908c6c4d53d706dfcc2041c046324e3925c9ca032f62cc825f0c11c9fff3fed99f616837244c7d71b3a8d79a8d5bba3284280b59ca1d0ed044801b7d4d6148f014c8c04e8859d9c3d074a7ad77b86ea0ae39fde03fb33eda53fe5c1728cf2daafd0001991691f21883d17fbf12b24e86f0f639967240dcf120c01713ad612ce32a7b8a9c911248414d8a2b836e82c827270f60f154d5de0efb7aec5b3db3f8b9cedbcda84aedea5fd0988ed0069871fda9db5ec2a1ba0f04592048f0040599023ac01e758886daa3fdd9190bb1c8ea29898cdc711e8e8e6c4497ae95ee2e5a6730bd8388d8fa812b21c9b97af84a7cc9f790139b0005dc86efe16436e63982fe8d8ca6bc5bea86b2297a0726dab7704fdcc8a3f6c273eb0f8aa008ad1e6c4a985d7cefe05d3b24cfd195d2fae5392a48be5bd50386244fa9002f95ce18efe97be356a3c5b3990172f812987d0fa10d7fdf9afcd20e165697e3e8f1fa564d1f03010f8f20d53cbea6789dd88800af410af54c3c346483fa085c6e02c088092372ce828e2afd0001f903226d53becf91fe3ee0e556a7ddd652e179dc3c2de5d7af38f380c9916791a37e149ec620429b47e5e0c016b898ee1dc45db857c93a718daeab3167c3c336b22692da51bbf7ef1bc42cba25af0b1fa89df2adcf41535803ad6e80ff1e1f57c80514f1d091040aec55e87c4810ea31ba22e4f93a101d71e324cfb2d84e381f1a59a601ea97907013e119a24a468b27558b68de170690e71bc3c2d7361ca7f77d116b642516d9cb128a70d6bfba83b2c22420059e8c22c9f794f2e144a3a065c942d3276253013efaa88a80e3d7f3c32dc249347a6df656df62d4f9482cc8470bd1bebda925d47c5cd9a54ce81d7bda23c2d0434a98a1f73911c6172facb08a21cb1b1935a2667416f5cb810c787fac55fe8e14146721452870f27b1d5a14fcce0021600ca51450ca3b29e9ff6b388f4df5286db585d027f68fbbd1d4a95fd756318700fd0001b941fa0b95cbce10d49d29c80ac6c45bb624fbcef94b9bcc75d3593a5e11ed85488b6332f9d059e0123d5df6486dd2f57a9239d137d46f3b9c0120d391d1f06cd48c13a0b847020d0832b15162461811662eadcaa2757e2b6b2240d478e7411c7e807e09ef824ecfb3681b49aa72a3319dd310d8efd930ffa7751a222e73f198032f2dfa00e978c9542dc476ca44b161fe470a5f63759de5086a18fc92aa375c608841c6ea41ebc6fb86dea22a8987f7d9abac948d5e67a173eee3b9b90c323c4f2624f53fcaaadd79427a36f560ce6cbd99872d8119acd2173935b0331217e33ceb4a0ef314e45c1a90ad06a46948a38a00feac8f58d8780e6d15ff6e013dbe214cc25d39b2def7e68e2d5c7afd69c5d629265f750b683dd660040dd3220a2ad600209901a1f845f602ecd4f341e7b68c6787561b4f18d7819c8b319dba6836a42517216578b022ea0911e03a47f0814046cea045fa63bb506730b0b491614417df91f900fd0001ab0bc038363d54f8e9e8ebed6a498b0f989c8ee56c81720bd66f71d0d97477d0db56d4481cc0e57c2316f4bd3a6843f86e5b28152436ba23f377dac267c7bb6501666efefb705be623d0491dd42a1a5397f45b6be6ceb1e0499842914f56296a34f304320f5b623ae7e16379d89394b7057d1b92de4c913265ba231d81dbf9e4b586704803baf1cf0fd474a721bd65206df02888dd77df03c831f8433f3b2c7cf7e1211c7c85a975d129f33734fcf77c09aaf68b681da7c506e8c89ac5394589d185117b722b757e307ccf31e9ddc1b9131633bd684ad458fdef09d346566eb4df920801ec4ac019081feda518cafe1ff9f9197b1473ddb18d3349652db870e0fd00014168b6756041ac27a58e4160cdc78c2cca30e144cfac7c58d40b5521c76ae171399e4e22bd3eb5a59d0a44666cbd8d38c4983f8e2bac6fa5ee84c86adbf9679bf8631dec545667463df5fbfdd5ff2d0f6f9021a4a03510e291253bd133520d5366e3c272bf8ec41a14b15aea97c420ff263bb52dacb3c3962359312e5a4690483434ba5f592057dc449727f03768f3756c24c85814e1204d2d90cad6e656d39e7dd7b9c4bfcd103dac62415b0d64901b01278602553c149f6d64342f16757b5ca1033494395404fe1ac7ae33d796be12b0d4f986de23186ecdbdc8477a742fdc973b34b312f5984b74faa42f5f62dd4938f76f5d7ec141249902825d81ab2d88fd000193a2f7ea915b7e506459b8484c43d305deca93a84b3c313a6cea7286d485395158806c3d7f3155f3ddadbfc913cbd7673193a951b356ae208319ecf406172cfbbad940f9fb6accde0c73ea5a19037d5d8644b4de22db968851a303717f473c491465712da34aba4e5dbc31361163ae1492bb3435779569598639943640b6e14233d8888aefa72580e22091b6848592d5b2273cd2df009d614da03d0c0803b4320800094dcbaaa337fd210820e07a8deabbd595d2b59b3bee5c7a27e585a1cef44e532de83f08f3df43d68f5934ca69776b8ee8ddc42969970d64145c093d4e989cf32ba71f750cd03b5c818c33462d05c6477ec1f0ec81c48e4b119d05d31cd5fd00010b1cbcbad09df7edcebe79a913033895c66686f078402893059e4a986fb76d28e89324f5b04ead2c2aa0a05786faa1e8f66fbaf66b7ca94bf52123e6afe4dab54bc33e5860e8766031dd256edf40b294f55062e613cafac04f77e284f5097e88cd7aaf46fd28f4fc24ef1ec1aa0bebbb3da5b504e4dca8dfc13ed99e4371dea6f3bc0f78cdf6ff47548e5a426c92095da045e5ccf45f446116e2c9567ed01d62c1fd3a78c62aa359118f77705174db6a4faacaa0b6d49b4da38e42b20e9cd2ed7979a0f6da28964e0b3fb755046f0a5477dda7465e00d13c8751c36255b7f922dbfe108a14e359257ad607dd7e1c9ccf330779135714b01746a25ddd11e565c821713c8702e50956f6f6ed9c283cfdd08938c8ccf08ada04309e47fe9ddf5cf5dc00fd0001f5e2772a310c56c1343104f8f618a6408dbdd5e421e31856f271fb33329d5055c4c73e06870feb8f7b298cb9b403dd6c4e87dd2137ac84df583c58ffd627b0c52996bea39da5959ccce7968455d3b4ac512c3d552cf63f2da74d6de8e8f037eca47a715d0d9398502b287e5f1034e536a84839bac21ae9958da81fe54c67165fc650f19679c9a628b74fb40c65257dc5b50f690263f9c1eaf41c3365c0e23f91aa7ade32a352c8b88b40b2d7acabbd085185f7737be6f5a7c342e2c908e8a4f997ec949e4bfd6ca7b3da894fd4581c81141cbfc01afc3eb86bc91c304c18c1dccde49d8b61e41d922fcb02162e444dd4931a076bb072ee3a6d5cebbe8683e992fd0001197c654987867c3fa8c71ce3718a70756063be0179e55bf302daafbbdfdd5669ec38e140e3204b260b1d54373f84657101147e672120d735c179fe2dc5fdf7dbb8aadee63b867e31d9d1242e45bd23ed510dc7a6d44ea7806159895a2293c0898bfa6d0018d9864f584a59003a8d4e3a38eae3ec7c9e35d1e5985acd544547ccc1e31024f05bfd5dc07ccbf535b2e0a0a703548e355eb9d1acd8a59684ba0fb674075011c7be7cc899c30ea6c1df0dc34c9366f47743aa12991192cc836db7fd5a3b0306d6905a82e13b729038c70fd3bea01def02b93cd2e71439a9fdd5fb93da6a72436ce9f5b431b7e18c76d8173964d5a02e24195e761d888a6a2532d785fd000177fcd4e94194a3c34efea9f8f04faccbdeae9f0eb8662b0195db08e2b41a08fed52ab7060465ecebdb2eeed7a768c4f65ed7b5193151a56c752cdf97cd4c6be8daf95c16c6703ec95b6cb541506c715983be6384031685d48190e611ddbded6fa377affb759a1f289523e56761857afb3c33b68f743c59a6bf2098a2f5bf3c1c8a3d41224dd12ef247874ff5ab6257cc3e29a65a1c16f3ecc26108142d1899a340be3db55556258a348f51ef61e8e73fa9db743f08df3d31919f2d9484603f0281422c2cfbd66959dc138c2176d6e242a5a04d5b1cbd8c39ed051486869f8b0f3ecdaf42498be6016dc9d49ae52220612a32f50259fb9a8be0cab88deafd56b12024a02c37de6161be5eee8cf63c3b0d16d0bdca07ad59fa0532678b864c13bc20c87f061046d5218e768801c69818dadd24e62aa4625d5a2af09b08f9eba8efb5e29fc2977184990fcd81a0a3f896691051da425d7b99292d8ad7a3bbae5ed9503c5b761907097dd6457a5444b9c85ccc829d5901d46cd917ead52a3316f96588a7b508501be9f69c73d97e0db9d615f20e50712f377663f6c47f42d005db72b225048abeb8d6e3a60afbe21cd13d4539b7d39806952d745a7c49a552175135d840a3f9b9e9ef6ba3c46e9f4bd42f9bbde0d5d5abda8cf06538d3492aa856d8708285c0aa99567adaf6e0d4b28feec0a55e49879ac8ee966e4520e5eeae3e6b4473cb710b4213973850ea6ff0331b04ccffab2c2c3f55ff28b8bdf644e4c19982916d01e28d745302b079066c61fc0e8e1c90931f122893f7f5eb86e9111f98cf36e719129668dcc4718c52d0c4c6a1a941b939e5e744d61aa9fb1aed6eca5fe062cd109b15abfc5851ff77c026e9ba7023b298d40acb1ae9884671ff1776aedabd859f2a481eb18b963afae2e2ec41e3f3671e9dfaeab234d6aaf97249f4702e706437d8e36f517b3b227bae68b79064a3fbe999bc2d75912d970826908dc17b815ec0f030e20b24f17c527557e36695abd05f67c60475a0c74aff42b5e7fd13efc3b1c3bf5ae6e3251731ffaad110c4210c9d6d78d69d6f68cc31ca99fe783a12fca506af01e28234f01e1b30dcdccdfbe696bd5703ddbf0554c8c4863edb0f252e2a9daa54d4900d8fd6aef61b8a8f1e165eea79a3f20663b08722762f2c548e0cd10cf0d2d8e8b9239b638d02c49749d55b721a6c81d2554b51b49191518150664b7e4dbde3ae02b36ab3ec9250290c8cee6b7371e0d3c7ad64d267cf463c4c82cc5a325aa72461345c4f45c8753de23bc148527b0e982511bed9e4bcd4cc37e1e3b5089373fcbfbef9a111c96cc79e9f37d619c0d68598541f2a37ea0fd614ca310c915c0d412d2eeee8f7d71e4a250bcc60d68ab3f296a5f75d75d627e5913aedf3646f733701218878049c420ce0089ded11b087f16111e397d0f2e354f1df0a858aaf07eeb8e80002210305cf1786fa950ae9b553390d6d62e2b285ebaeb978822439e0922403f9cc7dbc473045022100b807fa7bc196a7b2d7a3000e5e1870e2ff488bfd6e2850aeaefb3c606f28379e022009c3cec446550e5cb04483404a677c4b8406d85c62cb4d714e5ca3a50aa02f2600e80300000100e87648170000001976a914dbe6d470fa9fe4d037043533eff4f80aeef0c8d288ac0000000018b6dcbedb0528a2ac4f32b9ab011220000000000000000000000000000000000000000000000000000000000000000018ffffffff0f228aab01c2028655e8030000dc8ce67bfe1851477371a9ac40b6ae0cb8571f6e2d5285855288f6079f1ce7239ee8c85f465b1820058b79554f41af297e9caf95ce0084b7c35dea0b95e15a2fb9f8e62c5427c1c36120cbc1fc11ff344909079335209c6b84b45a9211cac960f64e9432ba5eb6e4ecb2068223dfe3d85b345da17bf374f9140c9577c148bcc431c9ec3c7d13bd2363dba821381ed9fa0614416261e88330b3e74c40e6561310eab3f26f092e72f3cab761f373d02680dfb52937bd9515be242f6573754f8f665523cce3bd606c8ad190954f8181577fd0efe7cc64b711d03774958df4a5211e44870302056557777951d7ff8c002161a6a59e979f05469cb31770bd484be6525625359979220eb7e9912e835065fb00fd000216aefbae3525166510814d1636b76b0d48ea3cd54a3a17b136a84340989d75f74ff952966830e4c0d59daa006d5a7190978270ee9475a0778afaf002cdce7efdbfad630f72838b5c4a3b538ba61b94bbd9e353437a50725af5f16fbcbf36bb34e7da54e5c24dfc90b545f95c973877bfadc2703ee10585a1fc1c97d7377bf41c9cbcd5a313849a3c826e7c1301083694e6dc05f46899a901ab4a8d7f6b3600df280157fbef6eca4c28fc610957a42a9acf7c4d7f9846ab6b9b04fa6abb5fefc168d45f10078b97d4d6a39638588a1c19e1bfc472657861a902c2d52cd32fb0463746f649ae88bc0602dbf35816fbccf91dc249be809160cbc7f8b6702d6cc5b81fdebd283231f40758afc899f6fecedc51dc4e5d09cb8961092220541f75ddad45680ea92b4ee78c29f58c197a68420bbb25b450c72d02d7249f7facf9927378620eb36fbf9b4ccbcb55627eb9cf905b4a4c65fcb77a537f642f10901b6e94afa37e4afb0d6d91194454a9c2dd8ef8fe4316f8594c7822a7d58cab09657cf501da5be5a44f947bb957b71e4291a7fc60cd5cef9f0676f7c89123c7ff1ae2e6dc001b6f19785534e207fed2bade8597541b13714284f67d6986bc616ef1b0adbe415242fee85acbf482a6a48b3f142ef7ddb5dd1c97a4b0c53c6ac7aceb8c042d9c9ada1bc986b8c276d07fbf8512a3dae6a357fc02b167eb85000040e8693e45fd000200e23abd27b258f9827ed58545a507bd465e255e1156610da314bf7df68b6b55129df84c7b19e362751ebb9beba10790c9c26c5ddc7f087258d81b006c0d2e92be0178bf5edf6e78e89f73cd97746afbb2551dbc97eafe32ae62e7f9ebcd14ad69faf74d2011d16f2c50775f4f499c87c3c50d9d5d486394c2a7f462675d2a4885493332e0610a78fc0c8b08eda42e4bfe93b8c7f80a911a7992a1deb7cca2e40933e1559815688d4e5ae5e58d706bc513e5108449a8393928b5b77ae73cb03fe212c6375b6c5e61fce9db16360a147e7f7fcd49e05a99711d4d5799be77f7e39d9d1397388d6680d4931b48798ce013256a586781ba80168bae63bed4d150b64a73f7d0ab0c9ebb42f5d4db40eeee303783249af4bbf334c660f8c084ed9a2e5fff8be230940a4a08b59418676ef005192365e4e67757288791ce4992b903a31537596cf6dad0be2af2418a6b9cc2c33e99d874168f6a29df189a869b16eb5d24400ab30e4eca9274114d646aaaa8bad45832b6c0ded2bfa698939a8af9d0af380d2afc58966afe0f45483ecad0f114b904cc2fafcf470dd4fb8f193795e8afc3243b4c946d5eac82babac6feaf4ff10bf53acdf8347fb9fb7a5ac4efcf160f0a7ef3576f439404a3078ea092f46f408a955c965344023d847fad7374cf145cadbc8348eeb2c5aa999ebeeb8a5548bb14e0092b184caee354020c19d66cb213fd0002729bdb186c4c494e17fd6effe29cbe7fbc539caca738d54f9ffc6e52a35a27da134192e2f7f4ee2a86af281b78670e662677e97a1ef008f10f42349fa83bf7841d88b1a457d38164a383ae9c6b974137d58216f22d135d30b9d6e7a74952a7e905f385141f4df088415d704cc3b03b2cd600cb5507f8ea1b53fc0e73031a3946c0d6269f020c9c26a3be3bfdcd37f8d3b9fd42538ebd72029fa0bd8eb57a4fe6769e1b43b5d5d7be311e12e52ee9dad67aa988dedc80ad616d7540381993d9de91a7fac6d08e4414254b9d1d72940fec032833a6b1a5605f4b62c47a86d70dbec5ec913d0a613d438cad385fedf24566bf79edd17238e55421520b95772224623f145100e663b2ba20161784f688afcf07a900ade1d48060d21be9ba9297697891c2584cb99a44868efbdf65178592ecfbadc92f4883662d6b21b7f266eb21815c7401b8e7da061e3258dd685f8cf65f2c2e407c913f85d053b05f6f92ed1299186632ddcf175ccbbc933044bdac5e10916917dea1146f77a8ba4b4fc8ce260b5deed395ecae9b81baa6b385fecca5d2982041c131ce02a1dec517ad2d459434aa3a514e7a4c6c1362401b1ab62b4c89bd7705d5072e0be5250c60c2fdd946bc73050d3b8bcfaa73165eee3660063f279e824d1e15f87307a40bc9e1ccc0f7d7087ba84fe9275742455241b61d3687d23eb9d7a9cc18072ed8be1492db46a454464090750eb0a393499a73d23f4c552ec6ae425a77f97d4285a7f287066b2198bfaa99073da6f4009755e59838e48cd5fe692962b87da3ea7e14b34b352fb2a4673eaaaa594a094610bd0cc566acafc21891b7b0c2470bbb338f579231e01c064f275c5ac9c2748cc50e7f2e36f2768d2a59c22d14b6b9a431f7772e716731c55ccbf086187fb15bd07a5af3040d468d4088ba9e6383f1df6dead9384758f2da81ee96370d9055ce5a0db56bbdccb57ab490f42a01e083b61c5157b3c00e2011dda865c7294cdfd2be5c03a1a36a4deda9cf03b500fd0101b3c97046a717a2f38fe2265185f4411cc68cce6cf9885a7a8fe6292eb9e3eca69fb6249774a8c82b888d22d5fcdd549846c3ebcf054c6bf07aa4d6b1c0d4d9bd8e16501f65373ceda249e9c760848fc86ea92fae7142d211c8bb4a287c91eb08cef7678ef1f445f76f81d464eb1d29ce5c6d6286d73d49cd0ef03b65376eb146a3ff69a487ec90b53c11cce613a586f22cd56fd34df6f7ad64fa3c68a6ae5c9dad99d4a3d2b0974ea1f627be4f0153c7b5fe472d0c562556c4d8d1c7c592bea45bb7886b74f8639f9487b2f6aebf4848b5718f2ce65b8f5a4efcf140e2857bc9c503f0058f9b6af16e75f2d530fbba8979f81569e6cc0bc04a54e30de4e03a9300fd00019b881d73a78b86771d41c0c2a9ebdb3899727f33d2d4d81dd27b6a00b4c7db265999b8442800750abde7cd97be0c691ed06b5d40da115546d90d4803e82c61d43eb5e2bc684adcf180be47660870921fdedb2ce43f33564541fc0debe175c6c49bdfb51378902dc709594b9b7d34d0af70b67c3c608aeb5185e78c1c39cc3080b71a36115f623a07a4e1a3e1f3e17b6f9f695f1a1acd9dd1319d0a0d67b337e64f720e5168c09196244bc71b083f302e042be19b6aa1f8ad61755f4883c3a1ae615252b884ca3cca5e18a023ad6725f08f9e0ffd60e7a73ccd29afc910d60dc99c06f5953c3e398ef615fca45f6a83f8a0be653d31a7e1a1666cc7334d9cad51fd00016f7efa38c8f9f478a6ea1217d8be9b7f0b01c5d1fa483c26e403eb3a4875aeebbd0e7eb8aab8472a5bd80e8be38df13526042952f813b71f8aeb4a2281bfe5e5d9ba70f7e4c9f477706da922899f505dd172e260ce5f008b59c0590d498ac50810e9a38d35f1a2ea4e9ce8f77e46d0b5604dbf94629cfb8b65453a0295eeca9d992365309b7956481a8c5080510a09183bd3358fb26933e15c83fe2ca6d186e631d72889a09464f5dafdc8a93dd100329071e52beb522bef1af0fbae0516ad3b02011e19a2b2924791b3f22679b78039c8356c0e6676e2451487f056d0cff064f55a992afba08f59af7606a809394772ff85c4c40673dd54eb30020c6a5cde3cfd0001ecbc47845e4a1f3c05c4e9d0a47e5e8996326f48d7ee1bd0e432c5f33fecf8a94feaf03f2da65525bbcb119c7928456c28f31c183a21af1acfcd9615669cf47a077f861f694bfc1831f1a71ab66540906c62b85274f63abcc53a37e3fccdc8563ca2153818b6b796473848d765d1c81d4e6f78ef8fce804184e04664c5c6af7c3abe4d92aac3f6ea99b84a3e53a7bf7679c26dc96804ac9e1443b054e3c55fe89315106a14646d06b84122861ac0ac27fe64fbee3c9807b0264a90eb9602187f4df2cc0c62b025ba70bbb30a7e43d533f32546d2e6f97537bc2d623a7f545676a37cb511614037d77fe21a35ce4a2275e7ea1d85b7bc19e477c61033f5effe7fa5d8ff48e2873845157b7a29718e6692704a9d864301fa254798555172c6277cce4ed5aebdff9c27a1bb37071677c16da15d6c1547c5b708e1988eba68befff1f1743342ad7cb89ec8731b567198953d965ef6e395d38b410a326ef3e262937c763179f22a076d17f848dc4e36be38d838d5788f121d771f23209a0d50fb3d016c5cbc47cec31069f7d22bd78691662d8b609932b9533bf828e213e5ed4e61f2b80f05acbc00fda0017bdc59c8a6a23d261cdf1dd10e91523503c3375a803755c29b6a84bac626708b7db937ed39f4053b5c6376b3988fc9388cc64dc07466c67704a32b703d5dd86d8fb8597cc2ff7ca190044c66638028855f29fdf2a0943c64125e3ad2487de6928bc34088957eb32d843613e6b588a91cbfd8c37c24ba655739cefdb203bc3061ff93498160c7e949823b0947c68b6c51dcdf038c538f50413266680ee23817ed9cb840e0094f6fd2277012aa2c6f82b086242e6332a4e00bb9c12c153dfea9340e681e63d72551f8830b2bb2587e5937685252928894bf90bfa174f62bf7ccd43415a094bb4142fcfe639c62f6eda0e4d7ee033f49f51eaa6a35b0f7f400992d8367a275e9d018a547430083c41a35ef543bb92e159efad39c5b84d127bc68dd581c308afd5f81654ffcdb3317dd6e21d5251916214e873c83b6ac197dbac6c1b93d79b9dd5da090be204b9765fdcf662c9296295610e42a0570a1503dd67c44e17936946f3a6ce61f82b13cf00a0b47d06f2cd28651b6af32ffc58304593d5ce81159ccc952ed980f93182fb468ebccadae4dab4565d64a5bcb3aec7a09d681fd24016a4905a3a143e4d61b16898fddbb0f9d7602ce865716b62ae4f9a37e2f6ab89de930e066db6f4a8667ccc4e79e7ac760642c33e5f24266540c9b4fbadda4c0aa1b6a74d02bdf2324ebf9598d8ba918438de1e3343be0b057925bdd52304581ef621fd085dc55cf8b45d605cb0b60047bfa935c2968d554753a615e75f24086b4e40508ecdeb411ed26c007a1110f3e73f504d7fdefb275cbb59cf9cd68bf4784b8845467fac90275f3bbcc2c14a87fbbd7d111441d6ba0833b9045db43975317aee170242b291f8b07254d395472bd4b67db7576bcf2460bf0c182f745a6cbbec3f680b7c6e0a85308bc3af8af3302355757a77a2fe3f98350e4ea1b3074e37a638c630d529141843583ba4b802e089e0a7ecaeeeb42079e072e64fa5251782cbc67ba9d46e4c7f502d44a06e5212d09f4dc5bef1f1dfc376d4a042f608b860971c44caeb3735cd57e19401314af06a73180918af7693ec5204b3f858806e6919af05a1a8c6daea2ee3f08fd2401c082f09f7042a7a0b6b484287050a15f5d8c1011c200d42eb51aff5a484fe1de9feaa264ed3022b6f5b1b54a4a316d3d7e2635210ad83e2d3c497bed46f417ed22804682529b034925dc785a2d74361d1db395d1681d71bc1b0635908ec3e92f850577f35912fe5c173402e6e2ed8003c64a57bb65a2013014a3ce14ccc725f733a50457a696396cac0a551cdda03a2ec81597031feaddd801a9bceaeb5f862a4cdb3eda06dc317a96b29c27d78dd977cc6f25d62bb967814fd1d7e87c675042522c904fadf1cff80289374de8f98df511de975011d877058aa7ea9cdf186ccfa5cfa5258e581ee7ee73e16dcfaa82f079a16c95e6ca4f49c037b2423c12006b549a0b80c5dc9b93685fd2a4bda99e5aea74eafe9d28149e94adc538198d459c7a9a45a1fd24011c69aaa26aa94954fb7dfae2d63eac286b4979e7d513eac8144a7bccc34fb298b7c556a82e7450bf590f1ae658c474ac7c12b3fccaec877b6bdd11fd9655a27b7b69b922b1629a24a8d7f81a6827dd22cbab62d121f5cf96d59be904022360c5bf04d2435c52541ea4d7f932e19fc471a0afb38f2e84668d974c57c963346d790a670a699ff53b5557def1ce9650a8624bb2065f9ce99d6b5361a1b39629040fc897a5d0a07816618840f86601508e90198de64d7091a8bda406009948fa9ebbf2f56adc66e057ab23152504438062867c4237ce2b99c020add16bf66a0c06a072c4fabd9b9fd1146b73366535d934328188798ccc18ad37d30e06a39b8e14468d32820d912359323b7d474dbf507e894a448a4e921f70d1fb4d4ac03b178ae157814004fda0015c202cbc492bde212955236761fcad7de9ec8932946b5352f6c35a242d39b354a1f96a706bcb84174a5b11a7e51cf0adeec9c1e5c88a3f8f32ca81977db668650734398e6feb45cbe0ed5c5d8f77cfa67b78f8c7c856629e6731321126d12ebe70603fe28d4281f5c9165e60749bc8688d7ff3cd509d958dcd1ac7b068a3548af0a3e20b984bf4406a6c6d55c674bc83240757e3a0515bbb626b6b6b863fa7029c5043d67ebcd531601d39b8b6b7e507a176216a264fb80f574d7a6a587d5ebba7c355007630fc49127368f6b672bd12fba956db75f189bd438f5034badc04d396b04a021608a7888434eefffd082efb0c3196698d1b015b42eb6f5a2123c085d37841c0cd6c7a1d77c55d61d76426758cdadcad3d7b1037b5d94c29962d4fe218c9f98c89ecdd9a50a48bc534bc167d536e11906bf594876aea01683269255701b705ac454b250abd45d10f4f8b881c6f4a360014b450132d750099100e15c70ef65ab0eeea340604f3c7b3eb3c51292036a6cc2843989ea418631fb595ca9d7e23a88a3a7d0a8dd5ec1212fc786dcf7107214d5c4d3f2cffffe2b1fbef09816033fdb616b9318b80b32f045ec1bec678dd1500480154ccdd87365d602f0126b57015784abee6fdb9b7f22ba135cb882dfa738baa17233fa53c68d35e4102f185c07a1310b710ff2d63db7238d36487ab504e64e239d0641137cd75cb282e831621f101663efb2f9de2520049c0d08a7c965477fef9d575ba31e101faaea20f96e40046132cd3aa981e8f360cb6a9bac68844d07c7d1741e56b104f634fa1a0c31d64ca4526de4f1754effc40aa04b9dfdb6f53ef77540d66fc9d0a4058fb46518433a1467a71873a03600b47c81e0d452cc44728e3a625235c84f7f62d753faf91fdfa1aea056925168616516e5c4357a7e82c94127fe8a4626c868bb7bcc13a0422e15e31c82935a4e1b9cac496bb456d1318e2e3e704627f1dbe646f5f1590283833193cb03f28e00f5020fbd43c5fdc39fd35498cf4fb7471417e814974331500d8e4ec8af34af39b457d20843d897d0e015456600325ef702c1bdfa7bbb3f2e7a74dcd8fd77beb3df4022320108d0f48a7a9b2a32e1587eb01094e20cb7c002d3de08f481a1d7cdc6b3f9c7c20185bc7ee65a12aa6003a58b83aa90d90baef64c7d324c662ea5138fbb4bd063720f8f9111e20def54a90755537e44fd506737cf1fcc4d0b320bef16eedbd750f8b2002e3af2f477e9d2912e50e4f03e43742c19e6e94c1ccf84ab04f0eff342bfc1020a544d7e745fa08a740418aa6da398bf10870a860427dcdbb857b6b41cec8e1342059eabb84637e61530039918cca60b860ef24c0df9e586b7ee9ce89336d5f1f7a210f0385ce2ad9f83a8534ab0325a42495a9cc4cd4774c9e8910bbf4e7192c2e98001fc3aae0957bc822f2aca9be874e1493a0dbad2ceaf959996060a2bc1781c23520cd178b0cfdcaa92929b9daef0c4dc752225792454327bc351b63765208972820203954fb6c5f5fa020f757c1bac415fec7e1bad3b7c19a93ba5ba53dc12f5ffc6720e7572f4709fdb74cdf2dbbf50a7bec9c10ee302cc2c5dd878bd109d1c87bfe3e20883ea4bb25deffe4bed0029e066230311cd71a4beafa608d43d615652cf9c146204c98a01cfce1f0ab321105b2f2659d375f691e2f6cd9eb821adc512718acdd6120d5f64f7950ad04508b36baeadb52228ed3a1139512125834c1f449b2a9613d67204550d2bb9a9333d567b6c2ab154f1fb4bde51d4b5c50307989ed07100095485720109b0b89090c8a2fb0c51f3f9ca1eab0e36b4d9200396e7958523e57b705d11b209195a60cb9f034fced26b3336b0c49872fa13d56cc410f59463e4f312c93423d20f52bbd6ff9d724752b5ecdb148a47e86c1378111d76e77a2f4434816e325c62920510cf87382f2a4c1417203c4e17511170ac616fca2caa49b521dd721a8183f1120ee7ab5b0de3332ec1fb81c2d5baaf0509eda6de26147b081866c2a9aaa3435882011ce790ec01637ff533a68dfd8fa22733bd7e4fefe18a5796e9bfaf996adf54b20509ea869f679c1ae8b074619487fedad28874cf9c93d01003e9dd0df2f45b66b20380577ba031eb78adb2c71bedc8154056b157ae0d01203c19d7df420a424f71521d04f8ed62e7175b7e70d7f92dafff586e5a60be02901f9f67e97374bcecfe7830020c6be51acd068843922b23415a1c7b39f4846da7584a496483a36612dc295968c204e43611bdc897913427fae390deb145024077c5808238d960f93c62a62f70e6520e2f6ace6ca1e8b6b73dc2fc3c43f3d1e740f1c663e3e0ff9415b2d282e1d377420bf6b145630d553e8c6e40d84626f01964e3d6befc33ac284263ee2c35d76003721a9d895ebe788be0a6988027ae6b33a26bee33016d8f4b64255f320d34deba4900020c8bbe181b5482c9352b9d607eed48dde4a2759d765bc2da53cbc1c03d68da30a20818a0a41e03fcaf75f38766bfa81738f0c8ec2fabed7142e998e7b55e014300120b61bcde758db04bc126bc67a1c87b9fb4f8eb2c3958b9e4106306508e2b22c5220cec0548ab3977bd4bbc802483f0c2ce3b1d6dae43bc0f8c79167e4a76ee6f7522007f74fab71a89f6b94bdc8b5128de93ef2be214d04fbb8ac8c2832e1f2ea6371213c26fe406e69b2060b60c6d0eb7759fe85f19cb2288344239f2a398f04b2b8900020689efa2cc2baa15ce24852b1f71d08200fb1f2ab8e10be0c4db8c8263a85032220b1f2737db4e6e55370ce004319e7c5e137f3567bc4d5603e4ed1f5c636db6a6b206dc3dc994eb2ed126f1a76892117b18b24028dce73ab6d35924ec69df9bc361121fb6e92175d959528d8326cafddb4ee94fb9ffc2d9c8a413898f14cec99d4299a0020349eb2d5c10d69df3bfc41f99d6cafff21ce69323637565e1cefa60173ad0d78201818225053a5e2d51745c5002281935d4dca8ad82ff76c5ca2dee6be84fb767021e8d31f169295ce6052584692ed9e4da87e637ca0b52455f216d5036c55d45c85002100c51c6bcf08c0a3926b2be93b47d0ed8955386d369ab8d6849957efb23904a20020b4b64e35cfcbde2461db3ce57292361aa30d136b0e7bbc766f4aa3ab4a72b66821e802f9eb8168e002b64b2b7ccdaba46e73e5c422dda18311788b19eec7af5782002062e41e97d6c8f4c6ac4c0f978f6f8488c92a51eb5793ad109abee4d6c009256920009f7f1755459578897b027bc2b282466aa1d3b9b0983fe4cdf51c9090548d5120760bc9a32ab7facf7f3c1d1aea1b6cab28bb65276e269472cb24ded949256c0121ea8ed0306eb39aeefdd4f57e98d25cef9ee6288a915cc96207ddff402bc2fe81002138caf88bb834204209e39e6c9430ceda0294f1253f8be81917370a34eb28149200203aa2e1582961cbf9b22333ed51aa4512dddeb3cef2e4fdc3644dfa5145366618203a0ac51cf2e1a98ea343e9ca5fbead275516bc20e9bc421e967be939026677682164c2810712d79c82e75116a7e173af1208478e8ab6763c7ee58551b4f323f78200209943e959b9228e61e5def9b2ea18de1688565a2c49dd98f1c0a7d43e81a6800820c4ab26007fa076e1ecd22f104a860f10b22b1ce2ad1229eaa2cf204815f7246e204090f4ac3d42b2793d83aa79103e0d0488ae1297109a6f47bcb29d8c8b6d383d2058ceed8e9f61bca997b4fef220feba451f5401ff7186d1348aab81d7951b5e1d2014994a638981db8c53c2a364c744009050975bfc23fe7bcfc5c8c36b3df0bc2120e26863332f579b931156f0559025f7f96a4d72a9fd108fbfd5c29a71b13df72520e84680238c100c359efc6bfbb7e97d3ddd4d1d24ef3fe8a5208a714580e9aa552108c2aed76de2cc32cfd4d0fa02eea4be069e74da620ba09461e63b5127cf9d8e0020626acd1bbc9c821f30e5ad5b682272cc4b87a9e05323357a367e170ebdae283c20ff8a87793a1dd9996598d50333ace7856916b2add797fb4cd7cb7fdf24245a642165e43a1aa272317475fddbb370cb547766ee44842ab25d83cef370304213eb8b002121565e2ca6c09a263cfcd17fed20fb6aa06e1e798276a5f0ca8cc16dfc5c309600203e8034276a6f2379f8374e8fbc709a692b2dfdf271c0726c4f890282a40eec2920fa335f7d0543267026ecca4424d15cd07755568dc93c6557f850031098fa55572036cea7284ab1abcbe3c7a83ea779392fec2fd8c1524f95c5bb481c67e300600521444c7d18c458aa1e62e5efc656b27d6396c2fc9299befe67e3eef807711f948c0020829cf5a6319d4467027f9057dfa46e1de952a01233e068f7fd18cdadf9a3534820b622a3b592686cde240a056840080c5116582bf166f4655ace84b34145a78b0520fddc9480245d4ac36034ada99a182ada449373ea0fe16557c3c6d9d55b21942720e59aec0bc8b52c1ea0179ef1bece2bf3275164c8b14ef9528a1335dbe13def6620af95305f745778a84f8405956a82816f366957d31e74af5509ff0b7f7dee737221424e7838cbff036afc7e59ba67c6add560e242a1772ff069a31e5e320c08428e0020f4855f5217b4a20c250b75c69d494ec450321911f9d7841e489d43b3739eca792010f35a5fc740eccaa7fa007f33b028089dbb8bf539f560df19627d5bdba6fe3f213c35de64e6b2d64bdb6ba246a5c9b6a91047e35240db65c383a1be9210b7838c0050fd000184213201216f3c4d446f38e3733348efdc4a4dfd79febf41f03567e0ec2b5a8acb93639951dc506d8649ca6d1926a25b4f19549d2b3700cff07c100c47c456ae23df2e60e27f8822c427e2de12038e00293de92621bc4a27d104803e48d076e3ffcf8c31f549fe9f95c6b9233be396cbd3c557efdfca11fdd91397e52f35d6b3a2130fd46ae505dc66bc987d8e93689d41be09a1df024af243b843e18f298de218ab87e557c782bd20648dc4fd4a5e654f1e9fa59626663adb179f51fec2f5534f2f4929ceaccd34d6928ca3d42fcc5efa32490428abc3296147147eabffda85ec2be06be4512448aabe1829d0219902fe1e9cd2bef29a8f89ed8eb1966b89bffd00015e46cc825850532b9bd9d584441772b3963c554af1424ffa9ccc7d7de55dbef9456a3fbf7b4be985d185eb898e166ba646daa12cca359ea77bb7a59e45e8a6cf2708c16b5ccacb708839eef2ee4b5b6597ba3c5899c9f5214bdace3a521fe36cd39b77952d1bcc81f9e5edfae34f1cce40369b7ee492701351d34e231af8a3768cc158a796e900d0cac462f5204da5cde3abcf561ad60f91fc8951e4fb37166ce37261649f840aa51e6ff9be749d72f1f5b5ae3349f14d572860dcf36aa4655788b8cf5108dff7a4e231d2e2a3bec0a159a1e16c9bb38c4052439f2b6b1a62addf739772a1d51057c89751f7518a3b1cd7b37c4ff7d621a54bca5b3936b137c3fd0001b4a09bfe02e11668f8f6204cb9ffa9817ec412c820b6b394ce2cc3a12546ebc5052ec1c74876f3de8fa22e19158198cd04c1336a792ea47e63c2bf4e85dbe7460501606c97409a906dae4e7ad84517a7955793365ca4f49b5f6829efe61f52069fa19cb30ce0a74d415898e7e134ed8c4106cc9d6be32577e9a024b9dfd8129cb5efb1ef282802fe0066aa41e587ac9ee20d6416010e1b0772a44b6d6d1eb4ddb32b80b288952b26323bbec16614c227e4599cf721484443f56571c7b048e58fe48b1786c44e4979e105196eb9b5803795b8aa3d3e3a8f85e10abeb0f7b43b9a62dbd0905af620309ef74f281f39b241c4b4c109ca7e0ec55b13eef8ee0544c820b833fcfd65b4a897458cb9aa376c6bdccf1032e099598452130bd38d28096322fd0001b6c9b1d3d60a49cdf61f9031694f9f790a4e0118ae39cce789df472c13bba207d101410af89ba4b2a88cff5eb09e53593bfdc69a4e2706633a45c77a6d8f4baff22c7e5e6b32278dbfe97100271b1fd1e64463fa6a757c4cf4b19954d1d363494664750fcde0f0b6e35f9e0f08f4fb1e438669f78b10e800943840b15541a31c3090437364159681974adba314bcac37e6cb3ec97c3d8e0cd52241a4c162787c199a256599b97e488b8a75a46d2c3d8af1951ddac43b0d338e739deed1ba26a8616f04d124244f365573b602697aab0b427a8f26f1a22de77c563cda13fc03a030817a837c497732c6108eac62102641176f62d5b8e73d0e27e17586d6e2c2c3fd0001ca7e381637425fa77d95f92b8b491ea1398f53d763a6ce32a2b2ff972ab74bd377723dde5302c487fcf7eac93b089457761ca341f143b7c5aeb51b33cf103f2f4ce4c282bc5bb8c7290c2a9dcc82fce3dcd9669f660872f602de46e869fccdd99c85c06d1d7bc9af4e93502e4ffc385b9641df8f21a25a14b8e4cf99cca023da529f8689d86418c37dbe3d4116e08069f3d08b9c952f4e2164dada9e62908d57cc68b264df8fcbfe449c21cae576adb8169a97294a6bbd369a58654cd182c8403080b3a5a916c107d7271311a291841f3e35e065d48f6023ec4118a3a88d417507ae86b6c74e6ced02c768e0f879844e22862c357a9fe22574e30c179e2243e62192455f24a5c214eba9746d2a8f6a47625b53e5e62bcecade179907fccb08e4b200218a8694fa7fa94c9c174c8e1525bb14dd946981e66b1c02178cde818615e3b6910021fca3cbe539842d405545a71cdacd7a795b6f6fd1c1095497ee8ee215d5cb8eca002039f76b8f7067cd9cf8bde783c8ea6edee7638113ec6729093749c2cc0c15d13c2091ecd1eb4b171326a6a26d764e72e09160ff2112e577149bc7c24e6c0907324421cdebc7f780b73aef4358c6f7e5c9a78ee95dce81c4c1bbbf570cde3c43ff5ca00021c6955241d2f09d2e90e33601fc139d0603919a1011ea7ee89f0e5d53727c45a3002037be468901ac92d7c3481ad63d364a93e2daa023bbcfaf4f6fa40cc54974de19209178cde568ebc660a7698cdd7f83d5932364eb8ac144e62cdc045a00ccda5201fd0001a3347a2cd4b1f5337653554be5fea273a5bf0292c0fd60908c6e699802079912372435166baf2f71b35ec0e00a714e9f7c10096d0f39a65f66f220057f369ce7c8221dddd00e90604f9de897ebf9f06afd41814b57350ca2d7ff7e08f60c94dc1aa087b7975936832a7050ae4a14b47b1986e70d61223cdc37dfeabc5e4212a869d953450202c9c12db23f8819faad59252173ac11c54020fd7324b4d39673befd2b585437affe9398e7967772d408c6db860ec512f94d02b0cbe9c9d414bb4be4b08c3a420a549efaedaa6f0aed7c74044785b611b2d65abfa33374748adb690a54c8719131e9dda9d46afc9dd09c8abc498d6de657920642d3d47a55f17fd3fd000189cc7f3247c6ede0becf1ec89f5d92142d25a713e037454409ccd146dc18c58319550275149342c690f00b1e060db34bf6ea34473c661ff9f32a40214a4715bbcea59a9ad6ff976e43b325135ca16377be53be39255f9e45ab4b3652d629a30500f9e37671d56952b215628ef42c1e49046476e9a760041003742751b158aa85c4e95f70e267d2631491c60cf09a174816890a2dcc2f8a38f296389c3ea66a6d577301297c242a6b9ca7465d8282f2e72e7673f9e1f1c8f470949c970854134de397c08c06d5d21fc487b2b9529c901c052e838a087f15b802d081e869cbb311efed66ba31c17c73cce1e0fc32d58d35e54bc5524776ee3f45d7b8f81fdad4d621b95f023b2202f5d7c814aa89c27b5e0bf5cd64b444c711c2e1c4b805af4fd58300208214f56ae87b268fd16d6df77efaa715fccd1fb1e6298c1c4f7a4f18d39c2f75fd00013fddc975fb72a66d5a7f3ba6df9c1ff55c7abb5a8f08317c6b346875e850223d87d72d71d9b17c11bdbe6eca34b521fe98dc8d31bef6fcfacec74e5c4a6c5f00ac769363df4720e17c3b687a42f29e8edbc20184dc9274d8546368e3fd2408bb68dd224b73a1487c10f4e29b0d8b9823f7c73db26ed16baa4c5d75b162cb5a97caff3cc8957072902538e0e698fad2e90b471777c5e8d90e5cd313933c2f3b30e49b6cf7ae7dcc09ab2e5e464601f093973d99c0815c3ea587d1803b4ca1d9bcc2ac20cb818f95d9239fbbe62c3356ba41f7dc9d2232f6221447fc4858bbf11ee382bfc639d9101943d958a59ff9b81007508c0879c4bf16885bcd6eb2383898fd00018ef6741f57def1a55a42b565ebe0451f0208762da626acaf0cbaac6d9bcec14e22c15660c2a0c5a23b27c445ad968a7e6b2daab11463040eb50799858b7a5063965f947234beb0d42fe1c2dc7bdce7fcda3de1bae384b62e798995eba4836dbee41a8a4de269c026018a22687ad77985d049bda1d39b79528b320ad3d22d893c547b4dc4acb57fac4e0603468beafdf54408ddb7d4c5db0cf14162d0d735b3fad10888f0048035481e5713b846761838504a36c1f956b072b46f11c7c6fc86c766c36fc7dfd5068855335b96162d8b299e3cd21060fed730310d7748c3d16f228b0eea1f37f5eee5453e3a19ebe1e60e4f2834d3338bf1887969de57ef02a1bbfd0001b50e09d8212707f0035a46513208bdba63a5d1fd7a7ea88e181d7a3de81b8afb4ea4b0428eff67c04b27372d73896fd9df443aa9b2a42cdb8665271bb1c54833454504dbc80645bc02366dc998d334b2723bbf5ee1e139265c107db84774b4884f26b57818d39d05b47d5bdab25778965a0627a96ec303c743ba57c0d32d0337a6d3dbe982284109eb0a7976221816cf3fa7f2e3cf739f30be83f253564af7f411358d9c5340fa5578120c48b617c088d9a3d0811a575bb1e96b746e25312ff6d87b9705c04a10123c7606b4c5d6658244121310ce3f1d062250b57ee51e35e0d7b787d38206fd9d26c70ef94f337cc7108ae8ffddf5fa314e6c4e5e1538fbb0fd000192fa78c12fea8a45902ac86e2878e8327b5f4c2ad9bec7d6167bc5590df49cbddda4d4d652f6f087f2ddc7a2813aa5b33048adc5f900eb4acd983bc86ea7b89f630b647a9ef42ab1bb6484ebc20989603144912ffd80158aff7e7d40a1a76489afb21f5f711ecc3ba613868a7aac4f28f2cd5440dfd064c4874d4e398a4718e10de8f7055e452271f01b27544af7035aed32259796962035d7bc37ef843cdccfacf969a1659e354ec27efda8756b09c0bf855f4fbf7598273154b3f517303b6169bdbe4ede890a90d3b34c917311027afeaca7dcd27158b04886dfd81803594292cdb3dbb77ad3a8df97df63095fd28c275b956cc61faddf770608b898d74ca9fd000138b1c34ee04d01368d9cd8ec4d70b97633951ada508c031470cb4cfb15a62426276c7442e7679f926e93325e287ab9ed87446c144be02e559dd076c9c5e1d6a6a7de45438076b1bd7b9ff5a821070877c1d9626925c1f47838e56bb6982b54fb9e131741bab5ea38aabbe4003538c454980dc3be9a436283edc32a3de0321f114ad32cf34e860ca36f18d476980910e564af57da498cd16d08af8b4d4696a9962adeb298d7af4c8c4ad9cb911d80a2115e833f0856833232f92f94cc9c3a6a14270f4c30ada671bacc9aa35bcd3c945dacbb01f4556ebac4e52adf8790dd49fa799584d227ab95afd2da9e67e5642a90e54fc8b693a07384577d04cc40861cc9fd00012c7977632367de82810aecc22a1a802a1aeb6ac54a4a79d8e61606a6eb72effe1abd74a0a18ef83709355e77cef5666f16d94c0d710f5ae3973bb26d07c0a436aebca4d156d42952cc8cedca94162225b5b4780cf47a6426757758957dcf2f638ead2312e67e140ee8c380949c0885c68b396517ba122d90a0ed184564bbe67bf1d0115c77857fbb29945ea00d8e809c295295494dc8cca091d900837b60b31a79bacfae59fe638ee8a2208942e27f605c452be3a4a43cf21e8e0f78e7cc20ffd2c546a0bbcc404b415e4eae2c7b9c2f9121bc741a6f8c5c28c9df3e0169cd86809f5e235ce17fb625f913f94b75b360f9097b625a5305040c55a4057dc4a68efd0001d594cafd37d880576656265ebb737602d6f3b9d0feb3147d8c1f6e1514ca64e3ee046bea5e6892d8db9c094198fb3f697ae6fc880075bbd461e9aab7425ac3a7fad84071b170739e7815d0c76d2ae7fefb718ec132b32a842c58cde33605488043aad9c5df6e58401994a38dc50779e348cd18582ca74aaadcce6df39b221d4235a88000eb2e3efed6744abd0b68836d56ff5d9ec973be549d52a195195725caf3b8cb683da9b96868d35727bf4b74dcbee838d9c39a33d15609fde1c2b345974a93c030952f52da7ac20b8c26b340fd9c08f56b97ccce21004af28ebe4946a91682f9738085cdd9a53e160346cfcf396cfb59465d114c600d9571634aa3c880fd00016c714ccc93e995491adb6718e9ef69fb2cc36044d9e6b73130606b9c845dfdc56e9518a120237f58fb6f2546bec6f47ea6a11f3d898baa47682fe3f537542fe9f6d3679398064a48a3ef8abc92e89eea84c6d8ca956b3c40e9b82b2a496bb1230f8789fc7b0befc061468049d416aca3fb41d4272304a728322684f9ca6125b91dea97bbbba8c83045b5ce8b3110d429d65998b3aed570ecfedd176e98a91eb3410cd501ba52d176bd2c8d05e94acc8f352b3cbe12adefb82d34e174765ef1197f8a93fd4e03c98967ddd0332733e5aa0ce87f63aff78a2b44d10ac63c1549d9a9c6808b743e6f785173924d736bc0890f2e68c1df72b0fb1632bd4679e87690fd0001e736a64f64d58af8d43f0980d29ba57dccea56ff13040270c926a2703401b83859a94d6cbf4cd62109053c9e6ddd1cc61ac649ebb1243037adec455891642de8f43b57afe96cb63736e3e7d735bbeec8d1dc2c698f37f0bcd85bd84cc6b7e25eab500c03f1c62ec730c24208e2df2830d32842277d9e5c9416a91217cbdad60d6a77a7127b09e7463354266a1130d1f04de9041f0f83d41246766027700fa9a02d10d2b0fcb0bd534d22ed38278ce177bbc1c429c09030f105a67db70011d3eb24754bbb31f8a6a98bde215f635409e4cb8c3d769efdd7f1561976bd29876c8a11a130cbb8e3fdf15fd9ad0329852dffd794f499345c3fee09eee21997a5c8a021b993d7cea74a8935b42df2d55606a8841b1a4a8fc0321701d5de9bce1dd1bee100fd00016e510cf2b787c67956990655ca7ba97aaea25163317e7ebfbcf2681b29b0b821aedb8f9b2e309d37f660ac7169dc8234a7e7e4d01e79164eb75f28d284c52ea3d7edff718aa96db6b0b6781366ab985d202823130ca53c2a8e5186fc18862348952e967b1a3e3636517c3e3c48d8fe5e4ef1d5e230ab584964c888c61393ee3d6e34c50446b86e68ebfd048ac86065f9a9c4bbfc2474027b612dcafbbb0416f12d3d856a96557529d1144a852ade77f50f600ecf3c0e00296576eb49a0b211baaa815cea78e1b7a56a1c698ff58488378722f58fdb1ab8bb0063654a8de8344041fddd04be1b4b2b1944ce9d1ebda667caf9ca00e5c2de892a9063a449edd8c1fd00017140014f19e2474e1cc4b40a5a8033f3ddfd960ef33c7e35432deabd85a5b2c18a27b85477c9e6fbb2d8a5e6c686078009b1f7868768fbb5f569ae3429fd64e49cb3a62f32fada09059982a03a20494bd2fd2caa75a01b3ecdbc32acbbd648905d56cd2aefc714af1c24bd6e8f06b1ddbb85e9882ddf8f0e67c654402bfe2e0d9ba404bb3da2d58305184949ce513b3784c3234b39d25e0c6df741683750cb46d7856e67a0d45f4839b5305f9965808d41cbcfb2ad3ad18cdba6744eab0148dd0c1d5e687b6e76bdb9408766b57297be6fdbcf9d7e3e6918c194ef32bb776b5ab85f3a6a164baf866d93ecc3acaefbac43a9fa267bc623cc136ad712b00d788efd00016d3db1d97d5d429249f5cd6dc35f61d0b1b44f1e433cd5e01d28afa6cd6718fc1432b77e8eb6418b0a4b6fcc6707cd3d5c6661cf57b3b73b78feae7c89e25eff2ec1d465be91a18b2f3bc4311919f410cfafe8ae8a06b4b947f9b6fd8ac17453c2f558dfd67f71829be66250d40c3aad6e3ff52d1c0c455e7a4f646445405cf1ad45ba65392bb622a770ab0f5a57e73d32d98ee49d73ac7dde7dad9b9c8e1da9d1e6aef0f9cd120bc1d2cbc5ad819190b758be385f2b0dd736184382af8aa419ac7d734881ab4728ea927b6655b7d3faa4a1e14caf6d38cc706a940bff9c9021e4b6c3ce516d0257deda35d2ac4e0423f01ac849b19b919b773a58f34a06c6b1fd0001464885fd950d292d5aaa6155164216521d2113d795d9aff389771e8f39ff3d96afb5e2359fc52aa6d6cbc3921a7a21e6f3fab62e748337e2cd212456e2b2f52dcb352a75902ac6fdcce93dcf027138be788aad5e09490bbce637751cfd5bda9ec540d7daa92eed7b27ff1bf66585fbe3b39db3de9dd386ecd7671f2395522c1c9006908afd04fe68d88194cbbc3216377cfc27c4fce55c8e558ebc4943cbb477a1172aa8b344c08d6fb853e64ff0f986b7f3e7cc3b2c3d8b2abbc43e08eff15787bfd6a9a8f98b207d8e2530c0c37a37ffcec2fecbd726b4b845ff48a44c1ec7031e4e663ec0042663ff81b9a7fe7d599695737511a685148fce0c3eb01513bb20ffe083f86d11f3c552efeba225a93eb8ea756f45c2e49a4dd08467b79a14000220fd4b0ae4d4c5a165ab75af08922366e89721ba7ee52751e0b3e64017787b9445fd0001d0a8ddbc130bbf7bcd20bdbc8728e812a45cdbe602dcea5826f753b94e1220cf698c1212464a17ed846b29db82b1cf5373241d4117b07a8b7d279d4e8511d22c47be22291e9ab56454becf533b771e5e602542d07828952d5ef900e2548739d57cbb6254c667bc50a0f97c11b7f3dc1624111f9d32cb0d85ac4106b41cd6d82db7aea1135334220163c190744b6daefa456f69c331facf9083af360db6f2a2c80c423357c8fd1bc28fcfd42db69d733efa9ecdff9df079bde1b73a63ee74e5af5c75b67a4824a72466e17b501f6057a68efc19627d115f19fbcb48c0e0889857f0d9191db5875ad6d336adfbf7f09989b2aecfe868c2efc2cc64af46d07c44b9fd000151620fcd4091a3d3e78e8a1f1b5ac9ae8bdd3760320ed9bea2e1b237110d7747e9894704336b958fc92eb200f06507cb56a12f202a8b098bcec5b7b6941dccc18d2bd968538185dbfdbb6ea61eaee22aa8ad24d73df0adfcfafaec181fda3626479710bc19835a5aa7a3b9afd8166b89f5aee8d52589059eda61f19f6319335dfac7765a9a9e22cce0fb3236eeba6ce250ea0b7cfc4a021ca3c88859f556dc1137349a7ad5a628bc47267ad91ff86174a2fe74e3ab298ae8917d6a57a916f00b16bc0f3584b12b0d63141a20b1ed54c6551c6dfa5647783dd9acc68ed75044faf6745161c1ee4abcd9969ff9e01f14791de7d0c8e44e77a5b249e2da833ad3bbfd000119884821e74482b639ec1f8484eb6199a01d6e0a3606e25527d7a9fdbdabaad9f378a9aab04a153b1003d520d03f25a9e41c82504ad6de9fa6cda30a3ee1128c35f49d469a79b3c190ab0fab92d9977478c7ddabb6a66f291b58756e040892f44ebf6c8d0ba3cdf5d9335c8b05b0d34a8f4e832c54979274f5d4554af2d05aec3d51a3cbe03282c9c104f664fc39863c3a23396e762a5a8b5ba18b3c84f0f49f8b7cb6f627905a4fec65e5ab41e868561dba5cc8bcaa8c201d613eb678342aaba5e5d44f7ad7a58810129aaea2e6bb9850ef022e54a50b18e5fbbb76b93f050c31d279e66cd51a29c42591b18db05e88283e52070e6eeffd8fa447bce2f22eb921b2e3f53f38bb201511b9e1d5bbf22bf9e23be137543e34d81a0b194f373dbaa600fd00010ef2d9c59966c760260612842d16526b4352a5f05de655fd0bf50546be1d893d90f4b8264488467880be2c4d7f3c577e6b68335f1e0764fdb16d6fc44fc5bc2c1660798e6b31bdcafbd33a9edb44e48dc37306abe9ea761cd2077e977a6d5b92aff3cdc33f644f47d90fa9a4b172faf29e264c9d55d27cc4e7b7e5e891adb566d172207406ac400348c386e74716a518cfde36169e4cbd8d3093c8d85b99e54474fb7c7ebec5a3beb18b664b953f4d9037041c45738e87c53d55eb92fe862a78627a8f4f3f8f3ef01102b8df05c9c1d81da85e36bff90943e0dd93efc00edbec664fe16f03c8e79d3e105803c50a606f9812d3717921477e224efc9c38604e932116d048938c5e50af925d722ada7f78de5fb1020ef09d45e001364d0ac87ea4b800fd00015a2d2be1965546e9ffe759719faf9960648c9183812a7db83a24b0ea52bc26e3774ac36fcef82756ad386332d49551a147e87ca68fedb289b965a4088b3de6506378af1f858c1c995313e189684bbd3e484499dd7a26097ee6e89ff1d0b6d4c6c03917c53a95d9fd1b6f9a8e59e1687506a5499adea9c1bbf2f63b14207daebf64c8bd5742bec97f6364560cb3d687f8a1ce12a197e87df8b23eff607c97849672fcd5803b43bc8b6dc2090d7b99299248007a3207621c0b40e6fcecc3f68b2888f5abc842a44e6f019391449a7356f9e2637c77612b342fe61e76b307ffb780f529c6c84a6e6ad8d7553021070499e85542cd288a543bb0d318b7abca62c48721047951dd48307113449db6a3f997999f421c62b4524e5baebffef1ed21a6a1a800fd0001c4594030b3c64f25c491e6a5ab25b959438c11265e0fb2e5b2c58e3d59c86d642aff89f4e5137f08ee4871df4098a5748795d596baeadd2db0b006e02822ae2c5f6a93c5281b82a7d60f8c390a264d293f1769d55a5b1f78f0f65f7694477ca79ec16677993d5b6606298171df85a7a8c9bc74a2438618d2aeb384de706b797758dd418b2b5d59dff089f7d4f7f21a8390a3a707c08ea4a238682670a0d80297ba68febea9c4c5afccc241d9f95aa77366880ccf891174b33d95f462839d2820451611e8453d981a703595e8fc73df0a4963c1baab591b7f3dbbbf62b50dc7bbfeb05ec2ecdb1a63d06ec20c4311451b4129a08b94049263e180411ce7b8b7b120a96a6184af4c9ac706b2fb01d6389d94cc4e3930925a5b2bdac9e96dbfa42a78fd0001cb6e8b1c0da834c4fc0d797fc3521eda3ddacade8a4ecfeb518a2e2e8a234d2f6901a7eb4d117404328c70a5c24f36236e88eb1dd19a7e9cf4ec7582f472da053e283dc193d70bc71867d2a348521a860fccebe0b45958f1b5919cb833d79802640b7665b7ec45135b24108eac8a882121b6e6734dcd327b506a434cea9298e6067c36457858e3c18d88a320ce33cc3861f5329bc1f9a8f4af57caf2c134051b12dbb58e309d7bfe9028c3b9b4179759095fa531cf20bdf18134c517ceddfb38b4d94849c3d7eae9b46c353bc43d2f8345e345f818e328875c1bdcd754b706258779c7c30592d0a4c4b5cb557eaad484d1cef2bd4d98d12e70b8fda33f3a5e8320486c47e0fc0d0e679b413041e800ed28ca862ceec23c1a937954131b960fdb3320a3e4a1a7ded3a425d38b144b090d9fb0aeb9ba631622041a702626583d41142520f6fded7e7b2408e70ac4ab0b4d23bc2571cfb9048b0bc738dfd0d6507549a451fd0001656bbe84db36e12bf3c78c07ba3f561d2c2687aaeeef2e2da17cb00f060e025a993c12551c12bd4d75c4c116d18951515f42c5628b0858d85b8afe5deb0aa14a2e33d147eb62b9a52bd4769b6a97382d6c39e5f70e727ee0c9a4684fcf9a03e7232394b4ecc6a2d32e27fe2b436b1081bcb4f3c8bc844e9cb1cf9b828bfc155a2467d506be2f89c9a36bfe2d19125fb21666ed4625cf881ffba75e67d209fde2742d5a46634019cf1f96c1e649a9dd58edbc374b9d6220bccf20055104e8ae8917537fd07f69e12e0b8200af3d924997ee33a7d1e9eb3ebba741f0edd1b59f05e1f279d0c4f7106276968fac8055088bd5f57840438a2776bb21693d9587d188fd00011ae402863053cdeb79711a4c4e7472a1559d86f89bc4daaa6865eced1126197f3c43d78ba16fb2d6508632ab4712b13c3f45d674064a51867bcba96a71b7683fa69ad337fd0c50e7927b913f025fcc47adddf1376a053280cd0fc45bbf29767b4555bbc4054a824c11dc93c3648b3e1c2ca42a5dc5f536eca084370ef65c5a6229bcac295c3fa578fc22eab793205cdc8d37fe3cbf7dc6e1a7c53ff3c7e4d226f0a0d4667bad282c625695d4a1ad88931ca894d4931b19b09c56d2f72e72f62600c97348ed8814f0841baea716d1e0d90f26f8c3932a1e66dd1e8c8e039d3e891ab7be0a887c16ea9fbf3dd7f2c7200587ef56cd0e75e8e828aedcef6198e6d6fd0001a265b258bad27b42d12a12e43a25bf566f2b77f6f0924e8e0c32f294768fd6d9f92e5a15dcc94a2067c71a1f9740700ee0e7f626d35fad2c441b176a077fe681515cb0c8613b0b43c708895c9ca5a41745ca87cc5e8d02e272a484be75cd9afc7478b98bd4c030c3dd4885c5214efbe70cf9a1f8a2616e2eadc150f979e1ca8c389b6fa288889464886bbdaee7539c6bba71ad0927e455d45db2c7371a5b15ccd8c7e7e91592e9bd057d85a18a9a9d1165a84329a6c7beab031f2819cf36a26aeaa4cbef4e7871c472b9b363a1a5d597005cb98e6828a7b6b7ae81cbd036f8d8afbc6289efacedbe51c10f27462c81525b18d119ab4527d9c6db52cde19cfdddfd000143a024d1136d92c3d0de09ce4a3837fff20ce4c4307fca87b1a09acdba6a1df122cc69dca4ec3ca89118ade730ec8959d0dd84db0eff5ab2ff71793af68a2d6bf3a301edce9cf1088046b3177c18d90f6318e2bea3a071469873d1a320d5036a6ea1375ce17113721f01852e1c436745536bba80365d2ee1060a73098f99983d18511059ecac21b84131d845bddfc589a1a4c195ee1d89ba9845c09d681a87c3fe2322cdf571b4a31756d2de38276b97ecef325f4ada73b747d78899c3f84aeec26fc9732ef5843f8b2d7af0fee0f04e01f85731eb9fde3f0a69c4c0aad09f51db5cd03db3627cce5d2a1dfe9910817efc2e53ebf9f79afaf09521a3f14980cd20d6c0a0d48152ef8efbf7a58b809f5c28186addc9690ba0857cbf2c96e395e92afd0001781c2002615bfb1b7d35b2e208a1df0bd8f95f2d639422c213683828227885660bb231058546848fd01763a1ae99e0a7a1040a0f398d8171b45ffc4a58a4439a5addbad802fe79c71a4a27fea8ed229c51d6cb26c3e21127aeccd2f0e31ff1c7d38987c95b917d4c86439a7a0d54b3985ccc3072727c654bea4d473676a45f13ac693de273581cd6f864fba7ff00f3e61cabfb689689c49849419ca1cf489cf9db2138f65c1445b74a0e0cc83e8368e6e79149e699b6e64c77c70ac5156bfa98794cd0c561732fc7e3623673e1f0ebc09de026d9745c4986d498762be6799cf99143fca5d69d04283b504c8d8e325c8811853d467b72e204417c7e35064ce7bcfd0001e42f7a528e3e1de18bdde6e2d9888886aea8ab8eb149299c32c68f6c93a19889efc05e641037687a091933cc83bfbdfac77d48a2828bac6b0625260d4b9da29b0d215d403c6d3aaaf33addeeac4d46875cbc4e3edc1a865d6fe0b6a588631188897cfd131672a8c5d098c0ff8ec5b17bcaecac1d78f83b5296408c994c1e81f93021da25ca403ab6694fb3e82ed260e88067e3edcd8cd0e70ce4c79b49962096eeb1eeb2b17be69033a338ebfadaaa1293f7fe17fb7ddce051d9eb82c84d639bab4a415353ae82dfed2996a26d184189ff1f25d3196c67f34ae50a39bdc2f711ed6468b364d1f0ea8eb29f486dc6c2f6dc59a24acf4772bd542557e9ef4b5b93fd00015ea90490404b84482136f214f4497c09a0ca87dcebecc03ac3152ae1c3e87b945f721137c7a309e1036d0e5d94c6cce38c36b1645a62c7160ca45abcfb5c165eb696154ae38684002a150ab45f1b8f1bb69b28757e2503967a1432090b6c90ce7e3671860e40e95200f8a1ac1ad927b49bdc0a66472eac7123c383ba28578b149f121ad8b1ead1e1908858a640ebebd2e1b8a4f787e5f41d573168493115448edb0de580a8c281b783afe2b62ac6ea243d021187367df9fd28f97e2ca7c8856d89c64a4c3c5e2147aea8120b4bc8b2d0b8ec5b7edeed35d24a800760e82ab19cb7363c7b2fcde6200b8e63e2b698489e9dc0bc4c8f1ba9ff68b59a7277038eb920fe94cb66b60142227c026662ddbc3dc29b373c5c805c365b245c2f69152f1e2b2007e3634d06ba18b973add33bf3e23a7175729a9442fc4213adcb0e5a52e2cc272096af7547b4220ef6335cf5fe47c75896ef2d27e58acb6d7b444b3645ad1a9370fd0001f3642f6dab0eedbdf04e554106719fde491a9bfe00e8228f250e0035f5a95782bef5680a15e6148467d4c7db9e22d9a4bc766ba884940645845b25ace95d405744929adc2c63e41e4c807e33a0d514919c09e855c9d77690be00720d83dcf2b2276e157d39b7acb3ae262e65a8a09ff49478fcd67765dd03b545d7e83bf194ee6b0c5f83c41f7c470e0a1c3f1014a7afc2b7149c01b3f1181eeee4ce8a9be47f0f7f897a05683629d6164fb882e1b67765e7560e7f5c6be76ad9902a755c6af0c455156b93f14e618f533feb9d351bb956da352b7a9d63cc5082d6f9768d80f1bb703c84be2bd75b848f06925f47e226c424c0ae8ad4293b0e9c330cdb16bbddfd000158cc2778c31d0436228349fd19e0428de5916401bbed1f3668014cc51cc6b42381c32e5a7d5ec4d194037b0544284c52e151b652e2733b17065b2a98fc1f5ff30a8acf5dc7522b64eb94a8a71526e2aff0acba058b541fa412bb5344eaae4945ace66b4f9251e842e4b52feae5ad89ae1ce3617debbb551c09c87c6e6e69b7942f1178db84dd758fcb3f63d658e3f48c1a47b725cd2e003a59b8e318950a45fd908c6c4d53d706dfcc2041c046324e3925c9ca032f62cc825f0c11c9fff3fed99f616837244c7d71b3a8d79a8d5bba3284280b59ca1d0ed044801b7d4d6148f014c8c04e8859d9c3d074a7ad77b86ea0ae39fde03fb33eda53fe5c1728cf2daafd0001991691f21883d17fbf12b24e86f0f639967240dcf120c01713ad612ce32a7b8a9c911248414d8a2b836e82c827270f60f154d5de0efb7aec5b3db3f8b9cedbcda84aedea5fd0988ed0069871fda9db5ec2a1ba0f04592048f0040599023ac01e758886daa3fdd9190bb1c8ea29898cdc711e8e8e6c4497ae95ee2e5a6730bd8388d8fa812b21c9b97af84a7cc9f790139b0005dc86efe16436e63982fe8d8ca6bc5bea86b2297a0726dab7704fdcc8a3f6c273eb0f8aa008ad1e6c4a985d7cefe05d3b24cfd195d2fae5392a48be5bd50386244fa9002f95ce18efe97be356a3c5b3990172f812987d0fa10d7fdf9afcd20e165697e3e8f1fa564d1f03010f8f20d53cbea6789dd88800af410af54c3c346483fa085c6e02c088092372ce828e2afd0001f903226d53becf91fe3ee0e556a7ddd652e179dc3c2de5d7af38f380c9916791a37e149ec620429b47e5e0c016b898ee1dc45db857c93a718daeab3167c3c336b22692da51bbf7ef1bc42cba25af0b1fa89df2adcf41535803ad6e80ff1e1f57c80514f1d091040aec55e87c4810ea31ba22e4f93a101d71e324cfb2d84e381f1a59a601ea97907013e119a24a468b27558b68de170690e71bc3c2d7361ca7f77d116b642516d9cb128a70d6bfba83b2c22420059e8c22c9f794f2e144a3a065c942d3276253013efaa88a80e3d7f3c32dc249347a6df656df62d4f9482cc8470bd1bebda925d47c5cd9a54ce81d7bda23c2d0434a98a1f73911c6172facb08a21cb1b1935a2667416f5cb810c787fac55fe8e14146721452870f27b1d5a14fcce0021600ca51450ca3b29e9ff6b388f4df5286db585d027f68fbbd1d4a95fd756318700fd0001b941fa0b95cbce10d49d29c80ac6c45bb624fbcef94b9bcc75d3593a5e11ed85488b6332f9d059e0123d5df6486dd2f57a9239d137d46f3b9c0120d391d1f06cd48c13a0b847020d0832b15162461811662eadcaa2757e2b6b2240d478e7411c7e807e09ef824ecfb3681b49aa72a3319dd310d8efd930ffa7751a222e73f198032f2dfa00e978c9542dc476ca44b161fe470a5f63759de5086a18fc92aa375c608841c6ea41ebc6fb86dea22a8987f7d9abac948d5e67a173eee3b9b90c323c4f2624f53fcaaadd79427a36f560ce6cbd99872d8119acd2173935b0331217e33ceb4a0ef314e45c1a90ad06a46948a38a00feac8f58d8780e6d15ff6e013dbe214cc25d39b2def7e68e2d5c7afd69c5d629265f750b683dd660040dd3220a2ad600209901a1f845f602ecd4f341e7b68c6787561b4f18d7819c8b319dba6836a42517216578b022ea0911e03a47f0814046cea045fa63bb506730b0b491614417df91f900fd0001ab0bc038363d54f8e9e8ebed6a498b0f989c8ee56c81720bd66f71d0d97477d0db56d4481cc0e57c2316f4bd3a6843f86e5b28152436ba23f377dac267c7bb6501666efefb705be623d0491dd42a1a5397f45b6be6ceb1e0499842914f56296a34f304320f5b623ae7e16379d89394b7057d1b92de4c913265ba231d81dbf9e4b586704803baf1cf0fd474a721bd65206df02888dd77df03c831f8433f3b2c7cf7e1211c7c85a975d129f33734fcf77c09aaf68b681da7c506e8c89ac5394589d185117b722b757e307ccf31e9ddc1b9131633bd684ad458fdef09d346566eb4df920801ec4ac019081feda518cafe1ff9f9197b1473ddb18d3349652db870e0fd00014168b6756041ac27a58e4160cdc78c2cca30e144cfac7c58d40b5521c76ae171399e4e22bd3eb5a59d0a44666cbd8d38c4983f8e2bac6fa5ee84c86adbf9679bf8631dec545667463df5fbfdd5ff2d0f6f9021a4a03510e291253bd133520d5366e3c272bf8ec41a14b15aea97c420ff263bb52dacb3c3962359312e5a4690483434ba5f592057dc449727f03768f3756c24c85814e1204d2d90cad6e656d39e7dd7b9c4bfcd103dac62415b0d64901b01278602553c149f6d64342f16757b5ca1033494395404fe1ac7ae33d796be12b0d4f986de23186ecdbdc8477a742fdc973b34b312f5984b74faa42f5f62dd4938f76f5d7ec141249902825d81ab2d88fd000193a2f7ea915b7e506459b8484c43d305deca93a84b3c313a6cea7286d485395158806c3d7f3155f3ddadbfc913cbd7673193a951b356ae208319ecf406172cfbbad940f9fb6accde0c73ea5a19037d5d8644b4de22db968851a303717f473c491465712da34aba4e5dbc31361163ae1492bb3435779569598639943640b6e14233d8888aefa72580e22091b6848592d5b2273cd2df009d614da03d0c0803b4320800094dcbaaa337fd210820e07a8deabbd595d2b59b3bee5c7a27e585a1cef44e532de83f08f3df43d68f5934ca69776b8ee8ddc42969970d64145c093d4e989cf32ba71f750cd03b5c818c33462d05c6477ec1f0ec81c48e4b119d05d31cd5fd00010b1cbcbad09df7edcebe79a913033895c66686f078402893059e4a986fb76d28e89324f5b04ead2c2aa0a05786faa1e8f66fbaf66b7ca94bf52123e6afe4dab54bc33e5860e8766031dd256edf40b294f55062e613cafac04f77e284f5097e88cd7aaf46fd28f4fc24ef1ec1aa0bebbb3da5b504e4dca8dfc13ed99e4371dea6f3bc0f78cdf6ff47548e5a426c92095da045e5ccf45f446116e2c9567ed01d62c1fd3a78c62aa359118f77705174db6a4faacaa0b6d49b4da38e42b20e9cd2ed7979a0f6da28964e0b3fb755046f0a5477dda7465e00d13c8751c36255b7f922dbfe108a14e359257ad607dd7e1c9ccf330779135714b01746a25ddd11e565c821713c8702e50956f6f6ed9c283cfdd08938c8ccf08ada04309e47fe9ddf5cf5dc00fd0001f5e2772a310c56c1343104f8f618a6408dbdd5e421e31856f271fb33329d5055c4c73e06870feb8f7b298cb9b403dd6c4e87dd2137ac84df583c58ffd627b0c52996bea39da5959ccce7968455d3b4ac512c3d552cf63f2da74d6de8e8f037eca47a715d0d9398502b287e5f1034e536a84839bac21ae9958da81fe54c67165fc650f19679c9a628b74fb40c65257dc5b50f690263f9c1eaf41c3365c0e23f91aa7ade32a352c8b88b40b2d7acabbd085185f7737be6f5a7c342e2c908e8a4f997ec949e4bfd6ca7b3da894fd4581c81141cbfc01afc3eb86bc91c304c18c1dccde49d8b61e41d922fcb02162e444dd4931a076bb072ee3a6d5cebbe8683e992fd0001197c654987867c3fa8c71ce3718a70756063be0179e55bf302daafbbdfdd5669ec38e140e3204b260b1d54373f84657101147e672120d735c179fe2dc5fdf7dbb8aadee63b867e31d9d1242e45bd23ed510dc7a6d44ea7806159895a2293c0898bfa6d0018d9864f584a59003a8d4e3a38eae3ec7c9e35d1e5985acd544547ccc1e31024f05bfd5dc07ccbf535b2e0a0a703548e355eb9d1acd8a59684ba0fb674075011c7be7cc899c30ea6c1df0dc34c9366f47743aa12991192cc836db7fd5a3b0306d6905a82e13b729038c70fd3bea01def02b93cd2e71439a9fdd5fb93da6a72436ce9f5b431b7e18c76d8173964d5a02e24195e761d888a6a2532d785fd000177fcd4e94194a3c34efea9f8f04faccbdeae9f0eb8662b0195db08e2b41a08fed52ab7060465ecebdb2eeed7a768c4f65ed7b5193151a56c752cdf97cd4c6be8daf95c16c6703ec95b6cb541506c715983be6384031685d48190e611ddbded6fa377affb759a1f289523e56761857afb3c33b68f743c59a6bf2098a2f5bf3c1c8a3d41224dd12ef247874ff5ab6257cc3e29a65a1c16f3ecc26108142d1899a340be3db55556258a348f51ef61e8e73fa9db743f08df3d31919f2d9484603f0281422c2cfbd66959dc138c2176d6e242a5a04d5b1cbd8c39ed051486869f8b0f3ecdaf42498be6016dc9d49ae52220612a32f50259fb9a8be0cab88deafd56b12024a02c37de6161be5eee8cf63c3b0d16d0bdca07ad59fa0532678b864c13bc20c87f061046d5218e768801c69818dadd24e62aa4625d5a2af09b08f9eba8efb5e29fc2977184990fcd81a0a3f896691051da425d7b99292d8ad7a3bbae5ed9503c5b761907097dd6457a5444b9c85ccc829d5901d46cd917ead52a3316f96588a7b508501be9f69c73d97e0db9d615f20e50712f377663f6c47f42d005db72b225048abeb8d6e3a60afbe21cd13d4539b7d39806952d745a7c49a552175135d840a3f9b9e9ef6ba3c46e9f4bd42f9bbde0d5d5abda8cf06538d3492aa856d8708285c0aa99567adaf6e0d4b28feec0a55e49879ac8ee966e4520e5eeae3e6b4473cb710b4213973850ea6ff0331b04ccffab2c2c3f55ff28b8bdf644e4c19982916d01e28d745302b079066c61fc0e8e1c90931f122893f7f5eb86e9111f98cf36e719129668dcc4718c52d0c4c6a1a941b939e5e744d61aa9fb1aed6eca5fe062cd109b15abfc5851ff77c026e9ba7023b298d40acb1ae9884671ff1776aedabd859f2a481eb18b963afae2e2ec41e3f3671e9dfaeab234d6aaf97249f4702e706437d8e36f517b3b227bae68b79064a3fbe999bc2d75912d970826908dc17b815ec0f030e20b24f17c527557e36695abd05f67c60475a0c74aff42b5e7fd13efc3b1c3bf5ae6e3251731ffaad110c4210c9d6d78d69d6f68cc31ca99fe783a12fca506af01e28234f01e1b30dcdccdfbe696bd5703ddbf0554c8c4863edb0f252e2a9daa54d4900d8fd6aef61b8a8f1e165eea79a3f20663b08722762f2c548e0cd10cf0d2d8e8b9239b638d02c49749d55b721a6c81d2554b51b49191518150664b7e4dbde3ae02b36ab3ec9250290c8cee6b7371e0d3c7ad64d267cf463c4c82cc5a325aa72461345c4f45c8753de23bc148527b0e982511bed9e4bcd4cc37e1e3b5089373fcbfbef9a111c96cc79e9f37d619c0d68598541f2a37ea0fd614ca310c915c0d412d2eeee8f7d71e4a250bcc60d68ab3f296a5f75d75d627e5913aedf3646f733701218878049c420ce0089ded11b087f16111e397d0f2e354f1df0a858aaf07eeb8e80002210305cf1786fa950ae9b553390d6d62e2b285ebaeb978822439e0922403f9cc7dbc473045022100b807fa7bc196a7b2d7a3000e5e1870e2ff488bfd6e2850aeaefb3c606f28379e022009c3cec446550e5cb04483404a677c4b8406d85c62cb4d714e5ca3a50aa02f260028e8073a460a05174876e8001a1976a914dbe6d470fa9fe4d037043533eff4f80aeef0c8d288ac222244524271336345713233515955416d48736f634336664452764a453753723548455a" ) func init() { diff --git a/bchain/coins/polygon/polygonrpc.go b/bchain/coins/polygon/polygonrpc.go new file mode 100644 index 0000000000..8ef914143b --- /dev/null +++ b/bchain/coins/polygon/polygonrpc.go @@ -0,0 +1,75 @@ +package polygon + +import ( + "context" + "encoding/json" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" +) + +const ( + // MainNet is production network + MainNet eth.Network = 137 +) + +// PolygonRPC is an interface to JSON-RPC polygon service. +type PolygonRPC struct { + *eth.EthereumRPC +} + +// NewPolygonRPC returns new PolygonRPC instance. +func NewPolygonRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error) { + c, err := eth.NewEthereumRPC(config, pushHandler) + if err != nil { + return nil, err + } + + s := &PolygonRPC{ + EthereumRPC: c.(*eth.EthereumRPC), + } + + return s, nil +} + +// Initialize polygon rpc interface +func (b *PolygonRPC) Initialize() error { + b.OpenRPC = eth.OpenRPC + + rc, ec, err := b.OpenRPC(b.ChainConfig.RPCURL) + if err != nil { + return err + } + + // set chain specific + b.Client = ec + b.RPC = rc + b.MainNetChainID = MainNet + b.NewBlock = eth.NewEthereumNewBlock() + b.NewTx = eth.NewEthereumNewTx() + + ctx, cancel := context.WithTimeout(context.Background(), b.Timeout) + defer cancel() + + id, err := b.Client.NetworkID(ctx) + if err != nil { + return err + } + + // parameters for getInfo request + switch eth.Network(id.Uint64()) { + case MainNet: + b.Testnet = false + b.Network = "livenet" + default: + return errors.Errorf("Unknown network id %v", id) + } + + b.InitAlternativeProviders() + + glog.Info("rpc: block chain ", b.Network) + + return nil +} diff --git a/bchain/coins/qtum/qtumparser.go b/bchain/coins/qtum/qtumparser.go index d6f2496543..8bc2d5e943 100644 --- a/bchain/coins/qtum/qtumparser.go +++ b/bchain/coins/qtum/qtumparser.go @@ -40,14 +40,16 @@ func init() { // QtumParser handle type QtumParser struct { - *btc.BitcoinLikeParser + *btc.BitcoinParser } // NewQtumParser returns new DashParser instance func NewQtumParser(params *chaincfg.Params, c *btc.Configuration) *QtumParser { - return &QtumParser{ - BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c), + p := &QtumParser{ + BitcoinParser: btc.NewBitcoinParser(params, c), } + p.VSizeSupport = false + return p } // GetChainParams contains network parameters for the main Qtum network, diff --git a/bchain/coins/ravencoin/ravencoinparser_test.go b/bchain/coins/ravencoin/ravencoinparser_test.go index 4dbefebc69..dafa126b99 100644 --- a/bchain/coins/ravencoin/ravencoinparser_test.go +++ b/bchain/coins/ravencoin/ravencoinparser_test.go @@ -74,10 +74,10 @@ func Test_GetAddrDescFromAddress_Mainnet(t *testing.T) { var ( testTx1 bchain.Tx - testTxPacked1 = "0a20d4d3a093586eae0c3668fd288d9e24955928a894c20b551b38dd18c99b123a7c12e1010200000001c171348ffc8976074fa064e48598a816fce3798afc635fb67d99580e50b8e614000000006a473044022009e07574fa543ad259bd3334eb365c655c96d310c578b64c24d7f77fa7dc591c0220427d8ae6eacd1ca2d1994e9ec49cb322aacdde98e4bdb065e0fce81162fb3aa9012102d46827546548b9b47ae1e9e84fc4e53513e0987eeb1dd41220ba39f67d3bf46affffffff02f8137114000000001976a914587a2afa560ccaeaeb67cb72a0db7e2573a179e488ace0c48110000000001976a914d85e6ab66ab0b2c4cfd40ca3b0a779529da5799288ac0000000018c7e1b3e5052000288491283298010a00122014e6b8500e58997db65f63fc8a79e3fc16a89885e464a04f077689fc8f3471c11800226a473044022009e07574fa543ad259bd3334eb365c655c96d310c578b64c24d7f77fa7dc591c0220427d8ae6eacd1ca2d1994e9ec49cb322aacdde98e4bdb065e0fce81162fb3aa9012102d46827546548b9b47ae1e9e84fc4e53513e0987eeb1dd41220ba39f67d3bf46a28ffffffff0f3a470a04147113f810001a1976a914587a2afa560ccaeaeb67cb72a0db7e2573a179e488ac222252484d31746d64766b6b3776446f69477877554a414d4e4e6d447179775a3574456e3a470a041081c4e010011a1976a914d85e6ab66ab0b2c4cfd40ca3b0a779529da5799288ac2222525631463939623955424272434d38614e4b7567737173444d3869716f4371374d744002" + testTxPacked1 = "0a20d4d3a093586eae0c3668fd288d9e24955928a894c20b551b38dd18c99b123a7c12e1010200000001c171348ffc8976074fa064e48598a816fce3798afc635fb67d99580e50b8e614000000006a473044022009e07574fa543ad259bd3334eb365c655c96d310c578b64c24d7f77fa7dc591c0220427d8ae6eacd1ca2d1994e9ec49cb322aacdde98e4bdb065e0fce81162fb3aa9012102d46827546548b9b47ae1e9e84fc4e53513e0987eeb1dd41220ba39f67d3bf46affffffff02f8137114000000001976a914587a2afa560ccaeaeb67cb72a0db7e2573a179e488ace0c48110000000001976a914d85e6ab66ab0b2c4cfd40ca3b0a779529da5799288ac0000000018c7e1b3e50528849128329401122014e6b8500e58997db65f63fc8a79e3fc16a89885e464a04f077689fc8f3471c1226a473044022009e07574fa543ad259bd3334eb365c655c96d310c578b64c24d7f77fa7dc591c0220427d8ae6eacd1ca2d1994e9ec49cb322aacdde98e4bdb065e0fce81162fb3aa9012102d46827546548b9b47ae1e9e84fc4e53513e0987eeb1dd41220ba39f67d3bf46a28ffffffff0f3a450a04147113f81a1976a914587a2afa560ccaeaeb67cb72a0db7e2573a179e488ac222252484d31746d64766b6b3776446f69477877554a414d4e4e6d447179775a3574456e3a470a041081c4e010011a1976a914d85e6ab66ab0b2c4cfd40ca3b0a779529da5799288ac2222525631463939623955424272434d38614e4b7567737173444d3869716f4371374d744002" testTx2 bchain.Tx - testTxPacked2 = "0a208e480d5c1bf7f11d1cbe396ab7dc14e01ea4e1aff45de7c055924f61304ad43412f40202000000029e2e14113b2f55726eebaa440edec707fcec3a31ce28fa125afea1e755fb6850010000006a47304402204034c3862f221551cffb2aa809f621f989a75cdb549c789a5ceb3a82c0bcc21c022001b4638f5d73fdd406a4dd9bf99be3dfca4a572b8f40f09b8fd495a7756c0db70121027a32ef45aef2f720ccf585f6fb0b8a7653db89cacc3320e5b385146851aba705fefffffff3b240ae32c542786876fcf23b4b2ab4c34ef077912898ee529756ed4ba35910000000006a47304402204d442645597b13abb85e96e5acd34eff50a4418822fe6a37ed378cdd24574dff02205ae667c56eab63cc45a51063f15b72136fd76e97c46af29bd28e8c4d405aa211012102cde27d7b29331ea3fef909a8d91f6f7753e99a3dd129914be50df26eed73fab3feffffff028447bf38000000001976a9146d7badec5426b880df25a3afc50e476c2423b34b88acb26b556a740000001976a914b3020d0ab85710151fa509d5d9a4e783903d681888ac83080a0018c7e1b3e50520839128288491283298010a0012205068fb55e7a1fe5a12fa28ce313aecfc07c7de0e44aaeb6e72552f3b11142e9e1801226a47304402204034c3862f221551cffb2aa809f621f989a75cdb549c789a5ceb3a82c0bcc21c022001b4638f5d73fdd406a4dd9bf99be3dfca4a572b8f40f09b8fd495a7756c0db70121027a32ef45aef2f720ccf585f6fb0b8a7653db89cacc3320e5b385146851aba70528feffffff0f3298010a0012201059a34bed569752ee98289177f04ec3b42a4b3bf2fc76687842c532ae40b2f31800226a47304402204d442645597b13abb85e96e5acd34eff50a4418822fe6a37ed378cdd24574dff02205ae667c56eab63cc45a51063f15b72136fd76e97c46af29bd28e8c4d405aa211012102cde27d7b29331ea3fef909a8d91f6f7753e99a3dd129914be50df26eed73fab328feffffff0f3a470a0438bf478410001a1976a9146d7badec5426b880df25a3afc50e476c2423b34b88ac2222524b4735747057776a6874716464546741335168556837516d4b637576426e6842583a480a05746a556bb210011a1976a914b3020d0ab85710151fa509d5d9a4e783903d681888ac222252526268564d624c6675657a485077554d756a546d4446417a76363459396d4a71644002" + testTxPacked2 = "0a208e480d5c1bf7f11d1cbe396ab7dc14e01ea4e1aff45de7c055924f61304ad43412f40202000000029e2e14113b2f55726eebaa440edec707fcec3a31ce28fa125afea1e755fb6850010000006a47304402204034c3862f221551cffb2aa809f621f989a75cdb549c789a5ceb3a82c0bcc21c022001b4638f5d73fdd406a4dd9bf99be3dfca4a572b8f40f09b8fd495a7756c0db70121027a32ef45aef2f720ccf585f6fb0b8a7653db89cacc3320e5b385146851aba705fefffffff3b240ae32c542786876fcf23b4b2ab4c34ef077912898ee529756ed4ba35910000000006a47304402204d442645597b13abb85e96e5acd34eff50a4418822fe6a37ed378cdd24574dff02205ae667c56eab63cc45a51063f15b72136fd76e97c46af29bd28e8c4d405aa211012102cde27d7b29331ea3fef909a8d91f6f7753e99a3dd129914be50df26eed73fab3feffffff028447bf38000000001976a9146d7badec5426b880df25a3afc50e476c2423b34b88acb26b556a740000001976a914b3020d0ab85710151fa509d5d9a4e783903d681888ac83080a0018c7e1b3e505208391282884912832960112205068fb55e7a1fe5a12fa28ce313aecfc07c7de0e44aaeb6e72552f3b11142e9e1801226a47304402204034c3862f221551cffb2aa809f621f989a75cdb549c789a5ceb3a82c0bcc21c022001b4638f5d73fdd406a4dd9bf99be3dfca4a572b8f40f09b8fd495a7756c0db70121027a32ef45aef2f720ccf585f6fb0b8a7653db89cacc3320e5b385146851aba70528feffffff0f32940112201059a34bed569752ee98289177f04ec3b42a4b3bf2fc76687842c532ae40b2f3226a47304402204d442645597b13abb85e96e5acd34eff50a4418822fe6a37ed378cdd24574dff02205ae667c56eab63cc45a51063f15b72136fd76e97c46af29bd28e8c4d405aa211012102cde27d7b29331ea3fef909a8d91f6f7753e99a3dd129914be50df26eed73fab328feffffff0f3a450a0438bf47841a1976a9146d7badec5426b880df25a3afc50e476c2423b34b88ac2222524b4735747057776a6874716464546741335168556837516d4b637576426e6842583a480a05746a556bb210011a1976a914b3020d0ab85710151fa509d5d9a4e783903d681888ac222252526268564d624c6675657a485077554d756a546d4446417a76363459396d4a71644002" ) func init() { diff --git a/bchain/coins/snowgem/snowgemparser_test.go b/bchain/coins/snowgem/snowgemparser_test.go index 2d8068f110..e6cac14357 100644 --- a/bchain/coins/snowgem/snowgemparser_test.go +++ b/bchain/coins/snowgem/snowgemparser_test.go @@ -19,8 +19,8 @@ import ( var ( testTx1, testTx2 bchain.Tx - testTxPacked1 = "0a20241803e368d7459f31286a155191ee386896d366d57c19d8e67a8f040d6ff71f12f4010400008085202f890119950c49d69b37d5f4fbb390d852387559e6a6d3fce9f390a409e4acf3f06381020000006a4730440220452aedf599e575598eb36d27ed98a6d388efda6e9be2bab96f16d0644e7df3060220669f4f3a4976ed73fa3ca9ecaad84dcf6ec35099c3bad631499985ea6a378d19012102ed9fb7fb61ec514be890ab45a925d554ff12050f099514251d5ebe904accc93ffeffffff02d3d0a146000000001976a9141a78c04d87f553545ba225b7bc7a271731f659d688ac7c54ae02000000001976a914b86f4b063545ebc2e80522a59d2dd206b707401b88aca68d0e00c58d0e00000000000000000000000018aba4b8ed0520a69b3a28b19b3a3298010a0012208163f0f3ace409a490f3e9fcd3a6e659753852d890b3fbf4d5379bd6490c95191802226a4730440220452aedf599e575598eb36d27ed98a6d388efda6e9be2bab96f16d0644e7df3060220669f4f3a4976ed73fa3ca9ecaad84dcf6ec35099c3bad631499985ea6a378d19012102ed9fb7fb61ec514be890ab45a925d554ff12050f099514251d5ebe904accc93f28feffffff0f3a480a0446a1d0d310001a1976a9141a78c04d87f553545ba225b7bc7a271731f659d688ac2223733150636953644665724a78665673397451353571446f3839695676466f7162436a7a3a480a0402ae547c10011a1976a914b86f4b063545ebc2e80522a59d2dd206b707401b88ac22237331653177736d6f7955625673794b726745374b73714c5164374c69755961685261524000" - testTxPacked2 = "0a2071dd4d998b0a711fe5ed21f8661ed27ca8b99afc488f5bbe149ec3c6492ec50312d2010400008085202f89017308714b21338783a435c5e420542a0f6243da5be6dc8bdf19e2d526a318d6a8000000006a47304402207ce5ebcb2dc5e8027b5d672babd2e6aaa186a917caf2b44eec63f7db16277b8b02207a89214d825fae08ebc86bca1f46579e770e830bd31b8101498207a2d901fd74012103c3fe8969a7b08f1d586a68da70d6aeff61aa3b4cbe7ca2cb5aae11529ca2af12feffffff014dd45023000000001976a914cef34ec02e80351cf4f9d63843fc79a77c9ab71888acaa8d0e00c98d0e00000000000000000000000018f9a6b8ed0520aa9b3a28b59b3a3298010a001220a8d618a326d5e219df8bdce65bda43620f2a5420e4c535a4838733214b7108731800226a47304402207ce5ebcb2dc5e8027b5d672babd2e6aaa186a917caf2b44eec63f7db16277b8b02207a89214d825fae08ebc86bca1f46579e770e830bd31b8101498207a2d901fd74012103c3fe8969a7b08f1d586a68da70d6aeff61aa3b4cbe7ca2cb5aae11529ca2af1228feffffff0f3a480a042350d44d10001a1976a914cef34ec02e80351cf4f9d63843fc79a77c9ab71888ac2223733167347a74585446447751326b506253385431666755334c645075666376354d764d4000" + testTxPacked1 = "0a20241803e368d7459f31286a155191ee386896d366d57c19d8e67a8f040d6ff71f12f4010400008085202f890119950c49d69b37d5f4fbb390d852387559e6a6d3fce9f390a409e4acf3f06381020000006a4730440220452aedf599e575598eb36d27ed98a6d388efda6e9be2bab96f16d0644e7df3060220669f4f3a4976ed73fa3ca9ecaad84dcf6ec35099c3bad631499985ea6a378d19012102ed9fb7fb61ec514be890ab45a925d554ff12050f099514251d5ebe904accc93ffeffffff02d3d0a146000000001976a9141a78c04d87f553545ba225b7bc7a271731f659d688ac7c54ae02000000001976a914b86f4b063545ebc2e80522a59d2dd206b707401b88aca68d0e00c58d0e00000000000000000000000018aba4b8ed0520a69b3a28b19b3a32960112208163f0f3ace409a490f3e9fcd3a6e659753852d890b3fbf4d5379bd6490c95191802226a4730440220452aedf599e575598eb36d27ed98a6d388efda6e9be2bab96f16d0644e7df3060220669f4f3a4976ed73fa3ca9ecaad84dcf6ec35099c3bad631499985ea6a378d19012102ed9fb7fb61ec514be890ab45a925d554ff12050f099514251d5ebe904accc93f28feffffff0f3a460a0446a1d0d31a1976a9141a78c04d87f553545ba225b7bc7a271731f659d688ac2223733150636953644665724a78665673397451353571446f3839695676466f7162436a7a3a480a0402ae547c10011a1976a914b86f4b063545ebc2e80522a59d2dd206b707401b88ac22237331653177736d6f7955625673794b726745374b73714c5164374c6975596168526152" + testTxPacked2 = "0a2071dd4d998b0a711fe5ed21f8661ed27ca8b99afc488f5bbe149ec3c6492ec50312d2010400008085202f89017308714b21338783a435c5e420542a0f6243da5be6dc8bdf19e2d526a318d6a8000000006a47304402207ce5ebcb2dc5e8027b5d672babd2e6aaa186a917caf2b44eec63f7db16277b8b02207a89214d825fae08ebc86bca1f46579e770e830bd31b8101498207a2d901fd74012103c3fe8969a7b08f1d586a68da70d6aeff61aa3b4cbe7ca2cb5aae11529ca2af12feffffff014dd45023000000001976a914cef34ec02e80351cf4f9d63843fc79a77c9ab71888acaa8d0e00c98d0e00000000000000000000000018f9a6b8ed0520aa9b3a28b59b3a3294011220a8d618a326d5e219df8bdce65bda43620f2a5420e4c535a4838733214b710873226a47304402207ce5ebcb2dc5e8027b5d672babd2e6aaa186a917caf2b44eec63f7db16277b8b02207a89214d825fae08ebc86bca1f46579e770e830bd31b8101498207a2d901fd74012103c3fe8969a7b08f1d586a68da70d6aeff61aa3b4cbe7ca2cb5aae11529ca2af1228feffffff0f3a460a042350d44d1a1976a914cef34ec02e80351cf4f9d63843fc79a77c9ab71888ac2223733167347a74585446447751326b506253385431666755334c645075666376354d764d" ) func init() { diff --git a/bchain/coins/vertcoin/vertcoinparser.go b/bchain/coins/vertcoin/vertcoinparser.go index 35d6f830d0..6bde1b56b7 100644 --- a/bchain/coins/vertcoin/vertcoinparser.go +++ b/bchain/coins/vertcoin/vertcoinparser.go @@ -35,12 +35,14 @@ func init() { // VertcoinParser handle type VertcoinParser struct { - *btc.BitcoinLikeParser + *btc.BitcoinParser } // NewVertcoinParser returns new VertcoinParser instance func NewVertcoinParser(params *chaincfg.Params, c *btc.Configuration) *VertcoinParser { - return &VertcoinParser{BitcoinLikeParser: btc.NewBitcoinLikeParser(params, c)} + p := &VertcoinParser{BitcoinParser: btc.NewBitcoinParser(params, c)} + p.VSizeSupport = true + return p } // GetChainParams contains network parameters for the main Vertcoin network, diff --git a/bchain/coins/vertcoin/vertcoinparser_test.go b/bchain/coins/vertcoin/vertcoinparser_test.go index aec4cbcc40..ce1cbd672f 100644 --- a/bchain/coins/vertcoin/vertcoinparser_test.go +++ b/bchain/coins/vertcoin/vertcoinparser_test.go @@ -90,6 +90,7 @@ func init() { Blocktime: 1529925180, Txid: "d58c11aa970449c3e0ee5e0cdf78532435a9d2b28a2da284a8dd4dd6bdd0331c", LockTime: 952180, + VSize: 223, Version: 1, Vin: []bchain.Vin{ { diff --git a/bchain/coins/vipstarcoin/vipstarcoinparser_test.go b/bchain/coins/vipstarcoin/vipstarcoinparser_test.go index 5ab6403182..83f215724f 100644 --- a/bchain/coins/vipstarcoin/vipstarcoinparser_test.go +++ b/bchain/coins/vipstarcoin/vipstarcoinparser_test.go @@ -294,6 +294,10 @@ func Test_UnpackTx(t *testing.T) { t.Errorf("unpackTx() error = %v, wantErr %v", err, tt.wantErr) return } + // ignore witness unpacking + for i := range got.Vin { + got.Vin[i].Witness = nil + } if !reflect.DeepEqual(got, tt.want) { t.Errorf("unpackTx() got = %v, want %v", got, tt.want) } diff --git a/bchain/coins/zec/zcashparser_test.go b/bchain/coins/zec/zcashparser_test.go index 9e4758ca78..2dee9c66a8 100644 --- a/bchain/coins/zec/zcashparser_test.go +++ b/bchain/coins/zec/zcashparser_test.go @@ -18,8 +18,8 @@ import ( var ( testTx1, testTx2 bchain.Tx - testTxPacked1 = "0a20e64aac0c211ad210c90934f06b1cc932327329e41a9f70c6eb76f79ef798b7b812ab1002000000019c012650c99d0ef761e863dbb966babf2cb7a7a2b5d90b1461c09521c473d23d000000006b483045022100f220f48c5267ef92a1e7a4d3b44fe9d97cce76eeba2785d45a0e2620b70e8d7302205640bc39e197ce19d95a98a3239af0f208ca289c067f80c97d8e411e61da5dee0121021721e83315fb5282f1d9d2a11892322df589bccd9cef45517b5fb3cfd3055c83ffffffff018eec1a3c040000001976a9149bb8229741305d8316ba3ca6a8d20740ce33c24188ac000000000162b4fc6b0000000000000000000000006ffa88c89b74f0f82e24744296845a0d0113b132ff5dfc2af34e6418eb15206af53078c4dd475cf143cd9a427983f5993622464b53e3a37d2519a946492c3977e30f0866550b9097222993a439a39260ac5e7d36aef38c7fdd1df3035a2d5817a9c20526e38f52f822d4db9d2f0156c4119d786d6e3a060ca871df7fae9a5c3a9c921b38ddc6414b13d16aa807389c68016e54bd6a9eb3b23a6bc7bf152e6dba15e9ec36f95dab15ad8f4a92a9d0309bbd930ef24bb7247bf534065c1e2f5b42e2c80eb59f48b4da6ec522319e065f8c4e463f95cc7fcad8d7ee91608e3c0ffcaa44129ba2d2da45d9a413919eca41af29faaf806a3eeb823e5a6c51afb1ec709505d812c0306bd76061a0a62d207355ad44d1ffce2b9e1dfd0818f79bd0f8e4031116b71fee2488484f17818b80532865773166cd389929e8409bb94e3948bd2e0215ef96d4e29d094590fda0de50715c11ff47c03380bb1d31b14e5b4ad8a372ca0b03364ef85f086b8a8eb5c56c3b1aee33e2cfbf1b2be1a3fb41b14b2c432b5d04d54c058fa87a96ae1d65d61b79360d09acc1e25a883fd7ae9a2a734a03362903021401c243173e1050b5cdb459b9ffc07c95e920f026618952d3a800b2e47e03b902084aed7ee8466a65d34abdbbd292781564dcd9b7440029d48c2640ebc196d4b40217f2872c1d0c1c9c2abf1147d6a5a9501895bc92960bfa182ceeb76a658224f1022bc53c4c1cd6888d72a152dc1aec5ba8a1d750fb7e498bee844d3481e4b4cd210227f94f775744185c9f24571b7df0c1c694cb2d3e4e9b955ed0b1caad2b02b5702139c4fbba03f0e422b2f3e4fc822b4f58baf32e7cd217cdbdec8540cb13d6496f271959b72a05e130eeffbe5b9a7fcd2793347cd9c0ea695265669844c363190f690c52a600cf413c3f00bdc5e9d1539e0cc63f4ec2945e0d86e6304a6deb5651e73eac21add5a641dfc95ab56200ed40d81f76755aee4659334c17ed3841ca5a5ab22f923956be1d264be2b485a0de55404510ece5c73d6626798be688f9dc18b69846acfe897a357cc4afe31f57fea32896717f124290e68f36f849fa6ecf76e02087f8c19dbc566135d7fa2daca2d843b9cc5bc3897d35f1de7d174f6407658f4a3706c12cea53d880b4d8c4d45b3f0d210214f815be49a664021a4a44b4a63e06a41d76b46f9aa6bad248e8d1a974ae7bbae5ea8ac269447db91637a19346729083cad5aebd5ff43ea13d04783068e9136da321b1152c666d2995d0ca06b26541deac62f4ef91f0e4af445b18a5c2a17c96eada0b27f85bb26dfb8f16515114c6b9f88037e2b85b3b84b65822eb99c992d99d12dcf9c71e5b46a586016faf5758483a716566db95b42187c101df68ca0554824e1c23cf0302bea03ad0a146af57e91794a268b8c82d78211718c8b5fea286f5de72fc7dfffecddcc02413525c472cb26022641d4bec2b8b7e71a7beb9ee18b82632799498eeee9a351cb9431a8d1906d5164acdf351bd538c3e9d1da8a211fe1cd18c44e72d8cdf16ce3fc9551552c05d52846ea7ef619232102588395cc2bcce509a4e7f150262a76c15475496c923dfce6bfc05871467ee7c213b39ea365c010083e0b1ba8926d3a9e586d8b11c9bab2a47d888bc7cb1a226c0086a1530e295d0047547006f4c8f1c24cdd8e16bb3845749895dec95f03fcda97d3224f6875b1b7b1c819d2fd35dd30968a3c82bc480d10082caf9d9dda8f9ec649c136c7fa07978099d97eaf4abfdc9854c266979d3cfc868f60689b6e3098b6c52a21796fe7c259d9a0dadf1b6efa59297d4c8c902febe7acf826eed30d40d2ac5119be91b51f4839d94599872c9a93c3e2691294914034001d3a278cb4a84d4ae048c0201a97e4cf1341ee663a162f5b586355018b9e5e30624ccdbeacf7d0382afacaf45f08e84d30c50bcd4e55c3138377261deb4e8c2931cd3c51cee94a048ae4839517b6e6537a5c0148d3830a33fea719ef9b4fa437e4d5fecdb646397c19ee56a0973c362a81803895cdc67246352dc566689cb203f9ebda900a5537bbb75aa25ddf3d4ab87b88737a58d760e1d271f08265daae1fe056e71971a8b826e5b215a05b71f99315b167dd2ec78874189657acafac2b5eeb9a901913f55f7ab69e1f9b203504448d414e71098b932a2309db57257eb3fef9de2f2a5a69aa46747d7b827df838345d38b95772bdab8c178c45777b92e8773864964b8e12ae29dbc1b21bf6527589f6bec71ff1cbb9928477409811c2e8150c79c3f21027ee954863b716875d3e9adfc6fdb18cd57a49bb395ca5c42da56f3beb78aad3a7a487de34a870bca61f3cdec422061328c83c910ab32ea7403c354915b7ebee29e1fea5a75158197e4a68e103f017fd7de5a70148ee7ce59356b1a74f83492e14faaa6cd4870bcc004e6eb0114d3429b74ea98fe2851b4553467a7660074e69b040aa31220d0e405d9166dbaf15e3ae2d8ec3b049ed99d17e0743bb6a1a7c3890bbdb7117f7374ad7a59aa1ab47d10445b28f4bc033794a71f88a8bf024189e9d27f9dc5859a4296437585b215656f807aca9dad35747494a43b8a1cf38be2b18a13de32a262ab29f9ba271c4fbce1a470a8243ebf9e7fd37b09262314afbb9a7e180218a0f1c9d505200028b0eb113299010a0012203dd273c42195c061140bd9b5a2a7b72cbfba66b9db63e861f70e9dc95026019c1800226b483045022100f220f48c5267ef92a1e7a4d3b44fe9d97cce76eeba2785d45a0e2620b70e8d7302205640bc39e197ce19d95a98a3239af0f208ca289c067f80c97d8e411e61da5dee0121021721e83315fb5282f1d9d2a11892322df589bccd9cef45517b5fb3cfd3055c8328ffffffff0f3a490a05043c1aec8e10001a1976a9149bb8229741305d8316ba3ca6a8d20740ce33c24188ac222374315934794c31344143486141626a656d6b647057376e594e48576e763179516244414000" - testTxPacked2 = "0a20bb47a9dd926de63e9d4f8dac58c3f63f4a079569ed3b80e932274a80f60e58b512e20101000000019cafb5c287980e6e5afb47339f6c1c81136d8255f5bd5226b36b01288494c46f000000006b483045022100c92b2f3c54918fa26288530c63a58197ea4974e5b6d92db792dd9717e6d9183c02204e577254213675466a6adad3ae6e9384cf8269fb2dd9943b86fac0c0ad8e3f98012102c99dab469e63b232488b3e7acb9cfcab7e5755f61aad318d9e06b38e5ea22880feffffff0223a7a784010000001976a914826f87806ddd4643730be99b41c98acc379e83db88ac80969800000000001976a914e395634b7684289285926d4c64db395b783720ec88ac6e75040018e4b1c9d50520eeea1128f9ea113299010a0012206fc4948428016bb32652bdf555826d13811c6c9f3347fb5a6e0e9887c2b5af9c1800226b483045022100c92b2f3c54918fa26288530c63a58197ea4974e5b6d92db792dd9717e6d9183c02204e577254213675466a6adad3ae6e9384cf8269fb2dd9943b86fac0c0ad8e3f98012102c99dab469e63b232488b3e7acb9cfcab7e5755f61aad318d9e06b38e5ea2288028feffffff0f3a490a050184a7a72310001a1976a914826f87806ddd4643730be99b41c98acc379e83db88ac22237431566d4854547770457477766f6a786f644e32435351714c596931687a59336341713a470a0398968010011a1976a914e395634b7684289285926d4c64db395b783720ec88ac222374316563784d587070685554525158474c586e56684a367563714433445a69706464674000" + testTxPacked1 = "0a20e64aac0c211ad210c90934f06b1cc932327329e41a9f70c6eb76f79ef798b7b812ab1002000000019c012650c99d0ef761e863dbb966babf2cb7a7a2b5d90b1461c09521c473d23d000000006b483045022100f220f48c5267ef92a1e7a4d3b44fe9d97cce76eeba2785d45a0e2620b70e8d7302205640bc39e197ce19d95a98a3239af0f208ca289c067f80c97d8e411e61da5dee0121021721e83315fb5282f1d9d2a11892322df589bccd9cef45517b5fb3cfd3055c83ffffffff018eec1a3c040000001976a9149bb8229741305d8316ba3ca6a8d20740ce33c24188ac000000000162b4fc6b0000000000000000000000006ffa88c89b74f0f82e24744296845a0d0113b132ff5dfc2af34e6418eb15206af53078c4dd475cf143cd9a427983f5993622464b53e3a37d2519a946492c3977e30f0866550b9097222993a439a39260ac5e7d36aef38c7fdd1df3035a2d5817a9c20526e38f52f822d4db9d2f0156c4119d786d6e3a060ca871df7fae9a5c3a9c921b38ddc6414b13d16aa807389c68016e54bd6a9eb3b23a6bc7bf152e6dba15e9ec36f95dab15ad8f4a92a9d0309bbd930ef24bb7247bf534065c1e2f5b42e2c80eb59f48b4da6ec522319e065f8c4e463f95cc7fcad8d7ee91608e3c0ffcaa44129ba2d2da45d9a413919eca41af29faaf806a3eeb823e5a6c51afb1ec709505d812c0306bd76061a0a62d207355ad44d1ffce2b9e1dfd0818f79bd0f8e4031116b71fee2488484f17818b80532865773166cd389929e8409bb94e3948bd2e0215ef96d4e29d094590fda0de50715c11ff47c03380bb1d31b14e5b4ad8a372ca0b03364ef85f086b8a8eb5c56c3b1aee33e2cfbf1b2be1a3fb41b14b2c432b5d04d54c058fa87a96ae1d65d61b79360d09acc1e25a883fd7ae9a2a734a03362903021401c243173e1050b5cdb459b9ffc07c95e920f026618952d3a800b2e47e03b902084aed7ee8466a65d34abdbbd292781564dcd9b7440029d48c2640ebc196d4b40217f2872c1d0c1c9c2abf1147d6a5a9501895bc92960bfa182ceeb76a658224f1022bc53c4c1cd6888d72a152dc1aec5ba8a1d750fb7e498bee844d3481e4b4cd210227f94f775744185c9f24571b7df0c1c694cb2d3e4e9b955ed0b1caad2b02b5702139c4fbba03f0e422b2f3e4fc822b4f58baf32e7cd217cdbdec8540cb13d6496f271959b72a05e130eeffbe5b9a7fcd2793347cd9c0ea695265669844c363190f690c52a600cf413c3f00bdc5e9d1539e0cc63f4ec2945e0d86e6304a6deb5651e73eac21add5a641dfc95ab56200ed40d81f76755aee4659334c17ed3841ca5a5ab22f923956be1d264be2b485a0de55404510ece5c73d6626798be688f9dc18b69846acfe897a357cc4afe31f57fea32896717f124290e68f36f849fa6ecf76e02087f8c19dbc566135d7fa2daca2d843b9cc5bc3897d35f1de7d174f6407658f4a3706c12cea53d880b4d8c4d45b3f0d210214f815be49a664021a4a44b4a63e06a41d76b46f9aa6bad248e8d1a974ae7bbae5ea8ac269447db91637a19346729083cad5aebd5ff43ea13d04783068e9136da321b1152c666d2995d0ca06b26541deac62f4ef91f0e4af445b18a5c2a17c96eada0b27f85bb26dfb8f16515114c6b9f88037e2b85b3b84b65822eb99c992d99d12dcf9c71e5b46a586016faf5758483a716566db95b42187c101df68ca0554824e1c23cf0302bea03ad0a146af57e91794a268b8c82d78211718c8b5fea286f5de72fc7dfffecddcc02413525c472cb26022641d4bec2b8b7e71a7beb9ee18b82632799498eeee9a351cb9431a8d1906d5164acdf351bd538c3e9d1da8a211fe1cd18c44e72d8cdf16ce3fc9551552c05d52846ea7ef619232102588395cc2bcce509a4e7f150262a76c15475496c923dfce6bfc05871467ee7c213b39ea365c010083e0b1ba8926d3a9e586d8b11c9bab2a47d888bc7cb1a226c0086a1530e295d0047547006f4c8f1c24cdd8e16bb3845749895dec95f03fcda97d3224f6875b1b7b1c819d2fd35dd30968a3c82bc480d10082caf9d9dda8f9ec649c136c7fa07978099d97eaf4abfdc9854c266979d3cfc868f60689b6e3098b6c52a21796fe7c259d9a0dadf1b6efa59297d4c8c902febe7acf826eed30d40d2ac5119be91b51f4839d94599872c9a93c3e2691294914034001d3a278cb4a84d4ae048c0201a97e4cf1341ee663a162f5b586355018b9e5e30624ccdbeacf7d0382afacaf45f08e84d30c50bcd4e55c3138377261deb4e8c2931cd3c51cee94a048ae4839517b6e6537a5c0148d3830a33fea719ef9b4fa437e4d5fecdb646397c19ee56a0973c362a81803895cdc67246352dc566689cb203f9ebda900a5537bbb75aa25ddf3d4ab87b88737a58d760e1d271f08265daae1fe056e71971a8b826e5b215a05b71f99315b167dd2ec78874189657acafac2b5eeb9a901913f55f7ab69e1f9b203504448d414e71098b932a2309db57257eb3fef9de2f2a5a69aa46747d7b827df838345d38b95772bdab8c178c45777b92e8773864964b8e12ae29dbc1b21bf6527589f6bec71ff1cbb9928477409811c2e8150c79c3f21027ee954863b716875d3e9adfc6fdb18cd57a49bb395ca5c42da56f3beb78aad3a7a487de34a870bca61f3cdec422061328c83c910ab32ea7403c354915b7ebee29e1fea5a75158197e4a68e103f017fd7de5a70148ee7ce59356b1a74f83492e14faaa6cd4870bcc004e6eb0114d3429b74ea98fe2851b4553467a7660074e69b040aa31220d0e405d9166dbaf15e3ae2d8ec3b049ed99d17e0743bb6a1a7c3890bbdb7117f7374ad7a59aa1ab47d10445b28f4bc033794a71f88a8bf024189e9d27f9dc5859a4296437585b215656f807aca9dad35747494a43b8a1cf38be2b18a13de32a262ab29f9ba271c4fbce1a470a8243ebf9e7fd37b09262314afbb9a7e180218a0f1c9d50528b0eb1132950112203dd273c42195c061140bd9b5a2a7b72cbfba66b9db63e861f70e9dc95026019c226b483045022100f220f48c5267ef92a1e7a4d3b44fe9d97cce76eeba2785d45a0e2620b70e8d7302205640bc39e197ce19d95a98a3239af0f208ca289c067f80c97d8e411e61da5dee0121021721e83315fb5282f1d9d2a11892322df589bccd9cef45517b5fb3cfd3055c8328ffffffff0f3a470a05043c1aec8e1a1976a9149bb8229741305d8316ba3ca6a8d20740ce33c24188ac222374315934794c31344143486141626a656d6b647057376e594e48576e76317951624441" + testTxPacked2 = "0a20bb47a9dd926de63e9d4f8dac58c3f63f4a079569ed3b80e932274a80f60e58b512e20101000000019cafb5c287980e6e5afb47339f6c1c81136d8255f5bd5226b36b01288494c46f000000006b483045022100c92b2f3c54918fa26288530c63a58197ea4974e5b6d92db792dd9717e6d9183c02204e577254213675466a6adad3ae6e9384cf8269fb2dd9943b86fac0c0ad8e3f98012102c99dab469e63b232488b3e7acb9cfcab7e5755f61aad318d9e06b38e5ea22880feffffff0223a7a784010000001976a914826f87806ddd4643730be99b41c98acc379e83db88ac80969800000000001976a914e395634b7684289285926d4c64db395b783720ec88ac6e75040018e4b1c9d50520eeea1128f9ea1132950112206fc4948428016bb32652bdf555826d13811c6c9f3347fb5a6e0e9887c2b5af9c226b483045022100c92b2f3c54918fa26288530c63a58197ea4974e5b6d92db792dd9717e6d9183c02204e577254213675466a6adad3ae6e9384cf8269fb2dd9943b86fac0c0ad8e3f98012102c99dab469e63b232488b3e7acb9cfcab7e5755f61aad318d9e06b38e5ea2288028feffffff0f3a470a050184a7a7231a1976a914826f87806ddd4643730be99b41c98acc379e83db88ac22237431566d4854547770457477766f6a786f644e32435351714c596931687a59336341713a470a0398968010011a1976a914e395634b7684289285926d4c64db395b783720ec88ac222374316563784d587070685554525158474c586e56684a367563714433445a6970646467" ) func init() { diff --git a/bchain/coins/zec/zcashrpc.go b/bchain/coins/zec/zcashrpc.go index c7f40566de..68ba1481d6 100644 --- a/bchain/coins/zec/zcashrpc.go +++ b/bchain/coins/zec/zcashrpc.go @@ -1,7 +1,11 @@ package zec import ( + "bytes" "encoding/json" + "os/exec" + "reflect" + "strings" "github.com/golang/glog" "github.com/juju/errors" @@ -42,7 +46,7 @@ func NewZCashRPC(config json.RawMessage, pushHandler func(bchain.NotificationTyp z := &ZCashRPC{ BitcoinRPC: b.(*btc.BitcoinRPC), } - z.RPCMarshaler = btc.JSONMarshalerV1{} + z.RPCMarshaler = JSONMarshalerV1Zebra{} z.ChainConfig.SupportsEstimateSmartFee = false return z, nil } @@ -84,13 +88,16 @@ func (z *ZCashRPC) GetChainInfo() (*bchain.ChainInfo, error) { return nil, chainInfo.Error } + // networkinfo not supported by zebra networkInfo := btc.ResGetNetworkInfo{} - err = z.Call(&btc.CmdGetNetworkInfo{Method: "getnetworkinfo"}, &networkInfo) - if err != nil { - return nil, err - } - if networkInfo.Error != nil { - return nil, networkInfo.Error + + zebrad := "zebra" + cmd := exec.Command("/opt/coins/nodes/zcash/bin/zebrad", "--version") + var out bytes.Buffer + cmd.Stdout = &out + err = cmd.Run() + if err == nil { + zebrad = out.String() } return &bchain.ChainInfo{ @@ -100,7 +107,7 @@ func (z *ZCashRPC) GetChainInfo() (*bchain.ChainInfo, error) { Difficulty: string(chainInfo.Result.Difficulty), Headers: chainInfo.Result.Headers, SizeOnDisk: chainInfo.Result.SizeOnDisk, - Version: string(networkInfo.Result.Version), + Version: zebrad, Subversion: string(networkInfo.Result.Subversion), ProtocolVersion: string(networkInfo.Result.ProtocolVersion), Timeoffset: networkInfo.Result.Timeoffset, @@ -111,6 +118,19 @@ func (z *ZCashRPC) GetChainInfo() (*bchain.ChainInfo, error) { // GetBlock returns block with given hash. func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { + type rpcBlock struct { + bchain.BlockHeader + Txs []bchain.Tx `json:"tx"` + } + type resGetBlockV1 struct { + Error *bchain.RPCError `json:"error"` + Result bchain.BlockInfo `json:"result"` + } + type resGetBlockV2 struct { + Error *bchain.RPCError `json:"error"` + Result rpcBlock `json:"result"` + } + var err error if hash == "" && height > 0 { hash, err = z.GetBlockHash(height) @@ -119,40 +139,138 @@ func (z *ZCashRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) { } } - glog.V(1).Info("rpc: getblock (verbosity=1) ", hash) - - res := btc.ResGetBlockThin{} + var rawResponse json.RawMessage + resV2 := resGetBlockV2{} req := btc.CmdGetBlock{Method: "getblock"} req.Params.BlockHash = hash + req.Params.Verbosity = 2 + err = z.Call(&req, &rawResponse) + if err != nil { + // Check if it's a memory error and fall back + errStr := strings.ToLower(err.Error()) + if strings.Contains(errStr, "memory capacity exceeded") || strings.Contains(errStr, "response is too big") { + glog.Warningf("getblock verbosity=2 failed for block %v, falling back to individual tx fetches", hash) + return z.getBlockWithFallback(hash) + } + return nil, errors.Annotatef(err, "hash %v", hash) + } + // hack for ZCash, where the field "valueZat" is used instead of "valueSat" + rawResponse = bytes.ReplaceAll(rawResponse, []byte(`"valueZat"`), []byte(`"valueSat"`)) + err = json.Unmarshal(rawResponse, &resV2) + if err != nil { + return nil, errors.Annotatef(err, "hash %v", hash) + } + + // Check if verbosity=2 returned an RPC error + if resV2.Error != nil { + // Check if error is memory-related (case-insensitive) + errorMsg := strings.ToLower(resV2.Error.Message) + if strings.Contains(errorMsg, "memory capacity exceeded") || strings.Contains(errorMsg, "response is too big") { + glog.Warningf("getblock verbosity=2 returned memory error for block %v, falling back to verbosity=1 + individual tx fetches", hash) + return z.getBlockWithFallback(hash) + } + return nil, errors.Annotatef(resV2.Error, "hash %v", hash) + } + + block := &bchain.Block{ + BlockHeader: resV2.Result.BlockHeader, + Txs: resV2.Result.Txs, + } + + // transactions fetched in block with verbosity 2 do not contain txids, so we need to get it separately + resV1 := resGetBlockV1{} req.Params.Verbosity = 1 - err = z.Call(&req, &res) + err = z.Call(&req, &resV1) + if err != nil { + return nil, errors.Annotatef(err, "hash %v", hash) + } + if resV1.Error != nil { + return nil, errors.Annotatef(resV1.Error, "hash %v", hash) + } + for i := range resV1.Result.Txids { + block.Txs[i].Txid = resV1.Result.Txids[i] + } + return block, nil +} +// getBlockWithFallback fetches block using verbosity=1 and then fetches each transaction individually +func (z *ZCashRPC) getBlockWithFallback(hash string) (*bchain.Block, error) { + type resGetBlockV1 struct { + Error *bchain.RPCError `json:"error"` + Result bchain.BlockInfo `json:"result"` + } + + // Get block header and txids using verbosity=1 + resV1 := resGetBlockV1{} + req := btc.CmdGetBlock{Method: "getblock"} + req.Params.BlockHash = hash + req.Params.Verbosity = 1 + err := z.Call(&req, &resV1) if err != nil { return nil, errors.Annotatef(err, "hash %v", hash) } - if res.Error != nil { - return nil, errors.Annotatef(res.Error, "hash %v", hash) + if resV1.Error != nil { + return nil, errors.Annotatef(resV1.Error, "hash %v", hash) + } + + // Create block with header from verbosity=1 response + block := &bchain.Block{ + BlockHeader: resV1.Result.BlockHeader, + Txs: make([]bchain.Tx, 0, len(resV1.Result.Txids)), } - txs := make([]bchain.Tx, 0, len(res.Result.Txids)) - for _, txid := range res.Result.Txids { + // Fetch each transaction individually + for _, txid := range resV1.Result.Txids { tx, err := z.GetTransaction(txid) if err != nil { - if err == bchain.ErrTxNotFound { - glog.Errorf("rpc: getblock: skipping transanction in block %s due error: %s", hash, err) - continue - } - return nil, err + return nil, errors.Annotatef(err, "failed to fetch tx %v for block %v", txid, hash) } - txs = append(txs, *tx) - } - block := &bchain.Block{ - BlockHeader: res.Result.BlockHeader, - Txs: txs, + block.Txs = append(block.Txs, *tx) } + return block, nil } +// GetTransaction returns a transaction by the transaction ID +func (z *ZCashRPC) GetTransaction(txid string) (*bchain.Tx, error) { + r, err := z.getRawTransaction(txid) + if err != nil { + return nil, err + } + // hack for ZCash, where the field "valueZat" is used instead of "valueSat" + r = bytes.ReplaceAll(r, []byte(`"valueZat"`), []byte(`"valueSat"`)) + tx, err := z.Parser.ParseTxFromJson(r) + if err != nil { + return nil, errors.Annotatef(err, "txid %v", txid) + } + tx.Blocktime = tx.Time + tx.Txid = txid + tx.CoinSpecificData = r + return tx, nil +} + +// getRawTransaction returns json as returned by backend, with all coin specific data +func (z *ZCashRPC) getRawTransaction(txid string) (json.RawMessage, error) { + glog.V(1).Info("rpc: getrawtransaction ", txid) + + res := btc.ResGetRawTransaction{} + req := btc.CmdGetRawTransaction{Method: "getrawtransaction"} + req.Params.Txid = txid + req.Params.Verbose = true + err := z.Call(&req, &res) + + if err != nil { + return nil, errors.Annotatef(err, "txid %v", txid) + } + if res.Error != nil { + if btc.IsMissingTx(res.Error) { + return nil, bchain.ErrTxNotFound + } + return nil, errors.Annotatef(res.Error, "txid %v", txid) + } + return res.Result, nil +} + // GetTransactionForMempool returns a transaction by the transaction ID. // It could be optimized for mempool, i.e. without block time and confirmations func (z *ZCashRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error) { @@ -168,3 +286,72 @@ func (z *ZCashRPC) GetMempoolEntry(txid string) (*bchain.MempoolEntry, error) { func (z *ZCashRPC) GetBlockRaw(hash string) (string, error) { return "", errors.New("GetBlockRaw: not supported") } + +// JSONMarshalerV1 is used for marshalling requests to legacy Bitcoin Type RPC interfaces +type JSONMarshalerV1Zebra struct{} + +// Marshal converts struct passed by parameter to JSON +func (JSONMarshalerV1Zebra) Marshal(v interface{}) ([]byte, error) { + u := cmdUntypedParams{} + + switch v := v.(type) { + case *btc.CmdGetBlock: + u.Method = v.Method + u.Params = append(u.Params, v.Params.BlockHash) + u.Params = append(u.Params, v.Params.Verbosity) + case *btc.CmdGetRawTransaction: + var n int + if v.Params.Verbose { + n = 1 + } + u.Method = v.Method + u.Params = append(u.Params, v.Params.Txid) + u.Params = append(u.Params, n) + default: + { + v := reflect.ValueOf(v).Elem() + + f := v.FieldByName("Method") + if !f.IsValid() || f.Kind() != reflect.String { + return nil, btc.ErrInvalidValue + } + u.Method = f.String() + + f = v.FieldByName("Params") + if f.IsValid() { + var arr []interface{} + switch f.Kind() { + case reflect.Slice: + arr = make([]interface{}, f.Len()) + for i := 0; i < f.Len(); i++ { + arr[i] = f.Index(i).Interface() + } + case reflect.Struct: + arr = make([]interface{}, f.NumField()) + for i := 0; i < f.NumField(); i++ { + arr[i] = f.Field(i).Interface() + } + default: + return nil, btc.ErrInvalidValue + } + u.Params = arr + } + } + } + u.Id = "-" + if u.Params == nil { + u.Params = make([]interface{}, 0) + } + d, err := json.Marshal(u) + if err != nil { + return nil, err + } + + return d, nil +} + +type cmdUntypedParams struct { + Method string `json:"method"` + Id string `json:"id"` + Params []interface{} `json:"params"` +} diff --git a/bchain/evm_interface.go b/bchain/evm_interface.go new file mode 100644 index 0000000000..8eb94f54a1 --- /dev/null +++ b/bchain/evm_interface.go @@ -0,0 +1,81 @@ +package bchain + +import ( + "context" + "fmt" + "math/big" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/rpc" +) + +// EVMClient provides the necessary client functionality for evm chain sync +type EVMClient interface { + NetworkID(ctx context.Context) (*big.Int, error) + HeaderByNumber(ctx context.Context, number *big.Int) (EVMHeader, error) + SuggestGasPrice(ctx context.Context) (*big.Int, error) + EstimateGas(ctx context.Context, msg interface{}) (uint64, error) + BalanceAt(ctx context.Context, addrDesc AddressDescriptor, blockNumber *big.Int) (*big.Int, error) + NonceAt(ctx context.Context, addrDesc AddressDescriptor, blockNumber *big.Int) (uint64, error) +} + +// EVMRPCClient provides the necessary rpc functionality for evm chain sync +type EVMRPCClient interface { + EthSubscribe(ctx context.Context, channel interface{}, args ...interface{}) (EVMClientSubscription, error) + CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error + Close() +} + +// EVMHeader provides access to the necessary header data for evm chain sync +type EVMHeader interface { + Hash() string + Number() *big.Int + Difficulty() *big.Int +} + +// EVMHash provides access to the necessary hash data for evm chain sync +type EVMHash interface { + Hex() string +} + +// EVMClientSubscription provides interaction with an evm client subscription +type EVMClientSubscription interface { + Err() <-chan error + Unsubscribe() +} + +// EVMSubscriber provides interaction with a subscription channel +type EVMSubscriber interface { + Channel() interface{} + Close() +} + +// EVMNewBlockSubscriber provides interaction with a new block subscription channel +type EVMNewBlockSubscriber interface { + EVMSubscriber + Read() (EVMHeader, bool) +} + +// EVMNewBlockSubscriber provides interaction with a new tx subscription channel +type EVMNewTxSubscriber interface { + EVMSubscriber + Read() (EVMHash, bool) +} + +// ToBlockNumArg converts a big.Int to an appropriate string representation of the number if possible +// - valid return values: (hex string, "latest", "pending", "earliest", "finalized", or "safe") +// - invalid return value: "invalid" +func ToBlockNumArg(number *big.Int) string { + if number == nil { + return "latest" + } + if number.Sign() >= 0 { + return hexutil.EncodeBig(number) + } + // It's negative. + if number.IsInt64() { + return rpc.BlockNumber(number.Int64()).String() + } + // It's negative and large, which is invalid. + return fmt.Sprintf("", number) +} diff --git a/bchain/golomb.go b/bchain/golomb.go new file mode 100644 index 0000000000..c0d38e303c --- /dev/null +++ b/bchain/golomb.go @@ -0,0 +1,217 @@ +package bchain + +import ( + "bytes" + "encoding/hex" + + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/martinboehm/btcutil/gcs" +) + +type FilterScriptsType int + +const ( + FilterScriptsInvalid = FilterScriptsType(iota) + FilterScriptsAll + FilterScriptsTaproot + FilterScriptsTaprootNoOrdinals +) + +// GolombFilter is computing golomb filter of address descriptors +type GolombFilter struct { + Enabled bool + UseZeroedKey bool + p uint8 + key string + filterScripts string + filterScriptsType FilterScriptsType + filterData [][]byte + uniqueData map[string]struct{} + // All the unique txids that contain ordinal data + ordinalTxIds map[string]struct{} + // Mapping of txid to address descriptors - only used in case of taproot-noordinals + allAddressDescriptors map[string][]AddressDescriptor +} + +// NewGolombFilter initializes the GolombFilter handler +func NewGolombFilter(p uint8, filterScripts string, key string, useZeroedKey bool) (*GolombFilter, error) { + if p == 0 { + return &GolombFilter{Enabled: false}, nil + } + gf := GolombFilter{ + Enabled: true, + UseZeroedKey: useZeroedKey, + p: p, + key: key, + filterScripts: filterScripts, + filterScriptsType: filterScriptsToScriptsType(filterScripts), + filterData: make([][]byte, 0), + uniqueData: make(map[string]struct{}), + } + // reject invalid filterScripts + if gf.filterScriptsType == FilterScriptsInvalid { + return nil, errors.Errorf("Invalid/unsupported filterScripts parameter %s", filterScripts) + } + // set ordinal-related fields if needed + if gf.ignoreOrdinals() { + gf.ordinalTxIds = make(map[string]struct{}) + gf.allAddressDescriptors = make(map[string][]AddressDescriptor) + } + return &gf, nil +} + +// Gets the M parameter that we are using for the filter +// Currently it relies on P parameter, but that can change +func GetGolombParamM(p uint8) uint64 { + return uint64(1 << uint64(p)) +} + +// Checks whether this input contains ordinal data +func isInputOrdinal(vin Vin) bool { + byte_pattern := []byte{ + 0x00, // OP_0, OP_FALSE + 0x63, // OP_IF + 0x03, // OP_PUSHBYTES_3 + 0x6f, // "o" + 0x72, // "r" + 0x64, // "d" + 0x01, // OP_PUSHBYTES_1 + } + // Witness needs to have at least 3 items and the second one needs to contain certain pattern + return len(vin.Witness) > 2 && bytes.Contains(vin.Witness[1], byte_pattern) +} + +// Whether a transaction contains any ordinal data +func txContainsOrdinal(tx *Tx) bool { + for _, vin := range tx.Vin { + if isInputOrdinal(vin) { + return true + } + } + return false +} + +// Saving all the ordinal-related txIds so we can later ignore their address descriptors +func (f *GolombFilter) markTxAndParentsAsOrdinals(tx *Tx) { + f.ordinalTxIds[tx.Txid] = struct{}{} + for _, vin := range tx.Vin { + f.ordinalTxIds[vin.Txid] = struct{}{} + } +} + +// Adding a new address descriptor mapped to a txid +func (f *GolombFilter) addTxIdMapping(ad AddressDescriptor, tx *Tx) { + f.allAddressDescriptors[tx.Txid] = append(f.allAddressDescriptors[tx.Txid], ad) +} + +// AddAddrDesc adds taproot address descriptor to the data for the filter +func (f *GolombFilter) AddAddrDesc(ad AddressDescriptor, tx *Tx) { + if f.ignoreNonTaproot() && !ad.IsTaproot() { + return + } + if f.ignoreOrdinals() && tx != nil && txContainsOrdinal(tx) { + f.markTxAndParentsAsOrdinals(tx) + return + } + if len(ad) == 0 { + return + } + // When ignoring ordinals, we need to save all the address descriptors before + // filtering out the "invalid" ones. + if f.ignoreOrdinals() && tx != nil { + f.addTxIdMapping(ad, tx) + return + } + f.includeAddrDesc(ad) +} + +// Private function to be called with descriptors that were already validated +func (f *GolombFilter) includeAddrDesc(ad AddressDescriptor) { + s := string(ad) + if _, found := f.uniqueData[s]; !found { + f.filterData = append(f.filterData, ad) + f.uniqueData[s] = struct{}{} + } +} + +// Including all the address descriptors from non-ordinal transactions +func (f *GolombFilter) includeAllAddressDescriptorsOrdinals() { + for txid, ads := range f.allAddressDescriptors { + // Ignoring the txids that contain ordinal data + if _, found := f.ordinalTxIds[txid]; found { + continue + } + for _, ad := range ads { + f.includeAddrDesc(ad) + } + } +} + +// Compute computes golomb filter from the data +func (f *GolombFilter) Compute() []byte { + m := GetGolombParamM(f.p) + + // In case of ignoring the ordinals, we still need to assemble the filter data + if f.ignoreOrdinals() { + f.includeAllAddressDescriptorsOrdinals() + } + + if len(f.filterData) == 0 { + return nil + } + + // Used key is possibly just zeroes, otherwise get it from the supplied key + var key [gcs.KeySize]byte + if f.UseZeroedKey { + key = [gcs.KeySize]byte{} + } else { + b, _ := hex.DecodeString(f.key) + if len(b) < gcs.KeySize { + return nil + } + copy(key[:], b[:gcs.KeySize]) + } + + filter, err := gcs.BuildGCSFilter(f.p, m, key, f.filterData) + if err != nil { + glog.Error("Cannot create golomb filter for ", f.key, ", ", err) + return nil + } + + fb, err := filter.NBytes() + if err != nil { + glog.Error("Error getting NBytes from golomb filter for ", f.key, ", ", err) + return nil + } + + return fb +} + +func (f *GolombFilter) ignoreNonTaproot() bool { + switch f.filterScriptsType { + case FilterScriptsTaproot, FilterScriptsTaprootNoOrdinals: + return true + } + return false +} + +func (f *GolombFilter) ignoreOrdinals() bool { + switch f.filterScriptsType { + case FilterScriptsTaprootNoOrdinals: + return true + } + return false +} + +func filterScriptsToScriptsType(filterScripts string) FilterScriptsType { + switch filterScripts { + case "": + return FilterScriptsAll + case "taproot": + return FilterScriptsTaproot + case "taproot-noordinals": + return FilterScriptsTaprootNoOrdinals + } + return FilterScriptsInvalid +} diff --git a/bchain/golomb_test.go b/bchain/golomb_test.go new file mode 100644 index 0000000000..cd9ddd4689 --- /dev/null +++ b/bchain/golomb_test.go @@ -0,0 +1,282 @@ +// //go:build unittest + +package bchain + +import ( + "encoding/hex" + "testing" +) + +func getCommonAddressDescriptors() []AddressDescriptor { + return []AddressDescriptor{ + // bc1pgeqrcq5capal83ypxczmypjdhk4d9wwcea4k66c7ghe07p2qt97sqh8sy5 + hexToBytes("512046403c0298e87bf3c4813605b2064dbdaad2b9d8cf6b6d6b1e45f2ff0540597d"), + // bc1p7en40zu9hmf9d3luh8evmfyg655pu5k2gtna6j7zr623f9tz7z0stfnwav + hexToBytes("5120f667578b85bed256c7fcb9f2cda488d5281e52ca42e7dd4bc21e95149562f09f"), + // 39ECUF8YaFRX7XfttfAiLa5ir43bsrQUZJ + hexToBytes("a91452ae9441d9920d9eb4a3c0a877ca8d8de547ce6587"), + } +} + +func TestGolombFilter(t *testing.T) { + tests := []struct { + name string + p uint8 + useZeroedKey bool + filterScripts string + key string + addressDescriptors []AddressDescriptor + wantError bool + wantEnabled bool + want string + }{ + { + name: "taproot", + p: 20, + useZeroedKey: false, + filterScripts: "taproot", + key: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + addressDescriptors: getCommonAddressDescriptors(), + wantEnabled: true, + wantError: false, + want: "0235dddcce5d60", + }, + { + name: "taproot-zeroed-key", + p: 20, + useZeroedKey: true, + filterScripts: "taproot", + key: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + addressDescriptors: getCommonAddressDescriptors(), + wantEnabled: true, + wantError: false, + want: "0218c23a013600", + }, + { + name: "taproot p=21", + p: 21, + useZeroedKey: false, + filterScripts: "taproot", + key: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + addressDescriptors: getCommonAddressDescriptors(), + wantEnabled: true, + wantError: false, + want: "0235ddda672eb0", + }, + { + name: "all", + p: 20, + useZeroedKey: false, + filterScripts: "", + key: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + addressDescriptors: getCommonAddressDescriptors(), + wantEnabled: true, + wantError: false, + want: "0350ccc61ac611976c80", + }, + { + name: "taproot-noordinals", + p: 20, + useZeroedKey: false, + filterScripts: "taproot-noordinals", + key: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + addressDescriptors: getCommonAddressDescriptors(), + wantEnabled: true, + wantError: false, + want: "0235dddcce5d60", + }, + { + name: "not supported filter", + p: 20, + useZeroedKey: false, + filterScripts: "notsupported", + wantEnabled: false, + wantError: true, + want: "", + }, + { + name: "not enabled", + p: 0, + useZeroedKey: false, + filterScripts: "", + wantEnabled: false, + wantError: false, + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gf, err := NewGolombFilter(tt.p, tt.filterScripts, tt.key, tt.useZeroedKey) + if err != nil && !tt.wantError { + t.Errorf("TestGolombFilter.NewGolombFilter() got unexpected error '%v'", err) + return + } + if err == nil && tt.wantError { + t.Errorf("TestGolombFilter.NewGolombFilter() wanted error, got none") + return + } + if gf == nil && tt.wantError { + return + } + if gf.Enabled != tt.wantEnabled { + t.Errorf("TestGolombFilter.NewGolombFilter() got gf.Enabled %v, want %v", gf.Enabled, tt.wantEnabled) + return + } + for _, ad := range tt.addressDescriptors { + gf.AddAddrDesc(ad, nil) + } + f := gf.Compute() + got := hex.EncodeToString(f) + if got != tt.want { + t.Errorf("TestGolombFilter Compute() got %v, want %v", got, tt.want) + } + }) + } +} + +// Preparation transaction, locking BTC redeemable by ordinal witness - parent of the reveal transaction +func getOrdinalCommitTx() (Tx, []AddressDescriptor) { + tx := Tx{ + // https://mempool.space/tx/11111c17cbe86aebab146ee039d4e354cb55a9fb226ebdd2e30948630e7710ad + Txid: "11111c17cbe86aebab146ee039d4e354cb55a9fb226ebdd2e30948630e7710ad", + Vin: []Vin{ + { + // https://mempool.space/tx/c4cae52a6e681b66c85c12feafb42f3617f34977032df1ee139eae07370863ef + Txid: "c163fe1fdc21269cb05621adec38045e46a65289a356f9354df6010bce064916", + Vout: 0, + Witness: [][]byte{ + hexToBytes("0371633164dd16345c02e80c9963042f9a502aa2c8109c0f61da333ac1503c3ce2a1b79895359bbdee5979ab2cb44f3395892e1c419c3a8f67d31d33d7e764c9"), + }, + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51206a711358bac6ca8f7ddfdf8f733546e658208122939f0bf7a3727f8143dfbbff", + Addresses: []string{ + "bc1pdfc3xk96cm9g7lwlm78hxd2xuevzpqfzjw0shaarwflczs7lh0lstksdn0", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "a9144390d0b3d2b6d48b8c205ffbe40b2d84c40de07f87", + Addresses: []string{ + "37rGgLSLX6C6LS9am4KWd6GT1QCEP4H4py", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "76a914ba6b046dd832aa8bc41c158232bcc18211387c4388ac", + Addresses: []string{ + "1HzgtNdRCXszf95rFYemsDSHJQBbs9rbZf", + }, + }, + }, + }, + } + addressDescriptors := []AddressDescriptor{ + // bc1pdfc3xk96cm9g7lwlm78hxd2xuevzpqfzjw0shaarwflczs7lh0lstksdn0 + hexToBytes("51206a711358bac6ca8f7ddfdf8f733546e658208122939f0bf7a3727f8143dfbbff"), + // 37rGgLSLX6C6LS9am4KWd6GT1QCEP4H4py + hexToBytes("a9144390d0b3d2b6d48b8c205ffbe40b2d84c40de07f87"), + // 1HzgtNdRCXszf95rFYemsDSHJQBbs9rbZf + hexToBytes("76a914ba6b046dd832aa8bc41c158232bcc18211387c4388ac"), + } + return tx, addressDescriptors +} + +// Transaction containing the actual ordinal data in witness - child of the commit transaction +func getOrdinalRevealTx() (Tx, []AddressDescriptor) { + tx := Tx{ + // https://mempool.space/tx/c4cae52a6e681b66c85c12feafb42f3617f34977032df1ee139eae07370863ef + Txid: "c4cae52a6e681b66c85c12feafb42f3617f34977032df1ee139eae07370863ef", + Vin: []Vin{ + { + Txid: "11111c17cbe86aebab146ee039d4e354cb55a9fb226ebdd2e30948630e7710ad", + Vout: 0, + Witness: [][]byte{ + hexToBytes("737ad2835962e3d147cd74a578f1109e9314eac9d00c9fad304ce2050b78fac21a2d124fd886d1d646cf1de5d5c9754b0415b960b1319526fa25e36ca1f650ce"), + hexToBytes("2029f34532e043fade4471779b4955005db8fa9b64c9e8d0a2dae4a38bbca23328ac0063036f726401010a696d6167652f77656270004d08025249464650020000574542505650384c440200002f57c2950067a026009086939b7785a104699656f4f53388355445b6415d22f8924000fd83bd31d346ca69f8fcfed6d8d18231846083f90f00ffbf203883666c36463c6ba8662257d789935e002192245bd15ac00216b080052cac85b380052c60e1593859f33a7a7abff7ed88feb361db3692341bc83553aef7aec75669ffb1ffd87fec3ff61ffb8ffdc736f20a96a0fba34071d4fdf111c435381df667728f95c4e82b6872d82471bfdc1665107bb80fd46df1686425bcd2e27eb59adc9d17b54b997ee96776a7c37ca2b57b9551bcffeb71d88768765af7384c2e3ba031ca3f19c9ddb0c6ec55223fbfe3731a1e8d7bb010de8532d53293bbbb6145597ee53559a612e6de4f8fc66936ef463eea7498555643ac0dafad6627575f2733b9fb352e411e7d9df8fc80fde75f5f66f5c5381a46b9a697d9c97555c4bf41a4909b9dd071557c3dfe0bfcd6459e06514266c65756ce9f25705230df63d30fef6076b797e1f49d00b41e87b5ccecb1c237f419e4b3ca6876053c14fc979a629459a62f78d735fb078bfa0e7a1fc69ad379447d817e06b3d7f1de820f28534f85fa20469cd6f93ddc6c5f2a94878fc64a98ac336294c99d27d11742268ae1a34cd61f31e2e4aee94b0ff496f55068fa727ace6ad2ec1e6e3f59e6a8bd154f287f652fbfaa05cac067951de1bfacc0e330c3bf6dd2efde4c509646566836eb71986154731daf722a6ff585001e87f9479559a61265d6e330f3682bf87ab2598fc3fca36da778e59cee71584594ef175e6d7d5f70d6deb02c4b371e5063c35669ffb1ffd87ffe0e730068"), + hexToBytes("c129f34532e043fade4471779b4955005db8fa9b64c9e8d0a2dae4a38bbca23328"), + }, + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51206850b179630df0f7012ae2b111bafa52ebb9b54e1435fc4f98fbe0af6f95076a", + Addresses: []string{ + "bc1pdpgtz7trphc0wqf2u2c3rwh62t4mnd2wzs6lcnucl0s27mu4qa4q4md9ta", + }, + }, + }, + }, + } + addressDescriptors := []AddressDescriptor{ + // bc1pdpgtz7trphc0wqf2u2c3rwh62t4mnd2wzs6lcnucl0s27mu4qa4q4md9ta + hexToBytes("51206850b179630df0f7012ae2b111bafa52ebb9b54e1435fc4f98fbe0af6f95076a"), + } + return tx, addressDescriptors +} + +func TestGolombIsOrdinal(t *testing.T) { + revealTx, _ := getOrdinalRevealTx() + if txContainsOrdinal(&revealTx) != true { + t.Error("Ordinal not found in reveal Tx") + } + commitTx, _ := getOrdinalCommitTx() + if txContainsOrdinal(&commitTx) != false { + t.Error("Ordinal found in commit Tx, but should not be there") + } +} + +func TestGolombOrdinalTransactions(t *testing.T) { + tests := []struct { + name string + filterScripts string + want string + }{ + { + name: "all", + filterScripts: "", + want: "04256e660160e42ff40ee320", // take all four descriptors + }, + { + name: "taproot", + filterScripts: "taproot", + want: "0212b734c2ebe0", // filter out two non-taproot ones + }, + { + name: "taproot-noordinals", + filterScripts: "taproot-noordinals", + want: "", // ignore everything + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gf, err := NewGolombFilter(20, tt.filterScripts, "", true) + if err != nil { + t.Errorf("TestGolombOrdinalTransactions.NewGolombFilter() got unexpected error '%v'", err) + return + } + + commitTx, addressDescriptorsCommit := getOrdinalCommitTx() + revealTx, addressDescriptorsReveal := getOrdinalRevealTx() + + for _, ad := range addressDescriptorsCommit { + gf.AddAddrDesc(ad, &commitTx) + } + for _, ad := range addressDescriptorsReveal { + gf.AddAddrDesc(ad, &revealTx) + } + + f := gf.Compute() + got := hex.EncodeToString(f) + if got != tt.want { + t.Errorf("TestGolombOrdinalTransactions Compute() got %v, want %v", got, tt.want) + } + }) + } +} diff --git a/bchain/mempool_bitcoin_type.go b/bchain/mempool_bitcoin_type.go index 009073dd19..b668236e19 100644 --- a/bchain/mempool_bitcoin_type.go +++ b/bchain/mempool_bitcoin_type.go @@ -1,10 +1,12 @@ package bchain import ( + "encoding/hex" "math/big" "time" "github.com/golang/glog" + "github.com/juju/errors" ) type chanInputPayload struct { @@ -18,11 +20,14 @@ type MempoolBitcoinType struct { chanTxid chan string chanAddrIndex chan txidio AddrDescForOutpoint AddrDescForOutpointFunc + golombFilterP uint8 + filterScripts string + useZeroedKey bool } // NewMempoolBitcoinType creates new mempool handler. // For now there is no cleanup of sync routines, the expectation is that the mempool is created only once per process -func NewMempoolBitcoinType(chain BlockChain, workers int, subworkers int) *MempoolBitcoinType { +func NewMempoolBitcoinType(chain BlockChain, workers int, subworkers int, golombFilterP uint8, filterScripts string, useZeroedKey bool) *MempoolBitcoinType { m := &MempoolBitcoinType{ BaseMempool: BaseMempool{ chain: chain, @@ -31,6 +36,9 @@ func NewMempoolBitcoinType(chain BlockChain, workers int, subworkers int) *Mempo }, chanTxid: make(chan string, 1), chanAddrIndex: make(chan txidio, 1), + golombFilterP: golombFilterP, + filterScripts: filterScripts, + useZeroedKey: useZeroedKey, } for i := 0; i < workers; i++ { go func(i int) { @@ -45,11 +53,11 @@ func NewMempoolBitcoinType(chain BlockChain, workers int, subworkers int) *Mempo }(j) } for txid := range m.chanTxid { - io, ok := m.getTxAddrs(txid, chanInput, chanResult) + io, golombFilter, ok := m.getTxAddrs(txid, chanInput, chanResult) if !ok { io = []addrIndex{} } - m.chanAddrIndex <- txidio{txid, io} + m.chanAddrIndex <- txidio{txid, io, golombFilter} } }(i) } @@ -61,6 +69,10 @@ func (m *MempoolBitcoinType) getInputAddress(payload *chanInputPayload) *addrInd var addrDesc AddressDescriptor var value *big.Int vin := &payload.tx.Vin[payload.index] + if vin.Txid == "" { + // cannot get address from empty input txid (for example in Litecoin mweb) + return nil + } if m.AddrDescForOutpoint != nil { addrDesc, value = m.AddrDescForOutpoint(Outpoint{vin.Txid, int32(vin.Vout)}) } @@ -87,11 +99,29 @@ func (m *MempoolBitcoinType) getInputAddress(payload *chanInputPayload) *addrInd } -func (m *MempoolBitcoinType) getTxAddrs(txid string, chanInput chan chanInputPayload, chanResult chan *addrIndex) ([]addrIndex, bool) { +func (m *MempoolBitcoinType) computeGolombFilter(mtx *MempoolTx, tx *Tx) string { + gf, _ := NewGolombFilter(m.golombFilterP, m.filterScripts, mtx.Txid, m.useZeroedKey) + if gf == nil || !gf.Enabled { + return "" + } + for _, vin := range mtx.Vin { + gf.AddAddrDesc(vin.AddrDesc, tx) + } + for _, vout := range mtx.Vout { + b, err := hex.DecodeString(vout.ScriptPubKey.Hex) + if err == nil { + gf.AddAddrDesc(b, tx) + } + } + fb := gf.Compute() + return hex.EncodeToString(fb) +} + +func (m *MempoolBitcoinType) getTxAddrs(txid string, chanInput chan chanInputPayload, chanResult chan *addrIndex) ([]addrIndex, string, bool) { tx, err := m.chain.GetTransactionForMempool(txid) if err != nil { glog.Error("cannot get transaction ", txid, ": ", err) - return nil, false + return nil, "", false } glog.V(2).Info("mempool: gettxaddrs ", txid, ", ", len(tx.Vin), " inputs") mtx := m.txToMempoolTx(tx) @@ -138,10 +168,14 @@ func (m *MempoolBitcoinType) getTxAddrs(txid string, chanInput chan chanInputPay io = append(io, *ai) } } + var golombFilter string + if m.golombFilterP > 0 { + golombFilter = m.computeGolombFilter(mtx, tx) + } if m.OnNewTx != nil { m.OnNewTx(mtx) } - return io, true + return io, golombFilter, true } // Resync gets mempool transactions and maps outputs to transactions. @@ -178,7 +212,7 @@ func (m *MempoolBitcoinType) Resync() (int, error) { select { // store as many processed transactions as possible case tio := <-m.chanAddrIndex: - onNewEntry(tio.txid, txEntry{tio.io, txTime}) + onNewEntry(tio.txid, txEntry{tio.io, txTime, tio.filter}) dispatched-- // send transaction to be processed case m.chanTxid <- txid: @@ -190,7 +224,7 @@ func (m *MempoolBitcoinType) Resync() (int, error) { } for i := 0; i < dispatched; i++ { tio := <-m.chanAddrIndex - onNewEntry(tio.txid, txEntry{tio.io, txTime}) + onNewEntry(tio.txid, txEntry{tio.io, txTime, tio.filter}) } for txid, entry := range m.txEntries { @@ -203,3 +237,19 @@ func (m *MempoolBitcoinType) Resync() (int, error) { glog.Info("mempool: resync finished in ", time.Since(start), ", ", len(m.txEntries), " transactions in mempool") return len(m.txEntries), nil } + +// GetTxidFilterEntries returns all mempool entries with golomb filter from +func (m *MempoolBitcoinType) GetTxidFilterEntries(filterScripts string, fromTimestamp uint32) (MempoolTxidFilterEntries, error) { + if m.filterScripts != filterScripts { + return MempoolTxidFilterEntries{}, errors.Errorf("Unsupported script filter %s", filterScripts) + } + m.mux.Lock() + entries := make(map[string]string) + for txid, entry := range m.txEntries { + if entry.filter != "" && entry.time >= fromTimestamp { + entries[txid] = entry.filter + } + } + m.mux.Unlock() + return MempoolTxidFilterEntries{entries, m.useZeroedKey}, nil +} diff --git a/bchain/mempool_bitcoin_type_test.go b/bchain/mempool_bitcoin_type_test.go new file mode 100644 index 0000000000..ddbe428f3c --- /dev/null +++ b/bchain/mempool_bitcoin_type_test.go @@ -0,0 +1,352 @@ +package bchain + +import ( + "encoding/hex" + "testing" + + "github.com/martinboehm/btcutil/gcs" +) + +func hexToBytes(h string) []byte { + b, _ := hex.DecodeString(h) + return b +} + +func TestMempoolBitcoinType_computeGolombFilter_taproot(t *testing.T) { + randomScript := hexToBytes("a914ff074800343a81ada8fe86c2d5d5a0e55b93dd7a87") + m := &MempoolBitcoinType{ + golombFilterP: 20, + filterScripts: "taproot", + } + golombFilterM := GetGolombParamM(m.golombFilterP) + tests := []struct { + name string + mtx MempoolTx + want string + }{ + { + name: "taproot", + mtx: MempoolTx{ + Txid: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + Vin: []MempoolVin{ + { + // bc1pgeqrcq5capal83ypxczmypjdhk4d9wwcea4k66c7ghe07p2qt97sqh8sy5 + AddrDesc: hexToBytes("512046403c0298e87bf3c4813605b2064dbdaad2b9d8cf6b6d6b1e45f2ff0540597d"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "5120f667578b85bed256c7fcb9f2cda488d5281e52ca42e7dd4bc21e95149562f09f", + Addresses: []string{ + "bc1p7en40zu9hmf9d3luh8evmfyg655pu5k2gtna6j7zr623f9tz7z0stfnwav", + }, + }, + }, + }, + }, + want: "0235dddcce5d60", + }, + { + name: "taproot multiple", + mtx: MempoolTx{ + Txid: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + Vin: []MempoolVin{ + { + // bc1pp3752xgfy39w30kggy8vvn0u68x8afwqmq6p96jzr8ffrcvjxgrqrny93y + AddrDesc: hexToBytes("51200c7d451909244ae8bec8410ec64dfcd1cc7ea5c0d83412ea4219d291e1923206"), + }, + { + // bc1p5ldsz3zxnjxrwf4xluf4qu7u839c204ptacwe2k0vzfk8s63mwts3njuwr + AddrDesc: hexToBytes("5120a7db0144469c8c3726a6ff135073dc3c4b853ea15f70ecaacf609363c351db97"), + }, + { + // bc1pgeqrcq5capal83ypxczmypjdhk4d9wwcea4k66c7ghe07p2qt97sqh8sy5 + AddrDesc: hexToBytes("512046403c0298e87bf3c4813605b2064dbdaad2b9d8cf6b6d6b1e45f2ff0540597d"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51209ab20580f77e7cd676f896fc1794f7e8061efc1ce7494f2bb16205262aa12bdb", + Addresses: []string{ + "bc1pn2eqtq8h0e7dvahcjm7p098haqrpalquuay572a3vgzjv24p90dszxzg40", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "5120f667578b85bed256c7fcb9f2cda488d5281e52ca42e7dd4bc21e95149562f09f", + Addresses: []string{ + "bc1p7en40zu9hmf9d3luh8evmfyg655pu5k2gtna6j7zr623f9tz7z0stfnwav", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "51201341e5a58314d89bcf5add2b2a68f109add5efb1ae774fa33c612da311f25904", + Addresses: []string{ + "bc1pzdq7tfvrznvfhn66m54j5683pxkatma34em5lgeuvyk6xy0jtyzqjt48z3", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "512042b2d5c032b68220bfd6d4e26bc015129e168e87e22af743ffdc736708b7d342", + Addresses: []string{ + "bc1pg2edtspjk6pzp07k6n3xhsq4z20pdr58ug40wsllm3ekwz9h6dpq77lhu9", + }, + }, + }, + }, + }, + want: "071143e4ad12730965a5247ac15db8c81c89b0bc", + }, + { + name: "taproot duplicities", + mtx: MempoolTx{ + Txid: "33a03f983b47725bbdd6045f2d5ee0d95dce08eaaf7104759758aabd8af27d34", + Vin: []MempoolVin{ + { + // bc1px2k5tu5mfq23ekkwncz5apx6ccw2nr0rne25r8t8zk7nu035ryxqn9ge8p + AddrDesc: hexToBytes("512032ad45f29b48151cdace9e054e84dac61ca98de39e55419d6715bd3e3e34190c"), + }, + { + // bc1px2k5tu5mfq23ekkwncz5apx6ccw2nr0rne25r8t8zk7nu035ryxqn9ge8p + AddrDesc: hexToBytes("512032ad45f29b48151cdace9e054e84dac61ca98de39e55419d6715bd3e3e34190c"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "512032ad45f29b48151cdace9e054e84dac61ca98de39e55419d6715bd3e3e34190c", + Addresses: []string{ + "bc1px2k5tu5mfq23ekkwncz5apx6ccw2nr0rne25r8t8zk7nu035ryxqn9ge8p", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "512032ad45f29b48151cdace9e054e84dac61ca98de39e55419d6715bd3e3e34190c", + Addresses: []string{ + "bc1px2k5tu5mfq23ekkwncz5apx6ccw2nr0rne25r8t8zk7nu035ryxqn9ge8p", + }, + }, + }, + { + ScriptPubKey: ScriptPubKey{ + Hex: "512032ad45f29b48151cdace9e054e84dac61ca98de39e55419d6715bd3e3e34190c", + Addresses: []string{ + "bc1px2k5tu5mfq23ekkwncz5apx6ccw2nr0rne25r8t8zk7nu035ryxqn9ge8p", + }, + }, + }, + }, + }, + want: "01778db0", + }, + { + name: "partial taproot", + mtx: MempoolTx{ + Txid: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + Vin: []MempoolVin{ + { + // bc1pgeqrcq5capal83ypxczmypjdhk4d9wwcea4k66c7ghe07p2qt97sqh8sy5 + AddrDesc: hexToBytes("512046403c0298e87bf3c4813605b2064dbdaad2b9d8cf6b6d6b1e45f2ff0540597d"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "00145f997834e1135e893b7707ba1b12bcb8d74b821d", + Addresses: []string{ + "bc1qt7vhsd8pzd0gjwmhq7apky4uhrt5hqsa2y58nl", + }, + }, + }, + }, + }, + want: "011aeee8", + }, + { + name: "no taproot", + mtx: MempoolTx{ + Txid: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + Vin: []MempoolVin{ + { + // 39ECUF8YaFRX7XfttfAiLa5ir43bsrQUZJ + AddrDesc: hexToBytes("a91452ae9441d9920d9eb4a3c0a877ca8d8de547ce6587"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "00145f997834e1135e893b7707ba1b12bcb8d74b821d", + Addresses: []string{ + "bc1qt7vhsd8pzd0gjwmhq7apky4uhrt5hqsa2y58nl", + }, + }, + }, + }, + }, + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := m.computeGolombFilter(&tt.mtx, nil) + if got != tt.want { + t.Errorf("MempoolBitcoinType.computeGolombFilter() = %v, want %v", got, tt.want) + } + if got != "" { + // build the filter from computed value + filter, err := gcs.FromNBytes(m.golombFilterP, golombFilterM, hexToBytes(got)) + if err != nil { + t.Errorf("gcs.BuildGCSFilter() unexpected error %v", err) + } + // check that the vin scripts match the filter + b, _ := hex.DecodeString(tt.mtx.Txid) + for i := range tt.mtx.Vin { + match, err := filter.Match(*(*[gcs.KeySize]byte)(b[:gcs.KeySize]), tt.mtx.Vin[i].AddrDesc) + if err != nil { + t.Errorf("filter.Match vin[%d] unexpected error %v", i, err) + } + if match != tt.mtx.Vin[i].AddrDesc.IsTaproot() { + t.Errorf("filter.Match vin[%d] got %v, want %v", i, match, tt.mtx.Vin[i].AddrDesc.IsTaproot()) + } + } + // check that the vout scripts match the filter + for i := range tt.mtx.Vout { + s := hexToBytes(tt.mtx.Vout[i].ScriptPubKey.Hex) + match, err := filter.Match(*(*[gcs.KeySize]byte)(b[:gcs.KeySize]), s) + if err != nil { + t.Errorf("filter.Match vout[%d] unexpected error %v", i, err) + } + if match != AddressDescriptor(s).IsTaproot() { + t.Errorf("filter.Match vout[%d] got %v, want %v", i, match, AddressDescriptor(s).IsTaproot()) + } + } + // check that a random script does not match the filter + match, err := filter.Match(*(*[gcs.KeySize]byte)(b[:gcs.KeySize]), randomScript) + if err != nil { + t.Errorf("filter.Match randomScript unexpected error %v", err) + } + if match != false { + t.Errorf("filter.Match randomScript got true, want false") + } + } + }) + } +} + +func TestMempoolBitcoinType_computeGolombFilter_taproot_noordinals(t *testing.T) { + m := &MempoolBitcoinType{ + golombFilterP: 20, + filterScripts: "taproot-noordinals", + } + tests := []struct { + name string + mtx MempoolTx + tx Tx + want string + }{ + { + name: "taproot-no-ordinals normal taproot tx", + mtx: MempoolTx{ + Txid: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + Vin: []MempoolVin{ + { + // bc1pdfc3xk96cm9g7lwlm78hxd2xuevzpqfzjw0shaarwflczs7lh0lstksdn0 + AddrDesc: hexToBytes("51206a711358bac6ca8f7ddfdf8f733546e658208122939f0bf7a3727f8143dfbbff"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51206850b179630df0f7012ae2b111bafa52ebb9b54e1435fc4f98fbe0af6f95076a", + Addresses: []string{ + "bc1pdpgtz7trphc0wqf2u2c3rwh62t4mnd2wzs6lcnucl0s27mu4qa4q4md9ta", + }, + }, + }, + }, + }, + tx: Tx{ + Vin: []Vin{ + { + Witness: [][]byte{ + hexToBytes("737ad2835962e3d147cd74a578f1109e9314eac9d00c9fad304ce2050b78fac21a2d124fd886d1d646cf1de5d5c9754b0415b960b1319526fa25e36ca1f650ce"), + }, + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51206850b179630df0f7012ae2b111bafa52ebb9b54e1435fc4f98fbe0af6f95076a", + Addresses: []string{ + "bc1pdpgtz7trphc0wqf2u2c3rwh62t4mnd2wzs6lcnucl0s27mu4qa4q4md9ta", + }, + }, + }, + }, + }, + want: "02899e8c952b40", + }, + { + name: "taproot-no-ordinals ordinal tx", + mtx: MempoolTx{ + Txid: "86336c62a63f509a278624e3f400cdd50838d035a44e0af8a7d6d133c04cc2d2", + Vin: []MempoolVin{ + { + // bc1pdfc3xk96cm9g7lwlm78hxd2xuevzpqfzjw0shaarwflczs7lh0lstksdn0 + AddrDesc: hexToBytes("51206a711358bac6ca8f7ddfdf8f733546e658208122939f0bf7a3727f8143dfbbff"), + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51206850b179630df0f7012ae2b111bafa52ebb9b54e1435fc4f98fbe0af6f95076a", + Addresses: []string{ + "bc1pdpgtz7trphc0wqf2u2c3rwh62t4mnd2wzs6lcnucl0s27mu4qa4q4md9ta", + }, + }, + }, + }, + }, + tx: Tx{ + // https://mempool.space/tx/c4cae52a6e681b66c85c12feafb42f3617f34977032df1ee139eae07370863ef + Txid: "c4cae52a6e681b66c85c12feafb42f3617f34977032df1ee139eae07370863ef", + Vin: []Vin{ + { + Txid: "11111c17cbe86aebab146ee039d4e354cb55a9fb226ebdd2e30948630e7710ad", + Vout: 0, + Witness: [][]byte{ + hexToBytes("737ad2835962e3d147cd74a578f1109e9314eac9d00c9fad304ce2050b78fac21a2d124fd886d1d646cf1de5d5c9754b0415b960b1319526fa25e36ca1f650ce"), + hexToBytes("2029f34532e043fade4471779b4955005db8fa9b64c9e8d0a2dae4a38bbca23328ac0063036f726401010a696d6167652f77656270004d08025249464650020000574542505650384c440200002f57c2950067a026009086939b7785a104699656f4f53388355445b6415d22f8924000fd83bd31d346ca69f8fcfed6d8d18231846083f90f00ffbf203883666c36463c6ba8662257d789935e002192245bd15ac00216b080052cac85b380052c60e1593859f33a7a7abff7ed88feb361db3692341bc83553aef7aec75669ffb1ffd87fec3ff61ffb8ffdc736f20a96a0fba34071d4fdf111c435381df667728f95c4e82b6872d82471bfdc1665107bb80fd46df1686425bcd2e27eb59adc9d17b54b997ee96776a7c37ca2b57b9551bcffeb71d88768765af7384c2e3ba031ca3f19c9ddb0c6ec55223fbfe3731a1e8d7bb010de8532d53293bbbb6145597ee53559a612e6de4f8fc66936ef463eea7498555643ac0dafad6627575f2733b9fb352e411e7d9df8fc80fde75f5f66f5c5381a46b9a697d9c97555c4bf41a4909b9dd071557c3dfe0bfcd6459e06514266c65756ce9f25705230df63d30fef6076b797e1f49d00b41e87b5ccecb1c237f419e4b3ca6876053c14fc979a629459a62f78d735fb078bfa0e7a1fc69ad379447d817e06b3d7f1de820f28534f85fa20469cd6f93ddc6c5f2a94878fc64a98ac336294c99d27d11742268ae1a34cd61f31e2e4aee94b0ff496f55068fa727ace6ad2ec1e6e3f59e6a8bd154f287f652fbfaa05cac067951de1bfacc0e330c3bf6dd2efde4c509646566836eb71986154731daf722a6ff585001e87f9479559a61265d6e330f3682bf87ab2598fc3fca36da778e59cee71584594ef175e6d7d5f70d6deb02c4b371e5063c35669ffb1ffd87ffe0e730068"), + hexToBytes("c129f34532e043fade4471779b4955005db8fa9b64c9e8d0a2dae4a38bbca23328"), + }, + }, + }, + Vout: []Vout{ + { + ScriptPubKey: ScriptPubKey{ + Hex: "51206850b179630df0f7012ae2b111bafa52ebb9b54e1435fc4f98fbe0af6f95076a", + Addresses: []string{ + "bc1pdpgtz7trphc0wqf2u2c3rwh62t4mnd2wzs6lcnucl0s27mu4qa4q4md9ta", + }, + }, + }, + }, + }, + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := m.computeGolombFilter(&tt.mtx, &tt.tx) + if got != tt.want { + t.Errorf("MempoolBitcoinType.computeGolombFilter() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/bchain/mempool_ethereum_type.go b/bchain/mempool_ethereum_type.go index 91fdeeac6e..aa1fbb5386 100644 --- a/bchain/mempool_ethereum_type.go +++ b/bchain/mempool_ethereum_type.go @@ -1,6 +1,7 @@ package bchain import ( + "errors" "time" "github.com/golang/glog" @@ -74,11 +75,11 @@ func (m *MempoolEthereumType) createTxEntry(txid string, txTime uint32) (txEntry addrIndexes, input.AddrDesc = appendAddress(addrIndexes, ^int32(i), a, parser) } } - t, err := parser.EthereumTypeGetErc20FromTx(tx) + t, err := parser.EthereumTypeGetTokenTransfersFromTx(tx) if err != nil { - glog.Error("GetErc20FromTx for tx ", txid, ", ", err) + glog.Error("GetGetTokenTransfersFromTx for tx ", txid, ", ", err) } else { - mtx.Erc20 = t + mtx.TokenTransfers = t for i := range t { addrIndexes, _ = appendAddress(addrIndexes, ^int32(i+1), t[i].From, parser) addrIndexes, _ = appendAddress(addrIndexes, int32(i+1), t[i].To, parser) @@ -131,8 +132,8 @@ func (m *MempoolEthereumType) Resync() (int, error) { return entries, nil } -// AddTransactionToMempool adds transactions to mempool -func (m *MempoolEthereumType) AddTransactionToMempool(txid string) { +// AddTransactionToMempool adds transactions to mempool, returns true if tx added to mempool, false if not added (for example duplicate call) +func (m *MempoolEthereumType) AddTransactionToMempool(txid string) bool { m.mux.Lock() _, exists := m.txEntries[txid] m.mux.Unlock() @@ -142,7 +143,7 @@ func (m *MempoolEthereumType) AddTransactionToMempool(txid string) { if !exists { entry, ok := m.createTxEntry(txid, uint32(time.Now().Unix())) if !ok { - return + return false } m.mux.Lock() m.txEntries[txid] = entry @@ -151,6 +152,7 @@ func (m *MempoolEthereumType) AddTransactionToMempool(txid string) { } m.mux.Unlock() } + return !exists } // RemoveTransactionFromMempool removes transaction from mempool @@ -165,3 +167,8 @@ func (m *MempoolEthereumType) RemoveTransactionFromMempool(txid string) { } m.mux.Unlock() } + +// GetTxidFilterEntries returns all mempool entries with golomb filter from +func (m *MempoolEthereumType) GetTxidFilterEntries(filterScripts string, fromTimestamp uint32) (MempoolTxidFilterEntries, error) { + return MempoolTxidFilterEntries{}, errors.New("Not supported") +} diff --git a/bchain/mq.go b/bchain/mq.go index 8f8e828263..5f91920914 100644 --- a/bchain/mq.go +++ b/bchain/mq.go @@ -92,15 +92,13 @@ func (mq *MQ) run(callback func(NotificationType)) { } else { repeatedError = false } - if msg != nil && len(msg) >= 3 { + if len(msg) >= 3 { var nt NotificationType switch string(msg[0]) { case "hashblock": nt = NotificationNewBlock - break case "hashtx": nt = NotificationNewTx - break default: nt = NotificationUnknown glog.Infof("MQ: NotificationUnknown %v", string(msg[0])) diff --git a/bchain/tx.pb.go b/bchain/tx.pb.go index d271806936..e17d8f8dfa 100644 --- a/bchain/tx.pb.go +++ b/bchain/tx.pb.go @@ -1,230 +1,426 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: tx.proto +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.21.5 +// source: bchain/tx.proto -/* -Package bchain is a generated protocol buffer package. - -It is generated from these files: - tx.proto - -It has these top-level messages: - ProtoTransaction -*/ package bchain -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// 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.ProtoPackageIsVersion2 // please upgrade the proto package +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) type ProtoTransaction struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + Txid []byte `protobuf:"bytes,1,opt,name=Txid,proto3" json:"Txid,omitempty"` Hex []byte `protobuf:"bytes,2,opt,name=Hex,proto3" json:"Hex,omitempty"` - Blocktime uint64 `protobuf:"varint,3,opt,name=Blocktime" json:"Blocktime,omitempty"` - Locktime uint32 `protobuf:"varint,4,opt,name=Locktime" json:"Locktime,omitempty"` - Height uint32 `protobuf:"varint,5,opt,name=Height" json:"Height,omitempty"` - Vin []*ProtoTransaction_VinType `protobuf:"bytes,6,rep,name=Vin" json:"Vin,omitempty"` - Vout []*ProtoTransaction_VoutType `protobuf:"bytes,7,rep,name=Vout" json:"Vout,omitempty"` - Version int32 `protobuf:"varint,8,opt,name=Version" json:"Version,omitempty"` + Blocktime uint64 `protobuf:"varint,3,opt,name=Blocktime,proto3" json:"Blocktime,omitempty"` + Locktime uint32 `protobuf:"varint,4,opt,name=Locktime,proto3" json:"Locktime,omitempty"` + Height uint32 `protobuf:"varint,5,opt,name=Height,proto3" json:"Height,omitempty"` + Vin []*ProtoTransaction_VinType `protobuf:"bytes,6,rep,name=Vin,proto3" json:"Vin,omitempty"` + Vout []*ProtoTransaction_VoutType `protobuf:"bytes,7,rep,name=Vout,proto3" json:"Vout,omitempty"` + Version int32 `protobuf:"varint,8,opt,name=Version,proto3" json:"Version,omitempty"` + VSize int64 `protobuf:"varint,9,opt,name=VSize,proto3" json:"VSize,omitempty"` } -func (m *ProtoTransaction) Reset() { *m = ProtoTransaction{} } -func (m *ProtoTransaction) String() string { return proto.CompactTextString(m) } -func (*ProtoTransaction) ProtoMessage() {} -func (*ProtoTransaction) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (x *ProtoTransaction) Reset() { + *x = ProtoTransaction{} + if protoimpl.UnsafeEnabled { + mi := &file_bchain_tx_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} -func (m *ProtoTransaction) GetTxid() []byte { - if m != nil { - return m.Txid +func (x *ProtoTransaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtoTransaction) ProtoMessage() {} + +func (x *ProtoTransaction) ProtoReflect() protoreflect.Message { + mi := &file_bchain_tx_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtoTransaction.ProtoReflect.Descriptor instead. +func (*ProtoTransaction) Descriptor() ([]byte, []int) { + return file_bchain_tx_proto_rawDescGZIP(), []int{0} +} + +func (x *ProtoTransaction) GetTxid() []byte { + if x != nil { + return x.Txid } return nil } -func (m *ProtoTransaction) GetHex() []byte { - if m != nil { - return m.Hex +func (x *ProtoTransaction) GetHex() []byte { + if x != nil { + return x.Hex } return nil } -func (m *ProtoTransaction) GetBlocktime() uint64 { - if m != nil { - return m.Blocktime +func (x *ProtoTransaction) GetBlocktime() uint64 { + if x != nil { + return x.Blocktime } return 0 } -func (m *ProtoTransaction) GetLocktime() uint32 { - if m != nil { - return m.Locktime +func (x *ProtoTransaction) GetLocktime() uint32 { + if x != nil { + return x.Locktime } return 0 } -func (m *ProtoTransaction) GetHeight() uint32 { - if m != nil { - return m.Height +func (x *ProtoTransaction) GetHeight() uint32 { + if x != nil { + return x.Height } return 0 } -func (m *ProtoTransaction) GetVin() []*ProtoTransaction_VinType { - if m != nil { - return m.Vin +func (x *ProtoTransaction) GetVin() []*ProtoTransaction_VinType { + if x != nil { + return x.Vin } return nil } -func (m *ProtoTransaction) GetVout() []*ProtoTransaction_VoutType { - if m != nil { - return m.Vout +func (x *ProtoTransaction) GetVout() []*ProtoTransaction_VoutType { + if x != nil { + return x.Vout } return nil } -func (m *ProtoTransaction) GetVersion() int32 { - if m != nil { - return m.Version +func (x *ProtoTransaction) GetVersion() int32 { + if x != nil { + return x.Version + } + return 0 +} + +func (x *ProtoTransaction) GetVSize() int64 { + if x != nil { + return x.VSize } return 0 } type ProtoTransaction_VinType struct { - Coinbase string `protobuf:"bytes,1,opt,name=Coinbase" json:"Coinbase,omitempty"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Coinbase string `protobuf:"bytes,1,opt,name=Coinbase,proto3" json:"Coinbase,omitempty"` Txid []byte `protobuf:"bytes,2,opt,name=Txid,proto3" json:"Txid,omitempty"` - Vout uint32 `protobuf:"varint,3,opt,name=Vout" json:"Vout,omitempty"` + Vout uint32 `protobuf:"varint,3,opt,name=Vout,proto3" json:"Vout,omitempty"` ScriptSigHex []byte `protobuf:"bytes,4,opt,name=ScriptSigHex,proto3" json:"ScriptSigHex,omitempty"` - Sequence uint32 `protobuf:"varint,5,opt,name=Sequence" json:"Sequence,omitempty"` - Addresses []string `protobuf:"bytes,6,rep,name=Addresses" json:"Addresses,omitempty"` + Sequence uint32 `protobuf:"varint,5,opt,name=Sequence,proto3" json:"Sequence,omitempty"` + Addresses []string `protobuf:"bytes,6,rep,name=Addresses,proto3" json:"Addresses,omitempty"` +} + +func (x *ProtoTransaction_VinType) Reset() { + *x = ProtoTransaction_VinType{} + if protoimpl.UnsafeEnabled { + mi := &file_bchain_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProtoTransaction_VinType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtoTransaction_VinType) ProtoMessage() {} + +func (x *ProtoTransaction_VinType) ProtoReflect() protoreflect.Message { + mi := &file_bchain_tx_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) } -func (m *ProtoTransaction_VinType) Reset() { *m = ProtoTransaction_VinType{} } -func (m *ProtoTransaction_VinType) String() string { return proto.CompactTextString(m) } -func (*ProtoTransaction_VinType) ProtoMessage() {} -func (*ProtoTransaction_VinType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 0} } +// Deprecated: Use ProtoTransaction_VinType.ProtoReflect.Descriptor instead. +func (*ProtoTransaction_VinType) Descriptor() ([]byte, []int) { + return file_bchain_tx_proto_rawDescGZIP(), []int{0, 0} +} -func (m *ProtoTransaction_VinType) GetCoinbase() string { - if m != nil { - return m.Coinbase +func (x *ProtoTransaction_VinType) GetCoinbase() string { + if x != nil { + return x.Coinbase } return "" } -func (m *ProtoTransaction_VinType) GetTxid() []byte { - if m != nil { - return m.Txid +func (x *ProtoTransaction_VinType) GetTxid() []byte { + if x != nil { + return x.Txid } return nil } -func (m *ProtoTransaction_VinType) GetVout() uint32 { - if m != nil { - return m.Vout +func (x *ProtoTransaction_VinType) GetVout() uint32 { + if x != nil { + return x.Vout } return 0 } -func (m *ProtoTransaction_VinType) GetScriptSigHex() []byte { - if m != nil { - return m.ScriptSigHex +func (x *ProtoTransaction_VinType) GetScriptSigHex() []byte { + if x != nil { + return x.ScriptSigHex } return nil } -func (m *ProtoTransaction_VinType) GetSequence() uint32 { - if m != nil { - return m.Sequence +func (x *ProtoTransaction_VinType) GetSequence() uint32 { + if x != nil { + return x.Sequence } return 0 } -func (m *ProtoTransaction_VinType) GetAddresses() []string { - if m != nil { - return m.Addresses +func (x *ProtoTransaction_VinType) GetAddresses() []string { + if x != nil { + return x.Addresses } return nil } type ProtoTransaction_VoutType struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + ValueSat []byte `protobuf:"bytes,1,opt,name=ValueSat,proto3" json:"ValueSat,omitempty"` - N uint32 `protobuf:"varint,2,opt,name=N" json:"N,omitempty"` + N uint32 `protobuf:"varint,2,opt,name=N,proto3" json:"N,omitempty"` ScriptPubKeyHex []byte `protobuf:"bytes,3,opt,name=ScriptPubKeyHex,proto3" json:"ScriptPubKeyHex,omitempty"` - Addresses []string `protobuf:"bytes,4,rep,name=Addresses" json:"Addresses,omitempty"` + Addresses []string `protobuf:"bytes,4,rep,name=Addresses,proto3" json:"Addresses,omitempty"` } -func (m *ProtoTransaction_VoutType) Reset() { *m = ProtoTransaction_VoutType{} } -func (m *ProtoTransaction_VoutType) String() string { return proto.CompactTextString(m) } -func (*ProtoTransaction_VoutType) ProtoMessage() {} -func (*ProtoTransaction_VoutType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0, 1} } +func (x *ProtoTransaction_VoutType) Reset() { + *x = ProtoTransaction_VoutType{} + if protoimpl.UnsafeEnabled { + mi := &file_bchain_tx_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} -func (m *ProtoTransaction_VoutType) GetValueSat() []byte { - if m != nil { - return m.ValueSat +func (x *ProtoTransaction_VoutType) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProtoTransaction_VoutType) ProtoMessage() {} + +func (x *ProtoTransaction_VoutType) ProtoReflect() protoreflect.Message { + mi := &file_bchain_tx_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ProtoTransaction_VoutType.ProtoReflect.Descriptor instead. +func (*ProtoTransaction_VoutType) Descriptor() ([]byte, []int) { + return file_bchain_tx_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *ProtoTransaction_VoutType) GetValueSat() []byte { + if x != nil { + return x.ValueSat } return nil } -func (m *ProtoTransaction_VoutType) GetN() uint32 { - if m != nil { - return m.N +func (x *ProtoTransaction_VoutType) GetN() uint32 { + if x != nil { + return x.N } return 0 } -func (m *ProtoTransaction_VoutType) GetScriptPubKeyHex() []byte { - if m != nil { - return m.ScriptPubKeyHex +func (x *ProtoTransaction_VoutType) GetScriptPubKeyHex() []byte { + if x != nil { + return x.ScriptPubKeyHex } return nil } -func (m *ProtoTransaction_VoutType) GetAddresses() []string { - if m != nil { - return m.Addresses +func (x *ProtoTransaction_VoutType) GetAddresses() []string { + if x != nil { + return x.Addresses } return nil } -func init() { - proto.RegisterType((*ProtoTransaction)(nil), "bchain.ProtoTransaction") - proto.RegisterType((*ProtoTransaction_VinType)(nil), "bchain.ProtoTransaction.VinType") - proto.RegisterType((*ProtoTransaction_VoutType)(nil), "bchain.ProtoTransaction.VoutType") -} - -func init() { proto.RegisterFile("tx.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 346 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x41, 0x6e, 0xea, 0x30, - 0x14, 0x94, 0x89, 0x09, 0xe1, 0x7d, 0xd0, 0x47, 0x5e, 0x54, 0x16, 0xea, 0x22, 0x65, 0x95, 0x55, - 0x16, 0x54, 0x3d, 0x40, 0xdb, 0x0d, 0x52, 0x2b, 0x84, 0x1c, 0x94, 0x7d, 0x12, 0x2c, 0xb0, 0x4a, - 0x6d, 0x9a, 0x38, 0x12, 0x48, 0xbd, 0x51, 0x8f, 0xd0, 0xcb, 0x55, 0x7e, 0x84, 0x50, 0x90, 0xba, - 0xf3, 0x8c, 0xdf, 0x64, 0xe6, 0x4d, 0x0c, 0x81, 0xdd, 0xc7, 0xbb, 0xd2, 0x58, 0xc3, 0xfc, 0xbc, - 0xd8, 0x64, 0x4a, 0x4f, 0xbe, 0x29, 0x8c, 0x16, 0x8e, 0x59, 0x96, 0x99, 0xae, 0xb2, 0xc2, 0x2a, - 0xa3, 0x19, 0x03, 0xba, 0xdc, 0xab, 0x15, 0x27, 0x21, 0x89, 0x06, 0x02, 0xcf, 0x6c, 0x04, 0xde, - 0x4c, 0xee, 0x79, 0x07, 0x29, 0x77, 0x64, 0xb7, 0xd0, 0x7f, 0xda, 0x9a, 0xe2, 0xcd, 0xaa, 0x77, - 0xc9, 0xbd, 0x90, 0x44, 0x54, 0x9c, 0x09, 0x36, 0x86, 0xe0, 0xf5, 0x74, 0x49, 0x43, 0x12, 0x0d, - 0x45, 0x8b, 0xd9, 0x0d, 0xf8, 0x33, 0xa9, 0xd6, 0x1b, 0xcb, 0xbb, 0x78, 0xd3, 0x20, 0x36, 0x05, - 0x2f, 0x55, 0x9a, 0xfb, 0xa1, 0x17, 0xfd, 0x9b, 0x86, 0xf1, 0x31, 0x62, 0x7c, 0x1d, 0x2f, 0x4e, - 0x95, 0x5e, 0x1e, 0x76, 0x52, 0xb8, 0x61, 0xf6, 0x00, 0x34, 0x35, 0xb5, 0xe5, 0x3d, 0x14, 0xdd, - 0xfd, 0x2d, 0x32, 0xb5, 0x45, 0x15, 0x8e, 0x33, 0x0e, 0xbd, 0x54, 0x96, 0x95, 0x32, 0x9a, 0x07, - 0x21, 0x89, 0xba, 0xe2, 0x04, 0xc7, 0x5f, 0x04, 0x7a, 0x8d, 0x83, 0x5b, 0xe2, 0xd9, 0x28, 0x9d, - 0x67, 0x95, 0xc4, 0x32, 0xfa, 0xa2, 0xc5, 0x6d, 0x49, 0x9d, 0x5f, 0x25, 0xb1, 0x26, 0x8c, 0x87, - 0x6b, 0x1d, 0x9d, 0x26, 0x30, 0x48, 0x8a, 0x52, 0xed, 0x6c, 0xa2, 0xd6, 0xae, 0x41, 0x8a, 0xf3, - 0x17, 0x9c, 0xf3, 0x49, 0xe4, 0x47, 0x2d, 0x75, 0x21, 0x9b, 0x4a, 0x5a, 0xec, 0x6a, 0x7e, 0x5c, - 0xad, 0x4a, 0x59, 0x55, 0xb2, 0xc2, 0x6a, 0xfa, 0xe2, 0x4c, 0x8c, 0x3f, 0x21, 0x38, 0x6d, 0xe6, - 0xbe, 0x92, 0x66, 0xdb, 0x5a, 0x26, 0x99, 0x6d, 0x7e, 0x5d, 0x8b, 0xd9, 0x00, 0xc8, 0x1c, 0xa3, - 0x0e, 0x05, 0x99, 0xb3, 0x08, 0xfe, 0x1f, 0xfd, 0x17, 0x75, 0xfe, 0x22, 0x0f, 0x2e, 0x96, 0x87, - 0x82, 0x6b, 0xfa, 0xd2, 0x9d, 0x5e, 0xb9, 0xe7, 0x3e, 0x3e, 0xa6, 0xfb, 0x9f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xa1, 0x51, 0x2e, 0xba, 0x58, 0x02, 0x00, 0x00, +var File_bchain_tx_proto protoreflect.FileDescriptor + +var file_bchain_tx_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x62, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x62, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x22, 0xd1, 0x04, 0x0a, 0x10, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x54, 0x78, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x54, 0x78, + 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x48, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x48, 0x65, 0x78, 0x12, 0x1c, 0x0a, 0x09, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x69, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x6b, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x4c, 0x6f, 0x63, 0x6b, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x32, 0x0a, 0x03, 0x56, 0x69, 0x6e, 0x18, 0x06, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x62, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x69, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x03, 0x56, 0x69, 0x6e, 0x12, 0x35, 0x0a, 0x04, 0x56, 0x6f, + 0x75, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x62, 0x63, 0x68, 0x61, 0x69, + 0x6e, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x56, 0x6f, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x56, 0x6f, 0x75, + 0x74, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x56, + 0x53, 0x69, 0x7a, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x56, 0x53, 0x69, 0x7a, + 0x65, 0x1a, 0xab, 0x01, 0x0a, 0x07, 0x56, 0x69, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, + 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x43, 0x6f, 0x69, 0x6e, 0x62, 0x61, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x54, 0x78, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x54, 0x78, 0x69, 0x64, 0x12, 0x12, 0x0a, + 0x04, 0x56, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x56, 0x6f, 0x75, + 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x53, 0x69, 0x67, 0x48, 0x65, + 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x53, + 0x69, 0x67, 0x48, 0x65, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x06, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x1a, + 0x7c, 0x0a, 0x08, 0x56, 0x6f, 0x75, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x53, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x53, 0x61, 0x74, 0x12, 0x0c, 0x0a, 0x01, 0x4e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x52, 0x01, 0x4e, 0x12, 0x28, 0x0a, 0x0f, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x50, + 0x75, 0x62, 0x4b, 0x65, 0x79, 0x48, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, + 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x48, 0x65, 0x78, 0x12, + 0x1c, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x09, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x42, 0x09, 0x5a, + 0x07, 0x62, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_bchain_tx_proto_rawDescOnce sync.Once + file_bchain_tx_proto_rawDescData = file_bchain_tx_proto_rawDesc +) + +func file_bchain_tx_proto_rawDescGZIP() []byte { + file_bchain_tx_proto_rawDescOnce.Do(func() { + file_bchain_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_bchain_tx_proto_rawDescData) + }) + return file_bchain_tx_proto_rawDescData +} + +var file_bchain_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_bchain_tx_proto_goTypes = []interface{}{ + (*ProtoTransaction)(nil), // 0: bchain.ProtoTransaction + (*ProtoTransaction_VinType)(nil), // 1: bchain.ProtoTransaction.VinType + (*ProtoTransaction_VoutType)(nil), // 2: bchain.ProtoTransaction.VoutType +} +var file_bchain_tx_proto_depIdxs = []int32{ + 1, // 0: bchain.ProtoTransaction.Vin:type_name -> bchain.ProtoTransaction.VinType + 2, // 1: bchain.ProtoTransaction.Vout:type_name -> bchain.ProtoTransaction.VoutType + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_bchain_tx_proto_init() } +func file_bchain_tx_proto_init() { + if File_bchain_tx_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_bchain_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtoTransaction); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bchain_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtoTransaction_VinType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_bchain_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProtoTransaction_VoutType); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_bchain_tx_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_bchain_tx_proto_goTypes, + DependencyIndexes: file_bchain_tx_proto_depIdxs, + MessageInfos: file_bchain_tx_proto_msgTypes, + }.Build() + File_bchain_tx_proto = out.File + file_bchain_tx_proto_rawDesc = nil + file_bchain_tx_proto_goTypes = nil + file_bchain_tx_proto_depIdxs = nil } diff --git a/bchain/tx.proto b/bchain/tx.proto index cd5c7bc559..d64e844583 100644 --- a/bchain/tx.proto +++ b/bchain/tx.proto @@ -1,6 +1,7 @@ syntax = "proto3"; package bchain; - + option go_package = "bchain/"; + message ProtoTransaction { message VinType { string Coinbase = 1; @@ -24,4 +25,5 @@ syntax = "proto3"; repeated VinType Vin = 6; repeated VoutType Vout = 7; int32 Version = 8; + int64 VSize = 9; } \ No newline at end of file diff --git a/bchain/types.go b/bchain/types.go index 29d8f2b256..8e214ae1b1 100644 --- a/bchain/types.go +++ b/bchain/types.go @@ -39,146 +39,188 @@ var ( // Outpoint is txid together with output (or input) index type Outpoint struct { - Txid string - Vout int32 + Txid string `ts_doc:"Transaction ID of the referenced outpoint."` + Vout int32 `ts_doc:"Index of the specific output in the transaction."` } // ScriptSig contains data about input script type ScriptSig struct { // Asm string `json:"asm"` - Hex string `json:"hex"` + Hex string `json:"hex" ts_doc:"Hex-encoded representation of the scriptSig."` } // Vin contains data about tx input type Vin struct { - Coinbase string `json:"coinbase"` - Txid string `json:"txid"` - Vout uint32 `json:"vout"` - ScriptSig ScriptSig `json:"scriptSig"` - Sequence uint32 `json:"sequence"` - Addresses []string `json:"addresses"` + Coinbase string `json:"coinbase" ts_doc:"Coinbase data if this is a coinbase input."` + Txid string `json:"txid" ts_doc:"Transaction ID of the input being spent."` + Vout uint32 `json:"vout" ts_doc:"Output index in the referenced transaction."` + ScriptSig ScriptSig `json:"scriptSig" ts_doc:"scriptSig object containing the spending script data."` + Sequence uint32 `json:"sequence" ts_doc:"Sequence number for the input."` + Addresses []string `json:"addresses" ts_doc:"Addresses derived from this input's script (if known)."` + Witness [][]byte `json:"-" ts_doc:"Witness data for SegWit inputs (not exposed via JSON)."` } // ScriptPubKey contains data about output script type ScriptPubKey struct { // Asm string `json:"asm"` - Hex string `json:"hex,omitempty"` + Hex string `json:"hex,omitempty" ts_doc:"Hex-encoded representation of the scriptPubKey."` // Type string `json:"type"` - Addresses []string `json:"addresses"` + Addresses []string `json:"addresses" ts_doc:"Addresses derived from this output's script (if known)."` } // Vout contains data about tx output type Vout struct { - ValueSat big.Int - JsonValue common.JSONNumber `json:"value"` - N uint32 `json:"n"` - ScriptPubKey ScriptPubKey `json:"scriptPubKey"` + ValueSat big.Int `ts_doc:"Amount (in satoshi or base unit) for this output."` + JsonValue common.JSONNumber `json:"value" ts_doc:"String-based amount for JSON usage."` + N uint32 `json:"n" ts_doc:"Index of this output in the transaction."` + ScriptPubKey ScriptPubKey `json:"scriptPubKey" ts_doc:"scriptPubKey object containing the output script data."` } // Tx is blockchain transaction // unnecessary fields are commented out to avoid overhead type Tx struct { - Hex string `json:"hex"` - Txid string `json:"txid"` - Version int32 `json:"version"` - LockTime uint32 `json:"locktime"` - Vin []Vin `json:"vin"` - Vout []Vout `json:"vout"` - BlockHeight uint32 `json:"blockHeight,omitempty"` + Hex string `json:"hex" ts_doc:"Hex-encoded transaction data."` + Txid string `json:"txid" ts_doc:"Transaction ID (hash)."` + Version int32 `json:"version" ts_doc:"Transaction version number."` + LockTime uint32 `json:"locktime" ts_doc:"Locktime specifying earliest time/block a tx can be mined."` + VSize int64 `json:"vsize,omitempty" ts_doc:"Virtual size of the transaction (for SegWit-based networks)."` + Vin []Vin `json:"vin" ts_doc:"List of inputs."` + Vout []Vout `json:"vout" ts_doc:"List of outputs."` + BlockHeight uint32 `json:"blockHeight,omitempty" ts_doc:"Block height in which this transaction was included."` // BlockHash string `json:"blockhash,omitempty"` - Confirmations uint32 `json:"confirmations,omitempty"` - Time int64 `json:"time,omitempty"` - Blocktime int64 `json:"blocktime,omitempty"` - CoinSpecificData interface{} `json:"-"` + Confirmations uint32 `json:"confirmations,omitempty" ts_doc:"Number of confirmations the transaction has."` + Time int64 `json:"time,omitempty" ts_doc:"Timestamp when the transaction was broadcast or included in a block."` + Blocktime int64 `json:"blocktime,omitempty" ts_doc:"Timestamp of the block in which the transaction was mined."` + CoinSpecificData interface{} `json:"-" ts_doc:"Additional chain-specific data (not exposed via JSON)."` } -// MempoolVin contains data about tx input +// MempoolVin contains data about tx input specifically in mempool type MempoolVin struct { Vin - AddrDesc AddressDescriptor `json:"-"` - ValueSat big.Int + AddrDesc AddressDescriptor `json:"-" ts_doc:"Internal descriptor for the input address (not exposed)."` + ValueSat big.Int `ts_doc:"Amount (in satoshi or base unit) of the input."` } // MempoolTx is blockchain transaction in mempool // optimized for onNewTx notification type MempoolTx struct { - Hex string `json:"hex"` - Txid string `json:"txid"` - Version int32 `json:"version"` - LockTime uint32 `json:"locktime"` - Vin []MempoolVin `json:"vin"` - Vout []Vout `json:"vout"` - Blocktime int64 `json:"blocktime,omitempty"` - Erc20 []Erc20Transfer `json:"-"` - CoinSpecificData interface{} `json:"-"` + Hex string `json:"hex" ts_doc:"Hex-encoded transaction data."` + Txid string `json:"txid" ts_doc:"Transaction ID (hash)."` + Version int32 `json:"version" ts_doc:"Transaction version number."` + LockTime uint32 `json:"locktime" ts_doc:"Locktime specifying earliest time/block a tx can be mined."` + VSize int64 `json:"vsize,omitempty" ts_doc:"Virtual size of the transaction (if applicable)."` + Vin []MempoolVin `json:"vin" ts_doc:"List of inputs in this mempool transaction."` + Vout []Vout `json:"vout" ts_doc:"List of outputs in this mempool transaction."` + Blocktime int64 `json:"blocktime,omitempty" ts_doc:"Timestamp for the block in which tx might eventually be mined, if known."` + TokenTransfers TokenTransfers `json:"-" ts_doc:"Token transfers discovered in this mempool transaction (not exposed by default)."` + CoinSpecificData interface{} `json:"-" ts_doc:"Additional chain-specific data (not exposed via JSON)."` +} + +// TokenStandard - standard of token +type TokenStandard int + +// TokenStandard enumeration +const ( + FungibleToken = TokenStandard(iota) // ERC20/BEP20 + NonFungibleToken // ERC721/BEP721 + MultiToken // ERC1155/BEP1155 +) + +// TokenStandardName specifies standard of token +type TokenStandardName string + +// Token standards +const ( + UnknownTokenStandard TokenStandardName = "" + UnhandledTokenStandard TokenStandardName = "-" + + // XPUBAddressStandard is address derived from xpub + XPUBAddressStandard TokenStandardName = "XPUBAddress" +) + +// TokenTransfers is array of TokenTransfer +type TokenTransfers []*TokenTransfer + +func (a TokenTransfers) Len() int { return len(a) } +func (a TokenTransfers) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a TokenTransfers) Less(i, j int) bool { + return a[i].Standard < a[j].Standard } // Block is block header and list of transactions type Block struct { BlockHeader - Txs []Tx `json:"tx"` + Txs []Tx `json:"tx" ts_doc:"List of full transactions included in this block."` + CoinSpecificData interface{} `json:"-" ts_doc:"Additional chain-specific data (not exposed via JSON)."` } // BlockHeader contains limited data (as needed for indexing) from backend block header type BlockHeader struct { - Hash string `json:"hash"` - Prev string `json:"previousblockhash"` - Next string `json:"nextblockhash"` - Height uint32 `json:"height"` - Confirmations int `json:"confirmations"` - Size int `json:"size"` - Time int64 `json:"time,omitempty"` + Hash string `json:"hash" ts_doc:"Block hash."` + Prev string `json:"previousblockhash" ts_doc:"Hash of the previous block in the chain."` + Next string `json:"nextblockhash" ts_doc:"Hash of the next block, if known."` + Height uint32 `json:"height" ts_doc:"Block height (0-based index in the chain)."` + Confirmations int `json:"confirmations" ts_doc:"Number of confirmations (distance from best chain tip)."` + Size int `json:"size" ts_doc:"Block size in bytes."` + Time int64 `json:"time,omitempty" ts_doc:"Timestamp of when this block was mined."` } // BlockInfo contains extended block header data and a list of block txids type BlockInfo struct { BlockHeader - Version common.JSONNumber `json:"version"` - MerkleRoot string `json:"merkleroot"` - Nonce common.JSONNumber `json:"nonce"` - Bits string `json:"bits"` - Difficulty common.JSONNumber `json:"difficulty"` - Txids []string `json:"tx,omitempty"` + Version common.JSONNumber `json:"version" ts_doc:"Block version (chain-specific meaning)."` + MerkleRoot string `json:"merkleroot" ts_doc:"Merkle root of the block's transactions."` + Nonce common.JSONNumber `json:"nonce" ts_doc:"Nonce used in the mining process."` + Bits string `json:"bits" ts_doc:"Compact representation of the target threshold."` + Difficulty common.JSONNumber `json:"difficulty" ts_doc:"Difficulty target for mining this block."` + Txids []string `json:"tx,omitempty" ts_doc:"List of transaction IDs included in this block."` } // MempoolEntry is used to get data about mempool entry type MempoolEntry struct { - Size uint32 `json:"size"` - FeeSat big.Int - Fee common.JSONNumber `json:"fee"` - ModifiedFeeSat big.Int - ModifiedFee common.JSONNumber `json:"modifiedfee"` - Time uint64 `json:"time"` - Height uint32 `json:"height"` - DescendantCount uint32 `json:"descendantcount"` - DescendantSize uint32 `json:"descendantsize"` - DescendantFees uint32 `json:"descendantfees"` - AncestorCount uint32 `json:"ancestorcount"` - AncestorSize uint32 `json:"ancestorsize"` - AncestorFees uint32 `json:"ancestorfees"` - Depends []string `json:"depends"` + Size uint32 `json:"size" ts_doc:"Size of the transaction in bytes, as stored in mempool."` + FeeSat big.Int `ts_doc:"Transaction fee in satoshi/base units."` + Fee common.JSONNumber `json:"fee" ts_doc:"String-based fee for JSON usage."` + ModifiedFeeSat big.Int `ts_doc:"Modified fee in satoshi/base units after priority adjustments."` + ModifiedFee common.JSONNumber `json:"modifiedfee" ts_doc:"String-based modified fee for JSON usage."` + Time uint64 `json:"time" ts_doc:"Unix timestamp when the tx entered the mempool."` + Height uint32 `json:"height" ts_doc:"Block height when the tx entered the mempool."` + DescendantCount uint32 `json:"descendantcount" ts_doc:"Number of descendant transactions in mempool."` + DescendantSize uint32 `json:"descendantsize" ts_doc:"Total size of all descendant transactions in bytes."` + DescendantFees uint32 `json:"descendantfees" ts_doc:"Combined fees of all descendant transactions."` + AncestorCount uint32 `json:"ancestorcount" ts_doc:"Number of ancestor transactions in mempool."` + AncestorSize uint32 `json:"ancestorsize" ts_doc:"Total size of all ancestor transactions in bytes."` + AncestorFees uint32 `json:"ancestorfees" ts_doc:"Combined fees of all ancestor transactions."` + Depends []string `json:"depends" ts_doc:"List of txids this transaction depends on."` } // ChainInfo is used to get information about blockchain type ChainInfo struct { - Chain string `json:"chain"` - Blocks int `json:"blocks"` - Headers int `json:"headers"` - Bestblockhash string `json:"bestblockhash"` - Difficulty string `json:"difficulty"` - SizeOnDisk int64 `json:"size_on_disk"` - Version string `json:"version"` - Subversion string `json:"subversion"` - ProtocolVersion string `json:"protocolversion"` - Timeoffset float64 `json:"timeoffset"` - Warnings string `json:"warnings"` - Consensus interface{} `json:"consensus,omitempty"` + Chain string `json:"chain" ts_doc:"Name of the chain (e.g. 'main')."` + Blocks int `json:"blocks" ts_doc:"Number of fully verified blocks in the chain."` + Headers int `json:"headers" ts_doc:"Number of block headers in the chain (can be ahead of full blocks)."` + Bestblockhash string `json:"bestblockhash" ts_doc:"Hash of the best (latest) block."` + Difficulty string `json:"difficulty" ts_doc:"Current difficulty of the network."` + SizeOnDisk int64 `json:"size_on_disk" ts_doc:"Size of the blockchain data on disk in bytes."` + Version string `json:"version" ts_doc:"Version of the blockchain backend."` + Subversion string `json:"subversion" ts_doc:"Subversion string of the blockchain backend."` + ProtocolVersion string `json:"protocolversion" ts_doc:"Protocol version for this chain node."` + Timeoffset float64 `json:"timeoffset" ts_doc:"Time offset (in seconds) reported by the node."` + Warnings string `json:"warnings" ts_doc:"Any warnings generated by the node regarding the chain state."` + ConsensusVersion string `json:"consensus_version,omitempty" ts_doc:"Version of the chain's consensus protocol, if available."` + Consensus interface{} `json:"consensus,omitempty" ts_doc:"Additional consensus details, structure depends on chain."` +} + +// LongTermFeeRate gets information about the fee rate over longer period of time. +type LongTermFeeRate struct { + FeePerUnit big.Int `json:"feePerUnit" ts_doc:"Long term fee rate (in sat/kByte)."` + Blocks uint64 `json:"blocks" ts_doc:"Amount of blocks used for the long term fee rate estimation."` } // RPCError defines rpc error returned by backend type RPCError struct { - Code int `json:"code"` - Message string `json:"message"` + Code int `json:"code" ts_doc:"Error code returned by the backend RPC."` + Message string `json:"message" ts_doc:"Human-readable error message."` } func (e *RPCError) Error() string { @@ -192,6 +234,13 @@ func (ad AddressDescriptor) String() string { return "ad:" + hex.EncodeToString(ad) } +func (ad AddressDescriptor) IsTaproot() bool { + if len(ad) == 34 && ad[0] == 0x51 && ad[1] == 0x20 { + return true + } + return false +} + // AddressDescriptorFromString converts string created by AddressDescriptor.String to AddressDescriptor func AddressDescriptorFromString(s string) (AddressDescriptor, error) { if len(s) > 3 && s[0:3] == "ad:" { @@ -200,28 +249,10 @@ func AddressDescriptorFromString(s string) (AddressDescriptor, error) { return nil, errors.New("invalid address descriptor") } -// EthereumType specific - -// Erc20Contract contains info about ERC20 contract -type Erc20Contract struct { - Contract string `json:"contract"` - Name string `json:"name"` - Symbol string `json:"symbol"` - Decimals int `json:"decimals"` -} - -// Erc20Transfer contains a single ERC20 token transfer -type Erc20Transfer struct { - Contract string - From string - To string - Tokens big.Int -} - // MempoolTxidEntry contains mempool txid with first seen time type MempoolTxidEntry struct { - Txid string - Time uint32 + Txid string `ts_doc:"Transaction ID (hash) of the mempool entry."` + Time uint32 `ts_doc:"Unix timestamp when the transaction was first seen in the mempool."` } // ScriptType - type of output script parsed from xpub (descriptor) @@ -238,17 +269,24 @@ const ( // XpubDescriptor contains parsed data from xpub descriptor type XpubDescriptor struct { - XpubDescriptor string // The whole descriptor - Xpub string // Xpub part of the descriptor - Type ScriptType - Bip string - ChangeIndexes []uint32 - ExtKey interface{} // extended key parsed from xpub, usually of type *hdkeychain.ExtendedKey + XpubDescriptor string `ts_doc:"Full descriptor string including xpub and script type."` + Xpub string `ts_doc:"The xpub part itself extracted from the descriptor."` + Type ScriptType `ts_doc:"Parsed script type (P2PKH, P2WPKH, etc.)."` + Bip string `ts_doc:"BIP standard (e.g. BIP44) inferred from the descriptor."` + ChangeIndexes []uint32 `ts_doc:"Indexes designated as change addresses."` + ExtKey interface{} `ts_doc:"Extended key object parsed from xpub (implementation-specific)."` } // MempoolTxidEntries is array of MempoolTxidEntry type MempoolTxidEntries []MempoolTxidEntry +// MempoolTxidFilterEntries is a map of txids to mempool golomb filters +// Also contains a flag whether constant zeroed key was used when calculating the filters +type MempoolTxidFilterEntries struct { + Entries map[string]string `json:"entries,omitempty" ts_doc:"Map of txid to filter data (hex-encoded)."` + UsedZeroedKey bool `json:"usedZeroedKey,omitempty" ts_doc:"Indicates if a zeroed key was used in filter calculation."` +} + // OnNewBlockFunc is used to send notification about a new block type OnNewBlockFunc func(hash string, height uint32) @@ -292,16 +330,23 @@ type BlockChain interface { GetTransactionSpecific(tx *Tx) (json.RawMessage, error) EstimateSmartFee(blocks int, conservative bool) (big.Int, error) EstimateFee(blocks int) (big.Int, error) - SendRawTransaction(tx string) (string, error) + LongTermFeeRate() (*LongTermFeeRate, error) + SendRawTransaction(tx string, disableAlternativeRPC bool) (string, error) GetMempoolEntry(txid string) (*MempoolEntry, error) + GetContractInfo(contractDesc AddressDescriptor) (*ContractInfo, error) // parser GetChainParser() BlockChainParser // EthereumType specific EthereumTypeGetBalance(addrDesc AddressDescriptor) (*big.Int, error) EthereumTypeGetNonce(addrDesc AddressDescriptor) (uint64, error) EthereumTypeEstimateGas(params map[string]interface{}) (uint64, error) - EthereumTypeGetErc20ContractInfo(contractDesc AddressDescriptor) (*Erc20Contract, error) + EthereumTypeGetEip1559Fees() (*Eip1559Fees, error) EthereumTypeGetErc20ContractBalance(addrDesc, contractDesc AddressDescriptor) (*big.Int, error) + EthereumTypeGetSupportedStakingPools() []string + EthereumTypeGetStakingPoolsData(addrDesc AddressDescriptor) ([]StakingPoolData, error) + EthereumTypeRpcCall(data, to, from string) (string, error) + EthereumTypeGetRawTransaction(txid string) (string, error) + GetTokenURI(contractDesc AddressDescriptor, tokenID *big.Int) (string, error) } // BlockChainParser defines common interface to parsing and conversions of block chain data @@ -313,8 +358,12 @@ type BlockChainParser interface { KeepBlockAddresses() int // AmountDecimals returns number of decimal places in coin amounts AmountDecimals() int + // UseAddressAliases returns true if address aliases are enabled + UseAddressAliases() bool // MinimumCoinbaseConfirmations returns minimum number of confirmations a coinbase transaction must have before it can be spent MinimumCoinbaseConfirmations() int + // SupportsVSize returns true if vsize of a transaction should be computed and returned by API + SupportsVSize() bool // AmountToDecimalString converts amount in big.Int to string with decimal point in the correct place AmountToDecimalString(a *big.Int) string // AmountToBigInt converts amount in common.JSONNumber (string) to big.Int @@ -345,7 +394,9 @@ type BlockChainParser interface { DeriveAddressDescriptors(descriptor *XpubDescriptor, change uint32, indexes []uint32) ([]AddressDescriptor, error) DeriveAddressDescriptorsFromTo(descriptor *XpubDescriptor, change uint32, fromIndex uint32, toIndex uint32) ([]AddressDescriptor, error) // EthereumType specific - EthereumTypeGetErc20FromTx(tx *Tx) ([]Erc20Transfer, error) + EthereumTypeGetTokenTransfersFromTx(tx *Tx) (TokenTransfers, error) + // AddressAlias + FormatAddressAlias(address string, name string) string } // Mempool defines common interface to mempool @@ -355,4 +406,5 @@ type Mempool interface { GetAddrDescTransactions(addrDesc AddressDescriptor) ([]Outpoint, error) GetAllEntries() MempoolTxidEntries GetTransactionTime(txid string) uint32 + GetTxidFilterEntries(filterScripts string, fromTimestamp uint32) (MempoolTxidFilterEntries, error) } diff --git a/bchain/types_ethereum_type.go b/bchain/types_ethereum_type.go new file mode 100644 index 0000000000..b93632ec45 --- /dev/null +++ b/bchain/types_ethereum_type.go @@ -0,0 +1,194 @@ +package bchain + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/accounts/abi" +) + +// EthereumInternalTransfer contains data about internal transfer +type EthereumInternalTransfer struct { + Type EthereumInternalTransactionType `json:"type" ts_doc:"The type of internal transaction (CALL, CREATE, SELFDESTRUCT)."` + From string `json:"from" ts_doc:"Sender address of this internal transfer."` + To string `json:"to" ts_doc:"Recipient address of this internal transfer."` + Value big.Int `json:"value" ts_doc:"Amount (in Wei) transferred internally."` +} + +// FourByteSignature contains data about a contract function signature +type FourByteSignature struct { + // stored in DB + Name string `ts_doc:"Original function name as stored in the database."` + Parameters []string `ts_doc:"Raw parameter type definitions (e.g. ['uint256','address'])."` + // processed from DB data and stored only in cache + DecamelName string `ts_doc:"A decamelized version of the function name for readability."` + Function string `ts_doc:"Reconstructed function definition string (e.g. 'transfer(address,uint256)')."` + ParsedParameters []abi.Type `ts_doc:"ABI-parsed parameter types (cached for efficiency)."` +} + +// EthereumParsedInputParam contains data about a contract function parameter +type EthereumParsedInputParam struct { + Type string `json:"type" ts_doc:"Parameter type (e.g. 'uint256')."` + Values []string `json:"values,omitempty" ts_doc:"List of stringified parameter values."` +} + +// EthereumParsedInputData contains the parsed data for an input data hex payload +type EthereumParsedInputData struct { + MethodId string `json:"methodId" ts_doc:"First 4 bytes of the input data (method signature ID)."` + Name string `json:"name" ts_doc:"Parsed function name if recognized."` + Function string `json:"function,omitempty" ts_doc:"Full function signature (including parameter types)."` + Params []EthereumParsedInputParam `json:"params,omitempty" ts_doc:"List of parsed parameters for this function call."` +} + +// EthereumInternalTransactionType - type of ethereum transaction from internal data +type EthereumInternalTransactionType int + +// EthereumInternalTransactionType enumeration +const ( + CALL = EthereumInternalTransactionType(iota) + CREATE + SELFDESTRUCT +) + +// EthereumInternalData contains internal transfers +type EthereumInternalData struct { + Type EthereumInternalTransactionType `json:"type" ts_doc:"High-level type of the internal transaction (CALL, CREATE, etc.)."` + Contract string `json:"contract,omitempty" ts_doc:"Address of the contract involved, if any."` + Transfers []EthereumInternalTransfer `json:"transfers,omitempty" ts_doc:"List of internal transfers associated with this data."` + Error string `ts_doc:"Error message if something went wrong while processing."` +} + +// ContractInfo contains info about a contract +type ContractInfo struct { + // Deprecated: Use Standard instead. + Type TokenStandardName `json:"type" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'" ts_doc:"@deprecated: Use standard instead."` + Standard TokenStandardName `json:"standard" ts_type:"'' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'"` + Contract string `json:"contract" ts_doc:"Smart contract address."` + Name string `json:"name" ts_doc:"Readable name of the contract."` + Symbol string `json:"symbol" ts_doc:"Symbol for tokens under this contract, if applicable."` + Decimals int `json:"decimals" ts_doc:"Number of decimal places, if applicable."` + CreatedInBlock uint32 `json:"createdInBlock,omitempty" ts_doc:"Block height where contract was first created."` + DestructedInBlock uint32 `json:"destructedInBlock,omitempty" ts_doc:"Block height where contract was destroyed (if any)."` +} + +// Ethereum token standard names +const ( + ERC20TokenStandard TokenStandardName = "ERC20" + ERC771TokenStandard TokenStandardName = "ERC721" + ERC1155TokenStandard TokenStandardName = "ERC1155" +) + +// EthereumTokenStandardMap maps bchain.TokenStandard to TokenStandardName +// the map must match all bchain.TokenStandard to avoid index out of range panic +var EthereumTokenStandardMap = []TokenStandardName{ERC20TokenStandard, ERC771TokenStandard, ERC1155TokenStandard} + +// MultiTokenValue holds one ID-value pair for multi-token standards like ERC1155 +type MultiTokenValue struct { + Id big.Int `ts_doc:"Token ID for this multi-token entry."` + Value big.Int `ts_doc:"Amount of the token ID transferred or owned."` +} + +// TokenTransfer contains a single token transfer +type TokenTransfer struct { + Standard TokenStandard `ts_doc:"Integer value od the token standard."` + Contract string `ts_doc:"Smart contract address for the token."` + From string `ts_doc:"Sender address of the token transfer."` + To string `ts_doc:"Recipient address of the token transfer."` + Value big.Int `ts_doc:"Amount of tokens transferred (for fungible tokens)."` + MultiTokenValues []MultiTokenValue `ts_doc:"List of ID-value pairs for multi-token transfers (e.g., ERC1155)."` +} + +// RpcTransaction is returned by eth_getTransactionByHash +type RpcTransaction struct { + AccountNonce string `json:"nonce" ts_doc:"Transaction nonce from the sender's account."` + GasPrice string `json:"gasPrice" ts_doc:"Gas price bid by the sender in Wei."` + MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas,omitempty"` + MaxFeePerGas string `json:"maxFeePerGas,omitempty"` + BaseFeePerGas string `json:"baseFeePerGas,omitempty"` + GasLimit string `json:"gas" ts_doc:"Maximum gas allowed for this transaction."` + To string `json:"to" ts_doc:"Recipient address if not a contract creation. Empty if it's contract creation."` + Value string `json:"value" ts_doc:"Amount of Ether (in Wei) sent in this transaction."` + Payload string `json:"input" ts_doc:"Hex-encoded input data for contract calls."` + Hash string `json:"hash" ts_doc:"Transaction hash."` + BlockNumber string `json:"blockNumber" ts_doc:"Block number where this transaction was included, if mined."` + BlockHash string `json:"blockHash,omitempty" ts_doc:"Hash of the block in which this transaction was included, if mined."` + From string `json:"from" ts_doc:"Sender's address derived by the backend."` + TransactionIndex string `json:"transactionIndex" ts_doc:"Index of the transaction within the block, if mined."` + // Signature values - ignored + // V string `json:"v"` + // R string `json:"r"` + // S string `json:"s"` +} + +// RpcLog is returned by eth_getLogs +type RpcLog struct { + Address string `json:"address" ts_doc:"Contract or address from which this log originated."` + Topics []string `json:"topics" ts_doc:"Indexed event signatures and parameters."` + Data string `json:"data" ts_doc:"Unindexed event data in hex form."` +} + +// RpcReceipt is returned by eth_getTransactionReceipt +type RpcReceipt struct { + GasUsed string `json:"gasUsed" ts_doc:"Amount of gas actually used by the transaction."` + Status string `json:"status" ts_doc:"Transaction execution status (0x0 = fail, 0x1 = success)."` + Logs []*RpcLog `json:"logs" ts_doc:"Array of log entries generated by this transaction."` + L1Fee string `json:"l1Fee,omitempty" ts_doc:"Additional Layer 1 fee, if on a rollup network."` + L1FeeScalar string `json:"l1FeeScalar,omitempty" ts_doc:"Fee scaling factor for L1 fees on some L2s."` + L1GasPrice string `json:"l1GasPrice,omitempty" ts_doc:"Gas price used on L1 for the rollup network."` + L1GasUsed string `json:"l1GasUsed,omitempty" ts_doc:"Amount of L1 gas used by the transaction, if any."` +} + +// EthereumSpecificData contains data specific to Ethereum transactions +type EthereumSpecificData struct { + Tx *RpcTransaction `json:"tx" ts_doc:"Raw transaction details from the blockchain node."` + InternalData *EthereumInternalData `json:"internalData,omitempty" ts_doc:"Summary of internal calls/transfers, if any."` + Receipt *RpcReceipt `json:"receipt,omitempty" ts_doc:"Transaction receipt info, including logs and gas usage."` +} + +// AddressAliasRecord maps address to ENS name +type AddressAliasRecord struct { + Address string `ts_doc:"Address whose alias is being stored."` + Name string `ts_doc:"The resolved name/alias (e.g. ENS domain)."` +} + +// EthereumBlockSpecificData contain data specific for Ethereum block +type EthereumBlockSpecificData struct { + InternalDataError string `ts_doc:"Error message for processing block internal data, if any."` + AddressAliasRecords []AddressAliasRecord `ts_doc:"List of address-to-alias mappings discovered in this block."` + Contracts []ContractInfo `ts_doc:"List of contracts created or updated in this block."` +} + +// StakingPoolData holds data about address participation in a staking pool contract +type StakingPoolData struct { + Contract string `json:"contract" ts_doc:"Address of the staking pool contract."` + Name string `json:"name" ts_doc:"Human-readable name of the staking pool."` + PendingBalance big.Int `json:"pendingBalance" ts_doc:"Amount not yet finalized in the pool (pendingBalanceOf)."` + PendingDepositedBalance big.Int `json:"pendingDepositedBalance" ts_doc:"Amount pending deposit (pendingDepositedBalanceOf)."` + DepositedBalance big.Int `json:"depositedBalance" ts_doc:"Total amount currently deposited (depositedBalanceOf)."` + WithdrawTotalAmount big.Int `json:"withdrawTotalAmount" ts_doc:"Total amount requested for withdrawal (withdrawRequest[0])."` + ClaimableAmount big.Int `json:"claimableAmount" ts_doc:"Amount that can be claimed (withdrawRequest[1])."` + RestakedReward big.Int `json:"restakedReward" ts_doc:"Total reward that has been restaked (restakedRewardOf)."` + AutocompoundBalance big.Int `json:"autocompoundBalance" ts_doc:"Auto-compounded balance (autocompoundBalanceOf)."` +} + +// Eip1559Fee +type Eip1559Fee struct { + MaxFeePerGas *big.Int `json:"maxFeePerGas"` + MaxPriorityFeePerGas *big.Int `json:"maxPriorityFeePerGas"` + MinWaitTimeEstimate int `json:"minWaitTimeEstimate,omitempty"` + MaxWaitTimeEstimate int `json:"maxWaitTimeEstimate,omitempty"` +} + +// Eip1559Fees +type Eip1559Fees struct { + BaseFeePerGas *big.Int `json:"baseFeePerGas,omitempty"` + Low *Eip1559Fee `json:"low,omitempty"` + Medium *Eip1559Fee `json:"medium,omitempty"` + High *Eip1559Fee `json:"high,omitempty"` + Instant *Eip1559Fee `json:"instant,omitempty"` + NetworkCongestion float64 `json:"networkCongestion,omitempty"` + LatestPriorityFeeRange []*big.Int `json:"latestPriorityFeeRange,omitempty"` + HistoricalPriorityFeeRange []*big.Int `json:"historicalPriorityFeeRange,omitempty"` + HistoricalBaseFeeRange []*big.Int `json:"historicalBaseFeeRange,omitempty"` + PriorityFeeTrend string `json:"priorityFeeTrend,omitempty"` + BaseFeeTrend string `json:"baseFeeTrend,omitempty"` +} diff --git a/blockbook-api.ts b/blockbook-api.ts new file mode 100644 index 0000000000..56ec8ae73c --- /dev/null +++ b/blockbook-api.ts @@ -0,0 +1,815 @@ +/* Do not change, this code is generated from Golang structs */ + +export interface APIError { + /** Human-readable error message describing the issue. */ + Text: string; + /** Whether the error message can safely be shown to the end user. */ + Public: boolean; +} +export interface AddressAlias { + /** Type of alias, e.g., user-defined name or contract name. */ + Type: string; + /** Alias string for the address. */ + Alias: string; +} +export interface EthereumInternalTransfer { + /** Type of internal transfer (CALL, CREATE, etc.). */ + type: number; + /** Address from which the transfer originated. */ + from: string; + /** Address to which the transfer was sent. */ + to: string; + /** Value transferred internally (in Wei or base units). */ + value: string; +} +export interface EthereumParsedInputParam { + /** Parameter type (e.g. 'uint256'). */ + type: string; + /** List of stringified parameter values. */ + values?: string[]; +} +export interface EthereumParsedInputData { + /** First 4 bytes of the input data (method signature ID). */ + methodId: string; + /** Parsed function name if recognized. */ + name: string; + /** Full function signature (including parameter types). */ + function?: string; + /** List of parsed parameters for this function call. */ + params?: EthereumParsedInputParam[]; +} +export interface EthereumSpecific { + /** High-level type of the Ethereum tx (e.g., 'call', 'create'). */ + type?: number; + /** Address of contract created by this transaction, if any. */ + createdContract?: string; + /** Execution status of the transaction (1: success, 0: fail, -1: pending). */ + status: number; + /** Error encountered during execution, if any. */ + error?: string; + /** Transaction nonce (sequential number from the sender). */ + nonce: number; + /** Maximum gas allowed by the sender for this transaction. */ + gasLimit: number; + /** Actual gas consumed by the transaction execution. */ + gasUsed?: number; + /** Price (in Wei or base units) per gas unit. */ + gasPrice?: string; + maxPriorityFeePerGas?: string; + maxFeePerGas?: string; + baseFeePerGas?: string; + /** Fee used for L1 part in rollups (e.g. Optimism). */ + l1Fee?: number; + /** Scaling factor for L1 fees in certain Layer 2 solutions. */ + l1FeeScalar?: string; + /** Gas price for L1 component, if applicable. */ + l1GasPrice?: string; + /** Amount of gas used in L1 for this tx, if applicable. */ + l1GasUsed?: number; + /** Hex-encoded input data for the transaction. */ + data?: string; + /** Decoded transaction data (function name, params, etc.). */ + parsedData?: EthereumParsedInputData; + /** List of internal (sub-call) transfers. */ + internalTransfers?: EthereumInternalTransfer[]; +} +export interface MultiTokenValue { + /** Token ID (for ERC1155). */ + id?: string; + /** Amount of that specific token ID. */ + value?: string; +} +export interface TokenTransfer { + /** @deprecated: Use standard instead. */ + type: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + standard: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + /** Source address of the token transfer. */ + from: string; + /** Destination address of the token transfer. */ + to: string; + /** Contract address of the token. */ + contract: string; + /** Token name. */ + name?: string; + /** Token symbol. */ + symbol?: string; + /** Number of decimals for this token (if applicable). */ + decimals: number; + /** Amount (in base units) of tokens transferred. */ + value?: string; + /** List of multiple ID-value pairs for ERC1155 transfers. */ + multiTokenValues?: MultiTokenValue[]; +} +export interface Vout { + /** Amount (in satoshi or base units) of the output. */ + value?: string; + /** Relative index of this output within the transaction. */ + n: number; + /** Indicates whether this output has been spent. */ + spent?: boolean; + /** Transaction ID in which this output was spent. */ + spentTxId?: string; + /** Index of the input that spent this output. */ + spentIndex?: number; + /** Block height at which this output was spent. */ + spentHeight?: number; + /** Raw script hex data for this output - aka ScriptPubKey. */ + hex?: string; + /** Disassembled script for this output. */ + asm?: string; + /** List of addresses associated with this output. */ + addresses: string[]; + /** Indicates whether this output is owned by valid address. */ + isAddress: boolean; + /** Indicates if this output belongs to the wallet in context. */ + isOwn?: boolean; + /** Output script type (e.g., 'P2PKH', 'P2SH'). */ + type?: string; +} +export interface Vin { + /** ID/hash of the originating transaction (where the UTXO comes from). */ + txid?: string; + /** Index of the output in the referenced transaction. */ + vout?: number; + /** Sequence number for this input (e.g. 4294967293). */ + sequence?: number; + /** Relative index of this input within the transaction. */ + n: number; + /** List of addresses associated with this input. */ + addresses?: string[]; + /** Indicates if this input is from a known address. */ + isAddress: boolean; + /** Indicates if this input belongs to the wallet in context. */ + isOwn?: boolean; + /** Amount (in satoshi or base units) of the input. */ + value?: string; + /** Raw script hex data for this input. */ + hex?: string; + /** Disassembled script for this input. */ + asm?: string; + /** Data for coinbase inputs (when mining). */ + coinbase?: string; +} +export interface Tx { + /** Transaction ID (hash). */ + txid: string; + /** Version of the transaction (if applicable). */ + version?: number; + /** Locktime indicating earliest time/height transaction can be mined. */ + lockTime?: number; + /** Array of inputs for this transaction. */ + vin: Vin[]; + /** Array of outputs for this transaction. */ + vout: Vout[]; + /** Hash of the block containing this transaction. */ + blockHash?: string; + /** Block height in which this transaction was included. */ + blockHeight: number; + /** Number of confirmations (blocks mined after this tx's block). */ + confirmations: number; + /** Estimated blocks remaining until confirmation (if unconfirmed). */ + confirmationETABlocks?: number; + /** Estimated seconds remaining until confirmation (if unconfirmed). */ + confirmationETASeconds?: number; + /** Unix timestamp of the block in which this transaction was included. 0 if unconfirmed. */ + blockTime: number; + /** Transaction size in bytes. */ + size?: number; + /** Virtual size in bytes, for SegWit-enabled chains. */ + vsize?: number; + /** Total value of all outputs (in satoshi or base units). */ + value: string; + /** Total value of all inputs (in satoshi or base units). */ + valueIn?: string; + /** Transaction fee (inputs - outputs). */ + fees?: string; + /** Raw hex-encoded transaction data. */ + hex?: string; + /** Indicates if this transaction is replace-by-fee (RBF) enabled. */ + rbf?: boolean; + /** Blockchain-specific extended data. */ + coinSpecificData?: any; + /** List of token transfers that occurred in this transaction. */ + tokenTransfers?: TokenTransfer[]; + /** Ethereum-like blockchain specific data (if applicable). */ + ethereumSpecific?: EthereumSpecific; + /** Aliases for addresses involved in this transaction. */ + addressAliases?: { [key: string]: AddressAlias }; +} +export interface FeeStats { + /** Number of transactions in the given block. */ + txCount: number; + /** Sum of all fees in satoshi or base units. */ + totalFeesSat: string; + /** Average fee per kilobyte in satoshi or base units. */ + averageFeePerKb: number; + /** Fee distribution deciles (0%..100%) in satoshi or base units per kB. */ + decilesFeePerKb: number[]; +} +export interface StakingPool { + /** Staking pool contract address on-chain. */ + contract: string; + /** Name of the staking pool contract. */ + name: string; + /** Balance pending deposit or withdrawal, if any. */ + pendingBalance: string; + /** Any pending deposit that is not yet finalized. */ + pendingDepositedBalance: string; + /** Currently deposited/staked balance. */ + depositedBalance: string; + /** Total amount withdrawn from this pool by the address. */ + withdrawTotalAmount: string; + /** Rewards or principal currently claimable by the address. */ + claimableAmount: string; + /** Total rewards that have been restaked automatically. */ + restakedReward: string; + /** Any balance automatically reinvested into the pool. */ + autocompoundBalance: string; +} +export interface ContractInfo { + /** @deprecated: Use standard instead. */ + type: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + standard: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + /** Smart contract address. */ + contract: string; + /** Readable name of the contract. */ + name: string; + /** Symbol for tokens under this contract, if applicable. */ + symbol: string; + /** Number of decimal places, if applicable. */ + decimals: number; + /** Block height where contract was first created. */ + createdInBlock?: number; + /** Block height where contract was destroyed (if any). */ + destructedInBlock?: number; +} +export interface Token { + /** @deprecated: Use standard instead. */ + type: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + standard: '' | 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155' | 'BEP20' | 'BEP721' | 'BEP1155'; + /** Readable name of the token. */ + name: string; + /** Derivation path if this token is derived from an XPUB-based address. */ + path?: string; + /** Contract address on-chain. */ + contract?: string; + /** Total number of token transfers for this address. */ + transfers: number; + /** Symbol for the token (e.g., 'ETH', 'USDT'). */ + symbol?: string; + /** Number of decimals for this token. */ + decimals: number; + /** Current token balance (in minimal base units). */ + balance?: string; + /** Value in the base currency (e.g. ETH for ERC20 tokens). */ + baseValue?: number; + /** Value in a secondary currency (e.g. fiat), if available. */ + secondaryValue?: number; + /** List of token IDs (for ERC721, each ID is a unique collectible). */ + ids?: string[]; + /** Multiple ERC1155 token balances (id + value). */ + multiTokenValues?: MultiTokenValue[]; + /** Total amount of tokens received. */ + totalReceived?: string; + /** Total amount of tokens sent. */ + totalSent?: string; +} +export interface Address { + /** Current page index. */ + page?: number; + /** Total number of pages available. */ + totalPages?: number; + /** Number of items returned on this page. */ + itemsOnPage?: number; + /** The address string in standard format. */ + address: string; + /** Current confirmed balance (in satoshi or base units). */ + balance: string; + /** Total amount ever received by this address. */ + totalReceived?: string; + /** Total amount ever sent by this address. */ + totalSent?: string; + /** Unconfirmed balance for this address. */ + unconfirmedBalance: string; + /** Number of unconfirmed transactions for this address. */ + unconfirmedTxs: number; + /** Unconfirmed outgoing balance for this address. */ + unconfirmedSending?: string; + /** Unconfirmed incoming balance for this address. */ + unconfirmedReceiving?: string; + /** Number of transactions for this address (including confirmed). */ + txs: number; + /** Historical total count of transactions, if known. */ + addrTxCount?: number; + /** Number of transactions not involving tokens (pure coin transfers). */ + nonTokenTxs?: number; + /** Number of internal transactions (e.g., Ethereum calls). */ + internalTxs?: number; + /** List of transaction details (if requested). */ + transactions?: Tx[]; + /** List of transaction IDs (if detailed data is not requested). */ + txids?: string[]; + /** Current transaction nonce for Ethereum-like addresses. */ + nonce?: string; + /** Number of tokens with any historical usage at this address. */ + usedTokens?: number; + /** List of tokens associated with this address. */ + tokens?: Token[]; + /** Total value of the address in secondary currency (e.g. fiat). */ + secondaryValue?: number; + /** Sum of token values in base currency. */ + tokensBaseValue?: number; + /** Sum of token values in secondary currency (fiat). */ + tokensSecondaryValue?: number; + /** Address's entire value in base currency, including tokens. */ + totalBaseValue?: number; + /** Address's entire value in secondary currency, including tokens. */ + totalSecondaryValue?: number; + /** Extra info if the address is a contract (ABI, type). */ + contractInfo?: ContractInfo; + /** @deprecated: replaced by contractInfo */ + erc20Contract?: ContractInfo; + /** Aliases assigned to this address. */ + addressAliases?: { [key: string]: AddressAlias }; + /** List of staking pool data if address interacts with staking. */ + stakingPools?: StakingPool[]; +} +export interface Utxo { + /** Transaction ID in which this UTXO was created. */ + txid: string; + /** Index of the output in that transaction. */ + vout: number; + /** Value of this UTXO (in satoshi or base units). */ + value: string; + /** Block height in which the UTXO was confirmed. */ + height?: number; + /** Number of confirmations for this UTXO. */ + confirmations: number; + /** Address to which this UTXO belongs. */ + address?: string; + /** Derivation path for XPUB-based wallets, if applicable. */ + path?: string; + /** If non-zero, locktime required before spending this UTXO. */ + lockTime?: number; + /** Indicates if this UTXO originated from a coinbase transaction. */ + coinbase?: boolean; +} +export interface BalanceHistory { + /** Unix timestamp for this point in the balance history. */ + time: number; + /** Number of transactions in this interval. */ + txs: number; + /** Amount received in this interval (in satoshi or base units). */ + received: string; + /** Amount sent in this interval (in satoshi or base units). */ + sent: string; + /** Amount sent to the same address (self-transfer). */ + sentToSelf: string; + /** Exchange rates at this point in time, if available. */ + rates?: { [key: string]: number }; + /** Transaction ID if the time corresponds to a specific tx. */ + txid?: string; +} +export interface BlockInfo { + Hash: string; + Time: number; + Txs: number; + Size: number; + Height: number; +} +export interface Blocks { + /** Current page index. */ + page?: number; + /** Total number of pages available. */ + totalPages?: number; + /** Number of items returned on this page. */ + itemsOnPage?: number; + /** List of blocks. */ + blocks: BlockInfo[]; +} +export interface Block { + /** Current page index. */ + page?: number; + /** Total number of pages available. */ + totalPages?: number; + /** Number of items returned on this page. */ + itemsOnPage?: number; + /** Block hash. */ + hash: string; + /** Hash of the previous block in the chain. */ + previousBlockHash?: string; + /** Hash of the next block, if known. */ + nextBlockHash?: string; + /** Block height (0-based index in the chain). */ + height: number; + /** Number of confirmations of this block (distance from best chain tip). */ + confirmations: number; + /** Size of the block in bytes. */ + size: number; + /** Timestamp of when this block was mined. */ + time?: number; + /** Block version (chain-specific meaning). */ + version: string; + /** Merkle root of the block's transactions. */ + merkleRoot: string; + /** Nonce used in the mining process. */ + nonce: string; + /** Compact representation of the target threshold. */ + bits: string; + /** Difficulty target for mining this block. */ + difficulty: string; + /** List of transaction IDs included in this block. */ + tx?: string[]; + /** Total count of transactions in this block. */ + txCount: number; + /** List of full transaction details (if requested). */ + txs?: Tx[]; + /** Optional aliases for addresses found in this block. */ + addressAliases?: { [key: string]: AddressAlias }; +} +export interface BlockRaw { + /** Hex-encoded block data. */ + hex: string; +} +export interface BackendInfo { + /** Error message if something went wrong in the backend. */ + error?: string; + /** Name of the chain - e.g. 'main'. */ + chain?: string; + /** Number of fully verified blocks in the chain. */ + blocks?: number; + /** Number of block headers in the chain. */ + headers?: number; + /** Hash of the best block in hex. */ + bestBlockHash?: string; + /** Current difficulty of the network. */ + difficulty?: string; + /** Size of the blockchain data on disk in bytes. */ + sizeOnDisk?: number; + /** Version of the blockchain backend - e.g. '280000'. */ + version?: string; + /** Subversion of the blockchain backend - e.g. '/Satoshi:28.0.0/'. */ + subversion?: string; + /** Protocol version of the blockchain backend - e.g. '70016'. */ + protocolVersion?: string; + /** Time offset (in seconds) reported by the backend. */ + timeOffset?: number; + /** Any warnings given by the backend regarding the chain state. */ + warnings?: string; + /** Version or details of the consensus protocol in use. */ + consensus_version?: string; + /** Additional chain-specific consensus data. */ + consensus?: any; +} +export interface InternalStateColumn { + /** Name of the database column. */ + name: string; + /** Version or schema version of the column. */ + version: number; + /** Number of rows stored in this column. */ + rows: number; + /** Total size (in bytes) of keys stored in this column. */ + keyBytes: number; + /** Total size (in bytes) of values stored in this column. */ + valueBytes: number; + /** Timestamp of the last update to this column. */ + updated: string; +} +export interface BlockbookInfo { + /** Coin name, e.g. 'Bitcoin'. */ + coin: string; + /** Network shortcut, e.g. 'BTC'. */ + network: string; + /** Hostname of the blockbook instance, e.g. 'backend5'. */ + host: string; + /** Running blockbook version, e.g. '0.4.0'. */ + version: string; + /** Git commit hash of the running blockbook, e.g. 'a0960c8e'. */ + gitCommit: string; + /** Build time of running blockbook, e.g. '2024-08-08T12:32:50+00:00'. */ + buildTime: string; + /** If true, blockbook is syncing from scratch or in a special sync mode. */ + syncMode: boolean; + /** Indicates if blockbook is in its initial sync phase. */ + initialSync: boolean; + /** Indicates if the backend is fully synced with the blockchain. */ + inSync: boolean; + /** Best (latest) block height according to this instance. */ + bestHeight: number; + /** Timestamp of the latest block in the chain. */ + lastBlockTime: string; + /** Indicates if mempool info is synced as well. */ + inSyncMempool: boolean; + /** Timestamp of the last mempool update. */ + lastMempoolTime: string; + /** Number of unconfirmed transactions in the mempool. */ + mempoolSize: number; + /** Number of decimals for this coin's base unit. */ + decimals: number; + /** Size of the underlying database in bytes. */ + dbSize: number; + /** Whether this instance provides fiat exchange rates. */ + hasFiatRates?: boolean; + /** Whether this instance provides fiat exchange rates for tokens. */ + hasTokenFiatRates?: boolean; + /** Timestamp of the latest fiat rates update. */ + currentFiatRatesTime?: string; + /** Timestamp of the latest historical fiat rates update. */ + historicalFiatRatesTime?: string; + /** Timestamp of the latest historical token fiat rates update. */ + historicalTokenFiatRatesTime?: string; + /** List of contract addresses supported for staking. */ + supportedStakingPools?: string[]; + /** Optional calculated DB size from columns. */ + dbSizeFromColumns?: number; + /** List of columns/tables in the DB for internal state. */ + dbColumns?: InternalStateColumn[]; + /** Additional human-readable info about this blockbook instance. */ + about: string; +} +export interface SystemInfo { + /** Blockbook instance information. */ + blockbook: BlockbookInfo; + /** Information about the connected backend node. */ + backend: BackendInfo; +} +export interface FiatTicker { + /** Unix timestamp for these fiat rates. */ + ts?: number; + /** Map of currency codes to their exchange rate. */ + rates: { [key: string]: number }; + /** Any error message encountered while fetching rates. */ + error?: string; +} +export interface FiatTickers { + /** List of fiat tickers with timestamps and rates. */ + tickers: FiatTicker[]; +} +export interface AvailableVsCurrencies { + /** Timestamp for the available currency list. */ + ts?: number; + /** List of currency codes (e.g., USD, EUR) supported by the rates. */ + available_currencies: string[]; + /** Error message, if any, when fetching the available currencies. */ + error?: string; +} +export interface WsReq { + /** Unique request identifier. */ + id: string; + /** Requested method name. */ + method: + | 'getAccountInfo' + | 'getInfo' + | 'getBlockHash' + | 'getBlock' + | 'getAccountUtxo' + | 'getBalanceHistory' + | 'getTransaction' + | 'getTransactionSpecific' + | 'estimateFee' + | 'sendTransaction' + | 'subscribeNewBlock' + | 'unsubscribeNewBlock' + | 'subscribeNewTransaction' + | 'unsubscribeNewTransaction' + | 'subscribeAddresses' + | 'unsubscribeAddresses' + | 'subscribeFiatRates' + | 'unsubscribeFiatRates' + | 'ping' + | 'getCurrentFiatRates' + | 'getFiatRatesForTimestamps' + | 'getFiatRatesTickersList' + | 'getMempoolFilters'; + /** Parameters for the requested method in raw JSON format. */ + params: any; +} +export interface WsRes { + /** Corresponding request identifier. */ + id: string; + /** Payload of the response, structure depends on the request. */ + data: any; +} +export interface WsAccountInfoReq { + /** Address or XPUB descriptor to query. */ + descriptor: string; + /** Level of detail to retrieve about the account. */ + details?: 'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs'; + /** Which tokens to include in the account info. */ + tokens?: 'derived' | 'used' | 'nonzero'; + /** Number of items per page, if paging is used. */ + pageSize?: number; + /** Requested page index, if paging is used. */ + page?: number; + /** Starting block height for transaction filtering. */ + from?: number; + /** Ending block height for transaction filtering. */ + to?: number; + /** Filter by specific contract address (for token data). */ + contractFilter?: string; + /** Currency code to convert values into (e.g. 'USD'). */ + secondaryCurrency?: string; + /** Gap limit for XPUB scanning, if relevant. */ + gap?: number; +} +export interface WsBackendInfo { + /** Backend version string. */ + version?: string; + /** Backend sub-version string. */ + subversion?: string; + /** Consensus protocol version in use. */ + consensus_version?: string; + /** Additional consensus details, structure depends on blockchain. */ + consensus?: any; +} +export interface WsInfoRes { + /** Human-readable blockchain name. */ + name: string; + /** Short code for the blockchain (e.g. BTC, ETH). */ + shortcut: string; + /** Network identifier (e.g. mainnet, testnet). */ + network: string; + /** Number of decimals in the base unit of the coin. */ + decimals: number; + /** Version of the blockbook or backend service. */ + version: string; + /** Current best chain height according to the backend. */ + bestHeight: number; + /** Block hash of the best (latest) block. */ + bestHash: string; + /** Genesis block hash or identifier. */ + block0Hash: string; + /** Indicates if this is a test network. */ + testnet: boolean; + /** Additional backend-related information. */ + backend: WsBackendInfo; +} +export interface WsBlockHashReq { + /** Block height for which the hash is requested. */ + height: number; +} +export interface WsBlockHashRes { + /** Block hash at the requested height. */ + hash: string; +} +export interface WsBlockReq { + /** Block identifier (hash). */ + id: string; + /** Number of transactions per page in the block. */ + pageSize?: number; + /** Page index to retrieve if multiple pages of transactions are available. */ + page?: number; +} +export interface WsBlockFilterReq { + /** Type of script filter (e.g., P2PKH, P2SH). */ + scriptType: string; + /** Block hash for which we want the filter. */ + blockHash: string; + /** Optional parameter for certain filter logic. */ + M?: number; +} +export interface WsBlockFiltersBatchReq { + /** Type of script filter (e.g., P2PKH, P2SH). */ + scriptType: string; + /** Hash of the latest known block. Filters will be retrieved backward from here. */ + bestKnownBlockHash: string; + /** Number of block filters per request. */ + pageSize?: number; + /** Optional parameter for certain filter logic. */ + M?: number; +} +export interface WsAccountUtxoReq { + /** Address or XPUB descriptor to retrieve UTXOs for. */ + descriptor: string; +} +export interface WsBalanceHistoryReq { + /** Address or XPUB descriptor to query history for. */ + descriptor: string; + /** Unix timestamp from which to start the history. */ + from?: number; + /** Unix timestamp at which to end the history. */ + to?: number; + /** List of currency codes for which to fetch exchange rates at each interval. */ + currencies?: string[]; + /** Gap limit for XPUB scanning, if relevant. */ + gap?: number; + /** Size of each aggregated time window in seconds. */ + groupBy?: number; +} +export interface WsTransactionReq { + /** Transaction ID to retrieve details for. */ + txid: string; +} +export interface WsTransactionSpecificReq { + /** Transaction ID for the detailed blockchain-specific data. */ + txid: string; +} +export interface WsEstimateFeeReq { + /** Block confirmations targets for which fees should be estimated. */ + blocks?: number[]; + /** Additional chain-specific parameters (e.g. for Ethereum). */ + specific?: { + conservative?: boolean; + txsize?: number; + from?: string; + to?: string; + data?: string; + value?: string; + }; +} +export interface Eip1559Fee { + maxFeePerGas: string; + maxPriorityFeePerGas: string; + minWaitTimeEstimate?: number; + maxWaitTimeEstimate?: number; +} +export interface Eip1559Fees { + baseFeePerGas?: string; + low?: Eip1559Fee; + medium?: Eip1559Fee; + high?: Eip1559Fee; + instant?: Eip1559Fee; + networkCongestion?: number; + latestPriorityFeeRange?: string[]; + historicalPriorityFeeRange?: string[]; + historicalBaseFeeRange?: string[]; + priorityFeeTrend?: 'up' | 'down'; + baseFeeTrend?: 'up' | 'down'; +} +export interface WsEstimateFeeRes { + /** Estimated total fee per transaction, if relevant. */ + feePerTx?: string; + /** Estimated fee per unit (sat/byte, Wei/gas, etc.). */ + feePerUnit?: string; + /** Max fee limit for blockchains like Ethereum. */ + feeLimit?: string; + eip1559?: Eip1559Fees; +} +export interface WsLongTermFeeRateRes { + /** Long term fee rate (in sat/kByte). */ + feePerUnit: string; + /** Amount of blocks used for the long term fee rate estimation. */ + blocks: number; +} +export interface WsSendTransactionReq { + /** Hex-encoded transaction data to broadcast. */ + hex: string; + /** Use alternative RPC method to broadcast transaction. */ + disableAlternativeRPC?: boolean; +} +export interface WsSubscribeAddressesReq { + /** List of addresses to subscribe for updates (e.g., new transactions). */ + addresses: string[]; +} +export interface WsSubscribeFiatRatesReq { + /** Fiat currency code (e.g. 'USD'). */ + currency?: string; + /** List of token symbols or IDs to get fiat rates for. */ + tokens?: string[]; +} +export interface WsCurrentFiatRatesReq { + /** List of fiat currencies, e.g. ['USD','EUR']. */ + currencies?: string[]; + /** Token symbol or ID if asking for token fiat rates (e.g. 'ETH'). */ + token?: string; +} +export interface WsFiatRatesForTimestampsReq { + /** List of Unix timestamps for which to retrieve fiat rates. */ + timestamps: number[]; + /** List of fiat currencies, e.g. ['USD','EUR']. */ + currencies?: string[]; + /** Token symbol or ID if asking for token fiat rates. */ + token?: string; +} +export interface WsFiatRatesTickersListReq { + /** Timestamp for which the list of available tickers is needed. */ + timestamp?: number; + /** Token symbol or ID if asking for token-specific fiat rates. */ + token?: string; +} +export interface WsMempoolFiltersReq { + /** Type of script we are filtering for (e.g., P2PKH, P2SH). */ + scriptType: string; + /** Only retrieve filters for mempool txs after this timestamp. */ + fromTimestamp: number; + /** Optional parameter for certain filter logic (e.g., n-bloom). */ + M?: number; +} +export interface WsRpcCallReq { + /** Address from which the RPC call is originated (if relevant). */ + from?: string; + /** Contract or address to which the RPC call is made. */ + to: string; + /** Hex-encoded call data (function signature + parameters). */ + data: string; +} +export interface WsRpcCallRes { + /** Hex-encoded return data from the call. */ + data: string; +} +export interface MempoolTxidFilterEntries { + /** Map of txid to filter data (hex-encoded). */ + entries?: { [key: string]: string }; + /** Indicates if a zeroed key was used in filter calculation. */ + usedZeroedKey?: boolean; +} diff --git a/blockbook.go b/blockbook.go index be1184f2d9..fa0cfdd7e8 100644 --- a/blockbook.go +++ b/blockbook.go @@ -2,9 +2,7 @@ package main import ( "context" - "encoding/json" "flag" - "io/ioutil" "log" "math/rand" "net/http" @@ -12,8 +10,8 @@ import ( "os" "os/signal" "runtime/debug" + "strconv" "strings" - "sync/atomic" "syscall" "time" @@ -25,6 +23,7 @@ import ( "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" "github.com/trezor/blockbook/fiat" + "github.com/trezor/blockbook/fourbyte" "github.com/trezor/blockbook/server" ) @@ -42,7 +41,7 @@ const exitCodeOK = 0 const exitCodeFatal = 255 var ( - blockchain = flag.String("blockchaincfg", "", "path to blockchain RPC service configuration json file") + configFile = flag.String("blockchaincfg", "", "path to blockchain RPC service configuration json file") dbPath = flag.String("datadir", "./data", "path to database directory") dbCache = flag.Int("dbcache", 1<<29, "size of the rocksdb cache") @@ -84,6 +83,8 @@ var ( // resync mempool at least each resyncMempoolPeriodMs (could be more often if invoked by message from ZeroMQ) resyncMempoolPeriodMs = flag.Int("resyncmempoolperiod", 60017, "resync mempool period in milliseconds") + + extendedIndex = flag.Bool("extendedindex", false, "if true, create index of input txids and spending transactions") ) var ( @@ -100,12 +101,12 @@ var ( metrics *common.Metrics syncWorker *db.SyncWorker internalState *common.InternalState + fiatRates *fiat.FiatRates callbacksOnNewBlock []bchain.OnNewBlockFunc callbacksOnNewTxAddr []bchain.OnNewTxAddrFunc callbacksOnNewTx []bchain.OnNewTxFunc callbacksOnNewFiatRatesTicker []fiat.OnNewFiatRatesTicker chanOsSignal chan os.Signal - inShutdown int32 ) func init() { @@ -151,38 +152,31 @@ func mainWithExitCode() int { return exitCodeOK } - if *blockchain == "" { - glog.Error("Missing blockchaincfg configuration parameter") - return exitCodeFatal - } - - coin, coinShortcut, coinLabel, err := coins.GetCoinNameFromConfig(*blockchain) + config, err := common.GetConfig(*configFile) if err != nil { glog.Error("config: ", err) return exitCodeFatal } - // gspt.SetProcTitle("blockbook-" + normalizeName(coin)) - - metrics, err = common.GetMetrics(coin) + metrics, err = common.GetMetrics(config.CoinName) if err != nil { glog.Error("metrics: ", err) return exitCodeFatal } - if chain, mempool, err = getBlockChainWithRetry(coin, *blockchain, pushSynchronizationHandler, metrics, 120); err != nil { + if chain, mempool, err = getBlockChainWithRetry(config.CoinName, *configFile, pushSynchronizationHandler, metrics, 120); err != nil { glog.Error("rpc: ", err) return exitCodeFatal } - index, err = db.NewRocksDB(*dbPath, *dbCache, *dbMaxOpenFiles, chain.GetChainParser(), metrics) + index, err = db.NewRocksDB(*dbPath, *dbCache, *dbMaxOpenFiles, chain.GetChainParser(), metrics, *extendedIndex) if err != nil { glog.Error("rocksDB: ", err) return exitCodeFatal } defer index.Close() - internalState, err = newInternalState(coin, coinShortcut, coinLabel, index) + internalState, err = newInternalState(config, index, *enableSubNewTx) if err != nil { glog.Error("internalState: ", err) return exitCodeFatal @@ -197,6 +191,17 @@ func mainWithExitCode() int { } internalState.UtxoChecked = true } + + // sort addressContracts if necessary + if !internalState.SortedAddressContracts { + err = index.SortAddressContracts(chanOsSignal) + if err != nil { + glog.Error("sortAddressContracts: ", err) + return exitCodeFatal + } + internalState.SortedAddressContracts = true + } + index.SetInternalState(internalState) if *fixUtxo { err = index.StoreInternalState(internalState) @@ -263,6 +268,11 @@ func mainWithExitCode() int { return exitCodeFatal } + if fiatRates, err = fiat.NewFiatRates(index, config, metrics, onNewFiatRatesTicker); err != nil { + glog.Error("fiatRates ", err) + return exitCodeFatal + } + // report BlockbookAppInfo metric, only log possible error if err = blockbookAppInfoMetric(index, chain, txCache, internalState, metrics); err != nil { glog.Error("blockbookAppInfoMetric ", err) @@ -335,7 +345,7 @@ func mainWithExitCode() int { until := uint32(*blockUntil) if !*synchronize { - if err = syncWorker.ConnectBlocksParallel(height, until); err != nil { + if err = syncWorker.BulkConnectBlocks(height, until); err != nil { if err != db.ErrOperationInterrupted { glog.Error("connectBlocksParallel ", err) return exitCodeFatal @@ -347,7 +357,7 @@ func mainWithExitCode() int { if internalServer != nil || publicServer != nil || chain != nil { // start fiat rates downloader only if not shutting down immediately - initFiatRatesDownloader(index, *blockchain) + initDownloaders(index, chain, config) waitForSignalAndShutdown(internalServer, publicServer, chain, 10*time.Second) } @@ -362,13 +372,13 @@ func mainWithExitCode() int { return exitCodeOK } -func getBlockChainWithRetry(coin string, configfile string, pushHandler func(bchain.NotificationType), metrics *common.Metrics, seconds int) (bchain.BlockChain, bchain.Mempool, error) { +func getBlockChainWithRetry(coin string, configFile string, pushHandler func(bchain.NotificationType), metrics *common.Metrics, seconds int) (bchain.BlockChain, bchain.Mempool, error) { var chain bchain.BlockChain var mempool bchain.Mempool var err error timer := time.NewTimer(time.Second) for i := 0; ; i++ { - if chain, mempool, err = coins.NewBlockChain(coin, configfile, pushHandler, metrics); err != nil { + if chain, mempool, err = coins.NewBlockChain(coin, configFile, pushHandler, metrics); err != nil { if i < seconds { glog.Error("rpc: ", err, " Retrying...") select { @@ -387,7 +397,7 @@ func getBlockChainWithRetry(coin string, configfile string, pushHandler func(bch } func startInternalServer() (*server.InternalServer, error) { - internalServer, err := server.NewInternalServer(*internalBinding, *certFiles, index, chain, mempool, txCache, metrics, internalState) + internalServer, err := server.NewInternalServer(*internalBinding, *certFiles, index, chain, mempool, txCache, metrics, internalState, fiatRates) if err != nil { return nil, err } @@ -407,7 +417,7 @@ func startInternalServer() (*server.InternalServer, error) { func startPublicServer() (*server.PublicServer, error) { // start public server in limited functionality, extend it after sync is finished by calling ConnectFullPublicInterface - publicServer, err := server.NewPublicServer(*publicBinding, *certFiles, index, chain, mempool, txCache, *explorerURL, metrics, internalState, *debugMode, *enableSubNewTx) + publicServer, err := server.NewPublicServer(*publicBinding, *certFiles, index, chain, mempool, txCache, *explorerURL, metrics, internalState, fiatRates, *debugMode) if err != nil { return nil, err } @@ -453,7 +463,7 @@ func performRollback() error { } func blockbookAppInfoMetric(db *db.RocksDB, chain bchain.BlockChain, txCache *db.TxCache, is *common.InternalState, metrics *common.Metrics) error { - api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is) + api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return err } @@ -461,29 +471,32 @@ func blockbookAppInfoMetric(db *db.RocksDB, chain bchain.BlockChain, txCache *db if err != nil { return err } + subversion := si.Backend.Subversion + if subversion == "" { + // for coins without subversion (ETH) use ConsensusVersion as subversion in metrics + subversion = si.Backend.ConsensusVersion + } + metrics.BlockbookAppInfo.Reset() metrics.BlockbookAppInfo.With(common.Labels{ "blockbook_version": si.Blockbook.Version, "blockbook_commit": si.Blockbook.GitCommit, "blockbook_buildtime": si.Blockbook.BuildTime, "backend_version": si.Backend.Version, - "backend_subversion": si.Backend.Subversion, + "backend_subversion": subversion, "backend_protocol_version": si.Backend.ProtocolVersion}).Set(float64(0)) metrics.BackendBestHeight.Set(float64(si.Backend.Blocks)) metrics.BlockbookBestHeight.Set(float64(si.Blockbook.BestHeight)) return nil } -func newInternalState(coin, coinShortcut, coinLabel string, d *db.RocksDB) (*common.InternalState, error) { - is, err := d.LoadInternalState(coin) +func newInternalState(config *common.Config, d *db.RocksDB, enableSubNewTx bool) (*common.InternalState, error) { + is, err := d.LoadInternalState(config) if err != nil { return nil, err } - is.CoinShortcut = coinShortcut - if coinLabel == "" { - coinLabel = coin - } - is.CoinLabel = coinLabel + + is.EnableSubNewTx = enableSubNewTx name, err := os.Hostname() if err != nil { glog.Error("get hostname ", err) @@ -493,49 +506,20 @@ func newInternalState(coin, coinShortcut, coinLabel string, d *db.RocksDB) (*com } is.Host = name } - return is, nil -} -func tickAndDebounce(tickTime time.Duration, debounceTime time.Duration, input chan struct{}, f func()) { - timer := time.NewTimer(tickTime) - var firstDebounce time.Time -Loop: - for { - select { - case _, ok := <-input: - if !timer.Stop() { - <-timer.C - } - // exit loop on closed input channel - if !ok { - break Loop - } - if firstDebounce.IsZero() { - firstDebounce = time.Now() - } - // debounce for up to debounceTime period - // afterwards execute immediately - if firstDebounce.Add(debounceTime).After(time.Now()) { - timer.Reset(debounceTime) - } else { - timer.Reset(0) - } - case <-timer.C: - // do the action, if not in shutdown, then start the loop again - if atomic.LoadInt32(&inShutdown) == 0 { - f() - } - timer.Reset(tickTime) - firstDebounce = time.Time{} - } + is.WsGetAccountInfoLimit, _ = strconv.Atoi(os.Getenv(strings.ToUpper(is.GetNetwork()) + "_WS_GETACCOUNTINFO_LIMIT")) + if is.WsGetAccountInfoLimit > 0 { + glog.Info("WsGetAccountInfoLimit enabled with limit ", is.WsGetAccountInfoLimit) + is.WsLimitExceedingIPs = make(map[string]int) } + return is, nil } func syncIndexLoop() { defer close(chanSyncIndexDone) glog.Info("syncIndexLoop starting") // resync index about every 15 minutes if there are no chanSyncIndex requests, with debounce 1 second - tickAndDebounce(time.Duration(*resyncIndexPeriodMs)*time.Millisecond, debounceResyncIndexMs*time.Millisecond, chanSyncIndex, func() { + common.TickAndDebounce(time.Duration(*resyncIndexPeriodMs)*time.Millisecond, debounceResyncIndexMs*time.Millisecond, chanSyncIndex, func() { if err := syncWorker.ResyncIndex(onNewBlockHash, false); err != nil { glog.Error("syncIndexLoop ", errors.ErrorStack(err), ", will retry...") // retry once in case of random network error, after a slight delay @@ -559,10 +543,11 @@ func onNewBlockHash(hash string, height uint32) { } } -func onNewFiatRatesTicker(ticker *db.CurrencyRatesTicker) { +func onNewFiatRatesTicker(ticker *common.CurrencyRatesTicker) { defer func() { if r := recover(); r != nil { glog.Error("onNewFiatRatesTicker recovered from panic: ", r) + debug.PrintStack() } }() for _, c := range callbacksOnNewFiatRatesTicker { @@ -574,7 +559,7 @@ func syncMempoolLoop() { defer close(chanSyncMempoolDone) glog.Info("syncMempoolLoop starting") // resync mempool about every minute if there are no chanSyncMempool requests, with debounce 1 second - tickAndDebounce(time.Duration(*resyncMempoolPeriodMs)*time.Millisecond, debounceResyncMempoolMs*time.Millisecond, chanSyncMempool, func() { + common.TickAndDebounce(time.Duration(*resyncMempoolPeriodMs)*time.Millisecond, debounceResyncMempoolMs*time.Millisecond, chanSyncMempool, func() { internalState.StartedMempoolSync() if count, err := mempool.Resync(); err != nil { glog.Error("syncMempoolLoop ", errors.ErrorStack(err)) @@ -604,7 +589,7 @@ func storeInternalStateLoop() { } else { glog.Info("storeInternalStateLoop starting with db stats compute disabled") } - tickAndDebounce(storeInternalStatePeriodMs*time.Millisecond, (storeInternalStatePeriodMs-1)*time.Millisecond, chanStoreInternalState, func() { + common.TickAndDebounce(storeInternalStatePeriodMs*time.Millisecond, (storeInternalStatePeriodMs-1)*time.Millisecond, chanStoreInternalState, func() { if (*dbStatsPeriodHours) > 0 && !computeRunning && lastCompute.Add(computePeriod).Before(time.Now()) { computeRunning = true go func() { @@ -620,7 +605,9 @@ func storeInternalStateLoop() { glog.Error("storeInternalStateLoop ", errors.ErrorStack(err)) } if lastAppInfo.Add(logAppInfoPeriod).Before(time.Now()) { - glog.Info(index.GetMemoryStats()) + if glog.V(1) { + glog.Info(index.GetMemoryStats()) + } if err := blockbookAppInfoMetric(index, chain, txCache, internalState, metrics); err != nil { glog.Error("blockbookAppInfoMetric ", err) } @@ -654,7 +641,7 @@ func onNewTx(tx *bchain.MempoolTx) { func pushSynchronizationHandler(nt bchain.NotificationType) { glog.V(1).Info("MQ: notification ", nt) - if atomic.LoadInt32(&inShutdown) != 0 { + if common.IsInShutdown() { return } if nt == bchain.NotificationNewBlock { @@ -668,7 +655,7 @@ func pushSynchronizationHandler(nt bchain.NotificationType) { func waitForSignalAndShutdown(internal *server.InternalServer, public *server.PublicServer, chain bchain.BlockChain, timeout time.Duration) { sig := <-chanOsSignal - atomic.StoreInt32(&inShutdown, 1) + common.SetInShutdown() glog.Infof("shutdown: %v", sig) ctx, cancel := context.WithTimeout(context.Background(), timeout) @@ -693,22 +680,11 @@ func waitForSignalAndShutdown(internal *server.InternalServer, public *server.Pu } } -func printResult(txid string, vout int32, isOutput bool) error { - glog.Info(txid, vout, isOutput) - return nil -} - -func normalizeName(s string) string { - s = strings.ToLower(s) - s = strings.Replace(s, " ", "-", -1) - return s -} - // computeFeeStats computes fee distribution in defined blocks func computeFeeStats(stopCompute chan os.Signal, blockFrom, blockTo int, db *db.RocksDB, chain bchain.BlockChain, txCache *db.TxCache, is *common.InternalState, metrics *common.Metrics) error { start := time.Now() glog.Info("computeFeeStats start") - api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is) + api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return err } @@ -717,33 +693,20 @@ func computeFeeStats(stopCompute chan os.Signal, blockFrom, blockTo int, db *db. return err } -func initFiatRatesDownloader(db *db.RocksDB, configfile string) { - data, err := ioutil.ReadFile(configfile) - if err != nil { - glog.Errorf("Error reading file %v, %v", configfile, err) - return - } - - var config struct { - FiatRates string `json:"fiat_rates"` - FiatRatesParams string `json:"fiat_rates_params"` +func initDownloaders(db *db.RocksDB, chain bchain.BlockChain, config *common.Config) { + if fiatRates.Enabled { + go fiatRates.RunDownloader() } - err = json.Unmarshal(data, &config) - if err != nil { - glog.Errorf("Error parsing config file %v, %v", configfile, err) - return - } - - if config.FiatRates == "" || config.FiatRatesParams == "" { - glog.Infof("FiatRates config (%v) is empty, so the functionality is disabled.", configfile) - } else { - fiatRates, err := fiat.NewFiatRatesDownloader(db, config.FiatRates, config.FiatRatesParams, nil, onNewFiatRatesTicker) + if config.FourByteSignatures != "" && chain.GetChainParser().GetChainType() == bchain.ChainEthereumType { + fbsd, err := fourbyte.NewFourByteSignaturesDownloader(db, config.FourByteSignatures) if err != nil { - glog.Errorf("NewFiatRatesDownloader Init error: %v", err) - return + glog.Errorf("NewFourByteSignaturesDownloader Init error: %v", err) + } else { + glog.Infof("Starting FourByteSignatures downloader...") + go fbsd.Run() } - glog.Infof("Starting %v FiatRates downloader...", config.FiatRates) - go fiatRates.Run() + } + } diff --git a/build/docker/bin/Dockerfile b/build/docker/bin/Dockerfile index d11c783896..07e4254dae 100644 --- a/build/docker/bin/Dockerfile +++ b/build/docker/bin/Dockerfile @@ -8,15 +8,15 @@ RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y build-essential git wget pkg-config lxc-dev libzmq3-dev \ libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev \ - liblz4-dev graphviz && \ + libzstd-dev liblz4-dev graphviz && \ apt-get clean - -ENV GOLANG_VERSION=go1.17.1.linux-amd64 -ENV ROCKSDB_VERSION=v6.22.1 +ARG GOLANG_VERSION +ENV GOLANG_VERSION=go1.25.4 +ENV ROCKSDB_VERSION=v9.10.0 ENV GOPATH=/go ENV PATH=$PATH:$GOPATH/bin ENV CGO_CFLAGS="-I/opt/rocksdb/include" -ENV CGO_LDFLAGS="-L/opt/rocksdb -ldl -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4" +ENV CGO_LDFLAGS="-L/opt/rocksdb -ldl -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd" ARG TCMALLOC RUN mkdir /build @@ -28,8 +28,10 @@ RUN if [ -n "${TCMALLOC}" ]; then \ fi # install and configure go -RUN cd /opt && wget https://dl.google.com/go/$GOLANG_VERSION.tar.gz && \ - tar xf $GOLANG_VERSION.tar.gz +ARG TARGETPLATFORM +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=arm64; elif [ "$TARGETPLATFORM" = "linux/aarch64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi \ + && cd /opt && wget https://dl.google.com/go/$GOLANG_VERSION.linux-$ARCHITECTURE.tar.gz && \ + tar xf $GOLANG_VERSION.linux-$ARCHITECTURE.tar.gz RUN ln -s /opt/go/bin/go /usr/bin/go RUN mkdir -p $GOPATH RUN echo -n "GO version: " && go version @@ -37,7 +39,7 @@ RUN echo -n "GOPATH: " && echo $GOPATH # install rocksdb RUN cd /opt && git clone -b $ROCKSDB_VERSION --depth 1 https://github.com/facebook/rocksdb.git -RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC PORTABLE=$PORTABLE_ROCKSDB make -j 4 release +RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC PORTABLE=$PORTABLE_ROCKSDB DISABLE_WARNING_AS_ERROR=1 make -j 4 release RUN strip /opt/rocksdb/ldb /opt/rocksdb/sst_dump && \ cp /opt/rocksdb/ldb /opt/rocksdb/sst_dump /build diff --git a/build/docker/bin/Makefile b/build/docker/bin/Makefile index ebb2483129..96402edd9f 100644 --- a/build/docker/bin/Makefile +++ b/build/docker/bin/Makefile @@ -1,6 +1,6 @@ SHELL = /bin/bash VERSION ?= devel -GITCOMMIT = $(shell cd /src && git describe --always --dirty) +GITCOMMIT = $(shell cd /src && git config --global --add safe.directory /src && git describe --always --dirty) BUILDTIME = $(shell date --iso-8601=seconds) LDFLAGS := -X github.com/trezor/blockbook/common.version=$(VERSION) -X github.com/trezor/blockbook/common.gitcommit=$(GITCOMMIT) -X github.com/trezor/blockbook/common.buildtime=$(BUILDTIME) BLOCKBOOK_BASE := $(GOPATH)/src/github.com/trezor @@ -10,12 +10,12 @@ ARGS ?= all: build tools build: prepare-sources - cd $(BLOCKBOOK_SRC) && go build -tags rocksdb_6_16 -o $(CURDIR)/blockbook -ldflags="-s -w $(LDFLAGS)" $(ARGS) + cd $(BLOCKBOOK_SRC) && go build -o $(CURDIR)/blockbook -ldflags="-s -w $(LDFLAGS)" $(ARGS) cp $(CURDIR)/blockbook /out/blockbook chown $(PACKAGER) /out/blockbook build-debug: prepare-sources - cd $(BLOCKBOOK_SRC) && go build -tags rocksdb_6_16 -o $(CURDIR)/blockbook -ldflags="$(LDFLAGS)" $(ARGS) + cd $(BLOCKBOOK_SRC) && go build -o $(CURDIR)/blockbook -ldflags="$(LDFLAGS)" $(ARGS) cp $(CURDIR)/blockbook /out/blockbook chown $(PACKAGER) /out/blockbook @@ -24,13 +24,13 @@ tools: chown $(PACKAGER) /out/{ldb,sst_dump} test: prepare-sources - cd $(BLOCKBOOK_SRC) && go test -tags 'rocksdb_6_16 unittest' `go list ./... | grep -vP '^github.com/trezor/blockbook/(contrib|tests)'` $(ARGS) + cd $(BLOCKBOOK_SRC) && go test -tags 'unittest' `go list ./... | grep -vP '^github.com/trezor/blockbook/(contrib|tests)'` $(ARGS) test-integration: prepare-sources - cd $(BLOCKBOOK_SRC) && go test -tags 'rocksdb_6_16 integration' `go list github.com/trezor/blockbook/tests/...` $(ARGS) + cd $(BLOCKBOOK_SRC) && go test -tags 'integration' `go list github.com/trezor/blockbook/tests/...` $(ARGS) test-all: prepare-sources - cd $(BLOCKBOOK_SRC) && go test -tags 'rocksdb_6_16 unittest integration' `go list ./... | grep -v '^github.com/trezor/blockbook/contrib'` $(ARGS) + cd $(BLOCKBOOK_SRC) && go test -tags 'unittest integration' `go list ./... | grep -v '^github.com/trezor/blockbook/contrib'` $(ARGS) prepare-sources: @ [ -n "`ls /src 2> /dev/null`" ] || (echo "/src doesn't exist or is empty" 1>&2 && exit 1) diff --git a/build/docker/deb/Dockerfile b/build/docker/deb/Dockerfile index 55989099ab..fd8fa114ef 100644 --- a/build/docker/deb/Dockerfile +++ b/build/docker/deb/Dockerfile @@ -6,9 +6,19 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get upgrade -y && \ - apt-get install -y devscripts debhelper make dh-exec && \ + apt-get install -y devscripts debhelper make dh-exec zstd && \ apt-get clean +# install docker cli +ARG DOCKER_VERSION + +RUN if [ -z "$DOCKER_VERSION" ]; then echo "DOCKER_VERSION is a required build arg" && exit 1; fi + +RUN wget -O docker.tgz "https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz" && \ + tar -xzf docker.tgz --strip 1 -C /usr/local/bin/ && \ + rm docker.tgz && \ + docker --version + ADD gpg-keys /tmp/gpg-keys RUN gpg --batch --import /tmp/gpg-keys/* diff --git a/build/docker/deb/gpg-keys/avalanche-releases.asc b/build/docker/deb/gpg-keys/avalanche-releases.asc new file mode 100644 index 0000000000..62d4236abe --- /dev/null +++ b/build/docker/deb/gpg-keys/avalanche-releases.asc @@ -0,0 +1,51 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBF7T6r4BEACmdzpthz6plCzb36P5Fx+Jwmm2/SlfKoXAEnJhjP+oK7PAvak+ +2sDFVv+MI5+nxJXQOdVat5/d9YlbwvgTQ4v/Iz0rJdSpjqKwUaJsDuHTedx6e/VA +y7hYXwEcsLjiK9Ws7f9Oem1fvPa6tbLGQ5oSM0B8OKXAiR/YGcA+pC7SKURbbdY3 +hfwRljeJ3/Uq8CTuDw1VsOqEELqlCED8VuSWG4CTOyU+KvV0jIB9TrRB0U/jb+XB +m/Jon/ZQFT5miPT+8VUa6L3WkVW9d97kiPhdH0d4yASoQ4AFiLpaEXXVWT9Nhvpg +VMYYxscA3EnjaTXBR/kUfgmlbXfkiHv8reawynxGLwupK+qpH0XJbawJ7Hgvhej1 +SkU3WxhWuKdD92t3JXnWtJTiqQA42DPf5Bl1p3o7TRWMz57GRc8H7l/DdlZ1FbMJ +TylAC+MJc5InJP//kZURMuKnsLkX4WyfF13fxb4oNXUt0wojdUvTQYnPDNFxW2Nr +ddAtT+VoeRXQtIk6YjR+WkTF6/XYbSq734e0gLKC4aDd3EvbpYT/ZqpGr1VOfhve +dIWbkHhqBtTHJQQy5ET7PiduN7S2OQGtuYUVzLp71iLAOK7hWOo5vWYDlwphK+uB +MuGSdsnmtpceGOaqANVtpFmLsPAGSzxMQ368lnefCas3/ybvglu0M3YD1QARAQAB +tCRBdmEgTGFicywgSW5jLiA8Y29udGFjdEBhdmFsYWJzLm9yZz6JAk4EEwEIADgW +IQRTlb2hEpysPnRpnQfZMICwwNX+iwUCXtPqvgIbAwULCQgHAwUVCgkICwUWAgMB +AAIeAQIXgAAKCRDZMICwwNX+iz+jEACElYnwV7VHgF70W2yJqPmJGZXswWlid6w4 +NTVOUV9jZTtIH88Jb81K03cOrzREXMX7H4qfEcsa2GM9s6n1IZJl+emaSCr3Z/sV +aNR4vSRWT6/IrvbSpVYdh3XOVjA11464ldr5VAtjh528pHfzR2krzhuMOaQL8r27 +TuiUDBjkAVBoWHwN9nahj0OU56r00Mr4fZUWFuNBRgpaQoB6FwjQ1xtoedgN97iI +QPwqEJdUzXQasl+K62TV7F8HUT2+25cEsu+w6OPSsERRgZLv3OHiEbO+ld9+KWDv +QywcTjIBHCF/5qL2gfx3TQ7KwxrUEquOm/QJL4mz9HwfLLaR6Etg1NhMFooTdstQ +tAJK6eUmRQk1psFP3yGbdSElkZ/RfbZvYcjm+x/r70Xo9T3Rv8fvIg6fqjnApmqW +7BT59iFUOWrATEUAi393hem81njll+fBxd3p+4ilhAEz39Z5NoHX0ddktnSa81Pz +4yKOJpcOB/mo7UwOoZ0iKND+ZSZxeo7YWlHZ5cSqRGyW5C/1PsLfqdRDw8SBO6A5 +rnjeppB+jiaPIqqKLGYRSV24H5PM9F7Uh1/H1lAIwXoxbSvkTelV0fTC+Bb9uPvu +AdLxDf/TiLnRL7zsV/buHamrO83fh772kVjwNvverNuNcpcBTHuAHruqT9jcMmv3 +IU46JdCefLkCDQRe0+q+ARAA8JGJzbWdn2vz1gtEhKLLe3gDcncr3wrqCF+joEQ6 +1XKE0vrgycLh79YMgBtkH9IXsP07KUXQ+xjSbW0SsHGYtANg16JxdRdDiJfkPl0R +ilALkuLvOrwLh2GJN1L7YggcWV/RTQ2NRpUFAdKQVU4x9N+E3QTRkVzcn2p/eiQh +cT4c4itWke7J17CvXwVRnSOMuse23wEj/Y5BHhLYn13ojknAK3UHXJGRVm5C0M14 +D9rTJBCrI03pBnBzQhxkXSbeC++vevU/DBN19ph6Mq6dv6VUP5Ai996Cs1IDfbB8 +CNW/IjJ+GSkciIurSFNXyFKa6ppSowYdxB1Fqabyx1isKGASfzNooCByVuj7xhFM +QjrAL2ZtOC1vjjUeuQ9ZpAmBa842xukJ8/ffvbvFoFXOOpJEJ9VZP2l5GWmanr/a +MkVvykssGmH8vLWytWa8J0QeA0FEFyiNc3kfkozIjScI90RdEj+ddp8z9H09/ml8 +xr1Xj07w3zz20/rRIdmpVTpo44jF0jV0h7n33dg+LWX7iDU+NpalfX0DH/sEuzEa +RYZsR09ExxLWBdHZ8HWIFRFRIrEg45oa7umo+YxypwrQFSxDT6v0QTPgle1Ged7h +f47filRbrHhXhVxKWLPJok+Bme0NOAXFs1bSw3xCnkL4RlSckrPrUwQPGLqNQ6hd +rrUAEQEAAYkCNgQYAQgAIBYhBFOVvaESnKw+dGmdB9kwgLDA1f6LBQJe0+q+AhsM +AAoJENkwgLDA1f6LgAcP/3YGbQY753108CRdVA+R8RQRKF8Wl7rBUNnXXCnuJ0j5 +4JaeqOkX5JQtEEnIMJZdpOFF6iK9LH9afbCUMiV/BLYbo1qPTAMgVVp8vfDkq4GT +wk4QIo3fLUEGW01IT93OY/OH4FsC8NcN9+mWnoiwlvyIfR7IauDbmbQ6eDzKr8r4 +K4am45eSPPOrS+W2+LjpjIMGzr971jL+FLeXoejiX0SeHJ/YGpv/qJnVZW3lVE9u +nomutcMCzbceZJuU4f6NoUDjGVEnNr3eUvPXPyrD53mD2G4C2H/pRteS6Oo7gsaH +Y2HfTngO8xVrMKQA6qGxilhYNSF0narDb7I+MCMTG0eGyGhixElmd2smmjbAzKY8 +dkMI7JYbhzbpfUVmiFhVEbr1mcCC8ZgkVCFmvw+Phbh29EUsMi9vQaHAzp/yZQ2+ +duBUPalYe+4ZPujq9QlvqLxUyDoqUg31TLaHHsvinByo6ZNXQ1NzGuYbVy1CYlK8 +9LqRPKFrO9bLsgwpE8pGkaOCl/1eATGru2b3jfwenknEBxvnXpexHLdUaJDcnBjH +nqpSPI6o3NXVvLp5On2ygXBNEQTbcCrMxs1YSafXwlWyteYXdBHSBOPSfhoscYLF +mvjNjlpX8tBPVnwHjpdxP+XitvrN/MVmGaMMfe+WDRRdUiup1Mj4ha8BzUggbGoq +=AzIy +-----END PGP PUBLIC KEY BLOCK----- \ No newline at end of file diff --git a/build/docker/deb/gpg-keys/dash-releases.asc b/build/docker/deb/gpg-keys/dash-releases.asc index 66f98fee0a..061617a4a6 100644 --- a/build/docker/deb/gpg-keys/dash-releases.asc +++ b/build/docker/deb/gpg-keys/dash-releases.asc @@ -1,5 +1,103 @@ -----BEGIN PGP PUBLIC KEY BLOCK----- +mQENBGWp8IkBCADEaVzTSOymYATI+x7Wp72QZnMZy5dbiOKvRd1E+zMAxamk3RgP +xu1g9zwecxRR5EU6HQoDawFckDp2kM014N055bXkIoQS04RTspfTWKa5TkcII2vR +sPRI7Hz3UXFvs3FngzLe3Kqp7HZ5dHzBiynm2hT1a0Bmzc19B/9A1zN51Hsvfdgo +tIfb9sHBUiq6+Sx8b/oKiouW/HQA6uFrYZFPwIVntagFcJjkNGwhziFHgo3yrMWm +qR4Nsuag/P0aa1byIvE6vkTOD05W7IfxasWy3bMxvTEWFsQCHJ5he5RBIzh9tq57 +YEhGqYfdTeAZ1GlJC/ByoCzrEQnXylQiRbylABEBAAG0I1Bhc3RhIFl1YmlrZXkg +PHBhc3RhQGRhc2hib29zdC5vcmc+iQFoBBMBCABSAhsDAhkBBQsJCAcCBhUKCQgL +AgUWAgMBAAIeBBYhBGCs9wv3EmRQSe5vFe/q8WaGIl9kBQJlqfxxGBhoa3BzOi8v +a2V5cy5vcGVucGdwLm9yZwAKCRDv6vFmhiJfZFErCAC6Fn5eiLMF0Ge0FFUWFQvw +NDpIEIqECRgp1Y44H6Rn4KPJArmVRB9UYmm9ntPo2v/fX6wFCRm+1sud8pZq4leF +I8efyKcCRqFDQm3GlXqpfqXD/Utbn2MVhUYhFu0FyLBbx9P4ZN5y1+dKJcBISDqD +XZ4GXSVBUPuBaygE5lbcTk+wFQWfiqjg8mk9dq/qlFEuL2rSQIYWW8z8pNYllg8M +T/qQ3ydY/O5BQuliUjFnyLCorghifUtO4cgMSXKdtop+Sle5GEUaQqM13wPOBo3V +SMWCxcPjwMj8x3q4b83fq9q2O1UVHhzmL7wFFUOKWBOZvokJPJqsUYRVGgT9J6WX +iQIzBBABCAAdFiEEKVkDYuyHioH9PCArUlJ77avoeYQFAmWqA6MACgkQUlJ77avo +eYTdGBAAlGZQ0GTf9fp6cwGW057fLZP0ysA+ThJlEqxOLXeGfuHlo+xxlDy6k8SN +DlmcFEgXsAWoD0X/HWZ+7G1kVVPJSixpVuuP513z38a7vNDlgF42livLcKticDpu +6gPuAS7YEEa5uugGJwmylHUeIVE69gp1QgJVPy0Egynv4IpsCiuuWLc/HL0uOS59 +KljH150cxsWX1sUIbgFapEqU5T2f5JFNO/ikBCqh9kFBw9ccMoQWBLw/AwpUqNH/ +8U7czzgnTvJqnXA97s1zUlbvOBpt7om2FRAcSGKcZNEGDp/jIOZUBAT3X+T4mvta +w+3g9U/7yg8mlka+DVxOE43eypQyyNoWP5ZetTb2R1Qq+WBaZHRJh9JoS03EYenL +XxDELYzkt2S6keh7sExc0j4nV9XmoRr5LD848HSQKB9fymcxkxPgn3avK28NMGpm +Xudqh/pz4PrOn+WOJJQg4494UvFtZ2zkAUnc6O0EUbr3ti6AUZCuyIZWc1GJmDrA +F3NtT4FgX40LjV6jcWAurN9HBX5mrV79X/5tqQBpho4DpNPs5rm8tDEYTWF+irFD +O96VJSVr5A9otM5kzHC7aUFCeXPgcCH5lpgZXj/7nE46Xf9MX4lmJ63oQ1hzELOe +Xtl1kSVmmtHDbj55LG496sxn0C5wc7WSZYge9llkLFnlgJQG8h60HlBhc3RhIFl1 +YmlrZXkgPHBhc3RhQGRhc2gub3JnPokBZQQTAQgATwIbAwULCQgHAgYVCgkICwIF +FgIDAQACHgQWIQRgrPcL9xJkUEnubxXv6vFmhiJfZAUCZan8cRgYaGtwczovL2tl +eXMub3BlbnBncC5vcmcACgkQ7+rxZoYiX2SjXAf/fXPwm0j84B9gVxjB4la1YahZ +/jomHhMzZm/HYqEs/3KrBPVUSM0+tkqI6pgVQVI9hTlijkcNhhZKAIF5Ye87Ule1 +x7wlnTJ+msWXMtybhaTv55BQVsnGRN/h88yoZH5UOylbMnFmeYh9IP9WKvrTTfZS +cSDN1Ib2LjeiPvxTyL9HiOTtCz1w6iijdS3rDWIEJhugBnFZ52nG+mQU5sy5+5S2 +W/PKr8hKqDVifCeZAju3sYTRsBBbCnGeTlqOtj/IJ65A2bw5tzM4gK6hrQwolzrC +c7teu9bZdP2dYuspkaGNX6afxR62VZYnpH/VCPp54c0/0Hl+TWEbERfGicLbC4kC +MgQQAQgAHRYhBClZA2Lsh4qB/TwgK1JSe+2r6HmEBQJlqfWlAAoJEFJSe+2r6HmE +C1QP9Ryh2XiUhQmvtiiDFPxzK0sa9YNAk84nUAOSrRLIQ1Xs3g33cg15kxMvtKf9 +OIJD14Mu1ypnfa1jsDr6zdy3CQCKAKEBTH41jw3XLa9R9XWaT6+0YV+meIHZ6uVJ +3+5M1xZGsnErsTM+iGGmneRIt2L0cZTt7HRJaL0EJrd7PXQb8B9BxgPnRa4UVpqd +FlhMhNHad7rz5hFAz8YkYEGX/bctF2y/gmHnu/xKkQsOlV+fQfROOlo/wQ/2vXRY +YBqWrVw0gAFDaI4P43CoKlYFzZOxrX+RLSc6eOSgmRkwMx5NzpOvfbypuiXLCmed +8pTF9SeXH3LzdO1gJQsKkia04OBohCosmnIjOCjeN3bxf606HZpBgXhj72kXZOX0 +NeA+yxEh1QIhvjxvD0WyIUChaXYsGy61F16vIUytE319diU/e/KQKnTC+oepiju6 +N23Iy8c2gRux48ghkmcN58bLOCUUvO+UYb7U9YYsi6HEiL8yd8KVPHVJ293NcMt0 +FsmxFd4Fddr2HYK0NLtf5MDo4yYMw2PmbQ/1/cy/Sr6BvlHmZ6R9+I9beO5LjPBQ +EN62PWWBfl6b2EpYyA9RTFUKFiRhEoqLpmORlzMcUcmIsIYX5ZWanitBnSnIznGe +TapoOXPE93OrpDJU9vIcYx7Y4E8drNAdW1zZcFBo9ilNexq0i1Bhc3RhIFl1Ymlr +ZXkgKFRoaXMgaXMgYW4gb2ZmbGluZSBvbmx5IGtleSB1c2VkIGZvciB0aGUgaGln +aGVzdCBsZXZlbCBvZiB2YWxpZGF0aW9uLiBNeSBtYWluIGtleSBpcyA1MjUyN0JF +REFCRTg3OTg0LiBTZWUga2V5YmFzZS5pby9wYXN0YSmJAWUEEwEIAE8CGwMFCwkI +BwIGFQoJCAsCBRYCAwEAAh4EFiEEYKz3C/cSZFBJ7m8V7+rxZoYiX2QFAmWp/HEY +GGhrcHM6Ly9rZXlzLm9wZW5wZ3Aub3JnAAoJEO/q8WaGIl9kVUYH/2HrXiEHYIZU +NojBSKzBqWUSoXjvN1lITo7WSzdg/saQLtIBuEWwVtZKGH9HcRpi93glAZk+0xeO +Twke4fEAeEiYS3U3t+GqqH5bo4aJD1+EedvpjM5PVhtDyM4VVw8wu/29Tl7lIZQ9 +57Un1dwuYrsO6BEmKWmnV31XpN7JMd4qIAIeQoN9NMOFBT2PS7LXiIUZ36TH3ZAP +hgbec/MhgCQW//KmMd6lqVCNhjJ4ggYeifsAhFo/xMMYxbpFZXkYkpMxziZoG7MT +gQLR2YQEVQm9rQOjdn4IOWN6qoEtxx/82mMq/JynGeMXMyt4rgdSpcjTgnBlKMBv +DU2FF+hvMWiJAjMEEAEIAB0WIQQpWQNi7IeKgf08ICtSUnvtq+h5hAUCZaoDowAK +CRBSUnvtq+h5hKMFD/9zrGMZh6da8RBO1+cU4LZi0KDcFPd0dMHIpnvJ0w1oI3aY +WBmtKbLm5lQZ9OqgRp3MTFZPXbnMrfjqNwmRkEW5V1RjA24MMXjCb5wdD7ZMQ3VN +sXMi4WEJ61o1uVobrBSowmtBJMXyx3tGcHOXOpIXzG+HVx2gnlqFytK621PmSjlA +If498EpqQriIqoEuVkeoyQ0fhSl1d5/gnfP629i1ERnyRN8htJ+J6CJUuHNRPfST +pqvfyrLQTvPSDC7tTNuTY47EKEy3QP1s+R6hLFVbBTxBK1lJVrxBpBqLFCdRQswX +7Xv2p6syn9ia3DmBpw2Bfh8ySPmgVwgonZODXTRAo0uYV3hdeJgblVt9XhSa9C9z +DYgrjXR3EGT+N3GYkjdXqdoOnZzsaUD7CQLnobW4ZIjM+EtwP7QBXv89liqW0ppK +RuZOJ8Zycbiqa+ThK0r2gFm8j7HZWBNE/osVuschQ89d1FmwUKmcMCba/IbNDDHG +JdTr6fJvbXdyF183GZhvSlXdOMPNhcX4dRUcxkooMcUjbnERHKb6q1AKvoIYceb+ +/WaO/RUzCWCRbIEdYKxqYFuKRvuMHcR/F0fGeUUNsujLBuL5xSdZmNDpOrefTH0R +ZDLdTtKATr4GbkVZGBtXvWmd6c5NdJLCMO/n1V6j2ZdpbRBsvB/tl0emdXUvr7kB +DQRlqfCJAQgAqVzAtdH5r5+WezUAbKxwxYopkMJauEhjSE08CLFr8MHiImcIKY2S +rtUTKA+bJYdaaTE1HqIhPTg18wo166/HKdvRR2vi7ACvb8sunAg0/H1Vq6d+y262 +4mLYqoRMQqBBJds0TIC4IDawJFjrkNT/S36jLtaEifENgskTQgashamRFYnwSgKv +BKyobdiRMh26GGoxZLRiZVehCR0FQqchd8GpFOJsSANyX2Hlyi9i8ZhU+Ld2PcPK +nmfkFsS35Dqjm7IkDLpMx7kwjr5YlTcIpQhENbJ68dAzzG9A3mV7Wojfv3Dzpz3j +9wXvoj2EYDYPvNAyftQlfrWKe3r8wcjBKQARAQABiQE2BBgBCAAgFiEEYKz3C/cS +ZFBJ7m8V7+rxZoYiX2QFAmWp8IkCGyAACgkQ7+rxZoYiX2ThTAf/cNb4kEhk+Wjj +FzRHNUinzwA/7+YT5gbEnVh/1x+IpeYpnnuVEdOhNFxz76SL3dtDF8ciIhWxsE4b +v6hpdqcps1Hnq2dkbZ+z9T1r8+IZ03eyYXOo7kZtCwX4UODFwFHi2WaZpCCgOvLX +pA8tKJ04VfIBjp3shlUo+vCROgMouOpJgaLs80LQpoHEB8enHIuNByqWhHl+D4DV +z2l4TPL3HQaCMcW2KCexVz1+9pnPT2hf8DQXrxmchC1CnJVgV64yDzmjhND9C2Hw +OPS0JcBhAzB1FqtVZGYfQSkE5FAA7FLN/IYcCDhxYKVzdKay6m/JL8cbcSpQqLWO +/MR86YndjbkBDQRlqfCJAQgArkCO/giMQ8ReApeP/B4GoNiWlax5bFqMQVPevVix +QfAJ7IQ+8W/JxFmV2F0U2CQU38u9c0kAhYtFk/H/0cC/aEnqKPT6SGpZ4+W7Ehmp +ngSx+1r0sVV1cuZcUncetQeK2IZsBYCCf9XjZIqgFMDygnfM5TvPUyj5qiATxIxV +9bRjI/oNYVPngfnot7VZafVq/yW5+JlYx8u0rKsn5ikpzSDV8IrHmehydrHUUhYj +6/y6ChDzs2ZAq+qoCgFov5z7VzczzEybfPTbAwXpDahCHxF2V6k81c5ZeKEr9l3K +l8Kcc2ybwRe2MbePYCSDHle4GRaYExTXjYnkgyOKtr5YgwARAQABiQE2BBgBCAAg +FiEEYKz3C/cSZFBJ7m8V7+rxZoYiX2QFAmWp8IkCGwwACgkQ7+rxZoYiX2Rx4gf+ +MmibxLDOnVrMv2joky9DJajtZow8ayipXjU1AgIjuvcoMV/GBn8OMx3IAXHVGpyV +16jJ00X8Q+MAwVxd8+7OUoOSFECBqECv5iD4q0OqcZqFx7EyC7iDVUfY9IG0EKjV +4AOzP/azJgT916t3OqcXXDJ2wIUbDIvUQUwTMjX0Fw7OQNGYlHS709UF3y0DwBdq +pCxj1y74D9XzjvWHYxlKI5X8Lt2QW+xsGKkaRp5aIXn6MUnpmdIFZEcTj8s553+m +iqlYokmTvkTa4cQsgwC6RqkVsYopJrYsKnDs/l4/m+4TrPdforaD6mKNKzlsLJSj +gZfWLfoIul+B10SwJHXuoQ== +=/A3N +-----END PGP PUBLIC KEY BLOCK----- + +-----BEGIN PGP PUBLIC KEY BLOCK----- + mQINBF1ULyUBEADFFliU0Hr+PRCQNT9/9ZEhZtLmMMu7tai3VCxhmrHrOpNJJHqX f1/CeUyBhmCvXpKIpAAbH66l/Uc9GH5UgMZ19gMyGa3q3QJn9A6RR9ud4ALRg60P fmYTAci+6Luko7bqTzkS+fYOUSy/LY57s5ANTpveE+iTsBd5grXczCxaYYnthKKA @@ -11,55 +109,317 @@ dH9rZNbO0vuv6rCP7e0nt2ACVT/fExdvrwuHHYZ/7IlwOBlFhab3QYpl/WWep2+X ae33WKl/AOmHVirgtipnq70PW9hHViaSg3rz0NyYHHczNVaCROHE8YdIM/bAmKY/ IYVBXJtT+6Mn8N87isK2TR7zMM3FvDJ4Dsqm1UTGwtDvMtB0sNa5IROaUCHdlMFu rG8n+Bq/oGBFjk9Ay/twH4uOpxyr91aGoGtytw/jhd1+LOb0TGhFGpdc8QARAQAB -tBZQYXN0YSA8cGFzdGFAZGFzaC5vcmc+iQJUBBMBCgA+FiEEKVkDYuyHioH9PCAr -UlJ77avoeYQFAl8FFxMCGwMFCQPDx2sFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA -CgkQUlJ77avoeYS4zhAAlFQAdXZnKprIFGf5ptm7eXeat3gtTMXkfsjXNM7/Q6vo -/HZQwoegfrh1CG1A6ND4NzHg4b6aCuHxWZOmdWKegxjnA2CRD+3cA/xLGlUtAoYC -1SYv6YdFy9A/s97ug4tUyHrVKTfEu0MxVkUrljzXNxSUawcHrNngRN7Sxn6diNH8 -kJWr8asJg+gfEYqXPKferbKap/3RYxX16EDHrX0iJJ4s7gvgzSDvWQMqW7WcOIOL -FVPji2Zqj06RoLvqH8Se/UsdWdcAHEcwRIxxIz2I6QN9gFFZGoL3lySrBhKifN3a -jDc2Y+NqWwTCbgisC6RseM1hkAhXiNX7zTN4uz8QCULSC+wqoNq9dQrHZTfwQ0qN -A4NGKgRCjFt4z0Bl9tYVwgS6dE8kuJCwn385C4y1jXWsS49BIXQIJFBT4kBm1h2l -ruwPvgdiY1iiPmj4UWyJZxBiU/EkHX3vyoQjU0Mfbehokt1Vu7rTZy2Xz6Hv1ZBv -nM9OGAjFJiVrK0lj9yUzXxd/7udqM/G3Y6nad17zKMMpSlUdGjLKU7uoYFfQz/sX -pMmU9gLgapOtE6MMMnxTWlK/Y4vnX0vd4y2oE8jo8luKgTrH+x5MhxTcU3F4DLIz -AyZF/7aupYUR0QURfLlYyHBu/HRZMayBsC25kGC4pz1FT8my+njJAJ+i/HE0cMy0 -G1Bhc3RhIDxwYXN0YUBkYXNoYm9vc3Qub3JnPokCVAQTAQgAPhYhBClZA2Lsh4qB -/TwgK1JSe+2r6HmEBQJdVC8lAhsDBQkDw8drBQsJCAcCBhUKCQgLAgQWAgMBAh4B -AheAAAoJEFJSe+2r6HmEyp4QAJC15jnvVcrnR1bWhDOOA+rm1W5yGhFAjvbumvvn -Xjmjas57R7TGtbNU2eF31kPMLiPx2HrBZVBYSsev7ceGfywJRbY81T6jca+EZHpq -o+XQ6HmC3jAdlqWtxSdnm79G0VsOYaKWht0BIv+almB7zKYsGPaUqJFHZf8lB78o -DOv/tBbXMuHagRQ44ZVqzoS/7OKiwATRve6kZMckU9A8wW/jNrbYxt5Mph6rInpb -ot1AMOywL9EFAplePelHB4DpFAUY6rDjgJu0ge5C789XxkNOkT6/1xYDOg0IxxDZ -+bm0IzzNjK23el6tsDdU/Bk1dywhNxGkhLkWCh46e2AjDPMpWZj7gYPy5Yz8Me0k -/HKvLsulJrwI3LH6g35naoIKGfTfJwnM7dQWxoIwb8IwASQvFuDQBzE3JDyS8gaV -wQMsg1rPXG4cC0DGpNAoxgI/XG13muEY57UWQZ9VgQlf3v4mAwZrz7acPn4DrAbT -4lomWWrN9djVWE2hWZ9L+EU9D63/ziM1IZHkqf3noLky9MrrlW6Yf41ETn2Sm3We -whA0q7+/p9lSdtG0IULTkFLAiOhPMW8pfJwmQJWN1JgBFaRqCSLhtsULVZlC4D0E -4XlM5QBi3rNoQF8AmCN5FPvUyvTd40TFdoub2T+Ga9qkama0lCEtjo0o+b9y3J8h -oTP9uQINBF1ULyUBEAC7rghotYC8xK3FWwL/42fAEHFg95/girmAHk/U2CSaQP63 -KiFZWfN03+HBUNfcEBd68Xwz7Loyi5QD0jElG3Zb08rToCtN3CEWmJqbY0A7k45S -G4nUXx4CFFDlW8jwxtW21kpKTcuIKZcZKPlRRcQUpLUHtbO1lXCobpizCgA/Bs16 -tm7BhsfaB9r0sr5q/Vx1ny2cNpWZlYvzPXFILJ9Fr9QC1mG38IShO8DBcnoLFVQG -eAiWpWcrQq86s3OiXabnHg2A9x210OWtNAT5KmpMqPKuhF7bsP5q2I7qkUb9M5OT -HhNZdHTthN5lAlP9+e1XjT11ojESBKEPSZ3ucnutVjLy771ngkuW3aa2exQod7Oj -UDGuWuLTlx7A9VhAu4k0P/l7Zf1TNJOljc25tAC2QPU+kzkl4JuyVP09wydG5TJ1 -luGfuJ5bRvnu5ak6kTXWzZ4gnmLFJyLiZIkT2Rb4hwKJz88+gPVGHYK8VME+X9uz -DoHPDrgsx+U+OBaRHs1VBvUMRN9ejkLYD9BTpn+js7gloB4CgaSL+wKZ4CLlb4XW -RyM+T8v9NczplxwzK1VA4QJgE5hVTFnZVuGSco5xIVBymTxuPbGwPXFfYRiGRdwJ -CS+60iAcbP923p229xpovzmStYP/LyHrxNMWNBcrT6DyByl7F+pMxwucXumoQQAR -AQABiQI8BBgBCAAmFiEEKVkDYuyHioH9PCArUlJ77avoeYQFAl1ULyUCGwwFCQPD -x2sACgkQUlJ77avoeYQPMQ/8DwfcmR5Jr/TeRa+50WWhVsZt+8/5eQq8acBk8YfP -ed79JXa1xeWM2BTXnEe8uS0jgaW4R8nFE9Sq9RqXXM5H2GqlqzS9fyCx/SvR3eib -YMcLIxjwaxx8MXTljx+p/SdTn+gsOXDCnXUjJbwEMtLDAA2xMtnXKy6R9hziGiil -TvX/B0CXzl9p7sjZBF24iZaUwAN9S1z06t9vW0CE+1oIlVmPm+B9Q1Jk5NQnvdEZ -t0vdnZ1zjaU7eZEzIOQ93KSSrQSA6jrNku4dlAWHFPNYhZ5RPy9Y2OmR1N5Ecu+/ -dzA9HHWTVq2sz6kT1iSEKDQQ4xNyY34Ux6SCdT557RyJufnBY68TTnPBEphE7Hfi -9rZTpNRToqRXd8W6reqqRdqIwVq6EjWVIUaBxyDsEI0yFsGk4GR8YjdyugUZKbal -PJ0nzv/4/0L15w5lKoITtm3kh8Oz/FXsOPEEr31nn5EbG2wik2XGmxS+UxKzFQ2E -5bKIIqvo0g587N0tgOSEdwoypYaZzXMLccce5m9fm7qitPJhdapzxfmncqHtCN/8 -KG03Y/pII5RCq4S+mJjknVN2ZBK6iofODdms37sQ4p2dQfvLUoHuJO+BDTuVwecA -xuQUNylAD60Ax330tU1JeHy6teEn8C3Fols1sJK+mQ4YHhYcvL9X4l2iYUL09veg -96I= -=85Kq ------END PGP PUBLIC KEY BLOCK----- \ No newline at end of file +tHxQYXN0YSAoU2VlIGtleWJhc2UuaW8vcGFzdGEgZm9yIHByb29mcyBvbiBteSBp +ZGVudGlmeS4gNjBBQ0Y3MEJGNzEyNjQ1MDQ5RUU2RjE1RUZFQUYxNjY4NjIyNUY2 +NCBpcyBteSBvZmZsaW5lIG9ubHkgR1BHIGtleS4piQJUBBMBCAA+AhsDBQkNLaMv +AheAFiEEKVkDYuyHioH9PCArUlJ77avoeYQFAmWp/WUFCwkIBwIGFQoJCAsCBBYC +AwECHgUACgkQUlJ77avoeYSFAw/+OIgYP39nPBoZ4G2sIPjpY1PsbGz2D8uj46we +orOJ438fwRbrW5LSSaQ/uQol0keekvt7xDbzQ4L5jFXlgwbhvIea05K8BsM0JMbw +SDcLtBbv0QIhlomV2nkG/rKtvCqwnJ4M19HrVmrqXIbYC2+C3p8qN4enGcNR+vRr +0Op+Q3wMsAPPLWyvBaXCKVIDOEYFGxLs5XqCxuJmtD/iyH9k21//iWjdf+/KEpK1 +OOH1QQQnKTCQPJX4iHeG2tQCMeQqXrTAdQqhvEEmGxqvJ74Oas34Uisd+/LCm4a/ +5enoRfEaVvOVNS1NoMUX1vvUC4YMU6OmtsNo0kCt5wOPxbDFb2vDKtEfnZMEAC0s +k2STti3uuu5WhwODAmjSH1Y/w4jN6tkOfSxQ2k04a12dtZGQBWBIKCgVWB5FZfhS +lPXbS8NMS7CSGnuvwyE2oT3osakEFFSGTW1KsqX57AqA/V/+nH6E77R6v1/61MU/ +m8f1FDe/5WmPPBUrZ7aZ7P+dHCR2PQ5W5tQPStRxeIi3usY1JKMYO88qtEWwClgg +Yh94OD3L9zQvQ8IGqJnpcSLjo0QNgka62D8KFsz3AjcPVYsLego/hn7bP3oXKI6S ++PuxgzbeMBWKLthPXx2klLDoHuNXgUGkTuauUVSoGWxIlyTqBvSpeSZ81O2BE/T/ +wN77yn2JATMEEAEIAB0WIQRgrPcL9xJkUEnubxXv6vFmhiJfZAUCZan2hwAKCRDv +6vFmhiJfZIsRB/4xeq0PhYYyIaAqD15pUIYwmfw35jSerHCkJWrpEAkZ2NhxPgEJ +81PCN1gqoEQ9F8rkk/5VnpFnqcF9nFRN/OiZZYUvoz4DoDX7hjz75Im+dKf4KqW8 +g6MUBTHfuV/srBdENYor2mZCfX6JnQjCjBe9HOUMh/CVzmmFOrthQ1kuCbK0/WPT +KGZ0UfNpNRyrnBpkjAgoO1pU5FTI4KlRhzSx6/NnePW4vHxpZBdd9VhNBU2/WGah +qtNmu7TDSrkpO4ljIJfiq4GMi60ign43zQ4ndJR0CQIcWjhgRAAq5sL8bsEdLhDV +u1+qOQYXaQNf17hqYhCesXfByKYRKqLnGmfrtBtQYXN0YSA8cGFzdGFAZGFzaGJv +b3N0Lm9yZz6JAlQEEwEIAD4WIQQpWQNi7IeKgf08ICtSUnvtq+h5hAUCXVQvJQIb +AwUJA8PHawULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRBSUnvtq+h5hMqeEACQ +teY571XK50dW1oQzjgPq5tVuchoRQI727pr75145o2rOe0e0xrWzVNnhd9ZDzC4j +8dh6wWVQWErHr+3Hhn8sCUW2PNU+o3GvhGR6aqPl0Oh5gt4wHZalrcUnZ5u/RtFb +DmGilobdASL/mpZge8ymLBj2lKiRR2X/JQe/KAzr/7QW1zLh2oEUOOGVas6Ev+zi +osAE0b3upGTHJFPQPMFv4za22MbeTKYeqyJ6W6LdQDDssC/RBQKZXj3pRweA6RQF +GOqw44CbtIHuQu/PV8ZDTpE+v9cWAzoNCMcQ2fm5tCM8zYytt3perbA3VPwZNXcs +ITcRpIS5FgoeOntgIwzzKVmY+4GD8uWM/DHtJPxyry7LpSa8CNyx+oN+Z2qCChn0 +3ycJzO3UFsaCMG/CMAEkLxbg0AcxNyQ8kvIGlcEDLINaz1xuHAtAxqTQKMYCP1xt +d5rhGOe1FkGfVYEJX97+JgMGa8+2nD5+A6wG0+JaJllqzfXY1VhNoVmfS/hFPQ+t +/84jNSGR5Kn956C5MvTK65VumH+NRE59kpt1nsIQNKu/v6fZUnbRtCFC05BSwIjo +TzFvKXycJkCVjdSYARWkagki4bbFC1WZQuA9BOF5TOUAYt6zaEBfAJgjeRT71Mr0 +3eNExXaLm9k/hmvapGpmtJQhLY6NKPm/ctyfIaEz/YkCVwQTAQgAQQIbAwIXgAUJ +DS2jLwULCQgHAgYVCgkICwIEFgIDAQIeBRYhBClZA2Lsh4qB/TwgK1JSe+2r6HmE +BQJlrVMsAhkBAAoJEFJSe+2r6HmE0KcP/2EGb4CWvsmn3q6NoBmZ+u+rCitaX33+ +kXc4US6vRvAfhe0YiOWr5tNd4lg2JID+6jsN2NkAZYgzm4TXXJLkjXkrB+s0sFkC +jyG1/wBfZlPUSfxoDFusJry87N/7E9yMX7A+YV2Hh/yOXbR+/jSINfmjC+3ttjWD +UsUWT9m1yN8SBNg6h66TLffFyXgGFkRKYE27eprP0cuVkI6Fks68ocSQ5FQ7gmdM +CC4JFtOI4e1ax6mfvTFz2e2f5DlohPjW9w4eKTn+k98Nuev+s3WGiDXjxSABoehA +dwz2mbEjPsuz0jLeYKn6ialHh+hruYZozx8dxpUIWEVlMwLDBteWCuwTp+XPmOva +KkgYLxkfjjeIqUy17f6py17GrDZFHLeiopcJqyQJ0XLQI/qAKXkySBpvGD86nrM1 +i+5X7nLxZ0YfjKQ7cI+fp5A6SsQPUk9SI95PXRssx481zNse5wxFMP8J9oIB6nge +r39lpRRmvaSUJDNWjfsRZ/XK4mfib2OlLXooWuU5lCwqtQ+Jw9Zr/Gby2kTNIjrf +IpdNyThTnth+uTwcA8KCJRJY2BrPBtWNWqPLxLv9RLR3/N1siyJcichExIBKEzOh +zzi/i/PTU8dK2OBXrSaJ8DXhPwyNTB2l7jnXBO0hxeO4gmzAFQpM7QXXVDguL0b5 +94y05UNOM/ljiQIcBBMBAgAGBQJeut/oAAoJECqAP87D6bin7ZMP/3be6BDv/zf0 +gCTmgjD6StvPHu+F17op4VPj2cHYCgFP1ZHFH2RjqRVhSN6Wk+hbmR5PDHoVA2nc +xITv/DddKRjYc7fPRlrje7H19+urJgqqkWzmuUbNlxKiXiVW/OPmCjjI89Okt3dZ +GCTicEAPzJ6LTpoVgo4n/Eu81nMm6caf++Pzz1vEI3bJdPHPYyI+gN64mEhfP4OJ +u8v2XTbj+0ua3JxYWilxF7haytApmaPqeT7uOEBrX7EV1M+DlQCSM61u2EC5eIwA +oDba/ENXNyg5Z1JbFe3DxqE6ZVcAcZWXGdtPotayuEy6WL3LB2UUsM4UB4FPSUwc +FvnkV8YzBSV8Rqx+mkOFM6BhxzwK0zPvY+vv+rXSwz7uE/yrToqO9KvGhFxMwMwz +TRAJXI870fJQ9c5z2LzxoNg5gOUQH4vPG6YQT1ev04fj7IGYch9EhrSjuLCm94BA +pOEA+h/TTN6+xVLemUSB/l+Obm5701PP/naVprCJcCqIU3tH5HU3BXpZH++AzWo0 +pmgbtd7ECsR/y0NR4Mxoef677q9YGJEG/psYC0GZlzWsY5zjala+bEVn5gvbw6Lh +4Q2gwpvVXdygb6PSPwRSkpgHtUxdvIQsDEaBBGg/ae0x3O55z2/z95acnhIMRqQp +UpnPmDZUBKlsDJ8tivw/2r8o16YtAlJ0iQEzBBABCAAdFiEEYKz3C/cSZFBJ7m8V +7+rxZoYiX2QFAmWp9dIACgkQ7+rxZoYiX2StMwf8CdL0fhz2TM1R79n+FW7QCSaI +NBzIE1lN2TbdVEZeyiwQLn9cbqOvVPFavj4vxWFIXfAYzitLDHkikmg5Qzj7OXB2 +plFnqJxZ1tZSC1EdMHuNX1j55FDAggV/U/yv2PDY2XuwJbj/hLj80oNzIL5qLnNc +o0CLggB8QLLleFw4BTKycGDrzQCk4AGQ8tDRNoyI6Q/oFQtWQgQdm9Cs02Myr51Q +ZBe09XXA4wpyqv9BM+E0o8SLp/x/wZXM99vDNa7Df0nsRIQukFy5HqJJTufP1b6Q +FVMY1ouweyLxABXO4cvtYpOAUwQroY4U/q9ZnRzxj8Sq+reAt8O/wwJ8ujy9ILQW +UGFzdGEgPHBhc3RhQGRhc2gub3JnPokCVAQTAQgAPgIbAwUJA8PHawIXgBYhBClZ +A2Lsh4qB/TwgK1JSe+2r6HmEBQJlqf1lBQsJCAcCBhUKCQgLAgQWAgMBAh4FAAoJ +EFJSe+2r6HmECFwQAIDwX6fe0y6bc42zNU3Sqtd+Q3OgZfW0Rg23viI1ujyJE1uk +mmGR0i0b2luM+lSw1xOpr+pEsRX0dfaqAbbyUVIgyIZ5viXDZyWyJXr7NuBQZalX +k4njNfAELnQN2MPy/dqpelb6/J+kn6q4TC4DN95bJtSzPLK16rI94sSO+XUAJaiU +pr++cUelALoa5yHBL0mGuhlkNgCNdTE0eVwBLRQDrAywcUOEb6f2eNHyK6UY7WLy +0/LZZv2SzG/ZNQEQNY15/vrDwsQvD1ZueY5haCRK0Ga5o3GWZACU/+/c4VL2Ew7K +odxAjhVHBz50wIe35DUKVkYOQDIx9y+e50CPJicKOsnwjpC+NzQCk462ixCO9DFI ++9AFTJ6TD2BxVRHxLyUY7J21Mes4EILKFAV2dAOSZnd6LgqiYzqovJl6FmaLJyRM +JEfqvTi6Vy38Ns/6PCVGJTWKVsKz2lDas6U3/71jS0FSEwEJ9Rv9Yo75uErypNlJ +MiEahwy7kxqs8BKLtuPrF6QKRB7RgWgVxxU7z92VKCBzKDD0Oe3CDu4Lfva0487d ++TwNIGJdDeJ+ywhhFXIoGmeRm1YZferx1u5PCphiDLVkDDlLEolbp3bxKnN+l4wC +OUvhabciX46H3sM6KGMSoDRjh5n0UPr2+67qBq/rNJRCkALEFrG46i/+mNrYiQEz +BBABCAAdFiEEYKz3C/cSZFBJ7m8V7+rxZoYiX2QFAmWp9dIACgkQ7+rxZoYiX2Se +cQf+IKiMpD8+D93HtmmwG0twBbPMOVta0NU90Gvjxkw/v/JIDEWlZECClUW6Se8Z +Icq+WRZeDP6UZharGAg2GfRpfrKIwVt/aP16LsCqq+SiP4xaohmpcXQxacS5u813 +G9FFuxmHud3x7/sXtxKSVQRkhgQlq+RRG/s5CodNvjliM5OQiiXGr+q1tWy5QhRs +xCXj4CTc2CiV0ycWB36Cx9tkx+/s0pf7X4778wCrhzT6Ds5fT0W9uZifcglfI/p5 +jYYQkGpOrnOiHkBU3F80iFowIGsiv8pfaSqBP8yBAOtNBSVo5ksqSaH+TpVeIb0/ +pfGrM1BOzpTVfTmEj77qSE2tvrkCDQRdVC8lARAAu64IaLWAvMStxVsC/+NnwBBx +YPef4Iq5gB5P1NgkmkD+tyohWVnzdN/hwVDX3BAXevF8M+y6MouUA9IxJRt2W9PK +06ArTdwhFpiam2NAO5OOUhuJ1F8eAhRQ5VvI8MbVttZKSk3LiCmXGSj5UUXEFKS1 +B7WztZVwqG6YswoAPwbNerZuwYbH2gfa9LK+av1cdZ8tnDaVmZWL8z1xSCyfRa/U +AtZht/CEoTvAwXJ6CxVUBngIlqVnK0KvOrNzol2m5x4NgPcdtdDlrTQE+SpqTKjy +roRe27D+atiO6pFG/TOTkx4TWXR07YTeZQJT/fntV409daIxEgShD0md7nJ7rVYy +8u+9Z4JLlt2mtnsUKHezo1Axrlri05cewPVYQLuJND/5e2X9UzSTpY3NubQAtkD1 +PpM5JeCbslT9PcMnRuUydZbhn7ieW0b57uWpOpE11s2eIJ5ixSci4mSJE9kW+IcC +ic/PPoD1Rh2CvFTBPl/bsw6Bzw64LMflPjgWkR7NVQb1DETfXo5C2A/QU6Z/o7O4 +JaAeAoGki/sCmeAi5W+F1kcjPk/L/TXM6ZccMytVQOECYBOYVUxZ2VbhknKOcSFQ +cpk8bj2xsD1xX2EYhkXcCQkvutIgHGz/dt6dtvcaaL85krWD/y8h68TTFjQXK0+g +8gcpexfqTMcLnF7pqEEAEQEAAYkCPAQYAQgAJhYhBClZA2Lsh4qB/TwgK1JSe+2r +6HmEBQJdVC8lAhsMBQkDw8drAAoJEFJSe+2r6HmEDzEP/A8H3JkeSa/03kWvudFl +oVbGbfvP+XkKvGnAZPGHz3ne/SV2tcXljNgU15xHvLktI4GluEfJxRPUqvUal1zO +R9hqpas0vX8gsf0r0d3om2DHCyMY8GscfDF05Y8fqf0nU5/oLDlwwp11IyW8BDLS +wwANsTLZ1ysukfYc4hoopU71/wdAl85fae7I2QRduImWlMADfUtc9Orfb1tAhPta +CJVZj5vgfUNSZOTUJ73RGbdL3Z2dc42lO3mRMyDkPdykkq0EgOo6zZLuHZQFhxTz +WIWeUT8vWNjpkdTeRHLvv3cwPRx1k1atrM+pE9YkhCg0EOMTcmN+FMekgnU+ee0c +ibn5wWOvE05zwRKYROx34va2U6TUU6KkV3fFuq3qqkXaiMFauhI1lSFGgccg7BCN +MhbBpOBkfGI3croFGSm2pTydJ87/+P9C9ecOZSqCE7Zt5IfDs/xV7DjxBK99Z5+R +GxtsIpNlxpsUvlMSsxUNhOWyiCKr6NIOfOzdLYDkhHcKMqWGmc1zC3HHHuZvX5u6 +orTyYXWqc8X5p3Kh7Qjf/ChtN2P6SCOUQquEvpiY5J1TdmQSuoqHzg3ZrN+7EOKd +nUH7y1KB7iTvgQ07lcHnAMbkFDcpQA+tAMd99LVNSXh8urXhJ/AtxaJbNbCSvpkO +GB4WHLy/V+JdomFC9Pb3oPeiiQI8BBgBCAAmAhsMFiEEKVkDYuyHioH9PCArUlJ7 +7avoeYQFAmEb0RAFCQ0to2sACgkQUlJ77avoeYRHuxAAigKlhF2q7RYOxcCIsA+z +Af4jJCCkpdOWwWhjqgjtbFrS/39/FoRSC9TClO2CU4j5FIAkPKdv7EFiAXaMIDur +tpN4Ps+l6wUX/tS+xaGDVseRoAdhVjp7ilG9WIvmV3UMqxge6hbam3H5JhiVlmS+ +DAxG07dbHiFrdqeHrVZU/3649K8JOO9/xSs7Qzf6XJqepfzCjQ4ZRnGy4A/0hhYT +yzGeJOcTNigSjsPHl5PNipG0xbnAn7mxFm2i5XdVmTMCqsThkH6Ac3OBbLgRBvBh +VRWUR1Fbod7ypLTjOrXFW3Yvm7mtbZU8oqLKgcaACyXaIvwAoBY9dIXgrws6Z1dg +wvFH+1N7V2A+mVkbjPzS7Iko9lC1e5WBAJ7VkW20/5Ki08JXpLmd7UyglCcioQTM +d7YyE/Aho3zQbo/9A10REC4kOsl/Ou6IeEURa+mfb9MYPgoVGTcKZnaX0d40auRJ +ptosuoYLenXciRdUmfsADAb2pVdm5b2H3+NLXf+TnbyY/zm24ZFGPXBRSj7tQgaV +6kn9NPSg32Z1WcR+pAn3Jwqts3f1PNuYCrZvWv66NohJRrdCZc1wV4dkYvl2M1s+ +zf8iTVti4IifNjn57slXtEsH36miQy2vN6Cp9I3A7m5WeL07i27P8bvhxOg9q6r3 +NAgNcAK3mOfpQ/ej25jgI5w= +=LIEu +-----END PGP PUBLIC KEY BLOCK----- + +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGKiMDcBEAC5eXHp6VV0fEBsHvqy2AGTuNAf9Zv7ux5GDT65XM1UuoXqhS0q +EGeijp1a70ndQ8TugzGSzoYT9W5xHPvgzDFpKAsiL1fELljnxd8KSl+3KKEX+QLK +1GHVDyLZTpL+vx+Nmb8920kqUMDLIeb/+TrbxGyWyOt8DFcCuigwNqsIVb5EMG/m +cbpO6pPiMahXZxmW1Hb8Pa047BC5kX2Qy07c/HhDAMyPp8C1xjyusgB+w7mSILzc +/n94CETPUztZbLEL+H9cUPFpSXEm53ZJ9MJIt2/eFYBVZ1XEU2hi341/mv2VPAiN +lUqoESJuim+OECPTUPdS8WLV5bmIAkyLj8uhArA1JpX6QwnhPuxCgptg00oHvmy0 ++DAR4DoIU1jndOIU/go78CHGIg3MrtOrXOvarKIairsX0sczRrdedZx9o1JoOiCt +K6k/lK5cYoH/WMiq3DvIUizOboH9jTj5DRXPoX/0eilGRNgRkpX3E1CbUJimiggx +6sgaC13RIaP/8tb9XQVUDsqaXHVAASZHwq4lAu1VjIh//IwQe++Qgr/k3gtkX3Hd +TvC9/Npx4pyODBGxk8KhJDHBeTP7vwl/VtYGD2XUtV/UfRGIvx93VYicsS04QlOu +3oSEzX6ayFOhwZxlbi/KY65xBMfuWw+zTs2qXbPWPkLuMZUOu0KN3oEQKwARAQAB +tCRLb25zdGFudGluIEFraW1vdiA8a25zdHFxQGdtYWlsLmNvbT6JAjgEEwEIACwF +AmKiMDcJECF2xKXQHqUkAhsDBQkeEzgAAhkBBAsHCQMFFQgKAgMEFgABAgAAYAIP +/i/mjLqeJI4l5WUckyocqALaQhe9pAX6JEk0gOlEuIgH9N/cl8fuEEv8j51TNIh2 +EQQZoNM//9Kj1dMxoy9Wtkh1yFe5OT9tKXkaXNwVeox45OqXYs/ARJ/rDUt1BNXu +Nbhdh5+OAYbFltF33JdfLXMRK22LoSOXPn1opEH1Zu6HS40lXl06CVqa7m3gvLY3 +BC/9pi8bSow/INnpJPjavtSA2uLLtRQRaqXs0iwF2FkyAKmAT7zANCA1pkBVMa7E +W+ulP0cr5/nqIPKIBfZxYmqE4YvN3px3JBNtzj7cdC3hAn1km1thOWSaBzb9lXLT +eXSHSRgG6AY2GdfC3F5UC6g6rEIncEJ8drfnTPpMLvXF3+KZ0ssdbLG9ctfev6X+ +lKS+TFEZs7TCANa1lEPr/ISCQYBbL63+xAbIz9SXG07jH6aFF07j6I3h+bWvZTJn +GIj2pq3QxBwh/pYf6hICxYU+fDP67mhlYor7yNIT83W+Ik4IhbLj9AtiW05NIavx +HPrEeYbjovsGWUhvN1LCAO7GFgmcTyQIqDDtLYLxLjnvjptc8HlKh4WW7KqCVawt +GayAcYYQXePDxerkiR0y6jCUSzr3MR8c9yfYarieQVKQLJTDP0UDYnXd20dlvzR9 +Q7wCbwu6jb0EcRDcnbZg8K8gOu1N2gfyFnesz3rq+PCAtC5Lb25zdGFudGluIEFr +aW1vdiA8a29uc3RhbnRpbi5ha2ltb3ZAZGFzaC5vcmc+iQJUBBMBCgA+FiEEFRkd +BbXPlW/jfJWWIXbEpdAepSQFAmKiSfACGwMFCR4TOAAFCwkIBwIGFQoJCAsCBBYC +AwECHgECF4AACgkQIXbEpdAepSTsahAAlq+6OBs1BL7k0drcK3hzN22y3E1LzBEK +mpxeIJ+eHDMerhVoSuDM75fwWk6SXoKxaRRErQ2EP3a5jDfu8MGD2xDypEcMLvE+ +EcFT3M2X79w/+MduR8cp9lUd0NCwpI7zAANq7Mj6gLDFdKEnA8pe730sHZB9I4G9 +vZl961FqzFUMwMttl8KxTzMKnbH/u5Tsvybh/dsv0lcV10irDuCoGGIM/MP42Hul +9CO3bAs69KXA30r/711ooAL3cpw5J5CeMvV2N5GnE656Cl9wRl6rCOSNoaRNJG4t +KtfNZeDd6na6+fABFnOYzzG/kd1+OcmfCFK79ljtL92b7cJzSkoOXfLYvM+V7UN4 +AohH8Lmon4MzGjieBFitHOOUMQy80hBEhuliajtFTv6JB4wS1K5U0NzNKjvLbUhQ +e+iabtChSAtYr3/liDALdROXyrEzAHYxK8Q5ZWdE9wUIz2HcQpHiFt0L33Y4lA8V +Dm26fi02svgHg5SBGGwQ65hSlzIQgmASaogoW3cYPOqVveibcGlM0bxM+0MN3QR6 +0T98PmqcdUV6S+xUkR1LI+5bj7ObzOusc0UGM8m4GQ+DdY46UqInc4yFrgLPzoj4 +QZPwn7aMRFbBF8YSTh7Cr4XvAx8CP2Abau8Sm6YHxXaausKRKaT4eKQlxryGkKdD +sQO3K/PaBWu5Ag0EYqIwNwEQAMaVJMN/2qrJUQnZgoOTcAmjKKUxphnGR27jqVKh +wTT3JW0qEap4ZUF0o6dJTHA0Ni2FltsGMddfyE++ipDgpW/+q9pFE6rs/eUufBX2 +yeYpf/4CSh1rZ6zqXqBQeifEflhEC1PXI+LGFOUyjuR5DV7cHw/i74UWXpUy8zT6 +RGyExSecmqNu9/6zCMnlNsfCAIfurwtrS6RdsYbvxSGWkNOnqkJ6zxOKgmtlOkeL +eNTxk4Oq+o7vPVh0zK/o5owMGpJzef1myMbB5H1aWeM5ReHf4y0VYCpR/IKhVCMm +qrgg70iGDLeeGaB3KFrCyhkFz/hBEcaL4juglQUq9CsfT+bbHWEoQS8jVBekRJi6 +iObupFIibC+W26p4/d5IYmYfU5gKMxPkfFoSokFGeICb8i35Rshv17vvt/Z/MXvk +RcGLAM2ydDtl5VG/h2dH1Dk9CLE3xa6AgtpIyUot+Y5VU1PC5p6gyD7WEo/dSVw7 +AJlgFKIx/UM3wx9MlVm5rB7sHvwnjaUcCTuBRtVitsmWsY/5N0K+qxGj/S1hKWQX +rmT+0K4/sRHfwv3lnFdeocq4hKfcmfhJJXoGXDL/jn/2ml2Oi+0hl0Mtds85MeJR +FwHETjhi/F5xAu9IgKJv/ewomKo8hwk0yHiNm46CCjHb7XmoIzz3e08z73pODzin +2WX7ABEBAAGJAjUEGAEIACkFAmKiMDcJECF2xKXQHqUkAhsMBQkeEzgABAsHCQMF +FQgKAgMEFgABAgAAT1cP/RStJ3oBrHGWB0fjPCfyossmgSeUKo4it+dHqNPTumIj +Zyy5p4FAhFsYeSQwoqlrNgZgt0MZxWQjvV6vNKqx0DXVR5S+xilPI8vpRSfnJhkI +vVdVY8qMj4I0/cyYqrasiR7YVIKepmEZe4aQTzhs/ifMooeY1+ZIwwLYollN91se +Nf3JqWmhY5Q7lPhUZXiyFNyE87geM1P4aOgwZm4EikEadzBFcoHzAXczSCpBwRxM +u53EQbz7Oq2xnFLORPAAwz9yJjCO/0N9HzH2o2Du6GeRccMeHZ65U8tQLvDO79Od +iWDZsU1h56BkDMhqTOsymHnv/QX4vO/X0tShhZXzLwe97++U+HUDobjcHmAySVNy +OugeGdFyYExMNM6Jd/GoS7Xo+RecBSP1yeDnweZgupCmzHVbrfRf7Vdesf6rY7hl +81amRIjdMlhWjOX8OxE4/u+npiQH+wT0VLOwTbxDNvGAAqzYzuETdNROiqqHGNXR +nc3pdm9EUvG/ur4AABDKllnsa0OP0oTOh+FqMQSlTEHwxPhlE11lyIIh2kkuNMmq +Vr7qNeOq3i6dA6EvGn2bikTsvHDw/kF0h08xZRTuy1I0Fcb6GYStM6Qskt4Hhrsa +xwuUTBELdLnf2nLk7sAoUl269juuWXTELTGC40olQh0m8bEXDinknhu6Jug3d0uW +=d05p +-----END PGP PUBLIC KEY BLOCK----- +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFUkMgoBEAD5lFzlr4fIR3CKlsgx1KXLNR+1+IIe3AT8YloMq3rlvylOTgGl +j1PTeQL0eHH+fD3ukSHHiZC7FcY2aC3vTPCd16+OO+ii/Nfx6vAyve2RiTA4brKi +BOGuI/Neh/ow9Sg1AOZY0xsjXVqkabExg+zlUy/6DoabuVEnv/kpl1Bjr5pTfXNG +yeXDKF7MkItib6E9qDE5AsU31XQEAVKBv6u9r+W297+Db3AH6rK3WXiSLfT4KfmV +oufRIubPQvPnYt9l22mPS0gtO4NLB1Qruu/IEYbSUYcWa1GOe9EYoxbPOhWUOj1G +Dt6E4fb4JtmJ/7vkEeHFDRcrW/3EHQLkdLWE4sWrtxWBS4mfjwW9IiT3uDIHiG4F +OjftU5eCefxa7eLJBwjL6YSvD3IdxCLE2fIhNWFgvvCX4gYOayNk8kseV4qdAh7V +PmNhelB3vOnB6S4ufv3ByCwjkviUMZv+L9miAM3Nr1wnX89//ie99s+0FgHtO12c +LPbNCtfHfocnXYdMKoH8cbziOnoKOSUJYtGrtXXRJlKL9KmYCJnbx+sJXdRucCm1 ++xEPRD8m9KHuuOk3powaAWztmL0fpkfrZ4MgHL64VOHlRVq8BpcUhMhrVUiBPL2U +Qh9Bik5QTF0+Cb0WnYV1ktD5QSuI/7LVngd2VVhynMxJ/0TgFwhGwMkA4wARAQAB +tBpVZGppbk02IDxVZGppbk02QGRhc2gub3JnPokCVwQTAQoAQQIbAwULCQgHAwUV +CgkICwUWAgMBAAIeAQIXgAIZARYhBD9dSMnwApPNNlo6mINZK9FADVjZBQJfX098 +BQkdmE+iAAoJEINZK9FADVjZQKcP/3m+uvemzL2Nfo6Ewm0qUjG8dFvD6scVrX0Y +Wc2C+l8mX8niLJz7p4ulg+f8qqZ9ai7zwPHzXlq+qnFMljqqD0zBkemnfzWboUqP +fQ1OF9p6CYwDWG60+YQqz+2wH8/ScLeBiJEpjGIQR2/TgvX0NH+aU7zkfdT26aVT +S7XgF9BVISlUgnPjmq/5uq3944zkv8afFuHWbo4KHokKIBW9ZQ8auoK/xwCotszX +/q//sqHsYLHu8iQN6qWNMD2uXlp/v10qZsiCgrbCOuxmBZ5si49rgnc0jnJRq4/1 +eBbRVqGlLM79mzUQ6X4lerCpZBXLdC6qGF2N7+7RbRYQ8QZomQhGJPMSJ+pQlgT7 +tb+GhpMy01fGmatL+GEEXzhZPjYSqR/HIzx4ZZUV2R691wzGXk/oLhLyAy4NUabc +G6ykylcEZG27G1PldbZlRCGrr5eCnOFULNYDIKWyoyuabzsgDLIBzNDNo97SmTaB +46iUVYVxxHpVsi/p1TL2jCTo0P15oQoyfVX/a1keRRkymQazTjgMSiSrFG0GxGHV +LZ4x4dcdTVj9PBeJRAS8JJCwR3ZmO1+nEdPAPTiQTjQYZKPTCi3kB1LD69jKY6wp +7pX8gN+U8wWl1sV+CBqU9Ts/lKbH/eKFUcKC2nxYOYdsDjOOjvUGrRYJ3hmhGfoJ +kqlmgoyaiQJXBBMBCgBBAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAhkBFiEE +P11IyfACk802WjqYg1kr0UANWNkFAlyKGfUFCQsoeRsACgkQg1kr0UANWNlpcw/+ +OX/tl7kbtY4ndb2ugscIM2W5mgAlJH/dzXO3W7c1fYb/u4RQlGZlekHjzT15mApd +jy2AKfxGFemFRHT9aQaETHDJwNrkn6PYjXrHDqWmgdygJSUCCBrq3Vz4BbIa0Hse +6eUjOT/bzrmrLbOc3kyITVt+MfvuNiCs0po9FcDt0yU1sIy51Xt3xricA5sXZnwK +iIxWVGtWw0TqIRtWW9piSGDJvGri1MIbLvxjIKEkKZsfcxMB5Lun7lQ7J0qrrOFW +XBbhAyuyOXzcuZBVvDyUrk6f5HDRvO78KYwUudWwW0T0rMDT4hh+Iq4TO3GkU6y2 +FUWfggw3sf5JKC8hrcSLVBZ8Qu+ZcwbWDX1ZBGtl+x6eNhphOapUuwCuwnPQ6vmH +SePhssXLRPMCcketgDtacNuN14OKAJws+40TuEuAW9hsMqXzlJgrMfeGG7m/NMeP +cp4LnYnaOZCzRZjUHlP5ljKvYF1MAYrG1vVYJOi4z3HoRJAg1qA1RsW3CRc/YkRR +cHCXG28srtgALP5jY/264Pd7xKWtpvTiuB0cjQQbwY/xnQK7DDPEhfs9xo0yjhZf +iaycN/BWn6YvZdkXjgDp0BtxqkFaDwqtDLCLnPdAab9czpajQRoneAWPQkh263qf +6Nj8xprw5sdnTrPsNY0QBNh5PgPxzjY2+HMHVPNgDPeJAlcEEwEKACoCGwMFCQeG +H4AFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AFAlcReQUCGQEAIQkQg1kr0UANWNkW +IQQ/XUjJ8AKTzTZaOpiDWSvRQA1Y2ak/EACu/O/MdMW7g4QJluc4u/TxknVvMyiU +wZpTRztvSc4ktnQIpMa/neRA3dLyA0QhRkPocOPAvcCf1zrgOf+L6TzYcBoDNTST +Rxuy9zCegbjfTMeIhfG8dg3sdB6FAs3+TeeyOTOz5enPVKxHAyyG+UCc3B16T0dY +k+twopQ6Wfuqtr6cK9OSYUDg/7mqHTfHJpt3go9ppuNFiiYHyR3uEztFYNYQj70n +mCgqIajIPoLsaFmtxVKm2jXJkbXlPQG/58XfRQYEskXtJNKItQQxEG/wMryXOknZ +yuituJwTW9eOe7CaUWcsVIbxLjt5nuuatKnbuagjDKtmb44kymPBsgdkgfRM1fCl +lkylxghtTSXdHG3Y+hcixgFuzQsxibtmANsSNd3chuETz5isz2ZWbcW4ItV3Izy7 +Gf9dcCHtIQEVD2ja9Vz2PBN4Y9RmSwPgnAFpS0gx0FKzq7oQbccatrcI6y+PV5D0 +CbA/Tjnt1Ik8W8+qIGzEpv6Pe09sWHKXbLEhoujBa+xHpWU+5tPiRElKDxze4sTh +x7rhN2wIyyqPjKjMAs2b/NFQjYdvA1/D4wOtqpFCwRxcyRO47zlpsD+Zjd8EhIAE +VbUzyFIousHbXl8fM3rtYehcJFufd49F8oUD0fm/HOQvnHQB5VMQ7wNPQQ7VgbjN +PfbzrNzagNvKnYkCVAQTAQoAJwUCVxF46AIbAwUJB4YfgAULCQgHAwUVCgkICwUW +AgMBAAIeAQIXgAAhCRCDWSvRQA1Y2RYhBD9dSMnwApPNNlo6mINZK9FADVjZcAYP +/j5fgs6jYafTrlHpH96yji5t2bJzNLWqQx6KtVVB7hyL2wPdm0lFXn/0m3HjjuY0 +KurIz2BQ7wW/k9mnYxhhCCh3YYf8fax9ECDJrSAMej+ugYBmYBaAmlROSKEzRKNt +rycBYbYwRuh4yAymgi97vFe8B+HPBe/YiqpzZ7h1TPG6+OLCZRQ9tDvPc1cjnzbu +Z+LU52B9jIkxpM8zJsaCaSg3F/S2e2Y3OUaWhNPsNIaAqYVMUlRTy+yzo5F75f7w +e1ze6AK9Z76I/F13tLNJG03BVJ8OnNkwSMuaJZCbzuQ1MSfFlgTOOdrQjnMjB348 +Ry5c2Sdwmn/ygCjzwBxxRrn1GUAzRoO1goe7SYKUXfPj4yN8gWbeeJGnUyHx57BQ +fdnotXbg9k8TIWCTcKKVxdlABgyhUy8AD4maETMASUZLVT04xNptMj4WQ81fk/Np +g6RAOzK35NfBOAjQ9rRIrIyDD1jVqH3bZPjkO0HS2mgldkIDMi+KNL9MdA83P6Cb +DakBWxPeD+xVtMfDa0vGodcOE228Ex6JcjGljqQT8xW+D31cz4Uw4pnzrB8WxybV +sBMsWLyjhRfhv8qnUW0h3icW26gFFSutPnyA51NS8p5HScHdN27ilyz/r0lye2/D +6Z6oyo3gEyvxEEjJaOK6GO1I8C5TCGfdMvPKaRq2uJqMtBtVZGppbk02IDxVZGpp +bk02QGdtYWlsLmNvbT6JAlQEEwEKAD4CGwMFCwkIBwMFFQoJCAsFFgIDAQACHgEC +F4AWIQQ/XUjJ8AKTzTZaOpiDWSvRQA1Y2QUCX19PfAUJHZhPogAKCRCDWSvRQA1Y +2XreEADJKYpzMt6wUm0bqR3oAdSD5WvCl7PNV+uqsREIfA2enkI7HbNXWqr9f/53 +BQwBFhJsLz7xWfY7gMj28YoJ2FVWGHj1ZPLh7XtEmPZwFXSq7v3SoqygrgYZ3yaS +JW3TdDCfMlhKG+oJKWbOIyDR78tM1WtIkmB3UZCKL2ymiEHxRftJcEdlmxUBS2h+ +unHpx7HKWTPJvza/PoVd7YYkXsmZSoCDJ0fCxpDMIzXuP4AA3Mr5uZj+DTfKhaKi +yyBOi+xkZAwpVsnSqAj2s8BWlqjETDCtNOzSmLVXsUv74p5JtQunb8v1waODo68m +aB/VuV1gMJvfOWj88VnkgWglUO859eRWQ5LwEjzZ8KGEV0MFqDFHEI14a5SsZrtn +hVTXT7yUD9IyZod/fWNGZJT3uUkzykpQ2IKszkbuG3zriDv8rk7Ppx8gQ+kBrXwJ +IXCxG8sXj96ugfp23oh6b6iNBJqXFfJ8567LzIr5pFQChRAG+L8qruBNd0LXES/9 +EZBZPB2DOCQnYf/igtdb3XVKHhpHzrwsYhFExNia7eYz1lf7GklL50mzcP2xcQ5D +uZ5acS0JO3y6cUPJQxsEC26naw32sctxaKFz3DeAYlMmIR1Z8PgeO2cdDZucxZHA +FZL4poIRnBcHGPkytlr/zk/F946gtp3HU29w3cwhB6vDikVjfokCVAQTAQoAPgIb +AwULCQgHAwUVCgkICwUWAgMBAAIeAQIXgBYhBD9dSMnwApPNNlo6mINZK9FADVjZ +BQJcihn6BQkLKHkbAAoJEINZK9FADVjZuoQQAIuc55ExIDZYkzHy3Q0amIRH7Eif +XJuTGu6NkyzYBmqgfXGLLfqZAXjCSyKa0N/ktW9y6cQtU+bUItzPIaVtn+56WjQw +U7ojQfJeyNu8wraRKiaNlSkLfC447ZB5Eq5w7TML67zCvYGB1DxAsNLiOas/evAY +Fwm7QfpwvmnXnOU7u/EuWRoCCfkP+6pZc26u034zv4CD7Jwp37Tk+L38LlZ8zKn1 +ksMd+nqV6lvdwY2iPCV75rqJ1gDh3I91+een1dHHMllsbWRShaC7Z622SXUsDibA +CfE9aqFyvf7H0AL5cc/7CJbUbmoREnj0N+dBzhsH8Qi6ofgfWLP0lxHyUlLpFAua +wLBBzg21d7goA4yShaE2lVIpRp3pjbbHqE0NMB/FvcL3HDe0SUERkxdA5WSEmEYz +5NSBZkPLSQSs6pMKYRrUXdiwysjEOP6hmydUkwmfSZAGogFgDC/cUxVMv391WQMP +m+VpECQKVTX5IBERiUk4suKMCxBdxUw7wXsnE3OlOwdK6KEclLzy3fhEKA7HsNSs +eJr2NiF4Ue494oJP/TzZO7fmi5Q+H9CASRQySOOhYJFH9bRvJMa/HSvoYbwE05RQ +3zhB3i3dFmWfeRCmhCiRkCWlZJyRuRemyAW0mhDLkatWX/2Wew15/eKn4CeoPubb +nDNXb1NCgs8IK8e6iQJUBBMBCgAnBQJYxm9cAhsDBQkHhh+ABQsJCAcDBRUKCQgL +BRYCAwEAAh4BAheAACEJEINZK9FADVjZFiEEP11IyfACk802WjqYg1kr0UANWNlW +PRAAqZPmW/7lsLFaL0hQ+Votj+32FnamiABJKpS+t6Fkm1ckIK+e+nuFXz3pr/WQ +J0eCmLoUwsngz+eOChPJDRAUdMb4eCKcW0yRd06UWZfwg7ugW/j7nXvDu4kJMnwW +thpysyVDpFpnRWC2bwplJzU+LexIF2ijjQTNFzQg0CGCxP0wZu+Be8NSVq0jgjYk +Hs6ekWBEWGlgCspJD/OeVvicRglump4/G5vqXt3jZyrAxt11N/Kl+uCnt1nnFQrn +6KQQbV42+P4ONGGK0DTlfGDYYICDP7XzNLHf0h7GElSjYEWeXLRh4jerkLIm3/1p +aa2XJuk4YSTAs1AuovAQGsbAMBgoecMFPE4qN+MNG6oXgl3PGrz2wvIZjpLjT9DS +u8FM4UqZX8ne+Hj0nn1wVKebQKfbSRiXaCxd0DM1EjmAZAsX85iikIhgd7/bP2Bw +ybrhQTp6dq+oS6/+z3qWeI1UWeYj49bKd+zTSjRVJEpRCkzXcIclTCcQw4ktRHv6 +ZdnFlx0TPzmvF8l5zOG0XvUQSOjCdGp1YulHAe681XXtYf7xG0lBxx2BsbTTKotm +/p75OytX9Y3/TMVoqkbog6fEt7yMWnWWzA7PLigoJwBfRW0FNvAmlSu3gbyUMw3P +wxLbBzaJsXbgdu5dyOOqyANVmugt2hLAkPds7H4tXsugODS5Ag0EVSQyCgEQAKKA +lbyFjfBNciP4c5JoYiDs/GNwmAh19TvZK9PDcmIQ8in76Yvpyiw9O+V7fCdyE/9N ++Pp8nVMv+HYREE14KsZVZMhi2oLkrta1N7nqwKHNcgh0OE/PN7yGUndq93hrCgDN +hTpfBAMb1tAsVljXTuKlxKgg+2ebznCSR9WfU72028kNBoMas1Z+orkXpknO2BOc +WUP8NShroxBdXg2I2k+w9zGNmLrWOsK+pqCFWY3xEObyy3e47McYiAYYXY3Ifb2Q +Saa4RzDQO97yKQcPWUYbpmbECAIqxsZzo/zCCZTx5c0zsPjuKpCxZY/oYx8K5opm +0cdcN51VsOl2YKGmpHd+lywc6huaWL+uSFspdshaufhvIJZ/neCsf7P5dZaoiUd8 +1RvEMaos4ZIMb5FBZSKqAFwTbAPu3w0UhW2JPCmNOphFenSNbCLjz3xqtZ/lpMy6 +7i+xJY7kv1RNbSXWdZIr2mwLMDJ8dqtacwA/A079ly/ze6iO7yNASQe78gd7/RCd +1tO97PK3xyaLs2lR1fHh8PKzPBxHKeoLjyCM3NH1JFGOtanFpubwBzyV2NShG8Wz +wkImT/noLqhOM/CEY8W6CdMabhoTUjDPRF18EVnSlKkVj7k+J2h7t7/P/CylcMhr +F1r5tUs5Ue48202dYFoNfNsN4b8djSk11HjMry3RABEBAAGJAjwEGAEKACYCGwwW +IQQ/XUjJ8AKTzTZaOpiDWSvRQA1Y2QUCY8Wf3AUJEmPU0gAKCRCDWSvRQA1Y2cKx +EADN/UUwxKSkhp/DWtw8Vp0PCYkuj3edFS+BXw/S8X6QCh6kBcFzh/YFRSVnuxrg +U5KxQ3BXEAEgTtapfPWckE2UAdLgOREjGj+ZPs9YnDbihKeizzBW4aC8e6zNRS7y +f92G00N1cr+LNjOpF9WUkuoU8FdfKo1tXmUi1KW/zhUVOMsZCvWlrDXA/ldSJ8FI +BtrNpc+OvWtOTkfKwPKvE0YUk93ukyxNPmoY8TYrxxzMe7C77tEb5mlW3nRCb8vb +ETOGz2HZCYpSQs7n4UNbUMLojHYbJMtW/UAoNrCYOiTfyTmbsvPvkgP4USlBNr7K +txcJTU+ZhqbQsWz/iHCvTKnP+Vw1CLpjQ4L7hvJwN4v3YI5Arc60YGwycvj23jE/ +5ZH7TuqymJ/1G0pRNk6oTWDDv10zFSIT15w1wYkmpbr9gHgeYOg6uwTPuevbpyLa +U2jKX6faTvhxg/8h2eUNUM6agjWAHxaemEiDX5NWiwA1Tkh/7086/jdu/ZQcGSJ8 +d46lqMDc1BhhR+5WePouf2UElAGdxqWhHKzM2Bt7D+jCrSbvtOlgrotg5Xx35vA5 +LAMYhJG4/etvORZiXuWWHs0gtZ85Itxjet8n58oehUI4mhpXQt2Ya+2oTpc7D5RD +2x++a0fd30gBgGGz81kMJpWewGAKlWEIrGmV/CfzR7eqxQ== +=lTCd +-----END PGP PUBLIC KEY BLOCK----- diff --git a/build/templates/backend/Makefile b/build/templates/backend/Makefile index 5b9e0bd4fa..570444583f 100644 --- a/build/templates/backend/Makefile +++ b/build/templates/backend/Makefile @@ -1,7 +1,21 @@ {{define "main" -}} +{{- if ne .Backend.BinaryURL "" }} ARCHIVE := $(shell basename {{.Backend.BinaryURL}}) +{{- else }} +ARCHIVE := +{{- end }} all: + mkdir backend +{{- if ne .Backend.DockerImage "" }} + docker container inspect extract > /dev/null 2>&1 && docker rm extract || true + docker create --name extract {{.Backend.DockerImage}} +{{- if eq .Backend.VerificationType "docker"}} + [ "$$(docker inspect --format='{{`{{index .RepoDigests 0}}`}}' {{.Backend.DockerImage}} | sed 's/.*@sha256://')" = "{{.Backend.VerificationSource}}" ] +{{- end}} + {{.Backend.ExtractCommand}} + docker rm extract +{{- else }} wget {{.Backend.BinaryURL}} {{- if eq .Backend.VerificationType "gpg"}} wget {{.Backend.VerificationSource}} -O checksum @@ -13,8 +27,8 @@ all: {{- else if eq .Backend.VerificationType "sha256"}} [ "$$(sha256sum ${ARCHIVE} | cut -d ' ' -f 1)" = "{{.Backend.VerificationSource}}" ] {{- end}} - mkdir backend {{.Backend.ExtractCommand}} ${ARCHIVE} +{{- end}} {{- if .Backend.ExcludeFiles}} # generated from exclude_files {{- range $index, $name := .Backend.ExcludeFiles}} @@ -24,6 +38,8 @@ all: clean: rm -rf backend +{{- if ne .Backend.BinaryURL "" }} rm -f ${ARCHIVE} +{{- end }} rm -f checksum {{end}} diff --git a/build/templates/backend/config/bitcoin.conf b/build/templates/backend/config/bitcoin.conf index d10eed8880..619f678536 100644 --- a/build/templates/backend/config/bitcoin.conf +++ b/build/templates/backend/config/bitcoin.conf @@ -10,9 +10,14 @@ zmqpubhashtx={{template "IPC.MessageQueueBindingTemplate" .}} zmqpubhashblock={{template "IPC.MessageQueueBindingTemplate" .}} rpcworkqueue=1100 -maxmempool=2000 +maxmempool=4096 +mempoolexpiry=8760 +mempoolfullrbf=1 + dbcache=1000 +deprecatedrpc=warnings + {{- if .Backend.AdditionalParams}} # generated from additional_params {{- range $name, $value := .Backend.AdditionalParams}} diff --git a/build/templates/backend/config/bitcoin_regtest.conf b/build/templates/backend/config/bitcoin_regtest.conf index 0fb7aef215..3bdfc3dcc2 100644 --- a/build/templates/backend/config/bitcoin_regtest.conf +++ b/build/templates/backend/config/bitcoin_regtest.conf @@ -12,6 +12,8 @@ rpcworkqueue=1100 maxmempool=2000 dbcache=1000 +deprecatedrpc=warnings + {{- if .Backend.AdditionalParams}} # generated from additional_params {{- range $name, $value := .Backend.AdditionalParams}} diff --git a/build/templates/backend/config/bitcoin-signet.conf b/build/templates/backend/config/bitcoin_signet.conf similarity index 96% rename from build/templates/backend/config/bitcoin-signet.conf rename to build/templates/backend/config/bitcoin_signet.conf index c26fa574e1..e88a0fd50e 100644 --- a/build/templates/backend/config/bitcoin-signet.conf +++ b/build/templates/backend/config/bitcoin_signet.conf @@ -13,6 +13,8 @@ rpcworkqueue=1100 maxmempool=2000 dbcache=1000 +deprecatedrpc=warnings + {{- if .Backend.AdditionalParams}} # generated from additional_params {{- range $name, $value := .Backend.AdditionalParams}} diff --git a/build/templates/backend/config/bitcoin_testnet4.conf b/build/templates/backend/config/bitcoin_testnet4.conf new file mode 100644 index 0000000000..46a5370b8c --- /dev/null +++ b/build/templates/backend/config/bitcoin_testnet4.conf @@ -0,0 +1,38 @@ +{{define "main" -}} +daemon=1 +server=1 +{{if .Backend.Mainnet}}mainnet=1{{else}}testnet4=1{{end}} +nolisten=1 +txindex=1 +disablewallet=1 + +zmqpubhashtx={{template "IPC.MessageQueueBindingTemplate" .}} +zmqpubhashblock={{template "IPC.MessageQueueBindingTemplate" .}} + +rpcworkqueue=1100 +maxmempool=4096 +mempoolexpiry=8760 +mempoolfullrbf=1 + +dbcache=1000 + +deprecatedrpc=warnings + +{{- if .Backend.AdditionalParams}} +# generated from additional_params +{{- range $name, $value := .Backend.AdditionalParams}} +{{- if eq $name "addnode"}} +{{- range $index, $node := $value}} +addnode={{$node}} +{{- end}} +{{- else}} +{{$name}}={{$value}} +{{- end}} +{{- end}} +{{- end}} + +{{if .Backend.Mainnet}}[main]{{else}}[testnet4]{{end}} +{{generateRPCAuth .IPC.RPCUser .IPC.RPCPass -}} +rpcport={{.Ports.BackendRPC}} + +{{end}} diff --git a/build/templates/backend/config/zcash.conf b/build/templates/backend/config/zcash.conf new file mode 100644 index 0000000000..edd7e6c1da --- /dev/null +++ b/build/templates/backend/config/zcash.conf @@ -0,0 +1,56 @@ +{{define "main" -}}[consensus] +checkpoint_sync = true + +[mempool] +eviction_memory_time = "1h" +tx_cost_limit = 80000000 + +[metrics] + +[mining] +internal_miner = false + +[network] +cache_dir = true +crawl_new_peer_interval = "1m 1s" +initial_mainnet_peers = [ + "dnsseed.z.cash:8233", + "dnsseed.str4d.xyz:8233", + "mainnet.seeder.zfnd.org:8233", + "mainnet.is.yolo.money:8233", +] +initial_testnet_peers = [ + "dnsseed.testnet.z.cash:18233", + "testnet.seeder.zfnd.org:18233", + "testnet.is.yolo.money:18233", +] +listen_addr = "0.0.0.0:8233" +max_connections_per_ip = 1 +network = "Mainnet" +peerset_initial_target_size = 25 + +[rpc] +cookie_dir = "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend" +debug_force_finished_sync = false +enable_cookie_auth = false +parallel_cpu_threads = 0 +listen_addr = '127.0.0.1:{{.Ports.BackendRPC}}' + +[state] +cache_dir = "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/zebra" +delete_old_database = true +ephemeral = false + +[sync] +checkpoint_verify_concurrency_limit = 1000 +download_concurrency_limit = 50 +full_verify_concurrency_limit = 20 +parallel_cpu_threads = 0 + +[tracing] +buffer_limit = 128000 +force_use_color = false +use_color = true +use_journald = false +log_file = "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/zebra.log" +{{end}} \ No newline at end of file diff --git a/build/templates/backend/debian/control b/build/templates/backend/debian/control index 4093b52e82..cdc74d4e9a 100644 --- a/build/templates/backend/debian/control +++ b/build/templates/backend/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper, wget, tar, gzip, make, dh-exec Standards-Version: 3.9.5 Package: {{.Backend.PackageName}} -Architecture: amd64 +Architecture: {{.Env.Architecture}} Depends: ${shlibs:Depends}, ${misc:Depends}, logrotate Description: Satoshilabs packaged {{.Coin.Name}} server {{end}} diff --git a/build/templates/backend/debian/install b/build/templates/backend/debian/install index 27e686617c..950633bb4e 100755 --- a/build/templates/backend/debian/install +++ b/build/templates/backend/debian/install @@ -3,4 +3,5 @@ backend/* {{.Env.BackendInstallPath}}/{{.Coin.Alias}} server.conf => {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf client.conf => {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}_client.conf +{{if .Backend.ExecScript }}exec.sh => {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}_exec.sh{{end}} {{end}} diff --git a/build/templates/backend/debian/service b/build/templates/backend/debian/service index 54473b3b63..2f5193ffbd 100644 --- a/build/templates/backend/debian/service +++ b/build/templates/backend/debian/service @@ -19,7 +19,7 @@ Type=simple {{template "Backend.ServiceAdditionalParamsTemplate" .}} # Resource limits -LimitNOFILE=500000 +LimitNOFILE=2000000 # Hardening measures #################### diff --git a/build/templates/backend/scripts/arbitrum.sh b/build/templates/backend/scripts/arbitrum.sh new file mode 100755 index 0000000000..0872739c21 --- /dev/null +++ b/build/templates/backend/scripts/arbitrum.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +NITRO_BIN=$INSTALL_DIR/nitro + +$NITRO_BIN \ + --chain.name arb1 \ + --init.latest pruned \ + --init.download-path $DATA_DIR/tmp \ + --auth.jwtsecret $DATA_DIR/jwtsecret \ + --persistent.chain $DATA_DIR \ + --parent-chain.connection.url http://127.0.0.1:8136 \ + --parent-chain.blob-client.beacon-url http://127.0.0.1:7536 \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool,arb \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,arb \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.origins '*' \ + --file-logging.enable='false' \ + --node.staker.enable='false' \ + --execution.tx-lookup-limit 0 \ + --validation.wasm.allowed-wasm-module-roots "$INSTALL_DIR/nitro-legacy/machines,$INSTALL_DIR/target/machines" + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/arbitrum_archive.sh b/build/templates/backend/scripts/arbitrum_archive.sh new file mode 100755 index 0000000000..27c7d6dabd --- /dev/null +++ b/build/templates/backend/scripts/arbitrum_archive.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +NITRO_BIN=$INSTALL_DIR/nitro + +$NITRO_BIN \ + --chain.name arb1 \ + --init.latest archive \ + --init.download-path $DATA_DIR/tmp \ + --auth.jwtsecret $DATA_DIR/jwtsecret \ + --persistent.chain $DATA_DIR \ + --parent-chain.connection.url http://127.0.0.1:8116 \ + --parent-chain.blob-client.beacon-url http://127.0.0.1:7516 \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool,arb \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,arb \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.origins '*' \ + --file-logging.enable='false' \ + --node.staker.enable='false' \ + --execution.caching.archive \ + --execution.tx-lookup-limit 0 \ + --validation.wasm.allowed-wasm-module-roots "$INSTALL_DIR/nitro-legacy/machines,$INSTALL_DIR/target/machines" + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/arbitrum_nova.sh b/build/templates/backend/scripts/arbitrum_nova.sh new file mode 100755 index 0000000000..3f15e4ef15 --- /dev/null +++ b/build/templates/backend/scripts/arbitrum_nova.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +NITRO_BIN=$INSTALL_DIR/nitro + +$NITRO_BIN \ + --chain.name nova \ + --init.latest pruned \ + --init.download-path $DATA_DIR/tmp \ + --auth.jwtsecret $DATA_DIR/jwtsecret \ + --persistent.chain $DATA_DIR \ + --parent-chain.connection.url http://127.0.0.1:8136 \ + --parent-chain.blob-client.beacon-url http://127.0.0.1:7536 \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool,arb \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,arb \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.origins '*' \ + --file-logging.enable='false' \ + --node.staker.enable='false' \ + --execution.tx-lookup-limit 0 \ + --validation.wasm.allowed-wasm-module-roots "$INSTALL_DIR/nitro-legacy/machines,$INSTALL_DIR/target/machines" + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/arbitrum_nova_archive.sh b/build/templates/backend/scripts/arbitrum_nova_archive.sh new file mode 100755 index 0000000000..eb150f79b4 --- /dev/null +++ b/build/templates/backend/scripts/arbitrum_nova_archive.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +NITRO_BIN=$INSTALL_DIR/nitro + +$NITRO_BIN \ + --chain.name nova \ + --init.latest archive \ + --init.download-path $DATA_DIR/tmp \ + --auth.jwtsecret $DATA_DIR/jwtsecret \ + --persistent.chain $DATA_DIR \ + --parent-chain.connection.url http://127.0.0.1:8116 \ + --parent-chain.blob-client.beacon-url http://127.0.0.1:7516 \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool,arb \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,arb \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.origins '*' \ + --file-logging.enable='false' \ + --node.staker.enable='false' \ + --execution.caching.archive \ + --execution.tx-lookup-limit 0 \ + --validation.wasm.allowed-wasm-module-roots "$INSTALL_DIR/nitro-legacy/machines,$INSTALL_DIR/target/machines" + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/base.sh b/build/templates/backend/scripts/base.sh new file mode 100644 index 0000000000..1b9305644b --- /dev/null +++ b/build/templates/backend/scripts/base.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +GETH_BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +CHAINDATA_DIR=$DATA_DIR/geth/chaindata +SNAPSHOT=https://mainnet-full-snapshots.base.org/$(curl https://mainnet-full-snapshots.base.org/latest) + +if [ ! -d "$CHAINDATA_DIR" ]; then + wget -c $SNAPSHOT -O - | zstd -cd | tar xf - --strip-components=1 -C $DATA_DIR +fi + +$GETH_BIN \ + --op-network base-mainnet \ + --datadir $DATA_DIR \ + --authrpc.jwtsecret $DATA_DIR/jwtsecret \ + --authrpc.addr 127.0.0.1 \ + --authrpc.port {{.Ports.BackendAuthRpc}} \ + --authrpc.vhosts "*" \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.port {{.Ports.BackendHttp}} \ + --http.addr 127.0.0.1 \ + --http.api eth,net,web3,debug,txpool,engine \ + --http.vhosts "*" \ + --http.corsdomain "*" \ + --ws \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,engine \ + --ws.origins "*" \ + --rollup.disabletxpoolgossip=true \ + --rollup.sequencerhttp https://mainnet-sequencer.base.io \ + --state.scheme hash \ + --history.transactions 0 \ + --cache 4096 \ + --syncmode full \ + --maxpeers 0 \ + --nodiscover + +{{end}} diff --git a/build/templates/backend/scripts/base_archive.sh b/build/templates/backend/scripts/base_archive.sh new file mode 100644 index 0000000000..6f344e467e --- /dev/null +++ b/build/templates/backend/scripts/base_archive.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +GETH_BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +CHAINDATA_DIR=$DATA_DIR/geth/chaindata +SNAPSHOT=https://mainnet-full-snapshots.base.org/$(curl https://mainnet-full-snapshots.base.org/latest) + +if [ ! -d "$CHAINDATA_DIR" ]; then + wget -c $SNAPSHOT -O - | zstd -cd | tar xf - --strip-components=1 -C $DATA_DIR +fi + +$GETH_BIN \ + --op-network base-mainnet \ + --datadir $DATA_DIR \ + --authrpc.jwtsecret $DATA_DIR/jwtsecret \ + --authrpc.addr 127.0.0.1 \ + --authrpc.port {{.Ports.BackendAuthRpc}} \ + --authrpc.vhosts "*" \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.port {{.Ports.BackendHttp}} \ + --http.addr 127.0.0.1 \ + --http.api eth,net,web3,debug,txpool,engine \ + --http.vhosts "*" \ + --http.corsdomain "*" \ + --ws \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,engine \ + --ws.origins "*" \ + --rollup.disabletxpoolgossip=true \ + --rollup.sequencerhttp https://mainnet.sequencer.optimism.io \ + --cache 4096 \ + --cache.gc 0 \ + --cache.trie 30 \ + --cache.snapshot 20 \ + --syncmode full \ + --gcmode archive \ + --maxpeers 0 \ + --nodiscover + +{{end}} diff --git a/build/templates/backend/scripts/base_archive_op_node.sh b/build/templates/backend/scripts/base_archive_op_node.sh new file mode 100644 index 0000000000..75e122da8e --- /dev/null +++ b/build/templates/backend/scripts/base_archive_op_node.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/op-node + +$BIN \ + --network base-mainnet \ + --l1 http://127.0.0.1:8116 \ + --l1.beacon http://127.0.0.1:7516 \ + --l1.trustrpc \ + --l1.rpckind=debug_geth \ + --l2 http://127.0.0.1:8411 \ + --rpc.addr 127.0.0.1 \ + --rpc.port {{.Ports.BackendRPC}} \ + --l2.jwt-secret {{.Env.BackendDataPath}}/base_archive/backend/jwtsecret \ + --p2p.bootnodes enr:-J24QNz9lbrKbN4iSmmjtnr7SjUMk4zB7f1krHZcTZx-JRKZd0kA2gjufUROD6T3sOWDVDnFJRvqBBo62zuF-hYCohOGAYiOoEyEgmlkgnY0gmlwhAPniryHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQKNVFlCxh_B-716tTs-h1vMzZkSs1FTu_OYTNjgufplG4N0Y3CCJAaDdWRwgiQG,enr:-J24QH-f1wt99sfpHy4c0QJM-NfmsIfmlLAMMcgZCUEgKG_BBYFc6FwYgaMJMQN5dsRBJApIok0jFn-9CS842lGpLmqGAYiOoDRAgmlkgnY0gmlwhLhIgb2Hb3BzdGFja4OFQgCJc2VjcDI1NmsxoQJ9FTIv8B9myn1MWaC_2lJ-sMoeCDkusCsk4BYHjjCq04N0Y3CCJAaDdWRwgiQG,enr:-J24QDXyyxvQYsd0yfsN0cRr1lZ1N11zGTplMNlW4xNEc7LkPXh0NAJ9iSOVdRO95GPYAIc6xmyoCCG6_0JxdL3a0zaGAYiOoAjFgmlkgnY0gmlwhAPckbGHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQJwoS7tzwxqXSyFL7g0JM-KWVbgvjfB8JA__T7yY_cYboN0Y3CCJAaDdWRwgiQG,enr:-J24QHmGyBwUZXIcsGYMaUqGGSl4CFdx9Tozu-vQCn5bHIQbR7On7dZbU61vYvfrJr30t0iahSqhc64J46MnUO2JvQaGAYiOoCKKgmlkgnY0gmlwhAPnCzSHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQINc4fSijfbNIiGhcgvwjsjxVFJHUstK9L1T8OTKUjgloN0Y3CCJAaDdWRwgiQG,enr:-J24QG3ypT4xSu0gjb5PABCmVxZqBjVw9ca7pvsI8jl4KATYAnxBmfkaIuEqy9sKvDHKuNCsy57WwK9wTt2aQgcaDDyGAYiOoGAXgmlkgnY0gmlwhDbGmZaHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQIeAK_--tcLEiu7HvoUlbV52MspE0uCocsx1f_rYvRenIN0Y3CCJAaDdWRwgiQG \ + --p2p.useragent base \ + --rollup.load-protocol-versions=true \ + --verifier.l1-confs 4 + +{{end}} diff --git a/build/templates/backend/scripts/base_op_node.sh b/build/templates/backend/scripts/base_op_node.sh new file mode 100644 index 0000000000..4254b8972e --- /dev/null +++ b/build/templates/backend/scripts/base_op_node.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/op-node + +$BIN \ + --network base-mainnet \ + --l1 http://127.0.0.1:8136 \ + --l1.beacon http://127.0.0.1:7536 \ + --l1.trustrpc \ + --l1.rpckind debug_geth \ + --l2 http://127.0.0.1:8409 \ + --rpc.addr 127.0.0.1 \ + --rpc.port {{.Ports.BackendRPC}} \ + --l2.jwt-secret {{.Env.BackendDataPath}}/base/backend/jwtsecret \ + --p2p.bootnodes enr:-J24QNz9lbrKbN4iSmmjtnr7SjUMk4zB7f1krHZcTZx-JRKZd0kA2gjufUROD6T3sOWDVDnFJRvqBBo62zuF-hYCohOGAYiOoEyEgmlkgnY0gmlwhAPniryHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQKNVFlCxh_B-716tTs-h1vMzZkSs1FTu_OYTNjgufplG4N0Y3CCJAaDdWRwgiQG,enr:-J24QH-f1wt99sfpHy4c0QJM-NfmsIfmlLAMMcgZCUEgKG_BBYFc6FwYgaMJMQN5dsRBJApIok0jFn-9CS842lGpLmqGAYiOoDRAgmlkgnY0gmlwhLhIgb2Hb3BzdGFja4OFQgCJc2VjcDI1NmsxoQJ9FTIv8B9myn1MWaC_2lJ-sMoeCDkusCsk4BYHjjCq04N0Y3CCJAaDdWRwgiQG,enr:-J24QDXyyxvQYsd0yfsN0cRr1lZ1N11zGTplMNlW4xNEc7LkPXh0NAJ9iSOVdRO95GPYAIc6xmyoCCG6_0JxdL3a0zaGAYiOoAjFgmlkgnY0gmlwhAPckbGHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQJwoS7tzwxqXSyFL7g0JM-KWVbgvjfB8JA__T7yY_cYboN0Y3CCJAaDdWRwgiQG,enr:-J24QHmGyBwUZXIcsGYMaUqGGSl4CFdx9Tozu-vQCn5bHIQbR7On7dZbU61vYvfrJr30t0iahSqhc64J46MnUO2JvQaGAYiOoCKKgmlkgnY0gmlwhAPnCzSHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQINc4fSijfbNIiGhcgvwjsjxVFJHUstK9L1T8OTKUjgloN0Y3CCJAaDdWRwgiQG,enr:-J24QG3ypT4xSu0gjb5PABCmVxZqBjVw9ca7pvsI8jl4KATYAnxBmfkaIuEqy9sKvDHKuNCsy57WwK9wTt2aQgcaDDyGAYiOoGAXgmlkgnY0gmlwhDbGmZaHb3BzdGFja4OFQgCJc2VjcDI1NmsxoQIeAK_--tcLEiu7HvoUlbV52MspE0uCocsx1f_rYvRenIN0Y3CCJAaDdWRwgiQG \ + --p2p.useragent base \ + --rollup.load-protocol-versions=true \ + --verifier.l1-confs 4 + +{{end}} diff --git a/build/templates/backend/scripts/bsc.sh b/build/templates/backend/scripts/bsc.sh new file mode 100644 index 0000000000..fdcfbf8035 --- /dev/null +++ b/build/templates/backend/scripts/bsc.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +GETH_BIN=$INSTALL_DIR/geth_linux +CHAINDATA_DIR=$DATA_DIR/geth/chaindata + +if [ ! -d "$CHAINDATA_DIR" ]; then + $GETH_BIN init --datadir $DATA_DIR $INSTALL_DIR/genesis.json +fi + +$GETH_BIN \ + --config $INSTALL_DIR/config.toml \ + --datadir $DATA_DIR \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws \ + --ws.addr 127.0.0.1 \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.api eth,net,web3,debug,txpool \ + --ws.origins '*' \ + --syncmode full \ + --maxpeers 200 \ + --rpc.allow-unprotected-txs \ + --txlookuplimit 0 \ + --cache 8000 \ + --ipcdisable \ + --nat none + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/bsc_archive.sh b/build/templates/backend/scripts/bsc_archive.sh new file mode 100644 index 0000000000..17990d9e19 --- /dev/null +++ b/build/templates/backend/scripts/bsc_archive.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +GETH_BIN=$INSTALL_DIR/geth_linux +CHAINDATA_DIR=$DATA_DIR/geth/chaindata + +if [ ! -d "$CHAINDATA_DIR" ]; then + $GETH_BIN init --datadir $DATA_DIR $INSTALL_DIR/genesis.json +fi + +$GETH_BIN \ + --config $INSTALL_DIR/config.toml \ + --datadir $DATA_DIR \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws \ + --ws.addr 127.0.0.1 \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.api eth,net,web3,debug,txpool \ + --ws.origins '*' \ + --gcmode archive \ + --cache.gc 0 \ + --cache.trie 30 \ + --syncmode full \ + --maxpeers 200 \ + --rpc.allow-unprotected-txs \ + --txlookuplimit 0 \ + --cache 8000 \ + --ipcdisable \ + --nat none + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/optimism.sh b/build/templates/backend/scripts/optimism.sh new file mode 100644 index 0000000000..faccfe80e5 --- /dev/null +++ b/build/templates/backend/scripts/optimism.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +GETH_BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +CHAINDATA_DIR=$DATA_DIR/geth/chaindata +SNAPSHOT=https://r2-snapshots.fastnode.io/op/$(curl -s https://r2-snapshots.fastnode.io/op/latest-mainnet) + +if [ ! -d "$CHAINDATA_DIR" ]; then + wget -c $SNAPSHOT -O - | lz4 -cd | tar xf - -C $DATA_DIR +fi + +$GETH_BIN \ + --op-network op-mainnet \ + --datadir $DATA_DIR \ + --authrpc.jwtsecret $DATA_DIR/jwtsecret \ + --authrpc.addr 127.0.0.1 \ + --authrpc.port {{.Ports.BackendAuthRpc}} \ + --authrpc.vhosts "*" \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.port {{.Ports.BackendHttp}} \ + --http.addr 127.0.0.1 \ + --http.api eth,net,web3,debug,txpool,engine \ + --http.vhosts "*" \ + --http.corsdomain "*" \ + --ws \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,engine \ + --ws.origins "*" \ + --rollup.disabletxpoolgossip=true \ + --rollup.sequencerhttp https://mainnet-sequencer.optimism.io \ + --txlookuplimit 0 \ + --cache 4096 \ + --syncmode full \ + --maxpeers 0 \ + --nodiscover + +{{end}} diff --git a/build/templates/backend/scripts/optimism_archive.sh b/build/templates/backend/scripts/optimism_archive.sh new file mode 100644 index 0000000000..780258841a --- /dev/null +++ b/build/templates/backend/scripts/optimism_archive.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +GETH_BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +CHAINDATA_DIR=$DATA_DIR/geth/chaindata +SNAPSHOT=https://datadirs.optimism.io/latest + +if [ ! -d "$CHAINDATA_DIR" ]; then + wget -c $(curl -sL $SNAPSHOT | grep -oP '(?<=url=)[^"]*') -O - | zstd -cd | tar xf - -C $DATA_DIR +fi + +$GETH_BIN \ + --op-network op-mainnet \ + --datadir $DATA_DIR \ + --authrpc.jwtsecret $DATA_DIR/jwtsecret \ + --authrpc.addr 127.0.0.1 \ + --authrpc.port {{.Ports.BackendAuthRpc}} \ + --authrpc.vhosts "*" \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.port {{.Ports.BackendHttp}} \ + --http.addr 127.0.0.1 \ + --http.api eth,net,web3,debug,txpool,engine \ + --http.vhosts "*" \ + --http.corsdomain "*" \ + --ws \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.addr 127.0.0.1 \ + --ws.api eth,net,web3,debug,txpool,engine \ + --ws.origins "*" \ + --rollup.disabletxpoolgossip=true \ + --rollup.historicalrpc http://127.0.0.1:8304 \ + --rollup.sequencerhttp https://mainnet.sequencer.optimism.io \ + --cache 4096 \ + --cache.gc 0 \ + --cache.trie 30 \ + --cache.snapshot 20 \ + --syncmode full \ + --gcmode archive \ + --maxpeers 0 \ + --nodiscover + +{{end}} diff --git a/build/templates/backend/scripts/optimism_archive_legacy_geth.sh b/build/templates/backend/scripts/optimism_archive_legacy_geth.sh new file mode 100644 index 0000000000..641da1fe19 --- /dev/null +++ b/build/templates/backend/scripts/optimism_archive_legacy_geth.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +export USING_OVM=true +export ETH1_SYNC_SERVICE_ENABLE=false + +GETH_BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +CHAINDATA_DIR=$DATA_DIR/geth/chaindata +SNAPSHOT=https://datadirs.optimism.io/mainnet-legacy-archival.tar.zst + +if [ ! -d "$CHAINDATA_DIR" ]; then + wget -c $SNAPSHOT -O - | zstd -cd | tar xf - -C $DATA_DIR +fi + +$GETH_BIN \ + --networkid 10 \ + --datadir $DATA_DIR \ + --port {{.Ports.BackendP2P}} \ + --rpc \ + --rpcport {{.Ports.BackendHttp}} \ + --rpcaddr 127.0.0.1 \ + --rpcapi eth,rollup,net,web3,debug \ + --rpcvhosts "*" \ + --rpccorsdomain "*" \ + --ws \ + --wsport {{.Ports.BackendRPC}} \ + --wsaddr 0.0.0.0 \ + --wsapi eth,rollup,net,web3,debug \ + --wsorigins "*" \ + --nousb \ + --ipcdisable \ + --nat=none \ + --nodiscover + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/optimism_archive_op_node.sh b/build/templates/backend/scripts/optimism_archive_op_node.sh new file mode 100644 index 0000000000..463757032e --- /dev/null +++ b/build/templates/backend/scripts/optimism_archive_op_node.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/op-node +PATH={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +$BIN \ + --network op-mainnet \ + --l1 http://127.0.0.1:8116 \ + --l1.beacon http://127.0.0.1:7516 \ + --l1.trustrpc \ + --l1.rpckind=debug_geth \ + --l2 http://127.0.0.1:8402 \ + --rpc.addr 127.0.0.1 \ + --rpc.port {{.Ports.BackendRPC}} \ + --l2.jwt-secret {{.Env.BackendDataPath}}/optimism_archive/backend/jwtsecret \ + --p2p.priv.path $PATH/opnode_p2p_priv.txt \ + --p2p.peerstore.path $PATH/opnode_peerstore_db \ + --p2p.discovery.path $PATH/opnode_discovery_db + +{{end}} diff --git a/build/templates/backend/scripts/optimism_op_node.sh b/build/templates/backend/scripts/optimism_op_node.sh new file mode 100644 index 0000000000..200c04b687 --- /dev/null +++ b/build/templates/backend/scripts/optimism_op_node.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +BIN={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/op-node +PATH={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +$BIN \ + --network op-mainnet \ + --l1 http://127.0.0.1:8136 \ + --l1.beacon http://127.0.0.1:7536 \ + --l1.trustrpc \ + --l1.rpckind=debug_geth \ + --l2 http://127.0.0.1:8400 \ + --rpc.addr 127.0.0.1 \ + --rpc.port {{.Ports.BackendRPC}} \ + --l2.jwt-secret {{.Env.BackendDataPath}}/optimism/backend/jwtsecret \ + --p2p.priv.path $PATH/opnode_p2p_priv.txt \ + --p2p.peerstore.path $PATH/opnode_peerstore_db \ + --p2p.discovery.path $PATH/opnode_discovery_db + +{{end}} diff --git a/build/templates/backend/scripts/polygon_archive_bor.sh b/build/templates/backend/scripts/polygon_archive_bor.sh new file mode 100644 index 0000000000..340e981cf4 --- /dev/null +++ b/build/templates/backend/scripts/polygon_archive_bor.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +BOR_BIN=$INSTALL_DIR/bor + +if [ -z "${BOR_PEBBLE_DB}" ]; then + ARCHIVE_FLAGS="--gcmode archive --db.engine leveldb --state.scheme hash" +else + ARCHIVE_FLAGS="--db.engine pebble" +fi + +# --bor.heimdall = backend-polygon-heimdall-archive ports.backend_http +$BOR_BIN server \ + --chain $INSTALL_DIR/genesis.json \ + --syncmode full \ + --datadir $DATA_DIR \ + $ARCHIVE_FLAGS \ + --bor.heimdall http://127.0.0.1:8173 \ + --maxpeers 200 \ + --bootnodes enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303,enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303,enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303,enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303,enode://93faa5d49ba61fa03f43f7e3c76907a9c72953e8628650eef09f5bddc646d9012916824cdd60da989fd954a852205df9a1fd9661379504c92e103a1ada4c2ceb@148.251.142.52:30314,enode://91f6d9873ee2ceee27b4054ec70844e21fa7c525e8d820d6a09989473f4f883951da75a09ef098d544c0c8a71e9ddd2e649e5b455b137260ba8657b2f96cad2c@178.63.148.12:30308,enode://2776f6f0d1c1e4dfddeb9a4b1c3b1a8777fbb3054b92fc55b405d35603667e974e9cad4408f1036cfc17af03dd1a6270c5cb40f854b94760474516b2d8c0f185@88.198.101.172:30308,enode://157321664e79855ee0f914fd05b21cc29ae3a7e805114d1c26efa1d4d2781f5d5bc4e76ed9d00f26d6138f80cc84ea183894c390fcb0e07100a845aed02f6f40@136.243.210.177:30303,enode://6a5e65c6ef3356bc79a780cf0c7534c299fb8cd7b37db80155830478c1e29d35336fe52a888efdf53c0e9bb9b94e20b5349d68798860f1cf36ae96da2b3826cc@178.63.247.234:30304,enode://d6da5ad18e51d492481b29443bd0f588b59d3f72f0da43a722b07fe2a9223a717c976a1cfe00ad86c557756b2bf297ea56c64a1f3d09bebcb9b81290689d8e33@178.63.197.250:30320,enode://51cbc8b750e28d5a4f250d141c032cf282ea873eb1c533c5156cfc51e6a5117d465b7b39b4e0088ee597ee87b89e06cc6c1ed5e6e050b1c3f638765ee584c4f4@178.63.163.68:30310,enode://6484d4394215c222257c97ac74fdcd6f77ecf00e896c38ef35cc41a44add96da64649139b37cc094e88bb985eb84b04d4c6c78f86bf205c9e112c31254cdc443@54.38.217.112:30303?discport=30346,enode://eb3b67d68daef47badfa683c8b04a1cba6a7c431613b8d7619a013aad38bd8d405eb1d0e41279b4f6fe15b264bd388e88282a77a908247b2d1e0198bd4def57b@148.251.224.230:30315,enode://aa228d96217dd91564e13536f3c2808d2040115c7c50509f26f836275e8e65d1bf9400bce3294760be18c9e00a4bf47026e661ba8d8ce1cf2ced30f0a70e5da8@89.187.163.132:30303?discport=30356,enode://c10ab147ba266a80f34dbc423cd12689434cb2cc1f18ced8f4e5828e23d6943a666c2db0f8464983ccc95666b36099b513d1e45d5df94139e42fbecde25832fa@87.249.137.89:30303?discport=30436,enode://e68049c37b182a36c8913fc0780aea5196c1841c917cbd76f83f1a3a8ae99fcfbd2dfa44e36081668120354439008fe4325ffc0d0176771ec2c1863033d4769e@65.108.199.236:30303,enode://a4c74da28447bacd2b3e8443d0917cca7798bca39dbb48b0e210f0fb6685538ba9d1608a2493424086363f04be5e6a99e6eabb70946ed503448d6b282056f87a@198.244.213.85:30303?discport=30315,enode://e28fce95f52cf3368b7b624c6f83379dec858fcebf6a7ff07e97aa9b9445736a165bf1c51cad7bdf6e3167e2b00b11c7911fc330dabb484998d899a1b01d75cf@148.251.194.252:30303?discport=30892,enode://412fdb01125f6868a188f472cf15f07c8f93d606395b909dd5010f2a4a2702739102cea18abb6437fbacd12e695982a77f28edd9bbdd36635b04e9b3c2948f8d@34.203.27.246:30303?discport=30388,enode://9703d9591cb1013b4fa6ea889e8effe7579aa59c324a6e019d690a13e108ef9b4419698347e4305f05291e644a713518a91b0fc32a3442c1394619e2a9b8251e@79.127.216.33:30303?discport=30349 \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.addr 0.0.0.0 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool,bor \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws \ + --ws.addr 0.0.0.0 \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.api eth,net,web3,debug,txpool,bor \ + --ws.origins '*' \ + --txlookuplimit 0 \ + --cache 4096 +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/polygon_archive_heimdall.sh b/build/templates/backend/scripts/polygon_archive_heimdall.sh new file mode 100644 index 0000000000..988956ab6e --- /dev/null +++ b/build/templates/backend/scripts/polygon_archive_heimdall.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +HEIMDALL_BIN=$INSTALL_DIR/heimdalld +HOME_DIR=$DATA_DIR +CONFIG_DIR=$HOME_DIR/config + +if [ ! -d "$CONFIG_DIR" ]; then + # init chain + $HEIMDALL_BIN init $(hostname -s) --home $HOME_DIR --chain-id heimdallv2-137 +fi + +# --bor_rpc_url: backend-polygon-bor-archive ports.backend_http +# --eth_rpc_url: backend-ethereum-archive ports.backend_http +$HEIMDALL_BIN start \ + --home $HOME_DIR \ + --rpc.laddr tcp://127.0.0.1:{{.Ports.BackendRPC}} \ + --p2p.laddr tcp://0.0.0.0:{{.Ports.BackendP2P}} \ + --grpc_server tcp://127.0.0.1:{{.Ports.BackendHttp}} \ + --p2p.seeds "e019e16d4e376723f3adc58eb1761809fea9bee0@35.234.150.253:26656,7f3049e88ac7f820fd86d9120506aaec0dc54b27@34.89.75.187:26656,1f5aff3b4f3193404423c3dd1797ce60cd9fea43@34.142.43.240:26656,2d5484feef4257e56ece025633a6ea132d8cadca@35.246.99.203:26656,17e9efcbd173e81a31579310c502e8cdd8b8ff2e@35.197.233.249:26656,72a83490309f9f63fdca3a0bef16c290e5cbb09c@35.246.95.65:26656,00677b1b2c6282fb060b7bb6e9cc7d2d05cdd599@34.105.180.11:26656,721dd4cebfc4b78760c7ee5d7b1b44d29a0aa854@34.147.169.102:26656,4760b3fc04648522a0bcb2d96a10aadee141ee89@34.89.55.74:26656" \ + --bor_rpc_url http://127.0.0.1:8172 \ + --eth_rpc_url http://127.0.0.1:8116 +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/polygon_bor.sh b/build/templates/backend/scripts/polygon_bor.sh new file mode 100644 index 0000000000..16c110b745 --- /dev/null +++ b/build/templates/backend/scripts/polygon_bor.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +BOR_BIN=$INSTALL_DIR/bor + +# --bor.heimdall = backend-polygon-heimdall ports.backend_http +$BOR_BIN server \ + --chain $INSTALL_DIR/genesis.json \ + --syncmode full \ + --datadir $DATA_DIR \ + --bor.heimdall http://127.0.0.1:8171 \ + --maxpeers 200 \ + --bootnodes enode://76316d1cb93c8ed407d3332d595233401250d48f8fbb1d9c65bd18c0495eca1b43ec38ee0ea1c257c0abb7d1f25d649d359cdfe5a805842159cfe36c5f66b7e8@52.78.36.216:30303,enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303,enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303,enode://681ebac58d8dd2d8a6eef15329dfbad0ab960561524cf2dfde40ad646736fe5c244020f20b87e7c1520820bc625cfb487dd71d63a3a3bf0baea2dbb8ec7c79f1@34.240.245.39:30303,enode://93faa5d49ba61fa03f43f7e3c76907a9c72953e8628650eef09f5bddc646d9012916824cdd60da989fd954a852205df9a1fd9661379504c92e103a1ada4c2ceb@148.251.142.52:30314,enode://91f6d9873ee2ceee27b4054ec70844e21fa7c525e8d820d6a09989473f4f883951da75a09ef098d544c0c8a71e9ddd2e649e5b455b137260ba8657b2f96cad2c@178.63.148.12:30308,enode://2776f6f0d1c1e4dfddeb9a4b1c3b1a8777fbb3054b92fc55b405d35603667e974e9cad4408f1036cfc17af03dd1a6270c5cb40f854b94760474516b2d8c0f185@88.198.101.172:30308,enode://157321664e79855ee0f914fd05b21cc29ae3a7e805114d1c26efa1d4d2781f5d5bc4e76ed9d00f26d6138f80cc84ea183894c390fcb0e07100a845aed02f6f40@136.243.210.177:30303,enode://6a5e65c6ef3356bc79a780cf0c7534c299fb8cd7b37db80155830478c1e29d35336fe52a888efdf53c0e9bb9b94e20b5349d68798860f1cf36ae96da2b3826cc@178.63.247.234:30304,enode://d6da5ad18e51d492481b29443bd0f588b59d3f72f0da43a722b07fe2a9223a717c976a1cfe00ad86c557756b2bf297ea56c64a1f3d09bebcb9b81290689d8e33@178.63.197.250:30320,enode://51cbc8b750e28d5a4f250d141c032cf282ea873eb1c533c5156cfc51e6a5117d465b7b39b4e0088ee597ee87b89e06cc6c1ed5e6e050b1c3f638765ee584c4f4@178.63.163.68:30310,enode://6484d4394215c222257c97ac74fdcd6f77ecf00e896c38ef35cc41a44add96da64649139b37cc094e88bb985eb84b04d4c6c78f86bf205c9e112c31254cdc443@54.38.217.112:30303?discport=30346,enode://eb3b67d68daef47badfa683c8b04a1cba6a7c431613b8d7619a013aad38bd8d405eb1d0e41279b4f6fe15b264bd388e88282a77a908247b2d1e0198bd4def57b@148.251.224.230:30315,enode://aa228d96217dd91564e13536f3c2808d2040115c7c50509f26f836275e8e65d1bf9400bce3294760be18c9e00a4bf47026e661ba8d8ce1cf2ced30f0a70e5da8@89.187.163.132:30303?discport=30356,enode://c10ab147ba266a80f34dbc423cd12689434cb2cc1f18ced8f4e5828e23d6943a666c2db0f8464983ccc95666b36099b513d1e45d5df94139e42fbecde25832fa@87.249.137.89:30303?discport=30436,enode://e68049c37b182a36c8913fc0780aea5196c1841c917cbd76f83f1a3a8ae99fcfbd2dfa44e36081668120354439008fe4325ffc0d0176771ec2c1863033d4769e@65.108.199.236:30303,enode://a4c74da28447bacd2b3e8443d0917cca7798bca39dbb48b0e210f0fb6685538ba9d1608a2493424086363f04be5e6a99e6eabb70946ed503448d6b282056f87a@198.244.213.85:30303?discport=30315,enode://e28fce95f52cf3368b7b624c6f83379dec858fcebf6a7ff07e97aa9b9445736a165bf1c51cad7bdf6e3167e2b00b11c7911fc330dabb484998d899a1b01d75cf@148.251.194.252:30303?discport=30892,enode://412fdb01125f6868a188f472cf15f07c8f93d606395b909dd5010f2a4a2702739102cea18abb6437fbacd12e695982a77f28edd9bbdd36635b04e9b3c2948f8d@34.203.27.246:30303?discport=30388,enode://9703d9591cb1013b4fa6ea889e8effe7579aa59c324a6e019d690a13e108ef9b4419698347e4305f05291e644a713518a91b0fc32a3442c1394619e2a9b8251e@79.127.216.33:30303?discport=30349 \ + --port {{.Ports.BackendP2P}} \ + --http \ + --http.addr 127.0.0.1 \ + --http.port {{.Ports.BackendHttp}} \ + --http.api eth,net,web3,debug,txpool,bor \ + --http.vhosts '*' \ + --http.corsdomain '*' \ + --ws \ + --ws.addr 127.0.0.1 \ + --ws.port {{.Ports.BackendRPC}} \ + --ws.api eth,net,web3,debug,txpool,bor \ + --ws.origins '*' \ + --txlookuplimit 0 \ + --cache 4096 + +{{end}} \ No newline at end of file diff --git a/build/templates/backend/scripts/polygon_heimdall.sh b/build/templates/backend/scripts/polygon_heimdall.sh new file mode 100644 index 0000000000..c267c1bbed --- /dev/null +++ b/build/templates/backend/scripts/polygon_heimdall.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +{{define "main" -}} + +set -e + +INSTALL_DIR={{.Env.BackendInstallPath}}/{{.Coin.Alias}} +DATA_DIR={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend + +HEIMDALL_BIN=$INSTALL_DIR/heimdalld +HOME_DIR=$DATA_DIR +CONFIG_DIR=$HOME_DIR/config + +if [ ! -d "$CONFIG_DIR" ]; then + # init chain + $HEIMDALL_BIN init $(hostname -s) --home $HOME_DIR --chain-id heimdallv2-137 +fi + +# --bor_rpc_url: backend-polygon-bor ports.backend_http +# --eth_rpc_url: backend-ethereum ports.backend_http +$HEIMDALL_BIN start \ + --home $HOME_DIR \ + --rpc.laddr tcp://127.0.0.1:{{.Ports.BackendRPC}} \ + --p2p.laddr tcp://0.0.0.0:{{.Ports.BackendP2P}} \ + --grpc_server tcp://127.0.0.1:{{.Ports.BackendHttp}} \ + --p2p.seeds "e019e16d4e376723f3adc58eb1761809fea9bee0@35.234.150.253:26656,7f3049e88ac7f820fd86d9120506aaec0dc54b27@34.89.75.187:26656,1f5aff3b4f3193404423c3dd1797ce60cd9fea43@34.142.43.240:26656,2d5484feef4257e56ece025633a6ea132d8cadca@35.246.99.203:26656,17e9efcbd173e81a31579310c502e8cdd8b8ff2e@35.197.233.249:26656,72a83490309f9f63fdca3a0bef16c290e5cbb09c@35.246.95.65:26656,00677b1b2c6282fb060b7bb6e9cc7d2d05cdd599@34.105.180.11:26656,721dd4cebfc4b78760c7ee5d7b1b44d29a0aa854@34.147.169.102:26656,4760b3fc04648522a0bcb2d96a10aadee141ee89@34.89.55.74:26656" \ + --bor_rpc_url http://127.0.0.1:8170 \ + --eth_rpc_url http://127.0.0.1:8136 +{{end}} \ No newline at end of file diff --git a/build/templates/blockbook/blockchaincfg.json b/build/templates/blockbook/blockchaincfg.json index 525937c5be..7d8fe75cee 100644 --- a/build/templates/blockbook/blockchaincfg.json +++ b/build/templates/blockbook/blockchaincfg.json @@ -7,6 +7,8 @@ {{end}} "coin_name": "{{.Coin.Name}}", "coin_shortcut": "{{.Coin.Shortcut}}", +{{- if .Coin.Network}} + "network": "{{.Coin.Network}}",{{end}} "coin_label": "{{.Coin.Label}}", "rpc_url": "{{template "IPC.RPCURLTemplate" .}}", "rpc_user": "{{.IPC.RPCUser}}", diff --git a/build/templates/blockbook/debian/control b/build/templates/blockbook/debian/control index c269337b8a..9185723a52 100644 --- a/build/templates/blockbook/debian/control +++ b/build/templates/blockbook/debian/control @@ -7,7 +7,7 @@ Build-Depends: debhelper, dh-exec Standards-Version: 3.9.5 Package: {{.Blockbook.PackageName}} -Architecture: amd64 -Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc, {{.Backend.PackageName}} +Architecture: {{.Env.Architecture}} +Depends: ${shlibs:Depends}, ${misc:Depends}, coreutils, passwd, findutils, psmisc Description: Satoshilabs blockbook server ({{.Coin.Name}}) {{end}} diff --git a/build/tools/image_status.sh b/build/tools/image_status.sh index 5c4397b72c..c8dc4283b8 100755 --- a/build/tools/image_status.sh +++ b/build/tools/image_status.sh @@ -16,10 +16,10 @@ if [ -z "$IMG_CREATED_TIME" ]; then exit 0 fi -IMG_CREATED_TS=$(date -d $IMG_CREATED_TIME +%s) -GIT_COMMIT_TS=$(date -d $(git log --pretty="format:%cI" -1 $DIR) +%s) +IMG_CREATED_TS=$IMG_CREATED_TIME +GIT_COMMIT_TS=$(git log --pretty="format:%cI" -1 $DIR) -if [ $IMG_CREATED_TS -lt $GIT_COMMIT_TS ]; then +if [[ "$IMG_CREATED_TS" < "$GIT_COMMIT_TS" ]]; then echo "out-of-time" else echo "ok" diff --git a/build/tools/templates.go b/build/tools/templates.go index 5612c5223d..03113d2a1b 100644 --- a/build/tools/templates.go +++ b/build/tools/templates.go @@ -8,21 +8,53 @@ import ( "os" "os/exec" "path/filepath" + "reflect" + "runtime" "text/template" "time" ) +// Backend contains backend specific fields +type Backend struct { + PackageName string `json:"package_name"` + PackageRevision string `json:"package_revision"` + SystemUser string `json:"system_user"` + Version string `json:"version"` + BinaryURL string `json:"binary_url"` + DockerImage string `json:"docker_image"` + VerificationType string `json:"verification_type"` + VerificationSource string `json:"verification_source"` + ExtractCommand string `json:"extract_command"` + ExcludeFiles []string `json:"exclude_files"` + ExecCommandTemplate string `json:"exec_command_template"` + ExecScript string `json:"exec_script"` + LogrotateFilesTemplate string `json:"logrotate_files_template"` + PostinstScriptTemplate string `json:"postinst_script_template"` + ServiceType string `json:"service_type"` + ServiceAdditionalParamsTemplate string `json:"service_additional_params_template"` + ProtectMemory bool `json:"protect_memory"` + Mainnet bool `json:"mainnet"` + ServerConfigFile string `json:"server_config_file"` + ClientConfigFile string `json:"client_config_file"` + AdditionalParams interface{} `json:"additional_params,omitempty"` + Platforms map[string]Backend `json:"platforms,omitempty"` +} + // Config contains the structure of the config type Config struct { Coin struct { Name string `json:"name"` Shortcut string `json:"shortcut"` + Network string `json:"network,omitempty"` Label string `json:"label"` Alias string `json:"alias"` } `json:"coin"` Ports struct { BackendRPC int `json:"backend_rpc"` BackendMessageQueue int `json:"backend_message_queue"` + BackendP2P int `json:"backend_p2p"` + BackendHttp int `json:"backend_http"` + BackendAuthRpc int `json:"backend_authrpc"` BlockbookInternal int `json:"blockbook_internal"` BlockbookPublic int `json:"blockbook_public"` } `json:"ports"` @@ -33,27 +65,7 @@ type Config struct { RPCTimeout int `json:"rpc_timeout"` MessageQueueBindingTemplate string `json:"message_queue_binding_template"` } `json:"ipc"` - Backend struct { - PackageName string `json:"package_name"` - PackageRevision string `json:"package_revision"` - SystemUser string `json:"system_user"` - Version string `json:"version"` - BinaryURL string `json:"binary_url"` - VerificationType string `json:"verification_type"` - VerificationSource string `json:"verification_source"` - ExtractCommand string `json:"extract_command"` - ExcludeFiles []string `json:"exclude_files"` - ExecCommandTemplate string `json:"exec_command_template"` - LogrotateFilesTemplate string `json:"logrotate_files_template"` - PostinstScriptTemplate string `json:"postinst_script_template"` - ServiceType string `json:"service_type"` - ServiceAdditionalParamsTemplate string `json:"service_additional_params_template"` - ProtectMemory bool `json:"protect_memory"` - Mainnet bool `json:"mainnet"` - ServerConfigFile string `json:"server_config_file"` - ClientConfigFile string `json:"client_config_file"` - AdditionalParams interface{} `json:"additional_params,omitempty"` - } `json:"backend"` + Backend Backend `json:"backend"` Blockbook struct { PackageName string `json:"package_name"` SystemUser string `json:"system_user"` @@ -87,6 +99,7 @@ type Config struct { BackendDataPath string `json:"backend_data_path"` BlockbookInstallPath string `json:"blockbook_install_path"` BlockbookDataPath string `json:"blockbook_data_path"` + Architecture string `json:"architecture"` } `json:"-"` } @@ -136,6 +149,16 @@ func (c *Config) ParseTemplate() *template.Template { return t } +func copyNonZeroBackendFields(toValue *Backend, fromValue *Backend) { + from := reflect.ValueOf(*fromValue) + to := reflect.ValueOf(toValue).Elem() + for i := 0; i < from.NumField(); i++ { + if from.Field(i).IsValid() && !from.Field(i).IsZero() { + to.Field(i).Set(from.Field(i)) + } + } +} + // LoadConfig loads the config files func LoadConfig(configsDir, coin string) (*Config, error) { config := new(Config) @@ -161,8 +184,15 @@ func LoadConfig(configsDir, coin string) (*Config, error) { } config.Meta.BuildDatetime = time.Now().Format("Mon, 02 Jan 2006 15:04:05 -0700") + config.Env.Architecture = runtime.GOARCH if !isEmpty(config, "backend") { + // set platform specific fields to config + platform, found := config.Backend.Platforms[runtime.GOARCH] + if found { + copyNonZeroBackendFields(&config.Backend, &platform) + } + switch config.Backend.ServiceType { case "forking": case "simple": @@ -175,6 +205,7 @@ func LoadConfig(configsDir, coin string) (*Config, error) { case "gpg": case "sha256": case "gpg-sha256": + case "docker": default: return nil, fmt.Errorf("Invalid verification type: %s", config.Backend.VerificationType) } @@ -253,11 +284,15 @@ func GeneratePackageDefinitions(config *Config, templateDir, outputDir string) e } if !isEmpty(config, "backend") { - err = writeBackendServerConfigFile(config, outputDir) - if err == nil { - err = writeBackendClientConfigFile(config, outputDir) + if err := writeBackendServerConfigFile(config, outputDir); err != nil { + return err } - if err != nil { + + if err := writeBackendClientConfigFile(config, outputDir); err != nil { + return err + } + + if err := writeBackendExecScript(config, outputDir); err != nil { return err } } @@ -327,3 +362,24 @@ func writeBackendClientConfigFile(config *Config, outputDir string) error { _, err = io.Copy(out, in) return err } + +func writeBackendExecScript(config *Config, outputDir string) error { + if config.Backend.ExecScript == "" { + return nil + } + + out, err := os.OpenFile(filepath.Join(outputDir, "backend/exec.sh"), os.O_CREATE|os.O_WRONLY, 0777) + if err != nil { + return err + } + defer out.Close() + + in, err := os.Open(filepath.Join(outputDir, "backend/scripts", config.Backend.ExecScript)) + if err != nil { + return err + } + defer in.Close() + + _, err = io.Copy(out, in) + return err +} diff --git a/build/tools/trezor-common/sync-coins.go b/build/tools/trezor-common/sync-coins.go index f4e90ba14e..acb5518e39 100644 --- a/build/tools/trezor-common/sync-coins.go +++ b/build/tools/trezor-common/sync-coins.go @@ -1,4 +1,4 @@ -//usr/bin/go run $0 $@ ; exit +// usr/bin/go run $0 $@ ; exit package main import ( diff --git a/build/tools/typescriptify/typescriptify.go b/build/tools/typescriptify/typescriptify.go new file mode 100644 index 0000000000..731c8ff230 --- /dev/null +++ b/build/tools/typescriptify/typescriptify.go @@ -0,0 +1,74 @@ +package main + +import ( + "fmt" + "math/big" + "time" + + "github.com/tkrajina/typescriptify-golang-structs/typescriptify" + "github.com/trezor/blockbook/api" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/server" +) + +func main() { + t := typescriptify.New() + t.CreateInterface = true + t.Indent = " " + t.BackupDir = "" + + t.ManageType(api.Amount{}, typescriptify.TypeOptions{TSType: "string"}) + t.ManageType([]api.Amount{}, typescriptify.TypeOptions{TSType: "string[]"}) + t.ManageType([]*api.Amount{}, typescriptify.TypeOptions{TSType: "string[]"}) + t.ManageType(big.Int{}, typescriptify.TypeOptions{TSType: "number"}) + t.ManageType(time.Time{}, typescriptify.TypeOptions{TSType: "string", TSDoc: "Time in ISO 8601 YYYY-MM-DDTHH:mm:ss.sssZd"}) + + // API - REST and Websocket + t.Add(api.APIError{}) + t.Add(api.Tx{}) + t.Add(api.FeeStats{}) + t.Add(api.Address{}) + t.Add(api.Utxo{}) + t.Add(api.BalanceHistory{}) + t.Add(api.Blocks{}) + t.Add(api.Block{}) + t.Add(api.BlockRaw{}) + t.Add(api.SystemInfo{}) + t.Add(api.FiatTicker{}) + t.Add(api.FiatTickers{}) + t.Add(api.AvailableVsCurrencies{}) + + // Websocket specific + t.Add(server.WsReq{}) + t.Add(server.WsRes{}) + t.Add(server.WsAccountInfoReq{}) + t.Add(server.WsInfoRes{}) + t.Add(server.WsBlockHashReq{}) + t.Add(server.WsBlockHashRes{}) + t.Add(server.WsBlockReq{}) + t.Add(server.WsBlockFilterReq{}) + t.Add(server.WsBlockFiltersBatchReq{}) + t.Add(server.WsAccountUtxoReq{}) + t.Add(server.WsBalanceHistoryReq{}) + t.Add(server.WsTransactionReq{}) + t.Add(server.WsTransactionSpecificReq{}) + t.Add(server.WsEstimateFeeReq{}) + t.Add(server.WsEstimateFeeRes{}) + t.Add(server.WsLongTermFeeRateRes{}) + t.Add(server.WsSendTransactionReq{}) + t.Add(server.WsSubscribeAddressesReq{}) + t.Add(server.WsSubscribeFiatRatesReq{}) + t.Add(server.WsCurrentFiatRatesReq{}) + t.Add(server.WsFiatRatesForTimestampsReq{}) + t.Add(server.WsFiatRatesTickersListReq{}) + t.Add(server.WsMempoolFiltersReq{}) + t.Add(server.WsRpcCallReq{}) + t.Add(server.WsRpcCallRes{}) + t.Add(bchain.MempoolTxidFilterEntries{}) + + err := t.ConvertToFile("blockbook-api.ts") + if err != nil { + panic(err.Error()) + } + fmt.Println("OK") +} diff --git a/common/config.go b/common/config.go new file mode 100644 index 0000000000..2252b602d3 --- /dev/null +++ b/common/config.go @@ -0,0 +1,42 @@ +package common + +import ( + "encoding/json" + "os" + + "github.com/juju/errors" +) + +// Config struct +type Config struct { + CoinName string `json:"coin_name"` + CoinShortcut string `json:"coin_shortcut"` + CoinLabel string `json:"coin_label"` + Network string `json:"network"` + FourByteSignatures string `json:"fourByteSignatures"` + FiatRates string `json:"fiat_rates"` + FiatRatesParams string `json:"fiat_rates_params"` + FiatRatesVsCurrencies string `json:"fiat_rates_vs_currencies"` + BlockGolombFilterP uint8 `json:"block_golomb_filter_p"` + BlockFilterScripts string `json:"block_filter_scripts"` + BlockFilterUseZeroedKey bool `json:"block_filter_use_zeroed_key"` +} + +// GetConfig loads and parses the config file and returns Config struct +func GetConfig(configFile string) (*Config, error) { + if configFile == "" { + return nil, errors.New("Missing blockchaincfg configuration parameter") + } + + configFileContent, err := os.ReadFile(configFile) + if err != nil { + return nil, errors.Errorf("Error reading file %v, %v", configFile, err) + } + + var cn Config + err = json.Unmarshal(configFileContent, &cn) + if err != nil { + return nil, errors.Annotatef(err, "Error parsing config file ") + } + return &cn, nil +} diff --git a/common/currencyrateticker.go b/common/currencyrateticker.go new file mode 100644 index 0000000000..2c1afe534c --- /dev/null +++ b/common/currencyrateticker.go @@ -0,0 +1,100 @@ +package common + +import ( + "strings" + "time" +) + +// CurrencyRatesTicker contains coin ticker data fetched from API +type CurrencyRatesTicker struct { + Timestamp time.Time `json:"timestamp"` // return as unix timestamp in API + Rates map[string]float32 `json:"rates"` // rates of the base currency against a list of vs currencies + TokenRates map[string]float32 `json:"tokenRates,omitempty"` // rates of the tokens (identified by the address of the contract) against the base currency +} + +var ( + // TickerRecalculateTokenRate signals if it is necessary to recalculate token rate to base rate + // this happens when token rates are downloaded in TokenVsCurrency different from the base currency + TickerRecalculateTokenRate bool + // TickerTokenVsCurrency is the currency in which the token rates are downloaded + TickerTokenVsCurrency string +) + +// Convert returns token rate in base currency +func (t *CurrencyRatesTicker) GetTokenRate(token string) (float32, bool) { + if t.TokenRates != nil { + rate, found := t.TokenRates[strings.ToLower(token)] + if !found { + return 0, false + } + if TickerRecalculateTokenRate { + vsRate, found := t.Rates[TickerTokenVsCurrency] + if !found || vsRate == 0 { + return 0, false + } + rate = rate / vsRate + } + return rate, found + } + return 0, false +} + +// Convert converts value in base currency to toCurrency +func (t *CurrencyRatesTicker) Convert(baseValue float64, toCurrency string) float64 { + rate, found := t.Rates[toCurrency] + if !found { + return 0 + } + return baseValue * float64(rate) +} + +// ConvertTokenToBase converts token value to base currency +func (t *CurrencyRatesTicker) ConvertTokenToBase(value float64, token string) float64 { + rate, found := t.GetTokenRate(token) + if found { + return value * float64(rate) + } + return 0 +} + +// ConvertToken converts token value to toCurrency currency +func (t *CurrencyRatesTicker) ConvertToken(value float64, token string, toCurrency string) float64 { + baseValue := t.ConvertTokenToBase(value, token) + if baseValue > 0 { + return t.Convert(baseValue, toCurrency) + } + return 0 +} + +// TokenRateInCurrency return token rate in toCurrency currency +func (t *CurrencyRatesTicker) TokenRateInCurrency(token string, toCurrency string) float32 { + rate, found := t.GetTokenRate(token) + if found { + baseRate, found := t.Rates[toCurrency] + if found { + return baseRate * rate + } + } + return 0 +} + +// IsSuitableTicker checks if the ticker can provide data for given vsCurrency or token +func IsSuitableTicker(ticker *CurrencyRatesTicker, vsCurrency string, token string) bool { + if vsCurrency != "" { + if ticker.Rates == nil { + return false + } + if _, found := ticker.Rates[vsCurrency]; !found { + return false + } + } + if token != "" { + if ticker.TokenRates == nil { + return false + } + if _, found := ticker.TokenRates[token]; !found { + return false + } + } + return true +} diff --git a/common/currencyrateticker_test.go b/common/currencyrateticker_test.go new file mode 100644 index 0000000000..70ddf1419b --- /dev/null +++ b/common/currencyrateticker_test.go @@ -0,0 +1,62 @@ +package common + +import ( + "testing" +) + +func TestCurrencyRatesTicker_ConvertToken(t *testing.T) { + ticker := &CurrencyRatesTicker{ + Rates: map[string]float32{ + "usd": 2129.987654321, + "eur": 1332.12345678, + }, + TokenRates: map[string]float32{ + "0x82df128257a7d7556262e1ab7f1f639d9775b85e": 0.4092341123, + "0x6b175474e89094c44da98b954eedeac495271d0f": 12.32323232323232, + "0xdac17f958d2ee523a2206206994597c13d831ec7": 1332421341235.51234, + }, + } + tests := []struct { + name string + value float64 + token string + toCurrency string + want float64 + }{ + { + name: "usd 0x82df128257a7d7556262e1ab7f1f639d9775b85e", + value: 10, + token: "0x82df128257a7d7556262e1ab7f1f639d9775b85e", + toCurrency: "usd", + want: 8716.635514874506, + }, + { + name: "eur 0xdac17f958d2ee523a2206206994597c13d831ec7", + value: 23.123, + token: "0xdac17f958d2ee523a2206206994597c13d831ec7", + toCurrency: "eur", + want: 4.104216071804417e+16, + }, + { + name: "eur 0xdac17f958d2ee523a2206206994597c13d831ec8", + value: 23.123, + token: "0xdac17f958d2ee523a2206206994597c13d831ec8", + toCurrency: "eur", + want: 0, + }, + { + name: "eur 0xdac17f958d2ee523a2206206994597c13d831ec7", + value: 23.123, + token: "0xdac17f958d2ee523a2206206994597c13d831ec7", + toCurrency: "czk", + want: 0, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := ticker.ConvertToken(tt.value, tt.token, tt.toCurrency); got != tt.want { + t.Errorf("CurrencyRatesTicker.ConvertToken() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/common/internalstate.go b/common/internalstate.go index bf8a46b5a3..5fb5273809 100644 --- a/common/internalstate.go +++ b/common/internalstate.go @@ -2,9 +2,13 @@ package common import ( "encoding/json" + "slices" "sort" "sync" + "sync/atomic" "time" + + "github.com/golang/glog" ) const ( @@ -16,70 +20,96 @@ const ( DbStateInconsistent ) +var inShutdown int32 + // InternalStateColumn contains the data of a db column type InternalStateColumn struct { - Name string `json:"name"` - Version uint32 `json:"version"` - Rows int64 `json:"rows"` - KeyBytes int64 `json:"keyBytes"` - ValueBytes int64 `json:"valueBytes"` - Updated time.Time `json:"updated"` + Name string `json:"name" ts_doc:"Name of the database column."` + Version uint32 `json:"version" ts_doc:"Version or schema version of the column."` + Rows int64 `json:"rows" ts_doc:"Number of rows stored in this column."` + KeyBytes int64 `json:"keyBytes" ts_doc:"Total size (in bytes) of keys stored in this column."` + ValueBytes int64 `json:"valueBytes" ts_doc:"Total size (in bytes) of values stored in this column."` + Updated time.Time `json:"updated" ts_doc:"Timestamp of the last update to this column."` } // BackendInfo is used to get information about blockchain type BackendInfo struct { - BackendError string `json:"error,omitempty"` - Chain string `json:"chain,omitempty"` - Blocks int `json:"blocks,omitempty"` - Headers int `json:"headers,omitempty"` - BestBlockHash string `json:"bestBlockHash,omitempty"` - Difficulty string `json:"difficulty,omitempty"` - SizeOnDisk int64 `json:"sizeOnDisk,omitempty"` - Version string `json:"version,omitempty"` - Subversion string `json:"subversion,omitempty"` - ProtocolVersion string `json:"protocolVersion,omitempty"` - Timeoffset float64 `json:"timeOffset,omitempty"` - Warnings string `json:"warnings,omitempty"` - Consensus interface{} `json:"consensus,omitempty"` + BackendError string `json:"error,omitempty" ts_doc:"Error message if something went wrong in the backend."` + Chain string `json:"chain,omitempty" ts_doc:"Name of the chain - e.g. 'main'."` + Blocks int `json:"blocks,omitempty" ts_doc:"Number of fully verified blocks in the chain."` + Headers int `json:"headers,omitempty" ts_doc:"Number of block headers in the chain."` + BestBlockHash string `json:"bestBlockHash,omitempty" ts_doc:"Hash of the best block in hex."` + Difficulty string `json:"difficulty,omitempty" ts_doc:"Current difficulty of the network."` + SizeOnDisk int64 `json:"sizeOnDisk,omitempty" ts_doc:"Size of the blockchain data on disk in bytes."` + Version string `json:"version,omitempty" ts_doc:"Version of the blockchain backend - e.g. '280000'."` + Subversion string `json:"subversion,omitempty" ts_doc:"Subversion of the blockchain backend - e.g. '/Satoshi:28.0.0/'."` + ProtocolVersion string `json:"protocolVersion,omitempty" ts_doc:"Protocol version of the blockchain backend - e.g. '70016'."` + Timeoffset float64 `json:"timeOffset,omitempty" ts_doc:"Time offset (in seconds) reported by the backend."` + Warnings string `json:"warnings,omitempty" ts_doc:"Any warnings given by the backend regarding the chain state."` + ConsensusVersion string `json:"consensus_version,omitempty" ts_doc:"Version or details of the consensus protocol in use."` + Consensus interface{} `json:"consensus,omitempty" ts_doc:"Additional chain-specific consensus data."` } // InternalState contains the data of the internal state type InternalState struct { - mux sync.Mutex + mux sync.Mutex `ts_doc:"Mutex for synchronized access to the internal state."` - Coin string `json:"coin"` - CoinShortcut string `json:"coinShortcut"` - CoinLabel string `json:"coinLabel"` - Host string `json:"host"` + Coin string `json:"coin" ts_doc:"Coin name (e.g. 'Bitcoin')."` + CoinShortcut string `json:"coinShortcut" ts_doc:"Short code for the coin (e.g. 'BTC')."` + CoinLabel string `json:"coinLabel" ts_doc:"Human-readable label for the coin (e.g. 'Bitcoin main')."` + Host string `json:"host" ts_doc:"Hostname of the node or backend."` + Network string `json:"network,omitempty" ts_doc:"Network name if different from CoinShortcut (e.g. 'testnet')."` - DbState uint32 `json:"dbState"` + DbState uint32 `json:"dbState" ts_doc:"State of the database (closed=0, open=1, inconsistent=2)."` + ExtendedIndex bool `json:"extendedIndex" ts_doc:"Indicates if an extended indexing strategy is used."` - LastStore time.Time `json:"lastStore"` + LastStore time.Time `json:"lastStore" ts_doc:"Time when the internal state was last stored/persisted."` // true if application is with flag --sync - SyncMode bool `json:"syncMode"` + SyncMode bool `json:"syncMode" ts_doc:"Flag indicating if the node is in sync mode."` + + InitialSync bool `json:"initialSync" ts_doc:"If true, the system is in the initial sync phase."` + IsSynchronized bool `json:"isSynchronized" ts_doc:"If true, the main index is fully synced to BestHeight."` + BestHeight uint32 `json:"bestHeight" ts_doc:"Current best block height known to the indexer."` + StartSync time.Time `json:"-" ts_doc:"Timestamp when sync started (not exposed via JSON)."` + LastSync time.Time `json:"lastSync" ts_doc:"Timestamp of the last successful sync."` + BlockTimes []uint32 `json:"-" ts_doc:"List of block timestamps (per height) for calculating historical stats (not exposed via JSON)."` + AvgBlockPeriod uint32 `json:"-" ts_doc:"Average time (in seconds) per block for the last 100 blocks (not exposed via JSON)."` + + IsMempoolSynchronized bool `json:"isMempoolSynchronized" ts_doc:"If true, mempool data is in sync."` + MempoolSize int `json:"mempoolSize" ts_doc:"Number of transactions in the current mempool."` + LastMempoolSync time.Time `json:"lastMempoolSync" ts_doc:"Timestamp of the last mempool sync."` + + DbColumns []InternalStateColumn `json:"dbColumns" ts_doc:"List of database column statistics."` + + HasFiatRates bool `json:"-" ts_doc:"True if fiat rates are supported (not exposed via JSON)."` + HasTokenFiatRates bool `json:"-" ts_doc:"True if token fiat rates are supported (not exposed via JSON)."` + HistoricalFiatRatesTime time.Time `json:"historicalFiatRatesTime" ts_doc:"Timestamp of the last historical fiat rates update."` + HistoricalTokenFiatRatesTime time.Time `json:"historicalTokenFiatRatesTime" ts_doc:"Timestamp of the last historical token fiat rates update."` - InitialSync bool `json:"initialSync"` - IsSynchronized bool `json:"isSynchronized"` - BestHeight uint32 `json:"bestHeight"` - LastSync time.Time `json:"lastSync"` - BlockTimes []uint32 `json:"-"` + EnableSubNewTx bool `json:"-" ts_doc:"Internal flag controlling subscription to new transactions (not exposed)."` - IsMempoolSynchronized bool `json:"isMempoolSynchronized"` - MempoolSize int `json:"mempoolSize"` - LastMempoolSync time.Time `json:"lastMempoolSync"` + BackendInfo BackendInfo `json:"-" ts_doc:"Information about the connected blockchain backend (not exposed in JSON)."` - DbColumns []InternalStateColumn `json:"dbColumns"` + // database migrations + UtxoChecked bool `json:"utxoChecked" ts_doc:"Indicates if UTXO consistency checks have been performed."` + SortedAddressContracts bool `json:"sortedAddressContracts" ts_doc:"Indicates if address/contract sorting has been completed."` - UtxoChecked bool `json:"utxoChecked"` + // golomb filter settings + BlockGolombFilterP uint8 `json:"block_golomb_filter_p" ts_doc:"Parameter P for building Golomb-Rice filters for blocks."` + BlockFilterScripts string `json:"block_filter_scripts" ts_doc:"Scripts included in block filters (e.g., 'p2pkh,p2sh')."` + BlockFilterUseZeroedKey bool `json:"block_filter_use_zeroed_key" ts_doc:"If true, uses a zeroed key for building block filters."` - BackendInfo BackendInfo `json:"-"` + // allowed number of fetched accounts over websocket + WsGetAccountInfoLimit int `json:"-" ts_doc:"Limit of how many getAccountInfo calls can be made via WS (not exposed)."` + WsLimitExceedingIPs map[string]int `json:"-" ts_doc:"Tracks IP addresses exceeding the WS limit (not exposed)."` } // StartedSync signals start of synchronization func (is *InternalState) StartedSync() { is.mux.Lock() defer is.mux.Unlock() + is.StartSync = time.Now().UTC() is.IsSynchronized = false } @@ -89,7 +119,7 @@ func (is *InternalState) FinishedSync(bestHeight uint32) { defer is.mux.Unlock() is.IsSynchronized = true is.BestHeight = bestHeight - is.LastSync = time.Now() + is.LastSync = time.Now().UTC() } // UpdateBestHeight sets new best height, without changing IsSynchronized flag @@ -97,7 +127,7 @@ func (is *InternalState) UpdateBestHeight(bestHeight uint32) { is.mux.Lock() defer is.mux.Unlock() is.BestHeight = bestHeight - is.LastSync = time.Now() + is.LastSync = time.Now().UTC() } // FinishedSyncNoChange marks end of synchronization in case no index update was necessary, it does not update lastSync time @@ -108,10 +138,10 @@ func (is *InternalState) FinishedSyncNoChange() { } // GetSyncState gets the state of synchronization -func (is *InternalState) GetSyncState() (bool, uint32, time.Time) { +func (is *InternalState) GetSyncState() (bool, uint32, time.Time, time.Time) { is.mux.Lock() defer is.mux.Unlock() - return is.IsSynchronized, is.BestHeight, is.LastSync + return is.IsSynchronized, is.BestHeight, is.LastSync, is.StartSync } // StartedMempoolSync signals start of mempool synchronization @@ -173,7 +203,7 @@ func (is *InternalState) GetDBColumnStatValues(c int) (int64, int64, int64) { func (is *InternalState) GetAllDBColumnStats() []InternalStateColumn { is.mux.Lock() defer is.mux.Unlock() - return append(is.DbColumns[:0:0], is.DbColumns...) + return slices.Clone(is.DbColumns) } // DBSizeTotal sums the computed sizes of all columns @@ -197,11 +227,45 @@ func (is *InternalState) GetBlockTime(height uint32) uint32 { return 0 } -// AppendBlockTime appends block time to BlockTimes -func (is *InternalState) AppendBlockTime(time uint32) { +// GetLastBlockTime returns time of the last block +func (is *InternalState) GetLastBlockTime() uint32 { is.mux.Lock() defer is.mux.Unlock() - is.BlockTimes = append(is.BlockTimes, time) + if len(is.BlockTimes) > 0 { + return is.BlockTimes[len(is.BlockTimes)-1] + } + return 0 +} + +// SetBlockTimes initializes BlockTimes array, returns AvgBlockPeriod +func (is *InternalState) SetBlockTimes(blockTimes []uint32) uint32 { + is.mux.Lock() + defer is.mux.Unlock() + if len(is.BlockTimes) < len(blockTimes) { + // no new block was set + is.BlockTimes = blockTimes + } else { + copy(is.BlockTimes, blockTimes) + } + is.computeAvgBlockPeriod() + glog.Info("set ", len(is.BlockTimes), " block times, average block period ", is.AvgBlockPeriod, "s") + return is.AvgBlockPeriod +} + +// SetBlockTime sets block time to BlockTimes, allocating the slice as necessary, returns AvgBlockPeriod +func (is *InternalState) SetBlockTime(height uint32, time uint32) uint32 { + is.mux.Lock() + defer is.mux.Unlock() + if int(height) >= len(is.BlockTimes) { + extend := int(height) - len(is.BlockTimes) + 1 + for i := 0; i < extend; i++ { + is.BlockTimes = append(is.BlockTimes, time) + } + } else { + is.BlockTimes[height] = time + } + is.computeAvgBlockPeriod() + return is.AvgBlockPeriod } // RemoveLastBlockTimes removes last times from BlockTimes @@ -212,6 +276,7 @@ func (is *InternalState) RemoveLastBlockTimes(count int) { count = len(is.BlockTimes) } is.BlockTimes = is.BlockTimes[:len(is.BlockTimes)-count] + is.computeAvgBlockPeriod() } // GetBlockHeightOfTime returns block height of the first block with time greater or equal to the given time or MaxUint32 if no such block @@ -235,6 +300,34 @@ func (is *InternalState) GetBlockHeightOfTime(time uint32) uint32 { return uint32(height) } +const avgBlockPeriodSample = 100 + +// Avg100BlocksPeriod returns average period of the last 100 blocks in seconds +func (is *InternalState) GetAvgBlockPeriod() uint32 { + is.mux.Lock() + defer is.mux.Unlock() + return is.AvgBlockPeriod +} + +// computeAvgBlockPeriod returns computes average of the last 100 blocks in seconds +func (is *InternalState) computeAvgBlockPeriod() { + last := len(is.BlockTimes) - 1 + first := last - avgBlockPeriodSample - 1 + if first < 0 { + return + } + is.AvgBlockPeriod = (is.BlockTimes[last] - is.BlockTimes[first]) / avgBlockPeriodSample +} + +// GetNetwork returns network. If not set returns the same value as CoinShortcut +func (is *InternalState) GetNetwork() string { + network := is.Network + if network == "" { + return is.CoinShortcut + } + return network +} + // SetBackendInfo sets new BackendInfo func (is *InternalState) SetBackendInfo(bi *BackendInfo) { is.mux.Lock() @@ -265,3 +358,25 @@ func UnpackInternalState(buf []byte) (*InternalState, error) { } return &is, nil } + +// SetInShutdown sets the internal state to in shutdown state +func SetInShutdown() { + atomic.StoreInt32(&inShutdown, 1) +} + +// IsInShutdown returns true if in application shutdown state +func IsInShutdown() bool { + return atomic.LoadInt32(&inShutdown) != 0 +} + +func (is *InternalState) AddWsLimitExceedingIP(ip string) { + is.mux.Lock() + defer is.mux.Unlock() + is.WsLimitExceedingIPs[ip] = is.WsLimitExceedingIPs[ip] + 1 +} + +func (is *InternalState) ResetWsLimitExceedingIPs() { + is.mux.Lock() + defer is.mux.Unlock() + is.WsLimitExceedingIPs = make(map[string]int) +} diff --git a/common/jsonnumber.go b/common/jsonnumber.go index d209fbe29b..d6eab76c08 100644 --- a/common/jsonnumber.go +++ b/common/jsonnumber.go @@ -6,7 +6,9 @@ import ( ) // JSONNumber is used instead of json.Number after upgrade to go 1.14 -// to handle data which can be numbers in double quotes or possibly not numbers at all +// +// to handle data which can be numbers in double quotes or possibly not numbers at all +// // see https://github.com/golang/go/issues/37308 type JSONNumber string diff --git a/common/metrics.go b/common/metrics.go index 10d1abb76f..0cb1ec4561 100644 --- a/common/metrics.go +++ b/common/metrics.go @@ -24,6 +24,8 @@ type Metrics struct { IndexDBSize prometheus.Gauge ExplorerViews *prometheus.CounterVec MempoolSize prometheus.Gauge + EstimatedFee *prometheus.GaugeVec + AvgBlockPeriod prometheus.Gauge DbColumnRows *prometheus.GaugeVec DbColumnSize *prometheus.GaugeVec BlockbookAppInfo *prometheus.GaugeVec @@ -33,6 +35,7 @@ type Metrics struct { WebsocketPendingRequests *prometheus.GaugeVec SocketIOPendingRequests *prometheus.GaugeVec XPubCacheSize prometheus.Gauge + CoingeckoRequests *prometheus.CounterVec } // Labels represents a collection of label name -> value mappings. @@ -69,7 +72,7 @@ func GetMetrics(coin string) (*Metrics, error) { prometheus.HistogramOpts{ Name: "blockbook_socketio_req_duration", Help: "Socketio request duration by method (in microseconds)", - Buckets: []float64{1, 5, 10, 25, 50, 75, 100, 250}, + Buckets: []float64{10, 100, 1_000, 10_000, 100_000, 1_000_000, 10_0000_000}, ConstLabels: Labels{"coin": coin}, }, []string{"method"}, @@ -101,7 +104,7 @@ func GetMetrics(coin string) (*Metrics, error) { prometheus.HistogramOpts{ Name: "blockbook_websocket_req_duration", Help: "Websocket request duration by method (in microseconds)", - Buckets: []float64{1, 5, 10, 25, 50, 75, 100, 250}, + Buckets: []float64{10, 100, 1_000, 10_000, 100_000, 1_000_000, 10_0000_000}, ConstLabels: Labels{"coin": coin}, }, []string{"method"}, @@ -110,7 +113,7 @@ func GetMetrics(coin string) (*Metrics, error) { prometheus.HistogramOpts{ Name: "blockbook_index_resync_duration", Help: "Duration of index resync operation (in milliseconds)", - Buckets: []float64{50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 600, 700, 1000, 2000, 5000}, + Buckets: []float64{10, 100, 500, 1000, 2000, 5000, 10000}, ConstLabels: Labels{"coin": coin}, }, ) @@ -118,7 +121,7 @@ func GetMetrics(coin string) (*Metrics, error) { prometheus.HistogramOpts{ Name: "blockbook_mempool_resync_duration", Help: "Duration of mempool resync operation (in milliseconds)", - Buckets: []float64{10, 25, 50, 75, 100, 150, 250, 500, 750, 1000, 2000, 5000}, + Buckets: []float64{10, 100, 500, 1000, 2000, 5000, 10000}, ConstLabels: Labels{"coin": coin}, }, ) @@ -169,6 +172,21 @@ func GetMetrics(coin string) (*Metrics, error) { ConstLabels: Labels{"coin": coin}, }, ) + metrics.EstimatedFee = prometheus.NewGaugeVec( + prometheus.GaugeOpts{ + Name: "blockbook_estimated_fee", + Help: "Estimated fee per byte (gas) for number of blocks", + ConstLabels: Labels{"coin": coin}, + }, + []string{"blocks", "conservative"}, + ) + metrics.AvgBlockPeriod = prometheus.NewGauge( + prometheus.GaugeOpts{ + Name: "blockbook_avg_block_period", + Help: "Average period of mining of last 100 blocks in seconds", + ConstLabels: Labels{"coin": coin}, + }, + ) metrics.DbColumnRows = prometheus.NewGaugeVec( prometheus.GaugeOpts{ Name: "blockbook_dbcolumn_rows", @@ -209,7 +227,7 @@ func GetMetrics(coin string) (*Metrics, error) { ) metrics.ExplorerPendingRequests = prometheus.NewGaugeVec( prometheus.GaugeOpts{ - Name: "blockbook_explorer_pending_reqests", + Name: "blockbook_explorer_pending_requests", Help: "Number of unfinished requests in explorer interface", ConstLabels: Labels{"coin": coin}, }, @@ -217,7 +235,7 @@ func GetMetrics(coin string) (*Metrics, error) { ) metrics.WebsocketPendingRequests = prometheus.NewGaugeVec( prometheus.GaugeOpts{ - Name: "blockbook_websocket_pending_reqests", + Name: "blockbook_websocket_pending_requests", Help: "Number of unfinished requests in websocket interface", ConstLabels: Labels{"coin": coin}, }, @@ -225,7 +243,7 @@ func GetMetrics(coin string) (*Metrics, error) { ) metrics.SocketIOPendingRequests = prometheus.NewGaugeVec( prometheus.GaugeOpts{ - Name: "blockbook_socketio_pending_reqests", + Name: "blockbook_socketio_pending_requests", Help: "Number of unfinished requests in socketio interface", ConstLabels: Labels{"coin": coin}, }, @@ -238,6 +256,14 @@ func GetMetrics(coin string) (*Metrics, error) { ConstLabels: Labels{"coin": coin}, }, ) + metrics.CoingeckoRequests = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "blockbook_coingecko_requests", + Help: "Total number of requests to coingecko", + ConstLabels: Labels{"coin": coin}, + }, + []string{"endpoint", "status"}, + ) v := reflect.ValueOf(metrics) for i := 0; i < v.NumField(); i++ { diff --git a/common/utils.go b/common/utils.go new file mode 100644 index 0000000000..4dee4686e0 --- /dev/null +++ b/common/utils.go @@ -0,0 +1,108 @@ +package common + +import ( + "encoding/json" + "io" + "math" + "runtime/debug" + "time" + + "github.com/golang/glog" + "github.com/juju/errors" +) + +// TickAndDebounce calls function f on trigger channel or with tickTime period (whatever is sooner) with debounce +func TickAndDebounce(tickTime time.Duration, debounceTime time.Duration, trigger chan struct{}, f func()) { + timer := time.NewTimer(tickTime) + var firstDebounce time.Time +Loop: + for { + select { + case _, ok := <-trigger: + if !timer.Stop() { + <-timer.C + } + // exit loop on closed input channel + if !ok { + break Loop + } + if firstDebounce.IsZero() { + firstDebounce = time.Now() + } + // debounce for up to debounceTime period + // afterwards execute immediately + if firstDebounce.Add(debounceTime).After(time.Now()) { + timer.Reset(debounceTime) + } else { + timer.Reset(0) + } + case <-timer.C: + // do the action, if not in shutdown, then start the loop again + if !IsInShutdown() { + f() + } + timer.Reset(tickTime) + firstDebounce = time.Time{} + } + } +} + +// SafeDecodeResponseFromReader reads from io.ReadCloser safely, with recovery from panic +func SafeDecodeResponseFromReader(body io.ReadCloser, res interface{}) (err error) { + var data []byte + defer func() { + if r := recover(); r != nil { + glog.Error("unmarshal json recovered from panic: ", r, "; data: ", string(data)) + debug.PrintStack() + if len(data) > 0 && len(data) < 2048 { + err = errors.Errorf("Error: %v", string(data)) + } else { + err = errors.New("Internal error") + } + } + }() + data, err = io.ReadAll(body) + if err != nil { + return err + } + return json.Unmarshal(data, &res) +} + +// RoundToSignificantDigits rounds a float64 number `n` to the specified number of significant figures `digits`. +// For example, RoundToSignificantDigits(1234, 3) returns 1230 +// +// This function works by shifting the number's decimal point to make the desired significant figures +// into whole numbers, rounding, and then shifting back. +// +// Example for n = 1234, digits = 3: +// +// log10(1234) ≈ 3.09 → ceil = 4 +// power = 3 - 4 = -1 +// magnitude = 10^-1 = 0.1 +// n * magnitude = 1234 * 0.1 = 123.4 +// round(123.4) = 123 +// 123 / 0.1 = 1230 +// +// Returns the number rounded to the desired number of significant figures. +func RoundToSignificantDigits(n float64, digits int) float64 { + if n == 0 { + return 0 + } + + // Step 1: Compute how many digits are before the decimal point. + // For 1234 → log10(1234) ≈ 3.09 → ceil = 4 + d := math.Ceil(math.Log10(math.Abs(n))) + + // Step 2: Calculate how much we need to shift the number to bring + // the significant digits into the integer part. + // For digits=3 and d=4 → power = -1 + power := digits - int(d) + + // Step 3: Compute 10^power to scale the number + // 10^-1 = 0.1 + magnitude := math.Pow(10, float64(power)) + + // Step 4: Scale, round, and scale back + // 1234 * 0.1 = 123.4 → round = 123 → 123 / 0.1 = 1230 + return math.Round(n*magnitude) / magnitude +} diff --git a/common/utils_test.go b/common/utils_test.go new file mode 100644 index 0000000000..6076742030 --- /dev/null +++ b/common/utils_test.go @@ -0,0 +1,44 @@ +//go:build unittest + +package common + +import ( + "math" + "strconv" + "testing" +) + +func Test_RoundToSignificantDigits(t *testing.T) { + type testCase struct { + input float64 + digits int + want float64 + } + + tests := []testCase{ + {input: 1234.5678, digits: 3, want: 1230}, + {input: 1234.5678, digits: 4, want: 1235}, + {input: 1234.5678, digits: 5, want: 1234.6}, + {input: 0.0123456, digits: 3, want: 0.0123}, + {input: 98765.4321, digits: 3, want: 98800}, + {input: 1.99999, digits: 3, want: 2.00}, + {input: 999.999, digits: 3, want: 1000}, + {input: 0.0006789, digits: 3, want: 0.000679}, + {input: 5.123456, digits: 3, want: 5.12}, + {input: 4.456789, digits: 3, want: 4.46}, + {input: 3.789012, digits: 3, want: 3.79}, + {input: 2.012345, digits: 3, want: 2.01}, + } + + for _, tt := range tests { + t.Run(strconv.FormatFloat(tt.input, 'f', -1, 64), func(t *testing.T) { + got := RoundToSignificantDigits(tt.input, tt.digits) + + // Use relative epsilon for float comparison + epsilon := 1e-9 + if math.Abs(got-tt.want) > epsilon { + t.Errorf("RoundToSignificantDigits(%v, %d) = %v, want %v", tt.input, tt.digits, got, tt.want) + } + }) + } +} diff --git a/configs/coins/arbitrum.json b/configs/coins/arbitrum.json new file mode 100644 index 0000000000..26cf935100 --- /dev/null +++ b/configs/coins/arbitrum.json @@ -0,0 +1,66 @@ +{ + "coin": { + "name": "Arbitrum", + "shortcut": "ETH", + "network": "ARB", + "label": "Arbitrum", + "alias": "arbitrum" + }, + "ports": { + "backend_rpc": 8205, + "backend_p2p": 38405, + "backend_http": 8305, + "blockbook_internal": 9205, + "blockbook_public": 9305 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-arbitrum", + "package_revision": "satoshilabs-1", + "system_user": "arbitrum", + "version": "3.2.1", + "docker_image": "offchainlabs/nitro-node:v3.2.1-d81324d", + "verification_type": "docker", + "verification_source": "724ebdcca39cd0c28ffd025ecea8d1622a376f41344201b729afb60352cbc306", + "extract_command": "docker cp extract:/home/user/target backend/target; docker cp extract:/home/user/nitro-legacy backend/nitro-legacy; docker cp extract:/usr/local/bin/nitro backend/nitro", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/arbitrum_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "arbitrum.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-arbitrum", + "system_user": "blockbook-arbitrum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"arbitrum-one\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/arbitrum_archive.json b/configs/coins/arbitrum_archive.json new file mode 100644 index 0000000000..09d0a5af9d --- /dev/null +++ b/configs/coins/arbitrum_archive.json @@ -0,0 +1,71 @@ +{ + "coin": { + "name": "Arbitrum Archive", + "shortcut": "ETH", + "network": "ARB", + "label": "Arbitrum", + "alias": "arbitrum_archive" + }, + "ports": { + "backend_rpc": 8306, + "backend_p2p": 38406, + "blockbook_internal": 9206, + "blockbook_public": 9306 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-arbitrum-archive", + "package_revision": "satoshilabs-1", + "system_user": "arbitrum", + "version": "3.2.1", + "docker_image": "offchainlabs/nitro-node:v3.2.1-d81324d", + "verification_type": "docker", + "verification_source": "724ebdcca39cd0c28ffd025ecea8d1622a376f41344201b729afb60352cbc306", + "extract_command": "docker cp extract:/home/user/target backend/target; docker cp extract:/home/user/nitro-legacy backend/nitro-legacy; docker cp extract:/usr/local/bin/nitro backend/nitro", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/arbitrum_archive_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "arbitrum_archive.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-arbitrum-archive", + "system_user": "blockbook-arbitrum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "eip1559Fees": true, + "alternative_estimate_fee": "infura", + "alternative_estimate_fee_params": "{\"url\": \"https://gas.api.infura.io/v3/${api_key}/networks/42161/suggestedGasFees\", \"periodSeconds\": 16}", + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"arbitrum-one\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/arbitrum_nova.json b/configs/coins/arbitrum_nova.json new file mode 100644 index 0000000000..55d20d7d13 --- /dev/null +++ b/configs/coins/arbitrum_nova.json @@ -0,0 +1,65 @@ +{ + "coin": { + "name": "Arbitrum Nova", + "shortcut": "ETH", + "label": "Arbitrum Nova", + "alias": "arbitrum_nova" + }, + "ports": { + "backend_rpc": 8207, + "backend_p2p": 38407, + "backend_http": 8307, + "blockbook_internal": 9207, + "blockbook_public": 9307 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-arbitrum-nova", + "package_revision": "satoshilabs-1", + "system_user": "arbitrum", + "version": "3.2.1", + "docker_image": "offchainlabs/nitro-node:v3.2.1-d81324d", + "verification_type": "docker", + "verification_source": "724ebdcca39cd0c28ffd025ecea8d1622a376f41344201b729afb60352cbc306", + "extract_command": "docker cp extract:/home/user/target backend/target; docker cp extract:/home/user/nitro-legacy backend/nitro-legacy; docker cp extract:/usr/local/bin/nitro backend/nitro", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/arbitrum_nova_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "arbitrum_nova.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-arbitrum-nova", + "system_user": "blockbook-arbitrum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/arbitrum_nova_archive.json b/configs/coins/arbitrum_nova_archive.json new file mode 100644 index 0000000000..d0833e4536 --- /dev/null +++ b/configs/coins/arbitrum_nova_archive.json @@ -0,0 +1,67 @@ +{ + "coin": { + "name": "Arbitrum Nova Archive", + "shortcut": "ETH", + "label": "Arbitrum Nova", + "alias": "arbitrum_nova_archive" + }, + "ports": { + "backend_rpc": 8308, + "backend_p2p": 38408, + "blockbook_internal": 9208, + "blockbook_public": 9308 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-arbitrum-nova-archive", + "package_revision": "satoshilabs-1", + "system_user": "arbitrum", + "version": "3.2.1", + "docker_image": "offchainlabs/nitro-node:v3.2.1-d81324d", + "verification_type": "docker", + "verification_source": "724ebdcca39cd0c28ffd025ecea8d1622a376f41344201b729afb60352cbc306", + "extract_command": "docker cp extract:/home/user/target backend/target; docker cp extract:/home/user/nitro-legacy backend/nitro-legacy; docker cp extract:/usr/local/bin/nitro backend/nitro", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/arbitrum_nova_archive_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "arbitrum_nova_archive.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-arbitrum-nova-archive", + "system_user": "blockbook-arbitrum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/avalanche.json b/configs/coins/avalanche.json new file mode 100644 index 0000000000..7a1c8b723d --- /dev/null +++ b/configs/coins/avalanche.json @@ -0,0 +1,69 @@ +{ + "coin": { + "name": "Avalanche", + "shortcut": "AVAX", + "label": "Avalanche", + "alias": "avalanche" + }, + "ports": { + "backend_rpc": 8098, + "backend_p2p": 38398, + "blockbook_internal": 9098, + "blockbook_public": 9198 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}/ext/bc/C/ws", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-avalanche", + "package_revision": "satoshilabs-1", + "system_user": "avalanche", + "version": "1.13.2", + "binary_url": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-amd64-v1.13.2.tar.gz", + "verification_type": "gpg", + "verification_source": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-amd64-v1.13.2.tar.gz.sig", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": [], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/avalanchego --data-dir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log-dir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --http-port {{.Ports.BackendRPC}} --staking-port {{.Ports.BackendP2P}} --public-ip 127.0.0.1 --staking-ephemeral-cert-enabled --chain-config-content ewogICJDIjp7CiAgICAiY29uZmlnIjoiZXdvZ0lDSmxkR2d0WVhCcGN5STZXd29nSUNBZ0ltVjBhQ0lzQ2lBZ0lDQWlaWFJvTFdacGJIUmxjaUlzQ2lBZ0lDQWlibVYwSWl3S0lDQWdJQ0prWldKMVp5MTBjbUZqWlhJaUxBb2dJQ0FnSW5kbFlqTWlMQW9nSUNBZ0ltbHVkR1Z5Ym1Gc0xXVjBhQ0lzQ2lBZ0lDQWlhVzUwWlhKdVlXd3RZbXh2WTJ0amFHRnBiaUlzQ2lBZ0lDQWlhVzUwWlhKdVlXd3RkSEpoYm5OaFkzUnBiMjRpTEFvZ0lDQWdJbWx1ZEdWeWJtRnNMWFI0TFhCdmIyd2lMQW9nSUNBZ0ltbHVkR1Z5Ym1Gc0xXUmxZblZuSWdvZ0lGMHNDaUFnSW5OMFlYUmxMWE41Ym1NdFpXNWhZbXhsWkNJNklHWmhiSE5sQ24wPSIKICB9Cn0=", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-arm64-v1.13.2.tar.gz", + "verification_source": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-arm64-v1.13.2.tar.gz.sig" + } + } + }, + "blockbook": { + "package_name": "blockbook-avalanche", + "system_user": "blockbook-avalanche", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"avalanche-2\",\"platformIdentifier\": \"avalanche\",\"platformVsCurrency\": \"usd\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/avalanche_archive.json b/configs/coins/avalanche_archive.json new file mode 100644 index 0000000000..7f7b7c5b67 --- /dev/null +++ b/configs/coins/avalanche_archive.json @@ -0,0 +1,72 @@ +{ + "coin": { + "name": "Avalanche Archive", + "shortcut": "AVAX", + "label": "Avalanche", + "alias": "avalanche_archive" + }, + "ports": { + "backend_rpc": 8099, + "backend_p2p": 38399, + "blockbook_internal": 9099, + "blockbook_public": 9199 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}/ext/bc/C/ws", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-avalanche-archive", + "package_revision": "satoshilabs-1", + "system_user": "avalanche", + "version": "1.13.2", + "binary_url": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-amd64-v1.13.2.tar.gz", + "verification_type": "gpg", + "verification_source": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-amd64-v1.13.2.tar.gz.sig", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": [], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/avalanchego --data-dir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log-dir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --http-port {{.Ports.BackendRPC}} --staking-port {{.Ports.BackendP2P}} --public-ip 127.0.0.1 --staking-ephemeral-cert-enabled --chain-config-content ewogICJDIjp7CiAgICAiY29uZmlnIjoiZXdvZ0lDSmxkR2d0WVhCcGN5STZXd29nSUNBZ0ltVjBhQ0lzQ2lBZ0lDQWlaWFJvTFdacGJIUmxjaUlzQ2lBZ0lDQWlibVYwSWl3S0lDQWdJQ0prWldKMVp5MTBjbUZqWlhJaUxBb2dJQ0FnSW5kbFlqTWlMQW9nSUNBZ0ltbHVkR1Z5Ym1Gc0xXVjBhQ0lzQ2lBZ0lDQWlhVzUwWlhKdVlXd3RZbXh2WTJ0amFHRnBiaUlzQ2lBZ0lDQWlhVzUwWlhKdVlXd3RkSEpoYm5OaFkzUnBiMjRpTEFvZ0lDQWdJbWx1ZEdWeWJtRnNMWFI0TFhCdmIyd2lMQW9nSUNBZ0ltbHVkR1Z5Ym1Gc0xXUmxZblZuSWdvZ0lGMHNDaUFnSW5CeWRXNXBibWN0Wlc1aFlteGxaQ0k2Wm1Gc2MyVXNDaUFnSW5OMFlYUmxMWE41Ym1NdFpXNWhZbXhsWkNJNklHWmhiSE5sQ24wPSIKICB9Cn0=", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-arm64-v1.13.2.tar.gz", + "verification_source": "https://github.com/ava-labs/avalanchego/releases/download/v1.13.2/avalanchego-linux-arm64-v1.13.2.tar.gz.sig" + } + } + }, + "blockbook": { + "package_name": "blockbook-avalanche-archive", + "system_user": "blockbook-avalanche", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"avalanche-2\",\"platformIdentifier\": \"avalanche\",\"platformVsCurrency\": \"usd\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/base.json b/configs/coins/base.json new file mode 100644 index 0000000000..83578785be --- /dev/null +++ b/configs/coins/base.json @@ -0,0 +1,67 @@ +{ + "coin": { + "name": "Base", + "shortcut": "ETH", + "network": "BASE", + "label": "Base", + "alias": "base" + }, + "ports": { + "backend_rpc": 8309, + "backend_p2p": 38409, + "backend_http": 8209, + "backend_authrpc": 8409, + "blockbook_internal": 9209, + "blockbook_public": 9309 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-base", + "package_revision": "satoshilabs-1", + "system_user": "base", + "version": "1.101411.3", + "docker_image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.3", + "verification_type": "docker", + "verification_source": "aefecdb139d8e3ed3128e7e3c87abb71198dc6a44ef21f012f391af52679e2c5", + "extract_command": "docker cp extract:/usr/local/bin/geth backend/geth", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/base_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "base.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-base", + "system_user": "blockbook-base", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"base\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/base_archive.json b/configs/coins/base_archive.json new file mode 100644 index 0000000000..57a1805754 --- /dev/null +++ b/configs/coins/base_archive.json @@ -0,0 +1,73 @@ +{ + "coin": { + "name": "Base Archive", + "shortcut": "ETH", + "network": "BASE", + "label": "Base", + "alias": "base_archive" + }, + "ports": { + "backend_rpc": 8211, + "backend_p2p": 38411, + "backend_http": 8311, + "backend_authrpc": 8411, + "blockbook_internal": 9211, + "blockbook_public": 9311 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-base-archive", + "package_revision": "satoshilabs-1", + "system_user": "base", + "version": "1.101411.3", + "docker_image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101411.3", + "verification_type": "docker", + "verification_source": "aefecdb139d8e3ed3128e7e3c87abb71198dc6a44ef21f012f391af52679e2c5", + "extract_command": "docker cp extract:/usr/local/bin/geth backend/geth", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/base_archive_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "base_archive.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-base-archive", + "system_user": "blockbook-base", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "eip1559Fees": true, + "alternative_estimate_fee": "infura", + "alternative_estimate_fee_params": "{\"url\": \"https://gas.api.infura.io/v3/${api_key}/networks/8453/suggestedGasFees\", \"periodSeconds\": 8}", + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"base\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/base_archive_op_node.json b/configs/coins/base_archive_op_node.json new file mode 100644 index 0000000000..85a4c5dbe1 --- /dev/null +++ b/configs/coins/base_archive_op_node.json @@ -0,0 +1,38 @@ +{ + "coin": { + "name": "Base Archive Op-Node", + "shortcut": "ETH", + "label": "Base", + "alias": "base_archive_op_node" + }, + "ports": { + "backend_rpc": 8212, + "blockbook_internal": 9212, + "blockbook_public": 9312 + }, + "backend": { + "package_name": "backend-base-archive-op-node", + "package_revision": "satoshilabs-1", + "system_user": "base", + "version": "1.10.1", + "docker_image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.10.1", + "verification_type": "docker", + "verification_source": "8f40714868fbdc788f67251383a0c0b78a3a937f07b2303bc7d33df5df6297d9", + "extract_command": "docker cp extract:/usr/local/bin/op-node backend/op-node", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/base_archive_op_node_exec.sh 2>&1 >> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "base_archive_op_node.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/base_op_node.json b/configs/coins/base_op_node.json new file mode 100644 index 0000000000..426d718069 --- /dev/null +++ b/configs/coins/base_op_node.json @@ -0,0 +1,38 @@ +{ + "coin": { + "name": "Base Op-Node", + "shortcut": "ETH", + "label": "Base", + "alias": "base_op_node" + }, + "ports": { + "backend_rpc": 8210, + "blockbook_internal": 9210, + "blockbook_public": 9310 + }, + "backend": { + "package_name": "backend-base-op-node", + "package_revision": "satoshilabs-1", + "system_user": "base", + "version": "1.10.1", + "docker_image": "us-docker.pkg.dev/oplabs-tools-artifacts/images/op-node:v1.10.1", + "verification_type": "docker", + "verification_source": "8f40714868fbdc788f67251383a0c0b78a3a937f07b2303bc7d33df5df6297d9", + "extract_command": "docker cp extract:/usr/local/bin/op-node backend/op-node", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/base_op_node_exec.sh 2>&1 >> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "base_op_node.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/bcash.json b/configs/coins/bcash.json index 3994a47954..1a6a4e5d4b 100644 --- a/configs/coins/bcash.json +++ b/configs/coins/bcash.json @@ -1,69 +1,68 @@ { - "coin": { - "name": "Bcash", - "shortcut": "BCH", - "label": "Bitcoin Cash", - "alias": "bcash" - }, - "ports": { - "backend_rpc": 8031, - "backend_message_queue": 38331, - "blockbook_internal": 9031, - "blockbook_public": 9131 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bcash", - "package_revision": "satoshilabs-1", - "system_user": "bcash", - "version": "24.1.0", - "binary_url": "https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v24.1.0/bitcoin-cash-node-24.1.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "857b6b95c54d84756fdd86893cd238a9b100c471a0b235aca4246cca74112ca9", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bcash.conf", - "client_config_file": "bitcoin_like_client.conf" - }, - "blockbook": { - "package_name": "blockbook-bcash", - "system_user": "blockbook-bcash", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "subversion": "/Bitcoin ABC Cash Node:22.1.0/", - "address_format": "cashaddr", - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "slip44": 145, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-cash\", \"periodSeconds\": 60}" - } + "coin": { + "name": "Bcash", + "shortcut": "BCH", + "label": "Bitcoin Cash", + "alias": "bcash" + }, + "ports": { + "backend_rpc": 8031, + "backend_message_queue": 38331, + "blockbook_internal": 9031, + "blockbook_public": 9131 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bcash", + "package_revision": "satoshilabs-1", + "system_user": "bcash", + "version": "28.0.1", + "binary_url": "https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v28.0.1/bitcoin-cash-node-28.0.1-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "d69ee632147f886ca540cecdff5b1b85512612b4c005e86b09083a63c35b64fa", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bcash.conf", + "client_config_file": "bitcoin_like_client.conf" + }, + "blockbook": { + "package_name": "blockbook-bcash", + "system_user": "blockbook-bcash", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "subversion": "/Bitcoin ABC Cash Node:22.1.0/", + "address_format": "cashaddr", + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "slip44": 145, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"bitcoin-cash\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/bcash_testnet.json b/configs/coins/bcash_testnet.json index dd50644ca7..fb98530cee 100644 --- a/configs/coins/bcash_testnet.json +++ b/configs/coins/bcash_testnet.json @@ -1,66 +1,64 @@ { - "coin": { - "name": "Bcash Testnet", - "shortcut": "TBCH", - "label": "Bitcoin Cash Testnet", - "alias": "bcash_testnet" - }, - "ports": { - "backend_rpc": 18031, - "backend_message_queue": 48331, - "blockbook_internal": 19031, - "blockbook_public": 19131 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bcash-testnet", - "package_revision": "satoshilabs-1", - "system_user": "bcash", - "version": "24.1.0", - "binary_url": "https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v24.1.0/bitcoin-cash-node-24.1.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "857b6b95c54d84756fdd86893cd238a9b100c471a0b235aca4246cca74112ca9", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_client.conf" - }, - "blockbook": { - "package_name": "blockbook-bcash-testnet", - "system_user": "blockbook-bcash", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "subversion": "/Bitcoin ABC Cash Node:22.1.0/", - "address_format": "cashaddr", - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "slip44": 1, - "additional_params": {} + "coin": { + "name": "Bcash Testnet", + "shortcut": "TBCH", + "label": "Bitcoin Cash Testnet", + "alias": "bcash_testnet" + }, + "ports": { + "backend_rpc": 18031, + "backend_message_queue": 48331, + "blockbook_internal": 19031, + "blockbook_public": 19131 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bcash-testnet", + "package_revision": "satoshilabs-1", + "system_user": "bcash", + "version": "28.0.1", + "binary_url": "https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v28.0.1/bitcoin-cash-node-28.0.1-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "d69ee632147f886ca540cecdff5b1b85512612b4c005e86b09083a63c35b64fa", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bcash.conf", + "client_config_file": "bitcoin_client.conf" + }, + "blockbook": { + "package_name": "blockbook-bcash-testnet", + "system_user": "blockbook-bcash", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "subversion": "/Bitcoin ABC Cash Node:22.1.0/", + "address_format": "cashaddr", + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "slip44": 1, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/bgold.json b/configs/coins/bgold.json index 13a445c19f..733ff874c2 100644 --- a/configs/coins/bgold.json +++ b/configs/coins/bgold.json @@ -1,265 +1,264 @@ { - "coin": { - "name": "Bgold", - "shortcut": "BTG", - "label": "Bitcoin Gold", - "alias": "bgold" - }, - "ports": { - "backend_rpc": 8035, - "backend_message_queue": 38335, - "blockbook_internal": 9035, - "blockbook_public": 9135 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bgold", - "package_revision": "satoshilabs-1", - "system_user": "bgold", - "version": "0.17.3", - "binary_url": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/bitcoin-gold-0.17.3-x86_64-linux-gnu.tar.gz", - "verification_type": "gpg-sha256", - "verification_source": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/SHA256SUMS.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bgoldd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "addnode": [ - "188.126.0.134", - "45.56.84.44", - "109.201.133.93:8338", - "178.63.11.246:8338", - "188.120.223.153:8338", - "79.137.64.158:8338", - "78.193.221.106:8338", - "139.59.151.13:8338", - "76.16.12.81:8338", - "172.104.157.62:8338", - "43.207.67.209:8338", - "178.63.11.246:8338", - "79.137.64.158:8338", - "78.193.221.106:8338", - "139.59.151.13:8338", - "172.104.157.62:8338", - "178.158.247.119:8338", - "109.201.133.93:8338", - "178.63.11.246:8338", - "139.59.151.13:8338", - "172.104.157.62:8338", - "188.120.223.153:8338", - "178.158.247.119:8338", - "78.193.221.106:8338", - "79.137.64.158:8338", - "76.16.12.81:8338", - "176.12.32.153:8338", - "178.158.247.122:8338", - "81.37.147.185:8338", - "176.12.32.153:8338", - "79.137.64.158:8338", - "178.158.247.122:8338", - "66.70.247.151:8338", - "89.18.27.165:8338", - "178.63.11.246:8338", - "91.222.17.86:8338", - "37.59.50.143:8338", - "91.50.219.221:8338", - "154.16.63.17:8338", - "213.136.76.42:8338", - "176.99.4.140:8338", - "176.9.48.36:8338", - "78.193.221.106:8338", - "34.236.228.99:8338", - "213.154.230.107:8338", - "111.231.66.252:8338", - "188.120.223.153:8338", - "219.89.122.82:8338", - "109.192.23.101:8338", - "98.114.91.222:8338", - "217.66.156.41:8338", - "172.104.157.62:8338", - "114.44.222.73:8338", - "91.224.140.216:8338", - "149.154.71.96:8338", - "107.181.183.242:8338", - "36.78.96.92:8338", - "46.22.7.74:8338", - "89.110.53.186:8338", - "73.243.220.85:8338", - "109.86.137.8:8338", - "77.78.12.89:8338", - "87.92.116.26:8338", - "93.78.122.48:8338", - "35.195.83.0:8338", - "46.147.75.220:8338", - "212.47.236.104:8338", - "95.220.100.230:8338", - "178.70.142.247:8338", - "45.76.136.149:8338", - "94.155.74.206:8338", - "178.70.142.247:8338", - "128.199.228.97:8338", - "77.171.144.207:8338", - "159.89.192.119:8338", - "136.63.238.170:8338", - "31.27.193.105:8338", - "176.107.192.240:8338", - "94.140.241.96:8338", - "66.108.15.5:8338", - "81.177.127.204:8338", - "88.18.69.174:8338", - "178.70.130.94:8338", - "78.98.162.140:8338", - "95.133.156.224:8338", - "46.188.16.96:8338", - "94.247.16.21:8338", - "eunode.pool.gold:8338", - "asianode.pool.gold:8338", - "45.56.84.44:8338", - "176.9.48.36:8338", - "93.57.253.121:8338", - "172.104.157.62:8338", - "176.12.32.153:8338", - "pool.serverpower.net:8338", - "213.154.229.126:8338", - "213.154.230.106:8338", - "213.154.230.107:8338", - "213.154.229.50:8338", - "145.239.0.50:8338", - "107.181.183.242:8338", - "109.201.133.93:8338", - "120.41.190.109:8338", - "120.41.191.224:8338", - "138.68.249.79:8338", - "13.95.223.202:8338", - "145.239.0.50:8338", - "149.56.95.26:8338", - "158.69.103.228:8338", - "159.89.192.119:8338", - "164.132.207.143:8338", - "171.100.141.106:8338", - "172.104.157.62:8338", - "173.176.95.92:8338", - "176.12.32.153:8338", - "178.239.54.250:8338", - "178.63.11.246:8338", - "185.139.2.140:8338", - "188.120.223.153:8338", - "190.46.2.92:8338", - "192.99.194.113:8338", - "199.229.248.218:8338", - "213.154.229.126:8338", - "213.154.229.50:8338", - "213.154.230.106:8338", - "213.154.230.107:8338", - "217.182.199.21", - "35.189.127.200:8338", - "35.195.83.0:8338", - "35.197.197.166:8338", - "35.200.168.155:8338", - "35.203.167.11:8338", - "37.59.50.143:8338", - "45.27.161.195:8338", - "45.32.234.160:8338", - "45.56.84.44:8338", - "46.188.16.96:8338", - "46.251.19.171:8338", - "5.157.119.109:8338", - "52.28.162.48:8338", - "54.153.140.202:8338", - "54.68.81.2:83388338", - "62.195.190.190:8338", - "62.216.5.136:8338", - "65.110.125.175:8338", - "67.68.226.130:8338", - "73.243.220.85:8338", - "77.78.12.89:8338", - "78.193.221.106:8338", - "78.98.162.140:8338", - "79.137.64.158:8338", - "84.144.177.238:8338", - "87.92.116.26:8338", - "89.115.139.117:8338", - "89.18.27.165:8338", - "91.50.219.221:8338", - "93.88.74.26", - "93.88.74.26:8338", - "94.155.74.206:8338", - "95.154.201.132:8338", - "98.29.248.131:8338", - "u2.my.to:8338", - "[2001:470:b:ce:dc70:83ff:fe7a:1e74]:8338", - "2001:7b8:61d:1:250:56ff:fe90:c89f:8338", - "2001:7b8:63a:1002:213:154:230:106:8338", - "2001:7b8:63a:1002:213:154:230:107:8338", - "45.56.84.44", - "109.201.133.93:8338", - "120.41.191.224:30607", - "138.68.249.79:50992", - "138.68.249.79:51314", - "172.104.157.62", - "178.63.11.246:8338", - "185.139.2.140:8338", - "199.229.248.218:28830", - "35.189.127.200:41220", - "35.189.127.200:48244", - "35.195.83.0:35172", - "35.195.83.0:35576", - "35.195.83.0:35798", - "35.197.197.166:32794", - "35.197.197.166:33112", - "35.197.197.166:33332", - "35.203.167.11:52158", - "37.59.50.143:35254", - "45.27.161.195:33852", - "45.27.161.195:36738", - "45.27.161.195:58628" - ], - "maxconnections": 250, - "mempoolexpiry": 72, - "timeout": 768 + "coin": { + "name": "Bgold", + "shortcut": "BTG", + "label": "Bitcoin Gold", + "alias": "bgold" + }, + "ports": { + "backend_rpc": 8035, + "backend_message_queue": 38335, + "blockbook_internal": 9035, + "blockbook_public": 9135 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bgold", + "package_revision": "satoshilabs-1", + "system_user": "bgold", + "version": "0.17.3", + "binary_url": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/bitcoin-gold-0.17.3-x86_64-linux-gnu.tar.gz", + "verification_type": "gpg-sha256", + "verification_source": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/SHA256SUMS.asc", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bgoldd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "addnode": [ + "188.126.0.134", + "45.56.84.44", + "109.201.133.93:8338", + "178.63.11.246:8338", + "188.120.223.153:8338", + "79.137.64.158:8338", + "78.193.221.106:8338", + "139.59.151.13:8338", + "76.16.12.81:8338", + "172.104.157.62:8338", + "43.207.67.209:8338", + "178.63.11.246:8338", + "79.137.64.158:8338", + "78.193.221.106:8338", + "139.59.151.13:8338", + "172.104.157.62:8338", + "178.158.247.119:8338", + "109.201.133.93:8338", + "178.63.11.246:8338", + "139.59.151.13:8338", + "172.104.157.62:8338", + "188.120.223.153:8338", + "178.158.247.119:8338", + "78.193.221.106:8338", + "79.137.64.158:8338", + "76.16.12.81:8338", + "176.12.32.153:8338", + "178.158.247.122:8338", + "81.37.147.185:8338", + "176.12.32.153:8338", + "79.137.64.158:8338", + "178.158.247.122:8338", + "66.70.247.151:8338", + "89.18.27.165:8338", + "178.63.11.246:8338", + "91.222.17.86:8338", + "37.59.50.143:8338", + "91.50.219.221:8338", + "154.16.63.17:8338", + "213.136.76.42:8338", + "176.99.4.140:8338", + "176.9.48.36:8338", + "78.193.221.106:8338", + "34.236.228.99:8338", + "213.154.230.107:8338", + "111.231.66.252:8338", + "188.120.223.153:8338", + "219.89.122.82:8338", + "109.192.23.101:8338", + "98.114.91.222:8338", + "217.66.156.41:8338", + "172.104.157.62:8338", + "114.44.222.73:8338", + "91.224.140.216:8338", + "149.154.71.96:8338", + "107.181.183.242:8338", + "36.78.96.92:8338", + "46.22.7.74:8338", + "89.110.53.186:8338", + "73.243.220.85:8338", + "109.86.137.8:8338", + "77.78.12.89:8338", + "87.92.116.26:8338", + "93.78.122.48:8338", + "35.195.83.0:8338", + "46.147.75.220:8338", + "212.47.236.104:8338", + "95.220.100.230:8338", + "178.70.142.247:8338", + "45.76.136.149:8338", + "94.155.74.206:8338", + "178.70.142.247:8338", + "128.199.228.97:8338", + "77.171.144.207:8338", + "159.89.192.119:8338", + "136.63.238.170:8338", + "31.27.193.105:8338", + "176.107.192.240:8338", + "94.140.241.96:8338", + "66.108.15.5:8338", + "81.177.127.204:8338", + "88.18.69.174:8338", + "178.70.130.94:8338", + "78.98.162.140:8338", + "95.133.156.224:8338", + "46.188.16.96:8338", + "94.247.16.21:8338", + "eunode.pool.gold:8338", + "asianode.pool.gold:8338", + "45.56.84.44:8338", + "176.9.48.36:8338", + "93.57.253.121:8338", + "172.104.157.62:8338", + "176.12.32.153:8338", + "pool.serverpower.net:8338", + "213.154.229.126:8338", + "213.154.230.106:8338", + "213.154.230.107:8338", + "213.154.229.50:8338", + "145.239.0.50:8338", + "107.181.183.242:8338", + "109.201.133.93:8338", + "120.41.190.109:8338", + "120.41.191.224:8338", + "138.68.249.79:8338", + "13.95.223.202:8338", + "145.239.0.50:8338", + "149.56.95.26:8338", + "158.69.103.228:8338", + "159.89.192.119:8338", + "164.132.207.143:8338", + "171.100.141.106:8338", + "172.104.157.62:8338", + "173.176.95.92:8338", + "176.12.32.153:8338", + "178.239.54.250:8338", + "178.63.11.246:8338", + "185.139.2.140:8338", + "188.120.223.153:8338", + "190.46.2.92:8338", + "192.99.194.113:8338", + "199.229.248.218:8338", + "213.154.229.126:8338", + "213.154.229.50:8338", + "213.154.230.106:8338", + "213.154.230.107:8338", + "217.182.199.21", + "35.189.127.200:8338", + "35.195.83.0:8338", + "35.197.197.166:8338", + "35.200.168.155:8338", + "35.203.167.11:8338", + "37.59.50.143:8338", + "45.27.161.195:8338", + "45.32.234.160:8338", + "45.56.84.44:8338", + "46.188.16.96:8338", + "46.251.19.171:8338", + "5.157.119.109:8338", + "52.28.162.48:8338", + "54.153.140.202:8338", + "54.68.81.2:83388338", + "62.195.190.190:8338", + "62.216.5.136:8338", + "65.110.125.175:8338", + "67.68.226.130:8338", + "73.243.220.85:8338", + "77.78.12.89:8338", + "78.193.221.106:8338", + "78.98.162.140:8338", + "79.137.64.158:8338", + "84.144.177.238:8338", + "87.92.116.26:8338", + "89.115.139.117:8338", + "89.18.27.165:8338", + "91.50.219.221:8338", + "93.88.74.26", + "93.88.74.26:8338", + "94.155.74.206:8338", + "95.154.201.132:8338", + "98.29.248.131:8338", + "u2.my.to:8338", + "[2001:470:b:ce:dc70:83ff:fe7a:1e74]:8338", + "2001:7b8:61d:1:250:56ff:fe90:c89f:8338", + "2001:7b8:63a:1002:213:154:230:106:8338", + "2001:7b8:63a:1002:213:154:230:107:8338", + "45.56.84.44", + "109.201.133.93:8338", + "120.41.191.224:30607", + "138.68.249.79:50992", + "138.68.249.79:51314", + "172.104.157.62", + "178.63.11.246:8338", + "185.139.2.140:8338", + "199.229.248.218:28830", + "35.189.127.200:41220", + "35.189.127.200:48244", + "35.195.83.0:35172", + "35.195.83.0:35576", + "35.195.83.0:35798", + "35.197.197.166:32794", + "35.197.197.166:33112", + "35.197.197.166:33332", + "35.203.167.11:52158", + "37.59.50.143:35254", + "45.27.161.195:33852", + "45.27.161.195:36738", + "45.27.161.195:58628" + ], + "maxconnections": 250, + "mempoolexpiry": 72, + "timeout": 768 + } + }, + "blockbook": { + "package_name": "blockbook-bgold", + "system_user": "blockbook-bgold", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "subversion": "/Bitcoin Gold:0.17.3/", + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "slip44": 156, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"bitcoin-gold\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "Jakub Matys", + "package_maintainer_email": "jakub.matys@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-bgold", - "system_user": "blockbook-bgold", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "subversion": "/Bitcoin Gold:0.17.3/", - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "slip44": 156, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-gold\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Jakub Matys", - "package_maintainer_email": "jakub.matys@satoshilabs.com" - } } diff --git a/configs/coins/bgold_testnet.json b/configs/coins/bgold_testnet.json index d31a6ac130..0038f87a4f 100644 --- a/configs/coins/bgold_testnet.json +++ b/configs/coins/bgold_testnet.json @@ -1,84 +1,78 @@ { - "coin": { - "name": "Bgold Testnet", - "shortcut": "TBTG", - "label": "Bitcoin Gold Testnet", - "alias": "bgold_testnet" - }, - "ports": { - "backend_rpc": 18035, - "backend_message_queue": 48335, - "blockbook_internal": 19035, - "blockbook_public": 19135 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bgold-testnet", - "package_revision": "satoshilabs-1", - "system_user": "bgold", - "version": "0.17.3", - "binary_url": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/bitcoin-gold-0.17.3-x86_64-linux-gnu.tar.gz", - "verification_type": "gpg-sha256", - "verification_source": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/SHA256SUMS.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" + "coin": { + "name": "Bgold Testnet", + "shortcut": "TBTG", + "label": "Bitcoin Gold Testnet", + "alias": "bgold_testnet" + }, + "ports": { + "backend_rpc": 18035, + "backend_message_queue": 48335, + "blockbook_internal": 19035, + "blockbook_public": 19135 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bgold-testnet", + "package_revision": "satoshilabs-1", + "system_user": "bgold", + "version": "0.17.3", + "binary_url": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/bitcoin-gold-0.17.3-x86_64-linux-gnu.tar.gz", + "verification_type": "gpg-sha256", + "verification_source": "https://github.com/BTCGPU/BTCGPU/releases/download/v0.17.3/SHA256SUMS.asc", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bgoldd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "addnode": [ + "136.243.230.235:18338", + "167.179.114.118:18338", + "51.15.140.154:18338", + "62.141.35.88:18338", + "71.172.96.60:18338", + "8.39.234.187:18338" ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bgoldd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "addnode": [ - "136.243.230.235:18338", - "167.179.114.118:18338", - "51.15.140.154:18338", - "62.141.35.88:18338", - "71.172.96.60:18338", - "8.39.234.187:18338" - ], - "maxconnections": 250, - "mempoolexpiry": 72, - "timeout": 768 - } - }, - "blockbook": { - "package_name": "blockbook-bgold-testnet", - "system_user": "blockbook-bgold", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "subversion": "/Bitcoin Gold:0.17.3/", - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 156, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin-gold\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Martin Kuvandzhiev", - "package_maintainer_email": "martin@bitcoingold.org" + "maxconnections": 250, + "mempoolexpiry": 72, + "timeout": 768 } + }, + "blockbook": { + "package_name": "blockbook-bgold-testnet", + "system_user": "blockbook-bgold", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "subversion": "/Bitcoin Gold:0.17.3/", + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 156, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "Martin Kuvandzhiev", + "package_maintainer_email": "martin@bitcoingold.org" } - +} diff --git a/configs/coins/bitcoin.json b/configs/coins/bitcoin.json index c059bb8616..02e10bb198 100644 --- a/configs/coins/bitcoin.json +++ b/configs/coins/bitcoin.json @@ -1,73 +1,85 @@ { - "coin": { - "name": "Bitcoin", - "shortcut": "BTC", - "label": "Bitcoin", - "alias": "bitcoin" - }, - "ports": { - "backend_rpc": 8030, - "backend_message_queue": 38330, - "blockbook_internal": 9030, - "blockbook_public": 9130 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bitcoin", - "package_revision": "satoshilabs-1", - "system_user": "bitcoin", - "version": "23.0", - "binary_url": "https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "2cca490c1f2842884a3c5b0606f179f9f937177da4eadd628e3f7fd7e25d26d0", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee" + "coin": { + "name": "Bitcoin", + "shortcut": "BTC", + "label": "Bitcoin", + "alias": "bitcoin" + }, + "ports": { + "backend_rpc": 8030, + "backend_message_queue": 38330, + "blockbook_internal": 9030, + "blockbook_public": 9130 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bitcoin", + "package_revision": "satoshilabs-1", + "system_user": "bitcoin", + "version": "29.2", + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "1fd58d0ae94b8a9e21bbaeab7d53395a44976e82bd5492b0a894826c135f9009", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee", + "addnode": ["ove.palatinus.cz"] + }, + "platforms": { + "arm64": { + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-aarch64-linux-gnu.tar.gz", + "verification_source": "f88f72a3c5bf526581aae573be8c1f62133eaecfe3d34646c9ffca7b79dfdc7a" + } + } + }, + "blockbook": { + "package_name": "blockbook-bitcoin", + "system_user": "blockbook-bitcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-dbcache=1073741824 -enablesubnewtx -extendedindex", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "additional_params": { + "alternative_estimate_fee": "mempoolspaceblock", + "alternative_estimate_fee_params": "{\"url\": \"https://mempool.space/api/v1/fees/mempool-blocks\", \"periodSeconds\": 20, \"feeRangeIndex\": 5, \"fallbackFeePerKB\": 1000}", + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"bitcoin\", \"periodSeconds\": 60}", + "block_golomb_filter_p": 20, + "block_filter_scripts": "taproot-noordinals", + "block_filter_use_zeroed_key": true, + "mempool_golomb_filter_p": 20, + "mempool_filter_scripts": "taproot", + "mempool_filter_use_zeroed_key": false + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-bitcoin", - "system_user": "blockbook-bitcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "-dbcache=1073741824", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "additional_params": { - "alternative_estimate_fee": "whatthefee-disabled", - "alternative_estimate_fee_params": "{\"url\": \"https://whatthefee.io/data.json\", \"periodSeconds\": 60}", - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/bitcoin_regtest.json b/configs/coins/bitcoin_regtest.json index dd025911b8..a14a85a66d 100644 --- a/configs/coins/bitcoin_regtest.json +++ b/configs/coins/bitcoin_regtest.json @@ -1,69 +1,82 @@ { - "coin": { - "name": "Regtest", - "shortcut": "rBTC", - "label": "Bitcoin Regtest", - "alias": "bitcoin_regtest" - }, - "ports": { - "backend_rpc": 18021, - "backend_message_queue": 48321, - "blockbook_internal": 19021, - "blockbook_public": 19121 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bitcoin-regtest", - "package_revision": "satoshilabs-1", - "system_user": "bitcoin", - "version": "23.0", - "binary_url": "https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "2cca490c1f2842884a3c5b0606f179f9f937177da4eadd628e3f7fd7e25d26d0", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/regtest/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "mainnet": false, - "protect_memory": true, - "server_config_file": "bitcoin_regtest.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee" + "coin": { + "name": "Regtest", + "shortcut": "rBTC", + "label": "Bitcoin Regtest", + "alias": "bitcoin_regtest" + }, + "ports": { + "backend_rpc": 18021, + "backend_message_queue": 48321, + "blockbook_internal": 19021, + "blockbook_public": 19121 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bitcoin-regtest", + "package_revision": "satoshilabs-1", + "system_user": "bitcoin", + "version": "29.2", + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "1fd58d0ae94b8a9e21bbaeab7d53395a44976e82bd5492b0a894826c135f9009", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/regtest/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "mainnet": false, + "protect_memory": true, + "server_config_file": "bitcoin_regtest.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-aarch64-linux-gnu.tar.gz", + "verification_source": "f88f72a3c5bf526581aae573be8c1f62133eaecfe3d34646c9ffca7b79dfdc7a" + } + } + }, + "blockbook": { + "package_name": "blockbook-bitcoin-regtest", + "system_user": "blockbook-bitcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": { + "alternative_estimate_fee": "mempoolspaceblock", + "alternative_estimate_fee_params": "{\"url\": \"https://mempool.space/api/v1/fees/mempool-blocks\", \"periodSeconds\": 20, \"feeRangeIndex\": 5, \"fallbackFeePerKB\": 1000}", + "block_golomb_filter_p": 20, + "block_filter_scripts": "taproot-noordinals", + "block_filter_use_zeroed_key": true, + "mempool_golomb_filter_p": 20, + "mempool_filter_scripts": "taproot", + "mempool_filter_use_zeroed_key": false + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-bitcoin-regtest", - "system_user": "blockbook-bitcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": {} - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/bitcoin_signet.json b/configs/coins/bitcoin_signet.json index 5eab9c235d..63f5562a45 100644 --- a/configs/coins/bitcoin_signet.json +++ b/configs/coins/bitcoin_signet.json @@ -1,69 +1,73 @@ { - "coin": { - "name": "Signet", - "shortcut": "sBTC", - "label": "Bitcoin Signet", - "alias": "bitcoin_signet" - }, - "ports": { - "backend_rpc": 18020, - "backend_message_queue": 48320, - "blockbook_internal": 19020, - "blockbook_public": 19120 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bitcoin-signet", - "package_revision": "satoshilabs-1", - "system_user": "bitcoin", - "version": "23.0", - "binary_url": "https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "2cca490c1f2842884a3c5b0606f179f9f937177da4eadd628e3f7fd7e25d26d0", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/signet/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin-signet.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee" + "coin": { + "name": "Signet", + "shortcut": "sBTC", + "label": "Bitcoin Signet", + "alias": "bitcoin_signet" + }, + "ports": { + "backend_rpc": 18020, + "backend_message_queue": 48320, + "blockbook_internal": 19020, + "blockbook_public": 19120 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bitcoin-signet", + "package_revision": "satoshilabs-1", + "system_user": "bitcoin", + "version": "29.2", + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "1fd58d0ae94b8a9e21bbaeab7d53395a44976e82bd5492b0a894826c135f9009", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/signet/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin_signet.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-aarch64-linux-gnu.tar.gz", + "verification_source": "f88f72a3c5bf526581aae573be8c1f62133eaecfe3d34646c9ffca7b79dfdc7a" + } + } + }, + "blockbook": { + "package_name": "blockbook-bitcoin-signet", + "system_user": "blockbook-bitcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "wakiyamap", + "package_maintainer_email": "wakiyamap@gmail.com" } - }, - "blockbook": { - "package_name": "blockbook-bitcoin-signet", - "system_user": "blockbook-bitcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": {} - } - }, - "meta": { - "package_maintainer": "wakiyamap", - "package_maintainer_email": "wakiyamap@gmail.com" - } } diff --git a/configs/coins/bitcoin_testnet.json b/configs/coins/bitcoin_testnet.json index 8d4f2c4651..f3db91e270 100644 --- a/configs/coins/bitcoin_testnet.json +++ b/configs/coins/bitcoin_testnet.json @@ -1,69 +1,80 @@ { - "coin": { - "name": "Testnet", - "shortcut": "TEST", - "label": "Bitcoin Testnet", - "alias": "bitcoin_testnet" - }, - "ports": { - "backend_rpc": 18030, - "backend_message_queue": 48330, - "blockbook_internal": 19030, - "blockbook_public": 19130 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bitcoin-testnet", - "package_revision": "satoshilabs-1", - "system_user": "bitcoin", - "version": "23.0", - "binary_url": "https://bitcoincore.org/bin/bitcoin-core-23.0/bitcoin-23.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "2cca490c1f2842884a3c5b0606f179f9f937177da4eadd628e3f7fd7e25d26d0", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee" + "coin": { + "name": "Testnet", + "shortcut": "TEST", + "label": "Bitcoin Testnet", + "alias": "bitcoin_testnet" + }, + "ports": { + "backend_rpc": 18030, + "backend_message_queue": 48330, + "blockbook_internal": 19030, + "blockbook_public": 19130 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bitcoin-testnet", + "package_revision": "satoshilabs-1", + "system_user": "bitcoin", + "version": "29.2", + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "1fd58d0ae94b8a9e21bbaeab7d53395a44976e82bd5492b0a894826c135f9009", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-aarch64-linux-gnu.tar.gz", + "verification_source": "f88f72a3c5bf526581aae573be8c1f62133eaecfe3d34646c9ffca7b79dfdc7a" + } + } + }, + "blockbook": { + "package_name": "blockbook-bitcoin-testnet", + "system_user": "blockbook-bitcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-enablesubnewtx -extendedindex", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 10000, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": { + "block_golomb_filter_p": 20, + "block_filter_scripts": "taproot-noordinals", + "block_filter_use_zeroed_key": true, + "mempool_golomb_filter_p": 20, + "mempool_filter_scripts": "taproot", + "mempool_filter_use_zeroed_key": false + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-bitcoin-testnet", - "system_user": "blockbook-bitcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": {} - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/bitcoin_testnet4.json b/configs/coins/bitcoin_testnet4.json new file mode 100644 index 0000000000..4478c3e135 --- /dev/null +++ b/configs/coins/bitcoin_testnet4.json @@ -0,0 +1,82 @@ +{ + "coin": { + "name": "Testnet4", + "shortcut": "TEST", + "label": "Bitcoin Testnet4", + "alias": "bitcoin_testnet4" + }, + "ports": { + "backend_rpc": 18029, + "backend_message_queue": 48329, + "blockbook_internal": 19029, + "blockbook_public": 19129 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bitcoin-testnet4", + "package_revision": "satoshilabs-1", + "system_user": "bitcoin", + "version": "29.2", + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "1fd58d0ae94b8a9e21bbaeab7d53395a44976e82bd5492b0a894826c135f9009", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin_testnet4.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://bitcoincore.org/bin/bitcoin-core-29.2/bitcoin-29.2-aarch64-linux-gnu.tar.gz", + "verification_source": "f88f72a3c5bf526581aae573be8c1f62133eaecfe3d34646c9ffca7b79dfdc7a" + } + } + }, + "blockbook": { + "package_name": "blockbook-bitcoin-testnet4", + "system_user": "blockbook-bitcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-enablesubnewtx -extendedindex", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 10000, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": { + "alternative_estimate_fee": "mempoolspace", + "alternative_estimate_fee_params": "{\"url\": \"https://mempool.space/testnet4/api/v1/fees/recommended\", \"periodSeconds\": 60}", + "block_golomb_filter_p": 20, + "block_filter_scripts": "taproot-noordinals", + "block_filter_use_zeroed_key": true, + "mempool_golomb_filter_p": 20, + "mempool_filter_scripts": "taproot", + "mempool_filter_use_zeroed_key": false + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/bitcore.json b/configs/coins/bitcore.json index 8cf72d54a1..4ebb9f2671 100644 --- a/configs/coins/bitcore.json +++ b/configs/coins/bitcore.json @@ -1,71 +1,72 @@ { - "coin": { - "name": "Bitcore", - "shortcut": "BTX", - "label": "Bitcore", - "alias": "bitcore" - }, - "ports": { - "backend_rpc": 8054, - "backend_message_queue": 38354, - "blockbook_internal": 9054, - "blockbook_public": 9154 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-bitcore", - "package_revision": "satoshilabs-1", - "system_user": "bitcore", - "version": "0.15.2.1", - "binary_url": "https://github.com/dalijolijo/BitCore/releases/download/0.15.2.1/bitcore-0.15.2.1-x86_64-linux-gnu_no-wallet.tar.gz", - "verification_type": "sha256", - "verification_source": "4e47b33d5fa7d67151c9860f4cd19c99a55d42b27c170bd2391988c67aa24fc8", - "extract_command": "tar -C backend -xf", - "exclude_files": [ - "bin/bitcore-qt", - "bin/test_bitcore-qt", - "bin/bench_bitcore", - "bin/test_bitcore" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcored -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "Bitcore", + "shortcut": "BTX", + "label": "Bitcore", + "alias": "bitcore" + }, + "ports": { + "backend_rpc": 8054, + "backend_message_queue": 38354, + "blockbook_internal": 9054, + "blockbook_public": 9154 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-bitcore", + "package_revision": "satoshilabs-1", + "system_user": "bitcore", + "version": "0.15.2.1", + "binary_url": "https://github.com/dalijolijo/BitCore/releases/download/0.15.2.1/bitcore-0.15.2.1-x86_64-linux-gnu_no-wallet.tar.gz", + "verification_type": "sha256", + "verification_source": "4e47b33d5fa7d67151c9860f4cd19c99a55d42b27c170bd2391988c67aa24fc8", + "extract_command": "tar -C backend -xf", + "exclude_files": [ + "bin/bitcore-qt", + "bin/test_bitcore-qt", + "bin/bench_bitcore", + "bin/test_bitcore" + ], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcored -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-bitcore", + "system_user": "blockbook-bitcore", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"bitcore\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "LIMXTEC", + "package_maintainer_email": "info@bitcore.cc" } - }, - "blockbook": { - "package_name": "blockbook-bitcore", - "system_user": "blockbook-bitcore", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcore\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "LIMXTEC", - "package_maintainer_email": "info@bitcore.cc" - } } diff --git a/configs/coins/bsc.json b/configs/coins/bsc.json new file mode 100644 index 0000000000..db599b3ac6 --- /dev/null +++ b/configs/coins/bsc.json @@ -0,0 +1,72 @@ +{ + "coin": { + "name": "BNB Smart Chain", + "shortcut": "BNB", + "network": "BSC", + "label": "BNB Smart Chain", + "alias": "bsc" + }, + "ports": { + "backend_rpc": 8064, + "backend_p2p": 38364, + "backend_http": 8164, + "blockbook_internal": 9064, + "blockbook_public": 9164 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-bsc", + "package_revision": "satoshilabs-1", + "system_user": "bsc", + "version": "1.1.23", + "binary_url": "https://github.com/bnb-chain/bsc/releases/download/v1.1.23/geth_linux", + "verification_type": "sha256", + "verification_source": "6636c40d4e82017257467ab2cfc88b11990cf3bb35faeec9c5194ab90009a81f", + "extract_command": "mv ${ARCHIVE} backend/geth_linux && chmod +x backend/geth_linux && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bsc_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "bsc.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://github.com/bnb-chain/bsc/releases/download/v1.1.23/mainnet.zip -O {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && unzip -o -d {{.Env.BackendInstallPath}}/{{.Coin.Alias}} {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && rm -f {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && sed -i -e '/\\[Node.LogConfig\\]/,+5d' {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/config.toml", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/bnb-chain/bsc/releases/download/v1.1.23/geth-linux-arm64", + "verification_source": "74105d6b9b8483a92ab8311784315c5f65dac2213004e0b1433cdf9127bced35" + } + } + }, + "blockbook": { + "package_name": "blockbook-bsc", + "system_user": "blockbook-bsc", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-dbcache=1500000000 -workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"binancecoin\",\"platformIdentifier\": \"binance-smart-chain\",\"platformVsCurrency\": \"bnb\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/bsc_archive.json b/configs/coins/bsc_archive.json new file mode 100644 index 0000000000..7fbc2ae610 --- /dev/null +++ b/configs/coins/bsc_archive.json @@ -0,0 +1,79 @@ +{ + "coin": { + "name": "BNB Smart Chain Archive", + "shortcut": "BNB", + "network": "BSC", + "label": "BNB Smart Chain", + "alias": "bsc_archive" + }, + "ports": { + "backend_rpc": 8065, + "backend_p2p": 38365, + "backend_http": 8165, + "blockbook_internal": 9065, + "blockbook_public": 9165 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 240 + }, + "backend": { + "package_name": "backend-bsc-archive", + "package_revision": "satoshilabs-1", + "system_user": "bsc", + "version": "1.1.23", + "binary_url": "https://github.com/bnb-chain/bsc/releases/download/v1.1.23/geth_linux", + "verification_type": "sha256", + "verification_source": "6636c40d4e82017257467ab2cfc88b11990cf3bb35faeec9c5194ab90009a81f", + "extract_command": "mv ${ARCHIVE} backend/geth_linux && chmod +x backend/geth_linux && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bsc_archive_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "bsc_archive.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://github.com/bnb-chain/bsc/releases/download/v1.1.23/mainnet.zip -O {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && unzip -o -d {{.Env.BackendInstallPath}}/{{.Coin.Alias}} {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && rm -f {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/mainnet.zip && sed -i -e '/\\[Node.LogConfig\\]/,+5d' {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/config.toml", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/bnb-chain/bsc/releases/download/v1.1.23/geth-linux-arm64", + "verification_source": "74105d6b9b8483a92ab8311784315c5f65dac2213004e0b1433cdf9127bced35" + } + } + }, + "blockbook": { + "package_name": "blockbook-bsc-archive", + "system_user": "blockbook-bsc", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-dbcache=1500000000 -workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "eip1559Fees": true, + "alternative_estimate_fee": "infura-disabled", + "alternative_estimate_fee_params": "{\"url\": \"https://gas.api.infura.io/v3/${api_key}/networks/56/suggestedGasFees\", \"periodSeconds\": 60}", + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "disableMempoolSync": true, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"binancecoin\",\"platformIdentifier\": \"binance-smart-chain\",\"platformVsCurrency\": \"bnb\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/dash.json b/configs/coins/dash.json index f2ee61a5c9..255325ef44 100644 --- a/configs/coins/dash.json +++ b/configs/coins/dash.json @@ -1,71 +1,70 @@ { - "coin": { - "name": "Dash", - "shortcut": "DASH", - "label": "Dash", - "alias": "dash" - }, - "ports": { - "backend_rpc": 8033, - "backend_message_queue": 38333, - "blockbook_internal": 9033, - "blockbook_public": 9133 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-dash", - "package_revision": "satoshilabs-1", - "system_user": "dash", - "version": "0.17.0.3", - "binary_url": "https://github.com/dashpay/dash/releases/download/v0.17.0.3/dashcore-0.17.0.3-x86_64-linux-gnu.tar.gz", - "verification_type": "gpg-sha256", - "verification_source": "https://github.com/dashpay/dash/releases/download/v0.17.0.3/SHA256SUMS.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/dash-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/dashd -deprecatedrpc=estimatefee -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "mempoolexpiry": 72 + "coin": { + "name": "Dash", + "shortcut": "DASH", + "label": "Dash", + "alias": "dash" + }, + "ports": { + "backend_rpc": 8033, + "backend_message_queue": 38333, + "blockbook_internal": 9033, + "blockbook_public": 9133 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-dash", + "package_revision": "satoshilabs-1", + "system_user": "dash", + "version": "22.0.0", + "binary_url": "https://github.com/dashpay/dash/releases/download/v22.0.0/dashcore-22.0.0-x86_64-linux-gnu.tar.gz", + "verification_type": "gpg-sha256", + "verification_source": "https://github.com/dashpay/dash/releases/download/v22.0.0/SHA256SUMS.asc", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/dash-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/dashd -deprecatedrpc=estimatefee -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "mempoolexpiry": 72 + } + }, + "blockbook": { + "package_name": "blockbook-dash", + "system_user": "blockbook-dash", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "subversion": "/Dash Core:0.17.0.3/", + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 50221772, + "slip44": 5, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"dash\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT Admin", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-dash", - "system_user": "blockbook-dash", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "subversion": "/Dash Core:0.17.0.3/", - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 50221772, - "slip44": 5, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"dash\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT Admin", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/dash_testnet.json b/configs/coins/dash_testnet.json index c4c5e17108..081381a6f6 100644 --- a/configs/coins/dash_testnet.json +++ b/configs/coins/dash_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-dash-testnet", "package_revision": "satoshilabs-1", "system_user": "dash", - "version": "0.17.0.3", - "binary_url": "https://github.com/dashpay/dash/releases/download/v0.17.0.3/dashcore-0.17.0.3-x86_64-linux-gnu.tar.gz", + "version": "22.0.0", + "binary_url": "https://github.com/dashpay/dash/releases/download/v22.0.0/dashcore-22.0.0-x86_64-linux-gnu.tar.gz", "verification_type": "gpg-sha256", - "verification_source": "https://github.com/dashpay/dash/releases/download/v0.17.0.3/SHA256SUMS.asc", + "verification_source": "https://github.com/dashpay/dash/releases/download/v22.0.0/SHA256SUMS.asc", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/dash-qt" diff --git a/configs/coins/decred.json b/configs/coins/decred.json index 0b9ded8e67..d8e4e35fbe 100644 --- a/configs/coins/decred.json +++ b/configs/coins/decred.json @@ -22,10 +22,10 @@ "package_name": "backend-decred", "package_revision": "decred-1", "system_user": "decred", - "version": "1.6.0-rc3", - "binary_url": "https://github.com/decred/decred-binaries/releases/download/v1.6.0-rc3/decred-linux-amd64-v1.6.0-rc3.tar.gz", + "version": "1.7.5", + "binary_url": "https://github.com/decred/decred-binaries/releases/download/v1.7.5/decred-linux-amd64-v1.7.5.tar.gz", "verification_type": "sha256", - "verification_source": "42e588b80cf03eb69fff9a8fe0fedc81d8142404769c19143a3a8498008b46dd", + "verification_source": "8be1894e6e61e9d0392f158b16055b8cec81d96ec3d0725d3494bc0a306c362b", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [], "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/dcrd --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --appdata={{.Env.BackendDataPath}}/{{.Coin.Alias}} -C={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf", @@ -52,7 +52,7 @@ "additional_params": "-resyncindexperiod=300111 -resyncmempoolperiod=60111", "block_chain": { "parse": true, - "subversion":"/Decred dcrd:1.6.0-rc3", + "subversion":"/Decred dcrd:1.7.5", "mempool_workers": 8, "mempool_sub_workers": 2, "block_addresses_to_keep": 30, diff --git a/configs/coins/decred_testnet.json b/configs/coins/decred_testnet.json index cc0b8b4ae7..f9894b5fe0 100644 --- a/configs/coins/decred_testnet.json +++ b/configs/coins/decred_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-decred-testnet", "package_revision": "decred-testnet-1", "system_user": "decred", - "version": "1.6.0-rc3", - "binary_url": "https://github.com/decred/decred-binaries/releases/download/v1.6.0-rc3/decred-linux-amd64-v1.6.0-rc3.tar.gz", + "version": "1.7.5", + "binary_url": "https://github.com/decred/decred-binaries/releases/download/v1.7.5/decred-linux-amd64-v1.7.5.tar.gz", "verification_type": "sha256", - "verification_source": "42e588b80cf03eb69fff9a8fe0fedc81d8142404769c19143a3a8498008b46dd", + "verification_source": "8be1894e6e61e9d0392f158b16055b8cec81d96ec3d0725d3494bc0a306c362b", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [], "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/dcrd --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --rpcuser={{.IPC.RPCUser}} --rpcpass={{.IPC.RPCPass}} -C={{.Env.BackendDataPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf --nofilelogging --appdata={{.Env.BackendDataPath}}/{{.Coin.Alias}} --notls --txindex --addrindex --testnet --rpclisten=[127.0.0.1]:18061", @@ -52,7 +52,7 @@ "additional_params": "-resyncindexperiod=300111 -resyncmempoolperiod=60111", "block_chain": { "parse": true, - "subversion":"/Decred dcrd:1.6.0-rc3", + "subversion":"/Decred dcrd:1.7.5", "mempool_workers": 8, "mempool_sub_workers": 2, "block_addresses_to_keep": 30, diff --git a/configs/coins/digibyte.json b/configs/coins/digibyte.json index 4c4fa237a7..f407545e84 100644 --- a/configs/coins/digibyte.json +++ b/configs/coins/digibyte.json @@ -1,72 +1,71 @@ { - "coin": { - "name": "DigiByte", - "shortcut": "DGB", - "label": "DigiByte", - "alias": "digibyte" - }, - "ports": { - "backend_rpc": 8042, - "backend_message_queue": 38342, - "blockbook_internal": 9042, - "blockbook_public": 9142 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-digibyte", - "package_revision": "satoshilabs-1", - "system_user": "digibyte", - "version": "7.17.3", - "binary_url": "https://github.com/digibyte-core/digibyte/releases/download/v7.17.3/digibyte-7.17.3-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "b5cd8f590d359e4846dd5cbe60751221e54d773a6227ea9686d17c4890057f46", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/digibyte-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/digibyted -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "DigiByte", + "shortcut": "DGB", + "label": "DigiByte", + "alias": "digibyte" + }, + "ports": { + "backend_rpc": 8042, + "backend_message_queue": 38342, + "blockbook_internal": 9042, + "blockbook_public": 9142 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-digibyte", + "package_revision": "satoshilabs-1", + "system_user": "digibyte", + "version": "7.17.3", + "binary_url": "https://github.com/digibyte-core/digibyte/releases/download/v7.17.3/digibyte-7.17.3-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "b5cd8f590d359e4846dd5cbe60751221e54d773a6227ea9686d17c4890057f46", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/digibyte-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/digibyted -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-digibyte", + "system_user": "blockbook-digibyte", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "slip44": 20, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"digibyte\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "Martin Bohm", + "package_maintainer_email": "martin.bohm@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-digibyte", - "system_user": "blockbook-digibyte", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "slip44": 20, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"digibyte\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Martin Bohm", - "package_maintainer_email": "martin.bohm@satoshilabs.com" - } } diff --git a/configs/coins/dogecoin.json b/configs/coins/dogecoin.json index 9b0c6891b3..f120043288 100644 --- a/configs/coins/dogecoin.json +++ b/configs/coins/dogecoin.json @@ -1,73 +1,79 @@ { - "coin": { - "name": "Dogecoin", - "shortcut": "DOGE", - "label": "Dogecoin", - "alias": "dogecoin" - }, - "ports": { - "backend_rpc": 8038, - "backend_message_queue": 38338, - "blockbook_internal": 9038, - "blockbook_public": 9138 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpcp", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-dogecoin", - "package_revision": "satoshilabs-1", - "system_user": "dogecoin", - "version": "1.14.5", - "binary_url": "https://github.com/dogecoin/dogecoin/releases/download/v1.14.5/dogecoin-1.14.5-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "17a03f019168ec5283947ea6fbf1a073c1d185ea9edacc2b91f360e1c191428e", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/dogecoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/dogecoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": false, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "discover": 0, - "rpcthreads": 16, - "upnp": 0, - "whitelist": "127.0.0.1" + "coin": { + "name": "Dogecoin", + "shortcut": "DOGE", + "label": "Dogecoin", + "alias": "dogecoin" + }, + "ports": { + "backend_rpc": 8038, + "backend_message_queue": 38338, + "blockbook_internal": 9038, + "blockbook_public": 9138 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpcp", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-dogecoin", + "package_revision": "satoshilabs-1", + "system_user": "dogecoin", + "version": "1.14.9", + "binary_url": "https://github.com/dogecoin/dogecoin/releases/download/v1.14.9/dogecoin-1.14.9-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "4f227117b411a7c98622c970986e27bcfc3f547a72bef65e7d9e82989175d4f8", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/dogecoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/dogecoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": false, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "discover": 0, + "rpcthreads": 16, + "upnp": 0, + "whitelist": "127.0.0.1" + }, + "platforms": { + "arm64": { + "binary_url": "https://github.com/dogecoin/dogecoin/releases/download/v1.14.9/dogecoin-1.14.9-aarch64-linux-gnu.tar.gz", + "verification_source": "6928c895a20d0bcb6d5c7dcec753d35c884a471aaf8ad4242a89a96acb4f2985", + "exclude_files": [] + } + } + }, + "blockbook": { + "package_name": "blockbook-dogecoin", + "system_user": "blockbook-dogecoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-resyncindexperiod=30011 -resyncmempoolperiod=2011", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 49990397, + "slip44": 3, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"dogecoin\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT Admin", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-dogecoin", - "system_user": "blockbook-dogecoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "-resyncindexperiod=30011 -resyncmempoolperiod=2011", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 49990397, - "slip44": 3, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"dogecoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT Admin", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/dogecoin_testnet.json b/configs/coins/dogecoin_testnet.json index 8ef2edc7aa..8103ba70db 100644 --- a/configs/coins/dogecoin_testnet.json +++ b/configs/coins/dogecoin_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-dogecoin-testnet", "package_revision": "satoshilabs-1", "system_user": "dogecoin", - "version": "1.14.5", - "binary_url": "https://github.com/dogecoin/dogecoin/releases/download/v1.14.5/dogecoin-1.14.5-x86_64-linux-gnu.tar.gz", + "version": "1.14.9", + "binary_url": "https://github.com/dogecoin/dogecoin/releases/download/v1.14.9/dogecoin-1.14.9-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "17a03f019168ec5283947ea6fbf1a073c1d185ea9edacc2b91f360e1c191428e", + "verification_source": "4f227117b411a7c98622c970986e27bcfc3f547a72bef65e7d9e82989175d4f8", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/dogecoin-qt" @@ -44,6 +44,13 @@ "rpcthreads": 16, "upnp": 0, "whitelist": "127.0.0.1" + }, + "platforms": { + "arm64": { + "binary_url": "https://github.com/dogecoin/dogecoin/releases/download/v1.14.9/dogecoin-1.14.9-aarch64-linux-gnu.tar.gz", + "verification_source": "6928c895a20d0bcb6d5c7dcec753d35c884a471aaf8ad4242a89a96acb4f2985", + "exclude_files": [] + } } }, "blockbook": { diff --git a/configs/coins/ecash.json b/configs/coins/ecash.json index af40823e80..6eba1ca3f5 100644 --- a/configs/coins/ecash.json +++ b/configs/coins/ecash.json @@ -1,69 +1,72 @@ { - "coin": { - "name": "ECash", - "shortcut": "XEC", - "label": "eCash", - "alias": "ecash" - }, - "ports": { - "backend_rpc": 8097, - "backend_message_queue": 38397, - "blockbook_internal": 9097, - "blockbook_public": 9197 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-ecash", - "package_revision": "satoshilabs-1", - "system_user": "ecash", - "version": "0.25.1", - "binary_url": "https://download.bitcoinabc.org/0.25.1/linux/bitcoin-abc-0.25.1-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "295183578ce67444fd6a504d2dcb85d07345454881ba4db5f52d82dd3a659bed", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/bitcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bcash.conf", - "client_config_file": "bitcoin_like_client.conf" - }, - "blockbook": { - "package_name": "blockbook-ecash", - "system_user": "blockbook-ecash", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "subversion": "/Bitcoin ABC:0.24.9(EB32.0)/", - "address_format": "cashaddr", - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "slip44": 899, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ecash\", \"periodSeconds\": 60}" - } + "coin": { + "name": "ECash", + "shortcut": "XEC", + "label": "eCash", + "alias": "ecash" + }, + "ports": { + "backend_rpc": 8097, + "backend_message_queue": 38397, + "blockbook_internal": 9097, + "blockbook_public": 9197 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-ecash", + "package_revision": "satoshilabs-1", + "system_user": "ecash", + "version": "0.27.3", + "binary_url": "https://download.bitcoinabc.org/0.27.3/linux/bitcoin-abc-0.27.3-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "390329fa9ad9e88319f5cf5239385268584116710144d6bc156fbcca7514710a", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/bitcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/bitcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bcash.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "listen": 1, + "avalanche": 1 + } + }, + "blockbook": { + "package_name": "blockbook-ecash", + "system_user": "blockbook-ecash", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "subversion": "/Bitcoin ABC:0.27.3(EB32.0)/", + "address_format": "cashaddr", + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "slip44": 899, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ecash\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "eCash", + "package_maintainer_email": "contact@e.cash" } - }, - "meta": { - "package_maintainer": "eCash", - "package_maintainer_email": "contact@e.cash" - } } diff --git a/configs/coins/ethereum-classic.json b/configs/coins/ethereum-classic.json index 537cd2fbc3..dbba500b02 100644 --- a/configs/coins/ethereum-classic.json +++ b/configs/coins/ethereum-classic.json @@ -1,62 +1,67 @@ { - "coin": { - "name": "Ethereum Classic", - "shortcut": "ETC", - "label": "Ethereum Classic", - "alias": "ethereum-classic" - }, - "ports": { - "backend_rpc": 8037, - "backend_message_queue": 0, - "blockbook_internal": 9037, - "blockbook_public": 9137 - }, - "ipc": { - "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_timeout": 25 - }, - "backend": { - "package_name": "backend-ethereum-classic", - "package_revision": "satoshilabs-1", - "system_user": "ethereum-classic", - "version": "1.12.6", - "binary_url": "https://github.com/etclabscore/core-geth/releases/download/v1.12.6/core-geth-linux-v1.12.6.zip", - "verification_type": "sha256", - "verification_source": "e46af4307abb876cfa423f9766dafc91eadb7f18a64c7fcde89220610797986f", - "extract_command": "unzip -d backend", - "exclude_files": [], - "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth --classic --ipcdisable --txlookuplimit 0 --cache 1024 --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --port 38337 --ws --ws.addr 127.0.0.1 --ws.port {{.Ports.BackendRPC}} --ws.origins \"*\" --http --http.port 8137 --http.addr 127.0.0.1 --http.corsdomain \"*\" 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", - "postinst_script_template": "", - "service_type": "simple", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "", - "client_config_file": "" - }, - "blockbook": { - "package_name": "blockbook-ethereum-classic", - "system_user": "blockbook-ethereum-classic", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 10000, - "additional_params": { - "mempoolTxTimeoutHours": 48, - "queryBackendOnMempoolResync": true, - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ethereum-classic\", \"periodSeconds\": 60}" - } + "coin": { + "name": "Ethereum Classic", + "shortcut": "ETC", + "label": "Ethereum Classic", + "alias": "ethereum-classic" + }, + "ports": { + "backend_rpc": 8037, + "backend_message_queue": 0, + "backend_p2p": 38337, + "backend_http": 8137, + "blockbook_internal": 9037, + "blockbook_public": 9137 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-classic", + "package_revision": "satoshilabs-1", + "system_user": "ethereum-classic", + "version": "1.12.18", + "binary_url": "https://github.com/etclabscore/core-geth/releases/download/v1.12.18/core-geth-linux-v1.12.18.zip", + "verification_type": "sha256", + "verification_source": "2382a15a53ce364cb41d3985ff3c2941392d8898c6f869666a8d7d7914a5748a", + "extract_command": "unzip -d backend", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth --classic --ipcdisable --txlookuplimit 0 --cache 1024 --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --port {{.Ports.BackendP2P}} --ws --ws.addr 127.0.0.1 --ws.port {{.Ports.BackendRPC}} --ws.origins \"*\" --http --http.port {{.Ports.BackendHttp}} --http.addr 127.0.0.1 --http.corsdomain \"*\" 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-ethereum-classic", + "system_user": "blockbook-ethereum-classic", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 10000, + "additional_params": { + "address_aliases": true, + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": true, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum-classic\", \"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/ethereum.json b/configs/coins/ethereum.json index c2f2eaec79..ef0f93d283 100644 --- a/configs/coins/ethereum.json +++ b/configs/coins/ethereum.json @@ -1,64 +1,76 @@ { - "coin": { - "name": "Ethereum", - "shortcut": "ETH", - "label": "Ethereum", - "alias": "ethereum" - }, - "ports": { - "backend_rpc": 8036, - "backend_message_queue": 0, - "backend_p2p": 38336, - "backend_http": 8136, - "blockbook_internal": 9036, - "blockbook_public": 9136 - }, - "ipc": { - "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_timeout": 25 - }, - "backend": { - "package_name": "backend-ethereum", - "package_revision": "satoshilabs-1", - "system_user": "ethereum", - "version": "1.10.17-25c9b49f", - "binary_url": "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz", - "verification_type": "gpg", - "verification_source": "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [], - "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth --ipcdisable --syncmode full --txlookuplimit 0 --cache 1024 --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --port 38336 --ws --ws.addr 127.0.0.1 --ws.port {{.Ports.BackendRPC}} --ws.origins \"*\" --http --http.port 8136 -http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", - "postinst_script_template": "", - "service_type": "simple", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "", - "client_config_file": "" - }, - "blockbook": { - "package_name": "blockbook-ethereum", - "system_user": "blockbook-ethereum", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "additional_params": { - "mempoolTxTimeoutHours": 48, - "queryBackendOnMempoolResync": false, - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"ethereum\", \"periodSeconds\": 60}" - } + "coin": { + "name": "Ethereum", + "shortcut": "ETH", + "label": "Ethereum", + "alias": "ethereum" + }, + "ports": { + "backend_rpc": 8036, + "backend_message_queue": 0, + "backend_p2p": 38336, + "backend_http": 8136, + "backend_authrpc": 8536, + "blockbook_internal": 9036, + "blockbook_public": 9136 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "3.2.1", + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_amd64.tar.gz", + "verification_type": "sha256", + "verification_source": "8b5444988667721f2b2ef1ab3098139c31f722492992939c110813408c39dc7c", + "extract_command": "tar -C backend --strip-components=1 -xf", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/erigon --chain mainnet --snap.keepblocks --db.size.limit 15TB --db.pagesize 16KB --prune.mode full --externalcl --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/erigon --port {{.Ports.BackendP2P}} --ws --ws.port {{.Ports.BackendRPC}} --http --http.port {{.Ports.BackendRPC}} --http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" --http.api \"eth,net,web3,debug,txpool\" --authrpc.port {{.Ports.BackendAuthRpc}} --private.api.addr \"\" --torrent.port {{.Ports.BackendHttp}} --log.dir.path {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log.dir.prefix {{.Coin.Alias}}'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_arm64.tar.gz", + "verification_source": "19a91709dc3ddbe947c4f81e70cb1de49044954e21f441e9ea46b3696f21b57f" + } + } + }, + "blockbook": { + "package_name": "blockbook-ethereum", + "system_user": "blockbook-ethereum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "consensusNodeVersion": "http://localhost:7536/eth/v1/node/version", + "address_aliases": true, + "eip1559Fees": true, + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } -} +} \ No newline at end of file diff --git a/configs/coins/ethereum_archive.json b/configs/coins/ethereum_archive.json new file mode 100644 index 0000000000..abe1fc4733 --- /dev/null +++ b/configs/coins/ethereum_archive.json @@ -0,0 +1,79 @@ +{ + "coin": { + "name": "Ethereum Archive", + "shortcut": "ETH", + "label": "Ethereum", + "alias": "ethereum_archive" + }, + "ports": { + "backend_rpc": 8016, + "backend_message_queue": 0, + "backend_p2p": 38316, + "backend_http": 8116, + "backend_authrpc": 8516, + "blockbook_internal": 9016, + "blockbook_public": 9116 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-archive", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "3.2.1", + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_amd64.tar.gz", + "verification_type": "sha256", + "verification_source": "8b5444988667721f2b2ef1ab3098139c31f722492992939c110813408c39dc7c", + "extract_command": "tar -C backend --strip-components=1 -xf", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/erigon --chain mainnet --snap.keepblocks --db.size.limit 15TB --db.pagesize 16KB --prune.mode archive --externalcl --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/erigon --port {{.Ports.BackendP2P}} --ws --ws.port {{.Ports.BackendRPC}} --http --http.port {{.Ports.BackendRPC}} --http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" --http.api \"eth,net,web3,debug,txpool\" --authrpc.port {{.Ports.BackendAuthRpc}} --private.api.addr \"\" --torrent.port {{.Ports.BackendHttp}} --log.dir.path {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log.dir.prefix {{.Coin.Alias}}'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_arm64.tar.gz", + "verification_source": "19a91709dc3ddbe947c4f81e70cb1de49044954e21f441e9ea46b3696f21b57f" + } + } + }, + "blockbook": { + "package_name": "blockbook-ethereum-archive", + "system_user": "blockbook-ethereum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "consensusNodeVersion": "http://localhost:7516/eth/v1/node/version", + "address_aliases": true, + "eip1559Fees": true, + "alternative_estimate_fee": "infura", + "alternative_estimate_fee_params": "{\"url\": \"https://gas.api.infura.io/v3/${api_key}/networks/1/suggestedGasFees\", \"periodSeconds\": 8}", + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/ethereum_archive_consensus.json b/configs/coins/ethereum_archive_consensus.json new file mode 100644 index 0000000000..e5f1f154a1 --- /dev/null +++ b/configs/coins/ethereum_archive_consensus.json @@ -0,0 +1,48 @@ +{ + "coin": { + "name": "Ethereum Archive", + "shortcut": "ETH", + "label": "Ethereum", + "alias": "ethereum_archive_consensus", + "execution_alias": "ethereum_archive" + }, + "ports": { + "backend_rpc": 8016, + "backend_message_queue": 0, + "backend_p2p": 38316, + "backend_http": 8116, + "backend_authrpc": 8516, + "blockbook_internal": 9016, + "blockbook_public": 9116 + }, + "backend": { + "package_name": "backend-ethereum-archive-consensus", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "6.1.2", + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-amd64", + "verification_type": "sha256", + "verification_source": "45d34c817db22e34ae12ebe733d281db76a349e3be439952f9e1dd50f10bc2b1", + "extract_command": "mv ${ARCHIVE} backend/beacon-chain && chmod +x backend/beacon-chain && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/beacon-chain --mainnet --accept-terms-of-use --execution-endpoint=http://localhost:{{.Ports.BackendAuthRpc}} --grpc-gateway-port=7516 --rpc-port=7517 --monitoring-port=7518 --p2p-tcp-port=3516 --p2p-udp-port=2516 --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --jwt-secret={{.Env.BackendDataPath}}/ethereum_archive/backend/erigon/jwt.hex 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-arm64", + "verification_source": "2651f1407bb842e7f03dc00ba58990ee3345865cb5d474a3f76a968db5e57c02" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/ethereum_consensus.json b/configs/coins/ethereum_consensus.json new file mode 100644 index 0000000000..4288d87db7 --- /dev/null +++ b/configs/coins/ethereum_consensus.json @@ -0,0 +1,48 @@ +{ + "coin": { + "name": "Ethereum", + "shortcut": "ETH", + "label": "Ethereum", + "alias": "ethereum_consensus", + "execution_alias": "ethereum" + }, + "ports": { + "backend_rpc": 8036, + "backend_message_queue": 0, + "backend_p2p": 38336, + "backend_http": 8136, + "backend_authrpc": 8536, + "blockbook_internal": 9036, + "blockbook_public": 9136 + }, + "backend": { + "package_name": "backend-ethereum-consensus", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "6.1.2", + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-amd64", + "verification_type": "sha256", + "verification_source": "45d34c817db22e34ae12ebe733d281db76a349e3be439952f9e1dd50f10bc2b1", + "extract_command": "mv ${ARCHIVE} backend/beacon-chain && chmod +x backend/beacon-chain && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/beacon-chain --mainnet --accept-terms-of-use --execution-endpoint=http://localhost:{{.Ports.BackendAuthRpc}} --grpc-gateway-port=7536 --rpc-port=7537 --monitoring-port=7538 --p2p-tcp-port=3536 --p2p-udp-port=2536 --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --jwt-secret={{.Env.BackendDataPath}}/ethereum/backend/erigon/jwt.hex 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-arm64", + "verification_source": "2651f1407bb842e7f03dc00ba58990ee3345865cb5d474a3f76a968db5e57c02" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/ethereum_testnet_goerli.json b/configs/coins/ethereum_testnet_goerli.json deleted file mode 100644 index aee66db2bd..0000000000 --- a/configs/coins/ethereum_testnet_goerli.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "coin": { - "name": "Ethereum Testnet Goerli", - "shortcut": "gGOE", - "label": "Ethereum Goerli", - "alias": "ethereum_testnet_goerli" - }, - "ports": { - "backend_rpc": 18026, - "backend_message_queue": 0, - "backend_p2p": 48326, - "blockbook_internal": 19026, - "blockbook_public": 19126 - }, - "ipc": { - "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_timeout": 25 - }, - "backend": { - "package_name": "backend-ethereum-testnet-goerli", - "package_revision": "satoshilabs-1", - "system_user": "ethereum", - "version": "1.10.17-25c9b49f", - "binary_url": "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz", - "verification_type": "gpg", - "verification_source": "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [], - "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth --goerli --syncmode full --txlookuplimit 0 --ipcdisable --cache 1024 --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --port 48326 --ws --ws.addr 127.0.0.1 --ws.port {{.Ports.BackendRPC}} --ws.origins \"*\" 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", - "postinst_script_template": "", - "service_type": "simple", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "", - "client_config_file": "" - }, - "blockbook": { - "package_name": "blockbook-ethereum-testnet-goerli", - "system_user": "blockbook-ethereum", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "additional_params": { - "mempoolTxTimeoutHours": 12, - "queryBackendOnMempoolResync": false - } - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } -} diff --git a/configs/coins/ethereum_testnet_hoodi.json b/configs/coins/ethereum_testnet_hoodi.json new file mode 100644 index 0000000000..21bbee5ab7 --- /dev/null +++ b/configs/coins/ethereum_testnet_hoodi.json @@ -0,0 +1,71 @@ +{ + "coin": { + "name": "Ethereum Testnet Hoodi", + "shortcut": "tHOD", + "label": "Ethereum Hoodi", + "alias": "ethereum_testnet_hoodi" + }, + "ports": { + "backend_rpc": 18006, + "backend_message_queue": 0, + "backend_p2p": 48306, + "backend_http": 18106, + "backend_authrpc": 18506, + "blockbook_internal": 19006, + "blockbook_public": 19106 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-hoodi", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "3.2.1", + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_amd64.tar.gz", + "verification_type": "sha256", + "verification_source": "8b5444988667721f2b2ef1ab3098139c31f722492992939c110813408c39dc7c", + "extract_command": "tar -C backend --strip-components=1 -xf", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/erigon --chain hoodi --snap.keepblocks --db.size.limit 15TB --db.pagesize 16KB --prune.mode full --externalcl --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/erigon --port {{.Ports.BackendP2P}} --ws --ws.port {{.Ports.BackendRPC}} --http --http.port {{.Ports.BackendRPC}} --http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" --http.api \"eth,net,web3,debug,txpool\" --authrpc.port {{.Ports.BackendAuthRpc}} --private.api.addr \"\" --torrent.port {{.Ports.BackendHttp}} --log.dir.path {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log.dir.prefix {{.Coin.Alias}}'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_arm64.tar.gz", + "verification_source": "19a91709dc3ddbe947c4f81e70cb1de49044954e21f441e9ea46b3696f21b57f" + } + } + }, + "blockbook": { + "package_name": "blockbook-ethereum-testnet-hoodi", + "system_user": "blockbook-ethereum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 3000, + "additional_params": { + "consensusNodeVersion": "http://localhost:17506/eth/v1/node/version", + "eip1559Fees": true, + "mempoolTxTimeoutHours": 12, + "queryBackendOnMempoolResync": false + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/ethereum_testnet_hoodi_archive.json b/configs/coins/ethereum_testnet_hoodi_archive.json new file mode 100644 index 0000000000..b6c0f5a2de --- /dev/null +++ b/configs/coins/ethereum_testnet_hoodi_archive.json @@ -0,0 +1,77 @@ +{ + "coin": { + "name": "Ethereum Testnet Hoodi Archive", + "shortcut": "tHOD", + "label": "Ethereum Hoodi", + "alias": "ethereum_testnet_hoodi_archive" + }, + "ports": { + "backend_rpc": 18026, + "backend_message_queue": 0, + "backend_p2p": 48326, + "backend_http": 18126, + "backend_torrent": 18126, + "backend_authrpc": 18526, + "blockbook_internal": 19026, + "blockbook_public": 19126 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-hoodi-archive", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "3.2.1", + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_amd64.tar.gz", + "verification_type": "sha256", + "verification_source": "8b5444988667721f2b2ef1ab3098139c31f722492992939c110813408c39dc7c", + "extract_command": "tar -C backend --strip-components=1 -xf", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/erigon --chain hoodi --snap.keepblocks --db.size.limit 15TB --db.pagesize 16KB --prune.mode archive --externalcl --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/erigon --port {{.Ports.BackendP2P}} --ws --ws.port {{.Ports.BackendRPC}} --http --http.port {{.Ports.BackendRPC}} --http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" --http.api \"eth,net,web3,debug,txpool\" --authrpc.port {{.Ports.BackendAuthRpc}} --private.api.addr \"\" --torrent.port {{.Ports.BackendHttp}} --log.dir.path {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log.dir.prefix {{.Coin.Alias}}'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_arm64.tar.gz", + "verification_source": "19a91709dc3ddbe947c4f81e70cb1de49044954e21f441e9ea46b3696f21b57f" + } + } + }, + "blockbook": { + "package_name": "blockbook-ethereum-testnet-hoodi-archive", + "system_user": "blockbook-ethereum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 3000, + "additional_params": { + "consensusNodeVersion": "http://localhost:17526/eth/v1/node/version", + "address_aliases": true, + "eip1559Fees": true, + "mempoolTxTimeoutHours": 12, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates-disabled": "coingecko", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/ethereum_testnet_hoodi_archive_consensus.json b/configs/coins/ethereum_testnet_hoodi_archive_consensus.json new file mode 100644 index 0000000000..8864249adc --- /dev/null +++ b/configs/coins/ethereum_testnet_hoodi_archive_consensus.json @@ -0,0 +1,52 @@ +{ + "coin": { + "name": "Ethereum Testnet Hoodi Archive", + "shortcut": "tHOD", + "label": "Ethereum Hoodi", + "alias": "ethereum_testnet_hoodi_archive_consensus", + "execution_alias": "ethereum_testnet_hoodi_archive" + }, + "ports": { + "backend_rpc": 18026, + "backend_message_queue": 0, + "backend_p2p": 48326, + "backend_http": 18126, + "backend_authrpc": 18526, + "blockbook_internal": 19026, + "blockbook_public": 19126 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-hoodi-archive-consensus", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "6.1.2", + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-amd64", + "verification_type": "sha256", + "verification_source": "45d34c817db22e34ae12ebe733d281db76a349e3be439952f9e1dd50f10bc2b1", + "extract_command": "mv ${ARCHIVE} backend/beacon-chain && chmod +x backend/beacon-chain && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/beacon-chain --hoodi --accept-terms-of-use --execution-endpoint=http://localhost:{{.Ports.BackendAuthRpc}} --grpc-gateway-port=17526 --rpc-port=17527 --monitoring-port=17528 --p2p-tcp-port=13626 --p2p-udp-port=12626 --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --jwt-secret={{.Env.BackendDataPath}}/ethereum_testnet_hoodi_archive/backend/erigon/jwt.hex --genesis-state={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://github.com/eth-clients/hoodi/raw/main/metadata/genesis.ssz -O {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-arm64", + "verification_source": "2651f1407bb842e7f03dc00ba58990ee3345865cb5d474a3f76a968db5e57c02" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/ethereum_testnet_hoodi_consensus.json b/configs/coins/ethereum_testnet_hoodi_consensus.json new file mode 100644 index 0000000000..1c50970658 --- /dev/null +++ b/configs/coins/ethereum_testnet_hoodi_consensus.json @@ -0,0 +1,52 @@ +{ + "coin": { + "name": "Ethereum Testnet Hoodi", + "shortcut": "tHOD", + "label": "Ethereum Hoodi", + "alias": "ethereum_testnet_hoodi_consensus", + "execution_alias": "ethereum_testnet_hoodi" + }, + "ports": { + "backend_rpc": 18006, + "backend_message_queue": 0, + "backend_p2p": 48306, + "backend_http": 18106, + "backend_authrpc": 18506, + "blockbook_internal": 19006, + "blockbook_public": 19106 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-hoodi-consensus", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "6.1.2", + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-amd64", + "verification_type": "sha256", + "verification_source": "45d34c817db22e34ae12ebe733d281db76a349e3be439952f9e1dd50f10bc2b1", + "extract_command": "mv ${ARCHIVE} backend/beacon-chain && chmod +x backend/beacon-chain && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/beacon-chain --hoodi --accept-terms-of-use --execution-endpoint=http://localhost:{{.Ports.BackendAuthRpc}} --grpc-gateway-port=17506 --rpc-port=17507 --monitoring-port=17508 --p2p-tcp-port=13506 --p2p-udp-port=12506 --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --jwt-secret={{.Env.BackendDataPath}}/ethereum_testnet_hoodi/backend/erigon/jwt.hex --genesis-state={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://github.com/eth-clients/holesky/raw/main/metadata/genesis.ssz -O {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-arm64", + "verification_source": "2651f1407bb842e7f03dc00ba58990ee3345865cb5d474a3f76a968db5e57c02" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/ethereum_testnet_ropsten.json b/configs/coins/ethereum_testnet_ropsten.json deleted file mode 100644 index b4d940c200..0000000000 --- a/configs/coins/ethereum_testnet_ropsten.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "coin": { - "name": "Ethereum Testnet Ropsten", - "shortcut": "tROP", - "label": "Ethereum Ropsten", - "alias": "ethereum_testnet_ropsten" - }, - "ports": { - "backend_rpc": 18036, - "backend_message_queue": 0, - "backend_p2p": 48336, - "blockbook_internal": 19036, - "blockbook_public": 19136 - }, - "ipc": { - "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_timeout": 25 - }, - "backend": { - "package_name": "backend-ethereum-testnet-ropsten", - "package_revision": "satoshilabs-1", - "system_user": "ethereum", - "version": "1.10.17-25c9b49f", - "binary_url": "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz", - "verification_type": "gpg", - "verification_source": "https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.17-25c9b49f.tar.gz.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [], - "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/geth --ropsten --syncmode full --txlookuplimit 0 --ipcdisable --cache 1024 --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --port 48336 --ws --ws.addr 127.0.0.1 --ws.port {{.Ports.BackendRPC}} --ws.origins \"*\" 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", - "postinst_script_template": "", - "service_type": "simple", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "", - "client_config_file": "" - }, - "blockbook": { - "package_name": "blockbook-ethereum-testnet-ropsten", - "system_user": "blockbook-ethereum", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 3000, - "additional_params": { - "mempoolTxTimeoutHours": 12, - "queryBackendOnMempoolResync": false - } - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } -} diff --git a/configs/coins/ethereum_testnet_sepolia.json b/configs/coins/ethereum_testnet_sepolia.json new file mode 100644 index 0000000000..18511edbec --- /dev/null +++ b/configs/coins/ethereum_testnet_sepolia.json @@ -0,0 +1,71 @@ +{ + "coin": { + "name": "Ethereum Testnet Sepolia", + "shortcut": "tSEP", + "label": "Ethereum Sepolia", + "alias": "ethereum_testnet_sepolia" + }, + "ports": { + "backend_rpc": 18076, + "backend_message_queue": 0, + "backend_p2p": 48376, + "backend_http": 18176, + "backend_authrpc": 18576, + "blockbook_internal": 19076, + "blockbook_public": 19176 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-sepolia", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "3.2.1", + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_amd64.tar.gz", + "verification_type": "sha256", + "verification_source": "8b5444988667721f2b2ef1ab3098139c31f722492992939c110813408c39dc7c", + "extract_command": "tar -C backend --strip-components=1 -xf", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/erigon --chain sepolia --snap.keepblocks --db.size.limit 15TB --db.pagesize 16KB --prune.mode full --externalcl --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/erigon --port {{.Ports.BackendP2P}} --ws --ws.port {{.Ports.BackendRPC}} --http --http.port {{.Ports.BackendRPC}} --http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" --http.api \"eth,net,web3,debug,txpool\" --authrpc.port {{.Ports.BackendAuthRpc}} --private.api.addr \"\" --torrent.port {{.Ports.BackendHttp}} --log.dir.path {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log.dir.prefix {{.Coin.Alias}}'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_arm64.tar.gz", + "verification_source": "19a91709dc3ddbe947c4f81e70cb1de49044954e21f441e9ea46b3696f21b57f" + } + } + }, + "blockbook": { + "package_name": "blockbook-ethereum-testnet-sepolia", + "system_user": "blockbook-ethereum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 3000, + "additional_params": { + "consensusNodeVersion": "http://localhost:17576/eth/v1/node/version", + "eip1559Fees": true, + "mempoolTxTimeoutHours": 12, + "queryBackendOnMempoolResync": false + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/ethereum_testnet_sepolia_archive.json b/configs/coins/ethereum_testnet_sepolia_archive.json new file mode 100644 index 0000000000..809f3f6ce5 --- /dev/null +++ b/configs/coins/ethereum_testnet_sepolia_archive.json @@ -0,0 +1,77 @@ +{ + "coin": { + "name": "Ethereum Testnet Sepolia Archive", + "shortcut": "tSEP", + "label": "Ethereum Sepolia", + "alias": "ethereum_testnet_sepolia_archive" + }, + "ports": { + "backend_rpc": 18086, + "backend_message_queue": 0, + "backend_p2p": 48386, + "backend_http": 18186, + "backend_torrent": 18186, + "backend_authrpc": 18586, + "blockbook_internal": 19086, + "blockbook_public": 19186 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-sepolia-archive", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "3.2.1", + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_amd64.tar.gz", + "verification_type": "sha256", + "verification_source": "8b5444988667721f2b2ef1ab3098139c31f722492992939c110813408c39dc7c", + "extract_command": "tar -C backend --strip-components=1 -xf", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/erigon --chain sepolia --snap.keepblocks --db.size.limit 15TB --db.pagesize 16KB --prune.mode archive --externalcl --nat none --datadir {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/erigon --port {{.Ports.BackendP2P}} --ws --ws.port {{.Ports.BackendRPC}} --http --http.port {{.Ports.BackendRPC}} --http.addr 127.0.0.1 --http.corsdomain \"*\" --http.vhosts \"*\" --http.api \"eth,net,web3,debug,txpool\" --authrpc.port {{.Ports.BackendAuthRpc}} --private.api.addr \"\" --torrent.port {{.Ports.BackendHttp}} --log.dir.path {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --log.dir.prefix {{.Coin.Alias}}'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/erigontech/erigon/releases/download/v3.2.1/erigon_v3.2.1_linux_arm64.tar.gz", + "verification_source": "19a91709dc3ddbe947c4f81e70cb1de49044954e21f441e9ea46b3696f21b57f" + } + } + }, + "blockbook": { + "package_name": "blockbook-ethereum-testnet-sepolia-archive", + "system_user": "blockbook-ethereum", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 3000, + "additional_params": { + "consensusNodeVersion": "http://localhost:17586/eth/v1/node/version", + "address_aliases": true, + "eip1559Fees": true, + "mempoolTxTimeoutHours": 12, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates-disabled": "coingecko", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/ethereum_testnet_sepolia_archive_consensus.json b/configs/coins/ethereum_testnet_sepolia_archive_consensus.json new file mode 100644 index 0000000000..3455cc1fd6 --- /dev/null +++ b/configs/coins/ethereum_testnet_sepolia_archive_consensus.json @@ -0,0 +1,52 @@ +{ + "coin": { + "name": "Ethereum Testnet Sepolia Archive", + "shortcut": "tSEP", + "label": "Ethereum Sepolia", + "alias": "ethereum_testnet_sepolia_archive_consensus", + "execution_alias": "ethereum_testnet_sepolia_archive" + }, + "ports": { + "backend_rpc": 18086, + "backend_message_queue": 0, + "backend_p2p": 48386, + "backend_http": 18186, + "backend_authrpc": 18586, + "blockbook_internal": 19086, + "blockbook_public": 19186 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-sepolia-archive-consensus", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "6.1.2", + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-amd64", + "verification_type": "sha256", + "verification_source": "45d34c817db22e34ae12ebe733d281db76a349e3be439952f9e1dd50f10bc2b1", + "extract_command": "mv ${ARCHIVE} backend/beacon-chain && chmod +x backend/beacon-chain && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/beacon-chain --sepolia --accept-terms-of-use --execution-endpoint=http://localhost:{{.Ports.BackendAuthRpc}} --grpc-gateway-port=17586 --rpc-port=17587 --monitoring-port=17548 --p2p-tcp-port=13676 --p2p-udp-port=12676 --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --jwt-secret={{.Env.BackendDataPath}}/ethereum_testnet_sepolia_archive/backend/erigon/jwt.hex --genesis-state={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://github.com/eth-clients/sepolia/raw/main/metadata/genesis.ssz -O {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-arm64", + "verification_source": "2651f1407bb842e7f03dc00ba58990ee3345865cb5d474a3f76a968db5e57c02" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/ethereum_testnet_sepolia_consensus.json b/configs/coins/ethereum_testnet_sepolia_consensus.json new file mode 100644 index 0000000000..b26f323e3c --- /dev/null +++ b/configs/coins/ethereum_testnet_sepolia_consensus.json @@ -0,0 +1,52 @@ +{ + "coin": { + "name": "Ethereum Testnet Sepolia", + "shortcut": "tSEP", + "label": "Ethereum Sepolia", + "alias": "ethereum_testnet_sepolia_consensus", + "execution_alias": "ethereum_testnet_sepolia" + }, + "ports": { + "backend_rpc": 18076, + "backend_message_queue": 0, + "backend_p2p": 48376, + "backend_http": 18176, + "backend_authrpc": 18576, + "blockbook_internal": 19076, + "blockbook_public": 19176 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-ethereum-testnet-sepolia-consensus", + "package_revision": "satoshilabs-1", + "system_user": "ethereum", + "version": "6.1.2", + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-amd64", + "verification_type": "sha256", + "verification_source": "45d34c817db22e34ae12ebe733d281db76a349e3be439952f9e1dd50f10bc2b1", + "extract_command": "mv ${ARCHIVE} backend/beacon-chain && chmod +x backend/beacon-chain && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/beacon-chain --sepolia --accept-terms-of-use --execution-endpoint=http://localhost:{{.Ports.BackendAuthRpc}} --grpc-gateway-port=17576 --rpc-port=17577 --monitoring-port=17578 --p2p-tcp-port=13576 --p2p-udp-port=12576 --datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend --jwt-secret={{.Env.BackendDataPath}}/ethereum_testnet_sepolia/backend/erigon/jwt.hex --genesis-state={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz 2>>{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://github.com/eth-clients/holesky/raw/main/metadata/genesis.ssz -O {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/genesis.ssz", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/OffchainLabs/prysm/releases/download/v6.1.2/beacon-chain-v6.1.2-linux-arm64", + "verification_source": "2651f1407bb842e7f03dc00ba58990ee3345865cb5d474a3f76a968db5e57c02" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/firo.json b/configs/coins/firo.json index 281b0c0edd..26458b3ed4 100644 --- a/configs/coins/firo.json +++ b/configs/coins/firo.json @@ -22,72 +22,15 @@ "package_name": "backend-firo", "package_revision": "satoshilabs-1", "system_user": "firo", - "version": "0.14.9.1", - "binary_url": "https://github.com/firoorg/firo/releases/download/v0.14.9.1/firo-0.14.9.1-linux64.tar.gz", + "version": "0.14.15.0", + "binary_url": "https://github.com/firoorg/firo/releases/download/v0.14.15.0/firo-0.14.15.0-linux64.tar.gz", "verification_type": "sha256", - "verification_source": "6384cc13ba193df3d44d2923b20fa562061b4e204ff8e0180147575fc3a1a588", + "verification_source": "6a601e7c1aa0af4aee3b28a7fbd365a1d749d2203e8d042bcccf9f950072ecd9", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ - "bin/tor", - "bin/tor-gencert", - "bin/torify", - "bin/tor-print-ed-signing-cert", - "bin/tor-resolve", "bin/firo-qt", "bin/firo-tx", - "etc/tor/torrc.sample", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/cmake/relic-config.cmake", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/aggregationinfo.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/bls.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/chaincode.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/extendedprivatekey.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/extendedpublickey.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/privatekey.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/publickey.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/signature.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/test-utils.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/chiabls/util.hpp", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/low/relic_bn_low.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/low/relic_dv_low.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/low/relic_fb_low.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/low/relic_fp_low.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/low/relic_fpx_low.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_arch.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_bc.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_bench.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_bn.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_conf.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_core.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_cp.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_dv.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_eb.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_ec.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_ed.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_ep.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_epx.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_err.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_fb.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_fbx.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_fp.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_fpx.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_label.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_md.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_pc.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_pool.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_pp.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_rand.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_test.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_trace.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_types.h", - "home/ubuntu/build/firo/depends/x86_64-linux-gnu/include/relic_util.h", - "include/bitcoinconsensus.h", - "lib/libbitcoinconsensus.so", - "lib/libbitcoinconsensus.so.0", - "lib/libbitcoinconsensus.so.0.0.0", - "README.md", - "share/tor/geoip", - "share/tor/geoip6" + "README.md" ], "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/firod -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", @@ -122,4 +65,4 @@ "package_maintainer": "Putta Khunchalee", "package_maintainer_email": "putta@zcoin.io" } -} \ No newline at end of file +} diff --git a/configs/coins/flux.json b/configs/coins/flux.json index 887f8fa8a9..3bafdcf074 100644 --- a/configs/coins/flux.json +++ b/configs/coins/flux.json @@ -22,10 +22,10 @@ "package_name": "backend-flux", "package_revision": "satoshilabs-1", "system_user": "flux", - "version": "6.0.0", - "binary_url": "https://github.com/RunOnFlux/fluxd/releases/download/v6.0.0/Flux-amd64-v6.0.0.tar.gz", + "version": "9.0.0", + "binary_url": "https://github.com/RunOnFlux/fluxd/releases/download/v9.0.0/Flux-amd64-v9.0.0.tar.gz", "verification_type": "sha256", - "verification_source": "28717246a383018de8f6099a26afc3a4877da32f2d9531a3253b1664c22145e7", + "verification_source": "3d37ad5c769195c9ce6d6d0ee613eb9852de0cb9ee3779c9da7d9f9e51cd285e", "extract_command": "tar -C backend -xf", "exclude_files": [], "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/fluxd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", @@ -39,10 +39,12 @@ "client_config_file": "bitcoin_like_client.conf", "additional_params": { "addnode": [ - "explorer.zel.cash", - "explorer2.zel.cash", - "explorer.zelcash.online", - "explorer-asia.zel.cash" + "explorer.runonflux.com", + "explorer.runonflux.io", + "blockbook.runonflux.com", + "blockbook.runonflux.io", + "explorer.flux.zelcore.io", + "blockbook.flux.zelcore.io" ] } }, diff --git a/configs/coins/fujicoin.json b/configs/coins/fujicoin.json index ce2d086d14..82343c654f 100644 --- a/configs/coins/fujicoin.json +++ b/configs/coins/fujicoin.json @@ -1,72 +1,71 @@ { - "coin": { - "name": "Fujicoin", - "shortcut": "FJC", - "label": "Fujicoin", - "alias": "fujicoin" - }, - "ports": { - "backend_rpc": 8048, - "backend_message_queue": 38348, - "blockbook_internal": 9048, - "blockbook_public": 9148 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-fujicoin", - "package_revision": "satoshilabs-1", - "system_user": "fujicoin", - "version": "22.0", - "binary_url": "https://download.fujicoin.org/fujicoin-v22.0/x86_64-linux-gnu/fujicoin-22.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "8aa699f3fbd6681391b90f744a25155d21a94f5ca63d6cc3b85172f3aca6e2a0", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/fujicoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/fujicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee" + "coin": { + "name": "Fujicoin", + "shortcut": "FJC", + "label": "Fujicoin", + "alias": "fujicoin" + }, + "ports": { + "backend_rpc": 8048, + "backend_message_queue": 38348, + "blockbook_internal": 9048, + "blockbook_public": 9148 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-fujicoin", + "package_revision": "satoshilabs-1", + "system_user": "fujicoin", + "version": "22.0", + "binary_url": "https://download.fujicoin.org/fujicoin-v22.0/x86_64-linux-gnu/fujicoin-22.0-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "8aa699f3fbd6681391b90f744a25155d21a94f5ca63d6cc3b85172f3aca6e2a0", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/fujicoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/fujicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + } + }, + "blockbook": { + "package_name": "blockbook-fujicoin", + "system_user": "blockbook-fujicoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "slip44": 75, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"fujicoin\", \"periodSeconds\": 600}" + } + } + }, + "meta": { + "package_maintainer": "Motty", + "package_maintainer_email": "fujicoin@gmail.com" } - }, - "blockbook": { - "package_name": "blockbook-fujicoin", - "system_user": "blockbook-fujicoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "slip44": 75, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"fujicoin\", \"periodSeconds\": 600}" - } - } - }, - "meta": { - "package_maintainer": "Motty", - "package_maintainer_email": "fujicoin@gmail.com" - } -} \ No newline at end of file +} diff --git a/configs/coins/groestlcoin.json b/configs/coins/groestlcoin.json index cfad624fdc..367a2071c6 100644 --- a/configs/coins/groestlcoin.json +++ b/configs/coins/groestlcoin.json @@ -1,73 +1,83 @@ { - "coin": { - "name": "Groestlcoin", - "shortcut": "GRS", - "label": "Groestlcoin", - "alias": "groestlcoin" - }, - "ports": { - "backend_rpc": 8045, - "backend_message_queue": 38345, - "blockbook_internal": 9045, - "blockbook_public": 9145 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-groestlcoin", - "package_revision": "satoshilabs-1", - "system_user": "groestlcoin", - "version": "22.0", - "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v22.0/groestlcoin-22.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "b30c5353dd3d9cfd7e8b31f29eac125925751165f690bacff57effd76560dddd", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/groestlcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee", - "whitelist": "127.0.0.1" + "coin": { + "name": "Groestlcoin", + "shortcut": "GRS", + "label": "Groestlcoin", + "alias": "groestlcoin" + }, + "ports": { + "backend_rpc": 8045, + "backend_message_queue": 38345, + "blockbook_internal": 9045, + "blockbook_public": 9145 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-groestlcoin", + "package_revision": "satoshilabs-1", + "system_user": "groestlcoin", + "version": "29.0", + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "e0b3e3d96caf908060779c0d9964c777ccc4b7364af54404ff1768e018e56768", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/groestlcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-aarch64-linux-gnu.tar.gz", + "verification_source": "43b67b0945eb63c26bf0106ce3e302d4fe0720900cd8658e84f5d7954899a2a8" + } + } + }, + "blockbook": { + "package_name": "blockbook-groestlcoin", + "system_user": "blockbook-groestlcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-enablesubnewtx -extendedindex", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "slip44": 17, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"groestlcoin\", \"periodSeconds\": 900}", + "block_golomb_filter_p": 20, + "block_filter_scripts": "taproot-noordinals", + "block_filter_use_zeroed_key": true, + "mempool_golomb_filter_p": 20, + "mempool_filter_scripts": "taproot", + "mempool_filter_use_zeroed_key": false + } + } + }, + "meta": { + "package_maintainer": "Groestlcoin Development Team", + "package_maintainer_email": "jackie@groestlcoin.org" } - }, - "blockbook": { - "package_name": "blockbook-groestlcoin", - "system_user": "blockbook-groestlcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "slip44": 17, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Groestlcoin Development Team", - "package_maintainer_email": "jackie@groestlcoin.org" - } } diff --git a/configs/coins/groestlcoin_regtest.json b/configs/coins/groestlcoin_regtest.json index cf5f434299..4d6ae18c80 100644 --- a/configs/coins/groestlcoin_regtest.json +++ b/configs/coins/groestlcoin_regtest.json @@ -1,73 +1,73 @@ { - "coin": { - "name": "Groestlcoin Regtest", - "shortcut": "rGRS", - "label": "Groestlcoin Regtest", - "alias": "groestlcoin_regtest" - }, - "ports": { - "backend_rpc": 18046, - "backend_message_queue": 48346, - "blockbook_internal": 19046, - "blockbook_public": 19146 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-groestlcoin-regtest", - "package_revision": "satoshilabs-1", - "system_user": "groestlcoin", - "version": "22.0", - "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v22.0/groestlcoin-22.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "b30c5353dd3d9cfd7e8b31f29eac125925751165f690bacff57effd76560dddd", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/groestlcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/regtest/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin_regtest.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee", - "whitelist": "127.0.0.1" + "coin": { + "name": "Groestlcoin Regtest", + "shortcut": "rGRS", + "label": "Groestlcoin Regtest", + "alias": "groestlcoin_regtest" + }, + "ports": { + "backend_rpc": 18046, + "backend_message_queue": 48346, + "blockbook_internal": 19046, + "blockbook_public": 19146 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-groestlcoin-regtest", + "package_revision": "satoshilabs-1", + "system_user": "groestlcoin", + "version": "29.0", + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "e0b3e3d96caf908060779c0d9964c777ccc4b7364af54404ff1768e018e56768", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/groestlcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/regtest/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "mainnet": false, + "protect_memory": true, + "server_config_file": "bitcoin_regtest.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-aarch64-linux-gnu.tar.gz", + "verification_source": "43b67b0945eb63c26bf0106ce3e302d4fe0720900cd8658e84f5d7954899a2a8" + } + } + }, + "blockbook": { + "package_name": "blockbook-groestlcoin-regtest", + "system_user": "blockbook-groestlcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "Groestlcoin Development Team", + "package_maintainer_email": "jackie@groestlcoin.org" } - }, - "blockbook": { - "package_name": "blockbook-groestlcoin-regtest", - "system_user": "blockbook-groestlcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Groestlcoin Development Team", - "package_maintainer_email": "jackie@groestlcoin.org" - } } diff --git a/configs/coins/groestlcoin_signet.json b/configs/coins/groestlcoin_signet.json index 36ef6266c3..2125aa4109 100644 --- a/configs/coins/groestlcoin_signet.json +++ b/configs/coins/groestlcoin_signet.json @@ -1,73 +1,73 @@ { - "coin": { - "name": "Groestlcoin Signet", - "shortcut": "sGRS", - "label": "Groestlcoin Signet", - "alias": "groestlcoin_signet" - }, - "ports": { - "backend_rpc": 18047, - "backend_message_queue": 48347, - "blockbook_internal": 19047, - "blockbook_public": 19147 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-groestlcoin-signet", - "package_revision": "satoshilabs-1", - "system_user": "groestlcoin", - "version": "22.0", - "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v22.0/groestlcoin-22.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "b30c5353dd3d9cfd7e8b31f29eac125925751165f690bacff57effd76560dddd", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/groestlcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/signet/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin-signet.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee", - "whitelist": "127.0.0.1" + "coin": { + "name": "Groestlcoin Signet", + "shortcut": "sGRS", + "label": "Groestlcoin Signet", + "alias": "groestlcoin_signet" + }, + "ports": { + "backend_rpc": 18047, + "backend_message_queue": 48347, + "blockbook_internal": 19047, + "blockbook_public": 19147 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-groestlcoin-signet", + "package_revision": "satoshilabs-1", + "system_user": "groestlcoin", + "version": "29.0", + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "e0b3e3d96caf908060779c0d9964c777ccc4b7364af54404ff1768e018e56768", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/groestlcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/signet/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin_signet.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-aarch64-linux-gnu.tar.gz", + "verification_source": "43b67b0945eb63c26bf0106ce3e302d4fe0720900cd8658e84f5d7954899a2a8" + } + } + }, + "blockbook": { + "package_name": "blockbook-groestlcoin-signet", + "system_user": "blockbook-groestlcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "Groestlcoin Development Team", + "package_maintainer_email": "jackie@groestlcoin.org" } - }, - "blockbook": { - "package_name": "blockbook-groestlcoin-signet", - "system_user": "blockbook-groestlcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Groestlcoin Development Team", - "package_maintainer_email": "jackie@groestlcoin.org" - } } diff --git a/configs/coins/groestlcoin_testnet.json b/configs/coins/groestlcoin_testnet.json index c0daa35bc5..2b0e15aaec 100644 --- a/configs/coins/groestlcoin_testnet.json +++ b/configs/coins/groestlcoin_testnet.json @@ -1,73 +1,80 @@ { - "coin": { - "name": "Groestlcoin Testnet", - "shortcut": "tGRS", - "label": "Groestlcoin Testnet", - "alias": "groestlcoin_testnet" - }, - "ports": { - "backend_rpc": 18045, - "backend_message_queue": 48345, - "blockbook_internal": 19045, - "blockbook_public": 19145 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-groestlcoin-testnet", - "package_revision": "satoshilabs-1", - "system_user": "groestlcoin", - "version": "22.0", - "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v22.0/groestlcoin-22.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "b30c5353dd3d9cfd7e8b31f29eac125925751165f690bacff57effd76560dddd", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/groestlcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_client.conf", - "additional_params": { - "deprecatedrpc": "estimatefee", - "whitelist": "127.0.0.1" + "coin": { + "name": "Groestlcoin Testnet", + "shortcut": "tGRS", + "label": "Groestlcoin Testnet", + "alias": "groestlcoin_testnet" + }, + "ports": { + "backend_rpc": 18045, + "backend_message_queue": 48345, + "blockbook_internal": 19045, + "blockbook_public": 19145 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-groestlcoin-testnet", + "package_revision": "satoshilabs-1", + "system_user": "groestlcoin", + "version": "29.0", + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "e0b3e3d96caf908060779c0d9964c777ccc4b7364af54404ff1768e018e56768", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/groestlcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/groestlcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin.conf", + "client_config_file": "bitcoin_client.conf", + "additional_params": { + "deprecatedrpc": "estimatefee" + }, + "platforms": { + "arm64": { + "binary_url": "https://github.com/Groestlcoin/groestlcoin/releases/download/v29.0/groestlcoin-29.0-aarch64-linux-gnu.tar.gz", + "verification_source": "43b67b0945eb63c26bf0106ce3e302d4fe0720900cd8658e84f5d7954899a2a8" + } + } + }, + "blockbook": { + "package_name": "blockbook-groestlcoin-testnet", + "system_user": "blockbook-groestlcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-enablesubnewtx -extendedindex", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": { + "block_golomb_filter_p": 20, + "block_filter_scripts": "taproot-noordinals", + "block_filter_use_zeroed_key": true, + "mempool_golomb_filter_p": 20, + "mempool_filter_scripts": "taproot", + "mempool_filter_use_zeroed_key": false + } + } + }, + "meta": { + "package_maintainer": "Groestlcoin Development Team", + "package_maintainer_email": "jackie@groestlcoin.org" } - }, - "blockbook": { - "package_name": "blockbook-groestlcoin-testnet", - "system_user": "blockbook-groestlcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"groestlcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Groestlcoin Development Team", - "package_maintainer_email": "jackie@groestlcoin.org" - } } diff --git a/configs/coins/litecoin.json b/configs/coins/litecoin.json index 0e580e42a8..026665c1df 100644 --- a/configs/coins/litecoin.json +++ b/configs/coins/litecoin.json @@ -1,72 +1,77 @@ { - "coin": { - "name": "Litecoin", - "shortcut": "LTC", - "label": "Litecoin", - "alias": "litecoin" - }, - "ports": { - "backend_rpc": 8034, - "backend_message_queue": 38334, - "blockbook_internal": 9034, - "blockbook_public": 9134 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-litecoin", - "package_revision": "satoshilabs-1", - "system_user": "litecoin", - "version": "0.21.2", - "binary_url": "https://download.litecoin.org/litecoin-0.21.2/linux/litecoin-0.21.2-x86_64-linux-gnu.tar.gz", - "verification_type": "gpg", - "verification_source": "https://download.litecoin.org/litecoin-0.21.2/linux/litecoin-0.21.2-x86_64-linux-gnu.tar.gz.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/litecoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/litecoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "Litecoin", + "shortcut": "LTC", + "label": "Litecoin", + "alias": "litecoin" + }, + "ports": { + "backend_rpc": 8034, + "backend_message_queue": 38334, + "blockbook_internal": 9034, + "blockbook_public": 9134 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-litecoin", + "package_revision": "satoshilabs-1", + "system_user": "litecoin", + "version": "0.21.4", + "binary_url": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-x86_64-linux-gnu.tar.gz", + "verification_type": "gpg", + "verification_source": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-x86_64-linux-gnu.tar.gz.asc", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/litecoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/litecoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + }, + "platforms": { + "arm64": { + "binary_url": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-aarch64-linux-gnu.tar.gz", + "verification_source": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-aarch64-linux-gnu.tar.gz.asc" + } + } + }, + "blockbook": { + "package_name": "blockbook-litecoin", + "system_user": "blockbook-litecoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 27108450, + "xpub_magic_segwit_p2sh": 28471030, + "xpub_magic_segwit_native": 78792518, + "slip44": 2, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"litecoin\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-litecoin", - "system_user": "blockbook-litecoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 27108450, - "xpub_magic_segwit_p2sh": 28471030, - "xpub_magic_segwit_native": 78792518, - "slip44": 2, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"litecoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/litecoin_testnet.json b/configs/coins/litecoin_testnet.json index 3293eb3069..0d0962b344 100644 --- a/configs/coins/litecoin_testnet.json +++ b/configs/coins/litecoin_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-litecoin-testnet", "package_revision": "satoshilabs-1", "system_user": "litecoin", - "version": "0.21.2", - "binary_url": "https://download.litecoin.org/litecoin-0.21.2/linux/litecoin-0.21.2-x86_64-linux-gnu.tar.gz", + "version": "0.21.4", + "binary_url": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-x86_64-linux-gnu.tar.gz", "verification_type": "gpg", - "verification_source": "https://download.litecoin.org/litecoin-0.21.2/linux/litecoin-0.21.2-x86_64-linux-gnu.tar.gz.asc", + "verification_source": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-x86_64-linux-gnu.tar.gz.asc", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/litecoin-qt" @@ -41,6 +41,12 @@ "client_config_file": "bitcoin_like_client.conf", "additional_params": { "whitelist": "127.0.0.1" + }, + "platforms": { + "arm64": { + "binary_url": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-aarch64-linux-gnu.tar.gz", + "verification_source": "https://download.litecoin.org/litecoin-0.21.4/linux/litecoin-0.21.4-aarch64-linux-gnu.tar.gz.asc" + } } }, "blockbook": { diff --git a/configs/coins/monacoin.json b/configs/coins/monacoin.json index bda3dfded1..39bbaba0e6 100644 --- a/configs/coins/monacoin.json +++ b/configs/coins/monacoin.json @@ -1,72 +1,71 @@ { - "coin": { - "name": "Monacoin", - "shortcut": "MONA", - "label": "Monacoin", - "alias": "monacoin" - }, - "ports": { - "backend_rpc": 8041, - "backend_message_queue": 38341, - "blockbook_internal": 9041, - "blockbook_public": 9141 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-monacoin", - "package_revision": "satoshilabs-1", - "system_user": "monacoin", - "version": "0.20.2", - "binary_url": "https://github.com/monacoinproject/monacoin/releases/download/v0.20.2/monacoin-0.20.2-x86_64-linux-gnu.tar.gz", - "verification_type": "gpg-sha256", - "verification_source": "https://github.com/monacoinproject/monacoin/releases/download/v0.20.2/monacoin-0.20.2-signatures.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/monacoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/monacoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "Monacoin", + "shortcut": "MONA", + "label": "Monacoin", + "alias": "monacoin" + }, + "ports": { + "backend_rpc": 8041, + "backend_message_queue": 38341, + "blockbook_internal": 9041, + "blockbook_public": 9141 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-monacoin", + "package_revision": "satoshilabs-1", + "system_user": "monacoin", + "version": "0.20.4", + "binary_url": "https://github.com/monacoinproject/monacoin/releases/download/v0.20.4/monacoin-0.20.4-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "94f8fe7400d23a9bad10af3dfc3f800e333be0aa4d61e5c8cfc5f338253d9451", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/monacoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/monacoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-monacoin", + "system_user": "blockbook-monacoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "slip44": 22, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"monacoin\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "wakiyamap", + "package_maintainer_email": "wakiyamap@gmail.com" } - }, - "blockbook": { - "package_name": "blockbook-monacoin", - "system_user": "blockbook-monacoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "slip44": 22, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"monacoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "wakiyamap", - "package_maintainer_email": "wakiyamap@gmail.com" - } } diff --git a/configs/coins/monacoin_testnet.json b/configs/coins/monacoin_testnet.json index d3fe2e355f..46d5826449 100644 --- a/configs/coins/monacoin_testnet.json +++ b/configs/coins/monacoin_testnet.json @@ -1,69 +1,69 @@ { - "coin": { - "name": "Monacoin Testnet", - "shortcut": "TMONA", - "label": "Monacoin Testnet", - "alias": "monacoin_testnet" - }, - "ports": { - "backend_rpc": 18041, - "backend_message_queue": 48341, - "blockbook_internal": 19041, - "blockbook_public": 19141 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-monacoin-testnet", - "package_revision": "satoshilabs-1", - "system_user": "monacoin", - "version": "0.20.2", - "binary_url": "https://github.com/monacoinproject/monacoin/releases/download/v0.20.2/monacoin-0.20.2-x86_64-linux-gnu.tar.gz", - "verification_type": "gpg-sha256", - "verification_source": "https://github.com/monacoinproject/monacoin/releases/download/v0.20.2/monacoin-0.20.2-signatures.asc", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/monacoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/monacoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "Monacoin Testnet", + "shortcut": "TMONA", + "label": "Monacoin Testnet", + "alias": "monacoin_testnet" + }, + "ports": { + "backend_rpc": 18041, + "backend_message_queue": 48341, + "blockbook_internal": 19041, + "blockbook_public": 19141 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-monacoin-testnet", + "package_revision": "satoshilabs-1", + "system_user": "monacoin", + "version": "0.20.4", + "binary_url": "https://github.com/monacoinproject/monacoin/releases/download/v0.20.4/monacoin-0.20.4-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "94f8fe7400d23a9bad10af3dfc3f800e333be0aa4d61e5c8cfc5f338253d9451", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": [ + "bin/monacoin-qt" + ], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/monacoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-monacoin-testnet", + "system_user": "blockbook-monacoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70617039, + "xpub_magic_segwit_p2sh": 71979618, + "xpub_magic_segwit_native": 73342198, + "slip44": 1, + "additional_params": {} + } + }, + "meta": { + "package_maintainer": "wakiyamap", + "package_maintainer_email": "wakiyamap@gmail.com" } - }, - "blockbook": { - "package_name": "blockbook-monacoin-testnet", - "system_user": "blockbook-monacoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70617039, - "xpub_magic_segwit_p2sh": 71979618, - "xpub_magic_segwit_native": 73342198, - "slip44": 1, - "additional_params": {} - } - }, - "meta": { - "package_maintainer": "wakiyamap", - "package_maintainer_email": "wakiyamap@gmail.com" - } } diff --git a/configs/coins/namecoin.json b/configs/coins/namecoin.json index 58e66f6b15..e18f571169 100644 --- a/configs/coins/namecoin.json +++ b/configs/coins/namecoin.json @@ -1,77 +1,74 @@ { - "coin": { - "name": "Namecoin", - "shortcut": "NMC", - "label": "Namecoin", - "alias": "namecoin" - }, - "ports": { - "backend_rpc": 8039, - "backend_message_queue": 38339, - "blockbook_internal": 9039, - "blockbook_public": 9139 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-namecoin", - "package_revision": "satoshilabs-1", - "system_user": "namecoin", - "version": "0.21.0.1", - "binary_url": "https://www.namecoin.org/files/namecoin-core/namecoin-core-0.21.0.1/namecoin-nc0.21.0.1-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "1e7f06030881fac5b8a6d33f497f1cab9a120189741ec81bc21e58d5cd93fa6f", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/namecoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/namecoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "addnode": [ - "45.24.110.177:8334" - ], - "discover": 0, - "listenonion": 0, - "upnp": 0, - "whitelist": "127.0.0.1", - "whitelistrelay": 1 + "coin": { + "name": "Namecoin", + "shortcut": "NMC", + "label": "Namecoin", + "alias": "namecoin" + }, + "ports": { + "backend_rpc": 8039, + "backend_message_queue": 38339, + "blockbook_internal": 9039, + "blockbook_public": 9139 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-namecoin", + "package_revision": "satoshilabs-1", + "system_user": "namecoin", + "version": "0.21.0.1", + "binary_url": "https://www.namecoin.org/files/namecoin-core/namecoin-core-0.21.0.1/namecoin-nc0.21.0.1-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "1e7f06030881fac5b8a6d33f497f1cab9a120189741ec81bc21e58d5cd93fa6f", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/namecoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/namecoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "addnode": ["45.24.110.177:8334"], + "discover": 0, + "listenonion": 0, + "upnp": 0, + "whitelist": "127.0.0.1", + "whitelistrelay": 1 + } + }, + "blockbook": { + "package_name": "blockbook-namecoin", + "system_user": "blockbook-namecoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "slip44": 7, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"namecoin\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT Admin", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-namecoin", - "system_user": "blockbook-namecoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "slip44": 7, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"namecoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT Admin", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/omotenashicoin.json b/configs/coins/omotenashicoin.json index 4d3c9b3cd8..d630bf6587 100644 --- a/configs/coins/omotenashicoin.json +++ b/configs/coins/omotenashicoin.json @@ -1,70 +1,69 @@ { "coin": { "name": "Omotenashicoin", - "shortcut": "MTNS", - "label": "Omotenashicoin", - "alias": "omotenashicoin" + "shortcut": "MTNS", + "label": "Omotenashicoin", + "alias": "omotenashicoin" }, - "ports": { - "blockbook_internal": 9094, - "blockbook_public": 9194, - "backend_rpc": 8094, - "backend_message_queue": 38394 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "mtnsrpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-mtns", - "package_revision": "satoshilabs-1", - "system_user": "mtns", - "version": "1.7.3", - "binary_url": "https://github.com/omotenashicoin-project/OmotenashiCoin-HDwalletbinaries/raw/master/stable/omotenashicoin-x86_64-linux-gnu.tar.gz", - "verification_type": "", - "verification_source": "", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/omotenashicoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/omotenashicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": false, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", + "ports": { + "blockbook_internal": 9094, + "blockbook_public": 9194, + "backend_rpc": 8094, + "backend_message_queue": 38394 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "mtnsrpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-mtns", + "package_revision": "satoshilabs-1", + "system_user": "mtns", + "version": "1.7.3", + "binary_url": "https://github.com/omotenashicoin-project/OmotenashiCoin-HDwalletbinaries/raw/master/stable/omotenashicoin-x86_64-linux-gnu.tar.gz", + "verification_type": "", + "verification_source": "", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/omotenashicoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/omotenashicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": false, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-mtns", + "system_user": "blockbook-mtns", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 61052245, + "slip44": 341, "additional_params": { - "whitelist": "127.0.0.1" - } - }, - "blockbook": { - "package_name": "blockbook-mtns", - "system_user": "blockbook-mtns", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 61052245, - "slip44": 341, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"omotenashicoin\", \"periodSeconds\": 60}" - } + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"omotenashicoin\", \"periodSeconds\": 900}" } - }, - "meta": { - "package_maintainer": "omotenashicoin dev", - "package_maintainer_email": "git@omotenashicoin.site" } + }, + "meta": { + "package_maintainer": "omotenashicoin dev", + "package_maintainer_email": "git@omotenashicoin.site" + } } diff --git a/configs/coins/omotenashicoin_testnet.json b/configs/coins/omotenashicoin_testnet.json index bd14828fa8..993d3abe34 100644 --- a/configs/coins/omotenashicoin_testnet.json +++ b/configs/coins/omotenashicoin_testnet.json @@ -1,70 +1,64 @@ { - "coin": { - "name": "Omotenashicoin Testnet", - "shortcut": "tMTNS", - "label": "Omotenashicoin Testnet", - "alias": "omotenashicoin_testnet" - }, - "ports": { - "blockbook_internal": 19089, - "blockbook_public": 19189, - "backend_rpc": 18089, - "backend_message_queue": 48389 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "mtnsrpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-mtns-testnet", - "package_revision": "satoshilabs-1", - "system_user": "mtns", - "version": "1.7.3", - "binary_url": "https://github.com/omotenashicoin-project/OmotenashiCoin-HDwalletbinaries/raw/master/stable/omotenashicoin-x86_64-linux-gnu.tar.gz", - "verification_type": "", - "verification_source": "", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/omotenashicoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/omotenashicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": false, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" - } - }, - "blockbook": { - "package_name": "blockbook-mtns-testnet", - "system_user": "blockbook-mtns", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 70544129, - "slip44": 1, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"omotenashicoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "omotenashicoin dev", - "package_maintainer_email": "git@omotenashicoin.site" - } + "coin": { + "name": "Omotenashicoin Testnet", + "shortcut": "tMTNS", + "label": "Omotenashicoin Testnet", + "alias": "omotenashicoin_testnet" + }, + "ports": { + "blockbook_internal": 19089, + "blockbook_public": 19189, + "backend_rpc": 18089, + "backend_message_queue": 48389 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "mtnsrpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-mtns-testnet", + "package_revision": "satoshilabs-1", + "system_user": "mtns", + "version": "1.7.3", + "binary_url": "https://github.com/omotenashicoin-project/OmotenashiCoin-HDwalletbinaries/raw/master/stable/omotenashicoin-x86_64-linux-gnu.tar.gz", + "verification_type": "", + "verification_source": "", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/omotenashicoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/omotenashicoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": false, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-mtns-testnet", + "system_user": "blockbook-mtns", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 70544129, + "slip44": 1 + } + }, + "meta": { + "package_maintainer": "omotenashicoin dev", + "package_maintainer_email": "git@omotenashicoin.site" + } } diff --git a/configs/coins/optimism.json b/configs/coins/optimism.json new file mode 100644 index 0000000000..bc7cc8868f --- /dev/null +++ b/configs/coins/optimism.json @@ -0,0 +1,67 @@ +{ + "coin": { + "name": "Optimism", + "shortcut": "ETH", + "network": "OP", + "label": "Optimism", + "alias": "optimism" + }, + "ports": { + "backend_rpc": 8200, + "backend_p2p": 38400, + "backend_http": 8300, + "backend_authrpc": 8400, + "blockbook_internal": 9200, + "blockbook_public": 9300 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-optimism", + "package_revision": "satoshilabs-1", + "system_user": "optimism", + "version": "1.101315.1", + "binary_url": "https://github.com/ethereum-optimism/op-geth/archive/refs/tags/v1.101315.1.tar.gz", + "verification_type": "sha256", + "verification_source": "f0f31ef2982f87f9e3eb90f2b603f5fcd9d680e487d35f5bdcf5aeba290b153f", + "extract_command": "mkdir backend/source && tar -C backend/source --strip 1 -xf v1.101315.1.tar.gz && cd backend/source && make geth && mv build/bin/geth ../ && rm -rf ../source && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/optimism_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "optimism.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-optimism", + "system_user": "blockbook-optimism", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"optimistic-ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/optimism_archive.json b/configs/coins/optimism_archive.json new file mode 100644 index 0000000000..3ae0e9d9d9 --- /dev/null +++ b/configs/coins/optimism_archive.json @@ -0,0 +1,72 @@ +{ + "coin": { + "name": "Optimism Archive", + "shortcut": "ETH", + "network": "OP", + "label": "Optimism", + "alias": "optimism_archive" + }, + "ports": { + "backend_rpc": 8202, + "backend_p2p": 38402, + "backend_http": 8302, + "backend_authrpc": 8402, + "blockbook_internal": 9202, + "blockbook_public": 9302 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-optimism-archive", + "package_revision": "satoshilabs-1", + "system_user": "optimism", + "version": "1.101315.1", + "binary_url": "https://github.com/ethereum-optimism/op-geth/archive/refs/tags/v1.101315.1.tar.gz", + "verification_type": "sha256", + "verification_source": "f0f31ef2982f87f9e3eb90f2b603f5fcd9d680e487d35f5bdcf5aeba290b153f", + "extract_command": "mkdir backend/source && tar -C backend/source --strip 1 -xf v1.101315.1.tar.gz && cd backend/source && make geth && mv build/bin/geth ../ && rm -rf ../source && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/optimism_archive_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "optimism_archive.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "openssl rand -hex 32 > {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/jwtsecret", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "blockbook": { + "package_name": "blockbook-optimism-archive", + "system_user": "blockbook-optimism", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "eip1559Fees": true, + "alternative_estimate_fee": "infura", + "alternative_estimate_fee_params": "{\"url\": \"https://gas.api.infura.io/v3/${api_key}/networks/10/suggestedGasFees\", \"periodSeconds\": 20}", + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"ethereum\",\"platformIdentifier\": \"optimistic-ethereum\",\"platformVsCurrency\": \"eth\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/optimism_archive_legacy_geth.json b/configs/coins/optimism_archive_legacy_geth.json new file mode 100644 index 0000000000..7a9379d95f --- /dev/null +++ b/configs/coins/optimism_archive_legacy_geth.json @@ -0,0 +1,40 @@ +{ + "coin": { + "name": "Optimism Archive Legacy Geth", + "shortcut": "ETH", + "label": "Optimism", + "alias": "optimism_archive_legacy_geth" + }, + "ports": { + "backend_rpc": 8204, + "backend_http": 8304, + "backend_p2p": 38404, + "blockbook_internal": 9204, + "blockbook_public": 9304 + }, + "backend": { + "package_name": "backend-optimism-archive-legacy-geth", + "package_revision": "satoshilabs-1", + "system_user": "optimism", + "version": "0.5.31", + "binary_url": "https://github.com/ethereum-optimism/optimism-legacy/archive/refs/heads/develop.zip", + "verification_type": "sha256", + "verification_source": "367b32b3f4c1450a57fa57650a0abdfb74ae58c09123d94b161aaec90fd6b883", + "extract_command": "mkdir backend/source && unzip -d backend/source", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/optimism_archive_legacy_geth_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "optimism_archive_legacy_geth.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "cd {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/source/optimism-legacy-devlop/l2geth && make geth && mv build/bin/geth {{.Env.BackendInstallPath}}/{{.Coin.Alias}} && rm -rf {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/source", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/optimism_archive_op_node.json b/configs/coins/optimism_archive_op_node.json new file mode 100644 index 0000000000..a16c412246 --- /dev/null +++ b/configs/coins/optimism_archive_op_node.json @@ -0,0 +1,38 @@ +{ + "coin": { + "name": "Optimism Archive Op-Node", + "shortcut": "ETH", + "label": "Optimism", + "alias": "optimism_archive_op_node" + }, + "ports": { + "backend_rpc": 8203, + "blockbook_internal": 9203, + "blockbook_public": 9303 + }, + "backend": { + "package_name": "backend-optimism-archive-op-node", + "package_revision": "satoshilabs-1", + "system_user": "optimism", + "version": "1.7.6", + "binary_url": "https://github.com/ethereum-optimism/optimism/archive/refs/tags/op-node/v1.7.6.tar.gz", + "verification_type": "sha256", + "verification_source": "91384e4834f0d0776d1c3e19613b5c50a904f6e5814349e444d42d9e8be5a7ab", + "extract_command": "mkdir backend/source && tar -C backend/source --strip 1 -xf v1.7.6.tar.gz && cd backend/source/op-node && go build -o ../../op-node ./cmd && rm -rf ../../source && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/optimism_archive_op_node_exec.sh 2>&1 >> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "optimism_archive_op_node.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/optimism_op_node.json b/configs/coins/optimism_op_node.json new file mode 100644 index 0000000000..e2b6cc1740 --- /dev/null +++ b/configs/coins/optimism_op_node.json @@ -0,0 +1,38 @@ +{ + "coin": { + "name": "Optimism Op-Node", + "shortcut": "ETH", + "label": "Optimism", + "alias": "optimism_op_node" + }, + "ports": { + "backend_rpc": 8201, + "blockbook_internal": 9201, + "blockbook_public": 9301 + }, + "backend": { + "package_name": "backend-optimism-op-node", + "package_revision": "satoshilabs-1", + "system_user": "optimism", + "version": "1.7.6", + "binary_url": "https://github.com/ethereum-optimism/optimism/archive/refs/tags/op-node/v1.7.6.tar.gz", + "verification_type": "sha256", + "verification_source": "91384e4834f0d0776d1c3e19613b5c50a904f6e5814349e444d42d9e8be5a7ab", + "extract_command": "mkdir backend/source && tar -C backend/source --strip 1 -xf v1.7.6.tar.gz && cd backend/source/op-node && go build -o ../../op-node ./cmd && rm -rf ../../source && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/optimism_op_node_exec.sh 2>&1 >> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "optimism_op_node.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/pivx.json b/configs/coins/pivx.json index 96d1531f32..327d76ab34 100644 --- a/configs/coins/pivx.json +++ b/configs/coins/pivx.json @@ -22,19 +22,19 @@ "package_name": "backend-pivx", "package_revision": "satoshilabs-1", "system_user": "pivx", - "version": "4.0.0", - "binary_url": "https://github.com/PIVX-Project/PIVX/releases/download/v4.0.0/pivx-4.0.0-x86_64-linux-gnu.tar.gz", + "version": "5.6.1", + "binary_url": "https://github.com/PIVX-Project/PIVX/releases/download/v5.6.1/pivx-5.6.1-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "6cb1f608ec0e106ea6bbb455ec8b85c7cad05ca52ab43011d3db80557816b79e", + "verification_source": "6704625c63ff73da8c57f0fbb1dab6f1e4bd8f62c17467e05f52a64012a0ee2f", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/pivx-qt" ], "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/pivxd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", + "postinst_script_template": "cd {{.Env.BackendInstallPath}}/{{.Coin.Alias}} && HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/install-params.sh", "service_type": "forking", - "service_additional_params_template": "", + "service_additional_params_template": "Environment=\"HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend\"", "protect_memory": false, "mainnet": true, "server_config_file": "bitcoin_like.conf", @@ -64,4 +64,4 @@ "package_maintainer": "rikardwissing", "package_maintainer_email": "rikard@coinid.org" } -} \ No newline at end of file +} diff --git a/configs/coins/pivx_testnet.json b/configs/coins/pivx_testnet.json index 325700d2a5..5a87334cf4 100644 --- a/configs/coins/pivx_testnet.json +++ b/configs/coins/pivx_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-pivx", "package_revision": "satoshilabs-1", "system_user": "pivx", - "version": "4.0.0", - "binary_url": "https://github.com/PIVX-Project/PIVX/releases/download/v4.0.0/pivx-4.0.0-x86_64-linux-gnu.tar.gz", + "version": "5.6.1", + "binary_url": "https://github.com/PIVX-Project/PIVX/releases/download/v5.6.1/pivx-5.6.1-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "6cb1f608ec0e106ea6bbb455ec8b85c7cad05ca52ab43011d3db80557816b79e", + "verification_source": "6704625c63ff73da8c57f0fbb1dab6f1e4bd8f62c17467e05f52a64012a0ee2f", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/pivx-qt" @@ -64,4 +64,4 @@ "package_maintainer": "PIVX team", "package_maintainer_email": "random.zebra@protonmail.com" } -} \ No newline at end of file +} diff --git a/configs/coins/polygon.json b/configs/coins/polygon.json new file mode 100644 index 0000000000..a9552c19f7 --- /dev/null +++ b/configs/coins/polygon.json @@ -0,0 +1,72 @@ +{ + "coin": { + "name": "Polygon", + "shortcut": "POL", + "network": "POL", + "label": "Polygon", + "alias": "polygon_bor" + }, + "ports": { + "backend_rpc": 8070, + "backend_p2p": 38370, + "backend_http": 8170, + "blockbook_internal": 9070, + "blockbook_public": 9170 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-polygon-bor", + "package_revision": "satoshilabs-1", + "system_user": "polygon", + "version": "2.2.9", + "binary_url": "https://github.com/maticnetwork/bor/releases/download/v2.2.9/bor-v2.2.9-amd64.deb", + "verification_type": "sha256", + "verification_source": "8125ae8f2c5e2485ba112e065bcbfa40468a113a41a3dfa34871dd239fd12f6e", + "extract_command": "mkdir -p backend && dpkg --fsys-tarfile ${ARCHIVE} | tar -xO ./usr/bin/bor > backend/bor && chmod +x backend/bor && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/polygon_bor_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "polygon_bor.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://raw.githubusercontent.com/maticnetwork/bor/v2.2.9/builder/files/genesis-mainnet-v1.json -O {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/genesis.json", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/maticnetwork/bor/releases/download/v2.2.9/bor-v2.2.9-arm64.deb", + "verification_source": "344bbd01a230250a43373ee559cb596bc8afb95026ce4aa9652c46077740414f" + } + } + }, + "blockbook": { + "package_name": "blockbook-polygon", + "system_user": "blockbook-polygon", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "additional_params": { + "mempoolTxTimeoutHours": 48, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"matic-network\",\"platformIdentifier\": \"polygon-pos\",\"platformVsCurrency\": \"usd\",\"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/polygon_archive.json b/configs/coins/polygon_archive.json new file mode 100644 index 0000000000..bfd19f9404 --- /dev/null +++ b/configs/coins/polygon_archive.json @@ -0,0 +1,78 @@ +{ + "coin": { + "name": "Polygon Archive", + "shortcut": "POL", + "network": "POL", + "label": "Polygon", + "alias": "polygon_archive_bor" + }, + "ports": { + "backend_rpc": 8072, + "backend_p2p": 38372, + "backend_http": 8172, + "blockbook_internal": 9072, + "blockbook_public": 9172 + }, + "ipc": { + "rpc_url_template": "ws://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_timeout": 25 + }, + "backend": { + "package_name": "backend-polygon-archive-bor", + "package_revision": "satoshilabs-1", + "system_user": "polygon", + "version": "2.2.9", + "binary_url": "https://github.com/maticnetwork/bor/releases/download/v2.2.9/bor-v2.2.9-amd64.deb", + "verification_type": "sha256", + "verification_source": "8125ae8f2c5e2485ba112e065bcbfa40468a113a41a3dfa34871dd239fd12f6e", + "extract_command": "mkdir -p backend && dpkg --fsys-tarfile ${ARCHIVE} | tar -xO ./usr/bin/bor > backend/bor && chmod +x backend/bor && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/polygon_archive_bor_exec.sh 2>> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "polygon_archive_bor.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "postinst_script_template": "wget https://raw.githubusercontent.com/maticnetwork/bor/v2.2.9/builder/files/genesis-mainnet-v1.json -O {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/genesis.json", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "", + "platforms": { + "arm64": { + "binary_url": "https://github.com/maticnetwork/bor/releases/download/v2.2.9/bor-v2.2.9-arm64.deb", + "verification_source": "344bbd01a230250a43373ee559cb596bc8afb95026ce4aa9652c46077740414f" + } + } + }, + "blockbook": { + "package_name": "blockbook-polygon-archive", + "system_user": "blockbook-polygon", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-workers=16", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 600, + "additional_params": { + "address_aliases": true, + "eip1559Fees": true, + "alternative_estimate_fee": "infura", + "alternative_estimate_fee_params": "{\"url\": \"https://gas.api.infura.io/v3/${api_key}/networks/137/suggestedGasFees\", \"periodSeconds\": 8}", + "mempoolTxTimeoutHours": 48, + "processInternalTransactions": true, + "queryBackendOnMempoolResync": false, + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"matic-network\",\"platformIdentifier\": \"polygon-pos\",\"platformVsCurrency\": \"usd\",\"periodSeconds\": 900}", + "fourByteSignatures": "https://www.4byte.directory/api/v1/signatures/" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} \ No newline at end of file diff --git a/configs/coins/polygon_heimdall.json b/configs/coins/polygon_heimdall.json new file mode 100644 index 0000000000..7c05497569 --- /dev/null +++ b/configs/coins/polygon_heimdall.json @@ -0,0 +1,39 @@ +{ + "coin": { + "name": "Polygon Heimdall", + "shortcut": "MATIC", + "label": "Polygon", + "alias": "polygon_heimdall" + }, + "ports": { + "backend_rpc": 8071, + "backend_p2p": 38371, + "backend_http": 8171, + "blockbook_internal": 9071, + "blockbook_public": 9171 + }, + "backend": { + "package_name": "backend-polygon-heimdall", + "package_revision": "satoshilabs-1", + "system_user": "polygon", + "version": "0.2.16", + "binary_url": "https://github.com/0xPolygon/heimdall-v2/releases/download/v0.2.16/heimdall-v0.2.16-amd64.deb", + "verification_type": "sha256", + "verification_source": "1682bade3065065a4b660a162e06c843b4a3079af829cec300a05e9577c9389b", + "extract_command": "mkdir -p backend && dpkg --fsys-tarfile ${ARCHIVE} | tar -xO ./usr/bin/heimdalld > backend/heimdalld && chmod +x backend/heimdalld && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/polygon_heimdall_exec.sh 2>&1 >> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "polygon_heimdall.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/polygon_heimdall_archive.json b/configs/coins/polygon_heimdall_archive.json new file mode 100644 index 0000000000..96826703db --- /dev/null +++ b/configs/coins/polygon_heimdall_archive.json @@ -0,0 +1,39 @@ +{ + "coin": { + "name": "Polygon Archive Heimdall", + "shortcut": "MATIC", + "label": "Polygon", + "alias": "polygon_archive_heimdall" + }, + "ports": { + "backend_rpc": 8073, + "backend_p2p": 38373, + "backend_http": 8173, + "blockbook_internal": 9073, + "blockbook_public": 9173 + }, + "backend": { + "package_name": "backend-polygon-archive-heimdall", + "package_revision": "satoshilabs-1", + "system_user": "polygon", + "version": "0.2.16", + "binary_url": "https://github.com/0xPolygon/heimdall-v2/releases/download/v0.2.16/heimdall-v0.2.16-amd64.deb", + "verification_type": "sha256", + "verification_source": "1682bade3065065a4b660a162e06c843b4a3079af829cec300a05e9577c9389b", + "extract_command": "mkdir -p backend && dpkg --fsys-tarfile ${ARCHIVE} | tar -xO ./usr/bin/heimdalld > backend/heimdalld && chmod +x backend/heimdalld && echo", + "exclude_files": [], + "exec_command_template": "/bin/sh -c '{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/polygon_archive_heimdall_exec.sh 2>&1 >> {{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log'", + "exec_script": "polygon_archive_heimdall.sh", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "", + "client_config_file": "" + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" + } +} diff --git a/configs/coins/qtum.json b/configs/coins/qtum.json index ae3c5a580b..7699106ac1 100644 --- a/configs/coins/qtum.json +++ b/configs/coins/qtum.json @@ -22,10 +22,10 @@ "package_name": "backend-qtum", "package_revision": "satoshilabs-1", "system_user": "qtum", - "version": "0.20.2", - "binary_url": "https://github.com/qtumproject/qtum/releases/download/mainnet-fastlane-v0.20.2/qtum-0.20.2-x86_64-linux-gnu.tar.gz", + "version": "27.1", + "binary_url": "https://github.com/qtumproject/qtum/releases/download/v27.1/qtum-27.1-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "52d746f2fb827c43cd8e1784a29ad6d21b843141b85002a49a3822ceebe8651d", + "verification_source": "0b1f612f0762184240c785c66b548f2dab8eed5e25481c635806ddf81807aa86", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/qtum-qt" diff --git a/configs/coins/qtum_testnet.json b/configs/coins/qtum_testnet.json index 63eb053e79..ed1218de3b 100644 --- a/configs/coins/qtum_testnet.json +++ b/configs/coins/qtum_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-qtum-testnet", "package_revision": "satoshilabs-1", "system_user": "qtum", - "version": "0.20.2", - "binary_url": "https://github.com/qtumproject/qtum/releases/download/mainnet-fastlane-v0.20.2/qtum-0.20.2-x86_64-linux-gnu.tar.gz", + "version": "27.1", + "binary_url": "https://github.com/qtumproject/qtum/releases/download/v27.1/qtum-27.1-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "52d746f2fb827c43cd8e1784a29ad6d21b843141b85002a49a3822ceebe8651d", + "verification_source": "0b1f612f0762184240c785c66b548f2dab8eed5e25481c635806ddf81807aa86", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/qtum-qt" diff --git a/configs/coins/ravencoin.json b/configs/coins/ravencoin.json index 5fe9543c67..2805feff40 100644 --- a/configs/coins/ravencoin.json +++ b/configs/coins/ravencoin.json @@ -22,10 +22,10 @@ "package_name": "backend-ravencoin", "package_revision": "satoshilabs-1", "system_user": "ravencoin", - "version": "4.2.1.0", - "binary_url": "https://github.com/RavenProject/Ravencoin/releases/download/v4.2.1/raven-4.2.1.0-x86_64-linux-gnu.tar.gz", + "version": "4.6.1.0", + "binary_url": "https://github.com/RavenProject/Ravencoin/releases/download/v4.6.1/raven-4.6.1-7864c39c2-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "5a86f806e2444c6e6d612fd315f3a1369521fe50863617d5f52c3b1c1e70af76", + "verification_source": "6c6ac6382cf594b218ec50dd9662892dc2d9a493ce151acb2d7feb500436c197", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/raven-qt" diff --git a/configs/coins/trezarcoin.json b/configs/coins/trezarcoin.json index c0b7ec3bb1..5d26312c88 100644 --- a/configs/coins/trezarcoin.json +++ b/configs/coins/trezarcoin.json @@ -1,70 +1,69 @@ { - "coin": { - "name": "Trezarcoin", - "shortcut": "TZC", - "label": "Trezarcoin", - "alias": "trezarcoin" - }, - "ports": { - "backend_rpc": 8096, - "backend_message_queue": 38396, - "blockbook_internal": 9096, - "blockbook_public": 9196 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-trezarcoin", - "package_revision": "satoshilabs-1", - "system_user": "trezarcoin", - "version": "2.1.1", - "binary_url": "https://github.com/TrezarCoin/TrezarCoin/releases/download/v2.1.1.0/trezarcoin-2.1.1-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "4b41c4fecf36a870d6bb7298d85b211f61d9f2bcc6c1bef3167f3ef772bc6fdf", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/trezarcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/trezarcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "Trezarcoin", + "shortcut": "TZC", + "label": "Trezarcoin", + "alias": "trezarcoin" + }, + "ports": { + "backend_rpc": 8096, + "backend_message_queue": 38396, + "blockbook_internal": 9096, + "blockbook_public": 9196 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-trezarcoin", + "package_revision": "satoshilabs-1", + "system_user": "trezarcoin", + "version": "2.1.1", + "binary_url": "https://github.com/TrezarCoin/TrezarCoin/releases/download/v2.1.1.0/trezarcoin-2.1.1-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "4b41c4fecf36a870d6bb7298d85b211f61d9f2bcc6c1bef3167f3ef772bc6fdf", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/trezarcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/trezarcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-trezarcoin", + "system_user": "blockbook-trezarcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 300, + "xpub_magic": 27108450, + "slip44": 232, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"trezarcoin\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-trezarcoin", - "system_user": "blockbook-trezarcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 300, - "xpub_magic": 27108450, - "slip44": 232, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"trezarcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/vertcoin.json b/configs/coins/vertcoin.json index b592b76a29..a1444acb9e 100644 --- a/configs/coins/vertcoin.json +++ b/configs/coins/vertcoin.json @@ -1,72 +1,71 @@ { - "coin": { - "name": "Vertcoin", - "shortcut": "VTC", - "label": "Vertcoin", - "alias": "vertcoin" - }, - "ports": { - "backend_rpc": 8040, - "backend_message_queue": 38340, - "blockbook_internal": 9040, - "blockbook_public": 9140 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-vertcoin", - "package_revision": "satoshilabs-1", - "system_user": "vertcoin", - "version": "0.18.0", - "binary_url": "https://github.com/vertcoin-project/vertcoin-core/releases/download/0.18.0/vertcoin-0.18.0-x86_64-linux-gnu.tar.gz", - "verification_type": "sha256", - "verification_source": "6ded7ea883b6cf9cee95701b13eef2e601a85f91d15f255d4fc7b25db92808ec", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [ - "bin/vertcoin-qt" - ], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/vertcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "", - "service_type": "forking", - "service_additional_params_template": "", - "protect_memory": true, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "whitelist": "127.0.0.1" + "coin": { + "name": "Vertcoin", + "shortcut": "VTC", + "label": "Vertcoin", + "alias": "vertcoin" + }, + "ports": { + "backend_rpc": 8040, + "backend_message_queue": 38340, + "blockbook_internal": 9040, + "blockbook_public": 9140 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-vertcoin", + "package_revision": "satoshilabs-1", + "system_user": "vertcoin", + "version": "23.2", + "binary_url": "https://github.com/vertcoin-project/vertcoin-core/releases/download/v23.2/vertcoin-23.2-x86_64-linux-gnu.tar.gz", + "verification_type": "sha256", + "verification_source": "51d01d1c7e1307edc0a88f44c3bd73ae8e088633ae85c56b08855b50882ee876", + "extract_command": "tar -C backend --strip 1 -xf", + "exclude_files": ["bin/vertcoin-qt"], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/vertcoind -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "forking", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "bitcoin_like.conf", + "client_config_file": "bitcoin_like_client.conf", + "additional_params": { + "whitelist": "127.0.0.1" + } + }, + "blockbook": { + "package_name": "blockbook-vertcoin", + "system_user": "blockbook-vertcoin", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "", + "block_chain": { + "parse": true, + "mempool_workers": 8, + "mempool_sub_workers": 2, + "block_addresses_to_keep": 1000, + "xpub_magic": 76067358, + "xpub_magic_segwit_p2sh": 77429938, + "xpub_magic_segwit_native": 78792518, + "slip44": 28, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"vertcoin\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "Petr Kracik", + "package_maintainer_email": "petr.kracik@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-vertcoin", - "system_user": "blockbook-vertcoin", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 8, - "mempool_sub_workers": 2, - "block_addresses_to_keep": 1000, - "xpub_magic": 76067358, - "xpub_magic_segwit_p2sh": 77429938, - "xpub_magic_segwit_native": 78792518, - "slip44": 28, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"vertcoin\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "Petr Kracik", - "package_maintainer_email": "petr.kracik@satoshilabs.com" - } } diff --git a/configs/coins/vertcoin_testnet.json b/configs/coins/vertcoin_testnet.json index 51f7590eef..c1e3bd6642 100644 --- a/configs/coins/vertcoin_testnet.json +++ b/configs/coins/vertcoin_testnet.json @@ -22,10 +22,10 @@ "package_name": "backend-vertcoin-testnet", "package_revision": "satoshilabs-1", "system_user": "vertcoin", - "version": "0.18.0", - "binary_url": "https://github.com/vertcoin-project/vertcoin-core/releases/download/0.18.0/vertcoin-0.18.0-x86_64-linux-gnu.tar.gz", + "version": "23.2", + "binary_url": "https://github.com/vertcoin-project/vertcoin-core/releases/download/v23.2/vertcoin-23.2-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "6ded7ea883b6cf9cee95701b13eef2e601a85f91d15f255d4fc7b25db92808ec", + "verification_source": "51d01d1c7e1307edc0a88f44c3bd73ae8e088633ae85c56b08855b50882ee876", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/vertcoin-qt" diff --git a/configs/coins/viacoin.json b/configs/coins/viacoin.json index 95e7aecb5f..8799388b03 100644 --- a/configs/coins/viacoin.json +++ b/configs/coins/viacoin.json @@ -14,7 +14,7 @@ "ipc": { "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", "rpc_user": "rpc", - "rpc_pass": "rpcp", + "rpc_pass": "rpc", "rpc_timeout": 25, "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" }, @@ -22,10 +22,10 @@ "package_name": "backend-viacoin", "package_revision": "satoshilabs-1", "system_user": "viacoin", - "version": "1.14-beta-1", - "binary_url": "https://github.com/viacoin/viacoin/releases/download/v0.15.2/viacoin-0.15.2-x86_64-linux-gnu.tar.gz", + "version": "0.16.3", + "binary_url": "https://github.com/viacoin/viacoin/releases/download/v0.16.3/viacoin-0.16.3-x86_64-linux-gnu.tar.gz", "verification_type": "sha256", - "verification_source": "bdbd432645a8b4baadddb7169ea4bef3d03f80dc2ce53dce5783d8582ac63bab", + "verification_source": "4b84d8f1485d799fdff6cb4b1a316c00056b8869b53a702cd8ce2cc581bae59a", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [ "bin/viacoin-qt" @@ -41,6 +41,7 @@ "client_config_file": "bitcoin_like_client.conf", "additional_params": { "discover": 0, + "deprecatedrpc": "estimatefee", "rpcthreads": 16, "upnp": 0, "whitelist": "127.0.0.1" @@ -62,11 +63,15 @@ "xpub_magic_segwit_p2sh": 77429938, "xpub_magic_segwit_native": 78792518, "slip44": 14, - "additional_params": {} + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"viacoin\", \"periodSeconds\": 900}" + } } }, "meta": { "package_maintainer": "Romano", - "package_maintainer_email": "romanornr@gmail.com" + "package_maintainer_email": "viacoin@protonmail.com" } } \ No newline at end of file diff --git a/configs/coins/zcash.json b/configs/coins/zcash.json index 6d1c9d0538..d2ec7ed719 100644 --- a/configs/coins/zcash.json +++ b/configs/coins/zcash.json @@ -1,70 +1,66 @@ { - "coin": { - "name": "Zcash", - "shortcut": "ZEC", - "label": "Zcash", - "alias": "zcash" - }, - "ports": { - "backend_rpc": 8032, - "backend_message_queue": 38332, - "blockbook_internal": 9032, - "blockbook_public": 9132 - }, - "ipc": { - "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", - "rpc_user": "rpc", - "rpc_pass": "rpc", - "rpc_timeout": 25, - "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" - }, - "backend": { - "package_name": "backend-zcash", - "package_revision": "satoshilabs-1", - "system_user": "zcash", - "version": "5.0.0", - "binary_url": "https://z.cash/downloads/zcash-5.0.0-linux64-debian-bullseye.tar.gz", - "verification_type": "sha256", - "verification_source": "f9b87ae99ea2c2f659e67481cb9ce9dd3f179619ae38334f383f2eb8db6f9e2c", - "extract_command": "tar -C backend --strip 1 -xf", - "exclude_files": [], - "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/zcashd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", - "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", - "postinst_script_template": "HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/zcash-fetch-params", - "service_type": "forking", - "service_additional_params_template": "Environment=\"HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend\"", - "protect_memory": false, - "mainnet": true, - "server_config_file": "bitcoin_like.conf", - "client_config_file": "bitcoin_like_client.conf", - "additional_params": { - "addnode": [ - "mainnet.z.cash" - ] + "coin": { + "name": "Zcash", + "shortcut": "ZEC", + "label": "Zcash", + "alias": "zcash" + }, + "ports": { + "backend_rpc": 8032, + "backend_message_queue": 38332, + "blockbook_internal": 9032, + "blockbook_public": 9132 + }, + "ipc": { + "rpc_url_template": "http://127.0.0.1:{{.Ports.BackendRPC}}", + "rpc_user": "rpc", + "rpc_pass": "rpc", + "rpc_timeout": 25, + "message_queue_binding_template": "tcp://127.0.0.1:{{.Ports.BackendMessageQueue}}" + }, + "backend": { + "package_name": "backend-zcash", + "package_revision": "satoshilabs-1", + "system_user": "zcash", + "version": "3.0.0", + "docker_image": "zfnd/zebra:3.0.0", + "verification_type": "docker", + "verification_source": "ec082c6c3fb26b1cbb4aa0f044406dc0cfbc8ce5f3c3e5ff5f9886d832becac9", + "extract_command": "mkdir backend/bin && docker cp extract:/usr/local/bin/zebrad backend/bin/zebrad", + "exclude_files": [], + "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/zebrad --config {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/zcash.conf start", + "logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log", + "postinst_script_template": "", + "service_type": "simple", + "service_additional_params_template": "", + "protect_memory": true, + "mainnet": true, + "server_config_file": "zcash.conf", + "client_config_file": "bitcoin_like_client.conf" + }, + "blockbook": { + "package_name": "blockbook-zcash", + "system_user": "blockbook-zcash", + "internal_binding_template": ":{{.Ports.BlockbookInternal}}", + "public_binding_template": ":{{.Ports.BlockbookPublic}}", + "explorer_url": "", + "additional_params": "-resyncindexperiod=50000 -resyncmempoolperiod=3000", + "block_chain": { + "parse": true, + "mempool_workers": 4, + "mempool_sub_workers": 8, + "block_addresses_to_keep": 300, + "xpub_magic": 76067358, + "slip44": 133, + "additional_params": { + "fiat_rates": "coingecko", + "fiat_rates_vs_currencies": "AED,ARS,AUD,BDT,BHD,BMD,BRL,CAD,CHF,CLP,CNY,CZK,DKK,EUR,GBP,HKD,HUF,IDR,ILS,INR,JPY,KRW,KWD,LKR,MMK,MXN,MYR,NGN,NOK,NZD,PHP,PKR,PLN,RUB,SAR,SEK,SGD,THB,TRY,TWD,UAH,USD,VEF,VND,ZAR,BTC,ETH", + "fiat_rates_params": "{\"coin\": \"zcash\", \"periodSeconds\": 900}" + } + } + }, + "meta": { + "package_maintainer": "IT Admin", + "package_maintainer_email": "it@satoshilabs.com" } - }, - "blockbook": { - "package_name": "blockbook-zcash", - "system_user": "blockbook-zcash", - "internal_binding_template": ":{{.Ports.BlockbookInternal}}", - "public_binding_template": ":{{.Ports.BlockbookPublic}}", - "explorer_url": "", - "additional_params": "", - "block_chain": { - "parse": true, - "mempool_workers": 4, - "mempool_sub_workers": 8, - "block_addresses_to_keep": 300, - "xpub_magic": 76067358, - "slip44": 133, - "additional_params": { - "fiat_rates": "coingecko", - "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"zcash\", \"periodSeconds\": 60}" - } - } - }, - "meta": { - "package_maintainer": "IT Admin", - "package_maintainer_email": "it@satoshilabs.com" - } } diff --git a/configs/coins/zcash_testnet.json b/configs/coins/zcash_testnet.json index 4622ba5ba3..14d5332e78 100644 --- a/configs/coins/zcash_testnet.json +++ b/configs/coins/zcash_testnet.json @@ -21,10 +21,10 @@ "backend": { "package_name": "backend-zcash-testnet", "package_revision": "satoshilabs-1", - "version": "5.0.0", - "binary_url": "https://z.cash/downloads/zcash-5.0.0-linux64-debian-bullseye.tar.gz", + "version": "6.2.0", + "binary_url": "https://download.z.cash/downloads/zcash-6.2.0-linux64-debian-bullseye.tar.gz", "verification_type": "sha256", - "verification_source": "f9b87ae99ea2c2f659e67481cb9ce9dd3f179619ae38334f383f2eb8db6f9e2c", + "verification_source": "71cf378c27582a4b9f9d57cafc2b5a57a46e9e52a5eda33be112dc9790c64c6f", "extract_command": "tar -C backend --strip 1 -xf", "exclude_files": [], "exec_command_template": "{{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/zcashd -datadir={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend -conf={{.Env.BackendInstallPath}}/{{.Coin.Alias}}/{{.Coin.Alias}}.conf -pid=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid", @@ -39,7 +39,9 @@ "additional_params": { "addnode": [ "testnet.z.cash" - ] + + ], + "i-am-aware-zcashd-will-be-replaced-by-zebrad-and-zallet-in-2025": 1 } }, "blockbook": { diff --git a/configs/contract-fix/ethereum.json b/configs/contract-fix/ethereum.json new file mode 100644 index 0000000000..1856a35d44 --- /dev/null +++ b/configs/contract-fix/ethereum.json @@ -0,0 +1,35 @@ +[ + { + "standard": "ERC20", + "contract": "0xC19B6A4Ac7C7Cc24459F08984Bbd09664af17bD1", + "name": "Sensorium", + "symbol": "SENSO", + "decimals": 0, + "createdInBlock": 11098997 + }, + { + "standard": "ERC20", + "contract": "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa", + "name": "mETH", + "symbol": "mETH", + "decimals": 18, + "createdInBlock": 18290587 + }, + { + "standard": "ERC20", + "contract": "0xE6829d9a7eE3040e1276Fa75293Bde931859e8fA", + "name": "cmETH", + "symbol": "cmETH", + "decimals": 18, + "createdInBlock": 20439180 + }, + { + "type": "ERC20", + "standard": "ERC20", + "contract": "0x6f40d4A6237C257fff2dB00FA0510DeEECd303eb", + "name": "Fluid", + "symbol": "FLUID", + "decimals": 18, + "createdInBlock": 12183236 + } +] diff --git a/configs/environ.json b/configs/environ.json index 4554561a8d..93c92a12f7 100644 --- a/configs/environ.json +++ b/configs/environ.json @@ -1,5 +1,5 @@ { - "version": "0.3.6", + "version": "0.5.0", "backend_install_path": "/opt/coins/nodes", "backend_data_path": "/opt/coins/data", "blockbook_install_path": "/opt/coins/blockbook", diff --git a/contrib/scripts/check-and-generate-port-registry.go b/contrib/scripts/check-and-generate-port-registry.go index 048a28f31d..9b2eebc6f8 100755 --- a/contrib/scripts/check-and-generate-port-registry.go +++ b/contrib/scripts/check-and-generate-port-registry.go @@ -1,4 +1,4 @@ -//usr/bin/go run $0 $@ ; exit +// usr/bin/go run $0 $@ ; exit package main import ( @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "math" "os" "path/filepath" @@ -36,15 +35,19 @@ type Config struct { Coin struct { Name string `json:"name"` Label string `json:"label"` + Alias string `json:"alias"` + } + Ports map[string]uint16 `json:"ports"` + Blockbook struct { + PackageName string `json:"package_name"` } - Ports map[string]uint16 `json:"ports"` } func checkPorts() int { ports := make(map[uint16][]string) status := 0 - files, err := ioutil.ReadDir(inputDir) + files, err := os.ReadDir(inputDir) if err != nil { panic(err) } @@ -69,21 +72,22 @@ func checkPorts() int { } if _, ok := v.Ports["blockbook_internal"]; !ok { - fmt.Printf("%s: missing blockbook_internal port\n", v.Coin.Name) + fmt.Printf("%s (%s): missing blockbook_internal port\n", v.Coin.Name, v.Coin.Alias) status = 1 } if _, ok := v.Ports["blockbook_public"]; !ok { - fmt.Printf("%s: missing blockbook_public port\n", v.Coin.Name) + fmt.Printf("%s (%s): missing blockbook_public port\n", v.Coin.Name, v.Coin.Alias) status = 1 } if _, ok := v.Ports["backend_rpc"]; !ok { - fmt.Printf("%s: missing backend_rpc port\n", v.Coin.Name) + fmt.Printf("%s (%s): missing backend_rpc port\n", v.Coin.Name, v.Coin.Alias) status = 1 } for _, port := range v.Ports { - if port > 0 { - ports[port] = append(ports[port], v.Coin.Name) + // ignore duplicities caused by configs that do not serve blockbook directly (consensus layers) + if port > 0 && v.Blockbook.PackageName == "" { + ports[port] = append(ports[port], v.Coin.Alias) } } } @@ -132,7 +136,7 @@ func main() { } func loadPortInfo(dir string) (PortInfoSlice, error) { - files, err := ioutil.ReadDir(dir) + files, err := os.ReadDir(dir) if err != nil { return nil, err } @@ -158,26 +162,31 @@ func loadPortInfo(dir string) (PortInfoSlice, error) { return nil, fmt.Errorf("%s: json: %s", path, err) } + // skip configs that do not have blockbook (consensus layers) + if v.Blockbook.PackageName == "" { + continue + } name := v.Coin.Label - if len(name) == 0 { + // exceptions when to use Name instead of Label so that the table looks good + if len(name) == 0 || strings.Contains(v.Coin.Name, "Ethereum") || strings.Contains(v.Coin.Name, "Archive") { name = v.Coin.Name } item := &PortInfo{CoinName: name, BackendServicePorts: map[string]uint16{}} - for k, v := range v.Ports { - if v == 0 { + for k, p := range v.Ports { + if p == 0 { continue } switch k { case "blockbook_internal": - item.BlockbookInternalPort = v + item.BlockbookInternalPort = p case "blockbook_public": - item.BlockbookPublicPort = v + item.BlockbookPublicPort = p case "backend_rpc": - item.BackendRPCPort = v + item.BackendRPCPort = p default: if len(k) > 8 && k[:8] == "backend_" { - item.BackendServicePorts[k[8:]] = v + item.BackendServicePorts[k[8:]] = p } } } @@ -233,10 +242,10 @@ func writeMarkdown(output string, slice PortInfoSlice) error { fmt.Fprintf(&buf, "# Registry of ports\n\n") - header := []string{"coin", "blockbook internal port", "blockbook public port", "backend rpc port", "backend service ports (zmq)"} + header := []string{"coin", "blockbook public", "blockbook internal", "backend rpc", "backend service ports (zmq)"} writeTable(&buf, header, slice) - fmt.Fprintf(&buf, "\n> NOTE: This document is generated from coin definitions in `configs/coins`.\n") + fmt.Fprintf(&buf, "\n> NOTE: This document is generated from coin definitions in `configs/coins` using command `go run contrib/scripts/check-and-generate-port-registry.go -w`.\n") out := os.Stdout if output != "stdout" { @@ -263,11 +272,11 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) { for i, item := range slice { row := make([]string, len(header)) row[0] = item.CoinName - if item.BlockbookInternalPort > 0 { - row[1] = fmt.Sprintf("%d", item.BlockbookInternalPort) - } if item.BlockbookPublicPort > 0 { - row[2] = fmt.Sprintf("%d", item.BlockbookPublicPort) + row[1] = fmt.Sprintf("%d", item.BlockbookPublicPort) + } + if item.BlockbookInternalPort > 0 { + row[2] = fmt.Sprintf("%d", item.BlockbookInternalPort) } if item.BackendRPCPort > 0 { row[3] = fmt.Sprintf("%d", item.BackendRPCPort) @@ -284,6 +293,7 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) { svcPorts = append(svcPorts, s) } + sort.Strings(svcPorts) row[4] = strings.Join(svcPorts, ", ") rows[i] = row @@ -294,7 +304,7 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) { padding[column] = len(header[column]) for _, row := range rows { - padding[column] = maxInt(padding[column], len(row[column])) + padding[column] = max(padding[column], len(row[column])) } } @@ -312,13 +322,6 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) { } } -func maxInt(a, b int) int { - if a > b { - return a - } - return b -} - func paddedRow(row []string, padding []int) []string { out := make([]string, len(row)) for i := 0; i < len(row); i++ { diff --git a/db/bulkconnect.go b/db/bulkconnect.go index 27412eedc9..faa49632a4 100644 --- a/db/bulkconnect.go +++ b/db/bulkconnect.go @@ -3,8 +3,8 @@ package db import ( "time" - "github.com/flier/gorocksdb" "github.com/golang/glog" + "github.com/linxGnu/grocksdb" "github.com/trezor/blockbook/bchain" ) @@ -25,9 +25,11 @@ type BulkConnect struct { chainType bchain.ChainType bulkAddresses []bulkAddresses bulkAddressesCount int + ethBlockTxs []ethBlockTx txAddressesMap map[string]*TxAddresses + blockFilters map[string][]byte balances map[string]*AddrBalance - addressContracts map[string]*AddrContracts + addressContracts map[string]*unpackedAddrContracts height uint32 } @@ -39,6 +41,7 @@ const ( partialStoreBalances = maxBulkBalances / 10 maxBulkAddrContracts = 1200000 partialStoreAddrContracts = maxBulkAddrContracts / 10 + maxBlockFilters = 1000 ) // InitBulkConnect initializes bulk connect and switches DB to inconsistent state @@ -48,7 +51,8 @@ func (d *RocksDB) InitBulkConnect() (*BulkConnect, error) { chainType: d.chainParser.GetChainType(), txAddressesMap: make(map[string]*TxAddresses), balances: make(map[string]*AddrBalance), - addressContracts: make(map[string]*AddrContracts), + addressContracts: make(map[string]*unpackedAddrContracts), + blockFilters: make(map[string][]byte), } if err := d.SetInconsistentState(true); err != nil { return nil, err @@ -57,7 +61,7 @@ func (d *RocksDB) InitBulkConnect() (*BulkConnect, error) { return b, nil } -func (b *BulkConnect) storeTxAddresses(wb *gorocksdb.WriteBatch, all bool) (int, int, error) { +func (b *BulkConnect) storeTxAddresses(wb *grocksdb.WriteBatch, all bool) (int, int, error) { var txm map[string]*TxAddresses var sp int if all { @@ -100,14 +104,14 @@ func (b *BulkConnect) storeTxAddresses(wb *gorocksdb.WriteBatch, all bool) (int, func (b *BulkConnect) parallelStoreTxAddresses(c chan error, all bool) { defer close(c) start := time.Now() - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() count, sp, err := b.storeTxAddresses(wb, all) if err != nil { c <- err return } - if err := b.d.db.Write(b.d.wo, wb); err != nil { + if err := b.d.WriteBatch(wb); err != nil { c <- err return } @@ -115,7 +119,7 @@ func (b *BulkConnect) parallelStoreTxAddresses(c chan error, all bool) { c <- nil } -func (b *BulkConnect) storeBalances(wb *gorocksdb.WriteBatch, all bool) (int, error) { +func (b *BulkConnect) storeBalances(wb *grocksdb.WriteBatch, all bool) (int, error) { var bal map[string]*AddrBalance if all { bal = b.balances @@ -140,14 +144,14 @@ func (b *BulkConnect) storeBalances(wb *gorocksdb.WriteBatch, all bool) (int, er func (b *BulkConnect) parallelStoreBalances(c chan error, all bool) { defer close(c) start := time.Now() - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() count, err := b.storeBalances(wb, all) if err != nil { c <- err return } - if err := b.d.db.Write(b.d.wo, wb); err != nil { + if err := b.d.WriteBatch(wb); err != nil { c <- err return } @@ -155,7 +159,7 @@ func (b *BulkConnect) parallelStoreBalances(c chan error, all bool) { c <- nil } -func (b *BulkConnect) storeBulkAddresses(wb *gorocksdb.WriteBatch) error { +func (b *BulkConnect) storeBulkAddresses(wb *grocksdb.WriteBatch) error { for _, ba := range b.bulkAddresses { if err := b.d.storeAddresses(wb, ba.bi.Height, ba.addresses); err != nil { return err @@ -169,9 +173,26 @@ func (b *BulkConnect) storeBulkAddresses(wb *gorocksdb.WriteBatch) error { return nil } +func (b *BulkConnect) storeBulkBlockFilters(wb *grocksdb.WriteBatch) error { + for blockHash, blockFilter := range b.blockFilters { + if err := b.d.storeBlockFilter(wb, blockHash, blockFilter); err != nil { + return err + } + } + b.blockFilters = make(map[string][]byte) + return nil +} + func (b *BulkConnect) connectBlockBitcoinType(block *bchain.Block, storeBlockTxs bool) error { addresses := make(addressesMap) - if err := b.d.processAddressesBitcoinType(block, addresses, b.txAddressesMap, b.balances); err != nil { + gf, err := bchain.NewGolombFilter(b.d.is.BlockGolombFilterP, b.d.is.BlockFilterScripts, block.BlockHeader.Hash, b.d.is.BlockFilterUseZeroedKey) + if err != nil { + glog.Error("connectBlockBitcoinType golomb filter error ", err) + gf = nil + } else if gf != nil && !gf.Enabled { + gf = nil + } + if err := b.d.processAddressesBitcoinType(block, addresses, b.txAddressesMap, b.balances, gf); err != nil { return err } var storeAddressesChan, storeBalancesChan chan error @@ -198,10 +219,13 @@ func (b *BulkConnect) connectBlockBitcoinType(block *bchain.Block, storeBlockTxs addresses: addresses, }) b.bulkAddressesCount += len(addresses) + if gf != nil { + b.blockFilters[block.BlockHeader.Hash] = gf.Compute() + } // open WriteBatch only if going to write - if sa || b.bulkAddressesCount > maxBulkAddresses || storeBlockTxs { + if sa || b.bulkAddressesCount > maxBulkAddresses || storeBlockTxs || len(b.blockFilters) > maxBlockFilters { start := time.Now() - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() bac := b.bulkAddressesCount if sa || b.bulkAddressesCount > maxBulkAddresses { @@ -214,7 +238,12 @@ func (b *BulkConnect) connectBlockBitcoinType(block *bchain.Block, storeBlockTxs return err } } - if err := b.d.db.Write(b.d.wo, wb); err != nil { + if len(b.blockFilters) > maxBlockFilters { + if err := b.storeBulkBlockFilters(wb); err != nil { + return err + } + } + if err := b.d.WriteBatch(wb); err != nil { return err } if bac > b.bulkAddressesCount { @@ -234,13 +263,13 @@ func (b *BulkConnect) connectBlockBitcoinType(block *bchain.Block, storeBlockTxs return nil } -func (b *BulkConnect) storeAddressContracts(wb *gorocksdb.WriteBatch, all bool) (int, error) { - var ac map[string]*AddrContracts +func (b *BulkConnect) storeAddressContracts(wb *grocksdb.WriteBatch, all bool) (int, error) { + var ac map[string]*unpackedAddrContracts if all { ac = b.addressContracts - b.addressContracts = make(map[string]*AddrContracts) + b.addressContracts = make(map[string]*unpackedAddrContracts) } else { - ac = make(map[string]*AddrContracts) + ac = make(map[string]*unpackedAddrContracts) // store some random address contracts for k, a := range b.addressContracts { ac[k] = a @@ -250,7 +279,7 @@ func (b *BulkConnect) storeAddressContracts(wb *gorocksdb.WriteBatch, all bool) } } } - if err := b.d.storeAddressContracts(wb, ac); err != nil { + if err := b.d.storeUnpackedAddressContracts(wb, ac); err != nil { return 0, err } return len(ac), nil @@ -259,14 +288,14 @@ func (b *BulkConnect) storeAddressContracts(wb *gorocksdb.WriteBatch, all bool) func (b *BulkConnect) parallelStoreAddressContracts(c chan error, all bool) { defer close(c) start := time.Now() - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() count, err := b.storeAddressContracts(wb, all) if err != nil { c <- err return } - if err := b.d.db.Write(b.d.wo, wb); err != nil { + if err := b.d.WriteBatch(wb); err != nil { c <- err return } @@ -280,6 +309,7 @@ func (b *BulkConnect) connectBlockEthereumType(block *bchain.Block, storeBlockTx if err != nil { return err } + b.ethBlockTxs = append(b.ethBlockTxs, blockTxs...) var storeAddrContracts chan error var sa bool if len(b.addressContracts) > maxBulkAddrContracts { @@ -301,25 +331,45 @@ func (b *BulkConnect) connectBlockEthereumType(block *bchain.Block, storeBlockTx // open WriteBatch only if going to write if sa || b.bulkAddressesCount > maxBulkAddresses || storeBlockTxs { start := time.Now() - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() bac := b.bulkAddressesCount if sa || b.bulkAddressesCount > maxBulkAddresses { - if err := b.storeBulkAddresses(wb); err != nil { + if err = b.storeBulkAddresses(wb); err != nil { return err } } + if err = b.d.storeInternalDataEthereumType(wb, b.ethBlockTxs); err != nil { + return err + } + b.ethBlockTxs = b.ethBlockTxs[:0] + if err = b.d.storeBlockSpecificDataEthereumType(wb, block); err != nil { + return err + } if storeBlockTxs { - if err := b.d.storeAndCleanupBlockTxsEthereumType(wb, block, blockTxs); err != nil { + if err = b.d.storeAndCleanupBlockTxsEthereumType(wb, block, blockTxs); err != nil { return err } } - if err := b.d.db.Write(b.d.wo, wb); err != nil { + if err = b.d.WriteBatch(wb); err != nil { return err } if bac > b.bulkAddressesCount { glog.Info("rocksdb: height ", b.height, ", stored ", bac, " addresses, done in ", time.Since(start)) } + } else { + // if there are blockSpecificData, store them + blockSpecificData, _ := block.CoinSpecificData.(*bchain.EthereumBlockSpecificData) + if blockSpecificData != nil { + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + if err = b.d.storeBlockSpecificDataEthereumType(wb, block); err != nil { + return err + } + if err := b.d.WriteBatch(wb); err != nil { + return err + } + } } if storeAddrContracts != nil { if err := <-storeAddrContracts; err != nil { @@ -356,13 +406,20 @@ func (b *BulkConnect) Close() error { storeAddressContractsChan = make(chan error) go b.parallelStoreAddressContracts(storeAddressContractsChan, true) } - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() + if err := b.d.storeInternalDataEthereumType(wb, b.ethBlockTxs); err != nil { + return err + } + b.ethBlockTxs = b.ethBlockTxs[:0] bac := b.bulkAddressesCount if err := b.storeBulkAddresses(wb); err != nil { return err } - if err := b.d.db.Write(b.d.wo, wb); err != nil { + if err := b.storeBulkBlockFilters(wb); err != nil { + return err + } + if err := b.d.WriteBatch(wb); err != nil { return err } glog.Info("rocksdb: height ", b.height, ", stored ", bac, " addresses, done in ", time.Since(start)) @@ -381,16 +438,18 @@ func (b *BulkConnect) Close() error { return err } } - var err error - b.d.is.BlockTimes, err = b.d.loadBlockTimes() - if err != nil { - return err - } - if err := b.d.SetInconsistentState(false); err != nil { return err } glog.Info("rocksdb: bulk connect closed, db set to open state") + + // set block times asynchronously (if not in unit test), it slows server startup for chains with large number of blocks + if b.d.is.Coin == "coin-unittest" { + b.d.setBlockTimes() + } else { + go b.d.setBlockTimes() + } + b.d = nil return nil } diff --git a/db/dboptions.go b/db/dboptions.go index 4aa95bd8a4..47f8df55fc 100644 --- a/db/dboptions.go +++ b/db/dboptions.go @@ -2,31 +2,29 @@ package db // #include "rocksdb/c.h" import "C" - -import ( - "github.com/flier/gorocksdb" -) +import "flag" +import "github.com/linxGnu/grocksdb" /* - possible additional tuning, using options not accessible by gorocksdb + possible additional tuning, using options not accessible by grocksdb // #include "rocksdb/c.h" import "C" cNativeOpts := C.rocksdb_options_create() - opts := &gorocksdb.Options{} + opts := &grocksdb.Options{} cField := reflect.Indirect(reflect.ValueOf(opts)).FieldByName("c") cPtr := (**C.rocksdb_options_t)(unsafe.Pointer(cField.UnsafeAddr())) *cPtr = cNativeOpts cNativeBlockOpts := C.rocksdb_block_based_options_create() - blockOpts := &gorocksdb.BlockBasedTableOptions{} + blockOpts := &grocksdb.BlockBasedTableOptions{} cBlockField := reflect.Indirect(reflect.ValueOf(blockOpts)).FieldByName("c") cBlockPtr := (**C.rocksdb_block_based_table_options_t)(unsafe.Pointer(cBlockField.UnsafeAddr())) *cBlockPtr = cNativeBlockOpts // https://github.com/facebook/rocksdb/wiki/Partitioned-Index-Filters - blockOpts.SetIndexType(gorocksdb.KTwoLevelIndexSearchIndexType) + blockOpts.SetIndexType(grocksdb.KTwoLevelIndexSearchIndexType) C.rocksdb_block_based_options_set_partition_filters(cNativeBlockOpts, boolToChar(true)) C.rocksdb_block_based_options_set_metadata_block_size(cNativeBlockOpts, C.uint64_t(4096)) C.rocksdb_block_based_options_set_cache_index_and_filter_blocks_with_high_priority(cNativeBlockOpts, boolToChar(true)) @@ -41,16 +39,20 @@ func boolToChar(b bool) C.uchar { } */ -func createAndSetDBOptions(bloomBits int, c *gorocksdb.Cache, maxOpenFiles int) *gorocksdb.Options { - blockOpts := gorocksdb.NewDefaultBlockBasedTableOptions() +var ( + noCompression = flag.Bool("noCompression", false, "disable rocksdb compression when rocksdb library can't find compression library linked with binary") +) + +func createAndSetDBOptions(bloomBits int, c *grocksdb.Cache, maxOpenFiles int) *grocksdb.Options { + blockOpts := grocksdb.NewDefaultBlockBasedTableOptions() blockOpts.SetBlockSize(32 << 10) // 32kB blockOpts.SetBlockCache(c) if bloomBits > 0 { - blockOpts.SetFilterPolicy(gorocksdb.NewBloomFilter(bloomBits)) + blockOpts.SetFilterPolicy(grocksdb.NewBloomFilter(float64(bloomBits))) } blockOpts.SetFormatVersion(4) - opts := gorocksdb.NewDefaultOptions() + opts := grocksdb.NewDefaultOptions() opts.SetBlockBasedTableFactory(blockOpts) opts.SetCreateIfMissing(true) opts.SetCreateIfMissingColumnFamilies(true) @@ -60,6 +62,11 @@ func createAndSetDBOptions(bloomBits int, c *gorocksdb.Cache, maxOpenFiles int) opts.SetWriteBufferSize(1 << 27) // 128MB opts.SetMaxBytesForLevelBase(1 << 27) // 128MB opts.SetMaxOpenFiles(maxOpenFiles) - opts.SetCompression(gorocksdb.LZ4HCCompression) + if *noCompression { + // resolve error rocksDB: Invalid argument: Compression type LZ4HC is not linked with the binary + opts.SetCompression(grocksdb.NoCompression) + } else { + opts.SetCompression(grocksdb.LZ4HCCompression) + } return opts } diff --git a/db/fiat.go b/db/fiat.go new file mode 100644 index 0000000000..dee8aa9442 --- /dev/null +++ b/db/fiat.go @@ -0,0 +1,212 @@ +package db + +import ( + "encoding/binary" + "encoding/json" + "math" + "time" + + vlq "github.com/bsm/go-vlq" + "github.com/golang/glog" + "github.com/juju/errors" + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/common" +) + +// FiatRatesTimeFormat is a format string for storing FiatRates timestamps in rocksdb +const FiatRatesTimeFormat = "20060102150405" // YYYYMMDDhhmmss + +func packTimestamp(t *time.Time) []byte { + return []byte(t.UTC().Format(FiatRatesTimeFormat)) +} + +func packFloat32(buf []byte, n float32) int { + binary.BigEndian.PutUint32(buf, math.Float32bits(n)) + return 4 +} + +func unpackFloat32(buf []byte) (float32, int) { + return math.Float32frombits(binary.BigEndian.Uint32(buf)), 4 +} + +func packCurrencyRatesTicker(ticker *common.CurrencyRatesTicker) []byte { + buf := make([]byte, 0, 32) + varBuf := make([]byte, vlq.MaxLen64) + l := packVaruint(uint(len(ticker.Rates)), varBuf) + buf = append(buf, varBuf[:l]...) + for c, v := range ticker.Rates { + buf = append(buf, packString(c)...) + l = packFloat32(varBuf, v) + buf = append(buf, varBuf[:l]...) + } + l = packVaruint(uint(len(ticker.TokenRates)), varBuf) + buf = append(buf, varBuf[:l]...) + for c, v := range ticker.TokenRates { + buf = append(buf, packString(c)...) + l = packFloat32(varBuf, v) + buf = append(buf, varBuf[:l]...) + } + return buf +} + +func unpackCurrencyRatesTicker(buf []byte) (*common.CurrencyRatesTicker, error) { + var ( + ticker common.CurrencyRatesTicker + s string + l int + len uint + v float32 + ) + len, l = unpackVaruint(buf) + buf = buf[l:] + if len > 0 { + ticker.Rates = make(map[string]float32, len) + for i := 0; i < int(len); i++ { + s, l = unpackString(buf) + buf = buf[l:] + v, l = unpackFloat32(buf) + buf = buf[l:] + ticker.Rates[s] = v + } + } + len, l = unpackVaruint(buf) + buf = buf[l:] + if len > 0 { + ticker.TokenRates = make(map[string]float32, len) + for i := 0; i < int(len); i++ { + s, l = unpackString(buf) + buf = buf[l:] + v, l = unpackFloat32(buf) + buf = buf[l:] + ticker.TokenRates[s] = v + } + } + return &ticker, nil +} + +// FiatRatesStoreTicker stores ticker data at the specified time +func (d *RocksDB) FiatRatesStoreTicker(wb *grocksdb.WriteBatch, ticker *common.CurrencyRatesTicker) error { + if len(ticker.Rates) == 0 { + return errors.New("Error storing ticker: empty rates") + } + wb.PutCF(d.cfh[cfFiatRates], packTimestamp(&ticker.Timestamp), packCurrencyRatesTicker(ticker)) + return nil +} + +func getTickerFromIterator(it *grocksdb.Iterator, vsCurrency string, token string) (*common.CurrencyRatesTicker, error) { + timeObj, err := time.Parse(FiatRatesTimeFormat, string(it.Key().Data())) + if err != nil { + return nil, err + } + ticker, err := unpackCurrencyRatesTicker(it.Value().Data()) + if err != nil { + return nil, err + } + if !common.IsSuitableTicker(ticker, vsCurrency, token) { + return nil, nil + } + ticker.Timestamp = timeObj.UTC() + return ticker, nil +} + +// FiatRatesGetTicker gets FiatRates ticker at the specified timestamp if it exist +func (d *RocksDB) FiatRatesGetTicker(tickerTime *time.Time) (*common.CurrencyRatesTicker, error) { + tickerTimeFormatted := tickerTime.UTC().Format(FiatRatesTimeFormat) + val, err := d.db.GetCF(d.ro, d.cfh[cfFiatRates], []byte(tickerTimeFormatted)) + if err != nil { + return nil, err + } + defer val.Free() + data := val.Data() + if len(data) == 0 { + return nil, nil + } + ticker, err := unpackCurrencyRatesTicker(data) + if err != nil { + return nil, err + } + ticker.Timestamp = tickerTime.UTC() + return ticker, nil +} + +// FiatRatesFindTicker gets FiatRates data closest to the specified timestamp, of the base currency, vsCurrency or the token if specified +func (d *RocksDB) FiatRatesFindTicker(tickerTime *time.Time, vsCurrency string, token string) (*common.CurrencyRatesTicker, error) { + tickerTimeFormatted := tickerTime.UTC().Format(FiatRatesTimeFormat) + it := d.db.NewIteratorCF(d.ro, d.cfh[cfFiatRates]) + defer it.Close() + + for it.Seek([]byte(tickerTimeFormatted)); it.Valid(); it.Next() { + ticker, err := getTickerFromIterator(it, vsCurrency, token) + if err != nil { + glog.Error("FiatRatesFindTicker error: ", err) + return nil, err + } + if ticker != nil { + return ticker, nil + } + } + return nil, nil +} + +// FiatRatesGetAllTickers gets FiatRates data closest to the specified timestamp, of the base currency, vsCurrency or the token if specified +func (d *RocksDB) FiatRatesGetAllTickers(fn func(ticker *common.CurrencyRatesTicker) error) error { + it := d.db.NewIteratorCF(d.ro, d.cfh[cfFiatRates]) + defer it.Close() + + for it.SeekToFirst(); it.Valid(); it.Next() { + ticker, err := getTickerFromIterator(it, "", "") + if err != nil { + return err + } + if ticker == nil { + return errors.New("FiatRatesGetAllTickers got nil ticker") + } + if err = fn(ticker); err != nil { + return err + } + } + return nil +} + +// FiatRatesFindLastTicker gets the last FiatRates record, of the base currency, vsCurrency or the token if specified +func (d *RocksDB) FiatRatesFindLastTicker(vsCurrency string, token string) (*common.CurrencyRatesTicker, error) { + it := d.db.NewIteratorCF(d.ro, d.cfh[cfFiatRates]) + defer it.Close() + + for it.SeekToLast(); it.Valid(); it.Prev() { + ticker, err := getTickerFromIterator(it, vsCurrency, token) + if err != nil { + glog.Error("FiatRatesFindLastTicker error: ", err) + return nil, err + } + if ticker != nil { + return ticker, nil + } + } + return nil, nil +} + +func (d *RocksDB) FiatRatesGetSpecialTickers(key string) (*[]common.CurrencyRatesTicker, error) { + val, err := d.db.GetCF(d.ro, d.cfh[cfDefault], []byte(key)) + if err != nil { + return nil, err + } + defer val.Free() + data := val.Data() + if data == nil { + return nil, nil + } + var tickers []common.CurrencyRatesTicker + if err := json.Unmarshal(data, &tickers); err != nil { + return nil, err + } + return &tickers, nil +} + +func (d *RocksDB) FiatRatesStoreSpecialTickers(key string, tickers *[]common.CurrencyRatesTicker) error { + data, err := json.Marshal(tickers) + if err != nil { + return err + } + return d.db.PutCF(d.wo, d.cfh[cfDefault], []byte(key), data) +} diff --git a/db/fiat_test.go b/db/fiat_test.go new file mode 100644 index 0000000000..e9ce5b4e75 --- /dev/null +++ b/db/fiat_test.go @@ -0,0 +1,195 @@ +//go:build unittest + +package db + +import ( + "reflect" + "testing" + "time" + + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/common" +) + +func TestRocksTickers(t *testing.T) { + d := setupRocksDB(t, &testBitcoinParser{ + BitcoinParser: bitcoinTestnetParser(), + }) + defer closeAndDestroyRocksDB(t, d) + + // Test storing & finding tickers + pastKey, _ := time.Parse(FiatRatesTimeFormat, "20190627000000") + futureKey, _ := time.Parse(FiatRatesTimeFormat, "20190630000000") + + ts1, _ := time.Parse(FiatRatesTimeFormat, "20190628000000") + ticker1 := &common.CurrencyRatesTicker{ + Timestamp: ts1, + Rates: map[string]float32{ + "usd": 20000, + "eur": 18000, + }, + TokenRates: map[string]float32{ + "0x6B175474E89094C44Da98b954EedeAC495271d0F": 17.2, + }, + } + + ts2, _ := time.Parse(FiatRatesTimeFormat, "20190629000000") + ticker2 := &common.CurrencyRatesTicker{ + Timestamp: ts2, + Rates: map[string]float32{ + "usd": 30000, + }, + TokenRates: map[string]float32{ + "0x82dF128257A7d7556262E1AB7F1f639d9775B85E": 13.1, + "0x6B175474E89094C44Da98b954EedeAC495271d0F": 17.5, + }, + } + + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + err := d.FiatRatesStoreTicker(wb, ticker1) + if err != nil { + t.Errorf("Error storing ticker! %v", err) + } + err = d.FiatRatesStoreTicker(wb, ticker2) + if err != nil { + t.Errorf("Error storing ticker! %v", err) + } + err = d.WriteBatch(wb) + if err != nil { + t.Errorf("Error storing ticker! %v", err) + } + + // test FiatRatesGetTicker with ticker that should be in DB + t1, err := d.FiatRatesGetTicker(&ts1) + if err != nil || t1 == nil { + t.Fatalf("FiatRatesGetTicker t1 %v", err) + } + if !reflect.DeepEqual(t1, ticker1) { + t.Fatalf("FiatRatesGetTicker(t1) = %v, want %v", *t1, *ticker1) + } + // test FiatRatesGetTicker with ticker that is not in DB + t2, err := d.FiatRatesGetTicker(&pastKey) + if err != nil || t2 != nil { + t.Fatalf("FiatRatesGetTicker t2 %v, %v", err, t2) + } + + ticker, err := d.FiatRatesFindTicker(&pastKey, "", "") // should find the closest key (ticker1) + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker == nil { + t.Errorf("Ticker not found") + } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker1.Timestamp.Format(FiatRatesTimeFormat) { + t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker1.Timestamp, ticker.Timestamp) + } + + ticker, err = d.FiatRatesFindLastTicker("", "") // should find the last key (ticker2) + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker == nil { + t.Errorf("Ticker not found") + } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker2.Timestamp.Format(FiatRatesTimeFormat) { + t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker1.Timestamp, ticker.Timestamp) + } + + ticker, err = d.FiatRatesFindTicker(&futureKey, "", "") // should not find anything + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker != nil { + t.Errorf("Ticker found, but the timestamp is older than the last ticker entry.") + } + + ticker, err = d.FiatRatesFindTicker(&pastKey, "", "0x6B175474E89094C44Da98b954EedeAC495271d0F") // should find the closest key (ticker1) + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker == nil { + t.Errorf("Ticker not found") + } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker1.Timestamp.Format(FiatRatesTimeFormat) { + t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker1.Timestamp, ticker.Timestamp) + } + + ticker, err = d.FiatRatesFindTicker(&pastKey, "", "0x82dF128257A7d7556262E1AB7F1f639d9775B85E") // should find the last key (ticker2) + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker == nil { + t.Errorf("Ticker not found") + } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker2.Timestamp.Format(FiatRatesTimeFormat) { + t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker2.Timestamp, ticker.Timestamp) + } + + ticker, err = d.FiatRatesFindLastTicker("eur", "") // should find the closest key (ticker1) + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker == nil { + t.Errorf("Ticker not found") + } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker1.Timestamp.Format(FiatRatesTimeFormat) { + t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker1.Timestamp, ticker.Timestamp) + } + + ticker, err = d.FiatRatesFindLastTicker("usd", "") // should find the last key (ticker2) + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker == nil { + t.Errorf("Ticker not found") + } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker2.Timestamp.Format(FiatRatesTimeFormat) { + t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker2.Timestamp, ticker.Timestamp) + } + + ticker, err = d.FiatRatesFindLastTicker("aud", "") // should not find any key + if err != nil { + t.Errorf("TestRocksTickers err: %+v", err) + } else if ticker != nil { + t.Errorf("Ticker %v found unexpectedly for aud vsCurrency", ticker) + } + +} + +func Test_packUnpackCurrencyRatesTicker(t *testing.T) { + type args struct { + } + tests := []struct { + name string + data common.CurrencyRatesTicker + }{ + { + name: "empty", + data: common.CurrencyRatesTicker{}, + }, + { + name: "rates", + data: common.CurrencyRatesTicker{ + Rates: map[string]float32{ + "usd": 2129.2341123, + "eur": 1332.51234, + }, + }, + }, + { + name: "rates&tokenrates", + data: common.CurrencyRatesTicker{ + Rates: map[string]float32{ + "usd": 322129.987654321, + "eur": 291332.12345678, + }, + TokenRates: map[string]float32{ + "0x82dF128257A7d7556262E1AB7F1f639d9775B85E": 0.4092341123, + "0x6B175474E89094C44Da98b954EedeAC495271d0F": 12.32323232323232, + "0xdAC17F958D2ee523a2206206994597C13D831ec7": 1332421341235.51234, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + packed := packCurrencyRatesTicker(&tt.data) + got, err := unpackCurrencyRatesTicker(packed) + if err != nil { + t.Errorf("unpackCurrencyRatesTicker() error = %v", err) + return + } + if !reflect.DeepEqual(got, &tt.data) { + t.Errorf("unpackCurrencyRatesTicker() = %v, want %v", *got, tt.data) + } + }) + } +} diff --git a/db/rocksdb.go b/db/rocksdb.go index a03a2a1e62..9fa6517f09 100644 --- a/db/rocksdb.go +++ b/db/rocksdb.go @@ -4,25 +4,25 @@ import ( "bytes" "encoding/binary" "encoding/hex" - "encoding/json" "fmt" "math/big" "os" "path/filepath" "sort" "strconv" + "sync" "time" "unsafe" vlq "github.com/bsm/go-vlq" - "github.com/flier/gorocksdb" "github.com/golang/glog" "github.com/juju/errors" + "github.com/linxGnu/grocksdb" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/common" ) -const dbVersion = 5 +const dbVersion = 7 const packedHeightBytes = 4 const maxAddrDescLen = 1024 @@ -31,39 +31,11 @@ const maxAddrDescLen = 1024 // when doing huge scan, it is better to close it and reopen from time to time to free the resources const refreshIterator = 5000000 -// FiatRatesTimeFormat is a format string for storing FiatRates timestamps in rocksdb -const FiatRatesTimeFormat = "20060102150405" // YYYYMMDDhhmmss - -// CurrencyRatesTicker contains coin ticker data fetched from API -type CurrencyRatesTicker struct { - Timestamp *time.Time // return as unix timestamp in API - Rates map[string]float64 -} - -// ResultTickerAsString contains formatted CurrencyRatesTicker data -type ResultTickerAsString struct { - Timestamp int64 `json:"ts,omitempty"` - Rates map[string]float64 `json:"rates"` - Error string `json:"error,omitempty"` -} - -// ResultTickersAsString contains a formatted CurrencyRatesTicker list -type ResultTickersAsString struct { - Tickers []ResultTickerAsString `json:"tickers"` -} - -// ResultTickerListAsString contains formatted data about available currency tickers -type ResultTickerListAsString struct { - Timestamp int64 `json:"ts,omitempty"` - Tickers []string `json:"available_currencies"` - Error string `json:"error,omitempty"` -} - // RepairRocksDB calls RocksDb db repair function func RepairRocksDB(name string) error { glog.Infof("rocksdb: repair") - opts := gorocksdb.NewDefaultOptions() - return gorocksdb.RepairDb(name, opts) + opts := grocksdb.NewDefaultOptions() + return grocksdb.RepairDb(name, opts) } type connectBlockStats struct { @@ -85,19 +57,25 @@ const ( addressBalanceDetailUTXOIndexed = 2 ) +const addrContractsCacheMinSize = 300_000 // limit for caching address contracts in memory to speed up indexing + // RocksDB handle type RocksDB struct { - path string - db *gorocksdb.DB - wo *gorocksdb.WriteOptions - ro *gorocksdb.ReadOptions - cfh []*gorocksdb.ColumnFamilyHandle - chainParser bchain.BlockChainParser - is *common.InternalState - metrics *common.Metrics - cache *gorocksdb.Cache - maxOpenFiles int - cbs connectBlockStats + path string + db *grocksdb.DB + wo *grocksdb.WriteOptions + ro *grocksdb.ReadOptions + cfh []*grocksdb.ColumnFamilyHandle + chainParser bchain.BlockChainParser + is *common.InternalState + metrics *common.Metrics + cache *grocksdb.Cache + maxOpenFiles int + cbs connectBlockStats + extendedIndex bool + connectBlockMux sync.Mutex + addrContractsCacheMux sync.Mutex + addrContractsCache map[string]*unpackedAddrContracts } const ( @@ -110,8 +88,19 @@ const ( // BitcoinType cfAddressBalance cfTxAddresses + cfBlockFilter + + __break__ + // EthereumType - cfAddressContracts = cfAddressBalance + cfAddressContracts = iota - __break__ + cfAddressBalance - 1 + cfInternalData + cfContracts + cfFunctionSignatures + cfBlockInternalDataErrors + + // TODO move to common section + cfAddressAliases ) // common columns @@ -119,23 +108,23 @@ var cfNames []string var cfBaseNames = []string{"default", "height", "addresses", "blockTxs", "transactions", "fiatRates"} // type specific columns -var cfNamesBitcoinType = []string{"addressBalance", "txAddresses"} -var cfNamesEthereumType = []string{"addressContracts"} +var cfNamesBitcoinType = []string{"addressBalance", "txAddresses", "blockFilter"} +var cfNamesEthereumType = []string{"addressContracts", "internalData", "contracts", "functionSignatures", "blockInternalDataErrors", "addressAliases"} -func openDB(path string, c *gorocksdb.Cache, openFiles int) (*gorocksdb.DB, []*gorocksdb.ColumnFamilyHandle, error) { +func openDB(path string, c *grocksdb.Cache, openFiles int) (*grocksdb.DB, []*grocksdb.ColumnFamilyHandle, error) { // opts with bloom filter opts := createAndSetDBOptions(10, c, openFiles) // opts for addresses without bloom filter // from documentation: if most of your queries are executed using iterators, you shouldn't set bloom filter optsAddresses := createAndSetDBOptions(0, c, openFiles) // default, height, addresses, blockTxids, transactions - cfOptions := []*gorocksdb.Options{opts, opts, optsAddresses, opts, opts, opts} + cfOptions := []*grocksdb.Options{opts, opts, optsAddresses, opts, opts, opts} // append type specific options count := len(cfNames) - len(cfOptions) for i := 0; i < count; i++ { cfOptions = append(cfOptions, opts) } - db, cfh, err := gorocksdb.OpenDbColumnFamilies(opts, path, cfNames, cfOptions) + db, cfh, err := grocksdb.OpenDbColumnFamilies(opts, path, cfNames, cfOptions) if err != nil { return nil, nil, err } @@ -144,7 +133,7 @@ func openDB(path string, c *gorocksdb.Cache, openFiles int) (*gorocksdb.DB, []*g // NewRocksDB opens an internal handle to RocksDB environment. Close // needs to be called to release it. -func NewRocksDB(path string, cacheSize, maxOpenFiles int, parser bchain.BlockChainParser, metrics *common.Metrics) (d *RocksDB, err error) { +func NewRocksDB(path string, cacheSize, maxOpenFiles int, parser bchain.BlockChainParser, metrics *common.Metrics, extendedIndex bool) (d *RocksDB, err error) { glog.Infof("rocksdb: opening %s, required data version %v, cache size %v, max open files %v", path, dbVersion, cacheSize, maxOpenFiles) cfNames = append([]string{}, cfBaseNames...) @@ -153,18 +142,23 @@ func NewRocksDB(path string, cacheSize, maxOpenFiles int, parser bchain.BlockCha cfNames = append(cfNames, cfNamesBitcoinType...) } else if chainType == bchain.ChainEthereumType { cfNames = append(cfNames, cfNamesEthereumType...) + extendedIndex = false } else { return nil, errors.New("Unknown chain type") } - c := gorocksdb.NewLRUCache(uint64(cacheSize)) + c := grocksdb.NewLRUCache(uint64(cacheSize)) db, cfh, err := openDB(path, c, maxOpenFiles) if err != nil { return nil, err } - wo := gorocksdb.NewDefaultWriteOptions() - ro := gorocksdb.NewDefaultReadOptions() - return &RocksDB{path, db, wo, ro, cfh, parser, nil, metrics, c, maxOpenFiles, connectBlockStats{}}, nil + wo := grocksdb.NewDefaultWriteOptions() + ro := grocksdb.NewDefaultReadOptions() + r := &RocksDB{path, db, wo, ro, cfh, parser, nil, metrics, c, maxOpenFiles, connectBlockStats{}, extendedIndex, sync.Mutex{}, sync.Mutex{}, make(map[string]*unpackedAddrContracts)} + if chainType == bchain.ChainEthereumType { + go r.periodicStoreAddrContractsCache() + } + return r, nil } func (d *RocksDB) closeDB() error { @@ -176,107 +170,13 @@ func (d *RocksDB) closeDB() error { return nil } -// FiatRatesConvertDate checks if the date is in correct format and returns the Time object. -// Possible formats are: YYYYMMDDhhmmss, YYYYMMDDhhmm, YYYYMMDDhh, YYYYMMDD -func FiatRatesConvertDate(date string) (*time.Time, error) { - for format := FiatRatesTimeFormat; len(format) >= 8; format = format[:len(format)-2] { - convertedDate, err := time.Parse(format, date) - if err == nil { - return &convertedDate, nil - } - } - msg := "Date \"" + date + "\" does not match any of available formats. " - msg += "Possible formats are: YYYYMMDDhhmmss, YYYYMMDDhhmm, YYYYMMDDhh, YYYYMMDD" - return nil, errors.New(msg) -} - -// FiatRatesStoreTicker stores ticker data at the specified time -func (d *RocksDB) FiatRatesStoreTicker(ticker *CurrencyRatesTicker) error { - if len(ticker.Rates) == 0 { - return errors.New("Error storing ticker: empty rates") - } else if ticker.Timestamp == nil { - return errors.New("Error storing ticker: empty timestamp") - } - ratesMarshalled, err := json.Marshal(ticker.Rates) - if err != nil { - glog.Error("Error marshalling ticker rates: ", err) - return err - } - timeFormatted := ticker.Timestamp.UTC().Format(FiatRatesTimeFormat) - err = d.db.PutCF(d.wo, d.cfh[cfFiatRates], []byte(timeFormatted), ratesMarshalled) - if err != nil { - glog.Error("Error storing ticker: ", err) - return err - } - return nil -} - -// FiatRatesFindTicker gets FiatRates data closest to the specified timestamp -func (d *RocksDB) FiatRatesFindTicker(tickerTime *time.Time) (*CurrencyRatesTicker, error) { - ticker := &CurrencyRatesTicker{} - tickerTimeFormatted := tickerTime.UTC().Format(FiatRatesTimeFormat) - it := d.db.NewIteratorCF(d.ro, d.cfh[cfFiatRates]) - defer it.Close() - - for it.Seek([]byte(tickerTimeFormatted)); it.Valid(); it.Next() { - timeObj, err := time.Parse(FiatRatesTimeFormat, string(it.Key().Data())) - if err != nil { - glog.Error("FiatRatesFindTicker time parse error: ", err) - return nil, err - } - timeObj = timeObj.UTC() - ticker.Timestamp = &timeObj - err = json.Unmarshal(it.Value().Data(), &ticker.Rates) - if err != nil { - glog.Error("FiatRatesFindTicker error unpacking rates: ", err) - return nil, err - } - break - } - if err := it.Err(); err != nil { - glog.Error("FiatRatesFindTicker Iterator error: ", err) - return nil, err - } - if !it.Valid() { - return nil, nil // ticker not found - } - return ticker, nil -} - -// FiatRatesFindLastTicker gets the last FiatRates record -func (d *RocksDB) FiatRatesFindLastTicker() (*CurrencyRatesTicker, error) { - ticker := &CurrencyRatesTicker{} - it := d.db.NewIteratorCF(d.ro, d.cfh[cfFiatRates]) - defer it.Close() - - for it.SeekToLast(); it.Valid(); it.Next() { - timeObj, err := time.Parse(FiatRatesTimeFormat, string(it.Key().Data())) - if err != nil { - glog.Error("FiatRatesFindTicker time parse error: ", err) - return nil, err - } - timeObj = timeObj.UTC() - ticker.Timestamp = &timeObj - err = json.Unmarshal(it.Value().Data(), &ticker.Rates) - if err != nil { - glog.Error("FiatRatesFindTicker error unpacking rates: ", err) - return nil, err - } - break - } - if err := it.Err(); err != nil { - glog.Error("FiatRatesFindLastTicker Iterator error: ", err) - return ticker, err - } - if !it.Valid() { - return nil, nil // ticker not found - } - return ticker, nil -} - // Close releases the RocksDB environment opened in NewRocksDB. func (d *RocksDB) Close() error { if d.db != nil { + // store cached address contracts + if d.chainParser.GetChainType() == bchain.ChainEthereumType { + d.storeAddrContractsCache() + } // store the internal state of the app if d.is != nil && d.is.DbState == common.DbStateOpen { d.is.DbState = common.DbStateClosed @@ -316,6 +216,15 @@ func atoUint64(s string) uint64 { return uint64(i) } +func (d *RocksDB) WriteBatch(wb *grocksdb.WriteBatch) error { + return d.db.Write(d.wo, wb) +} + +// HasExtendedIndex returns true if the DB indexes input txids and spending data +func (d *RocksDB) HasExtendedIndex() bool { + return d.extendedIndex +} + // GetMemoryStats returns memory usage statistics as reported by RocksDB func (d *RocksDB) GetMemoryStats() string { var total, indexAndFilter, memtable uint64 @@ -437,7 +346,10 @@ const ( // ConnectBlock indexes addresses in the block and stores them in db func (d *RocksDB) ConnectBlock(block *bchain.Block) error { - wb := gorocksdb.NewWriteBatch() + d.connectBlockMux.Lock() + defer d.connectBlockMux.Unlock() + + wb := grocksdb.NewWriteBatch() defer wb.Destroy() if glog.V(2) { @@ -453,7 +365,14 @@ func (d *RocksDB) ConnectBlock(block *bchain.Block) error { if chainType == bchain.ChainBitcoinType { txAddressesMap := make(map[string]*TxAddresses) balances := make(map[string]*AddrBalance) - if err := d.processAddressesBitcoinType(block, addresses, txAddressesMap, balances); err != nil { + gf, err := bchain.NewGolombFilter(d.is.BlockGolombFilterP, d.is.BlockFilterScripts, block.BlockHeader.Hash, d.is.BlockFilterUseZeroedKey) + if err != nil { + glog.Error("ConnectBlock golomb filter error ", err) + gf = nil + } else if gf != nil && !gf.Enabled { + gf = nil + } + if err := d.processAddressesBitcoinType(block, addresses, txAddressesMap, balances, gf); err != nil { return err } if err := d.storeTxAddresses(wb, txAddressesMap); err != nil { @@ -465,13 +384,25 @@ func (d *RocksDB) ConnectBlock(block *bchain.Block) error { if err := d.storeAndCleanupBlockTxs(wb, block); err != nil { return err } + if gf != nil { + blockFilter := gf.Compute() + if err := d.storeBlockFilter(wb, block.BlockHeader.Hash, blockFilter); err != nil { + return err + } + } } else if chainType == bchain.ChainEthereumType { - addressContracts := make(map[string]*AddrContracts) + addressContracts := make(map[string]*unpackedAddrContracts) blockTxs, err := d.processAddressesEthereumType(block, addresses, addressContracts) if err != nil { return err } - if err := d.storeAddressContracts(wb, addressContracts); err != nil { + if err := d.storeUnpackedAddressContracts(wb, addressContracts); err != nil { + return err + } + if err := d.storeInternalDataEthereumType(wb, blockTxs); err != nil { + return err + } + if err = d.storeBlockSpecificDataEthereumType(wb, block); err != nil { return err } if err := d.storeAndCleanupBlockTxsEthereumType(wb, block, blockTxs); err != nil { @@ -483,10 +414,13 @@ func (d *RocksDB) ConnectBlock(block *bchain.Block) error { if err := d.storeAddresses(wb, block.Height, addresses); err != nil { return err } - if err := d.db.Write(d.wo, wb); err != nil { + if err := d.WriteBatch(wb); err != nil { return err } - d.is.AppendBlockTime(uint32(block.Time)) + avg := d.is.SetBlockTime(block.Height, uint32(block.Time)) + if d.metrics != nil { + d.metrics.AvgBlockPeriod.Set(float64(avg)) + } return nil } @@ -511,6 +445,9 @@ type outpoint struct { type TxInput struct { AddrDesc bchain.AddressDescriptor ValueSat big.Int + // extended index properties + Txid string + Vout uint32 } // Addresses converts AddressDescriptor of the input to array of strings @@ -523,6 +460,10 @@ type TxOutput struct { AddrDesc bchain.AddressDescriptor Spent bool ValueSat big.Int + // extended index properties + SpentTxid string + SpentIndex uint32 + SpentHeight uint32 } // Addresses converts AddressDescriptor of the output to array of strings @@ -535,6 +476,8 @@ type TxAddresses struct { Height uint32 Inputs []TxInput Outputs []TxOutput + // extended index properties + VSize uint32 } // Utxo holds information about unspent transaction output @@ -677,7 +620,7 @@ func (d *RocksDB) GetAndResetConnectBlockStats() string { return s } -func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses addressesMap, txAddressesMap map[string]*TxAddresses, balances map[string]*AddrBalance) error { +func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses addressesMap, txAddressesMap map[string]*TxAddresses, balances map[string]*AddrBalance, gf *bchain.GolombFilter) error { blockTxIDs := make([][]byte, len(block.Txs)) blockTxAddresses := make([]*TxAddresses, len(block.Txs)) // first process all outputs so that inputs can refer to txs in this block @@ -689,13 +632,21 @@ func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses add } blockTxIDs[txi] = btxID ta := TxAddresses{Height: block.Height} + if d.extendedIndex { + if tx.VSize > 0 { + ta.VSize = uint32(tx.VSize) + } else { + ta.VSize = uint32(len(tx.Hex)) + } + } ta.Outputs = make([]TxOutput, len(tx.Vout)) txAddressesMap[string(btxID)] = &ta blockTxAddresses[txi] = &ta - for i, output := range tx.Vout { + for i := range tx.Vout { + output := &tx.Vout[i] tao := &ta.Outputs[i] tao.ValueSat = output.ValueSat - addrDesc, err := d.chainParser.GetAddrDescFromVout(&output) + addrDesc, err := d.chainParser.GetAddrDescFromVout(output) if err != nil || len(addrDesc) == 0 || len(addrDesc) > maxAddrDescLen { if err != nil { // do not log ErrAddressMissing, transactions can be without to address (for example eth contracts) @@ -707,6 +658,9 @@ func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses add } continue } + if gf != nil { + gf.AddAddrDesc(addrDesc, tx) + } tao.AddrDesc = addrDesc if d.chainParser.IsAddrDescIndexable(addrDesc) { strAddrDesc := string(addrDesc) @@ -745,7 +699,8 @@ func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses add ta := blockTxAddresses[txi] ta.Inputs = make([]TxInput, len(tx.Vin)) logged := false - for i, input := range tx.Vin { + for i := range tx.Vin { + input := &tx.Vin[i] tai := &ta.Inputs[i] btxID, err := d.chainParser.PackTxid(input.Txid) if err != nil { @@ -780,10 +735,20 @@ func (d *RocksDB) processAddressesBitcoinType(block *bchain.Block, addresses add if spentOutput.Spent { glog.Warningf("rocksdb: height %d, tx %v, input tx %v vout %v is double spend", block.Height, tx.Txid, input.Txid, input.Vout) } + if gf != nil { + gf.AddAddrDesc(spentOutput.AddrDesc, tx) + } tai.AddrDesc = spentOutput.AddrDesc tai.ValueSat = spentOutput.ValueSat // mark the output as spent in tx spentOutput.Spent = true + if d.extendedIndex { + spentOutput.SpentTxid = tx.Txid + spentOutput.SpentIndex = uint32(i) + spentOutput.SpentHeight = block.Height + tai.Txid = input.Txid + tai.Vout = input.Vout + } if len(spentOutput.AddrDesc) == 0 { if !logged { glog.V(1).Infof("rocksdb: height %d, tx %v, input tx %v vout %v skipping empty address", block.Height, tx.Txid, input.Txid, input.Vout) @@ -846,7 +811,25 @@ func addToAddressesMap(addresses addressesMap, strAddrDesc string, btxID []byte, return false } -func (d *RocksDB) storeAddresses(wb *gorocksdb.WriteBatch, height uint32, addresses addressesMap) error { +func (d *RocksDB) getTxIndexesForAddressAndBlock(addrDesc bchain.AddressDescriptor, height uint32) ([]txIndexes, error) { + key := packAddressKey(addrDesc, height) + val, err := d.db.GetCF(d.ro, d.cfh[cfAddresses], key) + if err != nil { + return nil, err + } + defer val.Free() + // nil data means the key was not found in DB + if val.Data() == nil { + return nil, nil + } + rv, err := d.unpackTxIndexes(val.Data()) + if err != nil { + return nil, err + } + return rv, nil +} + +func (d *RocksDB) storeAddresses(wb *grocksdb.WriteBatch, height uint32, addresses addressesMap) error { for addrDesc, txi := range addresses { ba := bchain.AddressDescriptor(addrDesc) key := packAddressKey(ba, height) @@ -856,17 +839,17 @@ func (d *RocksDB) storeAddresses(wb *gorocksdb.WriteBatch, height uint32, addres return nil } -func (d *RocksDB) storeTxAddresses(wb *gorocksdb.WriteBatch, am map[string]*TxAddresses) error { +func (d *RocksDB) storeTxAddresses(wb *grocksdb.WriteBatch, am map[string]*TxAddresses) error { varBuf := make([]byte, maxPackedBigintBytes) buf := make([]byte, 1024) for txID, ta := range am { - buf = packTxAddresses(ta, buf, varBuf) + buf = d.packTxAddresses(ta, buf, varBuf) wb.PutCF(d.cfh[cfTxAddresses], []byte(txID), buf) } return nil } -func (d *RocksDB) storeBalances(wb *gorocksdb.WriteBatch, abm map[string]*AddrBalance) error { +func (d *RocksDB) storeBalances(wb *grocksdb.WriteBatch, abm map[string]*AddrBalance) error { // allocate buffer initial buffer buf := make([]byte, 1024) varBuf := make([]byte, maxPackedBigintBytes) @@ -882,7 +865,7 @@ func (d *RocksDB) storeBalances(wb *gorocksdb.WriteBatch, abm map[string]*AddrBa return nil } -func (d *RocksDB) cleanupBlockTxs(wb *gorocksdb.WriteBatch, block *bchain.Block) error { +func (d *RocksDB) cleanupBlockTxs(wb *grocksdb.WriteBatch, block *bchain.Block) error { keep := d.chainParser.KeepBlockAddresses() // cleanup old block address if block.Height > uint32(keep) { @@ -897,13 +880,13 @@ func (d *RocksDB) cleanupBlockTxs(wb *gorocksdb.WriteBatch, block *bchain.Block) break } val.Free() - d.db.DeleteCF(d.wo, d.cfh[cfBlockTxs], key) + wb.DeleteCF(d.cfh[cfBlockTxs], key) } } return nil } -func (d *RocksDB) storeAndCleanupBlockTxs(wb *gorocksdb.WriteBatch, block *bchain.Block) error { +func (d *RocksDB) storeAndCleanupBlockTxs(wb *grocksdb.WriteBatch, block *bchain.Block) error { pl := d.chainParser.PackedTxidLen() buf := make([]byte, 0, pl*len(block.Txs)) varBuf := make([]byte, vlq.MaxLen64) @@ -1004,7 +987,7 @@ func (d *RocksDB) getTxAddresses(btxID []byte) (*TxAddresses, error) { if len(buf) < 3 { return nil, nil } - return unpackTxAddresses(buf) + return d.unpackTxAddresses(buf) } // GetTxAddresses returns TxAddresses for given txid or nil if not found @@ -1035,34 +1018,63 @@ func (d *RocksDB) AddrDescForOutpoint(outpoint bchain.Outpoint) (bchain.AddressD return ta.Outputs[outpoint.Vout].AddrDesc, &ta.Outputs[outpoint.Vout].ValueSat } -func packTxAddresses(ta *TxAddresses, buf []byte, varBuf []byte) []byte { +func (d *RocksDB) packTxAddresses(ta *TxAddresses, buf []byte, varBuf []byte) []byte { buf = buf[:0] l := packVaruint(uint(ta.Height), varBuf) buf = append(buf, varBuf[:l]...) + if d.extendedIndex { + l = packVaruint(uint(ta.VSize), varBuf) + buf = append(buf, varBuf[:l]...) + } l = packVaruint(uint(len(ta.Inputs)), varBuf) buf = append(buf, varBuf[:l]...) for i := range ta.Inputs { - buf = appendTxInput(&ta.Inputs[i], buf, varBuf) + buf = d.appendTxInput(&ta.Inputs[i], buf, varBuf) } l = packVaruint(uint(len(ta.Outputs)), varBuf) buf = append(buf, varBuf[:l]...) for i := range ta.Outputs { - buf = appendTxOutput(&ta.Outputs[i], buf, varBuf) + buf = d.appendTxOutput(&ta.Outputs[i], buf, varBuf) } return buf } -func appendTxInput(txi *TxInput, buf []byte, varBuf []byte) []byte { +func (d *RocksDB) appendTxInput(txi *TxInput, buf []byte, varBuf []byte) []byte { la := len(txi.AddrDesc) - l := packVaruint(uint(la), varBuf) - buf = append(buf, varBuf[:l]...) - buf = append(buf, txi.AddrDesc...) - l = packBigint(&txi.ValueSat, varBuf) - buf = append(buf, varBuf[:l]...) + var l int + if d.extendedIndex { + if txi.Txid == "" { + // coinbase transaction + la = ^la + } + l = packVarint(la, varBuf) + buf = append(buf, varBuf[:l]...) + buf = append(buf, txi.AddrDesc...) + l = packBigint(&txi.ValueSat, varBuf) + buf = append(buf, varBuf[:l]...) + if la >= 0 { + btxID, err := d.chainParser.PackTxid(txi.Txid) + if err != nil { + if err != bchain.ErrTxidMissing { + glog.Error("Cannot pack txid ", txi.Txid) + } + btxID = make([]byte, d.chainParser.PackedTxidLen()) + } + buf = append(buf, btxID...) + l = packVaruint(uint(txi.Vout), varBuf) + buf = append(buf, varBuf[:l]...) + } + } else { + l = packVaruint(uint(la), varBuf) + buf = append(buf, varBuf[:l]...) + buf = append(buf, txi.AddrDesc...) + l = packBigint(&txi.ValueSat, varBuf) + buf = append(buf, varBuf[:l]...) + } return buf } -func appendTxOutput(txo *TxOutput, buf []byte, varBuf []byte) []byte { +func (d *RocksDB) appendTxOutput(txo *TxOutput, buf []byte, varBuf []byte) []byte { la := len(txo.AddrDesc) if txo.Spent { la = ^la @@ -1072,6 +1084,20 @@ func appendTxOutput(txo *TxOutput, buf []byte, varBuf []byte) []byte { buf = append(buf, txo.AddrDesc...) l = packBigint(&txo.ValueSat, varBuf) buf = append(buf, varBuf[:l]...) + if d.extendedIndex && txo.Spent { + btxID, err := d.chainParser.PackTxid(txo.SpentTxid) + if err != nil { + if err != bchain.ErrTxidMissing { + glog.Error("Cannot pack txid ", txo.SpentTxid) + } + btxID = make([]byte, d.chainParser.PackedTxidLen()) + } + buf = append(buf, btxID...) + l = packVaruint(uint(txo.SpentIndex), varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(uint(txo.SpentHeight), varBuf) + buf = append(buf, varBuf[:l]...) + } return buf } @@ -1123,7 +1149,7 @@ func packAddrBalance(ab *AddrBalance, buf, varBuf []byte) []byte { l = packBigint(&ab.BalanceSat, varBuf) buf = append(buf, varBuf[:l]...) for _, utxo := range ab.Utxos { - // if Vout < 0, utxo is marked as spent + // if Vout < 0, utxo is marked as spent and removed from the entry if utxo.Vout >= 0 { buf = append(buf, utxo.BtxID...) l = packVaruint(uint(utxo.Vout), varBuf) @@ -1137,34 +1163,62 @@ func packAddrBalance(ab *AddrBalance, buf, varBuf []byte) []byte { return buf } -func unpackTxAddresses(buf []byte) (*TxAddresses, error) { +func (d *RocksDB) unpackTxAddresses(buf []byte) (*TxAddresses, error) { ta := TxAddresses{} height, l := unpackVaruint(buf) ta.Height = uint32(height) + if d.extendedIndex { + vsize, ll := unpackVaruint(buf[l:]) + ta.VSize = uint32(vsize) + l += ll + } inputs, ll := unpackVaruint(buf[l:]) l += ll ta.Inputs = make([]TxInput, inputs) for i := uint(0); i < inputs; i++ { - l += unpackTxInput(&ta.Inputs[i], buf[l:]) + l += d.unpackTxInput(&ta.Inputs[i], buf[l:]) } outputs, ll := unpackVaruint(buf[l:]) l += ll ta.Outputs = make([]TxOutput, outputs) for i := uint(0); i < outputs; i++ { - l += unpackTxOutput(&ta.Outputs[i], buf[l:]) + l += d.unpackTxOutput(&ta.Outputs[i], buf[l:]) } return &ta, nil } -func unpackTxInput(ti *TxInput, buf []byte) int { - al, l := unpackVaruint(buf) - ti.AddrDesc = append([]byte(nil), buf[l:l+int(al)]...) - al += uint(l) - ti.ValueSat, l = unpackBigint(buf[al:]) - return l + int(al) +func (d *RocksDB) unpackTxInput(ti *TxInput, buf []byte) int { + if d.extendedIndex { + al, l := unpackVarint(buf) + var coinbase bool + if al < 0 { + coinbase = true + al = ^al + } + ti.AddrDesc = append([]byte(nil), buf[l:l+al]...) + al += l + ti.ValueSat, l = unpackBigint(buf[al:]) + al += l + if !coinbase { + l = d.chainParser.PackedTxidLen() + ti.Txid, _ = d.chainParser.UnpackTxid(buf[al : al+l]) + al += l + var i uint + i, l = unpackVaruint(buf[al:]) + ti.Vout = uint32(i) + al += l + } + return al + } else { + al, l := unpackVaruint(buf) + ti.AddrDesc = append([]byte(nil), buf[l:l+int(al)]...) + al += uint(l) + ti.ValueSat, l = unpackBigint(buf[al:]) + return l + int(al) + } } -func unpackTxOutput(to *TxOutput, buf []byte) int { +func (d *RocksDB) unpackTxOutput(to *TxOutput, buf []byte) int { al, l := unpackVarint(buf) if al < 0 { to.Spent = true @@ -1173,7 +1227,20 @@ func unpackTxOutput(to *TxOutput, buf []byte) int { to.AddrDesc = append([]byte(nil), buf[l:l+al]...) al += l to.ValueSat, l = unpackBigint(buf[al:]) - return l + al + al += l + if d.extendedIndex && to.Spent { + l = d.chainParser.PackedTxidLen() + to.SpentTxid, _ = d.chainParser.UnpackTxid(buf[al : al+l]) + al += l + var i uint + i, l = unpackVaruint(buf[al:]) + al += l + to.SpentIndex = uint32(i) + i, l = unpackVaruint(buf[al:]) + to.SpentHeight = uint32(i) + al += l + } + return al } func (d *RocksDB) packTxIndexes(txi []txIndexes) []byte { @@ -1195,6 +1262,34 @@ func (d *RocksDB) packTxIndexes(txi []txIndexes) []byte { return buf } +func (d *RocksDB) unpackTxIndexes(buf []byte) ([]txIndexes, error) { + var retval []txIndexes + txidUnpackedLen := d.chainParser.PackedTxidLen() + for len(buf) > txidUnpackedLen { + btxID := make([]byte, txidUnpackedLen) + copy(btxID, buf[:txidUnpackedLen]) + indexes := make([]int32, 0, 16) + buf = buf[txidUnpackedLen:] + for { + index, l := unpackVarint32(buf) + indexes = append(indexes, index>>1) + buf = buf[l:] + if index&1 == 1 { + break + } + } + retval = append(retval, txIndexes{ + btxID: btxID, + indexes: indexes, + }) + } + // reverse the return values, packTxIndexes is storing it in reverse + for i, j := 0, len(retval)-1; i < j; i, j = i+1, j-1 { + retval[i], retval[j] = retval[j], retval[i] + } + return retval, nil +} + func (d *RocksDB) packOutpoints(outpoints []outpoint) []byte { buf := make([]byte, 0, 32) bvout := make([]byte, vlq.MaxLen32) @@ -1331,7 +1426,7 @@ func (d *RocksDB) GetBlockInfo(height uint32) (*BlockInfo, error) { return bi, err } -func (d *RocksDB) writeHeightFromBlock(wb *gorocksdb.WriteBatch, block *bchain.Block, op int) error { +func (d *RocksDB) writeHeightFromBlock(wb *grocksdb.WriteBatch, block *bchain.Block, op int) error { return d.writeHeight(wb, block.Height, &BlockInfo{ Hash: block.Hash, Time: block.Time, @@ -1341,7 +1436,7 @@ func (d *RocksDB) writeHeightFromBlock(wb *gorocksdb.WriteBatch, block *bchain.B }, op) } -func (d *RocksDB) writeHeight(wb *gorocksdb.WriteBatch, height uint32, bi *BlockInfo, op int) error { +func (d *RocksDB) writeHeight(wb *grocksdb.WriteBatch, height uint32, bi *BlockInfo, op int) error { key := packUint(height) switch op { case opInsert: @@ -1358,9 +1453,53 @@ func (d *RocksDB) writeHeight(wb *gorocksdb.WriteBatch, height uint32, bi *Block return nil } +// address alias support +var cachedAddressAliasRecords = make(map[string]string) +var cachedAddressAliasRecordsMux sync.Mutex + +// InitAddressAliasRecords loads all records to cache +func (d *RocksDB) InitAddressAliasRecords() (int, error) { + count := 0 + cachedAddressAliasRecordsMux.Lock() + defer cachedAddressAliasRecordsMux.Unlock() + it := d.db.NewIteratorCF(d.ro, d.cfh[cfAddressAliases]) + defer it.Close() + for it.SeekToFirst(); it.Valid(); it.Next() { + address := string(it.Key().Data()) + name := string(it.Value().Data()) + if address != "" && name != "" { + cachedAddressAliasRecords[address] = d.chainParser.FormatAddressAlias(address, name) + count++ + } + } + return count, nil +} + +func (d *RocksDB) GetAddressAlias(address string) string { + cachedAddressAliasRecordsMux.Lock() + name := cachedAddressAliasRecords[address] + cachedAddressAliasRecordsMux.Unlock() + return name +} + +func (d *RocksDB) storeAddressAliasRecords(wb *grocksdb.WriteBatch, records []bchain.AddressAliasRecord) error { + if d.chainParser.UseAddressAliases() { + for i := range records { + r := &records[i] + if len(r.Name) > 0 { + wb.PutCF(d.cfh[cfAddressAliases], []byte(r.Address), []byte(r.Name)) + cachedAddressAliasRecordsMux.Lock() + cachedAddressAliasRecords[r.Address] = d.chainParser.FormatAddressAlias(r.Address, r.Name) + cachedAddressAliasRecordsMux.Unlock() + } + } + } + return nil +} + // Disconnect blocks -func (d *RocksDB) disconnectTxAddressesInputs(wb *gorocksdb.WriteBatch, btxID []byte, inputs []outpoint, txa *TxAddresses, txAddressesToUpdate map[string]*TxAddresses, +func (d *RocksDB) disconnectTxAddressesInputs(wb *grocksdb.WriteBatch, btxID []byte, inputs []outpoint, txa *TxAddresses, txAddressesToUpdate map[string]*TxAddresses, getAddressBalance func(addrDesc bchain.AddressDescriptor) (*AddrBalance, error), addressFoundInTx func(addrDesc bchain.AddressDescriptor, btxID []byte) bool) error { var err error @@ -1416,7 +1555,7 @@ func (d *RocksDB) disconnectTxAddressesInputs(wb *gorocksdb.WriteBatch, btxID [] return nil } -func (d *RocksDB) disconnectTxAddressesOutputs(wb *gorocksdb.WriteBatch, btxID []byte, txa *TxAddresses, +func (d *RocksDB) disconnectTxAddressesOutputs(wb *grocksdb.WriteBatch, btxID []byte, txa *TxAddresses, getAddressBalance func(addrDesc bchain.AddressDescriptor) (*AddrBalance, error), addressFoundInTx func(addrDesc bchain.AddressDescriptor, btxID []byte) bool) error { for i, t := range txa.Outputs { @@ -1447,8 +1586,21 @@ func (d *RocksDB) disconnectTxAddressesOutputs(wb *gorocksdb.WriteBatch, btxID [ return nil } +func (d *RocksDB) disconnectBlockFilter(wb *grocksdb.WriteBatch, height uint32) error { + blockHash, err := d.GetBlockHash(height) + if err != nil { + return err + } + blockHashBytes, err := hex.DecodeString(blockHash) + if err != nil { + return err + } + wb.DeleteCF(d.cfh[cfBlockFilter], blockHashBytes) + return nil +} + func (d *RocksDB) disconnectBlock(height uint32, blockTxs []blockTxs) error { - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() txAddressesToUpdate := make(map[string]*TxAddresses) txAddresses := make([]*TxAddresses, len(blockTxs)) @@ -1532,7 +1684,10 @@ func (d *RocksDB) disconnectBlock(height uint32, blockTxs []blockTxs) error { wb.DeleteCF(d.cfh[cfTransactions], b) wb.DeleteCF(d.cfh[cfTxAddresses], b) } - return d.db.Write(d.wo, wb) + if err := d.disconnectBlockFilter(wb, height); err != nil { + return err + } + return d.WriteBatch(wb) } // DisconnectBlockRangeBitcoinType removes all data belonging to blocks in range lower-higher @@ -1560,7 +1715,7 @@ func (d *RocksDB) DisconnectBlockRangeBitcoinType(lower uint32, higher uint32) e return nil } -func (d *RocksDB) storeBalancesDisconnect(wb *gorocksdb.WriteBatch, balances map[string]*AddrBalance) { +func (d *RocksDB) storeBalancesDisconnect(wb *grocksdb.WriteBatch, balances map[string]*AddrBalance) { for _, b := range balances { if b != nil { // remove spent utxos @@ -1594,13 +1749,26 @@ func dirSize(path string) (int64, error) { return size, err } +// limit the number of size on disk calculations by restricting it to once a minute +var databaseSizeOnDisk int64 +var nextDatabaseSizeOnDisk time.Time +var databaseSizeOnDiskMux sync.Mutex + // DatabaseSizeOnDisk returns size of the database in bytes func (d *RocksDB) DatabaseSizeOnDisk() int64 { + databaseSizeOnDiskMux.Lock() + defer databaseSizeOnDiskMux.Unlock() + now := time.Now().UTC() + if now.Before(nextDatabaseSizeOnDisk) { + return databaseSizeOnDisk + } size, err := dirSize(d.path) if err != nil { glog.Warning("rocksdb: DatabaseSizeOnDisk: ", err) return 0 } + databaseSizeOnDisk = size + nextDatabaseSizeOnDisk = now.Add(60 * time.Second) return size } @@ -1646,14 +1814,14 @@ func (d *RocksDB) DeleteTx(txid string) error { return nil } // use write batch so that this delete matches other deletes - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() d.internalDeleteTx(wb, key) - return d.db.Write(d.wo, wb) + return d.WriteBatch(wb) } // internalDeleteTx checks if tx is cached and updates internal state accordingly -func (d *RocksDB) internalDeleteTx(wb *gorocksdb.WriteBatch, key []byte) { +func (d *RocksDB) internalDeleteTx(wb *grocksdb.WriteBatch, key []byte) { val, err := d.db.GetCF(d.ro, d.cfh[cfTransactions], key) // ignore error, it is only for statistics if err == nil { @@ -1693,34 +1861,105 @@ func (d *RocksDB) loadBlockTimes() ([]uint32, error) { } times = append(times, time) } - glog.Info("loaded ", len(times), " block times") return times, nil } -// LoadInternalState loads from db internal state or initializes a new one if not yet stored -func (d *RocksDB) LoadInternalState(rpcCoin string) (*common.InternalState, error) { - val, err := d.db.GetCF(d.ro, d.cfh[cfDefault], []byte(internalStateKey)) +func (d *RocksDB) setBlockTimes() { + start := time.Now() + bt, err := d.loadBlockTimes() if err != nil { - return nil, err + glog.Error("rocksdb: cannot load block times ", err) + return } - defer val.Free() - data := val.Data() - var is *common.InternalState - if len(data) == 0 { - is = &common.InternalState{Coin: rpcCoin, UtxoChecked: true} + avg := d.is.SetBlockTimes(bt) + if d.metrics != nil { + d.metrics.AvgBlockPeriod.Set(float64(avg)) + } + glog.Info("rocksdb: processed block times in ", time.Since(start)) +} + +func (d *RocksDB) migrateVersion5To6(sc, nc *common.InternalStateColumn) error { + // upgrade of DB 5 to 6 for BitcoinType coins is possible + // columns transactions and fiatRates must be cleared as they are not compatible + if d.chainParser.GetChainType() == bchain.ChainBitcoinType { + if nc.Name == "transactions" { + d.db.DeleteRangeCF(d.wo, d.cfh[cfTransactions], []byte{0}, []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) + } else if nc.Name == "fiatRates" { + d.db.DeleteRangeCF(d.wo, d.cfh[cfFiatRates], []byte{0}, []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) + } + glog.Infof("Column %s upgraded from v%d to v%d", nc.Name, sc.Version, dbVersion) } else { - is, err = common.UnpackInternalState(data) + return errors.Errorf("DB version %v of column '%v' does not match the required version %v. DB is not compatible.", sc.Version, sc.Name, dbVersion) + } + return nil +} + +func (d *RocksDB) migrateAddrContractsToV7(approxRows int64) error { + glog.Info("MigrateAddrContracts: starting, will process approximately ", approxRows, " rows") + var row int64 + var seekKey []byte + // do not use cache + ro := grocksdb.NewDefaultReadOptions() + ro.SetFillCache(false) + for { + var addrDesc bchain.AddressDescriptor + it := d.db.NewIteratorCF(ro, d.cfh[cfAddressContracts]) + if row == 0 { + it.SeekToFirst() + } else { + glog.Info("MigrateAddrContracts: row ", row) + it.Seek(seekKey) + it.Next() + } + + wb := grocksdb.NewWriteBatch() + for count := 0; it.Valid() && count < refreshIterator; it.Next() { + addrDesc = append([]byte{}, it.Key().Data()...) + buf := it.Value().Data() + count++ + row++ + acs, err := unpackAddrContractsV6(buf, addrDesc) + if err != nil { + glog.Error(err, ", ", hex.EncodeToString(buf)) + acs = &AddrContracts{} + } + repacked := packAddrContracts(acs) + wb.PutCF(d.cfh[cfAddressContracts], addrDesc, repacked) + } + err := d.WriteBatch(wb) + wb.Destroy() if err != nil { - return nil, err + return errors.Errorf("error storing repacked data %v", err) } - // verify that the rpc coin matches DB coin - // running it mismatched would corrupt the database - if is.Coin == "" { - is.Coin = rpcCoin - } else if is.Coin != rpcCoin { - return nil, errors.Errorf("Coins do not match. DB coin %v, RPC coin %v", is.Coin, rpcCoin) + + seekKey = addrDesc + valid := it.Valid() + it.Close() + if !valid { + break + } + } + glog.Info("MigrateAddrContracts: finished, migrated ", row, " rows") + return nil +} + +func (d *RocksDB) migrateVersion6To7(sc, nc *common.InternalStateColumn) error { + // DB v7 must migrate ethereum type column addressContracts + if d.chainParser.GetChainType() == bchain.ChainEthereumType { + if nc.Name == "addressContracts" { + err := d.migrateAddrContractsToV7(sc.Rows) + if err != nil { + return err + } + } else if nc.Name == "transactions" { + d.db.DeleteRangeCF(d.wo, d.cfh[cfTransactions], []byte{0}, []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) } + glog.Infof("Column %s migrated from v%d to v%d", nc.Name, sc.Version, dbVersion) } + return nil +} + +func (d *RocksDB) checkColumns(is *common.InternalState) ([]common.InternalStateColumn, error) { // make sure that column stats match the columns sc := is.DbColumns nc := make([]common.InternalStateColumn, len(cfNames)) @@ -1731,7 +1970,19 @@ func (d *RocksDB) LoadInternalState(rpcCoin string) (*common.InternalState, erro if sc[j].Name == nc[i].Name { // check the version of the column, if it does not match, the db is not compatible if sc[j].Version != dbVersion { - return nil, errors.Errorf("DB version %v of column '%v' does not match the required version %v. DB is not compatible.", sc[j].Version, sc[j].Name, dbVersion) + if sc[j].Version == 5 && dbVersion == 6 { + err := d.migrateVersion5To6(&sc[j], &nc[i]) + if err != nil { + return nil, err + } + } else if sc[j].Version == 6 && dbVersion == 7 { + err := d.migrateVersion6To7(&sc[j], &nc[i]) + if err != nil { + return nil, err + } + } else { + return nil, errors.Errorf("DB version %v of column '%v' does not match the required version %v. DB is not compatible.", sc[j].Version, sc[j].Name, dbVersion) + } } nc[i].Rows = sc[j].Rows nc[i].KeyBytes = sc[j].KeyBytes @@ -1741,17 +1992,89 @@ func (d *RocksDB) LoadInternalState(rpcCoin string) (*common.InternalState, erro } } } - is.DbColumns = nc - is.BlockTimes, err = d.loadBlockTimes() + return nc, nil +} + +// LoadInternalState loads from db internal state or initializes a new one if not yet stored +func (d *RocksDB) LoadInternalState(config *common.Config) (*common.InternalState, error) { + val, err := d.db.GetCF(d.ro, d.cfh[cfDefault], []byte(internalStateKey)) + if err != nil { + return nil, err + } + defer val.Free() + data := val.Data() + var is *common.InternalState + if len(data) == 0 { + is = &common.InternalState{ + Coin: config.CoinName, + UtxoChecked: true, + SortedAddressContracts: true, + ExtendedIndex: d.extendedIndex, + BlockGolombFilterP: config.BlockGolombFilterP, + BlockFilterScripts: config.BlockFilterScripts, + BlockFilterUseZeroedKey: config.BlockFilterUseZeroedKey, + } + } else { + is, err = common.UnpackInternalState(data) + if err != nil { + return nil, err + } + // verify that the rpc coin matches DB coin + // running it mismatched would corrupt the database + if is.Coin == "" { + is.Coin = config.CoinName + } else if is.Coin != config.CoinName { + return nil, errors.Errorf("Coins do not match. DB coin %v, RPC coin %v", is.Coin, config.CoinName) + } + if is.ExtendedIndex != d.extendedIndex { + return nil, errors.Errorf("ExtendedIndex setting does not match. DB extendedIndex %v, extendedIndex in options %v", is.ExtendedIndex, d.extendedIndex) + } + if is.BlockGolombFilterP != config.BlockGolombFilterP { + return nil, errors.Errorf("BlockGolombFilterP does not match. DB BlockGolombFilterP %v, config BlockGolombFilterP %v", is.BlockGolombFilterP, config.BlockGolombFilterP) + } + if is.BlockFilterScripts != config.BlockFilterScripts { + return nil, errors.Errorf("BlockFilterScripts does not match. DB BlockFilterScripts %v, config BlockFilterScripts %v", is.BlockFilterScripts, config.BlockFilterScripts) + } + if is.BlockFilterUseZeroedKey != config.BlockFilterUseZeroedKey { + return nil, errors.Errorf("BlockFilterUseZeroedKey does not match. DB BlockFilterUseZeroedKey %v, config BlockFilterUseZeroedKey %v", is.BlockFilterUseZeroedKey, config.BlockFilterUseZeroedKey) + } + } + nc, err := d.checkColumns(is) if err != nil { return nil, err } + is.DbColumns = nc + + d.is = is + // set block times asynchronously (if not in unit test), it slows server startup for chains with large number of blocks + if is.Coin == "coin-unittest" { + d.setBlockTimes() + } else { + go d.setBlockTimes() + } // after load, reset the synchronization data is.IsSynchronized = false is.IsMempoolSynchronized = false var t time.Time is.LastMempoolSync = t is.SyncMode = false + + if d.chainParser.UseAddressAliases() { + recordsCount, err := d.InitAddressAliasRecords() + if err != nil { + return nil, err + } + glog.Infof("loaded %d address alias records", recordsCount) + } + + is.CoinShortcut = config.CoinShortcut + if config.CoinLabel == "" { + is.CoinLabel = config.CoinName + } else { + is.CoinLabel = config.CoinLabel + } + is.Network = config.Network + return is, nil } @@ -1774,6 +2097,11 @@ func (d *RocksDB) SetInternalState(is *common.InternalState) { d.is = is } +// GetInternalState gets the InternalState +func (d *RocksDB) GetInternalState() *common.InternalState { + return d.is +} + // StoreInternalState stores the internal state to db func (d *RocksDB) StoreInternalState(is *common.InternalState) error { if d.metrics != nil { @@ -1798,7 +2126,7 @@ func (d *RocksDB) computeColumnSize(col int, stopCompute chan os.Signal) (int64, var rows, keysSum, valuesSum int64 var seekKey []byte // do not use cache - ro := gorocksdb.NewDefaultReadOptions() + ro := grocksdb.NewDefaultReadOptions() ro.SetFillCache(false) for { var key []byte @@ -1816,13 +2144,13 @@ func (d *RocksDB) computeColumnSize(col int, stopCompute chan os.Signal) (int64, return 0, 0, 0, errors.New("Interrupted") default: } - key = it.Key().Data() + key = append([]byte{}, it.Key().Data()...) count++ rows++ keysSum += int64(len(key)) valuesSum += int64(len(it.Value().Data())) } - seekKey = append([]byte{}, key...) + seekKey = key valid := it.Valid() it.Close() if !valid { @@ -1943,10 +2271,10 @@ func (d *RocksDB) fixUtxo(addrDesc bchain.AddressDescriptor, ba *AddrBalance) (b utxos[i], utxos[opp] = utxos[opp], utxos[i] } ba.Utxos = utxos - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() err = d.storeBalances(wb, map[string]*AddrBalance{string(addrDesc): ba}) if err == nil { - err = d.db.Write(d.wo, wb) + err = d.WriteBatch(wb) } wb.Destroy() if err != nil { @@ -1956,10 +2284,10 @@ func (d *RocksDB) fixUtxo(addrDesc bchain.AddressDescriptor, ba *AddrBalance) (b } return fixed, false, errors.Errorf("balance %s, checksum %s, from txa %s, txs %d", ba.BalanceSat.String(), checksum.String(), checksumFromTxs.String(), ba.Txs) } else if reorder { - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() err := d.storeBalances(wb, map[string]*AddrBalance{string(addrDesc): ba}) if err == nil { - err = d.db.Write(d.wo, wb) + err = d.WriteBatch(wb) } wb.Destroy() if err != nil { @@ -1979,7 +2307,7 @@ func (d *RocksDB) FixUtxos(stop chan os.Signal) error { var row, errorsCount, fixedCount int64 var seekKey []byte // do not use cache - ro := gorocksdb.NewDefaultReadOptions() + ro := grocksdb.NewDefaultReadOptions() ro.SetFillCache(false) for { var addrDesc bchain.AddressDescriptor @@ -1997,7 +2325,7 @@ func (d *RocksDB) FixUtxos(stop chan os.Signal) error { return errors.New("Interrupted") default: } - addrDesc = it.Key().Data() + addrDesc = append([]byte{}, it.Key().Data()...) buf := it.Value().Data() count++ row++ @@ -2024,7 +2352,7 @@ func (d *RocksDB) FixUtxos(stop chan os.Signal) error { fixedCount++ } } - seekKey = append([]byte{}, addrDesc...) + seekKey = addrDesc valid := it.Valid() it.Close() if !valid { @@ -2035,6 +2363,32 @@ func (d *RocksDB) FixUtxos(stop chan os.Signal) error { return nil } +func (d *RocksDB) storeBlockFilter(wb *grocksdb.WriteBatch, blockHash string, blockFilter []byte) error { + blockHashBytes, err := hex.DecodeString(blockHash) + if err != nil { + return err + } + wb.PutCF(d.cfh[cfBlockFilter], blockHashBytes, blockFilter) + return nil +} + +func (d *RocksDB) GetBlockFilter(blockHash string) (string, error) { + blockHashBytes, err := hex.DecodeString(blockHash) + if err != nil { + return "", err + } + val, err := d.db.GetCF(d.ro, d.cfh[cfBlockFilter], blockHashBytes) + if err != nil { + return "", err + } + defer val.Free() + buf := val.Data() + if buf == nil { + return "", nil + } + return hex.EncodeToString(buf), nil +} + // Helpers func packAddressKey(addrDesc bchain.AddressDescriptor, height uint32) []byte { @@ -2091,6 +2445,23 @@ func unpackVaruint(buf []byte) (uint, int) { return uint(i), ofs } +func packString(s string) []byte { + varBuf := make([]byte, vlq.MaxLen64) + l := len(s) + i := packVaruint(uint(l), varBuf) + buf := make([]byte, 0, i+l) + buf = append(buf, varBuf[:i]...) + buf = append(buf, s...) + return buf +} + +func unpackString(buf []byte) (string, int) { + sl, l := unpackVaruint(buf) + so := l + int(sl) + s := string(buf[l:so]) + return s, so +} + const ( // number of bits in a big.Word wordBits = 32 << (uint64(^big.Word(0)) >> 63) @@ -2103,7 +2474,7 @@ const ( // big int is packed in BigEndian order without memory allocation as 1 byte length followed by bytes of big int // number of written bytes is returned -// limitation: bigints longer than 248 bytes are truncated to 248 bytes +// limitation: big ints longer than 248 bytes are truncated to 248 bytes // caution: buffer must be big enough to hold the packed big int, buffer 249 bytes big is always safe func packBigint(bi *big.Int, buf []byte) int { w := bi.Bits() @@ -2144,6 +2515,10 @@ func packBigint(bi *big.Int, buf []byte) int { return fb + 1 } +func packedBigintLen(buf []byte) int { + return int(buf[0]) + 1 +} + func unpackBigint(buf []byte) (big.Int, int) { var r big.Int l := int(buf[0]) + 1 diff --git a/db/rocksdb_ethereumtype.go b/db/rocksdb_ethereumtype.go index f1df45ed2c..7d59825ee8 100644 --- a/db/rocksdb_ethereumtype.go +++ b/db/rocksdb_ethereumtype.go @@ -3,88 +3,352 @@ package db import ( "bytes" "encoding/hex" + "math/big" + "os" + "sort" + "sync" + "time" vlq "github.com/bsm/go-vlq" - "github.com/flier/gorocksdb" "github.com/golang/glog" "github.com/juju/errors" + "github.com/linxGnu/grocksdb" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/bchain/coins/eth" ) +const InternalTxIndexOffset = 1 +const ContractIndexOffset = 2 + +type AggregateFn = func(*big.Int, *big.Int) + +type Ids []big.Int + +func (s *Ids) sort() bool { + sorted := false + sort.Slice(*s, func(i, j int) bool { + isLess := (*s)[i].CmpAbs(&(*s)[j]) == -1 + if isLess == (i > j) { // it is necessary to swap - (id[i]j) or (id[i]>id[j] and i= 0 + }) +} + +// insert id in ascending order +func (s *Ids) insert(id big.Int) { + i := s.search(id) + if i == len(*s) { + *s = append(*s, id) + } else { + *s = append((*s)[:i+1], (*s)[i:]...) + (*s)[i] = id + } +} + +func (s *Ids) remove(id big.Int) { + i := s.search(id) + // remove id if found + if i < len(*s) && (*s)[i].CmpAbs(&id) == 0 { + *s = append((*s)[:i], (*s)[i+1:]...) + } +} + +type MultiTokenValues []bchain.MultiTokenValue + +func (s *MultiTokenValues) sort() bool { + sorted := false + sort.Slice(*s, func(i, j int) bool { + isLess := (*s)[i].Id.CmpAbs(&(*s)[j].Id) == -1 + if isLess == (i > j) { // it is necessary to swap - (id[i]j) or (id[i]>id[j] and i= 0 + }) +} + +func (s *MultiTokenValues) upsert(m bchain.MultiTokenValue, index int32, aggregate AggregateFn) { + i := s.search(m) + if i < len(*s) && (*s)[i].Id.CmpAbs(&m.Id) == 0 { + aggregate(&(*s)[i].Value, &m.Value) + // if transfer from, remove if the value is zero + if index < 0 && len((*s)[i].Value.Bits()) == 0 { + *s = append((*s)[:i], (*s)[i+1:]...) + } + return + } + if index >= 0 { + elem := bchain.MultiTokenValue{ + Id: m.Id, + Value: *new(big.Int).Set(&m.Value), + } + if i == len(*s) { + *s = append(*s, elem) + } else { + *s = append((*s)[:i+1], (*s)[i:]...) + (*s)[i] = elem + } + } +} + // AddrContract is Contract address with number of transactions done by given address type AddrContract struct { - Contract bchain.AddressDescriptor - Txs uint + Standard bchain.TokenStandard + Contract bchain.AddressDescriptor + Txs uint + Value big.Int // single value of ERC20 + Ids Ids // multiple ERC721 tokens + MultiTokenValues MultiTokenValues // multiple ERC1155 tokens } // AddrContracts contains number of transactions and contracts for an address type AddrContracts struct { TotalTxs uint NonContractTxs uint + InternalTxs uint Contracts []AddrContract } -func (d *RocksDB) storeAddressContracts(wb *gorocksdb.WriteBatch, acm map[string]*AddrContracts) error { - buf := make([]byte, 64) - varBuf := make([]byte, vlq.MaxLen64) - for addrDesc, acs := range acm { - // address with 0 contracts is removed from db - happens on disconnect - if acs == nil || (acs.NonContractTxs == 0 && len(acs.Contracts) == 0) { - wb.DeleteCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc)) - } else { - buf = buf[:0] - l := packVaruint(acs.TotalTxs, varBuf) +// packAddrContracts packs AddrContracts into a byte buffer +func packAddrContractsV6(acs *AddrContracts) []byte { + buf := make([]byte, 0, 128) + varBuf := make([]byte, maxPackedBigintBytes) + l := packVaruint(acs.TotalTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(acs.NonContractTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(acs.InternalTxs, varBuf) + buf = append(buf, varBuf[:l]...) + for _, ac := range acs.Contracts { + buf = append(buf, ac.Contract...) + l = packVaruint(uint(ac.Standard)+ac.Txs<<2, varBuf) + buf = append(buf, varBuf[:l]...) + if ac.Standard == bchain.FungibleToken { + l = packBigint(&ac.Value, varBuf) buf = append(buf, varBuf[:l]...) - l = packVaruint(acs.NonContractTxs, varBuf) + } else if ac.Standard == bchain.NonFungibleToken { + l = packVaruint(uint(len(ac.Ids)), varBuf) buf = append(buf, varBuf[:l]...) - for _, ac := range acs.Contracts { - buf = append(buf, ac.Contract...) - l = packVaruint(ac.Txs, varBuf) + for i := range ac.Ids { + l = packBigint(&ac.Ids[i], varBuf) + buf = append(buf, varBuf[:l]...) + } + } else { // bchain.ERC1155 + l = packVaruint(uint(len(ac.MultiTokenValues)), varBuf) + buf = append(buf, varBuf[:l]...) + for i := range ac.MultiTokenValues { + l = packBigint(&ac.MultiTokenValues[i].Id, varBuf) + buf = append(buf, varBuf[:l]...) + l = packBigint(&ac.MultiTokenValues[i].Value, varBuf) buf = append(buf, varBuf[:l]...) } - wb.PutCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc), buf) } } - return nil + return buf } -// GetAddrDescContracts returns AddrContracts for given addrDesc -func (d *RocksDB) GetAddrDescContracts(addrDesc bchain.AddressDescriptor) (*AddrContracts, error) { - val, err := d.db.GetCF(d.ro, d.cfh[cfAddressContracts], addrDesc) - if err != nil { - return nil, err - } - defer val.Free() - buf := val.Data() - if len(buf) == 0 { - return nil, nil +// packAddrContracts packs AddrContracts into a byte buffer +func packAddrContracts(acs *AddrContracts) []byte { + buf := make([]byte, 0, 8+len(acs.Contracts)*(eth.EthereumTypeAddressDescriptorLen+12)) + varBuf := make([]byte, maxPackedBigintBytes) + l := packVaruint(acs.TotalTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(acs.NonContractTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(acs.InternalTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(uint(len(acs.Contracts)), varBuf) + buf = append(buf, varBuf[:l]...) + for _, ac := range acs.Contracts { + buf = append(buf, ac.Contract...) + l = packVaruint(uint(ac.Standard)+ac.Txs<<2, varBuf) + buf = append(buf, varBuf[:l]...) + if ac.Standard == bchain.FungibleToken { + l = packBigint(&ac.Value, varBuf) + buf = append(buf, varBuf[:l]...) + } else if ac.Standard == bchain.NonFungibleToken { + l = packVaruint(uint(len(ac.Ids)), varBuf) + buf = append(buf, varBuf[:l]...) + for i := range ac.Ids { + l = packBigint(&ac.Ids[i], varBuf) + buf = append(buf, varBuf[:l]...) + } + } else { // bchain.ERC1155 + l = packVaruint(uint(len(ac.MultiTokenValues)), varBuf) + buf = append(buf, varBuf[:l]...) + for i := range ac.MultiTokenValues { + l = packBigint(&ac.MultiTokenValues[i].Id, varBuf) + buf = append(buf, varBuf[:l]...) + l = packBigint(&ac.MultiTokenValues[i].Value, varBuf) + buf = append(buf, varBuf[:l]...) + } + } } + return buf +} + +func unpackAddrContractsV6(buf []byte, addrDesc bchain.AddressDescriptor) (acs *AddrContracts, err error) { tt, l := unpackVaruint(buf) buf = buf[l:] nct, l := unpackVaruint(buf) buf = buf[l:] - c := make([]AddrContract, 0, 4) + ict, l := unpackVaruint(buf) + buf = buf[l:] + c := make([]AddrContract, 0, len(buf)/30+4) for len(buf) > 0 { if len(buf) < eth.EthereumTypeAddressDescriptorLen { return nil, errors.New("Invalid data stored in cfAddressContracts for AddrDesc " + addrDesc.String()) } - txs, l := unpackVaruint(buf[eth.EthereumTypeAddressDescriptorLen:]) contract := append(bchain.AddressDescriptor(nil), buf[:eth.EthereumTypeAddressDescriptorLen]...) - c = append(c, AddrContract{ + txs, l := unpackVaruint(buf[eth.EthereumTypeAddressDescriptorLen:]) + buf = buf[eth.EthereumTypeAddressDescriptorLen+l:] + standard := bchain.TokenStandard(txs & 3) + txs >>= 2 + ac := AddrContract{ + Standard: standard, Contract: contract, Txs: txs, - }) + } + if standard == bchain.FungibleToken { + b, ll := unpackBigint(buf) + buf = buf[ll:] + ac.Value = b + } else { + len, ll := unpackVaruint(buf) + buf = buf[ll:] + if standard == bchain.NonFungibleToken { + ac.Ids = make(Ids, len) + for i := uint(0); i < len; i++ { + b, ll := unpackBigint(buf) + buf = buf[ll:] + ac.Ids[i] = b + } + } else { + ac.MultiTokenValues = make(MultiTokenValues, len) + for i := uint(0); i < len; i++ { + b, ll := unpackBigint(buf) + buf = buf[ll:] + ac.MultiTokenValues[i].Id = b + b, ll = unpackBigint(buf) + buf = buf[ll:] + ac.MultiTokenValues[i].Value = b + } + } + } + c = append(c, ac) + } + return &AddrContracts{ + TotalTxs: tt, + NonContractTxs: nct, + InternalTxs: ict, + Contracts: c, + }, nil +} + +func unpackAddrContracts(buf []byte, addrDesc bchain.AddressDescriptor) (acs *AddrContracts, err error) { + tt, l := unpackVaruint(buf) + buf = buf[l:] + nct, l := unpackVaruint(buf) + buf = buf[l:] + ict, l := unpackVaruint(buf) + buf = buf[l:] + cl, l := unpackVaruint(buf) + buf = buf[l:] + c := make([]AddrContract, 0, cl) + for len(buf) > 0 { + if len(buf) < eth.EthereumTypeAddressDescriptorLen { + return nil, errors.New("Invalid data stored in cfAddressContracts for AddrDesc " + addrDesc.String()) + } + contract := append(bchain.AddressDescriptor(nil), buf[:eth.EthereumTypeAddressDescriptorLen]...) + txs, l := unpackVaruint(buf[eth.EthereumTypeAddressDescriptorLen:]) buf = buf[eth.EthereumTypeAddressDescriptorLen+l:] + standard := bchain.TokenStandard(txs & 3) + txs >>= 2 + ac := AddrContract{ + Standard: standard, + Contract: contract, + Txs: txs, + } + if standard == bchain.FungibleToken { + b, ll := unpackBigint(buf) + buf = buf[ll:] + ac.Value = b + } else { + len, ll := unpackVaruint(buf) + buf = buf[ll:] + if standard == bchain.NonFungibleToken { + ac.Ids = make(Ids, len) + for i := uint(0); i < len; i++ { + b, ll := unpackBigint(buf) + buf = buf[ll:] + ac.Ids[i] = b + } + } else { + ac.MultiTokenValues = make(MultiTokenValues, len) + for i := uint(0); i < len; i++ { + b, ll := unpackBigint(buf) + buf = buf[ll:] + ac.MultiTokenValues[i].Id = b + b, ll = unpackBigint(buf) + buf = buf[ll:] + ac.MultiTokenValues[i].Value = b + } + } + } + c = append(c, ac) } return &AddrContracts{ TotalTxs: tt, NonContractTxs: nct, + InternalTxs: ict, Contracts: c, }, nil } -func findContractInAddressContracts(contract bchain.AddressDescriptor, contracts []AddrContract) (int, bool) { +func (d *RocksDB) storeAddressContracts(wb *grocksdb.WriteBatch, acm map[string]*AddrContracts) error { + for addrDesc, acs := range acm { + // address with 0 contracts is removed from db - happens on disconnect + if acs == nil || (acs.NonContractTxs == 0 && acs.InternalTxs == 0 && len(acs.Contracts) == 0) { + wb.DeleteCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc)) + } else { + buf := packAddrContracts(acs) + wb.PutCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc), buf) + } + } + return nil +} + +// GetAddrDescContracts returns AddrContracts for given addrDesc +func (d *RocksDB) GetAddrDescContracts(addrDesc bchain.AddressDescriptor) (*AddrContracts, error) { + val, err := d.db.GetCF(d.ro, d.cfh[cfAddressContracts], addrDesc) + if err != nil { + return nil, err + } + defer val.Free() + buf := val.Data() + if len(buf) == 0 { + return nil, nil + } + return unpackAddrContracts(buf, addrDesc) +} + +func findContractInAddressContracts(contract bchain.AddressDescriptor, contracts []unpackedAddrContract) (int, bool) { for i := range contracts { if bytes.Equal(contract, contracts[i].Contract) { return i, true @@ -102,17 +366,87 @@ func isZeroAddress(addrDesc bchain.AddressDescriptor) bool { return true } -func (d *RocksDB) addToAddressesAndContractsEthereumType(addrDesc bchain.AddressDescriptor, btxID []byte, index int32, contract bchain.AddressDescriptor, addresses addressesMap, addressContracts map[string]*AddrContracts, addTxCount bool) error { +const transferTo = int32(0) +const transferFrom = ^int32(0) +const internalTransferTo = int32(1) +const internalTransferFrom = ^int32(1) + +// addToAddressesMapEthereumType maintains mapping between addresses and transactions in one block +// it ensures that each index is there only once, there can be for example multiple internal transactions of the same address +// the return value is true if the tx was processed before, to not to count the tx multiple times +func addToAddressesMapEthereumType(addresses addressesMap, strAddrDesc string, btxID []byte, index int32) bool { + // check that the address was already processed in this block + // if not found, it has certainly not been counted + at, found := addresses[strAddrDesc] + if found { + // if the tx is already in the slice, append the index to the array of indexes + for i, t := range at { + if bytes.Equal(btxID, t.btxID) { + for _, existing := range t.indexes { + if existing == index { + return true + } + } + at[i].indexes = append(t.indexes, index) + return true + } + } + } + addresses[strAddrDesc] = append(at, txIndexes{ + btxID: btxID, + indexes: []int32{index}, + }) + return false +} + +func addToContract(c *unpackedAddrContract, contractIndex int, index int32, contract bchain.AddressDescriptor, transfer *bchain.TokenTransfer, addTxCount bool) int32 { + var aggregate AggregateFn + // index 0 is for ETH transfers, index 1 (InternalTxIndexOffset) is for internal transfers, contract indexes start with 2 (ContractIndexOffset) + if index < 0 { + index = ^int32(contractIndex + ContractIndexOffset) + aggregate = func(s, v *big.Int) { + s.Sub(s, v) + if s.Sign() < 0 { + // glog.Warningf("rocksdb: addToContracts: contract %s, from %s, negative aggregate", transfer.Contract, transfer.From) + s.SetUint64(0) + } + } + } else { + index = int32(contractIndex + ContractIndexOffset) + aggregate = func(s, v *big.Int) { + s.Add(s, v) + } + } + if transfer.Standard == bchain.FungibleToken { + aggregate(c.Value.get(), &transfer.Value) + } else if transfer.Standard == bchain.NonFungibleToken { + if index < 0 { + c.Ids.remove(transfer.Value) + } else { + c.Ids.insert(transfer.Value) + } + } else { // bchain.ERC1155 + for _, t := range transfer.MultiTokenValues { + c.MultiTokenValues.upsert(t, index, aggregate) + } + } + if addTxCount { + c.Txs++ + } + return index +} + +func (d *RocksDB) addToAddressesAndContractsEthereumType(addrDesc bchain.AddressDescriptor, btxID []byte, index int32, contract bchain.AddressDescriptor, transfer *bchain.TokenTransfer, addTxCount bool, addresses addressesMap, addressContracts map[string]*unpackedAddrContracts) error { var err error strAddrDesc := string(addrDesc) ac, e := addressContracts[strAddrDesc] if !e { - ac, err = d.GetAddrDescContracts(addrDesc) + ac, err = d.getUnpackedAddrDescContracts(addrDesc) if err != nil { return err } if ac == nil { - ac = &AddrContracts{} + ac = &unpackedAddrContracts{} } addressContracts[strAddrDesc] = ac d.cbs.balancesMiss++ @@ -121,29 +455,35 @@ func (d *RocksDB) addToAddressesAndContractsEthereumType(addrDesc bchain.Address } if contract == nil { if addTxCount { - ac.NonContractTxs++ + if index == internalTransferFrom || index == internalTransferTo { + ac.InternalTxs++ + } else { + ac.NonContractTxs++ + } } } else { // do not store contracts for 0x0000000000000000000000000000000000000000 address if !isZeroAddress(addrDesc) { // locate the contract and set i to the index in the array of contracts - i, found := findContractInAddressContracts(contract, ac.Contracts) + contractIndex, found := findContractInAddressContracts(contract, ac.Contracts) if !found { - i = len(ac.Contracts) - ac.Contracts = append(ac.Contracts, AddrContract{Contract: contract}) + contractIndex = len(ac.Contracts) + ac.Contracts = append(ac.Contracts, unpackedAddrContract{ + Contract: contract, + Standard: transfer.Standard, + }) } - // index 0 is for ETH transfers, contract indexes start with 1 + c := &ac.Contracts[contractIndex] + index = addToContract(c, contractIndex, index, contract, transfer, addTxCount) + } else { if index < 0 { - index = ^int32(i + 1) + index = transferFrom } else { - index = int32(i + 1) - } - if addTxCount { - ac.Contracts[i].Txs++ + index = transferTo } } } - counted := addToAddressesMap(addresses, strAddrDesc, btxID, index) + counted := addToAddressesMapEthereumType(addresses, strAddrDesc, btxID, index) if !counted { ac.TotalTxs++ } @@ -151,273 +491,973 @@ func (d *RocksDB) addToAddressesAndContractsEthereumType(addrDesc bchain.Address } type ethBlockTxContract struct { - addr, contract bchain.AddressDescriptor + from, to, contract bchain.AddressDescriptor + transferStandard bchain.TokenStandard + value big.Int + idValues []bchain.MultiTokenValue +} + +type ethInternalTransfer struct { + internalType bchain.EthereumInternalTransactionType + from, to bchain.AddressDescriptor + value big.Int +} + +type ethInternalData struct { + internalType bchain.EthereumInternalTransactionType + contract bchain.AddressDescriptor + transfers []ethInternalTransfer + errorMsg string } type ethBlockTx struct { - btxID []byte - from, to bchain.AddressDescriptor - contracts []ethBlockTxContract + btxID []byte + from, to bchain.AddressDescriptor + contracts []ethBlockTxContract + internalData *ethInternalData } -func (d *RocksDB) processAddressesEthereumType(block *bchain.Block, addresses addressesMap, addressContracts map[string]*AddrContracts) ([]ethBlockTx, error) { - blockTxs := make([]ethBlockTx, len(block.Txs)) - for txi, tx := range block.Txs { - btxID, err := d.chainParser.PackTxid(tx.Txid) +func (d *RocksDB) processBaseTxData(blockTx *ethBlockTx, tx *bchain.Tx, addresses addressesMap, addressContracts map[string]*unpackedAddrContracts) error { + var from, to bchain.AddressDescriptor + var err error + // there is only one output address in EthereumType transaction, store it in format txid 0 + if len(tx.Vout) == 1 && len(tx.Vout[0].ScriptPubKey.Addresses) == 1 { + to, err = d.chainParser.GetAddrDescFromAddress(tx.Vout[0].ScriptPubKey.Addresses[0]) if err != nil { - return nil, err - } - blockTx := &blockTxs[txi] - blockTx.btxID = btxID - var from, to bchain.AddressDescriptor - // there is only one output address in EthereumType transaction, store it in format txid 0 - if len(tx.Vout) == 1 && len(tx.Vout[0].ScriptPubKey.Addresses) == 1 { - to, err = d.chainParser.GetAddrDescFromAddress(tx.Vout[0].ScriptPubKey.Addresses[0]) - if err != nil { - // do not log ErrAddressMissing, transactions can be without to address (for example eth contracts) - if err != bchain.ErrAddressMissing { - glog.Warningf("rocksdb: addrDesc: %v - height %d, tx %v, output", err, block.Height, tx.Txid) - } - continue + // do not log ErrAddressMissing, transactions can be without to address (for example eth contracts) + if err != bchain.ErrAddressMissing { + glog.Warningf("rocksdb: processBaseTxData: %v, tx %v, output", err, tx.Txid) } - if err = d.addToAddressesAndContractsEthereumType(to, btxID, 0, nil, addresses, addressContracts, true); err != nil { - return nil, err + } else { + if err = d.addToAddressesAndContractsEthereumType(to, blockTx.btxID, transferTo, nil, nil, true, addresses, addressContracts); err != nil { + return err } blockTx.to = to } - // there is only one input address in EthereumType transaction, store it in format txid ^0 - if len(tx.Vin) == 1 && len(tx.Vin[0].Addresses) == 1 { - from, err = d.chainParser.GetAddrDescFromAddress(tx.Vin[0].Addresses[0]) - if err != nil { - if err != bchain.ErrAddressMissing { - glog.Warningf("rocksdb: addrDesc: %v - height %d, tx %v, input", err, block.Height, tx.Txid) - } - continue + } + // there is only one input address in EthereumType transaction, store it in format txid ^0 + if len(tx.Vin) == 1 && len(tx.Vin[0].Addresses) == 1 { + from, err = d.chainParser.GetAddrDescFromAddress(tx.Vin[0].Addresses[0]) + if err != nil { + if err != bchain.ErrAddressMissing { + glog.Warningf("rocksdb: processBaseTxData: %v, tx %v, input", err, tx.Txid) } - if err = d.addToAddressesAndContractsEthereumType(from, btxID, ^int32(0), nil, addresses, addressContracts, !bytes.Equal(from, to)); err != nil { - return nil, err + } else { + if err = d.addToAddressesAndContractsEthereumType(from, blockTx.btxID, transferFrom, nil, nil, !bytes.Equal(from, to), addresses, addressContracts); err != nil { + return err } blockTx.from = from } - // store erc20 transfers - erc20, err := d.chainParser.EthereumTypeGetErc20FromTx(&tx) + } + return nil +} + +func (d *RocksDB) setAddressTxIndexesToAddressMap(addrDesc bchain.AddressDescriptor, height uint32, addresses addressesMap) error { + strAddrDesc := string(addrDesc) + _, found := addresses[strAddrDesc] + if !found { + txIndexes, err := d.getTxIndexesForAddressAndBlock(addrDesc, height) if err != nil { - glog.Warningf("rocksdb: GetErc20FromTx %v - height %d, tx %v", err, block.Height, tx.Txid) + return err } - blockTx.contracts = make([]ethBlockTxContract, len(erc20)*2) - j := 0 - for i, t := range erc20 { - var contract, from, to bchain.AddressDescriptor - contract, err = d.chainParser.GetAddrDescFromAddress(t.Contract) - if err == nil { - from, err = d.chainParser.GetAddrDescFromAddress(t.From) - if err == nil { - to, err = d.chainParser.GetAddrDescFromAddress(t.To) - } - } - if err != nil { - glog.Warningf("rocksdb: GetErc20FromTx %v - height %d, tx %v, transfer %v", err, block.Height, tx.Txid, t) - continue - } - if err = d.addToAddressesAndContractsEthereumType(to, btxID, int32(i), contract, addresses, addressContracts, true); err != nil { - return nil, err - } - eq := bytes.Equal(from, to) - bc := &blockTx.contracts[j] - j++ - bc.addr = from - bc.contract = contract - if err = d.addToAddressesAndContractsEthereumType(from, btxID, ^int32(i), contract, addresses, addressContracts, !eq); err != nil { - return nil, err - } - // add to address to blockTx.contracts only if it is different from from address - if !eq { - bc = &blockTx.contracts[j] - j++ - bc.addr = to - bc.contract = contract - } + if len(txIndexes) > 0 { + addresses[strAddrDesc] = txIndexes } - blockTx.contracts = blockTx.contracts[:j] } - return blockTxs, nil + return nil } -func (d *RocksDB) storeAndCleanupBlockTxsEthereumType(wb *gorocksdb.WriteBatch, block *bchain.Block, blockTxs []ethBlockTx) error { - pl := d.chainParser.PackedTxidLen() - buf := make([]byte, 0, (pl+2*eth.EthereumTypeAddressDescriptorLen)*len(blockTxs)) - varBuf := make([]byte, vlq.MaxLen64) - zeroAddress := make([]byte, eth.EthereumTypeAddressDescriptorLen) - appendAddress := func(a bchain.AddressDescriptor) { - if len(a) != eth.EthereumTypeAddressDescriptorLen { - buf = append(buf, zeroAddress...) +// existingBlock signals that internal data are reconnected to already indexed block after they failed during standard sync +func (d *RocksDB) processInternalData(blockTx *ethBlockTx, tx *bchain.Tx, id *bchain.EthereumInternalData, addresses addressesMap, addressContracts map[string]*unpackedAddrContracts, existingBlock bool) error { + blockTx.internalData = ðInternalData{ + internalType: id.Type, + errorMsg: id.Error, + } + // index contract creation + if id.Type == bchain.CREATE { + to, err := d.chainParser.GetAddrDescFromAddress(id.Contract) + if err != nil { + if err != bchain.ErrAddressMissing { + glog.Warningf("rocksdb: processInternalData: %v, tx %v, create contract", err, tx.Txid) + } + // set the internalType to CALL if incorrect contract so that it is not breaking the packing of data to DB + blockTx.internalData.internalType = bchain.CALL } else { - buf = append(buf, a...) + blockTx.internalData.contract = to + if existingBlock { + if err = d.setAddressTxIndexesToAddressMap(to, tx.BlockHeight, addresses); err != nil { + return err + } + } + if err = d.addToAddressesAndContractsEthereumType(to, blockTx.btxID, internalTransferTo, nil, nil, true, addresses, addressContracts); err != nil { + return err + } } } - for i := range blockTxs { - blockTx := &blockTxs[i] - buf = append(buf, blockTx.btxID...) - appendAddress(blockTx.from) - appendAddress(blockTx.to) - l := packVaruint(uint(len(blockTx.contracts)), varBuf) - buf = append(buf, varBuf[:l]...) - for j := range blockTx.contracts { - c := &blockTx.contracts[j] - appendAddress(c.addr) - appendAddress(c.contract) + // index internal transfers + if len(id.Transfers) > 0 { + blockTx.internalData.transfers = make([]ethInternalTransfer, len(id.Transfers)) + for i := range id.Transfers { + iti := &id.Transfers[i] + ito := &blockTx.internalData.transfers[i] + to, err := d.chainParser.GetAddrDescFromAddress(iti.To) + if err != nil { + // do not log ErrAddressMissing, transactions can be without to address (for example eth contracts) + if err != bchain.ErrAddressMissing { + glog.Warningf("rocksdb: processInternalData: %v, tx %v, internal transfer %d to", err, tx.Txid, i) + } + } else { + if existingBlock { + if err = d.setAddressTxIndexesToAddressMap(to, tx.BlockHeight, addresses); err != nil { + return err + } + } + if err = d.addToAddressesAndContractsEthereumType(to, blockTx.btxID, internalTransferTo, nil, nil, true, addresses, addressContracts); err != nil { + return err + } + ito.to = to + } + from, err := d.chainParser.GetAddrDescFromAddress(iti.From) + if err != nil { + if err != bchain.ErrAddressMissing { + glog.Warningf("rocksdb: processInternalData: %v, tx %v, internal transfer %d from", err, tx.Txid, i) + } + } else { + if existingBlock { + if err = d.setAddressTxIndexesToAddressMap(from, tx.BlockHeight, addresses); err != nil { + return err + } + } + if err = d.addToAddressesAndContractsEthereumType(from, blockTx.btxID, internalTransferFrom, nil, nil, !bytes.Equal(from, to), addresses, addressContracts); err != nil { + return err + } + ito.from = from + } + ito.internalType = iti.Type + ito.value = iti.Value } } - key := packUint(block.Height) - wb.PutCF(d.cfh[cfBlockTxs], key, buf) - return d.cleanupBlockTxs(wb, block) + return nil } -func (d *RocksDB) getBlockTxsEthereumType(height uint32) ([]ethBlockTx, error) { - pl := d.chainParser.PackedTxidLen() - val, err := d.db.GetCF(d.ro, d.cfh[cfBlockTxs], packUint(height)) +func (d *RocksDB) processContractTransfers(blockTx *ethBlockTx, tx *bchain.Tx, addresses addressesMap, addressContracts map[string]*unpackedAddrContracts) error { + tokenTransfers, err := d.chainParser.EthereumTypeGetTokenTransfersFromTx(tx) if err != nil { - return nil, err - } - defer val.Free() - buf := val.Data() - // nil data means the key was not found in DB - if buf == nil { - return nil, nil + glog.Warningf("rocksdb: processContractTransfers %v, tx %v", err, tx.Txid) } - // buf can be empty slice, this means the block did not contain any transactions - bt := make([]ethBlockTx, 0, 8) - getAddress := func(i int) (bchain.AddressDescriptor, int, error) { - if len(buf)-i < eth.EthereumTypeAddressDescriptorLen { - glog.Error("rocksdb: Inconsistent data in blockTxs ", hex.EncodeToString(buf)) - return nil, 0, errors.New("Inconsistent data in blockTxs") - } - a := append(bchain.AddressDescriptor(nil), buf[i:i+eth.EthereumTypeAddressDescriptorLen]...) - // return null addresses as nil - for _, b := range a { - if b != 0 { - return a, i + eth.EthereumTypeAddressDescriptorLen, nil + blockTx.contracts = make([]ethBlockTxContract, len(tokenTransfers)) + for i, t := range tokenTransfers { + var contract, from, to bchain.AddressDescriptor + contract, err = d.chainParser.GetAddrDescFromAddress(t.Contract) + if err == nil { + from, err = d.chainParser.GetAddrDescFromAddress(t.From) + if err == nil { + to, err = d.chainParser.GetAddrDescFromAddress(t.To) } } - return nil, i + eth.EthereumTypeAddressDescriptorLen, nil - } - var from, to bchain.AddressDescriptor - for i := 0; i < len(buf); { - if len(buf)-i < pl { - glog.Error("rocksdb: Inconsistent data in blockTxs ", hex.EncodeToString(buf)) - return nil, errors.New("Inconsistent data in blockTxs") + if err != nil { + glog.Warningf("rocksdb: processContractTransfers %v, tx %v, transfer %v", err, tx.Txid, t) + continue + } + if err = d.addToAddressesAndContractsEthereumType(to, blockTx.btxID, int32(i), contract, t, true, addresses, addressContracts); err != nil { + return err } - txid := append([]byte(nil), buf[i:i+pl]...) - i += pl - from, i, err = getAddress(i) + eq := bytes.Equal(from, to) + if err = d.addToAddressesAndContractsEthereumType(from, blockTx.btxID, ^int32(i), contract, t, !eq, addresses, addressContracts); err != nil { + return err + } + bc := &blockTx.contracts[i] + bc.transferStandard = t.Standard + bc.from = from + bc.to = to + bc.contract = contract + bc.value = t.Value + bc.idValues = t.MultiTokenValues + } + return nil +} + +func (d *RocksDB) processAddressesEthereumType(block *bchain.Block, addresses addressesMap, addressContracts map[string]*unpackedAddrContracts) ([]ethBlockTx, error) { + blockTxs := make([]ethBlockTx, len(block.Txs)) + for txi := range block.Txs { + tx := &block.Txs[txi] + btxID, err := d.chainParser.PackTxid(tx.Txid) if err != nil { return nil, err } - to, i, err = getAddress(i) - if err != nil { + blockTx := &blockTxs[txi] + blockTx.btxID = btxID + if err = d.processBaseTxData(blockTx, tx, addresses, addressContracts); err != nil { return nil, err } - cc, l := unpackVaruint(buf[i:]) - i += l - contracts := make([]ethBlockTxContract, cc) - for j := range contracts { - contracts[j].addr, i, err = getAddress(i) + // process internal data + eid, _ := tx.CoinSpecificData.(bchain.EthereumSpecificData) + if eid.InternalData != nil { + if err = d.processInternalData(blockTx, tx, eid.InternalData, addresses, addressContracts, false); err != nil { + return nil, err + } + } + // store contract transfers + if err = d.processContractTransfers(blockTx, tx, addresses, addressContracts); err != nil { + return nil, err + } + } + return blockTxs, nil +} + +// ReconnectInternalDataToBlockEthereumType adds missing internal data to the block and stores them in db +func (d *RocksDB) ReconnectInternalDataToBlockEthereumType(block *bchain.Block) error { + d.connectBlockMux.Lock() + defer d.connectBlockMux.Unlock() + + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + if d.chainParser.GetChainType() != bchain.ChainEthereumType { + return errors.New("Unsupported chain type") + } + + addresses := make(addressesMap) + addressContracts := make(map[string]*unpackedAddrContracts) + + // process internal data + blockTxs := make([]ethBlockTx, len(block.Txs)) + for txi := range block.Txs { + tx := &block.Txs[txi] + eid, _ := tx.CoinSpecificData.(bchain.EthereumSpecificData) + if eid.InternalData != nil { + btxID, err := d.chainParser.PackTxid(tx.Txid) + if err != nil { + return err + } + blockTx := &blockTxs[txi] + blockTx.btxID = btxID + tx.BlockHeight = block.Height + if err = d.processInternalData(blockTx, tx, eid.InternalData, addresses, addressContracts, true); err != nil { + return err + } + } + } + + if err := d.storeUnpackedAddressContracts(wb, addressContracts); err != nil { + return err + } + if err := d.storeInternalDataEthereumType(wb, blockTxs); err != nil { + return err + } + if err := d.storeAddresses(wb, block.Height, addresses); err != nil { + return err + } + // remove the block from the internal errors table + wb.DeleteCF(d.cfh[cfBlockInternalDataErrors], packUint(block.Height)) + if err := d.WriteBatch(wb); err != nil { + return err + } + return nil +} + +var ethZeroAddress []byte = make([]byte, eth.EthereumTypeAddressDescriptorLen) + +func appendAddress(buf []byte, a bchain.AddressDescriptor) []byte { + if len(a) != eth.EthereumTypeAddressDescriptorLen { + buf = append(buf, ethZeroAddress...) + } else { + buf = append(buf, a...) + } + return buf +} + +func packEthInternalData(data *ethInternalData) []byte { + // allocate enough for type+contract+all transfers with bigint value + buf := make([]byte, 0, (2*len(data.transfers)+1)*(eth.EthereumTypeAddressDescriptorLen+16)) + varBuf := make([]byte, maxPackedBigintBytes) + + // internalType is one bit (CALL|CREATE), it is joined with count of internal transfers*2 + l := packVaruint(uint(data.internalType)&1+uint(len(data.transfers))<<1, varBuf) + buf = append(buf, varBuf[:l]...) + if data.internalType == bchain.CREATE { + buf = appendAddress(buf, data.contract) + } + for i := range data.transfers { + t := &data.transfers[i] + buf = append(buf, byte(t.internalType)) + buf = appendAddress(buf, t.from) + buf = appendAddress(buf, t.to) + l = packBigint(&t.value, varBuf) + buf = append(buf, varBuf[:l]...) + } + if len(data.errorMsg) > 0 { + buf = append(buf, []byte(data.errorMsg)...) + } + return buf +} + +func (d *RocksDB) unpackEthInternalData(buf []byte) (*bchain.EthereumInternalData, error) { + id := bchain.EthereumInternalData{} + v, l := unpackVaruint(buf) + id.Type = bchain.EthereumInternalTransactionType(v & 1) + id.Transfers = make([]bchain.EthereumInternalTransfer, v>>1) + if id.Type == bchain.CREATE { + addresses, _, _ := d.chainParser.GetAddressesFromAddrDesc(buf[l : l+eth.EthereumTypeAddressDescriptorLen]) + l += eth.EthereumTypeAddressDescriptorLen + if len(addresses) > 0 { + id.Contract = addresses[0] + } + } + var ll int + for i := range id.Transfers { + t := &id.Transfers[i] + t.Type = bchain.EthereumInternalTransactionType(buf[l]) + l++ + addresses, _, _ := d.chainParser.GetAddressesFromAddrDesc(buf[l : l+eth.EthereumTypeAddressDescriptorLen]) + l += eth.EthereumTypeAddressDescriptorLen + if len(addresses) > 0 { + t.From = addresses[0] + } + addresses, _, _ = d.chainParser.GetAddressesFromAddrDesc(buf[l : l+eth.EthereumTypeAddressDescriptorLen]) + l += eth.EthereumTypeAddressDescriptorLen + if len(addresses) > 0 { + t.To = addresses[0] + } + t.Value, ll = unpackBigint(buf[l:]) + l += ll + } + id.Error = eth.UnpackInternalTransactionError(buf[l:]) + return &id, nil +} + +// FourByteSignature contains 4byte signature of transaction value with parameters +// and parsed parameters (that are not stored in DB) +func packFourByteKey(fourBytes uint32, id uint32) []byte { + key := make([]byte, 0, 8) + key = append(key, packUint(fourBytes)...) + key = append(key, packUint(id)...) + return key +} + +func packFourByteSignature(signature *bchain.FourByteSignature) []byte { + buf := packString(signature.Name) + for i := range signature.Parameters { + buf = append(buf, packString(signature.Parameters[i])...) + } + return buf +} + +func unpackFourByteSignature(buf []byte) (*bchain.FourByteSignature, error) { + var signature bchain.FourByteSignature + var l int + signature.Name, l = unpackString(buf) + for l < len(buf) { + s, ll := unpackString(buf[l:]) + signature.Parameters = append(signature.Parameters, s) + l += ll + } + return &signature, nil +} + +// GetFourByteSignature gets all 4byte signature of given fourBytes and id +func (d *RocksDB) GetFourByteSignature(fourBytes uint32, id uint32) (*bchain.FourByteSignature, error) { + key := packFourByteKey(fourBytes, id) + val, err := d.db.GetCF(d.ro, d.cfh[cfFunctionSignatures], key) + if err != nil { + return nil, err + } + defer val.Free() + buf := val.Data() + if len(buf) == 0 { + return nil, nil + } + return unpackFourByteSignature(buf) +} + +var cachedByteSignatures = make(map[uint32]*[]bchain.FourByteSignature) +var cachedByteSignaturesMux sync.Mutex + +// GetFourByteSignatures gets all 4byte signatures of given fourBytes +// (there may be more than one signature starting with the same four bytes) +func (d *RocksDB) GetFourByteSignatures(fourBytes uint32) (*[]bchain.FourByteSignature, error) { + cachedByteSignaturesMux.Lock() + signatures, found := cachedByteSignatures[fourBytes] + cachedByteSignaturesMux.Unlock() + if !found { + retval := []bchain.FourByteSignature{} + key := packUint(fourBytes) + it := d.db.NewIteratorCF(d.ro, d.cfh[cfFunctionSignatures]) + defer it.Close() + for it.Seek(key); it.Valid(); it.Next() { + current := it.Key().Data() + if bytes.Compare(current[:4], key) > 0 { + break + } + val := it.Value().Data() + signature, err := unpackFourByteSignature(val) if err != nil { return nil, err } - contracts[j].contract, i, err = getAddress(i) + retval = append(retval, *signature) + } + cachedByteSignaturesMux.Lock() + cachedByteSignatures[fourBytes] = &retval + cachedByteSignaturesMux.Unlock() + return &retval, nil + } + return signatures, nil +} + +// StoreFourByteSignature stores 4byte signature in DB +func (d *RocksDB) StoreFourByteSignature(wb *grocksdb.WriteBatch, fourBytes uint32, id uint32, signature *bchain.FourByteSignature) error { + key := packFourByteKey(fourBytes, id) + wb.PutCF(d.cfh[cfFunctionSignatures], key, packFourByteSignature(signature)) + cachedByteSignaturesMux.Lock() + delete(cachedByteSignatures, fourBytes) + cachedByteSignaturesMux.Unlock() + return nil +} + +// GetEthereumInternalData gets transaction internal data from DB +func (d *RocksDB) GetEthereumInternalData(txid string) (*bchain.EthereumInternalData, error) { + btxID, err := d.chainParser.PackTxid(txid) + if err != nil { + return nil, err + } + return d.getEthereumInternalData(btxID) +} + +func (d *RocksDB) getEthereumInternalData(btxID []byte) (*bchain.EthereumInternalData, error) { + val, err := d.db.GetCF(d.ro, d.cfh[cfInternalData], btxID) + if err != nil { + return nil, err + } + defer val.Free() + buf := val.Data() + if len(buf) == 0 { + return nil, nil + } + return d.unpackEthInternalData(buf) +} + +func (d *RocksDB) storeInternalDataEthereumType(wb *grocksdb.WriteBatch, blockTxs []ethBlockTx) error { + for i := range blockTxs { + blockTx := &blockTxs[i] + if blockTx.internalData != nil { + wb.PutCF(d.cfh[cfInternalData], blockTx.btxID, packEthInternalData(blockTx.internalData)) + } + } + return nil +} + +var cachedContracts = make(map[string]*bchain.ContractInfo) +var cachedContractsMux sync.Mutex + +func packContractInfo(contractInfo *bchain.ContractInfo) []byte { + buf := packString(contractInfo.Name) + buf = append(buf, packString(contractInfo.Symbol)...) + buf = append(buf, packString(string(contractInfo.Standard))...) + varBuf := make([]byte, vlq.MaxLen64) + l := packVaruint(uint(contractInfo.Decimals), varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(uint(contractInfo.CreatedInBlock), varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(uint(contractInfo.DestructedInBlock), varBuf) + buf = append(buf, varBuf[:l]...) + return buf +} + +func unpackContractInfo(buf []byte) (*bchain.ContractInfo, error) { + var contractInfo bchain.ContractInfo + var s string + var l int + var ui uint + contractInfo.Name, l = unpackString(buf) + buf = buf[l:] + contractInfo.Symbol, l = unpackString(buf) + buf = buf[l:] + s, l = unpackString(buf) + contractInfo.Standard = bchain.TokenStandardName(s) + contractInfo.Type = bchain.TokenStandardName(s) + buf = buf[l:] + ui, l = unpackVaruint(buf) + contractInfo.Decimals = int(ui) + buf = buf[l:] + ui, l = unpackVaruint(buf) + contractInfo.CreatedInBlock = uint32(ui) + buf = buf[l:] + ui, _ = unpackVaruint(buf) + contractInfo.DestructedInBlock = uint32(ui) + return &contractInfo, nil +} + +func (d *RocksDB) GetContractInfoForAddress(address string) (*bchain.ContractInfo, error) { + contract, err := d.chainParser.GetAddrDescFromAddress(address) + if err != nil || contract == nil { + return nil, err + } + return d.GetContractInfo(contract, "") +} + +// GetContractInfo gets contract from cache or DB and possibly updates the standard from standardFromContext +// it is hard to guess the standard of the contract using API, it is easier to set it the first time the contract is processed in a tx +func (d *RocksDB) GetContractInfo(contract bchain.AddressDescriptor, standardFromContext bchain.TokenStandardName) (*bchain.ContractInfo, error) { + cacheKey := string(contract) + cachedContractsMux.Lock() + contractInfo, found := cachedContracts[cacheKey] + cachedContractsMux.Unlock() + if !found { + val, err := d.db.GetCF(d.ro, d.cfh[cfContracts], contract) + if err != nil { + return nil, err + } + defer val.Free() + buf := val.Data() + if len(buf) == 0 { + return nil, nil + } + contractInfo, _ = unpackContractInfo(buf) + addresses, _, _ := d.chainParser.GetAddressesFromAddrDesc(contract) + if len(addresses) > 0 { + contractInfo.Contract = addresses[0] + } + // if the standard is specified and stored contractInfo has unknown standard, set and store it + if standardFromContext != bchain.UnknownTokenStandard && contractInfo.Standard == bchain.UnknownTokenStandard { + contractInfo.Standard = standardFromContext + contractInfo.Type = standardFromContext + err = d.db.PutCF(d.wo, d.cfh[cfContracts], contract, packContractInfo(contractInfo)) if err != nil { return nil, err } } - bt = append(bt, ethBlockTx{ - btxID: txid, - from: from, - to: to, - contracts: contracts, - }) + cachedContractsMux.Lock() + cachedContracts[cacheKey] = contractInfo + cachedContractsMux.Unlock() } - return bt, nil + return contractInfo, nil } -func (d *RocksDB) disconnectBlockTxsEthereumType(wb *gorocksdb.WriteBatch, height uint32, blockTxs []ethBlockTx, contracts map[string]*AddrContracts) error { - glog.Info("Disconnecting block ", height, " containing ", len(blockTxs), " transactions") - addresses := make(map[string]map[string]struct{}) - disconnectAddress := func(btxID []byte, addrDesc, contract bchain.AddressDescriptor) error { - var err error - // do not process empty address - if len(addrDesc) == 0 { - return nil - } - s := string(addrDesc) - txid := string(btxID) - // find if tx for this address was already encountered - mtx, ftx := addresses[s] - if !ftx { - mtx = make(map[string]struct{}) - mtx[txid] = struct{}{} - addresses[s] = mtx - } else { - _, ftx = mtx[txid] - if !ftx { - mtx[txid] = struct{}{} +// StoreContractInfo stores contractInfo in DB +// if CreatedInBlock==0 and DestructedInBlock!=0, it is evaluated as a destruction of a contract, the contract info is updated +// in all other cases the contractInfo overwrites previously stored data in DB (however it should not really happen as contract is created only once) +func (d *RocksDB) StoreContractInfo(contractInfo *bchain.ContractInfo) error { + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + if err := d.storeContractInfo(wb, contractInfo); err != nil { + return err + } + return d.WriteBatch(wb) +} + +func (d *RocksDB) storeContractInfo(wb *grocksdb.WriteBatch, contractInfo *bchain.ContractInfo) error { + if contractInfo.Contract != "" { + key, err := d.chainParser.GetAddrDescFromAddress(contractInfo.Contract) + if err != nil { + return err + } + if contractInfo.CreatedInBlock == 0 && contractInfo.DestructedInBlock != 0 { + storedCI, err := d.GetContractInfo(key, "") + if err != nil { + return err + } + if storedCI == nil { + return nil } + storedCI.DestructedInBlock = contractInfo.DestructedInBlock + contractInfo = storedCI } - c, fc := contracts[s] - if !fc { - c, err = d.GetAddrDescContracts(addrDesc) + wb.PutCF(d.cfh[cfContracts], key, packContractInfo(contractInfo)) + cacheKey := string(key) + cachedContractsMux.Lock() + delete(cachedContracts, cacheKey) + cachedContractsMux.Unlock() + } + return nil +} + +func packBlockTx(buf []byte, blockTx *ethBlockTx) []byte { + varBuf := make([]byte, maxPackedBigintBytes) + buf = append(buf, blockTx.btxID...) + buf = appendAddress(buf, blockTx.from) + buf = appendAddress(buf, blockTx.to) + // internal data are not stored in blockTx, they are fetched on disconnect directly from the cfInternalData column + // contracts - store the number of address pairs + l := packVaruint(uint(len(blockTx.contracts)), varBuf) + buf = append(buf, varBuf[:l]...) + for j := range blockTx.contracts { + c := &blockTx.contracts[j] + buf = appendAddress(buf, c.from) + buf = appendAddress(buf, c.to) + buf = appendAddress(buf, c.contract) + l = packVaruint(uint(c.transferStandard), varBuf) + buf = append(buf, varBuf[:l]...) + if c.transferStandard == bchain.MultiToken { + l = packVaruint(uint(len(c.idValues)), varBuf) + buf = append(buf, varBuf[:l]...) + for i := range c.idValues { + l = packBigint(&c.idValues[i].Id, varBuf) + buf = append(buf, varBuf[:l]...) + l = packBigint(&c.idValues[i].Value, varBuf) + buf = append(buf, varBuf[:l]...) + } + } else { // ERC20, ERC721 + l = packBigint(&c.value, varBuf) + buf = append(buf, varBuf[:l]...) + } + } + return buf +} + +func (d *RocksDB) storeAndCleanupBlockTxsEthereumType(wb *grocksdb.WriteBatch, block *bchain.Block, blockTxs []ethBlockTx) error { + pl := d.chainParser.PackedTxidLen() + buf := make([]byte, 0, (pl+2*eth.EthereumTypeAddressDescriptorLen)*len(blockTxs)) + for i := range blockTxs { + buf = packBlockTx(buf, &blockTxs[i]) + } + key := packUint(block.Height) + wb.PutCF(d.cfh[cfBlockTxs], key, buf) + return d.cleanupBlockTxs(wb, block) +} + +func (d *RocksDB) StoreBlockInternalDataErrorEthereumType(wb *grocksdb.WriteBatch, block *bchain.Block, message string, retryCount uint8) error { + key := packUint(block.Height) + // TODO: this supposes that Txid and block hash are the same size + txid, err := d.chainParser.PackTxid(block.Hash) + if err != nil { + return err + } + m := []byte(message) + buf := make([]byte, 0, len(txid)+len(m)+1) + // the stored structure is txid+retry count (1 byte)+error message + buf = append(buf, txid...) + buf = append(buf, retryCount) + buf = append(buf, m...) + wb.PutCF(d.cfh[cfBlockInternalDataErrors], key, buf) + return nil +} + +type BlockInternalDataError struct { + Height uint32 + Hash string + Retries uint8 + ErrorMessage string +} + +func (d *RocksDB) unpackBlockInternalDataError(val []byte) (string, uint8, string, error) { + txidUnpackedLen := d.chainParser.PackedTxidLen() + var hash, message string + var retries uint8 + var err error + if len(val) > txidUnpackedLen+1 { + hash, err = d.chainParser.UnpackTxid(val[:txidUnpackedLen]) + if err != nil { + return "", 0, "", err + } + val = val[txidUnpackedLen:] + retries = val[0] + message = string(val[1:]) + } + return hash, retries, message, nil +} + +func (d *RocksDB) GetBlockInternalDataErrorsEthereumType() ([]BlockInternalDataError, error) { + retval := []BlockInternalDataError{} + if d.chainParser.GetChainType() == bchain.ChainEthereumType { + it := d.db.NewIteratorCF(d.ro, d.cfh[cfBlockInternalDataErrors]) + defer it.Close() + for it.SeekToFirst(); it.Valid(); it.Next() { + height := unpackUint(it.Key().Data()) + val := it.Value().Data() + hash, retires, message, err := d.unpackBlockInternalDataError(val) if err != nil { + glog.Error("GetBlockInternalDataErrorsEthereumType height ", height, ", unpack error ", err) + continue + } + retval = append(retval, BlockInternalDataError{ + Height: height, + Hash: hash, + Retries: retires, + ErrorMessage: message, + }) + } + } + return retval, nil +} + +func (d *RocksDB) storeBlockSpecificDataEthereumType(wb *grocksdb.WriteBatch, block *bchain.Block) error { + blockSpecificData, _ := block.CoinSpecificData.(*bchain.EthereumBlockSpecificData) + if blockSpecificData != nil { + if blockSpecificData.InternalDataError != "" { + glog.Info("storeBlockSpecificDataEthereumType ", block.Height, ": ", blockSpecificData.InternalDataError) + if err := d.StoreBlockInternalDataErrorEthereumType(wb, block, blockSpecificData.InternalDataError, 0); err != nil { return err } - contracts[s] = c } - if c != nil { - if !ftx { - c.TotalTxs-- + if len(blockSpecificData.AddressAliasRecords) > 0 { + if err := d.storeAddressAliasRecords(wb, blockSpecificData.AddressAliasRecords); err != nil { + return err + } + } + for i := range blockSpecificData.Contracts { + if err := d.storeContractInfo(wb, &blockSpecificData.Contracts[i]); err != nil { + return err + } + } + } + return nil +} + +// unpackBlockTx unpacks ethBlockTx from buf, starting at position pos +// the position is updated as the data is unpacked and returned to the caller +func unpackBlockTx(buf []byte, pos int) (*ethBlockTx, int, error) { + getAddress := func(i int) (bchain.AddressDescriptor, int, error) { + if len(buf)-i < eth.EthereumTypeAddressDescriptorLen { + glog.Error("rocksdb: Inconsistent data in blockTxs ", hex.EncodeToString(buf)) + return nil, 0, errors.New("Inconsistent data in blockTxs") + } + a := append(bchain.AddressDescriptor(nil), buf[i:i+eth.EthereumTypeAddressDescriptorLen]...) + return a, i + eth.EthereumTypeAddressDescriptorLen, nil + } + var from, to bchain.AddressDescriptor + var err error + if len(buf)-pos < eth.EthereumTypeTxidLen { + glog.Error("rocksdb: Inconsistent data in blockTxs ", hex.EncodeToString(buf)) + return nil, 0, errors.New("Inconsistent data in blockTxs") + } + txid := append([]byte(nil), buf[pos:pos+eth.EthereumTypeTxidLen]...) + pos += eth.EthereumTypeTxidLen + from, pos, err = getAddress(pos) + if err != nil { + return nil, 0, err + } + to, pos, err = getAddress(pos) + if err != nil { + return nil, 0, err + } + // contracts + cc, l := unpackVaruint(buf[pos:]) + pos += l + contracts := make([]ethBlockTxContract, cc) + for j := range contracts { + c := &contracts[j] + c.from, pos, err = getAddress(pos) + if err != nil { + return nil, 0, err + } + c.to, pos, err = getAddress(pos) + if err != nil { + return nil, 0, err + } + c.contract, pos, err = getAddress(pos) + if err != nil { + return nil, 0, err + } + cc, l = unpackVaruint(buf[pos:]) + c.transferStandard = bchain.TokenStandard(cc) + pos += l + if c.transferStandard == bchain.MultiToken { + cc, l = unpackVaruint(buf[pos:]) + pos += l + c.idValues = make([]bchain.MultiTokenValue, cc) + for i := range c.idValues { + c.idValues[i].Id, l = unpackBigint(buf[pos:]) + pos += l + c.idValues[i].Value, l = unpackBigint(buf[pos:]) + pos += l } - if contract == nil { - if c.NonContractTxs > 0 { - c.NonContractTxs-- + } else { // ERC20, ERC721 + c.value, l = unpackBigint(buf[pos:]) + pos += l + } + } + return ðBlockTx{ + btxID: txid, + from: from, + to: to, + contracts: contracts, + }, pos, nil +} + +func (d *RocksDB) getBlockTxsEthereumType(height uint32) ([]ethBlockTx, error) { + val, err := d.db.GetCF(d.ro, d.cfh[cfBlockTxs], packUint(height)) + if err != nil { + return nil, err + } + defer val.Free() + buf := val.Data() + // nil data means the key was not found in DB + if buf == nil { + return nil, nil + } + // buf can be empty slice, this means the block did not contain any transactions + bt := make([]ethBlockTx, 0, 16) + var btx *ethBlockTx + for i := 0; i < len(buf); { + btx, i, err = unpackBlockTx(buf, i) + if err != nil { + return nil, err + } + bt = append(bt, *btx) + } + return bt, nil +} + +func (d *RocksDB) disconnectAddress(btxID []byte, internal bool, addrDesc bchain.AddressDescriptor, btxContract *ethBlockTxContract, addresses map[string]map[string]struct{}, contracts map[string]*unpackedAddrContracts) error { + var err error + // do not process empty address + if len(addrDesc) == 0 { + return nil + } + s := string(addrDesc) + txid := string(btxID) + // find if tx for this address was already encountered + mtx, ftx := addresses[s] + if !ftx { + mtx = make(map[string]struct{}) + mtx[txid] = struct{}{} + addresses[s] = mtx + } else { + _, ftx = mtx[txid] + if !ftx { + mtx[txid] = struct{}{} + } + } + addrContracts, fc := contracts[s] + if !fc { + addrContracts, err = d.getUnpackedAddrDescContracts(addrDesc) + if err != nil { + return err + } + if addrContracts != nil { + contracts[s] = addrContracts + } + } + if addrContracts != nil { + if !ftx { + addrContracts.TotalTxs-- + } + if btxContract == nil { + if internal { + if addrContracts.InternalTxs > 0 { + addrContracts.InternalTxs-- } else { - glog.Warning("AddressContracts ", addrDesc, ", EthTxs would be negative, tx ", hex.EncodeToString(btxID)) + glog.Warning("AddressContracts ", addrDesc, ", InternalTxs would be negative, tx ", hex.EncodeToString(btxID)) } } else { - i, found := findContractInAddressContracts(contract, c.Contracts) - if found { - if c.Contracts[i].Txs > 0 { - c.Contracts[i].Txs-- - if c.Contracts[i].Txs == 0 { - c.Contracts = append(c.Contracts[:i], c.Contracts[i+1:]...) - } + if addrContracts.NonContractTxs > 0 { + addrContracts.NonContractTxs-- + } else { + glog.Warning("AddressContracts ", addrDesc, ", EthTxs would be negative, tx ", hex.EncodeToString(btxID)) + } + } + } else { + contractIndex, found := findContractInAddressContracts(btxContract.contract, addrContracts.Contracts) + if found { + addrContract := &addrContracts.Contracts[contractIndex] + if addrContract.Txs > 0 { + addrContract.Txs-- + if addrContract.Txs == 0 { + // no transactions, remove the contract + addrContracts.Contracts = append(addrContracts.Contracts[:contractIndex], addrContracts.Contracts[contractIndex+1:]...) } else { - glog.Warning("AddressContracts ", addrDesc, ", contract ", i, " Txs would be negative, tx ", hex.EncodeToString(btxID)) + // update the values of the contract, reverse the direction + var index int32 + if bytes.Equal(addrDesc, btxContract.to) { + index = transferFrom + } else { + index = transferTo + } + addToContract(addrContract, contractIndex, index, btxContract.contract, &bchain.TokenTransfer{ + Standard: btxContract.transferStandard, + Value: btxContract.value, + MultiTokenValues: btxContract.idValues, + }, false) } } else { - glog.Warning("AddressContracts ", addrDesc, ", contract ", contract, " not found, tx ", hex.EncodeToString(btxID)) + glog.Warning("AddressContracts ", addrDesc, ", contract ", contractIndex, " Txs would be negative, tx ", hex.EncodeToString(btxID)) + } + } else { + if !isZeroAddress(addrDesc) { + glog.Warning("AddressContracts ", addrDesc, ", contract ", btxContract.contract, " not found, tx ", hex.EncodeToString(btxID)) } } - } else { + } + } else { + if !isZeroAddress(addrDesc) { glog.Warning("AddressContracts ", addrDesc, " not found, tx ", hex.EncodeToString(btxID)) } - return nil } + return nil +} + +func (d *RocksDB) disconnectInternalData(btxID []byte, addresses map[string]map[string]struct{}, contracts map[string]*unpackedAddrContracts) error { + internalData, err := d.getEthereumInternalData(btxID) + if err != nil { + return err + } + if internalData != nil { + if internalData.Type == bchain.CREATE { + contract, err := d.chainParser.GetAddrDescFromAddress(internalData.Contract) + if err != nil { + return err + } + if err := d.disconnectAddress(btxID, true, contract, nil, addresses, contracts); err != nil { + return err + } + } + for j := range internalData.Transfers { + t := &internalData.Transfers[j] + var from, to bchain.AddressDescriptor + from, err = d.chainParser.GetAddrDescFromAddress(t.From) + if err == nil { + to, err = d.chainParser.GetAddrDescFromAddress(t.To) + } + if err != nil { + return err + } + if err := d.disconnectAddress(btxID, true, from, nil, addresses, contracts); err != nil { + return err + } + // if from==to, tx is counted only once and does not have to be disconnected again + if !bytes.Equal(from, to) { + if err := d.disconnectAddress(btxID, true, to, nil, addresses, contracts); err != nil { + return err + } + } + } + } + return nil +} + +func (d *RocksDB) disconnectBlockTxsEthereumType(wb *grocksdb.WriteBatch, height uint32, blockTxs []ethBlockTx, contracts map[string]*unpackedAddrContracts) error { + glog.Info("Disconnecting block ", height, " containing ", len(blockTxs), " transactions") + addresses := make(map[string]map[string]struct{}) for i := range blockTxs { blockTx := &blockTxs[i] - if err := disconnectAddress(blockTx.btxID, blockTx.from, nil); err != nil { + if err := d.disconnectAddress(blockTx.btxID, false, blockTx.from, nil, addresses, contracts); err != nil { return err } // if from==to, tx is counted only once and does not have to be disconnected again if !bytes.Equal(blockTx.from, blockTx.to) { - if err := disconnectAddress(blockTx.btxID, blockTx.to, nil); err != nil { + if err := d.disconnectAddress(blockTx.btxID, false, blockTx.to, nil, addresses, contracts); err != nil { return err } } - for _, c := range blockTx.contracts { - if err := disconnectAddress(blockTx.btxID, c.addr, c.contract); err != nil { + // internal data + err := d.disconnectInternalData(blockTx.btxID, addresses, contracts) + if err != nil { + return err + + } + // contracts + for j := range blockTx.contracts { + c := &blockTx.contracts[j] + if err := d.disconnectAddress(blockTx.btxID, false, c.from, c, addresses, contracts); err != nil { return err } + if !bytes.Equal(c.from, c.to) { + if err := d.disconnectAddress(blockTx.btxID, false, c.to, c, addresses, contracts); err != nil { + return err + } + } } wb.DeleteCF(d.cfh[cfTransactions], blockTx.btxID) + wb.DeleteCF(d.cfh[cfInternalData], blockTx.btxID) } for a := range addresses { key := packAddressKey([]byte(a), height) @@ -441,9 +1481,9 @@ func (d *RocksDB) DisconnectBlockRangeEthereumType(lower uint32, higher uint32) } blocks[height-lower] = blockTxs } - wb := gorocksdb.NewWriteBatch() + wb := grocksdb.NewWriteBatch() defer wb.Destroy() - contracts := make(map[string]*AddrContracts) + contracts := make(map[string]*unpackedAddrContracts) for height := higher; height >= lower; height-- { if err := d.disconnectBlockTxsEthereumType(wb, height, blocks[height-lower], contracts); err != nil { return err @@ -451,12 +1491,363 @@ func (d *RocksDB) DisconnectBlockRangeEthereumType(lower uint32, higher uint32) key := packUint(height) wb.DeleteCF(d.cfh[cfBlockTxs], key) wb.DeleteCF(d.cfh[cfHeight], key) + wb.DeleteCF(d.cfh[cfBlockInternalDataErrors], key) } - d.storeAddressContracts(wb, contracts) - err := d.db.Write(d.wo, wb) + d.storeUnpackedAddressContracts(wb, contracts) + err := d.WriteBatch(wb) if err == nil { d.is.RemoveLastBlockTimes(int(higher-lower) + 1) glog.Infof("rocksdb: blocks %d-%d disconnected", lower, higher) } return err } + +func (d *RocksDB) SortAddressContracts(stop chan os.Signal) error { + if d.chainParser.GetChainType() != bchain.ChainEthereumType { + glog.Info("SortAddressContracts: applicable only for ethereum type coins") + return nil + } + glog.Info("SortAddressContracts: starting") + // do not use cache + ro := grocksdb.NewDefaultReadOptions() + ro.SetFillCache(false) + it := d.db.NewIteratorCF(ro, d.cfh[cfAddressContracts]) + defer it.Close() + var rowCount, idsSortedCount, multiTokenValuesSortedCount int + for it.SeekToFirst(); it.Valid(); it.Next() { + select { + case <-stop: + return errors.New("SortAddressContracts: interrupted") + default: + } + rowCount++ + addrDesc := it.Key().Data() + buf := it.Value().Data() + if len(buf) > 0 { + ca, err := unpackAddrContracts(buf, addrDesc) + if err != nil { + glog.Error("failed to unpack AddrContracts for: ", hex.EncodeToString(addrDesc)) + } + update := false + for i := range ca.Contracts { + c := &ca.Contracts[i] + if sorted := c.Ids.sort(); sorted { + idsSortedCount++ + update = true + } + if sorted := c.MultiTokenValues.sort(); sorted { + multiTokenValuesSortedCount++ + update = true + } + } + if update { + if err := func() error { + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + buf := packAddrContracts(ca) + wb.PutCF(d.cfh[cfAddressContracts], addrDesc, buf) + return d.WriteBatch(wb) + }(); err != nil { + return errors.Errorf("failed to write cfAddressContracts for: %v: %v", addrDesc, err) + } + } + } + if rowCount%5000000 == 0 { + glog.Infof("SortAddressContracts: progress - scanned %d rows, sorted %d ids and %d multi token values", rowCount, idsSortedCount, multiTokenValuesSortedCount) + } + } + glog.Infof("SortAddressContracts: finished - scanned %d rows, sorted %d ids and %d multi token value", rowCount, idsSortedCount, multiTokenValuesSortedCount) + return nil +} + +type unpackedBigInt struct { + Slice []byte + Value *big.Int +} +type unpackedIds []unpackedBigInt + +type unpackedAddrContract struct { + Standard bchain.TokenStandard + Contract bchain.AddressDescriptor + Txs uint + Value unpackedBigInt // single value of ERC20 + Ids unpackedIds // multiple ERC721 tokens + MultiTokenValues unpackedMultiTokenValues // multiple ERC1155 tokens +} + +func (b *unpackedBigInt) get() *big.Int { + if b.Value == nil { + if len(b.Slice) == 0 { + b.Value = big.NewInt(0) + } else { + bi, _ := unpackBigint(b.Slice) + b.Value = &bi + } + } + return b.Value +} + +type unpackedAddrContracts struct { + Packed []byte + TotalTxs uint + NonContractTxs uint + InternalTxs uint + Contracts []unpackedAddrContract +} + +func (s *unpackedIds) search(id big.Int) int { + // attempt to find id using a binary search + return sort.Search(len(*s), func(i int) bool { + return (*s)[i].get().CmpAbs(&id) >= 0 + }) +} + +// insert id in ascending order +func (s *unpackedIds) insert(id big.Int) { + i := s.search(id) + if i == len(*s) { + *s = append(*s, unpackedBigInt{Value: &id}) + } else { + *s = append((*s)[:i+1], (*s)[i:]...) + (*s)[i] = unpackedBigInt{Value: &id} + } +} + +func (s *unpackedIds) remove(id big.Int) { + i := s.search(id) + // remove id if found + if i < len(*s) && (*s)[i].get().CmpAbs(&id) == 0 { + *s = append((*s)[:i], (*s)[i+1:]...) + } +} + +type unpackedMultiTokenValue struct { + Id unpackedBigInt + Value unpackedBigInt +} + +type unpackedMultiTokenValues []unpackedMultiTokenValue + +// search for multi token value using a binary seach on id +func (s *unpackedMultiTokenValues) search(m bchain.MultiTokenValue) int { + return sort.Search(len(*s), func(i int) bool { + return (*s)[i].Id.get().CmpAbs(&m.Id) >= 0 + }) +} + +func (s *unpackedMultiTokenValues) upsert(m bchain.MultiTokenValue, index int32, aggregate AggregateFn) { + i := s.search(m) + if i < len(*s) && (*s)[i].Id.get().CmpAbs(&m.Id) == 0 { + aggregate((*s)[i].Value.get(), &m.Value) + // if transfer from, remove if the value is zero + if index < 0 && len((*s)[i].Value.get().Bits()) == 0 { + *s = append((*s)[:i], (*s)[i+1:]...) + } + return + } + if index >= 0 { + elem := unpackedMultiTokenValue{ + Id: unpackedBigInt{Value: &m.Id}, + Value: unpackedBigInt{Value: new(big.Int).Set(&m.Value)}, + } + if i == len(*s) { + *s = append(*s, elem) + } else { + *s = append((*s)[:i+1], (*s)[i:]...) + (*s)[i] = elem + } + } +} + +// getUnpackedAddrDescContracts returns partially unpacked AddrContracts for given addrDesc +func (d *RocksDB) getUnpackedAddrDescContracts(addrDesc bchain.AddressDescriptor) (*unpackedAddrContracts, error) { + d.addrContractsCacheMux.Lock() + rv, found := d.addrContractsCache[string(addrDesc)] + d.addrContractsCacheMux.Unlock() + if found && rv != nil { + return rv, nil + } + val, err := d.db.GetCF(d.ro, d.cfh[cfAddressContracts], addrDesc) + if err != nil { + return nil, err + } + defer val.Free() + buf := val.Data() + if len(buf) == 0 { + return nil, nil + } + rv, err = partiallyUnpackAddrContracts(buf) + if err == nil && rv != nil && len(buf) > addrContractsCacheMinSize { + d.addrContractsCacheMux.Lock() + d.addrContractsCache[string(addrDesc)] = rv + d.addrContractsCacheMux.Unlock() + } + return rv, err +} + +// to speed up import of blocks, the unpacking of big ints is deferred to time when they are needed +func partiallyUnpackAddrContracts(buf []byte) (acs *unpackedAddrContracts, err error) { + // make copy of the slice to avoid subsequent allocation of smaller slices + buf = append([]byte{}, buf...) + index := 0 + tt, l := unpackVaruint(buf) + index += l + nct, l := unpackVaruint(buf[index:]) + index += l + ict, l := unpackVaruint(buf[index:]) + index += l + cl, l := unpackVaruint(buf[index:]) + index += l + c := make([]unpackedAddrContract, 0, cl) + for index < len(buf) { + contract := buf[index : index+eth.EthereumTypeAddressDescriptorLen] + index += eth.EthereumTypeAddressDescriptorLen + txs, l := unpackVaruint(buf[index:]) + index += l + standard := bchain.TokenStandard(txs & 3) + txs >>= 2 + ac := unpackedAddrContract{ + Standard: standard, + Contract: contract, + Txs: txs, + } + if standard == bchain.FungibleToken { + l := packedBigintLen(buf[index:]) + ac.Value = unpackedBigInt{Slice: buf[index : index+l]} + index += l + } else { + len, ll := unpackVaruint(buf[index:]) + index += ll + if standard == bchain.NonFungibleToken { + ac.Ids = make(unpackedIds, len) + for i := uint(0); i < len; i++ { + ll := packedBigintLen(buf[index:]) + ac.Ids[i] = unpackedBigInt{Slice: buf[index : index+ll]} + index += ll + } + } else { + ac.MultiTokenValues = make(unpackedMultiTokenValues, len) + for i := uint(0); i < len; i++ { + ll := packedBigintLen(buf[index:]) + ac.MultiTokenValues[i].Id = unpackedBigInt{Slice: buf[index : index+ll]} + index += ll + ll = packedBigintLen(buf[index:]) + ac.MultiTokenValues[i].Value = unpackedBigInt{Slice: buf[index : index+ll]} + index += ll + } + } + } + c = append(c, ac) + } + return &unpackedAddrContracts{ + Packed: buf, + TotalTxs: tt, + NonContractTxs: nct, + InternalTxs: ict, + Contracts: c, + }, nil +} + +// packUnpackedAddrContracts packs unpackedAddrContracts into a byte buffer +func packUnpackedAddrContracts(acs *unpackedAddrContracts) []byte { + buf := make([]byte, 0, len(acs.Packed)+eth.EthereumTypeAddressDescriptorLen+12) + varBuf := make([]byte, maxPackedBigintBytes) + l := packVaruint(acs.TotalTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(acs.NonContractTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(acs.InternalTxs, varBuf) + buf = append(buf, varBuf[:l]...) + l = packVaruint(uint(len(acs.Contracts)), varBuf) + buf = append(buf, varBuf[:l]...) + for _, ac := range acs.Contracts { + buf = append(buf, ac.Contract...) + l = packVaruint(uint(ac.Standard)+ac.Txs<<2, varBuf) + buf = append(buf, varBuf[:l]...) + if ac.Standard == bchain.FungibleToken { + if ac.Value.Value != nil { + l = packBigint(ac.Value.Value, varBuf) + buf = append(buf, varBuf[:l]...) + } else { + buf = append(buf, ac.Value.Slice...) + } + } else if ac.Standard == bchain.NonFungibleToken { + l = packVaruint(uint(len(ac.Ids)), varBuf) + buf = append(buf, varBuf[:l]...) + for i := range ac.Ids { + if ac.Ids[i].Value != nil { + l = packBigint(ac.Ids[i].Value, varBuf) + buf = append(buf, varBuf[:l]...) + } else { + buf = append(buf, ac.Ids[i].Slice...) + } + } + } else { // bchain.ERC1155 + l = packVaruint(uint(len(ac.MultiTokenValues)), varBuf) + buf = append(buf, varBuf[:l]...) + for i := range ac.MultiTokenValues { + if ac.MultiTokenValues[i].Id.Value != nil { + l = packBigint(ac.MultiTokenValues[i].Id.Value, varBuf) + buf = append(buf, varBuf[:l]...) + } else { + buf = append(buf, ac.MultiTokenValues[i].Id.Slice...) + } + if ac.MultiTokenValues[i].Value.Value != nil { + l = packBigint(ac.MultiTokenValues[i].Value.Value, varBuf) + buf = append(buf, varBuf[:l]...) + } else { + buf = append(buf, ac.MultiTokenValues[i].Value.Slice...) + } + } + } + } + return buf +} + +func (d *RocksDB) storeUnpackedAddressContracts(wb *grocksdb.WriteBatch, acm map[string]*unpackedAddrContracts) error { + for addrDesc, acs := range acm { + // address with 0 contracts is removed from db - happens on disconnect + if acs == nil || (acs.NonContractTxs == 0 && acs.InternalTxs == 0 && len(acs.Contracts) == 0) { + wb.DeleteCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc)) + } else { + // do not store large address contracts found in cache + if _, found := d.addrContractsCache[addrDesc]; !found { + buf := packUnpackedAddrContracts(acs) + wb.PutCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc), buf) + } + } + } + return nil +} + +func (d *RocksDB) writeContractsCache() { + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + d.addrContractsCacheMux.Lock() + for addrDesc, acs := range d.addrContractsCache { + buf := packUnpackedAddrContracts(acs) + wb.PutCF(d.cfh[cfAddressContracts], bchain.AddressDescriptor(addrDesc), buf) + } + d.addrContractsCacheMux.Unlock() + if err := d.WriteBatch(wb); err != nil { + glog.Error("writeContractsCache: failed to store addrContractsCache: ", err) + } +} + +func (d *RocksDB) storeAddrContractsCache() { + start := time.Now() + if len(d.addrContractsCache) > 0 { + d.writeContractsCache() + } + glog.Info("storeAddrContractsCache: store ", len(d.addrContractsCache), " entries in ", time.Since(start)) +} + +func (d *RocksDB) periodicStoreAddrContractsCache() { + period := time.Duration(5) * time.Minute + timer := time.NewTimer(period) + for { + <-timer.C + timer.Reset(period) + d.storeAddrContractsCache() + } +} diff --git a/db/rocksdb_ethereumtype_test.go b/db/rocksdb_ethereumtype_test.go index 9819ec5d35..23791bfccb 100644 --- a/db/rocksdb_ethereumtype_test.go +++ b/db/rocksdb_ethereumtype_test.go @@ -4,11 +4,15 @@ package db import ( "encoding/hex" + "math/big" "reflect" "testing" "github.com/juju/errors" + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/bchain/coins/eth" + "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/tests/dbtestdata" ) @@ -17,7 +21,13 @@ type testEthereumParser struct { } func ethereumTestnetParser() *eth.EthereumParser { - return eth.NewEthereumParser(1) + return eth.NewEthereumParser(1, true) +} + +func bigintFromStringToHex(s string) string { + var b big.Int + b.SetString(s, 0) + return bigintToHex(&b) } func verifyAfterEthereumTypeBlock1(t *testing.T, d *RocksDB, afterDisconnect bool) { @@ -33,10 +43,11 @@ func verifyAfterEthereumTypeBlock1(t *testing.T, d *RocksDB, afterDisconnect boo } } if err := checkColumn(d, cfAddresses, []keyPair{ - {addressKeyHex(dbtestdata.EthAddr3e, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T1, []int32{^0}), nil}, - {addressKeyHex(dbtestdata.EthAddr55, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{1}) + txIndexesHex(dbtestdata.EthTxidB1T1, []int32{0}), nil}, - {addressKeyHex(dbtestdata.EthAddr20, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^0, ^1}), nil}, - {addressKeyHex(dbtestdata.EthAddrContract4a, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddr3e, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^1, 1}) + txIndexesHex(dbtestdata.EthTxidB1T1, []int32{^0}), nil}, + {addressKeyHex(dbtestdata.EthAddr55, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{2}) + txIndexesHex(dbtestdata.EthTxidB1T1, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddr20, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^0, ^2}), nil}, + {addressKeyHex(dbtestdata.EthAddr9f, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^1, 1}), nil}, + {addressKeyHex(dbtestdata.EthAddrContract4a, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{0, 1}), nil}, }); err != nil { { t.Fatal(err) @@ -44,10 +55,51 @@ func verifyAfterEthereumTypeBlock1(t *testing.T, d *RocksDB, afterDisconnect boo } if err := checkColumn(d, cfAddressContracts, []keyPair{ - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser), "0101", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser), "0201" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + "01", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser), "0101" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + "01", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), "0101", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser), "02010200", nil}, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser), + "02010001" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("10000000000000000000000"), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser), + "01010001" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintToHex(big.NewInt(0)), nil, + }, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr9f, d.chainParser), "01000200", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), "01010100", nil}, + }); err != nil { + { + t.Fatal(err) + } + } + + var destructedInBlock uint + if afterDisconnect { + destructedInBlock = 44445 + } + if err := checkColumn(d, cfContracts, []keyPair{ + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), + "0b436f6e7472616374203734" + // Contract 74 + "03533734" + // S74 + "054552433230" + // ERC20 + varuintToHex(12) + varuintToHex(44444) + varuintToHex(destructedInBlock), + nil, + }, + }); err != nil { + { + t.Fatal(err) + } + } + + if err := checkColumn(d, cfInternalData, []keyPair{ + { + dbtestdata.EthTxidB1T2, + "06" + + "01" + dbtestdata.EthAddr9f + dbtestdata.EthAddrContract4a + "030f4240" + + "00" + dbtestdata.EthAddr3e + dbtestdata.EthAddr9f + "030f4241" + + "00" + dbtestdata.EthAddr3e + dbtestdata.EthAddr3e + "030f4242", + nil, + }, }); err != nil { { t.Fatal(err) @@ -65,9 +117,7 @@ func verifyAfterEthereumTypeBlock1(t *testing.T, d *RocksDB, afterDisconnect boo dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + "00" + dbtestdata.EthTxidB1T2 + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + - "02" + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), + "01" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(uint(bchain.FungibleToken)) + bigintFromStringToHex("10000000000000000000000"), nil, }, } @@ -79,7 +129,7 @@ func verifyAfterEthereumTypeBlock1(t *testing.T, d *RocksDB, afterDisconnect boo } } -func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB) { +func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB, wantBlockInternalDataError bool) { if err := checkColumn(d, cfHeight, []keyPair{ { "0041eee8", @@ -88,7 +138,7 @@ func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB) { }, { "0041eee9", - "2b57e15e93a0ed197417a34c2498b7187df79099572c04a6b6e6ff418f74e6ee" + uintToHex(1534859988) + varuintToHex(2) + varuintToHex(2345678), + "2b57e15e93a0ed197417a34c2498b7187df79099572c04a6b6e6ff418f74e6ee" + uintToHex(1534859988) + varuintToHex(6) + varuintToHex(2345678), nil, }, }); err != nil { @@ -97,15 +147,27 @@ func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB) { } } if err := checkColumn(d, cfAddresses, []keyPair{ - {addressKeyHex(dbtestdata.EthAddr3e, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T1, []int32{^0}), nil}, - {addressKeyHex(dbtestdata.EthAddr55, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{1}) + txIndexesHex(dbtestdata.EthTxidB1T1, []int32{0}), nil}, - {addressKeyHex(dbtestdata.EthAddr20, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^0, ^1}), nil}, - {addressKeyHex(dbtestdata.EthAddrContract4a, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{0}), nil}, - {addressKeyHex(dbtestdata.EthAddr55, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^2, 1}) + txIndexesHex(dbtestdata.EthTxidB2T1, []int32{^0}), nil}, - {addressKeyHex(dbtestdata.EthAddr9f, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T1, []int32{0}), nil}, - {addressKeyHex(dbtestdata.EthAddr4b, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^0, 1, ^2, 2, ^1}), nil}, - {addressKeyHex(dbtestdata.EthAddr7b, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^1, 2}), nil}, + {addressKeyHex(dbtestdata.EthAddr3e, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^1, 1}) + txIndexesHex(dbtestdata.EthTxidB1T1, []int32{^0}), nil}, + {addressKeyHex(dbtestdata.EthAddr55, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{2}) + txIndexesHex(dbtestdata.EthTxidB1T1, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddr20, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^0, ^2}), nil}, + {addressKeyHex(dbtestdata.EthAddr9f, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{^1, 1}), nil}, + {addressKeyHex(dbtestdata.EthAddrContract4a, 4321000, d), txIndexesHex(dbtestdata.EthTxidB1T2, []int32{0, 1}), nil}, + + {addressKeyHex(dbtestdata.EthAddrZero, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T5, []int32{transferFrom}), nil}, + {addressKeyHex(dbtestdata.EthAddr3e, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T4, []int32{^0, 2}), nil}, + {addressKeyHex(dbtestdata.EthAddr4b, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^0, ^1, 2, ^3, 3, ^2}), nil}, + {addressKeyHex(dbtestdata.EthAddr55, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T6, []int32{0, ^0, 4, ^4}) + txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^3, 2}) + txIndexesHex(dbtestdata.EthTxidB2T1, []int32{^0}), nil}, + {addressKeyHex(dbtestdata.EthAddr5d, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T5, []int32{^0, 2}), nil}, + {addressKeyHex(dbtestdata.EthAddr7b, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T3, []int32{4}) + txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^2, 3}), nil}, + {addressKeyHex(dbtestdata.EthAddr83, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T3, []int32{^0, ^2}), nil}, + {addressKeyHex(dbtestdata.EthAddr92, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T4, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddr9f, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{1}) + txIndexesHex(dbtestdata.EthTxidB2T1, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddrA3, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T4, []int32{^2}), nil}, + {addressKeyHex(dbtestdata.EthAddrContract0d, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{1}), nil}, {addressKeyHex(dbtestdata.EthAddrContract47, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddrContract4a, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T2, []int32{^1}), nil}, + {addressKeyHex(dbtestdata.EthAddrContract6f, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T5, []int32{0}), nil}, + {addressKeyHex(dbtestdata.EthAddrContractCd, 4321001, d), txIndexesHex(dbtestdata.EthTxidB2T3, []int32{0}), nil}, }); err != nil { { t.Fatal(err) @@ -113,14 +175,95 @@ func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB) { } if err := checkColumn(d, cfAddressContracts, []keyPair{ - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser), "0101", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser), "0402" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + "02" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + "01", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser), "0101" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + "01", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), "0101", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr9f, d.chainParser), "0101", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser), "0101" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + "02" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + "02", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser), "0100" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + "01" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + "01", nil}, - {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract47, d.chainParser), "0101", nil}, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr20, d.chainParser), + "01010001" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintToHex(big.NewInt(0)), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser), + "03020201" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser) + varuintToHex(1<<2+uint(bchain.MultiToken)) + varuintToHex(1) + bigintFromStringToHex("150") + bigintFromStringToHex("1"), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser), + "01010102" + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + varuintToHex(2<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("8086") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(2<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("871180000950184"), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser), + "05030003" + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(2<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("10000000854307892726464") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("0") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("0"), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr5d, d.chainParser), + "01010001" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser) + varuintToHex(1<<2+uint(bchain.MultiToken)) + varuintToHex(2) + bigintFromStringToHex("1776") + bigintFromStringToHex("1") + bigintFromStringToHex("1898") + bigintFromStringToHex("10"), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser), + "02000003" + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("0") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + varuintToHex(1<<2+uint(bchain.FungibleToken)) + bigintFromStringToHex("7674999999999991915") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContractCd, d.chainParser) + varuintToHex(1<<2+uint(bchain.NonFungibleToken)) + varuintToHex(1) + bigintFromStringToHex("1"), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr83, d.chainParser), + "01010001" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContractCd, d.chainParser) + varuintToHex(1<<2+uint(bchain.NonFungibleToken)) + varuintToHex(0), nil, + }, + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrA3, d.chainParser), + "01000001" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser) + varuintToHex(1<<2+uint(bchain.MultiToken)) + varuintToHex(0), nil, + }, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr92, d.chainParser), "01010000", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr9f, d.chainParser), "03010400", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser), "01000100", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract47, d.chainParser), "01010000", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), "02010200", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser), "01010000", nil}, + {dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContractCd, d.chainParser), "01010000", nil}, + }); err != nil { + { + t.Fatal(err) + } + } + + if err := checkColumn(d, cfContracts, []keyPair{ + { + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser), + "0b436f6e7472616374203734" + // Contract 74 + "03533734" + // S74 + "054552433230" + // ERC20 + varuintToHex(12) + varuintToHex(44444) + varuintToHex(44445), + nil, + }, + }); err != nil { + { + t.Fatal(err) + } + } + + if err := checkColumn(d, cfInternalData, []keyPair{ + { + dbtestdata.EthTxidB1T2, + "06" + + "01" + dbtestdata.EthAddr9f + dbtestdata.EthAddrContract4a + "030f4240" + + "00" + dbtestdata.EthAddr3e + dbtestdata.EthAddr9f + "030f4241" + + "00" + dbtestdata.EthAddr3e + dbtestdata.EthAddr3e + "030f4242", + nil, + }, + { + dbtestdata.EthTxidB2T1, + "00" + hex.EncodeToString([]byte(dbtestdata.EthTx3InternalData.Error)), + nil, + }, + { + dbtestdata.EthTxidB2T2, + "05" + dbtestdata.EthAddrContract0d + + "00" + dbtestdata.EthAddr4b + dbtestdata.EthAddr9f + "030f424a" + + "02" + dbtestdata.EthAddrContract4a + dbtestdata.EthAddr9f + "030f424b", + nil, + }, }); err != nil { { t.Fatal(err) @@ -134,15 +277,22 @@ func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB) { dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr9f, d.chainParser) + "00" + dbtestdata.EthTxidB2T2 + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract47, d.chainParser) + - "08" + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + - dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser), + "04" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + varuintToHex(uint(bchain.FungibleToken)) + bigintFromStringToHex("7675000000000000001") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(uint(bchain.FungibleToken)) + bigintFromStringToHex("854307892726464") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract4a, d.chainParser) + varuintToHex(uint(bchain.FungibleToken)) + bigintFromStringToHex("871180000950184") + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr4b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract0d, d.chainParser) + varuintToHex(uint(bchain.FungibleToken)) + bigintFromStringToHex("7674999999999991915") + + dbtestdata.EthTxidB2T3 + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr83, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContractCd, d.chainParser) + + "01" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr83, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr7b, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContractCd, d.chainParser) + varuintToHex(uint(bchain.NonFungibleToken)) + bigintFromStringToHex("1") + + dbtestdata.EthTxidB2T4 + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr92, d.chainParser) + + "01" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrA3, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr3e, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser) + varuintToHex(uint(bchain.MultiToken)) + "01" + bigintFromStringToHex("150") + bigintFromStringToHex("1") + + dbtestdata.EthTxidB2T5 + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr5d, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser) + + "01" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrZero, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr5d, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddrContract6f, d.chainParser) + varuintToHex(uint(bchain.MultiToken)) + "02" + bigintFromStringToHex("1776") + bigintFromStringToHex("1") + bigintFromStringToHex("1898") + bigintFromStringToHex("10") + + dbtestdata.EthTxidB2T6 + + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + + "01" + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + dbtestdata.AddressToPubKeyHex(dbtestdata.EthAddr55, d.chainParser) + varuintToHex(uint(bchain.FungibleToken)) + bigintFromStringToHex("10000000000000000000000"), nil, }, }); err != nil { @@ -150,6 +300,87 @@ func verifyAfterEthereumTypeBlock2(t *testing.T, d *RocksDB) { t.Fatal(err) } } + + var addressAliases []keyPair + addressAliases = []keyPair{ + { + hex.EncodeToString([]byte(dbtestdata.EthAddr7bEIP55)), + hex.EncodeToString([]byte("address7b")), + nil, + }, + { + hex.EncodeToString([]byte(dbtestdata.EthAddr20EIP55)), + hex.EncodeToString([]byte("address20")), + nil, + }, + } + if err := checkColumn(d, cfAddressAliases, addressAliases); err != nil { + { + t.Fatal(err) + } + } + + var internalDataError []keyPair + if wantBlockInternalDataError { + internalDataError = []keyPair{ + { + "0041eee9", + "2b57e15e93a0ed197417a34c2498b7187df79099572c04a6b6e6ff418f74e6ee" + "00" + hex.EncodeToString([]byte("test error")), + nil, + }, + } + } + if err := checkColumn(d, cfBlockInternalDataErrors, internalDataError); err != nil { + { + t.Fatal(err) + } + } + +} + +func formatInternalData(in *bchain.EthereumInternalData) *bchain.EthereumInternalData { + out := *in + if out.Type == bchain.CREATE { + out.Contract = eth.EIP55AddressFromAddress(out.Contract) + } + for i := range out.Transfers { + t := &out.Transfers[i] + t.From = eth.EIP55AddressFromAddress(t.From) + t.To = eth.EIP55AddressFromAddress(t.To) + } + out.Error = eth.UnpackInternalTransactionError([]byte(in.Error)) + return &out +} + +func testFourByteSignature(t *testing.T, d *RocksDB) { + fourBytes := uint32(1234123) + id := uint32(42313) + signature := bchain.FourByteSignature{ + Name: "xyz", + Parameters: []string{"address", "(bytes,uint256[],uint256)", "uint16"}, + } + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + if err := d.StoreFourByteSignature(wb, fourBytes, id, &signature); err != nil { + t.Fatal(err) + } + if err := d.WriteBatch(wb); err != nil { + t.Fatal(err) + } + got, err := d.GetFourByteSignature(fourBytes, id) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(*got, signature) { + t.Errorf("testFourByteSignature: got %+v, want %+v", got, signature) + } + gotSlice, err := d.GetFourByteSignatures(fourBytes) + if err != nil { + t.Fatal(err) + } + if !reflect.DeepEqual(*gotSlice, []bchain.FourByteSignature{signature}) { + t.Errorf("testFourByteSignature: got %+v, want %+v", *gotSlice, []bchain.FourByteSignature{signature}) + } } // TestRocksDB_Index_EthereumType is an integration test probing the whole indexing functionality for EthereumType chains @@ -178,31 +409,53 @@ func TestRocksDB_Index_EthereumType(t *testing.T) { } verifyAfterEthereumTypeBlock1(t, d, false) - if len(d.is.BlockTimes) != 1 { - t.Fatal("Expecting is.BlockTimes 1, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 4321001 { + t.Fatal("Expecting is.BlockTimes 4321001, got ", len(d.is.BlockTimes)) } - // connect 2nd block + // connect 2nd block, simulate InternalDataError and AddressAlias block2 := dbtestdata.GetTestEthereumTypeBlock2(d.chainParser) if err := d.ConnectBlock(block2); err != nil { t.Fatal(err) } - verifyAfterEthereumTypeBlock2(t, d) + verifyAfterEthereumTypeBlock2(t, d, true) + block2.CoinSpecificData = nil - if len(d.is.BlockTimes) != 2 { - t.Fatal("Expecting is.BlockTimes 2, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 4321002 { + t.Fatal("Expecting is.BlockTimes 4321002, got ", len(d.is.BlockTimes)) } // get transactions for various addresses / low-high ranges verifyGetTransactions(t, d, "0x"+dbtestdata.EthAddr55, 0, 10000000, []txidIndex{ - {"0x" + dbtestdata.EthTxidB2T2, ^2}, - {"0x" + dbtestdata.EthTxidB2T2, 1}, + {"0x" + dbtestdata.EthTxidB2T6, 0}, + {"0x" + dbtestdata.EthTxidB2T6, ^0}, + {"0x" + dbtestdata.EthTxidB2T6, 4}, + {"0x" + dbtestdata.EthTxidB2T6, ^4}, + {"0x" + dbtestdata.EthTxidB2T2, ^3}, + {"0x" + dbtestdata.EthTxidB2T2, 2}, {"0x" + dbtestdata.EthTxidB2T1, ^0}, - {"0x" + dbtestdata.EthTxidB1T2, 1}, + {"0x" + dbtestdata.EthTxidB1T2, 2}, {"0x" + dbtestdata.EthTxidB1T1, 0}, }, nil) verifyGetTransactions(t, d, "mtGXQvBowMkBpnhLckhxhbwYK44Gs9eBad", 500000, 1000000, []txidIndex{}, errors.New("Address missing")) + id, err := d.GetEthereumInternalData(dbtestdata.EthTxidB1T1) + if err != nil || id != nil { + t.Errorf("GetEthereumInternalData(%s) = %+v, want %+v, err %v", dbtestdata.EthTxidB1T1, id, nil, err) + } + id, err = d.GetEthereumInternalData(dbtestdata.EthTxidB1T2) + if err != nil || !reflect.DeepEqual(id, formatInternalData(dbtestdata.EthTx2InternalData)) { + t.Errorf("GetEthereumInternalData(%s) = %+v, want %+v, err %v", dbtestdata.EthTxidB1T2, id, formatInternalData(dbtestdata.EthTx2InternalData), err) + } + id, err = d.GetEthereumInternalData(dbtestdata.EthTxidB2T1) + if err != nil || !reflect.DeepEqual(id, formatInternalData(dbtestdata.EthTx3InternalData)) { + t.Errorf("GetEthereumInternalData(%s) = %+v, want %+v, err %v", dbtestdata.EthTxidB2T1, id, formatInternalData(dbtestdata.EthTx3InternalData), err) + } + id, err = d.GetEthereumInternalData(dbtestdata.EthTxidB2T2) + if err != nil || !reflect.DeepEqual(id, formatInternalData(dbtestdata.EthTx4InternalData)) { + t.Errorf("GetEthereumInternalData(%s) = %+v, want %+v, err %v", dbtestdata.EthTxidB2T2, id, formatInternalData(dbtestdata.EthTx4InternalData), err) + } + // GetBestBlock height, hash, err := d.GetBestBlock() if err != nil { @@ -240,7 +493,7 @@ func TestRocksDB_Index_EthereumType(t *testing.T) { } iw := &BlockInfo{ Hash: "0x2b57e15e93a0ed197417a34c2498b7187df79099572c04a6b6e6ff418f74e6ee", - Txs: 2, + Txs: 6, Size: 2345678, Time: 1534859988, Height: 4321001, @@ -249,9 +502,20 @@ func TestRocksDB_Index_EthereumType(t *testing.T) { t.Errorf("GetBlockInfo() = %+v, want %+v", info, iw) } + // Test to store and get FourByteSignature + testFourByteSignature(t, d) + // Test tx caching functionality, leave one tx in db to test cleanup in DisconnectBlock testTxCache(t, d, block1, &block1.Txs[0]) + // InternalData are not packed and stored in DB, remove them so that the test does not fail + esd, _ := block2.Txs[0].CoinSpecificData.(bchain.EthereumSpecificData) + eid := esd.InternalData + esd.InternalData = nil + block2.Txs[0].CoinSpecificData = esd testTxCache(t, d, block2, &block2.Txs[0]) + // restore InternalData + esd.InternalData = eid + block2.Txs[0].CoinSpecificData = esd if err = d.PutTx(&block2.Txs[1], block2.Height, block2.Txs[1].Blocktime); err != nil { t.Fatal(err) } @@ -272,7 +536,7 @@ func TestRocksDB_Index_EthereumType(t *testing.T) { if err == nil || err.Error() != "Cannot disconnect blocks with height 4321000 and lower. It is necessary to rebuild index." { t.Fatal(err) } - verifyAfterEthereumTypeBlock2(t, d) + verifyAfterEthereumTypeBlock2(t, d, true) // disconnect the 2nd block, verify that the db contains only data from the 1st block with restored unspentTxs // and that the cached tx is removed @@ -287,18 +551,879 @@ func TestRocksDB_Index_EthereumType(t *testing.T) { } } - if len(d.is.BlockTimes) != 1 { - t.Fatal("Expecting is.BlockTimes 1, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 4321001 { + t.Fatal("Expecting is.BlockTimes 4321001, got ", len(d.is.BlockTimes)) } // connect block again and verify the state of db if err := d.ConnectBlock(block2); err != nil { t.Fatal(err) } - verifyAfterEthereumTypeBlock2(t, d) + verifyAfterEthereumTypeBlock2(t, d, false) + + if len(d.is.BlockTimes) != 4321002 { + t.Fatal("Expecting is.BlockTimes 4321002, got ", len(d.is.BlockTimes)) + } + +} + +func Test_BulkConnect_EthereumType(t *testing.T) { + d := setupRocksDB(t, &testEthereumParser{ + EthereumParser: ethereumTestnetParser(), + }) + defer closeAndDestroyRocksDB(t, d) + + bc, err := d.InitBulkConnect() + if err != nil { + t.Fatal(err) + } + + if d.is.DbState != common.DbStateInconsistent { + t.Fatal("DB not in DbStateInconsistent") + } + + if len(d.is.BlockTimes) != 0 { + t.Fatal("Expecting is.BlockTimes 0, got ", len(d.is.BlockTimes)) + } + + if err := bc.ConnectBlock(dbtestdata.GetTestEthereumTypeBlock1(d.chainParser), false); err != nil { + t.Fatal(err) + } + if err := checkColumn(d, cfBlockTxs, []keyPair{}); err != nil { + { + t.Fatal(err) + } + } - if len(d.is.BlockTimes) != 2 { - t.Fatal("Expecting is.BlockTimes 2, got ", len(d.is.BlockTimes)) + // connect 2nd block, simulate InternalDataError + block2 := dbtestdata.GetTestEthereumTypeBlock2(d.chainParser) + if err := bc.ConnectBlock(block2, true); err != nil { + t.Fatal(err) } + block2.CoinSpecificData = nil + if err := bc.Close(); err != nil { + t.Fatal(err) + } + + if d.is.DbState != common.DbStateOpen { + t.Fatal("DB not in DbStateOpen") + } + + verifyAfterEthereumTypeBlock2(t, d, true) + + if len(d.is.BlockTimes) != 4321002 { + t.Fatal("Expecting is.BlockTimes 4321002, got ", len(d.is.BlockTimes)) + } +} + +func Test_packUnpackEthInternalData(t *testing.T) { + parser := ethereumTestnetParser() + db := &RocksDB{chainParser: parser} + tests := []struct { + name string + data ethInternalData + want *bchain.EthereumInternalData + }{ + { + name: "CALL 1", + data: ethInternalData{ + internalType: bchain.CALL, + transfers: []ethInternalTransfer{ + { + internalType: bchain.CALL, + from: addressToAddrDesc(dbtestdata.EthAddr3e, parser), + to: addressToAddrDesc(dbtestdata.EthAddr20, parser), + value: *big.NewInt(412342134), + }, + }, + }, + want: &bchain.EthereumInternalData{ + Type: bchain.CALL, + Transfers: []bchain.EthereumInternalTransfer{ + { + Type: bchain.CALL, + From: eth.EIP55AddressFromAddress(dbtestdata.EthAddr3e), + To: eth.EIP55AddressFromAddress(dbtestdata.EthAddr20), + Value: *big.NewInt(412342134), + }, + }, + }, + }, + { + name: "CALL 2", + data: ethInternalData{ + internalType: bchain.CALL, + errorMsg: "error error error", + transfers: []ethInternalTransfer{ + { + internalType: bchain.CALL, + from: addressToAddrDesc(dbtestdata.EthAddr3e, parser), + to: addressToAddrDesc(dbtestdata.EthAddr20, parser), + value: *big.NewInt(4123421341), + }, + { + internalType: bchain.CREATE, + from: addressToAddrDesc(dbtestdata.EthAddr4b, parser), + to: addressToAddrDesc(dbtestdata.EthAddr55, parser), + value: *big.NewInt(123), + }, + { + internalType: bchain.SELFDESTRUCT, + from: addressToAddrDesc(dbtestdata.EthAddr7b, parser), + to: addressToAddrDesc(dbtestdata.EthAddr83, parser), + value: *big.NewInt(67890), + }, + }, + }, + want: &bchain.EthereumInternalData{ + Type: bchain.CALL, + Error: "error error error", + Transfers: []bchain.EthereumInternalTransfer{ + { + Type: bchain.CALL, + From: eth.EIP55AddressFromAddress(dbtestdata.EthAddr3e), + To: eth.EIP55AddressFromAddress(dbtestdata.EthAddr20), + Value: *big.NewInt(4123421341), + }, + { + Type: bchain.CREATE, + From: eth.EIP55AddressFromAddress(dbtestdata.EthAddr4b), + To: eth.EIP55AddressFromAddress(dbtestdata.EthAddr55), + Value: *big.NewInt(123), + }, + { + Type: bchain.SELFDESTRUCT, + From: eth.EIP55AddressFromAddress(dbtestdata.EthAddr7b), + To: eth.EIP55AddressFromAddress(dbtestdata.EthAddr83), + Value: *big.NewInt(67890), + }, + }, + }, + }, + { + name: "CREATE", + data: ethInternalData{ + internalType: bchain.CREATE, + contract: addressToAddrDesc(dbtestdata.EthAddrContract0d, parser), + }, + want: &bchain.EthereumInternalData{ + Type: bchain.CREATE, + Contract: eth.EIP55AddressFromAddress(dbtestdata.EthAddrContract0d), + Transfers: []bchain.EthereumInternalTransfer{}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + packed := packEthInternalData(&tt.data) + got, err := db.unpackEthInternalData(packed) + if err != nil { + t.Errorf("unpackEthInternalData() error = %v", err) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("packEthInternalData/unpackEthInternalData = %+v, want %+v", got, tt.want) + } + }) + } +} + +func generateAddrContracts(f, nf, nfc, m, mc int) []AddrContract { + parser := ethereumTestnetParser() + rv := make([]AddrContract, f+nf+m) + i := 0 + for ; i < f; i++ { + rv[i] = AddrContract{ + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract0d, parser), + Txs: uint(i + 100000), + Value: *big.NewInt(793201132 + int64(i*1000)), + } + } + for ; i < f+nf; i++ { + ids := make(Ids, nfc) + for j := 0; j < nfc; j++ { + ids[j] = *big.NewInt(int64(i*100000) + int64(j*100)) + } + rv[i] = AddrContract{ + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Txs: uint(i + 100000), + Ids: ids, + } + } + for ; i < f+nf+m; i++ { + mtv := make(MultiTokenValues, mc) + for j := 0; j < nfc; j++ { + mtv[j] = bchain.MultiTokenValue{ + Id: *big.NewInt(int64(j)), + Value: *big.NewInt(4231521 + int64(i*1000000) + int64(j*1000)), + } + } + rv[i] = AddrContract{ + Standard: bchain.MultiToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract4a, parser), + Txs: uint(i + 100000), + MultiTokenValues: mtv, + } + } + return rv +} + +var fungibleContracts = AddrContracts{ + TotalTxs: 3333330, + NonContractTxs: 2222220, + InternalTxs: 1111110, + Contracts: generateAddrContracts(100_000, 1, 1, 1, 1), +} +var packedFungibleContracts = packAddrContracts(&fungibleContracts) +var unpackedFungibleContracts, _ = partiallyUnpackAddrContracts(packedFungibleContracts) + +var mixedContracts = AddrContracts{ + TotalTxs: 3333330, + NonContractTxs: 2222220, + InternalTxs: 1111110, + Contracts: generateAddrContracts(100_000, 1, 1_000_000, 1, 1_000_000), +} +var packedMixedContracts = packAddrContracts(&mixedContracts) +var unpackedMixedContracts, _ = partiallyUnpackAddrContracts(packedMixedContracts) + +func Benchmark_packUnpackAddrContractsV6_Fungible(b *testing.B) { + for i := 0; i < b.N; i++ { + packed := packAddrContractsV6(&fungibleContracts) + unpackAddrContractsV6(packed, nil) + } +} + +func Benchmark_packUnpackAddrContracts_Fungible(b *testing.B) { + for i := 0; i < b.N; i++ { + packed := packAddrContracts(&fungibleContracts) + unpackAddrContracts(packed, nil) + } +} + +func Benchmark_packUnpackUnpackedkAddrContracts_Fungible(b *testing.B) { + for i := 0; i < b.N; i++ { + packed := packUnpackedAddrContracts(unpackedFungibleContracts) + partiallyUnpackAddrContracts(packed) + } +} + +func Benchmark_packUnpackAddrContractsV6_Mixed(b *testing.B) { + for i := 0; i < b.N; i++ { + packed := packAddrContractsV6(&mixedContracts) + unpackAddrContractsV6(packed, nil) + } +} + +func Benchmark_packUnpackAddrContracts_Mixed(b *testing.B) { + for i := 0; i < b.N; i++ { + packed := packAddrContracts(&mixedContracts) + unpackAddrContracts(packed, nil) + } +} + +func Benchmark_packUnpackUnpackedkAddrContracts_Mixed(b *testing.B) { + for i := 0; i < b.N; i++ { + packed := packUnpackedAddrContracts(unpackedMixedContracts) + partiallyUnpackAddrContracts(packed) + } +} + +func Test_packUnpackAddrContracts(t *testing.T) { + parser := ethereumTestnetParser() + type args struct { + buf []byte + addrDesc bchain.AddressDescriptor + } + tests := []struct { + name string + data AddrContracts + }{ + { + name: "1", + data: AddrContracts{ + TotalTxs: 30, + NonContractTxs: 20, + InternalTxs: 10, + Contracts: []AddrContract{}, + }, + }, + { + name: "2", + data: AddrContracts{ + TotalTxs: 12345, + NonContractTxs: 444, + InternalTxs: 8873, + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract0d, parser), + Txs: 8, + Value: *big.NewInt(793201132), + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Txs: 41235, + Ids: Ids{ + *big.NewInt(1), + *big.NewInt(2), + *big.NewInt(3), + *big.NewInt(3144223412344123), + *big.NewInt(5), + }, + }, + { + Standard: bchain.MultiToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract4a, parser), + Txs: 64, + MultiTokenValues: MultiTokenValues{ + { + Id: *big.NewInt(1), + Value: *big.NewInt(1412341234), + }, + { + Id: *big.NewInt(123412341234), + Value: *big.NewInt(3), + }, + }, + }, + }, + }, + }, + { + name: "generated", + data: AddrContracts{ + TotalTxs: 3333330, + NonContractTxs: 2222220, + InternalTxs: 1111110, + Contracts: generateAddrContracts(10, 1, 1_000, 1, 1_000), + }, + }, + { + name: "huge", + data: AddrContracts{ + TotalTxs: 3333330, + NonContractTxs: 2222220, + InternalTxs: 1111110, + Contracts: generateAddrContracts(10000, 1, 1_000_000, 1, 1_000_000), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + packed := packAddrContracts(&tt.data) + got, err := unpackAddrContracts(packed, nil) + if err != nil { + t.Errorf("unpackAddrContracts() error = %v", err) + return + } + if !reflect.DeepEqual(got, &tt.data) { + t.Errorf("unpackAddrContracts() = %v, want %v", got, tt.data) + } + }) + } +} + +func Test_addToContracts(t *testing.T) { + // the test builds addToContracts that keeps contracts of an address + // the test adds and removes values from addToContracts, therefore the order of tests is important + addrContracts := &AddrContracts{} + parser := ethereumTestnetParser() + type args struct { + index int32 + contract bchain.AddressDescriptor + transfer *bchain.TokenTransfer + addTxCount bool + } + tests := []struct { + name string + args args + wantIndex int32 + wantAddrContracts *AddrContracts + }{ + { + name: "ERC20 to", + args: args{ + index: 1, + contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.FungibleToken, + Value: *big.NewInt(123456), + }, + addTxCount: true, + }, + wantIndex: 0 + ContractIndexOffset, // the first contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Txs: 1, + Value: *big.NewInt(123456), + }, + }, + }, + }, + { + name: "ERC20 from", + args: args{ + index: ^1, + contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.FungibleToken, + Value: *big.NewInt(23456), + }, + addTxCount: true, + }, + wantIndex: ^(0 + ContractIndexOffset), // the first contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + }, + }, + }, + { + name: "ERC721 to id 1", + args: args{ + index: 1, + contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.NonFungibleToken, + Value: *big.NewInt(1), + }, + addTxCount: true, + }, + wantIndex: 1 + ContractIndexOffset, // the 2nd contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + Txs: 1, + Ids: Ids{*big.NewInt(1)}, + }, + }, + }, + }, + { + name: "ERC721 to id 2", + args: args{ + index: 1, + contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.NonFungibleToken, + Value: *big.NewInt(2), + }, + addTxCount: true, + }, + wantIndex: 1 + ContractIndexOffset, // the 2nd contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + Txs: 2, + Ids: Ids{*big.NewInt(1), *big.NewInt(2)}, + }, + }, + }, + }, + { + name: "ERC721 from id 1, addTxCount=false", + args: args{ + index: ^1, + contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.NonFungibleToken, + Value: *big.NewInt(1), + }, + addTxCount: false, + }, + wantIndex: ^(1 + ContractIndexOffset), // the 2nd contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + Txs: 2, + Ids: Ids{*big.NewInt(2)}, + }, + }, + }, + }, + { + name: "ERC1155 to id 11, value 56789", + args: args{ + index: 1, + contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.MultiToken, + MultiTokenValues: []bchain.MultiTokenValue{ + { + Id: *big.NewInt(11), + Value: *big.NewInt(56789), + }, + }, + }, + addTxCount: true, + }, + wantIndex: 2 + ContractIndexOffset, // the 3nd contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + Txs: 2, + Ids: Ids{*big.NewInt(2)}, + }, + { + Standard: bchain.MultiToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + Txs: 1, + MultiTokenValues: MultiTokenValues{ + { + Id: *big.NewInt(11), + Value: *big.NewInt(56789), + }, + }, + }, + }, + }, + }, + { + name: "ERC1155 to id 11, value 111 and id 22, value 222", + args: args{ + index: 1, + contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.MultiToken, + MultiTokenValues: []bchain.MultiTokenValue{ + { + Id: *big.NewInt(11), + Value: *big.NewInt(111), + }, + { + Id: *big.NewInt(22), + Value: *big.NewInt(222), + }, + }, + }, + addTxCount: true, + }, + wantIndex: 2 + ContractIndexOffset, // the 3nd contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + Txs: 2, + Ids: Ids{*big.NewInt(2)}, + }, + { + Standard: bchain.MultiToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + Txs: 2, + MultiTokenValues: MultiTokenValues{ + { + Id: *big.NewInt(11), + Value: *big.NewInt(56900), + }, + { + Id: *big.NewInt(22), + Value: *big.NewInt(222), + }, + }, + }, + }, + }, + }, + { + name: "ERC1155 from id 11, value 112 and id 22, value 222", + args: args{ + index: ^1, + contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + transfer: &bchain.TokenTransfer{ + Standard: bchain.MultiToken, + MultiTokenValues: []bchain.MultiTokenValue{ + { + Id: *big.NewInt(11), + Value: *big.NewInt(112), + }, + { + Id: *big.NewInt(22), + Value: *big.NewInt(222), + }, + }, + }, + addTxCount: true, + }, + wantIndex: ^(2 + ContractIndexOffset), // the 3nd contract of the address + wantAddrContracts: &AddrContracts{ + Contracts: []AddrContract{ + { + Standard: bchain.FungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract47, parser), + Value: *big.NewInt(100000), + Txs: 2, + }, + { + Standard: bchain.NonFungibleToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + Txs: 2, + Ids: Ids{*big.NewInt(2)}, + }, + { + Standard: bchain.MultiToken, + Contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + Txs: 3, + MultiTokenValues: MultiTokenValues{ + { + Id: *big.NewInt(11), + Value: *big.NewInt(56788), + }, + }, + }, + }, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + // convert addrContracts to partially unpacked form which is used for block import + buf := packAddrContracts(addrContracts) + unpackedAddrContracts, _ := partiallyUnpackAddrContracts(buf) + // check logic + contractIndex, found := findContractInAddressContracts(tt.args.contract, unpackedAddrContracts.Contracts) + if !found { + contractIndex = len(unpackedAddrContracts.Contracts) + unpackedAddrContracts.Contracts = append(unpackedAddrContracts.Contracts, unpackedAddrContract{ + Contract: tt.args.contract, + Standard: tt.args.transfer.Standard, + }) + } + if got := addToContract(&unpackedAddrContracts.Contracts[contractIndex], contractIndex, tt.args.index, tt.args.contract, tt.args.transfer, tt.args.addTxCount); got != tt.wantIndex { + t.Errorf("addToContracts() = %v, want %v", got, tt.wantIndex) + } + // convert from partially unpacked form to final form used by API + buf = packUnpackedAddrContracts(unpackedAddrContracts) + addrContracts, _ = unpackAddrContracts(buf, nil) + if !reflect.DeepEqual(addrContracts, tt.wantAddrContracts) { + t.Errorf("addToContracts() = %+v, want %+v", addrContracts, tt.wantAddrContracts) + } + }) + } +} + +func Test_packUnpackBlockTx(t *testing.T) { + parser := ethereumTestnetParser() + tests := []struct { + name string + blockTx ethBlockTx + pos int + }{ + { + name: "no contract", + blockTx: ethBlockTx{ + btxID: hexToBytes(dbtestdata.EthTxidB1T1), + from: addressToAddrDesc(dbtestdata.EthAddr3e, parser), + to: addressToAddrDesc(dbtestdata.EthAddr55, parser), + contracts: []ethBlockTxContract{}, + }, + pos: 73, + }, + { + name: "ERC20", + blockTx: ethBlockTx{ + btxID: hexToBytes(dbtestdata.EthTxidB1T1), + from: addressToAddrDesc(dbtestdata.EthAddr3e, parser), + to: addressToAddrDesc(dbtestdata.EthAddr55, parser), + contracts: []ethBlockTxContract{ + { + from: addressToAddrDesc(dbtestdata.EthAddr20, parser), + to: addressToAddrDesc(dbtestdata.EthAddr5d, parser), + contract: addressToAddrDesc(dbtestdata.EthAddrContract4a, parser), + transferStandard: bchain.FungibleToken, + value: *big.NewInt(10000), + }, + }, + }, + pos: 137, + }, + { + name: "multiple contracts", + blockTx: ethBlockTx{ + btxID: hexToBytes(dbtestdata.EthTxidB1T1), + from: addressToAddrDesc(dbtestdata.EthAddr3e, parser), + to: addressToAddrDesc(dbtestdata.EthAddr55, parser), + contracts: []ethBlockTxContract{ + { + from: addressToAddrDesc(dbtestdata.EthAddr20, parser), + to: addressToAddrDesc(dbtestdata.EthAddr3e, parser), + contract: addressToAddrDesc(dbtestdata.EthAddrContract4a, parser), + transferStandard: bchain.FungibleToken, + value: *big.NewInt(987654321), + }, + { + from: addressToAddrDesc(dbtestdata.EthAddr4b, parser), + to: addressToAddrDesc(dbtestdata.EthAddr55, parser), + contract: addressToAddrDesc(dbtestdata.EthAddrContract6f, parser), + transferStandard: bchain.NonFungibleToken, + value: *big.NewInt(13), + }, + { + from: addressToAddrDesc(dbtestdata.EthAddr5d, parser), + to: addressToAddrDesc(dbtestdata.EthAddr7b, parser), + contract: addressToAddrDesc(dbtestdata.EthAddrContractCd, parser), + transferStandard: bchain.MultiToken, + idValues: []bchain.MultiTokenValue{ + { + Id: *big.NewInt(1234), + Value: *big.NewInt(98765), + }, + { + Id: *big.NewInt(5566), + Value: *big.NewInt(12341234421), + }, + }, + }, + }, + }, + pos: 280, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + buf := make([]byte, 0) + packed := packBlockTx(buf, &tt.blockTx) + got, pos, err := unpackBlockTx(packed, 0) + if err != nil { + t.Errorf("unpackBlockTx() error = %v", err) + return + } + if !reflect.DeepEqual(*got, tt.blockTx) { + t.Errorf("unpackBlockTx() got = %v, want %v", *got, tt.blockTx) + } + if pos != tt.pos { + t.Errorf("unpackBlockTx() pos = %v, want %v", pos, tt.pos) + } + }) + } +} + +func Test_packUnpackFourByteSignature(t *testing.T) { + tests := []struct { + name string + signature bchain.FourByteSignature + }{ + { + name: "no params", + signature: bchain.FourByteSignature{ + Name: "abcdef", + }, + }, + { + name: "one param", + signature: bchain.FourByteSignature{ + Name: "opqr", + Parameters: []string{"uint16"}, + }, + }, + { + name: "multiple params", + signature: bchain.FourByteSignature{ + Name: "xyz", + Parameters: []string{"address", "(bytes,uint256[],uint256)", "uint16"}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + buf := packFourByteSignature(&tt.signature) + if got, err := unpackFourByteSignature(buf); !reflect.DeepEqual(*got, tt.signature) || err != nil { + t.Errorf("packUnpackFourByteSignature() = %v, want %v, error %v", *got, tt.signature, err) + } + }) + } +} + +func Test_packUnpackContractInfo(t *testing.T) { + tests := []struct { + name string + contractInfo bchain.ContractInfo + }{ + { + name: "empty", + contractInfo: bchain.ContractInfo{}, + }, + { + name: "unknown", + contractInfo: bchain.ContractInfo{ + Type: bchain.UnknownTokenStandard, + Standard: bchain.UnknownTokenStandard, + Name: "Test contract", + Symbol: "TCT", + Decimals: 18, + CreatedInBlock: 1234567, + DestructedInBlock: 234567890, + }, + }, + { + name: "ERC20", + contractInfo: bchain.ContractInfo{ + Type: bchain.ERC20TokenStandard, + Standard: bchain.ERC20TokenStandard, + Name: "GreenContract🟢", + Symbol: "🟢", + Decimals: 0, + CreatedInBlock: 1, + DestructedInBlock: 2, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + buf := packContractInfo(&tt.contractInfo) + if got, err := unpackContractInfo(buf); !reflect.DeepEqual(*got, tt.contractInfo) || err != nil { + t.Errorf("packUnpackContractInfo() = %v, want %v, error %v", *got, tt.contractInfo, err) + } + }) + } } diff --git a/db/rocksdb_test.go b/db/rocksdb_test.go index c74e8b2369..aeb4c666af 100644 --- a/db/rocksdb_test.go +++ b/db/rocksdb_test.go @@ -5,17 +5,16 @@ package db import ( "encoding/binary" "encoding/hex" - "io/ioutil" "math/big" "os" "reflect" "sort" "strings" "testing" - "time" vlq "github.com/bsm/go-vlq" "github.com/juju/errors" + "github.com/linxGnu/grocksdb" "github.com/martinboehm/btcutil/chaincfg" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/bchain/coins/btc" @@ -44,15 +43,15 @@ func bitcoinTestnetParser() *btc.BitcoinParser { } func setupRocksDB(t *testing.T, p bchain.BlockChainParser) *RocksDB { - tmp, err := ioutil.TempDir("", "testdb") + tmp, err := os.MkdirTemp("", "testdb") if err != nil { t.Fatal(err) } - d, err := NewRocksDB(tmp, 100000, -1, p, nil) + d, err := NewRocksDB(tmp, 100000, -1, p, nil, false) if err != nil { t.Fatal(err) } - is, err := d.LoadInternalState("coin-unittest") + is, err := d.LoadInternalState(&common.Config{CoinName: "coin-unittest"}) if err != nil { t.Fatal(err) } @@ -152,10 +151,10 @@ func checkColumn(d *RocksDB, col int, kp []keyPair) error { defer it.Close() i := 0 for it.SeekToFirst(); it.Valid(); it.Next() { + key := hex.EncodeToString(it.Key().Data()) if i >= len(kp) { - return errors.Errorf("Expected less rows in column %v", cfNames[col]) + return errors.Errorf("Expected less rows in column %v, superfluous key %v", cfNames[col], key) } - key := hex.EncodeToString(it.Key().Data()) if key != kp[i].Key { return errors.Errorf("Incorrect key %v found in column %v row %v, expecting %v", key, cfNames[col], i, kp[i].Key) } @@ -515,7 +514,7 @@ func testTxCache(t *testing.T, d *RocksDB, b *bchain.Block, tx *bchain.Tx) { // Confirmations are not stored in the DB, set them from input tx gtx.Confirmations = tx.Confirmations if !reflect.DeepEqual(gtx, tx) { - t.Errorf("GetTx: %v, want %v", gtx, tx) + t.Errorf("GetTx: %+v, want %+v", gtx, tx) } if err := d.DeleteTx(tx.Txid); err != nil { t.Fatal(err) @@ -548,8 +547,8 @@ func TestRocksDB_Index_BitcoinType(t *testing.T) { } verifyAfterBitcoinTypeBlock1(t, d, false) - if len(d.is.BlockTimes) != 1 { - t.Fatal("Expecting is.BlockTimes 1, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 225494 { + t.Fatal("Expecting is.BlockTimes 225494, got ", len(d.is.BlockTimes)) } // connect 2nd block - use some outputs from the 1st block as the inputs and 1 input uses tx from the same block @@ -559,8 +558,8 @@ func TestRocksDB_Index_BitcoinType(t *testing.T) { } verifyAfterBitcoinTypeBlock2(t, d) - if len(d.is.BlockTimes) != 2 { - t.Fatal("Expecting is.BlockTimes 1, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 225495 { + t.Fatal("Expecting is.BlockTimes 225495, got ", len(d.is.BlockTimes)) } // get transactions for various addresses / low-high ranges @@ -668,8 +667,8 @@ func TestRocksDB_Index_BitcoinType(t *testing.T) { } } - if len(d.is.BlockTimes) != 1 { - t.Fatal("Expecting is.BlockTimes 1, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 225494 { + t.Fatal("Expecting is.BlockTimes 225494, got ", len(d.is.BlockTimes)) } // connect block again and verify the state of db @@ -678,8 +677,8 @@ func TestRocksDB_Index_BitcoinType(t *testing.T) { } verifyAfterBitcoinTypeBlock2(t, d) - if len(d.is.BlockTimes) != 2 { - t.Fatal("Expecting is.BlockTimes 1, got ", len(d.is.BlockTimes)) + if len(d.is.BlockTimes) != 225495 { + t.Fatal("Expecting is.BlockTimes 225495, got ", len(d.is.BlockTimes)) } // test public methods for address balance and tx addresses @@ -803,6 +802,46 @@ func Test_BulkConnect_BitcoinType(t *testing.T) { } } +func Test_BlockFilter_GetAndStore(t *testing.T) { + d := setupRocksDB(t, &testBitcoinParser{ + BitcoinParser: bitcoinTestnetParser(), + }) + defer closeAndDestroyRocksDB(t, d) + + blockHash := "0000000000000003d0c9722718f8ee86c2cf394f9cd458edb1c854de2a7b1a91" + blockFilter := "042c6340895e413d8a811fa0" + blockFilterBytes, _ := hex.DecodeString(blockFilter) + + // Empty at the beginning + got, err := d.GetBlockFilter(blockHash) + if err != nil { + t.Fatal(err) + } + want := "" + if got != want { + t.Fatalf("GetBlockFilter(%s) = %s, want %s", blockHash, got, want) + } + + // Store the filter + wb := grocksdb.NewWriteBatch() + if err := d.storeBlockFilter(wb, blockHash, blockFilterBytes); err != nil { + t.Fatal(err) + } + if err := d.WriteBatch(wb); err != nil { + t.Fatal(err) + } + + // Get the filter + got, err = d.GetBlockFilter(blockHash) + if err != nil { + t.Fatal(err) + } + want = blockFilter + if got != want { + t.Fatalf("GetBlockFilter(%s) = %s, want %s", blockHash, got, want) + } +} + func Test_packBigint_unpackBigint(t *testing.T) { bigbig1, _ := big.NewInt(0).SetString("123456789123456789012345", 10) bigbig2, _ := big.NewInt(0).SetString("12345678912345678901234512389012345123456789123456789012345123456789123456789012345", 10) @@ -904,9 +943,10 @@ func addressToAddrDesc(addr string, parser bchain.BlockChainParser) []byte { func Test_packTxAddresses_unpackTxAddresses(t *testing.T) { parser := bitcoinTestnetParser() tests := []struct { - name string - hex string - data *TxAddresses + name string + hex string + data *TxAddresses + rocksDB *RocksDB }{ { name: "1", @@ -931,6 +971,7 @@ func Test_packTxAddresses_unpackTxAddresses(t *testing.T) { }, }, }, + rocksDB: &RocksDB{chainParser: parser, extendedIndex: false}, }, { name: "2", @@ -977,6 +1018,7 @@ func Test_packTxAddresses_unpackTxAddresses(t *testing.T) { }, }, }, + rocksDB: &RocksDB{chainParser: parser, extendedIndex: false}, }, { name: "empty address", @@ -1001,6 +1043,7 @@ func Test_packTxAddresses_unpackTxAddresses(t *testing.T) { }, }, }, + rocksDB: &RocksDB{chainParser: parser, extendedIndex: false}, }, { name: "empty", @@ -1009,18 +1052,111 @@ func Test_packTxAddresses_unpackTxAddresses(t *testing.T) { Inputs: []TxInput{}, Outputs: []TxOutput{}, }, + rocksDB: &RocksDB{chainParser: parser, extendedIndex: false}, + }, + { + name: "extendedIndex 1", + hex: "e0398241032ea9149eb21980dc9d413d8eac27314938b9da920ee53e8705021918f2c0c50c7ce2f5670fd52de738288299bd854a85ef1bb304f62f35ced1bd49a8a810002ea91409f70b896169c37981d2b54b371df0d81a136a2c870501dd7e28c0e96672c7fcc8da131427fcea7e841028614813496a56c11e8a6185c16861c495012ea914e371782582a4addb541362c55565d2cdf56f6498870501a1e35ec0ed308c72f9804dfeefdbb483ef8fd1e638180ad81d6b33f4b58d36d19162fa6d8106052fa9141d9ca71efa36d814424ea6ca1437e67287aebe348705012aadcac000b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa38400081ce8685592ea91424fbc77cdc62702ade74dcf989c15e5d3f9240bc870501664894c02fa914afbfb74ee994c7d45f6698738bc4226d065266f7870501a1e35ec0effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75ef17a1f4233276a914d2a37ce20ac9ec4f15dd05a7c6e8e9fbdb99850e88ac043b9943603376a9146b2044146a4438e6e5bfbc65f147afeb64d14fbb88ac05012a05f2007c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25a9956d8396f32a", + data: &TxAddresses{ + Height: 12345, + VSize: 321, + Inputs: []TxInput{ + { + AddrDesc: addressToAddrDesc("2N7iL7AvS4LViugwsdjTB13uN4T7XhV1bCP", parser), + ValueSat: *big.NewInt(9011000000), + Txid: "c50c7ce2f5670fd52de738288299bd854a85ef1bb304f62f35ced1bd49a8a810", + Vout: 0, + }, + { + AddrDesc: addressToAddrDesc("2Mt9v216YiNBAzobeNEzd4FQweHrGyuRHze", parser), + ValueSat: *big.NewInt(8011000000), + Txid: "e96672c7fcc8da131427fcea7e841028614813496a56c11e8a6185c16861c495", + Vout: 1, + }, + { + AddrDesc: addressToAddrDesc("2NDyqJpHvHnqNtL1F9xAeCWMAW8WLJmEMyD", parser), + ValueSat: *big.NewInt(7011000000), + Txid: "ed308c72f9804dfeefdbb483ef8fd1e638180ad81d6b33f4b58d36d19162fa6d", + Vout: 134, + }, + }, + Outputs: []TxOutput{ + { + AddrDesc: addressToAddrDesc("2MuwoFGwABMakU7DCpdGDAKzyj2nTyRagDP", parser), + ValueSat: *big.NewInt(5011000000), + Spent: true, + SpentTxid: dbtestdata.TxidB1T1, + SpentIndex: 0, + SpentHeight: 432112345, + }, + { + AddrDesc: addressToAddrDesc("2Mvcmw7qkGXNWzkfH1EjvxDcNRGL1Kf2tEM", parser), + ValueSat: *big.NewInt(6011000000), + }, + { + AddrDesc: addressToAddrDesc("2N9GVuX3XJGHS5MCdgn97gVezc6EgvzikTB", parser), + ValueSat: *big.NewInt(7011000000), + Spent: true, + SpentTxid: dbtestdata.TxidB1T2, + SpentIndex: 14231, + SpentHeight: 555555, + }, + { + AddrDesc: addressToAddrDesc("mzii3fuRSpExMLJEHdHveW8NmiX8MPgavk", parser), + ValueSat: *big.NewInt(999900000), + }, + { + AddrDesc: addressToAddrDesc("mqHPFTRk23JZm9W1ANuEFtwTYwxjESSgKs", parser), + ValueSat: *big.NewInt(5000000000), + Spent: true, + SpentTxid: dbtestdata.TxidB2T1, + SpentIndex: 674541, + SpentHeight: 6666666, + }, + }, + }, + rocksDB: &RocksDB{chainParser: parser, extendedIndex: true}, + }, + { + name: "extendedIndex empty address", + hex: "baef9a152d01010204d2020002162e010162fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db03e039", + data: &TxAddresses{ + Height: 123456789, + VSize: 45, + Inputs: []TxInput{ + { + AddrDesc: []byte(nil), + ValueSat: *big.NewInt(1234), + }, + }, + Outputs: []TxOutput{ + { + AddrDesc: []byte(nil), + ValueSat: *big.NewInt(5678), + }, + { + AddrDesc: []byte(nil), + ValueSat: *big.NewInt(98), + Spent: true, + SpentTxid: dbtestdata.TxidB2T4, + SpentIndex: 3, + SpentHeight: 12345, + }, + }, + }, + rocksDB: &RocksDB{chainParser: parser, extendedIndex: true}, }, } varBuf := make([]byte, maxPackedBigintBytes) buf := make([]byte, 1024) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - b := packTxAddresses(tt.data, buf, varBuf) + b := tt.rocksDB.packTxAddresses(tt.data, buf, varBuf) hex := hex.EncodeToString(b) if !reflect.DeepEqual(hex, tt.hex) { t.Errorf("packTxAddresses() = %v, want %v", hex, tt.hex) } - got1, err := unpackTxAddresses(b) + got1, err := tt.rocksDB.unpackTxAddresses(b) if err != nil { t.Errorf("unpackTxAddresses() error = %v", err) return @@ -1483,78 +1619,96 @@ func Test_reorderUtxo(t *testing.T) { } } -func TestRocksTickers(t *testing.T) { - d := setupRocksDB(t, &testBitcoinParser{ - BitcoinParser: bitcoinTestnetParser(), - }) - defer closeAndDestroyRocksDB(t, d) - - // Test valid formats - for _, date := range []string{"20190130", "2019013012", "201901301250", "20190130125030"} { - _, err := FiatRatesConvertDate(date) - if err != nil { - t.Errorf("%v", err) - } +func Test_packUnpackString(t *testing.T) { + tests := []struct { + name string + }{ + {name: "ahoj"}, + {name: ""}, + {name: "very long long very long long very long long very long long very long long very long long very long long very long long very long long very long long very long long very long long very long long"}, } - - // Test invalid formats - for _, date := range []string{"01102019", "10201901", "", "abc", "20190130xxx"} { - _, err := FiatRatesConvertDate(date) - if err == nil { - t.Errorf("Wrongly-formatted date \"%v\" marked as valid!", date) - } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + buf := packString(tt.name) + if got, l := unpackString(buf); !reflect.DeepEqual(got, tt.name) || l != len(buf) { + t.Errorf("Test_packUnpackString() = %v, want %v, len %d, want len %d", got, tt.name, l, len(buf)) + } + }) } +} - // Test storing & finding tickers - key, _ := time.Parse(FiatRatesTimeFormat, "20190627000000") - futureKey, _ := time.Parse(FiatRatesTimeFormat, "20190630000000") - - ts1, _ := time.Parse(FiatRatesTimeFormat, "20190628000000") - ticker1 := &CurrencyRatesTicker{ - Timestamp: &ts1, - Rates: map[string]float64{ - "usd": 20000, - }, +func TestRocksDB_packTxIndexes_unpackTxIndexes(t *testing.T) { + type args struct { + txi []txIndexes } - - ts2, _ := time.Parse(FiatRatesTimeFormat, "20190629000000") - ticker2 := &CurrencyRatesTicker{ - Timestamp: &ts2, - Rates: map[string]float64{ - "usd": 30000, + tests := []struct { + name string + data []txIndexes + hex string + }{ + { + name: "1", + data: []txIndexes{ + { + btxID: hexToBytes(dbtestdata.TxidB1T1), + indexes: []int32{1}, + }, + }, + hex: "00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa384006", + }, + { + name: "2", + data: []txIndexes{ + { + btxID: hexToBytes(dbtestdata.TxidB1T1), + indexes: []int32{-2, 1, 3, 1234, -53241}, + }, + { + btxID: hexToBytes(dbtestdata.TxidB1T2), + indexes: []int32{-2, -1, 0, 1, 2, 3}, + }, + }, + hex: "effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac7507030004080e00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa384007040ca6488cff61", + }, + { + name: "3", + data: []txIndexes{ + { + btxID: hexToBytes(dbtestdata.TxidB2T1), + indexes: []int32{-2, 1, 3}, + }, + { + btxID: hexToBytes(dbtestdata.TxidB1T1), + indexes: []int32{-2, -1, 0, 1, 2, 3}, + }, + { + btxID: hexToBytes(dbtestdata.TxidB1T2), + indexes: []int32{-2}, + }, + }, + hex: "effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac750500b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa384007030004080e7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d2507040e", }, } - err := d.FiatRatesStoreTicker(ticker1) - if err != nil { - t.Errorf("Error storing ticker! %v", err) - } - d.FiatRatesStoreTicker(ticker2) - if err != nil { - t.Errorf("Error storing ticker! %v", err) - } - - ticker, err := d.FiatRatesFindTicker(&key) // should find the closest key (ticker1) - if err != nil { - t.Errorf("TestRocksTickers err: %+v", err) - } else if ticker == nil { - t.Errorf("Ticker not found") - } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker1.Timestamp.Format(FiatRatesTimeFormat) { - t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker1.Timestamp, ticker.Timestamp) - } - - ticker, err = d.FiatRatesFindLastTicker() // should find the last key (ticker2) - if err != nil { - t.Errorf("TestRocksTickers err: %+v", err) - } else if ticker == nil { - t.Errorf("Ticker not found") - } else if ticker.Timestamp.Format(FiatRatesTimeFormat) != ticker2.Timestamp.Format(FiatRatesTimeFormat) { - t.Errorf("Incorrect ticker found. Expected: %v, found: %+v", ticker1.Timestamp, ticker.Timestamp) + d := &RocksDB{ + chainParser: &testBitcoinParser{ + BitcoinParser: bitcoinTestnetParser(), + }, } - - ticker, err = d.FiatRatesFindTicker(&futureKey) // should not find anything - if err != nil { - t.Errorf("TestRocksTickers err: %+v", err) - } else if ticker != nil { - t.Errorf("Ticker found, but the timestamp is older than the last ticker entry.") + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + b := d.packTxIndexes(tt.data) + hex := hex.EncodeToString(b) + if !reflect.DeepEqual(hex, tt.hex) { + t.Errorf("packTxIndexes() = %v, want %v", hex, tt.hex) + } + got, err := d.unpackTxIndexes(b) + if err != nil { + t.Errorf("unpackTxIndexes() error = %v", err) + return + } + if !reflect.DeepEqual(got, tt.data) { + t.Errorf("unpackTxIndexes() = %+v, want %+v", got, tt.data) + } + }) } } diff --git a/db/sync.go b/db/sync.go index 895edf28fe..e0ba75fc38 100644 --- a/db/sync.go +++ b/db/sync.go @@ -58,19 +58,20 @@ func (w *SyncWorker) updateBackendInfo() { ci = &bchain.ChainInfo{} } w.is.SetBackendInfo(&common.BackendInfo{ - BackendError: backendError, - BestBlockHash: ci.Bestblockhash, - Blocks: ci.Blocks, - Chain: ci.Chain, - Difficulty: ci.Difficulty, - Headers: ci.Headers, - ProtocolVersion: ci.ProtocolVersion, - SizeOnDisk: ci.SizeOnDisk, - Subversion: ci.Subversion, - Timeoffset: ci.Timeoffset, - Version: ci.Version, - Warnings: ci.Warnings, - Consensus: ci.Consensus, + BackendError: backendError, + BestBlockHash: ci.Bestblockhash, + Blocks: ci.Blocks, + Chain: ci.Chain, + Difficulty: ci.Difficulty, + Headers: ci.Headers, + ProtocolVersion: ci.ProtocolVersion, + SizeOnDisk: ci.SizeOnDisk, + Subversion: ci.Subversion, + Timeoffset: ci.Timeoffset, + Version: ci.Version, + Warnings: ci.Warnings, + ConsensusVersion: ci.ConsensusVersion, + Consensus: ci.Consensus, }) } @@ -152,7 +153,8 @@ func (w *SyncWorker) resyncIndex(onNewBlock bchain.OnNewBlockFunc, initialSync b // if parallel operation is enabled and the number of blocks to be connected is large, // use parallel routine to load majority of blocks // use parallel sync only in case of initial sync because it puts the db to inconsistent state - if w.syncWorkers > 1 && initialSync { + // or in case of ChainEthereumType if the tip is farther + if w.syncWorkers > 1 && (initialSync || w.chain.GetChainParser().GetChainType() == bchain.ChainEthereumType) { remoteBestHeight, err := w.chain.GetBestBlockHeight() if err != nil { return err @@ -161,15 +163,30 @@ func (w *SyncWorker) resyncIndex(onNewBlock bchain.OnNewBlockFunc, initialSync b glog.Error("resync: error - remote best height ", remoteBestHeight, " less than sync start height ", w.startHeight) return errors.New("resync: remote best height error") } - if remoteBestHeight-w.startHeight > uint32(w.syncChunk) { - glog.Infof("resync: parallel sync of blocks %d-%d, using %d workers", w.startHeight, remoteBestHeight, w.syncWorkers) - err = w.ConnectBlocksParallel(w.startHeight, remoteBestHeight) - if err != nil { - return err + if initialSync { + if remoteBestHeight-w.startHeight > uint32(w.syncChunk) { + glog.Infof("resync: bulk sync of blocks %d-%d, using %d workers", w.startHeight, remoteBestHeight, w.syncWorkers) + err = w.BulkConnectBlocks(w.startHeight, remoteBestHeight) + if err != nil { + return err + } + // after parallel load finish the sync using standard way, + // new blocks may have been created in the meantime + return w.resyncIndex(onNewBlock, initialSync) + } + } + if w.chain.GetChainParser().GetChainType() == bchain.ChainEthereumType { + syncWorkers := uint32(4) + if remoteBestHeight-w.startHeight >= syncWorkers { + glog.Infof("resync: parallel sync of blocks %d-%d, using %d workers", w.startHeight, remoteBestHeight, syncWorkers) + err = w.ParallelConnectBlocks(onNewBlock, w.startHeight, remoteBestHeight, syncWorkers) + if err != nil { + return err + } + // after parallel load finish the sync using standard way, + // new blocks may have been created in the meantime + return w.resyncIndex(onNewBlock, initialSync) } - // after parallel load finish the sync using standard way, - // new blocks may have been created in the meantime - return w.resyncIndex(onNewBlock, initialSync) } } err = w.connectBlocks(onNewBlock, initialSync) @@ -183,7 +200,7 @@ func (w *SyncWorker) handleFork(localBestHeight uint32, localBestHash string, on // find forked blocks, disconnect them and then synchronize again var height uint32 hashes := []string{localBestHash} - for height = localBestHeight - 1; height >= 0; height-- { + for height = localBestHeight - 1; ; height-- { local, err := w.db.GetBlockHash(height) if err != nil { return err @@ -270,12 +287,140 @@ func (w *SyncWorker) connectBlocks(onNewBlock bchain.OnNewBlockFunc, initialSync return nil } -// ConnectBlocksParallel uses parallel goroutines to get data from blockchain daemon -func (w *SyncWorker) ConnectBlocksParallel(lower, higher uint32) error { - type hashHeight struct { - hash string - height uint32 +type hashHeight struct { + hash string + height uint32 +} + +// ParallelConnectBlocks uses parallel goroutines to get data from blockchain daemon but keeps Blockbook in +func (w *SyncWorker) ParallelConnectBlocks(onNewBlock bchain.OnNewBlockFunc, lower, higher uint32, syncWorkers uint32) error { + var err error + var wg sync.WaitGroup + bch := make([]chan *bchain.Block, syncWorkers) + for i := 0; i < int(syncWorkers); i++ { + bch[i] = make(chan *bchain.Block) + } + hch := make(chan hashHeight, syncWorkers) + hchClosed := atomic.Value{} + hchClosed.Store(false) + writeBlockDone := make(chan struct{}) + terminating := make(chan struct{}) + writeBlockWorker := func() { + defer close(writeBlockDone) + lastBlock := lower - 1 + WriteBlockLoop: + for { + select { + case b := <-bch[(lastBlock+1)%syncWorkers]: + if b == nil { + // channel is closed and empty - work is done + break WriteBlockLoop + } + if b.Height != lastBlock+1 { + glog.Fatal("writeBlockWorker skipped block, expected block ", lastBlock+1, ", new block ", b.Height) + } + err := w.db.ConnectBlock(b) + if err != nil { + glog.Fatal("writeBlockWorker ", b.Height, " ", b.Hash, " error ", err) + } + + if onNewBlock != nil { + onNewBlock(b.Hash, b.Height) + } + w.metrics.BlockbookBestHeight.Set(float64(b.Height)) + + if b.Height > 0 && b.Height%1000 == 0 { + glog.Info("connected block ", b.Height, " ", b.Hash) + } + + lastBlock = b.Height + case <-terminating: + break WriteBlockLoop + } + } + if err != nil { + glog.Error("sync: ParallelConnectBlocks.Close error ", err) + } + glog.Info("WriteBlock exiting...") + } + for i := 0; i < int(syncWorkers); i++ { + wg.Add(1) + go w.getBlockWorker(i, syncWorkers, &wg, hch, bch, &hchClosed, terminating) + } + go writeBlockWorker() + var hash string +ConnectLoop: + for h := lower; h <= higher; { + select { + case <-w.chanOsSignal: + glog.Info("connectBlocksParallel interrupted at height ", h) + err = ErrOperationInterrupted + // signal all workers to terminate their loops (error loops are interrupted below) + close(terminating) + break ConnectLoop + default: + hash, err = w.chain.GetBlockHash(h) + if err != nil { + glog.Error("GetBlockHash error ", err) + w.metrics.IndexResyncErrors.With(common.Labels{"error": "failure"}).Inc() + time.Sleep(time.Millisecond * 500) + continue + } + hch <- hashHeight{hash, h} + h++ + } + } + close(hch) + // signal stop to workers that are in a error loop + hchClosed.Store(true) + // wait for workers and close bch that will stop writer loop + wg.Wait() + for i := 0; i < int(syncWorkers); i++ { + close(bch[i]) + } + <-writeBlockDone + return err +} + +func (w *SyncWorker) getBlockWorker(i int, syncWorkers uint32, wg *sync.WaitGroup, hch chan hashHeight, bch []chan *bchain.Block, hchClosed *atomic.Value, terminating chan struct{}) { + defer wg.Done() + var err error + var block *bchain.Block +GetBlockLoop: + for hh := range hch { + for { + block, err = w.chain.GetBlock(hh.hash, hh.height) + if err != nil { + // signal came while looping in the error loop + if hchClosed.Load() == true { + glog.Error("getBlockWorker ", i, " connect block error ", err, ". Exiting...") + return + } + if err == bchain.ErrBlockNotFound { + glog.Error("getBlockWorker ", i, " connect block ", hh.height, " ", hh.hash, " error ", err, ". Retrying...") + } else { + glog.Error("getBlockWorker ", i, " connect block error ", err, ". Retrying...") + } + w.metrics.IndexResyncErrors.With(common.Labels{"error": "failure"}).Inc() + time.Sleep(time.Millisecond * 500) + } else { + break + } + } + if w.dryRun { + continue + } + select { + case bch[hh.height%syncWorkers] <- block: + case <-terminating: + break GetBlockLoop + } } + glog.Info("getBlockWorker ", i, " exiting...") +} + +// BulkConnectBlocks uses parallel goroutines to get data from blockchain daemon +func (w *SyncWorker) BulkConnectBlocks(lower, higher uint32) error { var err error var wg sync.WaitGroup bch := make([]chan *bchain.Block, w.syncWorkers) @@ -321,41 +466,9 @@ func (w *SyncWorker) ConnectBlocksParallel(lower, higher uint32) error { } glog.Info("WriteBlock exiting...") } - getBlockWorker := func(i int) { - defer wg.Done() - var err error - var block *bchain.Block - GetBlockLoop: - for hh := range hch { - for { - block, err = w.chain.GetBlock(hh.hash, hh.height) - if err != nil { - // signal came while looping in the error loop - if hchClosed.Load() == true { - glog.Error("getBlockWorker ", i, " connect block error ", err, ". Exiting...") - return - } - glog.Error("getBlockWorker ", i, " connect block error ", err, ". Retrying...") - w.metrics.IndexResyncErrors.With(common.Labels{"error": "failure"}).Inc() - time.Sleep(time.Millisecond * 500) - } else { - break - } - } - if w.dryRun { - continue - } - select { - case bch[hh.height%uint32(w.syncWorkers)] <- block: - case <-terminating: - break GetBlockLoop - } - } - glog.Info("getBlockWorker ", i, " exiting...") - } for i := 0; i < w.syncWorkers; i++ { wg.Add(1) - go getBlockWorker(i) + go w.getBlockWorker(i, uint32(w.syncWorkers), &wg, hch, bch, &hchClosed, terminating) } go writeBlockWorker() var hash string @@ -385,7 +498,9 @@ ConnectLoop: start = time.Now() } if msTime.Before(time.Now()) { - glog.Info(w.db.GetMemoryStats()) + if glog.V(1) { + glog.Info(w.db.GetMemoryStats()) + } w.metrics.IndexDBSize.Set(float64(w.db.DatabaseSizeOnDisk())) msTime = time.Now().Add(10 * time.Minute) } @@ -415,7 +530,6 @@ func (w *SyncWorker) getBlockChain(out chan blockResult, done chan struct{}) { hash := w.startHash height := w.startHeight prevHash := "" - // loop until error ErrBlockNotFound for { select { diff --git a/db/txcache.go b/db/txcache.go index 27012849fd..bcc89bc254 100644 --- a/db/txcache.go +++ b/db/txcache.go @@ -46,7 +46,7 @@ func (c *TxCache) GetTransaction(txid string) (*bchain.Tx, int, error) { } if tx != nil { // number of confirmations is not stored in cache, they change all the time - _, bestheight, _ := c.is.GetSyncState() + _, bestheight, _, _ := c.is.GetSyncState() tx.Confirmations = bestheight - h + 1 c.metrics.TxCacheEfficiency.With(common.Labels{"status": "hit"}).Inc() return tx, int(h), nil diff --git a/docs/api.md b/docs/api.md index 9c372cd3e2..d0fb05fab3 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,31 +1,6 @@ # Blockbook API -**Blockbook** provides REST, websocket and socket.io API to the indexed blockchain. - -There are two versions of provided API. - -## Legacy API V1 - -The legacy API is a compatible subset of API provided by **Bitcore Insight**. It supports only Bitcoin-type coins. The details of the REST/socket.io requests can be found in the Insight's documentation. - -### REST API -``` -GET /api/v1/block-index/ -GET /api/v1/tx/ -GET /api/v1/address/
-GET /api/v1/utxo/
-GET /api/v1/block/ -GET /api/v1/estimatefee/ -GET /api/v1/sendtx/ -POST /api/v1/sendtx (hex tx data in request body) -``` - -### Socket.io API -Socket.io interface is provided at `/socket.io/`. The interface also can be explored using Blockbook Socket.io Test Page found at `/test-socketio.html`. - -The legacy API is provided as is and will not be further developed. - -The legacy API is currently (Blockbook v0.3.5) also accessible without the */v1/* prefix, however in the future versions the version less access will be removed. +**Blockbook** provides REST and websocket API to the indexed blockchain. ## API V2 @@ -33,199 +8,388 @@ API V2 is the current version of API. It can be used with all coin types that Bl Common principles used in API V2: -- all amounts are transferred as strings, in the lowest denomination (satoshis, wei, ...), without decimal point -- empty fields are omitted. Empty field is a string of value *null* or *""*, a number of value *0*, an object of value *null* or an array without elements. The reason for this is that the interface serves many different coins which use only subset of the fields. Sometimes this principle can lead to slightly confusing results, for example when transaction version is 0, the field *version* is omitted. +- all crypto amounts are transferred as strings, in the lowest denomination (satoshis, wei, ...), without decimal point +- empty fields are omitted. Empty field is a string of value _null_ or _""_, a number of value _0_, an object of value _null_ or an array without elements. The reason for this is that the interface serves many different coins which use only subset of the fields. Sometimes this principle can lead to slightly confusing results, for example when transaction version is 0, the field _version_ is omitted. +See all the referred types (`typescript` interfaces) in the [blockbook-api.ts](../blockbook-api.ts) file. ### REST API The following methods are supported: -- [Status](#status) -- [Get block hash](#get-block-hash) -- [Get transaction](#get-transaction) -- [Get transaction specific](#get-transaction-specific) -- [Get address](#get-address) -- [Get xpub](#get-xpub) -- [Get utxo](#get-utxo) -- [Get block](#get-block) -- [Send transaction](#send-transaction) -- [Tickers list](#tickers-list) -- [Tickers](#tickers) -- [Balance history](#balance-history) +- [Status](#status) +- [Get block hash](#get-block-hash) +- [Get transaction](#get-transaction) +- [Get transaction specific](#get-transaction-specific) +- [Get address](#get-address) +- [Get xpub](#get-xpub) +- [Get utxo](#get-utxo) +- [Get block](#get-block) +- [Send transaction](#send-transaction) +- [Tickers list](#tickers-list) +- [Tickers](#tickers) +- [Balance history](#balance-history) #### Status page + Status page returns current status of Blockbook and connected backend. + ``` -GET /api +GET /api/status ``` -Response: +Response (`SystemInfo` type): + + ```javascript { "blockbook": { "coin": "Bitcoin", - "host": "blockbook", - "version": "0.3.6", - "gitCommit": "3d9ad91", - "buildTime": "2019-05-17T14:34:00+00:00", + "network": "BTC", + "host": "backend5", + "version": "0.5.0", + "gitCommit": "a0960c8e", + "buildTime": "2024-08-08T12:32:50+00:00", "syncMode": true, "initialSync": false, "inSync": true, - "bestHeight": 577261, - "lastBlockTime": "2019-05-22T18:03:33.547762973+02:00", + "bestHeight": 860730, + "lastBlockTime": "2024-09-10T08:19:04.471017534Z", "inSyncMempool": true, - "lastMempoolTime": "2019-05-22T18:10:10.27929383+02:00", - "mempoolSize": 17348, + "lastMempoolTime": "2024-09-10T08:42:39.38871351Z", + "mempoolSize": 232021, "decimals": 8, - "dbSize": 191887866502, - "about": "Blockbook - blockchain indexer for Trezor wallet https://trezor.io/. Do not use for any other purpose." + "dbSize": 761283489075, + "hasFiatRates": true, + "currentFiatRatesTime": "2024-09-10T08:42:00.898792419Z", + "historicalFiatRatesTime": "2024-09-10T00:00:00Z", + "about": "Blockbook - blockchain indexer for Trezor Suite https://trezor.io/trezor-suite. Do not use for any other purpose." }, "backend": { "chain": "main", - "blocks": 577261, - "headers": 577261, - "bestBlockHash": "0000000000000000000ca8c902aa58b3118a7f35d093e25a07f17bcacd91cabf", - "difficulty": "6704632680587.417", - "sizeOnDisk": 250504188580, - "version": "180000", - "subversion": "/Satoshi:0.18.0/", - "protocolVersion": "70015", - "timeOffset": 0, - "warnings": "" + "blocks": 860730, + "headers": 860730, + "bestBlockHash": "00000000000000000000effeb0c4460480e6a347deab95332c63007a68646ee5", + "difficulty": "89471664776970.77", + "sizeOnDisk": 681584532221, + "version": "270100", + "subversion": "/Satoshi:27.1.0/", + "protocolVersion": "70016" } } ``` #### Get block hash + ``` GET /api/v2/block-index/ ``` Response: + + ```javascript { - "blockHash": "ed8f3af8c10ca70a136901c6dd3adf037f0aea8a93fbe9e80939214034300f1e" + "blockHash": "0000000000000000000b7b8574bc6fd285825ec2dbcbeca149121fc05b0c828c" } ``` -_Note: Blockbook always follows the main chain of the backend it is attached to. See notes on **Get Block** below_ +_Note: Blockbook always follows the main chain of the backend it is attached to. See notes on **Get Block** below_ #### Get transaction + Get transaction returns "normalized" data about transaction, which has the same general structure for all supported coins. It does not return coin specific fields (for example information about Zcash shielded addresses). + ``` GET /api/v2/tx/ ``` -Response for Bitcoin-type coins: +Response for Bitcoin-type coins, confirmed transaction (`Tx` type): + + ```javascript { - "txid": "9e2bc8fbd40af17a6564831f84aef0cab2046d4bad19e91c09d21bff2c851851", - "version": 1, + "txid": "8c1e3dec662d1f2a5e322ccef5eca263f98eb16723c6f990be0c88c1db113fb1", + "version": 2, + "lockTime": 860729, "vin": [ { - "txid": "f124e6999bf67e710b9e8a8ac4dbb08a64aa9c264120cf98793455e36a531615", - "vout": 2, - "sequence": 4294967295, + "txid": "0eb7b574373de2c88d0dc1444f49947c681d0437d21361f9ebb4dd09c62f2a66", + "vout": 1, + "sequence": 4294967293, "n": 0, "addresses": [ - "DDhUv8JZGmSxKYV95NLnbRTUKni9cDZD3S" + "bc1qmgwnfjlda4ns3g6g3yz74w6scnn9yu2ts82yyc" ], "isAddress": true, - "value": "55795108999999", - "hex": "473...2c7ec77bb982" + "value": "10106300" } ], "vout": [ { - "value": "55585679000000", + "value": "175000", "n": 0, - "hex": "76a914feaca9d9fa7120c7c587c00c639bb18d40faadd388ac", + "hex": "76a914ecc999d554eaa3efa5e871c28f58b549c36ec51788ac", "addresses": [ - "DUMh1rPrXTrCN2Z9EHsLPg7b78rACHB2h7" + "1Nb1ykSD7J5k4RFjJQGsrD9gxBE6jzfNa9" ], "isAddress": true }, { - "value": "209329999999", + "value": "9888100", "n": 1, - "hex": "76a914ea8984be785868391d92f49c14933f47c152ea0a88ac", + "hex": "001496f152a0919487624bf4f13f46f0d20fa10d9acc", "addresses": [ - "DSXDQ6rnwLX47WFRnemctoXPHA9pLMxqXn" + "bc1qjmc49gy3jjrkyjl57yl5duxjp7ssmxkvh5t2q5" ], "isAddress": true } ], - "blockHash": "78d1f3de899a10dd2e580704226ebf9508e95e1706f177fc9c31c47f245d2502", - "blockHeight": 2647927, + "blockHash": "00000000000000000000effeb0c4460480e6a347deab95332c63007a68646ee5", + "blockHeight": 860730, "confirmations": 1, - "blockTime": 1553088212, - "value": "55795008999999", - "valueIn": "55795108999999", - "fees": "100000000", - "hex": "0100000...0011000" + "blockTime": 1725956288, + "size": 225, + "vsize": 144, + "value": "10063100", + "valueIn": "10106300", + "fees": "43200", + "hex": "02000000000101662a2fc609ddb4ebf96113d237041d687c94494f44c10d8dc8e23d3774b5b70e0100000000fdffffff0298ab0200000000001976a914ecc999d554eaa3efa5e871c28f58b549c36ec51788ac64e196000000000016001496f152a0919487624bf4f13f46f0d20fa10d9acc0247304402202bb0591180cdbbe0f639af6eb21abdb993fc5a667b09e6392d5c11b025a9187102201ef2e84fc91a5d2c6fbbc9f943482d230256a3640f8ecb83c1f3f17242cf011001210314f03889e1667feb696ee280625943195189cfabe46d54204d987f631fe6892739220d00" } ``` -Response for Ethereum-type coins. There is always only one *vin*, only one *vout*, possibly an array of *tokenTransfers* and *ethereumSpecific* part. Missing is *hex* field: +Response for Bitcoin-type coins, unconfirmed transaction: + +Special fields: + +- _blockHeight_: -1 +- _confirmations_: 0 +- _confirmationETABlocks_: number +- _confirmationETASeconds_: number + + ```javascript { - "txid": "0xb78a36a4a0e7d708d595c3b193cace8f5b420e72e1f595a5387d87de509f0806", + "txid": "73b1ad97194e426031e5c692869de2d83dc2ff6033fc6f0ab5514345f92eaf0d", + "version": 2, "vin": [ { + "txid": "bccbebb64b1613ada74eefa96753088a80fefa53a10e42c66eef1899371bc096", "n": 0, "addresses": [ - "0x9c2e011c0ce0d75c2b62b9c5a0ba0a7456593803" + "bc1q9lh77es6m8ztr7muwcec00ewn8fxakpl9jwv8y" ], - "isAddress": true + "isAddress": true, + "value": "371042" } ], "vout": [ { - "value": "0", + "value": "293135", "n": 0, + "hex": "0014aafd7386f99f4b508ec05ee8f7edc2e07126620a", "addresses": [ - "0xc32ae45504ee9482db99cfa21066a59e877bc0e6" + "bc1q4t7h8phena94prkqtm500mwzupcjvcs2akcdy9" ], "isAddress": true + }, + { + "value": "74022", + "n": 1, + "hex": "0014a3de0fbba89c17d43093164ea955bad65bc260bf", + "addresses": [ + "bc1q500qlwagnstagvynze82j4d66eduyc9lf64ksh" + ], + "isAddress": true + } + ], + "blockHeight": -1, + "confirmations": 0, + "confirmationETABlocks": 1, + "confirmationETASeconds": 619, + "blockTime": 1725959035, + "size": 222, + "vsize": 141, + "value": "367157", + "valueIn": "371042", + "fees": "3885", + "hex": "0200000000010196c01b379918ef6ec6420ea153fafe808a085367a9ef4ea7ad13164bb6ebcbbc000000000000000000020f79040000000000160014aafd7386f99f4b508ec05ee8f7edc2e07126620a2621010000000000160014a3de0fbba89c17d43093164ea955bad65bc260bf0247304402204a5bdf8a8d19b0a19044b0c0de3ced92b92e8d0c629ffca83178c85a608f719e02203841d40dd92db48715f9f41a732e139ac3cc7696a23adc87136bd8037a594e9f012102824a5e7b878f8d63887bdcb1b0982cdb0b375068b3798c4c96799476a19a389e00000000", + "rbf": true, + "coinSpecificData": { + "txid": "73b1ad97194e426031e5c692869de2d83dc2ff6033fc6f0ab5514345f92eaf0d", + "hash": "91deb6a9d0f5a37e2e83d1e602ba14cd9811fd3605f582154c9bd1337f7f4c8a", + "version": 2, + "size": 222, + "vsize": 141, + "weight": 561, + "locktime": 0, + "vin": [ + { + "txid": "bccbebb64b1613ada74eefa96753088a80fefa53a10e42c66eef1899371bc096", + "vout": 0, + "scriptSig": { + "asm": "", + "hex": "" + }, + "txinwitness": [ + "304402204a5bdf8a8d19b0a19044b0c0de3ced92b92e8d0c629ffca83178c85a608f719e02203841d40dd92db48715f9f41a732e139ac3cc7696a23adc87136bd8037a594e9f01", + "02824a5e7b878f8d63887bdcb1b0982cdb0b375068b3798c4c96799476a19a389e" + ], + "sequence": 0 + } + ], + "vout": [ + { + "value": 0.00293135, + "n": 0, + "scriptPubKey": { + "asm": "0 aafd7386f99f4b508ec05ee8f7edc2e07126620a", + "desc": "addr(bc1q4t7h8phena94prkqtm500mwzupcjvcs2akcdy9)#qmxeweuu", + "hex": "0014aafd7386f99f4b508ec05ee8f7edc2e07126620a", + "address": "bc1q4t7h8phena94prkqtm500mwzupcjvcs2akcdy9", + "type": "witness_v0_keyhash" + } + }, + { + "value": 0.00074022, + "n": 1, + "scriptPubKey": { + "asm": "0 a3de0fbba89c17d43093164ea955bad65bc260bf", + "desc": "addr(bc1q500qlwagnstagvynze82j4d66eduyc9lf64ksh)#mynfp6xy", + "hex": "0014a3de0fbba89c17d43093164ea955bad65bc260bf", + "address": "bc1q500qlwagnstagvynze82j4d66eduyc9lf64ksh", + "type": "witness_v0_keyhash" + } + } + ], + "hex": "0200000000010196c01b379918ef6ec6420ea153fafe808a085367a9ef4ea7ad13164bb6ebcbbc000000000000000000020f79040000000000160014aafd7386f99f4b508ec05ee8f7edc2e07126620a2621010000000000160014a3de0fbba89c17d43093164ea955bad65bc260bf0247304402204a5bdf8a8d19b0a19044b0c0de3ced92b92e8d0c629ffca83178c85a608f719e02203841d40dd92db48715f9f41a732e139ac3cc7696a23adc87136bd8037a594e9f012102824a5e7b878f8d63887bdcb1b0982cdb0b375068b3798c4c96799476a19a389e00000000" + } +} +``` + +Response for Ethereum-type coins. Data of the transaction consist of: + +- always only one _vin_, only one _vout_ +- an array of _tokenTransfers_ (ERC20, ERC721 or ERC1155) +- _ethereumSpecific_ data + - _type_ (returned only for contract creation - value `1` and destruction value `2`) + - _status_ (`1` OK, `0` Failure, `-1` pending), potential _error_ message, _gasLimit_, _gasUsed_, _gasPrice_, _nonce_, input _data_ + - parsed input data in the field _parsedData_, if a match with the 4byte directory was found + - internal transfers (type `0` transfer, type `1` contract creation, type `2` contract destruction) +- _addressAliases_ - maps addresses in the transaction to names from contract or ENS. Only addresses with known names are returned. + + + +```javascript +{ + "txid": "0xa6c8ae1f91918d09cf2bd67bbac4c168849e672fd81316fa1d26bb9b4fc0f790", + "vin": [ + { + "n": 0, + "addresses": ["0xd446089cf19C3D3Eb1743BeF3A852293Fd2C7775"], + "isAddress": true } ], - "blockHash": "0x39df7fb0893200e1e78c04f98691637a89b64e7a3edd96c16f2537e2fd56c414", - "blockHeight": 5241585, + "vout": [ + { + "value": "5615959129349132871", + "n": 0, + "addresses": ["0xC36442b4a4522E871399CD717aBDD847Ab11FE88"], + "isAddress": true + } + ], + "blockHash": "0x10ea8cfecda89d6d864c1d919911f819c9febc2b455b48c9918cee3c6cdc4adb", + "blockHeight": 16529834, "confirmations": 3, - "blockTime": 1553088337, - "value": "0", - "fees": "402501000000000", + "blockTime": 1675204631, + "value": "5615959129349132871", + "fees": "19141662404282012", "tokenTransfers": [ { "type": "ERC20", - "from": "0x9c2e011c0ce0d75c2b62b9c5a0ba0a7456593803", - "to": "0x583cbbb8a8443b38abcc0c956bece47340ea1367", - "token": "0xc32ae45504ee9482db99cfa21066a59e877bc0e6", - "name": "Tangany Test Token", - "symbol": "TATETO", + "from": "0xd446089cf19C3D3Eb1743BeF3A852293Fd2C7775", + "to": "0x3B685307C8611AFb2A9E83EBc8743dc20480716E", + "contract": "0x4E15361FD6b4BB609Fa63C81A2be19d873717870", + "name": "Fantom Token", + "symbol": "FTM", + "decimals": 18, + "value": "15362368338194882707417" + }, + { + "type": "ERC20", + "from": "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + "to": "0x3B685307C8611AFb2A9E83EBc8743dc20480716E", + "contract": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "name": "Wrapped Ether", + "symbol": "WETH", "decimals": 18, - "value": "133800000" + "value": "5615959129349132871" + }, + { + "type": "ERC721", + "from": "0x0000000000000000000000000000000000000000", + "to": "0xd446089cf19C3D3Eb1743BeF3A852293Fd2C7775", + "contract": "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + "name": "Uniswap V3 Positions NFT-V1", + "symbol": "UNI-V3-POS", + "decimals": 18, + "value": "428189" } ], "ethereumSpecific": { "status": 1, - "nonce": 2830, - "gasLimit": 36591, - "gasUsed": 36591, - "gasPrice": "11000000000", - "data": "0xa9059cbb000000000000000000000000ba98d6a5" + "nonce": 505, + "gasLimit": 550941, + "gasUsed": 434686, + "gasPrice": "44035608242", + "maxPriorityFeePerGas": "44035608243", + "maxFeePerGas": "44035608244", + "baseFeePerGas": "2035608244", + "data": "0xac9650d800000000000000000000", + "parsedData": { + "methodId": "0xfa2b068f", + "name": "Mint", + "function": "mint(address, uint256, uint32, bytes32[], address)", + "params": [ + { + "type": "address", + "values": ["0xa5fD1Da088598e88ba731B0E29AECF0BC2A31F82"] + }, + { "type": "uint256", "values": ["688173296"] }, + { "type": "uint32", "values": ["0"] } + ] + }, + "internalTransfers": [ + { + "type": 0, + "from": "0xC36442b4a4522E871399CD717aBDD847Ab11FE88", + "to": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", + "value": "5615959129349132871" + } + ] + }, + "addressAliases": { + "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": { + "Type": "Contract", + "Alias": "Wrapped Ether" + }, + "0xC36442b4a4522E871399CD717aBDD847Ab11FE88": { + "Type": "Contract", + "Alias": "Uniswap V3 Positions NFT-V1" + } } } + ``` A note about the `blockTime` field: -- for already mined transaction (`confirmations > 0`), the field `blockTime` contains time of the block -- for transactions in mempool (`confirmations == 0`), the field contains time when the running instance of Blockbook was first time notified about the transaction. This time may be different in different instances of Blockbook. + +- for already mined transaction (`confirmations > 0`), the field `blockTime` contains time of the block +- for transactions in mempool (`confirmations == 0`), the field contains time when the running instance of Blockbook was first time notified about the transaction. This time may be different in different instances of Blockbook. #### Get transaction specific @@ -237,10 +401,14 @@ GET /api/v2/tx-specific/ Example response: + + ```javascript { "hex": "040000808...8e6e73cb009", "txid": "7a0a0ff6f67bac2a856c7296382b69151949878de6fb0d01a8efa197182b2913", + "authdigest": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "size": 1809, "overwintered": true, "version": 4, "versiongroupid": "892f2085", @@ -250,6 +418,7 @@ Example response: "vout": [], "vjoinsplit": [], "valueBalance": 0, + "valueBalanceZat": 0, "vShieldedSpend": [ { "cv": "50258bfa65caa9f42f4448b9194840c7da73afc8159faf7358140bfd0f237962", @@ -280,7 +449,8 @@ Example response: ], "bindingSig": "bc018af8808387...5130bb382ad8e6e73cb009", "blockhash": "0000000001c4aa394e796dd1b82e358f114535204f6f5b6cf4ad58dc439c47af", - "confirmations": 5222, + "height": 495665, + "confirmations": 2145803, "time": 1552301566, "blocktime": 1552301566 } @@ -291,93 +461,132 @@ Example response: Returns balances and transactions of an address. The returned transactions are sorted by block height, newest blocks first. ``` -GET /api/v2/address/
[?page=&pageSize=&from=&to=&details=&contract=] +GET /api/v2/address/
[?page=&pageSize=&from=&to=&details=&contract=&secondary=usd] ``` The optional query parameters: -- *page*: specifies page of returned transactions, starting from 1. If out of range, Blockbook returns the closest possible page. -- *pageSize*: number of transactions returned by call (default and maximum 1000) -- *from*, *to*: filter of the returned transactions *from* block height *to* block height (default no filter) -- *details*: specifies level of details returned by request (default *txids*) - - *basic*: return only address balances, without any transactions - - *tokens*: *basic* + tokens belonging to the address (applicable only to some coins) - - *tokenBalances*: *basic* + tokens with balances + belonging to the address (applicable only to some coins) - - *txids*: *tokenBalances* + list of txids, subject to *from*, *to* filter and paging - - *txslight*: *tokenBalances* + list of transaction with limited details (only data from index), subject to *from*, *to* filter and paging - - *txs*: *tokenBalances* + list of transaction with details, subject to *from*, *to* filter and paging -- *contract*: return only transactions which affect specified contract (applicable only to coins which support contracts) -Response: +- _page_: specifies page of returned transactions, starting from 1. If out of range, Blockbook returns the closest possible page. +- _pageSize_: number of transactions returned by call (default and maximum 1000) +- _from_, _to_: filter of the returned transactions _from_ block height _to_ block height (default no filter) +- _details_: specifies level of details returned by request (default _txids_) + - _basic_: return only address balances, without any transactions + - _tokens_: _basic_ + tokens belonging to the address (applicable only to some coins) + - _tokenBalances_: _basic_ + tokens with balances + belonging to the address (applicable only to some coins) + - _txids_: _tokenBalances_ + list of txids, subject to _from_, _to_ filter and paging + - _txslight_: _tokenBalances_ + list of transaction with limited details (only data from index), subject to _from_, _to_ filter and paging + - _txs_: _tokenBalances_ + list of transaction with details, subject to _from_, _to_ filter and paging +- _contract_: return only transactions which affect specified contract (applicable only to coins which support contracts) +- _secondary_: specifies secondary (fiat) currency in which the token and total balances are returned in addition to crypto values + +Example response for bitcoin type coin, _details_ set to _txids_ (`Address` type): + + ```javascript { "page": 1, "totalPages": 1, "itemsOnPage": 1000, - "address": "D5Z7XrtJNg7hAtznSDMXvfiFmMYphwuWz7", - "balance": "2432468097999991", - "totalReceived": "3992283916999979", - "totalSent": "1559815818999988", + "address": "bc1q0wd209cv5k9pd9mhk7nspacywcj038xxdhnt5u", + "balance": "4225100", + "totalReceived": "4225100", + "totalSent": "0", "unconfirmedBalance": "0", "unconfirmedTxs": 0, - "txs": 3, + "txs": 2, "txids": [ - "461dd46d5d6f56d765f82e60e6bf0727a3a1d1cb8c4144373d805b152a21d308", - "bdb5b47603c5d174eae3384c368068c8e9d2183b398ed0e31d125defa4447a10", - "5c1d2686d70d82bd8e84b5d3dc4bd0e8485e28cdc865336db6a5e40b2098277d" + "0db6010dc0815a4bdaa505bd1ccc851056b0d53c7e4ea7af39c4d648a2c0c019", + "7532920ddc506218337cceac978cce9c7f98e27ad3226dee55f3e934e0b32e80" ] } ``` +Example response for ethereum type coin, _details_ set to _tokenBalances_ and _secondary_ set to _usd_. The _baseValue_ is value of the token in the base currency (ETH), _secondaryValue_ is value of the token in specified _secondary_ currency: + + + +```javascript +{ + "address": "0x2df3951b2037bA620C20Ed0B73CCF45Ea473e83B", + "balance": "21004631949601199", + "unconfirmedBalance": "0", + "unconfirmedTxs": 0, + "txs": 5, + "nonTokenTxs": 3, + "nonce": "1", + "tokens": [ + { + "type": "ERC20", + "name": "Tether USD", + "contract": "0xdAC17F958D2ee523a2206206994597C13D831ec7", + "transfers": 3, + "symbol": "USDT", + "decimals": 6, + "balance": "4913000000", + "baseValue": 3.104622978658881, + "secondaryValue": 4914.214559070491 + } + ], + "secondaryValue": 33.247601671503574, + "tokensBaseValue": 3.104622978658881, + "tokensSecondaryValue": 4914.214559070491, + "totalBaseValue": 3.125627610608482, + "totalSecondaryValue": 4947.462160741995 +} + +``` + #### Get xpub -Returns balances and transactions of an xpub or output descriptor, applicable only for Bitcoin-type coins. +Returns balances and transactions of an xpub or output descriptor, applicable only for Bitcoin-type coins. Blockbook supports BIP44, BIP49, BIP84 and BIP86 (Taproot) derivation schemes, using either xpubs or output descriptors (see https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md) -* Xpubs +- Xpubs + + Blockbook expects xpub at level 3 derivation path, i.e. _m/purpose'/coin_type'/account'/_. Blockbook completes the _change/address_index_ part of the path when deriving addresses. + The BIP version is determined by the prefix of the xpub. The prefixes for each coin are defined by fields `xpub_magic`, `xpub_magic_segwit_p2sh`, `xpub_magic_segwit_native` in the [trezor-common](https://github.com/trezor/trezor-common/tree/master/defs/bitcoin) library. If the prefix is not recognized, Blockbook defaults to BIP44 derivation scheme. + +- Output descriptors + + Output descriptors are in the form `([][//*])[#checksum]`, for example `pkh([5c9e228d/44'/0'/0']xpub6BgBgses...Mj92pReUsQ/<0;1>/*)#abcd` - Blockbook expects xpub at level 3 derivation path, i.e. *m/purpose'/coin_type'/account'/*. Blockbook completes the *change/address_index* part of the path when deriving addresses. - The BIP version is determined by the prefix of the xpub. The prefixes for each coin are defined by fields `xpub_magic`, `xpub_magic_segwit_p2sh`, `xpub_magic_segwit_native` in the [trezor-common](https://github.com/trezor/trezor-common/tree/master/defs/bitcoin) library. If the prefix is not recognized, Blockbook defaults to BIP44 derivation scheme. + Parameters `type` and `xpub` are mandatory, the rest is optional -* Output descriptors - - Output descriptors are in the form `([][//*])[#checkum]`, for example `pkh([5c9e228d/44'/0'/0']xpub6BgBgses...Mj92pReUsQ/<0;1>/*)#abcd` - - Parameters `type` and `xpub` are mandatory, the rest is optional - - Blockbook supports a limited set of `type`s: - - BIP44: `pkh(xpub)` - - BIP49: `sh(wpkh(xpub))` - - BIP84: `wpkh(xpub)` - - BIP86 (Taproot single key): `tr(xpub)` - - Parameter `change` can be a single number or a list of change indexes, specified either in the format `` or `{index1,index2,...}`. If the parameter `change` is not specified, Blockbook defaults to `<0;1>`. + Blockbook supports a limited set of `type`s: - + - BIP44: `pkh(xpub)` + - BIP49: `sh(wpkh(xpub))` + - BIP84: `wpkh(xpub)` + - BIP86 (Taproot single key): `tr(xpub)` + + Parameter `change` can be a single number or a list of change indexes, specified either in the format `` or `{index1,index2,...}`. If the parameter `change` is not specified, Blockbook defaults to `<0;1>`. The returned transactions are sorted by block height, newest blocks first. ``` -GET /api/v2/xpub/[?page=&pageSize=&from=&to=&details=&tokens=] +GET /api/v2/xpub/[?page=&pageSize=&from=&to=&details=&tokens=&secondary=eur] ``` The optional query parameters: -- *page*: specifies page of returned transactions, starting from 1. If out of range, Blockbook returns the closest possible page. -- *pageSize*: number of transactions returned by call (default and maximum 1000) -- *from*, *to*: filter of the returned transactions *from* block height *to* block height (default no filter) -- *details*: specifies level of details returned by request (default *txids*) - - *basic*: return only xpub balances, without any derived addresses and transactions - - *tokens*: *basic* + tokens (addresses) derived from the xpub, subject to *tokens* parameter - - *tokenBalances*: *basic* + tokens (addresses) derived from the xpub with balances, subject to *tokens* parameter - - *txids*: *tokenBalances* + list of txids, subject to *from*, *to* filter and paging - - *txs*: *tokenBalances* + list of transaction with details, subject to *from*, *to* filter and paging -- *tokens*: specifies what tokens (xpub addresses) are returned by the request (default *nonzero*) - - *nonzero*: return only addresses with nonzero balance - - *used*: return addresses with at least one transaction - - *derived*: return all derived addresses -Response: +- _page_: specifies page of returned transactions, starting from 1. If out of range, Blockbook returns the closest possible page. +- _pageSize_: number of transactions returned by call (default and maximum 1000) +- _from_, _to_: filter of the returned transactions _from_ block height _to_ block height (default no filter) +- _details_: specifies level of details returned by request (default _txids_) + - _basic_: return only xpub balances, without any derived addresses and transactions + - _tokens_: _basic_ + tokens (addresses) derived from the xpub, subject to _tokens_ parameter + - _tokenBalances_: _basic_ + tokens (addresses) derived from the xpub with balances, subject to _tokens_ parameter + - _txids_: _tokenBalances_ + list of txids, subject to _from_, _to_ filter and paging + - _txs_: _tokenBalances_ + list of transaction with details, subject to _from_, _to_ filter and paging +- _tokens_: specifies what tokens (xpub addresses) are returned by the request (default _nonzero_) + - _nonzero_: return only addresses with nonzero balance + - _used_: return addresses with at least one transaction + - _derived_: return all derived addresses +- _secondary_: specifies secondary (fiat) currency in which the balances are returned in addition to crypto values + +Response (`Address` type): ```javascript { @@ -385,8 +594,8 @@ Response: "totalPages": 1, "itemsOnPage": 1000, "address": "dgub8sbe5Mi8LA4dXB9zPfLZW8arm...9Vjp2HHx91xdDEmWYpmD49fpoUYF", - "balance": "0", - "totalReceived": "3083381250", + "balance": "90000000", + "totalReceived": "3093381250", "totalSent": "3083381250", "unconfirmedBalance": "0", "unconfirmedTxs": 0, @@ -406,8 +615,8 @@ Response: "path": "m/44'/3'/0'/0/0", "transfers": 3, "decimals": 8, - "balance": "0", - "totalReceived": "2803986975", + "balance": "90000000", + "totalReceived": "2903986975", "totalSent": "2803986975" }, { @@ -420,58 +629,59 @@ Response: "totalReceived": "279394275", "totalSent": "279394275" } - ] + ], + "secondaryValue": 21195.47633568 } ``` -Note: *usedTokens* always returns total number of **used** addresses of xpub. +Note: _usedTokens_ always returns total number of **used** addresses of xpub. #### Get utxo -Returns array of unspent transaction outputs of address or xpub, applicable only for Bitcoin-type coins. By default, the list contains both confirmed and unconfirmed transactions. The query parameter *confirmed=true* disables return of unconfirmed transactions. The returned utxos are sorted by block height, newest blocks first. For xpubs or output descriptors, the response also contains address and derivation path of the utxo. +Returns array of unspent transaction outputs of address or xpub, applicable only for Bitcoin-type coins. By default, the list contains both confirmed and unconfirmed transactions. The query parameter _confirmed=true_ disables return of unconfirmed transactions. The returned utxos are sorted by block height, newest blocks first. For xpubs or output descriptors, the response also contains address and derivation path of the utxo. -Unconfirmed utxos do not have field *height*, the field *confirmations* has value *0* and may contain field *lockTime*, if not zero. +Unconfirmed utxos do not have field _height_, the field _confirmations_ has value _0_ and may contain field _lockTime_, if not zero. -Coinbase utxos have field *coinbase* set to true, however due to performance reasons only up to minimum coinbase confirmations limit (100). After this limit, utxos are not detected as coinbase. +Coinbase utxos have field _coinbase_ set to true, however due to performance reasons only up to minimum coinbase confirmations limit (100). After this limit, utxos are not detected as coinbase. ``` GET /api/v2/utxo/[?confirmed=true] ``` -Response: +Response (`Utxo[]` type): ```javascript [ - { - "txid": "13d26cd939bf5d155b1c60054e02d9c9b832a85e6ec4f2411be44b6b5a2842e9", - "vout": 0, - "value": "1422303206539", - "confirmations": 0, - "lockTime": 2648100 - }, - { - "txid": "a79e396a32e10856c97b95f43da7e9d2b9a11d446f7638dbd75e5e7603128cac", - "vout": 1, - "value": "39748685", - "height": 2648043, - "confirmations": 47, - "coinbase": true - }, - { - "txid": "de4f379fdc3ea9be063e60340461a014f372a018d70c3db35701654e7066b3ef", - "vout": 0, - "value": "122492339065", - "height": 2646043, - "confirmations": 2047 - }, - { - "txid": "9e8eb9b3d2e8e4b5d6af4c43a9196dfc55a05945c8675904d8c61f404ea7b1e9", - "vout": 0, - "value": "142771322208", - "height": 2644885, - "confirmations": 3205 - } -] + { + txid: '13d26cd939bf5d155b1c60054e02d9c9b832a85e6ec4f2411be44b6b5a2842e9', + vout: 0, + value: '1422303206539', + confirmations: 0, + lockTime: 2648100, + }, + { + txid: 'a79e396a32e10856c97b95f43da7e9d2b9a11d446f7638dbd75e5e7603128cac', + vout: 1, + value: '39748685', + height: 2648043, + confirmations: 47, + coinbase: true, + }, + { + txid: 'de4f379fdc3ea9be063e60340461a014f372a018d70c3db35701654e7066b3ef', + vout: 0, + value: '122492339065', + height: 2646043, + confirmations: 2047, + }, + { + txid: '9e8eb9b3d2e8e4b5d6af4c43a9196dfc55a05945c8675904d8c61f404ea7b1e9', + vout: 0, + value: '142771322208', + height: 2644885, + confirmations: 3205, + }, +]; ``` #### Get block @@ -482,7 +692,7 @@ Returns information about block with transactions, subject to paging. GET /api/v2/block/ ``` -Response: +Response (`Block` type): ```javascript { @@ -571,6 +781,7 @@ Response: ] } ``` + _Note: Blockbook always follows the main chain of the backend it is attached to. If there is a rollback-reorg in the backend, Blockbook will also do rollback. When you ask for block by height, you will always get the main chain block. If you ask for block by hash, you may get the block from another fork but it is not guaranteed (backend may not keep it)_ #### Send transaction @@ -579,7 +790,7 @@ Sends new transaction to backend. ``` GET /api/v2/sendtx/ -POST /api/v2/sendtx (hex tx data in request body) +POST /api/v2/sendtx/ (hex tx data in request body) NB: the '/' symbol at the end is mandatory. ``` Response: @@ -602,16 +813,17 @@ or in case of error #### Tickers list -Returns a list of available currency rate tickers for the specified date, along with an actual data timestamp. +Returns a list of available currency rate tickers (secondary currencies) for the specified date, along with an actual data timestamp. ``` GET /api/v2/tickers-list/?timestamp= ``` The query parameters: -- *timestamp*: specifies a Unix timestamp to return available tickers for. -Example response: +- _timestamp_: specifies a Unix timestamp to return available tickers for. + +Example response (`AvailableVsCurrencies` type): ```javascript { @@ -633,10 +845,11 @@ GET /api/v2/tickers/[?currency=×tamp=] ``` The optional query parameters: -- *currency*: specifies a currency of returned rate ("usd", "eur", "eth"...). If not specified, all available currencies will be returned. -- *timestamp*: a Unix timestamp that specifies a date to return currency rates for. If not specified, the last available rate will be returned. -Example response (no parameters): +- _currency_: specifies a currency of returned rate ("usd", "eur", "eth"...). If not specified, all available currencies will be returned. +- _timestamp_: a Unix timestamp that specifies a date to return currency rates for. If not specified, the last available rate will be returned. + +Example response (no parameters, `FiatTicker` type): ```javascript { @@ -660,6 +873,7 @@ Example response (currency=usd): ``` Example error response (e.g. rate unavailable, incorrect currency...): + ```javascript { "ts":7980386400, @@ -678,14 +892,17 @@ GET /api/v2/balancehistory/?from=&to=[&fiatcur ``` Query parameters: -- *from*: specifies a start date as a Unix timestamp -- *to*: specifies an end date as a Unix timestamp + +- _from_: specifies a start date as a Unix timestamp +- _to_: specifies an end date as a Unix timestamp The optional query parameters: -- *fiatcurrency*: if specified, the response will contain fiat rate at the time of transaction. If not, all available currencies will be returned. -- *groupBy*: an interval in seconds, to group results by. Default is 3600 seconds. -Example response (fiatcurrency not specified): +- _fiatcurrency_: if specified, the response will contain secondary (fiat) rate at the time of transaction. If not, all available currencies will be returned. +- _groupBy_: an interval in seconds, to group results by. Default is 3600 seconds. + +Example response (_fiatcurrency_ not specified, `BalanceHistory[]` type): + ```javascript [ { @@ -719,44 +936,44 @@ Example response (fiatcurrency=usd): ```javascript [ - { - "time": 1578391200, - "txs": 5, - "received": "5000000", - "sent": "0", - "sentToSelf":"0", - "rates": { - "usd": 7855.9 - } - }, - { - "time": 1578488400, - "txs": 1, - "received": "0", - "sent": "5000000", - "sentToSelf":"0", - "rates": { - "usd": 8283.11 - } - } -] + { + time: 1578391200, + txs: 5, + received: '5000000', + sent: '0', + sentToSelf: '0', + rates: { + usd: 7855.9, + }, + }, + { + time: 1578488400, + txs: 1, + received: '0', + sent: '5000000', + sentToSelf: '0', + rates: { + usd: 8283.11, + }, + }, +]; ``` Example response (fiatcurrency=usd&groupBy=172800): ```javascript [ - { - "time": 1578355200, - "txs": 6, - "received": "5000000", - "sent": "5000000", - "sentToSelf":"0", - "rates": { - "usd": 7734.45 - } - } -] + { + time: 1578355200, + txs: 6, + received: '5000000', + sent: '5000000', + sentToSelf: '0', + rates: { + usd: 7734.45, + }, + }, +]; ``` The value of `sentToSelf` is the amount sent from the same address to the same address or within addresses of xpub. @@ -767,26 +984,28 @@ Websocket interface is provided at `/websocket/`. The interface can be explored The websocket interface provides the following requests: -- getInfo -- getBlockHash -- getAccountInfo -- getAccountUtxo -- getTransaction -- getTransactionSpecific -- getBalanceHistory -- getCurrentFiatRates -- getFiatRatesTickersList -- getFiatRatesForTimestamps -- estimateFee -- sendTransaction -- ping +- getInfo +- getBlockHash +- getAccountInfo +- getAccountUtxo +- getTransaction +- getTransactionSpecific +- getBalanceHistory +- getCurrentFiatRates +- getFiatRatesTickersList +- getFiatRatesForTimestamps +- getMempoolFilters +- getBlockFilter +- estimateFee +- sendTransaction +- ping The client can subscribe to the following events: -- `subscribeNewBlock` - new block added to blockchain -- `subscribeNewTransaction` - new transaction added to blockchain (all addresses) -- `subscribeAddresses` - new transaction for given address (list of addresses) -- `subscribeFiatRates` - new currency rate ticker +- `subscribeNewBlock` - new block added to blockchain +- `subscribeNewTransaction` - new transaction added to blockchain (all addresses) +- `subscribeAddresses` - new transaction for a given address (list of addresses) added to mempool +- `subscribeFiatRates` - new currency rate ticker There can be always only one subscription of given event per connection, i.e. new list of addresses replaces previous list of addresses. @@ -794,22 +1013,49 @@ The subscribeNewTransaction event is not enabled by default. To enable support, _Note: If there is reorg on the backend (blockchain), you will get a new block hash with the same or even smaller height if the reorg is deeper_ -Websocket communication format -``` +Websocket communication format (`WsReq` type) + +```javascript { "id":"1", //an id to help to identify the response - "method":"", + "method":"", "params": } ``` Example for subscribing to an address (or multiple addresses) -``` + +```javascript { - "id":"1", - "method":"subscribeAddresses", + "id":"1", + "method":"subscribeAddresses", "params":{ "addresses":["mnYYiDCb2JZXnqEeXta1nkt5oCVe2RVhJj", "tb1qp0we5epypgj4acd2c4au58045ruud2pd6heuee"] } } ``` + +## Legacy API V1 + +The legacy API is a compatible subset of API provided by **Bitcore Insight**. It is supported only for Bitcoin-type coins. The details of the REST/socket.io requests can be found in the Insight's documentation. + +### REST API + +``` +GET /api/v1/block-index/ +GET /api/v1/tx/ +GET /api/v1/address/
+GET /api/v1/utxo/
+GET /api/v1/block/ +GET /api/v1/estimatefee/ +GET /api/v1/sendtx/ +POST /api/v1/sendtx/ (hex tx data in request body) +``` + +### Socket.io API + +Socket.io interface is provided at `/socket.io/`. The interface also can be explored using Blockbook Socket.io Test Page found at `/test-socketio.html`. + +The legacy API is provided as is and will not be further developed. + +The legacy API is currently (as of Blockbook v0.5.0) also accessible without the _/v1/_ prefix, however in the future versions the version-less access will be removed. diff --git a/docs/build.md b/docs/build.md index a464ccb5a8..9d39d3f1fa 100644 --- a/docs/build.md +++ b/docs/build.md @@ -11,7 +11,7 @@ Manual build require additional dependencies that are described in appropriate s ## Build in Docker environment All build operations run in Docker container in order to keep build environment isolated. Makefile in root of repository -define few targets used for building, testing and packaging of Blockbook. With Docker image definitions and Debian +defines few targets used for building, testing and packaging of Blockbook. With Docker image definitions and Debian package templates in *build/docker* and *build/templates* respectively, they are only inputs that make build process. Docker build images are created at first execution of Makefile and that information is persisted. (Actually there are @@ -78,7 +78,7 @@ There are few variables that can be passed to `make` in order to modify build pr `BASE_IMAGE`: Specifies the base image of the Docker build image. By default, it chooses the same Linux distro as the host machine but you can override it this way `make BASE_IMAGE=debian:10 all-bitcoin` to make a build for Debian 10. -*Please be aware that we are running our Blockbooks on Debian 9 and Debian 10 and do not offer support with running it on other distros.* +*Please be aware that we are currently running our Blockbooks on Debian 11 and do not offer support with running it on other distros.* `NO_CACHE`: Common behaviour of Docker image build is that build steps are cached and next time they are executed much faster. Although this is a good idea, when something went wrong you will need to override this behaviour somehow. Execute this @@ -137,7 +137,7 @@ Blockbook versioning is much simpler. There is only one version defined in *conf ### Back-end building -Because we don't keep back-end archives inside out repository we download them during build process. Build steps +Because we don't keep back-end archives inside our repository we download them during build process. Build steps are these: download, verify and extract archive, prepare distribution and make package. All configuration keys described below are in coin definition file in *configs/coins*. @@ -153,7 +153,7 @@ have signed sha256 sums and some don't care about verification at all. So there could be *gpg*, *gpg-sha256* or *sha256* and chooses particular method. *gpg* type require file with digital sign and maintainer's public key imported in Docker build image (see below). Sign -file is downloaded from URL defined in *backend.verification_source*. Than is passed to gpg in order to verify archvie. +file is downloaded from URL defined in *backend.verification_source*. Than is passed to gpg in order to verify archive. *gpg-sha256* type require signed checksum file and maintainer's public key imported in Docker build image (see below). Checksum file is downloaded from URL defined in *backend.verification_source*. Then is verified by gpg and passed to @@ -185,13 +185,13 @@ Configuration is described in [config.md](/docs/config.md). ## Manual build -Instructions below are focused on Debian 9 (Stretch) and 10 (Buster). If you want to use another Linux distribution or operating system -like macOS or Windows, please read instructions specific for each project. +Instructions below are focused on Debian 11 on amd64. If you want to use another Linux distribution or operating system +like macOS or Windows, please adapt the instructions to your target system. Setup go environment (use newer version of go as available) ``` -wget https://golang.org/dl/go1.17.1.linux-amd64.tar.gz && tar xf go1.17.1.linux-amd64.tar.gz +wget https://golang.org/dl/go1.22.8.linux-amd64.tar.gz && tar xf go1.22.8.linux-amd64.tar.gz sudo mv go /opt/go sudo ln -s /opt/go/bin/go /usr/bin/go # see `go help gopath` for details @@ -201,23 +201,23 @@ export PATH=$PATH:$GOPATH/bin ``` Install RocksDB: https://github.com/facebook/rocksdb/blob/master/INSTALL.md -and compile the static_lib and tools. Optionally, consider adding `PORTABLE=1` before the +and compile the static_lib and tools. Optionally, consider adding `PORTABLE=1` before the make command to create a portable binary. ``` sudo apt-get update && sudo apt-get install -y \ - build-essential git wget pkg-config libzmq3-dev libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev + build-essential git wget pkg-config libzmq3-dev libgflags-dev libsnappy-dev zlib1g-dev libzstd-dev libbz2-dev liblz4-dev git clone https://github.com/facebook/rocksdb.git cd rocksdb -git checkout v6.22.1 +git checkout v9.10.0 CFLAGS=-fPIC CXXFLAGS=-fPIC make release ``` -Setup variables for gorocksdb +Setup variables for grocksdb ``` export CGO_CFLAGS="-I/path/to/rocksdb/include" -export CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lm -lz -ldl -lbz2 -lsnappy -llz4" +export CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lm -lz -ldl -lbz2 -lsnappy -llz4 -lzstd" ``` Install ZeroMQ: https://github.com/zeromq/libzmq @@ -237,7 +237,7 @@ Get blockbook sources, install dependencies, build: cd $GOPATH/src git clone https://github.com/trezor/blockbook.git cd blockbook -go build -tags rocksdb_6_16 +go build ``` ### Example command diff --git a/docs/config.md b/docs/config.md index b4e14296c8..5e413e38b2 100644 --- a/docs/config.md +++ b/docs/config.md @@ -32,7 +32,7 @@ Good examples of coin configuration are * `backend_*` – Additional back-end ports can be documented here. Actually the only purpose is to get them to port table (prefix is removed and rest of string is used as note). * `blockbook_internal` – Blockbook's internal port that is used for metric collecting, debugging etc. - * `blockbook_public` – Blockbook's public port that is used to comunicate with Trezor wallet (via Socket.IO). + * `blockbook_public` – Blockbook's public port that is used to communicate with Trezor wallet (via Socket.IO). * `ipc` – Defines how Blockbook connects its back-end service. * `rpc_url_template` – Template that defines URL of back-end RPC service. See note on templates below. @@ -82,7 +82,7 @@ Good examples of coin configuration are * `explorer_url` – URL of blockchain explorer. Leave empty for internal explorer. * `additional_params` – Additional params of exec command (see [Dogecoin definition](/configs/coins/dogecoin.json)). * `block_chain` – Configuration of BlockChain type that ensures communication with back-end service. All options - must be tweaked for each individual coin separely. + must be tweaked for each individual coin separately. * `parse` – Use binary parser for block decoding if *true* else call verbose back-end RPC method that returns JSON. Note that verbose method is slow and not every coin support it. However there are coin implementations that don't support binary parsing (e.g. ZCash). @@ -112,4 +112,4 @@ to alter built-in text that is specific for Trezor. Text fields that could be up * [tos_link](/build/text/tos_link) – A link to Terms of service shown as the footer on the Explorer pages. Text data are stored as plain text files in *build/text* directory and are embedded to binary during build. A change of -theese files is mean for a private purpose and PRs that would update them won't be accepted. +these files is meant for a private purpose and PRs that would update them won't be accepted. diff --git a/docs/env.md b/docs/env.md new file mode 100644 index 0000000000..8d95dc985c --- /dev/null +++ b/docs/env.md @@ -0,0 +1,11 @@ +# Environment variables + +Some behavior of Blockbook can be modified by environment variables. The variables usually start with a coin shortcut to allow to run multiple Blockbooks on a single server. + +- `_WS_GETACCOUNTINFO_LIMIT` - Limits the number of `getAccountInfo` requests per websocket connection to reduce server abuse. Accepts number as input. + +- `_STAKING_POOL_CONTRACT` - The pool name and contract used for Ethereum staking. The format of the variable is `/`. If missing, staking support is disabled. + +- `COINGECKO_API_KEY` or `_COINGECKO_API_KEY` - API key for making requests to CoinGecko in the paid tier. + +- `_ALLOWED_RPC_CALL_TO` - Addresses to which `rpcCall` websocket requests can be made, as a comma-separated list. If omitted, `rpcCall` is enabled for all addresses. diff --git a/docs/ports.md b/docs/ports.md index 7d7a6b11a4..18bed15cab 100644 --- a/docs/ports.md +++ b/docs/ports.md @@ -1,73 +1,93 @@ # Registry of ports -| coin | blockbook internal port | blockbook public port | backend rpc port | backend service ports (zmq) | -|------------------------|-------------------------|-----------------------|------------------|-----------------------------| -| Bitcoin | 9030 | 9130 | 8030 | 38330 | -| Bitcoin Cash | 9031 | 9131 | 8031 | 38331 | -| Zcash | 9032 | 9132 | 8032 | 38332 | -| Dash | 9033 | 9133 | 8033 | 38333 | -| Litecoin | 9034 | 9134 | 8034 | 38334 | -| Bitcoin Gold | 9035 | 9135 | 8035 | 38335 | -| Ethereum | 9036 | 9136 | 8036 | 38336 p2p, 8136 http | -| Ethereum Classic | 9037 | 9137 | 8037 | | -| Dogecoin | 9038 | 9138 | 8038 | 38338 | -| Namecoin | 9039 | 9139 | 8039 | 38339 | -| Vertcoin | 9040 | 9140 | 8040 | 38340 | -| Monacoin | 9041 | 9141 | 8041 | 38341 | -| DigiByte | 9042 | 9142 | 8042 | 38342 | -| Myriad | 9043 | 9143 | 8043 | 38343 | -| GameCredits | 9044 | 9144 | 8044 | 38344 | -| Groestlcoin | 9045 | 9145 | 8045 | 38345 | -| Bitcoin Cash SV | 9046 | 9146 | 8046 | 38346 | -| Liquid | 9047 | 9147 | 8047 | 38347 | -| Fujicoin | 9048 | 9148 | 8048 | 38348 | -| PIVX | 9049 | 9149 | 8049 | 38349 | -| Firo | 9050 | 9150 | 8050 | 38350 | -| Koto | 9051 | 9151 | 8051 | 38351 | -| Bellcoin | 9052 | 9152 | 8052 | 38352 | -| NULS | 9053 | 9153 | 8053 | 38353 | -| Bitcore | 9054 | 9154 | 8054 | 38354 | -| Viacoin | 9055 | 9155 | 8055 | 38355 | -| VIPSTARCOIN | 9056 | 9156 | 8056 | 38356 | -| MonetaryUnit | 9057 | 9157 | 8057 | 38357 | -| Flux | 9058 | 9158 | 8058 | 38358 | -| Ravencoin | 9059 | 9159 | 8059 | 38359 | -| Ritocoin | 9060 | 9160 | 8060 | 38360 | -| Decred | 9061 | 9161 | 8061 | 38361 | -| SnowGem | 9062 | 9162 | 8062 | 38362 | -| Flo | 9066 | 9166 | 8066 | 38366 | -| Polis | 9067 | 9167 | 8067 | 38367 | -| Qtum | 9088 | 9188 | 8088 | 38388 | -| Divi Project | 9089 | 9189 | 8089 | 38389 | -| CPUchain | 9090 | 9190 | 8090 | 38390 | -| DeepOnion | 9091 | 9191 | 8091 | 38391 | -| Unobtanium | 9092 | 9192 | 65535 | 38392 | -| Omotenashicoin | 9094 | 9194 | 8094 | 38394 | -| BitZeny | 9095 | 9195 | 8095 | 38395 | -| Trezarcoin | 9096 | 9196 | 8096 | 38396 | -| eCash | 9097 | 9197 | 8097 | 38397 | -| Bitcoin Signet | 19020 | 19120 | 18020 | 48320 | -| Bitcoin Regtest | 19021 | 19121 | 18021 | 48321 | -| Ethereum Goerli | 19026 | 19126 | 18026 | 48326 p2p | -| Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 | -| Bitcoin Cash Testnet | 19031 | 19131 | 18031 | 48331 | -| Zcash Testnet | 19032 | 19132 | 18032 | 48332 | -| Dash Testnet | 19033 | 19133 | 18033 | 48333 | -| Litecoin Testnet | 19034 | 19134 | 18034 | 48334 | -| Bitcoin Gold Testnet | 19035 | 19135 | 18035 | 48335 | -| Ethereum Ropsten | 19036 | 19136 | 18036 | 48336 p2p | -| Dogecoin Testnet | 19038 | 19138 | 18038 | 48338 | -| Vertcoin Testnet | 19040 | 19140 | 18040 | 48340 | -| Monacoin Testnet | 19041 | 19141 | 18041 | 48341 | -| DigiByte Testnet | 19042 | 19142 | 18042 | 48342 | -| Groestlcoin Testnet | 19045 | 19145 | 18045 | 48345 | -| Groestlcoin Regtest | 19046 | 19146 | 18046 | 48346 | -| Groestlcoin Signet | 19047 | 19147 | 18047 | 48347 | -| PIVX Testnet | 19049 | 19149 | 18049 | 48349 | -| Koto Testnet | 19051 | 19151 | 18051 | 48351 | -| Decred Testnet | 19061 | 19161 | 18061 | 48361 | -| Flo Testnet | 19066 | 19166 | 18066 | 48366 | -| Qtum Testnet | 19088 | 19188 | 18088 | 48388 | -| Omotenashicoin Testnet | 19089 | 19189 | 18089 | 48389 | +| coin | blockbook public | blockbook internal | backend rpc | backend service ports (zmq) | +|----------------------------------|------------------|--------------------|-------------|-----------------------------------------------------| +| Ethereum Archive | 9116 | 9016 | 8016 | 38316 p2p, 8116 http, 8516 authrpc | +| Bitcoin | 9130 | 9030 | 8030 | 38330 | +| Bitcoin Cash | 9131 | 9031 | 8031 | 38331 | +| Zcash | 9132 | 9032 | 8032 | 38332 | +| Dash | 9133 | 9033 | 8033 | 38333 | +| Litecoin | 9134 | 9034 | 8034 | 38334 | +| Bitcoin Gold | 9135 | 9035 | 8035 | 38335 | +| Ethereum | 9136 | 9036 | 8036 | 38336 p2p, 8136 http, 8536 authrpc | +| Ethereum Classic | 9137 | 9037 | 8037 | 38337 p2p, 8137 http | +| Dogecoin | 9138 | 9038 | 8038 | 38338 | +| Namecoin | 9139 | 9039 | 8039 | 38339 | +| Vertcoin | 9140 | 9040 | 8040 | 38340 | +| Monacoin | 9141 | 9041 | 8041 | 38341 | +| DigiByte | 9142 | 9042 | 8042 | 38342 | +| Myriad | 9143 | 9043 | 8043 | 38343 | +| GameCredits | 9144 | 9044 | 8044 | 38344 | +| Groestlcoin | 9145 | 9045 | 8045 | 38345 | +| Bitcoin Cash SV | 9146 | 9046 | 8046 | 38346 | +| Liquid | 9147 | 9047 | 8047 | 38347 | +| Fujicoin | 9148 | 9048 | 8048 | 38348 | +| PIVX | 9149 | 9049 | 8049 | 38349 | +| Firo | 9150 | 9050 | 8050 | 38350 | +| Koto | 9151 | 9051 | 8051 | 38351 | +| Bellcoin | 9152 | 9052 | 8052 | 38352 | +| NULS | 9153 | 9053 | 8053 | 38353 | +| Bitcore | 9154 | 9054 | 8054 | 38354 | +| Viacoin | 9155 | 9055 | 8055 | 38355 | +| VIPSTARCOIN | 9156 | 9056 | 8056 | 38356 | +| MonetaryUnit | 9157 | 9057 | 8057 | 38357 | +| Flux | 9158 | 9058 | 8058 | 38358 | +| Ravencoin | 9159 | 9059 | 8059 | 38359 | +| Ritocoin | 9160 | 9060 | 8060 | 38360 | +| Decred | 9161 | 9061 | 8061 | 38361 | +| SnowGem | 9162 | 9062 | 8062 | 38362 | +| BNB Smart Chain | 9164 | 9064 | 8064 | 38364 p2p, 8164 http | +| BNB Smart Chain Archive | 9165 | 9065 | 8065 | 38365 p2p, 8165 http | +| Flo | 9166 | 9066 | 8066 | 38366 | +| Polis | 9167 | 9067 | 8067 | 38367 | +| Polygon | 9170 | 9070 | 8070 | 38370 p2p, 8170 http | +| Polygon Archive | 9172 | 9072 | 8072 | 38372 p2p, 8172 http | +| Qtum | 9188 | 9088 | 8088 | 38388 | +| Divi Project | 9189 | 9089 | 8089 | 38389 | +| CPUchain | 9190 | 9090 | 8090 | 38390 | +| DeepOnion | 9191 | 9091 | 8091 | 38391 | +| Unobtanium | 9192 | 9092 | 65535 | 38392 | +| Omotenashicoin | 9194 | 9094 | 8094 | 38394 | +| BitZeny | 9195 | 9095 | 8095 | 38395 | +| Trezarcoin | 9196 | 9096 | 8096 | 38396 | +| eCash | 9197 | 9097 | 8097 | 38397 | +| Avalanche | 9198 | 9098 | 8098 | 38398 p2p | +| Avalanche Archive | 9199 | 9099 | 8099 | 38399 p2p | +| Optimism | 9300 | 9200 | 8200 | 38400 p2p, 8300 http, 8400 authrpc | +| Optimism Archive | 9302 | 9202 | 8202 | 38402 p2p, 8302 http, 8402 authrpc | +| Arbitrum | 9305 | 9205 | 8205 | 38405 p2p, 8305 http | +| Arbitrum Archive | 9306 | 9206 | 8306 | 38406 p2p | +| Arbitrum Nova | 9307 | 9207 | 8207 | 38407 p2p, 8307 http | +| Arbitrum Nova Archive | 9308 | 9208 | 8308 | 38408 p2p | +| Base | 9309 | 9209 | 8309 | 38409 p2p, 8209 http, 8409 authrpc | +| Base Archive | 9311 | 9211 | 8211 | 38411 p2p, 8311 http, 8411 authrpc | +| Bitcoin Signet | 19120 | 19020 | 18020 | 48320 | +| Bitcoin Regtest | 19121 | 19021 | 18021 | 48321 | +| Bitcoin Testnet4 | 19129 | 19029 | 18029 | 48329 | +| Bitcoin Testnet | 19130 | 19030 | 18030 | 48330 | +| Bitcoin Cash Testnet | 19131 | 19031 | 18031 | 48331 | +| Zcash Testnet | 19132 | 19032 | 18032 | 48332 | +| Dash Testnet | 19133 | 19033 | 18033 | 48333 | +| Litecoin Testnet | 19134 | 19034 | 18034 | 48334 | +| Bitcoin Gold Testnet | 19135 | 19035 | 18035 | 48335 | +| Dogecoin Testnet | 19138 | 19038 | 18038 | 48338 | +| Vertcoin Testnet | 19140 | 19040 | 18040 | 48340 | +| Monacoin Testnet | 19141 | 19041 | 18041 | 48341 | +| DigiByte Testnet | 19142 | 19042 | 18042 | 48342 | +| Groestlcoin Testnet | 19145 | 19045 | 18045 | 48345 | +| Groestlcoin Regtest | 19146 | 19046 | 18046 | 48346 | +| Groestlcoin Signet | 19147 | 19047 | 18047 | 48347 | +| PIVX Testnet | 19149 | 19049 | 18049 | 48349 | +| Koto Testnet | 19151 | 19051 | 18051 | 48351 | +| Decred Testnet | 19161 | 19061 | 18061 | 48361 | +| Flo Testnet | 19166 | 19066 | 18066 | 48366 | +| Ethereum Testnet Holesky | 19116 | 19016 | 18016 | 18116 http, 18516 authrpc, 48316 p2p | +| Ethereum Testnet Holesky Archive | 19136 | 19036 | 18036 | 18136 http, 18136 torrent, 18536 authrpc, 48336 p2p | +| Ethereum Testnet Hoodi | 19106 | 19006 | 18006 | 18106 http, 18506 authrpc, 48306 p2p | +| Ethereum Testnet Hoodi Archive | 19126 | 19026 | 18026 | 18126 http, 18126 torrent, 18526 authrpc, 48326 p2p | +| Ethereum Testnet Sepolia | 19176 | 19076 | 18076 | 18176 http, 18576 authrpc, 48376 p2p | +| Ethereum Testnet Sepolia Archive | 19186 | 19086 | 18086 | 18186 http, 18186 torrent, 18586 authrpc, 48386 p2p | +| Qtum Testnet | 19188 | 19088 | 18088 | 48388 | +| Omotenashicoin Testnet | 19189 | 19089 | 18089 | 48389 | -> NOTE: This document is generated from coin definitions in `configs/coins`. +> NOTE: This document is generated from coin definitions in `configs/coins` using command `go run contrib/scripts/check-and-generate-port-registry.go -w`. diff --git a/docs/rocksdb.md b/docs/rocksdb.md index 4301b0f7cf..3a230085e9 100644 --- a/docs/rocksdb.md +++ b/docs/rocksdb.md @@ -2,126 +2,198 @@ **Blockbook** stores data the key-value store [RocksDB](https://github.com/facebook/rocksdb/wiki). As there are multiple indexes, Blockbook uses RocksDB **column families** feature to store indexes separately. ->The database structure is described in golang pseudo types in the form *(name type)*. +> The database structure is described in golang pseudo types in the form _(name type)_. > ->Operators used in the description: ->- *->* mapping from key to value. ->- *\+* concatenation, ->- *[]* array +> Operators used in the description: > ->Types used in the description: ->- *[]byte* - variable length array of bytes ->- *[32]byte* - fixed length array of bytes (32 bytes long in this case) ->- *uint32* - unsigned integer, stored as array of 4 bytes in big endian* ->- *vint*, *vuint* - variable length signed/unsigned int ->- *addrDesc* - address descriptor, abstraction of an address. -For Bitcoin type coins it is the transaction output script, stored as variable length array of bytes. -For Ethereum type coins it is fixed size array of 20 bytes. ->- *bigInt* - unsigned big integer, stored as length of the array (1 byte) followed by array of bytes of big int, i.e. *(int_len byte)+(int_value []byte)*. Zero is stored as one byte of value 0. +> - _->_ mapping from key to value. +> - _\+_ concatenation, +> - _[]_ array +> +> Types used in the description: +> +> - _[]byte_ - variable length array of bytes +> - _[32]byte_ - fixed length array of bytes (32 bytes long in this case) +> - _uint32_ - unsigned integer, stored as array of 4 bytes in big endian\* +> - _vint_, _vuint_ - variable length signed/unsigned int +> - _addrDesc_ - address descriptor, abstraction of an address. +> For Bitcoin type coins it is the transaction output script, stored as variable length array of bytes. +> For Ethereum type coins it is fixed size array of 20 bytes. +> - _bigInt_ - unsigned big integer, stored as length of the array (1 byte) followed by array of bytes of big int, i.e. _(int_len byte)+(int_value []byte)_. Zero is stored as one byte of value 0. +> - _float32_ - float32 number stored as _uint32_ +> - string - string stored as `(len vuint)+(value []byte)` **Database structure:** -The database structure described here is of Blockbook version **0.3.6** (internal data format version 5). +The database structure described here is of Blockbook version **0.5.0** (internal data format version 7). + +The database structure for **Bitcoin type** and **Ethereum type** coins is different. Column families used for both types: -The database structure for **Bitcoin type** and **Ethereum type** coins is slightly different. Column families used for both types: -- default, height, addresses, transactions, blockTxs +- default, height, addresses, transactions, blockTxs, fiatRates Column families used only by **Bitcoin type** coins: + - addressBalance, txAddresses Column families used only by **Ethereum type** coins: -- addressContracts + +- addressContracts, internalData, contracts, functionSignatures, blockInternalDataErrors, addressAliases **Column families description:** - **default** - Stores internal state in json format, under the key *internalState*. - + Stores internal state in json format, under the key _internalState_. + Most important internal state values are: + - coin - which coin is indexed in DB - - data format version - currently 5 + - data format version - currently 6 - dbState - closed, open, inconsistent - + Blockbook is checking on startup these values and does not allow to run against wrong coin, data format version and in inconsistent state. The database must be recreated if the internal state does not match. -- **height** +- **height** + + Maps _block height_ to _block hash_ and additional data about block. - Maps *block height* to *block hash* and additional data about block. - ``` - (height uint32) -> (hash [32]byte)+(time uint32)+(nr_txs vuint)+(size vuint) - ``` + ``` + (height uint32) -> (hash [32]byte)+(time uint32)+(nr_txs vuint)+(size vuint) + ``` - **addresses** - Maps *addrDesc+block height* to *array of transactions with array of input/output indexes*. - - The *block height* in the key is stored as bitwise complement ^ of the height to sort the keys in the order from newest to oldest. - - As there can be multiple inputs/outputs for the same address in one transaction, each txid is followed by variable length array of input/output indexes. - The index values in the array are multiplied by two, the last element of the array has the lowest bit set to 1. - Input or output is distinguished by the sign of the index, output is positive, input is negative (by operation bitwise complement ^ performed on the number). - ``` - (addrDesc []byte)+(^height uint32) -> []((txid [32]byte)+[](index vint)) - ``` + Maps _addrDesc+block height_ to _array of transactions with array of input/output indexes_. + + The _block height_ in the key is stored as bitwise complement ^ of the height to sort the keys in the order from newest to oldest. + + As there can be multiple inputs/outputs for the same address in one transaction, each txid is followed by variable length array of input/output indexes. + The index values in the array are multiplied by two, the last element of the array has the lowest bit set to 1. + Input or output is distinguished by the sign of the index, output is positive, input is negative (by operation bitwise complement ^ performed on the number). + + ``` + (addrDesc []byte)+(^height uint32) -> []((txid [32]byte)+[](index vint)) + ``` - **addressBalance** (used only by Bitcoin type coins) - Maps *addrDesc* to *number of transactions*, *sent amount*, *total balance* and a list of *unspent transactions outputs (UTXOs)*, ordered from oldest to newest - ``` - (addrDesc []byte) -> (nr_txs vuint)+(sent_amount bigInt)+(balance bigInt)+ - []((txid [32]byte)+(vout vuint)+(block_height vuint)+(amount bigInt)) - ``` + Maps _addrDesc_ to _number of transactions_, _sent amount_, _total balance_ and a list of _unspent transactions outputs (UTXOs)_, ordered from oldest to newest + + ``` + (addrDesc []byte) -> (nr_txs vuint)+(sent_amount bigInt)+(balance bigInt)+ + []((txid [32]byte)+(vout vuint)+(block_height vuint)+(amount bigInt)) + ``` - **txAddresses** (used only by Bitcoin type coins) - Maps *txid* to *block height* and array of *input addrDesc* with *amounts* and array of *output addrDesc* with *amounts*, with flag if output is spent. In case of spent output, *addrDesc_len* is negative (negative sign is achieved by bitwise complement ^). - ``` - (txid []byte) -> (height vuint)+ - (nr_inputs vuint)+[]((addrDesc_len vuint)+(addrDesc []byte)+(amount bigInt))+ - (nr_outputs vuint)+[]((addrDesc_len vint)+(addrDesc []byte)+(amount bigInt)) - ``` + Maps _txid_ to _block height_ and array of _input addrDesc_ with _amounts_ and array of _output addrDesc_ with _amounts_, with flag if output is spent. In case of spent output, _addrDesc_len_ is negative (negative sign is achieved by bitwise complement ^). + + ``` + (txid []byte) -> (height vuint)+ + (nr_inputs vuint)+[]((addrDesc_len vuint)+(addrDesc []byte)+(amount bigInt))+ + (nr_outputs vuint)+[]((addrDesc_len vint)+(addrDesc []byte)+(amount bigInt)) + ``` - **addressContracts** (used only by Ethereum type coins) - Maps *addrDesc* to *total number of transactions*, *number of non contract transactions* and array of *contracts* with *number of transfers* of given address. - ``` - (addrDesc []byte) -> (total_txs vuint)+(non-contract_txs vuint)+[]((contractAddrDesc []byte)+(nr_transfers vuint)) - ``` + Maps _addrDesc_ to _total number of transactions_, _number of non contract transactions_, _number of internal transactions_ + and array of _contracts_ with _number of transfers_ of given address. + + ``` + (addrDesc []byte) -> (total_txs vuint)+(non-contract_txs vuint)+(internal_txs vuint)+(contracts vuint)+ + []((contractAddrDesc []byte)+(type+4*nr_transfers vuint))+ + <(value bigInt) if ERC20> or + <(nr_values vuint)+[](id bigInt) if ERC721> or + <(nr_values vuint)+[]((id bigInt)+(value bigInt)) if ERC1155> + ``` + +- **internalData** (used only by Ethereum type coins) + + Maps _txid_ to _type (CALL 0 | CREATE 1)_, _addrDesc of created contract for CREATE type_, array of _type (CALL 0 | CREATE 1 | SELFDESTRUCT 2)_, _from addrDesc_, _to addrDesc_, _value bigInt_ and possible _error_. + + ``` + (txid []byte) -> (type+2*nr_transfers vuint)+<(addrDesc []byte) if CREATE>+ + []((type byte)+(fromAddrDesc []byte)+(toAddrDesc []byte)+(value bigInt))+ + (error []byte) + ``` - **blockTxs** - Maps *block height* to data necessary for blockchain rollback. Only last 300 (by default) blocks are kept. - The content of value data differs for Bitcoin and Ethereum types. + Maps _block height_ to data necessary for blockchain rollback. Only last 300 (by default) blocks are kept. + The content of value data differs for Bitcoin and Ethereum types. + + - Bitcoin type + + The value is an array of _txids_ and _input points_ in the block. - - Bitcoin type + ``` + (height uint32) -> []((txid [32]byte)+(nr_inputs vuint)+[]((txid [32]byte)+(index vint))) + ``` - The value is an array of *txids* and *input points* in the block. - ``` - (height uint32) -> []((txid [32]byte)+(nr_inputs vuint)+[]((txid [32]byte)+(index vint))) - ``` + - Ethereum type - - Ethereum type - - The value is an array of transaction data. For each transaction is stored *txid*, - *from* and *to* address descriptors and array of *contract address descriptors* with *transfer address descriptors*. - ``` - (height uint32) -> []((txid [32]byte)+(from addrDesc)+(to addrDesc)+(nr_contracts vuint)+[]((contract addrDesc)+(addr addrDesc))) - ``` + The value is an array of transaction data. For each transaction is stored _txid_, + _from_ and _to_ address descriptors and array of contract transfer infos consisting of + _from_, _to_ and _contract_ address descriptors, _type (ERC20 0 | ERC721 1 | ERC1155 2)_ and value (or list of id+value for ERC1155) + + ``` + (height uint32) -> []( + (txid [32]byte)+(from addrDesc)+(to addrDesc)+(nr_contracts vuint)+ + []((from addrDesc)+(to addrDesc)+(contract addrDesc)+(type byte)+ + <(value bigInt) if ERC20 or ERC721> or + <(nr_values vuint)+[]((id bigInt)+(value bigInt)) if ERC1155>) + ) + ``` - **transactions** - Transaction cache, *txdata* is generated by coin specific parser function PackTx. - ``` - (txid []byte) -> (txdata []byte) - ``` + Transaction cache, _txdata_ is generated by coin specific parser function PackTx. + + ``` + (txid []byte) -> (txdata []byte) + ``` - **fiatRates** - Stores fiat rates in json format. - ``` - (timestamp YYYYMMDDhhmmss) -> (rates json) - ``` + Stored daily fiat rates, one day as one entry. + + ``` + (timestamp YYYYMMDDhhmmss) -> (nr_currencies vuint)+[]((currency string)+(rate float32))+ + (nr_tokens vuint)+[]((tokenContract string)+(tokenRate float32)) + ``` + +- **contracts** (used only by Ethereum type coins) + + Maps contract _addrDesc_ to information about contract - _name_, _symbol_, _type_ (ERC20,ERC721 or ERC1155), _decimals_, _created_ and _destructed_ in block height + + ``` + (addrDesc []byte) -> (name string)+(symbol string)+(type string)+(decimals vuint)+ + (createdInBlock vuint)+(destroyedInBlock vuint) + ``` + +- **functionSignatures** (used only by Ethereum type coins) + + Database of four byte signatures downloaded from https://www.4byte.directory/. + + ``` + (fourBytes uint32)+(id uint32) -> (signatureName string)+[]((parameter string)) + ``` + +- **blockInternalDataErrors** (used only by Ethereum type coins) + + Errors when fetching internal data from backend. Stored so that the action can be retried. + + ``` + (blockHeight uint32) -> (blockHash [32]byte)+(retryCount byte)+(errorMessage []byte) + ``` + +- **addressAliases** (used only by Ethereum type coins) + + Maps _address_ to address ENS name. + ``` + (address []byte) -> (ensName []byte) + ``` -The `txid` field as specified in this documentation is a byte array of fixed size with length 32 bytes (*[32]byte*), however some coins may define other fixed size lengths. +**Note:** +The `txid` field as specified in this documentation is a byte array of fixed size with length 32 bytes (_[32]byte_), however some coins may define other fixed size lengths. diff --git a/docs/testing.md b/docs/testing.md index aa6de9ee7d..639bd3a8ec 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -16,7 +16,7 @@ You can use Go's flag *-run* to filter which tests should be executed. Use *ARGS ## Unit tests -Unit test file must start with constraint `// +build unittest` followed by blank line (constraints are described +Unit test file must start with constraint `//go:build unittest` followed by blank line (constraints are described [here](https://golang.org/pkg/go/build/#hdr-Build_Constraints)). Every coin implementation must have unit tests. At least for parser. Usual test suite define real transaction data @@ -34,7 +34,7 @@ components of Blockbook, it is mandatory that coin implementations have these in implemented in packages `blockbook/tests/rpc` and `blockbook/tests/sync` and both of them are declarative. For each coin there are test definition that enables particular tests of test suite and *testdata* file that contains test fixtures. -Not every coin implementation support full set of back-end API so it is necessary define which tests of test suite +Not every coin implementation supports full set of back-end API so it is necessary to define which tests of test suite are able to run. That is done in test definition file *blockbook/tests/tests.json*. Configuration is hierarchical and test implementations call each level as separate subtest. Go's *test* command allows filter tests to run by `-run` flag. It perfectly fits with layered test definitions. For example, you can: diff --git a/fiat/coingecko.go b/fiat/coingecko.go index 7ce07f9ba9..7e79dd4222 100644 --- a/fiat/coingecko.go +++ b/fiat/coingecko.go @@ -2,135 +2,544 @@ package fiat import ( "encoding/json" - "errors" - "io/ioutil" + "fmt" + "io" "net/http" + "net/url" + "os" "strconv" + "strings" "time" "github.com/golang/glog" + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" ) +const ( + DefaultHTTPTimeout = 15 * time.Second + DefaultThrottleDelayMs = 100 // 100 ms delay between requests +) + // Coingecko is a structure that implements RatesDownloaderInterface type Coingecko struct { - url string - coin string - httpTimeoutSeconds time.Duration - timeFormat string + url string + apiKey string + coin string + platformIdentifier string + platformVsCurrency string + allowedVsCurrencies map[string]struct{} + httpTimeout time.Duration + throttlingDelay time.Duration + timeFormat string + httpClient *http.Client + db *db.RocksDB + updatingCurrent bool + updatingTokens bool + metrics *common.Metrics +} + +// simpleSupportedVSCurrencies https://api.coingecko.com/api/v3/simple/supported_vs_currencies +type simpleSupportedVSCurrencies []string + +type coinsListItem struct { + ID string `json:"id"` + Symbol string `json:"symbol"` + Name string `json:"name"` + Platforms map[string]string `json:"platforms"` +} + +// coinList https://api.coingecko.com/api/v3/coins/list +type coinList []coinsListItem + +type marketPoint [2]float64 +type marketChartPrices struct { + Prices []marketPoint `json:"prices"` } // NewCoinGeckoDownloader creates a coingecko structure that implements the RatesDownloaderInterface -func NewCoinGeckoDownloader(url string, coin string, timeFormat string) RatesDownloaderInterface { +func NewCoinGeckoDownloader(db *db.RocksDB, network string, url string, coin string, platformIdentifier string, platformVsCurrency string, allowedVsCurrencies string, timeFormat string, metrics *common.Metrics, throttleDown bool) RatesDownloaderInterface { + throttlingDelayMs := 0 // No delay by default + if throttleDown { + throttlingDelayMs = DefaultThrottleDelayMs + } + + allowedVsCurrenciesMap := getAllowedVsCurrenciesMap(allowedVsCurrencies) + + apiKey := os.Getenv(strings.ToUpper(network) + "_COINGECKO_API_KEY") + if apiKey == "" { + apiKey = os.Getenv("COINGECKO_API_KEY") + } + + // use default address if not overridden, with respect to existence of apiKey + if url == "" { + if apiKey != "" { + url = "https://pro-api.coingecko.com/api/v3/" + } else { + url = "https://api.coingecko.com/api/v3" + } + } + glog.Info("Coingecko downloader url ", url) + return &Coingecko{ - url: url, - coin: coin, - httpTimeoutSeconds: 15 * time.Second, - timeFormat: timeFormat, + url: url, + apiKey: apiKey, + coin: coin, + platformIdentifier: platformIdentifier, + platformVsCurrency: platformVsCurrency, + allowedVsCurrencies: allowedVsCurrenciesMap, + httpTimeout: DefaultHTTPTimeout, + timeFormat: timeFormat, + httpClient: &http.Client{ + Timeout: DefaultHTTPTimeout, + }, + db: db, + throttlingDelay: time.Duration(throttlingDelayMs) * time.Millisecond, + metrics: metrics, } } -// makeRequest retrieves the response from Coingecko API at the specified date. -// If timestamp is nil, it fetches the latest market data available. -func (cg *Coingecko) makeRequest(timestamp *time.Time) ([]byte, error) { - requestURL := cg.url + "/coins/" + cg.coin - if timestamp != nil { - requestURL += "/history" +// getAllowedVsCurrenciesMap returns a map of allowed vs currencies +func getAllowedVsCurrenciesMap(currenciesString string) map[string]struct{} { + allowedVsCurrenciesMap := make(map[string]struct{}) + if len(currenciesString) > 0 { + for _, c := range strings.Split(strings.ToLower(currenciesString), ",") { + allowedVsCurrenciesMap[c] = struct{}{} + } } + return allowedVsCurrenciesMap +} - req, err := http.NewRequest("GET", requestURL, nil) +// doReq HTTP client +func doReq(req *http.Request, client *http.Client) ([]byte, error) { + resp, err := client.Do(req) if err != nil { - glog.Errorf("Error creating a new request for %v: %v", requestURL, err) return nil, err } - req.Close = true - req.Header.Set("Content-Type", "application/json") + defer resp.Body.Close() + body, err := io.ReadAll(resp.Body) + if err != nil { + return nil, err + } + if resp.StatusCode != 200 { + return nil, fmt.Errorf("%s", body) + } + return body, nil +} - // Add query parameters - q := req.URL.Query() +// makeReq HTTP request helper - will retry the call after 1 minute on error +func (cg *Coingecko) makeReq(url string, endpoint string) ([]byte, error) { + for { + // glog.Infof("Coingecko makeReq %v", url) + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return nil, err + } + req.Header.Set("Content-Type", "application/json") + if cg.apiKey != "" { + req.Header.Set("x-cg-pro-api-key", cg.apiKey) + } + resp, err := doReq(req, cg.httpClient) + if err == nil { + if cg.metrics != nil { + cg.metrics.CoingeckoRequests.With(common.Labels{"endpoint": endpoint, "status": "success"}).Inc() + } + return resp, err + } + if err.Error() != "error code: 1015" && !strings.Contains(strings.ToLower(err.Error()), "exceeded the rate limit") && !strings.Contains(strings.ToLower(err.Error()), "throttled") { + if cg.metrics != nil { + cg.metrics.CoingeckoRequests.With(common.Labels{"endpoint": endpoint, "status": "error"}).Inc() + } + glog.Errorf("Coingecko makeReq %v error %v", url, err) + return nil, err + } + if cg.metrics != nil { + cg.metrics.CoingeckoRequests.With(common.Labels{"endpoint": endpoint, "status": "throttle"}).Inc() + } + // if there is a throttling error, wait 60 seconds and retry + glog.Warningf("Coingecko makeReq %v error %v, will retry in 60 seconds", url, err) + time.Sleep(60 * time.Second) + } +} - // Add a unix timestamp to query parameters to get uncached responses - currentTimestamp := strconv.FormatInt(time.Now().UTC().UnixNano(), 10) - q.Add("current_timestamp", currentTimestamp) +// SimpleSupportedVSCurrencies /simple/supported_vs_currencies +func (cg *Coingecko) simpleSupportedVSCurrencies() (simpleSupportedVSCurrencies, error) { + url := cg.url + "/simple/supported_vs_currencies" + resp, err := cg.makeReq(url, "supported_vs_currencies") + if err != nil { + return nil, err + } + var data simpleSupportedVSCurrencies + err = json.Unmarshal(resp, &data) + if err != nil { + return nil, err + } + if len(cg.allowedVsCurrencies) == 0 { + return data, nil + } + filtered := make([]string, 0, len(cg.allowedVsCurrencies)) + for _, c := range data { + if _, found := cg.allowedVsCurrencies[c]; found { + filtered = append(filtered, c) + } + } + return filtered, nil +} - if timestamp == nil { - q.Add("market_data", "true") - q.Add("localization", "false") - q.Add("tickers", "false") - q.Add("community_data", "false") - q.Add("developer_data", "false") - } else { - timestampFormatted := timestamp.Format(cg.timeFormat) - q.Add("date", timestampFormatted) +// SimplePrice /simple/price Multiple ID and Currency (ids, vs_currencies) +func (cg *Coingecko) simplePrice(ids []string, vsCurrencies []string) (*map[string]map[string]float32, error) { + params := url.Values{} + idsParam := strings.Join(ids, ",") + vsCurrenciesParam := strings.Join(vsCurrencies, ",") + + params.Add("ids", idsParam) + params.Add("vs_currencies", vsCurrenciesParam) + + url := fmt.Sprintf("%s/simple/price?%s", cg.url, params.Encode()) + resp, err := cg.makeReq(url, "simple/price") + if err != nil { + return nil, err } - req.URL.RawQuery = q.Encode() - client := &http.Client{ - Timeout: cg.httpTimeoutSeconds, + t := make(map[string]map[string]float32) + err = json.Unmarshal(resp, &t) + if err != nil { + return nil, err } - resp, err := client.Do(req) + + return &t, nil +} + +// CoinsList /coins/list +func (cg *Coingecko) coinsList() (coinList, error) { + params := url.Values{} + platform := "false" + if cg.platformIdentifier != "" { + platform = "true" + } + params.Add("include_platform", platform) + url := fmt.Sprintf("%s/coins/list?%s", cg.url, params.Encode()) + resp, err := cg.makeReq(url, "coins/list") if err != nil { return nil, err } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - return nil, errors.New("Invalid response status: " + string(resp.Status)) + + var data coinList + err = json.Unmarshal(resp, &data) + if err != nil { + return nil, err + } + return data, nil +} + +// coinMarketChart /coins/{id}/market_chart?vs_currency={usd, eur, jpy, etc.}&days={1,14,30,max} +func (cg *Coingecko) coinMarketChart(id string, vs_currency string, days string, daily bool) (*marketChartPrices, error) { + if len(id) == 0 || len(vs_currency) == 0 || len(days) == 0 { + return nil, fmt.Errorf("id, vs_currency, and days is required") } - bodyBytes, err := ioutil.ReadAll(resp.Body) + + params := url.Values{} + if daily { + params.Add("interval", "daily") + } + params.Add("vs_currency", vs_currency) + params.Add("days", days) + + url := fmt.Sprintf("%s/coins/%s/market_chart?%s", cg.url, id, params.Encode()) + resp, err := cg.makeReq(url, "market_chart") if err != nil { return nil, err } - return bodyBytes, nil + + m := marketChartPrices{} + err = json.Unmarshal(resp, &m) + if err != nil { + return &m, err + } + + return &m, nil } -// GetData gets fiat rates from API at the specified date and returns a CurrencyRatesTicker -// If timestamp is nil, it will download the current fiat rates. -func (cg *Coingecko) getTicker(timestamp *time.Time) (*db.CurrencyRatesTicker, error) { - dataTimestamp := timestamp - if timestamp == nil { - timeNow := time.Now() - dataTimestamp = &timeNow +var vsCurrencies []string +var platformIds []string +var platformIdsToTokens map[string]string + +func (cg *Coingecko) platformIds() error { + if cg.platformIdentifier == "" { + return nil } - dataTimestampUTC := dataTimestamp.UTC() - ticker := &db.CurrencyRatesTicker{Timestamp: &dataTimestampUTC} - bodyBytes, err := cg.makeRequest(timestamp) + cl, err := cg.coinsList() if err != nil { + return err + } + idsMap := make(map[string]string, 64) + ids := make([]string, 0, 64) + for i := range cl { + id, found := cl[i].Platforms[cg.platformIdentifier] + if found && id != "" { + idsMap[cl[i].ID] = id + ids = append(ids, cl[i].ID) + } + } + platformIds = ids + platformIdsToTokens = idsMap + return nil +} + +// CurrentTickers returns the latest exchange rates +func (cg *Coingecko) CurrentTickers() (*common.CurrencyRatesTicker, error) { + cg.updatingCurrent = true + defer func() { cg.updatingCurrent = false }() + + var newTickers = common.CurrencyRatesTicker{} + + if vsCurrencies == nil { + vs, err := cg.simpleSupportedVSCurrencies() + if err != nil { + return nil, err + } + vsCurrencies = vs + } + prices, err := cg.simplePrice([]string{cg.coin}, vsCurrencies) + if err != nil || prices == nil { return nil, err } + newTickers.Rates = make(map[string]float32, len((*prices)[cg.coin])) + for t, v := range (*prices)[cg.coin] { + newTickers.Rates[t] = v + } - type FiatRatesResponse struct { - MarketData struct { - Prices map[string]float64 `json:"current_price"` - } `json:"market_data"` + if cg.platformIdentifier != "" && cg.platformVsCurrency != "" { + if platformIdsToTokens == nil { + err = cg.platformIds() + if err != nil { + return nil, err + } + } + newTickers.TokenRates = make(map[string]float32) + from := 0 + const maxRequestLen = 6000 + requestLen := 0 + for to := 0; to < len(platformIds); to++ { + requestLen += len(platformIds[to]) + 3 // 3 characters for the comma separator %2C + if requestLen > maxRequestLen || to+1 >= len(platformIds) { + tokenPrices, err := cg.simplePrice(platformIds[from:to+1], []string{cg.platformVsCurrency}) + if err != nil || tokenPrices == nil { + return nil, err + } + for id, v := range *tokenPrices { + t, found := platformIdsToTokens[id] + if found { + newTickers.TokenRates[t] = v[cg.platformVsCurrency] + } + } + from = to + 1 + requestLen = 0 + } + } } + newTickers.Timestamp = time.Now().UTC() + return &newTickers, nil +} - var data FiatRatesResponse - err = json.Unmarshal(bodyBytes, &data) +func (cg *Coingecko) getHighGranularityTickers(days string) (*[]common.CurrencyRatesTicker, error) { + mc, err := cg.coinMarketChart(cg.coin, highGranularityVsCurrency, days, false) if err != nil { - glog.Errorf("Error parsing FiatRates response: %v", err) return nil, err } - ticker.Rates = data.MarketData.Prices - return ticker, nil + if len(mc.Prices) < 2 { + return nil, nil + } + // ignore the last point, it is not in granularity + tickers := make([]common.CurrencyRatesTicker, len(mc.Prices)-1) + for i, p := range mc.Prices[:len(mc.Prices)-1] { + var timestamp uint + timestamp = uint(p[0]) + if timestamp > 100000000000 { + // convert timestamp from milliseconds to seconds + timestamp /= 1000 + } + rate := float32(p[1]) + u := time.Unix(int64(timestamp), 0).UTC() + ticker := common.CurrencyRatesTicker{ + Timestamp: u, + Rates: make(map[string]float32), + } + ticker.Rates[highGranularityVsCurrency] = rate + tickers[i] = ticker + } + return &tickers, nil +} + +// HourlyTickers returns the array of the exchange rates in hourly granularity +func (cg *Coingecko) HourlyTickers() (*[]common.CurrencyRatesTicker, error) { + return cg.getHighGranularityTickers("90") } -// MarketDataExists checks if there's data available for the specific timestamp. -func (cg *Coingecko) marketDataExists(timestamp *time.Time) (bool, error) { - resp, err := cg.makeRequest(timestamp) +// FiveMinutesTickers returns the array of the exchange rates in five minutes granularity +func (cg *Coingecko) FiveMinutesTickers() (*[]common.CurrencyRatesTicker, error) { + return cg.getHighGranularityTickers("1") +} + +func (cg *Coingecko) getHistoricalTicker(tickersToUpdate map[uint]*common.CurrencyRatesTicker, coinId string, vsCurrency string, token string) (bool, error) { + lastTicker, err := cg.db.FiatRatesFindLastTicker(vsCurrency, token) if err != nil { - glog.Error("Error getting market data: ", err) return false, err } - type FiatRatesResponse struct { - MarketData struct { - Prices map[string]interface{} `json:"current_price"` - } `json:"market_data"` + var days string + if lastTicker == nil { + days = "max" + } else { + diff := time.Since(lastTicker.Timestamp) + d := int(diff / (24 * 3600 * 1000000000)) + if d == 0 { // nothing to do, the last ticker exist + return false, nil + } + days = strconv.Itoa(d) } - var data FiatRatesResponse - err = json.Unmarshal(resp, &data) + mc, err := cg.coinMarketChart(coinId, vsCurrency, days, true) if err != nil { - glog.Errorf("Error parsing Coingecko response: %v", err) return false, err } - return len(data.MarketData.Prices) != 0, nil + warningLogged := false + for _, p := range mc.Prices { + var timestamp uint + timestamp = uint(p[0]) + if timestamp > 100000000000 { + // convert timestamp from milliseconds to seconds + timestamp /= 1000 + } + rate := float32(p[1]) + if timestamp%(24*3600) == 0 && timestamp != 0 && rate != 0 { // process only tickers for the whole day with non 0 value + var found bool + var ticker *common.CurrencyRatesTicker + if ticker, found = tickersToUpdate[timestamp]; !found { + u := time.Unix(int64(timestamp), 0).UTC() + ticker, err = cg.db.FiatRatesGetTicker(&u) + if err != nil { + return false, err + } + if ticker == nil { + if token != "" { // if the base currency is not found in DB, do not create ticker for the token + if !warningLogged { + glog.Warningf("No base currency ticker for date %v for token %s", u, token) + warningLogged = true + } + continue + } + ticker = &common.CurrencyRatesTicker{ + Timestamp: u, + Rates: make(map[string]float32), + } + } + tickersToUpdate[timestamp] = ticker + } + if token == "" { + ticker.Rates[vsCurrency] = rate + } else { + if ticker.TokenRates == nil { + ticker.TokenRates = make(map[string]float32) + } + ticker.TokenRates[token] = rate + } + } + } + return true, nil +} + +func (cg *Coingecko) storeTickers(tickersToUpdate map[uint]*common.CurrencyRatesTicker) error { + if len(tickersToUpdate) > 0 { + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + for _, v := range tickersToUpdate { + if err := cg.db.FiatRatesStoreTicker(wb, v); err != nil { + return err + } + } + if err := cg.db.WriteBatch(wb); err != nil { + return err + } + } + return nil +} + +func (cg *Coingecko) throttleHistoricalDownload() { + // long delay next request to avoid throttling if downloading current tickers at the same time + delay := 1 + if cg.updatingCurrent { + delay = 600 + } + time.Sleep(cg.throttlingDelay * time.Duration(delay)) +} + +// UpdateHistoricalTickers gets historical tickers for the main crypto currency +func (cg *Coingecko) UpdateHistoricalTickers() error { + tickersToUpdate := make(map[uint]*common.CurrencyRatesTicker) + + // reload vs_currencies + vs, err := cg.simpleSupportedVSCurrencies() + if err != nil { + return err + } + vsCurrencies = vs + + for _, currency := range vsCurrencies { + // get historical rates for each currency + var err error + var req bool + if req, err = cg.getHistoricalTicker(tickersToUpdate, cg.coin, currency, ""); err != nil { + // report error and continue, Coingecko may return error like "Could not find coin with the given id" + // the rates will be updated next run + glog.Errorf("getHistoricalTicker %s-%s %v", cg.coin, currency, err) + } + if req { + cg.throttleHistoricalDownload() + } + } + + return cg.storeTickers(tickersToUpdate) +} + +// UpdateHistoricalTokenTickers gets historical tickers for the tokens +func (cg *Coingecko) UpdateHistoricalTokenTickers() error { + if cg.updatingTokens { + return nil + } + cg.updatingTokens = true + defer func() { cg.updatingTokens = false }() + tickersToUpdate := make(map[uint]*common.CurrencyRatesTicker) + + if cg.platformIdentifier != "" && cg.platformVsCurrency != "" { + // reload platform ids + if err := cg.platformIds(); err != nil { + return err + } + glog.Infof("Coingecko returned %d %s tokens ", len(platformIds), cg.coin) + count := 0 + // get token historical rates + for tokenId, token := range platformIdsToTokens { + var err error + var req bool + if req, err = cg.getHistoricalTicker(tickersToUpdate, tokenId, cg.platformVsCurrency, token); err != nil { + // report error and continue, Coingecko may return error like "Could not find coin with the given id" + // the rates will be updated next run + glog.Errorf("getHistoricalTicker %s-%s %v", tokenId, cg.platformVsCurrency, err) + } + count++ + if count%100 == 0 { + err := cg.storeTickers(tickersToUpdate) + if err != nil { + return err + } + tickersToUpdate = make(map[uint]*common.CurrencyRatesTicker) + glog.Infof("Coingecko updated %d of %d token tickers", count, len(platformIds)) + } + if req { + cg.throttleHistoricalDownload() + } + } + } + + return cg.storeTickers(tickersToUpdate) } diff --git a/fiat/fiat_rates.go b/fiat/fiat_rates.go index dcc0c85ac5..8a2d4bd464 100644 --- a/fiat/fiat_rates.go +++ b/fiat/fiat_rates.go @@ -4,211 +4,480 @@ import ( "encoding/json" "errors" "fmt" - "reflect" + "math/rand" + "strings" + "sync" "time" "github.com/golang/glog" + "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" ) +const currentTickersKey = "CurrentTickers" +const hourlyTickersKey = "HourlyTickers" +const fiveMinutesTickersKey = "FiveMinutesTickers" + +const highGranularityVsCurrency = "usd" + +const secondsInDay = 24 * 60 * 60 +const secondsInHour = 60 * 60 +const secondsInFiveMinutes = 5 * 60 + // OnNewFiatRatesTicker is used to send notification about a new FiatRates ticker -type OnNewFiatRatesTicker func(ticker *db.CurrencyRatesTicker) +type OnNewFiatRatesTicker func(ticker *common.CurrencyRatesTicker) -// RatesDownloaderInterface provides method signatures for specific fiat rates downloaders +// RatesDownloaderInterface provides method signatures for a specific fiat rates downloader type RatesDownloaderInterface interface { - getTicker(timestamp *time.Time) (*db.CurrencyRatesTicker, error) - marketDataExists(timestamp *time.Time) (bool, error) + CurrentTickers() (*common.CurrencyRatesTicker, error) + HourlyTickers() (*[]common.CurrencyRatesTicker, error) + FiveMinutesTickers() (*[]common.CurrencyRatesTicker, error) + UpdateHistoricalTickers() error + UpdateHistoricalTokenTickers() error } -// RatesDownloader stores FiatRates API parameters -type RatesDownloader struct { - periodSeconds time.Duration - db *db.RocksDB - startTime *time.Time // a starting timestamp for tests to be deterministic (time.Now() for production) - timeFormat string - callbackOnNewTicker OnNewFiatRatesTicker - downloader RatesDownloaderInterface +// FiatRates is used to fetch and refresh fiat rates +type FiatRates struct { + Enabled bool + periodSeconds int64 + db *db.RocksDB + timeFormat string + callbackOnNewTicker OnNewFiatRatesTicker + downloader RatesDownloaderInterface + downloadTokens bool + provider string + allowedVsCurrencies string + mux sync.RWMutex + currentTicker *common.CurrencyRatesTicker + hourlyTickers map[int64]*common.CurrencyRatesTicker + hourlyTickersFrom int64 + hourlyTickersTo int64 + fiveMinutesTickers map[int64]*common.CurrencyRatesTicker + fiveMinutesTickersFrom int64 + fiveMinutesTickersTo int64 + dailyTickers map[int64]*common.CurrencyRatesTicker + dailyTickersFrom int64 + dailyTickersTo int64 } -// NewFiatRatesDownloader initiallizes the downloader for FiatRates API. -// If the startTime is nil, the downloader will start from the beginning. -func NewFiatRatesDownloader(db *db.RocksDB, apiType string, params string, startTime *time.Time, callback OnNewFiatRatesTicker) (*RatesDownloader, error) { - var rd = &RatesDownloader{} +// NewFiatRates initializes the FiatRates handler +func NewFiatRates(db *db.RocksDB, config *common.Config, metrics *common.Metrics, callback OnNewFiatRatesTicker) (*FiatRates, error) { + + var fr = &FiatRates{ + provider: config.FiatRates, + allowedVsCurrencies: config.FiatRatesVsCurrencies, + } + + if config.FiatRates == "" || config.FiatRatesParams == "" { + glog.Infof("FiatRates config is empty, not downloading fiat rates") + fr.Enabled = false + return fr, nil + } + type fiatRatesParams struct { - URL string `json:"url"` - Coin string `json:"coin"` - PeriodSeconds int `json:"periodSeconds"` + URL string `json:"url"` + Coin string `json:"coin"` + PlatformIdentifier string `json:"platformIdentifier"` + PlatformVsCurrency string `json:"platformVsCurrency"` + PeriodSeconds int64 `json:"periodSeconds"` } rdParams := &fiatRatesParams{} - err := json.Unmarshal([]byte(params), &rdParams) + err := json.Unmarshal([]byte(config.FiatRatesParams), &rdParams) if err != nil { return nil, err } - if rdParams.URL == "" || rdParams.PeriodSeconds == 0 { - return nil, errors.New("Missing parameters") + if rdParams.PeriodSeconds == 0 { + return nil, errors.New("missing parameters") } - rd.timeFormat = "02-01-2006" // Layout string for FiatRates date formatting (DD-MM-YYYY) - rd.periodSeconds = time.Duration(rdParams.PeriodSeconds) * time.Second // Time period for syncing the latest market data - rd.db = db - rd.callbackOnNewTicker = callback - if startTime == nil { - timeNow := time.Now().UTC() - rd.startTime = &timeNow - } else { - rd.startTime = startTime // If startTime is nil, time.Now() will be used + fr.timeFormat = "02-01-2006" // Layout string for FiatRates date formatting (DD-MM-YYYY) + fr.periodSeconds = rdParams.PeriodSeconds // Time period for syncing the latest market data + if fr.periodSeconds < 60 { // minimum is one minute + fr.periodSeconds = 60 } - if apiType == "coingecko" { - rd.downloader = NewCoinGeckoDownloader(rdParams.URL, rdParams.Coin, rd.timeFormat) - } else { - return nil, fmt.Errorf("NewFiatRatesDownloader: incorrect API type %q", apiType) + fr.db = db + fr.callbackOnNewTicker = callback + fr.downloadTokens = rdParams.PlatformIdentifier != "" && rdParams.PlatformVsCurrency != "" + if fr.downloadTokens { + common.TickerRecalculateTokenRate = strings.ToLower(db.GetInternalState().CoinShortcut) != rdParams.PlatformVsCurrency + common.TickerTokenVsCurrency = rdParams.PlatformVsCurrency } - return rd, nil -} + is := fr.db.GetInternalState() + if fr.provider == "coingecko" { + throttle := true + if callback == nil { + // a small hack - in tests the callback is not used, therefore there is no delay slowing down the test + throttle = false + } + fr.downloader = NewCoinGeckoDownloader(db, db.GetInternalState().GetNetwork(), rdParams.URL, rdParams.Coin, rdParams.PlatformIdentifier, rdParams.PlatformVsCurrency, fr.allowedVsCurrencies, fr.timeFormat, metrics, throttle) + if is != nil { + is.HasFiatRates = true + is.HasTokenFiatRates = fr.downloadTokens + fr.Enabled = true -// Run starts the FiatRates downloader. If there are tickers available, it continues from the last record. -// If there are no tickers, it finds the earliest market data available on API and downloads historical data. -// When historical data is downloaded, it continues to fetch the latest ticker prices. -func (rd *RatesDownloader) Run() error { - var timestamp *time.Time + if err := fr.loadDailyTickers(); err != nil { + return nil, err + } - // Check if there are any tickers stored in database - glog.Infof("Finding last available ticker...") - ticker, err := rd.db.FiatRatesFindLastTicker() - if err != nil { - glog.Errorf("RatesDownloader FindTicker error: %v", err) - return err - } + currentTickers, err := db.FiatRatesGetSpecialTickers(currentTickersKey) + if err != nil { + glog.Error("FiatRatesDownloader: get CurrentTickers from DB error ", err) + } + if currentTickers != nil && len(*currentTickers) > 0 { + fr.currentTicker = &(*currentTickers)[0] + } + + hourlyTickers, err := db.FiatRatesGetSpecialTickers(hourlyTickersKey) + if err != nil { + glog.Error("FiatRatesDownloader: get HourlyTickers from DB error ", err) + } + fr.hourlyTickers, fr.hourlyTickersFrom, fr.hourlyTickersTo = fr.tickersToMap(hourlyTickers, secondsInHour) + + fiveMinutesTickers, err := db.FiatRatesGetSpecialTickers(fiveMinutesTickersKey) + if err != nil { + glog.Error("FiatRatesDownloader: get FiveMinutesTickers from DB error ", err) + } + fr.fiveMinutesTickers, fr.fiveMinutesTickersFrom, fr.fiveMinutesTickersTo = fr.tickersToMap(fiveMinutesTickers, secondsInFiveMinutes) - if ticker == nil { - // If no tickers found, start downloading from the beginning - glog.Infof("No tickers found! Looking up the earliest market data available on API and downloading from there.") - timestamp, err = rd.findEarliestMarketData() - if err != nil { - glog.Errorf("Error looking up earliest market data: %v", err) - return err } } else { - // If found, continue downloading data from the next day of the last available record - glog.Infof("Last available ticker: %v", ticker.Timestamp) - timestamp = ticker.Timestamp - } - err = rd.syncHistorical(timestamp) - if err != nil { - glog.Errorf("RatesDownloader syncHistorical error: %v", err) - return err + return nil, fmt.Errorf("unknown provider %q", fr.provider) } - if err := rd.syncLatest(); err != nil { - glog.Errorf("RatesDownloader syncLatest error: %v", err) - return err + fr.logTickersInfo() + return fr, nil +} + +// GetCurrentTicker returns current ticker +func (fr *FiatRates) GetCurrentTicker(vsCurrency string, token string) *common.CurrencyRatesTicker { + fr.mux.RLock() + currentTicker := fr.currentTicker + fr.mux.RUnlock() + if currentTicker != nil && common.IsSuitableTicker(currentTicker, vsCurrency, token) { + return currentTicker } return nil } -// FindEarliestMarketData uses binary search to find the oldest market data available on API. -func (rd *RatesDownloader) findEarliestMarketData() (*time.Time, error) { - minDateString := "03-01-2009" - minDate, err := time.Parse(rd.timeFormat, minDateString) - if err != nil { - glog.Error("Error parsing date: ", err) - return nil, err +// getTokenTickersForTimestamps returns tickers for slice of timestamps, that contain requested vsCurrency and token +func (fr *FiatRates) getTokenTickersForTimestamps(timestamps []int64, vsCurrency string, token string) (*[]*common.CurrencyRatesTicker, error) { + currentTicker := fr.GetCurrentTicker("", token) + tickers := make([]*common.CurrencyRatesTicker, len(timestamps)) + var prevTicker *common.CurrencyRatesTicker + var prevTs int64 + var err error + for i, t := range timestamps { + // check if the token is available in the current ticker - if not, return nil ticker instead of wasting time in costly DB searches + if currentTicker != nil { + var ticker *common.CurrencyRatesTicker + date := time.Unix(t, 0) + // if previously found ticker is newer than this one (token tickers may not be in DB for every day), skip search in DB + if prevTicker != nil && t >= prevTs && !date.After(prevTicker.Timestamp) { + ticker = prevTicker + prevTs = t + } else { + ticker, err = fr.db.FiatRatesFindTicker(&date, vsCurrency, token) + if err != nil { + return nil, err + } + prevTicker = ticker + prevTs = t + } + // if ticker not found in DB, use current ticker + if ticker == nil { + tickers[i] = currentTicker + prevTicker = currentTicker + prevTs = t + } else { + tickers[i] = ticker + } + } } - maxDate := rd.startTime.Add(time.Duration(-24) * time.Hour) // today's historical tickers may not be ready yet, so set to yesterday - currentDate := maxDate - for { - var dataExists bool = false - for { - dataExists, err = rd.downloader.marketDataExists(¤tDate) - if err != nil { - glog.Errorf("Error checking if market data exists for date %v. Error: %v. Retrying in %v seconds.", currentDate, err, rd.periodSeconds) - timer := time.NewTimer(rd.periodSeconds) - <-timer.C + return &tickers, nil +} + +// GetTickersForTimestamps returns tickers for slice of timestamps, that contain requested vsCurrency and token +func (fr *FiatRates) GetTickersForTimestamps(timestamps []int64, vsCurrency string, token string) (*[]*common.CurrencyRatesTicker, error) { + if !fr.Enabled { + return nil, nil + } + // token rates are not in memory, them load from DB + if token != "" { + return fr.getTokenTickersForTimestamps(timestamps, vsCurrency, token) + } + fr.mux.RLock() + defer fr.mux.RUnlock() + tickers := make([]*common.CurrencyRatesTicker, len(timestamps)) + var prevTicker *common.CurrencyRatesTicker + var prevTs int64 + for i, t := range timestamps { + dailyTs := ceilUnix(t, secondsInDay) + // use higher granularity only for non daily timestamps + if t != dailyTs { + if t >= fr.fiveMinutesTickersFrom && t <= fr.fiveMinutesTickersTo { + if ticker, found := fr.fiveMinutesTickers[ceilUnix(t, secondsInFiveMinutes)]; found && ticker != nil { + if common.IsSuitableTicker(ticker, vsCurrency, token) { + tickers[i] = ticker + continue + } + } + } + if t >= fr.hourlyTickersFrom && t <= fr.hourlyTickersTo { + if ticker, found := fr.hourlyTickers[ceilUnix(t, secondsInHour)]; found && ticker != nil { + if common.IsSuitableTicker(ticker, vsCurrency, token) { + tickers[i] = ticker + continue + } + } } - break } - dateDiff := currentDate.Sub(minDate) - if dataExists { - if dateDiff < time.Hour*24 { - maxDate := time.Date(maxDate.Year(), maxDate.Month(), maxDate.Day(), 0, 0, 0, 0, maxDate.Location()) // truncate time to day - return &maxDate, nil - } - maxDate = currentDate - currentDate = currentDate.Add(-1 * dateDiff / 2) + if prevTicker != nil && t >= prevTs && t <= prevTicker.Timestamp.Unix() { + tickers[i] = prevTicker + continue } else { - minDate = currentDate - currentDate = currentDate.Add(maxDate.Sub(currentDate) / 2) + var found bool + if dailyTs < fr.dailyTickersFrom { + dailyTs = fr.dailyTickersFrom + } + var ticker *common.CurrencyRatesTicker + for ; dailyTs <= fr.dailyTickersTo; dailyTs += secondsInDay { + if ticker, found = fr.dailyTickers[dailyTs]; found && ticker != nil { + if common.IsSuitableTicker(ticker, vsCurrency, token) { + tickers[i] = ticker + prevTicker = ticker + prevTs = t + break + } else { + found = false + } + } + } + if !found { + tickers[i] = fr.currentTicker + prevTicker = fr.currentTicker + prevTs = t + } } } + return &tickers, nil +} +func (fr *FiatRates) logTickersInfo() { + glog.Infof("fiat rates %s handler, %d (%s - %s) daily tickers, %d (%s - %s) hourly tickers, %d (%s - %s) 5 minute tickers", fr.provider, + len(fr.dailyTickers), time.Unix(fr.dailyTickersFrom, 0).Format("2006-01-02"), time.Unix(fr.dailyTickersTo, 0).Format("2006-01-02"), + len(fr.hourlyTickers), time.Unix(fr.hourlyTickersFrom, 0).Format("2006-01-02 15:04"), time.Unix(fr.hourlyTickersTo, 0).Format("2006-01-02 15:04"), + len(fr.fiveMinutesTickers), time.Unix(fr.fiveMinutesTickersFrom, 0).Format("2006-01-02 15:04"), time.Unix(fr.fiveMinutesTickersTo, 0).Format("2006-01-02 15:04")) } -// syncLatest downloads the latest FiatRates data every rd.PeriodSeconds -func (rd *RatesDownloader) syncLatest() error { - timer := time.NewTimer(rd.periodSeconds) - var lastTickerRates map[string]float64 - sameTickerCounter := 0 - for { - ticker, err := rd.downloader.getTicker(nil) - if err != nil { - // Do not exit on GET error, log it, wait and try again - glog.Errorf("syncLatest GetData error: %v", err) - <-timer.C - timer.Reset(rd.periodSeconds) - continue +func roundTimeUnix(t time.Time, granularity int64) int64 { + return roundUnix(t.UTC().Unix(), granularity) +} + +func roundUnix(t int64, granularity int64) int64 { + unix := t + (granularity >> 1) + return unix - unix%granularity +} + +func ceilUnix(t int64, granularity int64) int64 { + unix := t + (granularity - 1) + return unix - unix%granularity +} + +// loadDailyTickers loads daily tickers to cache +func (fr *FiatRates) loadDailyTickers() error { + fr.mux.Lock() + defer fr.mux.Unlock() + fr.dailyTickers = make(map[int64]*common.CurrencyRatesTicker) + err := fr.db.FiatRatesGetAllTickers(func(ticker *common.CurrencyRatesTicker) error { + normalizedTime := roundTimeUnix(ticker.Timestamp, secondsInDay) + if normalizedTime == fr.dailyTickersFrom { + // there are multiple tickers on the first day, use only the first one + return nil + } + // remove token rates from cache to save memory (tickers with token rates are hundreds of kb big) + ticker.TokenRates = nil + if len(fr.dailyTickers) > 0 { + // check that there is a ticker for every day, if missing, set it from current value if missing + prevTime := normalizedTime + for { + prevTime -= secondsInDay + if _, found := fr.dailyTickers[prevTime]; found { + break + } + fr.dailyTickers[prevTime] = ticker + } + } else { + fr.dailyTickersFrom = normalizedTime } + fr.dailyTickers[normalizedTime] = ticker + fr.dailyTickersTo = normalizedTime + return nil + }) + return err +} - if sameTickerCounter < 5 && reflect.DeepEqual(ticker.Rates, lastTickerRates) { - // If rates are the same as previous, do not store them - glog.Infof("syncLatest: ticker rates for %v are the same as previous, skipping...", ticker.Timestamp) - <-timer.C - timer.Reset(rd.periodSeconds) - sameTickerCounter++ - continue +// setCurrentTicker sets current ticker +func (fr *FiatRates) setCurrentTicker(t *common.CurrencyRatesTicker) { + fr.mux.Lock() + defer fr.mux.Unlock() + fr.currentTicker = t + fr.db.FiatRatesStoreSpecialTickers(currentTickersKey, &[]common.CurrencyRatesTicker{*t}) +} + +func (fr *FiatRates) tickersToMap(tickers *[]common.CurrencyRatesTicker, granularitySeconds int64) (map[int64]*common.CurrencyRatesTicker, int64, int64) { + if tickers == nil || len(*tickers) == 0 { + return make(map[int64]*common.CurrencyRatesTicker), 0, 0 + } + m := make(map[int64]*common.CurrencyRatesTicker, len(*tickers)) + from := int64(0) + to := int64(0) + for i := range *tickers { + ticker := (*tickers)[i] + normalizedTime := roundTimeUnix(ticker.Timestamp, granularitySeconds) + dailyTime := roundTimeUnix(ticker.Timestamp, secondsInDay) + dailyTicker, found := fr.dailyTickers[dailyTime] + if !found { + // if not found in historical tickers, use current ticker + dailyTicker = fr.currentTicker + } + if dailyTicker != nil { + // high granularity tickers are loaded only in one currency, add other currencies based on daily rate between fiat currencies + vsRate, foundVs := ticker.Rates[highGranularityVsCurrency] + dailyVsRate, foundDaily := dailyTicker.Rates[highGranularityVsCurrency] + if foundDaily && dailyVsRate != 0 && foundVs && vsRate != 0 { + for currency, rate := range dailyTicker.Rates { + if currency != highGranularityVsCurrency { + ticker.Rates[currency] = vsRate * rate / dailyVsRate + } + } + } } - lastTickerRates = ticker.Rates - sameTickerCounter = 0 - - glog.Infof("syncLatest: storing ticker for %v", ticker.Timestamp) - err = rd.db.FiatRatesStoreTicker(ticker) - if err != nil { - // If there's an error storing ticker (like missing rates), log it, wait and try again - glog.Errorf("syncLatest StoreTicker error: %v", err) - } else if rd.callbackOnNewTicker != nil { - rd.callbackOnNewTicker(ticker) + if len(m) > 0 { + if normalizedTime == from { + // there are multiple normalized tickers for the first entry, skip + continue + } + // check that there is a ticker for each period, set it from current value if missing + prevTime := normalizedTime + for { + prevTime -= granularitySeconds + if _, found := m[prevTime]; found { + break + } + m[prevTime] = &ticker + } + } else { + from = normalizedTime } - <-timer.C - timer.Reset(rd.periodSeconds) + m[normalizedTime] = &ticker + to = normalizedTime } + return m, from, to +} + +// setHourlyTickers sets hourly tickers +func (fr *FiatRates) setHourlyTickers(t *[]common.CurrencyRatesTicker) { + fr.db.FiatRatesStoreSpecialTickers(hourlyTickersKey, t) + fr.mux.Lock() + defer fr.mux.Unlock() + fr.hourlyTickers, fr.hourlyTickersFrom, fr.hourlyTickersTo = fr.tickersToMap(t, secondsInHour) +} + +// setFiveMinutesTickers sets five minutes tickers +func (fr *FiatRates) setFiveMinutesTickers(t *[]common.CurrencyRatesTicker) { + fr.db.FiatRatesStoreSpecialTickers(fiveMinutesTickersKey, t) + fr.mux.Lock() + defer fr.mux.Unlock() + fr.fiveMinutesTickers, fr.fiveMinutesTickersFrom, fr.fiveMinutesTickersTo = fr.tickersToMap(t, secondsInFiveMinutes) } -// syncHistorical downloads all the historical data since the specified timestamp till today, -// then continues to download the latest rates -func (rd *RatesDownloader) syncHistorical(timestamp *time.Time) error { - period := time.Duration(1) * time.Second - timer := time.NewTimer(period) +// RunDownloader periodically downloads current (every 15 minutes) and historical (once a day) tickers +func (fr *FiatRates) RunDownloader() error { + glog.Infof("Starting %v FiatRates downloader...", fr.provider) + var lastHistoricalTickers time.Time + is := fr.db.GetInternalState() + tickerFromIs := fr.GetCurrentTicker("", "") + firstRun := true for { - if rd.startTime.Sub(*timestamp) < time.Duration(time.Hour*24) { - break + unix := time.Now().Unix() + next := unix + fr.periodSeconds + next -= next % fr.periodSeconds + // skip waiting for the period for the first run if there are no tickerFromIs or they are too old + if !firstRun || (tickerFromIs != nil && next-tickerFromIs.Timestamp.Unix() < fr.periodSeconds) { + // wait for the next run with a slight random value to avoid too many request at the same time + next += int64(rand.Intn(3)) + time.Sleep(time.Duration(next-unix) * time.Second) } + firstRun = false - ticker, err := rd.downloader.getTicker(timestamp) - if err != nil { - // Do not exit on GET error, log it, wait and try again - glog.Errorf("syncHistorical GetData error: %v", err) - <-timer.C - timer.Reset(rd.periodSeconds) - continue + // load current tickers + currentTicker, err := fr.downloader.CurrentTickers() + if err != nil || currentTicker == nil { + glog.Error("FiatRatesDownloader: CurrentTickers error ", err) + } else { + fr.setCurrentTicker(currentTicker) + glog.Info("FiatRatesDownloader: CurrentTickers updated") + if fr.callbackOnNewTicker != nil { + fr.callbackOnNewTicker(currentTicker) + } } - glog.Infof("syncHistorical: storing ticker for %v", ticker.Timestamp) - err = rd.db.FiatRatesStoreTicker(ticker) - if err != nil { - // If there's an error storing ticker (like missing rates), log it and continue to the next day - glog.Errorf("syncHistorical error storing ticker for %v: %v", timestamp, err) + // load hourly tickers, it is necessary to wait about 1 hour to prepare the tickers + if time.Now().UTC().Unix() >= fr.hourlyTickersTo+secondsInHour+secondsInHour { + hourlyTickers, err := fr.downloader.HourlyTickers() + if err != nil || hourlyTickers == nil { + glog.Error("FiatRatesDownloader: HourlyTickers error ", err) + } else { + fr.setHourlyTickers(hourlyTickers) + glog.Info("FiatRatesDownloader: HourlyTickers updated") + } } - *timestamp = timestamp.Add(time.Hour * 24) // go to the next day + // load five minute tickers, it is necessary to wait about 10 minutes to prepare the tickers + if time.Now().UTC().Unix() >= fr.fiveMinutesTickersTo+3*secondsInFiveMinutes { + fiveMinutesTickers, err := fr.downloader.FiveMinutesTickers() + if err != nil || fiveMinutesTickers == nil { + glog.Error("FiatRatesDownloader: FiveMinutesTickers error ", err) + } else { + fr.setFiveMinutesTickers(fiveMinutesTickers) + glog.Info("FiatRatesDownloader: FiveMinutesTickers updated") + } + } - <-timer.C - timer.Reset(period) + // once a day, 1 hour after UTC midnight (to let the provider prepare historical rates) update historical tickers + now := time.Now().UTC() + if (now.YearDay() != lastHistoricalTickers.YearDay() || now.Year() != lastHistoricalTickers.Year()) && now.Hour() > 0 { + err = fr.downloader.UpdateHistoricalTickers() + if err != nil { + glog.Error("FiatRatesDownloader: UpdateHistoricalTickers error ", err) + } else { + lastHistoricalTickers = time.Now().UTC() + if err = fr.loadDailyTickers(); err != nil { + glog.Error("FiatRatesDownloader: loadDailyTickers error ", err) + } else { + ticker, found := fr.dailyTickers[fr.dailyTickersTo] + if !found || ticker == nil { + glog.Error("FiatRatesDownloader: dailyTickers not loaded") + } else { + glog.Infof("FiatRatesDownloader: UpdateHistoricalTickers finished, last ticker from %v", ticker.Timestamp) + fr.logTickersInfo() + if is != nil { + is.HistoricalFiatRatesTime = ticker.Timestamp + } + } + } + if fr.downloadTokens { + // UpdateHistoricalTokenTickers in a goroutine, it can take quite some time as there are many tokens + go func() { + err := fr.downloader.UpdateHistoricalTokenTickers() + if err != nil { + glog.Error("FiatRatesDownloader: UpdateHistoricalTokenTickers error ", err) + } else { + glog.Info("FiatRatesDownloader: UpdateHistoricalTokenTickers finished") + if is != nil { + is.HistoricalTokenFiatRatesTime = time.Now().UTC() + } + } + }() + } + } + } } - return nil } diff --git a/fiat/fiat_rates_test.go b/fiat/fiat_rates_test.go index f119fce9c1..fad58acfca 100644 --- a/fiat/fiat_rates_test.go +++ b/fiat/fiat_rates_test.go @@ -3,12 +3,12 @@ package fiat import ( - "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "os" + "reflect" "testing" "time" @@ -30,16 +30,16 @@ func TestMain(m *testing.M) { os.Exit(c) } -func setupRocksDB(t *testing.T, parser bchain.BlockChainParser) (*db.RocksDB, *common.InternalState, string) { - tmp, err := ioutil.TempDir("", "testdb") +func setupRocksDB(t *testing.T, parser bchain.BlockChainParser, config *common.Config) (*db.RocksDB, *common.InternalState, string) { + tmp, err := os.MkdirTemp("", "testdb") if err != nil { t.Fatal(err) } - d, err := db.NewRocksDB(tmp, 100000, -1, parser, nil) + d, err := db.NewRocksDB(tmp, 100000, -1, parser, nil, false) if err != nil { t.Fatal(err) } - is, err := d.LoadInternalState("fakecoin") + is, err := d.LoadInternalState(config) if err != nil { t.Fatal(err) } @@ -66,19 +66,15 @@ func bitcoinTestnetParser() *btc.BitcoinParser { } // getFiatRatesMockData reads a stub JSON response from a file and returns its content as string -func getFiatRatesMockData(dateParam string) (string, error) { +func getFiatRatesMockData(name string) (string, error) { var filename string - if dateParam == "current" { - filename = "fiat/mock_data/current.json" - } else { - filename = "fiat/mock_data/" + dateParam + ".json" - } + filename = "fiat/mock_data/" + name + ".json" mockFile, err := os.Open(filename) if err != nil { glog.Errorf("Cannot open file %v", filename) return "", err } - b, err := ioutil.ReadAll(mockFile) + b, err := io.ReadAll(mockFile) if err != nil { glog.Errorf("Cannot read file %v", filename) return "", err @@ -87,90 +83,201 @@ func getFiatRatesMockData(dateParam string) (string, error) { } func TestFiatRates(t *testing.T) { - d, _, tmp := setupRocksDB(t, &testBitcoinParser{ - BitcoinParser: bitcoinTestnetParser(), - }) - defer closeAndDestroyRocksDB(t, d, tmp) - mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var err error var mockData string if r.URL.Path == "/ping" { w.WriteHeader(200) - } else if r.URL.Path == "/coins/bitcoin/history" { - date := r.URL.Query()["date"][0] - mockData, err = getFiatRatesMockData(date) // get stub rates by date - } else if r.URL.Path == "/coins/bitcoin" { - mockData, err = getFiatRatesMockData("current") // get "latest" stub rates + } else if r.URL.Path == "/coins/list" { + mockData, err = getFiatRatesMockData("coinlist") + } else if r.URL.Path == "/simple/supported_vs_currencies" { + mockData, err = getFiatRatesMockData("vs_currencies") + } else if r.URL.Path == "/simple/price" { + if r.URL.Query().Get("ids") == "ethereum" { + mockData, err = getFiatRatesMockData("simpleprice_base") + } else { + mockData, err = getFiatRatesMockData("simpleprice_tokens") + } + } else if r.URL.Path == "/coins/ethereum/market_chart" { + vsCurrency := r.URL.Query().Get("vs_currency") + if vsCurrency == "usd" { + days := r.URL.Query().Get("days") + if days == "max" { + mockData, err = getFiatRatesMockData("market_chart_eth_usd_max") + } else { + mockData, err = getFiatRatesMockData("market_chart_eth_usd_1") + } + } else { + mockData, err = getFiatRatesMockData("market_chart_eth_other") + } + } else if r.URL.Path == "/coins/vendit/market_chart" || r.URL.Path == "/coins/ethereum-cash-token/market_chart" { + mockData, err = getFiatRatesMockData("market_chart_token_other") } else { - t.Errorf("Unknown URL path: %v", r.URL.Path) + t.Fatalf("Unknown URL path: %v", r.URL.Path) } if err != nil { - t.Errorf("Error loading stub data: %v", err) + t.Fatalf("Error loading stub data: %v", err) } fmt.Fprintln(w, mockData) })) defer mockServer.Close() - // real CoinGecko API - //configJSON := `{"fiat_rates": "coingecko", "fiat_rates_params": "{\"url\": \"https://api.coingecko.com/api/v3\", \"coin\": \"bitcoin\", \"periodSeconds\": 60}"}` + // config with mocked CoinGecko API + config := common.Config{ + CoinName: "fakecoin", + FiatRates: "coingecko", + FiatRatesParams: `{"url": "` + mockServer.URL + `", "coin": "ethereum","platformIdentifier": "ethereum","platformVsCurrency": "eth","periodSeconds": 60}`, + } - // mocked CoinGecko API - configJSON := `{"fiat_rates": "coingecko", "fiat_rates_params": "{\"url\": \"` + mockServer.URL + `\", \"coin\": \"bitcoin\", \"periodSeconds\": 60}"}` + d, _, tmp := setupRocksDB(t, &testBitcoinParser{ + BitcoinParser: bitcoinTestnetParser(), + }, &config) + defer closeAndDestroyRocksDB(t, d, tmp) - type fiatRatesConfig struct { - FiatRates string `json:"fiat_rates"` - FiatRatesParams string `json:"fiat_rates_params"` + fiatRates, err := NewFiatRates(d, &config, nil, nil) + if err != nil { + t.Fatalf("FiatRates init error: %v", err) } - var config fiatRatesConfig - err := json.Unmarshal([]byte(configJSON), &config) + // get current tickers + currentTickers, err := fiatRates.downloader.CurrentTickers() if err != nil { - t.Errorf("Error parsing config: %v", err) + t.Fatalf("Error in CurrentTickers: %v", err) + return } - - if config.FiatRates == "" || config.FiatRatesParams == "" { - t.Errorf("Error parsing FiatRates config - empty parameter") + if currentTickers == nil { + t.Fatalf("CurrentTickers returned nil value") return } - testStartTime := time.Date(2019, 11, 22, 16, 0, 0, 0, time.UTC) - fiatRates, err := NewFiatRatesDownloader(d, config.FiatRates, config.FiatRatesParams, &testStartTime, nil) + + wantCurrentTickers := common.CurrencyRatesTicker{ + Rates: map[string]float32{ + "aed": 8447.1, + "ars": 268901, + "aud": 3314.36, + "btc": 0.07531005, + "eth": 1, + "eur": 2182.99, + "ltc": 29.097696, + "usd": 2299.72, + }, + TokenRates: map[string]float32{ + "0x5e9997684d061269564f94e5d11ba6ce6fa9528c": 5.58195e-07, + "0x906710835d1ae85275eb770f06873340ca54274b": 1.39852e-10, + }, + Timestamp: currentTickers.Timestamp, + } + if !reflect.DeepEqual(currentTickers, &wantCurrentTickers) { + t.Fatalf("CurrentTickers() = %v, want %v", *currentTickers, wantCurrentTickers) + } + + ticker, err := fiatRates.db.FiatRatesFindLastTicker("usd", "") if err != nil { - t.Errorf("FiatRates init error: %v\n", err) + t.Fatalf("FiatRatesFindLastTicker failed with error: %v", err) + } + if ticker != nil { + t.Fatalf("FiatRatesFindLastTicker found unexpected data") + } + + // update historical tickers for the first time + err = fiatRates.downloader.UpdateHistoricalTickers() + if err != nil { + t.Fatalf("UpdateHistoricalTickers 1st pass failed with error: %v", err) + } + err = fiatRates.downloader.UpdateHistoricalTokenTickers() + if err != nil { + t.Fatalf("UpdateHistoricalTokenTickers 1st pass failed with error: %v", err) } - if config.FiatRates == "coingecko" { - timestamp, err := fiatRates.findEarliestMarketData() - if err != nil { - t.Errorf("Error looking up earliest market data: %v", err) - return - } - earliestTimestamp, _ := time.Parse(db.FiatRatesTimeFormat, "20130429000000") - if *timestamp != earliestTimestamp { - t.Errorf("Incorrect earliest available timestamp found. Wanted: %v, got: %v", earliestTimestamp, timestamp) - return - } - // After verifying that findEarliestMarketData works correctly, - // set the earliest available timestamp to 2 days ago for easier testing - *timestamp = fiatRates.startTime.Add(time.Duration(-24*2) * time.Hour) + ticker, err = fiatRates.db.FiatRatesFindLastTicker("usd", "") + if err != nil || ticker == nil { + t.Fatalf("FiatRatesFindLastTicker failed with error: %v", err) + } + wantTicker := common.CurrencyRatesTicker{ + Rates: map[string]float32{ + "aed": 241272.48, + "ars": 241272.48, + "aud": 241272.48, + "btc": 241272.48, + "eth": 241272.48, + "eur": 241272.48, + "ltc": 241272.48, + "usd": 1794.5397, + }, + TokenRates: map[string]float32{ + "0x5e9997684d061269564f94e5d11ba6ce6fa9528c": 4.161734e+07, + "0x906710835d1ae85275eb770f06873340ca54274b": 4.161734e+07, + }, + Timestamp: time.Unix(1654732800, 0).UTC(), + } + if !reflect.DeepEqual(ticker, &wantTicker) { + t.Fatalf("UpdateHistoricalTickers(usd) 1st pass = %v, want %v", *ticker, wantTicker) + } - err = fiatRates.syncHistorical(timestamp) - if err != nil { - t.Errorf("RatesDownloader syncHistorical error: %v", err) - return - } - ticker, err := fiatRates.downloader.getTicker(fiatRates.startTime) - if err != nil { - // Do not exit on GET error, log it, wait and try again - glog.Errorf("Sync GetData error: %v", err) - return - } - err = fiatRates.db.FiatRatesStoreTicker(ticker) - if err != nil { - glog.Errorf("Sync StoreTicker error %v", err) - return - } + ticker, err = fiatRates.db.FiatRatesFindLastTicker("eur", "") + if err != nil || ticker == nil { + t.Fatalf("FiatRatesFindLastTicker failed with error: %v", err) + } + wantTicker = common.CurrencyRatesTicker{ + Rates: map[string]float32{ + "aed": 240402.97, + "ars": 240402.97, + "aud": 240402.97, + "btc": 240402.97, + "eth": 240402.97, + "eur": 240402.97, + "ltc": 240402.97, + }, + TokenRates: map[string]float32{ + "0x5e9997684d061269564f94e5d11ba6ce6fa9528c": 4.1464476e+07, + "0x906710835d1ae85275eb770f06873340ca54274b": 4.1464476e+07, + }, + Timestamp: time.Unix(1654819200, 0).UTC(), + } + if !reflect.DeepEqual(ticker, &wantTicker) { + t.Fatalf("UpdateHistoricalTickers(eur) 1st pass = %v, want %v", *ticker, wantTicker) + } + + // update historical tickers for the second time + err = fiatRates.downloader.UpdateHistoricalTickers() + if err != nil { + t.Fatalf("UpdateHistoricalTickers 2nd pass failed with error: %v", err) + } + err = fiatRates.downloader.UpdateHistoricalTokenTickers() + if err != nil { + t.Fatalf("UpdateHistoricalTokenTickers 2nd pass failed with error: %v", err) + } + ticker, err = fiatRates.db.FiatRatesFindLastTicker("usd", "") + if err != nil || ticker == nil { + t.Fatalf("FiatRatesFindLastTicker failed with error: %v", err) + } + wantTicker = common.CurrencyRatesTicker{ + Rates: map[string]float32{ + "aed": 240402.97, + "ars": 240402.97, + "aud": 240402.97, + "btc": 240402.97, + "eth": 240402.97, + "eur": 240402.97, + "ltc": 240402.97, + "usd": 1788.4183, + }, + TokenRates: map[string]float32{ + "0x5e9997684d061269564f94e5d11ba6ce6fa9528c": 4.1464476e+07, + "0x906710835d1ae85275eb770f06873340ca54274b": 4.1464476e+07, + }, + Timestamp: time.Unix(1654819200, 0).UTC(), + } + if !reflect.DeepEqual(ticker, &wantTicker) { + t.Fatalf("UpdateHistoricalTickers(usd) 2nd pass = %v, want %v", *ticker, wantTicker) + } + ticker, err = fiatRates.db.FiatRatesFindLastTicker("eur", "") + if err != nil || ticker == nil { + t.Fatalf("FiatRatesFindLastTicker failed with error: %v", err) + } + if !reflect.DeepEqual(ticker, &wantTicker) { + t.Fatalf("UpdateHistoricalTickers(eur) 2nd pass = %v, want %v", *ticker, wantTicker) } } diff --git a/fiat/mock_data/01-02-2013.json b/fiat/mock_data/01-02-2013.json deleted file mode 100644 index 94ba1bd575..0000000000 --- a/fiat/mock_data/01-02-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"}} diff --git a/fiat/mock_data/01-05-2013.json b/fiat/mock_data/01-05-2013.json deleted file mode 100644 index 060f0e0856..0000000000 --- a/fiat/mock_data/01-05-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":112.481,"brl":232.8687,"btc":1.0,"cad":117.617,"chf":108.7145,"cny":718.7368,"dkk":661.3731,"eur":88.6291,"gbp":74.9767,"hkd":903.2559,"idr":1130568.3956,"inr":6274.6092,"jpy":11364.3607,"krw":128625.969,"mxn":1412.9046,"myr":353.6681,"nzd":136.2101,"php":4792.6186,"pln":368.8928,"rub":3623.3519,"sek":758.5144,"sgd":143.534,"twd":3433.0342,"usd":117.0,"xag":4.9088,"xau":0.0808,"xdr":76.8864,"zar":1049.0856},"market_cap":{"aud":1248780934.15,"brl":2585343237.705,"btc":11102150.0,"cad":1305801576.55,"chf":1206964686.175,"cny":7979523764.12,"dkk":7342663362.165,"eur":983973562.5649999,"gbp":832402569.9049999,"hkd":10028082490.185,"idr":12551739913210.54,"inr":69661652529.78,"jpy":126168837145.505,"krw":1428024801733.35,"mxn":15686278804.89,"myr":3926476296.415,"nzd":1512224961.715,"php":53208370589.99,"pln":4095503199.52,"rub":40226996296.585,"sek":8421140645.96,"sgd":1593535998.1,"twd":38114060643.53,"usd":1298951550.0,"xag":54498233.92,"xau":897053.72,"xdr":853604345.7599999,"zar":11647105694.04},"total_volume":{"aud":0.0,"brl":0.0,"btc":0.0,"cad":0.0,"chf":0.0,"cny":0.0,"dkk":0.0,"eur":0.0,"gbp":0.0,"hkd":0.0,"idr":0.0,"inr":0.0,"jpy":0.0,"krw":0.0,"mxn":0.0,"myr":0.0,"nzd":0.0,"php":0.0,"pln":0.0,"rub":0.0,"sek":0.0,"sgd":0.0,"twd":0.0,"usd":0.0,"xag":0.0,"xau":0.0,"xdr":0.0,"zar":0.0}},"community_data":{"facebook_likes":null,"twitter_followers":null,"reddit_average_posts_48h":0.0,"reddit_average_comments_48h":0.0,"reddit_subscribers":null,"reddit_accounts_active_48h":null},"developer_data":{"forks":null,"stars":null,"subscribers":null,"total_issues":null,"closed_issues":null,"pull_requests_merged":null,"pull_request_contributors":null,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} \ No newline at end of file diff --git a/fiat/mock_data/04-04-2013.json b/fiat/mock_data/04-04-2013.json deleted file mode 100644 index 94ba1bd575..0000000000 --- a/fiat/mock_data/04-04-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"}} diff --git a/fiat/mock_data/05-05-2013.json b/fiat/mock_data/05-05-2013.json deleted file mode 100644 index 1cd65273ca..0000000000 --- a/fiat/mock_data/05-05-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":112.4208,"brl":233.1081,"btc":1.0,"cad":117.0104,"chf":108.4737,"cny":715.1351,"dkk":659.3659,"eur":88.4403,"gbp":74.4895,"hkd":899.8427,"idr":1128375.8759,"inr":6235.1253,"jpy":11470.4956,"krw":127344.157,"mxn":1401.3929,"myr":352.0832,"nzd":135.8774,"php":4740.2255,"pln":366.461,"rub":3602.9548,"sek":754.5925,"sgd":143.0844,"twd":3426.0044,"usd":116.79,"xag":4.9089,"xau":0.0807,"xdr":76.8136,"zar":1033.9804},"market_cap":{"aud":1249804517.76,"brl":2591509369.32,"btc":11117200.0,"cad":1300828018.88,"chf":1205923817.64,"cny":7950299933.72,"dkk":7330302583.48,"eur":983208503.1599998,"gbp":828114669.4000001,"hkd":10003731264.44,"idr":12544380287555.48,"inr":69317134985.16,"jpy":127519793684.32,"krw":1415710462200.4,"mxn":15579565147.88,"myr":3914179351.04,"nzd":1510576231.28,"php":52698034928.6,"pln":4074020229.2,"rub":40054769102.56,"sek":8388955741.0,"sgd":1590697891.68,"twd":38087576115.68,"usd":1298377788.0,"xag":54573223.08,"xau":897158.0399999999,"xdr":853952153.9199998,"zar":11494966902.88},"total_volume":{"aud":0.0,"brl":0.0,"btc":0.0,"cad":0.0,"chf":0.0,"cny":0.0,"dkk":0.0,"eur":0.0,"gbp":0.0,"hkd":0.0,"idr":0.0,"inr":0.0,"jpy":0.0,"krw":0.0,"mxn":0.0,"myr":0.0,"nzd":0.0,"php":0.0,"pln":0.0,"rub":0.0,"sek":0.0,"sgd":0.0,"twd":0.0,"usd":0.0,"xag":0.0,"xau":0.0,"xdr":0.0,"zar":0.0}},"community_data":{"facebook_likes":null,"twitter_followers":null,"reddit_average_posts_48h":0.0,"reddit_average_comments_48h":0.0,"reddit_subscribers":null,"reddit_accounts_active_48h":null},"developer_data":{"forks":null,"stars":null,"subscribers":null,"total_issues":null,"closed_issues":null,"pull_requests_merged":null,"pull_request_contributors":null,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} \ No newline at end of file diff --git a/fiat/mock_data/05-06-2013.json b/fiat/mock_data/05-06-2013.json deleted file mode 100644 index d45b810ae0..0000000000 --- a/fiat/mock_data/05-06-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":126.3133,"brl":259.5964,"btc":1.0,"cad":126.0278,"chf":115.6713,"cny":748.4143,"dkk":695.3988,"eur":93.2043,"gbp":79.6307,"hkd":946.0816,"idr":1196029.7068,"inr":6892.8316,"jpy":12203.5904,"krw":137012.0733,"mxn":1551.7041,"myr":377.299,"nzd":152.0791,"php":5112.2715,"pln":396.1512,"rub":3891.7674,"sek":800.3999,"sgd":152.8465,"twd":3646.9125,"uah":987.805115156,"usd":121.309,"xag":5.3382,"xau":0.0868,"xdr":81.033,"zar":1200.5467},"market_cap":{"aud":1420386743.3035636,"brl":2919148539.142982,"btc":11244950.003709536,"cad":1417176310.0775046,"chf":1300717985.3640869,"cny":8415881385.561269,"dkk":7819724738.639607,"eur":1048077693.6307446,"gbp":895443240.2603929,"hkd":10638640291.429523,"idr":13449294255917.375,"inr":77509546725.9892,"jpy":137228763913.74965,"krw":1540693914163.0862,"mxn":17448835025.0511,"myr":4242708391.449604,"nzd":1710121876.1091428,"php":57487237422.88915,"pln":4454700437.909536,"rub":43762729839.06665,"sek":9000456858.474112,"sgd":1718751250.7419894,"twd":41009348730.40335,"uah":11107819133.33776,"usd":1364113640.0,"xag":60027792.10980224,"xau":976061.6603219877,"xdr":911212033.6505947,"zar":13500087618.61847},"total_volume":{"aud":0.0,"brl":0.0,"btc":0.0,"cad":0.0,"chf":0.0,"cny":0.0,"dkk":0.0,"eur":0.0,"gbp":0.0,"hkd":0.0,"idr":0.0,"inr":0.0,"jpy":0.0,"krw":0.0,"mxn":0.0,"myr":0.0,"nzd":0.0,"php":0.0,"pln":0.0,"rub":0.0,"sek":0.0,"sgd":0.0,"twd":0.0,"uah":0.0,"usd":0.0,"xag":0.0,"xau":0.0,"xdr":0.0,"zar":0.0}},"community_data":{"facebook_likes":null,"twitter_followers":null,"reddit_average_posts_48h":0.0,"reddit_average_comments_48h":0.0,"reddit_subscribers":null,"reddit_accounts_active_48h":null},"developer_data":{"forks":null,"stars":null,"subscribers":null,"total_issues":null,"closed_issues":null,"pull_requests_merged":null,"pull_request_contributors":null,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} \ No newline at end of file diff --git a/fiat/mock_data/07-10-2013.json b/fiat/mock_data/07-10-2013.json deleted file mode 100644 index 328a45ddaf..0000000000 --- a/fiat/mock_data/07-10-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":130.8239,"bdt":9961.3816372,"bhd":48.39643563999999,"bmd":128.38,"brl":272.2555,"btc":1.0,"cad":127.0763,"chf":111.3766,"cny":754.702,"dkk":677.221,"eur":90.7575,"gbp":76.6108,"hkd":955.6959,"idr":1401976.6268,"inr":7601.0098,"jpy":11938.215,"krw":132238.2292,"ltc":59.84440454817475,"mmk":124564.42058759999,"mxn":1619.1347,"myr":393.0957,"nzd":148.4503,"php":5315.0149,"pln":381.3587,"rub":3973.0086,"sek":791.16,"sgd":153.7814,"twd":3623.6843,"uah":1051.00353918,"usd":128.38,"vef":807.6801751200001,"xag":5.5156,"xau":0.0932,"xdr":80.1381,"zar":1233.5253},"market_cap":{"aud":1544578916.545,"bdt":117609550368.68365,"bhd":571394937.205442,"bmd":1515724889.0,"brl":3214398173.525,"btc":11806550.0,"cad":1500332689.765,"chf":1314973396.73,"cny":8910426898.1,"dkk":7995643597.55,"eur":1071532961.6249999,"gbp":904509240.74,"hkd":11283471428.145,"idr":16552507143145.54,"inr":89741702254.19,"jpy":140949132308.25,"krw":1561277264961.26,"ltc":706555954.5182526,"mmk":1470676059888.5288,"mxn":19116394792.285,"myr":4641104036.835,"nzd":1752685889.465,"php":62751989167.595,"pln":4502530559.485,"rub":46907524686.33,"sek":9340870098.0,"sgd":1815627788.17,"twd":42783209872.165,"uah":12408725835.50563,"usd":1515724889.0,"vef":9535916371.563036,"xag":65120207.18,"xau":1100370.4600000002,"xdr":946154484.5549998,"zar":14563678130.715},"total_volume":{"aud":0.0,"bdt":0.0,"bhd":0.0,"bmd":0.0,"brl":0.0,"btc":0.0,"cad":0.0,"chf":0.0,"cny":0.0,"dkk":0.0,"eur":0.0,"gbp":0.0,"hkd":0.0,"idr":0.0,"inr":0.0,"jpy":0.0,"krw":0.0,"ltc":0.0,"mmk":0.0,"mxn":0.0,"myr":0.0,"nzd":0.0,"php":0.0,"pln":0.0,"rub":0.0,"sek":0.0,"sgd":0.0,"twd":0.0,"uah":0.0,"usd":0.0,"vef":0.0,"xag":0.0,"xau":0.0,"xdr":0.0,"zar":0.0}},"community_data":{"facebook_likes":null,"twitter_followers":null,"reddit_average_posts_48h":0.0,"reddit_average_comments_48h":0.0,"reddit_subscribers":null,"reddit_accounts_active_48h":null},"developer_data":{"forks":null,"stars":null,"subscribers":null,"total_issues":null,"closed_issues":null,"pull_requests_merged":null,"pull_request_contributors":null,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} \ No newline at end of file diff --git a/fiat/mock_data/13-06-2014.json b/fiat/mock_data/13-06-2014.json deleted file mode 100644 index c784ee4862..0000000000 --- a/fiat/mock_data/13-06-2014.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":635.4009,"bdt":46187.0412867627,"bhd":224.2182020654,"bmd":594.6833,"brl":1330.3026,"btc":1.0,"cad":645.6162,"chf":537.5144,"cny":3818.09,"dkk":3291.0056,"eur":439.2353,"gbp":350.5075,"hkd":4609.773,"idr":7056654.8237,"inr":35623.7845,"jpy":60664.7779,"krw":605273.662,"ltc":58.68544600938967,"mmk":576316.9820261401,"mxn":7774.4393,"myr":1921.5065,"nzd":689.3958,"php":26182.8705,"pln":1816.6144,"rub":20449.5057,"sek":3957.6568,"sgd":743.7241,"twd":17936.3326,"uah":6989.384186896,"usd":594.6833,"vef":3749.9319498579002,"vnd":12616057.538675,"xag":30.3811,"xau":0.4678,"xdr":388.0442,"zar":6383.9883},"market_cap":{"aud":8191238932.305,"bdt":595417933396.2369,"bhd":2890497741.0160007,"bmd":7666330027.785,"brl":17149529452.77,"btc":12891450.0,"cad":8322928961.49,"chf":6929340011.88,"cny":49220716330.5,"dkk":42425834142.12,"eur":5662379908.185,"gbp":4518549910.875,"hkd":59426658140.85,"idr":90970512826987.36,"inr":459242236692.525,"jpy":782056951058.955,"krw":7802855149989.9,"ltc":756540492.9577465,"mmk":7429561557940.883,"mxn":100223795513.985,"myr":24771004969.425,"nzd":8887311485.91,"php":337535165907.225,"pln":23418793706.88,"rub":263623780256.265,"sek":51019934754.36,"sgd":9587682048.945,"twd":231225334896.27,"uah":90103296776.16043,"usd":7666330027.785,"vef":48342060234.99562,"vnd":162639274956951.8,"xag":391656431.595,"xau":6030620.31,"xdr":5002452402.09,"zar":82298865970.035},"total_volume":{"aud":40549103.56573137,"bdt":2947498375.4849124,"bhd":14308835.723827252,"bmd":37950646.151919045,"brl":84895343.87055749,"btc":63816.5661486022,"cad":41201008.933909185,"chf":34302323.26342622,"cny":243657393.04631656,"dkk":210020676.56782028,"eur":28030488.577251133,"gbp":22368185.059331186,"hkd":294179883.5845404,"idr":450331479344.50385,"inr":2273387600.0077996,"jpy":3871417811.7456107,"krw":38626486689.029686,"ltc":3745103.647218439,"mmk":36778570806.03395,"mxn":496138019.85674256,"myr":122623946.66221909,"nzd":43994872.673268534,"php":1670900887.223535,"pln":115930093.0241033,"rub":1305017233.2102678,"sek":252564066.9706653,"sgd":47461918.22395964,"twd":1144635155.8312302,"uah":446038498.30104274,"usd":37950646.151919045,"vef":239307780.33086348,"vnd":805113470451.4246,"xag":1938817.4778172984,"xau":29853.38964431611,"xdr":24763648.357881423,"zar":407404211.6388525}},"community_data":{"facebook_likes":22450,"twitter_followers":54747,"reddit_average_posts_48h":2.449,"reddit_average_comments_48h":266.163,"reddit_subscribers":122886,"reddit_accounts_active_48h":"957.0"},"developer_data":{"forks":3894,"stars":5469,"subscribers":757,"total_issues":4332,"closed_issues":3943,"pull_requests_merged":1950,"pull_request_contributors":201,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} diff --git a/fiat/mock_data/20-04-2013.json b/fiat/mock_data/20-04-2013.json deleted file mode 100644 index 94ba1bd575..0000000000 --- a/fiat/mock_data/20-04-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"}} diff --git a/fiat/mock_data/20-11-2019.json b/fiat/mock_data/20-11-2019.json deleted file mode 100644 index 2dcf90600b..0000000000 --- a/fiat/mock_data/20-11-2019.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aed":29895.556252804836,"ars":485421.07790578756,"aud":11927.653049612183,"bch":33.63953944857689,"bdt":690035.4308521386,"bhd":3068.738317969027,"bmd":8138.831605359057,"bnb":440.3065882935356,"brl":34128.562570752125,"btc":1.0,"cad":10801.69453000047,"chf":8061.919646688408,"clp":6426418.993942025,"cny":57197.26687298181,"czk":187745.75358926164,"dkk":54903.744126591664,"eos":2611.7345692770737,"eth":46.298470465960534,"eur":7346.923290157612,"gbp":6295.369969082021,"hkd":63709.552982009845,"huf":2444677.126964913,"idr":114676137.3195094,"ils":28177.44890091363,"inr":584864.5454373802,"jpy":882985.9102812062,"krw":9504690.325370407,"kwd":2470.900442397376,"lkr":1459699.318199838,"ltc":147.7002152423325,"mmk":12336753.62587893,"mxn":157572.5004020829,"myr":33838.006282440794,"nok":74323.81022013885,"nzd":12659.561898218928,"php":414372.5288556039,"pkr":1268614.8449705977,"pln":31481.39945227751,"rub":519856.47442806256,"sar":30523.100863736137,"sek":78433.10629768472,"sgd":11082.158667121108,"thb":245711.32616578983,"try":46424.77447078138,"twd":247819.28355157803,"uah":196944.8714820098,"usd":8138.831605359057,"vef":2022399076.2122076,"vnd":188819978.95240378,"xag":474.4301555409632,"xau":5.522685574132437,"xdr":5913.04021558867,"xlm":124534.24474263463,"xrp":32009.044210117067,"zar":120220.54543519647},"market_cap":{"aed":539216184347.0786,"ars":8754702929895.195,"aud":215108532402.1839,"bch":606965693.7308347,"bdt":12445939086798.977,"bhd":55349810272.20994,"bmd":146797393103.30997,"bnb":7956861576.178785,"brl":615565508500.11,"btc":18056975.0,"cad":194793828360.1895,"chf":145401203097.50433,"clp":115881862115752.81,"cny":1031662719251.4414,"czk":3386836054983.015,"dkk":990235760930.7228,"eos":47156656992.1783,"eth":836285546.5188296,"eur":132513272767.39243,"gbp":113531342257.38261,"hkd":1149073035824.1863,"huf":44093634990629.44,"idr":2068029594287882.2,"ils":508227254662.9701,"inr":10549007465796.953,"jpy":15924140811667.746,"krw":171432931613907.47,"kwd":44566807761.80631,"lkr":26328110104320.3,"ltc":2665915975.9376416,"mmk":222513913476766.62,"mxn":2842848955360.077,"myr":610324841566.3215,"nok":1340509754601.4958,"nzd":228301948107.3441,"php":7486962257826.343,"pkr":22881583146556.33,"pln":567829491818.596,"rub":9376404569427.018,"sar":550534997342.308,"sek":1414830338781.8389,"sgd":199869788618.91415,"thb":4430345323857.896,"try":837402059023.0033,"twd":4471888986106.136,"uah":3552229007857.6865,"usd":146797393103.30997,"vef":36477338099366760,"vnd":3405959412743900,"xag":8552645126.132073,"xau":99600563.24666482,"xdr":106651535632.2029,"xlm":2242611242035.2026,"xrp":577654290936.0109,"zar":2168300254311.0623},"total_volume":{"aed":91806191763.19203,"ars":1490678420139.214,"aud":36628601050.19057,"bch":103303580.75045899,"bdt":2119028144266.9175,"bhd":9423781116.770079,"bmd":24993518393.55118,"bnb":1352136442.5417123,"brl":104805320679.67813,"btc":3074333.834646516,"cad":33170897741.553368,"chf":24757329644.7321,"clp":19734874625492.48,"cny":175646949214.35953,"czk":576547982950.5977,"dkk":168603775731.05692,"eos":8020369404.536936,"eth":142177861.5523058,"eur":22561649053.858624,"gbp":19332436490.375057,"hkd":195645512956.95944,"huf":7507353106907.763,"idr":352158674165137.06,"ils":86530060030.31366,"inr":1796059125304.906,"jpy":2711559307275.5625,"krw":29187930650356.914,"kwd":7587882223.171772,"lkr":4482587123987.1,"ltc":453572235.5970587,"mmk":37884907025485.92,"mxn":483889012339.82043,"myr":103913052073.02832,"nok":228240809969.9092,"nzd":38876218172.28588,"php":1272495601815.3118,"pkr":3895786274927.592,"pln":96676153828.6573,"rub":1596425996462.3315,"sar":93733316998.92708,"sek":240860037406.81345,"sgd":34032174385.395035,"thb":754554320301.3098,"try":142565728216.80225,"twd":761027641565.2402,"uah":604797531952.8716,"usd":24993518393.55118,"vef":6210580456920606,"vnd":579846819033510.8,"xag":1456926423.0950127,"xau":16959601.841128074,"xdr":18158340970.319584,"xlm":382431912530.61053,"xrp":98296496845.90811,"zar":369184983706.85724}},"community_data":{"facebook_likes":null,"twitter_followers":68549,"reddit_average_posts_48h":6.429,"reddit_average_comments_48h":227.357,"reddit_subscribers":1190720,"reddit_accounts_active_48h":"3557.33333333333"},"developer_data":{"forks":24603,"stars":41204,"subscribers":3495,"total_issues":0,"closed_issues":0,"pull_requests_merged":6973,"pull_request_contributors":623,"code_additions_deletions_4_weeks":{"additions":3441,"deletions":-1615},"commit_count_4_weeks":375},"public_interest_stats":{"alexa_rank":12740,"bing_matches":135000000}} diff --git a/fiat/mock_data/21-11-2019.json b/fiat/mock_data/21-11-2019.json deleted file mode 100644 index 14dd021d84..0000000000 --- a/fiat/mock_data/21-11-2019.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aed":29737.733661544353,"ars":482992.0576847001,"aud":11909.083120440264,"bch":33.38939623106484,"bdt":686435.825992477,"bhd":3052.4408925589955,"bmd":8095.865638011639,"bnb":447.42498131132714,"brl":33973.49056335204,"btc":1.0,"cad":10770.529152304092,"chf":8017.651480082802,"clp":6417583.259568359,"cny":56962.51062904988,"czk":186532.80032847245,"dkk":54611.02597516125,"eos":2625.1996127062725,"eth":46.30756277128346,"eur":7307.587392569718,"gbp":6263.7712441296035,"hkd":63361.07803605232,"huf":2437260.3503234047,"idr":113658578.86366026,"ils":28110.059875022114,"inr":581104.954710677,"jpy":878241.5283779115,"krw":9474186.762883117,"kwd":2457.953382894158,"lkr":1451476.6944985148,"ltc":147.17764652439055,"mmk":12276458.59050864,"mxn":157745.51319696513,"myr":33723.328315137434,"nok":73919.30120786528,"nzd":12630.060434833318,"php":412223.4002195826,"pkr":1261966.2105007921,"pln":31386.456698725444,"rub":516701.6230282524,"sar":30360.961494224146,"sek":78027.18391192055,"sgd":11029.362072616914,"thb":244420.8060296636,"try":46147.243723230094,"twd":246632.45889225203,"uah":195582.93374510246,"usd":8095.865638011639,"vef":2011722564.2894442,"vnd":187451397.8769113,"xag":471.370523519991,"xau":5.491344703606915,"xdr":5886.050536922535,"xlm":126226.86768614998,"xrp":32338.763084294602,"zar":119758.9020368509},"market_cap":{"aed":536925789662.0078,"ars":8721126622799.587,"aud":214993230987.64774,"bch":603145132.8718755,"bdt":12393852945152.863,"bhd":55112950276.81427,"bmd":146173851045.95633,"bnb":8069562575.040651,"brl":613403948529.2512,"btc":18058775.0,"cad":194516467063.8744,"chf":144785199461.0198,"clp":115857415095711.94,"cny":1028479215959.3489,"czk":3368167110571.1367,"dkk":986119641838.593,"eos":47362660343.0749,"eth":834881213.8173289,"eur":131953912642.35466,"gbp":113092515946.4908,"hkd":1143920014822.8933,"huf":44007835435061.79,"idr":2051934847845294.5,"ils":507537536909.2167,"inr":10491950179817.375,"jpy":15862731500313.05,"krw":171059949186530.47,"kwd":44379258220.658554,"lkr":26206949031136.875,"ltc":2660325666.65285,"mmk":221656004387641.53,"mxn":2848592157028.2905,"myr":608887176531.9319,"nok":1334790467520.1284,"nzd":228006504250.86572,"php":7443249821227.297,"pkr":22785267089002.48,"pln":566719821025.2997,"rub":9329253695306.072,"sar":548178398889.3755,"sek":1408776800748.5935,"sgd":199092731818.5716,"thb":4413592261082.244,"try":833269884841.5155,"twd":4453040344437.87,"uah":3531322270240.796,"usd":146173851045.95633,"vef":36322395603696830,"vnd":3384688469578368,"xag":8512844964.182701,"xau":99193575.31978594,"xdr":106274821359.85637,"xlm":2281320453520.52,"xrp":583446527953.1724,"zar":2162554421914.3018},"total_volume":{"aed":86108153638.4696,"ars":1398544851555.271,"aud":34483769701.4642,"bch":96681855.22416703,"bdt":1987633699334.181,"bhd":8838603921.209757,"bmd":23442272034.865948,"bnb":1295557337.0497513,"brl":98373150367.11145,"btc":2896005.038733083,"cad":31186989216.112743,"chf":23215796244.73709,"clp":18582661731791.32,"cny":164939826037.3168,"czk":540121692261.5999,"dkk":158130900913.4299,"eos":7601490219.642489,"eth":134087512.35435177,"eur":21159744891.37511,"gbp":18137285873.37578,"hkd":183467425740.0729,"huf":7057295996096.396,"idr":329108145311632.75,"ils":81395084845.85982,"inr":1682639144253.6147,"jpy":2543023530910.265,"krw":27433318848801.867,"kwd":7117214443.4175005,"lkr":4202875028575.5767,"ltc":426165475.2614542,"mmk":35547536825741.08,"mxn":456765637917.7518,"myr":97648784161.23398,"nok":214039664814.34357,"nzd":36571421237.528984,"php":1193628145421.9192,"pkr":3654131198332.759,"pln":90882172338.37012,"rub":1496153783854.0442,"sar":87912763181.98567,"sek":225934390856.19467,"sgd":31936462095.3393,"thb":707741368511.1285,"try":133623294825.93925,"twd":714145398712.4277,"uah":566327128343.4884,"usd":23442272034.865948,"vef":5825114906715977,"vnd":542781570103440.4,"xag":1364893704.471942,"xau":15900658.698529225,"xdr":17043563229.317081,"xlm":365500701557.407,"xrp":93639657003.90553,"zar":346772153302.9578}},"community_data":{"facebook_likes":null,"twitter_followers":68537,"reddit_average_posts_48h":6.5,"reddit_average_comments_48h":248.25,"reddit_subscribers":1191683,"reddit_accounts_active_48h":"3672.76923076923"},"developer_data":{"forks":24612,"stars":41218,"subscribers":3495,"total_issues":0,"closed_issues":0,"pull_requests_merged":6978,"pull_request_contributors":623,"code_additions_deletions_4_weeks":{"additions":3491,"deletions":-1642},"commit_count_4_weeks":388},"public_interest_stats":{"alexa_rank":12740,"bing_matches":135000000}} diff --git a/fiat/mock_data/22-11-2019.json b/fiat/mock_data/22-11-2019.json deleted file mode 100644 index 19ad080829..0000000000 --- a/fiat/mock_data/22-11-2019.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aed":28035.679772629657,"ars":455975.92278356064,"aud":11242.023660019182,"bch":33.7483287902988,"bdt":647296.9519021783,"bhd":2877.7787238679057,"bmd":7632.494765498649,"bnb":454.38160859138037,"brl":32004.577050688924,"btc":1.0,"cad":10134.64789197728,"chf":7577.578965660877,"clp":6088438.929707239,"cny":53650.33220564306,"czk":176064.87038406474,"dkk":51541.93185162167,"eos":2702.457481762241,"eth":47.35816140456382,"eur":6897.386297149177,"gbp":5908.00889818188,"hkd":59688.78043936735,"huf":2307617.389787238,"idr":107442628.81392431,"ils":26414.69053433299,"inr":547635.3233044049,"jpy":828835.8421129878,"krw":8981385.56540522,"kwd":2317.3933256902314,"lkr":1371578.7340592865,"ltc":150.51551045178746,"mmk":11576409.193776581,"mxn":147997.88975040163,"myr":31823.686924746547,"nok":69791.7992730364,"nzd":11915.530263116301,"php":388189.40886026394,"pkr":1185305.8751410455,"pln":29644.4875492805,"rub":486228.079036091,"sar":28621.16844609101,"sek":73412.31132752451,"sgd":10402.327115898055,"thb":230471.15540126187,"try":43490.718423287806,"twd":232501.04791412465,"uah":184490.35082571974,"usd":7632.494765498649,"vef":1896580628.6955354,"vnd":177318106.98911732,"xag":446.02452345840845,"xau":5.21078050135358,"xdr":5544.7555748075,"xlm":125542.05293968241,"xrp":31338.87101002938,"zar":112082.42238187103},"market_cap":{"aed":505952466029.5935,"ars":8228063686842.731,"aud":202906746120.7657,"bch":610302833.79301,"bdt":11681596156197.934,"bhd":51934508235.10716,"bmd":137741605692.4732,"bnb":8208811080.573547,"brl":577564326829.1097,"btc":18060475.0,"cad":182927050731.8614,"chf":136752620963.6013,"clp":109834974835741.86,"cny":968213294733.5328,"czk":3177872948714.952,"dkk":930200055102.5531,"eos":48834956976.25193,"eth":855479661.9732217,"eur":124481359054.06459,"gbp":106626741157.78348,"hkd":1077223378894.6129,"huf":41647543632679.81,"idr":1939126324938642.2,"ils":476698903812.6255,"inr":9882973293887.5,"jpy":14957705316159.902,"krw":162084679666504.06,"kwd":41821381803.56006,"lkr":24752517095323.91,"ltc":2718657573.4072695,"mmk":208916381798492.3,"mxn":2670451606202.2573,"myr":574313624934.7668,"nok":1259581556794.9636,"nzd":215062993789.54813,"php":7005804182301.389,"pkr":21390900288155.363,"pln":535015393864.2815,"rub":8774828990639.0205,"sar":516518624602.2619,"sek":1324936091931.084,"sgd":187713296046.46274,"thb":4159796491912.691,"try":784893129459.0262,"twd":4195747188740.0435,"uah":3329448357091.939,"usd":137741605692.4732,"vef":34227086837012150,"vnd":3200663218868120.5,"xag":8055064362.341162,"xau":94058232.86316237,"xdr":100064731062.59404,"xlm":2269248253100.4473,"xrp":566093764804.5127,"zar":2022682035850.9631},"total_volume":{"aed":96938279018.82988,"ars":1576616710817.6833,"aud":38871268152.918,"bch":116690764.74068807,"bdt":2238142718151.254,"bhd":9950424571.517105,"bmd":26390689050.100677,"bnb":1571104089.9267807,"brl":110661437324.88211,"btc":3458209.3682739506,"cad":35042322250.70604,"chf":26200808042.38517,"clp":21051845239481.676,"cny":185505431470.96753,"czk":608775163260.6022,"dkk":178215267527.76758,"eos":9344220633.428228,"eth":163749147.56075427,"eur":23848922615.61833,"gbp":20427976766.120914,"hkd":206384425112.9548,"huf":7978991778122.924,"idr":371501729758266.6,"ils":91333424478.36926,"inr":1893545161079.935,"jpy":2865845264861.2,"krw":31054715525924.953,"kwd":8012793790.76967,"lkr":4742473986606.729,"ltc":520433771.07914567,"mmk":40027464772158.91,"mxn":511728656025.9774,"myr":110035977994.39453,"nok":241317384348.23724,"nzd":41200035336.076935,"php":1342232952203.5798,"pkr":4098402912964.3467,"pln":102501014019.56622,"rub":1681218845936.662,"sar":98962708775.86293,"sek":253835939652.59772,"sgd":35967870106.38203,"thb":796894434137.848,"try":150376785276.3785,"twd":803913143453.4763,"uah":637907739340.2526,"usd":26390689050.100677,"vef":6557760099174900,"vnd":613108448584249.1,"xag":1542208002.620382,"xau":18017187.321394224,"xdr":19171964702.159466,"xlm":434083662502.9747,"xrp":108359641954.22104,"zar":387544629631.8232}},"community_data":{"facebook_likes":null,"twitter_followers":68552,"reddit_average_posts_48h":8.0,"reddit_average_comments_48h":363.727,"reddit_subscribers":1192543,"reddit_accounts_active_48h":"4102.33333333333"},"developer_data":{"forks":24627,"stars":41240,"subscribers":3497,"total_issues":0,"closed_issues":0,"pull_requests_merged":6982,"pull_request_contributors":623,"code_additions_deletions_4_weeks":{"additions":3706,"deletions":-1803},"commit_count_4_weeks":370},"public_interest_stats":{"alexa_rank":12740,"bing_matches":135000000}} \ No newline at end of file diff --git a/fiat/mock_data/23-09-2011.json b/fiat/mock_data/23-09-2011.json deleted file mode 100644 index 94ba1bd575..0000000000 --- a/fiat/mock_data/23-09-2011.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"}} diff --git a/fiat/mock_data/27-04-2013.json b/fiat/mock_data/27-04-2013.json deleted file mode 100644 index 94ba1bd575..0000000000 --- a/fiat/mock_data/27-04-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"}} diff --git a/fiat/mock_data/28-04-2013.json b/fiat/mock_data/28-04-2013.json deleted file mode 100644 index b9f2a4ad92..0000000000 --- a/fiat/mock_data/28-04-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":130.7952,"brl":268.8555,"btc":1.0,"cad":136.8008,"chf":126.7471,"cny":830.3415,"dkk":769.4261,"eur":103.1862,"gbp":86.889,"hkd":1043.747,"idr":1306348.9692,"inr":7304.2353,"jpy":13203.1967,"krw":149390.4586,"mxn":1633.6086,"myr":407.992,"nzd":158.5211,"php":5543.837,"pln":429.2283,"rub":4203.4233,"sek":884.1254,"sgd":166.2931,"usd":135.3,"xag":5.716,"xau":0.0938,"zar":1223.2239},"market_cap":{"aud":1450558006.5599997,"brl":2981688151.6499996,"btc":11090299.999999998,"cad":1517161912.2399998,"chf":1405663363.1299999,"cny":9208736337.449999,"dkk":8533166276.829999,"eur":1144365913.86,"gbp":963625076.6999998,"hkd":11575467354.099998,"idr":14487801973118.756,"inr":81006160747.59,"jpy":146427412362.00998,"krw":1656785003011.5798,"mxn":18117209456.579998,"myr":4524753677.599999,"nzd":1758046555.3299997,"php":61482815481.09999,"pln":4760270615.489999,"rub":46617225423.99,"sek":9805215923.619999,"sgd":1844240366.9299998,"usd":1500517590,"xag":63392154.79999999,"xau":1040270.1399999998,"zar":13565920018.169998},"total_volume":{"aud":0.0,"brl":0.0,"btc":0.0,"cad":0.0,"chf":0.0,"cny":0.0,"dkk":0.0,"eur":0.0,"gbp":0.0,"hkd":0.0,"idr":0.0,"inr":0.0,"jpy":0.0,"krw":0.0,"mxn":0.0,"myr":0.0,"nzd":0.0,"php":0.0,"pln":0.0,"rub":0.0,"sek":0.0,"sgd":0.0,"usd":0,"xag":0.0,"xau":0.0,"zar":0.0}},"community_data":{"facebook_likes":null,"twitter_followers":null,"reddit_average_posts_48h":0.0,"reddit_average_comments_48h":0.0,"reddit_subscribers":null,"reddit_accounts_active_48h":null},"developer_data":{"forks":null,"stars":null,"subscribers":null,"total_issues":null,"closed_issues":null,"pull_requests_merged":null,"pull_request_contributors":null,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} diff --git a/fiat/mock_data/29-04-2013.json b/fiat/mock_data/29-04-2013.json deleted file mode 100644 index d7f64132d7..0000000000 --- a/fiat/mock_data/29-04-2013.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","localization":{"en":"Bitcoin","de":"Bitcoin","es":"Bitcoin","fr":"Bitcoin","it":"Bitcoin","pl":"Bitcoin","ro":"Bitcoin","hu":"Bitcoin","nl":"Bitcoin","pt":"Bitcoin","sv":"Bitcoin","vi":"Bitcoin","tr":"Bitcoin","ru":"биткоина","ja":"ビットコイン","zh":"比特币","zh-tw":"比特幣","ko":"비트코인","ar":"بيتكوين","th":"บิตคอยน์","id":"Bitcoin"},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579"},"market_data":{"current_price":{"aud":140.0534,"brl":287.7259,"btc":1.0,"cad":146.3907,"chf":135.5619,"cny":889.0842,"dkk":822.6608,"eur":110.3745,"gbp":93.0697,"hkd":1117.9148,"idr":1394387.3129,"inr":7822.3338,"jpy":14108.4087,"krw":159839.6429,"mxn":1748.706,"myr":436.5932,"nzd":169.7084,"php":5937.7695,"pln":459.2644,"rub":4501.5503,"sek":944.2334,"sgd":178.0707,"twd":4262.3287,"usd":141.96,"xag":6.1223,"xau":0.1005,"xdr":95.6015,"zar":1309.9167},"market_cap":{"aud":1553878467.66,"brl":3192290087.91,"btc":11094900.0,"cad":1624190177.43,"chf":1504045724.31,"cny":9864300290.58,"dkk":9127339309.92,"eur":1224594040.05,"gbp":1032599014.53,"hkd":12403152914.52,"idr":15470587797894.21,"inr":86788011277.62,"jpy":156531383685.63,"krw":1773404854011.21,"mxn":19401718199.4,"myr":4843957894.68,"nzd":1882897727.16,"php":65878958825.55,"pln":5095492591.56,"rub":49944250423.47,"sek":10476175149.66,"sgd":1975676609.43,"twd":47290110693.63,"usd":1575032004.0,"xag":67926306.27,"xau":1115037.45,"xdr":1060689082.35,"zar":14533394794.83},"total_volume":{"aud":0.0,"brl":0.0,"btc":0.0,"cad":0.0,"chf":0.0,"cny":0.0,"dkk":0.0,"eur":0.0,"gbp":0.0,"hkd":0.0,"idr":0.0,"inr":0.0,"jpy":0.0,"krw":0.0,"mxn":0.0,"myr":0.0,"nzd":0.0,"php":0.0,"pln":0.0,"rub":0.0,"sek":0.0,"sgd":0.0,"twd":0.0,"usd":0.0,"xag":0.0,"xau":0.0,"xdr":0.0,"zar":0.0}},"community_data":{"facebook_likes":null,"twitter_followers":null,"reddit_average_posts_48h":0.0,"reddit_average_comments_48h":0.0,"reddit_subscribers":null,"reddit_accounts_active_48h":null},"developer_data":{"forks":null,"stars":null,"subscribers":null,"total_issues":null,"closed_issues":null,"pull_requests_merged":null,"pull_request_contributors":null,"code_additions_deletions_4_weeks":{"additions":null,"deletions":null},"commit_count_4_weeks":null},"public_interest_stats":{"alexa_rank":null,"bing_matches":null}} diff --git a/fiat/mock_data/coinlist.json b/fiat/mock_data/coinlist.json new file mode 100644 index 0000000000..ccf9278733 --- /dev/null +++ b/fiat/mock_data/coinlist.json @@ -0,0 +1,30 @@ +[ + { "id": "01coin", "symbol": "zoc", "name": "01coin", "platforms": {} }, + { + "id": "0-5x-long-algorand-token", + "symbol": "algohalf", + "name": "0.5X Long Algorand Token", + "platforms": { "ethereum": "" } + }, + { "id": "ethereum", "symbol": "eth", "name": "Ethereum", "platforms": {} }, + { + "id": "ethereum-cash-token", + "symbol": "ecash", + "name": "Ethereum Cash Token", + "platforms": { "ethereum": "0x906710835d1ae85275eb770f06873340ca54274b" } + }, + { + "id": "santa-shiba", + "symbol": "santashib", + "name": "Santa Shiba", + "platforms": { + "binance-smart-chain": "0x74c609b16512869b1873f5a9d7999deee386e740" + } + }, + { + "id": "vendit", + "symbol": "vndt", + "name": "Vendit", + "platforms": { "ethereum": "0x5e9997684d061269564f94e5d11ba6ce6fa9528c" } + } +] diff --git a/fiat/mock_data/current.json b/fiat/mock_data/current.json deleted file mode 100644 index 7d66dd3eb8..0000000000 --- a/fiat/mock_data/current.json +++ /dev/null @@ -1 +0,0 @@ -{"id":"bitcoin","symbol":"btc","name":"Bitcoin","asset_platform_id":null,"block_time_in_minutes":10,"categories":["Cryptocurrency"],"description":{"en":"Bitcoin is the first successful internet money based on peer-to-peer technology; whereby no central bank or authority is involved in the transaction and production of the Bitcoin currency. It was created by an anonymous individual/group under the name, Satoshi Nakamoto. The source code is available publicly as an open source project, anybody can look at it and be part of the developmental process.\r\n\r\nBitcoin is changing the way we see money as we speak. The idea was to produce a means of exchange, independent of any central authority, that could be transferred electronically in a secure, verifiable and immutable way. It is a decentralized peer-to-peer internet currency making mobile payment easy, very low transaction fees, protects your identity, and it works anywhere all the time with no central authority or banks.\r\n\r\nBitcoin is design to have only 21 million BTC ever created, thus making it a deflationary currency. Bitcoin uses the \u003ca href=\"https://www.coingecko.com/en?hashing_algorithm=SHA-256\"\u003eSHA-256\u003c/a\u003e hashing algorithm with an average transaction confirmation time of 10 minutes. Miners today are mining Bitcoin using ASIC chip dedicated to only mining Bitcoin, and the hash rate has shot up to peta hashes.\r\n\r\nBeing the first successful online cryptography currency, Bitcoin has inspired other alternative currencies such as \u003ca href=\"https://www.coingecko.com/en/coins/litecoin\"\u003eLitecoin\u003c/a\u003e, \u003ca href=\"https://www.coingecko.com/en/coins/peercoin\"\u003ePeercoin\u003c/a\u003e, \u003ca href=\"https://www.coingecko.com/en/coins/primecoin\"\u003ePrimecoin\u003c/a\u003e, and so on.\r\n\r\nThe cryptocurrency then took off with the innovation of the turing-complete smart contract by \u003ca href=\"https://www.coingecko.com/en/coins/ethereum\"\u003eEthereum\u003c/a\u003e which led to the development of other amazing projects such as \u003ca href=\"https://www.coingecko.com/en/coins/eos\"\u003eEOS\u003c/a\u003e, \u003ca href=\"https://www.coingecko.com/en/coins/tron\"\u003eTron\u003c/a\u003e, and even crypto-collectibles such as \u003ca href=\"https://www.coingecko.com/buzz/ethereum-still-king-dapps-cryptokitties-need-1-billion-on-eos\"\u003eCryptoKitties\u003c/a\u003e."},"links":{"homepage":["http://www.bitcoin.org","",""],"blockchain_site":["https://blockchair.com/bitcoin/","https://btc.com/","","",""],"official_forum_url":["https://bitcointalk.org/","",""],"chat_url":["","",""],"announcement_url":["",""],"twitter_screen_name":"btc","facebook_username":"bitcoins","bitcointalk_thread_identifier":null,"telegram_channel_identifier":"","subreddit_url":"https://www.reddit.com/r/Bitcoin/","repos_url":{"github":["https://github.com/bitcoin/bitcoin","https://github.com/bitcoin/bips"],"bitbucket":[]}},"image":{"thumb":"https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png?1547033579","small":"https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1547033579","large":"https://assets.coingecko.com/coins/images/1/large/bitcoin.png?1547033579"},"country_origin":"","genesis_date":"2009-01-03","sentiment_votes_up_percentage":38.69,"sentiment_votes_down_percentage":61.31,"market_cap_rank":1,"coingecko_rank":1,"coingecko_score":87.571,"developer_score":91.999,"community_score":80.5,"liquidity_score":100.084,"public_interest_score":44.29,"market_data":{"current_price":{"aed":26233,"ars":427146,"aud":10530.78,"bch":34.754373,"bdt":605978,"bhd":2693.12,"bmd":7142.59,"bnb":469.136,"brl":29879,"btc":1.0,"cad":9489.19,"chf":7113.95,"clp":5688362,"cny":50277,"czk":165074,"dkk":48362,"eos":2760,"eth":48.466911,"eur":6471.78,"gbp":5562.63,"hkd":55896,"huf":2162211,"idr":100796288,"ils":24797,"inr":512355,"jpy":776361,"krw":8423047,"kwd":2169.53,"lkr":1286409,"ltc":152.386,"mmk":10823325,"mxn":138495,"myr":29800,"nok":65379,"nzd":11149.85,"php":363629,"pkr":1110673,"pln":27816,"rub":455640,"sar":26785,"sek":68693,"sgd":9743.25,"thb":215688,"try":40799,"twd":218342,"uah":172189,"usd":7142.59,"vef":1774846373,"vnd":166109525,"xag":418.79,"xau":4.88,"xdr":5191.74,"xlm":125849,"xrp":30745,"zar":104995},"roi":null,"ath":{"aed":72229,"ars":654921,"aud":25717,"bch":42.242547,"bdt":1631248,"bhd":7416.37,"bmd":19665.39,"bnb":143062,"brl":64777,"btc":1.003301,"cad":25303,"chf":19484.57,"clp":12582805,"cny":130006,"czk":429834,"dkk":124584,"eos":3287,"eth":624.203,"eur":16727.68,"gbp":14759.86,"hkd":153608,"huf":5263109,"idr":266681922,"ils":69096,"inr":1259942,"jpy":2214028,"krw":21418073,"kwd":5939.64,"lkr":3024387,"ltc":318.98,"mmk":26871485,"mxn":376059,"myr":80224,"nok":164805,"nzd":28131,"php":991988,"pkr":2181203,"pln":70407,"rub":1157051,"sar":73750,"sek":167278,"sgd":26517,"thb":639578,"try":80284,"twd":589706,"uah":541437,"usd":19665.39,"vef":3454441855,"vnd":446720468,"xag":1225.45,"xau":15.67,"xdr":13907.05,"xlm":189028,"xrp":42151,"zar":257660},"ath_change_percentage":{"aed":-63.62124,"ars":-34.67198,"aud":-58.99662,"bch":-17.39149,"bdt":-62.79247,"bhd":-63.62871,"bmd":-63.62129,"bnb":-99.67103,"brl":-53.8445,"btc":-0.32896,"cad":-62.45264,"chf":-63.4543,"clp":-54.7089,"cny":-61.26497,"czk":-61.55431,"dkk":-61.13905,"eos":-16.10009,"eth":-92.21431,"eur":-61.26899,"gbp":-62.27369,"hkd":-63.55334,"huf":-58.87639,"idr":-62.15657,"ils":-64.07374,"inr":-59.26992,"jpy":-64.90022,"krw":-60.60644,"kwd":-63.4152,"lkr":-57.39745,"ltc":-52.11769,"mmk":-59.65748,"mxn":-63.10475,"myr":-62.79525,"nok":-60.29271,"nzd":-60.32548,"php":-63.31142,"pkr":-48.99833,"pln":-60.4529,"rub":-60.55354,"sar":-63.62382,"sek":-58.87165,"sgd":-63.20581,"thb":-66.23726,"try":-49.0973,"twd":-62.92736,"uah":-68.14693,"usd":-63.62129,"vef":-48.53915,"vnd":-62.77453,"xag":-65.86833,"xau":-68.86202,"xdr":-62.60861,"xlm":-33.15539,"xrp":-27.01399,"zar":-59.19278},"ath_date":{"aed":"2017-12-16T00:00:00.000Z","ars":"2019-08-13T13:41:31.186Z","aud":"2017-12-16T00:00:00.000Z","bch":"2018-12-15T16:19:57.060Z","bdt":"2017-12-16T00:00:00.000Z","bhd":"2017-12-16T00:00:00.000Z","bmd":"2017-12-16T00:00:00.000Z","bnb":"2017-10-19T00:00:00.000Z","brl":"2017-12-16T00:00:00.000Z","btc":"2019-10-15T16:00:56.136Z","cad":"2017-12-16T00:00:00.000Z","chf":"2017-12-16T00:00:00.000Z","clp":"2017-12-16T00:00:00.000Z","cny":"2017-12-16T00:00:00.000Z","czk":"2017-12-16T00:00:00.000Z","dkk":"2017-12-16T00:00:00.000Z","eos":"2019-09-05T20:22:13.572Z","eth":"2015-10-20T00:00:00.000Z","eur":"2017-12-16T00:00:00.000Z","gbp":"2017-12-16T00:00:00.000Z","hkd":"2017-12-16T00:00:00.000Z","huf":"2017-12-16T00:00:00.000Z","idr":"2017-12-16T00:00:00.000Z","ils":"2017-12-16T00:00:00.000Z","inr":"2017-12-16T00:00:00.000Z","jpy":"2017-12-16T00:00:00.000Z","krw":"2017-12-16T00:00:00.000Z","kwd":"2017-12-16T00:00:00.000Z","lkr":"2017-12-16T00:00:00.000Z","ltc":"2017-03-05T00:00:00.000Z","mmk":"2017-12-16T00:00:00.000Z","mxn":"2017-12-16T00:00:00.000Z","myr":"2017-12-16T00:00:00.000Z","nok":"2017-12-16T00:00:00.000Z","nzd":"2017-12-16T00:00:00.000Z","php":"2017-12-16T00:00:00.000Z","pkr":"2019-06-26T19:55:29.614Z","pln":"2017-12-16T00:00:00.000Z","rub":"2017-12-16T00:00:00.000Z","sar":"2017-12-16T00:00:00.000Z","sek":"2017-12-16T00:00:00.000Z","sgd":"2017-12-16T00:00:00.000Z","thb":"2017-12-16T00:00:00.000Z","try":"2019-06-26T19:55:29.614Z","twd":"2017-12-16T00:00:00.000Z","uah":"2017-12-16T00:00:00.000Z","usd":"2017-12-16T00:00:00.000Z","vef":"2019-06-26T19:55:29.614Z","vnd":"2017-12-16T00:00:00.000Z","xag":"2017-12-16T00:00:00.000Z","xau":"2017-12-16T00:00:00.000Z","xdr":"2017-12-16T00:00:00.000Z","xlm":"2019-09-12T22:33:57.455Z","xrp":"2019-09-06T12:53:39.935Z","zar":"2017-12-16T00:00:00.000Z"},"market_cap":{"aed":474793759318,"ars":7730972325788,"aud":190537867813,"bch":630551829,"bdt":10967221735647,"bhd":48741175024,"bmd":129269449023,"bnb":8504056047,"brl":540242881359,"btc":18061500,"cad":171672542961,"chf":128668733894,"clp":102976043092026,"cny":909940578620,"czk":2986033783826,"dkk":874823757177,"eos":49831754917,"eth":878149440,"eur":117068610616,"gbp":100617263456,"hkd":1011622634528,"huf":39109243612989,"idr":1823601645999521,"ils":448552061166,"inr":9272819588645,"jpy":14042144114110,"krw":152458449136441,"kwd":39265078063,"lkr":23281924163795,"ltc":2759842022,"mmk":195884749415125,"mxn":2507103402139,"myr":539325068270,"nok":1182462552968,"nzd":201673138152,"php":6576324680166,"pkr":20101399323136,"pln":503125744460,"rub":8247196943518,"sar":484759011874,"sek":1243159730063,"sgd":176297674578,"thb":3901906020384,"try":738440868912,"twd":3950345221975,"uah":3116344627531,"usd":129269449023,"vef":32121860601613224,"vnd":3004844249179323,"xag":7557859850,"xau":88142374,"xdr":93962084412,"xlm":2283168044885,"xrp":555894381400,"zar":1899894292486},"market_cap_rank":1,"total_volume":{"aed":138687050476,"ars":2258211477718,"aud":55673594578,"bch":183737598,"bdt":3203651532313,"bhd":14237857483,"bmd":37761091954,"bnb":2480204906,"brl":157962199864,"btc":5303296,"cad":50166932300,"chf":37609632215,"clp":30072933632557,"cny":265804102377,"czk":872704148379,"dkk":255678541091,"eos":14590103457,"eth":256232321,"eur":34214645720,"gbp":29408225131,"hkd":295508865363,"huf":11431065850716,"idr":532884529661782,"ils":131094616522,"inr":2708689636557,"jpy":4104423009447,"krw":44530522909173,"kwd":11469780637,"lkr":6800917663597,"ltc":805626595,"mmk":57220186912138,"mxn":732187572998,"myr":157543051743,"nok":345640000147,"nzd":58946461701,"php":1922417191403,"pkr":5871849798923,"pln":147054530842,"rub":2408855577961,"sar":141607455567,"sek":363160165026,"sgd":51510094341,"thb":1140290574296,"try":215692490077,"twd":1154318782196,"uah":910320086696,"usd":37761091954,"vef":9383164708217112,"vnd":878179122153079,"xag":2214048370,"xau":25773833,"xdr":27447404909,"xlm":665333514482,"xrp":162538792944,"zar":555079555485},"high_24h":{"aed":28288,"ars":460171,"aud":11341.92,"bch":35.462898,"bdt":653121,"bhd":2902.95,"bmd":7701.17,"bnb":479.999,"brl":32313,"btc":1.0,"cad":10224.26,"chf":7651.19,"clp":6150290,"cny":54135,"czk":177709,"dkk":52023,"eos":2804,"eth":49.32148,"eur":6961.83,"gbp":5962.03,"hkd":60252,"huf":2329092,"idr":108526800,"ils":26652,"inr":552563,"jpy":836775,"krw":9070591,"kwd":2338.72,"lkr":1386522,"ltc":155.932,"mmk":11702598,"mxn":149346,"myr":32102,"nok":70413,"nzd":12023.03,"php":391391,"pkr":1198463,"pln":29923,"rub":490607,"sar":28878,"sek":74080,"sgd":10492.07,"thb":232716,"try":43892,"twd":235078,"uah":186500,"usd":7701.17,"vef":1913645346,"vnd":178999196,"xag":450.44,"xau":5.26,"xdr":5594.65,"xlm":128230,"xrp":31649,"zar":113045},"low_24h":{"aed":25389,"ars":413252,"aud":10177.28,"bch":33.498779,"bdt":586479,"bhd":2606.33,"bmd":6912.76,"bnb":441.91,"brl":28872,"btc":1.0,"cad":9172.15,"chf":6875.83,"clp":5495871,"cny":48647,"czk":159479,"dkk":46725,"eos":2688,"eth":47.221694,"eur":6252.27,"gbp":5375.94,"hkd":54096,"huf":2089289,"idr":97454723,"ils":23978,"inr":495700,"jpy":750674,"krw":8145203,"kwd":2099.06,"lkr":1245015,"ltc":149.451,"mmk":10475054,"mxn":133891,"myr":28843,"nok":63132,"nzd":10775.68,"php":351479,"pkr":1073206,"pln":26857,"rub":440210,"sar":25927,"sek":66395,"sgd":9421.43,"thb":208711,"try":39550,"twd":211136,"uah":166648,"usd":6912.76,"vef":1717735697,"vnd":160482399,"xag":404.21,"xau":4.71,"xdr":5021.89,"xlm":124993,"xrp":30492,"zar":101450},"price_change_24h":-480.5673621733,"price_change_percentage_24h":-6.30404,"price_change_percentage_7d":-17.44599,"price_change_percentage_14d":-22.54054,"price_change_percentage_30d":-11.22023,"price_change_percentage_60d":-28.86786,"price_change_percentage_200d":24.23364,"price_change_percentage_1y":54.82116,"market_cap_change_24h":-9006537915.032,"market_cap_change_percentage_24h":-6.51345,"price_change_24h_in_currency":{"aed":-1765.3849375,"ars":-28250.7846463,"aud":-687.42268421,"bch":1.209693,"bdt":-40527.63640467,"bhd":-180.62666736,"bmd":-480.56736217,"bnb":13.500179,"brl":-2234.43033708,"btc":0.0,"cad":-631.36102032,"chf":-447.60591608,"clp":-374343.553352,"cny":-3307.29242038,"czk":-10750.48677935,"dkk":-3087.31721729,"eos":64.38,"eth":1.189393,"eur":-412.89174814,"gbp":-335.73696182,"hkd":-3726.49580785,"huf":-136103.17232295,"idr":-6721091.02167486,"ils":-1585.24792676,"inr":-34656.74698489,"jpy":-51434.05221209,"krw":-545602.5158788,"kwd":-145.59687908,"lkr":-83492.89071827,"ltc":0.41120093,"mmk":-738928.15288522,"mxn":-9373.69014498,"myr":-1954.66222593,"nok":-4225.97032316,"nzd":-741.18047963,"php":-24202.68533704,"pkr":-74347.06674375,"pln":-1774.3736239,"rub":-30122.73186387,"sar":-1801.65200366,"sek":-4761.52882112,"sgd":-641.55584025,"thb":-14530.99082294,"try":-2654.49777029,"twd":-14416.02940028,"uah":-12075.69031495,"usd":-480.56736217,"vef":-119415050.76443768,"vnd":-10911575.70808423,"xag":-25.13762803,"xau":-0.3155855,"xdr":-347.48043979,"xlm":-1338.794227113,"xrp":-784.6183422333,"zar":-7137.11714324},"price_change_percentage_1h_in_currency":{"aed":0.84905,"ars":0.86161,"aud":0.8867,"bch":-1.38159,"bdt":0.85317,"bhd":0.85317,"bmd":0.85317,"bnb":-1.51553,"brl":0.91348,"btc":0.0,"cad":0.915,"chf":0.88072,"clp":0.78989,"cny":0.87467,"czk":0.97735,"dkk":0.94907,"eos":-0.63738,"eth":-1.42231,"eur":0.94977,"gbp":0.91433,"hkd":0.86091,"huf":0.9903,"idr":0.88666,"ils":0.8754,"inr":0.90239,"jpy":0.87893,"krw":0.96319,"kwd":0.86978,"lkr":0.85317,"ltc":-1.45742,"mmk":0.85317,"mxn":0.85889,"myr":0.84592,"nok":1.07686,"nzd":0.85963,"php":1.01808,"pkr":0.85317,"pln":0.98571,"rub":0.95446,"sar":0.85328,"sek":0.92645,"sgd":0.9031,"thb":0.87489,"try":0.72911,"twd":0.89938,"uah":0.85317,"usd":0.85317,"vef":0.85317,"vnd":0.95458,"xag":1.08837,"xau":1.10648,"xdr":0.85317,"xlm":-1.37016,"xrp":0.15375,"zar":1.04254},"price_change_percentage_24h_in_currency":{"aed":-6.30532,"ars":-6.20356,"aud":-6.12774,"bch":3.60621,"bdt":-6.26872,"bhd":-6.2854,"bmd":-6.30404,"bnb":2.96293,"brl":-6.95795,"btc":0.0,"cad":-6.23841,"chf":-5.9195,"clp":-6.17453,"cny":-6.17208,"czk":-6.11433,"dkk":-6.00068,"eos":2.38856,"eth":2.51577,"eur":-5.99726,"gbp":-5.69203,"hkd":-6.25013,"huf":-5.92187,"idr":-6.25117,"ils":-6.0088,"inr":-6.33565,"jpy":-6.21338,"krw":-6.08344,"kwd":-6.28893,"lkr":-6.09481,"ltc":0.27057,"mmk":-6.39087,"mxn":-6.3392,"myr":-6.15559,"nok":-6.0714,"nzd":-6.2331,"php":-6.24051,"pkr":-6.27391,"pln":-5.99652,"rub":-6.20112,"sar":-6.30234,"sek":-6.48232,"sgd":-6.17783,"thb":-6.3118,"try":-6.10886,"twd":-6.19357,"uah":-6.55345,"usd":-6.30404,"vef":-6.30404,"vnd":-6.164,"xag":-5.66252,"xau":-6.07975,"xdr":-6.2731,"xlm":-1.05261,"xrp":-2.48855,"zar":-6.36494},"price_change_percentage_7d_in_currency":{"aed":-17.4561,"ars":-17.17189,"aud":-17.39343,"bch":11.54617,"bdt":-17.34556,"bhd":-17.42365,"bmd":-17.44599,"bnb":15.37505,"brl":-17.6939,"btc":0.0,"cad":-17.22355,"chf":-16.83939,"clp":-18.16528,"cny":-17.23081,"czk":-17.84696,"dkk":-17.5639,"eos":8.28045,"eth":3.50175,"eur":-17.56998,"gbp":-17.18365,"hkd":-17.46919,"huf":-17.62502,"idr":-17.26247,"ils":-17.71536,"inr":-17.71385,"jpy":-17.2919,"krw":-16.68652,"kwd":-17.43375,"lkr":-17.57364,"ltc":3.79137,"mmk":-17.47497,"mxn":-17.18117,"myr":-17.25559,"nok":-17.57382,"nzd":-17.76103,"php":-17.19551,"pkr":-17.66361,"pln":-17.28903,"rub":-17.622,"sar":-17.43643,"sek":-17.99201,"sgd":-17.30006,"thb":-17.44962,"try":-17.99541,"twd":-17.11248,"uah":-17.8811,"usd":-17.44599,"vef":-17.44599,"vnd":-17.01601,"xag":-17.68437,"xau":-17.19364,"xdr":-17.64438,"xlm":7.48208,"xrp":-4.57226,"zar":-18.1527},"price_change_percentage_14d_in_currency":{"aed":-22.55003,"ars":-22.26953,"aud":-21.20934,"bch":10.18823,"bdt":-22.4719,"bhd":-22.52698,"bmd":-22.54054,"bnb":3.78256,"brl":-20.98795,"btc":0.0,"cad":-21.89472,"chf":-22.44172,"clp":-16.95103,"cny":-21.8595,"czk":-22.52847,"dkk":-22.42537,"eos":3.89877,"eth":-1.80404,"eur":-22.42496,"gbp":-22.65386,"hkd":-22.54945,"huf":-22.08321,"idr":-21.79502,"ils":-23.09687,"inr":-21.7934,"jpy":-22.93533,"krw":-20.89782,"kwd":-22.52728,"lkr":-22.87826,"ltc":1.53118,"mmk":-22.72098,"mxn":-21.51393,"myr":-21.70354,"nok":-22.15384,"nzd":-22.92904,"php":-21.95551,"pkr":-22.80961,"pln":-21.72901,"rub":-22.2441,"sar":-22.54442,"sek":-22.62979,"sgd":-22.15219,"thb":-23.10963,"try":-23.08949,"twd":-21.78058,"uah":-23.91091,"usd":-22.54054,"vef":-22.54054,"vnd":-22.53941,"xag":-22.26463,"xau":-22.33687,"xdr":-22.55567,"xlm":1.69618,"xrp":-2.72537,"zar":-22.70147},"price_change_percentage_30d_in_currency":{"aed":-11.22443,"ars":-9.51444,"aud":-10.193,"bch":-1.85067,"bdt":-11.07576,"bhd":-11.21198,"bmd":-11.22023,"bnb":6.12033,"brl":-8.97239,"btc":0.0,"cad":-9.91713,"chf":-10.62881,"clp":-2.46349,"cny":-11.69817,"czk":-10.69528,"dkk":-10.45514,"eos":-0.60245,"eth":3.31477,"eur":-10.48102,"gbp":-10.92388,"hkd":-11.40589,"huf":-9.11838,"idr":-11.12997,"ils":-12.76593,"inr":-10.10704,"jpy":-11.04788,"krw":-10.68933,"kwd":-11.09524,"lkr":-11.91065,"ltc":1.16327,"mmk":-12.33699,"mxn":-10.07551,"myr":-11.44098,"nok":-11.18008,"nzd":-11.13426,"php":-11.70222,"pkr":-11.68762,"pln":-9.93606,"rub":-11.10484,"sar":-11.23433,"sek":-11.4895,"sgd":-11.12778,"thb":-11.50173,"try":-12.60444,"twd":-10.99896,"uah":-14.02182,"usd":-11.22023,"vef":-11.22023,"vnd":-11.12455,"xag":-8.57976,"xau":-9.77676,"xdr":-11.09094,"xlm":-2.0601,"xrp":11.18539,"zar":-10.5719},"price_change_percentage_60d_in_currency":{"aed":-28.87271,"ars":-24.94049,"aud":-28.98967,"bch":6.58558,"bdt":-28.55284,"bhd":-28.85919,"bmd":-28.86786,"bnb":-4.73332,"brl":-28.29542,"btc":0.0,"cad":-28.7742,"chf":-28.5492,"clp":-21.05412,"cny":-29.39446,"czk":-29.96813,"dkk":-28.93541,"eos":4.89171,"eth":2.15282,"eur":-28.98347,"gbp":-30.91919,"hkd":-29.00032,"huf":-28.93845,"idr":-28.57896,"ils":-29.88395,"inr":-28.33674,"jpy":-28.19392,"krw":-29.75392,"kwd":-28.86693,"lkr":-29.26237,"ltc":10.0907,"mmk":-29.68127,"mxn":-29.02416,"myr":-28.91758,"nok":-28.16281,"nzd":-30.41575,"php":-30.43231,"pkr":-29.27026,"pln":-30.19557,"rub":-29.14377,"sar":-28.88798,"sek":-29.4752,"sgd":-29.51848,"thb":-29.55026,"try":-29.23667,"twd":-29.86135,"uah":-29.77018,"usd":-28.86786,"vef":-28.86786,"vnd":-28.86503,"xag":-24.99432,"xau":-26.49988,"xdr":-29.12285,"xlm":-13.83671,"xrp":-14.54016,"zar":-29.92383},"price_change_percentage_200d_in_currency":{"aed":24.22488,"ars":66.85932,"aud":27.95174,"bch":76.94309,"bdt":24.91123,"bhd":24.2366,"bmd":24.23364,"bnb":86.35415,"brl":31.96581,"btc":0.0,"cad":22.59678,"chf":21.70062,"clp":46.20803,"cny":29.85077,"czk":25.05176,"dkk":26.08954,"eos":133.30477,"eth":36.87714,"eur":25.97742,"gbp":27.31032,"hkd":23.93812,"huf":30.22984,"idr":23.22097,"ils":20.37488,"inr":28.82094,"jpy":21.90092,"krw":25.82773,"kwd":24.06617,"lkr":26.37467,"ltc":100.2474,"mmk":23.76562,"mxn":26.42772,"myr":25.30265,"nok":30.11168,"nzd":28.35377,"php":22.01045,"pkr":36.51723,"pln":26.39489,"rub":21.26104,"sar":24.22499,"sek":24.9225,"sgd":24.29049,"thb":17.38252,"try":18.62205,"twd":22.88347,"uah":13.11625,"usd":24.23364,"vef":24.23364,"vnd":24.69572,"xag":8.68024,"xau":8.77097,"xdr":25.56291,"xlm":115.80188,"xrp":60.72697,"zar":26.48666},"price_change_percentage_1y_in_currency":{"aed":54.80299,"ars":155.34218,"aud":65.7028,"bch":78.89456,"bdt":57.19653,"bhd":54.81048,"bmd":54.82116,"bnb":-36.65258,"brl":70.52838,"btc":0.0,"cad":55.45654,"chf":55.10131,"clp":84.99866,"cny":57.31982,"czk":56.67972,"dkk":59.98455,"eos":129.05448,"eth":44.12795,"eur":59.73458,"gbp":54.03378,"hkd":54.68674,"huf":65.94232,"idr":49.69388,"ils":44.12632,"inr":56.02681,"jpy":48.86278,"krw":60.38647,"kwd":54.63991,"lkr":56.01994,"ltc":15.13364,"mmk":46.86442,"mxn":48.17348,"myr":54.61929,"nok":66.2395,"nzd":64.92835,"php":51.02989,"pkr":79.1998,"pln":59.54312,"rub":50.32841,"sar":54.6784,"sek":64.78944,"sgd":53.74122,"thb":42.06052,"try":66.34431,"twd":53.34085,"uah":34.53434,"usd":54.82116,"vef":54.80868,"vnd":54.8204,"xag":31.52974,"xau":29.51256,"xdr":56.55346,"xlm":458.8577,"xrp":200.09987,"zar":63.33739},"market_cap_change_24h_in_currency":{"aed":-33066285509.427795,"ars":-530278117251.8633,"aud":-12960274920.457092,"bch":24024713,"bdt":-759694248769.8789,"bhd":-3385553428.380455,"bmd":-9006537915.03212,"bnb":255092140,"brl":-42175575626.08362,"btc":1663,"cad":-12057111575.367401,"chf":-8491780658.011612,"clp":-7119297708339.391,"cny":-62028988767.01172,"czk":-203550613409.21533,"dkk":-58915127066.18848,"eos":1113960094,"eth":23139205,"eur":-7879783597.133743,"gbp":-6416093889.904633,"hkd":-69937566307.74951,"huf":-2567138850248.992,"idr":-127617002526785.75,"ils":-30288002282.410645,"inr":-646961300054.1992,"jpy":-965736921441.2344,"krw":-10313128196732.844,"kwd":-2728924342.179413,"lkr":-1566622601424.3633,"ltc":12247122,"mmk":-13842142728744.844,"mxn":-177409423821.13818,"myr":-36663555321.51227,"nok":-81603974747.83325,"nzd":-14103220841.779144,"php":-455362689074.46094,"pkr":-1393602846440.6172,"pln":-33879559789.90509,"rub":-570801019531.376,"sar":-33765015342.341797,"sek":-90223858525.68628,"sgd":-12077223463.969208,"thb":-272646025286.54932,"try":-49865416412.02966,"twd":-271842901196.03174,"uah":-226020631120.77588,"usd":-9006537915.03212,"vef":-2.238013371260464e+15,"vnd":-207810852801656.0,"xag":-501296089.4158993,"xau":-5993152.57134043,"xdr":-6570642236.026748,"xlm":-26680177257.057617,"xrp":-14067201416.741577,"zar":-135321097818.74121},"market_cap_change_percentage_24h_in_currency":{"aed":-6.51091,"ars":-6.41886,"aud":-6.36874,"bch":3.96103,"bdt":-6.47821,"bhd":-6.49485,"bmd":-6.51345,"bnb":3.09241,"brl":-7.24146,"btc":0.00921,"cad":-6.56242,"chf":-6.19113,"clp":-6.46648,"cny":-6.38178,"czk":-6.38173,"dkk":-6.30959,"eos":2.28656,"eth":2.70631,"eur":-6.30643,"gbp":-5.99448,"hkd":-6.46636,"huf":-6.1597,"idr":-6.54037,"ils":-6.32529,"inr":-6.52193,"jpy":-6.43487,"krw":-6.33595,"kwd":-6.49837,"lkr":-6.30469,"ltc":0.44574,"mmk":-6.60008,"mxn":-6.60863,"myr":-6.36533,"nok":-6.45567,"nzd":-6.53604,"php":-6.47587,"pkr":-6.48338,"pln":-6.30898,"rub":-6.47314,"sar":-6.51176,"sek":-6.76653,"sgd":-6.41127,"thb":-6.53114,"try":-6.32564,"twd":-6.43844,"uah":-6.7623,"usd":-6.51345,"vef":-6.51345,"vnd":-6.46851,"xag":-6.22021,"xau":-6.36652,"xdr":-6.53582,"xlm":-1.15506,"xrp":-2.4681,"zar":-6.64898},"total_supply":21000000.0,"circulating_supply":18061500.0,"last_updated":"2019-11-22T15:50:18.919Z"},"public_interest_stats":{"alexa_rank":12740,"bing_matches":135000000},"status_updates":[],"last_updated":"2019-11-22T15:50:18.919Z"} diff --git a/fiat/mock_data/market_chart_eth_other.json b/fiat/mock_data/market_chart_eth_other.json new file mode 100644 index 0000000000..aa416fdb18 --- /dev/null +++ b/fiat/mock_data/market_chart_eth_other.json @@ -0,0 +1,23 @@ +{ + "prices": [ + [1654560000000, 245991.30610738738], + [1654646400000, 241439.61063702923], + [1654732800000, 241272.47868584536], + [1654819200000, 240402.9616407818], + [1654874261000, 232687.7973743471] + ], + "market_caps": [ + [1654560000000, 29783749062026.934], + [1654646400000, 29309140822797.383], + [1654732800000, 29218371977967.83], + [1654819200000, 29135342816603.11], + [1654874261000, 28322159926577.836] + ], + "total_volumes": [ + [1654560000000, 2198234703995.5186], + [1654646400000, 3139844528072.9595], + [1654732800000, 2381462737920.105], + [1654819200000, 1407275835572.8992], + [1654874261000, 1875231811513.972] + ] +} diff --git a/fiat/mock_data/market_chart_eth_usd_1.json b/fiat/mock_data/market_chart_eth_usd_1.json new file mode 100644 index 0000000000..d70ef2e368 --- /dev/null +++ b/fiat/mock_data/market_chart_eth_usd_1.json @@ -0,0 +1,14 @@ +{ + "prices": [ + [1654819200000, 1788.4182866616045], + [1654871975000, 1741.4106052586249] + ], + "market_caps": [ + [1654819200000, 216720355679.05618], + [1654871975000, 210920939953.81134] + ], + "total_volumes": [ + [1654819200000, 10469080004.414614], + [1654871975000, 13875498345.972267] + ] +} diff --git a/fiat/mock_data/market_chart_eth_usd_max.json b/fiat/mock_data/market_chart_eth_usd_max.json new file mode 100644 index 0000000000..9d1fb3bd02 --- /dev/null +++ b/fiat/mock_data/market_chart_eth_usd_max.json @@ -0,0 +1,17 @@ +{ + "prices": [ + [1654560000000, 1860.1813068416047], + [1654646400000, 1818.3877119829308], + [1654732800000, 1794.539625671828] + ], + "market_caps": [ + [1654560000000, 225224111085.68793], + [1654646400000, 220727955347.00992], + [1654732800000, 217320792647.69748] + ], + "total_volumes": [ + [1654560000000, 16623006597.793545], + [1654646400000, 23647547692.445885], + [1654732800000, 17712874976.607395] + ] +} diff --git a/fiat/mock_data/market_chart_token_other.json b/fiat/mock_data/market_chart_token_other.json new file mode 100644 index 0000000000..2a439f387c --- /dev/null +++ b/fiat/mock_data/market_chart_token_other.json @@ -0,0 +1,23 @@ +{ + "prices": [ + [1654560000000, 43129640.779293984], + [1654646400000, 42170403.75197084], + [1654732800000, 41617340.4960857], + [1654819200000, 41464477.97624925], + [1654893557000, 39012012.89610346] + ], + "market_caps": [ + [1654560000000, 5221982916522588], + [1654646400000, 5118923172979404], + [1654732800000, 5039907336185186], + [1654819200000, 5024661446418917], + [1654893557000, 4722632860950729] + ], + "total_volumes": [ + [1654560000000, 385416357318398.5], + [1654646400000, 548412545554966], + [1654732800000, 410780981662688], + [1654819200000, 242725619902352.5], + [1654893557000, 395315245827820.75] + ] +} diff --git a/fiat/mock_data/simpleprice_base.json b/fiat/mock_data/simpleprice_base.json new file mode 100644 index 0000000000..0f098214e1 --- /dev/null +++ b/fiat/mock_data/simpleprice_base.json @@ -0,0 +1,12 @@ +{ + "ethereum": { + "btc": 0.07531005, + "eth": 1.0, + "ltc": 29.097696, + "usd": 2299.72, + "eur": 2182.99, + "aed": 8447.1, + "ars": 268901, + "aud": 3314.36 + } +} diff --git a/fiat/mock_data/simpleprice_tokens.json b/fiat/mock_data/simpleprice_tokens.json new file mode 100644 index 0000000000..3d8e71dab7 --- /dev/null +++ b/fiat/mock_data/simpleprice_tokens.json @@ -0,0 +1,8 @@ +{ + "ethereum-cash-token": { + "eth": 1.39852e-10 + }, + "vendit": { + "eth": 5.58195e-07 + } +} \ No newline at end of file diff --git a/fiat/mock_data/vs_currencies.json b/fiat/mock_data/vs_currencies.json new file mode 100644 index 0000000000..76cd47dbe0 --- /dev/null +++ b/fiat/mock_data/vs_currencies.json @@ -0,0 +1,10 @@ +[ + "btc", + "eth", + "ltc", + "usd", + "eur", + "aed", + "ars", + "aud" +] diff --git a/fourbyte/fourbyte.go b/fourbyte/fourbyte.go new file mode 100644 index 0000000000..2be1a158e1 --- /dev/null +++ b/fourbyte/fourbyte.go @@ -0,0 +1,200 @@ +package fourbyte + +import ( + "encoding/json" + "errors" + "io/ioutil" + "net/http" + "strconv" + "strings" + "time" + + "github.com/golang/glog" + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/db" +) + +// Coingecko is a structure that implements RatesDownloaderInterface +type FourByteSignaturesDownloader struct { + url string + httpTimeoutSeconds time.Duration + db *db.RocksDB +} + +// NewFourByteSignaturesDownloader initializes the downloader for FourByteSignatures API. +func NewFourByteSignaturesDownloader(db *db.RocksDB, url string) (*FourByteSignaturesDownloader, error) { + return &FourByteSignaturesDownloader{ + url: url, + httpTimeoutSeconds: 15 * time.Second, + db: db, + }, nil +} + +// Run starts the FourByteSignatures downloader +func (fd *FourByteSignaturesDownloader) Run() { + period := time.Hour * 24 + timer := time.NewTimer(period) + for { + fd.downloadSignatures() + <-timer.C + timer.Reset(period) + } +} + +type signatureData struct { + Id int `json:"id"` + TextSignature string `json:"text_signature"` + HexSignature string `json:"hex_signature"` +} + +type signaturesPage struct { + Count int `json:"count"` + Next string `json:"next"` + Results []signatureData `json:"results"` +} + +func (fd *FourByteSignaturesDownloader) getPage(url string) (*signaturesPage, error) { + req, err := http.NewRequest("GET", url, nil) + if err != nil { + glog.Errorf("Error creating a new request for %v: %v", url, err) + return nil, err + } + req.Close = true + req.Header.Set("Content-Type", "application/json") + client := &http.Client{ + Timeout: fd.httpTimeoutSeconds, + } + resp, err := client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return nil, errors.New("Invalid response status: " + string(resp.Status)) + } + bodyBytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return nil, err + } + var data signaturesPage + err = json.Unmarshal(bodyBytes, &data) + if err != nil { + glog.Errorf("Error parsing 4byte signatures response from %s: %v", url, err) + return nil, err + } + return &data, nil +} + +func (fd *FourByteSignaturesDownloader) getPageWithRetry(url string) (*signaturesPage, error) { + for retry := 1; retry <= 16; retry++ { + page, err := fd.getPage(url) + if err == nil && page != nil { + return page, err + } + glog.Errorf("Error getting 4byte signatures from %s: %v, retry count %d", url, err, retry) + timer := time.NewTimer(time.Second * time.Duration(retry)) + <-timer.C + } + return nil, errors.New("Too many retries to 4byte signatures") +} + +func parseSignatureFromText(t string) *bchain.FourByteSignature { + s := strings.Index(t, "(") + e := strings.LastIndex(t, ")") + if s < 0 || e < 0 { + return nil + } + var signature bchain.FourByteSignature + signature.Name = t[:s] + params := t[s+1 : e] + if len(params) > 0 { + s = 0 + tupleDepth := 0 + // parse params as comma separated list + // tuple is regarded as one parameter and not parsed further + for i, c := range params { + if c == ',' && tupleDepth == 0 { + signature.Parameters = append(signature.Parameters, params[s:i]) + s = i + 1 + } else if c == '(' { + tupleDepth++ + } else if c == ')' { + tupleDepth-- + } + } + signature.Parameters = append(signature.Parameters, params[s:]) + } + return &signature +} + +func (fd *FourByteSignaturesDownloader) downloadSignatures() { + period := time.Millisecond * 100 + timer := time.NewTimer(period) + url := fd.url + results := make([]signatureData, 0) + glog.Info("FourByteSignaturesDownloader starting download") + for { + page, err := fd.getPageWithRetry(url) + if err != nil { + glog.Errorf("Error getting 4byte signatures from %s: %v", url, err) + return + } + if page == nil { + glog.Errorf("Empty page from 4byte signatures from %s: %v", url, err) + return + } + glog.Infof("FourByteSignaturesDownloader downloaded %s with %d results", url, len(page.Results)) + if len(page.Results) > 0 { + fourBytes, err := strconv.ParseUint(page.Results[0].HexSignature, 0, 0) + if err != nil { + glog.Errorf("Invalid 4byte signature %+v on page %s: %v", page.Results[0], url, err) + return + } + sig, err := fd.db.GetFourByteSignature(uint32(fourBytes), uint32(page.Results[0].Id)) + if err != nil { + glog.Errorf("db.GetFourByteSignature error %+v on page %s: %v", page.Results[0], url, err) + return + } + // signature is already stored in db, break + if sig != nil { + break + } + results = append(results, page.Results...) + } + if page.Next == "" { + // at the end + break + } + url = page.Next + // wait a bit to not to flood the server + <-timer.C + timer.Reset(period) + } + if len(results) > 0 { + glog.Infof("FourByteSignaturesDownloader storing %d new signatures", len(results)) + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + + for i := range results { + r := &results[i] + fourBytes, err := strconv.ParseUint(r.HexSignature, 0, 0) + if err != nil { + glog.Errorf("Invalid 4byte signature %+v: %v", r, err) + return + } + fbs := parseSignatureFromText(r.TextSignature) + if fbs != nil { + fd.db.StoreFourByteSignature(wb, uint32(fourBytes), uint32(r.Id), fbs) + } else { + glog.Errorf("FourByteSignaturesDownloader invalid signature %s", r.TextSignature) + } + } + + if err := fd.db.WriteBatch(wb); err != nil { + glog.Errorf("FourByteSignaturesDownloader failed to store signatures, %v", err) + } + + } + glog.Infof("FourByteSignaturesDownloader finished") +} diff --git a/fourbyte/fourbyte_test.go b/fourbyte/fourbyte_test.go new file mode 100644 index 0000000000..c64ddad5ce --- /dev/null +++ b/fourbyte/fourbyte_test.go @@ -0,0 +1,55 @@ +package fourbyte + +import ( + "reflect" + "testing" + + "github.com/trezor/blockbook/bchain" +) + +func Test_parseSignatureFromText(t *testing.T) { + tests := []struct { + name string + signature string + want bchain.FourByteSignature + }{ + { + name: "_gonsPerFragment", + signature: "_gonsPerFragment()", + want: bchain.FourByteSignature{ + Name: "_gonsPerFragment", + }, + }, + { + name: "vestingDeposits", + signature: "vestingDeposits(address)", + want: bchain.FourByteSignature{ + Name: "vestingDeposits", + Parameters: []string{"address"}, + }, + }, + { + name: "batchTransferTokenB", + signature: "batchTransferTokenB(address[],uint256)", + want: bchain.FourByteSignature{ + Name: "batchTransferTokenB", + Parameters: []string{"address[]", "uint256"}, + }, + }, + { + name: "transmitAndSellTokenForEth", + signature: "transmitAndSellTokenForEth(address,uint256,uint256,uint256,address,(uint8,bytes32,bytes32),bytes)", + want: bchain.FourByteSignature{ + Name: "transmitAndSellTokenForEth", + Parameters: []string{"address", "uint256", "uint256", "uint256", "address", "(uint8,bytes32,bytes32)", "bytes"}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := parseSignatureFromText(tt.signature); !reflect.DeepEqual(*got, tt.want) { + t.Errorf("parseSignatureFromText() = %v, want %v", *got, tt.want) + } + }) + } +} diff --git a/go.mod b/go.mod index eb384ddb06..0b44d03671 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,11 @@ module github.com/trezor/blockbook -go 1.17 +go 1.25.0 require ( - github.com/Groestlcoin/go-groestl-hash v0.0.0-20181012171753-790653ac190c // indirect + github.com/ava-labs/avalanchego v1.14.0 github.com/bsm/go-vlq v0.0.0-20150828105119-ec6e8d4f5f4e - github.com/dchest/blake256 v1.0.0 // indirect - github.com/deckarep/golang-set v1.7.1 + github.com/deckarep/golang-set v1.8.0 github.com/decred/dcrd/chaincfg/chainhash v1.0.2 github.com/decred/dcrd/chaincfg/v3 v3.0.0 github.com/decred/dcrd/dcrec v1.0.0 @@ -14,62 +13,75 @@ require ( github.com/decred/dcrd/dcrutil/v3 v3.0.0 github.com/decred/dcrd/hdkeychain/v3 v3.0.0 github.com/decred/dcrd/txscript/v3 v3.0.0 - github.com/ethereum/go-ethereum v1.10.8 - github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect - github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 // indirect - github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect - github.com/flier/gorocksdb v0.0.0-20210322035443-567cc51a1652 - github.com/gogo/protobuf v1.3.2 - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b - github.com/golang/protobuf v1.4.3 - github.com/gorilla/websocket v1.4.2 + github.com/ethereum/go-ethereum v1.16.7 + github.com/golang/glog v1.2.1 + github.com/gorilla/websocket v1.5.0 github.com/juju/errors v0.0.0-20170703010042-c7d06af17c68 - github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 // indirect - github.com/juju/testing v0.0.0-20191001232224-ce9dec17d28b // indirect + github.com/linxGnu/grocksdb v1.9.8 github.com/martinboehm/bchutil v0.0.0-20190104112650-6373f11b6efe - github.com/martinboehm/btcd v0.0.0-20211010165247-d1f65b0f30fa + github.com/martinboehm/btcd v0.0.0-20221101112928-408689e15809 github.com/martinboehm/btcutil v0.0.0-20211010173611-6ef1889c1819 github.com/martinboehm/golang-socketio v0.0.0-20180414165752-f60b0a8befde - github.com/mr-tron/base58 v1.2.0 // indirect - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pebbe/zmq4 v1.2.1 github.com/pirk/ecashaddr-converter v0.0.0-20220121162910-c6cb45163b29 github.com/pirk/ecashutil v0.0.0-20220124103933-d37f548d249e - github.com/prometheus/client_golang v1.8.0 + github.com/prometheus/client_golang v1.23.2 github.com/schancel/cashaddr-converter v0.0.0-20181111022653-4769e7add95a - golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect - gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect + github.com/tkrajina/typescriptify-golang-structs v0.1.11 + golang.org/x/crypto v0.43.0 + google.golang.org/protobuf v1.36.10 ) require ( + github.com/Groestlcoin/go-groestl-hash v0.0.0-20181012171753-790653ac190c // indirect + github.com/Microsoft/go-winio v0.6.2 // indirect github.com/PiRK/cashaddr-converter v0.0.0-20220121162910-c6cb45163b29 // indirect - github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect + github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 // indirect + github.com/aead/siphash v1.0.1 // indirect github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/btcsuite/btcd v0.20.1-beta // indirect + github.com/bits-and-blooms/bitset v1.20.0 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect - github.com/cespare/xxhash/v2 v2.1.1 // indirect - github.com/dchest/siphash v1.2.1 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/consensys/gnark-crypto v0.18.1 // indirect + github.com/crate-crypto/go-eth-kzg v1.4.0 // indirect + github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect + github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect + github.com/dchest/blake256 v1.0.0 // indirect + github.com/dchest/siphash v1.2.3 // indirect + github.com/deckarep/golang-set/v2 v2.6.0 // indirect github.com/decred/base58 v1.0.3 // indirect - github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect + github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect github.com/decred/dcrd/crypto/ripemd160 v1.0.1 // indirect github.com/decred/dcrd/dcrec/edwards/v2 v2.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect github.com/decred/dcrd/wire v1.4.0 // indirect github.com/decred/slog v1.1.0 // indirect - github.com/go-ole/go-ole v1.2.1 // indirect - github.com/go-stack/stack v1.8.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.14.0 // indirect - github.com/prometheus/procfs v0.2.0 // indirect - github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/tklauser/go-sysconf v0.3.5 // indirect - github.com/tklauser/numcpus v0.2.2 // indirect - golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 // indirect - google.golang.org/protobuf v1.23.0 // indirect - gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect + github.com/ethereum/c-kzg-4844 v1.0.0 // indirect + github.com/ethereum/c-kzg-4844/v2 v2.1.5 // indirect + github.com/ethereum/go-verkle v0.2.2 // indirect + github.com/go-ole/go-ole v1.3.0 // indirect + github.com/gorilla/rpc v1.2.0 // indirect + github.com/holiman/uint256 v1.3.2 // indirect + github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 // indirect + github.com/juju/testing v0.0.0-20191001232224-ce9dec17d28b // indirect + github.com/kkdai/bstream v0.0.0-20171226095907-f71540b9dfdc // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.67.3 // indirect + github.com/prometheus/procfs v0.16.1 // indirect + github.com/shirou/gopsutil v3.21.11+incompatible // indirect + github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe // indirect + github.com/tklauser/go-sysconf v0.3.15 // indirect + github.com/tklauser/numcpus v0.10.0 // indirect + github.com/tkrajina/go-reflector v0.5.5 // indirect + github.com/yusufpapurcu/wmi v1.2.4 // indirect + go.yaml.in/yaml/v2 v2.4.3 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.37.0 // indirect + gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect ) // replace github.com/martinboehm/btcutil => ../btcutil diff --git a/go.sum b/go.sum index dc27b61eab..c7e0c7d0d0 100644 --- a/go.sum +++ b/go.sum @@ -1,97 +1,30 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4= -github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc= -github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= +github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Groestlcoin/go-groestl-hash v0.0.0-20181012171753-790653ac190c h1:8bYNmjELeCj7DEh/dN7zFzkJ0upK3GkbOC/0u1HMQ5s= github.com/Groestlcoin/go-groestl-hash v0.0.0-20181012171753-790653ac190c/go.mod h1:DwgC62sAn4RgH4L+O8REgcE7f0XplHPNeRYFy+ffy1M= -github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/PiRK/cashaddr-converter v0.0.0-20220121162910-c6cb45163b29 h1:B11BryeZQ1LrAzzM0lCpblwleB7SyxPfvN2AsNbyvQc= github.com/PiRK/cashaddr-converter v0.0.0-20220121162910-c6cb45163b29/go.mod h1:+39XiGr9m9TPY49sG4XIH5CVaRxHGFWT0U4MOY6dy3o= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= -github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6 h1:1zYrtlhrZ6/b6SAjLSfKzWtdgqK0U+HtH/VcBWh1BaU= +github.com/ProjectZKM/Ziren/crates/go-runtime/zkvm_runtime v0.0.0-20251001021608-1fe7b43fc4d6/go.mod h1:ioLG6R+5bUSO1oeGSDxOV3FADARuMoytZCSX6MEMQkI= +github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI= +github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI= +github.com/VictoriaMetrics/fastcache v1.13.0 h1:AW4mheMR5Vd9FkAPUv+NH6Nhw+fmbTMGMsNAoA/+4G0= +github.com/aead/siphash v1.0.1 h1:FwHfE/T45KPKYuuSAKyyvE+oPWcaQ+CUmFW0bPlM+kg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= -github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI= github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= -github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/ava-labs/avalanchego v1.14.0 h1:0j314N1fEwstKSymvyhvvxi8Hr752xc6MQvjq6kGIJY= +github.com/ava-labs/avalanchego v1.14.0/go.mod h1:7sYTcQknONY5x5qzS+GrN+UtyB8kX7Q5ClHhGj1DgXg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3MdfoPyRVU= +github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bsm/go-vlq v0.0.0-20150828105119-ec6e8d4f5f4e h1:D64GF/Xr5zSUnM3q1Jylzo4sK7szhP/ON+nb2DB5XJA= github.com/bsm/go-vlq v0.0.0-20150828105119-ec6e8d4f5f4e/go.mod h1:N+BjUcTjSxc2mtRGSCPsat1kze3CUtvJN3/jTXlp29k= -github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4= @@ -101,51 +34,55 @@ github.com/btcsuite/snappy-go v1.0.0 h1:ZxaA6lo2EpxGddsA8JwWOcxlzRybb444sgmeJQMJ github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= -github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= -github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= -github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= -github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cockroachdb/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= +github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/pebble v1.1.5 h1:5AAWCBWbat0uE0blr8qzufZP5tBjkRyy/jWe1QWLnvw= +github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= +github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/consensys/gnark-crypto v0.18.1 h1:RyLV6UhPRoYYzaFnPQA4qK3DyuDgkTgskDdoGqFt3fI= +github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c= +github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/crate-crypto/go-eth-kzg v1.4.0 h1:WzDGjHk4gFg6YzV0rJOAsTK4z3Qkz5jd4RE3DAvPFkg= +github.com/crate-crypto/go-eth-kzg v1.4.0/go.mod h1:J9/u5sWfznSObptgfa92Jq8rTswn6ahQWEuiLHOjCUI= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a h1:W8mUrRp6NOVl3J+MYp5kPMoUZPp7aOYHtaua31lwRHg= +github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a/go.mod h1:sTwzHBvIzm2RfVCGNEBZgRyjwK40bVoun3ZnGOCafNM= +github.com/crate-crypto/go-kzg-4844 v1.1.0 h1:EN/u9k2TF6OWSHrCCDBBU6GLNMq88OspHHlMnHfoyU4= +github.com/crate-crypto/go-kzg-4844 v1.1.0/go.mod h1:JolLjpSff1tCCJKaJx4psrlEdlXuJEC996PL3tTAFks= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/blake256 v1.0.0 h1:6gUgI5MHdz9g0TdrgKqXsoDX+Zjxmm1Sc6OsoGru50I= github.com/dchest/blake256 v1.0.0/go.mod h1:xXNWCE1jsAP8DAjP+rKw2MbeqLczjI3TRx2VK+9OEYY= github.com/dchest/siphash v1.2.1 h1:4cLinnzVJDKxTCl9B01807Yiy+W7ZzVHj/KIroQRvT4= github.com/dchest/siphash v1.2.1/go.mod h1:q+IRvb2gOSrUnYoPqHiyHXS0FOBBOdl6tONBlVnOnt4= -github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= -github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ= -github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ= +github.com/dchest/siphash v1.2.3 h1:QXwFc8cFOR2dSa/gE6o/HokBMWtLUaNDVd+22aKHeEA= +github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc= +github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80NsVHagjM= +github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/base58 v1.0.3 h1:KGZuh8d1WEMIrK0leQRM47W85KqCAdl2N+uagbctdDI= github.com/decred/base58 v1.0.3/go.mod h1:pXP9cXCfM2sFLb2viz2FNIdeMWmZDBKG3ZBYbiSM78E= github.com/decred/dcrd/chaincfg/chainhash v1.0.2 h1:rt5Vlq/jM3ZawwiacWjPa+smINyLRN07EO0cNBV6DGU= github.com/decred/dcrd/chaincfg/chainhash v1.0.2/go.mod h1:BpbrGgrPTr3YJYRN3Bm+D9NuaFd+zGyNeIKgrhCXK60= github.com/decred/dcrd/chaincfg/v3 v3.0.0 h1:+TFbu7ZmvBwM+SZz5mrj6cun9ts/6DAL5sqnsaFBHGQ= github.com/decred/dcrd/chaincfg/v3 v3.0.0/go.mod h1:EspyubQ7D2w6tjP7rBGDIE7OTbuMgBjR2F2kZFnh31A= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= +github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/crypto/ripemd160 v1.0.1 h1:TjRL4LfftzTjXzaufov96iDAkbY2R3aTvH2YMYa1IOc= github.com/decred/dcrd/crypto/ripemd160 v1.0.1/go.mod h1:F0H8cjIuWTRoixr/LM3REB8obcWkmYx0gbxpQWR8RPg= github.com/decred/dcrd/dcrec v1.0.0 h1:W+z6Es+Rai3MXYVoPAxYr5U1DGis0Co33scJ6uH2J6o= @@ -154,6 +91,8 @@ github.com/decred/dcrd/dcrec/edwards/v2 v2.0.1 h1:V6eqU1crZzuoFT4KG2LhaU5xDSdkHu github.com/decred/dcrd/dcrec/edwards/v2 v2.0.1/go.mod h1:d0H8xGMWbiIQP7gN3v2rByWUcuZPm9YsgmnfoxgbINc= github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0 h1:sgNeV1VRMDzs6rzyPpxyM0jp317hnwiq58Filgag2xw= github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0/go.mod h1:J70FGZSbzsjecRTiTzER+3f1KZLNaXkuv+yeFTKoxM8= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= github.com/decred/dcrd/dcrjson/v3 v3.0.1 h1:b9cpplNJG+nutE2jS8K/BtSGIJihEQHhFjFAsvJF/iI= github.com/decred/dcrd/dcrjson/v3 v3.0.1/go.mod h1:fnTHev/ABGp8IxFudDhjGi9ghLiXRff1qZz/wvq12Mg= github.com/decred/dcrd/dcrutil/v3 v3.0.0 h1:n6uQaTQynIhCY89XsoDk2WQqcUcnbD+zUM9rnZcIOZo= @@ -167,755 +106,222 @@ github.com/decred/dcrd/wire v1.4.0 h1:KmSo6eTQIvhXS0fLBQ/l7hG7QLcSJQKSwSyzSqJYDk github.com/decred/dcrd/wire v1.4.0/go.mod h1:WxC/0K+cCAnBh+SKsRjIX9YPgvrjhmE+6pZlel1G7Ro= github.com/decred/slog v1.1.0 h1:uz5ZFfmaexj1rEDgZvzQ7wjGkoSPjw2LCh8K+K1VrW4= github.com/decred/slog v1.1.0/go.mod h1:kVXlGnt6DHy2fV5OjSeuvCJ0OmlmTF6LFpEPMu/fOY0= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/dop251/goja v0.0.0-20200721192441-a695b0cdd498/go.mod h1:Mw6PkjjMXWbTj+nnj4s3QPXq1jaT0s5pC0iFD4+BOAA= -github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= -github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= -github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.10.8 h1:0UP5WUR8hh46ffbjJV7PK499+uGEyasRIfffS0vy06o= -github.com/ethereum/go-ethereum v1.10.8/go.mod h1:pJNuIUYfX5+JKzSD/BTdNsvJSZ1TJqmz0dVyXMAbf6M= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= -github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= -github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= -github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/flier/gorocksdb v0.0.0-20210322035443-567cc51a1652 h1:8GVjZ8n6qgX3b/0aklxpNar3RLkvS6G7FZcHkiHDUHs= -github.com/flier/gorocksdb v0.0.0-20210322035443-567cc51a1652/go.mod h1:CzkODoa0BVoE4x+tw0Pd0MOyGN/u4ip7M06gXTI7htQ= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= -github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= -github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-sourcemap/sourcemap v2.1.2+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA= +github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0= +github.com/ethereum/c-kzg-4844/v2 v2.1.5 h1:aVtoLK5xwJ6c5RiqO8g8ptJ5KU+2Hdquf6G3aXiHh5s= +github.com/ethereum/c-kzg-4844/v2 v2.1.5/go.mod h1:u59hRTTah4Co6i9fDWtiCjTrblJv0UwsqZKCc0GfgUs= +github.com/ethereum/go-ethereum v1.15.5 h1:Fo2TbBWC61lWVkFw9tsMoHCNX1ndpuaQBRJ8H6xLUPo= +github.com/ethereum/go-ethereum v1.15.5/go.mod h1:1LG2LnMOx2yPRHR/S+xuipXH29vPr6BIH6GElD8N/fo= +github.com/ethereum/go-ethereum v1.16.7 h1:qeM4TvbrWK0UC0tgkZ7NiRsmBGwsjqc64BHo20U59UQ= +github.com/ethereum/go-ethereum v1.16.7/go.mod h1:Fs6QebQbavneQTYcA39PEKv2+zIjX7rPUZ14DER46wk= +github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8= +github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk= +github.com/getsentry/sentry-go v0.35.0 h1:+FJNlnjJsZMG3g0/rmmP7GiKjQoUF5EXfEtBwtPtkzY= +github.com/getsentry/sentry-go v0.35.0/go.mod h1:C55omcY9ChRQIUcVcGcs+Zdy4ZpQGvNJ7JYHIoSWOtE= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= +github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= +github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= +github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.5 h1:kxhtnfFVi+rYdOALN0B3k9UT86zVJKfBimRaciULW4I= -github.com/google/uuid v1.1.5/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= -github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v0.0.0-20201113091052-beb923fada29/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= -github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= -github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= -github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= +github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang/glog v1.2.1 h1:OptwRhECazUx5ix5TTWC3EZhsZEHWcYWY4FQHTIubm4= +github.com/golang/glog v1.2.1/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= +github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/gorilla/rpc v1.2.0 h1:WvvdC2lNeT1SP32zrIce5l0ECBfbAlmrmSBsuc57wfk= +github.com/gorilla/rpc v1.2.0/go.mod h1:V4h9r+4sF5HnzqbwIez0fKSpANP0zlYd3qR7p36jkTQ= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= +github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= +github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= +github.com/holiman/billy v0.0.0-20250707135307-f2f9b9aae7db h1:IZUYC/xb3giYwBLMnr8d0TGTzPKFGNTCGgGLoyeX330= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/holiman/uint256 v1.3.2 h1:a9EgMPSC1AAaj1SZL5zIQD3WbwTuHrMGOerLjGmM/TA= +github.com/holiman/uint256 v1.3.2/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.2 h1:RfGLP+h3mvisuWEyybxNq5Eft3NWhHLPeUN72kpKZoI= -github.com/huin/goupnp v1.0.2/go.mod h1:0dxJBVBHqTMjIUMkESDTNgOOx/Mw5wYIfyFmdzSamkM= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= -github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= -github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= -github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= -github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= -github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458 h1:6OvNmYgJyexcZ3pYbTI9jWx5tHo1Dee/tWbLMfPe2TA= -github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/errors v0.0.0-20170703010042-c7d06af17c68 h1:d2hBkTvi7B89+OXY8+bBBshPlc+7JYacGrG/dFak8SQ= github.com/juju/errors v0.0.0-20170703010042-c7d06af17c68/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 h1:UUHMLvzt/31azWTN/ifGWef4WUqvXk0iRqdhdy/2uzI= github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= github.com/juju/testing v0.0.0-20191001232224-ce9dec17d28b h1:Rrp0ByJXEjhREMPGTt3aWYjoIsUGCbt21ekbeJcTWv0= github.com/juju/testing v0.0.0-20191001232224-ce9dec17d28b/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356 h1:I/yrLt2WilKxlQKCM52clh5rGzTKpVctGT1lH4Dc8Jw= -github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= +github.com/kkdai/bstream v0.0.0-20171226095907-f71540b9dfdc h1:I1QApI4r4SG8Hh45H0yRjVnThWRn1oOwod76rrAe5KE= github.com/kkdai/bstream v0.0.0-20171226095907-f71540b9dfdc/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= -github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/leanovate/gopter v0.2.11 h1:vRjThO1EKPb/1NsDXuDrzldR28RLkBflWYcU9CvzWu4= +github.com/leanovate/gopter v0.2.11/go.mod h1:aK3tzZP/C+p1m3SPRE4SYZFGP7jjkuSI4f7Xvpt0S9c= +github.com/linxGnu/grocksdb v1.9.8 h1:vOIKv9/+HKiqJAElJIEYv3ZLcihRxyP7Suu/Mu8Dxjs= +github.com/linxGnu/grocksdb v1.9.8/go.mod h1:C3CNe9UYc9hlEM2pC82AqiGS3LRW537u9LFV4wIZuHk= github.com/martinboehm/bchutil v0.0.0-20190104112650-6373f11b6efe h1:khZWpHuxJNh2EGzBbaS6EQ2d6KxgK31WeG0TnlTMUD4= github.com/martinboehm/bchutil v0.0.0-20190104112650-6373f11b6efe/go.mod h1:0hw4tpGU+9slqN/DrevhjTMb0iR9esxzpCdx8I6/UzU= github.com/martinboehm/btcd v0.0.0-20190104121910-8e7c0427fee5/go.mod h1:rKQj/jGwFruYjpM6vN+syReFoR0DsLQaajhyH/5mwUE= -github.com/martinboehm/btcd v0.0.0-20211010165247-d1f65b0f30fa h1:n8hCPoGumR6jNmNTMAo/VqDOw1yxUf0UCXJVZwf+JLQ= -github.com/martinboehm/btcd v0.0.0-20211010165247-d1f65b0f30fa/go.mod h1:YGXD0z/xtFXFF5jFp1GaVnrKRlEADn4pD47Zu4xaLg0= +github.com/martinboehm/btcd v0.0.0-20221101112928-408689e15809 h1:a3l5GCQYYyB4zDmtsB8gu+aB15earQxMG1W/S/zKcXs= +github.com/martinboehm/btcd v0.0.0-20221101112928-408689e15809/go.mod h1:YGXD0z/xtFXFF5jFp1GaVnrKRlEADn4pD47Zu4xaLg0= github.com/martinboehm/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:NIviPmxe43yBgIB4HGB4w4kv9/s5kaDa/pi+wZAAxQo= github.com/martinboehm/btcutil v0.0.0-20210922221517-e83b0c752949/go.mod h1:8iJaVY/VHW6lnojpTXf5X4gF2dx81Xtj2R6lJp2colA= github.com/martinboehm/btcutil v0.0.0-20211010173611-6ef1889c1819 h1:ra2UymMEDhR0CVxqz/0minCNXO8YMeZwxdnnFDpWVJ0= github.com/martinboehm/btcutil v0.0.0-20211010173611-6ef1889c1819/go.mod h1:/Z9FhVDXTih0kZExhK2hRvM+z68XkmbqZhFDU3bU1jY= github.com/martinboehm/golang-socketio v0.0.0-20180414165752-f60b0a8befde h1:Tz7WkXgQjeQVymqSQkEapbe/ZuzKCvb6GANFHnl0uAE= github.com/martinboehm/golang-socketio v0.0.0-20180414165752-f60b0a8befde/go.mod h1:p35TWcm7GkAwvPcUCEq4H+yTm0gA8Aq7UvGnbK6olQk= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= -github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= +github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= +github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= -github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= -github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= -github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= -github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= +github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v1.4.1 h1:PZSj/UFNaVp3KxrzHOcS7oyuWA7LoOY/77yCTEFu21U= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= -github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= -github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= -github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= -github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pebbe/zmq4 v1.2.1 h1:jrXQW3mD8Si2mcSY/8VBs2nNkK/sKCOEM0rHAfxyc8c= github.com/pebbe/zmq4 v1.2.1/go.mod h1:7N4y5R18zBiu3l0vajMUWQgZyjv464prE8RCyBcmnZM= -github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8= +github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/stun/v2 v2.0.0 h1:A5+wXKLAypxQri59+tmQKVs7+l6mMM+3d+eER9ifRU0= +github.com/pion/stun/v2 v2.0.0/go.mod h1:22qRSh08fSEttYUmJZGlriq9+03jtVmXNODgLccj8GQ= +github.com/pion/transport/v2 v2.2.1 h1:7qYnCBlpgSJNYMbLCKuSY9KbQdBFoETvPNETv0y4N7c= +github.com/pion/transport/v2 v2.2.1/go.mod h1:cXXWavvCnFF6McHTft3DWS9iic2Mftcz1Aq29pGcU5g= +github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouANiM= +github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0= github.com/pirk/ecashaddr-converter v0.0.0-20220121162910-c6cb45163b29 h1:awILOeL107zIYvPB1zhkz6ZTp0AaMpLGMoV16DMairA= github.com/pirk/ecashaddr-converter v0.0.0-20220121162910-c6cb45163b29/go.mod h1:ATZjpmb9u55Kcrd5M/ca/40H73BZLhduMzCmGwpfWw0= github.com/pirk/ecashutil v0.0.0-20220124103933-d37f548d249e h1:WrnL52yXO0jNpHC7UbthJl9mnHPHY7bW3xzmWIuWzh8= github.com/pirk/ecashutil v0.0.0-20220124103933-d37f548d249e/go.mod h1:y/B3gomTdd1s23RvcBij/X738fcTobeupT30EhV6nPE= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.8.0 h1:zvJNkoCFAnYFNC24FV8nW4JdRJ3GIFcLbg65lL/JDcw= -github.com/prometheus/client_golang v1.8.0/go.mod h1:O9VU6huf47PktckDQfMTX0Y8tY0/7TSWwj+ITvv0TnM= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= -github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= -github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= -github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.2.0 h1:wH4vA7pcjKuZzjF7lM8awk4fnuJO6idemZXoKnULUx4= -github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= -github.com/rjeczalik/notify v0.9.1 h1:CLCKso/QK1snAlnhNR/CNvNiFU2saUtjV0bx3EwNeCE= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q= +github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/schancel/cashaddr-converter v0.0.0-20181111022653-4769e7add95a h1:q2+wHBv8gDQRRPfxvRez8etJUp9VNnBDQhiUW4W5AKg= github.com/schancel/cashaddr-converter v0.0.0-20181111022653-4769e7add95a/go.mod h1:FdhEqBlgflrdbBs+Wh94EXSNJT+s6DTVvsHGMo0+u80= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4 h1:Gb2Tyox57NRNuZ2d3rmvB3pcmbu7O1RS3m8WRx7ilrg= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= -github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= -github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= +github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= +github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954 h1:xQdMZ1WLrgkkvOZ/LDQxjVxMLdby7osSh4ZEVa5sIjs= -github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= -github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= -github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef h1:wHSqTBrZW24CsNJDfeh9Ex6Pm0Rcpc7qrgKBiL44vF4= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= -github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY+qRo= +github.com/supranational/blst v0.3.14/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe h1:nbdqkIGOGfUAD54q1s2YBcBz/WcsxCO9HUQ4aGV5hUw= +github.com/supranational/blst v0.3.16-0.20250831170142-f48500c1fdbe/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= +github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= +github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4= +github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso= +github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ= +github.com/tkrajina/go-reflector v0.5.5 h1:gwoQFNye30Kk7NrExj8zm3zFtrGPqOkzFMLuQZg1DtQ= +github.com/tkrajina/go-reflector v0.5.5/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4= +github.com/tkrajina/typescriptify-golang-structs v0.1.11 h1:zEIVczF/iWgs4eTY7NQqbBe23OVlFVk9sWLX/FDYi4Q= +github.com/tkrajina/typescriptify-golang-structs v0.1.11/go.mod h1:sjU00nti/PMEOZb07KljFlR+lJ+RotsC0GBQMv9EKls= +github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w= +github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= +github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= +github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= +go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= +golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= +golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e h1:4qufH0hlUYs6AO6XmZC3GqfDPGSXHVXUFR6OND+iJX4= +golang.org/x/exp v0.0.0-20241215155358-4a5509556b9e/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= +golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912 h1:uCLL3g5wH2xjxVREVuAbP9JM5PPKjRbXKRa6IBjkzmU= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= +golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= -gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/server/html_templates.go b/server/html_templates.go new file mode 100644 index 0000000000..b9c9d62e3e --- /dev/null +++ b/server/html_templates.go @@ -0,0 +1,403 @@ +package server + +import ( + "encoding/json" + "fmt" + "html" + "html/template" + "math/big" + "net/http" + "runtime/debug" + "strconv" + "strings" + "time" + + "github.com/golang/glog" + "github.com/trezor/blockbook/api" + "github.com/trezor/blockbook/common" +) + +type tpl int + +const ( + noTpl = tpl(iota) + errorTpl + errorInternalTpl +) + +// htmlTemplateHandler is a handle to public http server +type htmlTemplates[TD any] struct { + metrics *common.Metrics + templates []*template.Template + debug bool + newTemplateData func(r *http.Request) *TD + newTemplateDataWithError func(error *api.APIError, r *http.Request) *TD + parseTemplates func() []*template.Template + postHtmlTemplateHandler func(data *TD, w http.ResponseWriter, r *http.Request) +} + +func (s *htmlTemplates[TD]) jsonHandler(handler func(r *http.Request, apiVersion int) (interface{}, error), apiVersion int) func(w http.ResponseWriter, r *http.Request) { + type jsonError struct { + Text string `json:"error"` + HTTPStatus int `json:"-"` + } + handlerName := getFunctionName(handler) + return func(w http.ResponseWriter, r *http.Request) { + var data interface{} + var err error + defer func() { + if e := recover(); e != nil { + glog.Error(handlerName, " recovered from panic: ", e) + debug.PrintStack() + if s.debug { + data = jsonError{fmt.Sprint("Internal server error: recovered from panic ", e), http.StatusInternalServerError} + } else { + data = jsonError{"Internal server error", http.StatusInternalServerError} + } + } + w.Header().Set("Content-Type", "application/json; charset=utf-8") + if e, isError := data.(jsonError); isError { + w.WriteHeader(e.HTTPStatus) + } + err = json.NewEncoder(w).Encode(data) + if err != nil { + glog.Warning("json encode ", err) + } + if s.metrics != nil { + s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Dec() + } + }() + if s.metrics != nil { + s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Inc() + } + data, err = handler(r, apiVersion) + if err != nil || data == nil { + if apiErr, ok := err.(*api.APIError); ok { + if apiErr.Public { + data = jsonError{apiErr.Error(), http.StatusBadRequest} + } else { + data = jsonError{apiErr.Error(), http.StatusInternalServerError} + } + } else { + if err != nil { + glog.Error(handlerName, " error: ", err) + } + if s.debug { + if data != nil { + data = jsonError{fmt.Sprintf("Internal server error: %v, data %+v", err, data), http.StatusInternalServerError} + } else { + data = jsonError{fmt.Sprintf("Internal server error: %v", err), http.StatusInternalServerError} + } + } else { + data = jsonError{"Internal server error", http.StatusInternalServerError} + } + } + } + } +} + +func (s *htmlTemplates[TD]) htmlTemplateHandler(handler func(w http.ResponseWriter, r *http.Request) (tpl, *TD, error)) func(w http.ResponseWriter, r *http.Request) { + handlerName := getFunctionName(handler) + return func(w http.ResponseWriter, r *http.Request) { + var t tpl + var data *TD + var err error + defer func() { + if e := recover(); e != nil { + glog.Error(handlerName, " recovered from panic: ", e) + debug.PrintStack() + t = errorInternalTpl + if s.debug { + data = s.newTemplateDataWithError(&api.APIError{Text: fmt.Sprint("Internal server error: recovered from panic ", e)}, r) + } else { + data = s.newTemplateDataWithError(&api.APIError{Text: "Internal server error"}, r) + } + } + // noTpl means the handler completely handled the request + if t != noTpl { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + // return 500 Internal Server Error with errorInternalTpl + if t == errorInternalTpl { + w.WriteHeader(http.StatusInternalServerError) + } + if err := s.templates[t].ExecuteTemplate(w, "base.html", data); err != nil { + glog.Error(err) + } + } + if s.metrics != nil { + s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Dec() + } + }() + if s.metrics != nil { + s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Inc() + } + if s.debug { + // reload templates on each request + // to reflect changes during development + s.templates = s.parseTemplates() + } + t, data, err = handler(w, r) + if err != nil || (data == nil && t != noTpl) { + t = errorInternalTpl + if apiErr, ok := err.(*api.APIError); ok { + data = s.newTemplateDataWithError(apiErr, r) + if apiErr.Public { + t = errorTpl + } + } else { + if err != nil { + glog.Error(handlerName, " error: ", err) + } + if s.debug { + data = s.newTemplateDataWithError(&api.APIError{Text: fmt.Sprintf("Internal server error: %v, data %+v", err, data)}, r) + } else { + data = s.newTemplateDataWithError(&api.APIError{Text: "Internal server error"}, r) + } + } + } + if s.postHtmlTemplateHandler != nil { + s.postHtmlTemplateHandler(data, w, r) + } + + } +} + +func relativeTimeUnit(d int64) string { + var u string + if d < 60 { + if d == 1 { + u = " sec" + } else { + u = " secs" + } + } else if d < 3600 { + d /= 60 + if d == 1 { + u = " min" + } else { + u = " mins" + } + } else if d < 3600*24 { + d /= 3600 + if d == 1 { + u = " hour" + } else { + u = " hours" + } + } else { + d /= 3600 * 24 + if d == 1 { + u = " day" + } else { + u = " days" + } + } + return strconv.FormatInt(d, 10) + u +} + +func relativeTime(d int64) string { + r := relativeTimeUnit(d) + if d > 3600*24 { + d = d % (3600 * 24) + if d >= 3600 { + r += " " + relativeTimeUnit(d) + } + } else if d > 3600 { + d = d % 3600 + if d >= 60 { + r += " " + relativeTimeUnit(d) + } + } + return r +} + +func unixTimeSpan(ut int64) template.HTML { + t := time.Unix(ut, 0) + return timeSpan(&t) +} + +var timeNow = time.Now + +func timeSpan(t *time.Time) template.HTML { + if t == nil { + return "" + } + u := t.Unix() + if u <= 0 { + return "" + } + d := timeNow().Unix() - u + f := t.UTC().Format("2006-01-02 15:04:05") + if d < 0 { + return template.HTML(f) + } + r := relativeTime(d) + return template.HTML(`` + r + " ago") +} + +func toJSON(data interface{}) string { + json, err := json.Marshal(data) + if err != nil { + return "" + } + return string(json) +} + +func formatAmountWithDecimals(a *api.Amount, d int) string { + if a == nil { + return "0" + } + return a.DecimalString(d) +} + +func appendAmountSpan(rv *strings.Builder, class, amount, shortcut, txDate string) { + rv.WriteString(`") + i := strings.IndexByte(amount, '.') + if i < 0 { + appendSeparatedNumberSpans(rv, amount, "nc") + } else { + appendSeparatedNumberSpans(rv, amount[:i], "nc") + rv.WriteString(`.`) + rv.WriteString(``) + appendLeftSeparatedNumberSpans(rv, amount[i+1:], "ns") + rv.WriteString("") + } + if shortcut != "" { + rv.WriteString(" ") + rv.WriteString(html.EscapeString(shortcut)) + } + rv.WriteString("") +} + +func appendAmountSpanBitcoinType(rv *strings.Builder, class, amount, shortcut, txDate string) { + if amount == "0" { + appendAmountSpan(rv, class, amount, shortcut, txDate) + return + } + rv.WriteString(`") + i := strings.IndexByte(amount, '.') + var decimals string + if i < 0 { + appendSeparatedNumberSpans(rv, amount, "nc") + decimals = "00000000" + } else { + appendSeparatedNumberSpans(rv, amount[:i], "nc") + decimals = amount[i+1:] + "00000000" + } + rv.WriteString(`.`) + rv.WriteString(``) + rv.WriteString(decimals[:2]) + rv.WriteString(``) + rv.WriteString(decimals[2:5]) + rv.WriteString("") + rv.WriteString(``) + rv.WriteString(decimals[5:8]) + rv.WriteString("") + rv.WriteString("") + if shortcut != "" { + rv.WriteString(" ") + rv.WriteString(html.EscapeString(shortcut)) + } + rv.WriteString("") +} + +func appendAmountWrapperSpan(rv *strings.Builder, primary, symbol, classes string) { + rv.WriteString(``) +} + +func formatInt(i int) template.HTML { + return formatInt64(int64(i)) +} + +func formatUint32(i uint32) template.HTML { + return formatInt64(int64(i)) +} + +func appendSeparatedNumberSpans(rv *strings.Builder, s, separatorClass string) { + if len(s) > 0 && s[0] == '-' { + s = s[1:] + rv.WriteByte('-') + } + t := (len(s) - 1) / 3 + if t <= 0 { + rv.WriteString(s) + } else { + t *= 3 + rv.WriteString(s[:len(s)-t]) + for i := len(s) - t; i < len(s); i += 3 { + rv.WriteString(``) + rv.WriteString(s[i : i+3]) + rv.WriteString("") + } + } +} + +func appendLeftSeparatedNumberSpans(rv *strings.Builder, s, separatorClass string) { + l := len(s) + if l <= 3 { + rv.WriteString(s) + } else { + rv.WriteString(s[:3]) + for i := 3; i < len(s); i += 3 { + rv.WriteString(``) + e := i + 3 + if e > l { + e = l + } + rv.WriteString(s[i:e]) + rv.WriteString("") + } + } +} + +func formatInt64(i int64) template.HTML { + s := strconv.FormatInt(i, 10) + var rv strings.Builder + appendSeparatedNumberSpans(&rv, s, "ns") + return template.HTML(rv.String()) +} + +func formatBigInt(i *big.Int) template.HTML { + if i == nil { + return "" + } + s := i.String() + var rv strings.Builder + appendSeparatedNumberSpans(&rv, s, "ns") + return template.HTML(rv.String()) +} diff --git a/server/html_templates_test.go b/server/html_templates_test.go new file mode 100644 index 0000000000..eca70f3652 --- /dev/null +++ b/server/html_templates_test.go @@ -0,0 +1,257 @@ +//go:build unittest + +package server + +import ( + "html/template" + "reflect" + "strings" + "testing" + "time" +) + +func Test_formatInt64(t *testing.T) { + tests := []struct { + name string + n int64 + want template.HTML + }{ + {"1", 1, "1"}, + {"13", 13, "13"}, + {"123", 123, "123"}, + {"1234", 1234, `1234`}, + {"91234", 91234, `91234`}, + {"891234", 891234, `891234`}, + {"7891234", 7891234, `7891234`}, + {"67891234", 67891234, `67891234`}, + {"567891234", 567891234, `567891234`}, + {"4567891234", 4567891234, `4567891234`}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := formatInt64(tt.n); !reflect.DeepEqual(got, tt.want) { + t.Errorf("formatInt64() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_formatTime(t *testing.T) { + timeNow = fixedTimeNow + tests := []struct { + name string + want template.HTML + }{ + { + name: "2020-12-23 15:16:17", + want: `630 days 21 hours ago`, + }, + { + name: "2022-08-23 11:12:13", + want: `23 days 1 hour ago`, + }, + { + name: "2022-09-14 11:12:13", + want: `1 day 1 hour ago`, + }, + { + name: "2022-09-14 14:12:13", + want: `22 hours 31 mins ago`, + }, + { + name: "2022-09-15 09:33:26", + want: `3 hours 10 mins ago`, + }, + { + name: "2022-09-15 12:23:56", + want: `20 mins ago`, + }, + { + name: "2022-09-15 12:24:07", + want: `19 mins ago`, + }, + { + name: "2022-09-15 12:43:21", + want: `35 secs ago`, + }, + { + name: "2022-09-15 12:43:56", + want: `0 secs ago`, + }, + { + name: "2022-09-16 12:43:56", + want: `2022-09-16 12:43:56`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tm, _ := time.Parse("2006-01-02 15:04:05", tt.name) + if got := timeSpan(&tm); !reflect.DeepEqual(got, tt.want) { + t.Errorf("formatTime() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_appendAmountSpan(t *testing.T) { + tests := []struct { + name string + class string + amount string + shortcut string + txDate string + want string + }{ + { + name: "prim-amt 1.23456789 BTC", + class: "prim-amt", + amount: "1.23456789", + shortcut: "BTC", + want: `1.23456789 BTC`, + }, + { + name: "prim-amt 1432134.23456 BTC", + class: "prim-amt", + amount: "1432134.23456", + shortcut: "BTC", + want: `1432134.23456 BTC`, + }, + { + name: "sec-amt 1 EUR", + class: "sec-amt", + amount: "1", + shortcut: "EUR", + want: `1 EUR`, + }, + { + name: "sec-amt -1 EUR", + class: "sec-amt", + amount: "-1", + shortcut: "EUR", + want: `-1 EUR`, + }, + { + name: "sec-amt 432109.23 EUR", + class: "sec-amt", + amount: "432109.23", + shortcut: "EUR", + want: `432109.23 EUR`, + }, + { + name: "sec-amt -432109.23 EUR", + class: "sec-amt", + amount: "-432109.23", + shortcut: "EUR", + want: `-432109.23 EUR`, + }, + { + name: "sec-amt 43141.29 EUR", + class: "sec-amt", + amount: "43141.29", + shortcut: "EUR", + txDate: "2022-03-14", + want: `43141.29 EUR`, + }, + { + name: "sec-amt -43141.29 EUR", + class: "sec-amt", + amount: "-43141.29", + shortcut: "EUR", + txDate: "2022-03-14", + want: `-43141.29 EUR`, + }, + { + name: "prim-amt 1.23456789 BTC", + class: "prim-amt", + amount: "1.23456789", + shortcut: "alert(1)", + want: `1.23456789 <javascript>alert(1)</javascript>`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var rv strings.Builder + appendAmountSpan(&rv, tt.class, tt.amount, tt.shortcut, tt.txDate) + if got := rv.String(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("appendAmountSpan() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_appendAmountSpanBitcoinType(t *testing.T) { + tests := []struct { + name string + class string + amount string + shortcut string + txDate string + want string + }{ + { + name: "prim-amt 1.23456789 BTC", + class: "prim-amt", + amount: "1.23456789", + shortcut: "BTC", + want: `1.23456789 BTC`, + }, + { + name: "prim-amt 1432134.23456 BTC", + class: "prim-amt", + amount: "1432134.23456", + shortcut: "BTC", + want: `1432134.23456000 BTC`, + }, + { + name: "prim-amt 1 BTC", + class: "prim-amt", + amount: "1", + shortcut: "BTC", + want: `1.00000000 BTC`, + }, + { + name: "prim-amt 0 BTC", + class: "prim-amt", + amount: "0", + shortcut: "BTC", + want: `0 BTC`, + }, + { + name: "prim-amt 34.2 BTC", + class: "prim-amt", + amount: "34.2", + shortcut: "BTC", + want: `34.20000000 BTC`, + }, + { + name: "prim-amt -34.2345678 BTC", + class: "prim-amt", + amount: "-34.2345678", + shortcut: "BTC", + want: `-34.23456780 BTC`, + }, + { + name: "prim-amt -1234.2345 BTC", + class: "prim-amt", + amount: "-1234.2345", + shortcut: "BTC", + want: `-1234.23450000 BTC`, + }, + { + name: "prim-amt -123.23 BTC", + class: "prim-amt", + amount: "-123.23", + shortcut: "BTC", + want: `-123.23000000 BTC`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var rv strings.Builder + appendAmountSpanBitcoinType(&rv, tt.class, tt.amount, tt.shortcut, tt.txDate) + if got := rv.String(); !reflect.DeepEqual(got, tt.want) { + t.Errorf("appendAmountSpanBitcoinType() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/server/internal.go b/server/internal.go index 92d0dbd843..e440fbd8e6 100644 --- a/server/internal.go +++ b/server/internal.go @@ -4,18 +4,27 @@ import ( "context" "encoding/json" "fmt" + "html/template" + "io" "net/http" + "path/filepath" + "sort" + "strconv" + "strings" "github.com/golang/glog" + "github.com/juju/errors" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/trezor/blockbook/api" "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/fiat" ) // InternalServer is handle to internal http server type InternalServer struct { + htmlTemplates[InternalTemplateData] https *http.Server certFiles string db *db.RocksDB @@ -28,8 +37,8 @@ type InternalServer struct { } // NewInternalServer creates new internal http interface to blockbook and returns its handle -func NewInternalServer(binding, certFiles string, db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState) (*InternalServer, error) { - api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is) +func NewInternalServer(binding, certFiles string, db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState, fiatRates *fiat.FiatRates) (*InternalServer, error) { + api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return nil, err } @@ -41,6 +50,9 @@ func NewInternalServer(binding, certFiles string, db *db.RocksDB, chain bchain.B Handler: serveMux, } s := &InternalServer{ + htmlTemplates: htmlTemplates[InternalTemplateData]{ + debug: true, + }, https: https, certFiles: certFiles, db: db, @@ -51,11 +63,22 @@ func NewInternalServer(binding, certFiles string, db *db.RocksDB, chain bchain.B is: is, api: api, } + s.htmlTemplates.newTemplateData = s.newTemplateData + s.htmlTemplates.newTemplateDataWithError = s.newTemplateDataWithError + s.htmlTemplates.parseTemplates = s.parseTemplates + s.templates = s.parseTemplates() serveMux.Handle(path+"favicon.ico", http.FileServer(http.Dir("./static/"))) + serveMux.Handle(path+"static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./static/")))) serveMux.HandleFunc(path+"metrics", promhttp.Handler().ServeHTTP) serveMux.HandleFunc(path, s.index) - + serveMux.HandleFunc(path+"admin", s.htmlTemplateHandler(s.adminIndex)) + serveMux.HandleFunc(path+"admin/ws-limit-exceeding-ips", s.htmlTemplateHandler(s.wsLimitExceedingIPs)) + if s.chainParser.GetChainType() == bchain.ChainEthereumType { + serveMux.HandleFunc(path+"admin/internal-data-errors", s.htmlTemplateHandler(s.internalDataErrors)) + serveMux.HandleFunc(path+"admin/contract-info", s.htmlTemplateHandler(s.contractInfoPage)) + serveMux.HandleFunc(path+"admin/contract-info/", s.jsonHandler(s.apiContractInfo, 0)) + } return s, nil } @@ -97,3 +120,155 @@ func (s *InternalServer) index(w http.ResponseWriter, r *http.Request) { w.Write(buf) } + +const ( + adminIndexTpl = iota + errorInternalTpl + 1 + adminInternalErrorsTpl + adminLimitExceedingIPSTpl + adminContractInfoTpl + + internalTplCount +) + +// WsLimitExceedingIP is used to transfer data to the templates +type WsLimitExceedingIP struct { + IP string + Count int +} + +// InternalTemplateData is used to transfer data to the templates +type InternalTemplateData struct { + CoinName string + CoinShortcut string + CoinLabel string + ChainType bchain.ChainType + Error *api.APIError + InternalDataErrors []db.BlockInternalDataError + RefetchingInternalData bool + WsGetAccountInfoLimit int + WsLimitExceedingIPs []WsLimitExceedingIP +} + +func (s *InternalServer) newTemplateData(r *http.Request) *InternalTemplateData { + t := &InternalTemplateData{ + CoinName: s.is.Coin, + CoinShortcut: s.is.CoinShortcut, + CoinLabel: s.is.CoinLabel, + ChainType: s.chainParser.GetChainType(), + } + return t +} + +func (s *InternalServer) newTemplateDataWithError(error *api.APIError, r *http.Request) *InternalTemplateData { + td := s.newTemplateData(r) + td.Error = error + return td +} + +func (s *InternalServer) parseTemplates() []*template.Template { + templateFuncMap := template.FuncMap{ + "formatUint32": formatUint32, + } + createTemplate := func(filenames ...string) *template.Template { + if len(filenames) == 0 { + panic("Missing templates") + } + return template.Must(template.New(filepath.Base(filenames[0])).Funcs(templateFuncMap).ParseFiles(filenames...)) + } + t := make([]*template.Template, internalTplCount) + t[errorTpl] = createTemplate("./static/internal_templates/error.html", "./static/internal_templates/base.html") + t[errorInternalTpl] = createTemplate("./static/internal_templates/error.html", "./static/internal_templates/base.html") + t[adminIndexTpl] = createTemplate("./static/internal_templates/index.html", "./static/internal_templates/base.html") + t[adminInternalErrorsTpl] = createTemplate("./static/internal_templates/block_internal_data_errors.html", "./static/internal_templates/base.html") + t[adminLimitExceedingIPSTpl] = createTemplate("./static/internal_templates/ws_limit_exceeding_ips.html", "./static/internal_templates/base.html") + t[adminContractInfoTpl] = createTemplate("./static/internal_templates/contract_info.html", "./static/internal_templates/base.html") + return t +} + +func (s *InternalServer) adminIndex(w http.ResponseWriter, r *http.Request) (tpl, *InternalTemplateData, error) { + data := s.newTemplateData(r) + return adminIndexTpl, data, nil +} + +func (s *InternalServer) internalDataErrors(w http.ResponseWriter, r *http.Request) (tpl, *InternalTemplateData, error) { + if r.Method == http.MethodPost { + err := s.api.RefetchInternalData() + if err != nil { + return errorTpl, nil, err + } + } + data := s.newTemplateData(r) + internalErrors, err := s.db.GetBlockInternalDataErrorsEthereumType() + if err != nil { + return errorTpl, nil, err + } + data.InternalDataErrors = internalErrors + data.RefetchingInternalData = s.api.IsRefetchingInternalData() + return adminInternalErrorsTpl, data, nil +} + +func (s *InternalServer) wsLimitExceedingIPs(w http.ResponseWriter, r *http.Request) (tpl, *InternalTemplateData, error) { + if r.Method == http.MethodPost { + s.is.ResetWsLimitExceedingIPs() + } + data := s.newTemplateData(r) + ips := make([]WsLimitExceedingIP, 0, len(s.is.WsLimitExceedingIPs)) + for k, v := range s.is.WsLimitExceedingIPs { + ips = append(ips, WsLimitExceedingIP{k, v}) + } + sort.Slice(ips, func(i, j int) bool { + return ips[i].Count > ips[j].Count + }) + data.WsLimitExceedingIPs = ips + data.WsGetAccountInfoLimit = s.is.WsGetAccountInfoLimit + return adminLimitExceedingIPSTpl, data, nil +} + +func (s *InternalServer) contractInfoPage(w http.ResponseWriter, r *http.Request) (tpl, *InternalTemplateData, error) { + data := s.newTemplateData(r) + return adminContractInfoTpl, data, nil +} + +func (s *InternalServer) apiContractInfo(r *http.Request, apiVersion int) (interface{}, error) { + if r.Method == http.MethodPost { + return s.updateContracts(r) + } + var contractAddress string + i := strings.LastIndexByte(r.URL.Path, '/') + if i > 0 { + contractAddress = r.URL.Path[i+1:] + } + if len(contractAddress) == 0 { + return nil, api.NewAPIError("Missing contract address", true) + } + + contractInfo, valid, err := s.api.GetContractInfo(contractAddress, bchain.UnknownTokenStandard) + if err != nil { + return nil, api.NewAPIError(err.Error(), true) + } + if !valid { + return nil, api.NewAPIError("Not a contract", true) + } + return contractInfo, nil +} + +func (s *InternalServer) updateContracts(r *http.Request) (interface{}, error) { + data, err := io.ReadAll(r.Body) + if err != nil { + return nil, api.NewAPIError("Cannot get request body", true) + } + var contractInfos []bchain.ContractInfo + err = json.Unmarshal(data, &contractInfos) + if err != nil { + return nil, errors.Annotatef(err, "Cannot unmarshal body to array of ContractInfo objects") + } + for i := range contractInfos { + c := &contractInfos[i] + err := s.db.StoreContractInfo(c) + if err != nil { + return nil, api.NewAPIError("Error updating contract "+c.Contract+" "+err.Error(), true) + } + + } + return "{\"success\":\"Updated " + strconv.Itoa(len(contractInfos)) + " contracts\"}", nil +} diff --git a/server/public.go b/server/public.go index 125c273a3b..e54a307c71 100644 --- a/server/public.go +++ b/server/public.go @@ -4,16 +4,18 @@ import ( "context" "encoding/json" "fmt" + "html" "html/template" - "io/ioutil" + "io" "math/big" "net/http" "net/url" + "os" "path/filepath" "reflect" "regexp" "runtime" - "runtime/debug" + "sort" "strconv" "strings" "time" @@ -23,6 +25,7 @@ import ( "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/fiat" ) const txsOnPage = 25 @@ -30,48 +33,51 @@ const blocksOnPage = 50 const mempoolTxsOnPage = 50 const txsInAPI = 1000 +const secondaryCoinCookieName = "secondary_coin" + const ( _ = iota apiV1 apiV2 ) -// PublicServer is a handle to public http server +// PublicServer provides public http server functionality type PublicServer struct { - binding string - certFiles string - socketio *SocketIoServer - websocket *WebsocketServer - https *http.Server - db *db.RocksDB - txCache *db.TxCache - chain bchain.BlockChain - chainParser bchain.BlockChainParser - mempool bchain.Mempool - api *api.Worker - explorerURL string - internalExplorer bool - metrics *common.Metrics - is *common.InternalState - templates []*template.Template - debug bool + htmlTemplates[TemplateData] + binding string + certFiles string + socketio *SocketIoServer + websocket *WebsocketServer + https *http.Server + db *db.RocksDB + txCache *db.TxCache + chain bchain.BlockChain + chainParser bchain.BlockChainParser + mempool bchain.Mempool + api *api.Worker + explorerURL string + internalExplorer bool + is *common.InternalState + fiatRates *fiat.FiatRates + useSatsAmountFormat bool + isFullInterface bool } // NewPublicServer creates new public server http interface to blockbook and returns its handle // only basic functionality is mapped, to map all functions, call -func NewPublicServer(binding string, certFiles string, db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, explorerURL string, metrics *common.Metrics, is *common.InternalState, debugMode bool, enableSubNewTx bool) (*PublicServer, error) { +func NewPublicServer(binding string, certFiles string, db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, explorerURL string, metrics *common.Metrics, is *common.InternalState, fiatRates *fiat.FiatRates, debugMode bool) (*PublicServer, error) { - api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is) + api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return nil, err } - socketio, err := NewSocketIoServer(db, chain, mempool, txCache, metrics, is) + socketio, err := NewSocketIoServer(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return nil, err } - websocket, err := NewWebsocketServer(db, chain, mempool, txCache, metrics, is, enableSubNewTx) + websocket, err := NewWebsocketServer(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return nil, err } @@ -84,23 +90,31 @@ func NewPublicServer(binding string, certFiles string, db *db.RocksDB, chain bch } s := &PublicServer{ - binding: binding, - certFiles: certFiles, - https: https, - api: api, - socketio: socketio, - websocket: websocket, - db: db, - txCache: txCache, - chain: chain, - chainParser: chain.GetChainParser(), - mempool: mempool, - explorerURL: explorerURL, - internalExplorer: explorerURL == "", - metrics: metrics, - is: is, - debug: debugMode, - } + htmlTemplates: htmlTemplates[TemplateData]{ + metrics: metrics, + debug: debugMode, + }, + binding: binding, + certFiles: certFiles, + https: https, + api: api, + socketio: socketio, + websocket: websocket, + db: db, + txCache: txCache, + chain: chain, + chainParser: chain.GetChainParser(), + mempool: mempool, + explorerURL: explorerURL, + internalExplorer: explorerURL == "", + is: is, + fiatRates: fiatRates, + useSatsAmountFormat: chain.GetChainParser().GetChainType() == bchain.ChainBitcoinType && chain.GetChainParser().AmountDecimals() == 8, + } + s.htmlTemplates.newTemplateData = s.newTemplateData + s.htmlTemplates.newTemplateDataWithError = s.newTemplateDataWithError + s.htmlTemplates.parseTemplates = s.parseTemplates + s.htmlTemplates.postHtmlTemplateHandler = s.postHtmlTemplateHandler s.templates = s.parseTemplates() // map only basic functions, the rest is enabled by method MapFullPublicInterface @@ -142,6 +156,9 @@ func (s *PublicServer) ConnectFullPublicInterface() { serveMux.HandleFunc(path+"spending/", s.htmlTemplateHandler(s.explorerSpendingTx)) serveMux.HandleFunc(path+"sendtx", s.htmlTemplateHandler(s.explorerSendTx)) serveMux.HandleFunc(path+"mempool", s.htmlTemplateHandler(s.explorerMempool)) + if s.chainParser.GetChainType() == bchain.ChainEthereumType { + serveMux.HandleFunc(path+"nft/", s.htmlTemplateHandler(s.explorerNftDetail)) + } } else { // redirect to wallet requests for tx and address, possibly to external site serveMux.HandleFunc(path+"tx/", s.txRedirect) @@ -168,8 +185,10 @@ func (s *PublicServer) ConnectFullPublicInterface() { serveMux.HandleFunc(path+"api/v1/estimatefee/", s.jsonHandler(s.apiEstimateFee, apiV1)) } serveMux.HandleFunc(path+"api/block-index/", s.jsonHandler(s.apiBlockIndex, apiDefault)) + serveMux.HandleFunc(path+"api/block-filters/", s.jsonHandler(s.apiBlockFilters, apiDefault)) serveMux.HandleFunc(path+"api/tx-specific/", s.jsonHandler(s.apiTxSpecific, apiDefault)) serveMux.HandleFunc(path+"api/tx/", s.jsonHandler(s.apiTx, apiDefault)) + serveMux.HandleFunc(path+"api/rawtx/", s.jsonHandler(s.apiRawTx, apiDefault)) serveMux.HandleFunc(path+"api/address/", s.jsonHandler(s.apiAddress, apiDefault)) serveMux.HandleFunc(path+"api/xpub/", s.jsonHandler(s.apiXpub, apiDefault)) serveMux.HandleFunc(path+"api/utxo/", s.jsonHandler(s.apiUtxo, apiDefault)) @@ -180,6 +199,7 @@ func (s *PublicServer) ConnectFullPublicInterface() { serveMux.HandleFunc(path+"api/balancehistory/", s.jsonHandler(s.apiBalanceHistory, apiDefault)) // v2 format serveMux.HandleFunc(path+"api/v2/block-index/", s.jsonHandler(s.apiBlockIndex, apiV2)) + serveMux.HandleFunc(path+"api/v2/block-filters/", s.jsonHandler(s.apiBlockFilters, apiV2)) serveMux.HandleFunc(path+"api/v2/tx-specific/", s.jsonHandler(s.apiTxSpecific, apiV2)) serveMux.HandleFunc(path+"api/v2/tx/", s.jsonHandler(s.apiTx, apiV2)) serveMux.HandleFunc(path+"api/v2/address/", s.jsonHandler(s.apiAddress, apiV2)) @@ -193,11 +213,12 @@ func (s *PublicServer) ConnectFullPublicInterface() { serveMux.HandleFunc(path+"api/v2/balancehistory/", s.jsonHandler(s.apiBalanceHistory, apiDefault)) serveMux.HandleFunc(path+"api/v2/tickers/", s.jsonHandler(s.apiTickers, apiV2)) serveMux.HandleFunc(path+"api/v2/multi-tickers/", s.jsonHandler(s.apiMultiTickers, apiV2)) - serveMux.HandleFunc(path+"api/v2/tickers-list/", s.jsonHandler(s.apiTickersList, apiV2)) + serveMux.HandleFunc(path+"api/v2/tickers-list/", s.jsonHandler(s.apiAvailableVsCurrencies, apiV2)) // socket.io interface serveMux.Handle(path+"socket.io/", s.socketio.GetHandler()) // websocket interface serveMux.Handle(path+"websocket", s.websocket.GetHandler()) + s.isFullInterface = true } // Close closes the server @@ -219,7 +240,7 @@ func (s *PublicServer) OnNewBlock(hash string, height uint32) { } // OnNewFiatRatesTicker notifies users subscribed to bitcoind/fiatrates about new ticker -func (s *PublicServer) OnNewFiatRatesTicker(ticker *db.CurrencyRatesTicker) { +func (s *PublicServer) OnNewFiatRatesTicker(ticker *common.CurrencyRatesTicker) { s.websocket.OnNewFiatRatesTicker(ticker) } @@ -234,12 +255,12 @@ func (s *PublicServer) OnNewTx(tx *bchain.MempoolTx) { } func (s *PublicServer) txRedirect(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, joinURL(s.explorerURL, r.URL.Path), 302) + http.Redirect(w, r, joinURL(s.explorerURL, r.URL.Path), http.StatusFound) s.metrics.ExplorerViews.With(common.Labels{"action": "tx-redirect"}).Inc() } func (s *PublicServer) addressRedirect(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, joinURL(s.explorerURL, r.URL.Path), 302) + http.Redirect(w, r, joinURL(s.explorerURL, r.URL.Path), http.StatusFound) s.metrics.ExplorerViews.With(common.Labels{"action": "address-redirect"}).Inc() } @@ -271,64 +292,8 @@ func getFunctionName(i interface{}) string { return name } -func (s *PublicServer) jsonHandler(handler func(r *http.Request, apiVersion int) (interface{}, error), apiVersion int) func(w http.ResponseWriter, r *http.Request) { - type jsonError struct { - Text string `json:"error"` - HTTPStatus int `json:"-"` - } - handlerName := getFunctionName(handler) - return func(w http.ResponseWriter, r *http.Request) { - var data interface{} - var err error - defer func() { - if e := recover(); e != nil { - glog.Error(handlerName, " recovered from panic: ", e) - debug.PrintStack() - if s.debug { - data = jsonError{fmt.Sprint("Internal server error: recovered from panic ", e), http.StatusInternalServerError} - } else { - data = jsonError{"Internal server error", http.StatusInternalServerError} - } - } - w.Header().Set("Content-Type", "application/json; charset=utf-8") - if e, isError := data.(jsonError); isError { - w.WriteHeader(e.HTTPStatus) - } - err = json.NewEncoder(w).Encode(data) - if err != nil { - glog.Warning("json encode ", err) - } - s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Dec() - }() - s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Inc() - data, err = handler(r, apiVersion) - if err != nil || data == nil { - if apiErr, ok := err.(*api.APIError); ok { - if apiErr.Public { - data = jsonError{apiErr.Error(), http.StatusBadRequest} - } else { - data = jsonError{apiErr.Error(), http.StatusInternalServerError} - } - } else { - if err != nil { - glog.Error(handlerName, " error: ", err) - } - if s.debug { - if data != nil { - data = jsonError{fmt.Sprintf("Internal server error: %v, data %+v", err, data), http.StatusInternalServerError} - } else { - data = jsonError{fmt.Sprintf("Internal server error: %v", err), http.StatusInternalServerError} - } - } else { - data = jsonError{"Internal server error", http.StatusInternalServerError} - } - } - } - } -} - -func (s *PublicServer) newTemplateData() *TemplateData { - return &TemplateData{ +func (s *PublicServer) newTemplateData(r *http.Request) *TemplateData { + t := &TemplateData{ CoinName: s.is.Coin, CoinShortcut: s.is.CoinShortcut, CoinLabel: s.is.CoinLabel, @@ -336,80 +301,67 @@ func (s *PublicServer) newTemplateData() *TemplateData { InternalExplorer: s.internalExplorer && !s.is.InitialSync, TOSLink: api.Text.TOSLink, } -} - -func (s *PublicServer) newTemplateDataWithError(text string) *TemplateData { - td := s.newTemplateData() - td.Error = &api.APIError{Text: text} - return td -} - -func (s *PublicServer) htmlTemplateHandler(handler func(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error)) func(w http.ResponseWriter, r *http.Request) { - handlerName := getFunctionName(handler) - return func(w http.ResponseWriter, r *http.Request) { - var t tpl - var data *TemplateData - var err error - defer func() { - if e := recover(); e != nil { - glog.Error(handlerName, " recovered from panic: ", e) - debug.PrintStack() - t = errorInternalTpl - if s.debug { - data = s.newTemplateDataWithError(fmt.Sprint("Internal server error: recovered from panic ", e)) - } else { - data = s.newTemplateDataWithError("Internal server error") - } + if t.ChainType == bchain.ChainEthereumType { + t.FungibleTokenName = bchain.EthereumTokenStandardMap[bchain.FungibleToken] + t.NonFungibleTokenName = bchain.EthereumTokenStandardMap[bchain.NonFungibleToken] + t.MultiTokenName = bchain.EthereumTokenStandardMap[bchain.MultiToken] + } + if !s.debug { + t.Minified = ".min.4" + } + if s.is.HasFiatRates { + // get the secondary coin and if it should be shown either from query parameters "secondary" and "use_secondary" + // or from the cookie "secondary_coin" in the format secondary=use_secondary, for example EUR=true + // the query parameters take precedence over the cookie + var cookieSecondary string + var cookieUseSecondary bool + cookie, _ := r.Cookie(secondaryCoinCookieName) + if cookie != nil { + a := strings.Split(cookie.Value, "=") + if len(a) == 2 { + cookieSecondary = a[0] + cookieUseSecondary, _ = strconv.ParseBool(a[1]) } - // noTpl means the handler completely handled the request - if t != noTpl { - w.Header().Set("Content-Type", "text/html; charset=utf-8") - // return 500 Internal Server Error with errorInternalTpl - if t == errorInternalTpl { - w.WriteHeader(http.StatusInternalServerError) - } - if err := s.templates[t].ExecuteTemplate(w, "base.html", data); err != nil { - glog.Error(err) - } - } - s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Dec() - }() - s.metrics.ExplorerPendingRequests.With((common.Labels{"method": handlerName})).Inc() - if s.debug { - // reload templates on each request - // to reflect changes during development - s.templates = s.parseTemplates() } - t, data, err = handler(w, r) - if err != nil || (data == nil && t != noTpl) { - t = errorInternalTpl - if apiErr, ok := err.(*api.APIError); ok { - data = s.newTemplateData() - data.Error = apiErr - if apiErr.Public { - t = errorTpl - } + secondary := strings.ToLower(r.URL.Query().Get("secondary")) + if secondary == "" { + if cookieSecondary != "" { + secondary = strings.ToLower(cookieSecondary) } else { - if err != nil { - glog.Error(handlerName, " error: ", err) - } - if s.debug { - data = s.newTemplateDataWithError(fmt.Sprintf("Internal server error: %v, data %+v", err, data)) - } else { - data = s.newTemplateDataWithError("Internal server error") - } + secondary = "usd" + } + } + ticker := s.fiatRates.GetCurrentTicker(secondary, "") + if ticker == nil && secondary != "usd" { + secondary = "usd" + ticker = s.fiatRates.GetCurrentTicker(secondary, "") + } + if ticker != nil { + t.SecondaryCoin = strings.ToUpper(secondary) + t.CurrentSecondaryCoinRate = float64(ticker.Rates[secondary]) + t.CurrentTicker = ticker + t.SecondaryCurrencies = make([]string, 0, len(ticker.Rates)) + for k := range ticker.Rates { + t.SecondaryCurrencies = append(t.SecondaryCurrencies, strings.ToUpper(k)) + } + sort.Strings(t.SecondaryCurrencies) // sort to get deterministic results + t.UseSecondaryCoin, _ = strconv.ParseBool(r.URL.Query().Get("use_secondary")) + if !t.UseSecondaryCoin { + t.UseSecondaryCoin = cookieUseSecondary } } } + return t } -type tpl int +func (s *PublicServer) newTemplateDataWithError(error *api.APIError, r *http.Request) *TemplateData { + td := s.newTemplateData(r) + td.Error = error + return td +} const ( - noTpl = tpl(iota) - errorTpl - errorInternalTpl - indexTpl + indexTpl = iota + errorInternalTpl + 1 txTpl addressTpl xpubTpl @@ -417,45 +369,78 @@ const ( blockTpl sendTransactionTpl mempoolTpl + nftDetailTpl - tplCount + publicTplCount ) // TemplateData is used to transfer data to the templates type TemplateData struct { - CoinName string - CoinShortcut string - CoinLabel string - InternalExplorer bool - ChainType bchain.ChainType - Address *api.Address - AddrStr string - Tx *api.Tx - Error *api.APIError - Blocks *api.Blocks - Block *api.Block - Info *api.SystemInfo - MempoolTxids *api.MempoolTxids - Page int - PrevPage int - NextPage int - PagingRange []int - PageParams template.URL - TOSLink string - SendTxHex string - Status string - NonZeroBalanceTokens bool + CoinName string + CoinShortcut string + CoinLabel string + InternalExplorer bool + ChainType bchain.ChainType + FungibleTokenName bchain.TokenStandardName + NonFungibleTokenName bchain.TokenStandardName + MultiTokenName bchain.TokenStandardName + Address *api.Address + AddrStr string + Tx *api.Tx + Error *api.APIError + Blocks *api.Blocks + Block *api.Block + Info *api.SystemInfo + MempoolTxids *api.MempoolTxids + Page int + PrevPage int + NextPage int + PagingRange []int + PageParams template.URL + Minified string + TOSLink string + SendTxHex string + Status string + NonZeroBalanceTokens bool + TokenId string + URI string + ContractInfo *bchain.ContractInfo + SecondaryCoin string + UseSecondaryCoin bool + CurrentSecondaryCoinRate float64 + CurrentTicker *common.CurrencyRatesTicker + SecondaryCurrencies []string + TxDate string + TxSecondaryCoinRate float64 + TxTicker *common.CurrencyRatesTicker } func (s *PublicServer) parseTemplates() []*template.Template { templateFuncMap := template.FuncMap{ - "formatTime": formatTime, - "formatUnixTime": formatUnixTime, + "timeSpan": timeSpan, + "relativeTime": relativeTime, + "unixTimeSpan": unixTimeSpan, + "amountSpan": s.amountSpan, + "tokenAmountSpan": s.tokenAmountSpan, + "amountSatsSpan": s.amountSatsSpan, + "formattedAmountSpan": s.formattedAmountSpan, + "summaryValuesSpan": s.summaryValuesSpan, + "addressAlias": addressAlias, + "addressAliasSpan": addressAliasSpan, "formatAmount": s.formatAmount, "formatAmountWithDecimals": formatAmountWithDecimals, + "formatInt64": formatInt64, + "formatInt": formatInt, + "formatUint32": formatUint32, + "formatBigInt": formatBigInt, "setTxToTemplateData": setTxToTemplateData, + "feePerByte": feePerByte, "isOwnAddress": isOwnAddress, "toJSON": toJSON, + "tokenTransfersCount": tokenTransfersCount, + "tokenCount": tokenCount, + "hasPrefix": strings.HasPrefix, + "jsStr": jsStr, } var createTemplate func(filenames ...string) *template.Template if s.debug { @@ -472,7 +457,7 @@ func (s *PublicServer) parseTemplates() []*template.Template { } t := template.New(filepath.Base(filenames[0])).Funcs(templateFuncMap) for _, filename := range filenames { - b, err := ioutil.ReadFile(filename) + b, err := os.ReadFile(filename) if err != nil { panic(err) } @@ -495,7 +480,7 @@ func (s *PublicServer) parseTemplates() []*template.Template { return t } } - t := make([]*template.Template, tplCount) + t := make([]*template.Template, publicTplCount) t[errorTpl] = createTemplate("./static/templates/error.html", "./static/templates/base.html") t[errorInternalTpl] = createTemplate("./static/templates/error.html", "./static/templates/base.html") t[indexTpl] = createTemplate("./static/templates/index.html", "./static/templates/base.html") @@ -505,6 +490,7 @@ func (s *PublicServer) parseTemplates() []*template.Template { t[txTpl] = createTemplate("./static/templates/tx.html", "./static/templates/txdetail_ethereumtype.html", "./static/templates/base.html") t[addressTpl] = createTemplate("./static/templates/address.html", "./static/templates/txdetail_ethereumtype.html", "./static/templates/paging.html", "./static/templates/base.html") t[blockTpl] = createTemplate("./static/templates/block.html", "./static/templates/txdetail_ethereumtype.html", "./static/templates/paging.html", "./static/templates/base.html") + t[nftDetailTpl] = createTemplate("./static/templates/tokenDetail.html", "./static/templates/base.html") } else { t[txTpl] = createTemplate("./static/templates/tx.html", "./static/templates/txdetail.html", "./static/templates/base.html") t[addressTpl] = createTemplate("./static/templates/address.html", "./static/templates/txdetail.html", "./static/templates/paging.html", "./static/templates/base.html") @@ -515,24 +501,14 @@ func (s *PublicServer) parseTemplates() []*template.Template { return t } -func formatUnixTime(ut int64) string { - return formatTime(time.Unix(ut, 0)) -} - -func formatTime(t time.Time) string { - return t.Format(time.RFC1123) -} - -func toJSON(data interface{}) string { - json, err := json.Marshal(data) - if err != nil { - return "" +func (s *PublicServer) postHtmlTemplateHandler(data *TemplateData, w http.ResponseWriter, r *http.Request) { + // // if SecondaryCoin is specified, set secondary_coin cookie + if data != nil && data.SecondaryCoin != "" { + http.SetCookie(w, &http.Cookie{Name: secondaryCoinCookieName, Value: data.SecondaryCoin + "=" + strconv.FormatBool(data.UseSecondaryCoin), Path: "/"}) } - return string(json) + } -// for now return the string as it is -// in future could be used to do coin specific formatting func (s *PublicServer) formatAmount(a *api.Amount) string { if a == nil { return "0" @@ -540,24 +516,260 @@ func (s *PublicServer) formatAmount(a *api.Amount) string { return s.chainParser.AmountToDecimalString((*big.Int)(a)) } -func formatAmountWithDecimals(a *api.Amount, d int) string { - if a == nil { - return "0" +func (s *PublicServer) amountSpan(a *api.Amount, td *TemplateData, classes string) template.HTML { + primary := s.formatAmount(a) + var rv strings.Builder + appendAmountWrapperSpan(&rv, primary, td.CoinShortcut, classes) + if s.useSatsAmountFormat { + appendAmountSpanBitcoinType(&rv, "prim-amt", primary, td.CoinShortcut, "") + } else { + appendAmountSpan(&rv, "prim-amt", primary, td.CoinShortcut, "") + } + if td.SecondaryCoin != "" { + p, err := strconv.ParseFloat(primary, 64) + if err == nil { + currentSecondary := formatSecondaryAmount(p*td.CurrentSecondaryCoinRate, td) + txSecondary := "" + // if tx is specified, compute secondary amount is at the time of tx and amount with current rate is returned with class "csec-amt" + if td.Tx != nil { + if td.TxTicker == nil { + date := time.Unix(td.Tx.Blocktime, 0).UTC() + secondary := strings.ToLower(td.SecondaryCoin) + var ticker *common.CurrencyRatesTicker + tickers, err := s.fiatRates.GetTickersForTimestamps([]int64{int64(td.Tx.Blocktime)}, "", "") + if err == nil && tickers != nil && len(*tickers) > 0 { + ticker = (*tickers)[0] + } + if ticker != nil { + td.TxSecondaryCoinRate = float64(ticker.Rates[secondary]) + // the ticker is from the midnight, valid for the whole day before + td.TxDate = date.Add(-1 * time.Second).Format("2006-01-02") + td.TxTicker = ticker + } + } + if td.TxSecondaryCoinRate != 0 { + txSecondary = formatSecondaryAmount(p*td.TxSecondaryCoinRate, td) + } + } + if txSecondary != "" { + appendAmountSpan(&rv, "sec-amt", txSecondary, td.SecondaryCoin, td.TxDate) + appendAmountSpan(&rv, "csec-amt", currentSecondary, td.SecondaryCoin, "") + } else { + appendAmountSpan(&rv, "sec-amt", currentSecondary, td.SecondaryCoin, "") + } + } + } + rv.WriteString("") + return template.HTML(rv.String()) +} + +func (s *PublicServer) amountSatsSpan(a *api.Amount, td *TemplateData, classes string) template.HTML { + var sats string + if s.chainParser.GetChainType() == bchain.ChainEthereumType { + sats = a.DecimalString(9) // Gwei + } else { + sats = a.String() + } + var rv strings.Builder + rv.WriteString(``) + appendAmountSpan(&rv, "", sats, "", "") + rv.WriteString("") + return template.HTML(rv.String()) +} + +func (s *PublicServer) tokenAmountSpan(t *api.TokenTransfer, td *TemplateData, classes string) template.HTML { + primary := formatAmountWithDecimals(t.Value, t.Decimals) + var rv strings.Builder + appendAmountWrapperSpan(&rv, primary, t.Symbol, classes) + appendAmountSpan(&rv, "prim-amt", primary, t.Symbol, "") + if td.SecondaryCoin != "" { + var currentBase, currentSecondary, txBase, txSecondary string + p, err := strconv.ParseFloat(primary, 64) + if err == nil { + if td.CurrentTicker != nil { + // get rate from current ticker + baseRateCurrent, found := td.CurrentTicker.GetTokenRate(t.Contract) + if found { + base := p * float64(baseRateCurrent) + currentBase = strconv.FormatFloat(base, 'f', 6, 64) + currentSecondary = formatSecondaryAmount(base*td.CurrentSecondaryCoinRate, td) + // get the historical rate only if current rate exist + // it is very costly to search in DB in vain for a rate for token for which there are no exchange rates + baseRate, found := s.api.GetContractBaseRate(td.TxTicker, t.Contract, td.Tx.Blocktime) + if found { + base := p * baseRate + txBase = strconv.FormatFloat(base, 'f', 6, 64) + txSecondary = formatSecondaryAmount(base*td.TxSecondaryCoinRate, td) + } + } + } + } + if txBase != "" { + appendAmountSpan(&rv, "base-amt", txBase, td.CoinShortcut, td.TxDate) + if currentBase != "" { + appendAmountSpan(&rv, "cbase-amt", currentBase, td.CoinShortcut, "") + } + } else if currentBase != "" { + appendAmountSpan(&rv, "base-amt", currentBase, td.CoinShortcut, "") + } + if txSecondary != "" { + appendAmountSpan(&rv, "sec-amt", txSecondary, td.SecondaryCoin, td.TxDate) + if currentSecondary != "" { + appendAmountSpan(&rv, "csec-amt", currentSecondary, td.SecondaryCoin, "") + } + } else if currentSecondary != "" { + appendAmountSpan(&rv, "sec-amt", currentSecondary, td.SecondaryCoin, "") + } else { + appendAmountSpan(&rv, "sec-amt", "-", "", "") + } + } + rv.WriteString("") + return template.HTML(rv.String()) +} + +func (s *PublicServer) formattedAmountSpan(a *api.Amount, d int, symbol string, td *TemplateData, classes string) template.HTML { + if symbol == td.CoinShortcut { + d = s.chainParser.AmountDecimals() + } + value := formatAmountWithDecimals(a, d) + var rv strings.Builder + appendAmountSpan(&rv, classes, value, symbol, "") + return template.HTML(rv.String()) +} + +func (s *PublicServer) summaryValuesSpan(baseValue float64, secondaryValue float64, td *TemplateData) template.HTML { + var rv strings.Builder + if secondaryValue > 0 { + appendAmountSpan(&rv, "", formatSecondaryAmount(secondaryValue, td), td.SecondaryCoin, "") + if baseValue > 0 && s.chainParser.GetChainType() == bchain.ChainEthereumType { + rv.WriteString(`(`) + appendAmountSpan(&rv, "", strconv.FormatFloat(baseValue, 'f', 6, 64), td.CoinShortcut, "") + rv.WriteString(")") + } + } else { + if baseValue > 0 { + appendAmountSpan(&rv, "", strconv.FormatFloat(baseValue, 'f', 6, 64), td.CoinShortcut, "") + } else { + if td.SecondaryCoin != "" { + rv.WriteString("-") + } + } + } + return template.HTML(rv.String()) +} + +func formatSecondaryAmount(a float64, td *TemplateData) string { + if td.SecondaryCoin == "BTC" || td.SecondaryCoin == "ETH" { + return strconv.FormatFloat(a, 'f', 6, 64) + } + return strconv.FormatFloat(a, 'f', 2, 64) +} + +func getAddressAlias(a string, td *TemplateData) *api.AddressAlias { + var alias api.AddressAlias + var found bool + if td.Block != nil { + alias, found = td.Block.AddressAliases[a] + } else if td.Address != nil { + alias, found = td.Address.AddressAliases[a] + } else if td.Tx != nil { + alias, found = td.Tx.AddressAliases[a] + } + if !found { + return nil } - return a.DecimalString(d) + return &alias +} + +func addressAlias(a string, td *TemplateData) string { + alias := getAddressAlias(a, td) + if alias == nil { + return "" + } + return alias.Alias +} + +func addressAliasSpan(a string, td *TemplateData) template.HTML { + var rv strings.Builder + alias := getAddressAlias(a, td) + if alias == nil { + rv.WriteString(``) + rv.WriteString(a) + } else { + rv.WriteString(``) + rv.WriteString(html.EscapeString(alias.Alias)) + } + rv.WriteString("") + return template.HTML(rv.String()) } // called from template to support txdetail.html functionality func setTxToTemplateData(td *TemplateData, tx *api.Tx) *TemplateData { td.Tx = tx + // reset the TxTicker if different Blocktime + if td.TxTicker != nil && td.TxTicker.Timestamp.Unix() != tx.Blocktime { + td.TxSecondaryCoinRate = 0 + td.TxTicker = nil + } return td } +// feePerByte returns fee per vByte or Byte if vsize is unknown +func feePerByte(tx *api.Tx) string { + if tx.FeesSat != nil { + if tx.VSize > 0 { + return fmt.Sprintf("%.2f sat/vByte", float64(tx.FeesSat.AsInt64())/float64(tx.VSize)) + } + if tx.Size > 0 { + return fmt.Sprintf("%.2f sat/Byte", float64(tx.FeesSat.AsInt64())/float64(tx.Size)) + } + } + return "" +} + // isOwnAddress returns true if the address is the one that is being shown in the explorer func isOwnAddress(td *TemplateData, a string) bool { return a == td.AddrStr } +// called from template, returns count of token transfers of given type in a tx +func tokenTransfersCount(tx *api.Tx, t bchain.TokenStandardName) int { + count := 0 + for i := range tx.TokenTransfers { + if tx.TokenTransfers[i].Standard == t { + count++ + } + } + return count +} + +// called from template, returns count of tokens in array of given type +func tokenCount(tokens []api.Token, t bchain.TokenStandardName) int { + count := 0 + for i := range tokens { + if tokens[i].Standard == t { + count++ + } + } + return count +} + +func jsStr(s string) template.JSStr { + return template.JSStr(s) +} + func (s *PublicServer) explorerTx(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error) { var tx *api.Tx var err error @@ -569,7 +781,7 @@ func (s *PublicServer) explorerTx(w http.ResponseWriter, r *http.Request) (tpl, return errorTpl, nil, err } } - data := s.newTemplateData() + data := s.newTemplateData(r) data.Tx = tx return txTpl, data, nil } @@ -584,7 +796,7 @@ func (s *PublicServer) explorerSpendingTx(w http.ResponseWriter, r *http.Request if ec == nil { spendingTx, err := s.api.GetSpendingTxid(tx, n) if err == nil && spendingTx != "" { - http.Redirect(w, r, joinURL("/tx/", spendingTx), 302) + http.Redirect(w, r, joinURL("/tx/", spendingTx), http.StatusFound) return noTpl, nil, nil } } @@ -675,11 +887,11 @@ func (s *PublicServer) explorerAddress(w http.ResponseWriter, r *http.Request) ( s.metrics.ExplorerViews.With(common.Labels{"action": "address"}).Inc() page, _, _, filter, filterParam, _ := s.getAddressQueryParams(r, api.AccountDetailsTxHistoryLight, txsOnPage) // do not allow details to be changed by query params - address, err := s.api.GetAddress(addressParam, page, txsOnPage, api.AccountDetailsTxHistoryLight, filter) + data := s.newTemplateData(r) + address, err := s.api.GetAddress(addressParam, page, txsOnPage, api.AccountDetailsTxHistoryLight, filter, strings.ToLower(data.SecondaryCoin)) if err != nil { return errorTpl, nil, err } - data := s.newTemplateData() data.AddrStr = address.AddrStr data.Address = address data.Page = address.Page @@ -694,6 +906,28 @@ func (s *PublicServer) explorerAddress(w http.ResponseWriter, r *http.Request) ( return addressTpl, data, nil } +func (s *PublicServer) explorerNftDetail(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error) { + parts := strings.Split(r.URL.Path, "/") + if len(parts) < 3 { + return errorTpl, nil, api.NewAPIError("Missing parameters", true) + } + tokenId := parts[len(parts)-1] + contract := parts[len(parts)-2] + uri, ci, err := s.api.GetEthereumTokenURI(contract, tokenId) + s.metrics.ExplorerViews.With(common.Labels{"action": "nftDetail"}).Inc() + if err != nil { + return errorTpl, nil, api.NewAPIError(err.Error(), true) + } + if ci == nil { + return errorTpl, nil, api.NewAPIError(fmt.Sprintf("Unknown contract %s", contract), true) + } + data := s.newTemplateData(r) + data.TokenId = tokenId + data.ContractInfo = ci + data.URI = uri + return nftDetailTpl, data, nil +} + func (s *PublicServer) explorerXpub(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error) { var xpub string i := strings.LastIndex(r.URL.Path, "xpub/") @@ -704,16 +938,16 @@ func (s *PublicServer) explorerXpub(w http.ResponseWriter, r *http.Request) (tpl return errorTpl, nil, api.NewAPIError("Missing xpub", true) } s.metrics.ExplorerViews.With(common.Labels{"action": "xpub"}).Inc() - page, _, _, filter, filterParam, gap := s.getAddressQueryParams(r, api.AccountDetailsTxHistoryLight, txsOnPage) // do not allow txsOnPage and details to be changed by query params - address, err := s.api.GetXpubAddress(xpub, page, txsOnPage, api.AccountDetailsTxHistoryLight, filter, gap) + page, _, _, filter, filterParam, gap := s.getAddressQueryParams(r, api.AccountDetailsTxHistoryLight, txsOnPage) + data := s.newTemplateData(r) + address, err := s.api.GetXpubAddress(xpub, page, txsOnPage, api.AccountDetailsTxHistoryLight, filter, gap, strings.ToLower(data.SecondaryCoin)) if err != nil { if err == api.ErrUnsupportedXpub { err = api.NewAPIError("XPUB functionality is not supported", true) } return errorTpl, nil, err } - data := s.newTemplateData() data.AddrStr = address.AddrStr data.Address = address data.Page = address.Page @@ -738,7 +972,7 @@ func (s *PublicServer) explorerBlocks(w http.ResponseWriter, r *http.Request) (t if err != nil { return errorTpl, nil, err } - data := s.newTemplateData() + data := s.newTemplateData(r) data.Blocks = blocks data.Page = blocks.Page data.PagingRange, data.PrevPage, data.NextPage = getPagingRange(blocks.Page, blocks.TotalPages) @@ -759,7 +993,7 @@ func (s *PublicServer) explorerBlock(w http.ResponseWriter, r *http.Request) (tp return errorTpl, nil, err } } - data := s.newTemplateData() + data := s.newTemplateData(r) data.Block = block data.Page = block.Page data.PagingRange, data.PrevPage, data.NextPage = getPagingRange(block.Page, block.TotalPages) @@ -767,6 +1001,11 @@ func (s *PublicServer) explorerBlock(w http.ResponseWriter, r *http.Request) (tp } func (s *PublicServer) explorerIndex(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error) { + if !s.isFullInterface && r.URL.Path != "/" { + w.WriteHeader(http.StatusServiceUnavailable) + w.Write([]byte("Service unavailable")) + return noTpl, nil, nil + } var si *api.SystemInfo var err error s.metrics.ExplorerViews.With(common.Labels{"action": "index"}).Inc() @@ -774,7 +1013,7 @@ func (s *PublicServer) explorerIndex(w http.ResponseWriter, r *http.Request) (tp if err != nil { return errorTpl, nil, err } - data := s.newTemplateData() + data := s.newTemplateData(r) data.Info = si return indexTpl, data, nil } @@ -787,24 +1026,24 @@ func (s *PublicServer) explorerSearch(w http.ResponseWriter, r *http.Request) (t var err error s.metrics.ExplorerViews.With(common.Labels{"action": "search"}).Inc() if len(q) > 0 { - address, err = s.api.GetXpubAddress(q, 0, 1, api.AccountDetailsBasic, &api.AddressFilter{Vout: api.AddressFilterVoutOff}, 0) + address, err = s.api.GetXpubAddress(q, 0, 1, api.AccountDetailsBasic, &api.AddressFilter{Vout: api.AddressFilterVoutOff}, 0, "") if err == nil { - http.Redirect(w, r, joinURL("/xpub/", url.QueryEscape(address.AddrStr)), 302) + http.Redirect(w, r, joinURL("/xpub/", url.QueryEscape(address.AddrStr)), http.StatusFound) return noTpl, nil, nil } block, err = s.api.GetBlock(q, 0, 1) if err == nil { - http.Redirect(w, r, joinURL("/block/", block.Hash), 302) + http.Redirect(w, r, joinURL("/block/", block.Hash), http.StatusFound) return noTpl, nil, nil } tx, err = s.api.GetTransaction(q, false, false) if err == nil { - http.Redirect(w, r, joinURL("/tx/", tx.Txid), 302) + http.Redirect(w, r, joinURL("/tx/", tx.Txid), http.StatusFound) return noTpl, nil, nil } - address, err = s.api.GetAddress(q, 0, 1, api.AccountDetailsBasic, &api.AddressFilter{Vout: api.AddressFilterVoutOff}) + address, err = s.api.GetAddress(q, 0, 1, api.AccountDetailsBasic, &api.AddressFilter{Vout: api.AddressFilterVoutOff}, "") if err == nil { - http.Redirect(w, r, joinURL("/address/", address.AddrStr), 302) + http.Redirect(w, r, joinURL("/address/", address.AddrStr), http.StatusFound) return noTpl, nil, nil } } @@ -813,7 +1052,7 @@ func (s *PublicServer) explorerSearch(w http.ResponseWriter, r *http.Request) (t func (s *PublicServer) explorerSendTx(w http.ResponseWriter, r *http.Request) (tpl, *TemplateData, error) { s.metrics.ExplorerViews.With(common.Labels{"action": "sendtx"}).Inc() - data := s.newTemplateData() + data := s.newTemplateData(r) if r.Method == http.MethodPost { err := r.ParseForm() if err != nil { @@ -821,7 +1060,7 @@ func (s *PublicServer) explorerSendTx(w http.ResponseWriter, r *http.Request) (t } hex := r.FormValue("hex") if len(hex) > 0 { - res, err := s.chain.SendRawTransaction(hex) + res, err := s.chain.SendRawTransaction(hex, false) if err != nil { data.SendTxHex = hex data.Error = &api.APIError{Text: err.Error(), Public: true} @@ -845,7 +1084,7 @@ func (s *PublicServer) explorerMempool(w http.ResponseWriter, r *http.Request) ( if err != nil { return errorTpl, nil, err } - data := s.newTemplateData() + data := s.newTemplateData(r) data.MempoolTxids = mempoolTxids data.Page = mempoolTxids.Page data.PagingRange, data.PrevPage, data.NextPage = getPagingRange(mempoolTxids.Page, mempoolTxids.TotalPages) @@ -911,6 +1150,9 @@ func getPagingRange(page int, total int) ([]int, int, int) { } func (s *PublicServer) apiIndex(r *http.Request, apiVersion int) (interface{}, error) { + if !s.isFullInterface && r.URL.Path != "/api/" { + return nil, api.NewAPIError("Service unavailable", false) + } s.metrics.ExplorerViews.With(common.Labels{"action": "api-index"}).Inc() return s.api.GetSystemInfo(false) } @@ -941,6 +1183,96 @@ func (s *PublicServer) apiBlockIndex(r *http.Request, apiVersion int) (interface }, nil } +func (s *PublicServer) apiBlockFilters(r *http.Request, apiVersion int) (interface{}, error) { + // Define return type + type blockFilterResult struct { + BlockHash string `json:"blockHash"` + Filter string `json:"filter"` + } + type resBlockFilters struct { + ParamP uint8 `json:"P"` + ParamM uint64 `json:"M"` + ZeroedKey bool `json:"zeroedKey"` + BlockFilters map[int]blockFilterResult `json:"blockFilters"` + } + + // Parse parameters + lastN, ec := strconv.Atoi(r.URL.Query().Get("lastN")) + if ec != nil { + lastN = 0 + } + from, ec := strconv.Atoi(r.URL.Query().Get("from")) + if ec != nil { + from = 0 + } + to, ec := strconv.Atoi(r.URL.Query().Get("to")) + if ec != nil { + to = 0 + } + scriptType := r.URL.Query().Get("scriptType") + if scriptType != s.is.BlockFilterScripts { + return nil, api.NewAPIError(fmt.Sprintf("Invalid scriptType %s. Use %s", scriptType, s.is.BlockFilterScripts), true) + } + // NOTE: technically, we are also accepting "m: uint64" param, but we do not use it currently + + // Sanity checks + if lastN == 0 && from == 0 && to == 0 { + return nil, api.NewAPIError("Missing parameters", true) + } + if from > to { + return nil, api.NewAPIError("Invalid parameters - from > to", true) + } + + // Best height is needed more than once + bestHeight, _, err := s.db.GetBestBlock() + if err != nil { + glog.Error(err) + return nil, err + } + + // Modify to/from if needed + if lastN > 0 { + // Get data for last N blocks + to = int(bestHeight) + from = to - lastN + 1 + } else { + // Get data for specified from-to range + // From will always stay the same (even if 0) + // To will be the best block if not specified + if to == 0 { + to = int(bestHeight) + } + } + + handleBlockFiltersResultFromTo := func(fromHeight int, toHeight int) (interface{}, error) { + blockFiltersMap := make(map[int]blockFilterResult) + for i := fromHeight; i <= toHeight; i++ { + blockHash, err := s.db.GetBlockHash(uint32(i)) + if err != nil { + glog.Error(err) + return nil, err + } + blockFilter, err := s.db.GetBlockFilter(blockHash) + if err != nil { + glog.Error(err) + return nil, err + } + blockFiltersMap[i] = blockFilterResult{ + BlockHash: blockHash, + Filter: blockFilter, + } + } + return resBlockFilters{ + ParamP: s.is.BlockGolombFilterP, + ParamM: bchain.GetGolombParamM(s.is.BlockGolombFilterP), + ZeroedKey: s.is.BlockFilterUseZeroedKey, + BlockFilters: blockFiltersMap, + }, nil + } + + return handleBlockFiltersResultFromTo(from, to) +} + func (s *PublicServer) apiTx(r *http.Request, apiVersion int) (interface{}, error) { var txid string i := strings.LastIndexByte(r.URL.Path, '/') @@ -968,6 +1300,19 @@ func (s *PublicServer) apiTx(r *http.Request, apiVersion int) (interface{}, erro return tx, err } +func (s *PublicServer) apiRawTx(r *http.Request, apiVersion int) (interface{}, error) { + var txid string + i := strings.LastIndexByte(r.URL.Path, '/') + if i > 0 { + txid = r.URL.Path[i+1:] + } + if len(txid) == 0 { + return "", api.NewAPIError("Missing txid", true) + } + s.metrics.ExplorerViews.With(common.Labels{"action": "api-raw-tx"}).Inc() + return s.api.GetRawTransaction(txid) +} + func (s *PublicServer) apiTxSpecific(r *http.Request, apiVersion int) (interface{}, error) { var txid string i := strings.LastIndexByte(r.URL.Path, '/') @@ -1000,7 +1345,8 @@ func (s *PublicServer) apiAddress(r *http.Request, apiVersion int) (interface{}, var err error s.metrics.ExplorerViews.With(common.Labels{"action": "api-address"}).Inc() page, pageSize, details, filter, _, _ := s.getAddressQueryParams(r, api.AccountDetailsTxidHistory, txsInAPI) - address, err = s.api.GetAddress(addressParam, page, pageSize, details, filter) + secondaryCoin := strings.ToLower(r.URL.Query().Get("secondary")) + address, err = s.api.GetAddress(addressParam, page, pageSize, details, filter, secondaryCoin) if err == nil && apiVersion == apiV1 { return s.api.AddressToV1(address), nil } @@ -1020,7 +1366,8 @@ func (s *PublicServer) apiXpub(r *http.Request, apiVersion int) (interface{}, er var err error s.metrics.ExplorerViews.With(common.Labels{"action": "api-xpub"}).Inc() page, pageSize, details, filter, _, gap := s.getAddressQueryParams(r, api.AccountDetailsTxidHistory, txsInAPI) - address, err = s.api.GetXpubAddress(xpub, page, pageSize, details, filter, gap) + secondaryCoin := strings.ToLower(r.URL.Query().Get("secondary")) + address, err = s.api.GetXpubAddress(xpub, page, pageSize, details, filter, gap, secondaryCoin) if err == nil && apiVersion == apiV1 { return s.api.AddressToV1(address), nil } @@ -1152,7 +1499,7 @@ func (s *PublicServer) apiSendTx(r *http.Request, apiVersion int) (interface{}, var hex string s.metrics.ExplorerViews.With(common.Labels{"action": "api-sendtx"}).Inc() if r.Method == http.MethodPost { - data, err := ioutil.ReadAll(r.Body) + data, err := io.ReadAll(r.Body) if err != nil { return nil, api.NewAPIError("Missing tx blob", true) } @@ -1163,7 +1510,7 @@ func (s *PublicServer) apiSendTx(r *http.Request, apiVersion int) (interface{}, } } if len(hex) > 0 { - res.Result, err = s.chain.SendRawTransaction(hex) + res.Result, err = s.chain.SendRawTransaction(hex, false) if err != nil { return nil, api.NewAPIError(err.Error(), true) } @@ -1172,21 +1519,22 @@ func (s *PublicServer) apiSendTx(r *http.Request, apiVersion int) (interface{}, return nil, api.NewAPIError("Missing tx blob", true) } -// apiTickersList returns a list of available FiatRates currencies -func (s *PublicServer) apiTickersList(r *http.Request, apiVersion int) (interface{}, error) { +// apiAvailableVsCurrencies returns a list of available versus currencies +func (s *PublicServer) apiAvailableVsCurrencies(r *http.Request, apiVersion int) (interface{}, error) { s.metrics.ExplorerViews.With(common.Labels{"action": "api-tickers-list"}).Inc() timestampString := strings.ToLower(r.URL.Query().Get("timestamp")) timestamp, err := strconv.ParseInt(timestampString, 10, 64) if err != nil { return nil, api.NewAPIError("Parameter \"timestamp\" is not a valid Unix timestamp.", true) } - result, err := s.api.GetFiatRatesTickersList(timestamp) + token := strings.ToLower(r.URL.Query().Get("token")) + result, err := s.api.GetAvailableVsCurrencies(timestamp, token) return result, err } // apiTickers returns FiatRates ticker prices for the specified block or timestamp. func (s *PublicServer) apiTickers(r *http.Request, apiVersion int) (interface{}, error) { - var result *db.ResultTickerAsString + var result *api.FiatTicker var err error currency := strings.ToLower(r.URL.Query().Get("currency")) @@ -1194,11 +1542,12 @@ func (s *PublicServer) apiTickers(r *http.Request, apiVersion int) (interface{}, if currency != "" { currencies = []string{currency} } + token := strings.ToLower(r.URL.Query().Get("token")) if block := r.URL.Query().Get("block"); block != "" { // Get tickers for specified block height or block hash s.metrics.ExplorerViews.With(common.Labels{"action": "api-tickers-block"}).Inc() - result, err = s.api.GetFiatRatesForBlockID(block, currencies) + result, err = s.api.GetFiatRatesForBlockID(block, currencies, token) } else if timestampString := r.URL.Query().Get("timestamp"); timestampString != "" { // Get tickers for specified timestamp s.metrics.ExplorerViews.With(common.Labels{"action": "api-tickers-date"}).Inc() @@ -1208,7 +1557,7 @@ func (s *PublicServer) apiTickers(r *http.Request, apiVersion int) (interface{}, return nil, api.NewAPIError("Parameter 'timestamp' is not a valid Unix timestamp.", true) } - resultTickers, err := s.api.GetFiatRatesForTimestamps([]int64{timestamp}, currencies) + resultTickers, err := s.api.GetFiatRatesForTimestamps([]int64{timestamp}, currencies, token) if err != nil { return nil, err } @@ -1216,7 +1565,7 @@ func (s *PublicServer) apiTickers(r *http.Request, apiVersion int) (interface{}, } else { // No parameters - get the latest available ticker s.metrics.ExplorerViews.With(common.Labels{"action": "api-tickers-last"}).Inc() - result, err = s.api.GetCurrentFiatRates(currencies) + result, err = s.api.GetCurrentFiatRates(currencies, token) } if err != nil { return nil, err @@ -1226,7 +1575,7 @@ func (s *PublicServer) apiTickers(r *http.Request, apiVersion int) (interface{}, // apiMultiTickers returns FiatRates ticker prices for the specified comma separated list of timestamps. func (s *PublicServer) apiMultiTickers(r *http.Request, apiVersion int) (interface{}, error) { - var result []db.ResultTickerAsString + var result []api.FiatTicker var err error currency := strings.ToLower(r.URL.Query().Get("currency")) @@ -1234,6 +1583,7 @@ func (s *PublicServer) apiMultiTickers(r *http.Request, apiVersion int) (interfa if currency != "" { currencies = []string{currency} } + token := strings.ToLower(r.URL.Query().Get("token")) if timestampString := r.URL.Query().Get("timestamp"); timestampString != "" { // Get tickers for specified timestamp s.metrics.ExplorerViews.With(common.Labels{"action": "api-multi-tickers-date"}).Inc() @@ -1245,7 +1595,7 @@ func (s *PublicServer) apiMultiTickers(r *http.Request, apiVersion int) (interfa return nil, api.NewAPIError("Parameter 'timestamp' does not contain a valid Unix timestamp.", true) } } - resultTickers, err := s.api.GetFiatRatesForTimestamps(t, currencies) + resultTickers, err := s.api.GetFiatRatesForTimestamps(t, currencies, token) if err != nil { return nil, err } diff --git a/server/public_ethereumtype_test.go b/server/public_ethereumtype_test.go new file mode 100644 index 0000000000..f63f8558f0 --- /dev/null +++ b/server/public_ethereumtype_test.go @@ -0,0 +1,274 @@ +//go:build unittest +// +build unittest + +package server + +import ( + "net/http" + "net/http/httptest" + "testing" + "time" + + "github.com/golang/glog" + "github.com/linxGnu/grocksdb" + "github.com/trezor/blockbook/bchain" + "github.com/trezor/blockbook/bchain/coins/eth" + "github.com/trezor/blockbook/common" + "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/tests/dbtestdata" +) + +func httpTestsEthereumType(t *testing.T, ts *httptest.Server) { + tests := []httpTests{ + { + name: "explorerAddress " + dbtestdata.EthAddr7b, + r: newGetRequest(ts.URL + "/address/" + dbtestdata.EthAddr7b), + status: http.StatusOK, + contentType: "text/html; charset=utf-8", + body: []string{ + `Trezor Fake Coin Explorer

Address address7b.eth

0x7B62EB7fe80350DC7EC945C0B73242cb9877FB1b

0.000000000123450123 FAKE
0.00 USD

Confirmed
Balance0.000000000123450123 FAKE0.00 USD
Transactions2
Non-contract Transactions0
Internal Transactions0
Nonce123
ContractQuantityValueTransfers#
Contract 130.000000001000123013 S13-1
Contract 740.001000123074 S74-1
ContractTokensTransfers#
Contract 20511

Transactions

ERC721 Token Transfers
ERC20 Token Transfers
address7b.eth
 
871.180000950184 S74-
 
address7b.eth
7.674999999999991915 S13-
`, + }, + }, + { + name: "explorerAddress " + dbtestdata.EthAddr5d, + r: newGetRequest(ts.URL + "/address/" + dbtestdata.EthAddr5d), + status: http.StatusOK, + contentType: "text/html; charset=utf-8", + body: []string{ + `Trezor Fake Coin Explorer

Address

0x5Dc6288b35E0807A3d6fEB89b3a2Ff4aB773168e

0.000000000123450093 FAKE
0.00 USD

Confirmed
Balance0.000000000123450093 FAKE0.00 USD
Transactions1
Non-contract Transactions1
Internal Transactions0
Nonce93
ContractTokensTransfers#
Contract 1111 S111 of ID 1776, 10 S111 of ID 18981

Transactions

0x5Dc6288b35E0807A3d6fEB89b3a2Ff4aB773168e
 
0 FAKE0.00 USD0.00 USD
ERC1155 Token Transfers
 
0x5Dc6288b35E0807A3d6fEB89b3a2Ff4aB773168e
1 S111 of ID 1776, 10 S111 of ID 1898
`, + }, + }, + { + name: "explorerTx " + dbtestdata.EthTxidB1T2, + r: newGetRequest(ts.URL + "/tx/0x" + dbtestdata.EthTxidB1T2), + status: http.StatusOK, + contentType: "text/html; charset=utf-8", + body: []string{ + `Trezor Fake Coin Explorer

Transaction

0xa9cd088aba2131000da6f38a33c20169baee476218deea6b78720700b895b101
In BlockUnconfirmed
StatusSuccess
Value0 FAKE0.00 USD0.00 USD
Gas Used / Limit52025 / 78037
Gas Price0.00000004 FAKE0.00 USD0.00 USD (40 Gwei)
Max Priority Fee Per Gas0.000000040000000001 FAKE0.00 USD0.00 USD (40.000000001 Gwei)
Max Fee Per Gas0.000000040000000002 FAKE0.00 USD0.00 USD (40.000000002 Gwei)
Base Fee Per Gas0.000000040000000003 FAKE0.00 USD0.00 USD (40.000000003 Gwei)
Fees0.002081 FAKE4.16 USD18.55 USD
RBFON
Nonce208
 
0 FAKE0.00 USD0.00 USD
ERC20 Token Transfers
Input Data

0xa9059cbb000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f00000000000000000000000000000000000000000000021e19e0c9bab2400000
transfer(address, uint256)
#TypeData
0address0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f
1uint25610000000000000000000000
`, + }, + }, { + name: "explorerTokenDetail " + dbtestdata.EthAddr7b, + r: newGetRequest(ts.URL + "/nft/" + dbtestdata.EthAddrContractCd + "/" + "1"), + status: http.StatusOK, + contentType: "text/html; charset=utf-8", + body: []string{`Trezor Fake Coin Explorer

NFT Token Detail

Token ID1
Contract0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9
Contract 205
StandardERC20
`}, + }, + { + name: "apiIndex", + r: newGetRequest(ts.URL + "/api"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"blockbook":{"coin":"Fakecoin"`, + `"bestHeight":4321001`, + `"decimals":18`, + `"backend":{"chain":"fakecoin","blocks":2,"headers":2,"bestBlockHash":"0x2b57e15e93a0ed197417a34c2498b7187df79099572c04a6b6e6ff418f74e6ee"`, + `"version":"001001","subversion":"/Fakecoin:0.0.1/"`, + }, + }, + { + name: "apiAddress EthAddr4b", + r: newGetRequest(ts.URL + "/api/v2/address/" + dbtestdata.EthAddr4b), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D","balance":"123450075","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":1,"nonTokenTxs":1,"internalTxs":1,"txids":["0xc92919ad24ffd58f760b18df7949f06e1190cf54a50a0e3745a385608ed3cbf2"],"nonce":"75","tokens":[{"type":"ERC20","standard":"ERC20","name":"Contract 13","contract":"0x0d0F936Ee4c93e25944694D6C121de94D9760F11","transfers":2,"symbol":"S13","decimals":18,"balance":"1000075013"},{"type":"ERC20","standard":"ERC20","name":"Contract 74","contract":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","transfers":2,"symbol":"S74","decimals":12,"balance":"1000075074"}]}`, + }, + }, + { + name: "apiAddress EthAddr7b details=txs", + r: newGetRequest(ts.URL + "/api/v2/address/" + dbtestdata.EthAddr7b + "?details=txs"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"0x7B62EB7fe80350DC7EC945C0B73242cb9877FB1b","balance":"123450123","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"transactions":[{"txid":"0xca7628be5c80cda77163729ec63d218ee868a399d827a4682a478c6f48a6e22a","vin":[{"n":0,"addresses":["0x837E3f699d85a4b0B99894567e9233dFB1DcB081"],"isAddress":true}],"vout":[{"value":"0","n":0,"addresses":["0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9"],"isAddress":true}],"blockHeight":-1,"confirmations":0,"blockTime":0,"value":"0","fees":"87945000410410","rbf":true,"coinSpecificData":{"tx":{"nonce":"0x2","gasPrice":"0x59682f07","gas":"0x173a9","to":"0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9","value":"0x0","input":"0x23b872dd000000000000000000000000837e3f699d85a4b0b99894567e9233dfb1dcb0810000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b0000000000000000000000000000000000000000000000000000000000000001","hash":"0xca7628be5c80cda77163729ec63d218ee868a399d827a4682a478c6f48a6e22a","blockNumber":"0xb33b9f","from":"0x837E3f699d85a4b0B99894567e9233dFB1DcB081","transactionIndex":"0x1"},"receipt":{"gasUsed":"0xe506","status":"0x1","logs":[{"address":"0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9","topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925","0x000000000000000000000000837e3f699d85a4b0b99894567e9233dfb1dcb081","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x"},{"address":"0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000837e3f699d85a4b0b99894567e9233dfb1dcb081","0x0000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b","0x0000000000000000000000000000000000000000000000000000000000000001"],"data":"0x"}]}},"tokenTransfers":[{"type":"ERC721","standard":"ERC721","from":"0x837E3f699d85a4b0B99894567e9233dFB1DcB081","to":"0x7B62EB7fe80350DC7EC945C0B73242cb9877FB1b","contract":"0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9","name":"Contract 205","symbol":"S205","decimals":18,"value":"1"}],"ethereumSpecific":{"status":1,"nonce":2,"gasLimit":95145,"gasUsed":58630,"gasPrice":"1500000007","data":"0x23b872dd000000000000000000000000837e3f699d85a4b0b99894567e9233dfb1dcb0810000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b0000000000000000000000000000000000000000000000000000000000000001","parsedData":{"methodId":"0x23b872dd","name":""}}},{"txid":"0xc92919ad24ffd58f760b18df7949f06e1190cf54a50a0e3745a385608ed3cbf2","vin":[{"n":0,"addresses":["0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D"],"isAddress":true}],"vout":[{"value":"0","n":0,"addresses":["0x479CC461fEcd078F766eCc58533D6F69580CF3AC"],"isAddress":true}],"blockHeight":-1,"confirmations":0,"blockTime":0,"value":"0","fees":"216368000000000","rbf":true,"coinSpecificData":{"tx":{"nonce":"0x1df76","gasPrice":"0x3b9aca00","gas":"0x3d090","to":"0x479CC461fEcd078F766eCc58533D6F69580CF3AC","value":"0x0","input":"0x4f15078700000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f110000000000000000000000004af4114f73d1c1c903ac9e0361b379d1291808a200000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000000000000004af4114f73d1c1c903ac9e0361b379d1291808a20000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000a5ef5a7656bfb0000000000000000000000000000000000000000000000000000004ba78398d5c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000166cfe0b9579b4ecf7a2801880f644009a324671a79754ea57c3a103c6e70d3dbef6ba69a08000000000000000000000000000000000000000000000000004f937d86afb90000000000000000000000000000000000000000000000000ab280fd8037d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000166cfb784b7c1f3fbe8b75484603ab8adc58aaee3a46245a6579fac7077b5570018b4e0d4eb0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000308fd0e798ac00000000000000000000000000000000000000000000000006a8313d60b1f606b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000029de0ccec59e8948e3d905b40e5542335ebc1eb4674db517d2f6392ec7fdeb3d45f3449d313ee2589819c6c79eb1c1b047adae68565c1608e3a1d1d70823febb0000000000000000000000000000000000000000000000000000000000000000234d06fe17f1202e8b07177a30eb64d14adc08cdb3fa1b3e3e0bea0f9672c02175b77c01c51d3c7e460723b27ecbc7801fd6482559a8c9999593f9a4d149c7384","hash":"0xc92919ad24ffd58f760b18df7949f06e1190cf54a50a0e3745a385608ed3cbf2","blockNumber":"0x41eee9","from":"0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D","transactionIndex":"0x24"},"internalData":{"type":1,"contract":"0d0f936ee4c93e25944694d6c121de94d9760f11","transfers":[{"type":0,"from":"4bda106325c335df99eab7fe363cac8a0ba2a24d","to":"9f4981531fda132e83c44680787dfa7ee31e4f8d","value":1000010},{"type":2,"from":"4af4114f73d1c1c903ac9e0361b379d1291808a2","to":"9f4981531fda132e83c44680787dfa7ee31e4f8d","value":1000011}],"Error":""},"receipt":{"gasUsed":"0x34d30","status":"0x1","logs":[{"address":"0x0d0F936Ee4c93e25944694D6C121de94D9760F11","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f","0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d"],"data":"0x0000000000000000000000000000000000000000000000006a8313d60b1f8001"},{"address":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d","0x000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f"],"data":"0x000000000000000000000000000000000000000000000000000308fd0e798ac0"},{"address":"0x479CC461fEcd078F766eCc58533D6F69580CF3AC","topics":["0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3","0x000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f","0x0000000000000000000000000000000000000000000000000000000000000000","0x5af266c0a89a07c1917deaa024414577e6c3c31c8907d079e13eb448c082594f"],"data":"0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f110000000000000000000000004af4114f73d1c1c903ac9e0361b379d1291808a20000000000000000000000000000000000000000000000006a8313d60b1f8001000000000000000000000000000000000000000000000000000308fd0e798ac0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005e083a16f4b092c5729a49f9c3ed3cc171bb3d3d0c22e20b1de6063c32f399ac"},{"address":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b","0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d"],"data":"0x00000000000000000000000000000000000000000000000000031855667df7a8"},{"address":"0x0d0F936Ee4c93e25944694D6C121de94D9760F11","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d","0x0000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b"],"data":"0x0000000000000000000000000000000000000000000000006a8313d60b1f606b"},{"address":"0x479CC461fEcd078F766eCc58533D6F69580CF3AC","topics":["0x0d0b9391970d9a25552f37d436d2aae2925e2bfe1b2a923754bada030c498cb3","0x0000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b","0x0000000000000000000000000000000000000000000000000000000000000000","0xb0b69dad58df6032c3b266e19b1045b19c87acd2c06fb0c598090f44b8e263aa"],"data":"0x0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000000000000004af4114f73d1c1c903ac9e0361b379d1291808a20000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f1100000000000000000000000000000000000000000000000000031855667df7a80000000000000000000000000000000000000000000000006a8313d60b1f606b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f2b0d62c44ed08f2a5adef40c875d20310a42a9d4f488bd26323256fe01c7f48"}]}},"tokenTransfers":[{"type":"ERC20","standard":"ERC20","from":"0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f","to":"0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D","contract":"0x0d0F936Ee4c93e25944694D6C121de94D9760F11","name":"Contract 13","symbol":"S13","decimals":18,"value":"7675000000000000001"},{"type":"ERC20","standard":"ERC20","from":"0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D","to":"0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f","contract":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","name":"Contract 74","symbol":"S74","decimals":12,"value":"854307892726464"},{"type":"ERC20","standard":"ERC20","from":"0x7B62EB7fe80350DC7EC945C0B73242cb9877FB1b","to":"0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D","contract":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","name":"Contract 74","symbol":"S74","decimals":12,"value":"871180000950184"},{"type":"ERC20","standard":"ERC20","from":"0x4Bda106325C335dF99eab7fE363cAC8A0ba2a24D","to":"0x7B62EB7fe80350DC7EC945C0B73242cb9877FB1b","contract":"0x0d0F936Ee4c93e25944694D6C121de94D9760F11","name":"Contract 13","symbol":"S13","decimals":18,"value":"7674999999999991915"}],"ethereumSpecific":{"status":1,"nonce":122742,"gasLimit":250000,"gasUsed":216368,"gasPrice":"1000000000","data":"0x4f15078700000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f110000000000000000000000004af4114f73d1c1c903ac9e0361b379d1291808a200000000000000000000000000000000000000000000000000000000000000000000000000000000000000007b62eb7fe80350dc7ec945c0b73242cb9877fb1b0000000000000000000000004bda106325c335df99eab7fe363cac8a0ba2a24d0000000000000000000000004af4114f73d1c1c903ac9e0361b379d1291808a20000000000000000000000000d0f936ee4c93e25944694d6c121de94d9760f110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000a5ef5a7656bfb0000000000000000000000000000000000000000000000000000004ba78398d5c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000166cfe0b9579b4ecf7a2801880f644009a324671a79754ea57c3a103c6e70d3dbef6ba69a08000000000000000000000000000000000000000000000000004f937d86afb90000000000000000000000000000000000000000000000000ab280fd8037d500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000166cfb784b7c1f3fbe8b75484603ab8adc58aaee3a46245a6579fac7077b5570018b4e0d4eb0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000308fd0e798ac00000000000000000000000000000000000000000000000006a8313d60b1f606b0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001b00000000000000000000000000000000000000000000000000000000000000029de0ccec59e8948e3d905b40e5542335ebc1eb4674db517d2f6392ec7fdeb3d45f3449d313ee2589819c6c79eb1c1b047adae68565c1608e3a1d1d70823febb0000000000000000000000000000000000000000000000000000000000000000234d06fe17f1202e8b07177a30eb64d14adc08cdb3fa1b3e3e0bea0f9672c02175b77c01c51d3c7e460723b27ecbc7801fd6482559a8c9999593f9a4d149c7384","parsedData":{"methodId":"0x4f150787","name":""}}}],"nonce":"123","tokens":[{"type":"ERC20","standard":"ERC20","name":"Contract 13","contract":"0x0d0F936Ee4c93e25944694D6C121de94D9760F11","transfers":1,"symbol":"S13","decimals":18,"balance":"1000123013"},{"type":"ERC721","standard":"ERC721","name":"Contract 205","contract":"0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9","transfers":1,"symbol":"S205","decimals":18,"ids":["1"]},{"type":"ERC20","standard":"ERC20","name":"Contract 74","contract":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","transfers":1,"symbol":"S74","decimals":12,"balance":"1000123074"}],"addressAliases":{"0x7B62EB7fe80350DC7EC945C0B73242cb9877FB1b":{"Type":"ENS","Alias":"address7b.eth"},"0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9":{"Type":"Contract","Alias":"Contract 205"}}}`, + }, + }, + { + name: "apiTx EthTxidB1T2", + r: newGetRequest(ts.URL + "/api/v2/tx/0x" + dbtestdata.EthTxidB1T2), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"txid":"0xa9cd088aba2131000da6f38a33c20169baee476218deea6b78720700b895b101","vin":[{"n":0,"addresses":["0x20cD153de35D469BA46127A0C8F18626b59a256A"],"isAddress":true}],"vout":[{"value":"0","n":0,"addresses":["0x4af4114F73d1c1C903aC9E0361b379D1291808A2"],"isAddress":true}],"blockHeight":-1,"confirmations":0,"blockTime":0,"value":"0","fees":"2081000000000000","rbf":true,"coinSpecificData":{"tx":{"nonce":"0xd0","gasPrice":"0x9502f9000","maxPriorityFeePerGas":"0x9502f9001","maxFeePerGas":"0x9502f9002","baseFeePerGas":"0x9502f9003","gas":"0x130d5","to":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","value":"0x0","input":"0xa9059cbb000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f00000000000000000000000000000000000000000000021e19e0c9bab2400000","hash":"0xa9cd088aba2131000da6f38a33c20169baee476218deea6b78720700b895b101","blockNumber":"0x41eee8","from":"0x20cD153de35D469BA46127A0C8F18626b59a256A","transactionIndex":"0x0"},"internalData":{"type":0,"transfers":[{"type":1,"from":"9f4981531fda132e83c44680787dfa7ee31e4f8d","to":"4af4114f73d1c1c903ac9e0361b379d1291808a2","value":1000000},{"type":0,"from":"3e3a3d69dc66ba10737f531ed088954a9ec89d97","to":"9f4981531fda132e83c44680787dfa7ee31e4f8d","value":1000001},{"type":0,"from":"3e3a3d69dc66ba10737f531ed088954a9ec89d97","to":"3e3a3d69dc66ba10737f531ed088954a9ec89d97","value":1000002}],"Error":""},"receipt":{"gasUsed":"0xcb39","status":"0x1","logs":[{"address":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x00000000000000000000000020cd153de35d469ba46127a0c8f18626b59a256a","0x000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f"],"data":"0x00000000000000000000000000000000000000000000021e19e0c9bab2400000"}]}},"tokenTransfers":[{"type":"ERC20","standard":"ERC20","from":"0x20cD153de35D469BA46127A0C8F18626b59a256A","to":"0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f","contract":"0x4af4114F73d1c1C903aC9E0361b379D1291808A2","name":"Contract 74","symbol":"S74","decimals":12,"value":"10000000000000000000000"}],"ethereumSpecific":{"status":1,"nonce":208,"gasLimit":78037,"gasUsed":52025,"gasPrice":"40000000000","maxPriorityFeePerGas":"40000000001","maxFeePerGas":"40000000002","baseFeePerGas":"40000000003","data":"0xa9059cbb000000000000000000000000555ee11fbddc0e49a9bab358a8941ad95ffdb48f00000000000000000000000000000000000000000000021e19e0c9bab2400000","parsedData":{"methodId":"0xa9059cbb","name":"Transfer","function":"transfer(address, uint256)","params":[{"type":"address","values":["0x555Ee11FBDDc0E49A9bAB358A8941AD95fFDB48f"]},{"type":"uint256","values":["10000000000000000000000"]}]}},"addressAliases":{"0x20cD153de35D469BA46127A0C8F18626b59a256A":{"Type":"ENS","Alias":"address20.eth"},"0x4af4114F73d1c1C903aC9E0361b379D1291808A2":{"Type":"Contract","Alias":"Contract 74"}}}`, + }, + }, + { + name: "apiFiatRates get rate by timestamp", + r: newGetRequest(ts.URL + "/api/v2/tickers?currency=usd×tamp=1574340000"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"ts":1574380800,"rates":{"usd":7914.5}}`, + }, + }, + { + name: "apiFiatRates get token rate by timestamp", + r: newGetRequest(ts.URL + "/api/v2/tickers?currency=usd×tamp=1574340000&token=0xA4DD6Bc15Be95Af55f0447555c8b6aA3088562f3"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"ts":1574380800,"rates":{"usd":1.2}}`, + }, + }, + { + name: "apiFiatRates get token rate by timestamp for all currencies", + r: newGetRequest(ts.URL + "/api/v2/tickers?timestamp=1574340000&token=0xA4DD6Bc15Be95Af55f0447555c8b6aA3088562f3"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"ts":1574380800,"rates":{"eur":1.0816754,"usd":1.2}}`, + }, + }, + { + name: "apiFiatRates get token rate for unknown token by timestamp", + r: newGetRequest(ts.URL + "/api/v2/tickers?currency=usd×tamp=1574340000&token=0xFFFFFFFFFFe95Af55f0447555c8b6aA3088562f3"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"ts":1574340000,"rates":{"usd":-1}}`, + }, + }, + } + + performHttpTests(tests, t, ts) +} + +var websocketTestsEthereumType = []websocketTest{ + { + name: "websocket getInfo", + req: websocketReq{ + Method: "getInfo", + }, + want: `{"id":"0","data":{"name":"Fakecoin","shortcut":"FAKE","network":"FAKE","decimals":18,"version":"unknown","bestHeight":4321001,"bestHash":"0x2b57e15e93a0ed197417a34c2498b7187df79099572c04a6b6e6ff418f74e6ee","block0Hash":"","testnet":true,"backend":{"version":"001001","subversion":"/Fakecoin:0.0.1/"}}}`, + }, + { + name: "websocket rpcCall", + req: websocketReq{ + Method: "rpcCall", + Params: WsRpcCallReq{ + To: "0xcdA9FC258358EcaA88845f19Af595e908bb7EfE9", + Data: "0x4567", + }, + }, + want: `{"id":"1","data":{"data":"0x4567abcd"}}`, + }, + { + name: "websocket sendTransaction hex format", + req: websocketReq{ + Method: "sendTransaction", + Params: WsSendTransactionReq{ + Hex: "123456", + DisableAlternativeRPC: true, + }, + }, + want: `{"id":"2","data":{"result":"9876"}}`, + }, +} + +func initEthereumTypeDB(d *db.RocksDB) error { + // add 0xa9059cbb transfer(address,uint256) signature + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + if err := d.StoreFourByteSignature(wb, 2835717307, 145, &bchain.FourByteSignature{ + Name: "transfer", + Parameters: []string{"address", "uint256"}, + }); err != nil { + return err + } + return d.WriteBatch(wb) +} + +// initTestFiatRatesEthereumType initializes test data for /api/v2/tickers endpoint +func initTestFiatRatesEthereumType(d *db.RocksDB) error { + if err := insertFiatRate("20180320000000", map[string]float32{ + "usd": 2000.0, + "eur": 1300.0, + }, map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 2000.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 123.0, + }, d); err != nil { + return err + } + if err := insertFiatRate("20180321000000", map[string]float32{ + "usd": 2001.0, + "eur": 1301.0, + }, map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 2001.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 199.0, + }, d); err != nil { + return err + } + if err := insertFiatRate("20180322000000", map[string]float32{ + "usd": 2002.0, + "eur": 1302.0, + }, map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 2002.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 99.0, + }, d); err != nil { + return err + } + if err := insertFiatRate("20180323000000", map[string]float32{ + "usd": 2003.0, + "eur": 1303.0, + }, map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 2003.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 101.0, + }, d); err != nil { + return err + } + if err := insertFiatRate("20190321000000", map[string]float32{ + "usd": 7814.5, + "eur": 7100.0, + }, map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 7814.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 499.0, + "0xa4dd6bc15be95af55f0447555c8b6aa3088562f3": 0.8, + }, d); err != nil { + return err + } + if err := insertFiatRate("20191122000000", map[string]float32{ + "usd": 7914.5, + "eur": 7134.1, + }, map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 7914.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 599.0, + "0xa4dd6bc15be95af55f0447555c8b6aa3088562f3": 1.2, + }, d); err != nil { + return err + } + + return d.FiatRatesStoreSpecialTickers("CurrentTickers", &[]common.CurrencyRatesTicker{ + { + Timestamp: time.Unix(1592821931, 0), + Rates: map[string]float32{ + "usd": 8914.5, + "eur": 8134.1, + }, + TokenRates: map[string]float32{ + "0xdac17f958d2ee523a2206206994597c13d831ec7": 8914.1, + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": 899.0, + "0xa4dd6bc15be95af55f0447555c8b6aa3088562f3": 8.2, + }, + }, + }) +} + +func Test_PublicServer_EthereumType(t *testing.T) { + timeNow = fixedTimeNow + parser := eth.NewEthereumParser(1, true) + chain, err := dbtestdata.NewFakeBlockChainEthereumType(parser) + if err != nil { + glog.Fatal("fakechain: ", err) + } + + s, dbpath := setupPublicHTTPServer(parser, chain, t, false) + defer closeAndDestroyPublicServer(t, s, dbpath) + s.ConnectFullPublicInterface() + // take the handler of the public server and pass it to the test server + ts := httptest.NewServer(s.https.Handler) + defer ts.Close() + + httpTestsEthereumType(t, ts) + runWebsocketTests(t, ts, websocketTestsEthereumType) +} diff --git a/server/public_test.go b/server/public_test.go index 3de7c4ff5c..bea3e69024 100644 --- a/server/public_test.go +++ b/server/public_test.go @@ -4,7 +4,7 @@ package server import ( "encoding/json" - "io/ioutil" + "io" "net/http" "net/http/httptest" "net/url" @@ -16,6 +16,7 @@ import ( "github.com/golang/glog" "github.com/gorilla/websocket" + "github.com/linxGnu/grocksdb" "github.com/martinboehm/btcutil/chaincfg" gosocketio "github.com/martinboehm/golang-socketio" "github.com/martinboehm/golang-socketio/transport" @@ -23,6 +24,7 @@ import ( "github.com/trezor/blockbook/bchain/coins/btc" "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/fiat" "github.com/trezor/blockbook/tests/dbtestdata" ) @@ -36,21 +38,29 @@ func TestMain(m *testing.M) { os.Exit(c) } -func setupRocksDB(t *testing.T, parser bchain.BlockChainParser) (*db.RocksDB, *common.InternalState, string) { - tmp, err := ioutil.TempDir("", "testdb") +func setupRocksDB(parser bchain.BlockChainParser, chain bchain.BlockChain, t *testing.T, extendedIndex bool, config *common.Config) (*db.RocksDB, *common.InternalState, string) { + tmp, err := os.MkdirTemp("", "testdb") if err != nil { t.Fatal(err) } - d, err := db.NewRocksDB(tmp, 100000, -1, parser, nil) + d, err := db.NewRocksDB(tmp, 100000, -1, parser, nil, extendedIndex) if err != nil { t.Fatal(err) } - is, err := d.LoadInternalState("fakecoin") + is, err := d.LoadInternalState(config) if err != nil { t.Fatal(err) } d.SetInternalState(is) - block1 := dbtestdata.GetTestBitcoinTypeBlock1(parser) + // there are 2 simulated block, of height bestBlockHeight-1 and bestBlockHeight + bestHeight, err := chain.GetBestBlockHeight() + if err != nil { + t.Fatal(err) + } + block1, err := chain.GetBlock("", bestHeight-1) + if err != nil { + t.Fatal(err) + } // setup internal state BlockTimes for i := uint32(0); i < block1.Height; i++ { is.BlockTimes = append(is.BlockTimes, 0) @@ -59,42 +69,55 @@ func setupRocksDB(t *testing.T, parser bchain.BlockChainParser) (*db.RocksDB, *c if err := d.ConnectBlock(block1); err != nil { t.Fatal(err) } - block2 := dbtestdata.GetTestBitcoinTypeBlock2(parser) - if err := d.ConnectBlock(block2); err != nil { + block2, err := chain.GetBlock("", bestHeight) + if err != nil { t.Fatal(err) } - if err := InitTestFiatRates(d); err != nil { + if err := d.ConnectBlock(block2); err != nil { t.Fatal(err) } is.FinishedSync(block2.Height) + if parser.GetChainType() == bchain.ChainEthereumType { + if err := initTestFiatRatesEthereumType(d); err != nil { + t.Fatal(err) + } + if err := initEthereumTypeDB(d); err != nil { + t.Fatal(err) + } + } else { + if err := initTestFiatRates(d); err != nil { + t.Fatal(err) + } + } return d, is, tmp } -func setupPublicHTTPServer(t *testing.T) (*PublicServer, string) { - parser := btc.NewBitcoinParser( - btc.GetChainParams("test"), - &btc.Configuration{ - BlockAddressesToKeep: 1, - XPubMagic: 70617039, - XPubMagicSegwitP2sh: 71979618, - XPubMagicSegwitNative: 73342198, - Slip44: 1, - }) +var metrics *common.Metrics - d, is, path := setupRocksDB(t, parser) - // setup internal state and match BestHeight to test data - is.Coin = "Fakecoin" - is.CoinLabel = "Fake Coin" - is.CoinShortcut = "FAKE" +func setupPublicHTTPServer(parser bchain.BlockChainParser, chain bchain.BlockChain, t *testing.T, extendedIndex bool) (*PublicServer, string) { + // config with mocked CoinGecko API + config := common.Config{ + CoinName: "Fakecoin", + CoinLabel: "Fake Coin", + CoinShortcut: "FAKE", + FiatRates: "coingecko", + FiatRatesParams: `{"url": "none", "coin": "ethereum","platformIdentifier": "ethereum","platformVsCurrency": "usd","periodSeconds": 60}`, + } - metrics, err := common.GetMetrics("Fakecoin") - if err != nil { - glog.Fatal("metrics: ", err) + // add block golomb filters with extended index + if extendedIndex { + config.BlockGolombFilterP = 20 } - chain, err := dbtestdata.NewFakeBlockChain(parser) - if err != nil { - glog.Fatal("fakechain: ", err) + d, is, path := setupRocksDB(parser, chain, t, extendedIndex, &config) + + var err error + // metrics can be setup only once + if metrics == nil { + metrics, err = common.GetMetrics("Fakecoin" + strconv.FormatBool(extendedIndex)) + if err != nil { + glog.Fatal("metrics: ", err) + } } mempool, err := chain.CreateMempool(chain) @@ -108,8 +131,13 @@ func setupPublicHTTPServer(t *testing.T) (*PublicServer, string) { glog.Fatal("txCache: ", err) } + fiatRates, err := fiat.NewFiatRates(d, &config, nil, nil) + if err != nil { + glog.Fatal("fiatRates ", err) + } + // s.Run is never called, binding can be to any port - s, err := NewPublicServer("localhost:12345", "", d, chain, mempool, txCache, "", metrics, is, false, false) + s, err := NewPublicServer("localhost:12345", "", d, chain, mempool, txCache, "", metrics, is, fiatRates, false) if err != nil { t.Fatal(err) } @@ -154,78 +182,108 @@ func newPostRequest(u string, body string) *http.Request { return r } -func insertFiatRate(date string, rates map[string]float64, d *db.RocksDB) error { - convertedDate, err := db.FiatRatesConvertDate(date) +func insertFiatRate(date string, rates map[string]float32, tokenRates map[string]float32, d *db.RocksDB) error { + convertedDate, err := time.Parse("20060102150405", date) if err != nil { return err } - ticker := &db.CurrencyRatesTicker{ - Timestamp: convertedDate, - Rates: rates, + ticker := &common.CurrencyRatesTicker{ + Timestamp: convertedDate, + Rates: rates, + TokenRates: tokenRates, + } + wb := grocksdb.NewWriteBatch() + defer wb.Destroy() + if err := d.FiatRatesStoreTicker(wb, ticker); err != nil { + return err } - return d.FiatRatesStoreTicker(ticker) + return d.WriteBatch(wb) } -// InitTestFiatRates initializes test data for /api/v2/tickers endpoint -func InitTestFiatRates(d *db.RocksDB) error { - if err := insertFiatRate("20180320020000", map[string]float64{ +// initTestFiatRates initializes test data for /api/v2/tickers endpoint +func initTestFiatRates(d *db.RocksDB) error { + if err := insertFiatRate("20180320000000", map[string]float32{ "usd": 2000.0, "eur": 1300.0, - }, d); err != nil { + }, nil, d); err != nil { return err } - if err := insertFiatRate("20180320030000", map[string]float64{ + if err := insertFiatRate("20180321000000", map[string]float32{ "usd": 2001.0, "eur": 1301.0, - }, d); err != nil { + }, nil, d); err != nil { return err } - if err := insertFiatRate("20180320040000", map[string]float64{ + if err := insertFiatRate("20180322000000", map[string]float32{ "usd": 2002.0, "eur": 1302.0, - }, d); err != nil { + }, nil, d); err != nil { return err } - if err := insertFiatRate("20180321055521", map[string]float64{ + if err := insertFiatRate("20180324000000", map[string]float32{ "usd": 2003.0, "eur": 1303.0, - }, d); err != nil { + }, nil, d); err != nil { return err } - if err := insertFiatRate("20191121140000", map[string]float64{ + if err := insertFiatRate("20191121000000", map[string]float32{ "usd": 7814.5, "eur": 7100.0, - }, d); err != nil { + }, nil, d); err != nil { return err } - return insertFiatRate("20191121143015", map[string]float64{ + return insertFiatRate("20191122000000", map[string]float32{ "usd": 7914.5, "eur": 7134.1, - }, d) + }, nil, d) +} + +type httpTests struct { + name string + r *http.Request + status int + contentType string + body []string +} + +func performHttpTests(tests []httpTests, t *testing.T, ts *httptest.Server) { + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resp, err := http.DefaultClient.Do(tt.r) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != tt.status { + t.Errorf("StatusCode = %v, want %v", resp.StatusCode, tt.status) + } + if resp.Header["Content-Type"][0] != tt.contentType { + t.Errorf("Content-Type = %v, want %v", resp.Header["Content-Type"][0], tt.contentType) + } + bb, err := io.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + b := string(bb) + for _, c := range tt.body { + if !strings.Contains(b, c) { + t.Errorf("got\n%v\nwant to contain %v", b, c) + break + } + } + }) + } } func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { - tests := []struct { - name string - r *http.Request - status int - contentType string - body []string - }{ + tests := []httpTests{ { name: "explorerTx", r: newGetRequest(ts.URL + "/tx/fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db"), status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Transaction

`, - `fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db`, - `td class="data">0 FAKE`, - `mzVznVsCHkVHX9UN8WPFASWUUHtxnNn4Jj`, - `13.60030331 FAKE`, - `No Inputs (Newly Generated Coins)`, - ``, + `Trezor Fake Coin Explorer

Transaction

fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db
Mined Time1639 days 11 hours ago
In Block00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6
In Block Height225494
Total Input0 FAKE
Total Output13.60030331 FAKE
Fees0 FAKE
No Inputs (Newly Generated Coins)
 
Unparsed address0 FAKE×
`, }, }, { @@ -234,18 +292,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Address`, - `0.00012345 FAKE`, - `mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz`, - `0.00012345 FAKE`, - `7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25`, - `3172.83951061 FAKE `, - `mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `td>mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `9172.83951061 FAKE ×`, - `00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840`, - ``, + `Trezor Fake Coin Explorer

Address

mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz

0.00012345 FAKE

Confirmed
Total Received0.00024690 FAKE
Total Sent0.00012345 FAKE
Final Balance0.00012345 FAKE
No. Transactions2

Transactions

mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz0.00012345 FAKE
 
OP_RETURN 2020f1686f6a200 FAKE×
No Inputs
 
mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz0.00012345 FAKE
mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz0.00012345 FAKE×
`, }, }, { @@ -254,11 +301,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Transaction

`, - `3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71`, - `0.00000062 FAKE`, - ``, + `Trezor Fake Coin Explorer

Transaction

3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71
Mined Time1639 days 11 hours ago
In Block00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6
In Block Height225494
Total Input3172.83951062 FAKE
Total Output3172.83951000 FAKE
Fees0.00000062 FAKE
`, }, }, { @@ -267,10 +310,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Error

`, - `

Transaction not found

`, - ``, + `Trezor Fake Coin Explorer

Error

Transaction not found

`, }, }, { @@ -279,14 +319,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Blocks`, - `225494`, - `00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6`, - `0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997`, - `2`, - `1234567`, - ``, + `Trezor Fake Coin Explorer

Blocks

HeightHashTimestampTransactionsSize
22549400000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b61639 days 11 hours ago42345678
2254930000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e29971640 days 9 hours ago21234567
`, }, }, { @@ -295,14 +328,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Block 225494

`, - `00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6`, - `4`, // number of transactions - `mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `9172.83951061 FAKE`, - `fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db`, - ``, + `Trezor Fake Coin Explorer

Block

225494
00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6
Transactions4
Height225494
Confirmations1
Timestamp1639 days 11 hours ago
Size (bytes)2345678
Version
Merkle Root
Nonce
Bits
Difficulty

Transactions

 
OP_RETURN 2020f1686f6a200 FAKE×
No Inputs (Newly Generated Coins)
 
Unparsed address0 FAKE×
`, }, }, { @@ -311,12 +337,9 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Application status

`, - `

Synchronization with backend is disabled, the state of index is not up to date.

`, - `225494`, - `/Fakecoin:0.0.1/`, - ``, + `Trezor Fake Coin Explorer

Application status

Synchronization with backend is disabled, the state of index is not up to date.

`, + `

Blockbook

CoinFakecoin
Host
Version / Commit / Buildunknown / unknown / unknown
Synchronized
true
Last Block225494
Last Block Update`, + `
Mempool in Sync
false
Last Mempool Update
Transactions in Mempool0
Current Fiat rates

Backend

Chainfakecoin
Version001001
Subversion/Fakecoin:0.0.1/
Last Block2
Difficulty
Blockbook - blockchain indexer for Trezor Suite https://trezor.io/trezor-suite. Do not use for any other purpose.
`, }, }, { @@ -325,14 +348,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Block 225494

`, - `00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6`, - `4`, // number of transactions - `mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `9172.83951061 FAKE`, - `fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db`, - ``, + `Trezor Fake Coin Explorer

Block

225494
00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6
Transactions4
Height225494
Confirmations1
Timestamp1639 days 11 hours ago
Size (bytes)2345678
Version
Merkle Root
Nonce
Bits
Difficulty

Transactions

 
OP_RETURN 2020f1686f6a200 FAKE×
No Inputs (Newly Generated Coins)
 
Unparsed address0 FAKE×
`, }, }, { @@ -341,14 +357,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Block 225494

`, - `00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6`, - `4`, // number of transactions - `mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `9172.83951061 FAKE`, - `fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db`, - ``, + `Trezor Fake Coin Explorer

Block

225494
00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6
Transactions4
Height225494
Confirmations1
Timestamp1639 days 11 hours ago
Size (bytes)2345678
Version
Merkle Root
Nonce
Bits
Difficulty

Transactions

 
OP_RETURN 2020f1686f6a200 FAKE×
No Inputs (Newly Generated Coins)
 
Unparsed address0 FAKE×
`, }, }, { @@ -357,14 +366,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Transaction

`, - `fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db`, - `td class="data">0 FAKE`, - `mzVznVsCHkVHX9UN8WPFASWUUHtxnNn4Jj`, - `13.60030331 FAKE`, - `No Inputs (Newly Generated Coins)`, - ``, + `Trezor Fake Coin Explorer

Transaction

fdd824a780cbb718eeb766eb05d83fdefc793a27082cd5e67f856d69798cf7db
Mined Time1639 days 11 hours ago
In Block00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6
In Block Height225494
Total Input0 FAKE
Total Output13.60030331 FAKE
Fees0 FAKE
No Inputs (Newly Generated Coins)
 
Unparsed address0 FAKE×
`, }, }, { @@ -373,18 +375,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Address`, - `0.00012345 FAKE`, - `mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz`, - `0.00012345 FAKE`, - `7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25`, - `3172.83951061 FAKE `, - `mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `td>mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL`, - `9172.83951061 FAKE ×`, - `00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840`, - ``, + `Trezor Fake Coin Explorer

Address

mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz

0.00012345 FAKE

Confirmed
Total Received0.00024690 FAKE
Total Sent0.00012345 FAKE
Final Balance0.00012345 FAKE
No. Transactions2

Transactions

mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz0.00012345 FAKE
 
OP_RETURN 2020f1686f6a200 FAKE×
No Inputs
 
mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz0.00012345 FAKE
mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz0.00012345 FAKE×
`, }, }, { @@ -393,16 +384,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

XPUB 1186.419755 FAKE

upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q
`, - `Total Received1186.41975501 FAKE`, - `Total Sent0.00000001 FAKE`, - `Used XPUB Addresses2`, - `2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu1186.419755 FAKE1m/49'/1'/33'/1/3`, - ``, - ``, - `2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu10.00009876 FAKE `, - ``, + `Trezor Fake Coin Explorer

XPUB

upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q

1186.419755 FAKE

Confirmed
Total Received1186.41975501 FAKE
Total Sent0.00000001 FAKE
Final Balance1186.41975500 FAKE
No. Transactions2
Used XPUB Addresses2
XPUB Addresses with Balance
AddressBalanceTxsPath
2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu1186.41975500 FAKE1m/49'/1'/33'/1/3

Transactions

`, }, }, { @@ -411,12 +393,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

XPUB 0 FAKE

tr([5c9e228d/86'/1'/0']tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/{0,1}/*)#4rqwxvej

Confirmed

`, - `Total Received0 FAKE`, - `Total Sent0 FAKE`, - `Used XPUB Addresses0`, - ``, + `Trezor Fake Coin Explorer

XPUB

tr([5c9e228d/86'/1'/0']tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/{0,1}/*)#4rqwxvej

0 FAKE

Confirmed
Total Received0 FAKE
Total Sent0 FAKE
Final Balance0 FAKE
No. Transactions0
Used XPUB Addresses0
XPUB Addresses with Balance
No addresses
`, }, }, { @@ -425,10 +402,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Error

`, - `

No matching records found for '1234'

`, - ``, + `Trezor Fake Coin Explorer

Error

No matching records found for '1234'

`, }, }, { @@ -437,10 +411,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Send Raw Transaction

`, - ``, - ``, + `Trezor Fake Coin Explorer

Send Raw Transaction

`, }, }, { @@ -449,11 +420,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "text/html; charset=utf-8", body: []string{ - `Fake Coin Explorer`, - `

Send Raw Transaction

`, - ``, - `
Invalid data
`, - ``, + `Trezor Fake Coin Explorer

Send Raw Transaction

Invalid data
`, }, }, { @@ -533,12 +500,12 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { }, }, { - name: "apiFiatRates missing currency", + name: "apiFiatRates all currencies", r: newGetRequest(ts.URL + "/api/v2/tickers"), status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1574346615,"rates":{"eur":7134.1,"usd":7914.5}}`, + `{"ts":1574380800,"rates":{"eur":7134.1,"usd":7914.5}}`, }, }, { @@ -547,16 +514,16 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1574346615,"rates":{"usd":7914.5}}`, + `{"ts":1574380800,"rates":{"usd":7914.5}}`, }, }, { name: "apiFiatRates get rate by exact timestamp", - r: newGetRequest(ts.URL + "/api/v2/tickers?currency=usd×tamp=1574344800"), + r: newGetRequest(ts.URL + "/api/v2/tickers?currency=usd×tamp=1521545531"), status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1574344800,"rates":{"usd":7814.5}}`, + `{"ts":1521590400,"rates":{"usd":2001}}`, }, }, { @@ -592,25 +559,25 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1574344800,"rates":{"eur":7100}}`, + `{"ts":1574380800,"rates":{"eur":7134.1}`, }, }, { name: "apiMultiFiatRates all currencies", - r: newGetRequest(ts.URL + "/api/v2/multi-tickers?timestamp=1574344800,1574346615"), + r: newGetRequest(ts.URL + "/api/v2/multi-tickers?timestamp=1574344800,1521677000"), status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"ts":1574344800,"rates":{"eur":7100,"usd":7814.5}},{"ts":1574346615,"rates":{"eur":7134.1,"usd":7914.5}}]`, + `[{"ts":1574380800,"rates":{"eur":7134.1,"usd":7914.5}},{"ts":1521849600,"rates":{"eur":1303,"usd":2003}}]`, }, }, { name: "apiMultiFiatRates get EUR rate", - r: newGetRequest(ts.URL + "/api/v2/multi-tickers?timestamp=1574344800,1574346615¤cy=eur"), + r: newGetRequest(ts.URL + "/api/v2/multi-tickers?timestamp=1521545531,1574346615¤cy=eur"), status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"ts":1574344800,"rates":{"eur":7100}},{"ts":1574346615,"rates":{"eur":7134.1}}]`, + `[{"ts":1521590400,"rates":{"eur":1301}},{"ts":1574380800,"rates":{"eur":7134.1}}]`, }, }, { @@ -619,7 +586,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1521511200,"rates":{"usd":2000}}`, + `{"ts":1521504000,"rates":{"usd":2000}}`, }, }, { @@ -628,7 +595,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1521611721,"rates":{"usd":2003}}`, + `{"ts":1521676800,"rates":{"usd":2002}}`, }, }, { @@ -637,7 +604,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1574346615,"rates":{"eur":7134.1}}`, + `{"ts":1574380800,"rates":{"eur":7134.1}}`, }, }, { @@ -655,7 +622,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"ts":1574346615,"available_currencies":["eur","usd"]}`, + `{"ts":1574380800,"available_currencies":["eur","usd"]}`, }, }, { @@ -709,7 +676,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"],"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"}]}`, + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"addrTxCount":3,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"],"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"}]}`, }, }, { @@ -718,7 +685,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"],"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"}]}`, + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"addrTxCount":3,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"],"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"}]}`, }, }, { @@ -727,7 +694,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"],"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N7NdeuAMgL57WE7QCeV2gTWi2Um8iAu5dA","path":"m/49'/1'/33'/0/11","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8JQEP6DSHEZHNsSDPA1gHMUq9YFndhkfV","path":"m/49'/1'/33'/0/12","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mvbn3YXqKZVpQKugaoQrfjSYPvz76RwZkC","path":"m/49'/1'/33'/0/13","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8MRNxCfwUY9TSW27X9ooGYtqgrGCfLRHx","path":"m/49'/1'/33'/0/14","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N6HvwrHC113KYZAmCtJ9XJNWgaTcnFunCM","path":"m/49'/1'/33'/0/15","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NEo3oNyHUoi7rmRWee7wki37jxPWsWCopJ","path":"m/49'/1'/33'/0/16","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mzm5KY8qdFbDHsQfy4akXbFvbR3FAwDuVo","path":"m/49'/1'/33'/0/17","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NGMwftmQCogp6XZNGvgiybz3WZysvsJzqC","path":"m/49'/1'/33'/0/18","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N3fJrrefndYjLGycvFFfYgevpZtcRKCkRD","path":"m/49'/1'/33'/0/19","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N1T7TnHBwfdpBoyw53EGUL7vuJmb2mU6jF","path":"m/49'/1'/33'/0/20","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5kBNMB8qgxE4Y4f8J19fScsE49J4aNvoJ","path":"m/49'/1'/33'/1/14","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NANWCaefhCKdXMcW8NbZnnrFRDvhJN2wPy","path":"m/49'/1'/33'/1/15","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NFHw7Yo2Bz8D2wGAYHW9qidbZFLpfJ72qB","path":"m/49'/1'/33'/1/16","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NBDSsBgy5PpFniLCb1eAFHcSxgxwPSDsZa","path":"m/49'/1'/33'/1/17","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NDWCSQHogc7sCuc2WoYt9PX2i2i6a5k6dX","path":"m/49'/1'/33'/1/18","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8vNyDP7iSDjm3BKpXrbDjAxyphqfvnJz8","path":"m/49'/1'/33'/1/19","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4tFKLurSbMusAyq1tv4tzymVjveAFV1Vb","path":"m/49'/1'/33'/1/20","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NBx5WwjAr2cH6Yqrp3Vsf957HtRKwDUVdX","path":"m/49'/1'/33'/1/21","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NBu1seHTaFhQxbcW5L5BkZzqFLGmZqpxsa","path":"m/49'/1'/33'/1/22","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NCDLoea22jGsXuarfT1n2QyCUh6RFhAPnT","path":"m/49'/1'/33'/1/23","transfers":0,"decimals":8}]}`, + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"addrTxCount":3,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"],"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7NdeuAMgL57WE7QCeV2gTWi2Um8iAu5dA","path":"m/49'/1'/33'/0/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8JQEP6DSHEZHNsSDPA1gHMUq9YFndhkfV","path":"m/49'/1'/33'/0/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mvbn3YXqKZVpQKugaoQrfjSYPvz76RwZkC","path":"m/49'/1'/33'/0/13","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8MRNxCfwUY9TSW27X9ooGYtqgrGCfLRHx","path":"m/49'/1'/33'/0/14","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6HvwrHC113KYZAmCtJ9XJNWgaTcnFunCM","path":"m/49'/1'/33'/0/15","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEo3oNyHUoi7rmRWee7wki37jxPWsWCopJ","path":"m/49'/1'/33'/0/16","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mzm5KY8qdFbDHsQfy4akXbFvbR3FAwDuVo","path":"m/49'/1'/33'/0/17","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NGMwftmQCogp6XZNGvgiybz3WZysvsJzqC","path":"m/49'/1'/33'/0/18","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3fJrrefndYjLGycvFFfYgevpZtcRKCkRD","path":"m/49'/1'/33'/0/19","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1T7TnHBwfdpBoyw53EGUL7vuJmb2mU6jF","path":"m/49'/1'/33'/0/20","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5kBNMB8qgxE4Y4f8J19fScsE49J4aNvoJ","path":"m/49'/1'/33'/1/14","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NANWCaefhCKdXMcW8NbZnnrFRDvhJN2wPy","path":"m/49'/1'/33'/1/15","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFHw7Yo2Bz8D2wGAYHW9qidbZFLpfJ72qB","path":"m/49'/1'/33'/1/16","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBDSsBgy5PpFniLCb1eAFHcSxgxwPSDsZa","path":"m/49'/1'/33'/1/17","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NDWCSQHogc7sCuc2WoYt9PX2i2i6a5k6dX","path":"m/49'/1'/33'/1/18","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8vNyDP7iSDjm3BKpXrbDjAxyphqfvnJz8","path":"m/49'/1'/33'/1/19","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4tFKLurSbMusAyq1tv4tzymVjveAFV1Vb","path":"m/49'/1'/33'/1/20","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBx5WwjAr2cH6Yqrp3Vsf957HtRKwDUVdX","path":"m/49'/1'/33'/1/21","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBu1seHTaFhQxbcW5L5BkZzqFLGmZqpxsa","path":"m/49'/1'/33'/1/22","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NCDLoea22jGsXuarfT1n2QyCUh6RFhAPnT","path":"m/49'/1'/33'/1/23","transfers":0,"decimals":8}]}`, }, }, { @@ -736,7 +703,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"tr([5c9e228d/86'/1'/0']tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/{0,1}/*)#4rqwxvej","balance":"0","totalReceived":"0","totalSent":"0","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":0,"tokens":[{"type":"XPUBAddress","name":"tb1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq8s8a5u","path":"m/86'/1'/0'/0/0","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"tb1p8tvmvsvhsee73rhym86wt435qrqm92psfsyhy6a3n5gw455znnpqm8wald","path":"m/86'/1'/0'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"tb1p537ddhyuydg5c2v75xxmn6ac64yz4xns2x0gpdcwj5vzzzgrywlqlqwk43","path":"m/86'/1'/0'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"tb1pn2d0yjeedavnkd8z8lhm566p0f2utm3lgvxrsdehnl94y34txmts5s7t4c","path":"m/86'/1'/0'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"tb1p0pnd6ue5vryymvd28aeq3kdz6rmsdjqrq6eespgtg8wdgnxjzjksujhq4u","path":"m/86'/1'/0'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"tb1p29gpmd96hhgf7wj2vs03ca7x2xx39g8t6e0p55h2d5ssqs4fsj8qtx00wc","path":"m/86'/1'/0'/1/2","transfers":0,"decimals":8}]}`, + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"tr([5c9e228d/86'/1'/0']tpubDC88gkaZi5HvJGxGDNLADkvtdpni3mLmx6vr2KnXmWMG8zfkBRggsxHVBkUpgcwPe2KKpkyvTJCdXHb1UHEWE64vczyyPQfHr1skBcsRedN/{0,1}/*)#4rqwxvej","balance":"0","totalReceived":"0","totalSent":"0","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":0,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"tb1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq8s8a5u","path":"m/86'/1'/0'/0/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"tb1p8tvmvsvhsee73rhym86wt435qrqm92psfsyhy6a3n5gw455znnpqm8wald","path":"m/86'/1'/0'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"tb1p537ddhyuydg5c2v75xxmn6ac64yz4xns2x0gpdcwj5vzzzgrywlqlqwk43","path":"m/86'/1'/0'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"tb1pn2d0yjeedavnkd8z8lhm566p0f2utm3lgvxrsdehnl94y34txmts5s7t4c","path":"m/86'/1'/0'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"tb1p0pnd6ue5vryymvd28aeq3kdz6rmsdjqrq6eespgtg8wdgnxjzjksujhq4u","path":"m/86'/1'/0'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"tb1p29gpmd96hhgf7wj2vs03ca7x2xx39g8t6e0p55h2d5ssqs4fsj8qtx00wc","path":"m/86'/1'/0'/1/2","transfers":0,"decimals":8}]}`, }, }, { @@ -745,7 +712,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"usedTokens":2}`, + `{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"addrTxCount":3,"usedTokens":2}`, }, }, { @@ -754,7 +721,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8},{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8}]}`, + `{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"addrTxCount":3,"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8}]}`, }, }, { @@ -763,7 +730,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"}]}`, + `{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"addrTxCount":3,"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"}]}`, }, }, { @@ -772,7 +739,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `{"page":1,"totalPages":1,"itemsOnPage":3,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"transactions":[{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true,"isOwn":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"}],"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8}]}`, + `{"page":1,"totalPages":1,"itemsOnPage":3,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"addrTxCount":3,"transactions":[{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true,"isOwn":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"}],"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8}]}`, }, }, { @@ -826,7 +793,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"time":1521514800,"txs":1,"received":"24690","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"0","sent":"12345","sentToSelf":"0","rates":{"eur":1303,"usd":2003}}]`, + `[{"time":1521514800,"txs":1,"received":"24690","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"0","sent":"12345","sentToSelf":"0","rates":{"eur":1302,"usd":2002}}]`, }, }, { @@ -835,7 +802,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"time":1521514800,"txs":1,"received":"9876","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"9000","sent":"9876","sentToSelf":"9000","rates":{"eur":1303,"usd":2003}}]`, + `[{"time":1521514800,"txs":1,"received":"9876","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"9000","sent":"9876","sentToSelf":"9000","rates":{"eur":1302,"usd":2002}}]`, }, }, { @@ -844,7 +811,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"time":1521514800,"txs":1,"received":"9876","sent":"0","sentToSelf":"0","rates":{"eur":1301}},{"time":1521594000,"txs":1,"received":"9000","sent":"9876","sentToSelf":"9000","rates":{"eur":1303}}]`, + `[{"time":1521514800,"txs":1,"received":"9876","sent":"0","sentToSelf":"0","rates":{"eur":1301}},{"time":1521594000,"txs":1,"received":"9000","sent":"9876","sentToSelf":"9000","rates":{"eur":1302}}]`, }, }, { @@ -862,7 +829,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"118641975500","sent":"1","sentToSelf":"118641975500","rates":{"eur":1303,"usd":2003}}]`, + `[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"118641975500","sent":"1","sentToSelf":"118641975500","rates":{"eur":1302,"usd":2002}}]`, }, }, { @@ -889,7 +856,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { status: http.StatusOK, contentType: "application/json; charset=utf-8", body: []string{ - `[{"time":1521594000,"txs":1,"received":"118641975500","sent":"1","sentToSelf":"118641975500","rates":{"eur":1303,"usd":2003}}]`, + `[{"time":1521594000,"txs":1,"received":"118641975500","sent":"1","sentToSelf":"118641975500","rates":{"eur":1302,"usd":2002}}]`, }, }, { @@ -947,33 +914,7 @@ func httpTestsBitcoinType(t *testing.T, ts *httptest.Server) { }, }, } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - resp, err := http.DefaultClient.Do(tt.r) - if err != nil { - t.Fatal(err) - } - defer resp.Body.Close() - if resp.StatusCode != tt.status { - t.Errorf("StatusCode = %v, want %v", resp.StatusCode, tt.status) - } - if resp.Header["Content-Type"][0] != tt.contentType { - t.Errorf("Content-Type = %v, want %v", resp.Header["Content-Type"][0], tt.contentType) - } - bb, err := ioutil.ReadAll(resp.Body) - if err != nil { - t.Fatal(err) - } - b := string(bb) - for _, c := range tt.body { - if !strings.Contains(b, c) { - t.Errorf("got %v, want to contain %v", b, c) - break - } - } - }) - } + performHttpTests(tests, t, ts) } func socketioTestsBitcoinType(t *testing.T, ts *httptest.Server) { @@ -997,7 +938,7 @@ func socketioTestsBitcoinType(t *testing.T, ts *httptest.Server) { { name: "socketio getInfo", req: socketioReq{"getInfo", []interface{}{}}, - want: `{"result":{"blocks":225494,"testnet":true,"network":"fakecoin","subversion":"/Fakecoin:0.0.1/","coin_name":"Fakecoin","about":"Blockbook - blockchain indexer for Trezor wallet https://trezor.io/. Do not use for any other purpose."}}`, + want: `{"result":{"blocks":225494,"testnet":true,"network":"fakecoin","subversion":"/Fakecoin:0.0.1/","coin_name":"Fakecoin","about":"Blockbook - blockchain indexer for Trezor Suite https://trezor.io/trezor-suite. Do not use for any other purpose."}}`, }, { name: "socketio estimateFee", @@ -1077,438 +1018,492 @@ func socketioTestsBitcoinType(t *testing.T, ts *httptest.Server) { } } -func websocketTestsBitcoinType(t *testing.T, ts *httptest.Server) { - type websocketReq struct { - ID string `json:"id"` - Method string `json:"method"` - Params interface{} `json:"params,omitempty"` - } - type websocketResp struct { - ID string `json:"id"` - } - url := strings.Replace(ts.URL, "http://", "ws://", 1) + "/websocket" - s, _, err := websocket.DefaultDialer.Dial(url, nil) - if err != nil { - t.Fatal(err) - } - defer s.Close() +type websocketReq struct { + ID string `json:"id"` + Method string `json:"method"` + Params interface{} `json:"params,omitempty"` +} +type websocketResp struct { + ID string `json:"id"` +} - tests := []struct { - name string - req websocketReq - want string - }{ - { - name: "websocket getInfo", - req: websocketReq{ - Method: "getInfo", - }, - want: `{"id":"0","data":{"name":"Fakecoin","shortcut":"FAKE","decimals":8,"version":"unknown","bestHeight":225494,"bestHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","block0Hash":"","testnet":true,"backend":{"version":"001001","subversion":"/Fakecoin:0.0.1/"}}}`, - }, - { - name: "websocket getBlockHash", - req: websocketReq{ - Method: "getBlockHash", - Params: map[string]interface{}{ - "height": 225494, - }, - }, - want: `{"id":"1","data":{"hash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6"}}`, - }, - { - name: "websocket getAccountInfo xpub txs", - req: websocketReq{ - Method: "getAccountInfo", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Xpub, - "details": "txs", - }, - }, - want: `{"id":"2","data":{"page":1,"totalPages":1,"itemsOnPage":25,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"transactions":[{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true,"isOwn":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vin":[],"vout":[{"value":"1234567890123","n":0,"spent":true,"hex":"76a914a08eae93007f22668ab5e4a9c83c8cd1c325e3e088ac","addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true},{"value":"1","n":1,"spent":true,"hex":"a91452724c5178682f70e0ba31c6ec0633755a3b41d987","addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true},{"value":"9876","n":2,"spent":true,"hex":"a914e921fc4912a315078f370d959f2c4f7b6d2a683c87","addresses":["2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu1"],"isAddress":true}],"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","blockHeight":225493,"confirmations":2,"blockTime":1521515026,"value":"1234567900000","valueIn":"0","fees":"0"}],"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N7NdeuAMgL57WE7QCeV2gTWi2Um8iAu5dA","path":"m/49'/1'/33'/0/11","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8JQEP6DSHEZHNsSDPA1gHMUq9YFndhkfV","path":"m/49'/1'/33'/0/12","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mvbn3YXqKZVpQKugaoQrfjSYPvz76RwZkC","path":"m/49'/1'/33'/0/13","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8MRNxCfwUY9TSW27X9ooGYtqgrGCfLRHx","path":"m/49'/1'/33'/0/14","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N6HvwrHC113KYZAmCtJ9XJNWgaTcnFunCM","path":"m/49'/1'/33'/0/15","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NEo3oNyHUoi7rmRWee7wki37jxPWsWCopJ","path":"m/49'/1'/33'/0/16","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mzm5KY8qdFbDHsQfy4akXbFvbR3FAwDuVo","path":"m/49'/1'/33'/0/17","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NGMwftmQCogp6XZNGvgiybz3WZysvsJzqC","path":"m/49'/1'/33'/0/18","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N3fJrrefndYjLGycvFFfYgevpZtcRKCkRD","path":"m/49'/1'/33'/0/19","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N1T7TnHBwfdpBoyw53EGUL7vuJmb2mU6jF","path":"m/49'/1'/33'/0/20","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5kBNMB8qgxE4Y4f8J19fScsE49J4aNvoJ","path":"m/49'/1'/33'/1/14","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NANWCaefhCKdXMcW8NbZnnrFRDvhJN2wPy","path":"m/49'/1'/33'/1/15","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NFHw7Yo2Bz8D2wGAYHW9qidbZFLpfJ72qB","path":"m/49'/1'/33'/1/16","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NBDSsBgy5PpFniLCb1eAFHcSxgxwPSDsZa","path":"m/49'/1'/33'/1/17","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NDWCSQHogc7sCuc2WoYt9PX2i2i6a5k6dX","path":"m/49'/1'/33'/1/18","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8vNyDP7iSDjm3BKpXrbDjAxyphqfvnJz8","path":"m/49'/1'/33'/1/19","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4tFKLurSbMusAyq1tv4tzymVjveAFV1Vb","path":"m/49'/1'/33'/1/20","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NBx5WwjAr2cH6Yqrp3Vsf957HtRKwDUVdX","path":"m/49'/1'/33'/1/21","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NBu1seHTaFhQxbcW5L5BkZzqFLGmZqpxsa","path":"m/49'/1'/33'/1/22","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NCDLoea22jGsXuarfT1n2QyCUh6RFhAPnT","path":"m/49'/1'/33'/1/23","transfers":0,"decimals":8}]}}`, - }, - { - name: "websocket getAccountInfo address", - req: websocketReq{ - Method: "getAccountInfo", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Addr4, - "details": "txids", - }, - }, - want: `{"id":"3","data":{"page":1,"totalPages":1,"itemsOnPage":25,"address":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","balance":"0","totalReceived":"1","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"]}}`, - }, - { - name: "websocket getAccountInfo xpub gap", - req: websocketReq{ - Method: "getAccountInfo", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Xpub, - "details": "tokens", - "tokens": "derived", - "gap": 10, - }, - }, - want: `{"id":"4","data":{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"usedTokens":2,"tokens":[{"type":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8},{"type":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8},{"type":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8}]}}`, - }, - { - name: "websocket getAccountUtxo", - req: websocketReq{ - Method: "getAccountUtxo", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Addr1, - }, - }, - want: `{"id":"5","data":[{"txid":"00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840","vout":0,"value":"100000000","height":225493,"confirmations":2}]}`, - }, - { - name: "websocket getAccountUtxo", - req: websocketReq{ - Method: "getAccountUtxo", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Addr4, - }, - }, - want: `{"id":"6","data":[]}`, - }, - { - name: "websocket getTransaction", - req: websocketReq{ - Method: "getTransaction", - Params: map[string]interface{}{ - "txid": dbtestdata.TxidB2T2, - }, - }, - want: `{"id":"7","data":{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"}}`, - }, - { - name: "websocket getTransaction", - req: websocketReq{ - Method: "getTransaction", - Params: map[string]interface{}{ - "txid": "not a tx", - }, - }, - want: `{"id":"8","data":{"error":{"message":"Transaction 'not a tx' not found"}}}`, - }, - { - name: "websocket getTransactionSpecific", - req: websocketReq{ - Method: "getTransactionSpecific", - Params: map[string]interface{}{ - "txid": dbtestdata.TxidB2T2, - }, - }, - want: `{"id":"9","data":{"hex":"","txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","version":0,"locktime":0,"vin":[{"coinbase":"","txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","vout":0,"scriptSig":{"hex":""},"sequence":0,"addresses":null},{"coinbase":"","txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"scriptSig":{"hex":""},"sequence":0,"addresses":null}],"vout":[{"ValueSat":118641975500,"value":0,"n":0,"scriptPubKey":{"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":null}},{"ValueSat":198641975500,"value":0,"n":1,"scriptPubKey":{"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":null}}],"confirmations":1,"time":1521595678,"blocktime":1521595678,"vsize":400}}`, - }, - { - name: "websocket estimateFee", - req: websocketReq{ - Method: "estimateFee", - Params: map[string]interface{}{ - "blocks": []int{2, 5, 10, 20}, - "specific": map[string]interface{}{ - "conservative": false, - "txsize": 1234, - }, - }, - }, - want: `{"id":"10","data":[{"feePerTx":"246","feePerUnit":"199"},{"feePerTx":"616","feePerUnit":"499"},{"feePerTx":"1233","feePerUnit":"999"},{"feePerTx":"2467","feePerUnit":"1999"}]}`, - }, - { - name: "websocket estimateFee second time, from cache", - req: websocketReq{ - Method: "estimateFee", - Params: map[string]interface{}{ - "blocks": []int{2, 5, 10, 20}, - "specific": map[string]interface{}{ - "conservative": false, - "txsize": 1234, - }, - }, - }, - want: `{"id":"11","data":[{"feePerTx":"246","feePerUnit":"199"},{"feePerTx":"616","feePerUnit":"499"},{"feePerTx":"1233","feePerUnit":"999"},{"feePerTx":"2467","feePerUnit":"1999"}]}`, - }, - { - name: "websocket sendTransaction", - req: websocketReq{ - Method: "sendTransaction", - Params: map[string]interface{}{ - "hex": "123456", - }, - }, - want: `{"id":"12","data":{"result":"9876"}}`, - }, - { - name: "websocket subscribeNewBlock", - req: websocketReq{ - Method: "subscribeNewBlock", - }, - want: `{"id":"13","data":{"subscribed":true}}`, - }, - { - name: "websocket unsubscribeNewBlock", - req: websocketReq{ - Method: "unsubscribeNewBlock", - }, - want: `{"id":"14","data":{"subscribed":false}}`, - }, - { - name: "websocket subscribeAddresses", - req: websocketReq{ - Method: "subscribeAddresses", - Params: map[string]interface{}{ - "addresses": []string{dbtestdata.Addr1, dbtestdata.Addr2}, - }, - }, - want: `{"id":"15","data":{"subscribed":true}}`, - }, - { - name: "websocket unsubscribeAddresses", - req: websocketReq{ - Method: "unsubscribeAddresses", - }, - want: `{"id":"16","data":{"subscribed":false}}`, - }, - { - name: "websocket ping", - req: websocketReq{ - Method: "ping", - }, - want: `{"id":"17","data":{}}`, - }, - { - name: "websocket getCurrentFiatRates all currencies", - req: websocketReq{ - Method: "getCurrentFiatRates", - Params: map[string]interface{}{ - "currencies": []string{}, - }, - }, - want: `{"id":"18","data":{"ts":1574346615,"rates":{"eur":7134.1,"usd":7914.5}}}`, - }, - { - name: "websocket getCurrentFiatRates usd", - req: websocketReq{ - Method: "getCurrentFiatRates", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - }, - }, - want: `{"id":"19","data":{"ts":1574346615,"rates":{"usd":7914.5}}}`, - }, - { - name: "websocket getCurrentFiatRates eur", - req: websocketReq{ - Method: "getCurrentFiatRates", - Params: map[string]interface{}{ - "currencies": []string{"eur"}, - }, - }, - want: `{"id":"20","data":{"ts":1574346615,"rates":{"eur":7134.1}}}`, - }, - { - name: "websocket getCurrentFiatRates incorrect currency", - req: websocketReq{ - Method: "getCurrentFiatRates", - Params: map[string]interface{}{ - "currencies": []string{"does-not-exist"}, - }, - }, - want: `{"id":"21","data":{"ts":1574346615,"rates":{"does-not-exist":-1}}}`, - }, - { - name: "websocket getFiatRatesForTimestamps missing date", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - }, - }, - want: `{"id":"22","data":{"error":{"message":"No timestamps provided"}}}`, - }, - { - name: "websocket getFiatRatesForTimestamps incorrect date", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - "timestamps": []string{"yesterday"}, - }, - }, - want: `{"id":"23","data":{"error":{"message":"json: cannot unmarshal string into Go struct field .timestamps of type int64"}}}`, - }, - { - name: "websocket getFiatRatesForTimestamps empty currency", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "timestamps": []int64{7885693815}, - "currencies": []string{""}, - }, - }, - want: `{"id":"24","data":{"tickers":[{"ts":7885693815,"rates":{}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps incorrect (future) date", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - "timestamps": []int64{7885693815}, - }, - }, - want: `{"id":"25","data":{"tickers":[{"ts":7885693815,"rates":{"usd":-1}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps exact date", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - "timestamps": []int64{1574346615}, - }, - }, - want: `{"id":"26","data":{"tickers":[{"ts":1574346615,"rates":{"usd":7914.5}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps closest date, eur", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"eur"}, - "timestamps": []int64{1521507600}, - }, - }, - want: `{"id":"27","data":{"tickers":[{"ts":1521511200,"rates":{"eur":1300}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps multiple timestamps usd", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - "timestamps": []int64{1570346615, 1574346615}, - }, - }, - want: `{"id":"28","data":{"tickers":[{"ts":1574344800,"rates":{"usd":7814.5}},{"ts":1574346615,"rates":{"usd":7914.5}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps multiple timestamps eur", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"eur"}, - "timestamps": []int64{1570346615, 1574346615}, - }, - }, - want: `{"id":"29","data":{"tickers":[{"ts":1574344800,"rates":{"eur":7100}},{"ts":1574346615,"rates":{"eur":7134.1}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps multiple timestamps with an error", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - "timestamps": []int64{1570346615, 1574346615, 2000000000}, - }, - }, - want: `{"id":"30","data":{"tickers":[{"ts":1574344800,"rates":{"usd":7814.5}},{"ts":1574346615,"rates":{"usd":7914.5}},{"ts":2000000000,"rates":{"usd":-1}}]}}`, - }, - { - name: "websocket getFiatRatesForTimestamps multiple errors", - req: websocketReq{ - Method: "getFiatRatesForTimestamps", - Params: map[string]interface{}{ - "currencies": []string{"usd"}, - "timestamps": []int64{7832854800, 2000000000}, - }, - }, - want: `{"id":"31","data":{"tickers":[{"ts":7832854800,"rates":{"usd":-1}},{"ts":2000000000,"rates":{"usd":-1}}]}}`, - }, - { - name: "websocket getTickersList", - req: websocketReq{ - Method: "getFiatRatesTickersList", - Params: map[string]interface{}{ - "timestamp": 1570346615, - }, - }, - want: `{"id":"32","data":{"ts":1574344800,"available_currencies":["eur","usd"]}}`, - }, - { - name: "websocket getBalanceHistory Addr2", - req: websocketReq{ - Method: "getBalanceHistory", - Params: map[string]interface{}{ - "descriptor": "mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz", - }, - }, - want: `{"id":"33","data":[{"time":1521514800,"txs":1,"received":"24690","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"0","sent":"12345","sentToSelf":"0","rates":{"eur":1303,"usd":2003}}]}`, - }, - { - name: "websocket getBalanceHistory xpub", - req: websocketReq{ - Method: "getBalanceHistory", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Xpub, - }, - }, - want: `{"id":"34","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"118641975500","sent":"1","sentToSelf":"118641975500","rates":{"eur":1303,"usd":2003}}]}`, - }, - { - name: "websocket getBalanceHistory xpub from=1521504000&to=1521590400 currencies=[usd]", - req: websocketReq{ - Method: "getBalanceHistory", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Xpub, - "from": 1521504000, - "to": 1521590400, - "currencies": []string{"usd"}, - }, - }, - want: `{"id":"35","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"usd":2001}}]}`, - }, - { - name: "websocket getBalanceHistory xpub from=1521504000&to=1521590400 currencies=[usd, eur, incorrect]", - req: websocketReq{ - Method: "getBalanceHistory", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Xpub, - "from": 1521504000, - "to": 1521590400, - "currencies": []string{"usd", "eur", "incorrect"}, +type websocketTest struct { + name string + req websocketReq + want string +} + +var websocketTestsBitcoinType = []websocketTest{ + { + name: "websocket getInfo", + req: websocketReq{ + Method: "getInfo", + }, + want: `{"id":"0","data":{"name":"Fakecoin","shortcut":"FAKE","network":"FAKE","decimals":8,"version":"unknown","bestHeight":225494,"bestHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","block0Hash":"","testnet":true,"backend":{"version":"001001","subversion":"/Fakecoin:0.0.1/"}}}`, + }, + { + name: "websocket getBlockHash", + req: websocketReq{ + Method: "getBlockHash", + Params: map[string]interface{}{ + "height": 225494, + }, + }, + want: `{"id":"1","data":{"hash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6"}}`, + }, + { + name: "websocket getAccountInfo xpub txs", + req: websocketReq{ + Method: "getAccountInfo", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + "details": "txs", + }, + }, + want: `{"id":"2","data":{"page":1,"totalPages":1,"itemsOnPage":25,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"addrTxCount":3,"transactions":[{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true,"isOwn":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vin":[],"vout":[{"value":"1234567890123","n":0,"spent":true,"hex":"76a914a08eae93007f22668ab5e4a9c83c8cd1c325e3e088ac","addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true},{"value":"1","n":1,"spent":true,"hex":"a91452724c5178682f70e0ba31c6ec0633755a3b41d987","addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true},{"value":"9876","n":2,"spent":true,"hex":"a914e921fc4912a315078f370d959f2c4f7b6d2a683c87","addresses":["2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu1"],"isAddress":true}],"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","blockHeight":225493,"confirmations":2,"blockTime":1521515026,"value":"1234567900000","valueIn":"0","fees":"0"}],"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7NdeuAMgL57WE7QCeV2gTWi2Um8iAu5dA","path":"m/49'/1'/33'/0/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8JQEP6DSHEZHNsSDPA1gHMUq9YFndhkfV","path":"m/49'/1'/33'/0/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mvbn3YXqKZVpQKugaoQrfjSYPvz76RwZkC","path":"m/49'/1'/33'/0/13","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8MRNxCfwUY9TSW27X9ooGYtqgrGCfLRHx","path":"m/49'/1'/33'/0/14","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6HvwrHC113KYZAmCtJ9XJNWgaTcnFunCM","path":"m/49'/1'/33'/0/15","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEo3oNyHUoi7rmRWee7wki37jxPWsWCopJ","path":"m/49'/1'/33'/0/16","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mzm5KY8qdFbDHsQfy4akXbFvbR3FAwDuVo","path":"m/49'/1'/33'/0/17","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NGMwftmQCogp6XZNGvgiybz3WZysvsJzqC","path":"m/49'/1'/33'/0/18","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3fJrrefndYjLGycvFFfYgevpZtcRKCkRD","path":"m/49'/1'/33'/0/19","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1T7TnHBwfdpBoyw53EGUL7vuJmb2mU6jF","path":"m/49'/1'/33'/0/20","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5kBNMB8qgxE4Y4f8J19fScsE49J4aNvoJ","path":"m/49'/1'/33'/1/14","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NANWCaefhCKdXMcW8NbZnnrFRDvhJN2wPy","path":"m/49'/1'/33'/1/15","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFHw7Yo2Bz8D2wGAYHW9qidbZFLpfJ72qB","path":"m/49'/1'/33'/1/16","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBDSsBgy5PpFniLCb1eAFHcSxgxwPSDsZa","path":"m/49'/1'/33'/1/17","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NDWCSQHogc7sCuc2WoYt9PX2i2i6a5k6dX","path":"m/49'/1'/33'/1/18","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8vNyDP7iSDjm3BKpXrbDjAxyphqfvnJz8","path":"m/49'/1'/33'/1/19","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4tFKLurSbMusAyq1tv4tzymVjveAFV1Vb","path":"m/49'/1'/33'/1/20","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBx5WwjAr2cH6Yqrp3Vsf957HtRKwDUVdX","path":"m/49'/1'/33'/1/21","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBu1seHTaFhQxbcW5L5BkZzqFLGmZqpxsa","path":"m/49'/1'/33'/1/22","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NCDLoea22jGsXuarfT1n2QyCUh6RFhAPnT","path":"m/49'/1'/33'/1/23","transfers":0,"decimals":8}]}}`, + }, + { + name: "websocket getAccountInfo address", + req: websocketReq{ + Method: "getAccountInfo", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Addr4, + "details": "txids", + }, + }, + want: `{"id":"3","data":{"page":1,"totalPages":1,"itemsOnPage":25,"address":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","balance":"0","totalReceived":"1","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"txids":["3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75"]}}`, + }, + { + name: "websocket getAccountInfo xpub gap", + req: websocketReq{ + Method: "getAccountInfo", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + "details": "tokens", + "tokens": "derived", + "gap": 10, + }, + }, + want: `{"id":"4","data":{"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":3,"addrTxCount":3,"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8}]}}`, + }, + { + name: "websocket getAccountUtxo", + req: websocketReq{ + Method: "getAccountUtxo", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Addr1, + }, + }, + want: `{"id":"5","data":[{"txid":"00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840","vout":0,"value":"100000000","height":225493,"confirmations":2}]}`, + }, + { + name: "websocket getAccountUtxo", + req: websocketReq{ + Method: "getAccountUtxo", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Addr4, + }, + }, + want: `{"id":"6","data":[]}`, + }, + { + name: "websocket getTransaction", + req: websocketReq{ + Method: "getTransaction", + Params: map[string]interface{}{ + "txid": dbtestdata.TxidB2T2, + }, + }, + want: `{"id":"7","data":{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"}}`, + }, + { + name: "websocket getTransaction", + req: websocketReq{ + Method: "getTransaction", + Params: map[string]interface{}{ + "txid": "not a tx", + }, + }, + want: `{"id":"8","data":{"error":{"message":"Transaction 'not a tx' not found"}}}`, + }, + { + name: "websocket getTransactionSpecific", + req: websocketReq{ + Method: "getTransactionSpecific", + Params: map[string]interface{}{ + "txid": dbtestdata.TxidB2T2, + }, + }, + want: `{"id":"9","data":{"hex":"","txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","version":0,"locktime":0,"vin":[{"coinbase":"","txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","vout":0,"scriptSig":{"hex":""},"sequence":0,"addresses":null},{"coinbase":"","txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"scriptSig":{"hex":""},"sequence":0,"addresses":null}],"vout":[{"ValueSat":118641975500,"value":0,"n":0,"scriptPubKey":{"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":null}},{"ValueSat":198641975500,"value":0,"n":1,"scriptPubKey":{"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":null}}],"confirmations":1,"time":1521595678,"blocktime":1521595678,"vsize":400}}`, + }, + { + name: "websocket estimateFee", + req: websocketReq{ + Method: "estimateFee", + Params: map[string]interface{}{ + "blocks": []int{2, 5, 10, 20}, + "specific": map[string]interface{}{ + "conservative": false, + "txsize": 1234, }, }, - want: `{"id":"36","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"incorrect":-1,"usd":2001}}]}`, }, - { - name: "websocket getBalanceHistory xpub from=1521504000&to=1521590400 currencies=[]", - req: websocketReq{ - Method: "getBalanceHistory", - Params: map[string]interface{}{ - "descriptor": dbtestdata.Xpub, - "from": 1521504000, - "to": 1521590400, - "currencies": []string{}, + want: `{"id":"10","data":[{"feePerTx":"246","feePerUnit":"199"},{"feePerTx":"616","feePerUnit":"499"},{"feePerTx":"1233","feePerUnit":"999"},{"feePerTx":"2467","feePerUnit":"1999"}]}`, + }, + { + name: "websocket estimateFee second time, from cache", + req: websocketReq{ + Method: "estimateFee", + Params: map[string]interface{}{ + "blocks": []int{2, 5, 10, 20}, + "specific": map[string]interface{}{ + "conservative": false, + "txsize": 1234, }, }, - want: `{"id":"37","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}}]}`, - }, - { - name: "websocket subscribeNewTransaction", - req: websocketReq{ - Method: "subscribeNewTransaction", - }, - want: `{"id":"38","data":{"subscribed":false,"message":"subscribeNewTransaction not enabled, use -enablesubnewtx flag to enable."}}`, - }, - { - name: "websocket unsubscribeNewTransaction", - req: websocketReq{ - Method: "unsubscribeNewTransaction", - }, - want: `{"id":"39","data":{"subscribed":false,"message":"unsubscribeNewTransaction not enabled, use -enablesubnewtx flag to enable."}}`, }, + want: `{"id":"11","data":[{"feePerTx":"246","feePerUnit":"199"},{"feePerTx":"616","feePerUnit":"499"},{"feePerTx":"1233","feePerUnit":"999"},{"feePerTx":"2467","feePerUnit":"1999"}]}`, + }, + { + name: "websocket sendTransaction", + req: websocketReq{ + Method: "sendTransaction", + Params: map[string]interface{}{ + "hex": "123456", + }, + }, + want: `{"id":"12","data":{"result":"9876"}}`, + }, + { + name: "websocket subscribeNewBlock", + req: websocketReq{ + Method: "subscribeNewBlock", + }, + want: `{"id":"13","data":{"subscribed":true}}`, + }, + { + name: "websocket unsubscribeNewBlock", + req: websocketReq{ + Method: "unsubscribeNewBlock", + }, + want: `{"id":"14","data":{"subscribed":false}}`, + }, + { + name: "websocket subscribeAddresses", + req: websocketReq{ + Method: "subscribeAddresses", + Params: map[string]interface{}{ + "addresses": []string{dbtestdata.Addr1, dbtestdata.Addr2}, + }, + }, + want: `{"id":"15","data":{"subscribed":true}}`, + }, + { + name: "websocket unsubscribeAddresses", + req: websocketReq{ + Method: "unsubscribeAddresses", + }, + want: `{"id":"16","data":{"subscribed":false}}`, + }, + { + name: "websocket ping", + req: websocketReq{ + Method: "ping", + }, + want: `{"id":"17","data":{}}`, + }, + { + name: "websocket getCurrentFiatRates all currencies", + req: websocketReq{ + Method: "getCurrentFiatRates", + Params: map[string]interface{}{ + "currencies": []string{}, + }, + }, + want: `{"id":"18","data":{"ts":1574380800,"rates":{"eur":7134.1,"usd":7914.5}}}`, + }, + { + name: "websocket getCurrentFiatRates usd", + req: websocketReq{ + Method: "getCurrentFiatRates", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + }, + }, + want: `{"id":"19","data":{"ts":1574380800,"rates":{"usd":7914.5}}}`, + }, + { + name: "websocket getCurrentFiatRates eur", + req: websocketReq{ + Method: "getCurrentFiatRates", + Params: map[string]interface{}{ + "currencies": []string{"eur"}, + }, + }, + want: `{"id":"20","data":{"ts":1574380800,"rates":{"eur":7134.1}}}`, + }, + { + name: "websocket getCurrentFiatRates incorrect currency", + req: websocketReq{ + Method: "getCurrentFiatRates", + Params: map[string]interface{}{ + "currencies": []string{"does-not-exist"}, + }, + }, + want: `{"id":"21","data":{"error":{"message":"No tickers found!"}}}`, + }, + { + name: "websocket getFiatRatesForTimestamps missing date", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + }, + }, + want: `{"id":"22","data":{"error":{"message":"No timestamps provided"}}}`, + }, + { + name: "websocket getFiatRatesForTimestamps incorrect date", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + "timestamps": []string{"yesterday"}, + }, + }, + want: `{"id":"23","data":{"error":{"message":"json: cannot unmarshal string into Go struct field WsFiatRatesForTimestampsReq.timestamps of type int64"}}}`, + }, + { + name: "websocket getFiatRatesForTimestamps empty currency", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "timestamps": []int64{7885693815}, + "currencies": []string{""}, + }, + }, + want: `{"id":"24","data":{"tickers":[{"ts":7885693815,"rates":{}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps incorrect (future) date", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + "timestamps": []int64{7885693815}, + }, + }, + want: `{"id":"25","data":{"tickers":[{"ts":7885693815,"rates":{"usd":-1}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps exact date", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + "timestamps": []int64{1574380800}, + }, + }, + want: `{"id":"26","data":{"tickers":[{"ts":1574380800,"rates":{"usd":7914.5}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps closest date, eur", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"eur"}, + "timestamps": []int64{1521507600}, + }, + }, + want: `{"id":"27","data":{"tickers":[{"ts":1521590400,"rates":{"eur":1301}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps multiple timestamps usd", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + "timestamps": []int64{1570346615, 1574346615}, + }, + }, + want: `{"id":"28","data":{"tickers":[{"ts":1574294400,"rates":{"usd":7814.5}},{"ts":1574380800,"rates":{"usd":7914.5}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps multiple timestamps eur", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"eur"}, + "timestamps": []int64{1570346615, 1574346615}, + }, + }, + want: `{"id":"29","data":{"tickers":[{"ts":1574294400,"rates":{"eur":7100}},{"ts":1574380800,"rates":{"eur":7134.1}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps multiple timestamps with an error", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + "timestamps": []int64{1570346615, 1574346615, 2000000000}, + }, + }, + want: `{"id":"30","data":{"tickers":[{"ts":1574294400,"rates":{"usd":7814.5}},{"ts":1574380800,"rates":{"usd":7914.5}},{"ts":2000000000,"rates":{"usd":-1}}]}}`, + }, + { + name: "websocket getFiatRatesForTimestamps multiple errors", + req: websocketReq{ + Method: "getFiatRatesForTimestamps", + Params: map[string]interface{}{ + "currencies": []string{"usd"}, + "timestamps": []int64{7832854800, 2000000000}, + }, + }, + want: `{"id":"31","data":{"tickers":[{"ts":7832854800,"rates":{"usd":-1}},{"ts":2000000000,"rates":{"usd":-1}}]}}`, + }, + { + name: "websocket getTickersList", + req: websocketReq{ + Method: "getFiatRatesTickersList", + Params: map[string]interface{}{ + "timestamp": 1570346615, + }, + }, + want: `{"id":"32","data":{"ts":1574294400,"available_currencies":["eur","usd"]}}`, + }, + { + name: "websocket getBalanceHistory Addr2", + req: websocketReq{ + Method: "getBalanceHistory", + Params: map[string]interface{}{ + "descriptor": "mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz", + }, + }, + want: `{"id":"33","data":[{"time":1521514800,"txs":1,"received":"24690","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"0","sent":"12345","sentToSelf":"0","rates":{"eur":1302,"usd":2002}}]}`, + }, + { + name: "websocket getBalanceHistory xpub", + req: websocketReq{ + Method: "getBalanceHistory", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + }, + }, + want: `{"id":"34","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}},{"time":1521594000,"txs":1,"received":"118641975500","sent":"1","sentToSelf":"118641975500","rates":{"eur":1302,"usd":2002}}]}`, + }, + { + name: "websocket getBalanceHistory xpub from=1521504000&to=1521590400 currencies=[usd]", + req: websocketReq{ + Method: "getBalanceHistory", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + "from": 1521504000, + "to": 1521590400, + "currencies": []string{"usd"}, + }, + }, + want: `{"id":"35","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"usd":2001}}]}`, + }, + { + name: "websocket getBalanceHistory xpub from=1521504000&to=1521590400 currencies=[usd, eur, incorrect]", + req: websocketReq{ + Method: "getBalanceHistory", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + "from": 1521504000, + "to": 1521590400, + "currencies": []string{"usd", "eur", "incorrect"}, + }, + }, + want: `{"id":"36","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"incorrect":-1,"usd":2001}}]}`, + }, + { + name: "websocket getBalanceHistory xpub from=1521504000&to=1521590400 currencies=[]", + req: websocketReq{ + Method: "getBalanceHistory", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + "from": 1521504000, + "to": 1521590400, + "currencies": []string{}, + }, + }, + want: `{"id":"37","data":[{"time":1521514800,"txs":1,"received":"1","sent":"0","sentToSelf":"0","rates":{"eur":1301,"usd":2001}}]}`, + }, + { + name: "websocket subscribeNewTransaction", + req: websocketReq{ + Method: "subscribeNewTransaction", + }, + want: `{"id":"38","data":{"subscribed":false,"message":"subscribeNewTransaction not enabled, use -enablesubnewtx flag to enable."}}`, + }, + { + name: "websocket unsubscribeNewTransaction", + req: websocketReq{ + Method: "unsubscribeNewTransaction", + }, + want: `{"id":"39","data":{"subscribed":false,"message":"unsubscribeNewTransaction not enabled, use -enablesubnewtx flag to enable."}}`, + }, + { + name: "websocket getBlock", + req: websocketReq{ + Method: "getBlock", + Params: map[string]interface{}{ + "id": "00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6", + }, + }, + want: `{"id":"40","data":{"error":{"message":"Not supported"}}}`, + }, + { + name: "websocket getMempoolFilters", + req: websocketReq{ + Method: "getMempoolFilters", + Params: map[string]interface{}{ + "scriptType": "", + }, + }, + want: `{"id":"41","data":{"P":0,"M":1,"zeroedKey":false,"entries":{}}}`, + }, + { + name: "websocket getMempoolFilters invalid type", + req: websocketReq{ + Method: "getMempoolFilters", + Params: map[string]interface{}{ + "scriptType": "invalid", + }, + }, + want: `{"id":"42","data":{"error":{"message":"Unsupported script filter invalid"}}}`, + }, + { + name: "websocket getBlockFilter", + req: websocketReq{ + Method: "getBlockFilter", + Params: map[string]interface{}{ + "blockHash": "abcd", + }, + }, + want: `{"id":"43","data":{"P":0,"M":1,"zeroedKey":false,"blockFilter":""}}`, + }, + { + name: "websocket rpcCall", + req: websocketReq{ + Method: "rpcCall", + Params: WsRpcCallReq{ + To: "0x123", + Data: "0x456", + }, + }, + want: `{"id":"44","data":{"error":{"message":"not supported"}}}`, + }, +} + +func runWebsocketTests(t *testing.T, ts *httptest.Server, tests []websocketTest) { + url := strings.Replace(ts.URL, "http://", "ws://", 1) + "/websocket" + s, _, err := websocket.DefaultDialer.Dial(url, nil) + if err != nil { + t.Fatal(err) } + defer s.Close() // send all requests at once for i, tt := range tests { @@ -1557,8 +1552,34 @@ func websocketTestsBitcoinType(t *testing.T, ts *httptest.Server) { } } +// fixedTimeNow returns always 2022-09-15 12:43:56 UTC +func fixedTimeNow() time.Time { + return time.Date(2022, 9, 15, 12, 43, 56, 0, time.UTC) +} + +func setupChain(t *testing.T) (bchain.BlockChainParser, bchain.BlockChain) { + timeNow = fixedTimeNow + parser := btc.NewBitcoinParser( + btc.GetChainParams("test"), + &btc.Configuration{ + BlockAddressesToKeep: 1, + XPubMagic: 70617039, + XPubMagicSegwitP2sh: 71979618, + XPubMagicSegwitNative: 73342198, + Slip44: 1, + }) + + chain, err := dbtestdata.NewFakeBlockChain(parser) + if err != nil { + glog.Fatal("fakechain: ", err) + } + return parser, chain +} + func Test_PublicServer_BitcoinType(t *testing.T) { - s, dbpath := setupPublicHTTPServer(t) + parser, chain := setupChain(t) + + s, dbpath := setupPublicHTTPServer(parser, chain, t, false) defer closeAndDestroyPublicServer(t, s, dbpath) s.ConnectFullPublicInterface() // take the handler of the public server and pass it to the test server @@ -1567,5 +1588,186 @@ func Test_PublicServer_BitcoinType(t *testing.T) { httpTestsBitcoinType(t, ts) socketioTestsBitcoinType(t, ts) - websocketTestsBitcoinType(t, ts) + runWebsocketTests(t, ts, websocketTestsBitcoinType) +} + +func httpTestsBitcoinTypeExtendedIndex(t *testing.T, ts *httptest.Server) { + tests := []struct { + name string + r *http.Request + status int + contentType string + body []string + }{ + { + name: "apiIndex", + r: newGetRequest(ts.URL + "/api"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"blockbook":{"coin":"Fakecoin"`, + `"bestHeight":225494`, + `"decimals":8`, + `"backend":{"chain":"fakecoin","blocks":2,"headers":2,"bestBlockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6"`, + `"version":"001001","subversion":"/Fakecoin:0.0.1/"`, + }, + }, + { + name: "apiTx v2", + r: newGetRequest(ts.URL + "/api/v2/tx/7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","vin":[{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","n":0,"addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true,"value":"1234567890123"},{"txid":"00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840","vout":1,"n":1,"addresses":["mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz"],"isAddress":true,"value":"12345"}],"vout":[{"value":"317283951061","n":0,"spent":true,"spentTxId":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","spentHeight":225494,"hex":"76a914ccaaaf374e1b06cb83118453d102587b4273d09588ac","addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true},{"value":"917283951061","n":1,"hex":"76a9148d802c045445df49613f6a70ddd2e48526f3701f88ac","addresses":["mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL"],"isAddress":true},{"value":"0","n":2,"hex":"6a072020f1686f6a20","addresses":["OP_RETURN 2020f1686f6a20"],"isAddress":false}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"1234567902122","valueIn":"1234567902468","fees":"346"}`, + }, + }, + { + name: "apiAddress v2 details=txs", + r: newGetRequest(ts.URL + "/api/v2/address/mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw?details=txs"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"page":1,"totalPages":1,"itemsOnPage":1000,"address":"mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw","balance":"0","totalReceived":"1234567890123","totalSent":"1234567890123","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"transactions":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","vin":[{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","n":0,"addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true,"isOwn":true,"value":"1234567890123"},{"txid":"00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840","vout":1,"n":1,"addresses":["mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz"],"isAddress":true,"value":"12345"}],"vout":[{"value":"317283951061","n":0,"spent":true,"spentTxId":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","spentHeight":225494,"hex":"76a914ccaaaf374e1b06cb83118453d102587b4273d09588ac","addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true},{"value":"917283951061","n":1,"hex":"76a9148d802c045445df49613f6a70ddd2e48526f3701f88ac","addresses":["mtR97eM2HPWVM6c8FGLGcukgaHHQv7THoL"],"isAddress":true},{"value":"0","n":2,"hex":"6a072020f1686f6a20","addresses":["OP_RETURN 2020f1686f6a20"],"isAddress":false}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"1234567902122","valueIn":"1234567902468","fees":"346"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vin":[],"vout":[{"value":"1234567890123","n":0,"spent":true,"spentTxId":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","spentHeight":225494,"hex":"76a914a08eae93007f22668ab5e4a9c83c8cd1c325e3e088ac","addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true,"isOwn":true},{"value":"1","n":1,"spent":true,"spentTxId":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","spentIndex":1,"spentHeight":225494,"hex":"a91452724c5178682f70e0ba31c6ec0633755a3b41d987","addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true},{"value":"9876","n":2,"spent":true,"spentTxId":"05e2e48aeabdd9b75def7b48d756ba304713c2aba7b522bf9dbc893fc4231b07","spentHeight":225494,"hex":"a914e921fc4912a315078f370d959f2c4f7b6d2a683c87","addresses":["2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu1"],"isAddress":true}],"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","blockHeight":225493,"confirmations":2,"blockTime":1521515026,"value":"1234567900000","valueIn":"0","fees":"0"}]}`, + }, + }, + { + name: "apiGetBlock", + r: newGetRequest(ts.URL + "/api/v2/block/225493"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"page":1,"totalPages":1,"itemsOnPage":1000,"hash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","nextBlockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","height":225493,"confirmations":2,"size":1234567,"time":1521515026,"version":0,"merkleRoot":"","nonce":"","bits":"","difficulty":"","txCount":2,"txs":[{"txid":"00b2c06055e5e90e9c82bd4181fde310104391a7fa4f289b1704e5d90caa3840","vin":[],"vout":[{"value":"100000000","n":0,"addresses":["mfcWp7DB6NuaZsExybTTXpVgWz559Np4Ti"],"isAddress":true},{"value":"12345","n":1,"spent":true,"spentTxId":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","spentIndex":1,"spentHeight":225494,"addresses":["mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz"],"isAddress":true},{"value":"12345","n":2,"addresses":["mtGXQvBowMkBpnhLckhxhbwYK44Gs9eEtz"],"isAddress":true}],"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","blockHeight":225493,"confirmations":2,"blockTime":1521515026,"value":"100024690","valueIn":"0","fees":"0"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vin":[],"vout":[{"value":"1234567890123","n":0,"spent":true,"spentTxId":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","spentHeight":225494,"addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true},{"value":"1","n":1,"spent":true,"spentTxId":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","spentIndex":1,"spentHeight":225494,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true},{"value":"9876","n":2,"spent":true,"spentTxId":"05e2e48aeabdd9b75def7b48d756ba304713c2aba7b522bf9dbc893fc4231b07","spentHeight":225494,"addresses":["2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu1"],"isAddress":true}],"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","blockHeight":225493,"confirmations":2,"blockTime":1521515026,"value":"1234567900000","valueIn":"0","fees":"0"}]}`, + }, + }, + { + name: "apiBlockFilters", + r: newGetRequest(ts.URL + "/api/v2/block-filters?lastN=2"), + status: http.StatusOK, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"P":20,"M":1048576,"zeroedKey":false,"blockFilters":{"225493":{"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","filter":"050079b0d468a27502af2ac08f2fc0"},"225494":{"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","filter":"0a0195bc0a550129e827a9ba4aa44287840cc73d0c27d16832059690"}}}`, + }, + }, + { + name: "apiBlockFilters scriptType=taproot", + r: newGetRequest(ts.URL + "/api/v2/block-filters?lastN=2&scriptType=taproot"), + status: http.StatusBadRequest, + contentType: "application/json; charset=utf-8", + body: []string{ + `{"error":"Invalid scriptType taproot. Use "}`, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resp, err := http.DefaultClient.Do(tt.r) + if err != nil { + t.Fatal(err) + } + defer resp.Body.Close() + if resp.StatusCode != tt.status { + t.Errorf("StatusCode = %v, want %v", resp.StatusCode, tt.status) + } + if resp.Header["Content-Type"][0] != tt.contentType { + t.Errorf("Content-Type = %v, want %v", resp.Header["Content-Type"][0], tt.contentType) + } + bb, err := io.ReadAll(resp.Body) + if err != nil { + t.Fatal(err) + } + b := string(bb) + for _, c := range tt.body { + if !strings.Contains(b, c) { + t.Errorf("got %v, want to contain %v", b, c) + break + } + } + }) + } +} + +var websocketTestsBitcoinTypeExtendedIndex = []websocketTest{ + { + name: "websocket getInfo", + req: websocketReq{ + Method: "getInfo", + }, + want: `{"id":"0","data":{"name":"Fakecoin","shortcut":"FAKE","network":"FAKE","decimals":8,"version":"unknown","bestHeight":225494,"bestHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","block0Hash":"","testnet":true,"backend":{"version":"001001","subversion":"/Fakecoin:0.0.1/"}}}`, + }, + { + name: "websocket getBlockHash", + req: websocketReq{ + Method: "getBlockHash", + Params: map[string]interface{}{ + "height": 225494, + }, + }, + want: `{"id":"1","data":{"hash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6"}}`, + }, + { + name: "websocket getAccountInfo xpub txs", + req: websocketReq{ + Method: "getAccountInfo", + Params: map[string]interface{}{ + "descriptor": dbtestdata.Xpub, + "details": "txs", + }, + }, + want: `{"id":"2","data":{"page":1,"totalPages":1,"itemsOnPage":25,"address":"upub5E1xjDmZ7Hhej6LPpS8duATdKXnRYui7bDYj6ehfFGzWDZtmCmQkZhc3Zb7kgRLtHWd16QFxyP86JKL3ShZEBFX88aciJ3xyocuyhZZ8g6q","balance":"118641975500","totalReceived":"118641975501","totalSent":"1","unconfirmedBalance":"0","unconfirmedTxs":0,"txs":2,"addrTxCount":3,"transactions":[{"txid":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","vin":[{"txid":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","n":0,"addresses":["mzB8cYrfRwFRFAGTDzV8LkUQy5BQicxGhX"],"isAddress":true,"value":"317283951061"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vout":1,"n":1,"addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true,"value":"1"}],"vout":[{"value":"118641975500","n":0,"hex":"a91495e9fbe306449c991d314afe3c3567d5bf78efd287","addresses":["2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu"],"isAddress":true,"isOwn":true},{"value":"198641975500","n":1,"hex":"76a9143f8ba3fda3ba7b69f5818086e12223c6dd25e3c888ac","addresses":["mmJx9Y8ayz9h14yd9fgCW1bUKoEpkBAquP"],"isAddress":true}],"blockHash":"00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6","blockHeight":225494,"confirmations":1,"blockTime":1521595678,"value":"317283951000","valueIn":"317283951062","fees":"62"},{"txid":"effd9ef509383d536b1c8af5bf434c8efbf521a4f2befd4022bbd68694b4ac75","vin":[],"vout":[{"value":"1234567890123","n":0,"spent":true,"spentTxId":"7c3be24063f268aaa1ed81b64776798f56088757641a34fb156c4f51ed2e9d25","spentHeight":225494,"hex":"76a914a08eae93007f22668ab5e4a9c83c8cd1c325e3e088ac","addresses":["mv9uLThosiEnGRbVPS7Vhyw6VssbVRsiAw"],"isAddress":true},{"value":"1","n":1,"spent":true,"spentTxId":"3d90d15ed026dc45e19ffb52875ed18fa9e8012ad123d7f7212176e2b0ebdb71","spentIndex":1,"spentHeight":225494,"hex":"a91452724c5178682f70e0ba31c6ec0633755a3b41d987","addresses":["2MzmAKayJmja784jyHvRUW1bXPget1csRRG"],"isAddress":true,"isOwn":true},{"value":"9876","n":2,"spent":true,"spentTxId":"05e2e48aeabdd9b75def7b48d756ba304713c2aba7b522bf9dbc893fc4231b07","spentHeight":225494,"hex":"a914e921fc4912a315078f370d959f2c4f7b6d2a683c87","addresses":["2NEVv9LJmAnY99W1pFoc5UJjVdypBqdnvu1"],"isAddress":true}],"blockHash":"0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997","blockHeight":225493,"confirmations":2,"blockTime":1521515026,"value":"1234567900000","valueIn":"0","fees":"0"}],"usedTokens":2,"tokens":[{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzmAKayJmja784jyHvRUW1bXPget1csRRG","path":"m/49'/1'/33'/0/0","transfers":2,"decimals":8,"balance":"0","totalReceived":"1","totalSent":"1"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MsYfbi6ZdVXLDNrYAQ11ja9Sd3otMk4Pmj","path":"m/49'/1'/33'/0/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuAZNAjLSo6RLFad2fvHSfgqBD7BoEVy4T","path":"m/49'/1'/33'/0/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEqKzw3BosGnBE9by5uaDy5QgwjHac4Zbg","path":"m/49'/1'/33'/0/3","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mw7vJNC8zUK6VNN4CEjtoTYmuNPLewxZzV","path":"m/49'/1'/33'/0/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1kvo97NFASPXiwephZUxE9PRXunjTxEc4","path":"m/49'/1'/33'/0/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuWrWMzoBt8VDFNvPmpJf42M1GTUs85fPx","path":"m/49'/1'/33'/0/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MuVZ2Ca6Da9zmYynt49Rx7uikAgubGcymF","path":"m/49'/1'/33'/0/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzRGWDUmrPP9HwYu4B43QGCTLwoop5cExa","path":"m/49'/1'/33'/0/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5C9EEWJzyBXhpyPHqa3UNed73Amsi5b3L","path":"m/49'/1'/33'/0/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzNawz2zjwq1L85GDE3YydEJGJYfXxaWkk","path":"m/49'/1'/33'/0/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7NdeuAMgL57WE7QCeV2gTWi2Um8iAu5dA","path":"m/49'/1'/33'/0/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8JQEP6DSHEZHNsSDPA1gHMUq9YFndhkfV","path":"m/49'/1'/33'/0/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mvbn3YXqKZVpQKugaoQrfjSYPvz76RwZkC","path":"m/49'/1'/33'/0/13","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8MRNxCfwUY9TSW27X9ooGYtqgrGCfLRHx","path":"m/49'/1'/33'/0/14","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6HvwrHC113KYZAmCtJ9XJNWgaTcnFunCM","path":"m/49'/1'/33'/0/15","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEo3oNyHUoi7rmRWee7wki37jxPWsWCopJ","path":"m/49'/1'/33'/0/16","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mzm5KY8qdFbDHsQfy4akXbFvbR3FAwDuVo","path":"m/49'/1'/33'/0/17","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NGMwftmQCogp6XZNGvgiybz3WZysvsJzqC","path":"m/49'/1'/33'/0/18","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3fJrrefndYjLGycvFFfYgevpZtcRKCkRD","path":"m/49'/1'/33'/0/19","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N1T7TnHBwfdpBoyw53EGUL7vuJmb2mU6jF","path":"m/49'/1'/33'/0/20","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MzSBtRWHbBjeUcu3H5VRDqkvz5sfmDxJKo","path":"m/49'/1'/33'/1/0","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MtShtAJYb1afWduUTwF1SixJjan7urZKke","path":"m/49'/1'/33'/1/1","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N3cP668SeqyBEr9gnB4yQEmU3VyxeRYith","path":"m/49'/1'/33'/1/2","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N6utyMZfPNUb1Bk8oz7p2JqJrXkq83gegu","path":"m/49'/1'/33'/1/3","transfers":1,"decimals":8,"balance":"118641975500","totalReceived":"118641975500","totalSent":"0"},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NEzatauNhf9kPTwwj6ZfYKjUdy52j4hVUL","path":"m/49'/1'/33'/1/4","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4RjsDp4LBpkNqyF91aNjgpF9CwDwBkJZq","path":"m/49'/1'/33'/1/5","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8XygTmQc4NoBBPEy3yybnfCYhsxFtzPDY","path":"m/49'/1'/33'/1/6","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5BjBomZvb48sccK2vwLMiQ5ETKp1fdPVn","path":"m/49'/1'/33'/1/7","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2MybMwbZRPCGU3SMWPwQCpDkbcQFw5Hbwen","path":"m/49'/1'/33'/1/8","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N7HexL4dyAQc7Th4iqcCW4hZuyiZsLWf74","path":"m/49'/1'/33'/1/9","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NF6X5FDGWrQj4nQrfP6hA77zB5WAc1DGup","path":"m/49'/1'/33'/1/10","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4ZRPdvc7BVioBTohy4F6QtxreqcjNj26b","path":"m/49'/1'/33'/1/11","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2Mtfho1rLmevh4qTnkYWxZEFCWteDMtTcUF","path":"m/49'/1'/33'/1/12","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFUCphKYvmMcNZRZrF261mRX6iADVB9Qms","path":"m/49'/1'/33'/1/13","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N5kBNMB8qgxE4Y4f8J19fScsE49J4aNvoJ","path":"m/49'/1'/33'/1/14","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NANWCaefhCKdXMcW8NbZnnrFRDvhJN2wPy","path":"m/49'/1'/33'/1/15","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NFHw7Yo2Bz8D2wGAYHW9qidbZFLpfJ72qB","path":"m/49'/1'/33'/1/16","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBDSsBgy5PpFniLCb1eAFHcSxgxwPSDsZa","path":"m/49'/1'/33'/1/17","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NDWCSQHogc7sCuc2WoYt9PX2i2i6a5k6dX","path":"m/49'/1'/33'/1/18","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N8vNyDP7iSDjm3BKpXrbDjAxyphqfvnJz8","path":"m/49'/1'/33'/1/19","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2N4tFKLurSbMusAyq1tv4tzymVjveAFV1Vb","path":"m/49'/1'/33'/1/20","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBx5WwjAr2cH6Yqrp3Vsf957HtRKwDUVdX","path":"m/49'/1'/33'/1/21","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NBu1seHTaFhQxbcW5L5BkZzqFLGmZqpxsa","path":"m/49'/1'/33'/1/22","transfers":0,"decimals":8},{"type":"XPUBAddress","standard":"XPUBAddress","name":"2NCDLoea22jGsXuarfT1n2QyCUh6RFhAPnT","path":"m/49'/1'/33'/1/23","transfers":0,"decimals":8}]}}`, + }, + { + name: "websocket getBlockFilter", + req: websocketReq{ + Method: "getBlockFilter", + Params: map[string]interface{}{ + "blockHash": "0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997", + }, + }, + want: `{"id":"3","data":{"P":20,"M":1048576,"zeroedKey":false,"blockFilter":"050079b0d468a27502af2ac08f2fc0"}}`, + }, + { + name: "websocket getBlockFiltersBatch bestKnownBlockHash 1st block", + req: websocketReq{ + Method: "getBlockFiltersBatch", + Params: map[string]interface{}{ + "bestKnownBlockHash": "0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997", + }, + }, + want: `{"id":"4","data":{"P":20,"M":1048576,"zeroedKey":false,"blockFiltersBatch":["225494:00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6:0a0195bc0a550129e827a9ba4aa44287840cc73d0c27d16832059690"]}}`, + }, + { + name: "websocket getBlockFiltersBatch bestKnownBlockHash 2nd block", + req: websocketReq{ + Method: "getBlockFiltersBatch", + Params: map[string]interface{}{ + "bestKnownBlockHash": "00000000eb0443fd7dc4a1ed5c686a8e995057805f9a161d9a5a77a95e72b7b6", + }, + }, + want: `{"id":"5","data":{"P":20,"M":1048576,"zeroedKey":false,"blockFiltersBatch":[]}}`, + }, + { + name: "websocket getBlockFiltersBatch bestKnownBlockHash 1st block, unsupported script type", + req: websocketReq{ + Method: "getBlockFiltersBatch", + Params: map[string]interface{}{ + "bestKnownBlockHash": "0000000076fbbed90fd75b0e18856aa35baa984e9c9d444cf746ad85e94e2997", + "scriptType": "unsupported", + }, + }, + want: `{"id":"6","data":{"error":{"message":"Unsupported script type unsupported"}}}`, + }, +} + +func Test_PublicServer_BitcoinType_ExtendedIndex(t *testing.T) { + parser, chain := setupChain(t) + + s, dbpath := setupPublicHTTPServer(parser, chain, t, true) + defer closeAndDestroyPublicServer(t, s, dbpath) + s.ConnectFullPublicInterface() + // take the handler of the public server and pass it to the test server + ts := httptest.NewServer(s.https.Handler) + defer ts.Close() + + httpTestsBitcoinTypeExtendedIndex(t, ts) + runWebsocketTests(t, ts, websocketTestsBitcoinTypeExtendedIndex) } diff --git a/server/socketio.go b/server/socketio.go index 5919db4522..c606eb1ac9 100644 --- a/server/socketio.go +++ b/server/socketio.go @@ -17,6 +17,7 @@ import ( "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/fiat" ) // SocketIoServer is handle to SocketIoServer @@ -33,8 +34,8 @@ type SocketIoServer struct { } // NewSocketIoServer creates new SocketIo interface to blockbook and returns its handle -func NewSocketIoServer(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState) (*SocketIoServer, error) { - api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is) +func NewSocketIoServer(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState, fiatRates *fiat.FiatRates) (*SocketIoServer, error) { + api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return nil, err } @@ -174,7 +175,9 @@ func (s *SocketIoServer) onMessage(c *gosocketio.Channel, req map[string]json.Ra t := time.Now() params := req["params"] s.metrics.SocketIOPendingRequests.With((common.Labels{"method": method})).Inc() - defer s.metrics.SocketIOReqDuration.With(common.Labels{"method": method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds + defer func() { + s.metrics.SocketIOReqDuration.With(common.Labels{"method": method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds + }() f, ok := onMessageHandlers[method] if ok { rv, err = f(s, params) @@ -584,7 +587,7 @@ type resultGetInfo struct { } func (s *SocketIoServer) getInfo() (res resultGetInfo, err error) { - _, height, _ := s.is.GetSyncState() + _, height, _, _ := s.is.GetSyncState() res.Result.Blocks = int(height) res.Result.Testnet = s.chain.IsTestnet() res.Result.Network = s.chain.GetNetworkName() @@ -638,7 +641,7 @@ func (s *SocketIoServer) getDetailedTransaction(txid string) (res resultGetDetai } func (s *SocketIoServer) sendTransaction(tx string) (res resultSendTransaction, err error) { - txid, err := s.chain.SendRawTransaction(tx) + txid, err := s.chain.SendRawTransaction(tx, false) if err != nil { return res, err } diff --git a/server/websocket.go b/server/websocket.go index 1942fdabe4..9a6d09cba3 100644 --- a/server/websocket.go +++ b/server/websocket.go @@ -4,6 +4,7 @@ import ( "encoding/json" "math/big" "net/http" + "os" "runtime/debug" "strconv" "strings" @@ -18,6 +19,7 @@ import ( "github.com/trezor/blockbook/bchain" "github.com/trezor/blockbook/common" "github.com/trezor/blockbook/db" + "github.com/trezor/blockbook/fiat" ) const upgradeFailed = "Upgrade failed: " @@ -34,31 +36,21 @@ var ( connectionCounter uint64 ) -type websocketReq struct { - ID string `json:"id"` - Method string `json:"method"` - Params json.RawMessage `json:"params"` -} - -type websocketRes struct { - ID string `json:"id"` - Data interface{} `json:"data"` -} - type websocketChannel struct { - id uint64 - conn *websocket.Conn - out chan *websocketRes - ip string - requestHeader http.Header - alive bool - aliveLock sync.Mutex - addrDescs []string // subscribed address descriptors as strings + id uint64 + conn *websocket.Conn + out chan *WsRes + ip string + requestHeader http.Header + alive bool + aliveLock sync.Mutex + addrDescs []string // subscribed address descriptors as strings + getAddressInfoDescriptorsMux sync.Mutex + getAddressInfoDescriptors map[string]struct{} } // WebsocketServer is a handle to websocket server type WebsocketServer struct { - socket *websocket.Conn upgrader *websocket.Upgrader db *db.RocksDB txCache *db.TxCache @@ -77,12 +69,14 @@ type WebsocketServer struct { addressSubscriptions map[string]map[*websocketChannel]string addressSubscriptionsLock sync.Mutex fiatRatesSubscriptions map[string]map[*websocketChannel]string + fiatRatesTokenSubscriptions map[*websocketChannel][]string fiatRatesSubscriptionsLock sync.Mutex + allowedRpcCallTo map[string]struct{} } // NewWebsocketServer creates new websocket interface to blockbook and returns its handle -func NewWebsocketServer(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState, enableSubNewTx bool) (*WebsocketServer, error) { - api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is) +func NewWebsocketServer(db *db.RocksDB, chain bchain.BlockChain, mempool bchain.Mempool, txCache *db.TxCache, metrics *common.Metrics, is *common.InternalState, fiatRates *fiat.FiatRates) (*WebsocketServer, error) { + api, err := api.NewWorker(db, chain, mempool, txCache, metrics, is, fiatRates) if err != nil { return nil, err } @@ -92,9 +86,10 @@ func NewWebsocketServer(db *db.RocksDB, chain bchain.BlockChain, mempool bchain. } s := &WebsocketServer{ upgrader: &websocket.Upgrader{ - ReadBufferSize: 1024 * 32, - WriteBufferSize: 1024 * 32, - CheckOrigin: checkOrigin, + ReadBufferSize: 1024 * 32, + WriteBufferSize: 1024 * 32, + CheckOrigin: checkOrigin, + EnableCompression: true, }, db: db, txCache: txCache, @@ -106,10 +101,19 @@ func NewWebsocketServer(db *db.RocksDB, chain bchain.BlockChain, mempool bchain. api: api, block0hash: b0, newBlockSubscriptions: make(map[*websocketChannel]string), - newTransactionEnabled: enableSubNewTx, + newTransactionEnabled: is.EnableSubNewTx, newTransactionSubscriptions: make(map[*websocketChannel]string), addressSubscriptions: make(map[string]map[*websocketChannel]string), fiatRatesSubscriptions: make(map[string]map[*websocketChannel]string), + fiatRatesTokenSubscriptions: make(map[*websocketChannel][]string), + } + envRpcCall := os.Getenv(strings.ToUpper(is.GetNetwork()) + "_ALLOWED_RPC_CALL_TO") + if envRpcCall != "" { + s.allowedRpcCallTo = make(map[string]struct{}) + for _, c := range strings.Split(envRpcCall, ",") { + s.allowedRpcCallTo[strings.ToLower(c)] = struct{}{} + } + glog.Info("Support of rpcCall for these contracts: ", envRpcCall) } return s, nil } @@ -120,7 +124,11 @@ func checkOrigin(r *http.Request) bool { } func getIP(r *http.Request) string { - ip := r.Header.Get("X-Real-Ip") + ip := r.Header.Get("cf-connecting-ip") + if ip != "" { + return ip + } + ip = r.Header.Get("X-Real-Ip") if ip != "" { return ip } @@ -130,22 +138,25 @@ func getIP(r *http.Request) string { // ServeHTTP sets up handler of websocket channel func (s *WebsocketServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { - http.Error(w, upgradeFailed+ErrorMethodNotAllowed.Error(), 503) + http.Error(w, upgradeFailed+ErrorMethodNotAllowed.Error(), http.StatusServiceUnavailable) return } conn, err := s.upgrader.Upgrade(w, r, nil) if err != nil { - http.Error(w, upgradeFailed+err.Error(), 503) + http.Error(w, upgradeFailed+err.Error(), http.StatusServiceUnavailable) return } c := &websocketChannel{ id: atomic.AddUint64(&connectionCounter, 1), conn: conn, - out: make(chan *websocketRes, outChannelSize), + out: make(chan *WsRes, outChannelSize), ip: getIP(r), requestHeader: r.Header, alive: true, } + if s.is.WsGetAccountInfoLimit > 0 { + c.getAddressInfoDescriptors = make(map[string]struct{}) + } go s.inputLoop(c) go s.outputLoop(c) s.onConnect(c) @@ -156,11 +167,13 @@ func (s *WebsocketServer) GetHandler() http.Handler { return s } -func (s *WebsocketServer) closeChannel(c *websocketChannel) { +func (s *WebsocketServer) closeChannel(c *websocketChannel) bool { if c.CloseOut() { c.conn.Close() s.onDisconnect(c) + return true } + return false } func (c *websocketChannel) CloseOut() bool { @@ -178,7 +191,7 @@ func (c *websocketChannel) CloseOut() bool { return false } -func (c *websocketChannel) DataOut(data *websocketRes) { +func (c *websocketChannel) DataOut(data *WsRes) { c.aliveLock.Lock() defer c.aliveLock.Unlock() if c.alive { @@ -209,7 +222,7 @@ func (s *WebsocketServer) inputLoop(c *websocketChannel) { } switch t { case websocket.TextMessage: - var req websocketReq + var req WsReq err := json.Unmarshal(d, &req) if err != nil { glog.Error("Error parsing message from ", c.id, ", ", string(d), ", ", err) @@ -223,7 +236,6 @@ func (s *WebsocketServer) inputLoop(c *websocketChannel) { return case websocket.PingMessage: c.conn.WriteControl(websocket.PongMessage, nil, time.Now().Add(defaultTimeout)) - break case websocket.CloseMessage: s.closeChannel(c) return @@ -264,46 +276,62 @@ func (s *WebsocketServer) onDisconnect(c *websocketChannel) { s.metrics.WebsocketClients.Dec() } -var requestHandlers = map[string]func(*WebsocketServer, *websocketChannel, *websocketReq) (interface{}, error){ - "getAccountInfo": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { +var requestHandlers = map[string]func(*WebsocketServer, *websocketChannel, *WsReq) (interface{}, error){ + "getAccountInfo": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { r, err := unmarshalGetAccountInfoRequest(req.Params) if err == nil { + if s.is.WsGetAccountInfoLimit > 0 { + c.getAddressInfoDescriptorsMux.Lock() + c.getAddressInfoDescriptors[r.Descriptor] = struct{}{} + l := len(c.getAddressInfoDescriptors) + c.getAddressInfoDescriptorsMux.Unlock() + if l > s.is.WsGetAccountInfoLimit { + if s.closeChannel(c) { + glog.Info("Client ", c.id, " exceeded getAddressInfo limit, ", c.ip) + s.is.AddWsLimitExceedingIP(c.ip) + } + return + } + } rv, err = s.getAccountInfo(r) } return }, - "getInfo": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "getInfo": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.getInfo() }, - "getBlockHash": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Height int `json:"height"` - }{} + "getBlockHash": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsBlockHashReq{} err = json.Unmarshal(req.Params, &r) if err == nil { rv, err = s.getBlockHash(r.Height) } return }, - "getAccountUtxo": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Descriptor string `json:"descriptor"` - }{} + "getBlock": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + if !s.is.ExtendedIndex { + return nil, errors.New("Not supported") + } + r := WsBlockReq{} + err = json.Unmarshal(req.Params, &r) + if r.PageSize == 0 { + r.PageSize = 1000000 + } + if err == nil { + rv, err = s.getBlock(r.Id, r.Page, r.PageSize) + } + return + }, + "getAccountUtxo": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsAccountUtxoReq{} err = json.Unmarshal(req.Params, &r) if err == nil { rv, err = s.getAccountUtxo(r.Descriptor) } return }, - "getBalanceHistory": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Descriptor string `json:"descriptor"` - From int64 `json:"from"` - To int64 `json:"to"` - Currencies []string `json:"currencies"` - Gap int `json:"gap"` - GroupBy uint32 `json:"groupBy"` - }{} + "getBalanceHistory": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsBalanceHistoryReq{} err = json.Unmarshal(req.Params, &r) if err == nil { if r.From <= 0 { @@ -322,112 +350,137 @@ var requestHandlers = map[string]func(*WebsocketServer, *websocketChannel, *webs } return }, - "getTransaction": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Txid string `json:"txid"` - }{} + "getTransaction": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsTransactionReq{} err = json.Unmarshal(req.Params, &r) if err == nil { rv, err = s.getTransaction(r.Txid) } return }, - "getTransactionSpecific": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Txid string `json:"txid"` - }{} + "getTransactionSpecific": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsTransactionSpecificReq{} err = json.Unmarshal(req.Params, &r) if err == nil { rv, err = s.getTransactionSpecific(r.Txid) } return }, - "estimateFee": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - return s.estimateFee(c, req.Params) + "estimateFee": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + return s.estimateFee(req.Params) + }, + "longTermFeeRate": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + return s.longTermFeeRate() + }, + "sendTransaction": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsSendTransactionReq{} + err = json.Unmarshal(req.Params, &r) + if err == nil { + rv, err = s.sendTransaction(r.Hex, r.DisableAlternativeRPC) + } + return + }, + + "getMempoolFilters": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsMempoolFiltersReq{} + err = json.Unmarshal(req.Params, &r) + if err == nil { + rv, err = s.getMempoolFilters(&r) + } + return + }, + "getBlockFilter": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsBlockFilterReq{} + err = json.Unmarshal(req.Params, &r) + if err == nil { + rv, err = s.getBlockFilter(&r) + } + return }, - "sendTransaction": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Hex string `json:"hex"` - }{} + "getBlockFiltersBatch": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsBlockFiltersBatchReq{} err = json.Unmarshal(req.Params, &r) if err == nil { - rv, err = s.sendTransaction(r.Hex) + rv, err = s.getBlockFiltersBatch(&r) } return }, - "subscribeNewBlock": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "rpcCall": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsRpcCallReq{} + err = json.Unmarshal(req.Params, &r) + if err == nil { + rv, err = s.rpcCall(&r) + } + return + }, + "subscribeNewBlock": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.subscribeNewBlock(c, req) }, - "unsubscribeNewBlock": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "unsubscribeNewBlock": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.unsubscribeNewBlock(c) }, - "subscribeNewTransaction": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "subscribeNewTransaction": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.subscribeNewTransaction(c, req) }, - "unsubscribeNewTransaction": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "unsubscribeNewTransaction": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.unsubscribeNewTransaction(c) }, - "subscribeAddresses": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "subscribeAddresses": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { ad, err := s.unmarshalAddresses(req.Params) if err == nil { rv, err = s.subscribeAddresses(c, ad, req) } return }, - "unsubscribeAddresses": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "unsubscribeAddresses": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.unsubscribeAddresses(c) }, - "subscribeFiatRates": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Currency string `json:"currency"` - }{} + "subscribeFiatRates": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + var r WsSubscribeFiatRatesReq err = json.Unmarshal(req.Params, &r) if err != nil { return nil, err } - return s.subscribeFiatRates(c, strings.ToLower(r.Currency), req) + r.Currency = strings.ToLower(r.Currency) + for i := range r.Tokens { + r.Tokens[i] = strings.ToLower(r.Tokens[i]) + } + return s.subscribeFiatRates(c, &r, req) }, - "unsubscribeFiatRates": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "unsubscribeFiatRates": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { return s.unsubscribeFiatRates(c) }, - "ping": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + "ping": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { r := struct{}{} return r, nil }, - "getCurrentFiatRates": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Currencies []string `json:"currencies"` - }{} + "getCurrentFiatRates": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsCurrentFiatRatesReq{} err = json.Unmarshal(req.Params, &r) if err == nil { - rv, err = s.getCurrentFiatRates(r.Currencies) + rv, err = s.getCurrentFiatRates(r.Currencies, r.Token) } return }, - "getFiatRatesForTimestamps": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Timestamps []int64 `json:"timestamps"` - Currencies []string `json:"currencies"` - }{} + "getFiatRatesForTimestamps": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsFiatRatesForTimestampsReq{} err = json.Unmarshal(req.Params, &r) if err == nil { - rv, err = s.getFiatRatesForTimestamps(r.Timestamps, r.Currencies) + rv, err = s.getFiatRatesForTimestamps(r.Timestamps, r.Currencies, r.Token) } return }, - "getFiatRatesTickersList": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { - r := struct { - Timestamp int64 `json:"timestamp"` - }{} + "getFiatRatesTickersList": func(s *WebsocketServer, c *websocketChannel, req *WsReq) (rv interface{}, err error) { + r := WsFiatRatesTickersListReq{} err = json.Unmarshal(req.Params, &r) if err == nil { - rv, err = s.getFiatRatesTickersList(r.Timestamp) + rv, err = s.getAvailableVsCurrencies(r.Timestamp, r.Token) } return }, } -func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) { +func (s *WebsocketServer) onRequest(c *websocketChannel, req *WsReq) { var err error var data interface{} defer func() { @@ -440,7 +493,7 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) { } // nil data means no response if data != nil { - c.DataOut(&websocketRes{ + c.DataOut(&WsRes{ ID: req.ID, Data: data, }) @@ -449,7 +502,9 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) { }() t := time.Now() s.metrics.WebsocketPendingRequests.With((common.Labels{"method": req.Method})).Inc() - defer s.metrics.WebsocketReqDuration.With(common.Labels{"method": req.Method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds + defer func() { + s.metrics.WebsocketReqDuration.With(common.Labels{"method": req.Method}).Observe(float64(time.Since(t)) / 1e3) // in microseconds + }() f, ok := requestHandlers[req.Method] if ok { data, err = f(s, c, req) @@ -470,20 +525,8 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) { } } -type accountInfoReq struct { - Descriptor string `json:"descriptor"` - Details string `json:"details"` - Tokens string `json:"tokens"` - PageSize int `json:"pageSize"` - Page int `json:"page"` - FromHeight int `json:"from"` - ToHeight int `json:"to"` - ContractFilter string `json:"contractFilter"` - Gap int `json:"gap"` -} - -func unmarshalGetAccountInfoRequest(params []byte) (*accountInfoReq, error) { - var r accountInfoReq +func unmarshalGetAccountInfoRequest(params []byte) (*WsAccountInfoReq, error) { + var r WsAccountInfoReq err := json.Unmarshal(params, &r) if err != nil { return nil, err @@ -491,7 +534,7 @@ func unmarshalGetAccountInfoRequest(params []byte) (*accountInfoReq, error) { return &r, nil } -func (s *WebsocketServer) getAccountInfo(req *accountInfoReq) (res *api.Address, err error) { +func (s *WebsocketServer) getAccountInfo(req *WsAccountInfoReq) (res *api.Address, err error) { var opt api.AccountDetails switch req.Details { case "tokens": @@ -526,14 +569,14 @@ func (s *WebsocketServer) getAccountInfo(req *accountInfoReq) (res *api.Address, if req.PageSize == 0 { req.PageSize = txsOnPage } - a, err := s.api.GetXpubAddress(req.Descriptor, req.Page, req.PageSize, opt, &filter, req.Gap) + a, err := s.api.GetXpubAddress(req.Descriptor, req.Page, req.PageSize, opt, &filter, req.Gap, strings.ToLower(req.SecondaryCurrency)) if err != nil { - return s.api.GetAddress(req.Descriptor, req.Page, req.PageSize, opt, &filter) + return s.api.GetAddress(req.Descriptor, req.Page, req.PageSize, opt, &filter, strings.ToLower(req.SecondaryCurrency)) } return a, nil } -func (s *WebsocketServer) getAccountUtxo(descriptor string) (interface{}, error) { +func (s *WebsocketServer) getAccountUtxo(descriptor string) (api.Utxos, error) { utxo, err := s.api.GetXpubUtxo(descriptor, false, 0) if err != nil { return s.api.GetAddressUtxo(descriptor, false) @@ -541,7 +584,7 @@ func (s *WebsocketServer) getAccountUtxo(descriptor string) (interface{}, error) return utxo, nil } -func (s *WebsocketServer) getTransaction(txid string) (interface{}, error) { +func (s *WebsocketServer) getTransaction(txid string) (*api.Tx, error) { return s.api.GetTransaction(txid, false, false) } @@ -549,90 +592,120 @@ func (s *WebsocketServer) getTransactionSpecific(txid string) (interface{}, erro return s.chain.GetTransactionSpecific(&bchain.Tx{Txid: txid}) } -func (s *WebsocketServer) getInfo() (interface{}, error) { +func (s *WebsocketServer) getInfo() (*WsInfoRes, error) { vi := common.GetVersionInfo() bi := s.is.GetBackendInfo() height, hash, err := s.db.GetBestBlock() if err != nil { return nil, err } - type backendInfo struct { - Version string `json:"version,omitempty"` - Subversion string `json:"subversion,omitempty"` - Consensus interface{} `json:"consensus,omitempty"` - } - type info struct { - Name string `json:"name"` - Shortcut string `json:"shortcut"` - Decimals int `json:"decimals"` - Version string `json:"version"` - BestHeight int `json:"bestHeight"` - BestHash string `json:"bestHash"` - Block0Hash string `json:"block0Hash"` - Testnet bool `json:"testnet"` - Backend backendInfo `json:"backend"` - } - return &info{ + return &WsInfoRes{ Name: s.is.Coin, Shortcut: s.is.CoinShortcut, + Network: s.is.GetNetwork(), Decimals: s.chainParser.AmountDecimals(), BestHeight: int(height), BestHash: hash, Version: vi.Version, Block0Hash: s.block0hash, Testnet: s.chain.IsTestnet(), - Backend: backendInfo{ - Version: bi.Version, - Subversion: bi.Subversion, - Consensus: bi.Consensus, + Backend: WsBackendInfo{ + Version: bi.Version, + Subversion: bi.Subversion, + ConsensusVersion: bi.ConsensusVersion, + Consensus: bi.Consensus, }, }, nil } -func (s *WebsocketServer) getBlockHash(height int) (interface{}, error) { +func (s *WebsocketServer) getBlockHash(height int) (*WsBlockHashRes, error) { h, err := s.db.GetBlockHash(uint32(height)) if err != nil { return nil, err } - type hash struct { - Hash string `json:"hash"` - } - return &hash{ + return &WsBlockHashRes{ Hash: h, }, nil } -func (s *WebsocketServer) estimateFee(c *websocketChannel, params []byte) (interface{}, error) { - type estimateFeeReq struct { - Blocks []int `json:"blocks"` - Specific map[string]interface{} `json:"specific"` +func (s *WebsocketServer) getBlock(id string, page, pageSize int) (interface{}, error) { + block, err := s.api.GetBlock(id, page, pageSize) + if err != nil { + return nil, err } - type estimateFeeRes struct { - FeePerTx string `json:"feePerTx,omitempty"` - FeePerUnit string `json:"feePerUnit,omitempty"` - FeeLimit string `json:"feeLimit,omitempty"` + return block, nil +} + +func eip1559FeesToApi(fee *bchain.Eip1559Fee) *api.Eip1559Fee { + if fee == nil { + return nil } - var r estimateFeeReq + apiFee := api.Eip1559Fee{} + apiFee.MaxFeePerGas = (*api.Amount)(fee.MaxFeePerGas) + apiFee.MaxPriorityFeePerGas = (*api.Amount)(fee.MaxPriorityFeePerGas) + apiFee.MaxWaitTimeEstimate = fee.MaxWaitTimeEstimate + apiFee.MinWaitTimeEstimate = fee.MinWaitTimeEstimate + return &apiFee +} + +func eip1559FeeRangeToApi(feeRange []*big.Int) []*api.Amount { + if feeRange == nil { + return nil + } + apiFeeRange := make([]*api.Amount, len(feeRange)) + for i := range feeRange { + apiFeeRange[i] = (*api.Amount)(feeRange[i]) + } + return apiFeeRange +} + +func (s *WebsocketServer) estimateFee(params []byte) (interface{}, error) { + var r WsEstimateFeeReq err := json.Unmarshal(params, &r) if err != nil { return nil, err } - res := make([]estimateFeeRes, len(r.Blocks)) + res := make([]WsEstimateFeeRes, len(r.Blocks)) if s.chainParser.GetChainType() == bchain.ChainEthereumType { gas, err := s.chain.EthereumTypeEstimateGas(r.Specific) if err != nil { return nil, err } sg := strconv.FormatUint(gas, 10) - for i, b := range r.Blocks { - fee, err := s.chain.EstimateSmartFee(b, true) - if err != nil { - return nil, err - } + b := 1 + if len(r.Blocks) > 0 { + b = r.Blocks[0] + } + fee, err := s.api.EstimateFee(b, true) + if err != nil { + return nil, err + } + feePerTx := new(big.Int) + feePerTx.Mul(&fee, new(big.Int).SetUint64(gas)) + eip1559, err := s.chain.EthereumTypeGetEip1559Fees() + if err != nil { + return nil, err + } + var eip1559Api *api.Eip1559Fees + if eip1559 != nil { + eip1559Api = &api.Eip1559Fees{} + eip1559Api.BaseFeePerGas = (*api.Amount)(eip1559.BaseFeePerGas) + eip1559Api.Instant = eip1559FeesToApi(eip1559.Instant) + eip1559Api.High = eip1559FeesToApi(eip1559.High) + eip1559Api.Medium = eip1559FeesToApi(eip1559.Medium) + eip1559Api.Low = eip1559FeesToApi(eip1559.Low) + eip1559Api.NetworkCongestion = eip1559.NetworkCongestion + eip1559Api.BaseFeeTrend = eip1559.BaseFeeTrend + eip1559Api.PriorityFeeTrend = eip1559.PriorityFeeTrend + eip1559Api.LatestPriorityFeeRange = eip1559FeeRangeToApi(eip1559.LatestPriorityFeeRange) + eip1559Api.HistoricalBaseFeeRange = eip1559FeeRangeToApi(eip1559.HistoricalBaseFeeRange) + eip1559Api.HistoricalPriorityFeeRange = eip1559FeeRangeToApi(eip1559.HistoricalPriorityFeeRange) + } + for i := range r.Blocks { res[i].FeePerUnit = fee.String() res[i].FeeLimit = sg - fee.Mul(&fee, new(big.Int).SetUint64(gas)) - res[i].FeePerTx = fee.String() + res[i].FeePerTx = feePerTx.String() + res[i].Eip1559 = eip1559Api } } else { conservative := true @@ -652,7 +725,7 @@ func (s *WebsocketServer) estimateFee(c *websocketChannel, params []byte) (inter } } for i, b := range r.Blocks { - fee, err := s.api.BitcoinTypeEstimateFee(b, conservative) + fee, err := s.api.EstimateFee(b, conservative) if err != nil { return nil, err } @@ -668,8 +741,19 @@ func (s *WebsocketServer) estimateFee(c *websocketChannel, params []byte) (inter return res, nil } -func (s *WebsocketServer) sendTransaction(tx string) (res resultSendTransaction, err error) { - txid, err := s.chain.SendRawTransaction(tx) +func (s *WebsocketServer) longTermFeeRate() (res interface{}, err error) { + feeRate, err := s.chain.LongTermFeeRate() + if err != nil { + return nil, err + } + return WsLongTermFeeRateRes{ + FeePerUnit: feeRate.FeePerUnit.String(), + Blocks: feeRate.Blocks, + }, nil +} + +func (s *WebsocketServer) sendTransaction(tx string, disableAlternativeRPC bool) (res resultSendTransaction, err error) { + txid, err := s.chain.SendRawTransaction(tx, disableAlternativeRPC) if err != nil { return res, err } @@ -677,6 +761,83 @@ func (s *WebsocketServer) sendTransaction(tx string) (res resultSendTransaction, return } +func (s *WebsocketServer) getMempoolFilters(r *WsMempoolFiltersReq) (res interface{}, err error) { + type resMempoolFilters struct { + ParamP uint8 `json:"P"` + ParamM uint64 `json:"M"` + ZeroedKey bool `json:"zeroedKey"` + Entries map[string]string `json:"entries"` + } + filterEntries, err := s.mempool.GetTxidFilterEntries(r.ScriptType, r.FromTimestamp) + if err != nil { + return nil, err + } + return resMempoolFilters{ + ParamP: s.is.BlockGolombFilterP, + ParamM: bchain.GetGolombParamM(s.is.BlockGolombFilterP), + ZeroedKey: filterEntries.UsedZeroedKey, + Entries: filterEntries.Entries, + }, nil +} + +func (s *WebsocketServer) getBlockFilter(r *WsBlockFilterReq) (res interface{}, err error) { + type resBlockFilter struct { + ParamP uint8 `json:"P"` + ParamM uint64 `json:"M"` + ZeroedKey bool `json:"zeroedKey"` + BlockFilter string `json:"blockFilter"` + } + if s.is.BlockFilterScripts != r.ScriptType { + return nil, errors.Errorf("Unsupported script type %s", r.ScriptType) + } + blockFilter, err := s.db.GetBlockFilter(r.BlockHash) + if err != nil { + return nil, err + } + return resBlockFilter{ + ParamP: s.is.BlockGolombFilterP, + ParamM: bchain.GetGolombParamM(s.is.BlockGolombFilterP), + ZeroedKey: s.is.BlockFilterUseZeroedKey, + BlockFilter: blockFilter, + }, nil +} + +func (s *WebsocketServer) getBlockFiltersBatch(r *WsBlockFiltersBatchReq) (res interface{}, err error) { + type resBlockFiltersBatch struct { + ParamP uint8 `json:"P"` + ParamM uint64 `json:"M"` + ZeroedKey bool `json:"zeroedKey"` + BlockFiltersBatch []string `json:"blockFiltersBatch"` + } + if s.is.BlockFilterScripts != r.ScriptType { + return nil, errors.Errorf("Unsupported script type %s", r.ScriptType) + } + blockFiltersBatch, err := s.api.GetBlockFiltersBatch(r.BlockHash, r.PageSize) + if err != nil { + return nil, err + } + return resBlockFiltersBatch{ + ParamP: s.is.BlockGolombFilterP, + ParamM: bchain.GetGolombParamM(s.is.BlockGolombFilterP), + ZeroedKey: s.is.BlockFilterUseZeroedKey, + BlockFiltersBatch: blockFiltersBatch, + }, nil +} + +func (s *WebsocketServer) rpcCall(r *WsRpcCallReq) (*WsRpcCallRes, error) { + if s.allowedRpcCallTo != nil { + _, ok := s.allowedRpcCallTo[strings.ToLower(r.To)] + if !ok { + return nil, errors.New("Not supported") + } + } + data, err := s.chain.EthereumTypeRpcCall(r.Data, r.To, r.From) + if err != nil { + return nil, err + } + return &WsRpcCallRes{Data: data}, nil +} + type subscriptionResponse struct { Subscribed bool `json:"subscribed"` } @@ -685,7 +846,7 @@ type subscriptionResponseMessage struct { Message string `json:"message"` } -func (s *WebsocketServer) subscribeNewBlock(c *websocketChannel, req *websocketReq) (res interface{}, err error) { +func (s *WebsocketServer) subscribeNewBlock(c *websocketChannel, req *WsReq) (res interface{}, err error) { s.newBlockSubscriptionsLock.Lock() defer s.newBlockSubscriptionsLock.Unlock() s.newBlockSubscriptions[c] = req.ID @@ -701,7 +862,7 @@ func (s *WebsocketServer) unsubscribeNewBlock(c *websocketChannel) (res interfac return &subscriptionResponse{false}, nil } -func (s *WebsocketServer) subscribeNewTransaction(c *websocketChannel, req *websocketReq) (res interface{}, err error) { +func (s *WebsocketServer) subscribeNewTransaction(c *websocketChannel, req *WsReq) (res interface{}, err error) { s.newTransactionSubscriptionsLock.Lock() defer s.newTransactionSubscriptionsLock.Unlock() if !s.newTransactionEnabled { @@ -724,9 +885,7 @@ func (s *WebsocketServer) unsubscribeNewTransaction(c *websocketChannel) (res in } func (s *WebsocketServer) unmarshalAddresses(params []byte) ([]string, error) { - r := struct { - Addresses []string `json:"addresses"` - }{} + r := WsSubscribeAddressesReq{} err := json.Unmarshal(params, &r) if err != nil { return nil, err @@ -742,7 +901,7 @@ func (s *WebsocketServer) unmarshalAddresses(params []byte) ([]string, error) { return rv, nil } -// unsubscribe addresses without addressSubscriptionsLock - can be called only from subscribeAddresses and unsubscribeAddresses +// doUnsubscribeAddresses addresses without addressSubscriptionsLock - can be called only from subscribeAddresses and unsubscribeAddresses func (s *WebsocketServer) doUnsubscribeAddresses(c *websocketChannel) { for _, ads := range c.addrDescs { sa, e := s.addressSubscriptions[ads] @@ -760,7 +919,7 @@ func (s *WebsocketServer) doUnsubscribeAddresses(c *websocketChannel) { c.addrDescs = nil } -func (s *WebsocketServer) subscribeAddresses(c *websocketChannel, addrDesc []string, req *websocketReq) (res interface{}, err error) { +func (s *WebsocketServer) subscribeAddresses(c *websocketChannel, addrDesc []string, req *WsReq) (res interface{}, err error) { s.addressSubscriptionsLock.Lock() defer s.addressSubscriptionsLock.Unlock() // unsubscribe all previous subscriptions @@ -787,7 +946,7 @@ func (s *WebsocketServer) unsubscribeAddresses(c *websocketChannel) (res interfa return &subscriptionResponse{false}, nil } -// unsubscribe fiat rates without fiatRatesSubscriptionsLock - can be called only from subscribeFiatRates and unsubscribeFiatRates +// doUnsubscribeFiatRates fiat rates without fiatRatesSubscriptionsLock - can be called only from subscribeFiatRates and unsubscribeFiatRates func (s *WebsocketServer) doUnsubscribeFiatRates(c *websocketChannel) { for fr, sa := range s.fiatRatesSubscriptions { for sc := range sa { @@ -799,16 +958,20 @@ func (s *WebsocketServer) doUnsubscribeFiatRates(c *websocketChannel) { delete(s.fiatRatesSubscriptions, fr) } } + delete(s.fiatRatesTokenSubscriptions, c) } // subscribeFiatRates subscribes all FiatRates subscriptions by this channel -func (s *WebsocketServer) subscribeFiatRates(c *websocketChannel, currency string, req *websocketReq) (res interface{}, err error) { +func (s *WebsocketServer) subscribeFiatRates(c *websocketChannel, d *WsSubscribeFiatRatesReq, req *WsReq) (res interface{}, err error) { s.fiatRatesSubscriptionsLock.Lock() defer s.fiatRatesSubscriptionsLock.Unlock() // unsubscribe all previous subscriptions s.doUnsubscribeFiatRates(c) + currency := d.Currency if currency == "" { currency = allFiatRates + } else { + currency = strings.ToLower(currency) } as, ok := s.fiatRatesSubscriptions[currency] if !ok { @@ -816,6 +979,9 @@ func (s *WebsocketServer) subscribeFiatRates(c *websocketChannel, currency strin s.fiatRatesSubscriptions[currency] = as } as[c] = req.ID + if len(d.Tokens) != 0 { + s.fiatRatesTokenSubscriptions[c] = d.Tokens + } s.metrics.WebsocketSubscribes.With((common.Labels{"method": "subscribeFiatRates"})).Set(float64(len(s.fiatRatesSubscriptions))) return &subscriptionResponse{true}, nil } @@ -840,7 +1006,7 @@ func (s *WebsocketServer) onNewBlockAsync(hash string, height uint32) { Hash: hash, } for c, id := range s.newBlockSubscriptions { - c.DataOut(&websocketRes{ + c.DataOut(&WsRes{ ID: id, Data: &data, }) @@ -857,7 +1023,7 @@ func (s *WebsocketServer) sendOnNewTx(tx *api.Tx) { s.newTransactionSubscriptionsLock.Lock() defer s.newTransactionSubscriptionsLock.Unlock() for c, id := range s.newTransactionSubscriptions { - c.DataOut(&websocketRes{ + c.DataOut(&WsRes{ ID: id, Data: &tx, }) @@ -885,7 +1051,7 @@ func (s *WebsocketServer) sendOnNewTxAddr(stringAddressDescriptor string, tx *ap as, ok := s.addressSubscriptions[stringAddressDescriptor] if ok { for c, id := range as { - c.DataOut(&websocketRes{ + c.DataOut(&WsRes{ ID: id, Data: &data, }) @@ -896,7 +1062,7 @@ func (s *WebsocketServer) sendOnNewTxAddr(stringAddressDescriptor string, tx *ap } func (s *WebsocketServer) getNewTxSubscriptions(tx *bchain.MempoolTx) map[string]struct{} { - // check if there is any subscription in inputs, outputs and erc20 + // check if there is any subscription in inputs, outputs and token transfers s.addressSubscriptionsLock.Lock() defer s.addressSubscriptionsLock.Unlock() subscribed := make(map[string]struct{}) @@ -919,8 +1085,8 @@ func (s *WebsocketServer) getNewTxSubscriptions(tx *bchain.MempoolTx) map[string } } } - for i := range tx.Erc20 { - addrDesc, err := s.chainParser.GetAddrDescFromAddress(tx.Erc20[i].From) + for i := range tx.TokenTransfers { + addrDesc, err := s.chainParser.GetAddrDescFromAddress(tx.TokenTransfers[i].From) if err == nil && len(addrDesc) > 0 { sad := string(addrDesc) as, ok := s.addressSubscriptions[sad] @@ -928,7 +1094,7 @@ func (s *WebsocketServer) getNewTxSubscriptions(tx *bchain.MempoolTx) map[string subscribed[sad] = struct{}{} } } - addrDesc, err = s.chainParser.GetAddrDescFromAddress(tx.Erc20[i].To) + addrDesc, err = s.chainParser.GetAddrDescFromAddress(tx.TokenTransfers[i].To) if err == nil && len(addrDesc) > 0 { sad := string(addrDesc) as, ok := s.addressSubscriptions[sad] @@ -960,7 +1126,7 @@ func (s *WebsocketServer) OnNewTx(tx *bchain.MempoolTx) { } } -func (s *WebsocketServer) broadcastTicker(currency string, rates map[string]float64) { +func (s *WebsocketServer) broadcastTicker(currency string, rates map[string]float32, ticker *common.CurrencyRatesTicker) { as, ok := s.fiatRatesSubscriptions[currency] if ok && len(as) > 0 { data := struct { @@ -969,36 +1135,60 @@ func (s *WebsocketServer) broadcastTicker(currency string, rates map[string]floa Rates: rates, } for c, id := range as { - c.DataOut(&websocketRes{ - ID: id, - Data: &data, - }) + var tokens []string + if ticker != nil { + tokens = s.fiatRatesTokenSubscriptions[c] + } + if len(tokens) > 0 { + dataWithTokens := struct { + Rates interface{} `json:"rates"` + TokenRates map[string]float32 `json:"tokenRates,omitempty"` + }{ + Rates: rates, + TokenRates: map[string]float32{}, + } + for _, token := range tokens { + rate := ticker.TokenRateInCurrency(token, currency) + if rate > 0 { + dataWithTokens.TokenRates[token] = rate + } + } + c.DataOut(&WsRes{ + ID: id, + Data: &dataWithTokens, + }) + } else { + c.DataOut(&WsRes{ + ID: id, + Data: &data, + }) + } } glog.Info("broadcasting new rates for currency ", currency, " to ", len(as), " channels") } } // OnNewFiatRatesTicker is a callback that broadcasts info about fiat rates affecting subscribed currency -func (s *WebsocketServer) OnNewFiatRatesTicker(ticker *db.CurrencyRatesTicker) { +func (s *WebsocketServer) OnNewFiatRatesTicker(ticker *common.CurrencyRatesTicker) { s.fiatRatesSubscriptionsLock.Lock() defer s.fiatRatesSubscriptionsLock.Unlock() for currency, rate := range ticker.Rates { - s.broadcastTicker(currency, map[string]float64{currency: rate}) + s.broadcastTicker(currency, map[string]float32{currency: rate}, ticker) } - s.broadcastTicker(allFiatRates, ticker.Rates) + s.broadcastTicker(allFiatRates, ticker.Rates, nil) } -func (s *WebsocketServer) getCurrentFiatRates(currencies []string) (interface{}, error) { - ret, err := s.api.GetCurrentFiatRates(currencies) +func (s *WebsocketServer) getCurrentFiatRates(currencies []string, token string) (*api.FiatTicker, error) { + ret, err := s.api.GetCurrentFiatRates(currencies, strings.ToLower(token)) return ret, err } -func (s *WebsocketServer) getFiatRatesForTimestamps(timestamps []int64, currencies []string) (interface{}, error) { - ret, err := s.api.GetFiatRatesForTimestamps(timestamps, currencies) +func (s *WebsocketServer) getFiatRatesForTimestamps(timestamps []int64, currencies []string, token string) (*api.FiatTickers, error) { + ret, err := s.api.GetFiatRatesForTimestamps(timestamps, currencies, strings.ToLower(token)) return ret, err } -func (s *WebsocketServer) getFiatRatesTickersList(timestamp int64) (interface{}, error) { - ret, err := s.api.GetFiatRatesTickersList(timestamp) +func (s *WebsocketServer) getAvailableVsCurrencies(timestamp int64, token string) (*api.AvailableVsCurrencies, error) { + ret, err := s.api.GetAvailableVsCurrencies(timestamp, strings.ToLower(token)) return ret, err } diff --git a/server/ws_types.go b/server/ws_types.go new file mode 100644 index 0000000000..3f17f6cea7 --- /dev/null +++ b/server/ws_types.go @@ -0,0 +1,188 @@ +package server + +import ( + "encoding/json" + + "github.com/trezor/blockbook/api" +) + +// WsReq represents a generic WebSocket request with an ID, method, and raw parameters. +type WsReq struct { + ID string `json:"id" ts_doc:"Unique request identifier."` + Method string `json:"method" ts_type:"'getAccountInfo' | 'getInfo' | 'getBlockHash'| 'getBlock' | 'getAccountUtxo' | 'getBalanceHistory' | 'getTransaction' | 'getTransactionSpecific' | 'estimateFee' | 'sendTransaction' | 'subscribeNewBlock' | 'unsubscribeNewBlock' | 'subscribeNewTransaction' | 'unsubscribeNewTransaction' | 'subscribeAddresses' | 'unsubscribeAddresses' | 'subscribeFiatRates' | 'unsubscribeFiatRates' | 'ping' | 'getCurrentFiatRates' | 'getFiatRatesForTimestamps' | 'getFiatRatesTickersList' | 'getMempoolFilters'" ts_doc:"Requested method name."` + Params json.RawMessage `json:"params" ts_type:"any" ts_doc:"Parameters for the requested method in raw JSON format."` +} + +// WsRes represents a generic WebSocket response with an ID and arbitrary data. +type WsRes struct { + ID string `json:"id" ts_doc:"Corresponding request identifier."` + Data interface{} `json:"data" ts_doc:"Payload of the response, structure depends on the request."` +} + +// WsAccountInfoReq carries parameters for the 'getAccountInfo' method. +type WsAccountInfoReq struct { + Descriptor string `json:"descriptor" ts_doc:"Address or XPUB descriptor to query."` + Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs'" ts_doc:"Level of detail to retrieve about the account."` + Tokens string `json:"tokens,omitempty" ts_type:"'derived' | 'used' | 'nonzero'" ts_doc:"Which tokens to include in the account info."` + PageSize int `json:"pageSize,omitempty" ts_doc:"Number of items per page, if paging is used."` + Page int `json:"page,omitempty" ts_doc:"Requested page index, if paging is used."` + FromHeight int `json:"from,omitempty" ts_doc:"Starting block height for transaction filtering."` + ToHeight int `json:"to,omitempty" ts_doc:"Ending block height for transaction filtering."` + ContractFilter string `json:"contractFilter,omitempty" ts_doc:"Filter by specific contract address (for token data)."` + SecondaryCurrency string `json:"secondaryCurrency,omitempty" ts_doc:"Currency code to convert values into (e.g. 'USD')."` + Gap int `json:"gap,omitempty" ts_doc:"Gap limit for XPUB scanning, if relevant."` +} + +// WsBackendInfo holds extended info about the connected backend node. +type WsBackendInfo struct { + Version string `json:"version,omitempty" ts_doc:"Backend version string."` + Subversion string `json:"subversion,omitempty" ts_doc:"Backend sub-version string."` + ConsensusVersion string `json:"consensus_version,omitempty" ts_doc:"Consensus protocol version in use."` + Consensus interface{} `json:"consensus,omitempty" ts_doc:"Additional consensus details, structure depends on blockchain."` +} + +// WsInfoRes is returned by 'getInfo' requests, containing basic blockchain info. +type WsInfoRes struct { + Name string `json:"name" ts_doc:"Human-readable blockchain name."` + Shortcut string `json:"shortcut" ts_doc:"Short code for the blockchain (e.g. BTC, ETH)."` + Network string `json:"network" ts_doc:"Network identifier (e.g. mainnet, testnet)."` + Decimals int `json:"decimals" ts_doc:"Number of decimals in the base unit of the coin."` + Version string `json:"version" ts_doc:"Version of the blockbook or backend service."` + BestHeight int `json:"bestHeight" ts_doc:"Current best chain height according to the backend."` + BestHash string `json:"bestHash" ts_doc:"Block hash of the best (latest) block."` + Block0Hash string `json:"block0Hash" ts_doc:"Genesis block hash or identifier."` + Testnet bool `json:"testnet" ts_doc:"Indicates if this is a test network."` + Backend WsBackendInfo `json:"backend" ts_doc:"Additional backend-related information."` +} + +// WsBlockHashReq holds a single integer for querying the block hash at that height. +type WsBlockHashReq struct { + Height int `json:"height" ts_doc:"Block height for which the hash is requested."` +} + +// WsBlockHashRes returns the block hash for a requested height. +type WsBlockHashRes struct { + Hash string `json:"hash" ts_doc:"Block hash at the requested height."` +} + +// WsBlockReq is used to request details of a block (by ID) with paging options. +type WsBlockReq struct { + Id string `json:"id" ts_doc:"Block identifier (hash)."` + PageSize int `json:"pageSize,omitempty" ts_doc:"Number of transactions per page in the block."` + Page int `json:"page,omitempty" ts_doc:"Page index to retrieve if multiple pages of transactions are available."` +} + +// WsAccountUtxoReq is used to request unspent transaction outputs (UTXOs) for a given xpub/address. +type WsAccountUtxoReq struct { + Descriptor string `json:"descriptor" ts_doc:"Address or XPUB descriptor to retrieve UTXOs for."` +} + +// WsBalanceHistoryReq is used to retrieve a historical balance chart or intervals for an account. +type WsBalanceHistoryReq struct { + Descriptor string `json:"descriptor" ts_doc:"Address or XPUB descriptor to query history for."` + From int64 `json:"from,omitempty" ts_doc:"Unix timestamp from which to start the history."` + To int64 `json:"to,omitempty" ts_doc:"Unix timestamp at which to end the history."` + Currencies []string `json:"currencies,omitempty" ts_doc:"List of currency codes for which to fetch exchange rates at each interval."` + Gap int `json:"gap,omitempty" ts_doc:"Gap limit for XPUB scanning, if relevant."` + GroupBy uint32 `json:"groupBy,omitempty" ts_doc:"Size of each aggregated time window in seconds."` +} + +// WsTransactionReq requests details for a specific transaction by its txid. +type WsTransactionReq struct { + Txid string `json:"txid" ts_doc:"Transaction ID to retrieve details for."` +} + +// WsMempoolFiltersReq requests mempool filters for scripts of a specific type, after a given timestamp. +type WsMempoolFiltersReq struct { + ScriptType string `json:"scriptType" ts_doc:"Type of script we are filtering for (e.g., P2PKH, P2SH)."` + FromTimestamp uint32 `json:"fromTimestamp" ts_doc:"Only retrieve filters for mempool txs after this timestamp."` + ParamM uint64 `json:"M,omitempty" ts_doc:"Optional parameter for certain filter logic (e.g., n-bloom)."` +} + +// WsBlockFilterReq requests a filter for a given block hash and script type. +type WsBlockFilterReq struct { + ScriptType string `json:"scriptType" ts_doc:"Type of script filter (e.g., P2PKH, P2SH)."` + BlockHash string `json:"blockHash" ts_doc:"Block hash for which we want the filter."` + ParamM uint64 `json:"M,omitempty" ts_doc:"Optional parameter for certain filter logic."` +} + +// WsBlockFiltersBatchReq is used to request batch filters for consecutive blocks. +type WsBlockFiltersBatchReq struct { + ScriptType string `json:"scriptType" ts_doc:"Type of script filter (e.g., P2PKH, P2SH)."` + BlockHash string `json:"bestKnownBlockHash" ts_doc:"Hash of the latest known block. Filters will be retrieved backward from here."` + PageSize int `json:"pageSize,omitempty" ts_doc:"Number of block filters per request."` + ParamM uint64 `json:"M,omitempty" ts_doc:"Optional parameter for certain filter logic."` +} + +// WsTransactionSpecificReq requests blockchain-specific transaction info that might go beyond standard fields. +type WsTransactionSpecificReq struct { + Txid string `json:"txid" ts_doc:"Transaction ID for the detailed blockchain-specific data."` +} + +// WsEstimateFeeReq requests an estimation of transaction fees for a set of blocks or with specific parameters. +type WsEstimateFeeReq struct { + Blocks []int `json:"blocks,omitempty" ts_doc:"Block confirmations targets for which fees should be estimated."` + Specific map[string]interface{} `json:"specific,omitempty" ts_type:"{conservative?: boolean; txsize?: number; from?: string; to?: string; data?: string; value?: string;}" ts_doc:"Additional chain-specific parameters (e.g. for Ethereum)."` +} + +// WsEstimateFeeRes is returned in response to a fee estimation request. +type WsEstimateFeeRes struct { + FeePerTx string `json:"feePerTx,omitempty" ts_doc:"Estimated total fee per transaction, if relevant."` + FeePerUnit string `json:"feePerUnit,omitempty" ts_doc:"Estimated fee per unit (sat/byte, Wei/gas, etc.)."` + FeeLimit string `json:"feeLimit,omitempty" ts_doc:"Max fee limit for blockchains like Ethereum."` + Eip1559 *api.Eip1559Fees `json:"eip1559,omitempty"` +} + +// WsLongTermFeeRateRes is returned in response to a long term fee rate request. +type WsLongTermFeeRateRes struct { + FeePerUnit string `json:"feePerUnit" ts_doc:"Long term fee rate (in sat/kByte)."` + Blocks uint64 `json:"blocks" ts_doc:"Amount of blocks used for the long term fee rate estimation."` +} + +// WsSendTransactionReq is used to broadcast a transaction to the network. +type WsSendTransactionReq struct { + Hex string `json:"hex,omitempty" ts_doc:"Hex-encoded transaction data to broadcast (string format)."` + DisableAlternativeRPC bool `json:"disableAlternativeRpc" ts_doc:"Use alternative RPC method to broadcast transaction."` +} + +// WsSubscribeAddressesReq is used to subscribe to updates on a list of addresses. +type WsSubscribeAddressesReq struct { + Addresses []string `json:"addresses" ts_doc:"List of addresses to subscribe for updates (e.g., new transactions)."` +} + +// WsSubscribeFiatRatesReq subscribes to updates of fiat rates for a specific currency or set of tokens. +type WsSubscribeFiatRatesReq struct { + Currency string `json:"currency,omitempty" ts_doc:"Fiat currency code (e.g. 'USD')."` + Tokens []string `json:"tokens,omitempty" ts_doc:"List of token symbols or IDs to get fiat rates for."` +} + +// WsCurrentFiatRatesReq requests the current fiat rates for specified currencies (and optionally a token). +type WsCurrentFiatRatesReq struct { + Currencies []string `json:"currencies,omitempty" ts_doc:"List of fiat currencies, e.g. ['USD','EUR']."` + Token string `json:"token,omitempty" ts_doc:"Token symbol or ID if asking for token fiat rates (e.g. 'ETH')."` +} + +// WsFiatRatesForTimestampsReq requests historical fiat rates for given timestamps. +type WsFiatRatesForTimestampsReq struct { + Timestamps []int64 `json:"timestamps" ts_doc:"List of Unix timestamps for which to retrieve fiat rates."` + Currencies []string `json:"currencies,omitempty" ts_doc:"List of fiat currencies, e.g. ['USD','EUR']."` + Token string `json:"token,omitempty" ts_doc:"Token symbol or ID if asking for token fiat rates."` +} + +// WsFiatRatesTickersListReq requests a list of tickers for a given timestamp (and possibly a token). +type WsFiatRatesTickersListReq struct { + Timestamp int64 `json:"timestamp,omitempty" ts_doc:"Timestamp for which the list of available tickers is needed."` + Token string `json:"token,omitempty" ts_doc:"Token symbol or ID if asking for token-specific fiat rates."` +} + +// WsRpcCallReq is used for raw RPC calls (for example, on an Ethereum-like backend). +type WsRpcCallReq struct { + From string `json:"from,omitempty" ts_doc:"Address from which the RPC call is originated (if relevant)."` + To string `json:"to" ts_doc:"Contract or address to which the RPC call is made."` + Data string `json:"data" ts_doc:"Hex-encoded call data (function signature + parameters)."` +} + +// WsRpcCallRes returns the result of an RPC call in hex form. +type WsRpcCallRes struct { + Data string `json:"data" ts_doc:"Hex-encoded return data from the call."` +} diff --git a/shell.nix b/shell.nix index 89b2034ce5..ee60043428 100644 --- a/shell.nix +++ b/shell.nix @@ -11,6 +11,7 @@ stdenv.mkDerivation { snappy zeromq zlib + gcc ]; shellHook = '' export CGO_LDFLAGS="-L${stdenv.cc.cc.lib}/lib -lrocksdb -lz -lbz2 -lsnappy -llz4 -lm -lstdc++" diff --git a/static/css/TTHoves/TTHoves-Black.woff b/static/css/TTHoves/TTHoves-Black.woff new file mode 100644 index 0000000000..e30243577e Binary files /dev/null and b/static/css/TTHoves/TTHoves-Black.woff differ diff --git a/static/css/TTHoves/TTHoves-Black.woff2 b/static/css/TTHoves/TTHoves-Black.woff2 new file mode 100644 index 0000000000..c815059747 Binary files /dev/null and b/static/css/TTHoves/TTHoves-Black.woff2 differ diff --git a/static/css/TTHoves/TTHoves-Bold.woff b/static/css/TTHoves/TTHoves-Bold.woff new file mode 100644 index 0000000000..96630ca3cf Binary files /dev/null and b/static/css/TTHoves/TTHoves-Bold.woff differ diff --git a/static/css/TTHoves/TTHoves-Bold.woff2 b/static/css/TTHoves/TTHoves-Bold.woff2 new file mode 100644 index 0000000000..8f1fd69015 Binary files /dev/null and b/static/css/TTHoves/TTHoves-Bold.woff2 differ diff --git a/static/css/TTHoves/TTHoves-BoldItalic.woff b/static/css/TTHoves/TTHoves-BoldItalic.woff new file mode 100644 index 0000000000..3c76f859b6 Binary files /dev/null and b/static/css/TTHoves/TTHoves-BoldItalic.woff differ diff --git a/static/css/TTHoves/TTHoves-BoldItalic.woff2 b/static/css/TTHoves/TTHoves-BoldItalic.woff2 new file mode 100644 index 0000000000..5fa30f302e Binary files /dev/null and b/static/css/TTHoves/TTHoves-BoldItalic.woff2 differ diff --git a/static/css/TTHoves/TTHoves-DemiBold.woff b/static/css/TTHoves/TTHoves-DemiBold.woff new file mode 100644 index 0000000000..6dc9af24c3 Binary files /dev/null and b/static/css/TTHoves/TTHoves-DemiBold.woff differ diff --git a/static/css/TTHoves/TTHoves-DemiBold.woff2 b/static/css/TTHoves/TTHoves-DemiBold.woff2 new file mode 100644 index 0000000000..ca31b22821 Binary files /dev/null and b/static/css/TTHoves/TTHoves-DemiBold.woff2 differ diff --git a/static/css/TTHoves/TTHoves-ExtraBold.woff b/static/css/TTHoves/TTHoves-ExtraBold.woff new file mode 100644 index 0000000000..43ab1969a7 Binary files /dev/null and b/static/css/TTHoves/TTHoves-ExtraBold.woff differ diff --git a/static/css/TTHoves/TTHoves-ExtraBold.woff2 b/static/css/TTHoves/TTHoves-ExtraBold.woff2 new file mode 100644 index 0000000000..c37df5c4ec Binary files /dev/null and b/static/css/TTHoves/TTHoves-ExtraBold.woff2 differ diff --git a/static/css/TTHoves/TTHoves-ExtraLight.woff b/static/css/TTHoves/TTHoves-ExtraLight.woff new file mode 100644 index 0000000000..e7e8aa2337 Binary files /dev/null and b/static/css/TTHoves/TTHoves-ExtraLight.woff differ diff --git a/static/css/TTHoves/TTHoves-ExtraLight.woff2 b/static/css/TTHoves/TTHoves-ExtraLight.woff2 new file mode 100644 index 0000000000..15db8acd73 Binary files /dev/null and b/static/css/TTHoves/TTHoves-ExtraLight.woff2 differ diff --git a/static/css/TTHoves/TTHoves-Light.woff b/static/css/TTHoves/TTHoves-Light.woff new file mode 100644 index 0000000000..be30da280d Binary files /dev/null and b/static/css/TTHoves/TTHoves-Light.woff differ diff --git a/static/css/TTHoves/TTHoves-Light.woff2 b/static/css/TTHoves/TTHoves-Light.woff2 new file mode 100644 index 0000000000..4a57aeb4eb Binary files /dev/null and b/static/css/TTHoves/TTHoves-Light.woff2 differ diff --git a/static/css/TTHoves/TTHoves-Medium.woff b/static/css/TTHoves/TTHoves-Medium.woff new file mode 100644 index 0000000000..3277fb8ac8 Binary files /dev/null and b/static/css/TTHoves/TTHoves-Medium.woff differ diff --git a/static/css/TTHoves/TTHoves-Medium.woff2 b/static/css/TTHoves/TTHoves-Medium.woff2 new file mode 100644 index 0000000000..3dae893a1a Binary files /dev/null and b/static/css/TTHoves/TTHoves-Medium.woff2 differ diff --git a/static/css/TTHoves/TTHoves-Regular.woff b/static/css/TTHoves/TTHoves-Regular.woff new file mode 100644 index 0000000000..dd7b6fe5d0 Binary files /dev/null and b/static/css/TTHoves/TTHoves-Regular.woff differ diff --git a/static/css/TTHoves/TTHoves-Regular.woff2 b/static/css/TTHoves/TTHoves-Regular.woff2 new file mode 100644 index 0000000000..a2cddb2908 Binary files /dev/null and b/static/css/TTHoves/TTHoves-Regular.woff2 differ diff --git a/static/css/TTHoves/TTHoves.css b/static/css/TTHoves/TTHoves.css new file mode 100644 index 0000000000..2d2b8a3066 --- /dev/null +++ b/static/css/TTHoves/TTHoves.css @@ -0,0 +1,39 @@ +@font-face { + font-family: 'TT Hoves'; + src: url('./TTHoves-Bold.woff2') format('woff2'), + url('./TTHoves-Bold.woff') format('woff'); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: 'TT Hoves'; + src: url('./TTHoves-Regular.woff2') format('woff2'), + url('./TTHoves-Regular.woff') format('woff'); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'TT Hoves'; + src: url('./TTHoves-Light.woff2') format('woff2'), + url('./TTHoves-Light.woff') format('woff'); + font-weight: 300; + font-style: normal; +} + +@font-face { + font-family: 'TT Hoves'; + src: url('./TTHoves-DemiBold.woff2') format('woff2'), + url('./TTHoves-DemiBold.woff') format('woff'); + font-weight: 600; + font-style: normal; +} + +@font-face { + font-family: 'TT Hoves'; + src: url('./TTHoves-Medium.woff2') format('woff2'), + url('./TTHoves-Medium.woff') format('woff'); + font-weight: 500; + font-style: normal; +} \ No newline at end of file diff --git a/static/css/bootstrap.5.2.2.min.css b/static/css/bootstrap.5.2.2.min.css new file mode 100644 index 0000000000..1359b3b721 --- /dev/null +++ b/static/css/bootstrap.5.2.2.min.css @@ -0,0 +1,7 @@ +@charset "UTF-8";/*! + * Bootstrap v5.2.2 (https://getbootstrap.com/) + * Copyright 2011-2022 The Bootstrap Authors + * Copyright 2011-2022 Twitter, Inc. + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */:root{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-black:#000;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13,110,253;--bs-secondary-rgb:108,117,125;--bs-success-rgb:25,135,84;--bs-info-rgb:13,202,240;--bs-warning-rgb:255,193,7;--bs-danger-rgb:220,53,69;--bs-light-rgb:248,249,250;--bs-dark-rgb:33,37,41;--bs-white-rgb:255,255,255;--bs-black-rgb:0,0,0;--bs-body-color-rgb:33,37,41;--bs-body-bg-rgb:255,255,255;--bs-font-sans-serif:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--bs-font-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-bg:#fff;--bs-border-width:1px;--bs-border-style:solid;--bs-border-color:#dee2e6;--bs-border-color-translucent:rgba(0, 0, 0, 0.175);--bs-border-radius:0.375rem;--bs-border-radius-sm:0.25rem;--bs-border-radius-lg:0.5rem;--bs-border-radius-xl:1rem;--bs-border-radius-2xl:2rem;--bs-border-radius-pill:50rem;--bs-link-color:#0d6efd;--bs-link-hover-color:#0a58ca;--bs-code-color:#d63384;--bs-highlight-bg:#fff3cd}*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;border:0;border-top:1px solid;opacity:.25}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}.h1,h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,h1{font-size:2.5rem}}.h2,h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,h2{font-size:2rem}}.h3,h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){.h3,h3{font-size:1.75rem}}.h4,h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){.h4,h4{font-size:1.5rem}}.h5,h5{font-size:1.25rem}.h6,h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}.small,small{font-size:.875em}.mark,mark{padding:.1875em;background-color:var(--bs-highlight-bg)}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:var(--bs-link-color);text-decoration:underline}a:hover{color:var(--bs-link-hover-color)}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:var(--bs-font-monospace);font-size:1em}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:var(--bs-code-color);word-wrap:break-word}a>code{color:inherit}kbd{padding:.1875rem .375rem;font-size:.875em;color:var(--bs-body-bg);background-color:var(--bs-body-color);border-radius:.25rem}kbd kbd{padding:0;font-size:1em}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]:not([type=date]):not([type=datetime-local]):not([type=month]):not([type=week]):not([type=time])::-webkit-calendar-picker-indicator{display:none!important}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}::file-selector-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}.lead{font-size:1.25rem;font-weight:300}.display-1{font-size:calc(1.625rem + 4.5vw);font-weight:300;line-height:1.2}@media (min-width:1200px){.display-1{font-size:5rem}}.display-2{font-size:calc(1.575rem + 3.9vw);font-weight:300;line-height:1.2}@media (min-width:1200px){.display-2{font-size:4.5rem}}.display-3{font-size:calc(1.525rem + 3.3vw);font-weight:300;line-height:1.2}@media (min-width:1200px){.display-3{font-size:4rem}}.display-4{font-size:calc(1.475rem + 2.7vw);font-weight:300;line-height:1.2}@media (min-width:1200px){.display-4{font-size:3.5rem}}.display-5{font-size:calc(1.425rem + 2.1vw);font-weight:300;line-height:1.2}@media (min-width:1200px){.display-5{font-size:3rem}}.display-6{font-size:calc(1.375rem + 1.5vw);font-weight:300;line-height:1.2}@media (min-width:1200px){.display-6{font-size:2.5rem}}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline-item{display:inline-block}.list-inline-item:not(:last-child){margin-right:.5rem}.initialism{font-size:.875em;text-transform:uppercase}.blockquote{margin-bottom:1rem;font-size:1.25rem}.blockquote>:last-child{margin-bottom:0}.blockquote-footer{margin-top:-1rem;margin-bottom:1rem;font-size:.875em;color:#6c757d}.blockquote-footer::before{content:"— "}.img-fluid{max-width:100%;height:auto}.img-thumbnail{padding:.25rem;background-color:#fff;border:1px solid var(--bs-border-color);border-radius:.375rem;max-width:100%;height:auto}.figure{display:inline-block}.figure-img{margin-bottom:.5rem;line-height:1}.figure-caption{font-size:.875em;color:#6c757d}.container,.container-fluid,.container-lg,.container-md,.container-sm,.container-xl,.container-xxl{--bs-gutter-x:1.5rem;--bs-gutter-y:0;width:100%;padding-right:calc(var(--bs-gutter-x) * .5);padding-left:calc(var(--bs-gutter-x) * .5);margin-right:auto;margin-left:auto}@media (min-width:576px){.container,.container-sm{max-width:540px}}@media (min-width:768px){.container,.container-md,.container-sm{max-width:720px}}@media (min-width:992px){.container,.container-lg,.container-md,.container-sm{max-width:960px}}@media (min-width:1200px){.container,.container-lg,.container-md,.container-sm,.container-xl{max-width:1140px}}@media (min-width:1400px){.container,.container-lg,.container-md,.container-sm,.container-xl,.container-xxl{max-width:1320px}}.row{--bs-gutter-x:1.5rem;--bs-gutter-y:0;display:flex;flex-wrap:wrap;margin-top:calc(-1 * var(--bs-gutter-y));margin-right:calc(-.5 * var(--bs-gutter-x));margin-left:calc(-.5 * var(--bs-gutter-x))}.row>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x) * .5);padding-left:calc(var(--bs-gutter-x) * .5);margin-top:var(--bs-gutter-y)}.col{flex:1 0 0%}.row-cols-auto>*{flex:0 0 auto;width:auto}.row-cols-1>*{flex:0 0 auto;width:100%}.row-cols-2>*{flex:0 0 auto;width:50%}.row-cols-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-4>*{flex:0 0 auto;width:25%}.row-cols-5>*{flex:0 0 auto;width:20%}.row-cols-6>*{flex:0 0 auto;width:16.6666666667%}.col-auto{flex:0 0 auto;width:auto}.col-1{flex:0 0 auto;width:8.33333333%}.col-2{flex:0 0 auto;width:16.66666667%}.col-3{flex:0 0 auto;width:25%}.col-4{flex:0 0 auto;width:33.33333333%}.col-5{flex:0 0 auto;width:41.66666667%}.col-6{flex:0 0 auto;width:50%}.col-7{flex:0 0 auto;width:58.33333333%}.col-8{flex:0 0 auto;width:66.66666667%}.col-9{flex:0 0 auto;width:75%}.col-10{flex:0 0 auto;width:83.33333333%}.col-11{flex:0 0 auto;width:91.66666667%}.col-12{flex:0 0 auto;width:100%}.offset-1{margin-left:8.33333333%}.offset-2{margin-left:16.66666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.33333333%}.offset-5{margin-left:41.66666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.33333333%}.offset-8{margin-left:66.66666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.33333333%}.offset-11{margin-left:91.66666667%}.g-0,.gx-0{--bs-gutter-x:0}.g-0,.gy-0{--bs-gutter-y:0}.g-1,.gx-1{--bs-gutter-x:0.25rem}.g-1,.gy-1{--bs-gutter-y:0.25rem}.g-2,.gx-2{--bs-gutter-x:0.5rem}.g-2,.gy-2{--bs-gutter-y:0.5rem}.g-3,.gx-3{--bs-gutter-x:1rem}.g-3,.gy-3{--bs-gutter-y:1rem}.g-4,.gx-4{--bs-gutter-x:1.5rem}.g-4,.gy-4{--bs-gutter-y:1.5rem}.g-5,.gx-5{--bs-gutter-x:3rem}.g-5,.gy-5{--bs-gutter-y:3rem}@media (min-width:576px){.col-sm{flex:1 0 0%}.row-cols-sm-auto>*{flex:0 0 auto;width:auto}.row-cols-sm-1>*{flex:0 0 auto;width:100%}.row-cols-sm-2>*{flex:0 0 auto;width:50%}.row-cols-sm-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-sm-4>*{flex:0 0 auto;width:25%}.row-cols-sm-5>*{flex:0 0 auto;width:20%}.row-cols-sm-6>*{flex:0 0 auto;width:16.6666666667%}.col-sm-auto{flex:0 0 auto;width:auto}.col-sm-1{flex:0 0 auto;width:8.33333333%}.col-sm-2{flex:0 0 auto;width:16.66666667%}.col-sm-3{flex:0 0 auto;width:25%}.col-sm-4{flex:0 0 auto;width:33.33333333%}.col-sm-5{flex:0 0 auto;width:41.66666667%}.col-sm-6{flex:0 0 auto;width:50%}.col-sm-7{flex:0 0 auto;width:58.33333333%}.col-sm-8{flex:0 0 auto;width:66.66666667%}.col-sm-9{flex:0 0 auto;width:75%}.col-sm-10{flex:0 0 auto;width:83.33333333%}.col-sm-11{flex:0 0 auto;width:91.66666667%}.col-sm-12{flex:0 0 auto;width:100%}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.33333333%}.offset-sm-2{margin-left:16.66666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.33333333%}.offset-sm-5{margin-left:41.66666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.33333333%}.offset-sm-8{margin-left:66.66666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.33333333%}.offset-sm-11{margin-left:91.66666667%}.g-sm-0,.gx-sm-0{--bs-gutter-x:0}.g-sm-0,.gy-sm-0{--bs-gutter-y:0}.g-sm-1,.gx-sm-1{--bs-gutter-x:0.25rem}.g-sm-1,.gy-sm-1{--bs-gutter-y:0.25rem}.g-sm-2,.gx-sm-2{--bs-gutter-x:0.5rem}.g-sm-2,.gy-sm-2{--bs-gutter-y:0.5rem}.g-sm-3,.gx-sm-3{--bs-gutter-x:1rem}.g-sm-3,.gy-sm-3{--bs-gutter-y:1rem}.g-sm-4,.gx-sm-4{--bs-gutter-x:1.5rem}.g-sm-4,.gy-sm-4{--bs-gutter-y:1.5rem}.g-sm-5,.gx-sm-5{--bs-gutter-x:3rem}.g-sm-5,.gy-sm-5{--bs-gutter-y:3rem}}@media (min-width:768px){.col-md{flex:1 0 0%}.row-cols-md-auto>*{flex:0 0 auto;width:auto}.row-cols-md-1>*{flex:0 0 auto;width:100%}.row-cols-md-2>*{flex:0 0 auto;width:50%}.row-cols-md-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-md-4>*{flex:0 0 auto;width:25%}.row-cols-md-5>*{flex:0 0 auto;width:20%}.row-cols-md-6>*{flex:0 0 auto;width:16.6666666667%}.col-md-auto{flex:0 0 auto;width:auto}.col-md-1{flex:0 0 auto;width:8.33333333%}.col-md-2{flex:0 0 auto;width:16.66666667%}.col-md-3{flex:0 0 auto;width:25%}.col-md-4{flex:0 0 auto;width:33.33333333%}.col-md-5{flex:0 0 auto;width:41.66666667%}.col-md-6{flex:0 0 auto;width:50%}.col-md-7{flex:0 0 auto;width:58.33333333%}.col-md-8{flex:0 0 auto;width:66.66666667%}.col-md-9{flex:0 0 auto;width:75%}.col-md-10{flex:0 0 auto;width:83.33333333%}.col-md-11{flex:0 0 auto;width:91.66666667%}.col-md-12{flex:0 0 auto;width:100%}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.33333333%}.offset-md-2{margin-left:16.66666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.33333333%}.offset-md-5{margin-left:41.66666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.33333333%}.offset-md-8{margin-left:66.66666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.33333333%}.offset-md-11{margin-left:91.66666667%}.g-md-0,.gx-md-0{--bs-gutter-x:0}.g-md-0,.gy-md-0{--bs-gutter-y:0}.g-md-1,.gx-md-1{--bs-gutter-x:0.25rem}.g-md-1,.gy-md-1{--bs-gutter-y:0.25rem}.g-md-2,.gx-md-2{--bs-gutter-x:0.5rem}.g-md-2,.gy-md-2{--bs-gutter-y:0.5rem}.g-md-3,.gx-md-3{--bs-gutter-x:1rem}.g-md-3,.gy-md-3{--bs-gutter-y:1rem}.g-md-4,.gx-md-4{--bs-gutter-x:1.5rem}.g-md-4,.gy-md-4{--bs-gutter-y:1.5rem}.g-md-5,.gx-md-5{--bs-gutter-x:3rem}.g-md-5,.gy-md-5{--bs-gutter-y:3rem}}@media (min-width:992px){.col-lg{flex:1 0 0%}.row-cols-lg-auto>*{flex:0 0 auto;width:auto}.row-cols-lg-1>*{flex:0 0 auto;width:100%}.row-cols-lg-2>*{flex:0 0 auto;width:50%}.row-cols-lg-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-lg-4>*{flex:0 0 auto;width:25%}.row-cols-lg-5>*{flex:0 0 auto;width:20%}.row-cols-lg-6>*{flex:0 0 auto;width:16.6666666667%}.col-lg-auto{flex:0 0 auto;width:auto}.col-lg-1{flex:0 0 auto;width:8.33333333%}.col-lg-2{flex:0 0 auto;width:16.66666667%}.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-11{flex:0 0 auto;width:91.66666667%}.col-lg-12{flex:0 0 auto;width:100%}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.33333333%}.offset-lg-2{margin-left:16.66666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.33333333%}.offset-lg-5{margin-left:41.66666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.33333333%}.offset-lg-8{margin-left:66.66666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.33333333%}.offset-lg-11{margin-left:91.66666667%}.g-lg-0,.gx-lg-0{--bs-gutter-x:0}.g-lg-0,.gy-lg-0{--bs-gutter-y:0}.g-lg-1,.gx-lg-1{--bs-gutter-x:0.25rem}.g-lg-1,.gy-lg-1{--bs-gutter-y:0.25rem}.g-lg-2,.gx-lg-2{--bs-gutter-x:0.5rem}.g-lg-2,.gy-lg-2{--bs-gutter-y:0.5rem}.g-lg-3,.gx-lg-3{--bs-gutter-x:1rem}.g-lg-3,.gy-lg-3{--bs-gutter-y:1rem}.g-lg-4,.gx-lg-4{--bs-gutter-x:1.5rem}.g-lg-4,.gy-lg-4{--bs-gutter-y:1.5rem}.g-lg-5,.gx-lg-5{--bs-gutter-x:3rem}.g-lg-5,.gy-lg-5{--bs-gutter-y:3rem}}@media (min-width:1200px){.col-xl{flex:1 0 0%}.row-cols-xl-auto>*{flex:0 0 auto;width:auto}.row-cols-xl-1>*{flex:0 0 auto;width:100%}.row-cols-xl-2>*{flex:0 0 auto;width:50%}.row-cols-xl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xl-4>*{flex:0 0 auto;width:25%}.row-cols-xl-5>*{flex:0 0 auto;width:20%}.row-cols-xl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xl-auto{flex:0 0 auto;width:auto}.col-xl-1{flex:0 0 auto;width:8.33333333%}.col-xl-2{flex:0 0 auto;width:16.66666667%}.col-xl-3{flex:0 0 auto;width:25%}.col-xl-4{flex:0 0 auto;width:33.33333333%}.col-xl-5{flex:0 0 auto;width:41.66666667%}.col-xl-6{flex:0 0 auto;width:50%}.col-xl-7{flex:0 0 auto;width:58.33333333%}.col-xl-8{flex:0 0 auto;width:66.66666667%}.col-xl-9{flex:0 0 auto;width:75%}.col-xl-10{flex:0 0 auto;width:83.33333333%}.col-xl-11{flex:0 0 auto;width:91.66666667%}.col-xl-12{flex:0 0 auto;width:100%}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.33333333%}.offset-xl-2{margin-left:16.66666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.33333333%}.offset-xl-5{margin-left:41.66666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.33333333%}.offset-xl-8{margin-left:66.66666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.33333333%}.offset-xl-11{margin-left:91.66666667%}.g-xl-0,.gx-xl-0{--bs-gutter-x:0}.g-xl-0,.gy-xl-0{--bs-gutter-y:0}.g-xl-1,.gx-xl-1{--bs-gutter-x:0.25rem}.g-xl-1,.gy-xl-1{--bs-gutter-y:0.25rem}.g-xl-2,.gx-xl-2{--bs-gutter-x:0.5rem}.g-xl-2,.gy-xl-2{--bs-gutter-y:0.5rem}.g-xl-3,.gx-xl-3{--bs-gutter-x:1rem}.g-xl-3,.gy-xl-3{--bs-gutter-y:1rem}.g-xl-4,.gx-xl-4{--bs-gutter-x:1.5rem}.g-xl-4,.gy-xl-4{--bs-gutter-y:1.5rem}.g-xl-5,.gx-xl-5{--bs-gutter-x:3rem}.g-xl-5,.gy-xl-5{--bs-gutter-y:3rem}}@media (min-width:1400px){.col-xxl{flex:1 0 0%}.row-cols-xxl-auto>*{flex:0 0 auto;width:auto}.row-cols-xxl-1>*{flex:0 0 auto;width:100%}.row-cols-xxl-2>*{flex:0 0 auto;width:50%}.row-cols-xxl-3>*{flex:0 0 auto;width:33.3333333333%}.row-cols-xxl-4>*{flex:0 0 auto;width:25%}.row-cols-xxl-5>*{flex:0 0 auto;width:20%}.row-cols-xxl-6>*{flex:0 0 auto;width:16.6666666667%}.col-xxl-auto{flex:0 0 auto;width:auto}.col-xxl-1{flex:0 0 auto;width:8.33333333%}.col-xxl-2{flex:0 0 auto;width:16.66666667%}.col-xxl-3{flex:0 0 auto;width:25%}.col-xxl-4{flex:0 0 auto;width:33.33333333%}.col-xxl-5{flex:0 0 auto;width:41.66666667%}.col-xxl-6{flex:0 0 auto;width:50%}.col-xxl-7{flex:0 0 auto;width:58.33333333%}.col-xxl-8{flex:0 0 auto;width:66.66666667%}.col-xxl-9{flex:0 0 auto;width:75%}.col-xxl-10{flex:0 0 auto;width:83.33333333%}.col-xxl-11{flex:0 0 auto;width:91.66666667%}.col-xxl-12{flex:0 0 auto;width:100%}.offset-xxl-0{margin-left:0}.offset-xxl-1{margin-left:8.33333333%}.offset-xxl-2{margin-left:16.66666667%}.offset-xxl-3{margin-left:25%}.offset-xxl-4{margin-left:33.33333333%}.offset-xxl-5{margin-left:41.66666667%}.offset-xxl-6{margin-left:50%}.offset-xxl-7{margin-left:58.33333333%}.offset-xxl-8{margin-left:66.66666667%}.offset-xxl-9{margin-left:75%}.offset-xxl-10{margin-left:83.33333333%}.offset-xxl-11{margin-left:91.66666667%}.g-xxl-0,.gx-xxl-0{--bs-gutter-x:0}.g-xxl-0,.gy-xxl-0{--bs-gutter-y:0}.g-xxl-1,.gx-xxl-1{--bs-gutter-x:0.25rem}.g-xxl-1,.gy-xxl-1{--bs-gutter-y:0.25rem}.g-xxl-2,.gx-xxl-2{--bs-gutter-x:0.5rem}.g-xxl-2,.gy-xxl-2{--bs-gutter-y:0.5rem}.g-xxl-3,.gx-xxl-3{--bs-gutter-x:1rem}.g-xxl-3,.gy-xxl-3{--bs-gutter-y:1rem}.g-xxl-4,.gx-xxl-4{--bs-gutter-x:1.5rem}.g-xxl-4,.gy-xxl-4{--bs-gutter-y:1.5rem}.g-xxl-5,.gx-xxl-5{--bs-gutter-x:3rem}.g-xxl-5,.gy-xxl-5{--bs-gutter-y:3rem}}.table{--bs-table-color:var(--bs-body-color);--bs-table-bg:transparent;--bs-table-border-color:var(--bs-border-color);--bs-table-accent-bg:transparent;--bs-table-striped-color:var(--bs-body-color);--bs-table-striped-bg:rgba(0, 0, 0, 0.05);--bs-table-active-color:var(--bs-body-color);--bs-table-active-bg:rgba(0, 0, 0, 0.1);--bs-table-hover-color:var(--bs-body-color);--bs-table-hover-bg:rgba(0, 0, 0, 0.075);width:100%;margin-bottom:1rem;color:var(--bs-table-color);vertical-align:top;border-color:var(--bs-table-border-color)}.table>:not(caption)>*>*{padding:.5rem .5rem;background-color:var(--bs-table-bg);border-bottom-width:1px;box-shadow:inset 0 0 0 9999px var(--bs-table-accent-bg)}.table>tbody{vertical-align:inherit}.table>thead{vertical-align:bottom}.table-group-divider{border-top:2px solid currentcolor}.caption-top{caption-side:top}.table-sm>:not(caption)>*>*{padding:.25rem .25rem}.table-bordered>:not(caption)>*{border-width:1px 0}.table-bordered>:not(caption)>*>*{border-width:0 1px}.table-borderless>:not(caption)>*>*{border-bottom-width:0}.table-borderless>:not(:first-child){border-top-width:0}.table-striped>tbody>tr:nth-of-type(odd)>*{--bs-table-accent-bg:var(--bs-table-striped-bg);color:var(--bs-table-striped-color)}.table-striped-columns>:not(caption)>tr>:nth-child(2n){--bs-table-accent-bg:var(--bs-table-striped-bg);color:var(--bs-table-striped-color)}.table-active{--bs-table-accent-bg:var(--bs-table-active-bg);color:var(--bs-table-active-color)}.table-hover>tbody>tr:hover>*{--bs-table-accent-bg:var(--bs-table-hover-bg);color:var(--bs-table-hover-color)}.table-primary{--bs-table-color:#000;--bs-table-bg:#cfe2ff;--bs-table-border-color:#bacbe6;--bs-table-striped-bg:#c5d7f2;--bs-table-striped-color:#000;--bs-table-active-bg:#bacbe6;--bs-table-active-color:#000;--bs-table-hover-bg:#bfd1ec;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-secondary{--bs-table-color:#000;--bs-table-bg:#e2e3e5;--bs-table-border-color:#cbccce;--bs-table-striped-bg:#d7d8da;--bs-table-striped-color:#000;--bs-table-active-bg:#cbccce;--bs-table-active-color:#000;--bs-table-hover-bg:#d1d2d4;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-success{--bs-table-color:#000;--bs-table-bg:#d1e7dd;--bs-table-border-color:#bcd0c7;--bs-table-striped-bg:#c7dbd2;--bs-table-striped-color:#000;--bs-table-active-bg:#bcd0c7;--bs-table-active-color:#000;--bs-table-hover-bg:#c1d6cc;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-info{--bs-table-color:#000;--bs-table-bg:#cff4fc;--bs-table-border-color:#badce3;--bs-table-striped-bg:#c5e8ef;--bs-table-striped-color:#000;--bs-table-active-bg:#badce3;--bs-table-active-color:#000;--bs-table-hover-bg:#bfe2e9;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-warning{--bs-table-color:#000;--bs-table-bg:#fff3cd;--bs-table-border-color:#e6dbb9;--bs-table-striped-bg:#f2e7c3;--bs-table-striped-color:#000;--bs-table-active-bg:#e6dbb9;--bs-table-active-color:#000;--bs-table-hover-bg:#ece1be;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-danger{--bs-table-color:#000;--bs-table-bg:#f8d7da;--bs-table-border-color:#dfc2c4;--bs-table-striped-bg:#eccccf;--bs-table-striped-color:#000;--bs-table-active-bg:#dfc2c4;--bs-table-active-color:#000;--bs-table-hover-bg:#e5c7ca;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-light{--bs-table-color:#000;--bs-table-bg:#f8f9fa;--bs-table-border-color:#dfe0e1;--bs-table-striped-bg:#ecedee;--bs-table-striped-color:#000;--bs-table-active-bg:#dfe0e1;--bs-table-active-color:#000;--bs-table-hover-bg:#e5e6e7;--bs-table-hover-color:#000;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-dark{--bs-table-color:#fff;--bs-table-bg:#212529;--bs-table-border-color:#373b3e;--bs-table-striped-bg:#2c3034;--bs-table-striped-color:#fff;--bs-table-active-bg:#373b3e;--bs-table-active-color:#fff;--bs-table-hover-bg:#323539;--bs-table-hover-color:#fff;color:var(--bs-table-color);border-color:var(--bs-table-border-color)}.table-responsive{overflow-x:auto;-webkit-overflow-scrolling:touch}@media (max-width:575.98px){.table-responsive-sm{overflow-x:auto;-webkit-overflow-scrolling:touch}}@media (max-width:767.98px){.table-responsive-md{overflow-x:auto;-webkit-overflow-scrolling:touch}}@media (max-width:991.98px){.table-responsive-lg{overflow-x:auto;-webkit-overflow-scrolling:touch}}@media (max-width:1199.98px){.table-responsive-xl{overflow-x:auto;-webkit-overflow-scrolling:touch}}@media (max-width:1399.98px){.table-responsive-xxl{overflow-x:auto;-webkit-overflow-scrolling:touch}}.form-label{margin-bottom:.5rem}.col-form-label{padding-top:calc(.375rem + 1px);padding-bottom:calc(.375rem + 1px);margin-bottom:0;font-size:inherit;line-height:1.5}.col-form-label-lg{padding-top:calc(.5rem + 1px);padding-bottom:calc(.5rem + 1px);font-size:1.25rem}.col-form-label-sm{padding-top:calc(.25rem + 1px);padding-bottom:calc(.25rem + 1px);font-size:.875rem}.form-text{margin-top:.25rem;font-size:.875em;color:#6c757d}.form-control{display:block;width:100%;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;background-clip:padding-box;border:1px solid #ced4da;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.375rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control[type=file]{overflow:hidden}.form-control[type=file]:not(:disabled):not([readonly]){cursor:pointer}.form-control:focus{color:#212529;background-color:#fff;border-color:#86b7fe;outline:0;box-shadow:0 0 0 .25rem rgba(13,110,253,.25)}.form-control::-webkit-date-and-time-value{height:1.5em}.form-control::-moz-placeholder{color:#6c757d;opacity:1}.form-control::placeholder{color:#6c757d;opacity:1}.form-control:disabled{background-color:#e9ecef;opacity:1}.form-control::-webkit-file-upload-button{padding:.375rem .75rem;margin:-.375rem -.75rem;-webkit-margin-end:.75rem;margin-inline-end:.75rem;color:#212529;background-color:#e9ecef;pointer-events:none;border-color:inherit;border-style:solid;border-width:0;border-inline-end-width:1px;border-radius:0;-webkit-transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}.form-control::file-selector-button{padding:.375rem .75rem;margin:-.375rem -.75rem;-webkit-margin-end:.75rem;margin-inline-end:.75rem;color:#212529;background-color:#e9ecef;pointer-events:none;border-color:inherit;border-style:solid;border-width:0;border-inline-end-width:1px;border-radius:0;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-control::-webkit-file-upload-button{-webkit-transition:none;transition:none}.form-control::file-selector-button{transition:none}}.form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button{background-color:#dde0e3}.form-control:hover:not(:disabled):not([readonly])::file-selector-button{background-color:#dde0e3}.form-control-plaintext{display:block;width:100%;padding:.375rem 0;margin-bottom:0;line-height:1.5;color:#212529;background-color:transparent;border:solid transparent;border-width:1px 0}.form-control-plaintext:focus{outline:0}.form-control-plaintext.form-control-lg,.form-control-plaintext.form-control-sm{padding-right:0;padding-left:0}.form-control-sm{min-height:calc(1.5em + .5rem + 2px);padding:.25rem .5rem;font-size:.875rem;border-radius:.25rem}.form-control-sm::-webkit-file-upload-button{padding:.25rem .5rem;margin:-.25rem -.5rem;-webkit-margin-end:.5rem;margin-inline-end:.5rem}.form-control-sm::file-selector-button{padding:.25rem .5rem;margin:-.25rem -.5rem;-webkit-margin-end:.5rem;margin-inline-end:.5rem}.form-control-lg{min-height:calc(1.5em + 1rem + 2px);padding:.5rem 1rem;font-size:1.25rem;border-radius:.5rem}.form-control-lg::-webkit-file-upload-button{padding:.5rem 1rem;margin:-.5rem -1rem;-webkit-margin-end:1rem;margin-inline-end:1rem}.form-control-lg::file-selector-button{padding:.5rem 1rem;margin:-.5rem -1rem;-webkit-margin-end:1rem;margin-inline-end:1rem}textarea.form-control{min-height:calc(1.5em + .75rem + 2px)}textarea.form-control-sm{min-height:calc(1.5em + .5rem + 2px)}textarea.form-control-lg{min-height:calc(1.5em + 1rem + 2px)}.form-control-color{width:3rem;height:calc(1.5em + .75rem + 2px);padding:.375rem}.form-control-color:not(:disabled):not([readonly]){cursor:pointer}.form-control-color::-moz-color-swatch{border:0!important;border-radius:.375rem}.form-control-color::-webkit-color-swatch{border-radius:.375rem}.form-control-color.form-control-sm{height:calc(1.5em + .5rem + 2px)}.form-control-color.form-control-lg{height:calc(1.5em + 1rem + 2px)}.form-select{display:block;width:100%;padding:.375rem 2.25rem .375rem .75rem;-moz-padding-start:calc(0.75rem - 3px);font-size:1rem;font-weight:400;line-height:1.5;color:#212529;background-color:#fff;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");background-repeat:no-repeat;background-position:right .75rem center;background-size:16px 12px;border:1px solid #ced4da;border-radius:.375rem;transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:none;-moz-appearance:none;appearance:none}@media (prefers-reduced-motion:reduce){.form-select{transition:none}}.form-select:focus{border-color:#86b7fe;outline:0;box-shadow:0 0 0 .25rem rgba(13,110,253,.25)}.form-select[multiple],.form-select[size]:not([size="1"]){padding-right:.75rem;background-image:none}.form-select:disabled{background-color:#e9ecef}.form-select:-moz-focusring{color:transparent;text-shadow:0 0 0 #212529}.form-select-sm{padding-top:.25rem;padding-bottom:.25rem;padding-left:.5rem;font-size:.875rem;border-radius:.25rem}.form-select-lg{padding-top:.5rem;padding-bottom:.5rem;padding-left:1rem;font-size:1.25rem;border-radius:.5rem}.form-check{display:block;min-height:1.5rem;padding-left:1.5em;margin-bottom:.125rem}.form-check .form-check-input{float:left;margin-left:-1.5em}.form-check-reverse{padding-right:1.5em;padding-left:0;text-align:right}.form-check-reverse .form-check-input{float:right;margin-right:-1.5em;margin-left:0}.form-check-input{width:1em;height:1em;margin-top:.25em;vertical-align:top;background-color:#fff;background-repeat:no-repeat;background-position:center;background-size:contain;border:1px solid rgba(0,0,0,.25);-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-print-color-adjust:exact;color-adjust:exact;print-color-adjust:exact}.form-check-input[type=checkbox]{border-radius:.25em}.form-check-input[type=radio]{border-radius:50%}.form-check-input:active{filter:brightness(90%)}.form-check-input:focus{border-color:#86b7fe;outline:0;box-shadow:0 0 0 .25rem rgba(13,110,253,.25)}.form-check-input:checked{background-color:#0d6efd;border-color:#0d6efd}.form-check-input:checked[type=checkbox]{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e")}.form-check-input:checked[type=radio]{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e")}.form-check-input[type=checkbox]:indeterminate{background-color:#0d6efd;border-color:#0d6efd;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e")}.form-check-input:disabled{pointer-events:none;filter:none;opacity:.5}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:default;opacity:.5}.form-switch{padding-left:2.5em}.form-switch .form-check-input{width:2em;margin-left:-2.5em;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");background-position:left center;border-radius:2em;transition:background-position .15s ease-in-out}@media (prefers-reduced-motion:reduce){.form-switch .form-check-input{transition:none}}.form-switch .form-check-input:focus{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2386b7fe'/%3e%3c/svg%3e")}.form-switch .form-check-input:checked{background-position:right center;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e")}.form-switch.form-check-reverse{padding-right:2.5em;padding-left:0}.form-switch.form-check-reverse .form-check-input{margin-right:-2.5em;margin-left:0}.form-check-inline{display:inline-block;margin-right:1rem}.btn-check{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.btn-check:disabled+.btn,.btn-check[disabled]+.btn{pointer-events:none;filter:none;opacity:.65}.form-range{width:100%;height:1.5rem;padding:0;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}.form-range:focus{outline:0}.form-range:focus::-webkit-slider-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .25rem rgba(13,110,253,.25)}.form-range:focus::-moz-range-thumb{box-shadow:0 0 0 1px #fff,0 0 0 .25rem rgba(13,110,253,.25)}.form-range::-moz-focus-outer{border:0}.form-range::-webkit-slider-thumb{width:1rem;height:1rem;margin-top:-.25rem;background-color:#0d6efd;border:0;border-radius:1rem;-webkit-transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:none;appearance:none}@media (prefers-reduced-motion:reduce){.form-range::-webkit-slider-thumb{-webkit-transition:none;transition:none}}.form-range::-webkit-slider-thumb:active{background-color:#b6d4fe}.form-range::-webkit-slider-runnable-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.form-range::-moz-range-thumb{width:1rem;height:1rem;background-color:#0d6efd;border:0;border-radius:1rem;-moz-transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;transition:background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-moz-appearance:none;appearance:none}@media (prefers-reduced-motion:reduce){.form-range::-moz-range-thumb{-moz-transition:none;transition:none}}.form-range::-moz-range-thumb:active{background-color:#b6d4fe}.form-range::-moz-range-track{width:100%;height:.5rem;color:transparent;cursor:pointer;background-color:#dee2e6;border-color:transparent;border-radius:1rem}.form-range:disabled{pointer-events:none}.form-range:disabled::-webkit-slider-thumb{background-color:#adb5bd}.form-range:disabled::-moz-range-thumb{background-color:#adb5bd}.form-floating{position:relative}.form-floating>.form-control,.form-floating>.form-control-plaintext,.form-floating>.form-select{height:calc(3.5rem + 2px);line-height:1.25}.form-floating>label{position:absolute;top:0;left:0;width:100%;height:100%;padding:1rem .75rem;overflow:hidden;text-align:start;text-overflow:ellipsis;white-space:nowrap;pointer-events:none;border:1px solid transparent;transform-origin:0 0;transition:opacity .1s ease-in-out,transform .1s ease-in-out}@media (prefers-reduced-motion:reduce){.form-floating>label{transition:none}}.form-floating>.form-control,.form-floating>.form-control-plaintext{padding:1rem .75rem}.form-floating>.form-control-plaintext::-moz-placeholder,.form-floating>.form-control::-moz-placeholder{color:transparent}.form-floating>.form-control-plaintext::placeholder,.form-floating>.form-control::placeholder{color:transparent}.form-floating>.form-control-plaintext:not(:-moz-placeholder-shown),.form-floating>.form-control:not(:-moz-placeholder-shown){padding-top:1.625rem;padding-bottom:.625rem}.form-floating>.form-control-plaintext:focus,.form-floating>.form-control-plaintext:not(:placeholder-shown),.form-floating>.form-control:focus,.form-floating>.form-control:not(:placeholder-shown){padding-top:1.625rem;padding-bottom:.625rem}.form-floating>.form-control-plaintext:-webkit-autofill,.form-floating>.form-control:-webkit-autofill{padding-top:1.625rem;padding-bottom:.625rem}.form-floating>.form-select{padding-top:1.625rem;padding-bottom:.625rem}.form-floating>.form-control:not(:-moz-placeholder-shown)~label{opacity:.65;transform:scale(.85) translateY(-.5rem) translateX(.15rem)}.form-floating>.form-control-plaintext~label,.form-floating>.form-control:focus~label,.form-floating>.form-control:not(:placeholder-shown)~label,.form-floating>.form-select~label{opacity:.65;transform:scale(.85) translateY(-.5rem) translateX(.15rem)}.form-floating>.form-control:-webkit-autofill~label{opacity:.65;transform:scale(.85) translateY(-.5rem) translateX(.15rem)}.form-floating>.form-control-plaintext~label{border-width:1px 0}.input-group{position:relative;display:flex;flex-wrap:wrap;align-items:stretch;width:100%}.input-group>.form-control,.input-group>.form-floating,.input-group>.form-select{position:relative;flex:1 1 auto;width:1%;min-width:0}.input-group>.form-control:focus,.input-group>.form-floating:focus-within,.input-group>.form-select:focus{z-index:5}.input-group .btn{position:relative;z-index:2}.input-group .btn:focus{z-index:5}.input-group-text{display:flex;align-items:center;padding:.375rem .75rem;font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:center;white-space:nowrap;background-color:#e9ecef;border:1px solid #ced4da;border-radius:.375rem}.input-group-lg>.btn,.input-group-lg>.form-control,.input-group-lg>.form-select,.input-group-lg>.input-group-text{padding:.5rem 1rem;font-size:1.25rem;border-radius:.5rem}.input-group-sm>.btn,.input-group-sm>.form-control,.input-group-sm>.form-select,.input-group-sm>.input-group-text{padding:.25rem .5rem;font-size:.875rem;border-radius:.25rem}.input-group-lg>.form-select,.input-group-sm>.form-select{padding-right:3rem}.input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),.input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-control,.input-group:not(.has-validation)>.form-floating:not(:last-child)>.form-select,.input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating){border-top-right-radius:0;border-bottom-right-radius:0}.input-group.has-validation>.dropdown-toggle:nth-last-child(n+4),.input-group.has-validation>.form-floating:nth-last-child(n+3)>.form-control,.input-group.has-validation>.form-floating:nth-last-child(n+3)>.form-select,.input-group.has-validation>:nth-last-child(n+3):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating){border-top-right-radius:0;border-bottom-right-radius:0}.input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){margin-left:-1px;border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.form-floating:not(:first-child)>.form-control,.input-group>.form-floating:not(:first-child)>.form-select{border-top-left-radius:0;border-bottom-left-radius:0}.valid-feedback{display:none;width:100%;margin-top:.25rem;font-size:.875em;color:#198754}.valid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;color:#fff;background-color:rgba(25,135,84,.9);border-radius:.375rem}.is-valid~.valid-feedback,.is-valid~.valid-tooltip,.was-validated :valid~.valid-feedback,.was-validated :valid~.valid-tooltip{display:block}.form-control.is-valid,.was-validated .form-control:valid{border-color:#198754;padding-right:calc(1.5em + .75rem);background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");background-repeat:no-repeat;background-position:right calc(.375em + .1875rem) center;background-size:calc(.75em + .375rem) calc(.75em + .375rem)}.form-control.is-valid:focus,.was-validated .form-control:valid:focus{border-color:#198754;box-shadow:0 0 0 .25rem rgba(25,135,84,.25)}.was-validated textarea.form-control:valid,textarea.form-control.is-valid{padding-right:calc(1.5em + .75rem);background-position:top calc(.375em + .1875rem) right calc(.375em + .1875rem)}.form-select.is-valid,.was-validated .form-select:valid{border-color:#198754}.form-select.is-valid:not([multiple]):not([size]),.form-select.is-valid:not([multiple])[size="1"],.was-validated .form-select:valid:not([multiple]):not([size]),.was-validated .form-select:valid:not([multiple])[size="1"]{padding-right:4.125rem;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"),url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");background-position:right .75rem center,center right 2.25rem;background-size:16px 12px,calc(.75em + .375rem) calc(.75em + .375rem)}.form-select.is-valid:focus,.was-validated .form-select:valid:focus{border-color:#198754;box-shadow:0 0 0 .25rem rgba(25,135,84,.25)}.form-control-color.is-valid,.was-validated .form-control-color:valid{width:calc(3rem + calc(1.5em + .75rem))}.form-check-input.is-valid,.was-validated .form-check-input:valid{border-color:#198754}.form-check-input.is-valid:checked,.was-validated .form-check-input:valid:checked{background-color:#198754}.form-check-input.is-valid:focus,.was-validated .form-check-input:valid:focus{box-shadow:0 0 0 .25rem rgba(25,135,84,.25)}.form-check-input.is-valid~.form-check-label,.was-validated .form-check-input:valid~.form-check-label{color:#198754}.form-check-inline .form-check-input~.valid-feedback{margin-left:.5em}.input-group>.form-control:not(:focus).is-valid,.input-group>.form-floating:not(:focus-within).is-valid,.input-group>.form-select:not(:focus).is-valid,.was-validated .input-group>.form-control:not(:focus):valid,.was-validated .input-group>.form-floating:not(:focus-within):valid,.was-validated .input-group>.form-select:not(:focus):valid{z-index:3}.invalid-feedback{display:none;width:100%;margin-top:.25rem;font-size:.875em;color:#dc3545}.invalid-tooltip{position:absolute;top:100%;z-index:5;display:none;max-width:100%;padding:.25rem .5rem;margin-top:.1rem;font-size:.875rem;color:#fff;background-color:rgba(220,53,69,.9);border-radius:.375rem}.is-invalid~.invalid-feedback,.is-invalid~.invalid-tooltip,.was-validated :invalid~.invalid-feedback,.was-validated :invalid~.invalid-tooltip{display:block}.form-control.is-invalid,.was-validated .form-control:invalid{border-color:#dc3545;padding-right:calc(1.5em + .75rem);background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");background-repeat:no-repeat;background-position:right calc(.375em + .1875rem) center;background-size:calc(.75em + .375rem) calc(.75em + .375rem)}.form-control.is-invalid:focus,.was-validated .form-control:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .25rem rgba(220,53,69,.25)}.was-validated textarea.form-control:invalid,textarea.form-control.is-invalid{padding-right:calc(1.5em + .75rem);background-position:top calc(.375em + .1875rem) right calc(.375em + .1875rem)}.form-select.is-invalid,.was-validated .form-select:invalid{border-color:#dc3545}.form-select.is-invalid:not([multiple]):not([size]),.form-select.is-invalid:not([multiple])[size="1"],.was-validated .form-select:invalid:not([multiple]):not([size]),.was-validated .form-select:invalid:not([multiple])[size="1"]{padding-right:4.125rem;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"),url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");background-position:right .75rem center,center right 2.25rem;background-size:16px 12px,calc(.75em + .375rem) calc(.75em + .375rem)}.form-select.is-invalid:focus,.was-validated .form-select:invalid:focus{border-color:#dc3545;box-shadow:0 0 0 .25rem rgba(220,53,69,.25)}.form-control-color.is-invalid,.was-validated .form-control-color:invalid{width:calc(3rem + calc(1.5em + .75rem))}.form-check-input.is-invalid,.was-validated .form-check-input:invalid{border-color:#dc3545}.form-check-input.is-invalid:checked,.was-validated .form-check-input:invalid:checked{background-color:#dc3545}.form-check-input.is-invalid:focus,.was-validated .form-check-input:invalid:focus{box-shadow:0 0 0 .25rem rgba(220,53,69,.25)}.form-check-input.is-invalid~.form-check-label,.was-validated .form-check-input:invalid~.form-check-label{color:#dc3545}.form-check-inline .form-check-input~.invalid-feedback{margin-left:.5em}.input-group>.form-control:not(:focus).is-invalid,.input-group>.form-floating:not(:focus-within).is-invalid,.input-group>.form-select:not(:focus).is-invalid,.was-validated .input-group>.form-control:not(:focus):invalid,.was-validated .input-group>.form-floating:not(:focus-within):invalid,.was-validated .input-group>.form-select:not(:focus):invalid{z-index:4}.btn{--bs-btn-padding-x:0.75rem;--bs-btn-padding-y:0.375rem;--bs-btn-font-family: ;--bs-btn-font-size:1rem;--bs-btn-font-weight:400;--bs-btn-line-height:1.5;--bs-btn-color:#212529;--bs-btn-bg:transparent;--bs-btn-border-width:1px;--bs-btn-border-color:transparent;--bs-btn-border-radius:0.375rem;--bs-btn-hover-border-color:transparent;--bs-btn-box-shadow:inset 0 1px 0 rgba(255, 255, 255, 0.15),0 1px 1px rgba(0, 0, 0, 0.075);--bs-btn-disabled-opacity:0.65;--bs-btn-focus-box-shadow:0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), .5);display:inline-block;padding:var(--bs-btn-padding-y) var(--bs-btn-padding-x);font-family:var(--bs-btn-font-family);font-size:var(--bs-btn-font-size);font-weight:var(--bs-btn-font-weight);line-height:var(--bs-btn-line-height);color:var(--bs-btn-color);text-align:center;text-decoration:none;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;border:var(--bs-btn-border-width) solid var(--bs-btn-border-color);border-radius:var(--bs-btn-border-radius);background-color:var(--bs-btn-bg);transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn:hover{color:var(--bs-btn-hover-color);background-color:var(--bs-btn-hover-bg);border-color:var(--bs-btn-hover-border-color)}.btn-check+.btn:hover{color:var(--bs-btn-color);background-color:var(--bs-btn-bg);border-color:var(--bs-btn-border-color)}.btn:focus-visible{color:var(--bs-btn-hover-color);background-color:var(--bs-btn-hover-bg);border-color:var(--bs-btn-hover-border-color);outline:0;box-shadow:var(--bs-btn-focus-box-shadow)}.btn-check:focus-visible+.btn{border-color:var(--bs-btn-hover-border-color);outline:0;box-shadow:var(--bs-btn-focus-box-shadow)}.btn-check:checked+.btn,.btn.active,.btn.show,.btn:first-child:active,:not(.btn-check)+.btn:active{color:var(--bs-btn-active-color);background-color:var(--bs-btn-active-bg);border-color:var(--bs-btn-active-border-color)}.btn-check:checked+.btn:focus-visible,.btn.active:focus-visible,.btn.show:focus-visible,.btn:first-child:active:focus-visible,:not(.btn-check)+.btn:active:focus-visible{box-shadow:var(--bs-btn-focus-box-shadow)}.btn.disabled,.btn:disabled,fieldset:disabled .btn{color:var(--bs-btn-disabled-color);pointer-events:none;background-color:var(--bs-btn-disabled-bg);border-color:var(--bs-btn-disabled-border-color);opacity:var(--bs-btn-disabled-opacity)}.btn-primary{--bs-btn-color:#fff;--bs-btn-bg:#0d6efd;--bs-btn-border-color:#0d6efd;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#0b5ed7;--bs-btn-hover-border-color:#0a58ca;--bs-btn-focus-shadow-rgb:49,132,253;--bs-btn-active-color:#fff;--bs-btn-active-bg:#0a58ca;--bs-btn-active-border-color:#0a53be;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#fff;--bs-btn-disabled-bg:#0d6efd;--bs-btn-disabled-border-color:#0d6efd}.btn-secondary{--bs-btn-color:#fff;--bs-btn-bg:#6c757d;--bs-btn-border-color:#6c757d;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#5c636a;--bs-btn-hover-border-color:#565e64;--bs-btn-focus-shadow-rgb:130,138,145;--bs-btn-active-color:#fff;--bs-btn-active-bg:#565e64;--bs-btn-active-border-color:#51585e;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#fff;--bs-btn-disabled-bg:#6c757d;--bs-btn-disabled-border-color:#6c757d}.btn-success{--bs-btn-color:#fff;--bs-btn-bg:#198754;--bs-btn-border-color:#198754;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#157347;--bs-btn-hover-border-color:#146c43;--bs-btn-focus-shadow-rgb:60,153,110;--bs-btn-active-color:#fff;--bs-btn-active-bg:#146c43;--bs-btn-active-border-color:#13653f;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#fff;--bs-btn-disabled-bg:#198754;--bs-btn-disabled-border-color:#198754}.btn-info{--bs-btn-color:#000;--bs-btn-bg:#0dcaf0;--bs-btn-border-color:#0dcaf0;--bs-btn-hover-color:#000;--bs-btn-hover-bg:#31d2f2;--bs-btn-hover-border-color:#25cff2;--bs-btn-focus-shadow-rgb:11,172,204;--bs-btn-active-color:#000;--bs-btn-active-bg:#3dd5f3;--bs-btn-active-border-color:#25cff2;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#000;--bs-btn-disabled-bg:#0dcaf0;--bs-btn-disabled-border-color:#0dcaf0}.btn-warning{--bs-btn-color:#000;--bs-btn-bg:#ffc107;--bs-btn-border-color:#ffc107;--bs-btn-hover-color:#000;--bs-btn-hover-bg:#ffca2c;--bs-btn-hover-border-color:#ffc720;--bs-btn-focus-shadow-rgb:217,164,6;--bs-btn-active-color:#000;--bs-btn-active-bg:#ffcd39;--bs-btn-active-border-color:#ffc720;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#000;--bs-btn-disabled-bg:#ffc107;--bs-btn-disabled-border-color:#ffc107}.btn-danger{--bs-btn-color:#fff;--bs-btn-bg:#dc3545;--bs-btn-border-color:#dc3545;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#bb2d3b;--bs-btn-hover-border-color:#b02a37;--bs-btn-focus-shadow-rgb:225,83,97;--bs-btn-active-color:#fff;--bs-btn-active-bg:#b02a37;--bs-btn-active-border-color:#a52834;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#fff;--bs-btn-disabled-bg:#dc3545;--bs-btn-disabled-border-color:#dc3545}.btn-light{--bs-btn-color:#000;--bs-btn-bg:#f8f9fa;--bs-btn-border-color:#f8f9fa;--bs-btn-hover-color:#000;--bs-btn-hover-bg:#d3d4d5;--bs-btn-hover-border-color:#c6c7c8;--bs-btn-focus-shadow-rgb:211,212,213;--bs-btn-active-color:#000;--bs-btn-active-bg:#c6c7c8;--bs-btn-active-border-color:#babbbc;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#000;--bs-btn-disabled-bg:#f8f9fa;--bs-btn-disabled-border-color:#f8f9fa}.btn-dark{--bs-btn-color:#fff;--bs-btn-bg:#212529;--bs-btn-border-color:#212529;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#424649;--bs-btn-hover-border-color:#373b3e;--bs-btn-focus-shadow-rgb:66,70,73;--bs-btn-active-color:#fff;--bs-btn-active-bg:#4d5154;--bs-btn-active-border-color:#373b3e;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#fff;--bs-btn-disabled-bg:#212529;--bs-btn-disabled-border-color:#212529}.btn-outline-primary{--bs-btn-color:#0d6efd;--bs-btn-border-color:#0d6efd;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#0d6efd;--bs-btn-hover-border-color:#0d6efd;--bs-btn-focus-shadow-rgb:13,110,253;--bs-btn-active-color:#fff;--bs-btn-active-bg:#0d6efd;--bs-btn-active-border-color:#0d6efd;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#0d6efd;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#0d6efd;--bs-gradient:none}.btn-outline-secondary{--bs-btn-color:#6c757d;--bs-btn-border-color:#6c757d;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#6c757d;--bs-btn-hover-border-color:#6c757d;--bs-btn-focus-shadow-rgb:108,117,125;--bs-btn-active-color:#fff;--bs-btn-active-bg:#6c757d;--bs-btn-active-border-color:#6c757d;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#6c757d;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#6c757d;--bs-gradient:none}.btn-outline-success{--bs-btn-color:#198754;--bs-btn-border-color:#198754;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#198754;--bs-btn-hover-border-color:#198754;--bs-btn-focus-shadow-rgb:25,135,84;--bs-btn-active-color:#fff;--bs-btn-active-bg:#198754;--bs-btn-active-border-color:#198754;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#198754;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#198754;--bs-gradient:none}.btn-outline-info{--bs-btn-color:#0dcaf0;--bs-btn-border-color:#0dcaf0;--bs-btn-hover-color:#000;--bs-btn-hover-bg:#0dcaf0;--bs-btn-hover-border-color:#0dcaf0;--bs-btn-focus-shadow-rgb:13,202,240;--bs-btn-active-color:#000;--bs-btn-active-bg:#0dcaf0;--bs-btn-active-border-color:#0dcaf0;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#0dcaf0;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#0dcaf0;--bs-gradient:none}.btn-outline-warning{--bs-btn-color:#ffc107;--bs-btn-border-color:#ffc107;--bs-btn-hover-color:#000;--bs-btn-hover-bg:#ffc107;--bs-btn-hover-border-color:#ffc107;--bs-btn-focus-shadow-rgb:255,193,7;--bs-btn-active-color:#000;--bs-btn-active-bg:#ffc107;--bs-btn-active-border-color:#ffc107;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#ffc107;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#ffc107;--bs-gradient:none}.btn-outline-danger{--bs-btn-color:#dc3545;--bs-btn-border-color:#dc3545;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#dc3545;--bs-btn-hover-border-color:#dc3545;--bs-btn-focus-shadow-rgb:220,53,69;--bs-btn-active-color:#fff;--bs-btn-active-bg:#dc3545;--bs-btn-active-border-color:#dc3545;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#dc3545;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#dc3545;--bs-gradient:none}.btn-outline-light{--bs-btn-color:#f8f9fa;--bs-btn-border-color:#f8f9fa;--bs-btn-hover-color:#000;--bs-btn-hover-bg:#f8f9fa;--bs-btn-hover-border-color:#f8f9fa;--bs-btn-focus-shadow-rgb:248,249,250;--bs-btn-active-color:#000;--bs-btn-active-bg:#f8f9fa;--bs-btn-active-border-color:#f8f9fa;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#f8f9fa;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#f8f9fa;--bs-gradient:none}.btn-outline-dark{--bs-btn-color:#212529;--bs-btn-border-color:#212529;--bs-btn-hover-color:#fff;--bs-btn-hover-bg:#212529;--bs-btn-hover-border-color:#212529;--bs-btn-focus-shadow-rgb:33,37,41;--bs-btn-active-color:#fff;--bs-btn-active-bg:#212529;--bs-btn-active-border-color:#212529;--bs-btn-active-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-btn-disabled-color:#212529;--bs-btn-disabled-bg:transparent;--bs-btn-disabled-border-color:#212529;--bs-gradient:none}.btn-link{--bs-btn-font-weight:400;--bs-btn-color:var(--bs-link-color);--bs-btn-bg:transparent;--bs-btn-border-color:transparent;--bs-btn-hover-color:var(--bs-link-hover-color);--bs-btn-hover-border-color:transparent;--bs-btn-active-color:var(--bs-link-hover-color);--bs-btn-active-border-color:transparent;--bs-btn-disabled-color:#6c757d;--bs-btn-disabled-border-color:transparent;--bs-btn-box-shadow:none;--bs-btn-focus-shadow-rgb:49,132,253;text-decoration:underline}.btn-link:focus-visible{color:var(--bs-btn-color)}.btn-link:hover{color:var(--bs-btn-hover-color)}.btn-group-lg>.btn,.btn-lg{--bs-btn-padding-y:0.5rem;--bs-btn-padding-x:1rem;--bs-btn-font-size:1.25rem;--bs-btn-border-radius:0.5rem}.btn-group-sm>.btn,.btn-sm{--bs-btn-padding-y:0.25rem;--bs-btn-padding-x:0.5rem;--bs-btn-font-size:0.875rem;--bs-btn-border-radius:0.25rem}.fade{transition:opacity .15s linear}@media (prefers-reduced-motion:reduce){.fade{transition:none}}.fade:not(.show){opacity:0}.collapse:not(.show){display:none}.collapsing{height:0;overflow:hidden;transition:height .35s ease}@media (prefers-reduced-motion:reduce){.collapsing{transition:none}}.collapsing.collapse-horizontal{width:0;height:auto;transition:width .35s ease}@media (prefers-reduced-motion:reduce){.collapsing.collapse-horizontal{transition:none}}.dropdown,.dropdown-center,.dropend,.dropstart,.dropup,.dropup-center{position:relative}.dropdown-toggle{white-space:nowrap}.dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid;border-right:.3em solid transparent;border-bottom:0;border-left:.3em solid transparent}.dropdown-toggle:empty::after{margin-left:0}.dropdown-menu{--bs-dropdown-zindex:1000;--bs-dropdown-min-width:10rem;--bs-dropdown-padding-x:0;--bs-dropdown-padding-y:0.5rem;--bs-dropdown-spacer:0.125rem;--bs-dropdown-font-size:1rem;--bs-dropdown-color:#212529;--bs-dropdown-bg:#fff;--bs-dropdown-border-color:var(--bs-border-color-translucent);--bs-dropdown-border-radius:0.375rem;--bs-dropdown-border-width:1px;--bs-dropdown-inner-border-radius:calc(0.375rem - 1px);--bs-dropdown-divider-bg:var(--bs-border-color-translucent);--bs-dropdown-divider-margin-y:0.5rem;--bs-dropdown-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-dropdown-link-color:#212529;--bs-dropdown-link-hover-color:#1e2125;--bs-dropdown-link-hover-bg:#e9ecef;--bs-dropdown-link-active-color:#fff;--bs-dropdown-link-active-bg:#0d6efd;--bs-dropdown-link-disabled-color:#adb5bd;--bs-dropdown-item-padding-x:1rem;--bs-dropdown-item-padding-y:0.25rem;--bs-dropdown-header-color:#6c757d;--bs-dropdown-header-padding-x:1rem;--bs-dropdown-header-padding-y:0.5rem;position:absolute;z-index:var(--bs-dropdown-zindex);display:none;min-width:var(--bs-dropdown-min-width);padding:var(--bs-dropdown-padding-y) var(--bs-dropdown-padding-x);margin:0;font-size:var(--bs-dropdown-font-size);color:var(--bs-dropdown-color);text-align:left;list-style:none;background-color:var(--bs-dropdown-bg);background-clip:padding-box;border:var(--bs-dropdown-border-width) solid var(--bs-dropdown-border-color);border-radius:var(--bs-dropdown-border-radius)}.dropdown-menu[data-bs-popper]{top:100%;left:0;margin-top:var(--bs-dropdown-spacer)}.dropdown-menu-start{--bs-position:start}.dropdown-menu-start[data-bs-popper]{right:auto;left:0}.dropdown-menu-end{--bs-position:end}.dropdown-menu-end[data-bs-popper]{right:0;left:auto}@media (min-width:576px){.dropdown-menu-sm-start{--bs-position:start}.dropdown-menu-sm-start[data-bs-popper]{right:auto;left:0}.dropdown-menu-sm-end{--bs-position:end}.dropdown-menu-sm-end[data-bs-popper]{right:0;left:auto}}@media (min-width:768px){.dropdown-menu-md-start{--bs-position:start}.dropdown-menu-md-start[data-bs-popper]{right:auto;left:0}.dropdown-menu-md-end{--bs-position:end}.dropdown-menu-md-end[data-bs-popper]{right:0;left:auto}}@media (min-width:992px){.dropdown-menu-lg-start{--bs-position:start}.dropdown-menu-lg-start[data-bs-popper]{right:auto;left:0}.dropdown-menu-lg-end{--bs-position:end}.dropdown-menu-lg-end[data-bs-popper]{right:0;left:auto}}@media (min-width:1200px){.dropdown-menu-xl-start{--bs-position:start}.dropdown-menu-xl-start[data-bs-popper]{right:auto;left:0}.dropdown-menu-xl-end{--bs-position:end}.dropdown-menu-xl-end[data-bs-popper]{right:0;left:auto}}@media (min-width:1400px){.dropdown-menu-xxl-start{--bs-position:start}.dropdown-menu-xxl-start[data-bs-popper]{right:auto;left:0}.dropdown-menu-xxl-end{--bs-position:end}.dropdown-menu-xxl-end[data-bs-popper]{right:0;left:auto}}.dropup .dropdown-menu[data-bs-popper]{top:auto;bottom:100%;margin-top:0;margin-bottom:var(--bs-dropdown-spacer)}.dropup .dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";border-top:0;border-right:.3em solid transparent;border-bottom:.3em solid;border-left:.3em solid transparent}.dropup .dropdown-toggle:empty::after{margin-left:0}.dropend .dropdown-menu[data-bs-popper]{top:0;right:auto;left:100%;margin-top:0;margin-left:var(--bs-dropdown-spacer)}.dropend .dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:"";border-top:.3em solid transparent;border-right:0;border-bottom:.3em solid transparent;border-left:.3em solid}.dropend .dropdown-toggle:empty::after{margin-left:0}.dropend .dropdown-toggle::after{vertical-align:0}.dropstart .dropdown-menu[data-bs-popper]{top:0;right:100%;left:auto;margin-top:0;margin-right:var(--bs-dropdown-spacer)}.dropstart .dropdown-toggle::after{display:inline-block;margin-left:.255em;vertical-align:.255em;content:""}.dropstart .dropdown-toggle::after{display:none}.dropstart .dropdown-toggle::before{display:inline-block;margin-right:.255em;vertical-align:.255em;content:"";border-top:.3em solid transparent;border-right:.3em solid;border-bottom:.3em solid transparent}.dropstart .dropdown-toggle:empty::after{margin-left:0}.dropstart .dropdown-toggle::before{vertical-align:0}.dropdown-divider{height:0;margin:var(--bs-dropdown-divider-margin-y) 0;overflow:hidden;border-top:1px solid var(--bs-dropdown-divider-bg);opacity:1}.dropdown-item{display:block;width:100%;padding:var(--bs-dropdown-item-padding-y) var(--bs-dropdown-item-padding-x);clear:both;font-weight:400;color:var(--bs-dropdown-link-color);text-align:inherit;text-decoration:none;white-space:nowrap;background-color:transparent;border:0}.dropdown-item:focus,.dropdown-item:hover{color:var(--bs-dropdown-link-hover-color);background-color:var(--bs-dropdown-link-hover-bg)}.dropdown-item.active,.dropdown-item:active{color:var(--bs-dropdown-link-active-color);text-decoration:none;background-color:var(--bs-dropdown-link-active-bg)}.dropdown-item.disabled,.dropdown-item:disabled{color:var(--bs-dropdown-link-disabled-color);pointer-events:none;background-color:transparent}.dropdown-menu.show{display:block}.dropdown-header{display:block;padding:var(--bs-dropdown-header-padding-y) var(--bs-dropdown-header-padding-x);margin-bottom:0;font-size:.875rem;color:var(--bs-dropdown-header-color);white-space:nowrap}.dropdown-item-text{display:block;padding:var(--bs-dropdown-item-padding-y) var(--bs-dropdown-item-padding-x);color:var(--bs-dropdown-link-color)}.dropdown-menu-dark{--bs-dropdown-color:#dee2e6;--bs-dropdown-bg:#343a40;--bs-dropdown-border-color:var(--bs-border-color-translucent);--bs-dropdown-box-shadow: ;--bs-dropdown-link-color:#dee2e6;--bs-dropdown-link-hover-color:#fff;--bs-dropdown-divider-bg:var(--bs-border-color-translucent);--bs-dropdown-link-hover-bg:rgba(255, 255, 255, 0.15);--bs-dropdown-link-active-color:#fff;--bs-dropdown-link-active-bg:#0d6efd;--bs-dropdown-link-disabled-color:#adb5bd;--bs-dropdown-header-color:#adb5bd}.btn-group,.btn-group-vertical{position:relative;display:inline-flex;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;flex:1 1 auto}.btn-group-vertical>.btn-check:checked+.btn,.btn-group-vertical>.btn-check:focus+.btn,.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn-check:checked+.btn,.btn-group>.btn-check:focus+.btn,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:1}.btn-toolbar{display:flex;flex-wrap:wrap;justify-content:flex-start}.btn-toolbar .input-group{width:auto}.btn-group{border-radius:.375rem}.btn-group>.btn-group:not(:first-child),.btn-group>:not(.btn-check:first-child)+.btn{margin-left:-1px}.btn-group>.btn-group:not(:last-child)>.btn,.btn-group>.btn.dropdown-toggle-split:first-child,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:not(:first-child)>.btn,.btn-group>.btn:nth-child(n+3),.btn-group>:not(.btn-check)+.btn{border-top-left-radius:0;border-bottom-left-radius:0}.dropdown-toggle-split{padding-right:.5625rem;padding-left:.5625rem}.dropdown-toggle-split::after,.dropend .dropdown-toggle-split::after,.dropup .dropdown-toggle-split::after{margin-left:0}.dropstart .dropdown-toggle-split::before{margin-right:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-right:.375rem;padding-left:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-right:.75rem;padding-left:.75rem}.btn-group-vertical{flex-direction:column;align-items:flex-start;justify-content:center}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group{width:100%}.btn-group-vertical>.btn-group:not(:first-child),.btn-group-vertical>.btn:not(:first-child){margin-top:-1px}.btn-group-vertical>.btn-group:not(:last-child)>.btn,.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child)>.btn,.btn-group-vertical>.btn~.btn{border-top-left-radius:0;border-top-right-radius:0}.nav{--bs-nav-link-padding-x:1rem;--bs-nav-link-padding-y:0.5rem;--bs-nav-link-font-weight: ;--bs-nav-link-color:var(--bs-link-color);--bs-nav-link-hover-color:var(--bs-link-hover-color);--bs-nav-link-disabled-color:#6c757d;display:flex;flex-wrap:wrap;padding-left:0;margin-bottom:0;list-style:none}.nav-link{display:block;padding:var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x);font-size:var(--bs-nav-link-font-size);font-weight:var(--bs-nav-link-font-weight);color:var(--bs-nav-link-color);text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out}@media (prefers-reduced-motion:reduce){.nav-link{transition:none}}.nav-link:focus,.nav-link:hover{color:var(--bs-nav-link-hover-color)}.nav-link.disabled{color:var(--bs-nav-link-disabled-color);pointer-events:none;cursor:default}.nav-tabs{--bs-nav-tabs-border-width:1px;--bs-nav-tabs-border-color:#dee2e6;--bs-nav-tabs-border-radius:0.375rem;--bs-nav-tabs-link-hover-border-color:#e9ecef #e9ecef #dee2e6;--bs-nav-tabs-link-active-color:#495057;--bs-nav-tabs-link-active-bg:#fff;--bs-nav-tabs-link-active-border-color:#dee2e6 #dee2e6 #fff;border-bottom:var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color)}.nav-tabs .nav-link{margin-bottom:calc(-1 * var(--bs-nav-tabs-border-width));background:0 0;border:var(--bs-nav-tabs-border-width) solid transparent;border-top-left-radius:var(--bs-nav-tabs-border-radius);border-top-right-radius:var(--bs-nav-tabs-border-radius)}.nav-tabs .nav-link:focus,.nav-tabs .nav-link:hover{isolation:isolate;border-color:var(--bs-nav-tabs-link-hover-border-color)}.nav-tabs .nav-link.disabled,.nav-tabs .nav-link:disabled{color:var(--bs-nav-link-disabled-color);background-color:transparent;border-color:transparent}.nav-tabs .nav-item.show .nav-link,.nav-tabs .nav-link.active{color:var(--bs-nav-tabs-link-active-color);background-color:var(--bs-nav-tabs-link-active-bg);border-color:var(--bs-nav-tabs-link-active-border-color)}.nav-tabs .dropdown-menu{margin-top:calc(-1 * var(--bs-nav-tabs-border-width));border-top-left-radius:0;border-top-right-radius:0}.nav-pills{--bs-nav-pills-border-radius:0.375rem;--bs-nav-pills-link-active-color:#fff;--bs-nav-pills-link-active-bg:#0d6efd}.nav-pills .nav-link{background:0 0;border:0;border-radius:var(--bs-nav-pills-border-radius)}.nav-pills .nav-link:disabled{color:var(--bs-nav-link-disabled-color);background-color:transparent;border-color:transparent}.nav-pills .nav-link.active,.nav-pills .show>.nav-link{color:var(--bs-nav-pills-link-active-color);background-color:var(--bs-nav-pills-link-active-bg)}.nav-fill .nav-item,.nav-fill>.nav-link{flex:1 1 auto;text-align:center}.nav-justified .nav-item,.nav-justified>.nav-link{flex-basis:0;flex-grow:1;text-align:center}.nav-fill .nav-item .nav-link,.nav-justified .nav-item .nav-link{width:100%}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.navbar{--bs-navbar-padding-x:0;--bs-navbar-padding-y:0.5rem;--bs-navbar-color:rgba(0, 0, 0, 0.55);--bs-navbar-hover-color:rgba(0, 0, 0, 0.7);--bs-navbar-disabled-color:rgba(0, 0, 0, 0.3);--bs-navbar-active-color:rgba(0, 0, 0, 0.9);--bs-navbar-brand-padding-y:0.3125rem;--bs-navbar-brand-margin-end:1rem;--bs-navbar-brand-font-size:1.25rem;--bs-navbar-brand-color:rgba(0, 0, 0, 0.9);--bs-navbar-brand-hover-color:rgba(0, 0, 0, 0.9);--bs-navbar-nav-link-padding-x:0.5rem;--bs-navbar-toggler-padding-y:0.25rem;--bs-navbar-toggler-padding-x:0.75rem;--bs-navbar-toggler-font-size:1.25rem;--bs-navbar-toggler-icon-bg:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");--bs-navbar-toggler-border-color:rgba(0, 0, 0, 0.1);--bs-navbar-toggler-border-radius:0.375rem;--bs-navbar-toggler-focus-width:0.25rem;--bs-navbar-toggler-transition:box-shadow 0.15s ease-in-out;position:relative;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:var(--bs-navbar-padding-y) var(--bs-navbar-padding-x)}.navbar>.container,.navbar>.container-fluid,.navbar>.container-lg,.navbar>.container-md,.navbar>.container-sm,.navbar>.container-xl,.navbar>.container-xxl{display:flex;flex-wrap:inherit;align-items:center;justify-content:space-between}.navbar-brand{padding-top:var(--bs-navbar-brand-padding-y);padding-bottom:var(--bs-navbar-brand-padding-y);margin-right:var(--bs-navbar-brand-margin-end);font-size:var(--bs-navbar-brand-font-size);color:var(--bs-navbar-brand-color);text-decoration:none;white-space:nowrap}.navbar-brand:focus,.navbar-brand:hover{color:var(--bs-navbar-brand-hover-color)}.navbar-nav{--bs-nav-link-padding-x:0;--bs-nav-link-padding-y:0.5rem;--bs-nav-link-font-weight: ;--bs-nav-link-color:var(--bs-navbar-color);--bs-nav-link-hover-color:var(--bs-navbar-hover-color);--bs-nav-link-disabled-color:var(--bs-navbar-disabled-color);display:flex;flex-direction:column;padding-left:0;margin-bottom:0;list-style:none}.navbar-nav .nav-link.active,.navbar-nav .show>.nav-link{color:var(--bs-navbar-active-color)}.navbar-nav .dropdown-menu{position:static}.navbar-text{padding-top:.5rem;padding-bottom:.5rem;color:var(--bs-navbar-color)}.navbar-text a,.navbar-text a:focus,.navbar-text a:hover{color:var(--bs-navbar-active-color)}.navbar-collapse{flex-basis:100%;flex-grow:1;align-items:center}.navbar-toggler{padding:var(--bs-navbar-toggler-padding-y) var(--bs-navbar-toggler-padding-x);font-size:var(--bs-navbar-toggler-font-size);line-height:1;color:var(--bs-navbar-color);background-color:transparent;border:var(--bs-border-width) solid var(--bs-navbar-toggler-border-color);border-radius:var(--bs-navbar-toggler-border-radius);transition:var(--bs-navbar-toggler-transition)}@media (prefers-reduced-motion:reduce){.navbar-toggler{transition:none}}.navbar-toggler:hover{text-decoration:none}.navbar-toggler:focus{text-decoration:none;outline:0;box-shadow:0 0 0 var(--bs-navbar-toggler-focus-width)}.navbar-toggler-icon{display:inline-block;width:1.5em;height:1.5em;vertical-align:middle;background-image:var(--bs-navbar-toggler-icon-bg);background-repeat:no-repeat;background-position:center;background-size:100%}.navbar-nav-scroll{max-height:var(--bs-scroll-height,75vh);overflow-y:auto}@media (min-width:576px){.navbar-expand-sm{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-sm .navbar-nav .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x);padding-left:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-sm .navbar-nav-scroll{overflow:visible}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}.navbar-expand-sm .offcanvas{position:static;z-index:auto;flex-grow:1;width:auto!important;height:auto!important;visibility:visible!important;background-color:transparent!important;border:0!important;transform:none!important;transition:none}.navbar-expand-sm .offcanvas .offcanvas-header{display:none}.navbar-expand-sm .offcanvas .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible}}@media (min-width:768px){.navbar-expand-md{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-md .navbar-nav .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x);padding-left:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-md .navbar-nav-scroll{overflow:visible}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}.navbar-expand-md .offcanvas{position:static;z-index:auto;flex-grow:1;width:auto!important;height:auto!important;visibility:visible!important;background-color:transparent!important;border:0!important;transform:none!important;transition:none}.navbar-expand-md .offcanvas .offcanvas-header{display:none}.navbar-expand-md .offcanvas .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible}}@media (min-width:992px){.navbar-expand-lg{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-lg .navbar-nav .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x);padding-left:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-lg .navbar-nav-scroll{overflow:visible}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}.navbar-expand-lg .offcanvas{position:static;z-index:auto;flex-grow:1;width:auto!important;height:auto!important;visibility:visible!important;background-color:transparent!important;border:0!important;transform:none!important;transition:none}.navbar-expand-lg .offcanvas .offcanvas-header{display:none}.navbar-expand-lg .offcanvas .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible}}@media (min-width:1200px){.navbar-expand-xl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xl .navbar-nav{flex-direction:row}.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xl .navbar-nav .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x);padding-left:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-xl .navbar-nav-scroll{overflow:visible}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}.navbar-expand-xl .offcanvas{position:static;z-index:auto;flex-grow:1;width:auto!important;height:auto!important;visibility:visible!important;background-color:transparent!important;border:0!important;transform:none!important;transition:none}.navbar-expand-xl .offcanvas .offcanvas-header{display:none}.navbar-expand-xl .offcanvas .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible}}@media (min-width:1400px){.navbar-expand-xxl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xxl .navbar-nav{flex-direction:row}.navbar-expand-xxl .navbar-nav .dropdown-menu{position:absolute}.navbar-expand-xxl .navbar-nav .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x);padding-left:var(--bs-navbar-nav-link-padding-x)}.navbar-expand-xxl .navbar-nav-scroll{overflow:visible}.navbar-expand-xxl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xxl .navbar-toggler{display:none}.navbar-expand-xxl .offcanvas{position:static;z-index:auto;flex-grow:1;width:auto!important;height:auto!important;visibility:visible!important;background-color:transparent!important;border:0!important;transform:none!important;transition:none}.navbar-expand-xxl .offcanvas .offcanvas-header{display:none}.navbar-expand-xxl .offcanvas .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible}}.navbar-expand{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.navbar-expand .navbar-nav .nav-link{padding-right:var(--bs-navbar-nav-link-padding-x);padding-left:var(--bs-navbar-nav-link-padding-x)}.navbar-expand .navbar-nav-scroll{overflow:visible}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.navbar-expand .offcanvas{position:static;z-index:auto;flex-grow:1;width:auto!important;height:auto!important;visibility:visible!important;background-color:transparent!important;border:0!important;transform:none!important;transition:none}.navbar-expand .offcanvas .offcanvas-header{display:none}.navbar-expand .offcanvas .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible}.navbar-dark{--bs-navbar-color:rgba(255, 255, 255, 0.55);--bs-navbar-hover-color:rgba(255, 255, 255, 0.75);--bs-navbar-disabled-color:rgba(255, 255, 255, 0.25);--bs-navbar-active-color:#fff;--bs-navbar-brand-color:#fff;--bs-navbar-brand-hover-color:#fff;--bs-navbar-toggler-border-color:rgba(255, 255, 255, 0.1);--bs-navbar-toggler-icon-bg:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e")}.card{--bs-card-spacer-y:1rem;--bs-card-spacer-x:1rem;--bs-card-title-spacer-y:0.5rem;--bs-card-border-width:1px;--bs-card-border-color:var(--bs-border-color-translucent);--bs-card-border-radius:0.375rem;--bs-card-box-shadow: ;--bs-card-inner-border-radius:calc(0.375rem - 1px);--bs-card-cap-padding-y:0.5rem;--bs-card-cap-padding-x:1rem;--bs-card-cap-bg:rgba(0, 0, 0, 0.03);--bs-card-cap-color: ;--bs-card-height: ;--bs-card-color: ;--bs-card-bg:#fff;--bs-card-img-overlay-padding:1rem;--bs-card-group-margin:0.75rem;position:relative;display:flex;flex-direction:column;min-width:0;height:var(--bs-card-height);word-wrap:break-word;background-color:var(--bs-card-bg);background-clip:border-box;border:var(--bs-card-border-width) solid var(--bs-card-border-color);border-radius:var(--bs-card-border-radius)}.card>hr{margin-right:0;margin-left:0}.card>.list-group{border-top:inherit;border-bottom:inherit}.card>.list-group:first-child{border-top-width:0;border-top-left-radius:var(--bs-card-inner-border-radius);border-top-right-radius:var(--bs-card-inner-border-radius)}.card>.list-group:last-child{border-bottom-width:0;border-bottom-right-radius:var(--bs-card-inner-border-radius);border-bottom-left-radius:var(--bs-card-inner-border-radius)}.card>.card-header+.list-group,.card>.list-group+.card-footer{border-top:0}.card-body{flex:1 1 auto;padding:var(--bs-card-spacer-y) var(--bs-card-spacer-x);color:var(--bs-card-color)}.card-title{margin-bottom:var(--bs-card-title-spacer-y)}.card-subtitle{margin-top:calc(-.5 * var(--bs-card-title-spacer-y));margin-bottom:0}.card-text:last-child{margin-bottom:0}.card-link+.card-link{margin-left:var(--bs-card-spacer-x)}.card-header{padding:var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x);margin-bottom:0;color:var(--bs-card-cap-color);background-color:var(--bs-card-cap-bg);border-bottom:var(--bs-card-border-width) solid var(--bs-card-border-color)}.card-header:first-child{border-radius:var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0}.card-footer{padding:var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x);color:var(--bs-card-cap-color);background-color:var(--bs-card-cap-bg);border-top:var(--bs-card-border-width) solid var(--bs-card-border-color)}.card-footer:last-child{border-radius:0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius)}.card-header-tabs{margin-right:calc(-.5 * var(--bs-card-cap-padding-x));margin-bottom:calc(-1 * var(--bs-card-cap-padding-y));margin-left:calc(-.5 * var(--bs-card-cap-padding-x));border-bottom:0}.card-header-tabs .nav-link.active{background-color:var(--bs-card-bg);border-bottom-color:var(--bs-card-bg)}.card-header-pills{margin-right:calc(-.5 * var(--bs-card-cap-padding-x));margin-left:calc(-.5 * var(--bs-card-cap-padding-x))}.card-img-overlay{position:absolute;top:0;right:0;bottom:0;left:0;padding:var(--bs-card-img-overlay-padding);border-radius:var(--bs-card-inner-border-radius)}.card-img,.card-img-bottom,.card-img-top{width:100%}.card-img,.card-img-top{border-top-left-radius:var(--bs-card-inner-border-radius);border-top-right-radius:var(--bs-card-inner-border-radius)}.card-img,.card-img-bottom{border-bottom-right-radius:var(--bs-card-inner-border-radius);border-bottom-left-radius:var(--bs-card-inner-border-radius)}.card-group>.card{margin-bottom:var(--bs-card-group-margin)}@media (min-width:576px){.card-group{display:flex;flex-flow:row wrap}.card-group>.card{flex:1 0 0%;margin-bottom:0}.card-group>.card+.card{margin-left:0;border-left:0}.card-group>.card:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.card-group>.card:not(:last-child) .card-header,.card-group>.card:not(:last-child) .card-img-top{border-top-right-radius:0}.card-group>.card:not(:last-child) .card-footer,.card-group>.card:not(:last-child) .card-img-bottom{border-bottom-right-radius:0}.card-group>.card:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.card-group>.card:not(:first-child) .card-header,.card-group>.card:not(:first-child) .card-img-top{border-top-left-radius:0}.card-group>.card:not(:first-child) .card-footer,.card-group>.card:not(:first-child) .card-img-bottom{border-bottom-left-radius:0}}.accordion{--bs-accordion-color:#212529;--bs-accordion-bg:#fff;--bs-accordion-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out,border-radius 0.15s ease;--bs-accordion-border-color:var(--bs-border-color);--bs-accordion-border-width:1px;--bs-accordion-border-radius:0.375rem;--bs-accordion-inner-border-radius:calc(0.375rem - 1px);--bs-accordion-btn-padding-x:1.25rem;--bs-accordion-btn-padding-y:1rem;--bs-accordion-btn-color:#212529;--bs-accordion-btn-bg:var(--bs-accordion-bg);--bs-accordion-btn-icon:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");--bs-accordion-btn-icon-width:1.25rem;--bs-accordion-btn-icon-transform:rotate(-180deg);--bs-accordion-btn-icon-transition:transform 0.2s ease-in-out;--bs-accordion-btn-active-icon:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");--bs-accordion-btn-focus-border-color:#86b7fe;--bs-accordion-btn-focus-box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.25);--bs-accordion-body-padding-x:1.25rem;--bs-accordion-body-padding-y:1rem;--bs-accordion-active-color:#0c63e4;--bs-accordion-active-bg:#e7f1ff}.accordion-button{position:relative;display:flex;align-items:center;width:100%;padding:var(--bs-accordion-btn-padding-y) var(--bs-accordion-btn-padding-x);font-size:1rem;color:var(--bs-accordion-btn-color);text-align:left;background-color:var(--bs-accordion-btn-bg);border:0;border-radius:0;overflow-anchor:none;transition:var(--bs-accordion-transition)}@media (prefers-reduced-motion:reduce){.accordion-button{transition:none}}.accordion-button:not(.collapsed){color:var(--bs-accordion-active-color);background-color:var(--bs-accordion-active-bg);box-shadow:inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--bs-accordion-border-color)}.accordion-button:not(.collapsed)::after{background-image:var(--bs-accordion-btn-active-icon);transform:var(--bs-accordion-btn-icon-transform)}.accordion-button::after{flex-shrink:0;width:var(--bs-accordion-btn-icon-width);height:var(--bs-accordion-btn-icon-width);margin-left:auto;content:"";background-image:var(--bs-accordion-btn-icon);background-repeat:no-repeat;background-size:var(--bs-accordion-btn-icon-width);transition:var(--bs-accordion-btn-icon-transition)}@media (prefers-reduced-motion:reduce){.accordion-button::after{transition:none}}.accordion-button:hover{z-index:2}.accordion-button:focus{z-index:3;border-color:var(--bs-accordion-btn-focus-border-color);outline:0;box-shadow:var(--bs-accordion-btn-focus-box-shadow)}.accordion-header{margin-bottom:0}.accordion-item{color:var(--bs-accordion-color);background-color:var(--bs-accordion-bg);border:var(--bs-accordion-border-width) solid var(--bs-accordion-border-color)}.accordion-item:first-of-type{border-top-left-radius:var(--bs-accordion-border-radius);border-top-right-radius:var(--bs-accordion-border-radius)}.accordion-item:first-of-type .accordion-button{border-top-left-radius:var(--bs-accordion-inner-border-radius);border-top-right-radius:var(--bs-accordion-inner-border-radius)}.accordion-item:not(:first-of-type){border-top:0}.accordion-item:last-of-type{border-bottom-right-radius:var(--bs-accordion-border-radius);border-bottom-left-radius:var(--bs-accordion-border-radius)}.accordion-item:last-of-type .accordion-button.collapsed{border-bottom-right-radius:var(--bs-accordion-inner-border-radius);border-bottom-left-radius:var(--bs-accordion-inner-border-radius)}.accordion-item:last-of-type .accordion-collapse{border-bottom-right-radius:var(--bs-accordion-border-radius);border-bottom-left-radius:var(--bs-accordion-border-radius)}.accordion-body{padding:var(--bs-accordion-body-padding-y) var(--bs-accordion-body-padding-x)}.accordion-flush .accordion-collapse{border-width:0}.accordion-flush .accordion-item{border-right:0;border-left:0;border-radius:0}.accordion-flush .accordion-item:first-child{border-top:0}.accordion-flush .accordion-item:last-child{border-bottom:0}.accordion-flush .accordion-item .accordion-button,.accordion-flush .accordion-item .accordion-button.collapsed{border-radius:0}.breadcrumb{--bs-breadcrumb-padding-x:0;--bs-breadcrumb-padding-y:0;--bs-breadcrumb-margin-bottom:1rem;--bs-breadcrumb-bg: ;--bs-breadcrumb-border-radius: ;--bs-breadcrumb-divider-color:#6c757d;--bs-breadcrumb-item-padding-x:0.5rem;--bs-breadcrumb-item-active-color:#6c757d;display:flex;flex-wrap:wrap;padding:var(--bs-breadcrumb-padding-y) var(--bs-breadcrumb-padding-x);margin-bottom:var(--bs-breadcrumb-margin-bottom);font-size:var(--bs-breadcrumb-font-size);list-style:none;background-color:var(--bs-breadcrumb-bg);border-radius:var(--bs-breadcrumb-border-radius)}.breadcrumb-item+.breadcrumb-item{padding-left:var(--bs-breadcrumb-item-padding-x)}.breadcrumb-item+.breadcrumb-item::before{float:left;padding-right:var(--bs-breadcrumb-item-padding-x);color:var(--bs-breadcrumb-divider-color);content:var(--bs-breadcrumb-divider, "/")}.breadcrumb-item.active{color:var(--bs-breadcrumb-item-active-color)}.pagination{--bs-pagination-padding-x:0.75rem;--bs-pagination-padding-y:0.375rem;--bs-pagination-font-size:1rem;--bs-pagination-color:var(--bs-link-color);--bs-pagination-bg:#fff;--bs-pagination-border-width:1px;--bs-pagination-border-color:#dee2e6;--bs-pagination-border-radius:0.375rem;--bs-pagination-hover-color:var(--bs-link-hover-color);--bs-pagination-hover-bg:#e9ecef;--bs-pagination-hover-border-color:#dee2e6;--bs-pagination-focus-color:var(--bs-link-hover-color);--bs-pagination-focus-bg:#e9ecef;--bs-pagination-focus-box-shadow:0 0 0 0.25rem rgba(13, 110, 253, 0.25);--bs-pagination-active-color:#fff;--bs-pagination-active-bg:#0d6efd;--bs-pagination-active-border-color:#0d6efd;--bs-pagination-disabled-color:#6c757d;--bs-pagination-disabled-bg:#fff;--bs-pagination-disabled-border-color:#dee2e6;display:flex;padding-left:0;list-style:none}.page-link{position:relative;display:block;padding:var(--bs-pagination-padding-y) var(--bs-pagination-padding-x);font-size:var(--bs-pagination-font-size);color:var(--bs-pagination-color);text-decoration:none;background-color:var(--bs-pagination-bg);border:var(--bs-pagination-border-width) solid var(--bs-pagination-border-color);transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media (prefers-reduced-motion:reduce){.page-link{transition:none}}.page-link:hover{z-index:2;color:var(--bs-pagination-hover-color);background-color:var(--bs-pagination-hover-bg);border-color:var(--bs-pagination-hover-border-color)}.page-link:focus{z-index:3;color:var(--bs-pagination-focus-color);background-color:var(--bs-pagination-focus-bg);outline:0;box-shadow:var(--bs-pagination-focus-box-shadow)}.active>.page-link,.page-link.active{z-index:3;color:var(--bs-pagination-active-color);background-color:var(--bs-pagination-active-bg);border-color:var(--bs-pagination-active-border-color)}.disabled>.page-link,.page-link.disabled{color:var(--bs-pagination-disabled-color);pointer-events:none;background-color:var(--bs-pagination-disabled-bg);border-color:var(--bs-pagination-disabled-border-color)}.page-item:not(:first-child) .page-link{margin-left:-1px}.page-item:first-child .page-link{border-top-left-radius:var(--bs-pagination-border-radius);border-bottom-left-radius:var(--bs-pagination-border-radius)}.page-item:last-child .page-link{border-top-right-radius:var(--bs-pagination-border-radius);border-bottom-right-radius:var(--bs-pagination-border-radius)}.pagination-lg{--bs-pagination-padding-x:1.5rem;--bs-pagination-padding-y:0.75rem;--bs-pagination-font-size:1.25rem;--bs-pagination-border-radius:0.5rem}.pagination-sm{--bs-pagination-padding-x:0.5rem;--bs-pagination-padding-y:0.25rem;--bs-pagination-font-size:0.875rem;--bs-pagination-border-radius:0.25rem}.badge{--bs-badge-padding-x:0.65em;--bs-badge-padding-y:0.35em;--bs-badge-font-size:0.75em;--bs-badge-font-weight:700;--bs-badge-color:#fff;--bs-badge-border-radius:0.375rem;display:inline-block;padding:var(--bs-badge-padding-y) var(--bs-badge-padding-x);font-size:var(--bs-badge-font-size);font-weight:var(--bs-badge-font-weight);line-height:1;color:var(--bs-badge-color);text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:var(--bs-badge-border-radius)}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.alert{--bs-alert-bg:transparent;--bs-alert-padding-x:1rem;--bs-alert-padding-y:1rem;--bs-alert-margin-bottom:1rem;--bs-alert-color:inherit;--bs-alert-border-color:transparent;--bs-alert-border:1px solid var(--bs-alert-border-color);--bs-alert-border-radius:0.375rem;position:relative;padding:var(--bs-alert-padding-y) var(--bs-alert-padding-x);margin-bottom:var(--bs-alert-margin-bottom);color:var(--bs-alert-color);background-color:var(--bs-alert-bg);border:var(--bs-alert-border);border-radius:var(--bs-alert-border-radius)}.alert-heading{color:inherit}.alert-link{font-weight:700}.alert-dismissible{padding-right:3rem}.alert-dismissible .btn-close{position:absolute;top:0;right:0;z-index:2;padding:1.25rem 1rem}.alert-primary{--bs-alert-color:#084298;--bs-alert-bg:#cfe2ff;--bs-alert-border-color:#b6d4fe}.alert-primary .alert-link{color:#06357a}.alert-secondary{--bs-alert-color:#41464b;--bs-alert-bg:#e2e3e5;--bs-alert-border-color:#d3d6d8}.alert-secondary .alert-link{color:#34383c}.alert-success{--bs-alert-color:#0f5132;--bs-alert-bg:#d1e7dd;--bs-alert-border-color:#badbcc}.alert-success .alert-link{color:#0c4128}.alert-info{--bs-alert-color:#055160;--bs-alert-bg:#cff4fc;--bs-alert-border-color:#b6effb}.alert-info .alert-link{color:#04414d}.alert-warning{--bs-alert-color:#664d03;--bs-alert-bg:#fff3cd;--bs-alert-border-color:#ffecb5}.alert-warning .alert-link{color:#523e02}.alert-danger{--bs-alert-color:#842029;--bs-alert-bg:#f8d7da;--bs-alert-border-color:#f5c2c7}.alert-danger .alert-link{color:#6a1a21}.alert-light{--bs-alert-color:#636464;--bs-alert-bg:#fefefe;--bs-alert-border-color:#fdfdfe}.alert-light .alert-link{color:#4f5050}.alert-dark{--bs-alert-color:#141619;--bs-alert-bg:#d3d3d4;--bs-alert-border-color:#bcbebf}.alert-dark .alert-link{color:#101214}@keyframes progress-bar-stripes{0%{background-position-x:1rem}}.progress{--bs-progress-height:1rem;--bs-progress-font-size:0.75rem;--bs-progress-bg:#e9ecef;--bs-progress-border-radius:0.375rem;--bs-progress-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-progress-bar-color:#fff;--bs-progress-bar-bg:#0d6efd;--bs-progress-bar-transition:width 0.6s ease;display:flex;height:var(--bs-progress-height);overflow:hidden;font-size:var(--bs-progress-font-size);background-color:var(--bs-progress-bg);border-radius:var(--bs-progress-border-radius)}.progress-bar{display:flex;flex-direction:column;justify-content:center;overflow:hidden;color:var(--bs-progress-bar-color);text-align:center;white-space:nowrap;background-color:var(--bs-progress-bar-bg);transition:var(--bs-progress-bar-transition)}@media (prefers-reduced-motion:reduce){.progress-bar{transition:none}}.progress-bar-striped{background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-size:var(--bs-progress-height) var(--bs-progress-height)}.progress-bar-animated{animation:1s linear infinite progress-bar-stripes}@media (prefers-reduced-motion:reduce){.progress-bar-animated{animation:none}}.list-group{--bs-list-group-color:#212529;--bs-list-group-bg:#fff;--bs-list-group-border-color:rgba(0, 0, 0, 0.125);--bs-list-group-border-width:1px;--bs-list-group-border-radius:0.375rem;--bs-list-group-item-padding-x:1rem;--bs-list-group-item-padding-y:0.5rem;--bs-list-group-action-color:#495057;--bs-list-group-action-hover-color:#495057;--bs-list-group-action-hover-bg:#f8f9fa;--bs-list-group-action-active-color:#212529;--bs-list-group-action-active-bg:#e9ecef;--bs-list-group-disabled-color:#6c757d;--bs-list-group-disabled-bg:#fff;--bs-list-group-active-color:#fff;--bs-list-group-active-bg:#0d6efd;--bs-list-group-active-border-color:#0d6efd;display:flex;flex-direction:column;padding-left:0;margin-bottom:0;border-radius:var(--bs-list-group-border-radius)}.list-group-numbered{list-style-type:none;counter-reset:section}.list-group-numbered>.list-group-item::before{content:counters(section, ".") ". ";counter-increment:section}.list-group-item-action{width:100%;color:var(--bs-list-group-action-color);text-align:inherit}.list-group-item-action:focus,.list-group-item-action:hover{z-index:1;color:var(--bs-list-group-action-hover-color);text-decoration:none;background-color:var(--bs-list-group-action-hover-bg)}.list-group-item-action:active{color:var(--bs-list-group-action-active-color);background-color:var(--bs-list-group-action-active-bg)}.list-group-item{position:relative;display:block;padding:var(--bs-list-group-item-padding-y) var(--bs-list-group-item-padding-x);color:var(--bs-list-group-color);text-decoration:none;background-color:var(--bs-list-group-bg);border:var(--bs-list-group-border-width) solid var(--bs-list-group-border-color)}.list-group-item:first-child{border-top-left-radius:inherit;border-top-right-radius:inherit}.list-group-item:last-child{border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.list-group-item.disabled,.list-group-item:disabled{color:var(--bs-list-group-disabled-color);pointer-events:none;background-color:var(--bs-list-group-disabled-bg)}.list-group-item.active{z-index:2;color:var(--bs-list-group-active-color);background-color:var(--bs-list-group-active-bg);border-color:var(--bs-list-group-active-border-color)}.list-group-item+.list-group-item{border-top-width:0}.list-group-item+.list-group-item.active{margin-top:calc(-1 * var(--bs-list-group-border-width));border-top-width:var(--bs-list-group-border-width)}.list-group-horizontal{flex-direction:row}.list-group-horizontal>.list-group-item:first-child:not(:last-child){border-bottom-left-radius:var(--bs-list-group-border-radius);border-top-right-radius:0}.list-group-horizontal>.list-group-item:last-child:not(:first-child){border-top-right-radius:var(--bs-list-group-border-radius);border-bottom-left-radius:0}.list-group-horizontal>.list-group-item.active{margin-top:0}.list-group-horizontal>.list-group-item+.list-group-item{border-top-width:var(--bs-list-group-border-width);border-left-width:0}.list-group-horizontal>.list-group-item+.list-group-item.active{margin-left:calc(-1 * var(--bs-list-group-border-width));border-left-width:var(--bs-list-group-border-width)}@media (min-width:576px){.list-group-horizontal-sm{flex-direction:row}.list-group-horizontal-sm>.list-group-item:first-child:not(:last-child){border-bottom-left-radius:var(--bs-list-group-border-radius);border-top-right-radius:0}.list-group-horizontal-sm>.list-group-item:last-child:not(:first-child){border-top-right-radius:var(--bs-list-group-border-radius);border-bottom-left-radius:0}.list-group-horizontal-sm>.list-group-item.active{margin-top:0}.list-group-horizontal-sm>.list-group-item+.list-group-item{border-top-width:var(--bs-list-group-border-width);border-left-width:0}.list-group-horizontal-sm>.list-group-item+.list-group-item.active{margin-left:calc(-1 * var(--bs-list-group-border-width));border-left-width:var(--bs-list-group-border-width)}}@media (min-width:768px){.list-group-horizontal-md{flex-direction:row}.list-group-horizontal-md>.list-group-item:first-child:not(:last-child){border-bottom-left-radius:var(--bs-list-group-border-radius);border-top-right-radius:0}.list-group-horizontal-md>.list-group-item:last-child:not(:first-child){border-top-right-radius:var(--bs-list-group-border-radius);border-bottom-left-radius:0}.list-group-horizontal-md>.list-group-item.active{margin-top:0}.list-group-horizontal-md>.list-group-item+.list-group-item{border-top-width:var(--bs-list-group-border-width);border-left-width:0}.list-group-horizontal-md>.list-group-item+.list-group-item.active{margin-left:calc(-1 * var(--bs-list-group-border-width));border-left-width:var(--bs-list-group-border-width)}}@media (min-width:992px){.list-group-horizontal-lg{flex-direction:row}.list-group-horizontal-lg>.list-group-item:first-child:not(:last-child){border-bottom-left-radius:var(--bs-list-group-border-radius);border-top-right-radius:0}.list-group-horizontal-lg>.list-group-item:last-child:not(:first-child){border-top-right-radius:var(--bs-list-group-border-radius);border-bottom-left-radius:0}.list-group-horizontal-lg>.list-group-item.active{margin-top:0}.list-group-horizontal-lg>.list-group-item+.list-group-item{border-top-width:var(--bs-list-group-border-width);border-left-width:0}.list-group-horizontal-lg>.list-group-item+.list-group-item.active{margin-left:calc(-1 * var(--bs-list-group-border-width));border-left-width:var(--bs-list-group-border-width)}}@media (min-width:1200px){.list-group-horizontal-xl{flex-direction:row}.list-group-horizontal-xl>.list-group-item:first-child:not(:last-child){border-bottom-left-radius:var(--bs-list-group-border-radius);border-top-right-radius:0}.list-group-horizontal-xl>.list-group-item:last-child:not(:first-child){border-top-right-radius:var(--bs-list-group-border-radius);border-bottom-left-radius:0}.list-group-horizontal-xl>.list-group-item.active{margin-top:0}.list-group-horizontal-xl>.list-group-item+.list-group-item{border-top-width:var(--bs-list-group-border-width);border-left-width:0}.list-group-horizontal-xl>.list-group-item+.list-group-item.active{margin-left:calc(-1 * var(--bs-list-group-border-width));border-left-width:var(--bs-list-group-border-width)}}@media (min-width:1400px){.list-group-horizontal-xxl{flex-direction:row}.list-group-horizontal-xxl>.list-group-item:first-child:not(:last-child){border-bottom-left-radius:var(--bs-list-group-border-radius);border-top-right-radius:0}.list-group-horizontal-xxl>.list-group-item:last-child:not(:first-child){border-top-right-radius:var(--bs-list-group-border-radius);border-bottom-left-radius:0}.list-group-horizontal-xxl>.list-group-item.active{margin-top:0}.list-group-horizontal-xxl>.list-group-item+.list-group-item{border-top-width:var(--bs-list-group-border-width);border-left-width:0}.list-group-horizontal-xxl>.list-group-item+.list-group-item.active{margin-left:calc(-1 * var(--bs-list-group-border-width));border-left-width:var(--bs-list-group-border-width)}}.list-group-flush{border-radius:0}.list-group-flush>.list-group-item{border-width:0 0 var(--bs-list-group-border-width)}.list-group-flush>.list-group-item:last-child{border-bottom-width:0}.list-group-item-primary{color:#084298;background-color:#cfe2ff}.list-group-item-primary.list-group-item-action:focus,.list-group-item-primary.list-group-item-action:hover{color:#084298;background-color:#bacbe6}.list-group-item-primary.list-group-item-action.active{color:#fff;background-color:#084298;border-color:#084298}.list-group-item-secondary{color:#41464b;background-color:#e2e3e5}.list-group-item-secondary.list-group-item-action:focus,.list-group-item-secondary.list-group-item-action:hover{color:#41464b;background-color:#cbccce}.list-group-item-secondary.list-group-item-action.active{color:#fff;background-color:#41464b;border-color:#41464b}.list-group-item-success{color:#0f5132;background-color:#d1e7dd}.list-group-item-success.list-group-item-action:focus,.list-group-item-success.list-group-item-action:hover{color:#0f5132;background-color:#bcd0c7}.list-group-item-success.list-group-item-action.active{color:#fff;background-color:#0f5132;border-color:#0f5132}.list-group-item-info{color:#055160;background-color:#cff4fc}.list-group-item-info.list-group-item-action:focus,.list-group-item-info.list-group-item-action:hover{color:#055160;background-color:#badce3}.list-group-item-info.list-group-item-action.active{color:#fff;background-color:#055160;border-color:#055160}.list-group-item-warning{color:#664d03;background-color:#fff3cd}.list-group-item-warning.list-group-item-action:focus,.list-group-item-warning.list-group-item-action:hover{color:#664d03;background-color:#e6dbb9}.list-group-item-warning.list-group-item-action.active{color:#fff;background-color:#664d03;border-color:#664d03}.list-group-item-danger{color:#842029;background-color:#f8d7da}.list-group-item-danger.list-group-item-action:focus,.list-group-item-danger.list-group-item-action:hover{color:#842029;background-color:#dfc2c4}.list-group-item-danger.list-group-item-action.active{color:#fff;background-color:#842029;border-color:#842029}.list-group-item-light{color:#636464;background-color:#fefefe}.list-group-item-light.list-group-item-action:focus,.list-group-item-light.list-group-item-action:hover{color:#636464;background-color:#e5e5e5}.list-group-item-light.list-group-item-action.active{color:#fff;background-color:#636464;border-color:#636464}.list-group-item-dark{color:#141619;background-color:#d3d3d4}.list-group-item-dark.list-group-item-action:focus,.list-group-item-dark.list-group-item-action:hover{color:#141619;background-color:#bebebf}.list-group-item-dark.list-group-item-action.active{color:#fff;background-color:#141619;border-color:#141619}.btn-close{box-sizing:content-box;width:1em;height:1em;padding:.25em .25em;color:#000;background:transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;border:0;border-radius:.375rem;opacity:.5}.btn-close:hover{color:#000;text-decoration:none;opacity:.75}.btn-close:focus{outline:0;box-shadow:0 0 0 .25rem rgba(13,110,253,.25);opacity:1}.btn-close.disabled,.btn-close:disabled{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:.25}.btn-close-white{filter:invert(1) grayscale(100%) brightness(200%)}.toast{--bs-toast-zindex:1090;--bs-toast-padding-x:0.75rem;--bs-toast-padding-y:0.5rem;--bs-toast-spacing:1.5rem;--bs-toast-max-width:350px;--bs-toast-font-size:0.875rem;--bs-toast-color: ;--bs-toast-bg:rgba(255, 255, 255, 0.85);--bs-toast-border-width:1px;--bs-toast-border-color:var(--bs-border-color-translucent);--bs-toast-border-radius:0.375rem;--bs-toast-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-toast-header-color:#6c757d;--bs-toast-header-bg:rgba(255, 255, 255, 0.85);--bs-toast-header-border-color:rgba(0, 0, 0, 0.05);width:var(--bs-toast-max-width);max-width:100%;font-size:var(--bs-toast-font-size);color:var(--bs-toast-color);pointer-events:auto;background-color:var(--bs-toast-bg);background-clip:padding-box;border:var(--bs-toast-border-width) solid var(--bs-toast-border-color);box-shadow:var(--bs-toast-box-shadow);border-radius:var(--bs-toast-border-radius)}.toast.showing{opacity:0}.toast:not(.show){display:none}.toast-container{--bs-toast-zindex:1090;position:absolute;z-index:var(--bs-toast-zindex);width:-webkit-max-content;width:-moz-max-content;width:max-content;max-width:100%;pointer-events:none}.toast-container>:not(:last-child){margin-bottom:var(--bs-toast-spacing)}.toast-header{display:flex;align-items:center;padding:var(--bs-toast-padding-y) var(--bs-toast-padding-x);color:var(--bs-toast-header-color);background-color:var(--bs-toast-header-bg);background-clip:padding-box;border-bottom:var(--bs-toast-border-width) solid var(--bs-toast-header-border-color);border-top-left-radius:calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width));border-top-right-radius:calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width))}.toast-header .btn-close{margin-right:calc(-.5 * var(--bs-toast-padding-x));margin-left:var(--bs-toast-padding-x)}.toast-body{padding:var(--bs-toast-padding-x);word-wrap:break-word}.modal{--bs-modal-zindex:1055;--bs-modal-width:500px;--bs-modal-padding:1rem;--bs-modal-margin:0.5rem;--bs-modal-color: ;--bs-modal-bg:#fff;--bs-modal-border-color:var(--bs-border-color-translucent);--bs-modal-border-width:1px;--bs-modal-border-radius:0.5rem;--bs-modal-box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-modal-inner-border-radius:calc(0.5rem - 1px);--bs-modal-header-padding-x:1rem;--bs-modal-header-padding-y:1rem;--bs-modal-header-padding:1rem 1rem;--bs-modal-header-border-color:var(--bs-border-color);--bs-modal-header-border-width:1px;--bs-modal-title-line-height:1.5;--bs-modal-footer-gap:0.5rem;--bs-modal-footer-bg: ;--bs-modal-footer-border-color:var(--bs-border-color);--bs-modal-footer-border-width:1px;position:fixed;top:0;left:0;z-index:var(--bs-modal-zindex);display:none;width:100%;height:100%;overflow-x:hidden;overflow-y:auto;outline:0}.modal-dialog{position:relative;width:auto;margin:var(--bs-modal-margin);pointer-events:none}.modal.fade .modal-dialog{transition:transform .3s ease-out;transform:translate(0,-50px)}@media (prefers-reduced-motion:reduce){.modal.fade .modal-dialog{transition:none}}.modal.show .modal-dialog{transform:none}.modal.modal-static .modal-dialog{transform:scale(1.02)}.modal-dialog-scrollable{height:calc(100% - var(--bs-modal-margin) * 2)}.modal-dialog-scrollable .modal-content{max-height:100%;overflow:hidden}.modal-dialog-scrollable .modal-body{overflow-y:auto}.modal-dialog-centered{display:flex;align-items:center;min-height:calc(100% - var(--bs-modal-margin) * 2)}.modal-content{position:relative;display:flex;flex-direction:column;width:100%;color:var(--bs-modal-color);pointer-events:auto;background-color:var(--bs-modal-bg);background-clip:padding-box;border:var(--bs-modal-border-width) solid var(--bs-modal-border-color);border-radius:var(--bs-modal-border-radius);outline:0}.modal-backdrop{--bs-backdrop-zindex:1050;--bs-backdrop-bg:#000;--bs-backdrop-opacity:0.5;position:fixed;top:0;left:0;z-index:var(--bs-backdrop-zindex);width:100vw;height:100vh;background-color:var(--bs-backdrop-bg)}.modal-backdrop.fade{opacity:0}.modal-backdrop.show{opacity:var(--bs-backdrop-opacity)}.modal-header{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:var(--bs-modal-header-padding);border-bottom:var(--bs-modal-header-border-width) solid var(--bs-modal-header-border-color);border-top-left-radius:var(--bs-modal-inner-border-radius);border-top-right-radius:var(--bs-modal-inner-border-radius)}.modal-header .btn-close{padding:calc(var(--bs-modal-header-padding-y) * .5) calc(var(--bs-modal-header-padding-x) * .5);margin:calc(-.5 * var(--bs-modal-header-padding-y)) calc(-.5 * var(--bs-modal-header-padding-x)) calc(-.5 * var(--bs-modal-header-padding-y)) auto}.modal-title{margin-bottom:0;line-height:var(--bs-modal-title-line-height)}.modal-body{position:relative;flex:1 1 auto;padding:var(--bs-modal-padding)}.modal-footer{display:flex;flex-shrink:0;flex-wrap:wrap;align-items:center;justify-content:flex-end;padding:calc(var(--bs-modal-padding) - var(--bs-modal-footer-gap) * .5);background-color:var(--bs-modal-footer-bg);border-top:var(--bs-modal-footer-border-width) solid var(--bs-modal-footer-border-color);border-bottom-right-radius:var(--bs-modal-inner-border-radius);border-bottom-left-radius:var(--bs-modal-inner-border-radius)}.modal-footer>*{margin:calc(var(--bs-modal-footer-gap) * .5)}@media (min-width:576px){.modal{--bs-modal-margin:1.75rem;--bs-modal-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15)}.modal-dialog{max-width:var(--bs-modal-width);margin-right:auto;margin-left:auto}.modal-sm{--bs-modal-width:300px}}@media (min-width:992px){.modal-lg,.modal-xl{--bs-modal-width:800px}}@media (min-width:1200px){.modal-xl{--bs-modal-width:1140px}}.modal-fullscreen{width:100vw;max-width:none;height:100%;margin:0}.modal-fullscreen .modal-content{height:100%;border:0;border-radius:0}.modal-fullscreen .modal-footer,.modal-fullscreen .modal-header{border-radius:0}.modal-fullscreen .modal-body{overflow-y:auto}@media (max-width:575.98px){.modal-fullscreen-sm-down{width:100vw;max-width:none;height:100%;margin:0}.modal-fullscreen-sm-down .modal-content{height:100%;border:0;border-radius:0}.modal-fullscreen-sm-down .modal-footer,.modal-fullscreen-sm-down .modal-header{border-radius:0}.modal-fullscreen-sm-down .modal-body{overflow-y:auto}}@media (max-width:767.98px){.modal-fullscreen-md-down{width:100vw;max-width:none;height:100%;margin:0}.modal-fullscreen-md-down .modal-content{height:100%;border:0;border-radius:0}.modal-fullscreen-md-down .modal-footer,.modal-fullscreen-md-down .modal-header{border-radius:0}.modal-fullscreen-md-down .modal-body{overflow-y:auto}}@media (max-width:991.98px){.modal-fullscreen-lg-down{width:100vw;max-width:none;height:100%;margin:0}.modal-fullscreen-lg-down .modal-content{height:100%;border:0;border-radius:0}.modal-fullscreen-lg-down .modal-footer,.modal-fullscreen-lg-down .modal-header{border-radius:0}.modal-fullscreen-lg-down .modal-body{overflow-y:auto}}@media (max-width:1199.98px){.modal-fullscreen-xl-down{width:100vw;max-width:none;height:100%;margin:0}.modal-fullscreen-xl-down .modal-content{height:100%;border:0;border-radius:0}.modal-fullscreen-xl-down .modal-footer,.modal-fullscreen-xl-down .modal-header{border-radius:0}.modal-fullscreen-xl-down .modal-body{overflow-y:auto}}@media (max-width:1399.98px){.modal-fullscreen-xxl-down{width:100vw;max-width:none;height:100%;margin:0}.modal-fullscreen-xxl-down .modal-content{height:100%;border:0;border-radius:0}.modal-fullscreen-xxl-down .modal-footer,.modal-fullscreen-xxl-down .modal-header{border-radius:0}.modal-fullscreen-xxl-down .modal-body{overflow-y:auto}}.tooltip{--bs-tooltip-zindex:1080;--bs-tooltip-max-width:200px;--bs-tooltip-padding-x:0.5rem;--bs-tooltip-padding-y:0.25rem;--bs-tooltip-margin: ;--bs-tooltip-font-size:0.875rem;--bs-tooltip-color:#fff;--bs-tooltip-bg:#000;--bs-tooltip-border-radius:0.375rem;--bs-tooltip-opacity:0.9;--bs-tooltip-arrow-width:0.8rem;--bs-tooltip-arrow-height:0.4rem;z-index:var(--bs-tooltip-zindex);display:block;padding:var(--bs-tooltip-arrow-height);margin:var(--bs-tooltip-margin);font-family:var(--bs-font-sans-serif);font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;white-space:normal;word-spacing:normal;line-break:auto;font-size:var(--bs-tooltip-font-size);word-wrap:break-word;opacity:0}.tooltip.show{opacity:var(--bs-tooltip-opacity)}.tooltip .tooltip-arrow{display:block;width:var(--bs-tooltip-arrow-width);height:var(--bs-tooltip-arrow-height)}.tooltip .tooltip-arrow::before{position:absolute;content:"";border-color:transparent;border-style:solid}.bs-tooltip-auto[data-popper-placement^=top] .tooltip-arrow,.bs-tooltip-top .tooltip-arrow{bottom:0}.bs-tooltip-auto[data-popper-placement^=top] .tooltip-arrow::before,.bs-tooltip-top .tooltip-arrow::before{top:-1px;border-width:var(--bs-tooltip-arrow-height) calc(var(--bs-tooltip-arrow-width) * .5) 0;border-top-color:var(--bs-tooltip-bg)}.bs-tooltip-auto[data-popper-placement^=right] .tooltip-arrow,.bs-tooltip-end .tooltip-arrow{left:0;width:var(--bs-tooltip-arrow-height);height:var(--bs-tooltip-arrow-width)}.bs-tooltip-auto[data-popper-placement^=right] .tooltip-arrow::before,.bs-tooltip-end .tooltip-arrow::before{right:-1px;border-width:calc(var(--bs-tooltip-arrow-width) * .5) var(--bs-tooltip-arrow-height) calc(var(--bs-tooltip-arrow-width) * .5) 0;border-right-color:var(--bs-tooltip-bg)}.bs-tooltip-auto[data-popper-placement^=bottom] .tooltip-arrow,.bs-tooltip-bottom .tooltip-arrow{top:0}.bs-tooltip-auto[data-popper-placement^=bottom] .tooltip-arrow::before,.bs-tooltip-bottom .tooltip-arrow::before{bottom:-1px;border-width:0 calc(var(--bs-tooltip-arrow-width) * .5) var(--bs-tooltip-arrow-height);border-bottom-color:var(--bs-tooltip-bg)}.bs-tooltip-auto[data-popper-placement^=left] .tooltip-arrow,.bs-tooltip-start .tooltip-arrow{right:0;width:var(--bs-tooltip-arrow-height);height:var(--bs-tooltip-arrow-width)}.bs-tooltip-auto[data-popper-placement^=left] .tooltip-arrow::before,.bs-tooltip-start .tooltip-arrow::before{left:-1px;border-width:calc(var(--bs-tooltip-arrow-width) * .5) 0 calc(var(--bs-tooltip-arrow-width) * .5) var(--bs-tooltip-arrow-height);border-left-color:var(--bs-tooltip-bg)}.tooltip-inner{max-width:var(--bs-tooltip-max-width);padding:var(--bs-tooltip-padding-y) var(--bs-tooltip-padding-x);color:var(--bs-tooltip-color);text-align:center;background-color:var(--bs-tooltip-bg);border-radius:var(--bs-tooltip-border-radius)}.popover{--bs-popover-zindex:1070;--bs-popover-max-width:276px;--bs-popover-font-size:0.875rem;--bs-popover-bg:#fff;--bs-popover-border-width:1px;--bs-popover-border-color:var(--bs-border-color-translucent);--bs-popover-border-radius:0.5rem;--bs-popover-inner-border-radius:calc(0.5rem - 1px);--bs-popover-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-popover-header-padding-x:1rem;--bs-popover-header-padding-y:0.5rem;--bs-popover-header-font-size:1rem;--bs-popover-header-color: ;--bs-popover-header-bg:#f0f0f0;--bs-popover-body-padding-x:1rem;--bs-popover-body-padding-y:1rem;--bs-popover-body-color:#212529;--bs-popover-arrow-width:1rem;--bs-popover-arrow-height:0.5rem;--bs-popover-arrow-border:var(--bs-popover-border-color);z-index:var(--bs-popover-zindex);display:block;max-width:var(--bs-popover-max-width);font-family:var(--bs-font-sans-serif);font-style:normal;font-weight:400;line-height:1.5;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;white-space:normal;word-spacing:normal;line-break:auto;font-size:var(--bs-popover-font-size);word-wrap:break-word;background-color:var(--bs-popover-bg);background-clip:padding-box;border:var(--bs-popover-border-width) solid var(--bs-popover-border-color);border-radius:var(--bs-popover-border-radius)}.popover .popover-arrow{display:block;width:var(--bs-popover-arrow-width);height:var(--bs-popover-arrow-height)}.popover .popover-arrow::after,.popover .popover-arrow::before{position:absolute;display:block;content:"";border-color:transparent;border-style:solid;border-width:0}.bs-popover-auto[data-popper-placement^=top]>.popover-arrow,.bs-popover-top>.popover-arrow{bottom:calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width))}.bs-popover-auto[data-popper-placement^=top]>.popover-arrow::after,.bs-popover-auto[data-popper-placement^=top]>.popover-arrow::before,.bs-popover-top>.popover-arrow::after,.bs-popover-top>.popover-arrow::before{border-width:var(--bs-popover-arrow-height) calc(var(--bs-popover-arrow-width) * .5) 0}.bs-popover-auto[data-popper-placement^=top]>.popover-arrow::before,.bs-popover-top>.popover-arrow::before{bottom:0;border-top-color:var(--bs-popover-arrow-border)}.bs-popover-auto[data-popper-placement^=top]>.popover-arrow::after,.bs-popover-top>.popover-arrow::after{bottom:var(--bs-popover-border-width);border-top-color:var(--bs-popover-bg)}.bs-popover-auto[data-popper-placement^=right]>.popover-arrow,.bs-popover-end>.popover-arrow{left:calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width));width:var(--bs-popover-arrow-height);height:var(--bs-popover-arrow-width)}.bs-popover-auto[data-popper-placement^=right]>.popover-arrow::after,.bs-popover-auto[data-popper-placement^=right]>.popover-arrow::before,.bs-popover-end>.popover-arrow::after,.bs-popover-end>.popover-arrow::before{border-width:calc(var(--bs-popover-arrow-width) * .5) var(--bs-popover-arrow-height) calc(var(--bs-popover-arrow-width) * .5) 0}.bs-popover-auto[data-popper-placement^=right]>.popover-arrow::before,.bs-popover-end>.popover-arrow::before{left:0;border-right-color:var(--bs-popover-arrow-border)}.bs-popover-auto[data-popper-placement^=right]>.popover-arrow::after,.bs-popover-end>.popover-arrow::after{left:var(--bs-popover-border-width);border-right-color:var(--bs-popover-bg)}.bs-popover-auto[data-popper-placement^=bottom]>.popover-arrow,.bs-popover-bottom>.popover-arrow{top:calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width))}.bs-popover-auto[data-popper-placement^=bottom]>.popover-arrow::after,.bs-popover-auto[data-popper-placement^=bottom]>.popover-arrow::before,.bs-popover-bottom>.popover-arrow::after,.bs-popover-bottom>.popover-arrow::before{border-width:0 calc(var(--bs-popover-arrow-width) * .5) var(--bs-popover-arrow-height)}.bs-popover-auto[data-popper-placement^=bottom]>.popover-arrow::before,.bs-popover-bottom>.popover-arrow::before{top:0;border-bottom-color:var(--bs-popover-arrow-border)}.bs-popover-auto[data-popper-placement^=bottom]>.popover-arrow::after,.bs-popover-bottom>.popover-arrow::after{top:var(--bs-popover-border-width);border-bottom-color:var(--bs-popover-bg)}.bs-popover-auto[data-popper-placement^=bottom] .popover-header::before,.bs-popover-bottom .popover-header::before{position:absolute;top:0;left:50%;display:block;width:var(--bs-popover-arrow-width);margin-left:calc(-.5 * var(--bs-popover-arrow-width));content:"";border-bottom:var(--bs-popover-border-width) solid var(--bs-popover-header-bg)}.bs-popover-auto[data-popper-placement^=left]>.popover-arrow,.bs-popover-start>.popover-arrow{right:calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width));width:var(--bs-popover-arrow-height);height:var(--bs-popover-arrow-width)}.bs-popover-auto[data-popper-placement^=left]>.popover-arrow::after,.bs-popover-auto[data-popper-placement^=left]>.popover-arrow::before,.bs-popover-start>.popover-arrow::after,.bs-popover-start>.popover-arrow::before{border-width:calc(var(--bs-popover-arrow-width) * .5) 0 calc(var(--bs-popover-arrow-width) * .5) var(--bs-popover-arrow-height)}.bs-popover-auto[data-popper-placement^=left]>.popover-arrow::before,.bs-popover-start>.popover-arrow::before{right:0;border-left-color:var(--bs-popover-arrow-border)}.bs-popover-auto[data-popper-placement^=left]>.popover-arrow::after,.bs-popover-start>.popover-arrow::after{right:var(--bs-popover-border-width);border-left-color:var(--bs-popover-bg)}.popover-header{padding:var(--bs-popover-header-padding-y) var(--bs-popover-header-padding-x);margin-bottom:0;font-size:var(--bs-popover-header-font-size);color:var(--bs-popover-header-color);background-color:var(--bs-popover-header-bg);border-bottom:var(--bs-popover-border-width) solid var(--bs-popover-border-color);border-top-left-radius:var(--bs-popover-inner-border-radius);border-top-right-radius:var(--bs-popover-inner-border-radius)}.popover-header:empty{display:none}.popover-body{padding:var(--bs-popover-body-padding-y) var(--bs-popover-body-padding-x);color:var(--bs-popover-body-color)}.carousel{position:relative}.carousel.pointer-event{touch-action:pan-y}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner::after{display:block;clear:both;content:""}.carousel-item{position:relative;display:none;float:left;width:100%;margin-right:-100%;-webkit-backface-visibility:hidden;backface-visibility:hidden;transition:transform .6s ease-in-out}@media (prefers-reduced-motion:reduce){.carousel-item{transition:none}}.carousel-item-next,.carousel-item-prev,.carousel-item.active{display:block}.active.carousel-item-end,.carousel-item-next:not(.carousel-item-start){transform:translateX(100%)}.active.carousel-item-start,.carousel-item-prev:not(.carousel-item-end){transform:translateX(-100%)}.carousel-fade .carousel-item{opacity:0;transition-property:opacity;transform:none}.carousel-fade .carousel-item-next.carousel-item-start,.carousel-fade .carousel-item-prev.carousel-item-end,.carousel-fade .carousel-item.active{z-index:1;opacity:1}.carousel-fade .active.carousel-item-end,.carousel-fade .active.carousel-item-start{z-index:0;opacity:0;transition:opacity 0s .6s}@media (prefers-reduced-motion:reduce){.carousel-fade .active.carousel-item-end,.carousel-fade .active.carousel-item-start{transition:none}}.carousel-control-next,.carousel-control-prev{position:absolute;top:0;bottom:0;z-index:1;display:flex;align-items:center;justify-content:center;width:15%;padding:0;color:#fff;text-align:center;background:0 0;border:0;opacity:.5;transition:opacity .15s ease}@media (prefers-reduced-motion:reduce){.carousel-control-next,.carousel-control-prev{transition:none}}.carousel-control-next:focus,.carousel-control-next:hover,.carousel-control-prev:focus,.carousel-control-prev:hover{color:#fff;text-decoration:none;outline:0;opacity:.9}.carousel-control-prev{left:0}.carousel-control-next{right:0}.carousel-control-next-icon,.carousel-control-prev-icon{display:inline-block;width:2rem;height:2rem;background-repeat:no-repeat;background-position:50%;background-size:100% 100%}.carousel-control-prev-icon{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e")}.carousel-control-next-icon{background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e")}.carousel-indicators{position:absolute;right:0;bottom:0;left:0;z-index:2;display:flex;justify-content:center;padding:0;margin-right:15%;margin-bottom:1rem;margin-left:15%;list-style:none}.carousel-indicators [data-bs-target]{box-sizing:content-box;flex:0 1 auto;width:30px;height:3px;padding:0;margin-right:3px;margin-left:3px;text-indent:-999px;cursor:pointer;background-color:#fff;background-clip:padding-box;border:0;border-top:10px solid transparent;border-bottom:10px solid transparent;opacity:.5;transition:opacity .6s ease}@media (prefers-reduced-motion:reduce){.carousel-indicators [data-bs-target]{transition:none}}.carousel-indicators .active{opacity:1}.carousel-caption{position:absolute;right:15%;bottom:1.25rem;left:15%;padding-top:1.25rem;padding-bottom:1.25rem;color:#fff;text-align:center}.carousel-dark .carousel-control-next-icon,.carousel-dark .carousel-control-prev-icon{filter:invert(1) grayscale(100)}.carousel-dark .carousel-indicators [data-bs-target]{background-color:#000}.carousel-dark .carousel-caption{color:#000}.spinner-border,.spinner-grow{display:inline-block;width:var(--bs-spinner-width);height:var(--bs-spinner-height);vertical-align:var(--bs-spinner-vertical-align);border-radius:50%;animation:var(--bs-spinner-animation-speed) linear infinite var(--bs-spinner-animation-name)}@keyframes spinner-border{to{transform:rotate(360deg)}}.spinner-border{--bs-spinner-width:2rem;--bs-spinner-height:2rem;--bs-spinner-vertical-align:-0.125em;--bs-spinner-border-width:0.25em;--bs-spinner-animation-speed:0.75s;--bs-spinner-animation-name:spinner-border;border:var(--bs-spinner-border-width) solid currentcolor;border-right-color:transparent}.spinner-border-sm{--bs-spinner-width:1rem;--bs-spinner-height:1rem;--bs-spinner-border-width:0.2em}@keyframes spinner-grow{0%{transform:scale(0)}50%{opacity:1;transform:none}}.spinner-grow{--bs-spinner-width:2rem;--bs-spinner-height:2rem;--bs-spinner-vertical-align:-0.125em;--bs-spinner-animation-speed:0.75s;--bs-spinner-animation-name:spinner-grow;background-color:currentcolor;opacity:0}.spinner-grow-sm{--bs-spinner-width:1rem;--bs-spinner-height:1rem}@media (prefers-reduced-motion:reduce){.spinner-border,.spinner-grow{--bs-spinner-animation-speed:1.5s}}.offcanvas,.offcanvas-lg,.offcanvas-md,.offcanvas-sm,.offcanvas-xl,.offcanvas-xxl{--bs-offcanvas-zindex:1045;--bs-offcanvas-width:400px;--bs-offcanvas-height:30vh;--bs-offcanvas-padding-x:1rem;--bs-offcanvas-padding-y:1rem;--bs-offcanvas-color: ;--bs-offcanvas-bg:#fff;--bs-offcanvas-border-width:1px;--bs-offcanvas-border-color:var(--bs-border-color-translucent);--bs-offcanvas-box-shadow:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075)}@media (max-width:575.98px){.offcanvas-sm{position:fixed;bottom:0;z-index:var(--bs-offcanvas-zindex);display:flex;flex-direction:column;max-width:100%;color:var(--bs-offcanvas-color);visibility:hidden;background-color:var(--bs-offcanvas-bg);background-clip:padding-box;outline:0;transition:transform .3s ease-in-out}}@media (max-width:575.98px) and (prefers-reduced-motion:reduce){.offcanvas-sm{transition:none}}@media (max-width:575.98px){.offcanvas-sm.offcanvas-start{top:0;left:0;width:var(--bs-offcanvas-width);border-right:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(-100%)}}@media (max-width:575.98px){.offcanvas-sm.offcanvas-end{top:0;right:0;width:var(--bs-offcanvas-width);border-left:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(100%)}}@media (max-width:575.98px){.offcanvas-sm.offcanvas-top{top:0;right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-bottom:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(-100%)}}@media (max-width:575.98px){.offcanvas-sm.offcanvas-bottom{right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-top:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(100%)}}@media (max-width:575.98px){.offcanvas-sm.show:not(.hiding),.offcanvas-sm.showing{transform:none}}@media (max-width:575.98px){.offcanvas-sm.hiding,.offcanvas-sm.show,.offcanvas-sm.showing{visibility:visible}}@media (min-width:576px){.offcanvas-sm{--bs-offcanvas-height:auto;--bs-offcanvas-border-width:0;background-color:transparent!important}.offcanvas-sm .offcanvas-header{display:none}.offcanvas-sm .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible;background-color:transparent!important}}@media (max-width:767.98px){.offcanvas-md{position:fixed;bottom:0;z-index:var(--bs-offcanvas-zindex);display:flex;flex-direction:column;max-width:100%;color:var(--bs-offcanvas-color);visibility:hidden;background-color:var(--bs-offcanvas-bg);background-clip:padding-box;outline:0;transition:transform .3s ease-in-out}}@media (max-width:767.98px) and (prefers-reduced-motion:reduce){.offcanvas-md{transition:none}}@media (max-width:767.98px){.offcanvas-md.offcanvas-start{top:0;left:0;width:var(--bs-offcanvas-width);border-right:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(-100%)}}@media (max-width:767.98px){.offcanvas-md.offcanvas-end{top:0;right:0;width:var(--bs-offcanvas-width);border-left:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(100%)}}@media (max-width:767.98px){.offcanvas-md.offcanvas-top{top:0;right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-bottom:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(-100%)}}@media (max-width:767.98px){.offcanvas-md.offcanvas-bottom{right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-top:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(100%)}}@media (max-width:767.98px){.offcanvas-md.show:not(.hiding),.offcanvas-md.showing{transform:none}}@media (max-width:767.98px){.offcanvas-md.hiding,.offcanvas-md.show,.offcanvas-md.showing{visibility:visible}}@media (min-width:768px){.offcanvas-md{--bs-offcanvas-height:auto;--bs-offcanvas-border-width:0;background-color:transparent!important}.offcanvas-md .offcanvas-header{display:none}.offcanvas-md .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible;background-color:transparent!important}}@media (max-width:991.98px){.offcanvas-lg{position:fixed;bottom:0;z-index:var(--bs-offcanvas-zindex);display:flex;flex-direction:column;max-width:100%;color:var(--bs-offcanvas-color);visibility:hidden;background-color:var(--bs-offcanvas-bg);background-clip:padding-box;outline:0;transition:transform .3s ease-in-out}}@media (max-width:991.98px) and (prefers-reduced-motion:reduce){.offcanvas-lg{transition:none}}@media (max-width:991.98px){.offcanvas-lg.offcanvas-start{top:0;left:0;width:var(--bs-offcanvas-width);border-right:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(-100%)}}@media (max-width:991.98px){.offcanvas-lg.offcanvas-end{top:0;right:0;width:var(--bs-offcanvas-width);border-left:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(100%)}}@media (max-width:991.98px){.offcanvas-lg.offcanvas-top{top:0;right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-bottom:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(-100%)}}@media (max-width:991.98px){.offcanvas-lg.offcanvas-bottom{right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-top:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(100%)}}@media (max-width:991.98px){.offcanvas-lg.show:not(.hiding),.offcanvas-lg.showing{transform:none}}@media (max-width:991.98px){.offcanvas-lg.hiding,.offcanvas-lg.show,.offcanvas-lg.showing{visibility:visible}}@media (min-width:992px){.offcanvas-lg{--bs-offcanvas-height:auto;--bs-offcanvas-border-width:0;background-color:transparent!important}.offcanvas-lg .offcanvas-header{display:none}.offcanvas-lg .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible;background-color:transparent!important}}@media (max-width:1199.98px){.offcanvas-xl{position:fixed;bottom:0;z-index:var(--bs-offcanvas-zindex);display:flex;flex-direction:column;max-width:100%;color:var(--bs-offcanvas-color);visibility:hidden;background-color:var(--bs-offcanvas-bg);background-clip:padding-box;outline:0;transition:transform .3s ease-in-out}}@media (max-width:1199.98px) and (prefers-reduced-motion:reduce){.offcanvas-xl{transition:none}}@media (max-width:1199.98px){.offcanvas-xl.offcanvas-start{top:0;left:0;width:var(--bs-offcanvas-width);border-right:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(-100%)}}@media (max-width:1199.98px){.offcanvas-xl.offcanvas-end{top:0;right:0;width:var(--bs-offcanvas-width);border-left:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(100%)}}@media (max-width:1199.98px){.offcanvas-xl.offcanvas-top{top:0;right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-bottom:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(-100%)}}@media (max-width:1199.98px){.offcanvas-xl.offcanvas-bottom{right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-top:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(100%)}}@media (max-width:1199.98px){.offcanvas-xl.show:not(.hiding),.offcanvas-xl.showing{transform:none}}@media (max-width:1199.98px){.offcanvas-xl.hiding,.offcanvas-xl.show,.offcanvas-xl.showing{visibility:visible}}@media (min-width:1200px){.offcanvas-xl{--bs-offcanvas-height:auto;--bs-offcanvas-border-width:0;background-color:transparent!important}.offcanvas-xl .offcanvas-header{display:none}.offcanvas-xl .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible;background-color:transparent!important}}@media (max-width:1399.98px){.offcanvas-xxl{position:fixed;bottom:0;z-index:var(--bs-offcanvas-zindex);display:flex;flex-direction:column;max-width:100%;color:var(--bs-offcanvas-color);visibility:hidden;background-color:var(--bs-offcanvas-bg);background-clip:padding-box;outline:0;transition:transform .3s ease-in-out}}@media (max-width:1399.98px) and (prefers-reduced-motion:reduce){.offcanvas-xxl{transition:none}}@media (max-width:1399.98px){.offcanvas-xxl.offcanvas-start{top:0;left:0;width:var(--bs-offcanvas-width);border-right:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(-100%)}}@media (max-width:1399.98px){.offcanvas-xxl.offcanvas-end{top:0;right:0;width:var(--bs-offcanvas-width);border-left:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(100%)}}@media (max-width:1399.98px){.offcanvas-xxl.offcanvas-top{top:0;right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-bottom:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(-100%)}}@media (max-width:1399.98px){.offcanvas-xxl.offcanvas-bottom{right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-top:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(100%)}}@media (max-width:1399.98px){.offcanvas-xxl.show:not(.hiding),.offcanvas-xxl.showing{transform:none}}@media (max-width:1399.98px){.offcanvas-xxl.hiding,.offcanvas-xxl.show,.offcanvas-xxl.showing{visibility:visible}}@media (min-width:1400px){.offcanvas-xxl{--bs-offcanvas-height:auto;--bs-offcanvas-border-width:0;background-color:transparent!important}.offcanvas-xxl .offcanvas-header{display:none}.offcanvas-xxl .offcanvas-body{display:flex;flex-grow:0;padding:0;overflow-y:visible;background-color:transparent!important}}.offcanvas{position:fixed;bottom:0;z-index:var(--bs-offcanvas-zindex);display:flex;flex-direction:column;max-width:100%;color:var(--bs-offcanvas-color);visibility:hidden;background-color:var(--bs-offcanvas-bg);background-clip:padding-box;outline:0;transition:transform .3s ease-in-out}@media (prefers-reduced-motion:reduce){.offcanvas{transition:none}}.offcanvas.offcanvas-start{top:0;left:0;width:var(--bs-offcanvas-width);border-right:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(-100%)}.offcanvas.offcanvas-end{top:0;right:0;width:var(--bs-offcanvas-width);border-left:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateX(100%)}.offcanvas.offcanvas-top{top:0;right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-bottom:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(-100%)}.offcanvas.offcanvas-bottom{right:0;left:0;height:var(--bs-offcanvas-height);max-height:100%;border-top:var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);transform:translateY(100%)}.offcanvas.show:not(.hiding),.offcanvas.showing{transform:none}.offcanvas.hiding,.offcanvas.show,.offcanvas.showing{visibility:visible}.offcanvas-backdrop{position:fixed;top:0;left:0;z-index:1040;width:100vw;height:100vh;background-color:#000}.offcanvas-backdrop.fade{opacity:0}.offcanvas-backdrop.show{opacity:.5}.offcanvas-header{display:flex;align-items:center;justify-content:space-between;padding:var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x)}.offcanvas-header .btn-close{padding:calc(var(--bs-offcanvas-padding-y) * .5) calc(var(--bs-offcanvas-padding-x) * .5);margin-top:calc(-.5 * var(--bs-offcanvas-padding-y));margin-right:calc(-.5 * var(--bs-offcanvas-padding-x));margin-bottom:calc(-.5 * var(--bs-offcanvas-padding-y))}.offcanvas-title{margin-bottom:0;line-height:1.5}.offcanvas-body{flex-grow:1;padding:var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x);overflow-y:auto}.placeholder{display:inline-block;min-height:1em;vertical-align:middle;cursor:wait;background-color:currentcolor;opacity:.5}.placeholder.btn::before{display:inline-block;content:""}.placeholder-xs{min-height:.6em}.placeholder-sm{min-height:.8em}.placeholder-lg{min-height:1.2em}.placeholder-glow .placeholder{animation:placeholder-glow 2s ease-in-out infinite}@keyframes placeholder-glow{50%{opacity:.2}}.placeholder-wave{-webkit-mask-image:linear-gradient(130deg,#000 55%,rgba(0,0,0,0.8) 75%,#000 95%);mask-image:linear-gradient(130deg,#000 55%,rgba(0,0,0,0.8) 75%,#000 95%);-webkit-mask-size:200% 100%;mask-size:200% 100%;animation:placeholder-wave 2s linear infinite}@keyframes placeholder-wave{100%{-webkit-mask-position:-200% 0%;mask-position:-200% 0%}}.clearfix::after{display:block;clear:both;content:""}.text-bg-primary{color:#fff!important;background-color:RGBA(13,110,253,var(--bs-bg-opacity,1))!important}.text-bg-secondary{color:#fff!important;background-color:RGBA(108,117,125,var(--bs-bg-opacity,1))!important}.text-bg-success{color:#fff!important;background-color:RGBA(25,135,84,var(--bs-bg-opacity,1))!important}.text-bg-info{color:#000!important;background-color:RGBA(13,202,240,var(--bs-bg-opacity,1))!important}.text-bg-warning{color:#000!important;background-color:RGBA(255,193,7,var(--bs-bg-opacity,1))!important}.text-bg-danger{color:#fff!important;background-color:RGBA(220,53,69,var(--bs-bg-opacity,1))!important}.text-bg-light{color:#000!important;background-color:RGBA(248,249,250,var(--bs-bg-opacity,1))!important}.text-bg-dark{color:#fff!important;background-color:RGBA(33,37,41,var(--bs-bg-opacity,1))!important}.link-primary{color:#0d6efd!important}.link-primary:focus,.link-primary:hover{color:#0a58ca!important}.link-secondary{color:#6c757d!important}.link-secondary:focus,.link-secondary:hover{color:#565e64!important}.link-success{color:#198754!important}.link-success:focus,.link-success:hover{color:#146c43!important}.link-info{color:#0dcaf0!important}.link-info:focus,.link-info:hover{color:#3dd5f3!important}.link-warning{color:#ffc107!important}.link-warning:focus,.link-warning:hover{color:#ffcd39!important}.link-danger{color:#dc3545!important}.link-danger:focus,.link-danger:hover{color:#b02a37!important}.link-light{color:#f8f9fa!important}.link-light:focus,.link-light:hover{color:#f9fafb!important}.link-dark{color:#212529!important}.link-dark:focus,.link-dark:hover{color:#1a1e21!important}.ratio{position:relative;width:100%}.ratio::before{display:block;padding-top:var(--bs-aspect-ratio);content:""}.ratio>*{position:absolute;top:0;left:0;width:100%;height:100%}.ratio-1x1{--bs-aspect-ratio:100%}.ratio-4x3{--bs-aspect-ratio:75%}.ratio-16x9{--bs-aspect-ratio:56.25%}.ratio-21x9{--bs-aspect-ratio:42.8571428571%}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}.sticky-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}.sticky-bottom{position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}@media (min-width:576px){.sticky-sm-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}.sticky-sm-bottom{position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}}@media (min-width:768px){.sticky-md-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}.sticky-md-bottom{position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}}@media (min-width:992px){.sticky-lg-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}.sticky-lg-bottom{position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}}@media (min-width:1200px){.sticky-xl-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}.sticky-xl-bottom{position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}}@media (min-width:1400px){.sticky-xxl-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}.sticky-xxl-bottom{position:-webkit-sticky;position:sticky;bottom:0;z-index:1020}}.hstack{display:flex;flex-direction:row;align-items:center;align-self:stretch}.vstack{display:flex;flex:1 1 auto;flex-direction:column;align-self:stretch}.visually-hidden,.visually-hidden-focusable:not(:focus):not(:focus-within){position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}.stretched-link::after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;content:""}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vr{display:inline-block;align-self:stretch;width:1px;min-height:1em;background-color:currentcolor;opacity:.25}.align-baseline{vertical-align:baseline!important}.align-top{vertical-align:top!important}.align-middle{vertical-align:middle!important}.align-bottom{vertical-align:bottom!important}.align-text-bottom{vertical-align:text-bottom!important}.align-text-top{vertical-align:text-top!important}.float-start{float:left!important}.float-end{float:right!important}.float-none{float:none!important}.opacity-0{opacity:0!important}.opacity-25{opacity:.25!important}.opacity-50{opacity:.5!important}.opacity-75{opacity:.75!important}.opacity-100{opacity:1!important}.overflow-auto{overflow:auto!important}.overflow-hidden{overflow:hidden!important}.overflow-visible{overflow:visible!important}.overflow-scroll{overflow:scroll!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-grid{display:grid!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:flex!important}.d-inline-flex{display:inline-flex!important}.d-none{display:none!important}.shadow{box-shadow:0 .5rem 1rem rgba(0,0,0,.15)!important}.shadow-sm{box-shadow:0 .125rem .25rem rgba(0,0,0,.075)!important}.shadow-lg{box-shadow:0 1rem 3rem rgba(0,0,0,.175)!important}.shadow-none{box-shadow:none!important}.position-static{position:static!important}.position-relative{position:relative!important}.position-absolute{position:absolute!important}.position-fixed{position:fixed!important}.position-sticky{position:-webkit-sticky!important;position:sticky!important}.top-0{top:0!important}.top-50{top:50%!important}.top-100{top:100%!important}.bottom-0{bottom:0!important}.bottom-50{bottom:50%!important}.bottom-100{bottom:100%!important}.start-0{left:0!important}.start-50{left:50%!important}.start-100{left:100%!important}.end-0{right:0!important}.end-50{right:50%!important}.end-100{right:100%!important}.translate-middle{transform:translate(-50%,-50%)!important}.translate-middle-x{transform:translateX(-50%)!important}.translate-middle-y{transform:translateY(-50%)!important}.border{border:var(--bs-border-width) var(--bs-border-style) var(--bs-border-color)!important}.border-0{border:0!important}.border-top{border-top:var(--bs-border-width) var(--bs-border-style) var(--bs-border-color)!important}.border-top-0{border-top:0!important}.border-end{border-right:var(--bs-border-width) var(--bs-border-style) var(--bs-border-color)!important}.border-end-0{border-right:0!important}.border-bottom{border-bottom:var(--bs-border-width) var(--bs-border-style) var(--bs-border-color)!important}.border-bottom-0{border-bottom:0!important}.border-start{border-left:var(--bs-border-width) var(--bs-border-style) var(--bs-border-color)!important}.border-start-0{border-left:0!important}.border-primary{--bs-border-opacity:1;border-color:rgba(var(--bs-primary-rgb),var(--bs-border-opacity))!important}.border-secondary{--bs-border-opacity:1;border-color:rgba(var(--bs-secondary-rgb),var(--bs-border-opacity))!important}.border-success{--bs-border-opacity:1;border-color:rgba(var(--bs-success-rgb),var(--bs-border-opacity))!important}.border-info{--bs-border-opacity:1;border-color:rgba(var(--bs-info-rgb),var(--bs-border-opacity))!important}.border-warning{--bs-border-opacity:1;border-color:rgba(var(--bs-warning-rgb),var(--bs-border-opacity))!important}.border-danger{--bs-border-opacity:1;border-color:rgba(var(--bs-danger-rgb),var(--bs-border-opacity))!important}.border-light{--bs-border-opacity:1;border-color:rgba(var(--bs-light-rgb),var(--bs-border-opacity))!important}.border-dark{--bs-border-opacity:1;border-color:rgba(var(--bs-dark-rgb),var(--bs-border-opacity))!important}.border-white{--bs-border-opacity:1;border-color:rgba(var(--bs-white-rgb),var(--bs-border-opacity))!important}.border-1{--bs-border-width:1px}.border-2{--bs-border-width:2px}.border-3{--bs-border-width:3px}.border-4{--bs-border-width:4px}.border-5{--bs-border-width:5px}.border-opacity-10{--bs-border-opacity:0.1}.border-opacity-25{--bs-border-opacity:0.25}.border-opacity-50{--bs-border-opacity:0.5}.border-opacity-75{--bs-border-opacity:0.75}.border-opacity-100{--bs-border-opacity:1}.w-25{width:25%!important}.w-50{width:50%!important}.w-75{width:75%!important}.w-100{width:100%!important}.w-auto{width:auto!important}.mw-100{max-width:100%!important}.vw-100{width:100vw!important}.min-vw-100{min-width:100vw!important}.h-25{height:25%!important}.h-50{height:50%!important}.h-75{height:75%!important}.h-100{height:100%!important}.h-auto{height:auto!important}.mh-100{max-height:100%!important}.vh-100{height:100vh!important}.min-vh-100{min-height:100vh!important}.flex-fill{flex:1 1 auto!important}.flex-row{flex-direction:row!important}.flex-column{flex-direction:column!important}.flex-row-reverse{flex-direction:row-reverse!important}.flex-column-reverse{flex-direction:column-reverse!important}.flex-grow-0{flex-grow:0!important}.flex-grow-1{flex-grow:1!important}.flex-shrink-0{flex-shrink:0!important}.flex-shrink-1{flex-shrink:1!important}.flex-wrap{flex-wrap:wrap!important}.flex-nowrap{flex-wrap:nowrap!important}.flex-wrap-reverse{flex-wrap:wrap-reverse!important}.justify-content-start{justify-content:flex-start!important}.justify-content-end{justify-content:flex-end!important}.justify-content-center{justify-content:center!important}.justify-content-between{justify-content:space-between!important}.justify-content-around{justify-content:space-around!important}.justify-content-evenly{justify-content:space-evenly!important}.align-items-start{align-items:flex-start!important}.align-items-end{align-items:flex-end!important}.align-items-center{align-items:center!important}.align-items-baseline{align-items:baseline!important}.align-items-stretch{align-items:stretch!important}.align-content-start{align-content:flex-start!important}.align-content-end{align-content:flex-end!important}.align-content-center{align-content:center!important}.align-content-between{align-content:space-between!important}.align-content-around{align-content:space-around!important}.align-content-stretch{align-content:stretch!important}.align-self-auto{align-self:auto!important}.align-self-start{align-self:flex-start!important}.align-self-end{align-self:flex-end!important}.align-self-center{align-self:center!important}.align-self-baseline{align-self:baseline!important}.align-self-stretch{align-self:stretch!important}.order-first{order:-1!important}.order-0{order:0!important}.order-1{order:1!important}.order-2{order:2!important}.order-3{order:3!important}.order-4{order:4!important}.order-5{order:5!important}.order-last{order:6!important}.m-0{margin:0!important}.m-1{margin:.25rem!important}.m-2{margin:.5rem!important}.m-3{margin:1rem!important}.m-4{margin:1.5rem!important}.m-5{margin:3rem!important}.m-auto{margin:auto!important}.mx-0{margin-right:0!important;margin-left:0!important}.mx-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-3{margin-right:1rem!important;margin-left:1rem!important}.mx-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-5{margin-right:3rem!important;margin-left:3rem!important}.mx-auto{margin-right:auto!important;margin-left:auto!important}.my-0{margin-top:0!important;margin-bottom:0!important}.my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-0{margin-top:0!important}.mt-1{margin-top:.25rem!important}.mt-2{margin-top:.5rem!important}.mt-3{margin-top:1rem!important}.mt-4{margin-top:1.5rem!important}.mt-5{margin-top:3rem!important}.mt-auto{margin-top:auto!important}.me-0{margin-right:0!important}.me-1{margin-right:.25rem!important}.me-2{margin-right:.5rem!important}.me-3{margin-right:1rem!important}.me-4{margin-right:1.5rem!important}.me-5{margin-right:3rem!important}.me-auto{margin-right:auto!important}.mb-0{margin-bottom:0!important}.mb-1{margin-bottom:.25rem!important}.mb-2{margin-bottom:.5rem!important}.mb-3{margin-bottom:1rem!important}.mb-4{margin-bottom:1.5rem!important}.mb-5{margin-bottom:3rem!important}.mb-auto{margin-bottom:auto!important}.ms-0{margin-left:0!important}.ms-1{margin-left:.25rem!important}.ms-2{margin-left:.5rem!important}.ms-3{margin-left:1rem!important}.ms-4{margin-left:1.5rem!important}.ms-5{margin-left:3rem!important}.ms-auto{margin-left:auto!important}.p-0{padding:0!important}.p-1{padding:.25rem!important}.p-2{padding:.5rem!important}.p-3{padding:1rem!important}.p-4{padding:1.5rem!important}.p-5{padding:3rem!important}.px-0{padding-right:0!important;padding-left:0!important}.px-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-3{padding-right:1rem!important;padding-left:1rem!important}.px-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-5{padding-right:3rem!important;padding-left:3rem!important}.py-0{padding-top:0!important;padding-bottom:0!important}.py-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-0{padding-top:0!important}.pt-1{padding-top:.25rem!important}.pt-2{padding-top:.5rem!important}.pt-3{padding-top:1rem!important}.pt-4{padding-top:1.5rem!important}.pt-5{padding-top:3rem!important}.pe-0{padding-right:0!important}.pe-1{padding-right:.25rem!important}.pe-2{padding-right:.5rem!important}.pe-3{padding-right:1rem!important}.pe-4{padding-right:1.5rem!important}.pe-5{padding-right:3rem!important}.pb-0{padding-bottom:0!important}.pb-1{padding-bottom:.25rem!important}.pb-2{padding-bottom:.5rem!important}.pb-3{padding-bottom:1rem!important}.pb-4{padding-bottom:1.5rem!important}.pb-5{padding-bottom:3rem!important}.ps-0{padding-left:0!important}.ps-1{padding-left:.25rem!important}.ps-2{padding-left:.5rem!important}.ps-3{padding-left:1rem!important}.ps-4{padding-left:1.5rem!important}.ps-5{padding-left:3rem!important}.gap-0{gap:0!important}.gap-1{gap:.25rem!important}.gap-2{gap:.5rem!important}.gap-3{gap:1rem!important}.gap-4{gap:1.5rem!important}.gap-5{gap:3rem!important}.font-monospace{font-family:var(--bs-font-monospace)!important}.fs-1{font-size:calc(1.375rem + 1.5vw)!important}.fs-2{font-size:calc(1.325rem + .9vw)!important}.fs-3{font-size:calc(1.3rem + .6vw)!important}.fs-4{font-size:calc(1.275rem + .3vw)!important}.fs-5{font-size:1.25rem!important}.fs-6{font-size:1rem!important}.fst-italic{font-style:italic!important}.fst-normal{font-style:normal!important}.fw-light{font-weight:300!important}.fw-lighter{font-weight:lighter!important}.fw-normal{font-weight:400!important}.fw-bold{font-weight:700!important}.fw-semibold{font-weight:600!important}.fw-bolder{font-weight:bolder!important}.lh-1{line-height:1!important}.lh-sm{line-height:1.25!important}.lh-base{line-height:1.5!important}.lh-lg{line-height:2!important}.text-start{text-align:left!important}.text-end{text-align:right!important}.text-center{text-align:center!important}.text-decoration-none{text-decoration:none!important}.text-decoration-underline{text-decoration:underline!important}.text-decoration-line-through{text-decoration:line-through!important}.text-lowercase{text-transform:lowercase!important}.text-uppercase{text-transform:uppercase!important}.text-capitalize{text-transform:capitalize!important}.text-wrap{white-space:normal!important}.text-nowrap{white-space:nowrap!important}.text-break{word-wrap:break-word!important;word-break:break-word!important}.text-primary{--bs-text-opacity:1;color:rgba(var(--bs-primary-rgb),var(--bs-text-opacity))!important}.text-secondary{--bs-text-opacity:1;color:rgba(var(--bs-secondary-rgb),var(--bs-text-opacity))!important}.text-success{--bs-text-opacity:1;color:rgba(var(--bs-success-rgb),var(--bs-text-opacity))!important}.text-info{--bs-text-opacity:1;color:rgba(var(--bs-info-rgb),var(--bs-text-opacity))!important}.text-warning{--bs-text-opacity:1;color:rgba(var(--bs-warning-rgb),var(--bs-text-opacity))!important}.text-danger{--bs-text-opacity:1;color:rgba(var(--bs-danger-rgb),var(--bs-text-opacity))!important}.text-light{--bs-text-opacity:1;color:rgba(var(--bs-light-rgb),var(--bs-text-opacity))!important}.text-dark{--bs-text-opacity:1;color:rgba(var(--bs-dark-rgb),var(--bs-text-opacity))!important}.text-black{--bs-text-opacity:1;color:rgba(var(--bs-black-rgb),var(--bs-text-opacity))!important}.text-white{--bs-text-opacity:1;color:rgba(var(--bs-white-rgb),var(--bs-text-opacity))!important}.text-body{--bs-text-opacity:1;color:rgba(var(--bs-body-color-rgb),var(--bs-text-opacity))!important}.text-muted{--bs-text-opacity:1;color:#6c757d!important}.text-black-50{--bs-text-opacity:1;color:rgba(0,0,0,.5)!important}.text-white-50{--bs-text-opacity:1;color:rgba(255,255,255,.5)!important}.text-reset{--bs-text-opacity:1;color:inherit!important}.text-opacity-25{--bs-text-opacity:0.25}.text-opacity-50{--bs-text-opacity:0.5}.text-opacity-75{--bs-text-opacity:0.75}.text-opacity-100{--bs-text-opacity:1}.bg-primary{--bs-bg-opacity:1;background-color:rgba(var(--bs-primary-rgb),var(--bs-bg-opacity))!important}.bg-secondary{--bs-bg-opacity:1;background-color:rgba(var(--bs-secondary-rgb),var(--bs-bg-opacity))!important}.bg-success{--bs-bg-opacity:1;background-color:rgba(var(--bs-success-rgb),var(--bs-bg-opacity))!important}.bg-info{--bs-bg-opacity:1;background-color:rgba(var(--bs-info-rgb),var(--bs-bg-opacity))!important}.bg-warning{--bs-bg-opacity:1;background-color:rgba(var(--bs-warning-rgb),var(--bs-bg-opacity))!important}.bg-danger{--bs-bg-opacity:1;background-color:rgba(var(--bs-danger-rgb),var(--bs-bg-opacity))!important}.bg-light{--bs-bg-opacity:1;background-color:rgba(var(--bs-light-rgb),var(--bs-bg-opacity))!important}.bg-dark{--bs-bg-opacity:1;background-color:rgba(var(--bs-dark-rgb),var(--bs-bg-opacity))!important}.bg-black{--bs-bg-opacity:1;background-color:rgba(var(--bs-black-rgb),var(--bs-bg-opacity))!important}.bg-white{--bs-bg-opacity:1;background-color:rgba(var(--bs-white-rgb),var(--bs-bg-opacity))!important}.bg-body{--bs-bg-opacity:1;background-color:rgba(var(--bs-body-bg-rgb),var(--bs-bg-opacity))!important}.bg-transparent{--bs-bg-opacity:1;background-color:transparent!important}.bg-opacity-10{--bs-bg-opacity:0.1}.bg-opacity-25{--bs-bg-opacity:0.25}.bg-opacity-50{--bs-bg-opacity:0.5}.bg-opacity-75{--bs-bg-opacity:0.75}.bg-opacity-100{--bs-bg-opacity:1}.bg-gradient{background-image:var(--bs-gradient)!important}.user-select-all{-webkit-user-select:all!important;-moz-user-select:all!important;user-select:all!important}.user-select-auto{-webkit-user-select:auto!important;-moz-user-select:auto!important;user-select:auto!important}.user-select-none{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}.pe-none{pointer-events:none!important}.pe-auto{pointer-events:auto!important}.rounded{border-radius:var(--bs-border-radius)!important}.rounded-0{border-radius:0!important}.rounded-1{border-radius:var(--bs-border-radius-sm)!important}.rounded-2{border-radius:var(--bs-border-radius)!important}.rounded-3{border-radius:var(--bs-border-radius-lg)!important}.rounded-4{border-radius:var(--bs-border-radius-xl)!important}.rounded-5{border-radius:var(--bs-border-radius-2xl)!important}.rounded-circle{border-radius:50%!important}.rounded-pill{border-radius:var(--bs-border-radius-pill)!important}.rounded-top{border-top-left-radius:var(--bs-border-radius)!important;border-top-right-radius:var(--bs-border-radius)!important}.rounded-end{border-top-right-radius:var(--bs-border-radius)!important;border-bottom-right-radius:var(--bs-border-radius)!important}.rounded-bottom{border-bottom-right-radius:var(--bs-border-radius)!important;border-bottom-left-radius:var(--bs-border-radius)!important}.rounded-start{border-bottom-left-radius:var(--bs-border-radius)!important;border-top-left-radius:var(--bs-border-radius)!important}.visible{visibility:visible!important}.invisible{visibility:hidden!important}@media (min-width:576px){.float-sm-start{float:left!important}.float-sm-end{float:right!important}.float-sm-none{float:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-grid{display:grid!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:flex!important}.d-sm-inline-flex{display:inline-flex!important}.d-sm-none{display:none!important}.flex-sm-fill{flex:1 1 auto!important}.flex-sm-row{flex-direction:row!important}.flex-sm-column{flex-direction:column!important}.flex-sm-row-reverse{flex-direction:row-reverse!important}.flex-sm-column-reverse{flex-direction:column-reverse!important}.flex-sm-grow-0{flex-grow:0!important}.flex-sm-grow-1{flex-grow:1!important}.flex-sm-shrink-0{flex-shrink:0!important}.flex-sm-shrink-1{flex-shrink:1!important}.flex-sm-wrap{flex-wrap:wrap!important}.flex-sm-nowrap{flex-wrap:nowrap!important}.flex-sm-wrap-reverse{flex-wrap:wrap-reverse!important}.justify-content-sm-start{justify-content:flex-start!important}.justify-content-sm-end{justify-content:flex-end!important}.justify-content-sm-center{justify-content:center!important}.justify-content-sm-between{justify-content:space-between!important}.justify-content-sm-around{justify-content:space-around!important}.justify-content-sm-evenly{justify-content:space-evenly!important}.align-items-sm-start{align-items:flex-start!important}.align-items-sm-end{align-items:flex-end!important}.align-items-sm-center{align-items:center!important}.align-items-sm-baseline{align-items:baseline!important}.align-items-sm-stretch{align-items:stretch!important}.align-content-sm-start{align-content:flex-start!important}.align-content-sm-end{align-content:flex-end!important}.align-content-sm-center{align-content:center!important}.align-content-sm-between{align-content:space-between!important}.align-content-sm-around{align-content:space-around!important}.align-content-sm-stretch{align-content:stretch!important}.align-self-sm-auto{align-self:auto!important}.align-self-sm-start{align-self:flex-start!important}.align-self-sm-end{align-self:flex-end!important}.align-self-sm-center{align-self:center!important}.align-self-sm-baseline{align-self:baseline!important}.align-self-sm-stretch{align-self:stretch!important}.order-sm-first{order:-1!important}.order-sm-0{order:0!important}.order-sm-1{order:1!important}.order-sm-2{order:2!important}.order-sm-3{order:3!important}.order-sm-4{order:4!important}.order-sm-5{order:5!important}.order-sm-last{order:6!important}.m-sm-0{margin:0!important}.m-sm-1{margin:.25rem!important}.m-sm-2{margin:.5rem!important}.m-sm-3{margin:1rem!important}.m-sm-4{margin:1.5rem!important}.m-sm-5{margin:3rem!important}.m-sm-auto{margin:auto!important}.mx-sm-0{margin-right:0!important;margin-left:0!important}.mx-sm-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-sm-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-sm-3{margin-right:1rem!important;margin-left:1rem!important}.mx-sm-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-sm-5{margin-right:3rem!important;margin-left:3rem!important}.mx-sm-auto{margin-right:auto!important;margin-left:auto!important}.my-sm-0{margin-top:0!important;margin-bottom:0!important}.my-sm-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-sm-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-sm-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-sm-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-sm-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-sm-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-sm-0{margin-top:0!important}.mt-sm-1{margin-top:.25rem!important}.mt-sm-2{margin-top:.5rem!important}.mt-sm-3{margin-top:1rem!important}.mt-sm-4{margin-top:1.5rem!important}.mt-sm-5{margin-top:3rem!important}.mt-sm-auto{margin-top:auto!important}.me-sm-0{margin-right:0!important}.me-sm-1{margin-right:.25rem!important}.me-sm-2{margin-right:.5rem!important}.me-sm-3{margin-right:1rem!important}.me-sm-4{margin-right:1.5rem!important}.me-sm-5{margin-right:3rem!important}.me-sm-auto{margin-right:auto!important}.mb-sm-0{margin-bottom:0!important}.mb-sm-1{margin-bottom:.25rem!important}.mb-sm-2{margin-bottom:.5rem!important}.mb-sm-3{margin-bottom:1rem!important}.mb-sm-4{margin-bottom:1.5rem!important}.mb-sm-5{margin-bottom:3rem!important}.mb-sm-auto{margin-bottom:auto!important}.ms-sm-0{margin-left:0!important}.ms-sm-1{margin-left:.25rem!important}.ms-sm-2{margin-left:.5rem!important}.ms-sm-3{margin-left:1rem!important}.ms-sm-4{margin-left:1.5rem!important}.ms-sm-5{margin-left:3rem!important}.ms-sm-auto{margin-left:auto!important}.p-sm-0{padding:0!important}.p-sm-1{padding:.25rem!important}.p-sm-2{padding:.5rem!important}.p-sm-3{padding:1rem!important}.p-sm-4{padding:1.5rem!important}.p-sm-5{padding:3rem!important}.px-sm-0{padding-right:0!important;padding-left:0!important}.px-sm-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-sm-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-sm-3{padding-right:1rem!important;padding-left:1rem!important}.px-sm-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-sm-5{padding-right:3rem!important;padding-left:3rem!important}.py-sm-0{padding-top:0!important;padding-bottom:0!important}.py-sm-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-sm-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-sm-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-sm-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-sm-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-sm-0{padding-top:0!important}.pt-sm-1{padding-top:.25rem!important}.pt-sm-2{padding-top:.5rem!important}.pt-sm-3{padding-top:1rem!important}.pt-sm-4{padding-top:1.5rem!important}.pt-sm-5{padding-top:3rem!important}.pe-sm-0{padding-right:0!important}.pe-sm-1{padding-right:.25rem!important}.pe-sm-2{padding-right:.5rem!important}.pe-sm-3{padding-right:1rem!important}.pe-sm-4{padding-right:1.5rem!important}.pe-sm-5{padding-right:3rem!important}.pb-sm-0{padding-bottom:0!important}.pb-sm-1{padding-bottom:.25rem!important}.pb-sm-2{padding-bottom:.5rem!important}.pb-sm-3{padding-bottom:1rem!important}.pb-sm-4{padding-bottom:1.5rem!important}.pb-sm-5{padding-bottom:3rem!important}.ps-sm-0{padding-left:0!important}.ps-sm-1{padding-left:.25rem!important}.ps-sm-2{padding-left:.5rem!important}.ps-sm-3{padding-left:1rem!important}.ps-sm-4{padding-left:1.5rem!important}.ps-sm-5{padding-left:3rem!important}.gap-sm-0{gap:0!important}.gap-sm-1{gap:.25rem!important}.gap-sm-2{gap:.5rem!important}.gap-sm-3{gap:1rem!important}.gap-sm-4{gap:1.5rem!important}.gap-sm-5{gap:3rem!important}.text-sm-start{text-align:left!important}.text-sm-end{text-align:right!important}.text-sm-center{text-align:center!important}}@media (min-width:768px){.float-md-start{float:left!important}.float-md-end{float:right!important}.float-md-none{float:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-grid{display:grid!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:flex!important}.d-md-inline-flex{display:inline-flex!important}.d-md-none{display:none!important}.flex-md-fill{flex:1 1 auto!important}.flex-md-row{flex-direction:row!important}.flex-md-column{flex-direction:column!important}.flex-md-row-reverse{flex-direction:row-reverse!important}.flex-md-column-reverse{flex-direction:column-reverse!important}.flex-md-grow-0{flex-grow:0!important}.flex-md-grow-1{flex-grow:1!important}.flex-md-shrink-0{flex-shrink:0!important}.flex-md-shrink-1{flex-shrink:1!important}.flex-md-wrap{flex-wrap:wrap!important}.flex-md-nowrap{flex-wrap:nowrap!important}.flex-md-wrap-reverse{flex-wrap:wrap-reverse!important}.justify-content-md-start{justify-content:flex-start!important}.justify-content-md-end{justify-content:flex-end!important}.justify-content-md-center{justify-content:center!important}.justify-content-md-between{justify-content:space-between!important}.justify-content-md-around{justify-content:space-around!important}.justify-content-md-evenly{justify-content:space-evenly!important}.align-items-md-start{align-items:flex-start!important}.align-items-md-end{align-items:flex-end!important}.align-items-md-center{align-items:center!important}.align-items-md-baseline{align-items:baseline!important}.align-items-md-stretch{align-items:stretch!important}.align-content-md-start{align-content:flex-start!important}.align-content-md-end{align-content:flex-end!important}.align-content-md-center{align-content:center!important}.align-content-md-between{align-content:space-between!important}.align-content-md-around{align-content:space-around!important}.align-content-md-stretch{align-content:stretch!important}.align-self-md-auto{align-self:auto!important}.align-self-md-start{align-self:flex-start!important}.align-self-md-end{align-self:flex-end!important}.align-self-md-center{align-self:center!important}.align-self-md-baseline{align-self:baseline!important}.align-self-md-stretch{align-self:stretch!important}.order-md-first{order:-1!important}.order-md-0{order:0!important}.order-md-1{order:1!important}.order-md-2{order:2!important}.order-md-3{order:3!important}.order-md-4{order:4!important}.order-md-5{order:5!important}.order-md-last{order:6!important}.m-md-0{margin:0!important}.m-md-1{margin:.25rem!important}.m-md-2{margin:.5rem!important}.m-md-3{margin:1rem!important}.m-md-4{margin:1.5rem!important}.m-md-5{margin:3rem!important}.m-md-auto{margin:auto!important}.mx-md-0{margin-right:0!important;margin-left:0!important}.mx-md-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-md-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-md-3{margin-right:1rem!important;margin-left:1rem!important}.mx-md-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-md-5{margin-right:3rem!important;margin-left:3rem!important}.mx-md-auto{margin-right:auto!important;margin-left:auto!important}.my-md-0{margin-top:0!important;margin-bottom:0!important}.my-md-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-md-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-md-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-md-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-md-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-md-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-md-0{margin-top:0!important}.mt-md-1{margin-top:.25rem!important}.mt-md-2{margin-top:.5rem!important}.mt-md-3{margin-top:1rem!important}.mt-md-4{margin-top:1.5rem!important}.mt-md-5{margin-top:3rem!important}.mt-md-auto{margin-top:auto!important}.me-md-0{margin-right:0!important}.me-md-1{margin-right:.25rem!important}.me-md-2{margin-right:.5rem!important}.me-md-3{margin-right:1rem!important}.me-md-4{margin-right:1.5rem!important}.me-md-5{margin-right:3rem!important}.me-md-auto{margin-right:auto!important}.mb-md-0{margin-bottom:0!important}.mb-md-1{margin-bottom:.25rem!important}.mb-md-2{margin-bottom:.5rem!important}.mb-md-3{margin-bottom:1rem!important}.mb-md-4{margin-bottom:1.5rem!important}.mb-md-5{margin-bottom:3rem!important}.mb-md-auto{margin-bottom:auto!important}.ms-md-0{margin-left:0!important}.ms-md-1{margin-left:.25rem!important}.ms-md-2{margin-left:.5rem!important}.ms-md-3{margin-left:1rem!important}.ms-md-4{margin-left:1.5rem!important}.ms-md-5{margin-left:3rem!important}.ms-md-auto{margin-left:auto!important}.p-md-0{padding:0!important}.p-md-1{padding:.25rem!important}.p-md-2{padding:.5rem!important}.p-md-3{padding:1rem!important}.p-md-4{padding:1.5rem!important}.p-md-5{padding:3rem!important}.px-md-0{padding-right:0!important;padding-left:0!important}.px-md-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-md-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-md-3{padding-right:1rem!important;padding-left:1rem!important}.px-md-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-md-5{padding-right:3rem!important;padding-left:3rem!important}.py-md-0{padding-top:0!important;padding-bottom:0!important}.py-md-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-md-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-md-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-md-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-md-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-md-0{padding-top:0!important}.pt-md-1{padding-top:.25rem!important}.pt-md-2{padding-top:.5rem!important}.pt-md-3{padding-top:1rem!important}.pt-md-4{padding-top:1.5rem!important}.pt-md-5{padding-top:3rem!important}.pe-md-0{padding-right:0!important}.pe-md-1{padding-right:.25rem!important}.pe-md-2{padding-right:.5rem!important}.pe-md-3{padding-right:1rem!important}.pe-md-4{padding-right:1.5rem!important}.pe-md-5{padding-right:3rem!important}.pb-md-0{padding-bottom:0!important}.pb-md-1{padding-bottom:.25rem!important}.pb-md-2{padding-bottom:.5rem!important}.pb-md-3{padding-bottom:1rem!important}.pb-md-4{padding-bottom:1.5rem!important}.pb-md-5{padding-bottom:3rem!important}.ps-md-0{padding-left:0!important}.ps-md-1{padding-left:.25rem!important}.ps-md-2{padding-left:.5rem!important}.ps-md-3{padding-left:1rem!important}.ps-md-4{padding-left:1.5rem!important}.ps-md-5{padding-left:3rem!important}.gap-md-0{gap:0!important}.gap-md-1{gap:.25rem!important}.gap-md-2{gap:.5rem!important}.gap-md-3{gap:1rem!important}.gap-md-4{gap:1.5rem!important}.gap-md-5{gap:3rem!important}.text-md-start{text-align:left!important}.text-md-end{text-align:right!important}.text-md-center{text-align:center!important}}@media (min-width:992px){.float-lg-start{float:left!important}.float-lg-end{float:right!important}.float-lg-none{float:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-grid{display:grid!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:flex!important}.d-lg-inline-flex{display:inline-flex!important}.d-lg-none{display:none!important}.flex-lg-fill{flex:1 1 auto!important}.flex-lg-row{flex-direction:row!important}.flex-lg-column{flex-direction:column!important}.flex-lg-row-reverse{flex-direction:row-reverse!important}.flex-lg-column-reverse{flex-direction:column-reverse!important}.flex-lg-grow-0{flex-grow:0!important}.flex-lg-grow-1{flex-grow:1!important}.flex-lg-shrink-0{flex-shrink:0!important}.flex-lg-shrink-1{flex-shrink:1!important}.flex-lg-wrap{flex-wrap:wrap!important}.flex-lg-nowrap{flex-wrap:nowrap!important}.flex-lg-wrap-reverse{flex-wrap:wrap-reverse!important}.justify-content-lg-start{justify-content:flex-start!important}.justify-content-lg-end{justify-content:flex-end!important}.justify-content-lg-center{justify-content:center!important}.justify-content-lg-between{justify-content:space-between!important}.justify-content-lg-around{justify-content:space-around!important}.justify-content-lg-evenly{justify-content:space-evenly!important}.align-items-lg-start{align-items:flex-start!important}.align-items-lg-end{align-items:flex-end!important}.align-items-lg-center{align-items:center!important}.align-items-lg-baseline{align-items:baseline!important}.align-items-lg-stretch{align-items:stretch!important}.align-content-lg-start{align-content:flex-start!important}.align-content-lg-end{align-content:flex-end!important}.align-content-lg-center{align-content:center!important}.align-content-lg-between{align-content:space-between!important}.align-content-lg-around{align-content:space-around!important}.align-content-lg-stretch{align-content:stretch!important}.align-self-lg-auto{align-self:auto!important}.align-self-lg-start{align-self:flex-start!important}.align-self-lg-end{align-self:flex-end!important}.align-self-lg-center{align-self:center!important}.align-self-lg-baseline{align-self:baseline!important}.align-self-lg-stretch{align-self:stretch!important}.order-lg-first{order:-1!important}.order-lg-0{order:0!important}.order-lg-1{order:1!important}.order-lg-2{order:2!important}.order-lg-3{order:3!important}.order-lg-4{order:4!important}.order-lg-5{order:5!important}.order-lg-last{order:6!important}.m-lg-0{margin:0!important}.m-lg-1{margin:.25rem!important}.m-lg-2{margin:.5rem!important}.m-lg-3{margin:1rem!important}.m-lg-4{margin:1.5rem!important}.m-lg-5{margin:3rem!important}.m-lg-auto{margin:auto!important}.mx-lg-0{margin-right:0!important;margin-left:0!important}.mx-lg-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-lg-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-lg-3{margin-right:1rem!important;margin-left:1rem!important}.mx-lg-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-lg-5{margin-right:3rem!important;margin-left:3rem!important}.mx-lg-auto{margin-right:auto!important;margin-left:auto!important}.my-lg-0{margin-top:0!important;margin-bottom:0!important}.my-lg-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-lg-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-lg-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-lg-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-lg-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-lg-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-lg-0{margin-top:0!important}.mt-lg-1{margin-top:.25rem!important}.mt-lg-2{margin-top:.5rem!important}.mt-lg-3{margin-top:1rem!important}.mt-lg-4{margin-top:1.5rem!important}.mt-lg-5{margin-top:3rem!important}.mt-lg-auto{margin-top:auto!important}.me-lg-0{margin-right:0!important}.me-lg-1{margin-right:.25rem!important}.me-lg-2{margin-right:.5rem!important}.me-lg-3{margin-right:1rem!important}.me-lg-4{margin-right:1.5rem!important}.me-lg-5{margin-right:3rem!important}.me-lg-auto{margin-right:auto!important}.mb-lg-0{margin-bottom:0!important}.mb-lg-1{margin-bottom:.25rem!important}.mb-lg-2{margin-bottom:.5rem!important}.mb-lg-3{margin-bottom:1rem!important}.mb-lg-4{margin-bottom:1.5rem!important}.mb-lg-5{margin-bottom:3rem!important}.mb-lg-auto{margin-bottom:auto!important}.ms-lg-0{margin-left:0!important}.ms-lg-1{margin-left:.25rem!important}.ms-lg-2{margin-left:.5rem!important}.ms-lg-3{margin-left:1rem!important}.ms-lg-4{margin-left:1.5rem!important}.ms-lg-5{margin-left:3rem!important}.ms-lg-auto{margin-left:auto!important}.p-lg-0{padding:0!important}.p-lg-1{padding:.25rem!important}.p-lg-2{padding:.5rem!important}.p-lg-3{padding:1rem!important}.p-lg-4{padding:1.5rem!important}.p-lg-5{padding:3rem!important}.px-lg-0{padding-right:0!important;padding-left:0!important}.px-lg-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-lg-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-lg-3{padding-right:1rem!important;padding-left:1rem!important}.px-lg-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-lg-5{padding-right:3rem!important;padding-left:3rem!important}.py-lg-0{padding-top:0!important;padding-bottom:0!important}.py-lg-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-lg-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-lg-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-lg-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-lg-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-lg-0{padding-top:0!important}.pt-lg-1{padding-top:.25rem!important}.pt-lg-2{padding-top:.5rem!important}.pt-lg-3{padding-top:1rem!important}.pt-lg-4{padding-top:1.5rem!important}.pt-lg-5{padding-top:3rem!important}.pe-lg-0{padding-right:0!important}.pe-lg-1{padding-right:.25rem!important}.pe-lg-2{padding-right:.5rem!important}.pe-lg-3{padding-right:1rem!important}.pe-lg-4{padding-right:1.5rem!important}.pe-lg-5{padding-right:3rem!important}.pb-lg-0{padding-bottom:0!important}.pb-lg-1{padding-bottom:.25rem!important}.pb-lg-2{padding-bottom:.5rem!important}.pb-lg-3{padding-bottom:1rem!important}.pb-lg-4{padding-bottom:1.5rem!important}.pb-lg-5{padding-bottom:3rem!important}.ps-lg-0{padding-left:0!important}.ps-lg-1{padding-left:.25rem!important}.ps-lg-2{padding-left:.5rem!important}.ps-lg-3{padding-left:1rem!important}.ps-lg-4{padding-left:1.5rem!important}.ps-lg-5{padding-left:3rem!important}.gap-lg-0{gap:0!important}.gap-lg-1{gap:.25rem!important}.gap-lg-2{gap:.5rem!important}.gap-lg-3{gap:1rem!important}.gap-lg-4{gap:1.5rem!important}.gap-lg-5{gap:3rem!important}.text-lg-start{text-align:left!important}.text-lg-end{text-align:right!important}.text-lg-center{text-align:center!important}}@media (min-width:1200px){.float-xl-start{float:left!important}.float-xl-end{float:right!important}.float-xl-none{float:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-grid{display:grid!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:flex!important}.d-xl-inline-flex{display:inline-flex!important}.d-xl-none{display:none!important}.flex-xl-fill{flex:1 1 auto!important}.flex-xl-row{flex-direction:row!important}.flex-xl-column{flex-direction:column!important}.flex-xl-row-reverse{flex-direction:row-reverse!important}.flex-xl-column-reverse{flex-direction:column-reverse!important}.flex-xl-grow-0{flex-grow:0!important}.flex-xl-grow-1{flex-grow:1!important}.flex-xl-shrink-0{flex-shrink:0!important}.flex-xl-shrink-1{flex-shrink:1!important}.flex-xl-wrap{flex-wrap:wrap!important}.flex-xl-nowrap{flex-wrap:nowrap!important}.flex-xl-wrap-reverse{flex-wrap:wrap-reverse!important}.justify-content-xl-start{justify-content:flex-start!important}.justify-content-xl-end{justify-content:flex-end!important}.justify-content-xl-center{justify-content:center!important}.justify-content-xl-between{justify-content:space-between!important}.justify-content-xl-around{justify-content:space-around!important}.justify-content-xl-evenly{justify-content:space-evenly!important}.align-items-xl-start{align-items:flex-start!important}.align-items-xl-end{align-items:flex-end!important}.align-items-xl-center{align-items:center!important}.align-items-xl-baseline{align-items:baseline!important}.align-items-xl-stretch{align-items:stretch!important}.align-content-xl-start{align-content:flex-start!important}.align-content-xl-end{align-content:flex-end!important}.align-content-xl-center{align-content:center!important}.align-content-xl-between{align-content:space-between!important}.align-content-xl-around{align-content:space-around!important}.align-content-xl-stretch{align-content:stretch!important}.align-self-xl-auto{align-self:auto!important}.align-self-xl-start{align-self:flex-start!important}.align-self-xl-end{align-self:flex-end!important}.align-self-xl-center{align-self:center!important}.align-self-xl-baseline{align-self:baseline!important}.align-self-xl-stretch{align-self:stretch!important}.order-xl-first{order:-1!important}.order-xl-0{order:0!important}.order-xl-1{order:1!important}.order-xl-2{order:2!important}.order-xl-3{order:3!important}.order-xl-4{order:4!important}.order-xl-5{order:5!important}.order-xl-last{order:6!important}.m-xl-0{margin:0!important}.m-xl-1{margin:.25rem!important}.m-xl-2{margin:.5rem!important}.m-xl-3{margin:1rem!important}.m-xl-4{margin:1.5rem!important}.m-xl-5{margin:3rem!important}.m-xl-auto{margin:auto!important}.mx-xl-0{margin-right:0!important;margin-left:0!important}.mx-xl-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-xl-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-xl-3{margin-right:1rem!important;margin-left:1rem!important}.mx-xl-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-xl-5{margin-right:3rem!important;margin-left:3rem!important}.mx-xl-auto{margin-right:auto!important;margin-left:auto!important}.my-xl-0{margin-top:0!important;margin-bottom:0!important}.my-xl-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-xl-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-xl-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-xl-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-xl-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-xl-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-xl-0{margin-top:0!important}.mt-xl-1{margin-top:.25rem!important}.mt-xl-2{margin-top:.5rem!important}.mt-xl-3{margin-top:1rem!important}.mt-xl-4{margin-top:1.5rem!important}.mt-xl-5{margin-top:3rem!important}.mt-xl-auto{margin-top:auto!important}.me-xl-0{margin-right:0!important}.me-xl-1{margin-right:.25rem!important}.me-xl-2{margin-right:.5rem!important}.me-xl-3{margin-right:1rem!important}.me-xl-4{margin-right:1.5rem!important}.me-xl-5{margin-right:3rem!important}.me-xl-auto{margin-right:auto!important}.mb-xl-0{margin-bottom:0!important}.mb-xl-1{margin-bottom:.25rem!important}.mb-xl-2{margin-bottom:.5rem!important}.mb-xl-3{margin-bottom:1rem!important}.mb-xl-4{margin-bottom:1.5rem!important}.mb-xl-5{margin-bottom:3rem!important}.mb-xl-auto{margin-bottom:auto!important}.ms-xl-0{margin-left:0!important}.ms-xl-1{margin-left:.25rem!important}.ms-xl-2{margin-left:.5rem!important}.ms-xl-3{margin-left:1rem!important}.ms-xl-4{margin-left:1.5rem!important}.ms-xl-5{margin-left:3rem!important}.ms-xl-auto{margin-left:auto!important}.p-xl-0{padding:0!important}.p-xl-1{padding:.25rem!important}.p-xl-2{padding:.5rem!important}.p-xl-3{padding:1rem!important}.p-xl-4{padding:1.5rem!important}.p-xl-5{padding:3rem!important}.px-xl-0{padding-right:0!important;padding-left:0!important}.px-xl-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-xl-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-xl-3{padding-right:1rem!important;padding-left:1rem!important}.px-xl-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-xl-5{padding-right:3rem!important;padding-left:3rem!important}.py-xl-0{padding-top:0!important;padding-bottom:0!important}.py-xl-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-xl-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-xl-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-xl-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-xl-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-xl-0{padding-top:0!important}.pt-xl-1{padding-top:.25rem!important}.pt-xl-2{padding-top:.5rem!important}.pt-xl-3{padding-top:1rem!important}.pt-xl-4{padding-top:1.5rem!important}.pt-xl-5{padding-top:3rem!important}.pe-xl-0{padding-right:0!important}.pe-xl-1{padding-right:.25rem!important}.pe-xl-2{padding-right:.5rem!important}.pe-xl-3{padding-right:1rem!important}.pe-xl-4{padding-right:1.5rem!important}.pe-xl-5{padding-right:3rem!important}.pb-xl-0{padding-bottom:0!important}.pb-xl-1{padding-bottom:.25rem!important}.pb-xl-2{padding-bottom:.5rem!important}.pb-xl-3{padding-bottom:1rem!important}.pb-xl-4{padding-bottom:1.5rem!important}.pb-xl-5{padding-bottom:3rem!important}.ps-xl-0{padding-left:0!important}.ps-xl-1{padding-left:.25rem!important}.ps-xl-2{padding-left:.5rem!important}.ps-xl-3{padding-left:1rem!important}.ps-xl-4{padding-left:1.5rem!important}.ps-xl-5{padding-left:3rem!important}.gap-xl-0{gap:0!important}.gap-xl-1{gap:.25rem!important}.gap-xl-2{gap:.5rem!important}.gap-xl-3{gap:1rem!important}.gap-xl-4{gap:1.5rem!important}.gap-xl-5{gap:3rem!important}.text-xl-start{text-align:left!important}.text-xl-end{text-align:right!important}.text-xl-center{text-align:center!important}}@media (min-width:1400px){.float-xxl-start{float:left!important}.float-xxl-end{float:right!important}.float-xxl-none{float:none!important}.d-xxl-inline{display:inline!important}.d-xxl-inline-block{display:inline-block!important}.d-xxl-block{display:block!important}.d-xxl-grid{display:grid!important}.d-xxl-table{display:table!important}.d-xxl-table-row{display:table-row!important}.d-xxl-table-cell{display:table-cell!important}.d-xxl-flex{display:flex!important}.d-xxl-inline-flex{display:inline-flex!important}.d-xxl-none{display:none!important}.flex-xxl-fill{flex:1 1 auto!important}.flex-xxl-row{flex-direction:row!important}.flex-xxl-column{flex-direction:column!important}.flex-xxl-row-reverse{flex-direction:row-reverse!important}.flex-xxl-column-reverse{flex-direction:column-reverse!important}.flex-xxl-grow-0{flex-grow:0!important}.flex-xxl-grow-1{flex-grow:1!important}.flex-xxl-shrink-0{flex-shrink:0!important}.flex-xxl-shrink-1{flex-shrink:1!important}.flex-xxl-wrap{flex-wrap:wrap!important}.flex-xxl-nowrap{flex-wrap:nowrap!important}.flex-xxl-wrap-reverse{flex-wrap:wrap-reverse!important}.justify-content-xxl-start{justify-content:flex-start!important}.justify-content-xxl-end{justify-content:flex-end!important}.justify-content-xxl-center{justify-content:center!important}.justify-content-xxl-between{justify-content:space-between!important}.justify-content-xxl-around{justify-content:space-around!important}.justify-content-xxl-evenly{justify-content:space-evenly!important}.align-items-xxl-start{align-items:flex-start!important}.align-items-xxl-end{align-items:flex-end!important}.align-items-xxl-center{align-items:center!important}.align-items-xxl-baseline{align-items:baseline!important}.align-items-xxl-stretch{align-items:stretch!important}.align-content-xxl-start{align-content:flex-start!important}.align-content-xxl-end{align-content:flex-end!important}.align-content-xxl-center{align-content:center!important}.align-content-xxl-between{align-content:space-between!important}.align-content-xxl-around{align-content:space-around!important}.align-content-xxl-stretch{align-content:stretch!important}.align-self-xxl-auto{align-self:auto!important}.align-self-xxl-start{align-self:flex-start!important}.align-self-xxl-end{align-self:flex-end!important}.align-self-xxl-center{align-self:center!important}.align-self-xxl-baseline{align-self:baseline!important}.align-self-xxl-stretch{align-self:stretch!important}.order-xxl-first{order:-1!important}.order-xxl-0{order:0!important}.order-xxl-1{order:1!important}.order-xxl-2{order:2!important}.order-xxl-3{order:3!important}.order-xxl-4{order:4!important}.order-xxl-5{order:5!important}.order-xxl-last{order:6!important}.m-xxl-0{margin:0!important}.m-xxl-1{margin:.25rem!important}.m-xxl-2{margin:.5rem!important}.m-xxl-3{margin:1rem!important}.m-xxl-4{margin:1.5rem!important}.m-xxl-5{margin:3rem!important}.m-xxl-auto{margin:auto!important}.mx-xxl-0{margin-right:0!important;margin-left:0!important}.mx-xxl-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-xxl-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-xxl-3{margin-right:1rem!important;margin-left:1rem!important}.mx-xxl-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-xxl-5{margin-right:3rem!important;margin-left:3rem!important}.mx-xxl-auto{margin-right:auto!important;margin-left:auto!important}.my-xxl-0{margin-top:0!important;margin-bottom:0!important}.my-xxl-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-xxl-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-xxl-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-xxl-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-xxl-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-xxl-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-xxl-0{margin-top:0!important}.mt-xxl-1{margin-top:.25rem!important}.mt-xxl-2{margin-top:.5rem!important}.mt-xxl-3{margin-top:1rem!important}.mt-xxl-4{margin-top:1.5rem!important}.mt-xxl-5{margin-top:3rem!important}.mt-xxl-auto{margin-top:auto!important}.me-xxl-0{margin-right:0!important}.me-xxl-1{margin-right:.25rem!important}.me-xxl-2{margin-right:.5rem!important}.me-xxl-3{margin-right:1rem!important}.me-xxl-4{margin-right:1.5rem!important}.me-xxl-5{margin-right:3rem!important}.me-xxl-auto{margin-right:auto!important}.mb-xxl-0{margin-bottom:0!important}.mb-xxl-1{margin-bottom:.25rem!important}.mb-xxl-2{margin-bottom:.5rem!important}.mb-xxl-3{margin-bottom:1rem!important}.mb-xxl-4{margin-bottom:1.5rem!important}.mb-xxl-5{margin-bottom:3rem!important}.mb-xxl-auto{margin-bottom:auto!important}.ms-xxl-0{margin-left:0!important}.ms-xxl-1{margin-left:.25rem!important}.ms-xxl-2{margin-left:.5rem!important}.ms-xxl-3{margin-left:1rem!important}.ms-xxl-4{margin-left:1.5rem!important}.ms-xxl-5{margin-left:3rem!important}.ms-xxl-auto{margin-left:auto!important}.p-xxl-0{padding:0!important}.p-xxl-1{padding:.25rem!important}.p-xxl-2{padding:.5rem!important}.p-xxl-3{padding:1rem!important}.p-xxl-4{padding:1.5rem!important}.p-xxl-5{padding:3rem!important}.px-xxl-0{padding-right:0!important;padding-left:0!important}.px-xxl-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-xxl-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-xxl-3{padding-right:1rem!important;padding-left:1rem!important}.px-xxl-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-xxl-5{padding-right:3rem!important;padding-left:3rem!important}.py-xxl-0{padding-top:0!important;padding-bottom:0!important}.py-xxl-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-xxl-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-xxl-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-xxl-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-xxl-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-xxl-0{padding-top:0!important}.pt-xxl-1{padding-top:.25rem!important}.pt-xxl-2{padding-top:.5rem!important}.pt-xxl-3{padding-top:1rem!important}.pt-xxl-4{padding-top:1.5rem!important}.pt-xxl-5{padding-top:3rem!important}.pe-xxl-0{padding-right:0!important}.pe-xxl-1{padding-right:.25rem!important}.pe-xxl-2{padding-right:.5rem!important}.pe-xxl-3{padding-right:1rem!important}.pe-xxl-4{padding-right:1.5rem!important}.pe-xxl-5{padding-right:3rem!important}.pb-xxl-0{padding-bottom:0!important}.pb-xxl-1{padding-bottom:.25rem!important}.pb-xxl-2{padding-bottom:.5rem!important}.pb-xxl-3{padding-bottom:1rem!important}.pb-xxl-4{padding-bottom:1.5rem!important}.pb-xxl-5{padding-bottom:3rem!important}.ps-xxl-0{padding-left:0!important}.ps-xxl-1{padding-left:.25rem!important}.ps-xxl-2{padding-left:.5rem!important}.ps-xxl-3{padding-left:1rem!important}.ps-xxl-4{padding-left:1.5rem!important}.ps-xxl-5{padding-left:3rem!important}.gap-xxl-0{gap:0!important}.gap-xxl-1{gap:.25rem!important}.gap-xxl-2{gap:.5rem!important}.gap-xxl-3{gap:1rem!important}.gap-xxl-4{gap:1.5rem!important}.gap-xxl-5{gap:3rem!important}.text-xxl-start{text-align:left!important}.text-xxl-end{text-align:right!important}.text-xxl-center{text-align:center!important}}@media (min-width:1200px){.fs-1{font-size:2.5rem!important}.fs-2{font-size:2rem!important}.fs-3{font-size:1.75rem!important}.fs-4{font-size:1.5rem!important}}@media print{.d-print-inline{display:inline!important}.d-print-inline-block{display:inline-block!important}.d-print-block{display:block!important}.d-print-grid{display:grid!important}.d-print-table{display:table!important}.d-print-table-row{display:table-row!important}.d-print-table-cell{display:table-cell!important}.d-print-flex{display:flex!important}.d-print-inline-flex{display:inline-flex!important}.d-print-none{display:none!important}} +/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/static/css/main.css b/static/css/main.css index d4642b3c77..e708ac188c 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1,309 +1,701 @@ -html, body { +@import "TTHoves/TTHoves.css"; + +* { + margin: 0; + padding: 0; + outline: none; + font-family: "TT Hoves", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif; +} + +html, +body { height: 100%; } body { - width: 100%; min-height: 100%; - background-color: #ffffff; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif; - font-size: 11px; + margin: 0; + background: linear-gradient(to bottom, #f6f6f6 360px, #e5e5e5 0), #e5e5e5; + background-repeat: no-repeat; } a { - color: #428bca; + color: #00854d; text-decoration: none; } -h1 small { - font-size: 65%; +a:hover { + color: #00854d; + text-decoration: underline; } -h3 { - margin-top: 20px; +select { + border-radius: 0.5rem; + padding-left: 0.5rem; + border: 1px solid #ced4da; + color: var(--bs-body-color); + min-height: 45px; } -.octicon { - color: #777; - display: inline-block; - vertical-align: text-top; - fill: currentColor; - height: 16px; +#header { + position: fixed; + top: 0; + left: 0; + width: 100%; + margin: 0; + padding-bottom: 0; + padding-top: 0; + background-color: white; + border-bottom: 1px solid #f6f6f6; + z-index: 10; } -.navbar-form { - padding-bottom: 1px; +#header a { + color: var(--bs-navbar-brand-color); } -.navbar-form .form-control { - background-color: gray; - color: #fff; - border-radius: 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border: 0; - -webkit-box-shadow: 1px 1px 0 0 rgba(255, 255, 255, .41), inset 1px 1px 3px 0 rgba(0, 0, 0, .10); - -moz-box-shadow: 1px 1px 0 0 rgba(255, 255, 255, .41), inset 1px 1px 3px 0 rgba(0, 0, 0, .10); - box-shadow: 1px 1px 0 0 rgba(255, 255, 255, .41), inset 1px 1px 3px 0 rgba(0, 0, 0, .10); +#header a:hover { + color: var(--bs-navbar-brand-hover-color); } -@media (min-width: 768px) { - .container { - max-width: 750px; - } +#header .navbar { + --bs-navbar-padding-y: 0.7rem; } -@media (min-width: 992px) { - body { - font-size: 12px; - } - .container { - max-width: 970px; - } - .octicon { - height: 24px; - } - .navbar-form .form-control { - width: 230px; - } +#header .form-control-lg { + font-size: 1rem; + padding: 0.75rem 1rem; } -@media (min-width: 1200px) { - body { - font-size: 14px; - } - .container { - max-width: 1170px; - } - .octicon { - height: 32px; - } - .navbar-form .form-control { - width: 360px; - } +#header .container { + min-height: 50px; } -#header { - position: absolute; - top: 0; - left: 0; - width: 100%; - margin: 0; - padding-bottom: 0; - padding-top: 0; - background-color: #212121; - border: 0; +#header .btn.dropdown-toggle { + padding-right: 0; +} + +#header .dropdown-menu { + --bs-dropdown-min-width: 13rem; +} + +#header .dropdown-menu[data-bs-popper] { + left: initial; + right: 0; } -.bg-trezor { - background-color: #212121!important; - padding-top: 3px; - padding-bottom: 2px; - z-index: 2; +#header .dropdown-menu.show { + display: flex; } -.bg-trezor .navbar-brand { - color: rgba(255, 255, 255); +.form-control:focus { + outline: 0; + box-shadow: none; + border-color: #00854d; +} + +.base-value { + color: #757575 !important; + padding-left: 0.5rem; + font-weight: normal; +} + +.badge { + vertical-align: middle; + text-transform: uppercase; + letter-spacing: 0.15em; + --bs-badge-padding-x: 0.8rem; + --bs-badge-font-weight: normal; + --bs-badge-border-radius: 0.6rem; +} + +.bg-secondary { + background-color: #757575 !important; +} + +.accordion { + --bs-accordion-border-radius: 10px; + --bs-accordion-inner-border-radius: calc(10px - 1px); + --bs-accordion-color: var(--bs-body-color); + --bs-accordion-active-color: var(--bs-body-color); + --bs-accordion-active-bg: white; + --bs-accordion-btn-active-icon: url("data:image/svg+xml,"); +} + +.accordion-button:focus { + outline: 0; + box-shadow: none; +} + +.accordion-body { + letter-spacing: -0.01em; +} + +.bb-group { + border: 0.6rem solid #f6f6f6; + background-color: #f6f6f6; + border-radius: 0.5rem; + position: relative; + display: inline-flex; + vertical-align: middle; +} + +.bb-group>.btn { + --bs-btn-padding-x: 0.5rem; + --bs-btn-padding-y: 0.22rem; + --bs-btn-border-radius: 0.3rem; + --bs-btn-border-width: 0; + color: #545454; +} + +.bb-group>.btn-check:checked+.btn, +.bb-group .btn.active { + color: black; font-weight: bold; - font-size: 19px; - fill: #FFFFFF; + background-color: white; } -@media (max-width: 768px) { - .navbar { - font-size: 14px; - } - .bg-trezor .navbar-brand { - font-weight: normal; - font-size: 14px; - } +.paging { + display: flex; +} + +.paging .bb-group>.btn { + min-width: 2rem; + margin-left: 0.1rem; + margin-right: 0.1rem; +} + +.paging .bb-group>.btn:hover { + background-color: white; +} + +.paging a { + text-decoration: none; +} + +.btn-paging { + --bs-btn-color: #757575; + --bs-btn-border-color: #e2e2e2; + --bs-btn-hover-color: black; + --bs-btn-hover-bg: #f6f6f6; + --bs-btn-hover-border-color: #e2e2e2; + --bs-btn-focus-shadow-rgb: 108, 117, 125; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #e2e2e2; + --bs-btn-active-border-color: #e2e2e2; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-gradient: none; + --bs-btn-padding-y: 0.75rem; + --bs-btn-padding-x: 1.1rem; + --bs-btn-border-radius: 0.5rem; + --bs-btn-font-weight: bold; + background-color: #f6f6f6; +} + +span.btn-paging { + cursor: initial; +} + +span.btn-paging:hover { + color: #757575; +} + +.btn-paging.active:hover { + background-color: white; +} + +.paging-group { + border: 1px solid #e2e2e2; + border-radius: 0.5rem; +} + +.paging-group>.bb-group { + border: 0.53rem solid #f6f6f6; } #wrap { min-height: 100%; height: auto; - padding: 75px 0; - margin: 0 auto -42px; + padding: 112px 0 75px 0; + margin: 0 auto -56px; } #footer { - background-color: #212121; - color: #fff; - height: 42px; + background-color: black; + color: #757575; + height: 56px; overflow: hidden; } -.alert-data { - color: #383d41; - background-color: #f4f4f4; - border-color: #d6d8db; - padding: 15px; +.navbar-form { + width: 60%; } -.line-top { - border-top: 1px solid #EAEAEA; - padding: 10px 0 0; +.navbar-form button { + margin-left: -50px; + position: relative; } -.line-mid { - padding: 15px; +.search-icon { + width: 16px; + height: 16px; + position: absolute; + top: 16px; + background-size: cover; + background-image: url("data:image/svg+xml, %3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.24976 12.5C10.1493 12.5 12.4998 10.1495 12.4998 7.25C12.4998 4.35051 10.1493 2 7.24976 2C4.35026 2 1.99976 4.35051 1.99976 7.25C1.99976 10.1495 4.35026 12.5 7.24976 12.5Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M10.962 10.9625L13.9996 14.0001' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3C/svg%3E"); } -.line-bot { - border-bottom: 2px solid #EAEAEA; - padding: 0 0 15px; +.navbar-form ::placeholder { + color: #e2e2e2; } -.txvalues { - display: inline-block; - padding: .7em 2em; - font-size: 13px; - color: #fff; - text-align: center; +.ellipsis { + overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; - vertical-align: baseline; - border-radius: .25em; - margin-top: 5px; } -.txvalues:not(:last-child) { - margin-right: 5px; +.data-table { + table-layout: fixed; + overflow-wrap: anywhere; + margin-left: 8px; + margin-top: 2rem; + margin-bottom: 2rem; + width: calc(100% - 16px); +} + +.data-table thead { + padding-bottom: 20px; +} + +.table.data-table> :not(caption)>*>* { + padding: 0.8rem 0.8rem; + background-color: var(--bs-table-bg); + border-bottom-width: 1px; + box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg); +} + +.table.data-table>thead>*>* { + padding-bottom: 1.5rem; +} + +.table.data-table>*>*:last-child>* { + border-bottom: none; +} + +.data-table thead, +.data-table thead tr, +.data-table thead th { + color: #757575; + border: none; + font-weight: normal; +} + +.data-table tbody th { + color: #757575; + font-weight: normal; } -.txvalues-default { - background-color: #EBEBEB; - color: #333; +.data-table tbody { + background: white; + border-radius: 8px; + box-shadow: 0 0 0 8px white; +} + +.data-table h3, +.data-table h5, +.data-table h6 { + margin-bottom: 0; } -.txvalues-success { - background-color: dimgray; +.data-table h3, +.data-table h5 { + color: var(--bs-body-color); } -.txvalues-primary { - background-color: #000; +.accordion .table.data-table>thead>*>* { + padding-bottom: 0; +} + +.info-table tbody { + display: inline-table; + width: 100%; +} + +.info-table td { + font-weight: bold; } -.txvalues-danger { - background-color: #AC0015; +.info-table tr>td:first-child { + font-weight: normal; + color: #757575; +} + +.ns:before { + content: " "; +} + +.nc:before { + content: ","; +} + +.trezor-logo { + width: 128px; + height: 32px; + position: absolute; + top: 16px; + background-size: cover; + background-image: url("data:image/svg+xml,%3Csvg style='width: 128px%3B' version='1.1' xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewBox='0 0 163.7 41.9' space='preserve'%3E%3Cpolygon points='101.1 12.8 118.2 12.8 118.2 17.3 108.9 29.9 118.2 29.9 118.2 35.2 101.1 35.2 101.1 30.7 110.4 18.1 101.1 18.1'%3E%3C/polygon%3E%3Cpath d='M158.8 26.9c2.1-0.8 4.3-2.9 4.3-6.6c0-4.5-3.1-7.4-7.7-7.4h-10.5v22.3h5.8v-7.5h2.2l4.1 7.5h6.7L158.8 26.9z M154.7 22.5h-4V18h4c1.5 0 2.5 0.9 2.5 2.2C157.2 21.6 156.2 22.5 154.7 22.5z'%3E%3C/path%3E%3Cpath d='M130.8 12.5c-6.8 0-11.6 4.9-11.6 11.5s4.9 11.5 11.6 11.5s11.7-4.9 11.7-11.5S137.6 12.5 130.8 12.5z M130.8 30.3c-3.4 0-5.7-2.6-5.7-6.3c0-3.8 2.3-6.3 5.7-6.3c3.4 0 5.8 2.6 5.8 6.3C136.6 27.7 134.2 30.3 130.8 30.3z'%3E%3C/path%3E%3Cpolygon points='82.1 12.8 98.3 12.8 98.3 18 87.9 18 87.9 21.3 98 21.3 98 26.4 87.9 26.4 87.9 30 98.3 30 98.3 35.2 82.1 35.2'%3E%3C/polygon%3E%3Cpath d='M24.6 9.7C24.6 4.4 20 0 14.4 0S4.2 4.4 4.2 9.7v3.1H0v22.3h0l14.4 6.7l14.4-6.7h0V12.9h-4.2V9.7z M9.4 9.7c0-2.5 2.2-4.5 5-4.5s5 2 5 4.5v3.1H9.4V9.7z M23 31.5l-8.6 4l-8.6-4V18.1H23V31.5z'%3E%3C/path%3E%3Cpath d='M79.4 20.3c0-4.5-3.1-7.4-7.7-7.4H61.2v22.3H67v-7.5h2.2l4.1 7.5H80l-4.9-8.3C77.2 26.1 79.4 24 79.4 20.3z M71 22.5h-4V18h4c1.5 0 2.5 0.9 2.5 2.2C73.5 21.6 72.5 22.5 71 22.5z'%3E%3C/path%3E%3Cpolygon points='40.5 12.8 58.6 12.8 58.6 18.1 52.4 18.1 52.4 35.2 46.6 35.2 46.6 18.1 40.5 18.1'%3E%3C/polygon%3E%3C/svg%3E"); +} + +.copyable::before, +.copied::before { + width: 18px; + height: 16px; + margin: 3px -18px; + content: ""; + position: absolute; + background-size: cover; +} + +.copyable::before { + display: none; + cursor: copy; + background-image: url("data:image/svg+xml,%3Csvg width='18' height='16' viewBox='0 0 18 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 10.4996H13.5V2.49963H5.5V5.49963' stroke='%2300854D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M10.4998 5.49976H2.49976V13.4998H10.4998V5.49976Z' stroke='%2300854D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); +} + +.copyable:hover::before { + display: inline-block; +} + +.copied::before { + transition: all 0.4s ease; + transform: scale(1.2); + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='16' viewBox='-30 -30 330 330'%3E%3Cpath d='M 30,180 90,240 240,30' style='stroke:%2300854D; stroke-width:32; fill:none'/%3E%3C/svg%3E"); +} + +.h-data { + letter-spacing: 0.12em; + font-weight: normal !important; +} + +.tx-detail { + background: #f6f6f6; + color: #757575; + border-radius: 10px; + box-shadow: 0 0 0 10px white; + width: calc(100% - 20px); + margin-left: 10px; + margin-top: 3rem; + overflow-wrap: break-word; +} + +.tx-detail:first-child { + margin-top: 1rem; +} + +.tx-detail:last-child { + margin-bottom: 2rem; +} + +.tx-detail span.ellipsis, +.tx-detail a.ellipsis { + display: block; + float: left; + max-width: 100%; +} + +.tx-detail>.head, +.tx-detail>.footer { + padding: 1.5rem; + --bs-gutter-x: 0; +} + +.tx-detail>.head { + border-radius: 10px 10px 0 0; +} + +.tx-detail .txid { + font-size: 106%; + letter-spacing: -0.01em; +} + +.tx-detail>.body { + padding: 0 1.5rem; + --bs-gutter-x: 0; + letter-spacing: -0.01em; +} + + +.tx-detail>.subhead { + padding: 1.5rem 1.5rem 0.4rem 1.5rem; + --bs-gutter-x: 0; + letter-spacing: 0.1em; text-transform: uppercase; + color: var(--bs-body-color); +} + +.tx-detail>.subhead-2 { + padding: 0.3rem 1.5rem 0 1.5rem; + --bs-gutter-x: 0; + font-size: .875em; + color: var(--bs-body-color); +} + +.tx-in .col-12, +.tx-out .col-12, +.tx-addr .col-12 { + background-color: white; + padding: 1.2rem 1.3rem; + border-bottom: 1px solid #f6f6f6; +} + +.amt-out { + padding: 1.2rem 0 1.2rem 1rem; + text-align: right; + overflow-wrap: break-word; +} + +.tx-in .col-12:last-child, +.tx-out .col-12:last-child { + border-bottom: none; } .tx-own { - background-color: #fbf8f0; + background-color: #fff9e3 !important; } .tx-amt { - float: right!important; + float: right !important; } -.tx-in .tx-own .tx-amt { - color: #dc3545!important; +.spent { + color: #dc3545 !important; } -.tx-out .tx-own .tx-amt { - color: #28a745!important; +.unspent { + color: #28a745 !important; } -.tx-addr { - float: left!important; +.outpoint { + color: #757575 !important; } -.ellipsis { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; +.spent, +.unspent, +.outpoint { + display: inline-block; + text-align: right; + min-width: 18px; + text-decoration: none !important; } -.data-div { - margin: 20px 0 30px 0; +.octicon { + height: 24px; + width: 24px; + margin-left: -12px; + margin-top: 19px; + position: absolute; + background-size: cover; + background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 4.5L16.5 12L9 19.5' stroke='%23AFAFAF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A"); } -.data-div .col-md-10 { - padding-left: 0; +.txvalue { + color: var(--bs-body-color); + font-weight: bold; } -.data-table { - table-layout: fixed; - border-radius: .25rem; - background: white; +.txerror { + color: #c51f13; } -.data-table td, .data-table th { - padding: .4rem; +.txerror a, +.txerror .txvalue { + color: #c51f13; } -.data-table span.ellipsis { - max-width: 100%; +.txerror .copyable::before, +.txerror .copied::before { + /* turn svg stroke to red */ + filter: invert(86%) sepia(43%) saturate(732%) hue-rotate(367deg) brightness(84%); } -.data { - font-weight: bold; +.tx-amt .amt:hover, +.tx-amt.amt:hover, +.amt-out>.amt:hover { + color: var(--bs-body-color); } -table.data-table table.data-table th { - border-top: 0; - font-weight: normal; +.prim-amt { + display: initial; } -.alert .data-table { - margin: 0; +.sec-amt { + display: none; } -::-webkit-input-placeholder { - color: #CCC!important; - font-style: italic; - font-size: 14px; +.csec-amt { + display: none; } -::-moz-placeholder { - color: #CCC!important; - font-style: italic; - font-size: 14px; +.base-amt { + display: none; } -.h-container ul, .h-container h3 { - margin: 0; +.cbase-amt { + display: none; } -.h-container h5 { - margin-top: 6px; - margin-bottom: 0; +.tooltip { + --bs-tooltip-opacity: 1; + --bs-tooltip-max-width: 380px; + --bs-tooltip-bg: #fff; + --bs-tooltip-color: var(--bs-body-color); + --bs-tooltip-padding-x: 1rem; + --bs-tooltip-padding-y: 0.8rem; + filter: drop-shadow(0px 24px 64px rgba(22, 27, 45, 0.25)); } -.page-link { - color: #428bca; +.l-tooltip { + text-align: start; + display: inline-block; } -.page-text { - display: block; - padding: .5rem .3rem; - line-height: 1.25; +.l-tooltip .prim-amt, +.l-tooltip .sec-amt, +.l-tooltip .csec-amt, +.l-tooltip .base-amt, +.l-tooltip .cbase-amt { + display: initial; + float: right; } -.page-link { - color: #428bca; +.l-tooltip .amt-time { + padding-right: 3rem; + float: left; } -.page-item.active .page-link { - background-color: #428bca; +.amt-dec { + font-size: 95%; } -#txSpecific { - margin: 0; +.unconfirmed { + color: white; + background-color: #c51e13; + padding: 0.7rem 1.2rem; + border-radius: 1.4rem; +} + +.json { + word-wrap: break-word; + font-size: smaller; + background: #002b31; + border-radius: 8px; +} + +#raw { + padding: 1.5rem 2rem; + color: #ffffff; + letter-spacing: 0.02em; } -.string { - color: darkgreen; +#raw .string { + color: #2bca87; } -.number, .boolean { - color: darkred; +#raw .number, +#raw .boolean { + color: #efc941; } -.null { +#raw .null { color: red; } -.key { - color: #333; -} \ No newline at end of file +@media (max-width: 768px) { + body { + font-size: 0.8rem; + background: linear-gradient(to bottom, #f6f6f6 500px, #e5e5e5 0), #e5e5e5; + } + + .container { + padding-left: 2px; + padding-right: 2px; + } + + .accordion-body { + padding: var(--bs-accordion-body-padding-y) 0; + } + + .octicon { + scale: 60% !important; + margin-top: -2px; + } + + .unconfirmed { + padding: 0.1rem 0.8rem; + } + + .btn { + --bs-btn-font-size: 0.8rem; + } +} + +@media (max-width: 991px) { + #header .container { + min-height: 40px; + } + + #header .dropdown-menu[data-bs-popper] { + left: 0; + right: initial; + } + + .trezor-logo { + top: 10px; + } + + .octicon { + scale: 80%; + } + + .table.data-table>:not(caption)>*>* { + padding: 0.8rem 0.4rem; + } + + .tx-in .col-12, + .tx-out .col-12, + .tx-addr .col-12 { + padding: 0.7rem 1.1rem; + } + + .amt-out { + padding: 0.7rem 0 0.7rem 1rem + } +} + +@media (min-width: 769px) { + body { + font-size: 0.9rem; + } + + .btn { + --bs-btn-font-size: 0.9rem; + } +} + +@media (min-width: 1200px) { + + .h1, + h1 { + font-size: 2.4rem; + } + + body { + font-size: 1rem; + } + + .btn { + --bs-btn-font-size: 1rem; + } +} diff --git a/static/css/main.min.4.css b/static/css/main.min.4.css new file mode 100644 index 0000000000..54dd88a23d --- /dev/null +++ b/static/css/main.min.4.css @@ -0,0 +1 @@ +@import "TTHoves/TTHoves.css";* {margin: 0;padding: 0;outline: none;font-family: "TT Hoves", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;}html, body {height: 100%;}body {min-height: 100%;margin: 0;background: linear-gradient(to bottom, #f6f6f6 360px, #e5e5e5 0), #e5e5e5;background-repeat: no-repeat;}a {color: #00854d;text-decoration: none;}a:hover {color: #00854d;text-decoration: underline;}select {border-radius: 0.5rem;padding-left: 0.5rem;border: 1px solid #ced4da;color: var(--bs-body-color);min-height: 45px;}#header {position: fixed;top: 0;left: 0;width: 100%;margin: 0;padding-bottom: 0;padding-top: 0;background-color: white;border-bottom: 1px solid #f6f6f6;z-index: 10;}#header a {color: var(--bs-navbar-brand-color);}#header a:hover {color: var(--bs-navbar-brand-hover-color);}#header .navbar {--bs-navbar-padding-y: 0.7rem;}#header .form-control-lg {font-size: 1rem;padding: 0.75rem 1rem;}#header .container {min-height: 50px;}#header .btn.dropdown-toggle {padding-right: 0;}#header .dropdown-menu {--bs-dropdown-min-width: 13rem;}#header .dropdown-menu[data-bs-popper] {left: initial;right: 0;}#header .dropdown-menu.show {display: flex;}.form-control:focus {outline: 0;box-shadow: none;border-color: #00854d;}.base-value {color: #757575 !important;padding-left: 0.5rem;font-weight: normal;}.badge {vertical-align: middle;text-transform: uppercase;letter-spacing: 0.15em;--bs-badge-padding-x: 0.8rem;--bs-badge-font-weight: normal;--bs-badge-border-radius: 0.6rem;}.bg-secondary {background-color: #757575 !important;}.accordion {--bs-accordion-border-radius: 10px;--bs-accordion-inner-border-radius: calc(10px - 1px);--bs-accordion-color: var(--bs-body-color);--bs-accordion-active-color: var(--bs-body-color);--bs-accordion-active-bg: white;--bs-accordion-btn-active-icon: url("data:image/svg+xml,");}.accordion-button:focus {outline: 0;box-shadow: none;}.accordion-body {letter-spacing: -0.01em;}.bb-group {border: 0.6rem solid #f6f6f6;background-color: #f6f6f6;border-radius: 0.5rem;position: relative;display: inline-flex;vertical-align: middle;}.bb-group>.btn {--bs-btn-padding-x: 0.5rem;--bs-btn-padding-y: 0.22rem;--bs-btn-border-radius: 0.3rem;--bs-btn-border-width: 0;color: #545454;}.bb-group>.btn-check:checked+.btn, .bb-group .btn.active {color: black;font-weight: bold;background-color: white;}.paging {display: flex;}.paging .bb-group>.btn {min-width: 2rem;margin-left: 0.1rem;margin-right: 0.1rem;}.paging .bb-group>.btn:hover {background-color: white;}.paging a {text-decoration: none;}.btn-paging {--bs-btn-color: #757575;--bs-btn-border-color: #e2e2e2;--bs-btn-hover-color: black;--bs-btn-hover-bg: #f6f6f6;--bs-btn-hover-border-color: #e2e2e2;--bs-btn-focus-shadow-rgb: 108, 117, 125;--bs-btn-active-color: #fff;--bs-btn-active-bg: #e2e2e2;--bs-btn-active-border-color: #e2e2e2;--bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);--bs-gradient: none;--bs-btn-padding-y: 0.75rem;--bs-btn-padding-x: 1.1rem;--bs-btn-border-radius: 0.5rem;--bs-btn-font-weight: bold;background-color: #f6f6f6;}span.btn-paging {cursor: initial;}span.btn-paging:hover {color: #757575;}.btn-paging.active:hover {background-color: white;}.paging-group {border: 1px solid #e2e2e2;border-radius: 0.5rem;}.paging-group>.bb-group {border: 0.53rem solid #f6f6f6;}#wrap {min-height: 100%;height: auto;padding: 112px 0 75px 0;margin: 0 auto -56px;}#footer {background-color: black;color: #757575;height: 56px;overflow: hidden;}.navbar-form {width: 60%;}.navbar-form button {margin-left: -50px;position: relative;}.search-icon {width: 16px;height: 16px;position: absolute;top: 16px;background-size: cover;background-image: url("data:image/svg+xml, %3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.24976 12.5C10.1493 12.5 12.4998 10.1495 12.4998 7.25C12.4998 4.35051 10.1493 2 7.24976 2C4.35026 2 1.99976 4.35051 1.99976 7.25C1.99976 10.1495 4.35026 12.5 7.24976 12.5Z' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3Cpath d='M10.962 10.9625L13.9996 14.0001' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' /%3E%3C/svg%3E");}.navbar-form ::placeholder {color: #e2e2e2;}.ellipsis {overflow: hidden;text-overflow: ellipsis;white-space: nowrap;}.data-table {table-layout: fixed;overflow-wrap: anywhere;margin-left: 8px;margin-top: 2rem;margin-bottom: 2rem;width: calc(100% - 16px);}.data-table thead {padding-bottom: 20px;}.table.data-table> :not(caption)>*>* {padding: 0.8rem 0.8rem;background-color: var(--bs-table-bg);border-bottom-width: 1px;box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);}.table.data-table>thead>*>* {padding-bottom: 1.5rem;}.table.data-table>*>*:last-child>* {border-bottom: none;}.data-table thead, .data-table thead tr, .data-table thead th {color: #757575;border: none;font-weight: normal;}.data-table tbody th {color: #757575;font-weight: normal;}.data-table tbody {background: white;border-radius: 8px;box-shadow: 0 0 0 8px white;}.data-table h3, .data-table h5, .data-table h6 {margin-bottom: 0;}.data-table h3, .data-table h5 {color: var(--bs-body-color);}.accordion .table.data-table>thead>*>* {padding-bottom: 0;}.info-table tbody {display: inline-table;width: 100%;}.info-table td {font-weight: bold;}.info-table tr>td:first-child {font-weight: normal;color: #757575;}.ns:before {content: " ";}.nc:before {content: ",";}.trezor-logo {width: 128px;height: 32px;position: absolute;top: 16px;background-size: cover;background-image: url("data:image/svg+xml,%3Csvg style='width: 128px%3B' version='1.1' xmlns='http://www.w3.org/2000/svg' x='0px' y='0px' viewBox='0 0 163.7 41.9' space='preserve'%3E%3Cpolygon points='101.1 12.8 118.2 12.8 118.2 17.3 108.9 29.9 118.2 29.9 118.2 35.2 101.1 35.2 101.1 30.7 110.4 18.1 101.1 18.1'%3E%3C/polygon%3E%3Cpath d='M158.8 26.9c2.1-0.8 4.3-2.9 4.3-6.6c0-4.5-3.1-7.4-7.7-7.4h-10.5v22.3h5.8v-7.5h2.2l4.1 7.5h6.7L158.8 26.9z M154.7 22.5h-4V18h4c1.5 0 2.5 0.9 2.5 2.2C157.2 21.6 156.2 22.5 154.7 22.5z'%3E%3C/path%3E%3Cpath d='M130.8 12.5c-6.8 0-11.6 4.9-11.6 11.5s4.9 11.5 11.6 11.5s11.7-4.9 11.7-11.5S137.6 12.5 130.8 12.5z M130.8 30.3c-3.4 0-5.7-2.6-5.7-6.3c0-3.8 2.3-6.3 5.7-6.3c3.4 0 5.8 2.6 5.8 6.3C136.6 27.7 134.2 30.3 130.8 30.3z'%3E%3C/path%3E%3Cpolygon points='82.1 12.8 98.3 12.8 98.3 18 87.9 18 87.9 21.3 98 21.3 98 26.4 87.9 26.4 87.9 30 98.3 30 98.3 35.2 82.1 35.2'%3E%3C/polygon%3E%3Cpath d='M24.6 9.7C24.6 4.4 20 0 14.4 0S4.2 4.4 4.2 9.7v3.1H0v22.3h0l14.4 6.7l14.4-6.7h0V12.9h-4.2V9.7z M9.4 9.7c0-2.5 2.2-4.5 5-4.5s5 2 5 4.5v3.1H9.4V9.7z M23 31.5l-8.6 4l-8.6-4V18.1H23V31.5z'%3E%3C/path%3E%3Cpath d='M79.4 20.3c0-4.5-3.1-7.4-7.7-7.4H61.2v22.3H67v-7.5h2.2l4.1 7.5H80l-4.9-8.3C77.2 26.1 79.4 24 79.4 20.3z M71 22.5h-4V18h4c1.5 0 2.5 0.9 2.5 2.2C73.5 21.6 72.5 22.5 71 22.5z'%3E%3C/path%3E%3Cpolygon points='40.5 12.8 58.6 12.8 58.6 18.1 52.4 18.1 52.4 35.2 46.6 35.2 46.6 18.1 40.5 18.1'%3E%3C/polygon%3E%3C/svg%3E");}.copyable::before, .copied::before {width: 18px;height: 16px;margin: 3px -18px;content: "";position: absolute;background-size: cover;}.copyable::before {display: none;cursor: copy;background-image: url("data:image/svg+xml,%3Csvg width='18' height='16' viewBox='0 0 18 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 10.4996H13.5V2.49963H5.5V5.49963' stroke='%2300854D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M10.4998 5.49976H2.49976V13.4998H10.4998V5.49976Z' stroke='%2300854D' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");}.copyable:hover::before {display: inline-block;}.copied::before {transition: all 0.4s ease;transform: scale(1.2);background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='16' viewBox='-30 -30 330 330'%3E%3Cpath d='M 30,180 90,240 240,30' style='stroke:%2300854D;stroke-width:32;fill:none'/%3E%3C/svg%3E");}.h-data {letter-spacing: 0.12em;font-weight: normal !important;}.tx-detail {background: #f6f6f6;color: #757575;border-radius: 10px;box-shadow: 0 0 0 10px white;width: calc(100% - 20px);margin-left: 10px;margin-top: 3rem;overflow-wrap: break-word;}.tx-detail:first-child {margin-top: 1rem;}.tx-detail:last-child {margin-bottom: 2rem;}.tx-detail span.ellipsis, .tx-detail a.ellipsis {display: block;float: left;max-width: 100%;}.tx-detail>.head, .tx-detail>.footer {padding: 1.5rem;--bs-gutter-x: 0;}.tx-detail>.head {border-radius: 10px 10px 0 0;}.tx-detail .txid {font-size: 106%;letter-spacing: -0.01em;}.tx-detail>.body {padding: 0 1.5rem;--bs-gutter-x: 0;letter-spacing: -0.01em;}.tx-detail>.subhead {padding: 1.5rem 1.5rem 0.4rem 1.5rem;--bs-gutter-x: 0;letter-spacing: 0.1em;text-transform: uppercase;color: var(--bs-body-color);}.tx-detail>.subhead-2 {padding: 0.3rem 1.5rem 0 1.5rem;--bs-gutter-x: 0;font-size: .875em;color: var(--bs-body-color);}.tx-in .col-12, .tx-out .col-12, .tx-addr .col-12 {background-color: white;padding: 1.2rem 1.3rem;border-bottom: 1px solid #f6f6f6;}.amt-out {padding: 1.2rem 0 1.2rem 1rem;text-align: right;overflow-wrap: break-word;}.tx-in .col-12:last-child, .tx-out .col-12:last-child {border-bottom: none;}.tx-own {background-color: #fff9e3 !important;}.tx-amt {float: right !important;}.spent {color: #dc3545 !important;}.unspent {color: #28a745 !important;}.outpoint {color: #757575 !important;}.spent, .unspent, .outpoint {display: inline-block;text-align: right;min-width: 18px;text-decoration: none !important;}.octicon {height: 24px;width: 24px;margin-left: -12px;margin-top: 19px;position: absolute;background-size: cover;background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 4.5L16.5 12L9 19.5' stroke='%23AFAFAF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A");}.txvalue {color: var(--bs-body-color);font-weight: bold;}.txerror {color: #c51f13;}.txerror a, .txerror .txvalue {color: #c51f13;}.txerror .copyable::before, .txerror .copied::before {filter: invert(86%) sepia(43%) saturate(732%) hue-rotate(367deg) brightness(84%);}.tx-amt .amt:hover, .tx-amt.amt:hover, .amt-out>.amt:hover {color: var(--bs-body-color);}.prim-amt {display: initial;}.sec-amt {display: none;}.csec-amt {display: none;}.base-amt {display: none;}.cbase-amt {display: none;}.tooltip {--bs-tooltip-opacity: 1;--bs-tooltip-max-width: 380px;--bs-tooltip-bg: #fff;--bs-tooltip-color: var(--bs-body-color);--bs-tooltip-padding-x: 1rem;--bs-tooltip-padding-y: 0.8rem;filter: drop-shadow(0px 24px 64px rgba(22, 27, 45, 0.25));}.l-tooltip {text-align: start;display: inline-block;}.l-tooltip .prim-amt, .l-tooltip .sec-amt, .l-tooltip .csec-amt, .l-tooltip .base-amt, .l-tooltip .cbase-amt {display: initial;float: right;}.l-tooltip .amt-time {padding-right: 3rem;float: left;}.amt-dec {font-size: 95%;}.unconfirmed {color: white;background-color: #c51e13;padding: 0.7rem 1.2rem;border-radius: 1.4rem;}.json {word-wrap: break-word;font-size: smaller;background: #002b31;border-radius: 8px;}#raw {padding: 1.5rem 2rem;color: #ffffff;letter-spacing: 0.02em;}#raw .string {color: #2bca87;}#raw .number, #raw .boolean {color: #efc941;}#raw .null {color: red;}@media (max-width: 768px) {body {font-size: 0.8rem;background: linear-gradient(to bottom, #f6f6f6 500px, #e5e5e5 0), #e5e5e5;}.container {padding-left: 2px;padding-right: 2px;}.accordion-body {padding: var(--bs-accordion-body-padding-y) 0;}.octicon {scale: 60% !important;margin-top: -2px;}.unconfirmed {padding: 0.1rem 0.8rem;}.btn {--bs-btn-font-size: 0.8rem;}}@media (max-width: 991px) {#header .container {min-height: 40px;}#header .dropdown-menu[data-bs-popper] {left: 0;right: initial;}.trezor-logo {top: 10px;}.octicon {scale: 80%;}.table.data-table>:not(caption)>*>* {padding: 0.8rem 0.4rem;}.tx-in .col-12, .tx-out .col-12, .tx-addr .col-12 {padding: 0.7rem 1.1rem;}.amt-out {padding: 0.7rem 0 0.7rem 1rem }}@media (min-width: 769px) {body {font-size: 0.9rem;}.btn {--bs-btn-font-size: 0.9rem;}}@media (min-width: 1200px) {.h1, h1 {font-size: 2.4rem;}body {font-size: 1rem;}.btn {--bs-btn-font-size: 1rem;}} \ No newline at end of file diff --git a/static/internal_templates/base.html b/static/internal_templates/base.html new file mode 100644 index 0000000000..86d6fd40ef --- /dev/null +++ b/static/internal_templates/base.html @@ -0,0 +1,28 @@ + + + + + + + + Blockbook {{.CoinLabel}} Internal Admin + + + + +
+
+ {{- template "specific" . -}} +
+
+ + + \ No newline at end of file diff --git a/static/internal_templates/block_internal_data_errors.html b/static/internal_templates/block_internal_data_errors.html new file mode 100644 index 0000000000..2301f94362 --- /dev/null +++ b/static/internal_templates/block_internal_data_errors.html @@ -0,0 +1,35 @@ +{{define "specific"}} +

Blocks with errors from fetching internal data

+
+
Count: {{len .InternalDataErrors}}
+
+ {{if .RefetchingInternalData}}Fetching...{{else}} +
+ +
+ {{end}} +
+ +
+ + + + + + + + + + + {{range $e := .InternalDataErrors}} + + + + + + + {{end}} + +
HeightHashRetriesError Message
{{formatUint32 $e.Height}}{{$e.Hash}}{{$e.Retries}}{{$e.ErrorMessage}}
+
+{{end}} \ No newline at end of file diff --git a/static/internal_templates/contract_info.html b/static/internal_templates/contract_info.html new file mode 100644 index 0000000000..57cbfece24 --- /dev/null +++ b/static/internal_templates/contract_info.html @@ -0,0 +1,39 @@ +{{define "specific"}} {{if eq .ChainType 1}} + +
+
+
+ +
+
+ +
+
+
+
+ To update contract, use POST request to /admin/contract-info/ endpoint. Example: +
+
+            curl -k -v  \
+            'https://<internaladdress>/admin/contract-info/' \
+            -H 'Content-Type: application/json' \
+            --data '[{ContractInfo},{ContractInfo},...]'        
+        
+
+
+{{else}} Not supported {{end}}{{end}} diff --git a/static/internal_templates/error.html b/static/internal_templates/error.html new file mode 100644 index 0000000000..0b75378bcf --- /dev/null +++ b/static/internal_templates/error.html @@ -0,0 +1,4 @@ +{{define "specific"}} +

Error

+

{{.Error.Text}}

+{{end}} \ No newline at end of file diff --git a/static/internal_templates/index.html b/static/internal_templates/index.html new file mode 100644 index 0000000000..7a94bce8f0 --- /dev/null +++ b/static/internal_templates/index.html @@ -0,0 +1,14 @@ +{{define "specific"}} + +{{if eq .ChainType 1}} + + +{{end}}{{end}} diff --git a/static/internal_templates/ws_limit_exceeding_ips.html b/static/internal_templates/ws_limit_exceeding_ips.html new file mode 100644 index 0000000000..081431fb1b --- /dev/null +++ b/static/internal_templates/ws_limit_exceeding_ips.html @@ -0,0 +1,29 @@ +{{define "specific"}} +

IP addresses disconnected for exceeding websocket limit

+
+
Distinct ip addresses that exceeded limit of {{.WsGetAccountInfoLimit}} requests since last reset: {{len .WsLimitExceedingIPs}}
+
+
+ +
+
+ +
+ + + + + + + + + {{range $d := .WsLimitExceedingIPs}} + + + + + {{end}} + +
IPCount
{{$d.IP}}{{$d.Count}}
+
+{{end}} \ No newline at end of file diff --git a/static/js/bootstrap.bundle.5.2.2.min.js b/static/js/bootstrap.bundle.5.2.2.min.js new file mode 100644 index 0000000000..1d138863be --- /dev/null +++ b/static/js/bootstrap.bundle.5.2.2.min.js @@ -0,0 +1,7 @@ +/*! + * Bootstrap v5.2.2 (https://getbootstrap.com/) + * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,(function(){"use strict";const t="transitionend",e=t=>{let e=t.getAttribute("data-bs-target");if(!e||"#"===e){let i=t.getAttribute("href");if(!i||!i.includes("#")&&!i.startsWith("."))return null;i.includes("#")&&!i.startsWith("#")&&(i=`#${i.split("#")[1]}`),e=i&&"#"!==i?i.trim():null}return e},i=t=>{const i=e(t);return i&&document.querySelector(i)?i:null},n=t=>{const i=e(t);return i?document.querySelector(i):null},s=e=>{e.dispatchEvent(new Event(t))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(t):null,a=t=>{if(!o(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},l=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),c=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?c(t.parentNode):null},h=()=>{},d=t=>{t.offsetHeight},u=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,f=[],p=()=>"rtl"===document.documentElement.dir,g=t=>{var e;e=()=>{const e=u();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(f.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of f)t()})),f.push(e)):e()},m=t=>{"function"==typeof t&&t()},_=(e,i,n=!0)=>{if(!n)return void m(e);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(i)+5;let r=!1;const a=({target:n})=>{n===i&&(r=!0,i.removeEventListener(t,a),m(e))};i.addEventListener(t,a),setTimeout((()=>{r||s(i)}),o)},b=(t,e,i,n)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!i&&n?t[s-1]:t[0]:(o+=i?1:-1,n&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},v=/[^.]*(?=\..*)\.|.*/,y=/\..*/,w=/::\d+$/,A={};let E=1;const T={mouseenter:"mouseover",mouseleave:"mouseout"},C=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function O(t,e){return e&&`${e}::${E++}`||t.uidEvent||E++}function x(t){const e=O(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function k(t,e,i=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===i))}function L(t,e,i){const n="string"==typeof e,s=n?i:e||i;let o=N(t);return C.has(o)||(o=t),[n,s,o]}function D(t,e,i,n,s){if("string"!=typeof e||!t)return;let[o,r,a]=L(e,i,n);if(e in T){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=x(t),c=l[a]||(l[a]={}),h=k(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=O(r,e.replace(v,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return j(s,{delegateTarget:r}),n.oneOff&&P.off(t,s.type,e,i),i.apply(r,[s])}}(t,i,r):function(t,e){return function i(n){return j(n,{delegateTarget:t}),i.oneOff&&P.off(t,n.type,e),e.apply(t,[n])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function S(t,e,i,n,s){const o=k(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function I(t,e,i,n){const s=e[i]||{};for(const o of Object.keys(s))if(o.includes(n)){const n=s[o];S(t,e,i,n.callable,n.delegationSelector)}}function N(t){return t=t.replace(y,""),T[t]||t}const P={on(t,e,i,n){D(t,e,i,n,!1)},one(t,e,i,n){D(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=L(e,i,n),a=r!==e,l=x(t),c=l[r]||{},h=e.startsWith(".");if(void 0===o){if(h)for(const i of Object.keys(l))I(t,l,i,e.slice(1));for(const i of Object.keys(c)){const n=i.replace(w,"");if(!a||e.includes(n)){const e=c[i];S(t,l,r,e.callable,e.delegationSelector)}}}else{if(!Object.keys(c).length)return;S(t,l,r,o,s?i:null)}},trigger(t,e,i){if("string"!=typeof e||!t)return null;const n=u();let s=null,o=!0,r=!0,a=!1;e!==N(e)&&n&&(s=n.Event(e,i),n(t).trigger(s),o=!s.isPropagationStopped(),r=!s.isImmediatePropagationStopped(),a=s.isDefaultPrevented());let l=new Event(e,{bubbles:o,cancelable:!0});return l=j(l,i),a&&l.preventDefault(),r&&t.dispatchEvent(l),l.defaultPrevented&&s&&s.preventDefault(),l}};function j(t,e){for(const[i,n]of Object.entries(e||{}))try{t[i]=n}catch(e){Object.defineProperty(t,i,{configurable:!0,get:()=>n})}return t}const M=new Map,H={set(t,e,i){M.has(t)||M.set(t,new Map);const n=M.get(t);n.has(e)||0===n.size?n.set(e,i):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(n.keys())[0]}.`)},get:(t,e)=>M.has(t)&&M.get(t).get(e)||null,remove(t,e){if(!M.has(t))return;const i=M.get(t);i.delete(e),0===i.size&&M.delete(t)}};function $(t){if("true"===t)return!0;if("false"===t)return!1;if(t===Number(t).toString())return Number(t);if(""===t||"null"===t)return null;if("string"!=typeof t)return t;try{return JSON.parse(decodeURIComponent(t))}catch(e){return t}}function W(t){return t.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`))}const B={setDataAttribute(t,e,i){t.setAttribute(`data-bs-${W(e)}`,i)},removeDataAttribute(t,e){t.removeAttribute(`data-bs-${W(e)}`)},getDataAttributes(t){if(!t)return{};const e={},i=Object.keys(t.dataset).filter((t=>t.startsWith("bs")&&!t.startsWith("bsConfig")));for(const n of i){let i=n.replace(/^bs/,"");i=i.charAt(0).toLowerCase()+i.slice(1,i.length),e[i]=$(t.dataset[n])}return e},getDataAttribute:(t,e)=>$(t.getAttribute(`data-bs-${W(e)}`))};class F{static get Default(){return{}}static get DefaultType(){return{}}static get NAME(){throw new Error('You have to implement the static method "NAME", for each component!')}_getConfig(t){return t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t}_mergeConfigObj(t,e){const i=o(e)?B.getDataAttribute(e,"config"):{};return{...this.constructor.Default,..."object"==typeof i?i:{},...o(e)?B.getDataAttributes(e):{},..."object"==typeof t?t:{}}}_typeCheckConfig(t,e=this.constructor.DefaultType){for(const n of Object.keys(e)){const s=e[n],r=t[n],a=o(r)?"element":null==(i=r)?`${i}`:Object.prototype.toString.call(i).match(/\s([a-z]+)/i)[1].toLowerCase();if(!new RegExp(s).test(a))throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${n}" provided type "${a}" but expected type "${s}".`)}var i}}class z extends F{constructor(t,e){super(),(t=r(t))&&(this._element=t,this._config=this._getConfig(e),H.set(this._element,this.constructor.DATA_KEY,this))}dispose(){H.remove(this._element,this.constructor.DATA_KEY),P.off(this._element,this.constructor.EVENT_KEY);for(const t of Object.getOwnPropertyNames(this))this[t]=null}_queueCallback(t,e,i=!0){_(t,e,i)}_getConfig(t){return t=this._mergeConfigObj(t,this._element),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}static getInstance(t){return H.get(r(t),this.DATA_KEY)}static getOrCreateInstance(t,e={}){return this.getInstance(t)||new this(t,"object"==typeof e?e:null)}static get VERSION(){return"5.2.2"}static get DATA_KEY(){return`bs.${this.NAME}`}static get EVENT_KEY(){return`.${this.DATA_KEY}`}static eventName(t){return`${t}${this.EVENT_KEY}`}}const q=(t,e="hide")=>{const i=`click.dismiss${t.EVENT_KEY}`,s=t.NAME;P.on(document,i,`[data-bs-dismiss="${s}"]`,(function(i){if(["A","AREA"].includes(this.tagName)&&i.preventDefault(),l(this))return;const o=n(this)||this.closest(`.${s}`);t.getOrCreateInstance(o)[e]()}))};class R extends z{static get NAME(){return"alert"}close(){if(P.trigger(this._element,"close.bs.alert").defaultPrevented)return;this._element.classList.remove("show");const t=this._element.classList.contains("fade");this._queueCallback((()=>this._destroyElement()),this._element,t)}_destroyElement(){this._element.remove(),P.trigger(this._element,"closed.bs.alert"),this.dispose()}static jQueryInterface(t){return this.each((function(){const e=R.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}q(R,"close"),g(R);const V='[data-bs-toggle="button"]';class K extends z{static get NAME(){return"button"}toggle(){this._element.setAttribute("aria-pressed",this._element.classList.toggle("active"))}static jQueryInterface(t){return this.each((function(){const e=K.getOrCreateInstance(this);"toggle"===t&&e[t]()}))}}P.on(document,"click.bs.button.data-api",V,(t=>{t.preventDefault();const e=t.target.closest(V);K.getOrCreateInstance(e).toggle()})),g(K);const Q={find:(t,e=document.documentElement)=>[].concat(...Element.prototype.querySelectorAll.call(e,t)),findOne:(t,e=document.documentElement)=>Element.prototype.querySelector.call(e,t),children:(t,e)=>[].concat(...t.children).filter((t=>t.matches(e))),parents(t,e){const i=[];let n=t.parentNode.closest(e);for(;n;)i.push(n),n=n.parentNode.closest(e);return i},prev(t,e){let i=t.previousElementSibling;for(;i;){if(i.matches(e))return[i];i=i.previousElementSibling}return[]},next(t,e){let i=t.nextElementSibling;for(;i;){if(i.matches(e))return[i];i=i.nextElementSibling}return[]},focusableChildren(t){const e=["a","button","input","textarea","select","details","[tabindex]",'[contenteditable="true"]'].map((t=>`${t}:not([tabindex^="-"])`)).join(",");return this.find(e,t).filter((t=>!l(t)&&a(t)))}},X={endCallback:null,leftCallback:null,rightCallback:null},Y={endCallback:"(function|null)",leftCallback:"(function|null)",rightCallback:"(function|null)"};class U extends F{constructor(t,e){super(),this._element=t,t&&U.isSupported()&&(this._config=this._getConfig(e),this._deltaX=0,this._supportPointerEvents=Boolean(window.PointerEvent),this._initEvents())}static get Default(){return X}static get DefaultType(){return Y}static get NAME(){return"swipe"}dispose(){P.off(this._element,".bs.swipe")}_start(t){this._supportPointerEvents?this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX):this._deltaX=t.touches[0].clientX}_end(t){this._eventIsPointerPenTouch(t)&&(this._deltaX=t.clientX-this._deltaX),this._handleSwipe(),m(this._config.endCallback)}_move(t){this._deltaX=t.touches&&t.touches.length>1?0:t.touches[0].clientX-this._deltaX}_handleSwipe(){const t=Math.abs(this._deltaX);if(t<=40)return;const e=t/this._deltaX;this._deltaX=0,e&&m(e>0?this._config.rightCallback:this._config.leftCallback)}_initEvents(){this._supportPointerEvents?(P.on(this._element,"pointerdown.bs.swipe",(t=>this._start(t))),P.on(this._element,"pointerup.bs.swipe",(t=>this._end(t))),this._element.classList.add("pointer-event")):(P.on(this._element,"touchstart.bs.swipe",(t=>this._start(t))),P.on(this._element,"touchmove.bs.swipe",(t=>this._move(t))),P.on(this._element,"touchend.bs.swipe",(t=>this._end(t))))}_eventIsPointerPenTouch(t){return this._supportPointerEvents&&("pen"===t.pointerType||"touch"===t.pointerType)}static isSupported(){return"ontouchstart"in document.documentElement||navigator.maxTouchPoints>0}}const G="next",J="prev",Z="left",tt="right",et="slid.bs.carousel",it="carousel",nt="active",st={ArrowLeft:tt,ArrowRight:Z},ot={interval:5e3,keyboard:!0,pause:"hover",ride:!1,touch:!0,wrap:!0},rt={interval:"(number|boolean)",keyboard:"boolean",pause:"(string|boolean)",ride:"(boolean|string)",touch:"boolean",wrap:"boolean"};class at extends z{constructor(t,e){super(t,e),this._interval=null,this._activeElement=null,this._isSliding=!1,this.touchTimeout=null,this._swipeHelper=null,this._indicatorsElement=Q.findOne(".carousel-indicators",this._element),this._addEventListeners(),this._config.ride===it&&this.cycle()}static get Default(){return ot}static get DefaultType(){return rt}static get NAME(){return"carousel"}next(){this._slide(G)}nextWhenVisible(){!document.hidden&&a(this._element)&&this.next()}prev(){this._slide(J)}pause(){this._isSliding&&s(this._element),this._clearInterval()}cycle(){this._clearInterval(),this._updateInterval(),this._interval=setInterval((()=>this.nextWhenVisible()),this._config.interval)}_maybeEnableCycle(){this._config.ride&&(this._isSliding?P.one(this._element,et,(()=>this.cycle())):this.cycle())}to(t){const e=this._getItems();if(t>e.length-1||t<0)return;if(this._isSliding)return void P.one(this._element,et,(()=>this.to(t)));const i=this._getItemIndex(this._getActive());if(i===t)return;const n=t>i?G:J;this._slide(n,e[t])}dispose(){this._swipeHelper&&this._swipeHelper.dispose(),super.dispose()}_configAfterMerge(t){return t.defaultInterval=t.interval,t}_addEventListeners(){this._config.keyboard&&P.on(this._element,"keydown.bs.carousel",(t=>this._keydown(t))),"hover"===this._config.pause&&(P.on(this._element,"mouseenter.bs.carousel",(()=>this.pause())),P.on(this._element,"mouseleave.bs.carousel",(()=>this._maybeEnableCycle()))),this._config.touch&&U.isSupported()&&this._addTouchEventListeners()}_addTouchEventListeners(){for(const t of Q.find(".carousel-item img",this._element))P.on(t,"dragstart.bs.carousel",(t=>t.preventDefault()));const t={leftCallback:()=>this._slide(this._directionToOrder(Z)),rightCallback:()=>this._slide(this._directionToOrder(tt)),endCallback:()=>{"hover"===this._config.pause&&(this.pause(),this.touchTimeout&&clearTimeout(this.touchTimeout),this.touchTimeout=setTimeout((()=>this._maybeEnableCycle()),500+this._config.interval))}};this._swipeHelper=new U(this._element,t)}_keydown(t){if(/input|textarea/i.test(t.target.tagName))return;const e=st[t.key];e&&(t.preventDefault(),this._slide(this._directionToOrder(e)))}_getItemIndex(t){return this._getItems().indexOf(t)}_setActiveIndicatorElement(t){if(!this._indicatorsElement)return;const e=Q.findOne(".active",this._indicatorsElement);e.classList.remove(nt),e.removeAttribute("aria-current");const i=Q.findOne(`[data-bs-slide-to="${t}"]`,this._indicatorsElement);i&&(i.classList.add(nt),i.setAttribute("aria-current","true"))}_updateInterval(){const t=this._activeElement||this._getActive();if(!t)return;const e=Number.parseInt(t.getAttribute("data-bs-interval"),10);this._config.interval=e||this._config.defaultInterval}_slide(t,e=null){if(this._isSliding)return;const i=this._getActive(),n=t===G,s=e||b(this._getItems(),i,n,this._config.wrap);if(s===i)return;const o=this._getItemIndex(s),r=e=>P.trigger(this._element,e,{relatedTarget:s,direction:this._orderToDirection(t),from:this._getItemIndex(i),to:o});if(r("slide.bs.carousel").defaultPrevented)return;if(!i||!s)return;const a=Boolean(this._interval);this.pause(),this._isSliding=!0,this._setActiveIndicatorElement(o),this._activeElement=s;const l=n?"carousel-item-start":"carousel-item-end",c=n?"carousel-item-next":"carousel-item-prev";s.classList.add(c),d(s),i.classList.add(l),s.classList.add(l),this._queueCallback((()=>{s.classList.remove(l,c),s.classList.add(nt),i.classList.remove(nt,c,l),this._isSliding=!1,r(et)}),i,this._isAnimated()),a&&this.cycle()}_isAnimated(){return this._element.classList.contains("slide")}_getActive(){return Q.findOne(".active.carousel-item",this._element)}_getItems(){return Q.find(".carousel-item",this._element)}_clearInterval(){this._interval&&(clearInterval(this._interval),this._interval=null)}_directionToOrder(t){return p()?t===Z?J:G:t===Z?G:J}_orderToDirection(t){return p()?t===J?Z:tt:t===J?tt:Z}static jQueryInterface(t){return this.each((function(){const e=at.getOrCreateInstance(this,t);if("number"!=typeof t){if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}else e.to(t)}))}}P.on(document,"click.bs.carousel.data-api","[data-bs-slide], [data-bs-slide-to]",(function(t){const e=n(this);if(!e||!e.classList.contains(it))return;t.preventDefault();const i=at.getOrCreateInstance(e),s=this.getAttribute("data-bs-slide-to");return s?(i.to(s),void i._maybeEnableCycle()):"next"===B.getDataAttribute(this,"slide")?(i.next(),void i._maybeEnableCycle()):(i.prev(),void i._maybeEnableCycle())})),P.on(window,"load.bs.carousel.data-api",(()=>{const t=Q.find('[data-bs-ride="carousel"]');for(const e of t)at.getOrCreateInstance(e)})),g(at);const lt="show",ct="collapse",ht="collapsing",dt='[data-bs-toggle="collapse"]',ut={parent:null,toggle:!0},ft={parent:"(null|element)",toggle:"boolean"};class pt extends z{constructor(t,e){super(t,e),this._isTransitioning=!1,this._triggerArray=[];const n=Q.find(dt);for(const t of n){const e=i(t),n=Q.find(e).filter((t=>t===this._element));null!==e&&n.length&&this._triggerArray.push(t)}this._initializeChildren(),this._config.parent||this._addAriaAndCollapsedClass(this._triggerArray,this._isShown()),this._config.toggle&&this.toggle()}static get Default(){return ut}static get DefaultType(){return ft}static get NAME(){return"collapse"}toggle(){this._isShown()?this.hide():this.show()}show(){if(this._isTransitioning||this._isShown())return;let t=[];if(this._config.parent&&(t=this._getFirstLevelChildren(".collapse.show, .collapse.collapsing").filter((t=>t!==this._element)).map((t=>pt.getOrCreateInstance(t,{toggle:!1})))),t.length&&t[0]._isTransitioning)return;if(P.trigger(this._element,"show.bs.collapse").defaultPrevented)return;for(const e of t)e.hide();const e=this._getDimension();this._element.classList.remove(ct),this._element.classList.add(ht),this._element.style[e]=0,this._addAriaAndCollapsedClass(this._triggerArray,!0),this._isTransitioning=!0;const i=`scroll${e[0].toUpperCase()+e.slice(1)}`;this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct,lt),this._element.style[e]="",P.trigger(this._element,"shown.bs.collapse")}),this._element,!0),this._element.style[e]=`${this._element[i]}px`}hide(){if(this._isTransitioning||!this._isShown())return;if(P.trigger(this._element,"hide.bs.collapse").defaultPrevented)return;const t=this._getDimension();this._element.style[t]=`${this._element.getBoundingClientRect()[t]}px`,d(this._element),this._element.classList.add(ht),this._element.classList.remove(ct,lt);for(const t of this._triggerArray){const e=n(t);e&&!this._isShown(e)&&this._addAriaAndCollapsedClass([t],!1)}this._isTransitioning=!0,this._element.style[t]="",this._queueCallback((()=>{this._isTransitioning=!1,this._element.classList.remove(ht),this._element.classList.add(ct),P.trigger(this._element,"hidden.bs.collapse")}),this._element,!0)}_isShown(t=this._element){return t.classList.contains(lt)}_configAfterMerge(t){return t.toggle=Boolean(t.toggle),t.parent=r(t.parent),t}_getDimension(){return this._element.classList.contains("collapse-horizontal")?"width":"height"}_initializeChildren(){if(!this._config.parent)return;const t=this._getFirstLevelChildren(dt);for(const e of t){const t=n(e);t&&this._addAriaAndCollapsedClass([e],this._isShown(t))}}_getFirstLevelChildren(t){const e=Q.find(":scope .collapse .collapse",this._config.parent);return Q.find(t,this._config.parent).filter((t=>!e.includes(t)))}_addAriaAndCollapsedClass(t,e){if(t.length)for(const i of t)i.classList.toggle("collapsed",!e),i.setAttribute("aria-expanded",e)}static jQueryInterface(t){const e={};return"string"==typeof t&&/show|hide/.test(t)&&(e.toggle=!1),this.each((function(){const i=pt.getOrCreateInstance(this,e);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t]()}}))}}P.on(document,"click.bs.collapse.data-api",dt,(function(t){("A"===t.target.tagName||t.delegateTarget&&"A"===t.delegateTarget.tagName)&&t.preventDefault();const e=i(this),n=Q.find(e);for(const t of n)pt.getOrCreateInstance(t,{toggle:!1}).toggle()})),g(pt);var gt="top",mt="bottom",_t="right",bt="left",vt="auto",yt=[gt,mt,_t,bt],wt="start",At="end",Et="clippingParents",Tt="viewport",Ct="popper",Ot="reference",xt=yt.reduce((function(t,e){return t.concat([e+"-"+wt,e+"-"+At])}),[]),kt=[].concat(yt,[vt]).reduce((function(t,e){return t.concat([e,e+"-"+wt,e+"-"+At])}),[]),Lt="beforeRead",Dt="read",St="afterRead",It="beforeMain",Nt="main",Pt="afterMain",jt="beforeWrite",Mt="write",Ht="afterWrite",$t=[Lt,Dt,St,It,Nt,Pt,jt,Mt,Ht];function Wt(t){return t?(t.nodeName||"").toLowerCase():null}function Bt(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ft(t){return t instanceof Bt(t).Element||t instanceof Element}function zt(t){return t instanceof Bt(t).HTMLElement||t instanceof HTMLElement}function qt(t){return"undefined"!=typeof ShadowRoot&&(t instanceof Bt(t).ShadowRoot||t instanceof ShadowRoot)}const Rt={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var i=e.styles[t]||{},n=e.attributes[t]||{},s=e.elements[t];zt(s)&&Wt(s)&&(Object.assign(s.style,i),Object.keys(n).forEach((function(t){var e=n[t];!1===e?s.removeAttribute(t):s.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow),function(){Object.keys(e.elements).forEach((function(t){var n=e.elements[t],s=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:i[t]).reduce((function(t,e){return t[e]="",t}),{});zt(n)&&Wt(n)&&(Object.assign(n.style,o),Object.keys(s).forEach((function(t){n.removeAttribute(t)})))}))}},requires:["computeStyles"]};function Vt(t){return t.split("-")[0]}var Kt=Math.max,Qt=Math.min,Xt=Math.round;function Yt(){var t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Ut(){return!/^((?!chrome|android).)*safari/i.test(Yt())}function Gt(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=t.getBoundingClientRect(),s=1,o=1;e&&zt(t)&&(s=t.offsetWidth>0&&Xt(n.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Xt(n.height)/t.offsetHeight||1);var r=(Ft(t)?Bt(t):window).visualViewport,a=!Ut()&&i,l=(n.left+(a&&r?r.offsetLeft:0))/s,c=(n.top+(a&&r?r.offsetTop:0))/o,h=n.width/s,d=n.height/o;return{width:h,height:d,top:c,right:l+h,bottom:c+d,left:l,x:l,y:c}}function Jt(t){var e=Gt(t),i=t.offsetWidth,n=t.offsetHeight;return Math.abs(e.width-i)<=1&&(i=e.width),Math.abs(e.height-n)<=1&&(n=e.height),{x:t.offsetLeft,y:t.offsetTop,width:i,height:n}}function Zt(t,e){var i=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(i&&qt(i)){var n=e;do{if(n&&t.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function te(t){return Bt(t).getComputedStyle(t)}function ee(t){return["table","td","th"].indexOf(Wt(t))>=0}function ie(t){return((Ft(t)?t.ownerDocument:t.document)||window.document).documentElement}function ne(t){return"html"===Wt(t)?t:t.assignedSlot||t.parentNode||(qt(t)?t.host:null)||ie(t)}function se(t){return zt(t)&&"fixed"!==te(t).position?t.offsetParent:null}function oe(t){for(var e=Bt(t),i=se(t);i&&ee(i)&&"static"===te(i).position;)i=se(i);return i&&("html"===Wt(i)||"body"===Wt(i)&&"static"===te(i).position)?e:i||function(t){var e=/firefox/i.test(Yt());if(/Trident/i.test(Yt())&&zt(t)&&"fixed"===te(t).position)return null;var i=ne(t);for(qt(i)&&(i=i.host);zt(i)&&["html","body"].indexOf(Wt(i))<0;){var n=te(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||e&&"filter"===n.willChange||e&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(t)||e}function re(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function ae(t,e,i){return Kt(t,Qt(e,i))}function le(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function ce(t,e){return e.reduce((function(e,i){return e[i]=t,e}),{})}const he={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,i=t.state,n=t.name,s=t.options,o=i.elements.arrow,r=i.modifiersData.popperOffsets,a=Vt(i.placement),l=re(a),c=[bt,_t].indexOf(a)>=0?"height":"width";if(o&&r){var h=function(t,e){return le("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:ce(t,yt))}(s.padding,i),d=Jt(o),u="y"===l?gt:bt,f="y"===l?mt:_t,p=i.rects.reference[c]+i.rects.reference[l]-r[l]-i.rects.popper[c],g=r[l]-i.rects.reference[l],m=oe(o),_=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=p/2-g/2,v=h[u],y=_-d[c]-h[f],w=_/2-d[c]/2+b,A=ae(v,w,y),E=l;i.modifiersData[n]=((e={})[E]=A,e.centerOffset=A-w,e)}},effect:function(t){var e=t.state,i=t.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=e.elements.popper.querySelector(n)))&&Zt(e.elements.popper,n)&&(e.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function de(t){return t.split("-")[1]}var ue={top:"auto",right:"auto",bottom:"auto",left:"auto"};function fe(t){var e,i=t.popper,n=t.popperRect,s=t.placement,o=t.variation,r=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,h=t.roundOffsets,d=t.isFixed,u=r.x,f=void 0===u?0:u,p=r.y,g=void 0===p?0:p,m="function"==typeof h?h({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var _=r.hasOwnProperty("x"),b=r.hasOwnProperty("y"),v=bt,y=gt,w=window;if(c){var A=oe(i),E="clientHeight",T="clientWidth";A===Bt(i)&&"static"!==te(A=ie(i)).position&&"absolute"===a&&(E="scrollHeight",T="scrollWidth"),(s===gt||(s===bt||s===_t)&&o===At)&&(y=mt,g-=(d&&A===w&&w.visualViewport?w.visualViewport.height:A[E])-n.height,g*=l?1:-1),s!==bt&&(s!==gt&&s!==mt||o!==At)||(v=_t,f-=(d&&A===w&&w.visualViewport?w.visualViewport.width:A[T])-n.width,f*=l?1:-1)}var C,O=Object.assign({position:a},c&&ue),x=!0===h?function(t){var e=t.x,i=t.y,n=window.devicePixelRatio||1;return{x:Xt(e*n)/n||0,y:Xt(i*n)/n||0}}({x:f,y:g}):{x:f,y:g};return f=x.x,g=x.y,l?Object.assign({},O,((C={})[y]=b?"0":"",C[v]=_?"0":"",C.transform=(w.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",C)):Object.assign({},O,((e={})[y]=b?g+"px":"",e[v]=_?f+"px":"",e.transform="",e))}const pe={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,i=t.options,n=i.gpuAcceleration,s=void 0===n||n,o=i.adaptive,r=void 0===o||o,a=i.roundOffsets,l=void 0===a||a,c={placement:Vt(e.placement),variation:de(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,fe(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:r,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,fe(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}};var ge={passive:!0};const me={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,i=t.instance,n=t.options,s=n.scroll,o=void 0===s||s,r=n.resize,a=void 0===r||r,l=Bt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&c.forEach((function(t){t.addEventListener("scroll",i.update,ge)})),a&&l.addEventListener("resize",i.update,ge),function(){o&&c.forEach((function(t){t.removeEventListener("scroll",i.update,ge)})),a&&l.removeEventListener("resize",i.update,ge)}},data:{}};var _e={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,(function(t){return _e[t]}))}var ve={start:"end",end:"start"};function ye(t){return t.replace(/start|end/g,(function(t){return ve[t]}))}function we(t){var e=Bt(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ae(t){return Gt(ie(t)).left+we(t).scrollLeft}function Ee(t){var e=te(t),i=e.overflow,n=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(i+s+n)}function Te(t){return["html","body","#document"].indexOf(Wt(t))>=0?t.ownerDocument.body:zt(t)&&Ee(t)?t:Te(ne(t))}function Ce(t,e){var i;void 0===e&&(e=[]);var n=Te(t),s=n===(null==(i=t.ownerDocument)?void 0:i.body),o=Bt(n),r=s?[o].concat(o.visualViewport||[],Ee(n)?n:[]):n,a=e.concat(r);return s?a:a.concat(Ce(ne(r)))}function Oe(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function xe(t,e,i){return e===Tt?Oe(function(t,e){var i=Bt(t),n=ie(t),s=i.visualViewport,o=n.clientWidth,r=n.clientHeight,a=0,l=0;if(s){o=s.width,r=s.height;var c=Ut();(c||!c&&"fixed"===e)&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:r,x:a+Ae(t),y:l}}(t,i)):Ft(e)?function(t,e){var i=Gt(t,!1,"fixed"===e);return i.top=i.top+t.clientTop,i.left=i.left+t.clientLeft,i.bottom=i.top+t.clientHeight,i.right=i.left+t.clientWidth,i.width=t.clientWidth,i.height=t.clientHeight,i.x=i.left,i.y=i.top,i}(e,i):Oe(function(t){var e,i=ie(t),n=we(t),s=null==(e=t.ownerDocument)?void 0:e.body,o=Kt(i.scrollWidth,i.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),r=Kt(i.scrollHeight,i.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-n.scrollLeft+Ae(t),l=-n.scrollTop;return"rtl"===te(s||i).direction&&(a+=Kt(i.clientWidth,s?s.clientWidth:0)-o),{width:o,height:r,x:a,y:l}}(ie(t)))}function ke(t){var e,i=t.reference,n=t.element,s=t.placement,o=s?Vt(s):null,r=s?de(s):null,a=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(o){case gt:e={x:a,y:i.y-n.height};break;case mt:e={x:a,y:i.y+i.height};break;case _t:e={x:i.x+i.width,y:l};break;case bt:e={x:i.x-n.width,y:l};break;default:e={x:i.x,y:i.y}}var c=o?re(o):null;if(null!=c){var h="y"===c?"height":"width";switch(r){case wt:e[c]=e[c]-(i[h]/2-n[h]/2);break;case At:e[c]=e[c]+(i[h]/2-n[h]/2)}}return e}function Le(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=void 0===n?t.placement:n,o=i.strategy,r=void 0===o?t.strategy:o,a=i.boundary,l=void 0===a?Et:a,c=i.rootBoundary,h=void 0===c?Tt:c,d=i.elementContext,u=void 0===d?Ct:d,f=i.altBoundary,p=void 0!==f&&f,g=i.padding,m=void 0===g?0:g,_=le("number"!=typeof m?m:ce(m,yt)),b=u===Ct?Ot:Ct,v=t.rects.popper,y=t.elements[p?b:u],w=function(t,e,i,n){var s="clippingParents"===e?function(t){var e=Ce(ne(t)),i=["absolute","fixed"].indexOf(te(t).position)>=0&&zt(t)?oe(t):t;return Ft(i)?e.filter((function(t){return Ft(t)&&Zt(t,i)&&"body"!==Wt(t)})):[]}(t):[].concat(e),o=[].concat(s,[i]),r=o[0],a=o.reduce((function(e,i){var s=xe(t,i,n);return e.top=Kt(s.top,e.top),e.right=Qt(s.right,e.right),e.bottom=Qt(s.bottom,e.bottom),e.left=Kt(s.left,e.left),e}),xe(t,r,n));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(Ft(y)?y:y.contextElement||ie(t.elements.popper),l,h,r),A=Gt(t.elements.reference),E=ke({reference:A,element:v,strategy:"absolute",placement:s}),T=Oe(Object.assign({},v,E)),C=u===Ct?T:A,O={top:w.top-C.top+_.top,bottom:C.bottom-w.bottom+_.bottom,left:w.left-C.left+_.left,right:C.right-w.right+_.right},x=t.modifiersData.offset;if(u===Ct&&x){var k=x[s];Object.keys(O).forEach((function(t){var e=[_t,mt].indexOf(t)>=0?1:-1,i=[gt,mt].indexOf(t)>=0?"y":"x";O[t]+=k[i]*e}))}return O}function De(t,e){void 0===e&&(e={});var i=e,n=i.placement,s=i.boundary,o=i.rootBoundary,r=i.padding,a=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?kt:l,h=de(n),d=h?a?xt:xt.filter((function(t){return de(t)===h})):yt,u=d.filter((function(t){return c.indexOf(t)>=0}));0===u.length&&(u=d);var f=u.reduce((function(e,i){return e[i]=Le(t,{placement:i,boundary:s,rootBoundary:o,padding:r})[Vt(i)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}const Se={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name;if(!e.modifiersData[n]._skip){for(var s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0===r||r,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,u=i.altBoundary,f=i.flipVariations,p=void 0===f||f,g=i.allowedAutoPlacements,m=e.options.placement,_=Vt(m),b=l||(_!==m&&p?function(t){if(Vt(t)===vt)return[];var e=be(t);return[ye(t),e,ye(e)]}(m):[be(m)]),v=[m].concat(b).reduce((function(t,i){return t.concat(Vt(i)===vt?De(e,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:g}):i)}),[]),y=e.rects.reference,w=e.rects.popper,A=new Map,E=!0,T=v[0],C=0;C=0,D=L?"width":"height",S=Le(e,{placement:O,boundary:h,rootBoundary:d,altBoundary:u,padding:c}),I=L?k?_t:bt:k?mt:gt;y[D]>w[D]&&(I=be(I));var N=be(I),P=[];if(o&&P.push(S[x]<=0),a&&P.push(S[I]<=0,S[N]<=0),P.every((function(t){return t}))){T=O,E=!1;break}A.set(O,P)}if(E)for(var j=function(t){var e=v.find((function(e){var i=A.get(e);if(i)return i.slice(0,t).every((function(t){return t}))}));if(e)return T=e,"break"},M=p?3:1;M>0&&"break"!==j(M);M--);e.placement!==T&&(e.modifiersData[n]._skip=!0,e.placement=T,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Ie(t,e,i){return void 0===i&&(i={x:0,y:0}),{top:t.top-e.height-i.y,right:t.right-e.width+i.x,bottom:t.bottom-e.height+i.y,left:t.left-e.width-i.x}}function Ne(t){return[gt,_t,mt,bt].some((function(e){return t[e]>=0}))}const Pe={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,i=t.name,n=e.rects.reference,s=e.rects.popper,o=e.modifiersData.preventOverflow,r=Le(e,{elementContext:"reference"}),a=Le(e,{altBoundary:!0}),l=Ie(r,n),c=Ie(a,s,o),h=Ne(l),d=Ne(c);e.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}},je={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.offset,o=void 0===s?[0,0]:s,r=kt.reduce((function(t,i){return t[i]=function(t,e,i){var n=Vt(t),s=[bt,gt].indexOf(n)>=0?-1:1,o="function"==typeof i?i(Object.assign({},e,{placement:t})):i,r=o[0],a=o[1];return r=r||0,a=(a||0)*s,[bt,_t].indexOf(n)>=0?{x:a,y:r}:{x:r,y:a}}(i,e.rects,o),t}),{}),a=r[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=r}},Me={name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,i=t.name;e.modifiersData[i]=ke({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},He={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,i=t.options,n=t.name,s=i.mainAxis,o=void 0===s||s,r=i.altAxis,a=void 0!==r&&r,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,u=i.tether,f=void 0===u||u,p=i.tetherOffset,g=void 0===p?0:p,m=Le(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),_=Vt(e.placement),b=de(e.placement),v=!b,y=re(_),w="x"===y?"y":"x",A=e.modifiersData.popperOffsets,E=e.rects.reference,T=e.rects.popper,C="function"==typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,O="number"==typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),x=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,k={x:0,y:0};if(A){if(o){var L,D="y"===y?gt:bt,S="y"===y?mt:_t,I="y"===y?"height":"width",N=A[y],P=N+m[D],j=N-m[S],M=f?-T[I]/2:0,H=b===wt?E[I]:T[I],$=b===wt?-T[I]:-E[I],W=e.elements.arrow,B=f&&W?Jt(W):{width:0,height:0},F=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},z=F[D],q=F[S],R=ae(0,E[I],B[I]),V=v?E[I]/2-M-R-z-O.mainAxis:H-R-z-O.mainAxis,K=v?-E[I]/2+M+R+q+O.mainAxis:$+R+q+O.mainAxis,Q=e.elements.arrow&&oe(e.elements.arrow),X=Q?"y"===y?Q.clientTop||0:Q.clientLeft||0:0,Y=null!=(L=null==x?void 0:x[y])?L:0,U=N+K-Y,G=ae(f?Qt(P,N+V-Y-X):P,N,f?Kt(j,U):j);A[y]=G,k[y]=G-N}if(a){var J,Z="x"===y?gt:bt,tt="x"===y?mt:_t,et=A[w],it="y"===w?"height":"width",nt=et+m[Z],st=et-m[tt],ot=-1!==[gt,bt].indexOf(_),rt=null!=(J=null==x?void 0:x[w])?J:0,at=ot?nt:et-E[it]-T[it]-rt+O.altAxis,lt=ot?et+E[it]+T[it]-rt-O.altAxis:st,ct=f&&ot?function(t,e,i){var n=ae(t,e,i);return n>i?i:n}(at,et,lt):ae(f?at:nt,et,f?lt:st);A[w]=ct,k[w]=ct-et}e.modifiersData[n]=k}},requiresIfExists:["offset"]};function $e(t,e,i){void 0===i&&(i=!1);var n,s,o=zt(e),r=zt(e)&&function(t){var e=t.getBoundingClientRect(),i=Xt(e.width)/t.offsetWidth||1,n=Xt(e.height)/t.offsetHeight||1;return 1!==i||1!==n}(e),a=ie(e),l=Gt(t,r,i),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(o||!o&&!i)&&(("body"!==Wt(e)||Ee(a))&&(c=(n=e)!==Bt(n)&&zt(n)?{scrollLeft:(s=n).scrollLeft,scrollTop:s.scrollTop}:we(n)),zt(e)?((h=Gt(e,!0)).x+=e.clientLeft,h.y+=e.clientTop):a&&(h.x=Ae(a))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function We(t){var e=new Map,i=new Set,n=[];function s(t){i.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!i.has(t)){var n=e.get(t);n&&s(n)}})),n.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){i.has(t.name)||s(t)})),n}var Be={placement:"bottom",modifiers:[],strategy:"absolute"};function Fe(){for(var t=arguments.length,e=new Array(t),i=0;iNumber.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_getPopperConfig(){const t={placement:this._getPlacement(),modifiers:[{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"offset",options:{offset:this._getOffset()}}]};return(this._inNavbar||"static"===this._config.display)&&(B.setDataAttribute(this._menu,"popper","static"),t.modifiers=[{name:"applyStyles",enabled:!1}]),{...t,..."function"==typeof this._config.popperConfig?this._config.popperConfig(t):this._config.popperConfig}}_selectMenuItem({key:t,target:e}){const i=Q.find(".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)",this._menu).filter((t=>a(t)));i.length&&b(i,e,t===Ye,!i.includes(e)).focus()}static jQueryInterface(t){return this.each((function(){const e=hi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}static clearMenus(t){if(2===t.button||"keyup"===t.type&&"Tab"!==t.key)return;const e=Q.find(ti);for(const i of e){const e=hi.getInstance(i);if(!e||!1===e._config.autoClose)continue;const n=t.composedPath(),s=n.includes(e._menu);if(n.includes(e._element)||"inside"===e._config.autoClose&&!s||"outside"===e._config.autoClose&&s)continue;if(e._menu.contains(t.target)&&("keyup"===t.type&&"Tab"===t.key||/input|select|option|textarea|form/i.test(t.target.tagName)))continue;const o={relatedTarget:e._element};"click"===t.type&&(o.clickEvent=t),e._completeHide(o)}}static dataApiKeydownHandler(t){const e=/input|textarea/i.test(t.target.tagName),i="Escape"===t.key,n=[Xe,Ye].includes(t.key);if(!n&&!i)return;if(e&&!i)return;t.preventDefault();const s=this.matches(Ze)?this:Q.prev(this,Ze)[0]||Q.next(this,Ze)[0]||Q.findOne(Ze,t.delegateTarget.parentNode),o=hi.getOrCreateInstance(s);if(n)return t.stopPropagation(),o.show(),void o._selectMenuItem(t);o._isShown()&&(t.stopPropagation(),o.hide(),s.focus())}}P.on(document,Ge,Ze,hi.dataApiKeydownHandler),P.on(document,Ge,ei,hi.dataApiKeydownHandler),P.on(document,Ue,hi.clearMenus),P.on(document,"keyup.bs.dropdown.data-api",hi.clearMenus),P.on(document,Ue,Ze,(function(t){t.preventDefault(),hi.getOrCreateInstance(this).toggle()})),g(hi);const di=".fixed-top, .fixed-bottom, .is-fixed, .sticky-top",ui=".sticky-top",fi="padding-right",pi="margin-right";class gi{constructor(){this._element=document.body}getWidth(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}hide(){const t=this.getWidth();this._disableOverFlow(),this._setElementAttributes(this._element,fi,(e=>e+t)),this._setElementAttributes(di,fi,(e=>e+t)),this._setElementAttributes(ui,pi,(e=>e-t))}reset(){this._resetElementAttributes(this._element,"overflow"),this._resetElementAttributes(this._element,fi),this._resetElementAttributes(di,fi),this._resetElementAttributes(ui,pi)}isOverflowing(){return this.getWidth()>0}_disableOverFlow(){this._saveInitialAttribute(this._element,"overflow"),this._element.style.overflow="hidden"}_setElementAttributes(t,e,i){const n=this.getWidth();this._applyManipulationCallback(t,(t=>{if(t!==this._element&&window.innerWidth>t.clientWidth+n)return;this._saveInitialAttribute(t,e);const s=window.getComputedStyle(t).getPropertyValue(e);t.style.setProperty(e,`${i(Number.parseFloat(s))}px`)}))}_saveInitialAttribute(t,e){const i=t.style.getPropertyValue(e);i&&B.setDataAttribute(t,e,i)}_resetElementAttributes(t,e){this._applyManipulationCallback(t,(t=>{const i=B.getDataAttribute(t,e);null!==i?(B.removeDataAttribute(t,e),t.style.setProperty(e,i)):t.style.removeProperty(e)}))}_applyManipulationCallback(t,e){if(o(t))e(t);else for(const i of Q.find(t,this._element))e(i)}}const mi="show",_i="mousedown.bs.backdrop",bi={className:"modal-backdrop",clickCallback:null,isAnimated:!1,isVisible:!0,rootElement:"body"},vi={className:"string",clickCallback:"(function|null)",isAnimated:"boolean",isVisible:"boolean",rootElement:"(element|string)"};class yi extends F{constructor(t){super(),this._config=this._getConfig(t),this._isAppended=!1,this._element=null}static get Default(){return bi}static get DefaultType(){return vi}static get NAME(){return"backdrop"}show(t){if(!this._config.isVisible)return void m(t);this._append();const e=this._getElement();this._config.isAnimated&&d(e),e.classList.add(mi),this._emulateAnimation((()=>{m(t)}))}hide(t){this._config.isVisible?(this._getElement().classList.remove(mi),this._emulateAnimation((()=>{this.dispose(),m(t)}))):m(t)}dispose(){this._isAppended&&(P.off(this._element,_i),this._element.remove(),this._isAppended=!1)}_getElement(){if(!this._element){const t=document.createElement("div");t.className=this._config.className,this._config.isAnimated&&t.classList.add("fade"),this._element=t}return this._element}_configAfterMerge(t){return t.rootElement=r(t.rootElement),t}_append(){if(this._isAppended)return;const t=this._getElement();this._config.rootElement.append(t),P.on(t,_i,(()=>{m(this._config.clickCallback)})),this._isAppended=!0}_emulateAnimation(t){_(t,this._getElement(),this._config.isAnimated)}}const wi=".bs.focustrap",Ai="backward",Ei={autofocus:!0,trapElement:null},Ti={autofocus:"boolean",trapElement:"element"};class Ci extends F{constructor(t){super(),this._config=this._getConfig(t),this._isActive=!1,this._lastTabNavDirection=null}static get Default(){return Ei}static get DefaultType(){return Ti}static get NAME(){return"focustrap"}activate(){this._isActive||(this._config.autofocus&&this._config.trapElement.focus(),P.off(document,wi),P.on(document,"focusin.bs.focustrap",(t=>this._handleFocusin(t))),P.on(document,"keydown.tab.bs.focustrap",(t=>this._handleKeydown(t))),this._isActive=!0)}deactivate(){this._isActive&&(this._isActive=!1,P.off(document,wi))}_handleFocusin(t){const{trapElement:e}=this._config;if(t.target===document||t.target===e||e.contains(t.target))return;const i=Q.focusableChildren(e);0===i.length?e.focus():this._lastTabNavDirection===Ai?i[i.length-1].focus():i[0].focus()}_handleKeydown(t){"Tab"===t.key&&(this._lastTabNavDirection=t.shiftKey?Ai:"forward")}}const Oi="hidden.bs.modal",xi="show.bs.modal",ki="modal-open",Li="show",Di="modal-static",Si={backdrop:!0,focus:!0,keyboard:!0},Ii={backdrop:"(boolean|string)",focus:"boolean",keyboard:"boolean"};class Ni extends z{constructor(t,e){super(t,e),this._dialog=Q.findOne(".modal-dialog",this._element),this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._isShown=!1,this._isTransitioning=!1,this._scrollBar=new gi,this._addEventListeners()}static get Default(){return Si}static get DefaultType(){return Ii}static get NAME(){return"modal"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||this._isTransitioning||P.trigger(this._element,xi,{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._isTransitioning=!0,this._scrollBar.hide(),document.body.classList.add(ki),this._adjustDialog(),this._backdrop.show((()=>this._showElement(t))))}hide(){this._isShown&&!this._isTransitioning&&(P.trigger(this._element,"hide.bs.modal").defaultPrevented||(this._isShown=!1,this._isTransitioning=!0,this._focustrap.deactivate(),this._element.classList.remove(Li),this._queueCallback((()=>this._hideModal()),this._element,this._isAnimated())))}dispose(){for(const t of[window,this._dialog])P.off(t,".bs.modal");this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}handleUpdate(){this._adjustDialog()}_initializeBackDrop(){return new yi({isVisible:Boolean(this._config.backdrop),isAnimated:this._isAnimated()})}_initializeFocusTrap(){return new Ci({trapElement:this._element})}_showElement(t){document.body.contains(this._element)||document.body.append(this._element),this._element.style.display="block",this._element.removeAttribute("aria-hidden"),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.scrollTop=0;const e=Q.findOne(".modal-body",this._dialog);e&&(e.scrollTop=0),d(this._element),this._element.classList.add(Li),this._queueCallback((()=>{this._config.focus&&this._focustrap.activate(),this._isTransitioning=!1,P.trigger(this._element,"shown.bs.modal",{relatedTarget:t})}),this._dialog,this._isAnimated())}_addEventListeners(){P.on(this._element,"keydown.dismiss.bs.modal",(t=>{if("Escape"===t.key)return this._config.keyboard?(t.preventDefault(),void this.hide()):void this._triggerBackdropTransition()})),P.on(window,"resize.bs.modal",(()=>{this._isShown&&!this._isTransitioning&&this._adjustDialog()})),P.on(this._element,"mousedown.dismiss.bs.modal",(t=>{P.one(this._element,"click.dismiss.bs.modal",(e=>{this._element===t.target&&this._element===e.target&&("static"!==this._config.backdrop?this._config.backdrop&&this.hide():this._triggerBackdropTransition())}))}))}_hideModal(){this._element.style.display="none",this._element.setAttribute("aria-hidden",!0),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._isTransitioning=!1,this._backdrop.hide((()=>{document.body.classList.remove(ki),this._resetAdjustments(),this._scrollBar.reset(),P.trigger(this._element,Oi)}))}_isAnimated(){return this._element.classList.contains("fade")}_triggerBackdropTransition(){if(P.trigger(this._element,"hidePrevented.bs.modal").defaultPrevented)return;const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._element.style.overflowY;"hidden"===e||this._element.classList.contains(Di)||(t||(this._element.style.overflowY="hidden"),this._element.classList.add(Di),this._queueCallback((()=>{this._element.classList.remove(Di),this._queueCallback((()=>{this._element.style.overflowY=e}),this._dialog)}),this._dialog),this._element.focus())}_adjustDialog(){const t=this._element.scrollHeight>document.documentElement.clientHeight,e=this._scrollBar.getWidth(),i=e>0;if(i&&!t){const t=p()?"paddingLeft":"paddingRight";this._element.style[t]=`${e}px`}if(!i&&t){const t=p()?"paddingRight":"paddingLeft";this._element.style[t]=`${e}px`}}_resetAdjustments(){this._element.style.paddingLeft="",this._element.style.paddingRight=""}static jQueryInterface(t,e){return this.each((function(){const i=Ni.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===i[t])throw new TypeError(`No method named "${t}"`);i[t](e)}}))}}P.on(document,"click.bs.modal.data-api",'[data-bs-toggle="modal"]',(function(t){const e=n(this);["A","AREA"].includes(this.tagName)&&t.preventDefault(),P.one(e,xi,(t=>{t.defaultPrevented||P.one(e,Oi,(()=>{a(this)&&this.focus()}))}));const i=Q.findOne(".modal.show");i&&Ni.getInstance(i).hide(),Ni.getOrCreateInstance(e).toggle(this)})),q(Ni),g(Ni);const Pi="show",ji="showing",Mi="hiding",Hi=".offcanvas.show",$i="hidePrevented.bs.offcanvas",Wi="hidden.bs.offcanvas",Bi={backdrop:!0,keyboard:!0,scroll:!1},Fi={backdrop:"(boolean|string)",keyboard:"boolean",scroll:"boolean"};class zi extends z{constructor(t,e){super(t,e),this._isShown=!1,this._backdrop=this._initializeBackDrop(),this._focustrap=this._initializeFocusTrap(),this._addEventListeners()}static get Default(){return Bi}static get DefaultType(){return Fi}static get NAME(){return"offcanvas"}toggle(t){return this._isShown?this.hide():this.show(t)}show(t){this._isShown||P.trigger(this._element,"show.bs.offcanvas",{relatedTarget:t}).defaultPrevented||(this._isShown=!0,this._backdrop.show(),this._config.scroll||(new gi).hide(),this._element.setAttribute("aria-modal",!0),this._element.setAttribute("role","dialog"),this._element.classList.add(ji),this._queueCallback((()=>{this._config.scroll&&!this._config.backdrop||this._focustrap.activate(),this._element.classList.add(Pi),this._element.classList.remove(ji),P.trigger(this._element,"shown.bs.offcanvas",{relatedTarget:t})}),this._element,!0))}hide(){this._isShown&&(P.trigger(this._element,"hide.bs.offcanvas").defaultPrevented||(this._focustrap.deactivate(),this._element.blur(),this._isShown=!1,this._element.classList.add(Mi),this._backdrop.hide(),this._queueCallback((()=>{this._element.classList.remove(Pi,Mi),this._element.removeAttribute("aria-modal"),this._element.removeAttribute("role"),this._config.scroll||(new gi).reset(),P.trigger(this._element,Wi)}),this._element,!0)))}dispose(){this._backdrop.dispose(),this._focustrap.deactivate(),super.dispose()}_initializeBackDrop(){const t=Boolean(this._config.backdrop);return new yi({className:"offcanvas-backdrop",isVisible:t,isAnimated:!0,rootElement:this._element.parentNode,clickCallback:t?()=>{"static"!==this._config.backdrop?this.hide():P.trigger(this._element,$i)}:null})}_initializeFocusTrap(){return new Ci({trapElement:this._element})}_addEventListeners(){P.on(this._element,"keydown.dismiss.bs.offcanvas",(t=>{"Escape"===t.key&&(this._config.keyboard?this.hide():P.trigger(this._element,$i))}))}static jQueryInterface(t){return this.each((function(){const e=zi.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}P.on(document,"click.bs.offcanvas.data-api",'[data-bs-toggle="offcanvas"]',(function(t){const e=n(this);if(["A","AREA"].includes(this.tagName)&&t.preventDefault(),l(this))return;P.one(e,Wi,(()=>{a(this)&&this.focus()}));const i=Q.findOne(Hi);i&&i!==e&&zi.getInstance(i).hide(),zi.getOrCreateInstance(e).toggle(this)})),P.on(window,"load.bs.offcanvas.data-api",(()=>{for(const t of Q.find(Hi))zi.getOrCreateInstance(t).show()})),P.on(window,"resize.bs.offcanvas",(()=>{for(const t of Q.find("[aria-modal][class*=show][class*=offcanvas-]"))"fixed"!==getComputedStyle(t).position&&zi.getOrCreateInstance(t).hide()})),q(zi),g(zi);const qi=new Set(["background","cite","href","itemtype","longdesc","poster","src","xlink:href"]),Ri=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i,Vi=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i,Ki=(t,e)=>{const i=t.nodeName.toLowerCase();return e.includes(i)?!qi.has(i)||Boolean(Ri.test(t.nodeValue)||Vi.test(t.nodeValue)):e.filter((t=>t instanceof RegExp)).some((t=>t.test(i)))},Qi={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","srcset","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},Xi={allowList:Qi,content:{},extraClass:"",html:!1,sanitize:!0,sanitizeFn:null,template:"
"},Yi={allowList:"object",content:"object",extraClass:"(string|function)",html:"boolean",sanitize:"boolean",sanitizeFn:"(null|function)",template:"string"},Ui={entry:"(string|element|function|null)",selector:"(string|element)"};class Gi extends F{constructor(t){super(),this._config=this._getConfig(t)}static get Default(){return Xi}static get DefaultType(){return Yi}static get NAME(){return"TemplateFactory"}getContent(){return Object.values(this._config.content).map((t=>this._resolvePossibleFunction(t))).filter(Boolean)}hasContent(){return this.getContent().length>0}changeContent(t){return this._checkContent(t),this._config.content={...this._config.content,...t},this}toHtml(){const t=document.createElement("div");t.innerHTML=this._maybeSanitize(this._config.template);for(const[e,i]of Object.entries(this._config.content))this._setContent(t,i,e);const e=t.children[0],i=this._resolvePossibleFunction(this._config.extraClass);return i&&e.classList.add(...i.split(" ")),e}_typeCheckConfig(t){super._typeCheckConfig(t),this._checkContent(t.content)}_checkContent(t){for(const[e,i]of Object.entries(t))super._typeCheckConfig({selector:e,entry:i},Ui)}_setContent(t,e,i){const n=Q.findOne(i,t);n&&((e=this._resolvePossibleFunction(e))?o(e)?this._putElementInTemplate(r(e),n):this._config.html?n.innerHTML=this._maybeSanitize(e):n.textContent=e:n.remove())}_maybeSanitize(t){return this._config.sanitize?function(t,e,i){if(!t.length)return t;if(i&&"function"==typeof i)return i(t);const n=(new window.DOMParser).parseFromString(t,"text/html"),s=[].concat(...n.body.querySelectorAll("*"));for(const t of s){const i=t.nodeName.toLowerCase();if(!Object.keys(e).includes(i)){t.remove();continue}const n=[].concat(...t.attributes),s=[].concat(e["*"]||[],e[i]||[]);for(const e of n)Ki(e,s)||t.removeAttribute(e.nodeName)}return n.body.innerHTML}(t,this._config.allowList,this._config.sanitizeFn):t}_resolvePossibleFunction(t){return"function"==typeof t?t(this):t}_putElementInTemplate(t,e){if(this._config.html)return e.innerHTML="",void e.append(t);e.textContent=t.textContent}}const Ji=new Set(["sanitize","allowList","sanitizeFn"]),Zi="fade",tn="show",en=".modal",nn="hide.bs.modal",sn="hover",on="focus",rn={AUTO:"auto",TOP:"top",RIGHT:p()?"left":"right",BOTTOM:"bottom",LEFT:p()?"right":"left"},an={allowList:Qi,animation:!0,boundary:"clippingParents",container:!1,customClass:"",delay:0,fallbackPlacements:["top","right","bottom","left"],html:!1,offset:[0,0],placement:"top",popperConfig:null,sanitize:!0,sanitizeFn:null,selector:!1,template:'',title:"",trigger:"hover focus"},ln={allowList:"object",animation:"boolean",boundary:"(string|element)",container:"(string|element|boolean)",customClass:"(string|function)",delay:"(number|object)",fallbackPlacements:"array",html:"boolean",offset:"(array|string|function)",placement:"(string|function)",popperConfig:"(null|object|function)",sanitize:"boolean",sanitizeFn:"(null|function)",selector:"(string|boolean)",template:"string",title:"(string|element|function)",trigger:"string"};class cn extends z{constructor(t,e){if(void 0===Ke)throw new TypeError("Bootstrap's tooltips require Popper (https://popper.js.org)");super(t,e),this._isEnabled=!0,this._timeout=0,this._isHovered=null,this._activeTrigger={},this._popper=null,this._templateFactory=null,this._newContent=null,this.tip=null,this._setListeners(),this._config.selector||this._fixTitle()}static get Default(){return an}static get DefaultType(){return ln}static get NAME(){return"tooltip"}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}toggleEnabled(){this._isEnabled=!this._isEnabled}toggle(){this._isEnabled&&(this._activeTrigger.click=!this._activeTrigger.click,this._isShown()?this._leave():this._enter())}dispose(){clearTimeout(this._timeout),P.off(this._element.closest(en),nn,this._hideModalHandler),this.tip&&this.tip.remove(),this._element.getAttribute("data-bs-original-title")&&this._element.setAttribute("title",this._element.getAttribute("data-bs-original-title")),this._disposePopper(),super.dispose()}show(){if("none"===this._element.style.display)throw new Error("Please use show on visible elements");if(!this._isWithContent()||!this._isEnabled)return;const t=P.trigger(this._element,this.constructor.eventName("show")),e=(c(this._element)||this._element.ownerDocument.documentElement).contains(this._element);if(t.defaultPrevented||!e)return;this.tip&&(this.tip.remove(),this.tip=null);const i=this._getTipElement();this._element.setAttribute("aria-describedby",i.getAttribute("id"));const{container:n}=this._config;if(this._element.ownerDocument.documentElement.contains(this.tip)||(n.append(i),P.trigger(this._element,this.constructor.eventName("inserted"))),this._popper?this._popper.update():this._popper=this._createPopper(i),i.classList.add(tn),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.on(t,"mouseover",h);this._queueCallback((()=>{P.trigger(this._element,this.constructor.eventName("shown")),!1===this._isHovered&&this._leave(),this._isHovered=!1}),this.tip,this._isAnimated())}hide(){if(!this._isShown())return;if(P.trigger(this._element,this.constructor.eventName("hide")).defaultPrevented)return;const t=this._getTipElement();if(t.classList.remove(tn),"ontouchstart"in document.documentElement)for(const t of[].concat(...document.body.children))P.off(t,"mouseover",h);this._activeTrigger.click=!1,this._activeTrigger.focus=!1,this._activeTrigger.hover=!1,this._isHovered=null,this._queueCallback((()=>{this._isWithActiveTrigger()||(this._isHovered||t.remove(),this._element.removeAttribute("aria-describedby"),P.trigger(this._element,this.constructor.eventName("hidden")),this._disposePopper())}),this.tip,this._isAnimated())}update(){this._popper&&this._popper.update()}_isWithContent(){return Boolean(this._getTitle())}_getTipElement(){return this.tip||(this.tip=this._createTipElement(this._newContent||this._getContentForTemplate())),this.tip}_createTipElement(t){const e=this._getTemplateFactory(t).toHtml();if(!e)return null;e.classList.remove(Zi,tn),e.classList.add(`bs-${this.constructor.NAME}-auto`);const i=(t=>{do{t+=Math.floor(1e6*Math.random())}while(document.getElementById(t));return t})(this.constructor.NAME).toString();return e.setAttribute("id",i),this._isAnimated()&&e.classList.add(Zi),e}setContent(t){this._newContent=t,this._isShown()&&(this._disposePopper(),this.show())}_getTemplateFactory(t){return this._templateFactory?this._templateFactory.changeContent(t):this._templateFactory=new Gi({...this._config,content:t,extraClass:this._resolvePossibleFunction(this._config.customClass)}),this._templateFactory}_getContentForTemplate(){return{".tooltip-inner":this._getTitle()}}_getTitle(){return this._resolvePossibleFunction(this._config.title)||this._element.getAttribute("data-bs-original-title")}_initializeOnDelegatedTarget(t){return this.constructor.getOrCreateInstance(t.delegateTarget,this._getDelegateConfig())}_isAnimated(){return this._config.animation||this.tip&&this.tip.classList.contains(Zi)}_isShown(){return this.tip&&this.tip.classList.contains(tn)}_createPopper(t){const e="function"==typeof this._config.placement?this._config.placement.call(this,t,this._element):this._config.placement,i=rn[e.toUpperCase()];return Ve(this._element,t,this._getPopperConfig(i))}_getOffset(){const{offset:t}=this._config;return"string"==typeof t?t.split(",").map((t=>Number.parseInt(t,10))):"function"==typeof t?e=>t(e,this._element):t}_resolvePossibleFunction(t){return"function"==typeof t?t.call(this._element):t}_getPopperConfig(t){const e={placement:t,modifiers:[{name:"flip",options:{fallbackPlacements:this._config.fallbackPlacements}},{name:"offset",options:{offset:this._getOffset()}},{name:"preventOverflow",options:{boundary:this._config.boundary}},{name:"arrow",options:{element:`.${this.constructor.NAME}-arrow`}},{name:"preSetPlacement",enabled:!0,phase:"beforeMain",fn:t=>{this._getTipElement().setAttribute("data-popper-placement",t.state.placement)}}]};return{...e,..."function"==typeof this._config.popperConfig?this._config.popperConfig(e):this._config.popperConfig}}_setListeners(){const t=this._config.trigger.split(" ");for(const e of t)if("click"===e)P.on(this._element,this.constructor.eventName("click"),this._config.selector,(t=>{this._initializeOnDelegatedTarget(t).toggle()}));else if("manual"!==e){const t=e===sn?this.constructor.eventName("mouseenter"):this.constructor.eventName("focusin"),i=e===sn?this.constructor.eventName("mouseleave"):this.constructor.eventName("focusout");P.on(this._element,t,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusin"===t.type?on:sn]=!0,e._enter()})),P.on(this._element,i,this._config.selector,(t=>{const e=this._initializeOnDelegatedTarget(t);e._activeTrigger["focusout"===t.type?on:sn]=e._element.contains(t.relatedTarget),e._leave()}))}this._hideModalHandler=()=>{this._element&&this.hide()},P.on(this._element.closest(en),nn,this._hideModalHandler)}_fixTitle(){const t=this._element.getAttribute("title");t&&(this._element.getAttribute("aria-label")||this._element.textContent.trim()||this._element.setAttribute("aria-label",t),this._element.setAttribute("data-bs-original-title",t),this._element.removeAttribute("title"))}_enter(){this._isShown()||this._isHovered?this._isHovered=!0:(this._isHovered=!0,this._setTimeout((()=>{this._isHovered&&this.show()}),this._config.delay.show))}_leave(){this._isWithActiveTrigger()||(this._isHovered=!1,this._setTimeout((()=>{this._isHovered||this.hide()}),this._config.delay.hide))}_setTimeout(t,e){clearTimeout(this._timeout),this._timeout=setTimeout(t,e)}_isWithActiveTrigger(){return Object.values(this._activeTrigger).includes(!0)}_getConfig(t){const e=B.getDataAttributes(this._element);for(const t of Object.keys(e))Ji.has(t)&&delete e[t];return t={...e,..."object"==typeof t&&t?t:{}},t=this._mergeConfigObj(t),t=this._configAfterMerge(t),this._typeCheckConfig(t),t}_configAfterMerge(t){return t.container=!1===t.container?document.body:r(t.container),"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),"number"==typeof t.title&&(t.title=t.title.toString()),"number"==typeof t.content&&(t.content=t.content.toString()),t}_getDelegateConfig(){const t={};for(const e in this._config)this.constructor.Default[e]!==this._config[e]&&(t[e]=this._config[e]);return t.selector=!1,t.trigger="manual",t}_disposePopper(){this._popper&&(this._popper.destroy(),this._popper=null)}static jQueryInterface(t){return this.each((function(){const e=cn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(cn);const hn={...cn.Default,content:"",offset:[0,8],placement:"right",template:'',trigger:"click"},dn={...cn.DefaultType,content:"(null|string|element|function)"};class un extends cn{static get Default(){return hn}static get DefaultType(){return dn}static get NAME(){return"popover"}_isWithContent(){return this._getTitle()||this._getContent()}_getContentForTemplate(){return{".popover-header":this._getTitle(),".popover-body":this._getContent()}}_getContent(){return this._resolvePossibleFunction(this._config.content)}static jQueryInterface(t){return this.each((function(){const e=un.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t]()}}))}}g(un);const fn="click.bs.scrollspy",pn="active",gn="[href]",mn={offset:null,rootMargin:"0px 0px -25%",smoothScroll:!1,target:null,threshold:[.1,.5,1]},_n={offset:"(number|null)",rootMargin:"string",smoothScroll:"boolean",target:"element",threshold:"array"};class bn extends z{constructor(t,e){super(t,e),this._targetLinks=new Map,this._observableSections=new Map,this._rootElement="visible"===getComputedStyle(this._element).overflowY?null:this._element,this._activeTarget=null,this._observer=null,this._previousScrollData={visibleEntryTop:0,parentScrollTop:0},this.refresh()}static get Default(){return mn}static get DefaultType(){return _n}static get NAME(){return"scrollspy"}refresh(){this._initializeTargetsAndObservables(),this._maybeEnableSmoothScroll(),this._observer?this._observer.disconnect():this._observer=this._getNewObserver();for(const t of this._observableSections.values())this._observer.observe(t)}dispose(){this._observer.disconnect(),super.dispose()}_configAfterMerge(t){return t.target=r(t.target)||document.body,t.rootMargin=t.offset?`${t.offset}px 0px -30%`:t.rootMargin,"string"==typeof t.threshold&&(t.threshold=t.threshold.split(",").map((t=>Number.parseFloat(t)))),t}_maybeEnableSmoothScroll(){this._config.smoothScroll&&(P.off(this._config.target,fn),P.on(this._config.target,fn,gn,(t=>{const e=this._observableSections.get(t.target.hash);if(e){t.preventDefault();const i=this._rootElement||window,n=e.offsetTop-this._element.offsetTop;if(i.scrollTo)return void i.scrollTo({top:n,behavior:"smooth"});i.scrollTop=n}})))}_getNewObserver(){const t={root:this._rootElement,threshold:this._config.threshold,rootMargin:this._config.rootMargin};return new IntersectionObserver((t=>this._observerCallback(t)),t)}_observerCallback(t){const e=t=>this._targetLinks.get(`#${t.target.id}`),i=t=>{this._previousScrollData.visibleEntryTop=t.target.offsetTop,this._process(e(t))},n=(this._rootElement||document.documentElement).scrollTop,s=n>=this._previousScrollData.parentScrollTop;this._previousScrollData.parentScrollTop=n;for(const o of t){if(!o.isIntersecting){this._activeTarget=null,this._clearActiveClass(e(o));continue}const t=o.target.offsetTop>=this._previousScrollData.visibleEntryTop;if(s&&t){if(i(o),!n)return}else s||t||i(o)}}_initializeTargetsAndObservables(){this._targetLinks=new Map,this._observableSections=new Map;const t=Q.find(gn,this._config.target);for(const e of t){if(!e.hash||l(e))continue;const t=Q.findOne(e.hash,this._element);a(t)&&(this._targetLinks.set(e.hash,e),this._observableSections.set(e.hash,t))}}_process(t){this._activeTarget!==t&&(this._clearActiveClass(this._config.target),this._activeTarget=t,t.classList.add(pn),this._activateParents(t),P.trigger(this._element,"activate.bs.scrollspy",{relatedTarget:t}))}_activateParents(t){if(t.classList.contains("dropdown-item"))Q.findOne(".dropdown-toggle",t.closest(".dropdown")).classList.add(pn);else for(const e of Q.parents(t,".nav, .list-group"))for(const t of Q.prev(e,".nav-link, .nav-item > .nav-link, .list-group-item"))t.classList.add(pn)}_clearActiveClass(t){t.classList.remove(pn);const e=Q.find("[href].active",t);for(const t of e)t.classList.remove(pn)}static jQueryInterface(t){return this.each((function(){const e=bn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}P.on(window,"load.bs.scrollspy.data-api",(()=>{for(const t of Q.find('[data-bs-spy="scroll"]'))bn.getOrCreateInstance(t)})),g(bn);const vn="ArrowLeft",yn="ArrowRight",wn="ArrowUp",An="ArrowDown",En="active",Tn="fade",Cn="show",On='[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]',xn=`.nav-link:not(.dropdown-toggle), .list-group-item:not(.dropdown-toggle), [role="tab"]:not(.dropdown-toggle), ${On}`;class kn extends z{constructor(t){super(t),this._parent=this._element.closest('.list-group, .nav, [role="tablist"]'),this._parent&&(this._setInitialAttributes(this._parent,this._getChildren()),P.on(this._element,"keydown.bs.tab",(t=>this._keydown(t))))}static get NAME(){return"tab"}show(){const t=this._element;if(this._elemIsActive(t))return;const e=this._getActiveElem(),i=e?P.trigger(e,"hide.bs.tab",{relatedTarget:t}):null;P.trigger(t,"show.bs.tab",{relatedTarget:e}).defaultPrevented||i&&i.defaultPrevented||(this._deactivate(e,t),this._activate(t,e))}_activate(t,e){t&&(t.classList.add(En),this._activate(n(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.removeAttribute("tabindex"),t.setAttribute("aria-selected",!0),this._toggleDropDown(t,!0),P.trigger(t,"shown.bs.tab",{relatedTarget:e})):t.classList.add(Cn)}),t,t.classList.contains(Tn)))}_deactivate(t,e){t&&(t.classList.remove(En),t.blur(),this._deactivate(n(t)),this._queueCallback((()=>{"tab"===t.getAttribute("role")?(t.setAttribute("aria-selected",!1),t.setAttribute("tabindex","-1"),this._toggleDropDown(t,!1),P.trigger(t,"hidden.bs.tab",{relatedTarget:e})):t.classList.remove(Cn)}),t,t.classList.contains(Tn)))}_keydown(t){if(![vn,yn,wn,An].includes(t.key))return;t.stopPropagation(),t.preventDefault();const e=[yn,An].includes(t.key),i=b(this._getChildren().filter((t=>!l(t))),t.target,e,!0);i&&(i.focus({preventScroll:!0}),kn.getOrCreateInstance(i).show())}_getChildren(){return Q.find(xn,this._parent)}_getActiveElem(){return this._getChildren().find((t=>this._elemIsActive(t)))||null}_setInitialAttributes(t,e){this._setAttributeIfNotExists(t,"role","tablist");for(const t of e)this._setInitialAttributesOnChild(t)}_setInitialAttributesOnChild(t){t=this._getInnerElement(t);const e=this._elemIsActive(t),i=this._getOuterElement(t);t.setAttribute("aria-selected",e),i!==t&&this._setAttributeIfNotExists(i,"role","presentation"),e||t.setAttribute("tabindex","-1"),this._setAttributeIfNotExists(t,"role","tab"),this._setInitialAttributesOnTargetPanel(t)}_setInitialAttributesOnTargetPanel(t){const e=n(t);e&&(this._setAttributeIfNotExists(e,"role","tabpanel"),t.id&&this._setAttributeIfNotExists(e,"aria-labelledby",`#${t.id}`))}_toggleDropDown(t,e){const i=this._getOuterElement(t);if(!i.classList.contains("dropdown"))return;const n=(t,n)=>{const s=Q.findOne(t,i);s&&s.classList.toggle(n,e)};n(".dropdown-toggle",En),n(".dropdown-menu",Cn),i.setAttribute("aria-expanded",e)}_setAttributeIfNotExists(t,e,i){t.hasAttribute(e)||t.setAttribute(e,i)}_elemIsActive(t){return t.classList.contains(En)}_getInnerElement(t){return t.matches(xn)?t:Q.findOne(xn,t)}_getOuterElement(t){return t.closest(".nav-item, .list-group-item")||t}static jQueryInterface(t){return this.each((function(){const e=kn.getOrCreateInstance(this);if("string"==typeof t){if(void 0===e[t]||t.startsWith("_")||"constructor"===t)throw new TypeError(`No method named "${t}"`);e[t]()}}))}}P.on(document,"click.bs.tab",On,(function(t){["A","AREA"].includes(this.tagName)&&t.preventDefault(),l(this)||kn.getOrCreateInstance(this).show()})),P.on(window,"load.bs.tab",(()=>{for(const t of Q.find('.active[data-bs-toggle="tab"], .active[data-bs-toggle="pill"], .active[data-bs-toggle="list"]'))kn.getOrCreateInstance(t)})),g(kn);const Ln="hide",Dn="show",Sn="showing",In={animation:"boolean",autohide:"boolean",delay:"number"},Nn={animation:!0,autohide:!0,delay:5e3};class Pn extends z{constructor(t,e){super(t,e),this._timeout=null,this._hasMouseInteraction=!1,this._hasKeyboardInteraction=!1,this._setListeners()}static get Default(){return Nn}static get DefaultType(){return In}static get NAME(){return"toast"}show(){P.trigger(this._element,"show.bs.toast").defaultPrevented||(this._clearTimeout(),this._config.animation&&this._element.classList.add("fade"),this._element.classList.remove(Ln),d(this._element),this._element.classList.add(Dn,Sn),this._queueCallback((()=>{this._element.classList.remove(Sn),P.trigger(this._element,"shown.bs.toast"),this._maybeScheduleHide()}),this._element,this._config.animation))}hide(){this.isShown()&&(P.trigger(this._element,"hide.bs.toast").defaultPrevented||(this._element.classList.add(Sn),this._queueCallback((()=>{this._element.classList.add(Ln),this._element.classList.remove(Sn,Dn),P.trigger(this._element,"hidden.bs.toast")}),this._element,this._config.animation)))}dispose(){this._clearTimeout(),this.isShown()&&this._element.classList.remove(Dn),super.dispose()}isShown(){return this._element.classList.contains(Dn)}_maybeScheduleHide(){this._config.autohide&&(this._hasMouseInteraction||this._hasKeyboardInteraction||(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay)))}_onInteraction(t,e){switch(t.type){case"mouseover":case"mouseout":this._hasMouseInteraction=e;break;case"focusin":case"focusout":this._hasKeyboardInteraction=e}if(e)return void this._clearTimeout();const i=t.relatedTarget;this._element===i||this._element.contains(i)||this._maybeScheduleHide()}_setListeners(){P.on(this._element,"mouseover.bs.toast",(t=>this._onInteraction(t,!0))),P.on(this._element,"mouseout.bs.toast",(t=>this._onInteraction(t,!1))),P.on(this._element,"focusin.bs.toast",(t=>this._onInteraction(t,!0))),P.on(this._element,"focusout.bs.toast",(t=>this._onInteraction(t,!1)))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){const e=Pn.getOrCreateInstance(this,t);if("string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}return q(Pn),g(Pn),{Alert:R,Button:K,Carousel:at,Collapse:pt,Dropdown:hi,Modal:Ni,Offcanvas:zi,Popover:un,ScrollSpy:bn,Tab:kn,Toast:Pn,Tooltip:cn}})); +//# sourceMappingURL=bootstrap.bundle.min.js.map \ No newline at end of file diff --git a/static/js/main.js b/static/js/main.js new file mode 100644 index 0000000000..b1d31408f8 --- /dev/null +++ b/static/js/main.js @@ -0,0 +1,218 @@ +function syntaxHighlight(json) { + json = JSON.stringify(json, undefined, 2); + json = json + .replace(/&/g, "&") + .replace(//g, ">"); + if (json.length > 1000000) { + return `${json}`; + } + return json.replace( + /("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, + (match) => { + let cls = "number"; + if (/^"/.test(match)) { + if (/:$/.test(match)) { + cls = "key"; + } else { + cls = "string"; + } + } else if (/true|false/.test(match)) { + cls = "boolean"; + } else if (/null/.test(match)) { + cls = "null"; + } + return `${match}`; + } + ); +} + +function getCoinCookie() { + if(hasSecondary) return document.cookie + .split("; ") + .find((row) => row.startsWith("secondary_coin=")) + ?.split("="); +} + +function changeCSSStyle(selector, cssProp, cssVal) { + const mIndex = 1; + const cssRules = document.all ? "rules" : "cssRules"; + for ( + i = 0, len = document.styleSheets[mIndex][cssRules].length; + i < len; + i++ + ) { + if (document.styleSheets[mIndex][cssRules][i].selectorText === selector) { + document.styleSheets[mIndex][cssRules][i].style[cssProp] = cssVal; + return; + } + } +} + +function amountTooltip() { + const prim = this.querySelector(".prim-amt"); + const sec = this.querySelector(".sec-amt"); + const csec = this.querySelector(".csec-amt"); + const base = this.querySelector(".base-amt"); + const cbase = this.querySelector(".cbase-amt"); + let s = `${prim.outerHTML}
`; + if (base) { + let t = base.getAttribute("tm"); + if (!t) { + t = "now"; + } + s += `${t}${base.outerHTML}
`; + } + if (cbase) { + s += `now${cbase.outerHTML}
`; + } + if (sec) { + let t = sec.getAttribute("tm"); + if (!t) { + t = "now"; + } + s += `${t}${sec.outerHTML}
`; + } + if (csec) { + s += `now${csec.outerHTML}
`; + } + return `${s}`; +} + +function addressAliasTooltip() { + const type = this.getAttribute("alias-type"); + const address = this.getAttribute("cc"); + return `${type}
${address}
`; +} + +function handleTxPage(rawData, txId) { + const rawOutput = document.getElementById('raw'); + const rawButton = document.getElementById('raw-button'); + const rawHexButton = document.getElementById('raw-hex-button'); + + rawOutput.innerHTML = syntaxHighlight(rawData); + + let isShowingHexData = false; + + const memoizedResponses = {}; + + async function getTransactionHex(txId) { + // BTC-like coins have a 'hex' field in the raw data + if (rawData['hex']) { + return rawData['hex']; + } + if (memoizedResponses[txId]) { + return memoizedResponses[txId]; + } + const fetchedData = await fetchTransactionHex(txId); + memoizedResponses[txId] = fetchedData; + return fetchedData; + } + + async function fetchTransactionHex(txId) { + const response = await fetch(`/api/rawtx/${txId}`); + if (!response.ok) { + throw new Error(`Error fetching data: ${response.status}`); + } + const txHex = await response.text(); + const hexWithoutQuotes = txHex.replace(/"/g, ''); + return hexWithoutQuotes; + } + + function updateButtonStyles() { + if (isShowingHexData) { + rawButton.classList.add('active'); + rawButton.style.fontWeight = 'normal'; + rawHexButton.classList.remove('active'); + rawHexButton.style.fontWeight = 'bold'; + } else { + rawButton.classList.remove('active'); + rawButton.style.fontWeight = 'bold'; + rawHexButton.classList.add('active'); + rawHexButton.style.fontWeight = 'normal'; + } + } + + updateButtonStyles(); + + rawHexButton.addEventListener('click', async () => { + if (!isShowingHexData) { + try { + const txHex = await getTransactionHex(txId); + rawOutput.textContent = txHex; + } catch (error) { + console.error('Error fetching raw transaction hex:', error); + rawOutput.textContent = `Error fetching raw transaction hex: ${error.message}`; + } + isShowingHexData = true; + updateButtonStyles(); + } + }); + + rawButton.addEventListener('click', () => { + if (isShowingHexData) { + rawOutput.innerHTML = syntaxHighlight(rawData); + isShowingHexData = false; + updateButtonStyles(); + } + }); +} + +window.addEventListener("DOMContentLoaded", () => { + const a = getCoinCookie(); + if (a?.length === 3) { + if (a[2] === "true") { + changeCSSStyle(".prim-amt", "display", "none"); + changeCSSStyle(".sec-amt", "display", "initial"); + } + document + .querySelectorAll(".amt") + .forEach( + (e) => new bootstrap.Tooltip(e, { title: amountTooltip, html: true }) + ); + } + + document + .querySelectorAll("[alias-type]") + .forEach( + (e) => + new bootstrap.Tooltip(e, { title: addressAliasTooltip, html: true }) + ); + + document + .querySelectorAll("[tt]") + .forEach((e) => new bootstrap.Tooltip(e, { title: e.getAttribute("tt") })); + + document.querySelectorAll("#header .bb-group>.btn-check").forEach((e) => + e.addEventListener("click", (e) => { + const a = getCoinCookie(); + const sc = e.target.id === "secondary-coin"; + if (a?.length === 3 && (a[2] === "true") !== sc) { + document.cookie = `${a[0]}=${a[1]}=${sc}; Path=/`; + changeCSSStyle(".prim-amt", "display", sc ? "none" : "initial"); + changeCSSStyle(".sec-amt", "display", sc ? "initial" : "none"); + } + }) + ); + + document.querySelectorAll(".copyable").forEach((e) => + e.addEventListener("click", (e) => { + if (e.clientX < e.target.getBoundingClientRect().x) { + let t = e.target.getAttribute("cc"); + if (!t) t = e.target.innerText; + const textToCopy = t.trim(); + navigator.clipboard.writeText(textToCopy); + e.target.className = e.target.className.replace("copyable", "copied"); + setTimeout( + () => + (e.target.className = e.target.className.replace( + "copied", + "copyable" + )), + 1000 + ); + e.preventDefault(); + } + }) + ); +}); diff --git a/static/js/main.min.4.js b/static/js/main.min.4.js new file mode 100644 index 0000000000..5e237185ab --- /dev/null +++ b/static/js/main.min.4.js @@ -0,0 +1 @@ +function syntaxHighlight(t){return(t=(t=JSON.stringify(t,void 0,2)).replace(/&/g,"&").replace(//g,">")).length>1e6?`${t}`:t.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(t=>{let e="number";return/^"/.test(t)?e=/:$/.test(t)?"key":"string":/true|false/.test(t)?e="boolean":/null/.test(t)&&(e="null"),`${t}`}))}function getCoinCookie(){if(hasSecondary)return document.cookie.split("; ").find((t=>t.startsWith("secondary_coin=")))?.split("=")}function changeCSSStyle(t,e,n){const a=document.all?"rules":"cssRules";for(i=0,len=document.styleSheets[1][a].length;i`;if(a){let t=a.getAttribute("tm");t||(t="now"),i+=`${t}${a.outerHTML}
`}if(o&&(i+=`now${o.outerHTML}
`),e){let t=e.getAttribute("tm");t||(t="now"),i+=`${t}${e.outerHTML}
`}return n&&(i+=`now${n.outerHTML}
`),`${i}`}function addressAliasTooltip(){return`${this.getAttribute("alias-type")}
${this.getAttribute("cc")}
`}function handleTxPage(t,e){const n=document.getElementById("raw"),a=document.getElementById("raw-button"),o=document.getElementById("raw-hex-button");n.innerHTML=syntaxHighlight(t);let i=!1;const r={};async function s(e){if(t.hex)return t.hex;if(r[e])return r[e];const n=await async function(t){const e=await fetch(`/api/rawtx/${t}`);if(!e.ok)throw new Error(`Error fetching data: ${e.status}`);const n=await e.text();return n.replace(/"/g,"")}(e);return r[e]=n,n}function l(){i?(a.classList.add("active"),a.style.fontWeight="normal",o.classList.remove("active"),o.style.fontWeight="bold"):(a.classList.remove("active"),a.style.fontWeight="bold",o.classList.add("active"),o.style.fontWeight="normal")}l(),o.addEventListener("click",(async()=>{if(!i){try{const t=await s(e);n.textContent=t}catch(t){console.error("Error fetching raw transaction hex:",t),n.textContent=`Error fetching raw transaction hex: ${t.message}`}i=!0,l()}})),a.addEventListener("click",(()=>{i&&(n.innerHTML=syntaxHighlight(t),i=!1,l())}))}window.addEventListener("DOMContentLoaded",(()=>{const t=getCoinCookie();3===t?.length&&("true"===t[2]&&(changeCSSStyle(".prim-amt","display","none"),changeCSSStyle(".sec-amt","display","initial")),document.querySelectorAll(".amt").forEach((t=>new bootstrap.Tooltip(t,{title:amountTooltip,html:!0})))),document.querySelectorAll("[alias-type]").forEach((t=>new bootstrap.Tooltip(t,{title:addressAliasTooltip,html:!0}))),document.querySelectorAll("[tt]").forEach((t=>new bootstrap.Tooltip(t,{title:t.getAttribute("tt")}))),document.querySelectorAll("#header .bb-group>.btn-check").forEach((t=>t.addEventListener("click",(t=>{const e=getCoinCookie(),n="secondary-coin"===t.target.id;3===e?.length&&"true"===e[2]!==n&&(document.cookie=`${e[0]}=${e[1]}=${n}; Path=/`,changeCSSStyle(".prim-amt","display",n?"none":"initial"),changeCSSStyle(".sec-amt","display",n?"initial":"none"))})))),document.querySelectorAll(".copyable").forEach((t=>t.addEventListener("click",(t=>{if(t.clientXt.target.className=t.target.className.replace("copied","copyable")),1e3),t.preventDefault()}}))))})); \ No newline at end of file diff --git a/static/templates/address.html b/static/templates/address.html index 208a2b4483..d2bc9772e6 100644 --- a/static/templates/address.html +++ b/static/templates/address.html @@ -1,120 +1,316 @@ -{{define "specific"}}{{$cs := .CoinShortcut}}{{$addr := .Address}}{{$data := .}} -

{{if $addr.Erc20Contract}}Contract {{$addr.Erc20Contract.Name}} ({{$addr.Erc20Contract.Symbol}}){{else}}Address{{end}} {{formatAmount $addr.BalanceSat}} {{$cs}} -

-
- {{$addr.AddrStr}} -
-

Confirmed

-
-
- - - {{- if eq .ChainType 1 -}} - - - - - - - - - - - - - - - - - {{- if $addr.Tokens -}} - - - - - {{- end -}} - - {{- else -}} - - - - - - - - - - - - - - - - - {{- end -}} - -
Balance{{formatAmount $addr.BalanceSat}} {{$cs}}
Transactions{{$addr.Txs}}
Non-contract Transactions{{$addr.NonTokenTxs}}
Nonce{{$addr.Nonce}}
ERC20 Tokens - - - - - - - - {{- range $t := $addr.Tokens -}} - - - - - - {{- end -}} - -
ContractTokensTransfers
{{if $t.Contract}}{{$t.Name}}{{else}}{{$t.Name}}{{end}}{{formatAmountWithDecimals $t.BalanceSat $t.Decimals}} {{$t.Symbol}}{{$t.Transfers}}
-
Total Received{{formatAmount $addr.TotalReceivedSat}} {{$cs}}
Total Sent{{formatAmount $addr.TotalSentSat}} {{$cs}}
Final Balance{{formatAmount $addr.BalanceSat}} {{$cs}}
No. Transactions{{$addr.Txs}}
+{{define "specific"}}{{$addr := .Address}}{{$data := .}} +
+
+

{{if $addr.ContractInfo}}Contract {{$addr.ContractInfo.Name}}{{if $addr.ContractInfo.Symbol}} ({{$addr.ContractInfo.Symbol}}){{end}}{{else}}Address {{addressAlias $addr.AddrStr $data}}{{end}}

+
{{$addr.AddrStr}}
+

+
{{formattedAmountSpan $addr.BalanceSat 0 $data.CoinShortcut $data "copyable"}}
+ {{if $addr.SecondaryValue}}
{{summaryValuesSpan 0 $addr.SecondaryValue $data}}
{{end}} +

+ {{if gt $addr.TotalSecondaryValue $addr.SecondaryValue}} +
Including Tokens
+

+
{{summaryValuesSpan $addr.TotalBaseValue 0 $data}}
+
{{summaryValuesSpan 0 $addr.TotalSecondaryValue $data}}
+

+ {{end}}
-
-
+
+
-{{- if $addr.UnconfirmedTxs -}} -

Unconfirmed

-
- - - - - - - - - - - -
Unconfirmed Balance{{formatAmount $addr.UnconfirmedBalanceSat}} {{$cs}}
No. Transactions{{$addr.UnconfirmedTxs}}
+ + + + + + + {{if eq .ChainType 1}} + + + + + + + + + + + + + + + + + + + + + {{if $addr.ContractInfo}} + {{if $addr.ContractInfo.Standard}} + + + + + {{end}} + {{if $addr.ContractInfo.CreatedInBlock}} + + + + + {{end}} + {{if $addr.ContractInfo.DestructedInBlock}} + + + + + {{end}} + {{end}} + {{else}} + + + + + + + + + + + + + + + + + {{end}} + +
Confirmed
Balance{{amountSpan $addr.BalanceSat $data "copyable"}}
Transactions{{formatInt $addr.Txs}}
Non-contract Transactions{{formatInt $addr.NonTokenTxs}}
Internal Transactions{{formatInt $addr.InternalTxs}}
Nonce{{$addr.Nonce}}
Standard{{$addr.ContractInfo.Standard}}
Created in Block{{formatUint32 $addr.ContractInfo.CreatedInBlock}}
Destructed in Block{{formatUint32 $addr.ContractInfo.DestructedInBlock}}
Total Received{{amountSpan $addr.TotalReceivedSat $data "copyable"}}
Total Sent{{amountSpan $addr.TotalSentSat $data "copyable"}}
Final Balance{{amountSpan $addr.BalanceSat $data "copyable"}}
No. Transactions{{formatInt $addr.Txs}}
+{{if $addr.UnconfirmedTxs}} + + + + + + + + + + + + + + + +
Unconfirmed
Unconfirmed Balance{{amountSpan $addr.UnconfirmedBalanceSat $data "copyable"}}
No. Transactions{{formatInt $addr.UnconfirmedTxs}}
+{{end}} +{{if eq .ChainType 1}} +{{if tokenCount $addr.Tokens .FungibleTokenName}} +
+
+
+ +
+
+
+ + + + + + + + + {{range $t := $addr.Tokens}} + {{if eq $t.Standard $.FungibleTokenName}} + + + + + + + {{end}} + {{end}} + +
ContractQuantityValueTransfers#
{{if $t.Name}}{{$t.Name}}{{else}}{{$t.Contract}}{{end}}{{formattedAmountSpan $t.BalanceSat $t.Decimals $t.Symbol $data "copyable"}}{{summaryValuesSpan $t.BaseValue $t.SecondaryValue $data}}{{formatInt $t.Transfers}}
+
+
+
-{{- end}}{{if or $addr.Transactions $addr.Filter -}} -
-

Transactions

- -
- +{{end}} +{{if tokenCount $addr.Tokens .NonFungibleTokenName}} +
+
+
+ +
+
+
+ + + + + + + + {{range $t := $addr.Tokens}} + {{if eq $t.Standard $.NonFungibleTokenName}} + + + + + + {{end}} + {{end}} + +
ContractTokensTransfers#
{{if $t.Name}}{{$t.Name}}{{else}}{{$t.Contract}}{{end}} + {{range $i, $iv := $t.Ids}}{{if $i}}, {{end}}{{formatAmountWithDecimals $iv 0}}{{end}} + {{$t.Transfers}}
+
+
+
+
+{{end}} +{{if tokenCount $addr.Tokens .MultiTokenName}} +
+
+
+ +
+
+
+ + + + + + + + {{range $t := $addr.Tokens}} + {{if eq $t.Standard $.MultiTokenName}} + + + + + + {{end}} + {{end}} + +
ContractTokensTransfers#
{{if $t.Name}}{{$t.Name}}{{else}}{{$t.Contract}}{{end}} + {{range $i, $iv := $t.MultiTokenValues}}{{if $i}}, {{end}}{{formattedAmountSpan $iv.Value 0 $t.Symbol $data ""}} of ID {{$iv.Id}}{{end}} + {{formatInt $t.Transfers}}
+
+
+
+
+{{end}} +{{if $addr.StakingPools }} +
+
+
+ +
+
+
+ {{range $sp := $addr.StakingPools}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$sp.Name}} {{$sp.Contract}}
Pending Balance{{amountSpan $sp.PendingBalance $data "copyable"}}
Pending Deposited Balance{{amountSpan $sp.PendingDepositedBalance $data "copyable"}}
Deposited Balance{{amountSpan $sp.DepositedBalance $data "copyable"}}
Withdrawal Total Amount{{amountSpan $sp.WithdrawTotalAmount $data "copyable"}}
Claimable Amount{{amountSpan $sp.ClaimableAmount $data "copyable"}}
Restaked Reward{{amountSpan $sp.RestakedReward $data "copyable"}}
Autocompound Balance{{amountSpan $sp.AutocompoundBalance $data "copyable"}}
+ {{end}} +
+
+
+
+{{end}} +{{end}} +{{if or $addr.Transactions $addr.Filter}} +
+

Transactions

+
+ +
+
+ {{template "paging" $data}}
-
- {{- range $tx := $addr.Transactions}}{{$data := setTxToTemplateData $data $tx}}{{template "txdetail" $data}}{{end -}} +
+ {{range $tx := $addr.Transactions}}{{$data := setTxToTemplateData $data $tx}}{{template "txdetail" $data}}{{end}}
- +{{template "paging" $data }} {{end}}{{end}} \ No newline at end of file diff --git a/static/templates/base.html b/static/templates/base.html index 7127a63fb4..9156d494e1 100644 --- a/static/templates/base.html +++ b/static/templates/base.html @@ -4,8 +4,11 @@ - - + + + + + Trezor {{.CoinLabel}} Explorer @@ -13,81 +16,84 @@
+
{{- template "specific" . -}}
-