{"action":"opened","issue":{"url":"https://api.github.com/repos/NebulousLabs/Sia/issues/290","labels_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/290/labels{/name}","comments_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/290/comments","events_url":"https://api.github.com/repos/NebulousLabs/Sia/issues/290/events","html_url":"https://github.com/NebulousLabs/Sia/issues/290","id":55511242,"number":290,"title":"Procedure for Creating a Contract","user":{"login":"DavidVorick","id":2316841,"avatar_url":"https://avatars.githubusercontent.com/u/2316841?v=3","gravatar_id":"","url":"https://api.github.com/users/DavidVorick","html_url":"https://github.com/DavidVorick","followers_url":"https://api.github.com/users/DavidVorick/followers","following_url":"https://api.github.com/users/DavidVorick/following{/other_user}","gists_url":"https://api.github.com/users/DavidVorick/gists{/gist_id}","starred_url":"https://api.github.com/users/DavidVorick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DavidVorick/subscriptions","organizations_url":"https://api.github.com/users/DavidVorick/orgs","repos_url":"https://api.github.com/users/DavidVorick/repos","events_url":"https://api.github.com/users/DavidVorick/events{/privacy}","received_events_url":"https://api.github.com/users/DavidVorick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-26T17:26:42Z","updated_at":"2015-01-26T17:26:42Z","closed_at":null,"body":"1. Renter contacts host with proposed terms. \r\n\r\n- FileSize\r\n- Window size (how many blocks a host has to submit each proof)\r\n- Window start points (which block each window will start at) (each window should start an equal number of blocks apart)\r\n- Client contribution towards payout each window\r\n- Host contribution towards payout each window\r\n- Valid Proof Address\r\n- Missed Proof Address\r\n\r\n2. If the host agrees with the contract, the host will allocate space for the file and send an agreement message. Host should agree with the client contribution and the host contribution, should agree that the window size is large enough, that the start points are acceptable, and that the distance between window start points is acceptable, the total duration of the contract is acceptable (total duration starts from the current height, not from the starting point of the first window).\r\n\r\n3. The renter will upload the file\r\n\r\n4. The renter will upload a transaction containing all of the contracts, and inputs, with a signature. 'whole transaction' should be set to false  when the renter signs the transaction.\r\n\r\n5. The host will check that everything matches the prior agreement. There should be one contract for each window, the payout for each contract should be (client payout per window + host payout per window). Each contract should have a start point lined up with the `window start points` and and end point that is `window size` after the start point.\r\n\r\nEach contract should now have a merkle root, and that merkle root should match  the merkle root of the file uploaded to the host.\r\n\r\n6. the host adds ('host contribution each window' * number of windows) funds to the transaction and signs 'whole transaction', and submits it to the blockchain.\r\n\r\n7. Renter watches blockchain for submitted transaction + contracts. If they don't appear in time, the renter knows to try again with a different host. ('in time' means that the transaction appears in the blockchain before the first window starts. Otherwise the signatures will all be invalidated)."}}