Crates.io | chain-spec-generator |
lib.rs | chain-spec-generator |
version | 13.0.1-beta.196 |
source | src |
created_at | 2023-02-17 20:25:53.89845 |
updated_at | 2023-02-17 20:25:53.89845 |
description | Generates a chainspec artifact for use in genesis block creation of a Xand network. |
homepage | |
repository | |
max_upload_size | |
id | 787757 |
size | 501,815 |
A tool to generate Xand chainspecs.
You will need a YAML configuration file specifying the initial network
participants. See sample_config.yaml
in this repo for an example.
Download the CHAINSPEC_VERSION
template you'd like to use into a ./chainspec_templates
directory:
CHAINSPEC_VERSION="7.11.0"
ZIP_FILENAME="chain-spec-template.${CHAINSPEC_VERSION}.zip"
wget --directory-prefix=./chainspec_templates/ --user=$ARTIFACTORY_USER --password=$ARTIFACTORY_PASS \
https://transparentinc.jfrog.io/artifactory/artifacts-internal/chain-specs/templates/${ZIP_FILENAME}
The tool can be run locally from the repo root via Cargo:
cargo run generate --chainspec-zip ./chainspec_templates/$ZIP_FILENAME --config my_config.yaml --output-dir ./chainspec_output
The CLI is also published as a Docker image. It can be used as follows,
replacing 0.3.1
with the latest (or desired) version:
docker run --rm -it \
-v $(pwd)/my_config.yaml:/config.yaml \
-v $(pwd)/chainspec_templates/$ZIP_FILENAME:/chainspec_template.zip \
-v $(pwd)/chainspec_output:/output \
xandkeeper/chain-spec-generator:0.3.1 \
generate \
--chainspec-zip /chainspec_template.zip \
--config /config.yaml \
--output-dir /output
You can test if the chain spec is correctly formatted for a given validator version by using the validator docker image to parse and produce a "raw" version of the chain spec
docker run xandkeeper/validator:$CHAINSPEC_VERSION
docker run --rm \
-v $(pwd)/chainspec_output/chainSpecModified.json:/xand/chainSpecModified.json \
--entrypoint ./xandstrate \
xandkeeper/validator:$CHAINSPEC_VERSION build-spec --raw --chain /xand/chainSpecModified.json > $(pwd)/chainspec_output/chainSpecRaw.json
To help mitigate bugs we rely on snapshot
tests. Rather than letting the chainspec
generation snapshot tests potentially fail as the chainspec template
published by thermite evolves, we explicitly pin the version used. A
copy of the pinned chainspec template ZIP is located in
./.test-assets
.
Note that the pinned version is independent of the
CHAINSPEC_VERSION
environment variable recommended above to users
for convenience as they run the generator. However, it is recommended
to periodically bump the template version used by the snapshot tests
to detect divergences early on.