handshake

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CovenantTypeNone     = 0
	CovenantTypeClaim    = 1
	CovenantTypeOpen     = 2
	CovenantTypeBid      = 3
	CovenantTypeReveal   = 4
	CovenantTypeRedeem   = 5
	CovenantTypeRegister = 6
	CovenantTypeUpdate   = 7
	CovenantTypeRenew    = 8
	CovenantTypeTransfer = 9
	CovenantTypeFinalize = 10
	CovenantTypeRevoke   = 11
)

Covenant types

View Source
const (
	DnsMaxName  = 255
	DnsMaxLabel = 63
)
View Source
const (
	RecordTypeDS     = 0
	RecordTypeNS     = 1
	RecordTypeGLUE4  = 2
	RecordTypeGLUE6  = 3
	RecordTypeSYNTH4 = 4
	RecordTypeSYNTH6 = 5
	RecordTypeTEXT   = 6
)

Record types

View Source
const (
	ProofTypeDeadend   uint8 = 0
	ProofTypeShort     uint8 = 1
	ProofTypeCollision uint8 = 2
	ProofTypeExists    uint8 = 3
	ProofTypeUnknown   uint8 = 4
)

Variables

View Source
var (
	ProofSkip     = []byte{0x02}
	ProofInternal = []byte{0x01}
	ProofLeaf     = []byte{0x00}
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Version uint8
	Hash    []byte
}

func (*Address) Decode

func (a *Address) Decode(r *bytes.Buffer) error

type Block

type Block struct {
	Header       BlockHeader
	Transactions []Transaction
}

func NewBlockFromReader

func NewBlockFromReader(r io.Reader) (*Block, error)

func (*Block) Decode

func (b *Block) Decode(r *bytes.Buffer) error

type BlockHeader

type BlockHeader struct {
	Nonce        uint32
	Time         uint64
	PrevBlock    [32]byte
	NameRoot     [32]byte
	ExtraNonce   [24]byte
	ReservedRoot [32]byte
	WitnessRoot  [32]byte
	MerkleRoot   [32]byte
	Version      uint32
	Bits         uint32
	Mask         [32]byte
}

func (*BlockHeader) Decode

func (h *BlockHeader) Decode(r io.Reader) error

type BytesReader

type BytesReader struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

func NewBytesReader

func NewBytesReader(buf []byte) *BytesReader

func (*BytesReader) OriginalBytes

func (b *BytesReader) OriginalBytes() []byte

type Covenant

type Covenant interface {
	// contains filtered or unexported methods
}

type DomainRecord

type DomainRecord interface {
	// contains filtered or unexported methods
}

type DomainResourceData

type DomainResourceData struct {
	Version uint8
	Records []DomainRecord
}

func NewDomainResourceDataFromBytes

func NewDomainResourceDataFromBytes(data []byte) (*DomainResourceData, error)

type DsDomainRecord

type DsDomainRecord struct {
	KeyTag     uint16
	Algorithm  uint8
	DigestType uint8
	Digest     []byte
}

type GenericCovenant

type GenericCovenant struct {
	Type  uint8
	Items [][]byte
}

func (*GenericCovenant) Covenant

func (c *GenericCovenant) Covenant() Covenant

func (*GenericCovenant) Decode

func (c *GenericCovenant) Decode(r io.Reader) error

type Glue4DomainRecord

type Glue4DomainRecord struct {
	Name    string
	Address net.IP
}

type Glue6DomainRecord

type Glue6DomainRecord struct {
	Name    string
	Address net.IP
}

type NsDomainRecord

type NsDomainRecord struct {
	Name string
}

type Outpoint

type Outpoint struct {
	Hash  [32]byte
	Index uint32
}

func (*Outpoint) Decode

func (o *Outpoint) Decode(r *bytes.Buffer) error

type Proof

type Proof struct {
	Type       uint8
	Depth      uint16
	Nodes      []ProofNode
	Prefix     []byte
	PrefixSize uint16
	Left       []byte
	Right      []byte
	NxKey      []byte
	NxHash     []byte
	Value      []byte
}

func NewProofFromJson

func NewProofFromJson(data []byte) (*Proof, error)

func (*Proof) Decode

func (p *Proof) Decode(r *bytes.Buffer) error

func (*Proof) UnmarshalJSON

func (p *Proof) UnmarshalJSON(data []byte) error

func (*Proof) Verify

func (p *Proof) Verify(
	root []byte,
	key []byte,
) ([]byte, error)

type ProofNode

type ProofNode struct {
	Prefix     []byte
	PrefixSize uint16
	Node       []byte
}

func (*ProofNode) UnmarshalJSON

func (n *ProofNode) UnmarshalJSON(data []byte) error

type RegisterCovenant

type RegisterCovenant struct {
	NameHash     []byte
	Height       uint32
	ResourceData DomainResourceData
	BlockHash    []byte
}

func NewRegisterCovenantFromGeneric

func NewRegisterCovenantFromGeneric(
	gc *GenericCovenant,
) (*RegisterCovenant, error)

type Synth4DomainRecord

type Synth4DomainRecord struct {
	Address net.IP
}

type Synth6DomainRecord

type Synth6DomainRecord struct {
	Address net.IP
}

type TextDomainRecord

type TextDomainRecord struct {
	Items [][]byte
}

type Transaction

type Transaction struct {
	Version  uint32
	Inputs   []TransactionInput
	Outputs  []TransactionOutput
	LockTime uint32
	// contains filtered or unexported fields
}

func NewTransactionFromReader

func NewTransactionFromReader(r io.Reader) (*Transaction, error)

func (*Transaction) Decode

func (t *Transaction) Decode(r *bytes.Buffer) error

func (*Transaction) Hash

func (t *Transaction) Hash() []byte

func (*Transaction) WitnessHash

func (t *Transaction) WitnessHash() []byte

type TransactionInput

type TransactionInput struct {
	PrevOutpoint Outpoint
	Sequence     uint32
	Witness      [][]byte
}

func (*TransactionInput) Decode

func (i *TransactionInput) Decode(r *bytes.Buffer) error

func (*TransactionInput) DecodeWitness

func (i *TransactionInput) DecodeWitness(r io.Reader) error

type TransactionOutput

type TransactionOutput struct {
	Value    uint64
	Address  Address
	Covenant GenericCovenant
}

func (*TransactionOutput) Decode

func (o *TransactionOutput) Decode(r *bytes.Buffer) error

type UpdateCovenant

type UpdateCovenant struct {
	NameHash     []byte
	Height       uint32
	ResourceData DomainResourceData
	BlockHash    []byte
}

func NewUpdateCovenantFromGeneric

func NewUpdateCovenantFromGeneric(
	gc *GenericCovenant,
) (*UpdateCovenant, error)

Jump to

Keyboard shortcuts

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