eos

package
v0.0.0-...-872243e Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2019 License: GPL-3.0, LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const ALPHABET = "defghijklmnopqrstuvwxyz12345abcdefghijklmnopqrstuvwxyz12345abc"
View Source
const CREATOR_ACCOUNT = "gzx123454321"
View Source
const CREATOR_PRIVKEY = "5JqBVZS4shWHBhcht6bn3ecWDoZXPk3TRSVpsLriQz5J3BKZtqH"

Variables

View Source
var BALANCE_SERVER string
View Source
var EOS_DEFAULT_FEE *big.Int
View Source
var InitialCPU = int64(1000)
View Source
var InitialRam = uint32(5000)
View Source
var InitialStakeNet = int64(1000)

Functions

func CreateNewAccount

func CreateNewAccount(creatorName, creatorActivePrivKey, accountName, ownerkey, activekey string, buyram uint32) (bool, error)

创建eos账户 需要一个creator账户, creator要有余额用于购买内存

func DelegateBW

func DelegateBW(fromAcctName, fromActivePrivKey, receiverName string, stakeCPU, stakeNet int64, transfer bool) (bool, error)

预购cpu和net带宽, 用于帐号执行各种action

func EOSConfigInit

func EOSConfigInit()

func EOSInit

func EOSInit()

func EOS_newUnsignedTransaction

func EOS_newUnsignedTransaction(fromAcctName, toAcctName string, amount *big.Int, memo string) (string, *eos.SignedTransaction, error)

func GenAccountName

func GenAccountName(pubKeyHex string) string

根据公钥生成地址

func GetAccountNameByPubKey

func GetAccountNameByPubKey(pubKey string) ([]string, error)

func GetHeadBlockID

func GetHeadBlockID(nodeos string) (chainID string, err error)

func HexToPubKey

func HexToPubKey(pubKeyHex string) (ecc.PublicKey, error)

func IsCanonical

func IsCanonical(rsv []byte) bool

func IsCanonical(compactSig []byte) bool {

func MakeSignedTransaction

func MakeSignedTransaction(stx *eos.SignedTransaction, signature ecc.Signature) *eos.SignedTransaction

func PubKeyToHex

func PubKeyToHex(pk string) (pubKeyHex string, _ error)

func RSVToSignature

func RSVToSignature(rsvStr string) (ecc.Signature, error)

dcrm签的rsv转换成eos签名

func SignDigestWithPrivKey

func SignDigestWithPrivKey(hash, wif string) (ecc.Signature, error)

func SubmitTransaction

func SubmitTransaction(stx *eos.SignedTransaction) string

Types

type EOSHandler

type EOSHandler struct {
}

func NewEOSHandler

func NewEOSHandler() *EOSHandler

func (*EOSHandler) BuildUnsignedLockinTransaction

func (h *EOSHandler) BuildUnsignedLockinTransaction(fromAddress, toUserKey, toAcctName string, amount *big.Int, jsonstring string) (transaction interface{}, digests []string, err error)

构造Lockin交易, 开发用

func (*EOSHandler) BuildUnsignedTransaction

func (h *EOSHandler) BuildUnsignedTransaction(fromAddress, fromPublicKey, toAcctName string, amount *big.Int, jsonstring string) (transaction interface{}, digests []string, err error)

构造交易

func (*EOSHandler) GetAddressBalance

func (h *EOSHandler) GetAddressBalance(address string, jsonstring string) (balance types.Balance, err error)

func (*EOSHandler) GetDefaultFee

func (h *EOSHandler) GetDefaultFee() types.Value

func (*EOSHandler) GetTransactionInfo

func (h *EOSHandler) GetTransactionInfo(txhash string) (fromAddress string, txOutputs []types.TxOutput, jsonstring string, confirmed bool, fee types.Value, err error)

func (*EOSHandler) IsToken

func (h *EOSHandler) IsToken() bool

func (*EOSHandler) MakeSignedTransaction

func (h *EOSHandler) MakeSignedTransaction(rsv []string, transaction interface{}) (signedTransaction interface{}, err error)

func (*EOSHandler) PublicKeyToAddress

func (h *EOSHandler) PublicKeyToAddress(pubKeyHex string) (acctName string, err error)

用一个大账户存钱,用交易备注区分用户,交易备注是公钥hash+base58

func (*EOSHandler) SignTransaction

func (h *EOSHandler) SignTransaction(hash []string, privateKey interface{}) (rsv []string, err error)

func (*EOSHandler) SubmitTransaction

func (h *EOSHandler) SubmitTransaction(signedTransaction interface{}) (txhash string, err error)

type EOSTx

type EOSTx struct {
	FromAddress string
	TxOutputs   []EOSTxOutput
	Fee         int64
	Confirmed   bool
}

type EOSTxOutput

type EOSTxOutput struct {
	ToAddress string
	Amount    string
}

func (*EOSTxOutput) ToTxOutput

func (e *EOSTxOutput) ToTxOutput() *types.TxOutput

type SubmitTxRes

type SubmitTxRes struct {
	Transaction_id string      `json:"transaction_id"`
	Error          interface{} `json:"error,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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