Hot answers tagged

8 votes
Accepted

Verify that Token is NFT

You can check the token policy for that. For most NFT projects you can look it up on https://pool.pm A token policy can look like this: { "scripts": [ { "keyHash": &...
eddex's user avatar
  • 3,753
8 votes
Accepted

Is the length (in characters) of a token policy id always the same?

The policyId is the hash of the policy script. It is a blake2b-224 hash resulting in 28 bytes and a hex length of 56 chars. So, your code will always work and is the right way to do it. Find the spec ...
Ashish Prajapati's user avatar
5 votes
Accepted

Detailed Minting policy documentation?

You were almost there, the token policy scripts are actually the multisig/nativescripts. As you know token policy's are not turing complete contracts, for that you should be looking at Plutus. Here's ...
Ashish Prajapati's user avatar
4 votes
Accepted

Write a policy script with a custom redeemer type, but do NOT use `Plutus.liftCode`

It's pretty simple: Define the redeemer with the proper types (they must be part of UnsafeFromData typeclass in order to use PlutusTx.unstableMakeIsData (2)) Do PlutusTx.unstableMakeIsData ''...
kindofdev's user avatar
  • 1,304
4 votes
Accepted

Updating NFT metadata when policy unlocked

Yes, the process you've outlined is correct. You can simply mint a second NFT with updated metadata into your own wallet (no need to retrieve the original from someone elses) and then burn it ...
Tygar Pool's user avatar
3 votes

Is it possible to call the `mkValidator` inside the same / another `mkValidator` function for script composibility?

In this case, when compiling your validator, compiler is trying to compute a value (which is only available after successfully compiled your validator) to complete compiling your validator, thus, it's ...
Tuvshintsenguun's user avatar
3 votes

Programmatically creating the policyid / scripthash in Javascript (Browser)

Finally got my head around this, thanks to this version in Python: Re-Implementing Policy Hashing in Python by @tycl. Basically we need to Parse the policy (JSON) Follow the CDDL specifications to ...
sean's user avatar
  • 1,463
3 votes
Accepted

Calculate a policy locking

Given the slot lenght is one second, this is pretty easy. Find the current slot number. $ curl -s -H "project_id: $BLOCKFROST_PROJECT_ID" https://cardano-mainnet.blockfrost.io/api/v0/...
Marek Mahut - StakeNuts's user avatar
2 votes
Accepted

How to PlutusTx.compile work with multiple arguments to mkPolicy

We have wrapMintingPolicy :: UnsafeFromData r => (r -> ScriptContext -> Bool) -> WrappedMintingPolicyType. In the first case, we can spell out the details like: policy :: PaymentPubKeyHash ...
Mihai Codescu's user avatar
2 votes

Is the length (in characters) of a token policy id always the same?

Yes, the policy ID is indeed defined as a ScriptHash in the specifications. Its length is 28 bytes.
vaz's user avatar
  • 756
2 votes
Accepted

Re-Implementing Policy Hashing in Python

It seems I was close, but the str.encode() function was not the correct one to use. Also a zero byte needs to be prepended to the data to be hashed. Thanks to user bwbush from the cardano forum for ...
tycl's user avatar
  • 190
2 votes
Accepted

How do validators know a policy script is expired based only on slot number?

The slot number does not get reset with each epoch. You can see here that the slot number is strictly increasing: https://explorer.cardano.org/en.html
Jey's user avatar
  • 1,549
2 votes
Accepted

Unlocked NFT minting policy

If you want to add security to this setup, you might want to consider using a multi signature setup. Say, for example, a 3 out of 5 signatures are needed. Then an adversary needs to retrieve at least ...
Fermat's user avatar
  • 1,862
2 votes

Why does an cardano token have multiple policys

When looking from https://cardanoassets.com/ we could see, it might be just an copycat
ErikM's user avatar
  • 41
1 vote

How to differentiate NFTs of the same policy id?

You can add custom metadata to your NFT. The most used standard is CIP-721. The metadata could look like this: { "721": { "<policy_id>": { "<asset_name>...
eddex's user avatar
  • 3,753
1 vote

How to create Policy Id using cardano serlization lib?

You can find a full example here in the the /doc/getting-started folder of the serialization lib: https://github.com/Emurgo/cardano-serialization-lib/blob/master/doc/getting-started/minting-nfts.md ...
sean's user avatar
  • 1,463
1 vote
Accepted

Are NFT policies interchangeable between networks?

As it turns out, they are. I've minted NFTs on preprod and mainnet with the exact same keys and policy. Here's the policy on preprod: https://preprod.venster.io/policies/...
wout's user avatar
  • 177
1 vote

Is it possible to call the `mkValidator` inside the same / another `mkValidator` function for script composibility?

Script.validatorHash can not be compiled to Plutus Core (probably for good reason, as it would've resulted in much larger on-chain scripts). As Erik mentioned, if you only need the hash of your ...
keyanm's user avatar
  • 76
1 vote

How to view binarydata in cexplorer?

in your case: SELECT multi_asset.policy::text human_policy FROM ... or SELECT encode(multi_asset.name::bytea, 'escape'::text) human_name FROM ...
cexplorer.io's user avatar
1 vote

How to view binarydata in cexplorer?

These fields are not in general "normal text". They might be normal text (eg ASCII) or they could also be UTF-8 or UTF-16 or any other encoding. The most sensible way to view them is as ...
Erik de Castro Lopo's user avatar
1 vote

Multiple policies associated with the same token/nft

as @Fermat already answered Currently Value is parametrized by a currency symbol and a token name. Here the currency symbol is not arbitrary, it is the hash of the minting policy script. This script ...
Michele Nuzzi's user avatar
1 vote
Accepted

How to Look Up a Token Policy ID from The Smart Contract Validator

You can use the following info :: TxInfo info = scriptContextTxInfo ctx inputValue :: [Value] inputValue = map (txOutValue . txInInfoResolved) (txInfoInputs info) checkValueHasToken :: Value -> ...
Fermat's user avatar
  • 1,862
1 vote

How to create the policy.vkey and policy.skey with Cardanocli-js?

A policy key is just a payment key (or stake key, depending on where the policy is listed in the address). So in the example of using cardanocli-js, you would use the addressKeyGen method. https://...
Samuel Leathers's user avatar
1 vote

ad-hoc policy lock

Nope. The contents of the script itself are used to actual generate the Policy ID. Once you mint something under that policy ID it's impossible to make a change.
Tygar Pool's user avatar
1 vote
Accepted

How does one-time minting policy actually work?

Yes, this is an example of a "one-time minting policy" referred to in the Cardano documentation. The policy ensures that only one NFT is minted by a combination of i) being parametrised with ...
Jey's user avatar
  • 1,549
1 vote
Accepted

Registering policy ID programatically (pool.pm)

No, there's no way to currently do this programmatically, and yes - this feature is specific to pool.pm.
Tygar Pool's user avatar
1 vote
Accepted

Programmatically creating the policyid / scripthash in Javascript (Browser)

You can do this using the 10.0 beta version of cardano-serialization-lib which should make it into stable pretty soon (I'm in the process of testing this, you can follow the status on this Github ...
Thom's user avatar
  • 354

Only top scored, non community-wiki answers of a minimum length are eligible