Deploy a smart contract
In this guide, you will learn how to deploy a compiled Ethereum smart contract using the MARCO API.
Prerequisites
Before you start, complete the following prerequisites:
Step by step
To deploy a smart contract, send a POST
request to the Ledger Call endpoint as follows:
curl --location --request POST 'https://api-marco.finboot.com/v1/ledger-ops/ledger/call' \
--header 'ApplicationToken: <APPLICATION_TOKEN>' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"ledgerId": "<LEDGER_ID>",
"method": "deploy",
"params": ["<BYTECODE>","<ABI>","<PARAMETERS>"],
"options":{
"marco": {
"walletId": "<WALLET_ID>",
"dependencies": []
},
"plugin": {
"walletPassword": "<WALLET_PASSWORD>"
}
}
}'
Replace:
APPLICATION_TOKEN
: The marpp token. For guidance on obtaining this token, see the Quickstart guide.ACCESS_TOKEN
: The access token. For guidance on obtaining this token, see the Quickstart guide.LEDGER_ID
: The resource ID of the ledger where the contract will be deployed. For example,LGR-3c8de984e49
.BYTECODE
: The byte code of compiled smart contract. For example,0x6060604052341561000...5b6f4e647c2844f4e1c8cf1d8e037c72
.ABI
: The ABI of the smart contract. For example,'[{"inputs":[{"name":"value","type":"string"}],"type":"constructor"}]'
.PARAMETERS
: An array of the contract parameters in string format. If the contract does not have parameters, then send an empty array like"[]"
.WALLET_ID
: The resource ID of the wallet that will call the smart contract. For example,WAL-62EPFgDCGOM
.WALLET_PASSWORD
: The password of theWALLET_ID
.
Once the request is sent, the API returns an action ID and its status:
{
"actionId": "3dd80efc-3538-4a5e-9b31-4075565a4022",
"intent": "e3c8e28d-9a6f-4aed-8a3f-faa4e538b2df",
"status": "PENDING"
}
Next step
To retrieve the details of the operation, follow the Search transaction guide.