Update modified contracts on the testnet
In the first step of this tutorial, you started the project on the testnet. The script uploaded the initial contracts on the network for you.
Now that you implemented and tested your changes locally on the emulator, it is time to deploy your modified smart contracts to the testnet.

Run the project on the testnet again. The script will use the account you initially created:
Important: You do not need to stop the previous process. By running the next command, existing services will be configured to communicate with the testnet instead of the emulator.
1npm run dev:testnet
You will be asked if you want to use the existing account credentials. Enter Y
to continue:
1? Use existing testnet credentials in env.testnet ? (Y/n) Y
Once all services are up and running, you will see the same logs you saw in the second step:
1✔ API server started2ℹ Kitty Items API is running at: http://localhost:30003ℹ View log output: npx pm2 logs api45✔ Storefront web app started6ℹ Kitty Items Web App is running at: http://localhost:30017ℹ View log output: npx pm2 logs web89KITTY ITEMS HAS STARTED101112Visit: http://localhost:3001131415View your account and transactions here:16https://testnet.flowscan.org/account/0xa4c19ed9d691743c1718Explore your account here:19https://flow-view-source.com/testnet/account/0xa4c19ed9d691743c2021? Would you like to view the logs for all processes? (Y/n)
Open up the last link to explore your testnet account via flow-view-source. On the left side navigation, locate the Kitty Items contract.
Keep this page open - we will get back to it once we are done!
Next, redeploy the contracts to the testnet by running the following command in your terminal, inside the root folder of your project:
Note: You will notice that the previous script execution finished once all services successfully started. You do not need to stop the previous process. You can run the next command in the same terminal without impact on the services running in the background.
1npm run update:testnet
The script will update the changed contract:
1Deploying 1 contracts for accounts: testnet-account23KittyItems -> 0x580b8132bc817403 (ba7f...bdc88)45✨ All contracts deployed successfully
Note: You may notice that this time only one contract was updated. This is because the other 3 contracts were already deployed outside of this project.
Go back to the flow-view-source page and refresh the contract view. Scroll down verify the changes you made to your contract. For instance, you should see shades
case in the Kind
enum.
Finally, run the following command to send the transaction to update the contract with the new shades
images on the testnet.
1npx dotenv -e .env.testnet -- flow transactions send --signer testnet-account ./cadence/transactions/kittyItems/add_nft_images_for_new_kind.cdc -f flow.json -f flow.testnet.json -n testnet
You should see the following response. Take note of the Status - it should be ✅ SEALED
.
1Transaction ID: 60f0271a0ab31173f577300a058d644f5752f1fea844bc1ec6c89eafc870873723Status ✅ SEALED4ID 60f0271a0ab31173f577300a058d644f5752f1fea844bc1ec6c89eafc87087375Payer 36e0834a80d3a3606Authorizers [36e0834a80d3a360]78Proposal Key:9Address 36e0834a80d3a36010Index 011Sequence 51213No Payload Signatures1415Envelope Signature 0: 36e0834a80d3a36016Signatures (minimized, use --include signatures)1718Events:19Index 020Type A.36e0834a80d3a360.KittyItems.ImagesAddedForNewKind21Tx ID 60f0271a0ab31173f577300a058d644f5752f1fea844bc1ec6c89eafc870873722Values23- kind (UInt8): 52425Index 126Type A.7e60df042a9c0868.FlowToken.TokensWithdrawn27Tx ID 60f0271a0ab31173f577300a058d644f5752f1fea844bc1ec6c89eafc870873728Values29- amount (UFix64): 0.0000100030- from (Address?): 0x36e0834a80d3a3603132Index 233Type A.7e60df042a9c0868.FlowToken.TokensDeposited34Tx ID 60f0271a0ab31173f577300a058d644f5752f1fea844bc1ec6c89eafc870873735Values36- amount (UFix64): 0.0000100037- to (Address?): 0x912d5440f7e3769e3839Index 340Type A.912d5440f7e3769e.FlowFees.FeesDeducted41Tx ID 60f0271a0ab31173f577300a058d644f5752f1fea844bc1ec6c89eafc870873742Values43- amount (UFix64): 0.0000100044- inclusionEffort (UFix64): 1.0000000045- executionEffort (UFix64): 0.00000012
As indicated, the transaction was sealed and you are ready to mint your new KittyItems NFT on the testnet!
🎉 Congratulations on completing this tutorial! Because you made it to the very end, we're rewarding you with a unique FLOAT NFT!
Important: To claim your NFT, open this FLOAT event. You will be asked to connect a wallet. Once done, you need to enter a secret code. Open the
add_nft_images_for_new_kind.cdc
file you created in this previous step. Locate the comment beforeexecute{}
. Use this code to claim your NFT 🤫
To summarize, you should now understand how to ...
- deploy and update smart contracts
- mint and transfer NFTs
- add a new kind of NFT to the marketplace
- interact with the Flow blockchain from within a web application
To verify that everything works as expected, you can mint one of the new NFTs on the testnet.
Open the Kitty Items web application: http://localhost:3001/
. This time, the web application is wired up to interact with testnet smart contracts you updated. Repeat the instructions from the last step.