Skip to content

5. Construction API Reference

syuan100 edited this page Aug 27, 2021 · 3 revisions

Construction

Reference: https://www.rosetta-api.org/docs/ConstructionApi.html


/construction/combine

https://www.rosetta-api.org/docs/ConstructionApi.html#constructioncombine

Request:

Schema

Helium specific notes:

Object Type Description
unsigned_transaction string Unsigned transaction encoded as a base64 string. Derived from /construction/payloads.
signing_payload SigningPayload Transaction protobuf encoded as a hex string. Derived from /construction/payloads.
public_key PublicKey Account public key encoded as a hex string.
signataure > hex_bytes string Resulting signature after the signing_payload has been signed (encoded as a hex string). This must be derived separately outside of Rosetta since Rosetta does NOT handle private keys.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "unsigned_transaction": "...",
    "signatures": [
        {
            "signing_payload": {
                "address": "...",
                "hex_bytes": "..."
            },
            "public_key": {
                "hex_bytes": "...",
                "curve_type": "edwards25519"
            },
            "signature_type": "ed25519",
            "hex_bytes": "..."
        }
    ]
}

Response:

Schema

Helium specific notes:

Object Type Description
signed_transaction string Signed transaction encoded as a base64 string. Should be directly passed to /construction/submit
{
    "signed_transaction": "..."
}

/construction/derive

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionderive

Request:

Schema

Helium specific notes:

Object Type Description
public_key string Raw public key converted to a hex string. Cannot contain bytes for Helium specific properties like netType or keyType.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "public_key": {
        "hex_bytes": "...",
        "curve_type": "edwards25519"
    }
}

Response:

Schema

{
    "address": "...",
    "account_identifier": {
        "address": "..."
    }
}

/construction/hash

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionhash

Request:

Schema

Helium specific notes:

Object Type Description
signed_transaction string Signed transaction encoded as a base64 string. Derived from /construction/combine.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "signed_transaction": "..."
}

Response:

Schema

Helium specific notes:

Object Type Description
hash string base64url encoded hash of the transaction. This is the main identifier for transactions on the Helium blockchain.
{
    "transaction_identifier": {
        "hash": "..."
    }
}

/construction/metadata

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionmetadata

Request:

Schema

Helium specific notes:

Object Type Description
options object Contains specific metadata requests generated from /combine/preprocess. If you'd like to create your own options object, see transaction specific documentation for metadata here. (TBD) Example below is for a payment_v2 transaction.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "options": {
        "helium_metadata": {
            "payer": "...",
            "payments": [
                {
                    "amount": 10000000,
                    "payee": "..."
                }
            ]
        },
        "requested_metadata": {
            "get_nonce_for": {
                "address": "..."
            }
        },
        "transaction_type": "payment_v2"
    }
}

Response:

Schema

Helium specific notes:

Object Type Description
metadata object Required helium metadata to complete transaction construction during submission to /construction/payloads. Usually always includes chain_vars and account nonce which are required for all transactions. Retains the original options object from /combine/preprocess so we are able to confirm intent.
{
    "metadata": {
        "chain_vars": {
            "allowPaymentV2Memos": true,
            "allowZeroAmount": false,
            "alphaDecay": 0.0035,
            "assertLocTxnVersion": 2,
            "batchSize": 400,
            ...
        },
        "get_nonce_for": {
            "nonce": 139
        },
        "options": {
            "requested_metadata": {
                "get_nonce_for": {
                    "address": "..."
                }
            },
            "helium_metadata": {
                "payer": "...",
                "payments": [
                    {
                        "amount": 10000000,
                        "payee": "..."
                    }
                ]
            },
            "transaction_type": "payment_v2"
        }
    }
}

/construction/parse

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionparse

Request

Schema

Helium specific notes:

Object Type Description
signed boolean Denotes whether or not the string represents a signed transaction.
transaction string Raw base64 transaction string to be parsed.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "signed": false,
    "transaction": "..."
}

Response

Schema

Helium specific notes:

