TxIn¶
- class blsct.TxIn(amount: int, gamma: int | Scalar, spending_key: Scalar, token_id: TokenId, out_point: OutPoint, staked_commitment: bool = False, rbf: bool = False)¶
Represents a transaction input used to construct CTxIn in a confidential transaction.
>>> from blsct import OutPoint, Scalar, TokenId, CTxId, TxIn, CTX_ID_SIZE >>> import secrets >>> amount = 123 >>> gamma = 100 >>> spending_key = Scalar() >>> token_id = TokenId() >>> ctx_id = CTxId.deserialize(secrets.token_hex(CTX_ID_SIZE)) >>> out_point = OutPoint(ctx_id) >>> tx_in = TxIn(amount, gamma, spending_key, token_id, out_point) >>> tx_in.get_amount() 123 >>> tx_in.get_gamma() 100 >>> tx_in.get_spending_key() SpendingKey(36bcc5eac63182e19...) >>> tx_in.get_token_id() TokenId(000000000000000000000...) >>> tx_in.get_out_point() OutPoint(31f41784d028c886a886...) >>> tx_in.get_staked_commitment() False >>> tx_in.get_rbf() False >>> ser = tx_in.serialize() >>> deser = TxIn.deserialize(ser) >>> ser == deser.serialize() True
- classmethod deserialize(hex: str) Self¶
Deserialize the TxIn from a hexadecimal string
- get_amount() int¶
Get the amount of the transaction input.
- get_gamma() int¶
Get the gamma value of the transaction input.
- get_rbf() bool¶
Get the replace-by-fee flag of the transaction input.
- get_staked_commitment() bool¶
Get the staked commitment flag of the transaction input.
- serialize() str¶
Serialize the TxIn to a hexadecimal string