1

I'm thinking on a way to create a cNFT that requires 'proof of ownership' to be minted and own by a wallet, by proof of ownership I refer to something the receipt owns and can pass to others or loss, like a house or a car (let's imagine that the Oracle for that is piece of cake to implement) and when these things change owners or are destroyed in a way that satisfies an oracle the cNFT returns(?) to the owner of the Policy ID (or are invalidated somehow allowing them to be minted again).

I know cNFTs cannot be passed unless the wallet owner approves a transaction where these assets are moves to another Cardano ADA wallet address, so when the current owner gives up ownership of the things used in an ownership challenge the minted cNFT should change hands too without depending on the current cNFT owner.

Furthermore, I know smart contracts can own assets, but I don't know if wallets can own smart contracts, or even if owning a smart contract that owns a cNFT is the way to go. Is there a recommended way to go about something like this?

1 Answer 1

2

To my understanding, by "proof of ownership" you are referring to the user owning a physical object, and this smart contract should keep track of the real-world ownership via NFTs.

before I keep answering there is an important key concept that cannot be ignored

You do not have access to the entire blockchain data while using a validator

let me explain:

in Solidity, by standard, you have access to something like

MyTokenContract.balanceOf( address )

where "address" might not even ever have interacted with the smart contract.

in Plutus, you could access such information only via an oracle.

Without oracle, you can only access information regarding the current transaction or previous transactions if the relevant data is explicitly exposed via the Datum (which is meant to be the state of the smart contract).

the balanceOf is only an example, but for this reason, you cannot move (or block) other user's assets via smart contract.

simulate the account model

the "smart contract that owns the cNFT" is the way to go. this is because this way you are "centralizing" the NFT ownership to the smart contract.

you could then have a map from Address (or PublicKeyHash) to MintingPolicyHash (which is the policy-id of your NFT) in your state (Datum)

so that only that address has the control of that NFT in that smart contract,

but the smart contract can do whatever he wants with the NFT.

own a smart contract

You can't really "own" a smart contract but you could implement what I like to call "God-mode" for a specific Address (or PublicKeyHash)

this can be done in your smart contract logic like so:

{-# LANGUAGE OverloadedStrings #-}
-- OverloadedStrings needet to easly construct a constant PubKeyHash

import Plutus.V1.Ledger.Contexts as Ctx
import Ledger.Crypto ( PubKeyHash )

scLogic :: MyDatum -> MyRedeemer -> ScriptContext -> Bool
scLogic datum redeemer ctx =
    if Ctx.txSignedBy (Ctx.scriptContextTxInfo ctx) (PubKeyHash "<owner public key hash (hex)>")

    then True -- the owner is signing the Tx, god-mode active
    
    else -- implement smart contract logic for anyone else
1
  • just to clarify, it is the other way around, the physical object determines who owns the NFT (either because someone owns the physical object used in the proof of ownership challenge, or it does not exist anymore, i.e.: the physical object was destroyed) I'm assuming that an oracle can be implemented to verify ownership of the physical object via a challenge to keep the question simple.
    – shackra
    Jun 21, 2022 at 22:27

Your Answer

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

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