Object Type Description
operations []Operation The transaction represented as an array of Operation objects. See Helium Operation reference (TBD) for how operations denote intent. Below is an example for a payment_v2 transaction with a single payment.
{
    "operations": [
        {
            "operation_identifier": {
                "index": 0
            },
            "type": "debit_op",
            "status": "SUCCESS",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "-10000000",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "debit_category": "payment"
            }
        },
        {
            "operation_identifier": {
                "index": 1
            },
            "type": "credit_op",
            "status": "SUCCESS",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "10000000",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "credit_category": "payment"
            }
        },
        {
            "operation_identifier": {
                "index": 2
            },
            "type": "debit_op",
            "status": "SUCCESS",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "0",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "dc_fee": 35000,
                "implicit_burn": false
            }
        }
    ]
}

/construction/payloads

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionpayloads

Request

Schema

Helium specific notes:

Object Type Description
operations []Operation An array of Operations that denote the intent to create a specific Helium transaction. See Helium Operation reference (TBD) for how operations denote intent. Below is an example for a payment_v2 transaction with a single payment.
metadata object Required helium metadata to complete transaction construction generated from /construction/metadata. Usually always includes chain_vars and account nonce which are required for all transactions. Retains the original options object from /combine/preprocess so we are able to confirm intent.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "operations": [
        {
            "operation_identifier": {
                "index": 0
            },
            "type": "debit_op",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "-10000000",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "credit_category": "payment"
            }
        },
        {
            "operation_identifier": {
                "index": 1
            },
            "type": "credit_op",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "10000000",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "credit_category": "payment"
            }
        }
    ],
    "metadata": {
        "chain_vars": {
            "allowPaymentV2Memos": true,
            "allowZeroAmount": false,
            "alphaDecay": 0.0035,
            "assertLocTxnVersion": 2,
            "batchSize": 400,
            "betaDecay": 0.002,
            ...
        },
        "get_nonce_for": {
            "nonce": 2
        },
        "options": {
            "requested_metadata": {
                "get_nonce_for": {
                    "address": "..."
                }
            },
            "helium_metadata": {
                "payer": "...",
                "payments": [
                    {
                        "amount": 10000000,
                        "payee": "..."
                    }
                ]
            },
            "transaction_type": "payment_v2"
        }
    }
}

Response

Schema

Helium specific notes:

Object Type Description
unsigned_transaction string Unsigned transaction encoded as a base64 string. To be passed to /construction/combine.
signing_payload SigningPayload Transaction protobuf encoded as a hex string, ready to be signed. To be passed to /construction/combine once the signature is derived. The signature must be derived separately outside of Rosetta since Rosetta does NOT handle private keys.
{
    "unsigned_transaction": "...",
    "payloads": [
        {
            "hex_bytes": "..."
        }
    ]
}

/construction/preprocess

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionpreprocess

Request

Schema

Helium specific notes:

Object Type Description
operations []Operation An array of Operations that denote the intent to create a specific Helium transaction. See Helium Operation reference (TBD) for how operations denote intent. Below is an example for a payment_v2 transaction with a single payment.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "operations": [
        {
            "operation_identifier": {
                "index": 0
            },
            "type": "debit_op",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "-10000000",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "credit_category": "payment"
            }
        },
        {
            "operation_identifier": {
                "index": 1
            },
            "type": "credit_op",
            "account": {
                "address": "..."
            },
            "amount": {
                "value": "10000000",
                "currency": {
                    "symbol": "HNT",
                    "decimals": 8
                }
            },
            "metadata": {
                "credit_category": "payment"
            }
        }
    ],
    "metadata": {}
}

Response

Schema

Helium specific notes:

Object Type Description
options object Contains specific metadata requests to be passed to /construction/metadata to retrieve the necessary information to construct a transaction. Example below is for a payment_v2 transaction.
{
    "options": {
        "helium_metadata": {
            "payer": "...",
            "payments": [
                {
                    "amount": 10000000,
                    "payee": "..."
                }
            ]
        },
        "requested_metadata": {
            "get_nonce_for": {
                "address": "..."
            }
        },
        "transaction_type": "payment_v2"
    }
}

/construction/submit

https://www.rosetta-api.org/docs/ConstructionApi.html#constructionsubmit

Request

Schema

Helium specific notes:

Object Type Description
signed_transaction string Signed transaction encoded as a base64 string. Derived from /construction/combine.
{
    "network_identifier": {
        "blockchain": "Helium",
        "network": "Mainnet"
    },
    "signed_transaction": "..."
}

Response

Schema

Helium specific notes:

Object Type Description
hash string base64url encoded hash of the submitted transaction. This is the main identifier for transactions on the Helium blockchain.
{
    "transaction_identifier": {
        "hash": "..."
    }
}