Local Network Setup
Start the Local Chain
The examples in the repository and in this getting started section require a test network running locally, so if you do not already have one, install the IOTA CLI tool.
Next, start the local network with the following command.
RUST_LOG="off,iota_node=info" iota-localnet start --force-regenesis --with-faucet
Configure IOTA Client For the Local Chain
Fresh IOTA Client
If you haven't started the IOTA CLI client features tool yet, you have to generate a config file during the first start by calling:
iota client
Agree to connect to a full node server. Now you can interactively provide the config values:
- URL: "http://127.0.0.1:9000"
- alias: "localnet"
- key scheme: 0 (ed25519)
New Env
Alternatively, if you don't already have an environment pointing to the local node, create a new env for an IOTA full node server with the same values as described above.
iota client new-env --rpc "http://127.0.0.1:9000" --alias localnet
Switch to Local Node Env
If you did one of the steps above or already have an env as described above, make sure to switch to it.
Check active env with:
iota client envs
If your localnet does not have the asterisk in the "active" column, switch to it with:
iota client switch --env localnet
Request Funds for Active Accounts
Request funds for the active account, as the next step will need them. This can be done with:
iota client faucet
Publish the IOTA Audit Trails Package
Now that you have your env pointing to a local node, and have an account, you're almost ready to put a checkmark on the last requirement for using the IOTA Audit Trails locally: the deployment of the smart contracts used by the library.
Clone the IOTA Notarization repository, and switch to the tag matching the version you're working with.
Next, publish the Audit Trails package to your local test network:
./audit-trail-move/scripts/publish_package.sh
The script outputs the package IDs for both the Audit Trails package and the TF Components package. You can use eval to set the environment variables automatically:
eval $(./audit-trail-move/scripts/publish_package.sh)
This sets two environment variables:
IOTA_AUDIT_TRAIL_PKG_ID— the ID of the Audit Trails packageIOTA_TF_COMPONENTS_PKG_ID— the ID of the TF Components package (on localnet, this is the same as the Audit Trails package ID)
The examples and tests require both of these variables. You can also set them manually, e.g.:
export IOTA_AUDIT_TRAIL_PKG_ID=0x20f640b0dc01c50c04a84443d4320d7a77a15ed94f9bc19ebb6d0a5805045ddc
export IOTA_TF_COMPONENTS_PKG_ID=0x20f640b0dc01c50c04a84443d4320d7a77a15ed94f9bc19ebb6d0a5805045ddc