# Set Up Smart Contracts
Deploy a smart contract after meeting the prerequisites.
# Prerequisites
- Wallet: Set up a wallet via Keeper Wallet or WX Network.
NOTE: Ensure saving your wallet's seed phrase to send transactions.
- Tokens: Obtain WAVES tokens to cover the transaction fee for each script deployment:
- For the Mainnet network: Get 0.001 WAVES via Available Market Options.
- For the Testnet network: Get 0.001 WAVES via Faucet.
- For the Stagenet network: Get 0.001 WAVES via Faucet.
# Tutorial
Follow the steps for the relevant smart contract type:
# Deploy dApp Script
- Prepare your dApp script:
// Script example: {-# STDLIB_VERSION 8 #-} {-# CONTENT_TYPE DAPP #-} {-# SCRIPT_TYPE ACCOUNT #-} @Callable(i) func checkStorageUntouchedByAlias(accountAlias: String) = { let alias = Alias(accountAlias) let res = if isDataStorageUntouched(alias) then { unit } else { throw("Data storage is not untouched by the alias") } ([], res) }
- Send a Set Script Transaction with:
- Your seed phrase pasted into the
seedPhrase
variable. - Your dApp script pasted into the
rideScript
variable.// Example of the ride script formatted: rideScript := ` {-# STDLIB_VERSION 8 #-} {-# CONTENT_TYPE EXPRESSION #-} {-# SCRIPT_TYPE ACCOUNT #-} let cooperPubKey = base58'BVqYXrapgJP9atQccdBPAgJPwHDKkh6A8' let BTCId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS' match tx { case o: Order => sigVerify(o.bodyBytes, o.proofs[0], cooperPubKey ) && (o.assetPair.priceAsset == BTCId || o.assetPair.amountAsset == BTCId) case _ => sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey ) } `
# Deploy Smart Account Script
- Prepare your smart asset script:
// Script example: {-# STDLIB_VERSION 6 #-} {-# CONTENT_TYPE EXPRESSION #-} {-# SCRIPT_TYPE ACCOUNT #-} let cooperPubKey = base58'BVqYXrapgJP9atQccdBPAgJPwHDKkh6A8' let BTCId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS' match tx { case o: Order => sigVerify(o.bodyBytes, o.proofs[0], cooperPubKey ) && (o.assetPair.priceAsset == BTCId || o.assetPair.amountAsset == BTCId) case _ => sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey ) };
- Send a Set Script Transaction with:
- Your seed phrase pasted into the
seedPhrase
variable. - Your smart asset script pasted into the
rideScript
variable.// Example of the ride script formatted: rideScript := ` {-# STDLIB_VERSION 8 #-} {-# CONTENT_TYPE EXPRESSION #-} {-# SCRIPT_TYPE ACCOUNT #-} let cooperPubKey = base58'BVqYXrapgJP9atQccdBPAgJPwHDKkh6A8' let BTCId = base58'8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS' match tx { case o: Order => sigVerify(o.bodyBytes, o.proofs[0], cooperPubKey ) && (o.assetPair.priceAsset == BTCId || o.assetPair.amountAsset == BTCId) case _ => sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey ) }
# Deploy Smart Asset Script
- Prepare your smart asset script:
// Script example: {-# STDLIB_VERSION 6 #-} {-# CONTENT_TYPE EXPRESSION #-} {-# SCRIPT_TYPE ASSET #-} func trueReturner () = { true } trueReturner()
- Follow the steps based on your goal:
- To create a new smart asset with the defined script.
- To add a smart asset script to an existing asset.
# Create Smart Asset
Send an Issue Transaction with:
- Your seed phrase pasted into the
seedPhrase
variable. - Your smart asset script pasted into the
rideScript
variable.// Formatting example: rideScript := ` {-# STDLIB_VERSION 6 #-} {-# CONTENT_TYPE EXPRESSION #-} {-# SCRIPT_TYPE ASSET #-} func trueReturner () = { true } trueReturner() `
# Add Asset Script
Send a Set Asset Script Transaction with:
- Your seed phrase pasted into the
seedPhrase
variable. - Your asset ID pasted into the
assetID
variable. - Your smart asset script pasted into the
rideScript
variable.// Formatting example: rideScript := ` {-# STDLIB_VERSION 6 #-} {-# CONTENT_TYPE EXPRESSION #-} {-# SCRIPT_TYPE ASSET #-} func trueReturner () = { true } trueReturner() `