syscoin

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainnetMagic                                   wire.BitcoinNet = 0xffcae2ce
	RegtestMagic                                   wire.BitcoinNet = 0xdab5bffa
	SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_SYSCOIN  int32           = 0x7400
	SYSCOIN_TX_VERSION_SYSCOIN_BURN_TO_ALLOCATION  int32           = 0x7401
	SYSCOIN_TX_VERSION_ASSET_ACTIVATE              int32           = 0x7402
	SYSCOIN_TX_VERSION_ASSET_UPDATE                int32           = 0x7403
	SYSCOIN_TX_VERSION_ASSET_TRANSFER              int32           = 0x7404
	SYSCOIN_TX_VERSION_ASSET_SEND                  int32           = 0x7405
	SYSCOIN_TX_VERSION_ALLOCATION_MINT             int32           = 0x7406
	SYSCOIN_TX_VERSION_ALLOCATION_BURN_TO_ETHEREUM int32           = 0x7407
	SYSCOIN_TX_VERSION_ALLOCATION_SEND             int32           = 0x7408
	SYSCOIN_TX_VERSION_ALLOCATION_LOCK             int32           = 0x7409
)

magic numbers

Variables

View Source
var (
	MainNetParams chaincfg.Params
	RegtestParams 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 CmdAssetAllocationSend

type CmdAssetAllocationSend struct {
	Method string `json:"method"`
	Params struct {
		Asset    int    `json:"asset_guid"`
		Sender   string `json:"address_sender"`
		Receiver string `json:"address_receiver"`
		Amount   string `json:"amount"`
	} `json:"params"`
}

type CmdSendFrom

type CmdSendFrom struct {
	Method string `json:"method"`
	Params struct {
		Sender   string `json:"funding_address"`
		Receiver string `json:"address"`
		Amount   string `json:"amount"`
	} `json:"params"`
}

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) AppendTokenTransferRecipient

func (p *SyscoinParser) AppendTokenTransferRecipient(ttr *bchain.TokenTransferRecipient, buf []byte, varBuf []byte) []byte

func (*SyscoinParser) AppendTokenTransferSummary

func (p *SyscoinParser) AppendTokenTransferSummary(tts *bchain.TokenTransferSummary, buf []byte, varBuf []byte) []byte

func (*SyscoinParser) GetAddrDescFromAddress

func (p *SyscoinParser) GetAddrDescFromAddress(address string) (bchain.AddressDescriptor, error)

GetAddrDescFromAddress returns internal address representation (descriptor) of given address

func (*SyscoinParser) GetAddressesFromAddrDesc

func (p *SyscoinParser) GetAddressesFromAddrDesc(addrDesc bchain.AddressDescriptor) ([]string, bool, error)

GetAddressesFromAddrDesc returns addresses for given address descriptor with flag if the addresses are searchable

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) 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) IsTxIndexAsset

func (p *SyscoinParser) IsTxIndexAsset(txIndex int32) bool

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

same as base but packs/unpacks additional varint for length of indexes array (base uses bitshifting and takes up lowest bit which we need for asset guid which uses up entire int32 range)

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) TryGetOPReturn

func (p *SyscoinParser) TryGetOPReturn(script []byte, nVersion int32) []byte

TryGetOPReturn tries to process OP_RETURN script and return data

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) UnpackAssetKey

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

func (*SyscoinParser) UnpackAssetTxIndex

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

func (*SyscoinParser) UnpackTokenTransferRecipient

func (p *SyscoinParser) UnpackTokenTransferRecipient(ttr *bchain.TokenTransferRecipient, buf []byte) int

func (*SyscoinParser) UnpackTokenTransferSummary

func (p *SyscoinParser) UnpackTokenTransferSummary(tts *bchain.TokenTransferSummary, buf []byte) int

func (*SyscoinParser) UnpackTxAddresses

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

func (*SyscoinParser) UnpackTxIndexes

func (p *SyscoinParser) UnpackTxIndexes(txindexes *[]int32, buf *[]byte) error

type SyscoinRPC

type SyscoinRPC struct {
	*btc.BitcoinRPC
}

SyscoinRPC is an interface to JSON-RPC bitcoind service

func (*SyscoinRPC) AssetAllocationSend

func (b *SyscoinRPC) AssetAllocationSend(asset int, sender string, receiver string, amount string) (*bchain.Tx, string, error)

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.

func (*SyscoinRPC) SendFrom

func (b *SyscoinRPC) SendFrom(sender string, receiver string, amount string) (*bchain.Tx, error)

Jump to

Keyboard shortcuts

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