Documentation ¶
Index ¶
- Constants
- Variables
- func GetCorssChainSigners(code []byte) ([]*common.Uint160, error)
- func GetSigners(code []byte) ([]*common.Uint160, error)
- func SignBySigner(txn *types.Transaction, acc *Account) ([]byte, error)
- type Account
- type AccountData
- type Client
- func (cl *Client) CreateAccount() (*Account, error)
- func (cl *Client) CreateMultiSigAccount(m int, pubKeys []*crypto.PublicKey) (*Account, error)
- func (cl *Client) DecryptPrivateKey(prikey []byte) ([]byte, error)
- func (cl *Client) EncryptPrivateKey(prikey []byte) ([]byte, error)
- func (cl *Client) GetAccount(pubKey *crypto.PublicKey) (*Account, error)
- func (cl *Client) GetAccountByCodeHash(codeHash common.Uint160) *Account
- func (cl *Client) GetAccounts() []*Account
- func (cl *Client) GetMainAccount() *Account
- func (cl *Client) HandleInterrupt()
- func (cl *Client) LoadAccounts() error
- func (cl *Client) SaveAccount(ac *Account) error
- func (cl *Client) Sign(txn *types.Transaction) (*types.Transaction, error)
- type FileData
- type FileStore
- func (cs *FileStore) BuildDatabase(path string)
- func (cs *FileStore) DeleteAccountData(programHash string) error
- func (cs *FileStore) LoadAccountData() ([]AccountData, error)
- func (cs *FileStore) LoadStoredData(name string) ([]byte, error)
- func (cs *FileStore) SaveAccountData(programHash []byte, redeemScript []byte, encryptedPrivateKey []byte) error
- func (cs *FileStore) SaveStoredData(name string, value []byte) error
- func (cs *FileStore) SetPath(path string)
Constants ¶
View Source
const ( MAINACCOUNT = "main-account" SUBACCOUNT = "sub-account" KeystoreFileName = "keystore.dat" KeystoreVersion = "1.0.0" MaxSignalQueueLen = 5 )
Variables ¶
View Source
var IDReverse, _ = hex.DecodeString("a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0")
View Source
var SystemAssetID, _ = common.Uint256FromBytes(common.BytesReverse(IDReverse))
Functions ¶
func SignBySigner ¶
func SignBySigner(txn *types.Transaction, acc *Account) ([]byte, error)
Types ¶
type Account ¶
type Account struct { PrivateKey []byte PublicKey *crypto.PublicKey ProgramHash common.Uint168 RedeemScript []byte Address string }
A ELA standard account is a set of private key, public key, redeem script, program hash and address data. redeem script is (script content length)+(script content)+(script type), program hash is the sha256 value of redeem script and converted to ripemd160 format with a (Type) prefix. address is the base58 format of program hash, which is the string value show up on user interface as account address. With account, you can get the transfer address or sign transaction etc.
func AddMultiSig ¶ added in v0.3.0
func NewAccount ¶
Create an account instance with private key and public key
func NewMultiSigAccount ¶ added in v0.3.0
type AccountData ¶
type AccountData struct { Address string ProgramHash string RedeemScript string PrivateKeyEncrypted string Type string }
func GetWalletAccountData ¶ added in v0.3.0
func GetWalletAccountData(walletPath string) ([]AccountData, error)
func GetWalletMainAccountData ¶ added in v0.3.0
func GetWalletMainAccountData(walletPath string) (*AccountData, error)
type Client ¶
type Client struct { FileStore // contains filtered or unexported fields }
func (*Client) CreateAccount ¶
CreateAccount create a new Account then save it
func (*Client) CreateMultiSigAccount ¶ added in v0.3.0
func (*Client) DecryptPrivateKey ¶ added in v0.3.0
func (*Client) EncryptPrivateKey ¶ added in v0.3.0
func (*Client) GetAccount ¶
func (*Client) GetAccountByCodeHash ¶ added in v0.3.0
func (*Client) GetAccounts ¶
func (*Client) GetMainAccount ¶ added in v0.3.0
func (*Client) HandleInterrupt ¶ added in v0.3.0
func (cl *Client) HandleInterrupt()
func (*Client) LoadAccounts ¶ added in v0.3.0
LoadAccounts loads all accounts from db to memory
func (*Client) SaveAccount ¶ added in v0.3.0
SaveAccount saves a Account to memory and db
func (*Client) Sign ¶
func (cl *Client) Sign(txn *types.Transaction) (*types.Transaction, error)
type FileData ¶
type FileData struct { Version string PasswordHash string IV string MasterKey string Account []AccountData }
type FileStore ¶
type FileStore struct { // this lock could be hold by readDB, writeDB and interrupt signals. sync.Mutex // contains filtered or unexported fields }
func (*FileStore) BuildDatabase ¶
func (*FileStore) DeleteAccountData ¶
func (*FileStore) LoadAccountData ¶
func (cs *FileStore) LoadAccountData() ([]AccountData, error)
func (*FileStore) SaveAccountData ¶
func (*FileStore) SaveStoredData ¶
Click to show internal directories.
Click to hide internal directories.