pub struct HashLockedForfeitBundle {
pub vtxo_id: VtxoId,
pub unlock_hash: UnlockHash,
pub user_nonces: HashLockedForfeitNonces,
pub forfeit_tx_part_sig: PartialSignature,
pub forfeit_claim_tx_part_sig: PartialSignature,
}Expand description
A bundle of signatures that forfeits a user’s VTXO conditional on the server revealing a secret preimage
In hArk, the forfeit protocol actually consists of two steps. First there is a tx that sends the money to an output that the server can claim if he provides the preimage, but that still has a timeout back to the user, to force the server to actually reveal the preimage before the new hArk VTXO expires. This output policy also has to contain the user’s pubkey, so the user that forfeits will have to provide a partial signature for both the spend from his VTXO to the forfeit tx and on a tx that spends the forfeit tx to the server’s wallet.
Fields§
§vtxo_id: VtxoId§unlock_hash: UnlockHash§user_nonces: HashLockedForfeitNonces§forfeit_tx_part_sig: PartialSignatureUser’s partial signature on the forfeit tx
forfeit_claim_tx_part_sig: PartialSignatureUser’s partial signature on the forfeit claim tx
Implementations§
Source§impl HashLockedForfeitBundle
impl HashLockedForfeitBundle
Sourcepub fn forfeit_vtxo(
vtxo: &Vtxo,
unlock_hash: UnlockHash,
user_key: &Keypair,
server_nonces: &HashLockedForfeitNonces,
) -> Self
pub fn forfeit_vtxo( vtxo: &Vtxo, unlock_hash: UnlockHash, user_key: &Keypair, server_nonces: &HashLockedForfeitNonces, ) -> Self
Create a new HashLockedForfeitBundle for the given VTXO
Sourcepub fn verify(
&self,
vtxo: &Vtxo,
server_nonces: &HashLockedForfeitNonces,
) -> Result<(), &'static str>
pub fn verify( &self, vtxo: &Vtxo, server_nonces: &HashLockedForfeitNonces, ) -> Result<(), &'static str>
Used by the server to verify if the partial signatures in the bundle are valid
Sourcepub fn finish(
self,
vtxo: &Vtxo,
server_pub_nonces: &HashLockedForfeitNonces,
[ff_sec_nonce, claim_sec_nonce]: [SecretNonce; 2],
server_key: &Keypair,
) -> [Signature; 2]
pub fn finish( self, vtxo: &Vtxo, server_pub_nonces: &HashLockedForfeitNonces, [ff_sec_nonce, claim_sec_nonce]: [SecretNonce; 2], server_key: &Keypair, ) -> [Signature; 2]
Used by the server to finish the forfeit signatures using its own nonces.
NB users don’t need to know these signatures.
Trait Implementations§
Source§impl Clone for HashLockedForfeitBundle
impl Clone for HashLockedForfeitBundle
Source§fn clone(&self) -> HashLockedForfeitBundle
fn clone(&self) -> HashLockedForfeitBundle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HashLockedForfeitBundle
impl Debug for HashLockedForfeitBundle
Source§impl PartialEq for HashLockedForfeitBundle
impl PartialEq for HashLockedForfeitBundle
Source§impl ProtocolEncoding for HashLockedForfeitBundle
impl ProtocolEncoding for HashLockedForfeitBundle
Source§fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
fn encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<(), Error>
Source§fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
fn decode<R: Read + ?Sized>(r: &mut R) -> Result<Self, ProtocolDecodingError>
Source§fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
fn deserialize(byte_slice: &[u8]) -> Result<Self, ProtocolDecodingError>
Source§fn serialize_hex(&self) -> String
fn serialize_hex(&self) -> String
Source§fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
fn deserialize_hex(hex_str: &str) -> Result<Self, ProtocolDecodingError>
impl Eq for HashLockedForfeitBundle
impl StructuralPartialEq for HashLockedForfeitBundle
Auto Trait Implementations§
impl Freeze for HashLockedForfeitBundle
impl RefUnwindSafe for HashLockedForfeitBundle
impl Send for HashLockedForfeitBundle
impl Sync for HashLockedForfeitBundle
impl Unpin for HashLockedForfeitBundle
impl UnwindSafe for HashLockedForfeitBundle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.