Example 1: bits
// Generating a mnemonic
NSString *mnemonic = [NYMnemonic generateMnemonicString:@128 language:@"english"];
//=> @"letter advice cage absurd amount doctor acoustic avoid letter advice cage above"
NSString *seed = [NYMnemonic deterministicSeedStringFromMnemonicString:mnemonic
passphrase:@""
language:@"english"];
//=> "d71de856f81a8acc65e6fc851a38d4d7ec216fd0796d0a6827a3ad6ed5511a30fa280f12eb2e47ed2ac03b5c462a0358d18d69fe4f985ec81778c1b370b652a8"
Example 2: bits
// Output storage hosts information
curl -X POST "http://localhost:5001/api/v1/storage/hosts/info?host-info-mode=all"
Example 3: Bits
0 0 0 0 1 1 0 1
128 64 32 16 8 4 2 1
Example 4: bits
// Outputs Session ID
{"ID":"4a99a8a0-21a1-4e26-861f-9d725eb06012"}
Example 5: bits
// Storage upload a file with BTFS hash QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCf7b, price of 750000 μBTT, and contract length 35 days:
curl -X POST "http://localhost:5001/api/v1/storage/upload?arg=QmdBX8seLx4TGHwr8Tu9L2QSByaJ9bbFUpxFvKAYyxCf7b&price=750000&storage-length=35"
Example 6: bits
{
"Name":"myfile",
"Hash":"Qme8q2XFoGJoMxTZkM21kxQfohk7MpRv5WNq8Vy57K5u74",
"Size":"197717"
}
Example 7: bits
async saveToIpfs (files) {
const source = this.btfs.add(
[...files],
{
progress: (prog) => console.log(`received: ${prog}`),
chunker : "reed-solomon-1-1-256000"
}
)
try {
for await (const file of source) {
this.setState({ added_file_hash: file.path })
}
} catch (err) {
console.error(err)
}
}
Example 8: bits
{
"Nodes": [
{
"node_id": "16Uiu2HAm1w5WMxGCriUPz6eHN1YNjPPy7W3XG2zciJhsMF2GWXWL",
"create_timestamp": "2019-09-25T02:33:10.252092Z",
"update_timestamp": "2020-01-22T23:53:54.324533Z",
"region": "California",
"btfs_version": "1.0.0",
"score": 8,
"heart_beats": 6342,
"uptime": 0.551,
"age": 10358444,
"reputation": 60,
..........
"upload_variance": 0.016222889,
"location": {
"lat": 33.7,
"lon": -117.8
},
"storage_volume_cap": 15107810000,
"storage_volume_left": 15107809000,
"country_short": "US",
"flg": {}