Deploy a Smart Contract
If you are new to the space, we recommend using Remix IDE to develop, compile, and deploy your contracts. It has one of the most intuitive UIs amongst the existing EVM IDEs compatible with PHI Network, making the experience effortless.You can access it using your browser: https://remix.ethereum.org/
- A desktop or laptop computer
- MetaMask or another browser based wallet
- Enough PHI to pay for the gas fees
Once in Remix, create a new file/folder using the icons below your workspace dropdown (see below). Make sure your file name includes the the '.sol' extension, so it’s recognized as a Solidity file. Once the file is created, all you need to do is start putting together your code. You can copy our open-source code for a simple PHI20 token in our Classic PHI-20 Token page if you need a starting point.
Once you have finished coding, you will have to compile your contract. To do so, click on the 'Compile' button on the left-hand side menu on Remix. Make sure that the Solidity version specified in the contract matches the Solidity version of your compiler. When you’re satisfied with your code and your compiler is set up, simply press the compile button.
Once you have compiled your contract successfully, it's time to deploy! First, change the 'Environment' dropdown to Injected Web3, so that Remix sends the transaction to your browser wallet, rather than your localhost. With that done, make sure to fill any required fields from your smart contract compilation using the 'Contract' dropdown - in this example, specifying the name of the token, symbol, and decimals - and then click on 'Transact' to send the deployment transaction to your wallet.
Once confirmed, it will be sent to the blockchain, and Remix will provide you a 'Success' message, along with your newly created contract address.
All done! Now you have your contract and can start using it straight away. To add it to your MetaMask or any browser wallet, copy the address, click on 'Import Token' on your wallet, and paste it there.