1

Context:

I'm trying to programmatically verify the owner/creator of a policyId. I assume that I need to verify whether a signing wallet is the same wallet that generated a particular policy id. (I am also using MeshJS endpoint that utilizes CIP-8 = "Message Signing", so a user will sign via nami/eternl/etc via browser interface)

My Research thus far:

I initially assumed that if I use the tx hash to find the UTxO and use the payment address of the inputs, it would give me the creator of said policyId. But this assumption was wrong since I have witnessed that some minting utxos have the minter's address as the input.

One can prove ownership of the UtxO address with this method, but not the policy ID.

I also began looking into reconstructing the tx that generated the policy ID, but that is looking like a dead end for me since I've been told that generating policy ID is for creating new assets and that regenerating the policy ID would only end up changing all the asset fingerprints.

I've been told that a wallet could be generated with Policy keys, but this is something that noone is doing, and doesn't account for people minting collections via a third party and don't own their policy keys. Also some creators just ditch wallets altogether after a mint is over.

I have seen a project implement interfaces which asks the owner to sign with a wallet, or send x amount to an address. So I assume there is a way to implement this.

Is it just not ideal to verify ownership of a policy ID with message signing? Is there a workaround that app/dapp developers are using?

1 Answer 1

1

I think you can do this, the policy ID is the hash of a script which usually includes the hash of the public key of a key pair, of which the private key is used to sign the minting transaction. You could use this key to sign a CIP8 message. This key pair is usually only used to mint a particular policy ID and is not used "as a wallet". One could do that in theory, but it would require the creator to get the private key from the minting service and import it to a browser wallet. Not sure if it would work well in practice or would be too much of a technical hurdle for creators.

Simplified example in pycardano to show the idea (not really tested and not 100% general):

# key pair generated by the minting service
key_pair = PaymentKeyPair.generate()

# vkey "interpreted as wallet address"
address  = Address(key_pair.verification_key.hash())

# simplified, can also contain more conditions like time lock
policy_id = ScriptAll([ScriptPubkey(key_pair.verification_key.hash())]).hash()

signature           = pycardano.cip.cip8.sign(message, key_pair.signing_key)
verification_result = pycardano.cip.cip8.verify(signature)

assert verification_result['signing_address'] == address
assert verification_result['message'] == message
assert verification_result['verified']

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.