rgb-archive / spec

[OLD!] RGB Protocol specifications for Bitcoin-based digital assets
https://rgb-org.github.io/
148 stars 26 forks source link

Implementing issue #61: disambiguing P2C RGB tweak #73

Closed dr-orlovsky closed 5 years ago

dr-orlovsky commented 5 years ago

Adding "RGB" string to the public/private key tweaking procedure in pay-to-contract commitment scheme in order to prevent attacks around re-interpreting RGB contracts as some non-RGB contracts.

Implements issue #61

inaltoasinistra commented 5 years ago

For this purpose we could use the operation defined in bip-taproot.

hashtag(m) is a shorthand for SHA256(SHA256(tag) || SHA256(tag) || m), where tag is a UTF-8 encoded tag name.

This would reduce the incompatibilities among technologies and it would simplify future integrations or libraries design

dr-orlovsky commented 5 years ago

I've updated both P2C scheme to be 100%-compatible with the best practice from the Taproot proposal – and also OP_RETURN with the same tag, preventing the similar issue.

However, I am not sure about using single or double-SHA256 hash in P2C scheme: in Taproot we have a single hash, while the original RGB spec was mentioning double. Since I do not see any advantage of using double hash here, I have stuck with Taproot-compatible single hash.