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)
- func SignMultiSignTransaction(txn *types.Transaction, program *pg.Program, ...) (*pg.Program, error)
- func SignStandardTransaction(txn *types.Transaction, program *pg.Program, ...) (*pg.Program, error)
- type Account
- func AddMultiSig(path string, password []byte, m int, pubKeys []*crypto.PublicKey) (*Account, error)
- func FromJson(data string) (*Account, error)
- func NewAccount() (*Account, error)
- func NewAccountWithPrivateKey(privateKey []byte) (*Account, error)
- func NewMultiSigAccount(m int, pubKeys []*crypto.PublicKey) (*Account, error)
- type AccountData
- type AccountInfo
- type Client
- func Add(path string, password []byte) (*Client, error)
- func Create(path string, password []byte) (*Client, error)
- func CreateFromAccount(path string, password []byte, account *Account) (*Client, error)
- func NewClient(path string, password []byte, create bool) *Client
- func Open(path string, password []byte) (*Client, error)
- 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(address string) error
- func (cs *FileStore) LoadAccountData() ([]AccountData, error)
- func (cs *FileStore) LoadStoredData(name string) ([]byte, error)
- func (cs *FileStore) SaveAccountData(programHash *common.Uint168, redeemScript []byte, encryptedPrivateKey []byte) error
- func (cs *FileStore) SaveStoredData(name string, value []byte) error
- func (cs *FileStore) SetPath(path string)
Constants ¶
const ( MAINACCOUNT = "main-account" SUBACCOUNT = "sub-account" KeystoreFileName = "keystore.dat" KeystoreVersion = "1.0.0" MaxSignalQueueLen = 5 )
Variables ¶
var IDReverse, _ = hex.DecodeString("a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0")
var SystemAssetID, _ = common.Uint256FromBytes(common.BytesReverse(IDReverse))
Functions ¶
func SignBySigner ¶
func SignBySigner(txn *types.Transaction, acc *Account) ([]byte, error)
func SignMultiSignTransaction ¶ added in v0.5.0
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 AccountInfo ¶ added in v0.5.0
type AccountInfo struct { PrivateKey string `json:"PrivateKey"` PublicKey string `json:"PublicKey"` ProgramHash string `json:"ProgramHash"` RedeemScript string `json:"RedeemScript"` Address string `json:"Address"` }
String format of Account
type Client ¶
type Client struct { FileStore // contains filtered or unexported fields }
func CreateFromAccount ¶ added in v0.5.0
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)