GLO specification
The Generic Ledger Operation (GLO) specification defines a standard, language-agnostic interface to define operations that can be performed on any Distributed Ledger Technology (DLT).
Versions
The GLO specification is subject to change to adapt to the constantly changing nature of ledger technologies. For this reason, the structure is versioned using Semantic Versioning.
The current version is 0.1.0
.
GLO structure
GLOs are represented as JSON objects. The following is a list of the fields that are common to all GLOs:
Field | Type | Description |
---|---|---|
version | string | Required Version of the GLO structure. |
type | GLO Type enum | Required Type of operation to be performed on a given DLT network. |
options | GLO Options object | Required Ledger-agnostic options of the operation. |
meta | GLO Meta | Ledger-specific options of the operation. |
Example:
{
"version": "0.1.0",
"type": "transfer",
"options": {
"recipient": {
"lookup_service": {
"type": "ledger",
"value": "ethereum"
},
"resource": "0xfea8e07b145bb611a4b5ab5c015f3cc3644c083a"
},
"amount": 0
}
}
Schemas
GLO Type enum
List of supported GLO types:
transfer
: Transfer of native currency funds.contract_call
: Method call of a deployed smart contract.contract_deploy
: Deployment of a smart contract.
GLO Options object
The body of the operation is generic for all ledger technologies MARCO supports. This object structure varies depending on the type of operation.
transfer
options
An object representing the transfer
GLO options.
Field | Type | Description |
---|---|---|
recipient | Resource Locator object | Required. Resource locator of the recipient of the funds. |
amount | string or number | Required. Amount of native currency to transfer to recipient. |
Example:
{
"recipient": {
"lookup_service": {
"type": "ledger",
"value": "ethereum"
},
"resource": "0xfea8e07b145bb611a4b5ab5c015f3cc3644c083a"
},
"amount": 0
}
contract_call
options
An object representing the contract_call
GLO options.
Field | Type | Description |
---|---|---|
contract_instance | Resource Locator object | Required. Smart contract instance locator. |
method_name | string | Required. Method of the contract instance to be called. |
args | List of strings | List of arguments passed to the method in the order defined. |
Example:
{
"contract_instance": {
"lookup_service": {
"type": "ledger",
"value": "ethereum"
},
"resource": "0x8b0b7b8c7c7a4b2b4ab15c6d62a01a019b44b827"
},
"method_name": "set",
"args": ["0x1234567890123456789012345678901234567890", "0x1234567890123456789012345678901234567890"]
}
contract_deploy
options
An object representing the contract_deploy
GLO options.
Field | Type | Description |
---|---|---|
contract_source | Resource Locator object | Required. Smart contract source locator. |
args | List of strings | Arguments used to initialise the contract. |
Example:
{
"contract_source": {
"lookup_service": {
"type": "marco",
"value": "marco"
},
"resource": "SCT-oNO0BYzLnho:0.0.1"
},
"args": ["Hello World!"]
}
GLO Meta object
An object that is used to specify native ledger-specific options for an operation. Its content varies depending on the DLT being used.
For example, when using the Ethereum ledger, the native_transaction_content
field can be used to specify options specific to Ethereum transactions, such as the gasPrice
and gasLimit
.
Example:
{
"ledger": {
"ethereum": {
"version": "0.0.1",
"native_transaction_content": {
"gasPrice": "0",
"gasLimit": "0"
}
}
}
}
If there is a conflict between the GLO Options
object and the GLO Meta
object, the latter takes precedence.
ethereum
options
An object representing the specific metainformation for Ethereum operations.
Within the meta.ledger.ethereum.native_transaction_content field
, the following options are available:
Field | Type | Description |
---|---|---|
from | string (hexadecimal) | The Ethereum-native sender address that will be signing the transaction. |
to | string (hexadecimal) | The receiving Ethereum-native address. |
data | string | An optional field to include arbitrary data. |
chainId | number or string (hexadecimal) | The id of the chain to prevent replay attacks. For more information, see EIP-155 |
nonce | string (hexadecimal) or number | A sequentially incrementing counter which indicates the transaction number from the account |
value | string (hexadecimal) or number | The amount of ether to transfer in WEI (the smallest denomination of ether). |
gasPrice | string (hexadecimal) or number | The price per unit of gas in WEI that the sender is willing to pay. |
gasLimit | string (hexadecimal) or number | The maximum amount of gas that the sender is willing to spend on the transaction. |
For more information, see Ethereum transactions.
Example:
{
"ledger": {
"ethereum": {
"version": "0.0.1",
"native_transaction_content": {
"from": "0x1234567890123456789012345678901234567890",
"to": "0x1234567890123456789012345678901234567890",
"data": "0x1234567890123456789012345678901234567890",
"chainId": 1,
"nonce": 0,
"value": 0,
"gasPrice": 0,
"gasLimit": 0
}
}
}
}
Resource Locator object
A resource locator object contains the information to retrieve wallets, smart contract template, or instance details from MARCO or DLT network.
This object has the following fields:
Field | Type | Description |
---|---|---|
lookup_service.type | string | Required. Lookup service to use. Available values: marco , ledger . |
lookup_service.value | string | Required. Specific lookup service. It varies depending on the type selected. |
resource | string | Required. Resource identifier in the lookup service. |
marco
type
When lookup_service.type
is set to marco
, the lookup_service.value
field must be set to marco
.
The resource
field is the MARCO platform's wallet, smart contract template, or instance identifier.
Example:
{
"lookup_service": {
"type": "marco",
"value": "marco"
},
"resource": "WAL-62EPFgDCGOM"
}
ledger
type
When lookup_service.type
is ledger
, the lookup_service.value
field can be set to any of the following DLTs:
ethereum
: Ethereum network.hyperledger-fabric
: Hyperledger Fabric network.
lookup_service.value
must match the DLT where you want to execute the operation.
The field resource
is the account or smart contract address in the DLT network.
Example:
{
"lookup_service": {
"type": "ledger",
"value": "ethereum"
},
"resource": "0xfea8e07b145bb611a4b5ab5c015f3cc3644c083a"
}