Skip to main content

Smart contracts

Smart contracts are computer programs that are executed on a DLT network. They are used to automate the execution of a contract or agreement between two or more parties.

Smart contract template

A smart contract template is a program ready to be deployed on a DLT network. The template contains the compiled specification of the smart contract, which can be versioned and deployed multiple times on the same network.

For example, a smart contract template can be a specification that implements a token standard, such as ERC-20. This template can be deployed multiple times on a ledger to create different tokens.

Supported languages

MARCO supports uploading smart contract templates written in the following technologies:

DLTSmart contract language
EthereumSolidity
HyperLedger FabricChaincode

Directory structure

MARCO smart contract templates must adhere to a specific directory structure. The table below outlines the required files and directories:

FileDescription
manifest.jsonMARCO manifest file. For more details, see manifest.json
contracts/Directory containing the smart contract source code in one of the supported languages.

Smart contract templates uploaded to MARCO must be compressed in a .zip file.

tip

Looking for inspiration? Download the Hello World sample smart contract template for Ethereum here.

manifest.json

The manifest.json file provides information about the smart contract template, enabling the MARCO platform to recognize the contract. The table below highlights the required fields:

FieldDescription
contractSpecifies the name of the index file containing the smart contract details within the contracts folder.

Example:

{"contract": "HelloWorld"}

Compiled smart contract

When you upload a smart contract as a template via the MARCO Console, the platform transforms the smart contract's by compiling the high-level code (like Solidity for Ethereum contracts) into a machine-readable format.

Alternatively, you can compile the contract locally and deploy the contract via the MARCO API.

Application Binary Interface (ABI)

The ABI is like a bridge connecting smart contracts to external programs, like other contracts or user interfaces. It is a set of rules that describes how to interact with the contract's functions and data.

Example for Ethereum:

[
{
"inputs":[
{
"name":"value",
"type":"string"
}
],
"type":"constructor"
}
]

Bytecode

The bytecode is the smart contract code in a form that the blockchain can understand and use.

Example for Ethereum:

0x6060604052341561000...5b6f4e647c2844f4e1c8cf1d8e037c72

Smart contract instance

A smart contract instance is a specific instance of a compiled smart contract already deployed on a DLT network.

Following the previous example, a smart contract instance can be a specific ERC-20 token contract deployed on the Ethereum mainnet.

Smart contract group

A contract group works just as a folder to keep your smart contract instances organized.

See also