Documentation ¶
Index ¶
- Constants
- Variables
- func AesgcmDecrypter(password []byte, seed []byte) ([]byte, error)
- func AesgcmEncrypter(password []byte, seed []byte) ([]byte, error)
- func CalcWalletPassKey() []byte
- func CreateSeed(folderpath string, lang int32) (string, error)
- func DisableLog()
- func GetPrivkeyBySeed(db dbm.DB, seed string) (string, error)
- func GetSeed(db dbm.DB, password string) (string, error)
- func InitSeedLibrary()
- func NewStore(db db.DB) *walletStore
- func SaveSeed(db dbm.DB, seed string, password string) (bool, error)
- func SaveSeedInBatch(db dbm.DB, seed string, password string, batch dbm.Batch) (bool, error)
- func SetLogLevel(level string)
- func VerifySeed(seed string) (bool, error)
- type Wallet
- func (wallet *Wallet) AddWaitGroup(delta int)
- func (wallet *Wallet) AddrInWallet(addr string) bool
- func (wallet *Wallet) CheckWalletStatus() (bool, error)
- func (wallet *Wallet) Close()
- func (wallet *Wallet) ExecWallet(msg *queue.Message) (types.Message, error)
- func (wallet *Wallet) GenSeed(lang int32) (*types.ReplySeed, error)
- func (wallet *Wallet) GetAPI() client.QueueProtocolAPI
- func (wallet *Wallet) GetAccountByAddr(addr string) (*types.WalletAccountStore, error)
- func (ws *Wallet) GetAccountByLabel(label string) (*types.WalletAccountStore, error)
- func (wallet *Wallet) GetAllPrivKeys() ([]crypto.PrivKey, error)
- func (wallet *Wallet) GetBalance(addr string, execer string) (*types.Account, error)
- func (wallet *Wallet) GetBlockHeight() int64
- func (wallet *Wallet) GetConfig() *types.Wallet
- func (wallet *Wallet) GetDBStore() dbm.DB
- func (wallet *Wallet) GetHeight() int64
- func (wallet *Wallet) GetLastHeader() *types.Header
- func (wallet *Wallet) GetMutex() *sync.Mutex
- func (wallet *Wallet) GetPassword() string
- func (wallet *Wallet) GetPrivKeyByAddr(addr string) (crypto.PrivKey, error)
- func (wallet *Wallet) GetRandom() *rand.Rand
- func (wallet *Wallet) GetSignType() int
- func (wallet *Wallet) GetTxDetailByHashs(ReqHashes *types.ReqHashes)
- func (wallet *Wallet) GetWaitGroup() *sync.WaitGroup
- func (wallet *Wallet) GetWalletAccounts() ([]*types.WalletAccountStore, error)
- func (wallet *Wallet) GetWalletDone() chan struct{}
- func (wallet *Wallet) GetWalletStatus() *types.WalletStatus
- func (wallet *Wallet) IsCaughtUp() bool
- func (wallet *Wallet) IsClose() bool
- func (wallet *Wallet) IsRescanUtxosFlagScaning() (bool, error)
- func (wallet *Wallet) IsTransfer(addr string) (bool, error)
- func (wallet *Wallet) IsWalletLocked() bool
- func (wallet *Wallet) Nonce() int64
- func (wallet *Wallet) On_AddBlock(block *types.BlockDetail) (types.Message, error)
- func (wallet *Wallet) On_DelBlock(block *types.BlockDetail) (types.Message, error)
- func (wallet *Wallet) On_DumpPrivkey(req *types.ReqString) (types.Message, error)
- func (wallet *Wallet) On_ErrToFront(req *types.ReportErrEvent) (types.Message, error)
- func (wallet *Wallet) On_FatalFailure(req *types.ReqNil) (types.Message, error)
- func (wallet *Wallet) On_GenSeed(req *types.GenSeedLang) (types.Message, error)
- func (wallet *Wallet) On_GetSeed(req *types.GetSeedByPw) (types.Message, error)
- func (wallet *Wallet) On_GetWalletStatus(req *types.ReqNil) (types.Message, error)
- func (wallet *Wallet) On_NewAccount(req *types.ReqNewAccount) (types.Message, error)
- func (wallet *Wallet) On_SaveSeed(req *types.SaveSeedByPw) (types.Message, error)
- func (wallet *Wallet) On_SignRawTx(req *types.ReqSignRawTx) (types.Message, error)
- func (wallet *Wallet) On_WalletGetAccountList(req *types.ReqAccountList) (types.Message, error)
- func (wallet *Wallet) On_WalletImportPrivkey(req *types.ReqWalletImportPrivkey) (types.Message, error)
- func (wallet *Wallet) On_WalletLock(req *types.ReqNil) (types.Message, error)
- func (wallet *Wallet) On_WalletMergeBalance(req *types.ReqWalletMergeBalance) (types.Message, error)
- func (wallet *Wallet) On_WalletSendToAddress(req *types.ReqWalletSendToAddress) (types.Message, error)
- func (wallet *Wallet) On_WalletSetFee(req *types.ReqWalletSetFee) (types.Message, error)
- func (wallet *Wallet) On_WalletSetLabel(req *types.ReqWalletSetLabel) (types.Message, error)
- func (wallet *Wallet) On_WalletSetPasswd(req *types.ReqWalletSetPasswd) (types.Message, error)
- func (wallet *Wallet) On_WalletTransactionList(req *types.ReqWalletTransactionList) (types.Message, error)
- func (wallet *Wallet) On_WalletUnLock(req *types.WalletUnLock) (types.Message, error)
- func (wallet *Wallet) ProcCreateNewAccount(Label *types.ReqNewAccount) (*types.WalletAccount, error)
- func (wallet *Wallet) ProcDumpPrivkey(addr string) (string, error)
- func (wallet *Wallet) ProcGetAccountList(req *types.ReqAccountList) (*types.WalletAccounts, error)
- func (wallet *Wallet) ProcImportPrivKey(PrivKey *types.ReqWalletImportPrivkey) (*types.WalletAccount, error)
- func (wallet *Wallet) ProcMergeBalance(MergeBalance *types.ReqWalletMergeBalance) (*types.ReplyHashes, error)
- func (wallet *Wallet) ProcRecvMsg()
- func (wallet *Wallet) ProcSendToAddress(SendToAddress *types.ReqWalletSendToAddress) (*types.ReplyHash, error)
- func (wallet *Wallet) ProcSignRawTx(unsigned *types.ReqSignRawTx) (string, error)
- func (wallet *Wallet) ProcWalletAddBlock(block *types.BlockDetail)
- func (wallet *Wallet) ProcWalletDelBlock(block *types.BlockDetail)
- func (wallet *Wallet) ProcWalletLock() error
- func (wallet *Wallet) ProcWalletSetFee(WalletSetFee *types.ReqWalletSetFee) error
- func (wallet *Wallet) ProcWalletSetLabel(SetLabel *types.ReqWalletSetLabel) (*types.WalletAccount, error)
- func (wallet *Wallet) ProcWalletSetPasswd(Passwd *types.ReqWalletSetPasswd) error
- func (wallet *Wallet) ProcWalletTxList(TxList *types.ReqWalletTransactionList) (*types.WalletTxDetails, error)
- func (wallet *Wallet) ProcWalletUnLock(WalletUnLock *types.WalletUnLock) error
- func (wallet *Wallet) RegisterMineStatusReporter(reporter wcom.MineStatusReport) error
- func (wallet *Wallet) SaveSeed(password string, seed string) (bool, error)
- func (wallet *Wallet) SendToAddress(priv crypto.PrivKey, addrto string, amount int64, note string, Istoken bool, ...) (*types.ReplyHash, error)
- func (wallet *Wallet) SendTransaction(payload types.Message, execer []byte, priv crypto.PrivKey, to string) (hash []byte, err error)
- func (wallet *Wallet) SetQueueClient(cli queue.Client)
- func (wallet *Wallet) SetWalletAccount(update bool, addr string, account *types.WalletAccountStore) error
- func (wallet *Wallet) WaitGroupDone()
- func (wallet *Wallet) WaitTx(hash []byte) *types.TransactionDetail
- func (wallet *Wallet) WaitTxs(hashes [][]byte) (ret []*types.TransactionDetail)
Constants ¶
const ( // 交易操作的方向 AddTx int32 = 20001 DelTx int32 = 20002 )
const BACKUPKEYINDEX = "backupkeyindex"
Variables ¶
var ( SeedLong = 15 SaveSeedLong = 12 WalletSeed = []byte("walletseed") ChineseSeedCache = make(map[string]string) EnglishSeedCache = make(map[string]string) )
var ( MaxTxHashsPerTime int64 = 100 // 1;secp256k1,2:ed25519,3:sm2 SignType = 1 )
Functions ¶
func AesgcmDecrypter ¶
使用钱包的password对seed进行aesgcm解密,返回解密后的seed
func AesgcmEncrypter ¶
使用钱包的password对seed进行aesgcm加密,返回加密后的seed
func CalcWalletPassKey ¶
func CalcWalletPassKey() []byte
func CreateSeed ¶
通过指定语言类型生成seed种子,传入语言类型以及 lang = 0 通过英语单词生成种子 lang = 1 通过中文生成种子 bitsize=128 返回12个单词或者汉子,bitsize+32=160 返回15个单词或者汉子,bitszie=256 返回24个单词或者汉子
func DisableLog ¶
func DisableLog()
func GetPrivkeyBySeed ¶
通过seed生成子私钥十六进制字符串
func SaveSeedInBatch ¶
func SetLogLevel ¶
func SetLogLevel(level string)
Types ¶
type Wallet ¶
type Wallet struct { Password string FeeAmount int64 EncryptFlag int64 // contains filtered or unexported fields }
func (*Wallet) AddWaitGroup ¶
func (*Wallet) CheckWalletStatus ¶
钱包状态检测函数,解锁状态,seed是否已保存
func (*Wallet) ExecWallet ¶
func (*Wallet) GetAPI ¶
func (wallet *Wallet) GetAPI() client.QueueProtocolAPI
func (*Wallet) GetAccountByAddr ¶
func (wallet *Wallet) GetAccountByAddr(addr string) (*types.WalletAccountStore, error)
func (*Wallet) GetAccountByLabel ¶
func (ws *Wallet) GetAccountByLabel(label string) (*types.WalletAccountStore, error)
func (*Wallet) GetBalance ¶
func (*Wallet) GetBlockHeight ¶
func (*Wallet) GetDBStore ¶
func (*Wallet) GetLastHeader ¶
func (*Wallet) GetPassword ¶
func (*Wallet) GetPrivKeyByAddr ¶
func (*Wallet) GetSignType ¶
func (*Wallet) GetTxDetailByHashs ¶
func (*Wallet) GetWaitGroup ¶
func (*Wallet) GetWalletAccounts ¶
func (wallet *Wallet) GetWalletAccounts() ([]*types.WalletAccountStore, error)
output:
type WalletAccountStore struct { Privkey string //加密后的私钥hex值 Label string Addr string TimeStamp string
获取钱包的所有账户地址列表,
func (*Wallet) GetWalletDone ¶
func (wallet *Wallet) GetWalletDone() chan struct{}
func (*Wallet) GetWalletStatus ¶
func (wallet *Wallet) GetWalletStatus() *types.WalletStatus
func (*Wallet) IsCaughtUp ¶
func (*Wallet) IsRescanUtxosFlagScaning ¶
func (*Wallet) IsTransfer ¶
检测钱包是否允许转账到指定地址,判断钱包锁和是否有seed以及挖矿锁
func (*Wallet) On_AddBlock ¶
func (*Wallet) On_DelBlock ¶
func (*Wallet) On_DumpPrivkey ¶
func (*Wallet) On_ErrToFront ¶
func (*Wallet) On_FatalFailure ¶
onFatalFailure 定时查询是否有致命性故障产生
func (*Wallet) On_GenSeed ¶
func (*Wallet) On_GetSeed ¶
func (*Wallet) On_GetWalletStatus ¶
func (*Wallet) On_NewAccount ¶
func (*Wallet) On_SaveSeed ¶
func (*Wallet) On_SignRawTx ¶
func (*Wallet) On_WalletGetAccountList ¶
func (*Wallet) On_WalletImportPrivkey ¶
func (*Wallet) On_WalletLock ¶
func (*Wallet) On_WalletMergeBalance ¶
func (*Wallet) On_WalletSendToAddress ¶
func (*Wallet) On_WalletSetFee ¶
func (*Wallet) On_WalletSetLabel ¶
func (*Wallet) On_WalletSetPasswd ¶
func (*Wallet) On_WalletTransactionList ¶
func (*Wallet) On_WalletUnLock ¶
func (*Wallet) ProcCreateNewAccount ¶
func (wallet *Wallet) ProcCreateNewAccount(Label *types.ReqNewAccount) (*types.WalletAccount, error)
input:
type ReqNewAccount struct { Label string
output:
type WalletAccount struct { Acc *Account Label string
type Account struct { Currency int32 Balance int64 Frozen int64 Addr string
创建一个新的账户
func (*Wallet) ProcDumpPrivkey ¶
获取地址对应的私钥
func (*Wallet) ProcGetAccountList ¶
func (wallet *Wallet) ProcGetAccountList(req *types.ReqAccountList) (*types.WalletAccounts, error)
output:
type WalletAccounts struct { Wallets []*WalletAccount
type WalletAccount struct { Acc *Account Label string
获取钱包的地址列表
func (*Wallet) ProcImportPrivKey ¶
func (wallet *Wallet) ProcImportPrivKey(PrivKey *types.ReqWalletImportPrivkey) (*types.WalletAccount, error)
input:
type ReqWalletImportPrivKey struct { Privkey string Label string
output:
type WalletAccount struct { Acc *Account Label string
导入私钥,并且同时会导入交易
func (*Wallet) ProcMergeBalance ¶
func (wallet *Wallet) ProcMergeBalance(MergeBalance *types.ReqWalletMergeBalance) (*types.ReplyHashes, error)
input:
type ReqWalletMergeBalance struct { To string
output:
type ReplyHashes struct { Hashes [][]byte
合并所有的balance 到一个地址
func (*Wallet) ProcRecvMsg ¶
func (wallet *Wallet) ProcRecvMsg()
func (*Wallet) ProcSendToAddress ¶
func (wallet *Wallet) ProcSendToAddress(SendToAddress *types.ReqWalletSendToAddress) (*types.ReplyHash, error)
input:
type ReqWalletSendToAddress struct { From string To string Amount int64 Note string
output:
type ReplyHash struct { Hashe []byte
发送一笔交易给对方地址,返回交易hash
func (*Wallet) ProcSignRawTx ¶
func (wallet *Wallet) ProcSignRawTx(unsigned *types.ReqSignRawTx) (string, error)
input:
type ReqSignRawTx struct { Addr string Privkey string TxHex string Expire string }
output: string 签名交易
func (*Wallet) ProcWalletAddBlock ¶
func (wallet *Wallet) ProcWalletAddBlock(block *types.BlockDetail)
wallet模块收到blockchain广播的addblock消息,需要解析钱包相关的tx并存储到db中
func (*Wallet) ProcWalletDelBlock ¶
func (wallet *Wallet) ProcWalletDelBlock(block *types.BlockDetail)
wallet模块收到blockchain广播的delblock消息,需要解析钱包相关的tx并存db中删除
func (*Wallet) ProcWalletSetFee ¶
func (wallet *Wallet) ProcWalletSetFee(WalletSetFee *types.ReqWalletSetFee) error
type ReqWalletSetFee struct { Amount int64
设置钱包默认的手续费
func (*Wallet) ProcWalletSetLabel ¶
func (wallet *Wallet) ProcWalletSetLabel(SetLabel *types.ReqWalletSetLabel) (*types.WalletAccount, error)
input:
type ReqWalletSetLabel struct { Addr string Label string
output:
type WalletAccount struct { Acc *Account Label string
设置某个账户的标签
func (*Wallet) ProcWalletSetPasswd ¶
func (wallet *Wallet) ProcWalletSetPasswd(Passwd *types.ReqWalletSetPasswd) error
input:
type ReqWalletSetPasswd struct { Oldpass string Newpass string
设置或者修改密码
func (*Wallet) ProcWalletTxList ¶
func (wallet *Wallet) ProcWalletTxList(TxList *types.ReqWalletTransactionList) (*types.WalletTxDetails, error)
input:
type ReqWalletTransactionList struct { FromTx []byte Count int32
output:
type WalletTxDetails struct { TxDetails []*WalletTxDetail
type WalletTxDetail struct { Tx *Transaction Receipt *ReceiptData Height int64 Index int64
获取所有钱包的交易记录
func (*Wallet) ProcWalletUnLock ¶
func (wallet *Wallet) ProcWalletUnLock(WalletUnLock *types.WalletUnLock) error
input:
type WalletUnLock struct { Passwd string Timeout int64
解锁钱包Timeout时间,超时后继续锁住
func (*Wallet) RegisterMineStatusReporter ¶
func (wallet *Wallet) RegisterMineStatusReporter(reporter wcom.MineStatusReport) error
func (*Wallet) SendToAddress ¶
func (*Wallet) SendTransaction ¶
func (*Wallet) SetQueueClient ¶
func (*Wallet) SetWalletAccount ¶
func (*Wallet) WaitGroupDone ¶
func (wallet *Wallet) WaitGroupDone()
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
transformer/btcbase
转换基于比特币地址规则的币种 使用此规则的币种有:BTC、BCH、LTC、ZEC、USDT、 BTY 对各个币种进行注册
|
转换基于比特币地址规则的币种 使用此规则的币种有:BTC、BCH、LTC、ZEC、USDT、 BTY 对各个币种进行注册 |