# How to Deploy a Smart Contract

We recommend using an [online compiler](https://ethereum.github.io/browser-solidity/#optimize=false\&version=soljson-v0.5.7+commit.6da8b019.js) to compile smart contracts. If you want to test your smart contract, it’s better to deploy it on testnet first. You can install [Pchain testnet](https://github.com/pchain-org/pchain/wiki/How-to-sync-and-run-pchain's-testnet) and get [free tPI](https://testnet.pchain.org/vfaucet.html) from our testnet.

### Compile

Copy your code into it.

![](https://pchaindoc.readthedocs.io/en/latest/_images/contract.png)

Click **Details** button.

![](https://pchaindoc.readthedocs.io/en/latest/_images/compile1.png)

Copy the Byte Code and ABI/JSON Interface

![](https://pchaindoc.readthedocs.io/en/latest/_images/bytecode.png)

### Deploy

{% hint style="info" %}
You can only deploy smart contracts on the subchain.
{% endhint %}

Click on the "Contract" tab.

![](https://pchaindoc.readthedocs.io/en/latest/_images/contractpage.png)

Copy your byte code and click "Deploy Contract" button.

![](https://pchaindoc.readthedocs.io/en/latest/_images/deploy1.png)

Enter your password and send the transaction.

![](https://pchaindoc.readthedocs.io/en/latest/_images/maketransaction.png)

Wait for the contract address return and copy the address.

![](https://pchaindoc.readthedocs.io/en/latest/_images/address.png)

### Interact with Contract

Click "Interact with Contract" button, copy your ABI/JSON Interface into it and click "Access" button.

![](https://pchaindoc.readthedocs.io/en/latest/_images/abi.png)
