Documentation ¶
Index ¶
- Constants
- func ArchonSignatureFor(r io.Reader, acc ifc.IAccount) (string, []byte, int64, error)
- func GasPerGByteFromProfile(gasPerMByte int64) string
- func GasToInt64(gas float64) int64
- func GenerateNewEthKey() []byte
- func GenerateNewEthWallet(path, password, pKey string) (err error)
- func GenerateNewNeoWallet(path, password, wif string) (err error)
- func GenerateNewWalletFile(accT ifc.AccountType, showPassword bool)
- func GetEthereumUploadTxInfo(txId string) (*ifc.UploadTxInfo, error)
- func GetNodeId(acc ifc.IAccount) (nodeId string, err error)
- func GetRegistrationInfo(regPath string) (*interfaces.RegistrationInfo, error)
- func IsEth(acc ifc.IAccount) bool
- func NewIAccount(walletPath string, password string) (iaccount ifc.IAccount, err error)
- func PermLayerID(acc ifc.IAccount) permission_layer.PermissionLayerID
- func PrettyCurrencyForAccount(acc ifc.IAccount, amount int64) string
- func PrivateKeyFromString(hexkey string) (*ecdsa.PrivateKey, error)
- func ProposeUpload(acc ifc.IAccount, fc *shards.FileContainer, s *shards.ShardsContainer, ...) (txId string, price int64, err error)
- func PublicFromPrivate(priv *ecdsa.PrivateKey) []byte
- func Sign(acc ifc.IAccount, hash []byte) (sig []byte, err error)
- func Verify(acc ifc.IAccount, hash, signature, publicKey []byte) bool
- func WeiPerByteFromProfile(weiPerMByte int64) string
- func WeiString(wei int64) string
- type EthAccount
- func (acc *EthAccount) AddressBytes() []byte
- func (acc *EthAccount) AddressString() string
- func (account *EthAccount) BlockchainName() string
- func (account *EthAccount) EcdsaPrivateKey() *ecdsa.PrivateKey
- func (acc *EthAccount) EcdsaPublicKeyBytes() []byte
- func (acc *EthAccount) GetAccountType() ifc.AccountType
- func (acc *EthAccount) GetEarnings() (int64, error)
- func (acc *EthAccount) GetEthAddress() *EthAddress
- func (account *EthAccount) GetEthPrivate() *[32]byte
- func (account *EthAccount) GetEthereumKeyset() *wallet.EthereumKeyset
- func (acc *EthAccount) GetUploadTxInfo(txId string) (info *ifc.UploadTxInfo, err error)
- func (account *EthAccount) GetUserName() (userName string, err error)
- func (acc *EthAccount) HundredthOfCent() int64
- func (acc *EthAccount) IsSpRegistered() (isRegistered bool)
- func (acc *EthAccount) IsTxAccepted(txId string) bool
- func (acc *EthAccount) Permission() UrlPermission
- func (acc *EthAccount) PrettyCurrency(amount int64) string
- func (account *EthAccount) PrivateKeyBytes() []byte
- func (account *EthAccount) PrivateKeyString() string
- func (acc *EthAccount) ProposeUpload(fc *shards.FileContainer, s *shards.ShardsContainer, a *ArchonUrl, ...) (txId string, price int64, err error)
- func (acc *EthAccount) PublicKeyBytes() []byte
- func (account *EthAccount) PublicKeyString() string
- func (acc *EthAccount) RegisterSP(r *ifc.RegistrationInfo) (txId string, err error)
- func (account *EthAccount) RegisterUserName(userName string) error
- func (acc *EthAccount) Sign(hash []byte) (sig []byte, err error)
- func (acc *EthAccount) UnregisterSP() (err error)
- func (acc *EthAccount) Verify(hash, signature, publicKey []byte) bool
- type EthereumKey
- type NeoAccount
- func (account *NeoAccount) AddressBytes() []byte
- func (account *NeoAccount) AddressString() string
- func (account *NeoAccount) BlockchainName() string
- func (acc *NeoAccount) EcdsaPrivateKey() *ecdsa.PrivateKey
- func (acc *NeoAccount) EcdsaPublicKeyBytes() []byte
- func (acc *NeoAccount) GetAccountType() interfaces.AccountType
- func (acc *NeoAccount) GetEarnings() (int64, error)
- func (acc *NeoAccount) GetUploadTxInfo(txId string) (pInfo *interfaces.UploadTxInfo, err error)
- func (acc *NeoAccount) GetUserName() (string, error)
- func (acc *NeoAccount) GetWallet() *wallet.Account
- func (acc *NeoAccount) HundredthOfCent() int64
- func (acc *NeoAccount) IsSpRegistered() bool
- func (acc *NeoAccount) IsTxAccepted(txId string) bool
- func (acc *NeoAccount) Permission() UrlPermission
- func (acc *NeoAccount) PrettyCurrency(amount int64) string
- func (account *NeoAccount) PrivateKeyBytes() []byte
- func (account *NeoAccount) PrivateKeyString() string
- func (acc *NeoAccount) ProposeUpload(fc *shards.FileContainer, s *shards.ShardsContainer, a *ArchonUrl, ...) (txIds map[string]string, totalPrice int64, err error)
- func (account *NeoAccount) PublicKeyBytes() []byte
- func (account *NeoAccount) PublicKeyString() string
- func (acc *NeoAccount) RegisterSP(r *interfaces.RegistrationInfo) (txId string, err error)
- func (acc *NeoAccount) RegisterUserName(userName string) error
- func (acc *NeoAccount) Sign(hash []byte) (sig []byte, err error)
- func (acc *NeoAccount) UnregisterSP() error
- func (acc *NeoAccount) Verify(hash, signature, publicKey []byte) bool
Constants ¶
const ( EthToWei = Quintillion CentsToWei = 100000000000 )
const RegistrationFileName = "registration.txt"
const RegistrationVersion = 2
Variables ¶
This section is empty.
Functions ¶
func ArchonSignatureFor ¶
func GasPerGByteFromProfile ¶
func GasToInt64 ¶
func GenerateNewEthKey ¶
func GenerateNewEthKey() []byte
func GenerateNewEthWallet ¶
GenerateNewEthWallet creates a new .json wallet file
func GenerateNewNeoWallet ¶
GenerateNewNeoWallet creates a new .json wallet file
func GenerateNewWalletFile ¶
func GenerateNewWalletFile(accT ifc.AccountType, showPassword bool)
func GetEthereumUploadTxInfo ¶
func GetEthereumUploadTxInfo(txId string) (*ifc.UploadTxInfo, error)
GetEthereumUploadTxInfo returns info needed to verify the transaction on the SP side
func GetRegistrationInfo ¶
func GetRegistrationInfo(regPath string) (*interfaces.RegistrationInfo, error)
func NewIAccount ¶
func PermLayerID ¶
func PermLayerID(acc ifc.IAccount) permission_layer.PermissionLayerID
func PrivateKeyFromString ¶
func PrivateKeyFromString(hexkey string) (*ecdsa.PrivateKey, error)
func ProposeUpload ¶
func ProposeUpload(acc ifc.IAccount, fc *shards.FileContainer, s *shards.ShardsContainer, a *ArchonUrl, sps StorageProviders, maxPayment int64) (txId string, price int64, err error)
if maxPayment is negative, then the user will be prompted
func PublicFromPrivate ¶
func PublicFromPrivate(priv *ecdsa.PrivateKey) []byte
func WeiPerByteFromProfile ¶
Types ¶
type EthAccount ¶
type EthAccount struct { PrivateKey *ecdsa.PrivateKey // Public key is also available through this // contains filtered or unexported fields }
Implements IAccount for Ethereum
func NewEthAccount ¶
func NewEthAccount(walletPath string, password string) (ethAcc *EthAccount, err error)
walletPath may be relative (to exe folder, or absolute)
func (*EthAccount) AddressBytes ¶
func (acc *EthAccount) AddressBytes() []byte
func (*EthAccount) AddressString ¶
func (acc *EthAccount) AddressString() string
func (*EthAccount) BlockchainName ¶
func (account *EthAccount) BlockchainName() string
func (*EthAccount) EcdsaPrivateKey ¶
func (account *EthAccount) EcdsaPrivateKey() *ecdsa.PrivateKey
func (*EthAccount) EcdsaPublicKeyBytes ¶
func (acc *EthAccount) EcdsaPublicKeyBytes() []byte
func (*EthAccount) GetAccountType ¶
func (acc *EthAccount) GetAccountType() ifc.AccountType
--------------------- IAccount start -----------------------------------------------
func (*EthAccount) GetEarnings ¶
func (acc *EthAccount) GetEarnings() (int64, error)
func (*EthAccount) GetEthAddress ¶
func (acc *EthAccount) GetEthAddress() *EthAddress
func (*EthAccount) GetEthPrivate ¶
func (account *EthAccount) GetEthPrivate() *[32]byte
func (*EthAccount) GetEthereumKeyset ¶
func (account *EthAccount) GetEthereumKeyset() *wallet.EthereumKeyset
func (*EthAccount) GetUploadTxInfo ¶
func (acc *EthAccount) GetUploadTxInfo(txId string) (info *ifc.UploadTxInfo, err error)
func (*EthAccount) GetUserName ¶
func (account *EthAccount) GetUserName() (userName string, err error)
GetUserName returns the user name, if registered, otherwise empty string Note SPs have no user name
func (*EthAccount) HundredthOfCent ¶
func (acc *EthAccount) HundredthOfCent() int64
func (*EthAccount) IsSpRegistered ¶
func (acc *EthAccount) IsSpRegistered() (isRegistered bool)
func (*EthAccount) IsTxAccepted ¶
func (acc *EthAccount) IsTxAccepted(txId string) bool
func (*EthAccount) Permission ¶
func (acc *EthAccount) Permission() UrlPermission
func (*EthAccount) PrettyCurrency ¶
func (acc *EthAccount) PrettyCurrency(amount int64) string
func (*EthAccount) PrivateKeyBytes ¶
func (account *EthAccount) PrivateKeyBytes() []byte
func (*EthAccount) PrivateKeyString ¶
func (account *EthAccount) PrivateKeyString() string
func (*EthAccount) ProposeUpload ¶
func (acc *EthAccount) ProposeUpload(fc *shards.FileContainer, s *shards.ShardsContainer, a *ArchonUrl, sps StorageProviders, maxPayment int64) (txId string, price int64, err error)
func (*EthAccount) PublicKeyBytes ¶
func (acc *EthAccount) PublicKeyBytes() []byte
func (*EthAccount) PublicKeyString ¶
func (account *EthAccount) PublicKeyString() string
func (*EthAccount) RegisterSP ¶
func (acc *EthAccount) RegisterSP(r *ifc.RegistrationInfo) (txId string, err error)
func (*EthAccount) RegisterUserName ¶
func (account *EthAccount) RegisterUserName(userName string) error
func (*EthAccount) UnregisterSP ¶
func (acc *EthAccount) UnregisterSP() (err error)
func (*EthAccount) Verify ¶
func (acc *EthAccount) Verify(hash, signature, publicKey []byte) bool
type EthereumKey ¶
Needed because file signing is done with Eth keys
func ToEcdsa ¶
func ToEcdsa(privateKey []byte) (ethKey *EthereumKey, err error)
type NeoAccount ¶
type NeoAccount struct {
// contains filtered or unexported fields
}
func NewNeoAccount ¶
func NewNeoAccount(walletPath string, password string) (acc *NeoAccount, err error)
walletPath may be relative (to exe folder) or absolute
func NewNeoAccountFromWif ¶
func NewNeoAccountFromWif(wif string) (acc *NeoAccount, err error)
func (*NeoAccount) AddressBytes ¶
func (account *NeoAccount) AddressBytes() []byte
func (*NeoAccount) AddressString ¶
func (account *NeoAccount) AddressString() string
func (*NeoAccount) BlockchainName ¶
func (account *NeoAccount) BlockchainName() string
func (*NeoAccount) EcdsaPrivateKey ¶
func (acc *NeoAccount) EcdsaPrivateKey() *ecdsa.PrivateKey
func (*NeoAccount) EcdsaPublicKeyBytes ¶
func (acc *NeoAccount) EcdsaPublicKeyBytes() []byte
func (*NeoAccount) GetAccountType ¶
func (acc *NeoAccount) GetAccountType() interfaces.AccountType
--------------------- IAccount start -----------------------------------------------
func (*NeoAccount) GetEarnings ¶
func (acc *NeoAccount) GetEarnings() (int64, error)
func (*NeoAccount) GetUploadTxInfo ¶
func (acc *NeoAccount) GetUploadTxInfo(txId string) (pInfo *interfaces.UploadTxInfo, err error)
func (*NeoAccount) GetUserName ¶
func (acc *NeoAccount) GetUserName() (string, error)
GetUserName returns the user name, if registered, otherwise empty string Note SPs have no user name
func (*NeoAccount) GetWallet ¶
func (acc *NeoAccount) GetWallet() *wallet.Account
func (*NeoAccount) HundredthOfCent ¶
func (acc *NeoAccount) HundredthOfCent() int64
func (*NeoAccount) IsSpRegistered ¶
func (acc *NeoAccount) IsSpRegistered() bool
func (*NeoAccount) IsTxAccepted ¶
func (acc *NeoAccount) IsTxAccepted(txId string) bool
func (*NeoAccount) Permission ¶
func (acc *NeoAccount) Permission() UrlPermission
func (*NeoAccount) PrettyCurrency ¶
func (acc *NeoAccount) PrettyCurrency(amount int64) string
func (*NeoAccount) PrivateKeyBytes ¶
func (account *NeoAccount) PrivateKeyBytes() []byte
func (*NeoAccount) PrivateKeyString ¶
func (account *NeoAccount) PrivateKeyString() string
func (*NeoAccount) ProposeUpload ¶
func (acc *NeoAccount) ProposeUpload(fc *shards.FileContainer, s *shards.ShardsContainer, a *ArchonUrl, sps StorageProviders, maxPayment int64) (txIds map[string]string, totalPrice int64, err error)
func (*NeoAccount) PublicKeyBytes ¶
func (account *NeoAccount) PublicKeyBytes() []byte
func (*NeoAccount) PublicKeyString ¶
func (account *NeoAccount) PublicKeyString() string
func (*NeoAccount) RegisterSP ¶
func (acc *NeoAccount) RegisterSP(r *interfaces.RegistrationInfo) (txId string, err error)
func (*NeoAccount) RegisterUserName ¶
func (acc *NeoAccount) RegisterUserName(userName string) error
func (*NeoAccount) UnregisterSP ¶
func (acc *NeoAccount) UnregisterSP() error
func (*NeoAccount) Verify ¶
func (acc *NeoAccount) Verify(hash, signature, publicKey []byte) bool