wallet

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashLength          = 32
	AddressLength       = 20
	HashStringLength    = 64
	AddressStringLength = 41
	PriKeyLength        = 32
	PriKeyStringLength  = 64
	ADDRESS_PREFIX      = "i"
	WALLET_NAMESPACE    = "ink"
	MAIN_BALANCE_NAME   = "INK"
)

Variables

View Source
var InkMinimumFee *big.Int

Functions

func FromECDSAPub

func FromECDSAPub(pub *ecdsa.PublicKey) []byte

func GetAddressHexFromPrikey

func GetAddressHexFromPrikey(priKey string) (string, error)

func GetInvokeHash

func GetInvokeHash(chaincodeSpec *pb.ChaincodeSpec, geneAlg string, senderSpec *pb.SenderSpec) ([]byte, error)

func HexToECDSA

func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)

func Keccak256

func Keccak256(data ...[]byte) []byte

func NewECDSAPrivateKeyFromD

func NewECDSAPrivateKeyFromD(c elliptic.Curve, D *big.Int) *ecdsa.PrivateKey

func S256

func S256() elliptic.Curve

func SignInvoke

func SignInvoke(chaincodeSpec *pb.ChaincodeSpec, geneAlg string, senderSpec *pb.SenderSpec, priKey string) ([]byte, error)

func SignJson

func SignJson(json []byte, priKey string) ([]byte, error)

func SignatureBytesToString

func SignatureBytesToString(sig []byte) string

func SignatureStringToBytes

func SignatureStringToBytes(sig string) ([]byte, error)

func ToECDSA

func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)

func ToECDSAPub

func ToECDSAPub(pub []byte) *ecdsa.PublicKey

--------------------------------------

Types

type Account

type Account struct {
	Balance map[string]*big.Int `json:"balance"`
	Counter uint64              `json:"counter"`
}

type Address

type Address [AddressLength]byte

func BytesToAddress

func BytesToAddress(b []byte) *Address

func GetAddressFromPrikey

func GetAddressFromPrikey(priKey string) (*Address, error)

func GetSenderFromSignature

func GetSenderFromSignature(hashT []byte, signature []byte) (*Address, error)

func HexToAddress

func HexToAddress(hexKey string) (*Address, error)

func PubkeyToAddress

func PubkeyToAddress(p ecdsa.PublicKey) *Address

func StringToAddress

func StringToAddress(b string) *Address

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

func (*Address) ToBytes

func (a *Address) ToBytes() []byte

func (*Address) ToString

func (a *Address) ToString() string

type Hash

type Hash [HashLength]byte

func BytesToHash

func BytesToHash(b []byte) *Hash

func (*Hash) SetBytes

func (a *Hash) SetBytes(b []byte)

func (*Hash) ToBytes

func (a *Hash) ToBytes() []byte

type TxData

type TxData struct {
	Sender      *Address `json:"from"`
	Recipient   *Address `json:"to"`
	BalanceType string   `json:"balanceType"`
	Amount      *big.Int `json:"amount"`
}

Directories

Path Synopsis
ink

Jump to

Keyboard shortcuts

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