Archway is a smart contract platform which gives developers the tools to quickly build and launch scalable cross-chain dApps.
The network starts with a vanilla Proof-of-Stake (PoS) network, with modified Minting, CosmWasm, Distribution, Staking, Group, and Governance Cosmos modules that manage the Archway inflation and rewards system.
Smart Contract in archway protocal uses CosmWasm, WebAssembly(Wasm), and Rust.
This tutorial is to build and deploy smart contract in archway
Let's setup a new project, using Archway Developer CLI.
To create a new wallet
archway accounts --add <account-name>
NOTE: when got error: no such subcommand: run-script. Using
cargo install cargo-run-script
to install run-script.
To check account balance
archwayd query bank balances <account-address> --node <rpc-host>:<rpc-port> --chain-id <network-id>
To request funds from the faucet you should use our Discord channel.
- Join our Discord server at https://discord.gg/dnYYcKPAX5
- Send the following message in the 🚰 | faucet channel
!faucet <address>
The funds will be deposited to your account in a few minutes on all testnets.
Let's create first dApp project, using Archway Developer CLI.
To create a project with template.
archway new
Default wasm executables can be produced by the developer CLI using the command.
To deploy a smart contract
archway deploy --args '<arguments>'
- Querying - Queries read from the blockchain. They don't modify anything stored on chain, so they don't cost a fee.
archwayd query wasm contract-state smart <contract-address> <query> --node <rpc:443> --chain-id <chain-id>
- Execute - Transactions write to the blockchain and cost a gas fee for modifying a contract's state securely.
archway tx --args '<arguments>'
or
archwayd tx wasm execute <contract-address> '<arguments>' --node <rpc:443> --chain-id <chain-id> --from <account-address>
Let's create nft project, using Archway Developer CLI.
The contract instantiation requires three parameters:
- name (the NFT collection name)
- symbol (a token symbol to represent it)
- minter (the wallet address allowed to mint a new NFT using this contract)
archway deploy --args '{ "name": <name>, "symbol": <symbol>, "minter": <account> }'
- Minting - mint an NFT with MintMsg parameters
archway tx --args '{"mint":{"token_id":"<token-id>","owner":<account-address>,"extension":{"name":"<name>","description":"<description>","image":"<image-url>","attributes":[{"trait_type":"<trait-type>","value":"<value>"}]}}}'
- Querying - get nft infomation
archwayd query wasm contract-state smart <contract-address> '{"nft_info":{"token_id":"<token-id>"}}' --node <rpc:443> --chain-id <chain-id>
archwayd query wasm contract-state smart <contract-address> '{"owner_of":{"token_id":"<token-id>"}}' --node <rpc:443> --chain-id <chain-id>
- Sending - transfer nft token
archway tx --args '{"transfer_nft":{"recipient":"<account-address>","token_id":"<token-id>"}}'