Documentation ¶
Index ¶
- func BCAddressToEthAddress(address string) [20]byte
- func ECRecoverFromTx(data GetTxByHashResult) (retKey [64]byte, err error)
- func EthAddressToBCAddress(address [20]byte) string
- func GetBalance(ethAddress [20]byte) (big.Int, error)
- func GetEarnings(ethAddress [20]byte) (big.Int, error)
- func GetNodeID2Address(nodeID [32]byte) ([20]byte, error)
- func GetPublickeyFromContract(username string, timeout time.Duration) (pubkey [64]byte, err error)
- func GetRegisteredSP(ethAddress [20]byte) (sp *RegisteredSp, err error)
- func GetUsernameFromContract(address [20]byte) (username [32]byte, err error)
- func IsTxAcceptedByBlockchain(txid string) (bool, error)
- func ProposeUpload(params *UploadParams) (txid string, err error)
- func RegisterUsername(params *RegisterUsernameParams) (txid string, err error)
- func Unpack(methodName string, input []byte) (inter interface{}, err error)
- type GetTxByHashResult
- type InputDeconstruct
- type ProposeUploadArgs
- type RegisterUsernameParams
- type TxLog
- type TxLogs
- type TxReceipt
- type UploadParams
- type UploadTx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BCAddressToEthAddress ¶
func ECRecoverFromTx ¶
func ECRecoverFromTx(data GetTxByHashResult) (retKey [64]byte, err error)
func EthAddressToBCAddress ¶
func GetBalance ¶
called by CheckTxCostAgainstBalance
func GetEarnings ¶
utility function for sp to list its earnings
func GetNodeID2Address ¶
called by routines in archon-dht since in the smart contract nodeID -> address -> spProfile
func GetPublickeyFromContract ¶
This function is available to client that downloads an archon file, so that they may validate the ContainerSignature associated with the download
func GetRegisteredSP ¶
An sp participating in archon network makes available to archon clients its cache of registeredSp profiles. The sp fills this cache by taking census of the nodeIDs of its "neighbors" in the overlay, then retrieving the sp profile associated with each of thes nodeIDs
func GetUsernameFromContract ¶
An uploader needs to first have their username registered with the sc before they can upload to the archon cloud. The primary use of this function is that the sp calls this during GetUploadTx so that the sp will store the corresponding upload in the registered namespace. this registered namespace prevents the uploader from cheating and overwriting files in other namespaces
func IsTxAcceptedByBlockchain ¶
Note this is designed for registerSP and proposeUpload tx only. Other txs will not necessarily return correct bool.
func ProposeUpload ¶
func ProposeUpload(params *UploadParams) (txid string, err error)
To upload shards to sps, the uploader must make ProposeUpload tx to the smart contract with "SPsToUploadTo" being the result of the local marketplace instance with the upload as input. When the uploader sends the shards to the sps with the resultant txid, the sps will check that the txid has has data that matches the upload.. i.e. correct upload size, containerSignature, etc.
func RegisterUsername ¶
func RegisterUsername(params *RegisterUsernameParams) (txid string, err error)
Types ¶
type GetTxByHashResult ¶
type GetTxByHashResult struct { BlockHash string `json:blockHash` BlockNumber string `json:blockNumber` From string `json:from` Gas string `json:gas` GasPrice string `json:gasPrice` Hash string `json:hash` Input string `json:input` Nonce string `json:nonce` R string `json:r` S string `json:s` To string `json:to` TransactionIndex string `json:transactionIndex` V string `json:v` Value string `json:value` }
type InputDeconstruct ¶
type InputDeconstruct struct { HashedArchonFilepath [32]byte ContainerSignature [ethcrypto.SignatureLength]byte Params encodings.ProposeUploadParams Shardsize uint64 ArchonSPs [][20]byte }
type ProposeUploadArgs ¶
type RegisterUsernameParams ¶
type RegisterUsernameParams struct { Username string Wallet wallet.EthereumKeyset }
type UploadParams ¶
type UploadParams struct { Wallet wallet.EthereumKeyset ServiceDuration uint32 MinSLARequirements int UploadPmt uint64 // bid in marketplace, defaults to flat payment ArchonFilepath string Filesize uint64 Shardsize uint64 FileContainerType uint8 EncryptionType uint8 CompressionType uint8 ShardContainerType uint8 ErasureCodeType uint8 CustomField uint8 ContainerSignature [ethcrypto.SignatureLength]byte SPsToUploadTo [][20]byte // sps to whom the shards are to go }
type UploadTx ¶
type UploadTx struct { BlockHash string `json:blockHash` BlockNumber string `json:blockNumber` From string `json:from` Gas string `json:gas` GasPrice string `json:gasPrice` Hash string `json:hash` InputDeconstructed InputDeconstruct Input string `json:input` Nonce string `json:nonce` R string `json:r` S string `json:s` To string `json:to` TransactionIndex string `json:transactionIndex` V string `json:v` AmountPaid string PublicKey [64]byte UsernameCompressed [32]byte }
func GetUploadTx ¶
Called by sp. When uploader sends shards (and associated txid) to an sp, the sp checks the data and validity of the tx associated with the txid