Auctioning App

Deploying an auctioning App using the Andromeda CLI.
If unfimailar with the steps of deploying an app, go back to the first example where we explain in detail all the different parts of deploying an App.
If any of the messages in this example do not work, you might want to cross reference the messages with the ADO specific section which always contains the latest ADO versions to make sure they are correct. Other than that the logic will remain the same.

Defining our App

For this example, we will be building a simple auction app. We only need two components/ADOs:
We will perform the following steps:
  • Mint an NFT
  • Send it to auction starting an auction on it
  • Place bids on the NFT
  • End the auction
  • Claim the funds and transfer the NFT to the new owner


Our contracts use a “ado db” contract to store code ids and a “registry” or "primitive" to store important contract addresses (such as the ado db). The addresses for both can be found in the deployed contracts section. In the contracts discussed below the references to “primitive contract” are a reference to the “registry” contract.
Since both the “registry” and “ado db” contracts have already been instantiated, all what is left for us to do is make our App.

Defining the Messages

For this app we would need only 2 components:
Although not necessary, if you are unfamiliar with these ADOs, it is suggested to read through each of the them before deploying an app.
Let us first start by representing the instantiation message for each of our ADOs:
Keep in mind that the app takes these messages as base64 encoded.
The primitive_contract and modules fields can be omitted without affecting the result.


"name":"Auction Sale",
Make sure to set the minter as your own address and not the one above.
As base64:


As base64:


