1
0

Upgrade SIA

This commit is contained in:
Scott E. Graves
2017-03-03 16:48:32 -06:00
parent 359e9466f1
commit 9e61c30ba9
31 changed files with 354 additions and 31 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,4 @@
# [![Sia Logo](http://sia.tech/img/svg/sia-green-logo.svg)](http://sia.tech) v1.1.0 (Andromeda)
# [![Sia Logo](http://sia.tech/img/svg/sia-green-logo.svg)](http://sia.tech) v1.1.1 (Andromeda)
=========
[![Build Status](https://travis-ci.org/NebulousLabs/Sia.svg?branch=master)](https://travis-ci.org/NebulousLabs/Sia)
@@ -14,6 +14,8 @@ best service at the lowest price. And since there is no barrier to entry for
hosts, anyone with spare storage capacity can join the network and start
making money.
![UI](http://i.imgur.com/iHoGqoL.png)
Traditional cloud storage has a number of shortcomings. Users are limited to a
few big-name offerings: Google, Microsoft, Amazon. These companies have little
incentive to encrypt your data or make it easy to switch services later. Their
@@ -54,9 +56,9 @@ authority. To acquire siacoins, use an exchange such as [Poloniex](https://polon
To get started with Sia, check out the guides below:
- [How to Store Data on Sia](https://medium.com/@jhowell1337/getting-started-with-private-decentralized-cloud-storage-c9565dc8c854)
- [How to Become a Sia Host](http://blog.sia.tech/2016/05/26/how-to-run-a-host-on-sia)
- [Using the Sia API](http://blog.sia.tech/2016/10/20/api-quickstart-guide)
- [How to Store Data on Sia](https://blog.sia.tech/getting-started-with-private-decentralized-cloud-storage-c9565dc8c854)
- [How to Become a Sia Host](https://blog.sia.tech/how-to-run-a-host-on-sia-2159ebc4725)
- [Using the Sia API](https://blog.sia.tech/api-quickstart-guide-f1d160c05235)
Usage

View File

@@ -155,9 +155,10 @@ returns the version of the Sia daemon currently running.
Consensus
---------
| Route | HTTP verb |
| ---------------------------- | --------- |
| [/consensus](#consensus-get) | GET |
| Route | HTTP verb |
| --------------------------------------------------------------------------- | --------- |
| [/consensus](#consensus-get) | GET |
| [/consensus/validate/transactionset](#consensusvalidatetransactionset-post) | POST |
For examples and detailed descriptions of request and response parameters,
refer to [Consensus.md](/doc/api/Consensus.md).
@@ -176,6 +177,19 @@ returns information about the consensus set, such as the current block height.
}
```
#### /consensus/validate/transactionset [POST]
validates a set of transactions using the current utxo set.
###### Request Body Bytes
Since transactions may be large, the transaction set is supplied in the POST
body, encoded in JSON format.
###### Response
standard success or error response. See
[#standard-responses](#standard-responses).
Gateway
-------
@@ -465,10 +479,11 @@ standard success or error response. See
Host DB
-------
| Request | HTTP Verb |
| ------------------------------------------- | --------- |
| [/hostdb/active](#hostdbactive-get-example) | GET |
| [/hostdb/all](#hostdball-get-example) | GET |
| Request | HTTP Verb |
| ------------------------------------------------------- | --------- |
| [/hostdb/active](#hostdbactive-get-example) | GET |
| [/hostdb/all](#hostdball-get-example) | GET |
| [/hostdb/hosts/___:pubkey___](#hostdbhosts-get-example) | GET |
For examples and detailed descriptions of request and response parameters,
refer to [HostDB.md](/doc/api/HostDB.md).
@@ -501,6 +516,7 @@ numhosts // Optional
"algorithm": "ed25519",
"key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
}
]
}
@@ -530,11 +546,58 @@ any particular order, and the order may change in subsequent calls.
"algorithm": "ed25519",
"key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
}
]
}
```
#### /hostdb/hosts/___:pubkey___ [GET] [(example)](/doc/api/HostDB.md#host-details)
fetches detailed information about a particular host, including metrics
regarding the score of the host within the database. It should be noted that
each renter uses different metrics for selecting hosts, and that a good score on
in one hostdb does not mean that the host will be successful on the network
overall.
###### Path Parameters [(with comments)](/doc/api/HostDB.md#path-parameters)
```
:pubkey
```
###### JSON Response [(with comments)](/doc/api/HostDB.md#json-response-2)
```javascript
{
"entry": {
"acceptingcontracts": true,
"maxdownloadbatchsize": 17825792, // bytes
"maxduration": 25920, // blocks
"maxrevisebatchsize": 17825792, // bytes
"netaddress": "123.456.789.0:9982",
"remainingstorage": 35000000000, // bytes
"sectorsize": 4194304, // bytes
"totalstorage": 35000000000, // bytes
"unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
"windowsize": 144, // blocks
"publickey": {
"algorithm": "ed25519",
"key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
},
"scorebreakdown": {
"ageadjustment": 0.1234,
"burnadjustment": 0.1234,
"collateraladjustment": 23.456,
"priceadjustment": 0.1234,
"storageremainingadjustment": 0.1234,
"uptimeadjustment": 0.1234,
"versionadjustment": 0.1234,
}
}
```
Miner
-----
@@ -614,6 +677,7 @@ Renter
| [/renter/contracts](#rentercontracts-get) | GET |
| [/renter/downloads](#renterdownloads-get) | GET |
| [/renter/files](#renterfiles-get) | GET |
| [/renter/prices](#renter-prices-get) | GET |
| [/renter/delete/___*siapath___](#renterdeletesiapath-post) | POST |
| [/renter/download/___*siapath___](#renterdownloadsiapath-get) | GET |
| [/renter/rename/___*siapath___](#renterrenamesiapath-post) | POST |
@@ -672,11 +736,12 @@ returns active contracts. Expired contracts are not included.
{
"contracts": [
{
"endheight": 50000, // block height
"id": "1234567890abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"netaddress": "12.34.56.78:9",
"renterfunds": "1234", // hastings
"size": 8192 // bytes
"endheight": 50000, // block height
"id": "1234567890abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"lasttransaction": {}, // types.Transaction
"netaddress": "12.34.56.78:9",
"renterfunds": "1234", // hastings
"size": 8192 // bytes
}
]
}
@@ -722,6 +787,21 @@ lists the status of all files.
}
```
#### /renter/prices [GET]
lists the estimated prices of performing various storage and data operations.
###### JSON Response [(with comments)](/doc/api/Renter.md#json-response-4)
```javascript
{
"downloadterabyte": "1234", // hastings
"formcontracts": "1234", // hastings
"storageterabytemonth": "1234", // hastings
"uploadterabyte": "1234", // hastings
}
```
#### /renter/delete/___*siapath___ [POST]
deletes a renter file entry. Does not delete any downloads or original files,

View File

@@ -190,7 +190,7 @@ File Contract Revision
8. The renter signs the revision and sends the signature to the host.
9. The host signs the revision and sends the siganture to the renter. Both
9. The host signs the revision and sends the signature to the renter. Both
parties submit the new revision to the transaction pool. The connection
deadline is reset to 600 seconds (unless the maximum deadline has been
reached), and the loop restarts.

View File

@@ -20,9 +20,10 @@ endpoint returns information about the state of the blockchain.
Index
-----
| Route | HTTP verb |
| ---------------------------- | --------- |
| [/consensus](#consensus-get) | GET |
| Route | HTTP verb |
| --------------------------------------------------------------------------- | --------- |
| [/consensus](#consensus-get) | GET |
| [/consensus/validate/transactionset](#consensusvalidatetransactionset-post) | POST |
#### /consensus [GET]
@@ -45,3 +46,16 @@ returns information about the consensus set, such as the current block height.
"target": [0,0,0,0,0,0,11,48,125,79,116,89,136,74,42,27,5,14,10,31,23,53,226,238,202,219,5,204,38,32,59,165]
}
```
#### /consensus/validate/transactionset [POST]
validates a set of transactions using the current utxo set.
###### Request Body Bytes
Since transactions may be large, the transaction set is supplied in the POST
body, encoded in JSON format.
###### Response
standard success or error response. See
[#standard-responses](#standard-responses).

View File

@@ -18,10 +18,11 @@ identifies hosts by their public key and keeps track of metrics such as price.
Index
-----
| Request | HTTP Verb | Examples |
| ------------------------------------------- | --------- | ----------------------------- |
| [/hostdb/active](#hostdbactive-get-example) | GET | [Active hosts](#active-hosts) |
| [/hostdb/all](#hostdball-get-example) | GET | [All hosts](#all-hosts) |
| Request | HTTP Verb | Examples |
| ------------------------------------------------------- | --------- | ----------------------------- |
| [/hostdb/active](#hostdbactive-get-example) | GET | [Active hosts](#active-hosts) |
| [/hostdb/all](#hostdball-get-example) | GET | [All hosts](#all-hosts) |
| [/hostdb/hosts/___:pubkey___](#hostdbhosts-get-example) | GET | [Hosts](#hosts) |
#### /hostdb/active [GET] [(example)](#active-hosts)
@@ -166,6 +167,130 @@ any particular order, and the order may change in subsequent calls.
}
```
#### /hostdb/hosts/___:pubkey___ [GET] [(example)](#hosts)
fetches detailed information about a particular host, including metrics
regarding the score of the host within the database. It should be noted that
each renter uses different metrics for selecting hosts, and that a good score on
in one hostdb does not mean that the host will be successful on the network
overall.
###### Path Parameters
```
// The public key of the host. Each public key identifies a single host.
//
// Example Pubkey: ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
:pubkey
```
###### JSON Response
```javascript
{
"entry": {
// true if the host is accepting new contracts.
"acceptingcontracts": true,
// Maximum number of bytes that the host will allow to be requested by a
// single download request.
"maxdownloadbatchsize": 17825792,
// Maximum duration in blocks that a host will allow for a file contract.
// The host commits to keeping files for the full duration under the
// threat of facing a large penalty for losing or dropping data before
// the duration is complete. The storage proof window of an incoming file
// contract must end before the current height + maxduration.
//
// There is a block approximately every 10 minutes.
// e.g. 1 day = 144 blocks
"maxduration": 25920,
// Maximum size in bytes of a single batch of file contract
// revisions. Larger batch sizes allow for higher throughput as there is
// significant communication overhead associated with performing a batch
// upload.
"maxrevisebatchsize": 17825792,
// Remote address of the host. It can be an IPv4, IPv6, or hostname,
// along with the port. IPv6 addresses are enclosed in square brackets.
"netaddress": "123.456.789.0:9982",
// Unused storage capacity the host claims it has, in bytes.
"remainingstorage": 35000000000,
// Smallest amount of data in bytes that can be uploaded or downloaded to
// or from the host.
"sectorsize": 4194304,
// Total amount of storage capacity the host claims it has, in bytes.
"totalstorage": 35000000000,
// Address at which the host can be paid when forming file contracts.
"unlockhash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
// A storage proof window is the number of blocks that the host has to
// get a storage proof onto the blockchain. The window size is the
// minimum size of window that the host will accept in a file contract.
"windowsize": 144,
// Public key used to identify and verify hosts.
"publickey": {
// Algorithm used for signing and verification. Typically "ed25519".
"algorithm": "ed25519",
// Key used to verify signed host messages.
"key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
},
// The string representation of the full public key, used when calling
// /hostdb/hosts.
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
},
// A set of scores as determined by the renter. Generally, the host's final
// final score is all of the values multiplied together. Modified renters may
// have additional criteria that they use to judge a host, or may ignore
// certin criteia. In general, these fields should only be used as a loose
// guide for the score of a host, as every renter sees the world differently
// and uses different metrics to evaluate hosts.
"scorebreakdown": {
// The multiplier that gets applied to the host based on how long it has
// been a host. Older hosts typically have a lower penalty.
"ageadjustment": 0.1234,
// The multiplier that gets applied to the host based on how much
// proof-of-burn the host has performed. More burn causes a linear increase
// in score.
"burnadjustment": 23.456,
// The multiplier that gets applied to a host based on how much collateral
// the host is offering. More collateral is typically better, though above
// a point it can be detrimental.
"collateraladjustment": 23.456,
// The multiplier that gets applied to a host based on the host's price.
// Lower prices are almost always better. Below a certain, very low price,
// there is no advantage.
"priceadjustment": 0.1234,
// The multiplier that gets applied to a host based on how much storage is
// remaining for the host. More storage remaining is better, to a point.
"storageremainingadjustment": 0.1234,
// The multiplier that gets applied to a host based on the uptime percentage
// of the host. The penalty increases extremely quickly as uptime drops
// below 90%.
"uptimeadjustment": 0.1234,
// The multiplier that gets applied to a host based on the version of Sia
// that they are running. Versions get penalties if there are known bugs,
// scaling limitations, performance limitations, etc. Generally, the most
// recent version is always the one with the highest score.
"versionadjustment": 0.1234
}
}
```
Examples
--------
@@ -200,6 +325,7 @@ Examples
"algorithm": "ed25519",
"key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
},
{
"acceptingcontracts": true,
@@ -216,6 +342,7 @@ Examples
"algorithm": "ed25519",
"key": "WWVzIEJydWNlIFNjaG5laWVyIGNhbiByZWFkIHRoaXM="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
}
]
}
@@ -252,6 +379,7 @@ Examples
"algorithm": "ed25519",
"key": "SSByYW4gb3V0IG9mIDMyIGNoYXIgbG9uZyBqb2tlcy4="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
},
{
"acceptingcontracts": true,
@@ -268,6 +396,7 @@ Examples
"algorithm": "ed25519",
"key": "RW50cm9weSBpc24ndCB3aGF0IGl0IHVzZWQgdG8gYmU="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
},
{
"acceptingcontracts": true,
@@ -284,7 +413,52 @@ Examples
"algorithm": "ed25519",
"key": "WWVzIEJydWNlIFNjaG5laWVyIGNhbiByZWFkIHRoaXM="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
}
]
}
```
#### Hosts
###### Request
```
/hostdb/hosts/ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
```
###### Expected Response Code
```
200 OK
```
###### Example JSON Response
```javascript
{
"entry": {
"acceptingcontracts": false,
"maxdownloadbatchsize": 17825792,
"maxduration": 25920,
"maxrevisebatchsize": 17825792,
"netaddress": "123.456.789.2:9982",
"remainingstorage": 314,
"sectorsize": 4194304,
"totalstorage": 314159265359,
"unlockhash": "abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789",
"windowsize": 144,
"publickey": {
"algorithm": "ed25519",
"key": "SSByYW4gb3V0IG9mIDMyIGNoYXIgbG9uZyBqb2tlcy4="
}
"publickeystring": "ed25519:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
},
"scorebreakdown": {
"ageadjustment": 0.1234,
"burnadjustment": 0.1234,
"collateraladjustment": 23.456,
"priceadjustment": 0.1234,
"storageremainingadjustment": 0.1234,
"uptimeadjustment": 0.1234,
"versionadjustment": 0.1234,
}
}
```

View File

@@ -26,6 +26,7 @@ Index
| [/renter/contracts](#rentercontracts-get) | GET |
| [/renter/downloads](#renterdownloads-get) | GET |
| [/renter/files](#renterfiles-get) | GET |
| [/renter/prices](#renter-prices-get) | GET |
| [/renter/delete/___*siapath___](#renterdeletesiapath-post) | POST |
| [/renter/download/___*siapath___](#renterdownloadsiapath-get) | GET |
| [/renter/rename/___*siapath___](#renterrenamesiapath-post) | POST |
@@ -129,6 +130,9 @@ returns active contracts. Expired contracts are not included.
// Address of the host the file contract was formed with.
"netaddress": "12.34.56.78:9",
// A signed transaction containing the most recent contract revision.
"lasttransaction": {},
// Remaining funds left for the renter to spend on uploads & downloads.
"renterfunds": "1234", // hastings
@@ -211,6 +215,32 @@ lists the status of all files.
}
```
#### /renter/prices [GET]
lists the estimated prices of performing various storage and data operations.
###### JSON Response
```javascript
{
// The estimated cost of downloading one terabyte of data from the
// network.
"downloadterabyte": "1234", // hastings
// The estimated cost of forming a set of contracts on the network. This
// cost also applies to the estimated cost of renewing the renter's set of
// contracts.
"formcontracts": "1234", // hastings
// The estimated cost of storing one terabyte of data on the network for
// a month, including accounting for redundancy.
"storageterabytemonth": "1234", // hastings
// The estimated cost of uploading one terabyte of data to the network,
// including accounting for redundancy.
"uploadterabyte": "1234", // hastings
}
```
#### /renter/delete/___*siapath___ [POST]
deletes a renter file entry. Does not delete any downloads or original files,

View File

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -9,8 +9,6 @@ namespace UnitTests
{
TEST_CLASS(SiaApiFileTree)
{
DAEMON_TEST()
private:
const SiaHostConfig _hostConfig = { TEST_SERVER_AND_PORT, TEST_SERVER_VERSION };
@@ -84,7 +82,31 @@ namespace UnitTests
ret = ft.Query(L"root/sub1/file*.??t");
Assert::AreEqual((size_t)6, ret.size());
}
};
DEFINE_DAEMON(SiaApiFileTree);
TEST_METHOD(QueryDirsRoot)
{
CSiaCurl siaCurl;
siaCurl.SetHostConfig(_hostConfig);
json j =
{
{ "files",
{
{ { "siapath", "root/sub1/file1.dat" },{ "filesize", 1 },{ "available", true },{ "renewing", true },{ "redundancy", 5 },{ "uploadprogress", 100 },{ "expiration", 60000 } },
{ { "siapath", "root/sub1/file2.dat" },{ "filesize", 2 },{ "available", true },{ "renewing", true },{ "redundancy", 5 },{ "uploadprogress", 100 },{ "expiration", 60000 } },
{ { "siapath", "root/sub2/file3.dat" },{ "filesize", 1 },{ "available", true },{ "renewing", true },{ "redundancy", 5 },{ "uploadprogress", 100 },{ "expiration", 60000 } },
{ { "siapath", "root/sub2/file1.txt" },{ "filesize", 2 },{ "available", true },{ "renewing", true },{ "redundancy", 5 },{ "uploadprogress", 100 },{ "expiration", 60000 } },
{ { "siapath", "root/sub3/file2.txt" },{ "filesize", 2 },{ "available", true },{ "renewing", true },{ "redundancy", 5 },{ "uploadprogress", 100 },{ "expiration", 60000 } },
{ { "siapath", "root/sub3/file3.txt" },{ "filesize", 3 },{ "available", true },{ "renewing", true },{ "redundancy", 5 },{ "uploadprogress", 100 },{ "expiration", 60000 } }
} }
};
CSiaDriveConfig driveConfig;
CSiaFileTree ft(siaCurl, &driveConfig);
ft.BuildTree(j);
auto ret = ft.QueryDirectories(L"/");
Assert::AreEqual((size_t)1, ret.size());
Assert::AreEqual(L"root", ret[0].c_str());
}
};
}

View File

@@ -3,6 +3,7 @@
#include "UnitTestConfig.h"
std::uint16_t Daemon::_iter = 0;
static const String SIA_PATH = L"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64";
Daemon::Daemon()
{
@@ -27,7 +28,7 @@ void Daemon::Cleanup()
BOOL failed = TRUE;
String path;
path.resize(MAX_PATH + 1);
GetFullPathName((L"\"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\data" + std::to_wstring(_i)).c_str(), MAX_PATH, &path[0], nullptr);
GetFullPathName((SIA_PATH + L"\\data" + std::to_wstring(_i)).c_str(), MAX_PATH, &path[0], nullptr);
while (failed)
{
PROCESS_INFORMATION pi2;
@@ -67,11 +68,11 @@ void Daemon::Start()
{
String path;
path.resize(MAX_PATH + 1);
GetFullPathName(L"\"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\", MAX_PATH, &path[0], nullptr);
GetFullPathName((SIA_PATH + L"\\").c_str(), MAX_PATH, &path[0], nullptr);
String exec;
exec.resize(MAX_PATH + 1);
GetFullPathName(L"\"..\\..\\..\\..\\3rd-party\\Sia-v1.1.0-windows-amd64\\siad.exe", MAX_PATH, &exec[0], nullptr);
GetFullPathName((SIA_PATH + L"\\siad.exe").c_str(), MAX_PATH, &exec[0], nullptr);
String szCmdline = L" -d .\\data" + std::to_wstring(_i) + L" --api-addr " + String(TEST_SERVER_HOST) + L":" + std::to_wstring(TEST_SERVER_PORT) + L" --no-bootstrap";
CreateProcess(exec.c_str(), &szCmdline[0], nullptr, nullptr, FALSE, 0, nullptr, path.c_str(), &si, &pi);