Getting started contract deployment in Patex Network
This tutorial teaches you the basics of Patex development. Patex is EVM equivalent, meaning we run a slightly modified version of the same geth you run on mainnet. Therefore, the differences between Patex development and Ethereum development are minor.
For development purposes we recommend you use either a local development node on Patex Sepolia Testnet. That way you don't need to spend real money. If you need ETH on Patex Sepolia for testing purposes, you can use this faucet.
As you can see in the different development stacks below, the way you deploy contracts and interact with them on Patex is almost identical to the way you do it with L1 Ethereum. The most visible difference is that you have to specify a different endpoint (of course).
Follow these steps to add Patex Sepolia support to an existing Hardhat project (or a newly created one).
Define your network configuration in .env:
# Put the mnemonic for an account on Patex here
MNEMONIC=test test test test test test test test test test test junk
# URL to access Patex Sepolia
PATEX_SEPOLIA_URL=https://test-rpc.patex.io
Follow these steps to add Patex Sepolia support to an existing Truffle project.
Define your network configuration in .env:
# Put the mnemonic for an account on Patex here
MNEMONIC=test test test test test test test test test test test junk
# URL to access Patex Sepolia
PATEX_SEPLOIA_URL=
Add dotenv and @truffle/hdwallet-provider to your project:
Select the Environment Injected Provider - MetaMask.
Accept the connection in the wallet.
Greeter interaction
Click the run icon ().
Make sure your environment is Injected Web3 and the network ID is 471100.
Click the files icon ().
Download Greeter.sol and upload () it to Remix under contracts.
Right-click contracts > Greeter.sol and select Compile.
Open contracts > artifacts and see that there's a Greeter.json file. This file is the compiled version, the API for the contract, etc.
Click the run icon ().
Scroll down. In the At Address field, type the contract address 0x317ccBB804c1f104b0fA1495B625c87F66091745. Then, click At Address. Expand the contract to see you can interact with it.
Click greet and expand the transaction result in the console (bottom right).
Type a greeting (preferably, one that starts with the word Remix) and then click setGreeting. Approve the transaction in your wallet. Note that if the greeting includes a comma you need to enclose it in quotes.
See the results on the console and then click greet again to see the greeting changed (see it under the greet button).
After you are done with that development, debug your decentralized application using either the Sepolia test network. This lets you debug parts that are Patex specific such as calls to bridges to transfer assets between layers.
Only when you have a version that works well on a test network should you deploy to the production network, where every transaction has a cost.
Contract source verification
You don't have to upload your source code to block explorers, but it is a good idea. On the test network it lets you issue queries and transactions from the explorer's user interface. On the production network it lets users know exactly what your contract does, which is conducive to trust.
Just remember, if you use the Patexscan API, you need one API key for Patex and a separate one for Patex Sepolia.