--- tags: ncd title: NEAR Certified Developer -4- Day 4 description: This course is an opportunity for web developers to earn a Certificate of Completion that represents the ability to design, develop, test and deploy smart contracts on the NEAR platform. image: https://near.org/wp-content/themes/near-19/assets/downloads/near_logo.svg GA: UA-188414449-3 --- # Day 4 ## Deploying web 3 *Learn to deploy smart contracts to TestNet* --- ### :sparkles: The goal for today is to deploy your contracts and verify they work. :sparkles: --- When we say "application" on NEAR we usually mean software that has been written to define: - software that has been written to define - (a) **on**-chain data and behavior **controlled by smart contracts** (eg. NFT contract) - (b) **off**-chain data and behavior **communicating with smart contracts** (eg. web app) We have looked at many contracts and applications this week and now we will deploy them. Deploying to MainNet is out of scope so we will focus on TestNet and, as bonus activity, LocalNet where you can build in private. Anything that runs on TestNet should work just as well on MainNet. This is the only purpose of TestNet, in fact: to provide a full preview of our work before we take it live on MainNet. :::success ### :green_book: CORE Activities ::: 1. **Reserve your demo spot** by completing the form below. You must participate (with a team or by yourself) in the development of a demo to earn a certificate. If your demo is solo (just you) then please fill out the form below with your information. If your demo is team (you and others) then fill out the form below ONLY ONCE and include all the names of people on the team. [**[ REGISTER for your demo slot ]**](https://airtable.com/shrYTxIqins8n6xaE) > _To earn your certificate of completion, you MUST deliver a demonstration of your work at the end of this week (tomorrow). If you are not ready for a demo tomrrow then you are welcome to wait until the next time we run this course and deliver a demo on that Friday - Demo Day_ 2. Watch [this orientation video](https://www.loom.com/share/86f241b15eba4424ac483ab517195705) about today's challenge. 3. Deploy at least one application to TestNet - Choose any one (or more) of the contracts and applications you saw on Day 1 and Day 2. It doesn't matter, when deploying, whether the application is written in Rust or AssemblyScript. All contract code is compiled to WebAssembly and deployed to the network to be run inside a Wasm-compatible virtual machine. You will use a command like `yarn dev` for most applications but you can just as easily deploy an application using NEAR CLI with [`near dev-deploy`](https://docs.near.org/docs/tools/near-cli#near-dev-deploy) for TestNet (or [`near deploy`](https://docs.near.org/docs/tools/near-cli#near-deploy) if you have already created an account). 4. Verify the application was deployed - Use [NEAR Explorer](https://explorer.testnet.near.org) to verify the deployment (find evidence of the deployment to the [target account](https://explorer.testnet.near.org/accounts/dev-1614258294715-7729054) to which the contract was deployed) - Use NEAR CLI to issue the command [`near state <contract-account>`](https://docs.near.org/docs/tools/near-cli#near-state) and notice that the `code_hash` is not the default value of all `1`s 5. Verify your use of the application - Use [NEAR Explorer](https://explorer.testnet.near.org) to verify the deployment (find a record of any transactions related to [your account](https://explorer.testnet.near.org/accounts/sherif.testnet) or related the target account to which the contract was deployed) :::info ### :blue_book: BONUS Activities *If you have the time to look around the corner, here's a little more for you.* ::: 1. Install [`nearup`](https://github.com/near/nearup) and get a [local node running](https://github.com/near/nearup#spawn-a-local-network). This will include: - installing `nearup` and `nearcore` prerequisites - compiling `nearcore` (this can take a long while) - running `nearup` with reference to the previously compiled `nearcore` binary 2. Make sure you read through the `nearup` documentation (the README of the repository) for details on setup. 4. You will end up with a 4-node LocalNet. To create an account you will have to use one of the node validator keys which you will find in your home directory (below is from MacOS) --- This is what the filesystem will look like for your LocalNet keystore ```shell /Users/sherif/.near/localnet ├── node0 │ ├── config.json │ ├── data │ ├── genesis.json │ ├── node_key.json │ └── validator_key.json <-- open one of these files ├── node1 │ ├── config.json │ ├── data │ ├── genesis.json │ ├── node_key.json │ └── validator_key.json ├── node2 │ ├── config.json │ ├── data │ ├── genesis.json │ ├── node_key.json │ └── validator_key.json └── node3 ├── config.json ├── data ├── genesis.json ├── node_key.json └── validator_key.json ``` :::warning ### :orange_book: Going Deeper *If you're feeling fearless, here's about as far as you might take this road in a day* ::: It's time to prepare for your demos!