Skip to content

Repository files navigation

NDID Migration Tools

Prerequisites

  • Go version >= 1.18.0
  • (Optional) (for reading from LevelDB using C lib) LevelDB version >= 1.7 and snappy

Getting Started

go run main.go

To run with C lib support for LevelDB:

CGO_ENABLED=1 CGO_LDFLAGS="-lsnappy" go run -tags "cleveldb" main.go

Environment variable options

  • INITIAL_STATE_DATA_DIR: Directory path of initial state data
  • INITIAL_STATE_DATA_FILENAME: ABCI initial state data file name (for JSON file data type) or directory name excluding suffix .db (for LevelDB data type). [Default: data]
  • BACKUP_VALIDATORS_FILENAME: File name of validators backup data
  • CHAIN_HISTORY_FILENAME: File name of chain history data [Default: chain_history]

Specific to create-initial-state-data command

  • TM_HOME: Source Tendermint home directory path
  • ABCI_DB_DIR_PATH: Source ABCI state DB directory path
  • INITIAL_STATE_DATA_TYPE: ABCI initial state data file type. Options are leveldb and file. leveldb will output as a LevelDB database directory. file will output as a single file with JSON data format [Default: leveldb]
  • READ_BUFFER_SIZE: Key-value read buffer size (number of keys) [Default: 250000]
  • LEVELDB_MAX_BATCH_BYTES: LevelDB write max batch size in bytes. (Only apply when INITIAL_STATE_DATA_TYPE is set to leveldb) [Default: 8388608 (8 MB)]
  • LEVELDB_WRITE_BUFFER_BYTES: LevelDB write buffer size in bytes. (Only apply when INITIAL_STATE_DATA_TYPE is set to leveldb) [Default: 268435456 (256 MB)]

Specific to restore command

  • NDID_NODE_ID: NDID node ID [Default: NDID]
  • KEY_DIR: NDID node key directory path [Default: ./dev_keys/]
  • TENDERMINT_RPC_HOST: Tendermint RPC host [Default: localhost]
  • TENDERMINT_RPC_PORT: Tendermint RPC port [Default: 45000]

Migrate Data to a New Chain

Option 1

  1. Run backup with command create-initial-state-data [fromVersion] [toVersion]

Example:

go run main.go create-initial-state-data 4 5
  1. Run restore with command restore [toVersion]

Example:

go run main.go restore 5

Option 2

  1. Run create initial state data with command create-initial-state-data [fromVersion] [toVersion]

Example:

go run main.go create-initial-state-data 6 7
  1. Use created initial state data with Tendermint/ABCI for InitChain. Refer to https://github.com/ndidplatform/smart-contract for usage.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages