neo

package
v0.0.0-...-063bfca Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GasAssert = "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7"
	NEOAssert = "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"
)

Asserts .

View Source
const (
	MinerTransaction      byte = 0x00
	IssueTransaction      byte = 0x01
	ClaimTransaction      byte = 0x02
	EnrollmentTransaction byte = 0x20
	RegisterTransaction   byte = 0x40
	ContractTransaction   byte = 0x80
	PublishTransaction    byte = 0xd0
	InvocationTransaction byte = 0xd1
)

Transaction types

View Source
const (
	ContractHash   = byte(0x00)
	ECDH02         = byte(0x02)
	ECDH03         = byte(0x03)
	Script         = byte(0x20)
	Vote           = byte(0x30)
	CertURL        = byte(0x80)
	DescriptionURL = byte(0x81)
	Description    = byte(90)
	Hash1          = byte(0xa1)
	Hash2          = byte(0xa2)
	Hash3          = byte(0xa3)
	Hash4          = byte(0xa4)
	Hash5          = byte(0xa5)
	Hash6          = byte(0xa6)
	Hash7          = byte(0xa7)
	Hash8          = byte(0xa8)
	Hash9          = byte(0xa9)
	Hash10         = byte(0xaa)
	Hash11         = byte(0xab)
	Hash12         = byte(0xac)
	Hash13         = byte(0xad)
	Hash14         = byte(0xae)
	Hash15         = byte(0xaf)
	Remark         = byte(0xf0)
	Remark1        = byte(0xf1)
	Remark2        = byte(0xf2)
	Remark3        = byte(0xf3)
	Remark4        = byte(0xf4)
	Remark5        = byte(0xf5)
	Remark6        = byte(0xf6)
	Remark7        = byte(0xf7)
	Remark8        = byte(0xf8)
	Remark9        = byte(0xf9)
	Remark10       = byte(0xfa)
	Remark11       = byte(0xfb)
	Remark12       = byte(0xfc)
	Remark13       = byte(0xfd)
	Remark14       = byte(0xfe)
	Remark15       = byte(0xff)
)

Attr Usage

Variables

View Source
var (
	StandardScryptN = 1 << 18
	StandardScryptP = 1
	LightScryptN    = 1 << 12
	LightScryptP    = 6
)

const variables

View Source
var (
	ErrNoUTXO = errors.New("no enough utxo")
)

Err

Functions

func CalcTxInput

func CalcTxInput(amount float64, unspent []*neogo.UTXO) ([]*neogo.UTXO, float64, error)

CalcTxInput .

func WriteLightScryptKeyStore

func WriteLightScryptKeyStore(key *Key, password string) ([]byte, error)

WriteLightScryptKeyStore write keystore with Scrypt format

func WriteScryptKeyStore

func WriteScryptKeyStore(key *Key, password string) ([]byte, error)

WriteScryptKeyStore write keystore with Scrypt format

Types

type Key

type Key struct {
	ID         uuid.UUID       // Key ID
	Address    string          // address
	PrivateKey *btc.PrivateKey // btc private key
}

Key NEO wallet key

func KeyFromPrivateKey

func KeyFromPrivateKey(privateKeyBytes []byte) (*Key, error)

KeyFromPrivateKey neo key from private key bytes

func KeyFromWIF

func KeyFromWIF(wif string) (*Key, error)

KeyFromWIF neo key from wif format

func NewKey

func NewKey() (*Key, error)

NewKey create new key

func ReadKeyStore

func ReadKeyStore(data []byte, password string) (*Key, error)

ReadKeyStore read key from keystore

type RawClaimTx

type RawClaimTx struct {
	*RawTx
	Claims []*RawTxInput
}

RawClaimTx .

func NewRawClaimTx

func NewRawClaimTx() *RawClaimTx

NewRawClaimTx .

type RawTx

type RawTx struct {
	Type       byte              // transaction type
	Version    byte              // tx version
	XData      RawTxSerializable // special tx data
	Attributes []*RawTxAttr      // tx attribute
	Inputs     []*RawTxInput     // tx inputs
	Outputs    []*RawTxOutput    // tx output
	Scripts    []*RawTxScript    // tx scripts
}

RawTx raw transaction object

func CreateClaimTx

func CreateClaimTx(val float64, address string, unspent []*neogo.UTXO) (*RawTx, error)

CreateClaimTx .

func CreateSendAssertTx

func CreateSendAssertTx(assert, from, to string, amount float64, unspent []*neogo.UTXO) (*RawTx, error)

CreateSendAssertTx create send assert tx object

func NewRawTx

func NewRawTx(txType byte) *RawTx

NewRawTx create new raw tx

func (*RawTx) GenerateWithSign

func (tx *RawTx) GenerateWithSign(key *Key) ([]byte, string, error)

GenerateWithSign generate raw tx with sign data

func (*RawTx) WriteBytes

func (tx *RawTx) WriteBytes(writer io.Writer) error

WriteBytes .

type RawTxAttr

type RawTxAttr struct {
	Usage byte
	Data  []byte
}

RawTxAttr raw transaction attribute

func (*RawTxAttr) WriteBytes

func (attr *RawTxAttr) WriteBytes(writer io.Writer) error

WriteBytes .

type RawTxInput

type RawTxInput struct {
	TxID string
	Vout uint16
}

RawTxInput raw tx input parameter

func (*RawTxInput) WriteBytes

func (input *RawTxInput) WriteBytes(writer io.Writer) error

WriteBytes .

type RawTxOutput

type RawTxOutput struct {
	AssertID string
	Value    float64
	Address  string
}

RawTxOutput raw tx output utxo

func (*RawTxOutput) WriteBytes

func (output *RawTxOutput) WriteBytes(writer io.Writer) error

WriteBytes .

type RawTxScript

type RawTxScript struct {
	StackScript  []byte
	RedeemScript []byte
}

RawTxScript .

func (*RawTxScript) WriteBytes

func (script *RawTxScript) WriteBytes(writer io.Writer) error

WriteBytes .

type RawTxSerializable

type RawTxSerializable func(writer io.Writer) error

RawTxSerializable .

Jump to

Keyboard shortcuts

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