Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

CNTools 8.2.0 #895

Merged
merged 16 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/Build/offchain-metadata-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
!> - An average pool operator may not require offline-metadata-tools at all. Please verify if it is required for your use as mentioned [here](build.md#components)

>Ensure the [Pre-Requisites](basics.md#pre-requisites) are in place before you proceed.

In the Cardano multi-asset era, this project helps you create and submit metadata describing your assets, storing them off-the-chain.

##### Download pre-built binaries

Go to [input-output-hk/offchain-metadata-tools](https://github.com/input-output-hk/offchain-metadata-tools#pre-built-binaries) to download the binaries and place in a direcotry specified by `PATH`, eg `$HOME/.cabal/bin/`.

##### Build Instructions

An alternative to pre-built binaries. Instructions describe how to build the `token-metadata-creator` tool but the offchain-metadata-tools repository contains other tools as well. Build the ones needed for your installation.

##### Clone the repository

Execute the below to clone the offchain-metadata-tools repository to $HOME/git folder on your system:

``` bash
cd ~/git
git clone https://github.com/input-output-hk/offchain-metadata-tools.git
cd offchain-metadata-tools/token-metadata-creator
```

##### Build token-metadata-creator

You can use the instructions below to build token-metadata-creator, same steps can be executed in future to update the binaries (replacing appropriate tag) as well.

``` bash
git fetch --tags --all
git pull
# Replace master with appropriate tag if you'd like to avoid compiling against master
git checkout master
$CNODE_HOME/scripts/cabal-build-all.sh
```
The above would copy the binaries into `~/.cabal/bin` folder.

##### Verify that token-metadata-creator is installed

Verify that the tool is executable from anywhere by running:

``` bash
token-metadata-creator -h
```
2 changes: 1 addition & 1 deletion docs/Build/rest.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
!> - An average pool operator may not require cardano-wallet at all. Please verify if it is required for your use as mentioned [here](build.md#components)
!> - An average pool operator may not require cardano-rest at all. Please verify if it is required for your use as mentioned [here](build.md#components)

>Ensure the [Pre-Requisites](basics.md#pre-requisites) are in place before you proceed.

Expand Down
11 changes: 11 additions & 0 deletions docs/Scripts/cntools-changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this tool will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [8.2.0] - 2021-04-18
##### Added
- Ability to create & update a Cardano Token Registry submission JSON file
- Requires 'token-metadata-creator' tool, instructions to download/build this tool added to Guild Operators documentation:
- https://cardano-community.github.io/guild-operators/#/Build/offchainMetadataTools
- Token Registry lookup in Wallet >> Show
- Token asset fingerprint generation according to https://github.com/cardano-foundation/CIPs/pull/64

##### Changed
- Redesigned input handling to be more flexible and improve output

## [8.1.6] - 2021-04-14
##### Changed
- Metadata creation now offer the choice to add a metadata JSON scaffold to see the required structure
Expand Down
5 changes: 4 additions & 1 deletion docs/Scripts/cntools.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ See [CNCLI](Scripts/cncli.md) and [Log Monitor](Scripts/logmonitor.md) sections
##### Download and Update
The update functionality is provided from within CNTools. In case of breaking changes, please follow the prompts post upgrade. If stuck, it's always best to re-run latest prereqs before proceeding.

!> If you have not updated in a while, it is possible that you might come from a release with breaking change. If so, please be sure to check out the [upgrade](upgrade.md) instructions

##### Navigation
The scripts menu supports both arrow key navigation and shortcut key selection. The character within the square brackets is the shortcut to press for quick navigation. For other selections like wallet and pool menu that doesn't contain shortcuts, there is a third way to navigate. Key pressed is compared to the first character of the menu option and if there is a match selection jumps to this location. A handy way to quickly navigate a large menu.

Expand All @@ -51,6 +53,7 @@ Supported devices: Model T
Make sure the latest firmware is installed on the device. In addition to this, install `Trezor Bridge` for your system before trying to use your Trezor device in CNTools. You can find the latest version of the bridge at https://wallet.trezor.io/#/bridge

##### Offline Workflow

CNTools can be run in online and offline mode. At a very high level, for working with offline devices, remember that you need to use CNTools on an online node to generate a staging transaction for the desired type of transaction, and then move the staging transaction to offline node to sign (authorize) using your offline node signing keys - and then bring back updated transaction to the online node for submission to chain.

For offline workflow all wallet and pool keys should be kept on the offline node. The backup function in CNTools has an option to create a backup without private keys(sensitive signing keys) to be transfered to online node. All other files are included in the backup to be transfered to the online node.
Expand All @@ -59,7 +62,7 @@ Keys excluded from backup when created without private keys:
**Wallet** - payment.skey, stake.skey
**Pool** - cold.skey

Example workflow for creating a wallet and pool
Note that setting up an offline server requires good sysops background (you need to be aware of how to set up your server with offline mirror repository, how to transfer files across and be fairly familiar with the disk layout of guild tools). The prereqs.sh in its current state is not expected to run on an offline machine. Essentially you simply need `cardano-cli`,`bech32`,`cardano-address` binary in your $PATH, OS level dependency packages [ `jq`,`coreutils`,`pkgconfig`,`gcc-c++` and `bc` ], perhaps a copy from your online cnode folder (to ensure you have the right genesis/config files on your offline server). We strongly recommend you to familiarise with the workflow on testnet / guild network first, before attempting on mainnet. Example workflow for creating a wallet and pool

``` mermaid

Expand Down
4 changes: 2 additions & 2 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* [Build and Run](build.md)
* [Node and CLI](Build/node-cli.md "Cardano Node and CLI")
* [Wallet](Build/wallet.md "Cardano Wallet")
* [DBSync tool](Build/dbsync.md "Cardano DB Sync Tool")
* [REST](Build/rest.md "Cardano Rest")
* [DBSync](Build/dbsync.md "Cardano DB Sync Tool")
* [PostgREST](Build/pgrest.md "PostgREST")
* [Offchain Metadata Tools](Build/offchain-metadata-tools.md "Offchain Metadata Tools")
* [Docker](docker/docker.md "Cardano Docker by Guild Operators")
* [Build](docker/build.md "Build your own Cardano Node")
* [Run](docker/run.md "Run you own Cardano Node")
Expand Down
39 changes: 16 additions & 23 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,32 @@ For most Pool Operators, simply building [cardano-node](Build/node-cli.md) shoul
graph TB
A(Need to interact with <br/>HD Wallets or query<br/> pool metadata locally?)
B(Need to explore <br/> blockchain locally?)
C(Automate pool-ops <br/> tasks using <br/> menu navigations?)
C(Manage pool-ops <br/> and asset operation <br/> tasks using <br/> menu navigations?)
D(Create Custom Assets?)
E(Monitor node <br/> using Terminal UI)
O{{Node}}
P{{PostgREST}}
Q{{DBSync }}
R{{Wallet}}
S{{CNTools}}
T{{Rest}}

O --x A --x R
T{{*Rest}}
U{{*GraphQL}}
V{{Offline Metadata Tools}}
X{{gLiveView}}

O --x E --x X
O --x C --x S
O --x D --x V
O --x B
B --x P --x Q
B --x T --x Q
O --x C
C --x S
B --x U --x Q
O --x A --x R
```

**The instructions are intentionally limited to cabal** to avoid wait times/availability of nix/docker files on, what we expect to be, a rapidly developing codebase - this will also help prevent managing multiple versions of instructions (at least for now).
> We have retired usage of Rest/GraphQL components from guild website due to lack of advantages over PostgREST , as well as simplicity/not having to work with/mix different technologies for base layer itself.

**The instructions are intentionally limited to stack/cabal** to avoid wait times/availability of nix/docker files on, what we expect to be, a rapidly developing codebase - this will also help prevent managing multiple versions of instructions (at least for now).

Note that the instructions are predominantly focused around building Cardano components and OS/3rd-party software (eg: postgres) setup instructions are intended to provide basic information only.

###### Docker Builds

If you would like to go down the Docker route, the basic instructions to get you set up with Docker itself are below. Additionally, you can follow [IOHK Adrestia documentation](https://docs.cardano.org/projects/adrestia) for the latest release information:
``` bash
# CentOS
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
sudo yum install -y docker-ce docker-ce-cli
sudo systemctl enable docker
sudo chkconfig docker on

## These steps would be automatically performed by the install above
# sudo groupadd docker
# sudo usermod -aG docker $USER
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose;chmod 755 /usr/bin/docker-compose
```
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
hook.beforeEach(function(content) {
// Invoked each time before parsing the Markdown file.
// ...
var custommarkdown = '!> Note that there was a breaking change introduced to guild repository scripts on 15th October. If you are coming from release before, please be sure to check out the [upgrade](upgrade.md) instructions\n'
var custommarkdown = ''
return custommarkdown + '\n' + content;
});
//hook.doneEach(function() {
Expand Down
58 changes: 5 additions & 53 deletions scripts/cnode-helper-scripts/cncli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,64 +126,16 @@ cncliInit() {
if ! command -v sqlite3 >/dev/null; then echo "ERROR: sqlite3 not found, please install before activating blocklog function" && exit 1; fi

PARENT="$(dirname $0)"

# Check if update is available
[[ -f "${PARENT}"/.env_branch ]] && BRANCH="$(cat ${PARENT}/.env_branch)" || BRANCH="master"
URL="https://raw.githubusercontent.com/cardano-community/guild-operators/${BRANCH}/scripts/cnode-helper-scripts"
if curl -s -f -m 10 -o "${PARENT}"/cncli.sh.tmp ${URL}/cncli.sh && curl -s -f -m 10 -o "${PARENT}"/env.tmp ${URL}/env && [[ -f "${PARENT}"/cncli.sh.tmp && -f "${PARENT}"/env.tmp ]]; then
if [[ -f "${PARENT}"/env ]]; then
if [[ $(grep "_HOME=" "${PARENT}"/env) =~ ^#?([^[:space:]]+)_HOME ]]; then
vname=$(tr '[:upper:]' '[:lower:]' <<< "${BASH_REMATCH[1]}")
else
echo -e "\nFailed to get cnode instance name from env file, aborting!\n"
rm -f "${PARENT}"/cncli.sh.tmp
rm -f "${PARENT}"/env.tmp
exit 1
fi
sed -e "s@/opt/cardano/[c]node@/opt/cardano/${vname}@g" -e "s@[C]NODE_HOME@${BASH_REMATCH[1]}_HOME@g" -i "${PARENT}"/cncli.sh.tmp -i "${PARENT}"/env.tmp
CNCLI_TEMPL=$(awk '/^# Do NOT modify/,0' "${PARENT}"/cncli.sh)
CNCLI_TEMPL2=$(awk '/^# Do NOT modify/,0' "${PARENT}"/cncli.sh.tmp)
ENV_TEMPL=$(awk '/^# Do NOT modify/,0' "${PARENT}"/env)
ENV_TEMPL2=$(awk '/^# Do NOT modify/,0' "${PARENT}"/env.tmp)
if [[ "$(echo ${CNCLI_TEMPL} | sha256sum)" != "$(echo ${CNCLI_TEMPL2} | sha256sum)" || "$(echo ${ENV_TEMPL} | sha256sum)" != "$(echo ${ENV_TEMPL2} | sha256sum)" ]]; then
. "${PARENT}"/env offline &>/dev/null # source in offline mode and ignore errors to get some common functions, sourced at a later point again
if [[ ${BATCH_AUTO_UPDATE} = 'Y' ]] || { [[ -t 1 ]] && getAnswer "\nA new version is available, do you want to upgrade?"; }; then
cp "${PARENT}"/cncli.sh "${PARENT}/cncli.sh_bkp$(date +%s)"
cp "${PARENT}"/env "${PARENT}/env_bkp$(date +%s)"
CNCLI_STATIC=$(awk '/#!/{x=1}/^# Do NOT modify/{exit} x' "${PARENT}"/cncli.sh)
ENV_STATIC=$(awk '/#!/{x=1}/^# Do NOT modify/{exit} x' "${PARENT}"/env)
printf '%s\n%s\n' "$CNCLI_STATIC" "$CNCLI_TEMPL2" > "${PARENT}"/cncli.sh.tmp
printf '%s\n%s\n' "$ENV_STATIC" "$ENV_TEMPL2" > "${PARENT}"/env.tmp
{
mv -f "${PARENT}"/cncli.sh.tmp "${PARENT}"/cncli.sh && \
mv -f "${PARENT}"/env.tmp "${PARENT}"/env && \
chmod 755 "${PARENT}"/cncli.sh "${PARENT}"/env && \
echo -e "\nUpdate applied successfully, please run cncli again!\n" && \
exit 0;
} || {
echo -e "\n${FG_RED}Update failed!${NC}\n\nplease install cncli.sh & env with prereqs.sh or manually download from GitHub" && \
rm -f "${PARENT}"/cncli.sh.tmp && \
rm -f "${PARENT}"/env.tmp && \
exit 1;
}
fi
fi
else
mv "${PARENT}"/env.tmp "${PARENT}"/env
rm -f "${PARENT}"/cncli.sh.tmp
echo -e "\nCommon env file downloaded: ${PARENT}/env"
echo -e "This is a mandatory prerequisite, please set variables accordingly in User Variables section in the env file and restart cncli.sh\n"
exit 0
fi
fi
rm -f "${PARENT}"/cncli.sh.tmp
rm -f "${PARENT}"/env.tmp


if [[ ! -f "${PARENT}"/env ]]; then
echo -e "\nCommon env file missing: ${PARENT}/env"
echo -e "This is a mandatory prerequisite, please install with prereqs.sh or manually download from GitHub\n"
exit 1
fi

# Check if update is available
! checkUpdate env ${BATCH_AUTO_UPDATE} && exit 1
! checkUpdate cncli.sh ${BATCH_AUTO_UPDATE} && exit 1

until . "${PARENT}"/env; do
echo "sleeping for 10s and testing again..."
Expand Down
Loading