📌BiDirectionalPaymentChannel

Overview

The BiDirectionalPaymentChannel contract is designed to manage a two-way payment channel between two parties.

This type of channel allows these parties to conduct numerous transactions with each other off-chain, with the final settlement occurring on the Ethereum blockchain.

The primary advantage of this approach is the significant reduction in transaction fees and improved efficiency, as only two transactions (channel opening and closing) are recorded on the blockchain, regardless of the number of off-chain transactions conducted.

Methods

verify

Checks whether the provided signatures are valid for the given contract state (balances and nonce).

Parameters

NameTypeDescription

_signatures

bytes[2] memory

Array of cryptographic signatures from the users.

_contract

address

Address of this contract.

_signers

address[2] memory

Array of addresses of the signers.

_balances

uint[2] memory

Proposed balances of the users in the channel.

_nonce

uint

Nonce associated with the current state.

Returns

NameTypeDescription

-

bool

Returns true if the signatures are valid for the given state, otherwise false.

challengeExit

Allows a user to propose a new state (balances and nonce) for the channel, secured by their signatures.

Parameters

NameTypeDescription

_balances

uint[2] memory

Proposed balances of the users in the challenge.

_nonce

uint

Nonce associated with the challenge state.

_signatures

bytes[2] memory

Array of cryptographic signatures from the users for the challenge.

withdraw

Enables a user to withdraw their balance from the contract after the challenge period has expired.

Last updated