LogoLogo
  • Overview
  • Getting Started
    • Using Mainnet
    • Wallet Configuration
    • Using DApps
    • Technical Architecture
  • Utilities
    • Fees
    • Bridges
    • Block Explorers
    • Oracles
    • Data Indexer
  • Development
    • Private RPC Providers
    • Contract Deployment(Remix)
    • Contract Deployment(Starton)
    • NFT APIs
    • Account Abstraction
    • Contracts
    • Running Matchain Node
  • Links
    • Network Status
    • Rollup info page
    • Matchain Website
Powered by GitBook
LogoLogo

All Rights Reserved © 2024 Matchain

On this page

Was this helpful?

  1. Development

Contract Deployment(Starton)

PreviousContract Deployment(Remix)NextNFT APIs

Last updated 6 months ago

Was this helpful?

Already know what you're doing?

  • RPC URL: https://rpc.matchain.io

  • ChainID: 698

  • or request gas sponsorship from our team

Welcome to the Follow these steps to deploy your first smart contract using Starton. If you would prefer to use , check out this guide. Let's create a project to deploy a smart contract from code using

Step 1 - Initialize the project

1. Start by creating a directory for your project:

Copy

bash mkdir matchain-deploy

2. Then, get into your project directory:

Copy

bash cd matchain-deploy

3. With your project directory set up, install the dependencies:

Copy

bash npm add axios

4. Then, use touch to create a index.js file and open it with your favorite editor.

Copy

bash touch list.js

Step 2 - Add starton to your project

1. First, import axios

Copy

jsx const axios = require("axios")

Copy

const starton = axios.create({
 baseURL: "https://api.starton.com",
 headers: {
 "x-api-key": "YOUR API KEY",
 },
})

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.

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

starton.post("/v3/smart-contract/from-template", {
 "network": "matchain-mainnet", // you can choose any network
 "signerWallet": "YOUR STARTON WALLET", // This will be the w
 "templateId": "ERC20_META_TRANSACTION", // you can choose an
 "name": "My first smart token", // the name that will be dis
 "description": "This is the first smart contract I deploy. "
 "params": [
 "My first token ", // Your smart contract name, on chain
 "MFT", // the symbol of your token
 "10000" + "000000000000000000", // 10000 token supply +
 "ANY WALLET YOU WANT" // The wallet that will receive th
 ],
 "speed": "average", // The fees you will pay on chain. More
}).then((response) => {
 console.log({
 transactionHash: response.data.transaction.transactionHa
 smartContractAddress: response.data.smartContract.addres

 })
}).catch(error => console.error(error.response.data))

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

bash node list.js

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.

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

1. Go to Matchain , and click .

3.

Add
Matchain
Bridge
Matchain Mainnet smart contract deployment tutorial!
Remix
Starton's API.
Developer section
Dashboard
Wallet
Check all of your transactions on Matchain Web Application