lbryio / proposals

Discussion of large projects
1 stars 0 forks source link

Claim Signatures (by victor) #5

Closed lyoshenka closed 5 years ago

lyoshenka commented 6 years ago

Claim signatures

Keep in mind: ANY change is retro incompatible. Even just including a field without changing anything else. The purpose of this document is to provide alternatives for making the next modifications less impacting.

Today

Claim is a protobuf message. It can be either a stream or a certificate. Certificate holds the public key, while the claim holds metadata. Inside that metadata, we have a signature. To validate that we:

  1. Get the content claim.
  2. Figure out which certificate signed it, fetch the certificate.
  3. Extract the signature from the protobuf
  4. Clear the signature field 4.1. Now we have the original protobuf, used for signing. This requires the whole operation to be deterministic. If one bit gets flipped, the signature won't match what is being signed.
  5. Take the hash of that re-encoded protobuf binary serialization, check that the signature was made for this hash. Done.

    The main issue

    We need to be able to re-encode it deterministically in order to validate.

    Issues

    • We depend on Google by making re-encoding deterministic
    • This can easily lock us on a protobuf version if serialization changes
    • Even being able to parse a protobuf, deterministically being able to recode it requires knowledge on the previous schema, at a minimum.
    • We need to know how a 10 years old claim was serialized, 10 years ago
    • Depending on how far ago it was signed, we would need technical knowledge on how a claim was encoded 10 years ago.
    • We can't verify claims from a future version, as we have no idea how that version serialized it. Even being able to parse the fields we care about.

Proposal 1 - Having the signature decoupled from the claim binary.

Instead of being a protobuf field, the signature would be appended to the protobuf binary, like: Claim content := <protobuf binary><signature>

How to verify:

  1. Parse the protobuf and check if has a signatures. Options for that: 1.1. check the certificate id from the protobuf. If it has a certificate id, assume it was signed and proceed to verification. If not, stop. 1.2. If not signed, add trailing zeroes. (thats not good, but I want to make sure I told all options :P)
  2. Get the trailing X bytes. The signature is a fixed length representation.
  3. Verify the original payload against the appended verification.

Upsides

Downsides

Proposal 2 - No on-chain claim metadata, with better off chain publishing support

How it would work:

  1. Publish your channel certificate as usual. If you really want the name, bid it for real. Or just get your channel permanent URI.
  2. Two scenarios: 2.1. if you want your published content to have a LBRY name or a traditional LBRY URI (with a claim id, for instance) and prove that it's on the blockchain -- Publish the hash of the metadata + signature (on chain publishing with off chain metadata) 2.2. if only you want your published content to be cryptographically proven legit (authentic LBRY channel publish) over any protocol -- Don't use the blockchain, just for channels (off-chain publishing)

The new on-chain format:

Many options are possible, but the main idea is that the content of the claim wouldn't be directly used, so the claim content would be: <SHA384 hash of the claim metadata><certificate claim id><signature>

On chain publishing:

Publisher:

Client:

Off chain publishing (after you have a channel):

Publisher:

Rationale:

Upsides:

Downsides:

Off chain services examples:

Basically, by making the metadata just like any other binary content and caring only for certificates, we are back to a model of public/private key, which is the most used model today for centralized services security. Except that now NO UNKNOWN AUTHORITY is necessary (like the root certificates or government issued signatures). Only the channel/person you already trusted in a decentralized manner over LBRY Blockchain. This allows whoever is serving the claim metadata blob to serve an infinite number of services.

Descriptions hosters

If we add a "description source" field to the certificate claim, you can edit descriptions at will and sign the edits under that source. Could be HTTP, for instance. Since integrity is not verified (just authenticity), you can provide up-to-date alternative descriptions if you want to. (hey, this is already possible"-ish". Maybe include it to the description editing issue?)

Live streams

As myself: I can claim that I will stream something at something something protocol. I can also sign the stream so you can be sure its me. As my poor famous self celebrity: I can let my fans further broadcast my stream, as it's signed and I don't need to trust them. As my own fan: I can sign the recorded signed stream and make a publish to watch myself over and over again, being cryptographically sure its me.

Transcoding

As the publisher:

CDNs/centralized services/current tech

I can serve my blobs from anywhere and anyone can serve them for me as in scalable fast centralized services. Except they can't lie/tamper/pretend its missing and don't need to be trusted.

"Optional options" for reducing the new format to 384 bits:

  1. Claim the blob hash of the metadata blob content concatenated with the signature (proposal 1)
  2. Claim the blob hash of a blob with signature+cert_id+metadata_blob_hash 2.1 adds a layer of indirection, so I prefer 1, but maybe reducing to 384 isn't a gain at all. Something for when we hit severe fee issues, maybe.

Proposal 3 - New transaction type

It was discussed something about creating a new type of transaction with the signature attached. It could be a push data or a whole new type of transaction. I will list why I don't like it, but I'm not a good fit to defend it as I think it's a bad idea.

How it would work (from what I understood): Two new transaction fields: certificate_id and signature

How to verify:

  1. extract the payload
  2. extract the signature
  3. extract the certificate id
  4. get the certificate and verify

Upsides

Downsides

Proposal 4 - Having the claim protobuf versioned

We already have a version for each part of the protobuf. Extend that so we know which version generated the signature.

I can't comment on that as I don't know how it would solve the problem. I believe we would be able to tell that we can't verify the signature because we don't know that schema, instead of just failing. However it would still have the main issue of forward compatibility.

lyoshenka commented 5 years ago

implemented