Skip to content

Commit

Permalink
Replace hashlock with secrethash
Browse files Browse the repository at this point in the history
  • Loading branch information
LefterisJP committed Mar 23, 2018
1 parent b60fd3c commit 8a6d2b3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions messaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Invariants
Hash
^^^^

- ``sha3_keccak(expiration || amount || hashlock)``
- ``sha3_keccak(expiration || amount || secrethash)``

Fields
^^^^^^
Expand All @@ -74,7 +74,7 @@ Fields
+----------------------+-------------+------------------------------------------------------------+
| locked_amount | uint256 | amount of tokens held by the lock |
+----------------------+-------------+------------------------------------------------------------+
| hashlock | bytes32 | sha3 of the secret |
| secrethash | bytes32 | sha3 of the secret |
+----------------------+-------------+------------------------------------------------------------+


Expand Down Expand Up @@ -146,7 +146,7 @@ Fields
+======================+===============+============================================================+
| payment_amount | uint256 | The amount received by the node once secret is revealed |
+----------------------+---------------+------------------------------------------------------------+
| lock_hashlock | bytes32 | Specifies which lock is being unlocked |
| lock_secrethash | bytes32 | Specifies which lock is being unlocked |
+----------------------+---------------+------------------------------------------------------------+
| signature | bytes | Elliptic Curve 256k1 signature |
+----------------------+---------------+------------------------------------------------------------+
Expand Down Expand Up @@ -205,7 +205,7 @@ Fields
+----------------------+---------------+------------------------------------------------------------+
| Field Name | Field Type | Description |
+======================+===============+============================================================+
| hashlock | bytes32 | The hashlock to remove |
| secrethash | bytes32 | The hashlock to remove |
+----------------------+---------------+------------------------------------------------------------+
| balance_proof | BalanceProof | The updated balance proof |
+----------------------+---------------+------------------------------------------------------------+
Expand Down Expand Up @@ -252,7 +252,7 @@ A succesfull direct transfer involves only 2 messages. The direct transfer messa

Mediated Transfer
^^^^^^^^^^^^^^^^^
A :term:`Mediated Transfer` is a hashlocked transfer. Currently raiden supports only one type of lock. The lock has an amount that is being transferred, a :term:`hashlock` used to verify the secret that unlocks it, and a :term:`lock expiration` to determine its validity.
A :term:`Mediated Transfer` is a hashlocked transfer. Currently raiden supports only one type of lock. The lock has an amount that is being transferred, a :term:`secrethash` used to verify the secret that unlocks it, and a :term:`lock expiration` to determine its validity.

Mediated transfers have an :term:`initiator` and a :term:`target` and a number of hops in between. The number of hops can also be zero as these transfers can also be sent to a direct partner. Assuming ``N`` number of hops a mediated transfer will require ``6N + 8`` messages to complete. These are:

Expand Down
6 changes: 3 additions & 3 deletions pathfinding_service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The following data types are taken from the Raiden Core spec.

* uint64: expiration
* uint256: locked_amount
* bytes32: hashlock
* bytes32: secrethash

Public Endpoints
----------------
Expand Down Expand Up @@ -100,12 +100,12 @@ Example
{
"expiration": 200
"locked_amount": 40
"hashlock": "<keccak-hash>"
"secrethash": "<keccak-hash>"
},
{
"expiration": 50
"locked_amount": 10
"hashlock": "<keccak-hash>"
"secrethash": "<keccak-hash>"
},
],
}' /api/1/balance
Expand Down
10 changes: 5 additions & 5 deletions smart_contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Unlocks a pending transfer by providing the secret and increases the partner's t
address partner,
uint64 expiration_block,
uint locked_amount,
bytes32 hashlock,
bytes32 secrethash,
bytes merkle_proof,
bytes32 secret)
public
Expand All @@ -244,7 +244,7 @@ Unlocks a pending transfer by providing the secret and increases the partner's t
address partner,
uint64 expiration_block,
uint256 locked_amount,
bytes32 hashlock,
bytes32 secrethash,
bytes merkle_proof,
bytes32 secret)
external
Expand All @@ -257,9 +257,9 @@ Unlocks a pending transfer by providing the secret and increases the partner's t
- ``partner``: Ethereum address of the channel participant that pays the ``locked_amount``.
- ``expiration_block``: The absolute block number at which the lock expires.
- ``locked_amount``: The number of tokens being transferred.
- ``hashlock``: A hashed secret, ``sha3_keccack(secret)``.
- ``secrethash``: A hashed secret, ``sha3_keccack(secret)``.
- ``merkle_proof``: The merkle proof needed to compute the merkle root.
- ``secret``: The preimage used to derive a hashlock.
- ``secret``: The preimage used to derive a secrethash.
- ``payer_participant``: Ethereum address of the channel participant whose ``transferred_amount`` will be increased.
- ``transferred_amount``: The total amount of tokens that the ``payer_participant`` owes to the channel participant that calls this function.

Expand Down Expand Up @@ -336,7 +336,7 @@ Getters

function getSecretBlockHeight(bytes32 secret) public constant returns (uint64)

- ``secret``: The preimage used to derive a hashlock.
- ``secret``: The preimage used to derive a secrethash.

Data types definition
---------------------
Expand Down
2 changes: 1 addition & 1 deletion terminology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Raiden Terminology
lockhash
The hash of a lock. ``sha3_keccack(lock)``

hashlock
secrethash
The hash of a :term:`secret`. ``sha3_keccack(secret)``

balance proof
Expand Down

0 comments on commit 8a6d2b3

Please sign in to comment.