{"action":"created","comment":{"url":"https://api.github.com/repos/bitshares/bsips/pulls/comments/214052391","pull_request_review_id":151021944,"id":214052391,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDA1MjM5MQ==","diff_hunk":"@@ -156,9 +167,101 @@ Alice now examines the HTLC Bob created on the Bitcoin Network, ensuring the `pr\n \n Bob has now observed the `preimage` Alice used to \"unlock\" his HTLC, and he will use it to \"unlock\" her HTLC to receive the 10,000 bitUSD `escrow assets` into his `recipient` account \"bob\". NOTE: He must do this before 10AM tomorrow. Otherwise, Alice may (and should) reclaim the funds in the contract she created.\n \n+# **Specifications**\n+\n+## **Objects**\n+\n+```\n+htlc_obj\n+  id                // int\n+  depositor         // account object\n+  quantity           // int\n+  symbol            // string\n+  recipient         // account object\n+  preimage_hash     // string\n+  preimage_length   // int\n+  preimage_tx_id    // reference to transaction object containing the preimage used for htlc_redeem\n+  timeout_threshold // datetime\n+\n+  // Constructor\n+  Set: id = next available\n+  Initialize other fields = NULL\n+\n+  return contract\n+```\n+\n+## **Operations**\n+\n+### **Prepare**\n+\n+```\n+transaction_obj htlc_prepare(depositor, quantity, symbol, recipient, preimage_hash, preimage_length, timeout_threshold, htlc_preparation_fee)\n+  Validate: HTLC signed by requisite `authority` for `depositor` account \n+  Validate: `depositor` account has requisite `quantity` of `symbol` asset for the `guarantee`\n+  Validate: `timeout_threshold` < now() + GRAPHENE_HTLC_MAXIMUM_DURRATION\n+  Calculate: `required_fee` = GRAPHENE_HTLC_OPERATION_FEE + GRAPHENE_HTLC_DAILY_FEE * count((`timeout_threshold` - now()), days)\n+  Validate: `depositor` account has requisite `quantity` of BTS for `required_fee`\n+  Validate: `recipient` account exists\n+  Validate: `preimage_length` does not exceed GRAPHENE_HTLC_MAXIMUM_PREIMAGE_LENGTH\n+  Validate: `preimage_hash` well formed\n+  Update: BTS balance of `depositor` based on `required_fee`)\n+  contract = new htlc_obj\n+  Set: `contract.depositor` = `depositor`\n+  Set: `contract.recipient` = `recipient`\n+  Set: `contract.preimage_hash` = `preimage_hash`\n+  Set: `contract.preimage_length` = `preimage_length`\n+  Set: `contract.timeout_treshold` = `timeout_threshold`\n+  Transfer: from `depositor` account to `contract.quantity` of `contract.symbol`\n+  return results\n+```\n+\n+### **Redeem**\n+\n+```\n+transaction_obj htlc_redeem(redeemer, id, preimage, htlc_redemption_fee)\n+  Validate: transaction signed by requisite `authority` for `redeemer` // any account may attempt to redeem","path":"bsip-0044.md","position":222,"original_position":168,"commit_id":"1961fb9c0030cec20a7e4efde7b419903a0aa3c9","original_commit_id":"1961fb9c0030cec20a7e4efde7b419903a0aa3c9","user":{"login":"pmconrad","id":6449255,"node_id":"MDQ6VXNlcjY0NDkyNTU=","avatar_url":"https://avatars3.githubusercontent.com/u/6449255?v=4","gravatar_id":"","url":"https://api.github.com/users/pmconrad","html_url":"https://github.com/pmconrad","followers_url":"https://api.github.com/users/pmconrad/followers","following_url":"https://api.github.com/users/pmconrad/following{/other_user}","gists_url":"https://api.github.com/users/pmconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/pmconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmconrad/subscriptions","organizations_url":"https://api.github.com/users/pmconrad/orgs","repos_url":"https://api.github.com/users/pmconrad/repos","events_url":"https://api.github.com/users/pmconrad/events{/privacy}","received_events_url":"https://api.github.com/users/pmconrad/received_events","type":"User","site_admin":false},"body":"Better call it fee_paying_account instead of redeemer","created_at":"2018-08-30T14:27:23Z","updated_at":"2018-08-30T14:27:23Z","html_url":"https://github.com/bitshares/bsips/pull/104#discussion_r214052391","pull_request_url":"https://api.github.com/repos/bitshares/bsips/pulls/104","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/bitshares/bsips/pulls/comments/214052391"},"html":{"href":"https://github.com/bitshares/bsips/pull/104#discussion_r214052391"},"pull_request":{"href":"https://api.github.com/repos/bitshares/bsips/pulls/104"}}},"pull_request":{"url":"https://api.github.com/repos/bitshares/bsips/pulls/104","id":211431108,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExNDMxMTA4","html_url":"https://github.com/bitshares/bsips/pull/104","diff_url":"https://github.com/bitshares/bsips/pull/104.diff","patch_url":"https://github.com/bitshares/bsips/pull/104.patch","issue_url":"https://api.github.com/repos/bitshares/bsips/issues/104","number":104,"state":"open","locked":false,"title":"BSIP44: Hashed Timelock Contract","user":{"login":"ryanRfox","id":13419165,"node_id":"MDQ6VXNlcjEzNDE5MTY1","avatar_url":"https://avatars1.githubusercontent.com/u/13419165?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanRfox","html_url":"https://github.com/ryanRfox","followers_url":"https://api.github.com/users/ryanRfox/followers","following_url":"https://api.github.com/users/ryanRfox/following{/other_user}","gists_url":"https://api.github.com/users/ryanRfox/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanRfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanRfox/subscriptions","organizations_url":"https://api.github.com/users/ryanRfox/orgs","repos_url":"https://api.github.com/users/ryanRfox/repos","events_url":"https://api.github.com/users/ryanRfox/events{/privacy}","received_events_url":"https://api.github.com/users/ryanRfox/received_events","type":"User","site_admin":false},"body":"See #103 \r\n\r\nCurrent version of BSIP44 draft:\r\nRevised: 29 AUG\r\n\r\nBSIP: 0044\\\r\nTitle: Hashed Time-Locked Contract\\\r\nAuthors: Ryan R. Fox, John M. Jones, taconator\\\r\nStatus: Draft\\\r\nType: Protocol\\\r\nCreated: 2018-08-22\\\r\nDiscussion: https://github.com/bitshares/bsips/pull/104\r\n\r\n# **Abstract**\r\n\r\nThis BSIP describes an implementation of a Hashed Time-Locked Contract (HTLC) operation.\r\n\r\n# **Motivation**\r\n\r\nThe ability to securely hold tokenized assets within a hashed time-locked contract on the BitShares blockchain is a desirable feature that could be used by many persons, services, and businesses to mitigate risks between participants during asset transfer. HTLC implement conditional transfers, whereby a designated party (the \"recipient\") will reveal the preimage of a hash in order to execute the asset transfers from a second party (the \"depositor\"), else after time lock expiry \"depositor\" may retrieve their assets. No third-party escrow agent is required, rather the HTLC operation enforces conditions, evaluations and transfers through the BitShares consensus protocol.\r\n\r\n# **Rational**\r\n\r\n## **Elements of a Hashed Time-Locked Contract (HTLC)**\r\n\r\nAn HTLC is defined to have the following components:\r\n\r\n* Parties to the HTLC\r\n\r\n    * The depositor\r\n\r\n    * The recipient\r\n\r\n* Escrow Asset\r\n\r\n    * Asset symbol\r\n    \r\n    * Asset quantity\r\n\r\n* Conditions\r\n\r\n    * Hash lock\r\n\r\n        * Preimage (the secret)\r\n\r\n        * Preimage hash (hash of the preimage)\r\n\r\n        * Preimage length\r\n\r\n    * Time lock\r\n\r\n        * Timeout threshold (expiry)\r\n\r\n* Condition Evaluators\r\n\r\n* Fees\r\n\r\n  * Prepare operation fee\r\n  \r\n  * Prepare duration fee\r\n\r\n### **Parties**\r\n\r\nTwo parties must be defined within each HTLC: the `depositor` and the `recipient`. The `depositor` will escrow their assets within the HTLC and designate the `recipient` to receive them. Note that a proposal transaction may be used for tasks such as multi-signature, but the end result at approval remains a single `depositor` and a single `recipient`.\r\n\r\n### **Escrow Asset**\r\n\r\nAn HTLC involves a conditional transfer of the defined `asset symbol` in the amount of `assets quantity` from the `depositor` to the `recipient`. The HTLC holds these designated `escrow assets` from `depositor` on the blockchain and will continue to enforce the specified `conditions` until one is satisfied.\r\n\r\n### **Conditions**\r\n\r\nThere are two competing conditions within an HTLC, the `hash lock` and the `time lock`.\r\n\r\nThe HTLC contains a `hash lock` condition, which comprise both the `preimage hash` and `preimage length`, barring the transfer of held `escrow assets` unless satisfied. If a `preimage` of requisite `length` is provided to the HTLC which generates a hash matching the `preimage hash`, the `preimage` is then stored within the blockchain, and the `escrow assets` are transferred to the `recipient`.\r\n\r\nIf a satisfactory `preimage` is not provided to the HTLC before the stipulated `time lock` expires, the `depositor` may request the return of `escrow assets`. The HTLC will only evaluate transfer request from `depositor` and after `timeout threshold`, then return `escrow assets` to `depositor`.\r\n\r\n**Note:** we recommend the Committee the set maximum allowable `preimage length` to ensure unreasonably large submissions are rejected. \r\n\r\n### **Condition Evaluators**\r\n\r\nThe `preimage` can be thought of a secret key, that will eventually be shared with the `recipient`. This can be a word, a phrase, or even a random series of bytes. The `length` of the `preimage` must be specified within the HTLC at creation.\r\n\r\nUpon presentation of a `preimage`, the HTLC `condition evaluator` validates:\r\n\r\n1. That the `timeout threshold` has not yet occurred.\r\n\r\n2. That the length of the `preimage` matches the specified `preimage length`. \r\n\r\n3. That the hash of the `preimage` calculates to the specified `preimage hash`. \r\n\r\nIf all evaluations succeed, the `escrow assets` are transferred to the `recipient`. If any evaluation fails, nothing happens; the HTLC remains ready to evaluate the next `preimage`.\r\n\r\nUpon presentation of a request from the `depositor` for return of `escrow assets`, the HTLC `condition evaluator` validates that the `timeout threshold` is now in the past. It then returns the `escrow assts` to `depositor`.\r\n\r\n### **Timing of Condition Evaluation**\r\n\r\nThe `timeout threshold` of the contract is defined by `depositor` within the HTLC at creation. It can be any time in the future and should allow enough time for `recipient` to review the HTLC and provide the `preimage`. Further, it should not be set too far into the future to mitigate against an unresponsive `recipient` impacting `depositor`, as their `escrow assets` will be locked until `timeout threshold` expiry. The accuracy is based on when the `condition evaluator` runs, and should be considered accurate ± 15 seconds.\r\n\r\n**Note:** we recommend the Committee set the maximum value for `timeout threshold` to limit the amount of time a contract may consume memory of validation nodes.\r\n\r\n### **Early Termination of an Escrow Contract**\r\n\r\nTo protect the `recipient`, early termination of an HTLC is not allowed by any party. Placing a `timeout threshold` far into the future is valid, up to the maximum defined by the Committee. User protection from locking up funds for an extremely long period could be provided by the UI used to create the HTLC.\r\n\r\n### **Automatic Transfers Upon Expiry**\r\n\r\nUpon expiry of the `timeout threshold`, the `escrow assets` held within the HTLC will be queued for return to `depositor`. No action is required by the `depositor` to receive their \"locked\" funds back from the contract after expiry. \r\n\r\n### **Fees**\r\n\r\nWe propose three (3) operations (see Specification) to implement the HTLC feature, each requiring distinct fees. All fees will be set and maintained by the Committee. \r\n\r\nThe \"prepare\" operation will store in-memory data on validation nodes until redeemed or expiry. We recommend the `htlc_preparation_fee` be comprised of two (2) components: `GRAPHENE_HTLC_PREPARE_FEE` which is flat and `GRAPHENE_HTLC_DAILY_FEE` which is variable based on the number of days until `timeout threshold`.\r\n\r\nThe \"redeem\" operation frees most of the memory from the validation nodes and adds the `preimage` data into blockchain storage when the transaction is validated. We recommend the `htlc_redemption_fee` be comprised of two (2) components: `GRAPHEN_HTLC_REDEEM_FEE` which is may be quite low and `GRAPHENE_HTLC_KB_FEE` which is variable based on the total number of kilobytes of data committed to the blockchain.\r\n\r\nThe \"extend expiry\" operation will update the `timeout_threshold` to a future date. We recommend the `htlc_extend_expiry_fee` be calculated based on the number of additional days at the current `GRAPHENE_HTLC_DAILY_FEE` rate.\r\n\r\n## **Existing Escrow Proposals**\r\n\r\nThis section describes various escrow concepts that have been proposed either for BitShares or for other blockchains or services in terms of the elements that have been defined above. This is intended to provide some background and comparison to the concepts that follow.\r\n\r\n### **BitShares Escrow**\r\n\r\nA separate BSIP [cite] is currently being discussed that provides a more traditional escrow service. This involves parties, agents, and a more complex evaluation. HTLC shares some similarities, and could be considered a thin subset of BitShares Escrow.\r\n\r\nThe smaller, well-defined nature of HTLC provides a major advantage for applications that want to attempt tasks such as cross chain atomic swaps.\r\n\r\n### **Scorum Atomic Swap**\r\n[cite]\r\n\r\n### **BitShares Multi-Signature Account**\r\n\r\nOne of the existing features of BitShares is the ability to have an account that requires multiples signatures by differently authorized parties [cite] and even hierarchical authorizations. Using this mechanism as a form of escrow is possible. But there are many limitations. More information on escrow and multi-signatures can be found in the BitShares Escrow BSIP [cite].\r\n\r\n### **BitShares Proposals**\r\n\r\nOne of the existing features of BitShares is the ability to have a proposal that is recorded on the blockchain and awaits the authorization of the requisite parties (e.g. M-of-N signatures) to execute. However, the proposal does not \"lock\" any assets, so the transfer will fail if the sending account lacks sufficient funds during validation. If the required authorizations are not given by proposal expiry, then no transfer will occur. This feature also contains many limitations when compared to HTLC.\r\n\r\n## **Possible Concepts to Implement**\r\n\r\nThe following will describe possible concepts that could be implemented within the BitShares protocol.\r\n\r\n### **Set-Price Swap**\r\n\r\nTwo parties may agree on a swap of two distinct `escrow assets` at a set price (defined exchange ratio), without using an exchange such as the BitShares DEX. This will require two (2) HTLC contracts containing the identical `preimage hash` within each to \"link\" them together and facilitate the execution of an \"atomic swap\" of these \"locked\" `escrow assets` between the party's accounts resulting in a trustless value exchange.\r\n\r\n#### **Business Approach**\r\n\r\nAlice begins by generating a distinct `preimage` of her choosing, notes the `preimage length` and calculates the `preimage hash`. She retains the `preimage` in secret, then creates a new HTLC stipulating that the `depositor` account \"alice\" will transfer `quantity` \"100\" \"bitUSD\" `asset` into the `recipient` account \"bob\" if a `preimage` is presented matching the `preimage hash` before the `timelock threshold` of 10AM tomorrow. Upon consensus validation of the HTLC, the 100 bitUSD `escrow assets` are transferred from Alice's `depositor` account into the HTLC where they remain locked by the `preimage hash` and `timelock threshold`. She then shares the resulting `contract identifier` with Bob.\r\n\r\nBob queries the blockchain for the `contract identifier` Alice provided. He examines to ensure it contains his desired `recipient` account, `asset` symbol, asset `quantity`, `preimage length`, and `timelock threshold`. Bob now creates his own HTLC that will deposit `quantity` \"10,000\" \"BTS\" `symbol` into the `recipient` account \"alice\" from `depositor` account \"bob\", if a `preimage` that generates the `preimage hash` Bob copied from Alice's HTLC before the `timelock threshold` of 5pm today. Upon consensus validation of Bob's HTLC, his 10,000 BTS `escrow assets` are transferred from his `depositor` account and \"locked\" into the contract. He then shares the resulting `contract identifier` with Alice. Notice Bob specified a `timelock threshold` much shorter than Alice defined in her contract. This ensures Bob will have enough time to observe and use the `preimage` Alice will publish to the blockchain next. \r\n\r\nAlice now examines the HTLC Bob created, ensuring the `preimage hash` and `preimage length` both match the original values she used within her contract. She also verifies her desired `recipient` account \"alice\", the `quantity`, `symbol`, and the `timelock threshold` agree with her intentions. She now uses her `preimage` to \"unlock\" Bob's contract. Once consensus validation occurs, the HTLC will transfer the `escrow assets` 10,000 BTS into her `recipient` account \"alice\". This reveals the `preimage` on the BitShares blockchain for Bob to use next. NOTE: She must do this before 5PM. Otherwise, Bob may (and should) reclaim the funds in the contract he created.\r\n\r\nBob can now observe the `preimage` Alice used to \"unlock\" his HTLC, and he will use it to \"unlock\" her HTLC to receive the 100 bitUSD `escrow assets` into his `recipient` account \"bob\". NOTE: He must do this before 10AM tomorrow. Otherwise, Alice may (and should) reclaim the funds in the contract she created.\r\n\r\n### **Cross-Chain Swap**\r\n\r\nSimilar to the set-price swap mentioned above, two parties may exchange tokens between distinct blockchains when both implement HTLC support. Bitcoin, Litecoin and many others support HTLC [cite].\r\n\r\n#### **Business Approach**\r\n\r\nAlice and Bob intend to swap BTC (bitcoin token) and BTS (BitShares token). This will require both parties to define both a BTC deposit address and BTS deposit account. These addresses/accounts will be exchanged between the parties.\r\n\r\nAlice will initiate the first leg of the swap on the BitShares Network with her HTLC and Bob will follow up on the Bitcoin Network with his HTLC. Allice generates a distinct `preimage` of her choosing, notes the `preimage length` and calculates the `preimage hash`. She retains the `preimage` in secret, then creates a new HTLC stipulating that the `depositor` account \"alice\" will transfer `quantity` \"10,000\" \"bitUSD\" `asset` into the `recipient` account \"bob\" if a `preimage` is presented matching the `preimage hash` before the `timelock threshold` of 10AM tomorrow. Upon consensus validation of the HTLC on the BitShares Network, the 10,000 bitUSD `escrow assets` are transferred from Alice's `depositor` account into the HTLC where they remain locked by the `preimage hash` and `timelock threshold`. She then shares the resulting `contract identifier` with Bob.\r\n\r\nBob queries the BitShares Network for the `contract identifier` Alice provided. He examines to ensure it contains his desired `recipient` account, `asset` symbol, asset `quantity`, `preimage length`, and `timelock threshold`. Bob now creates and funds his own HTLC on the Bitcoin Network that will spend the `UTXO` of this contract to the `recipient address` Alice provided during their setup phase, of `amount` 1 BTC if a `preimage` that generates the `preimage hash` Bob copied from Alice's HTLC before the `timelock threshold` of 5pm today. Upon consensus validation of Bob's HTLC on the Bitcoin Network, 1 BTC he controlled are spent into the contract and \"locked\". He then shares the resulting `contract identifier` with Alice. Notice Bob specified a `timelock threshold` much shorter than Alice defined in her contract. This ensures Bob will have enough time to observe and use the `preimage` Alice will publish to the blockchain next. \r\n\r\nAlice now examines the HTLC Bob created on the Bitcoin Network, ensuring the `preimage hash` and `preimage length` both match the original values she used within her contract. She also verifies her desired `recipient address`, `quantity`, and `timelock threshold` agree with her intentions. She now uses her `preimage` to \"unlock\" Bob's contract. Once consensus validation occurs on the Bitcoin Network, the HTLC will spend 1 BTC to Alice's `recipient address`. This reveals the `preimage` on the Bitcoin Network for Bob to use next. NOTE: She must do this before 5PM. Otherwise, Bob may (and should) reclaim the funds in the contract he created.\r\n\r\nBob has now observed the `preimage` Alice used to \"unlock\" his HTLC, and he will use it to \"unlock\" her HTLC to receive the 10,000 bitUSD `escrow assets` into his `recipient` account \"bob\". NOTE: He must do this before 10AM tomorrow. Otherwise, Alice may (and should) reclaim the funds in the contract she created.\r\n\r\n# **Specifications**\r\n\r\n## **Objects**\r\n\r\n```\r\nhtlc_obj\r\n  id                // int\r\n  depositor         // account object\r\n  quantity           // int\r\n  symbol            // string\r\n  recipient         // account object\r\n  preimage_hash     // string\r\n  preimage_length   // int\r\n  preimage_tx_id    // reference to transaction object containing the preimage used for htlc_redeem\r\n  timeout_threshold // datetime\r\n\r\n  // Constructor\r\n  Set: id = next available\r\n  Initialize other fields = NULL\r\n\r\n  return contract\r\n```\r\n\r\n## **Operations**\r\n\r\n### **Prepare**\r\n\r\n```\r\ntransaction_obj htlc_prepare(depositor, quantity, symbol, recipient, preimage_hash, preimage_length, timeout_threshold, htlc_preparation_fee)\r\n  Validate: HTLC signed by requisite `authority` for `depositor` account \r\n  Validate: `depositor` account has requisite `quantity` of `symbol` asset for the `guarantee`\r\n  Validate: `timeout_threshold` < now() + GRAPHENE_HTLC_MAXIMUM_DURRATION\r\n  Calculate: `required_fee` = GRAPHENE_HTLC_OPERATION_FEE + GRAPHENE_HTLC_DAILY_FEE * count((`timeout_threshold` - now()), days)\r\n  Validate: `depositor` account has requisite `quantity` of BTS for `required_fee`\r\n  Validate: `recipient` account exists\r\n  Validate: `preimage_length` does not exceed GRAPHENE_HTLC_MAXIMUM_PREIMAGE_LENGTH\r\n  Validate: `preimage_hash` well formed\r\n  Update: BTS balance of `depositor` based on `required_fee`)\r\n  contract = new htlc_obj\r\n  Set: `contract.depositor` = `depositor`\r\n  Set: `contract.recipient` = `recipient`\r\n  Set: `contract.preimage_hash` = `preimage_hash`\r\n  Set: `contract.preimage_length` = `preimage_length`\r\n  Set: `contract.timeout_treshold` = `timeout_threshold`\r\n  Transfer: from `depositor` account to `contract.quantity` of `contract.symbol`\r\n  return results\r\n```\r\n\r\n### **Redeem**\r\n\r\n```\r\ntransaction_obj htlc_redeem(redeemer, id, preimage, htlc_redemption_fee)\r\n  Validate: transaction signed by requisite `authority` for `redeemer` // any account may attempt to redeem\r\n  Get: get_htlc(id)\r\n  Validate: `redeemer` account has requisite `quantity` of BTS for `htlc_redeem_fee` and `htlc_kb_fee`\r\n  // Evaluate: timelock\r\n     if now() < `timeout_threshold` then return error // \"timeout exceeded\"\r\n  Update: balance of `redeemer` based on total fees\r\n  // Evaluate: hashlock\r\n     if length(preimage) != `id.preimage_length` then return error // \"preimage length mismatch\"\r\n     Calculate: `preimage_hash` = hash(preimage)\r\n     if `preimage_hash` != `id.preimage_hash` then return error // \"invalid preimage submitted\"\r\n     Update: balance of `id.recipient` add asset `id.symbol` of quantity `id.quantity`\r\n     Add: transaction to mempool \r\n     Set: `id.preimage_tx_id` = `transaction_id` \r\n     Cleanup: memory allocated to this htlc\r\n     return: results\r\n```\r\n\r\n### **Extend Expiry**\r\n\r\n```\r\ntransaction_obj htlc_extend_expiry(depositor, id, timeout_threshold, htlc_extention_fee)\r\n  Validate: transaction signed by requisite `authority` for `depositor` account \r\n  Validate: `timeout_threshold` < now() + GRAPHENE_HTLC_MAXIMUM_DURRATION\r\n  Calculate: `required_fee` = GRAPHENE_HTLC_DAILY_FEE * count((`timeout_threshold` - now()), days)\r\n  Validate: `depositor` account has requisite `quantity` of BTS for `required_fee`\r\n  Update: BTS balance of `depositor` based on `required_fee`)\r\n  Set: `contract.timeout_treshold` = `timeout_threshold`\r\n  return results\r\n```\r\n\r\n## **APIs**\r\n\r\n### **get_htlc**\r\n\r\n### **htlc_prepare**\r\n\r\n### **htlc_redeem**\r\n\r\n### **htlc_extend_expiry**\r\n\r\n# **Discussion**\r\n\r\nhttps://github.com/bitshares/bsips/pull/104\r\n\r\n# **Summary for Shareholders**\r\n\r\nTBD\r\n\r\n# **Copyright**\r\n\r\nThis document is placed in the public domain.\r\n\r\n# **See Also**\r\n\r\nA description of [Hashed Timelock Contracts](https://en.bitcoinwiki.org/wiki/Hashed_Timelock_Contracts)\r\n","created_at":"2018-08-28T13:53:37Z","updated_at":"2018-08-30T14:27:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d14c8aedae38b1d2b27b68417dcdbf83fcbe8d59","assignee":{"login":"jmjatlanta","id":4626076,"node_id":"MDQ6VXNlcjQ2MjYwNzY=","avatar_url":"https://avatars3.githubusercontent.com/u/4626076?v=4","gravatar_id":"","url":"https://api.github.com/users/jmjatlanta","html_url":"https://github.com/jmjatlanta","followers_url":"https://api.github.com/users/jmjatlanta/followers","following_url":"https://api.github.com/users/jmjatlanta/following{/other_user}","gists_url":"https://api.github.com/users/jmjatlanta/gists{/gist_id}","starred_url":"https://api.github.com/users/jmjatlanta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmjatlanta/subscriptions","organizations_url":"https://api.github.com/users/jmjatlanta/orgs","repos_url":"https://api.github.com/users/jmjatlanta/repos","events_url":"https://api.github.com/users/jmjatlanta/events{/privacy}","received_events_url":"https://api.github.com/users/jmjatlanta/received_events","type":"User","site_admin":false},"assignees":[{"login":"jmjatlanta","id":4626076,"node_id":"MDQ6VXNlcjQ2MjYwNzY=","avatar_url":"https://avatars3.githubusercontent.com/u/4626076?v=4","gravatar_id":"","url":"https://api.github.com/users/jmjatlanta","html_url":"https://github.com/jmjatlanta","followers_url":"https://api.github.com/users/jmjatlanta/followers","following_url":"https://api.github.com/users/jmjatlanta/following{/other_user}","gists_url":"https://api.github.com/users/jmjatlanta/gists{/gist_id}","starred_url":"https://api.github.com/users/jmjatlanta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmjatlanta/subscriptions","organizations_url":"https://api.github.com/users/jmjatlanta/orgs","repos_url":"https://api.github.com/users/jmjatlanta/repos","events_url":"https://api.github.com/users/jmjatlanta/events{/privacy}","received_events_url":"https://api.github.com/users/jmjatlanta/received_events","type":"User","site_admin":false},{"login":"ryanRfox","id":13419165,"node_id":"MDQ6VXNlcjEzNDE5MTY1","avatar_url":"https://avatars1.githubusercontent.com/u/13419165?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanRfox","html_url":"https://github.com/ryanRfox","followers_url":"https://api.github.com/users/ryanRfox/followers","following_url":"https://api.github.com/users/ryanRfox/following{/other_user}","gists_url":"https://api.github.com/users/ryanRfox/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanRfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanRfox/subscriptions","organizations_url":"https://api.github.com/users/ryanRfox/orgs","repos_url":"https://api.github.com/users/ryanRfox/repos","events_url":"https://api.github.com/users/ryanRfox/events{/privacy}","received_events_url":"https://api.github.com/users/ryanRfox/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/bitshares/bsips/pulls/104/commits","review_comments_url":"https://api.github.com/repos/bitshares/bsips/pulls/104/comments","review_comment_url":"https://api.github.com/repos/bitshares/bsips/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bitshares/bsips/issues/104/comments","statuses_url":"https://api.github.com/repos/bitshares/bsips/statuses/1961fb9c0030cec20a7e4efde7b419903a0aa3c9","head":{"label":"bitshares:bsip-hashed-timelock-contract","ref":"bsip-hashed-timelock-contract","sha":"1961fb9c0030cec20a7e4efde7b419903a0aa3c9","user":{"login":"bitshares","id":6914094,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MTQwOTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6914094?v=4","gravatar_id":"","url":"https://api.github.com/users/bitshares","html_url":"https://github.com/bitshares","followers_url":"https://api.github.com/users/bitshares/followers","following_url":"https://api.github.com/users/bitshares/following{/other_user}","gists_url":"https://api.github.com/users/bitshares/gists{/gist_id}","starred_url":"https://api.github.com/users/bitshares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitshares/subscriptions","organizations_url":"https://api.github.com/users/bitshares/orgs","repos_url":"https://api.github.com/users/bitshares/repos","events_url":"https://api.github.com/users/bitshares/events{/privacy}","received_events_url":"https://api.github.com/users/bitshares/received_events","type":"Organization","site_admin":false},"repo":{"id":48125108,"node_id":"MDEwOlJlcG9zaXRvcnk0ODEyNTEwOA==","name":"bsips","full_name":"bitshares/bsips","owner":{"login":"bitshares","id":6914094,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MTQwOTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6914094?v=4","gravatar_id":"","url":"https://api.github.com/users/bitshares","html_url":"https://github.com/bitshares","followers_url":"https://api.github.com/users/bitshares/followers","following_url":"https://api.github.com/users/bitshares/following{/other_user}","gists_url":"https://api.github.com/users/bitshares/gists{/gist_id}","starred_url":"https://api.github.com/users/bitshares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitshares/subscriptions","organizations_url":"https://api.github.com/users/bitshares/orgs","repos_url":"https://api.github.com/users/bitshares/repos","events_url":"https://api.github.com/users/bitshares/events{/privacy}","received_events_url":"https://api.github.com/users/bitshares/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitshares/bsips","description":"BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.","fork":false,"url":"https://api.github.com/repos/bitshares/bsips","forks_url":"https://api.github.com/repos/bitshares/bsips/forks","keys_url":"https://api.github.com/repos/bitshares/bsips/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitshares/bsips/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitshares/bsips/teams","hooks_url":"https://api.github.com/repos/bitshares/bsips/hooks","issue_events_url":"https://api.github.com/repos/bitshares/bsips/issues/events{/number}","events_url":"https://api.github.com/repos/bitshares/bsips/events","assignees_url":"https://api.github.com/repos/bitshares/bsips/assignees{/user}","branches_url":"https://api.github.com/repos/bitshares/bsips/branches{/branch}","tags_url":"https://api.github.com/repos/bitshares/bsips/tags","blobs_url":"https://api.github.com/repos/bitshares/bsips/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitshares/bsips/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitshares/bsips/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitshares/bsips/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitshares/bsips/statuses/{sha}","languages_url":"https://api.github.com/repos/bitshares/bsips/languages","stargazers_url":"https://api.github.com/repos/bitshares/bsips/stargazers","contributors_url":"https://api.github.com/repos/bitshares/bsips/contributors","subscribers_url":"https://api.github.com/repos/bitshares/bsips/subscribers","subscription_url":"https://api.github.com/repos/bitshares/bsips/subscription","commits_url":"https://api.github.com/repos/bitshares/bsips/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitshares/bsips/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitshares/bsips/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitshares/bsips/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitshares/bsips/contents/{+path}","compare_url":"https://api.github.com/repos/bitshares/bsips/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitshares/bsips/merges","archive_url":"https://api.github.com/repos/bitshares/bsips/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitshares/bsips/downloads","issues_url":"https://api.github.com/repos/bitshares/bsips/issues{/number}","pulls_url":"https://api.github.com/repos/bitshares/bsips/pulls{/number}","milestones_url":"https://api.github.com/repos/bitshares/bsips/milestones{/number}","notifications_url":"https://api.github.com/repos/bitshares/bsips/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitshares/bsips/labels{/name}","releases_url":"https://api.github.com/repos/bitshares/bsips/releases{/id}","deployments_url":"https://api.github.com/repos/bitshares/bsips/deployments","created_at":"2015-12-16T17:33:17Z","updated_at":"2018-08-27T17:15:30Z","pushed_at":"2018-08-29T20:41:00Z","git_url":"git://github.com/bitshares/bsips.git","ssh_url":"git@github.com:bitshares/bsips.git","clone_url":"https://github.com/bitshares/bsips.git","svn_url":"https://github.com/bitshares/bsips","homepage":"https://bitshares.org","size":1745,"stargazers_count":41,"watchers_count":41,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":50,"mirror_url":null,"archived":false,"open_issues_count":51,"license":null,"forks":50,"open_issues":51,"watchers":41,"default_branch":"master"}},"base":{"label":"bitshares:master","ref":"master","sha":"bbe731878cd5e231cb2692295acf708d2140d239","user":{"login":"bitshares","id":6914094,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MTQwOTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6914094?v=4","gravatar_id":"","url":"https://api.github.com/users/bitshares","html_url":"https://github.com/bitshares","followers_url":"https://api.github.com/users/bitshares/followers","following_url":"https://api.github.com/users/bitshares/following{/other_user}","gists_url":"https://api.github.com/users/bitshares/gists{/gist_id}","starred_url":"https://api.github.com/users/bitshares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitshares/subscriptions","organizations_url":"https://api.github.com/users/bitshares/orgs","repos_url":"https://api.github.com/users/bitshares/repos","events_url":"https://api.github.com/users/bitshares/events{/privacy}","received_events_url":"https://api.github.com/users/bitshares/received_events","type":"Organization","site_admin":false},"repo":{"id":48125108,"node_id":"MDEwOlJlcG9zaXRvcnk0ODEyNTEwOA==","name":"bsips","full_name":"bitshares/bsips","owner":{"login":"bitshares","id":6914094,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5MTQwOTQ=","avatar_url":"https://avatars3.githubusercontent.com/u/6914094?v=4","gravatar_id":"","url":"https://api.github.com/users/bitshares","html_url":"https://github.com/bitshares","followers_url":"https://api.github.com/users/bitshares/followers","following_url":"https://api.github.com/users/bitshares/following{/other_user}","gists_url":"https://api.github.com/users/bitshares/gists{/gist_id}","starred_url":"https://api.github.com/users/bitshares/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitshares/subscriptions","organizations_url":"https://api.github.com/users/bitshares/orgs","repos_url":"https://api.github.com/users/bitshares/repos","events_url":"https://api.github.com/users/bitshares/events{/privacy}","received_events_url":"https://api.github.com/users/bitshares/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bitshares/bsips","description":"BitShares Improvement Proposals and Protocols. These technical documents describe the process of updating and improving the BitShares blockchain and technical ecosystem.","fork":false,"url":"https://api.github.com/repos/bitshares/bsips","forks_url":"https://api.github.com/repos/bitshares/bsips/forks","keys_url":"https://api.github.com/repos/bitshares/bsips/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bitshares/bsips/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bitshares/bsips/teams","hooks_url":"https://api.github.com/repos/bitshares/bsips/hooks","issue_events_url":"https://api.github.com/repos/bitshares/bsips/issues/events{/number}","events_url":"https://api.github.com/repos/bitshares/bsips/events","assignees_url":"https://api.github.com/repos/bitshares/bsips/assignees{/user}","branches_url":"https://api.github.com/repos/bitshares/bsips/branches{/branch}","tags_url":"https://api.github.com/repos/bitshares/bsips/tags","blobs_url":"https://api.github.com/repos/bitshares/bsips/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bitshares/bsips/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bitshares/bsips/git/refs{/sha}","trees_url":"https://api.github.com/repos/bitshares/bsips/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bitshares/bsips/statuses/{sha}","languages_url":"https://api.github.com/repos/bitshares/bsips/languages","stargazers_url":"https://api.github.com/repos/bitshares/bsips/stargazers","contributors_url":"https://api.github.com/repos/bitshares/bsips/contributors","subscribers_url":"https://api.github.com/repos/bitshares/bsips/subscribers","subscription_url":"https://api.github.com/repos/bitshares/bsips/subscription","commits_url":"https://api.github.com/repos/bitshares/bsips/commits{/sha}","git_commits_url":"https://api.github.com/repos/bitshares/bsips/git/commits{/sha}","comments_url":"https://api.github.com/repos/bitshares/bsips/comments{/number}","issue_comment_url":"https://api.github.com/repos/bitshares/bsips/issues/comments{/number}","contents_url":"https://api.github.com/repos/bitshares/bsips/contents/{+path}","compare_url":"https://api.github.com/repos/bitshares/bsips/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bitshares/bsips/merges","archive_url":"https://api.github.com/repos/bitshares/bsips/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bitshares/bsips/downloads","issues_url":"https://api.github.com/repos/bitshares/bsips/issues{/number}","pulls_url":"https://api.github.com/repos/bitshares/bsips/pulls{/number}","milestones_url":"https://api.github.com/repos/bitshares/bsips/milestones{/number}","notifications_url":"https://api.github.com/repos/bitshares/bsips/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bitshares/bsips/labels{/name}","releases_url":"https://api.github.com/repos/bitshares/bsips/releases{/id}","deployments_url":"https://api.github.com/repos/bitshares/bsips/deployments","created_at":"2015-12-16T17:33:17Z","updated_at":"2018-08-27T17:15:30Z","pushed_at":"2018-08-29T20:41:00Z","git_url":"git://github.com/bitshares/bsips.git","ssh_url":"git@github.com:bitshares/bsips.git","clone_url":"https://github.com/bitshares/bsips.git","svn_url":"https://github.com/bitshares/bsips","homepage":"https://bitshares.org","size":1745,"stargazers_count":41,"watchers_count":41,"language":null,"has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":50,"mirror_url":null,"archived":false,"open_issues_count":51,"license":null,"forks":50,"open_issues":51,"watchers":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bitshares/bsips/pulls/104"},"html":{"href":"https://github.com/bitshares/bsips/pull/104"},"issue":{"href":"https://api.github.com/repos/bitshares/bsips/issues/104"},"comments":{"href":"https://api.github.com/repos/bitshares/bsips/issues/104/comments"},"review_comments":{"href":"https://api.github.com/repos/bitshares/bsips/pulls/104/comments"},"review_comment":{"href":"https://api.github.com/repos/bitshares/bsips/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bitshares/bsips/pulls/104/commits"},"statuses":{"href":"https://api.github.com/repos/bitshares/bsips/statuses/1961fb9c0030cec20a7e4efde7b419903a0aa3c9"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"pmconrad"}}