Skip to main content

Deploying a Smart Contract

To deploy a smart contract with Starton you have three options:

  • Deploy a smart contract using an audited contract template from our library
  • Deploy your own smart contract using its bytecode and ABI
  • Import existing contract to view them on your dashboard and interact with them.

You can deploy a smart contract from templates directly from code using the Relayer or using the Dashboard.

To deploy a smart contract from the code of your application, use the following snippet. You can find the full list of templates in our API reference.

You will need the ID of the template we got in order to tell which template to use for the contract creation.

We also need to provide values for the parameters of our smart contract’s constructor.

const axios = require("axios")

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

startonAPI
.post("/v3/smart-contract/from-template", {
network: "ethereum-sepolia",
templateId: "ERC20_MINT_META_TRANSACTION",
name: "My token with starton",
signerWallet: "0x694F07CEEc0869aa0dB5E8157FA538268F28B23f",
description: "Description on my token",
params: ["DemoToken", "DEMO", "1000000000000000000000000", "0x694F07CEEc0869aa0dB5E8157FA538268F28B23f"],
})
.then((res) => console.log(res.data))
.catch((e) => console.log(e))

Here is the expected response:

{
"id": "ERC20_META_TRANSACTION",
"name": "DemoToken",
"description": "Our own crypto token.",
"network": "ethereum-sepolia",
"bytecode": " … ",
"abi": [],
"projectId": "prj_f2108b28949d47898a39939cbc7277c3",
"address": "0xDA96a733ec2C3eC1142A5A1Ef31cfd7755CAE037",
"creationHash": "0xef4313209959d6441e14db5d43905f674a78adba2173b522b7fe37311e135c05",
"createdAt": "Tue Jun 29 2021 13:09:17 GMT+0000 (Coordinated Universal Time)",
"updatedAt": "Tue Jun 29 2021 13:09:17 GMT+0000 (Coordinated Universal Time)"
}

To learn more on how to deploy a smart contract from a template, see our full tutorial.