tx

package
v0.0.0-...-868bdbc Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterTxServiceAmino

func RegisterTxServiceAmino(cdc *amino.Codec)

RegisterTxServiceAmino ...

func VerifySignature

func VerifySignature(tx *protobuf.Tx, pubKey secp256k1.PubKeySecp256k1) (bool, error)

Types

type Proof

type Proof struct {
	RootHash cmn.HexBytes
	Data     Tx
	Proof    merkle.SimpleProof
}

Proof represents a Merkle proof of the presence of a transaction in the Merkle tree.

func (Proof) LeafHash

func (p Proof) LeafHash() []byte

LeafHash ...

func (Proof) Validate

func (p Proof) Validate(dataHash []byte) error

Validate verifies the proof. It returns nil if the RootHash matches the dataHash argument, and if the proof is internally consistent. Otherwise, it returns an error.

type Service

type Service interface {
	SetTxs(txs [][]byte)
	GetTxs() [][]byte
	ParseNewTxRequest(uint64, uint64, *txProtoc.TransactionRequest) error // Accepts incoming protoc structured transactions and sets byte-wise tx transaction
	Hash(tx Tx) []byte                                                    // Hash computes the hash of the wire encoded transaction.
	String(tx Tx) string                                                  // String returns the hex-encoded transaction as a string.
	Index(tx Tx) int                                                      // Index returns the index of this transaction in the list, or -1 if not found
	IndexByHash(hash []byte) int                                          // IndexByHash returns the index of this transaction hash in the list, or -1 if not found
	MerkleHash() []byte                                                   // MerkleHash returns the simple Merkle root hash of the transactions.
	Proof(i int) Proof                                                    // Proof returns a simple merkle proof for this node.
	LeafHash(tx Tx) []byte                                                // LeafHash returns the hash of the this proof refers to.
	// Validate verifies the proof. It returns nil if the RootHash matches the dataHash argument,
	// and if the proof is internally consistent. Otherwise, it returns a sensible error.
	Validate(dataHash []byte) error
}

Service ... Operations for a list of transactions

func GetTxsService

func GetTxsService() Service

GetTxService creates a new transaction service

type Tx

type Tx []byte

Tx is an arbitrary byte array.

type Txs

type Txs [][]byte

Txs is a slice of Tx. TODO make Txs of type `[]Tx`

func (*Txs) GetTxs

func (t *Txs) GetTxs() [][]byte

func (*Txs) Hash

func (t *Txs) Hash(tx Tx) []byte

Hash ...

func (*Txs) Index

func (t *Txs) Index(tx Tx) int

Index returns the index of this transaction in the list, or -1 if not found

func (*Txs) IndexByHash

func (t *Txs) IndexByHash(hash []byte) int

IndexByHash returns the index of this transaction hash in the list, or -1 if not found

func (*Txs) LeafHash

func (t *Txs) LeafHash(tx Tx) []byte

LeafHash returns the hash of the this proof refers to.

func (*Txs) MerkleHash

func (t *Txs) MerkleHash() []byte

MerkleHash returns the simple Merkle root hash of the transactions.

func (*Txs) ParseNewTxRequest

func (t *Txs) ParseNewTxRequest(senderNonce, senderBal uint64, txReq *txProtoc.TransactionRequest) error

func (*Txs) Proof

func (t *Txs) Proof(i int) Proof

Proof returns a simple merkle proof for this node. Panics if i < 0 or i >= len(txs) TODO: optimize this!

func (*Txs) SetTxs

func (t *Txs) SetTxs(txs [][]byte)

func (*Txs) String

func (t *Txs) String(tx Tx) string

String returns the hex-encoded transaction as a string.

func (*Txs) Validate

func (t *Txs) Validate(dataHash []byte) error

Validate ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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