User Tools

Site Tools


Introduction to File Contracts

(Note: this is a simple, short, non-technical introduction to File Contracts in Sia. For a more detailed and technical explanation, check Contracts).

File contracts are smart contracts contained within the Sia’s blockchain. They enable renters to use host’s free space with a well defined set of rules that will be automatically enforced without the need of actual trust between the two sides.

Contract formation

The renter stablishes an allowance: a pre-paid amount of Siacoin meant to pay storage and bandwidth costs for the total established duration of the contract (by default 13 weeks). This allowance gets locked in the wallet. The client software of the renter picks up 50 optimal hosts according to their scoring.

These hosts, as a guarantee of good intentions, locks an amount of Siacoins in collateral. The size of the collateral is setup manually by the host, but higher collaterals ensure a higher scoring during the hosts selection process.

The file contract is signed by the renter and the 50 hosts and is submitted to the blockchain.


A 3.9% of the renter’s allowance and a 3.9% of the host’s collateral put in the contract are paid as fees. These fees are paid to the holders of Siafunds.

Upload and Download

The renter can upload and download his files as many times as he wants while funds remain in the allowance, paying for the bandwidth and storage costs requested by the hosts at the time the contract was formed. Host pricing updates do not affect current contracts.

Data transfer is done as a direct connection between the renter and his hosts (files are not included in the blockchain). Data is encrypted by the Twofish algorithm and stored with the redundancy algorithm Reed-Solomon among the hosts. Current target redundancy is 3x.

Proofs of Storage

During the contract, the hosts must submit Proofs of Storage to the blockchain to demonstrate:

  1. they are online
  2. they still preserve the renter's files intact.

Hosts are required an uptime of 97%.

File Repair

If during the contract duration some hosts go offline, and so the redundancy drops below a certain value, new hosts will be recruited for the contract and data will be uploaded to them. In versions earlier than 1.3.0 Capricorn, files had to be stored locally in order to restore the redundancy. Now they are automatically downloaded from the available hosts and uploaded to new ones.

Contract termination

Depending on what happened during the contract window, there are different possible outcomes:

  • The renter did not upload any file: The renter receives his allowance back but pays the fees corresponding both to the allowance and the collateral. The host receive his full collateral back (host is ensured to not pay any fee this way if renter did not used the contract).
  • The renter uploaded files and the host achieved the target uptime: The renter receives the unused part of his allowance and pays the fees corresponding both to the allowance and the collateral. The host receives the payment for storage and bandwidth, his full collateral back and does not pay any fee.
  • The renter uploaded files but the host did not achieve the target uptime: The host loses the full collateral corresponding to the amount of storage uploaded by the renter, does not receive the payments for bandwidth and storage and pays the fees corresponding to his collateral. All these loses are not sent to the renter. Instead, they are burnt.

If the renter has enabled auto-renewal of contracts, some time before the expiration it will be auto-renewed. The renter needs to be online some time in advance to actually renew his contracts. Current pricing of hosts will be applied to the new contract, but if some hosts are not well scored anymore (because they are not offering competitive prices, for example) they will be replaced by new hosts.

If the contract is terminated without renewal, the files are deleted from the hosts immediately.

about/introduction_to_file_contracts.txt · Last modified: 2017/11/27 13:23 by Fornax