"name": "Auction App",
"app": [
"name": "auction",
"ado_type": "auction",
"instantiate_msg": "e30="
"name": "tokens",
"ado_type": "cw721",
"instantiate_msg": "eyJuYW1lIjoiQXVjdGlvbiBTYWxlIiwic3ltYm9sIjoiQVMiLCJtaW50ZXIiOnsgICAiaWRlbnRpZmllciI6Imp1bm8xemtwdGhxc3ozdWQ5N2ZtNnA0a3hjcmE4YWU5OWpnemF1dWd5ZW0ifX0="
"primitive_contract": "juno133fdsnvcah870exzcyxknydswyh778jfhwxzlhhgjuagh4482zpqp856dz"
There are several components found here. A simple name for the app, the components of the app itself and a reference to the “registry”. Each component of the app provides two values: a name used for referencing for other components within the app, and the base64 encoded instantiation message.

Instantiating the App

First, let us open the CLI by running andr in our terminal. We then need to chose the chain we want to deploy on. For this example I will be using the Juno testnet uni-5:
chain use uni-5
If this is the first time using the CLI make sure to run "wallets add <wallet-name>"
in order to create a wallet. Then go to the Juno faucet and request some tokens.
The Andromeda CLI will open and we can now instantiate our App. We will be using our wasm command to instantiate our app:
I have already uplaoded the App contract to the uni-5 testnet. The code Id to use is 98. If you want to upload a new one to make sure it is the latest version, you need to:
-Clone our Repo and build the contract
-In artifacts, run wasm upload andromeda_app_contract.wasm in CLI
-You will get a new code Id to use.
wasm instantiate 98 '{"name": "Auction App","app": [{"name": "auction","ado_type": "auction","instantiate_msg": "e30="},{"name": "tokens","ado_type": "cw721","instantiate_msg": "eyJuYW1lIjoiQXVjdGlvbiBTYWxlIiwic3ltYm9sIjoiQVMiLCJtaW50ZXIiOnsgICAiaWRlbnRpZmllciI6Imp1bm8xemtwdGhxc3ozdWQ5N2ZtNnA0a3hjcmE4YWU5OWpnemF1dWd5ZW0ifX0="}],"primitive_contract": "juno133fdsnvcah870exzcyxknydswyh778jfhwxzlhhgjuagh4482zpqp856dz"}'
You will be using the contract addresses that were instantiated for you instead of the ones in this tutorial. The addresses are found in the explorer in the "Instantiates" section.

Interacting with the App

Andromeda contracts assign the original instantiator as contract owners. Due to how instantiation via a submessage operates in CosmWasm contracts, we must claim ownership of the components in order to execute messages that have authorization restrictions (owner restricted).

Claim Components

wasm execute juno1ah8m9dpas4s4g0dkzuj485kww2ukfx28ml2p3gy6nlalaps4wcvspt249d '{"claim_ownership":{}}'

Mint Tokens

We will only mint one token to auction:
"mint": {
"token_id": "1",
"owner": "juno1zkpthqsz3ud97fm6p4kxcra8ae99jgzauugyem",
"extension": {
"name": "Some token",
"publisher": "juno1zkpthqsz3ud97fm6p4kxcra8ae99jgzauugyem",
"description": "A token to place in auction",
"attributes": [],
wasm execute juno16802hcvuxjqlvl8c7j20ltgtlk5gecqw2qgrxnugc934f0n4y6rsnxtz79 '{"mint": {"token_id": "1","owner": "juno1zkpthqsz3ud97fm6p4kxcra8ae99jgzauugyem","extension": {"name": "Some token","publisher": "juno1zkpthqsz3ud97fm6p4kxcra8ae99jgzauugyem","description": "A token to place in auction", "attributes": [],"image":"" }}}'

Start Auction

In order to start an auction on our token, we need to send it to the auction contract with the required message.
"send_nft": {
"contract": "juno1gu9dxksczas9l0gl7x2dmmum7k555mu2g724zv5839363w0p53wqweuq9h",
"token_id": "1",
"msg": "eyJzdGFydF9hdWN0aW9uIjogeyJzdGFydF90aW1lIjogMTY2NDQwMjAwMDAwMCwiZHVyYXRpb24iOiA5MDAwMDAsImNvaW5fZGVub20iOiAidWp1bm94IiwibWluX2JpZCI6IjUwMCJ9fQ=="
The attached message is a start_auction message to start the auction when the NFT is sent (When start_time is reached).
"start_auction": {
"start_time": 1664402000000,
"duration": 900000,
"coin_denom": "ujunox",
Make sure to check the current epoch time in milliseconds to enter a valid start time.
wasm execute juno16802hcvuxjqlvl8c7j20ltgtlk5gecqw2qgrxnugc934f0n4y6rsnxtz79 '{"send_nft": {"contract": "juno1gu9dxksczas9l0gl7x2dmmum7k555mu2g724zv5839363w0p53wqweuq9h","token_id": "1","msg": "eyJzdGFydF9hdWN0aW9uIjogeyJzdGFydF90aW1lIjogMTY2NDQwMjAwMDAwMCwiZHVyYXRpb24iOiA5MDAwMDAsImNvaW5fZGVub20iOiAidWp1bm94IiwibWluX2JpZCI6IjUwMCJ9fQ=="}}'

Place Bids

Now it is time to start placing some bids on our NFT.
"place_bid": {
"token_id": "1",
Dont forget to switch wallets when bidding since the owner cannot bid on their own auctioned NFT. To switch wallets run "wallets use" then chose the wallet to bid with.
wasm execute juno1gu9dxksczas9l0gl7x2dmmum7k555mu2g724zv5839363w0p53wqweuq9h '{ "place_bid": { "token_id": "1","token_address":"juno16802hcvuxjqlvl8c7j20ltgtlk5gecqw2qgrxnugc934f0n4y6rsnxtz79"}}'
Let us query the Bids of the auction to see if they match:
"auction_id": "1",
wasm query juno1gu9dxksczas9l0gl7x2dmmum7k555mu2g724zv5839363w0p53wqweuq9h '{"bids":{"auction_id": "1"}}'


- Querying contract...
"bids": [
"bidder": "juno1e53vtk7fmqzfttdvpf4a3pyx0e79wkmjzh6qsk",
"amount": "600",
"timestamp": "1664402180009179411"
"bidder": "juno19s3l3wh5a3w5dpyv6v2342aej39mwmjea8vpsn",
"amount": "2000",
"timestamp": "1664402318133803263"
After the Auction has concluded, it is time to claim the NFT for the buyer and Funds for the seller.


"claim": {
"token_id": "1",
wasm execute juno1gu9dxksczas9l0gl7x2dmmum7k555mu2g724zv5839363w0p53wqweuq9h '{"claim": {"token_id": "1","token_address":"juno16802hcvuxjqlvl8c7j20ltgtlk5gecqw2qgrxnugc934f0n4y6rsnxtz79"}}'
You can see in the transaction details that 0.002 JUNOX were sent to our selling address which is the amount of the winning bid.


Congratulations, we have built a fully functioning auctioning App that allows you to auction off your NFTs. Keep in mind that all the apps we build in these examples are highly customizable to satisfy user needs. We can change the accepted funds, add/remove whitelists, and even add more components to our App if needed.