A key-value storage smart contract implementation in Rust using CosmWasm. This smart contract allows you to add, delete, and edit key-value pairs using a smart contract in the Cosmos ecosystem.
This build process assumes you have wasmd
and Rust installed on your machine. Instructions on how to set up your wasmd
wallets can be found here.
- Install dependencies:
rustup default stable
- In the
cw-cyph
compile the wasm contract:RUSTFLAG='-C link-args=-s' cargo wasm
- Run unit tests:
RUST_BACKTRACE=1 cargo unit-test
- Run the
rust-optimizer
using docker:docker run --rm -v "$(pwd)":/code \ --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ cosmwasm/rust-optimizer:0.12.4
- Use
wasmd
to upload te contract:RES=$(wasmd tx wasm store artifacts/cw_nameservice.wasm --from wallet $TXFLAG -y --output json)
- Get the contract code ID and instantiate it:
CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[0].value') INIT='{}' wasmd tx wasm instantiate $CODE_ID "$INIT" \ --from wallet --label "cyph password manager" $TXFLAG -y
More information on how to interact with the contract can be found here.