syscoin

package
v0.3.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MainnetMagic wire.BitcoinNet = 0xffcae2ce
	TestnetMagic wire.BitcoinNet = 0xcee2cafe

	SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_SYSCOIN  int32 = 128
	SYSCOIN_TX_VERSION_SYSCOIN_BURN_TO_ALLOCATION  int32 = 129
	SYSCOIN_TX_VERSION_ASSET_ACTIVATE              int32 = 130
	SYSCOIN_TX_VERSION_ASSET_UPDATE                int32 = 131
	SYSCOIN_TX_VERSION_ASSET_SEND                  int32 = 132
	SYSCOIN_TX_VERSION_ALLOCATION_MINT             int32 = 133
	SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_ETHEREUM int32 = 134
	SYSCOIN_TX_VERSION_ALLOCATION_SEND             int32 = 135
)

magic numbers

Variables

View Source
var (
	MainNetParams chaincfg.Params
	TestnetParams chaincfg.Params
)

chain parameters

Functions

func GetChainParams

func GetChainParams(chain string) *chaincfg.Params

GetChainParams returns network parameters

func NewSyscoinRPC

func NewSyscoinRPC(config json.RawMessage, pushHandler func(notificationType bchain.NotificationType)) (bchain.BlockChain, error)

NewSyscoinRPC returns new SyscoinRPC instance

Types

type GetSyscoinTxHex

type GetSyscoinTxHex struct {
	Hex string `json:"hex"`
}

type ResSyscoinSend

type ResSyscoinSend struct {
	Error  *bchain.RPCError `json:"error"`
	Result json.RawMessage  `json:"result"`
}

type SyscoinParser

type SyscoinParser struct {
	*btc.BitcoinParser
	BaseParser *bchain.BaseParser
}

SyscoinParser handle

func NewSyscoinParser

func NewSyscoinParser(params *chaincfg.Params, c *btc.Configuration) *SyscoinParser

NewSyscoinParser returns new SyscoinParser instance

func (*SyscoinParser) AppendAssetInfo added in v0.3.5

func (p *SyscoinParser) AppendAssetInfo(assetInfo *bchain.AssetInfo, buf []byte, varBuf []byte) []byte

func (*SyscoinParser) GetAllocationFromTx added in v0.3.5

func (p *SyscoinParser) GetAllocationFromTx(tx *bchain.Tx) (*bchain.AssetAllocation, error)

func (*SyscoinParser) GetAssetAllocationFromData added in v0.3.5

func (p *SyscoinParser) GetAssetAllocationFromData(sptData []byte) (*bchain.AssetAllocation, error)

func (*SyscoinParser) GetAssetAllocationFromDesc added in v0.3.5

func (p *SyscoinParser) GetAssetAllocationFromDesc(addrDesc *bchain.AddressDescriptor) (*bchain.AssetAllocation, error)

func (*SyscoinParser) GetAssetFromData added in v0.3.5

func (p *SyscoinParser) GetAssetFromData(sptData []byte) (*bchain.Asset, error)

func (*SyscoinParser) GetAssetFromDesc added in v0.3.5

func (p *SyscoinParser) GetAssetFromDesc(addrDesc *bchain.AddressDescriptor) (*bchain.Asset, error)

func (*SyscoinParser) GetAssetTypeFromVersion

func (p *SyscoinParser) GetAssetTypeFromVersion(nVersion int32) *bchain.TokenType

func (*SyscoinParser) GetAssetsMaskFromVersion

func (p *SyscoinParser) GetAssetsMaskFromVersion(nVersion int32) bchain.AssetsMask

func (*SyscoinParser) GetMaxAddrLength

func (p *SyscoinParser) GetMaxAddrLength() int

matches max data carrier for systx

func (*SyscoinParser) GetSPTDataFromDesc added in v0.3.5

func (p *SyscoinParser) GetSPTDataFromDesc(addrDesc *bchain.AddressDescriptor) ([]byte, error)

func (*SyscoinParser) IsAssetActivateTx

func (p *SyscoinParser) IsAssetActivateTx(nVersion int32) bool

func (*SyscoinParser) IsAssetAllocationTx

func (p *SyscoinParser) IsAssetAllocationTx(nVersion int32) bool

note assetsend in core is assettx but its deserialized as allocation, we just care about balances so we can do it in same code for allocations

func (*SyscoinParser) IsAssetSendTx

func (p *SyscoinParser) IsAssetSendTx(nVersion int32) bool

func (*SyscoinParser) IsAssetTx

func (p *SyscoinParser) IsAssetTx(nVersion int32) bool

func (*SyscoinParser) IsSyscoinMintTx

