Contract Deployment(Starton)
Already know what you're doing?
RPC URL:
https://rpc.matchain.io
ChainID:
698
Bridge or request gas sponsorship from our team
Welcome to the Matchain Mainnet smart contract deployment tutorial! Follow these steps to deploy your first smart contract using Starton. If you would prefer to use Remix, check out this guide. Let's create a project to deploy a smart contract from code using Starton's API.
Step 1 - Initialize the project
1. Start by creating a directory for your project:
Copy
2. Then, get into your project directory:
Copy
3. With your project directory set up, install the dependencies:
Copy
4. Then, use touch to create a index.js file and open it with your favorite editor.
Copy
Step 2 - Add starton to your project
1. First, import axios
Copy
2. Then, initialize axios using Starton URL and authenticate with your API KEY.To create an API key, go to the Deploying your first Smart contract on Matchain Developer section
Copy
Step 3 - Creating a wallet
Before we can continue you will need a backend Wallet to sign our transaction.
Backend Wallet Backend Wallet uses a KMS. Metamask is unavailable whenusing Starton from code. Since it is a browser extension,Starton API cannot access it from your project. For more information, see: Understanding Key Management Systems
We recommend you to create your wallet on Starton web application, but you canalso create it from code if you'd like to automate it.
1. Go to Matchain Dashboard, and click Wallet.
2. Click + Wallet.
Step 4 - Deploy your ERC20 token
For this tutorial, you will deploy your own ERC20 token. Starton provides you with a library of smart contracts templates. Learn more.
1. Now, let's write your first API call!
Copy
Congratulations on your first request.
Let's dive into what we just did:
- The endpoint/v3/smart-contract/from-template allows you to deploy audited smart contracts. You can also deploy smart contract your own code, or import an existing contract Deploying your first Smart contract on Matchain 4- We used the Starton KMS to sign the transaction and pay gas fee. This allows you to automatetransactions, but also to sponsor the end-user fees with gas less transaction - We used a ERC20 template. You can find more templates inStarton Library - We had to put 18 zeros after "10000" as the smart contract will read the amount in wei (the equivalent of cents, except there are 18 decimals and not 2). - We selected an average speed for your transaction. But with Starton everything is customizable. You can also set up a gas strategy to automate the management of your transactions.
2. Almost done! Now we can execute it to get our first contract deployed
Copy
3. Check all of your transactions on Matchain Web Application
Congratulations on deploying your first smart contract! In this tutorial, you discovered how to deploy your first smart contract but this is only the first step.
Last updated