Appearance
Getting Started
Prerequisites
To execute the sample workflows, the contracts need to be deployed into an EVM based chain, and the CLI setup has to be done. In this example we will use hardhat.
Run Hardhat
sh
git clone git@bitbucket.org:skutrondev/evm-skucode-20-plus.git
cd evm-skucode-20-plus
npm install
npx hardhat node
Deploy the contracts
Open new terminal/in another tab
sh
cd evm-skucode-20-plus
npx hardhat ignition deploy ignition/modules/SkucodeFactory.js --network localhost
npx hardhat ignition deploy ignition/modules/SkusetFactory.js --network localhost
Save the address. For Example:
sh
SkucodeFactory#SkucodeFactory - 0x5FbDB2315678afecb367f032d93F642f64180aa3
SkusetFactory#SkusetFactory - 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
CLI Setup
If using npm
bash
git clone git@bitbucket.org:skutrondev/skc-nodeio-cli.git
cd skc-nodeio-cli
npm run clean
npm run setup
npm link
Recommended node version:
v20.11.0
Test Installation
Once installed, you can test the installation via:
sh
$ sct
sct <command>
Commands:
sct completion generate completion script
sct token token related commands
sct tokenLedger tokenLedger related commands
sct user user related commands
Options:
--help Show help [boolean]
--version Show version number [boolean]
Workflows Execution
bash
git clone git@bitbucket.org:skutrondev/sct-workflows.git
cd sct-workflows
- Create .env file under directory
sct-workflows
. - Update the following fields with the appropriate values in .env :
bash
NETWORK=http://localhost:8545
SKUCODE_FACTORY_CONTRACT_ADDRESS=0x5FbDB2315678afecb367f032d93F642f64180aa3
SKUSET_FACTORY_CONTRACT_ADDRESS=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
FAUCET_PRIV_KEY=0xa267530f49f8280200edf313ee7af6b827f2a8bce2897751d06a843f644967b1
Vault Installation (optional)
For vault based signing (which is optional), the env variables VAULT_ADDR
and VAULT_TOKEN
need to be defined. Follow the steps below to set up the vault.
- Follow the installation steps here to install HashiCorp Vault on your machine:
- Install Skuchain's vault plugin
skuchain-vault-plugin
for secure transaction signing.
- Execute the commands below
git clone git@bitbucket.org:skutrondev/skuchain-vault-plugin.git
cd skuchain-vault-plugin
go build -o vault/plugins/skuchain-vault-plugin cmd/vault-plugin/main.go
vault server -dev -dev-root-token-id=root -dev-plugin-dir=./vault/plugins
- In a second terminal tab, execute the following commands
export VAULT_TOKEN=root
export VAULT_ADDR=http://127.0.0.1:8200
vault secrets disable skuchain-vault-plugin
vault secrets enable -path=skuchain-vault-plugin skuchain-vault-plugin
- Add the below variables to the
.env
file undersct-workflows
directory.
bash
VAULT_TOKEN=root
VAULT_ADDR=http://127.0.0.1:8200
Next, to execute the workflows, follow these steps:
Preferred Purchasing Workflow
To execute the preferred purchasing workflow, follow these steps:
Navigate to the preferred-purchasing directory:
bashcd preferred-purchasing/
Run the truck flow via different ways:
Using Private keys
bashbash truck-private-key.sh
Using Vault
bashbash truck-vault.sh
Using keys from file
bashbash truck-file.sh
Multi-tier Construction Workflow
To execute the construction workflow, follow these steps:
Navigate to the construction directory:
bashcd construction/
Run the construction flow via different ways:
Using Private keys
bashbash construction-private-key.sh
Using Vault
bashbash construction-vault.sh
Using keys from file
bashbash construction-file.sh