Welcome to the new Provenance Blockchain developer documentation portal!
logo
In this section, we will set up everything required to deploy the tutorial smart contract to a Provenance Blockchain localnet cluster.
It is assumed that Go 1.18+ is installed. See here for installation instructions.

Blockchain

If not already available, clone the Provenance Blockchain project.
shell
mkdir -p $GOPATH/src/github.com/provenance-io cd $GOPATH/src/github.com/provenance-io git clone git@github.com:provenance-io/provenance.git
Navigate to the blockchain project and checkout the required branch.
shell
cd ./provenance git fetch git checkout main
Install commands and start a provenance localnet cluster.
shell
make clean build install make run

Accounts

Before the Wasm can be deployed, accounts need to be set up for the consumer, merchant, and transfer fee bucket.
Create merchant account keys
shell
provenanced keys add merchant --home build/run/provenanced --keyring-backend test --testnet --hd-path "44'/1'/0'/0/0" --output json | jq
Create feebucket account keys
shell
provenanced keys add feebucket --home build/run/provenanced --keyring-backend test --testnet --hd-path "44'/1'/0'/0/0" --output json | jq
Create consumer account keys
shell
provenanced keys add consumer --home build/run/provenanced --keyring-backend test --testnet --hd-path "44'/1'/0'/0/0" --output json | jq
Create alias for the keys
shell
export validator=$(provenanced keys show -a validator --home build/run/provenanced --keyring-backend test -t) export merchant=$(provenanced keys show -a merchant --home build/run/provenanced --keyring-backend test -t) export feebucket=$(provenanced keys show -a feebucket --home build/run/provenanced --keyring-backend test -t) export consumer=$(provenanced keys show -a consumer --home build/run/provenanced --keyring-backend test -t)
Fund a merchant account with nhash, creating it on chain.
shell
provenanced tx bank send \\ "$validator" \\ "$merchant" \\ 200000000000nhash \\ --from="$validator" \\ --keyring-backend=test \\ --home=build/run/provenanced \\ --chain-id=testing \\ --gas=auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq
Fund a feebucket account with nhash, creating it on chain.
shell
provenanced tx bank send \\ "$validator" \\ "$feebucket" \\ 200000000000nhash \\ --from="$validator" \\ --keyring-backend=test \\ --home=build/run/provenanced \\ --chain-id=testing \\ --gas=auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq
Fund a consumer account with nhash, creating it on chain.
shell
provenanced tx bank send \\ "$validator" \\ "$consumer" \\ 200000000000nhash \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq

Name

An unrestricted name, sc.pb, must be created so the smart contract can bind a name to its address.
shell
provenanced tx name bind \\ "sc" \\ "$validator" \\ "pb" \\ --unrestrict \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas-prices="100000nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq

Marker

A marker must be created in order to mint coins required for purchase transfers.
shell
provenanced tx marker new 1000000000purchasecoin \\ --type COIN \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas auto \\ --gas-prices="1000000nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq
Grant withdraw access on the marker to the validator marker admin account
shell
provenanced tx marker grant \\ $validator \\ purchasecoin \\ withdraw \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq
Finalize the marker
shell
provenanced tx marker finalize purchasecoin \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq
Activate the marker, minting the purchasecoin supply
shell
provenanced tx marker activate purchasecoin \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq

Withdraw

Coins must be withdrawn into the consumer account in order to send purchase transfers.
shell
provenanced tx marker withdraw purchasecoin \\ 100000purchasecoin \\ $consumer \\ --from validator \\ --keyring-backend test \\ --home build/run/provenanced \\ --chain-id testing \\ --gas auto \\ --gas-prices="1905nhash" \\ --gas-adjustment=1.5 \\ --yes \\ --testnet \\ --output json | jq
The consumer account should now have nhash to pay network fees, and purchasecoin for purchases with the merchant.
shell
provenanced q bank balances "$consumer" -t -o json | jq
Example account query output
json
{ "balances": [ { "denom": "nhash", "amount": "200000000000" }, { "denom": "purchasecoin", "amount": "100000" } ], "pagination": { "next_key": null, "total": "0" } }

Up Next

Proceed to the Store section to upload the optimized smart contract Wasm to the blockchain.