func (p *SyscoinParser) IsSyscoinMintTx(nVersion int32) bool

func (*SyscoinParser) IsSyscoinTx

func (p *SyscoinParser) IsSyscoinTx(nVersion int32) bool

func (*SyscoinParser) LoadAssets added in v0.3.5

func (p *SyscoinParser) LoadAssets(tx *bchain.Tx) error

func (*SyscoinParser) PackAddrBalance

func (p *SyscoinParser) PackAddrBalance(ab *bchain.AddrBalance, buf, varBuf []byte) []byte

func (*SyscoinParser) PackAsset

func (p *SyscoinParser) PackAsset(asset *bchain.Asset) ([]byte, error)

func (*SyscoinParser) PackAssetKey

func (p *SyscoinParser) PackAssetKey(assetGuid uint32, height uint32) []byte

func (*SyscoinParser) PackAssetTxIndex

func (p *SyscoinParser) PackAssetTxIndex(txAsset *bchain.TxAsset) []byte

func (*SyscoinParser) PackTxAddresses

func (p *SyscoinParser) PackTxAddresses(ta *bchain.TxAddresses, buf []byte, varBuf []byte) []byte

func (*SyscoinParser) PackTxIndexes

func (p *SyscoinParser) PackTxIndexes(txi []bchain.TxIndexes) []byte

func (*SyscoinParser) PackedTxIndexLen added in v0.3.5

func (p *SyscoinParser) PackedTxIndexLen() int

func (*SyscoinParser) ParseBlock

func (p *SyscoinParser) ParseBlock(b []byte) (*bchain.Block, error)

ParseBlock parses raw block to our Block struct it has special handling for Auxpow blocks that cannot be parsed by standard btc wire parse

func (*SyscoinParser) ParseTxFromJson added in v0.3.5

func (p *SyscoinParser) ParseTxFromJson(msg json.RawMessage) (*bchain.Tx, error)

ParseTxFromJson parses JSON message containing transaction and returns Tx struct

func (*SyscoinParser) TryGetOPReturn

func (p *SyscoinParser) TryGetOPReturn(script []byte) []byte

TryGetOPReturn tries to process OP_RETURN script and return data

func (*SyscoinParser) TxFromMsgTx added in v0.3.5

func (p *SyscoinParser) TxFromMsgTx(t *wire.MsgTx, parseAddresses bool) bchain.Tx

TxFromMsgTx converts syscoin wire Tx to bchain.Tx

func (*SyscoinParser) UnpackAddrBalance

func (p *SyscoinParser) UnpackAddrBalance(buf []byte, txidUnpackedLen int, detail bchain.AddressBalanceDetail) (*bchain.AddrBalance, error)

func (*SyscoinParser) UnpackAsset

func (p *SyscoinParser) UnpackAsset(buf []byte) (*bchain.Asset, error)

func (*SyscoinParser) UnpackAssetInfo added in v0.3.5

func (p *SyscoinParser) UnpackAssetInfo(assetInfo *bchain.AssetInfo, buf []byte) int

func (*SyscoinParser) UnpackAssetKey

func (p *SyscoinParser) UnpackAssetKey(buf []byte) (uint32, uint32)

func (*SyscoinParser) UnpackAssetTxIndex

func (p *SyscoinParser) UnpackAssetTxIndex(buf []byte) []*bchain.TxAssetIndex

func (*SyscoinParser) UnpackTx added in v0.3.5

func (p *SyscoinParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error)

UnpackTx unpacks transaction from protobuf byte array

func (*SyscoinParser) UnpackTxAddresses

func (p *SyscoinParser) UnpackTxAddresses(buf []byte) (*bchain.TxAddresses, error)

func (*SyscoinParser) UnpackTxIndexType added in v0.3.5

func (p *SyscoinParser) UnpackTxIndexType(buf []byte) (bchain.AssetsMask, int)

func (*SyscoinParser) WitnessPubKeyHashFromKeyID added in v0.3.5

func (p *SyscoinParser) WitnessPubKeyHashFromKeyID(keyId []byte) (string, error)

type SyscoinRPC

type SyscoinRPC struct {
	*btc.BitcoinRPC
}

SyscoinRPC is an interface to JSON-RPC bitcoind service

func (*SyscoinRPC) GetBlock

func (b *SyscoinRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)

GetBlock returns block with given hash

func (*SyscoinRPC) GetChainTips

func (b *SyscoinRPC) GetChainTips() (string, error)

func (*SyscoinRPC) Initialize

func (b *SyscoinRPC) Initialize() error

Initialize initializes SyscoinRPC instance.

Jump to

Keyboard shortcuts

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