raiden-network / spec

Spec of the Raiden Network protocol
8 stars 19 forks source link

Secret encrypted on metadata #344

Closed andrevmatos closed 2 years ago

andrevmatos commented 3 years ago

Abstract

Spec for https://github.com/raiden-network/raiden/issues/7071 When making a transfer, after validations pass, we need to reveal the secret only to target. Usually (fallback case), this is done by target sending a message to initiator requesting the secret, initiator doing the validation on its side and then revealing the secret to target directly, which then is able to proceed with unlocking. There's a way to do that without requiring this slower messaging exchange, by using ECIES to encrypt the secret and the information needed for its validation with target's public key. The downside is that this puts the responsibility of validating these information on the target, and the initiator doesn't have the ability to cancel this transfer by forgetting the secret before revealing anymore. But we never implemented features which would require this anyway, and the optimisation is more important ATM.

Spec

Conclusion

This change depends on immutableMetadata capability, but it'll gracefully fall back to behavior compatible with 2.0/Bespin in case it isn't possible, so it's fully backwards compatible.

This is an optimisation to avoid target needing to message initiator, which usually doesn't have an RTC channel established, and would allow RTC channels to be established only between partners, reducing the attack surface and speeding the transfer times since first transfer to a new target.

This also fixes https://github.com/raiden-network/raiden/issues/473