StoreFileToMiners

This is the interface for uploading the file to miners.

// StoreFileToMiners store a file to some miners
//
// Receive parameter:
//   - file: stored file
//   - mnemonic: account mnemonic
//   - territory: territory name
//   - timeout: timeout for waiting for block transaction to complete
//   - rpcs: rpc address list
//   - wantMiner: the wallet account of the miner you want to store. if it is empty, will be randomly selected.
//
// Return parameter:
//   - string: [fid] unique identifier for the file
//   - error: error message
//
// Preconditions:
//  1. your account needs to have money, and will be automatically created if the territory you specify does not exist.
//  2. if the number of miners you specify is less than 12, file storage will be exited if even one fails.
//  3. if the number of miners you specify is greater than 11, no other miners will be found for storage.
func StoreFileToMiners(file string, mnemonic string, territory string, timeout time.Duration, rpcs []string, wantMiner []string) (string, error)

Example code:

Last updated

Was this helpful?