channels

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2016 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Id common.Hash
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(c *Channels, id common.Hash, from, to common.Address, nonce *big.Int) *Channel

NewChannel returns a new payment channel.

func (*Channel) SignPayment

func (c *Channel) SignPayment(amount *big.Int) (Cheque, error)

SignPayment returns a signed transaction on the current payment channel.

type Channels

type Channels struct {
	// contains filtered or unexported fields
}

Channels is the channels contract reflecting that on the ethereum network. The channels contract handles all validation and verifications of payments and allows you to redeem cheques.

Channels implements the proxy.Verifier and proxy.Charges interfaces.

func Fetch

func Fetch(db ethdb.Database, mux *event.TypeMux, blockchain *core.BlockChain) (*Channels, error)

Fetch initialises a new abi and returns the contract. It does not deploy the contract, hence the name.

func (*Channels) Call

func (c *Channels) Call(methodName string, v ...interface{}) interface{}

helper forwarder

func (*Channels) ChannelId

func (c *Channels) ChannelId(from, to common.Address) common.Hash

ChannelId returns the canonical channel name for transactor and beneficiary

func (*Channels) Claim

func (c *Channels) Claim(signer common.Address, from, to common.Address, nonce uint64, amount *big.Int, sig []byte) (*types.Transaction, error)

Claim redeems a given signature using the canonical channel. It creates an Ethereum transaction and submits it to the Ethereum network.

Chaim returns the unsigned transaction and an error if it failed.

func (*Channels) Exists

func (c *Channels) Exists(from, to common.Address) bool

Exists returns whether there exists a channel between transactor and beneficiary.

func (*Channels) NewChannel

func (c *Channels) NewChannel(key *ecdsa.PrivateKey, to common.Address, amount, price *big.Int, cb func(*Channel)) (*types.Transaction, error)

Start Go API. Not important for this version

func (*Channels) Nonce

func (c *Channels) Nonce(from, to common.Address) *big.Int

func (*Channels) Price

func (c *Channels) Price(from, to common.Address) *big.Int

func (*Channels) Stop

func (c *Channels) Stop()

func (*Channels) ValidateSig

func (c *Channels) ValidateSig(from, to common.Address, nonce uint64, amount *big.Int, sig []byte) bool

Validate validates the ECDSA (curve=secp256k1) signature with the given input where H=KECCAK(from, to, amount) and the validation must satisfy: channel_owner == ECRECOVER(H, S) where S is the given signature signed by the sender.

func (*Channels) Verify

func (c *Channels) Verify(from, to common.Address, nonce uint64, amount *big.Int, sig []byte) (bool, bool)

type Cheque

type Cheque struct {
	Sig           []byte
	From, To      common.Address
	Nonce, Amount *big.Int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL