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": &...
6
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 ...
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 ...
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 ''...
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 ...
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 ...
2
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/...
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.
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 ...
2
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 ...
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
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://...
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.
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 ...
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.
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
policy × 19nft × 9
native-assets × 5
minting × 4
cbor × 3
plutus × 2
smart-contract × 2
plutus-pioneer-program × 2
cardano-cli × 2
script × 2
blake2b × 2
transaction × 1
metadata × 1
mint × 1
python × 1
java × 1
javascript × 1
asset × 1