Documentation ¶
Index ¶
- func DisassembleString(c *cryptos.Crypto, s []byte) (string, error)
- func DisassembleStrings(c *cryptos.Crypto, s []byte) ([]string, error)
- func ParseInt64(c *cryptos.Crypto, v []byte) (int64, error)
- type Disassembler
- type Engine
- func (eng *Engine) Bytes() []byte
- func (eng *Engine) Data(b []byte) *Engine
- func (eng *Engine) HTLC(lockScript, tokenHash, timeLockedScript, hashLockedScript []byte) *Engine
- func (eng *Engine) HTLCRecover(sig, key, locksScript []byte) *Engine
- func (eng *Engine) HTLCRedeem(sig, key, token, locksScript []byte) *Engine
- func (eng *Engine) HashLock(h []byte, verify bool) *Engine
- func (eng *Engine) If(i, e []byte) *Engine
- func (eng *Engine) Int64(n int64) *Engine
- func (eng *Engine) LockTime(lock int64) *Engine
- func (eng *Engine) LockTimeTime(t time.Time) *Engine
- func (eng *Engine) MSTLC(lockScript, timeLockedScript []byte, nRequired int64, pubKeys ...[]byte) *Engine
- func (eng *Engine) P2MS(verify bool, nRequired int64, pubKeys ...[]byte) *Engine
- func (eng *Engine) P2PKHHash(hash []byte) *Engine
- func (eng *Engine) P2PKHPublic(pub []byte) *Engine
- func (eng *Engine) P2PKPublic(pub []byte) *Engine
- func (eng *Engine) P2SHHash(h []byte) *Engine
- func (eng *Engine) P2SHScript(s []byte) *Engine
- func (eng *Engine) Sequence(lock int64) *Engine
- func (eng *Engine) SetBytes(b []byte)
- type Generator
- type IntParser
- type SequenceNumberBTC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisassembleString ¶
DisassembleString disassembles a script into a string
func DisassembleStrings ¶
DisassembleStrings disassembles a script into multiple strings
Types ¶
type Disassembler ¶
Disassembler represents a script disassembler
func NewDisassemblerBCH ¶
func NewDisassemblerBCH() Disassembler
NewDisassemblerBCH returns a new Disassembler for bitcoin-cash
func NewDisassemblerBTC ¶
func NewDisassemblerBTC() Disassembler
NewDisassemblerBTC returns a new Disassembler for bitcoin
func NewDisassemblerDCR ¶
func NewDisassemblerDCR() Disassembler
NewDisassemblerDCR returns a new Disassembler for decred
func NewDisassemblerDOGE ¶
func NewDisassemblerDOGE() Disassembler
NewDisassemblerDOGE returns a new Disassembler for dogecoin
func NewDisassemblerLTC ¶
func NewDisassemblerLTC() Disassembler
NewDisassemblerLTC returns a new Disassembler for litecoin
type Engine ¶
type Engine struct { Generator Generator // contains filtered or unexported fields }
Engine represents a scripting engine
func (*Engine) HTLCRecover ¶
HTLCRecover recovers an htlc to the script
func (*Engine) HTLCRedeem ¶
HTLCRedeem redeems an htlc to the script
func (*Engine) LockTimeTime ¶
LockTimeTime adds a timelock to the script using an absolute time
func (*Engine) MSTLC ¶
func (eng *Engine) MSTLC(lockScript, timeLockedScript []byte, nRequired int64, pubKeys ...[]byte) *Engine
MSTLC adds a multisig-time-lock contract to the script
func (*Engine) P2PKHPublic ¶
P2PKHPublic adds a p2pkh contract to the script using the public key
func (*Engine) P2PKPublic ¶
P2PKPublic adds a p2pk contract to the script using the public key
func (*Engine) P2SHScript ¶
P2SHScript adds a p2sh contract to the script using the script s
type Generator ¶
type Generator interface { // If else statement. If e is nil an else branch will not be present If(i, e []byte) []byte // Data returns the bytes as data Data(b []byte) []byte // Int64 returns n as data Int64(n int64) []byte // P2PKHHash returns a p2pkh contract using the hash P2PKHHash(hash []byte) []byte // P2PKHPublic returns a p2pkh contract using the public key P2PKHPublic(pub []byte) []byte // P2PKPublic returns a p2pk contract using the public key P2PKPublic(pub []byte) []byte // P2SHHash returns a p2sh contract using the hash P2SHHash(h []byte) []byte // P2SHScript returns a p2sh contract using the script P2SHScript(s []byte) []byte // P2SHRedeem returns a script to redeem a p2sh contract P2SHRedeem(s []byte, pref ...[]byte) []byte // P2MS returns a p2ms contract P2MS(verify bool, nRequired int64, pubKeys ...[]byte) []byte // LockTime returns an absolute timelock using an int LockTime(lock int64) []byte // LockTimeTime returns an absolute timelock using an time.Time LockTimeTime(t time.Time) []byte // Sequence returns a relative timelock using an int Sequence(lock int64) []byte // HashLock returns an hashlock HashLock(h []byte, verify bool) []byte // HTLC returns returns an hash time locked contract HTLC(lockScript, tokenHash, timeLockedScript, hashLockedScript []byte) []byte // HTLCRedeem returns the script to redeem an htlc HTLCRedeem(sig, key, token, locksScript []byte) []byte // HTLCRecover returns the script to recover an htlc HTLCRecover(sig, key, locksScript []byte) []byte // MSTLC returns a multi-sig time locked contract MSTLC(lockScript, timeLockedScript []byte, nRequired int64, pubKeys ...[]byte) []byte }
Generator represents a script generator
func NewGenerator ¶
NewGenerator returns a generator for the given crypto
func NewGeneratorBCH ¶
func NewGeneratorBCH() Generator
NewGeneratorBCH returns a new bitcoin-cash generator
func NewGeneratorBTC ¶
func NewGeneratorBTC() Generator
NewGeneratorBTC returns a new bitcoin generator
func NewGeneratorDCR ¶
func NewGeneratorDCR() Generator
NewGeneratorDCR returns a new decred generator
func NewGeneratorDOGE ¶
func NewGeneratorDOGE() Generator
NewGeneratorDOGE returns a new dogecoin generator
func NewGeneratorLTC ¶
func NewGeneratorLTC() Generator
NewGeneratorLTC returns a new litecoin generator
type IntParser ¶
IntParser represent and int64 parser
func NewIntParserBCH ¶
func NewIntParserBCH() IntParser
NewIntParserBCH returns a new int64 parser for bitcoin-cash
func NewIntParserBTC ¶
func NewIntParserBTC() IntParser
NewIntParserBTC returns a new int64 parser for bitcoin
func NewIntParserDCR ¶
func NewIntParserDCR() IntParser
NewIntParserDCR returns a new int64 parser for decred
func NewIntParserDOGE ¶
func NewIntParserDOGE() IntParser
NewIntParserDOGE returns a new int64 parser for dogecoin
func NewIntParserLTC ¶
func NewIntParserLTC() IntParser
NewIntParserLTC returns a new int64 parser for litecoin
type SequenceNumberBTC ¶
type SequenceNumberBTC int64
SequenceNumberBTC represents the nSequence field in bitcoin
func (SequenceNumberBTC) Disable ¶
func (s SequenceNumberBTC) Disable() SequenceNumberBTC
Disable the lock
func (SequenceNumberBTC) IsSeconds ¶
func (s SequenceNumberBTC) IsSeconds() SequenceNumberBTC
IsSeconds sets the seconds bit (use blocks otherwise)
func (SequenceNumberBTC) Set ¶
func (s SequenceNumberBTC) Set(ns int32) SequenceNumberBTC
Set the sequence value from an int32
func (SequenceNumberBTC) SetDuration ¶
func (s SequenceNumberBTC) SetDuration(d time.Duration) SequenceNumberBTC
Set the sequence value from a time.Duration