Skip to content

3. Transaction Reference

syuan100 edited this page Aug 27, 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 (WIP)

Follow the guide below to decode Rosetta Operations into Helium transactions. Balance changing transactions include transactions with fees that are deducted from HNT accounts. Pass through transactions only contain metadata.

Balance changing transactions
payment_v1
payment_v2
reward_v1
reward_v2
security_coinbase_v1
security_exchange_v1
token_burn_v1
transfer_hotspot_v1
stake_validator_v1
unstake_validator_v1
transfer_validator_v1
add_gateway_v1
assert_location_v1
assert_location_v2
oui_v1
routing_v1
state_channel_open_v1
Pass-through Transactions
dc_coinbase_v1
state_channel_close_v1
gen_gateway_v1
poc_request_v1
poc_receipt_v1
consensus_group_v1
vars_v1
price_oracle_v1
create_htlc_v1*
redeem_htlc_v1*

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
        }
    }
]