Smart Contracts

Smart Contracts Overview

Basic Information Lua Contract Language MagnaChain’s smart contract is written in Lua and is modified from the official 5.1 version. Most of the syntax is reserved. The number type is changed to long long; no other data types have been modified. We also removed security-related basic libraries (e.g. io, os, etc.) and floating-point related operation […]

Publishing Smart Contracts

How It Works The publisher publishes the written Lua file locally. Lua’s virtual machine built into MagnaChain parses it into bytecodes, stores it in the transaction data, and calculates the relevant fees, then returns the address of the contract. Command line format: publish ${ContractFilePath} parameters: @ContractFilePath[string,required,1]-> The absolute path of the contract file to publish. […]

Calling Smart Contracts

How It Works The publisher or other user can find the bytecode corresponding to the contract through the returned contract address, load it into the Lua virtual machine, and call the interface on the contract to complete the transaction with relevant parameters. After the transaction is completed, the relevant fees will be deducted based on […]

Starting a Node

Step 1: Connect to the network (currently our testnet) On Linux magnachaind -daemon On Windows celld.exe   Step 2: Specify data path Default on Linux ~/.magnachain Default on Windows C:\Users\$username\$AppData\Roaming\MagnaChain   Step 3: Specify startup parameters Common parameters: -daemon -> background process -printtoconsole -> log output to the console -datadir=your_dir -> specify the data directory […]

Not finding the answer you need? Ask a question on our forum and a technical team member will be in touch to provide the information you need.
Go to Forums