# Deployment

#### Deploying on a Local Network

1. **Compile the contract**:

   ```bash
   npx hardhat compile
   ```
2. **Deploy the contract**: Create a script `/scripts/deploy.js`:

   ```javascript
   async function main() {
     const Contract = await ethers.getContractFactory("MyContract");
     const contract = await Contract.deploy();
     console.log("Contract deployed to:", contract.address);
   }

   main()
     .then(() => process.exit(0))
     .catch((error) => {
       console.error(error);
       process.exit(1);
     });
   ```
3. **Run the deployment script**:

   ```bash
   npx hardhat run scripts/deploy.js --network localhost
   ```

#### Deploying on Testnet&#x20;

1. **Configure Networks in Hardhat**: Edit `hardhat.config.js` to include testnet configurations:

   ```javascript
   codemodule.exports = {
     networks: {
       phron: {
         url: "https://testnet.phron.ai",
       }
     },
     solidity: "0.8.4",
   };
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.phron.ai/build-with-phronai/smart-contracts-development/solidity-contracts/phron-api/deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
