Skip to content

3. Transaction Reference

syuan100 edited this page Jul 29, 2021 · 4 revisions

Transaction Reference: Construction

Follow the guide below to create Helium transactions from Rosetta Operations.

Transaction
payment_v2

payment_v2

Order Op Name Notes
1 DebitOp
  • DebitOp must always come before a CreditOp.
  • DebitOp must have an Amount with a negative value.
  • Absolute value of Amount must be equal to Amount value in subsequent CreditOp
2 CreditOp
  • CreditOp must always come after a DebitOp.
  • CreditOp must have an Amount with a positive value.
  • Value of Amount must be equal to absolute value of Amount in previous DebitOp
1n DebitOp Repeat sets of DebitOp and CreditOps as desired to make multiple payments.
2n CreditOp See above.

Note: A final DebitOp representing a fee is not necessary for Helium since transaction fees are automatically set for every transaction type and cannot be modified by the user.

Example: Payment of 0.1 HNT

"operations": [
    {
        "operation_identifier": {
            "index": 0
        },
        "type": "debit_op",
        "account": {
            "address": "{{sending_address}}"
        },
        "amount": {
            "value": "-10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "debit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 1
        },
        "type": "credit_op",
        "account": {
            "address": "{{receiving_address}}"
        },
        "amount": {
            "value": "10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "credit_category": "payment"
        }
    }
]

Transaction Reference: Data

Follow the guide below to decode Rosetta Operations into Helium transactions.

Transaction
payment_v1
payment_v2

paymvent_v1

Order Op Name Notes
1 DebitOp
  • DebitOp must always come before a CreditOp.
  • DebitOp must have an Amount with a negative value.
  • Absolute value of Amount must be equal to Amount value in subsequent CreditOp
2 CreditOp
  • CreditOp must always come after a DebitOp.
  • CreditOp must have an Amount with a positive value.
  • Value of Amount must be equal to absolute value of Amount in previous DebitOp
3 DebitOp Dangling DebitOp represents the fee for the transaction.

Note: If fees are denoted in HNT, it means that an implicit burn has taken place and the DC transaction fee was calculated and deducted in HNT.

Example: Payment of 0.1 HNT

"operations": [
    {
        "operation_identifier": {
            "index": 0
        },
        "type": "debit_op",
        "account": {
            "address": "{{sending_address}}"
        },
        "amount": {
            "value": "-10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "debit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 1
        },
        "type": "credit_op",
        "account": {
            "address": "{{receiving_address}}"
        },
        "amount": {
            "value": "10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "credit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 2
        },
        "type": "debit_op",
        "status": "SUCCESS",
        "account": {
            "address": "{{sending_address}}"
        },
        "amount": {
            "value": "-2812136",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "implicit_burn": true
        }
    }
]

paymvent_v2

Order Op Name Notes
1 DebitOp
  • DebitOp must always come before a CreditOp.
  • DebitOp must have an Amount with a negative value.
  • Absolute value of Amount must be equal to Amount value in subsequent CreditOp
2 CreditOp
  • CreditOp must always come after a DebitOp.
  • CreditOp must have an Amount with a positive value.
  • Value of Amount must be equal to absolute value of Amount in previous DebitOp
1n DebitOp Repeat sets of DebitOp and CreditOps as desired to make multiple payments.
2n CreditOp See above.
*Final DebitOp Dangling DebitOp represents the fee for the transaction.

Note: If fees are denoted in HNT, it means that an implicit burn has taken place and the DC transaction fee was calculated and deducted in HNT.

Example: Payment to two different addresses of 0.1 HNT each

"operations": [
    {
        "operation_identifier": {
            "index": 0
        },
        "type": "debit_op",
        "account": {
            "address": "{{sending_address}}"
        },
        "amount": {
            "value": "-10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "debit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 1
        },
        "type": "credit_op",
        "account": {
            "address": "{{receiving_address_1}}"
        },
        "amount": {
            "value": "10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "credit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 2
        },
        "type": "debit_op",
        "account": {
            "address": "{{sending_address}}"
        },
        "amount": {
            "value": "-10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "debit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 3
        },
        "type": "credit_op",
        "account": {
            "address": "{{receiving_address_2}}"
        },
        "amount": {
            "value": "10000000",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "credit_category": "payment"
        }
    },
    {
        "operation_identifier": {
            "index": 4
        },
        "type": "debit_op",
        "status": "SUCCESS",
        "account": {
            "address": "{{sending_address}}"
        },
        "amount": {
            "value": "-2812136",
            "currency": {
                "symbol": "HNT",
                "decimals": 8
            }
        },
        "metadata": {
            "implicit_burn": true
        }
    }
]