parser

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextPlain   = "text/plain"
	ImageUrl    = "image/url"
	ImageJpg    = "image/jpg"
	ImageGif    = "image/gif"
	AudioWav    = "audio/wav"
	Transaction = "transaction"
	BsvProtocol = "bsvProtocol"
)
View Source
const (
	Op0      = 0x00
	OpReturn = 0x6A
)
View Source
const (
	Op0Str      = "OP_0"
	OpReturnStr = "OP_RETURN"
)
View Source
const (
	TypeEmpty = iota
	TypeP2PK
	TypeP2PKH
	TypeOpreturn
	TypeNotStandard
)
View Source
const (
	OpCodeHash160     = byte(0xA9)
	OpCodeEqual       = byte(0x87)
	OpCodeEqualVerify = byte(0x88)
	OpCodeCheckSig    = byte(0xAC)
	OpCodeDup         = byte(0x76)
	OpCode_0          = byte(0x00)
	OpCode_1          = byte(0x51)
	OpCheckMultiSig   = byte(0xAE)
	OpPushData1       = byte(0x4C)
	OpPushData2       = byte(0x4D)
	OpPushData3       = byte(0x4E)
)
View Source
const (
	OpCodeHash160_Str     = "OP_HASH160"
	OpCodeEqual_Str       = "OP_EQUAL"
	OpCodeEqualVerify_Str = "OP_EQUALVERIFY"
	OpCodeCheckSig_Str    = "OP_CHECKSIG"
	OpCodeDup_Str         = "OP_DUP"
	OpCode_0_Str          = "0"
	OpCode_1_Str          = "1"
	OpCheckMultiSig_Str   = "OP_CHECKMULTISIG"
	OpPushData1_Str       = "OP_PUSHDATA1"
	OpPushData2_Str       = "OP_PUSHDATA2"
	OpPushData3_Str       = "OP_PUSHDATA3"
	OpReturn_Str          = "OP_RETURN"
)

Variables

View Source
var (
	OpMeta             = []byte{0x6d, 0x65, 0x74, 0x61}
	OpMVC              = []byte{0x6d, 0x76, 0x63}
	OP_CHAIN_FLAG_LIST = [][]byte{
		OpMeta,
		OpMVC,
	}

	MetaIDFlag = "metaid"
)

Functions

func CheckChainFlag added in v0.0.3

func CheckChainFlag(chainFlag string) bool

func DecodeMetaOutScript

func DecodeMetaOutScript(scriptPubKey string, txId string) ([]string, bool, error)

DecodeMetaOutScript :

Used to parse script data in Outputs for parser data

return:

PartsString - []string - The parts of script
IsMeta      - bool     - Whether Meta
Error       - error    - The message of error

func DecodeMetaOutScriptForMetaFile

func DecodeMetaOutScriptForMetaFile(script, encoding string) ([]string, bool, error)

for metafile

func GetMetaBlockEndBlockHeight

func GetMetaBlockEndBlockHeight(metaBlockHeight int64) int64

func GetMetaBlockStartBlockHeight

func GetMetaBlockStartBlockHeight(metaBlockHeight int64) int64

func GetStartBlockHeightAndEndBlockHeight

func GetStartBlockHeightAndEndBlockHeight(metaBlockHeight int64) (int64, int64)

func IsChainFlag

func IsChainFlag(opStr string) (bool, string)

func MakeMetaBlockHeight

func MakeMetaBlockHeight(blockHeight int64) int64

func MakeMetanetId

func MakeMetanetId(nodePubKey string, nodeParentTxId string) string

*

Make MetanetID for finding unique parent node

func MakeNodeId

func MakeNodeId(nodePubKey string, nodeTxId string) string

*

Make NodeID

Types

type DataPart

type DataPart struct {
	ChainTag            string      `json:"chainTag"`
	TxId                string      `json:"txID"`
	MetanetId           string      `json:"metanetId"`
	NodePublicKey       string      `json:"nodePublicKey"` //NodePublicKey / NodeAddress
	NodeParentTxId      string      `json:"nodeParentTxId"`
	NodeParentChainFlag string      `json:"nodeParentChainFlag"`
	MetaIdTag           string      `json:"metaIdTag"`
	NodeName            string      `json:"nodeName"`
	Data                interface{} `json:"data"`
	DataString          string      `json:"dataString"` //data raw string
	Encrypt             string      `json:"encrypt"`
	Version             string      `json:"version"`
	DataType            string      `json:"dataType"`
	Encoding            string      `json:"encoding"`
	Params              []string    `json:"params"` //extra params
}

func ChainDataToDataPart

func ChainDataToDataPart(parts []string) *DataPart

type ScriptType

type ScriptType int64

func DecodeCommonOutScript

func DecodeCommonOutScript(scriptPubKey string) (ScriptType, string, string, []string, error)

type p2pk|p2pkh describe parts error

func DecodeNormalOutScript

func DecodeNormalOutScript(scriptPubKey string) (ScriptType, string, error)

type p2pk|p2pkh describe parts error

Jump to

Keyboard shortcuts

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