text:
suppress errors in trace emulator
I would like to suppress this error. How can I do that ?
Slot 00013: *** CONTRACT LOG: "PassingTest [TEST_TAG:3] -- caught error: WalletContractError (ValidationError (ScriptFailure (EvaluationError [] "CekEvaluationFailure: An error has occurred:  User error:\nThe machine terminated part way through evaluation due to overspending the budget.\nThe budget when the machine terminated was:\n({ cpu: 6259676882\n| mem: -3722\n})\nNegative numbers indicate the overspent budget; note that this only indicatessthe budget that was needed for the next step, not to run the program to completion.")))"

You can use a different TraceConfig. See here for example https://github.com/input-output-hk/plutus-apps/blob/20ac87dc4d0bd969840168bd84c063f3a6f78887/plutus-contract/src/Plutus/Trace/Emulator.hs#L239


text:
What prevents a smart contract from going into an infinite loop?
What is the equivalent of gas in preventing DoS attacks? What happens if an attacker writes a recursion that never stops in Plutus? Someone asked the question before.

One of the features of Plutus contracts is that fees of all valid Plutus contracts must be able to be determined at compile time. That means that anything for which this cannot be determined is not a valid Plutus contract. Therefore, contracts containing infinite loops are not valid.

The execution costs of a contract need to be covered by the included transaction fees. Additionally, a collateral needs to be included. The value of the collateral determines the script execution budget. As soon as execution costs exceed the collateral:

script execution is aborted,
the transaction is not accepted (i.e. does not make it to the blockchain),
the collateral is collected by the validating node.

Because it is impossible to determine in advance if a program/script will succeed or not (halting problem), the script needs to be executed to find out. Because script execution is deterministic on Cardano, the constructor of the transaction can, however, make sure that transaction fees and collateral have the correct values. Execution failure and collateral collection are therefore only to protect against ill intentioned actors, and do not impact well behaving actors.
In this blogpost you can find more about the collateral mechanism on Cardano: link

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Submit transactions to the blockchain in Plutus
Currently my workflow is like this:

write a validator script in Plutus
test the script in by creating functions/endpoints to submit transactions to Plutus.Trace (Emulator)
if the test goes well, I serialize the script and get a script.plutus file
test the serialized script in the blockchain (preprod or mainnet) using cardano-cli or other front-end tools (like lucid or mesh)

Step 4 is quite laborious. It requires that you find the right syntaxes in the front-end tools that are equivalent to Plutus’ in step 2. You might not find one. Or your tools of choice may not yet support state-of-the-art features your dapp needs. And, of course, if the test fails and the validator script needs changes, you have to go back to step 1. Going through 2-4 all over again.
So I figure: if I can submit transactions to the blockchain right there in Plutus, life will be much easier. That would eliminate step 3-4 and speedup the development immeasurably. That would also reduce bugs and errors when translating between multiple platforms/environments.
Is there a way to achieve that?
Or, is there a better/faster workflow?

the original vision was to use Plutus Application Backends, unfortunately the development is lagging behind.
We're still early in the development ecosystem, so what you described is mostly the one we can use for now.

Thanks. Good to know. Just wish there is something better already.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How can I Stake NFTs In Cardano?
I am new to Cardano, I want some guidance from you guyz about this. Can someone please guide me that how can we stake NFTs in non custodial way in Cardano. I want to stake NFTs like the official staking mechanism of staking in Cardano. Like taking the snapshots of wallet assets, identify staked NFT and calculating and releasing rewards. Also how can i interact that all staking mechanism with my front end.
Your guidance will be very helpful for me. Thanks in Advance.

I am not aware of any staking being available for NFTs on Cardano.
Staking ADA on the Cardano network serves a purpose, it helps secure the Proof-of-Stake network. What purpose would staking NFTs serve?

Its purpose is Just like the staking of ADA tokens. Users can stake their NFTs in a non-custodial way and their awards will have to be calculated according to the duration it has been locked. Also locking would be handled by snapshots.

But again, what would be the purpose of staking NFTs?

To get rewards by staking NFT

Like Erik mentions, Proof-of-Stake is a consensus algorithm designed to secure the network.
The concept of "staking NFT's" is something that NFT projects use to hype/promote/give usecase to their NFT's, but this is not done on a protocol level; meaning that not every NFT will have this "feature" and IF they have it, it still depends on how they implemented it.

So if i make it clear, do u mean to say that it cannot be implemented or there is no way to do that? Just because each NFT has its own implementation etc. But we will only need the fingerprint of that nft then why we are concerning about NFT's implementation. I'm sorry if it sounds silly question. I'm new to cardano, kindly explain its limitations, it will be very helpful for me. Thanks alot

You can implement a passive earn feature for holding an NFT, in common tongue this is called "staking" but this will never be part of the consensus. Maybe you can have a look at farming options like what DEX's are offering, like Wingriders or Minswap.

deposit an NFT (or FT) in a smart contract
based on the duration you'll earn X amount of Token Y

But what if , i want to stake it in non custodial way. Like i cant lock NFT in a script but have to take snapshot and calculate reward. Also i am not getting about why and how NFT cant be used in staking side of cardano. And if it is possible then what can be the best solution for it? Your suggesstions will be highly appreciated as i have to make the possibe non custodial scenerio.

Q1. You can lock NFT's in scripts.. but that seems overly complex. You can just write a script that scans which wallets hold your NFT's and assign them a value of your COIN and have them withdraw that amount of COIN from a faucet.
Q2. It's not possible to use NFT's in Cardano's staking. Proof of Stake is a consensus to secure the network. Anyone can make an NFT, it doesn't actually mean that it has any value, so how would you secure the network with that? That's what I meant with the difference between the "hype term" STAKING and actual Proof of Stake.
My answer to Q1 would be best imo.

I want to stake NFTs like the official staking mechanism of staking in Cardano.

Short answer: You will have to build this functionality yourself(or hire a team to do so).


text:
cardano-cli transaction with inline datum
I already have utxos with inline datum sitting at a wallet address (not in a smart contract address):

now I want to use this utxo in another transaction, in order to inspect it's datum, without spending the utxo:
cardano-cli transaction build-raw \
--babbage-era \
--tx-in fcb7f6692469d9a2eefb04e05241d3288aad4849303da5369465bb395cf9fe8c#1
--tx-in-inline-datum-present
--tx-in {other utxo to be spent}
... some outputs ...
--tx-in-collateral {collateral utxo}
--protocol-params-file pparams.json
... and so on, the usual stuff

The thing is, once I call 'transaction submit' command, I get an error:
Invalid option `--tx-in'

I am 100% confident, that error is raised from inline datum related commands. What am I doing wrong? Maybe it is impossible to read inline datums from simple wallet addresses, only from validators (by also providing plutus scripts, datums, redeemers, etc.). Or maybe my cardano-cli syntax is wrong and I am missing something?
EDIT:
screenshots of the exact cardano-cli commands:

Can you screenshot your command and the error message exactly?

edited the post

solved, this helped: https://github.com/input-output-hk/Vasil-testnet/blob/main/reference-inputs-cip-31.md
problem was in syntax, referenced input must be provided with --read-only-tx-in-reference option


text:
ScriptWitnessNotValidatingUTXOW - Transaction Error While Minting NFT With Native Script - Before Slot Instruction Not Working
I am trying to mint an NFT for the zeroOneGame exercise from gimbalabs on the pre-production testnet (babbage-era) but I incur in an error and I can't see what I am doing wrong.
Here are the steps that I am taking:
I create P1.vkey and P1.skey and then build the payment address P1.addr.
I create policy.vkey and policy.skey and then get the hash key for policy.vkey
cardano-cli address key-hash --payment-verification-key-file policy.vkey
> c1ed1f20dee68e6c10a863a5058ff9b44b0ad37f409c38a50fd38f51

I ask for the current slot
{
    "block": 458153,
    "epoch": 42,
    "era": "Babbage",
    "hash": "e4a4ca5c206829d30112a0ed8c95813218d3ccf1713811236081ce2e4933c001",
    "slot": 16656970,
    "syncProgress": "100.00"
}

Now I can create the policy.script
{
  "type": "all",
  "scripts":
  [
    {
      "type": "before",
      "slot": 16670000
    },
    {
      "type": "sig",
      "keyHash": "c1ed1f20dee68e6c10a863a5058ff9b44b0ad37f409c38a50fd38f51"
    }
  ]
}

Now I can create the policyID
cardano-cli transaction policyid --script-file policy.script
> 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8

In the meantime the P1.addr was funded obtanining the following UTxO
cardano-cli query utxo --address $(cat P1.addr) --testnet-magic 1
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
95ebaeb5d47bf28842e7551ca467415cfae12f466239b59e90c532405ab88e3a     0        997833047 lovelace + TxOutDatumNone

I can now build the tx.raw for the minting of my NFT.
cardano-cli transaction build \
--babbage-era \
--testnet-magic 1 \
--tx-in 95ebaeb5d47bf28842e7551ca467415cfae12f466239b59e90c532405ab88e3a#0 \
--tx-out $(cat P1.addr)+2000000+"1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--change-address $(cat P1.addr) \
--mint="1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--mint-script-file policy.script \
--witness-override '2' \
--out-file tx.raw

and finally sign it and submit it
cardano-cli transaction sign  \
--signing-key-file P1.skey  \
--signing-key-file policy.skey  \
--testnet-magic 1 \
--tx-body-file tx.raw  \
--out-file tx.signed

cardano-cli transaction submit --tx-file tx.signed --testnet-magic 1

Everything seem correct to me, but unfortunately at this point I get the following error from the cardano-cli
Command failed: transaction submit
Error: Error while submitting
tx: ShelleyTxValidationError
  ShelleyBasedEraBabbage (
    ApplyTxError [
      UtxowFailure (
        FromAlonzoUtxowFail (
          WrappedShelleyEraFailure (
            ScriptWitnessNotValidatingUTXOW (
              fromList [
                ScriptHash "0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8"
              ]
            )
          )
        )
      )
    ]
  )

The script witness is not validating the script, yet I have put the right hash of the right policy.vkey in the policy.script, and I am signing the transaction with the relative policy.skey. So the witness should validate the script, why is that not the case?
I see that it mentions something about WrappedShelleyEraFailure, is that something to do with the fact I am not using the right commands for the Babbage era?
Also what is the "W" in the UTXO in ScriptWitnessNotValidatingUTXOW and FromAlonzoUtxowFail indicating?
UPDATE
It seem that the problem was in the script itself. I removed the lines regarding the slot number:
    {
      "type": "before",
      "slot": 16670000
    },

and the transaction went through creating the token, although without the time limit it is not an NFT.
But well it also changes the nature of my question:
Why my time limit instruction isn't working?

When creating a transaction that will consume a script that contains a before you need to add " --invalid-after" to your transaction.
In your case in would look something like :
cardano-cli transaction build \
--babbage-era \
--testnet-magic 1 \
--tx-in 95ebaeb5d47bf28842e7551ca467415cfae12f466239b59e90c532405ab88e3a#0 \
--tx-out $(cat P1.addr)+2000000+"1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--change-address $(cat P1.addr) \
--mint="1 0de56a658ba5838183a57f6260d8f2919c8350b2186609ebd986cfa8.7a65726f4f6e6547616d65546573743031" \
--mint-script-file policy.script \
--invalid-after 16670000 \
--witness-override '2' \
--out-file tx.raw


text:
Yarn doesn't recognise BlockFrost
Can anyone help me with this kind of error? I'm running this tutorial.
https://github.com/blockfrost/blockfrost-js-examples/tree/master/examples/simple-transaction

Did you run 'yarn' as following https://github.com/blockfrost/blockfrost-js-examples/blob/master/examples/simple-transaction/README.md#how-to-use ?

After cloning the repository, you need to install the dependencies. They are not part of the git repository.
To do this with yarn, simply execute the yarn command in the /simple-transaction directory (without any parameters).


text:
Error when executing nix-shell in plutus-apps
I am getting...
error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override

...when trying to run nix-shell from plutus-apps repo.
Does anybody know how I can enable flakes?
I am using the latest commit 7952b9d30d15779a7fd8103bdbc9612d5df18ec2.

There are two ways of fixing this issue:
Temporary
Add --experimental-features 'nix-command flakes' when calling the nix-shell command.
Permanent
Edit either ~/.config/nix/nix.conf or /etc/nix/nix.conf and add:
experimental-features = nix-command flakes

For more information you can refer to: https://github.com/input-output-hk/plutus-apps/#nix-1

This is in plutus-apps nix config https://github.com/input-output-hk/plutus-apps/#nix-1

Thank you. I have edited the answer to include that link instead of the one from Nix.


text:
Are NFT policies interchangeable between networks?
Generating a policy doesn't require a running node; the cardano-cli alone is sufficient. Since no connection is made to the network, can I assume there's no difference between a policy on preprod and mainnet? In other words, can I use the same policy to mint on all the different networks?
The only difference will be the expiry slot because the reference slot will differ 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/3333acb55ed79731ea6658abb74f453cbb87e15aee01a7aab484b2a6
Here's the same policy on mainnet:
https://venster.io/policies/3333acb55ed79731ea6658abb74f453cbb87e15aee01a7aab484b2a6


text:
Understanding Script Failure Error Relating to Order TxIds - (script hash not known)
trying to claim back the first player bet after deadline in the ZeroOneGame from ppbl gimbalabs course on pre-production_testnet I get an error when trying to build the claim transaction.
I have this Player 1 address addr_test1vpn9qvm8tuth36pm0ul70tn7hwl0rtjk6cw9k6gzw5g6pxc8cexwu
cardano-cli query utxo --address $(cat P1.addr) --testnet-magic 1
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
2077017595a69be695124ddff5f79c3410121234feed38f8519682239199ad29     0        5000000 lovelace + TxOutDatumNone
f8f17e3515372fa9428abf3e0a30aedc3f11a6ef598d5f9838d35e2e45519bf3     0        992481013 lovelace + TxOutDatumNone

And this contract address addr_test1wrxhzl9vvcf2p8njp2metcf9mkapc9d2fj8a5fszv4ngnecge54yd which received the bet and NFTstate already.
cardano-cli query utxo --address $(cat contract1stGame.addr) --testnet-magic 1
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
f8f17e3515372fa9428abf3e0a30aedc3f11a6ef598d5f9838d35e2e45519bf3     1        5000000 lovelace + 1 665c8f0cdf7dc8b939d484d85f80d24c4c50af560be49c58d2b51f38.7a65726f4f6e6547616d65546573743031 + TxOutDatumHash ScriptDataInBabbageEra "f47634d3b1c1caccb51ab10c74958ccb464b0893c3e612b649a4484a6e50eeca"

Then I try to build the transaction to ClaimByFirstPlayer
cardano-cli transaction build --babbage-era \
--tx-in f8f17e3515372fa9428abf3e0a30aedc3f11a6ef598d5f9838d35e2e45519bf3#0 \
--tx-in-script-file ../output/ZeroOneGame.plutus \
--tx-in-datum-file ../output/startGame-DATUM.json \
--required-signer P1.skey \
--tx-in-redeemer-file ../output/firstPlayerClaims-REDEEMER.json \
--tx-in-collateral 2077017595a69be695124ddff5f79c3410121234feed38f8519682239199ad29#0 \
--tx-out $(cat P1.addr)+5000000+"1 665c8f0cdf7dc8b939d484d85f80d24c4c50af560be49c58d2b51f38.7a65726f4f6e6547616d65546573743031" \
--change-address $(cat P1.addr) \
--protocol-params-file parameters.json \
--invalid-before 17168436 \
--testnet-magic 1 \
--out-file tx.raw

But I receive the following error:
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 0 (in the order of the TxIds) failed with:
transaction input 0 (in the order of the TxIds) points to a script hash that is not known.

Is difficult to understand what it is going wrong from this error, I told that the --tx-in order may have been wrong, but after trying to make it better the error persists.
Is there any obvious mistake I am going through from the information given?

Mystery solved, what Plutus is trying to tell me is that I forgot to put the UTxO/--tx-in of the contract itself.
to the previous transaction I had to add the line
--tx-in f8f17e3515372fa9428abf3e0a30aedc3f11a6ef598d5f9838d35e2e45519bf3#1 \

That error is a weird way to say that the script couldn't find any UTxO related to the contract in the transaction being built.


text:
Staking balance and Reward in cardano
I want to get the staking balance and reward in Cardano. I am using the Blockfrost API and I can get the staking and reward amount using the stake address.
However, what I don't understand is that the staking address is not unique for each address. One staking address is associated with several wallet addresses. So, I can't get the exact stake and reward amount for a selected wallet. I can only get them for the selected stake address.
Could anyone explain this to me?

staking is address is not unique for each address.

Correct, all addresses for a single wallet will have the same staking address.

One staking address is associated with several wallet addresses.

I do not think that can happen.
Each wallet can have more than one address, but the stake address component for all addresses in a single wallet will be identical.

I don't  understand, Each wallet can have more than one address. Is it possible? Could you explain in detail?

Oh, sorry, I just realized, my wallet can has several addresses. Now, I understand. Thank you.

Hi, I have one question. Is there lock for staking balance in cardano?

Lock? Sorry, not sure what you mean.

And standard "address" in a wallet is made up of two components; the stake address and the payment credentials. All addresses in a wallet will have the same stake address.

@Heindrick - Please be vary that while that mode of query is alright for small-scale usage of private wallet, do not use it for projects as a rule- as the converse of question asked is not necessarily true (a stake address can belong to multiple addresses). HD-Wallet is an offchain concept, the blockchain itself does not know of your 'wallet' addresses. An adversary can join their own payment address with a known stake address


text:
Djed for transaction fees
I've seen on a couple of sites in the past two days the statement that the goal for Djed is to become the coin with which all transaction fees on the Cardano network will be paid. Since this is the first I've heard this, I'm skeptical. Can someone point to a statement from IOG that corroborates this?

That's not true. For the security of the system, the fees needs to be paid in ADA.
You might use Djed as a way to pay for the fees with babel fees but that is several years away, if it ever gets implemented in the first place.

Thanks. Yes - it was babel fees I read about. That's why the whole djed for fees statement puzzled me. Thanks for clarifying.


text:
Is there a CLI tool to view a single transaction from a Cardano node, e.g. local-cluster or prod?
Cardanoscan is great for testnet/pre-prod/mainnet. There are also some great tools like Oura for viewing transactions as they are happening, but some of the information in the transaction isn't showing.
Given a single (known) transaction ID, and a running Cardano node, is there a CLI tool for Linux for viewing the contents of a transaction, i.e. including metadata and inline datum, that works as easily as Oura, but has the detail of Cardanoscan?

It is always good to include link of the knowledge provided, this way other people that have the same question or that are responding to it, have clear examples of what you are talking about

Kupo may do what you want. Else check for alternatives in its readme.

Kupo is certainly easier to setup than some of the options. I am just looking at it now. In terms of user expectations here, is the answer always, that one needs to run a local indexer to view transaction data? Even when running a Cardano node, there's no random access to the information on it, so to speak?

@ross-spencer It is non-trivial to get historical transaction data using the node's mini protocols. Chain-followers (indexers) such as kupo and marconi stream this data out so  you just need to query a rest api or sql db for useful and well formatted transaction data. They also handle rollbacks. Your alternative to a local indexer is something like blockfrost.

Thanks @james. I've marked this as the correct answer as it is working for my use-case. I appreciate the feedback.

Not that I know of, as the Cardano node stores only the current state of the blockchain without any historical data, which transactions are.

I appreciate this clear answer, and it's helpful to have this confirmed for a newbie. I need additional rep to vote it up, but here's a vote in spirit anyway!


text:
how to resolve this transaction submission error of MintToken with Mesh
I am Facing this error while transaction submission.
""transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (PPViewHashesDontMatch (SJust (SafeHash \"268fc512be7cdc13c5e3da75d2888a5790c01173b32a38b4da2972a3b0059ee2\")) (SJust (SafeHash \"47120f8f4cf7f65759c1a535d34e593e271bcd69fb9719359f8ec23cd73f0221\"))))])""
I am following the mesh api tutorial https://meshjs.dev/apis/transaction/smart-contract#plutusminting
The code is exact same as given in tutorial, but i am stuck at this error for so long. For safe side i am also pasting the code here. Kindly suggest a solution for it, will be very helpful for me.
Thanks in Advance
import { AssetMetadata, Mint, Action, PlutusScript } from '@meshsdk/core';

const script: PlutusScript = {
  code: plutusMintingScriptCbor,
  version: 'V2',
};

const redeemer: Partial<Action> = {
  tag: 'MINT',
};

const tx = new Transaction({ initiator: wallet });

// define asset#1 metadata
const assetMetadata1: AssetMetadata = {
  "name": "Mesh Token",
  "image": "ipfs://QmRzicpReutwCkM6aotuKjErFCUD213DpwPq6ByuzMJaua",
  "mediaType": "image/jpg",
  "description": "This NFT is minted by Mesh (https://meshjs.dev/)."
};
const asset1: Mint = {
  assetName: 'MeshToken',
  assetQuantity: '1',
  metadata: assetMetadata1,
  label: '721',
  recipient: 'addr_test1vpvx0sacufuypa2k4sngk7q40zc5c4npl337uusdh64kv0c7e4cxr',
};
tx.mintAsset(
  script,
  asset1,
  redeemer,
);

const unsignedTx = await tx.build();
const signedTx = await wallet.signTx(unsignedTx);
const txHash = await wallet.submitTx(signedTx);```

The code you are seeing is returned directly from the node.
PPViewHashesDontMatch means that the protocol parameters hash does not match what is on-chain.
Are you sure you are using the latest version of Mesh?

yes, I have meshsdk/core 1.3.0 and meshsdk/react 1.1.3 version. And both of these are latest one

Are you sure the redeemer you are passing is correct?

Yes, the redeemer here is just a formality as the script is always true script. Also i copied the redeemer format from the tutorial link given.

I been dealing with this problem using Lucid for building the transactions.
When the framework create the transactions it was using wrong protocols parameters.
There is a field in the body of the transaction, called script_data_hash.
This field need to be filled before submitting the transaction.
Script data hash is a hash related with the redeemers of the transactions, the datums and the cost model (protocol parameters)
For example in Lucid, I fixed it updating the cost models and calculating all again:
const redeemers = witness_set_NEW_VERISON.redeemers();
const datums = witness_set_NEW_VERISON.plutus_data();
const costModels_NEW_VERISON = createCostModels_NEW_VERISON(protocolParameters.costModels);
const scriptHash = hash_script_data(redeemers!, costModels_NEW_VERISON, datums);
body.set_script_data_hash(C.ScriptDataHash.from_bytes(scriptHash.to_bytes()));

The error you are receiving is that the set_script_data_hash in the body is not matching the one that is calculated in the node when trying to validate the transaction.
Check where you initialize:
const tx = new Transaction({ initiator: wallet });

If there is a way to set manually the protocol parameters or the cost model.

Yes but in mesh library, there is no such variable to set the protocol parameters, It just create, build and sign the transmission with it function only. So how can i check these in Mesh library


text:
Converting a sum type to BuiltinByteString
I have a type defined as follows:
data A = A1 | B2 | A3 deriving (Show, Eq)
Is it possible to convert it to and from BuiltinByteString without explicitly having functions as such:
convertToBuiltInByteString :: A-> BuiltinByteString
convertToBuiltInByteString A1 = "A1"
convertToBuiltInByteString B2 = "B2"
convertToBuiltInByteString A3 = "A3"

fromBuiltInByteString :: BuiltinByteString -> A
fromBuiltInByteString "A1" = A1
fromBuiltInByteString "B2" = B2
fromBuiltInByteString "A3" = A3

If you also derive a Read instance, then it should be possible to use show and read to covert to and from String and there is likely a way of converting from String to and from BuiltinByteString.


text:
How to query assets transactions with cardano-graphql?
query assets transaction with cardano-graphql, e.g blockforst api https://cardano-mainnet.blockfrost.io/api/v0/assets/{asset}/transactions

describe with more details your question

Cardano GraphQL API documentation: https://input-output-hk.github.io/cardano-graphql/
Example requests: https://github.com/input-output-hk/cardano-graphql/tree/master/packages/api-cardano-db-hasura/src/example_queries
To find all Transaction objects related to an Asset, you can use the transactions query and filter for a specific Token in the TransactionOutput using the where clause.
There is an example in the project wiki that does the same but filters for Block number:
https://github.com/input-output-hk/cardano-graphql/wiki/Interacting-With-The-API

You can also play with GraphQL on ADANATOR, it has this graphical query builder which is pretty useful:
https://adanator.com/graphiql


text:
Data from Mesh to Plutus
I created this datum with Mesh
  const datumMD: Data = new Map<Data, Data>();
  datumMD.set('name', assetName );
  datumMD.set('question', input);
  datumMD.set('answers', []);
  datumMD.set('results', []);

  const datumState: Data = new Map<Data, Data>();
  datumState.set('state', 'INIT');

  const datumMetadata: Data = {
    alternative: 0,
    fields: [datumMD, datumState]
  };

The CBOR of that is:
d8799fa447616e737765727380446e616d654a70726f706f73616c2d33487175657374696f6e53446f657320697420776f726b3f20486d6d6d3f47726573756c747380a145737461746544494e4954ff

What would the type of that datum be in Plutus (Haskell)?

When creating datumMD you are using keys of type String but values of different types. In Haskell, Maps, just like lists, are homogenous, therefore you cannot have lists, then strings, then ... in the same map's values. I cannot help further, correct this and then we'll see how to translate your datum to a Haskell data type.
Also, I'm interested in why you are doing it this way (Mesh -> Plutus) instead of the usual (Plutus -> Mesh)?
Thanks in advance for the clarification :)

It seems to work, the CBOR of this datum is this: d8799fa447616e737765727380446e616d654a70726f706f73616c2d31487175657374696f6e576e696b6f73203234206c6570746120706172616b616c7747726573756c747380a145737461746544494e4954ff
So maybe its considered all Map of Data ?

Could it be that its
data DatumMetadata = DatumMetadata { datumMD       :: ![(BuiltinData, BuiltinData)],
datumState    :: ![(BuiltinData, BuiltinData)]}

I did the Mesh -> Plutus because i needed the datum first on the OffChain part, i didnt use it that much onChain.

also interested, how this Map<Data, Data>() converts to Plutus type? is this (BuiltinData, BuiltinData) a correct way?


text:
Catalyst application still shows Fund 9
It's Fund 10 but the catalyst application is not reflecting that. I think I may have registered again and forgotten about it. How can I confirm that my wallet id is accurate / up to date? I have my staking key, can I use that to search for my wallet Id and compare that id to what is listed in the catalyst app?

Fund 10 has not yet started.
The project Catalyst is on hold and it is not yet known when Fund 10 will start.

Thank you! That's very helpful, where can I read more about this and why it's happening?

I think the best place is to subscribe to the project Catalyst Newsletter https://us20.campaign-archive.com/home/?u=26d3b656ecc43aa6f3063eaed&id=2451b43b07
if this responded your question, can you please mark it so? Thank you!

Done, thank you!


text:
Trying to submit a minting transaction using pycardano and blockfrost
Hello Cardano developers, I really hope you can help me :)
I'm developing a Dapp and I need to mint a NFT. This works through a website, so a user clicks in a button to mint a NFT. Simple, right?
I figured how to send a transaction. My code allows the user to send an amount of ADA to my wallet. However, when I add the following code
        # Set nft we want to mint
        builder.mint = my_nft

        # Set native script
        builder.native_scripts = native_scripts

        # Set transaction metadata
        builder.auxiliary_data = auxiliary_data

my code breaks :( I've set up the metadata correctly (I tested on pool.pm/test/metadata), I also calculated the outputs, as well as the minimum value to go with the NFT. You can see below the transaction object returned when submitting.
I will leave the error too.
Thank you for your help.
Transaction:
 {
  'auxiliary_data': None,
  'transaction_body': {
    'auxiliary_data_hash': AuxiliaryDataHash(hex='68efbbf230620bf792ecf11e0e166dd98a0dbb3bbcca97da27c08dffdc522ca0'),
    'certificates': None,
    'collateral': None,
    'collateral_return': None,
    'fee': 196873,
    'inputs': [
      {
        'index': 0,
        'transaction_id': TransactionId(hex='6ca198e4b77746d1cc5e7d039958fdd8ba0a49383d9ff5ead25967a483ced2c4'),
      },
      {
        'index': 1,
        'transaction_id': TransactionId(hex='9c09d98a5d6f7618838dd39be3b0c1e6c2f2142c034c92dcacc93bc3096522ec'),
      },
    ],
    'mint': {ScriptHash(hex='accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a'): {AssetName(b'COLECAOTESTE1121'): 1}},
    'network_id': None,
    'outputs': [
      {
        'address': addr_test1qqmkqk6z05t8txkkduwzk38y0zvqlknkrkqqyxkt8kcm4lzknl4jmmh4jdmuv9vqpjvwhkhtrl2z8ex7gxlvp4wnytlq2xn3f4,
        'amount': {
          'coin': 1417990,
          'multi_asset': {ScriptHash(hex='accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a'): {AssetName(b'COLECAOTESTE1121'): 1}},
        },
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1vz4tng24jteu2989g67ztrvzkgduy97awnlqv54th0fv76c7vpwu0,
        'amount': {'coin': 98582010, 'multi_asset': {}},
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
      {
        'address': addr_test1qqmkqk6z05t8txkkduwzk38y0zvqlknkrkqqyxkt8kcm4lzknl4jmmh4jdmuv9vqpjvwhkhtrl2z8ex7gxlvp4wnytlq2xn3f4,
        'amount': {
          'coin': 8628629836,
          'multi_asset': {ScriptHash(hex='57e8d0b5f11c6a329bea53d237c660ecef7cb884a3644761034c1e97'): {AssetName(b'Faketoken'): 100, AssetName(b'Faketoken2'): 100}},
        },
        'datum': None,
        'datum_hash': None,
        'post_alonzo': False,
        'script': None,
      },
    ],
    'reference_inputs': None,
    'required_signers': None,
    'script_data_hash': None,
    'total_collateral': None,
    'ttl': 20440000,
    'update': None,
    'validity_start': None,
    'withdraws': None,
  },
  'transaction_witness_set': {
    'bootstrap_witness': None,
    'native_scripts': None,
    'plutus_data': None,
    'plutus_v1_script': None,
    'plutus_v2_script': None,
    'redeemer': None,
    'vkey_witnesses': [
      {
        'signature': b'\xdc\\\xd8l:\x91:\x1f\xc2\x88hae\x14\x7f\xd3\xca\xc5\x1e\x81@2\xad+\r\xdfi\x86AN?\x1cN\xd2S\xe8mu?\xc7\xe2\x98\x07\xd1\x9b3\x1a\x07W\xb8\xec\n \xe4QW\x9dT\xdc\x1a\xd8\x1f\x1b\x0e',
        'vkey': {"type": "", "description": "", "cborHex": "58201998b14fad7342650d95dc5ce34b461ad9bb714bed69ad2b92f5d685e0545630"},
      },
    ],
  },
  'valid': True,
}

blockfrost.utils.ApiError: {'error': 'Bad Request', 'message': '"transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingScriptWitnessesUTXOW (fromList [ScriptHash \\"accfcecc5acf5f6480ba9b8ba618d4f1ea67f518d6e496db921bfc3a\\"])))),UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (MissingTxMetadata (AuxiliaryDataHash {unsafeAuxiliaryDataHash = SafeHash \\"68efbbf230620bf792ecf11e0e166dd98a0dbb3bbcca97da27c08dffdc522ca0\\"}))))])"', 'status_code': 400}

The problem is the NFT's native script is missing from the transaction. See this line in the transaction repl:
'native_scripts': None,

Not sure how this transaction was build, but looks like you have set native script correctly in your tx builder. You can use builder.build_and_sign([signing_key]) to create a full transaction that contains the native script in witness set.

you are completely right  thank ou very much


text:
How do I resolve this Webpack issue with Mesh library on NextJS project
I am trying to set up Mesh library on an existing NextJS project. I am not sure how to handle an issue that seems to be with the Webpack configuration for handling wasm files in the library. I am adding the library and configuration using the guide provided here by Mesh.dev.
The error after starting the NextJS project server is:

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
error - ./node_modules/@emurgo/cardano-message-signing-browser/cardano_message_signing_bg.wasm
Module parse failed: Unexpected character '' (1:0)
The module seem to be a WebAssembly module, but module is not flagged as WebAssembly module for webpack.
BREAKING CHANGE: Since webpack 5 WebAssembly is not enabled by default and flagged as experimental feature.
You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true' (based on async modules) or 'experiments.syncWebAssembly: true' (like webpack 4, deprecated).
For files that transpile to WebAssembly, make sure to set the module type in the 'module.rules' section of the config (e. g. 'type: "webassembly/async"').
(Source code omitted for this binary file)

Import trace for requested module:
./node_modules/@emurgo/cardano-message-signing-browser/cardano_message_signing_bg.wasm
./node_modules/@emurgo/cardano-message-signing-browser/cardano_message_signing.js
./node_modules/@meshsdk/core/dist/core.js
./node_modules/@meshsdk/react/dist/react.js

Hi, please read the error message and read the guides. The error says, You need to enable one of the WebAssembly experiments via 'experiments.asyncWebAssembly: true'. And the guide you have pointed out shows exactly the config you need.

Thanks @Jingles I had mistyped the name of the config file. Solved!


text:
Cardano NFT storage
In a Discord discussion I discovered that the images of Cardano NFT are not on the Cardano network but on IPFS and that we need to pin them or else they might disappear.
How can I do that?

It is true most of the NFTs on Cardano are not storing their media directly on the Cardano blockchain, mostly due to the cost, as storing something on a blockchain (that is being replicated and validate by thousands participants) is expensive.
Instead, they store their metadata on Cardano blockchain and one part of this metedata is a pointer to a storage location of the media. The most popular storage for these media is IPFS (InterPlanetary File System) which is a peer-to-peer network for storing and sharing data on a distributed file system.
However, for the media to be present on IPFS at least one participant (node) on the network must hold the file on their hard drive. This is what we're calling pinning. You opt to store the file in question on your hard drive and make it accessible to others. Someone has to do it, else the file disappears forever from the IPFS network.
So who is responsible to store it? The creator of your NFT project should do it and it would be prudent to investigate if your NFT project is doing that.
That being said, at Blockfrost we're at the moment pinning all Cardano NFTs that are on-chain at the moment. A service to the community we sadly might not be able to continue for long due to raising costs.
Also, if your project used a service like NMKR Studio, they are pinning the media minted using their service.

To add to that, there are also some free options for pinning files to IPFS like https://nft.storage or https://pinata.cloud/

Cost isn't really a huge issue, there's a hard limit on how much data you can have in a mint transaction though

Cost to the network, not only thousands of nodes needs to store it forever, they need to verify it too.


text:
Is explorer.cardano.org down?
I was wondering if explorer.cardano.org was down.
The explorer page keeps displaying a charging icon.

Yes, it looks like it is.
$ curl https://explorer.cardano.org/graphql

<title>502 Bad Gateway</title>

502 Bad Gateway

nginx

You might want to use an alternative explorer, such as cexplorer.io.

Thanks for the answer, do you know why it is down or when will it be up again ?

Not sure, but I have pinged IOG to see.

Thanks, where have you reached them ?

The best place is the IOG discord technical chat.


text:
Speed of Hydra on the main chain vs a Cardano sidechain
I have an idea for a dapp that needs to settle tens of thousands of transactions per second and there's a grey area in my knowledge when it comes to understanding the limitations of hydra-pay on the main chain and Cardano sidechains
For hydra-pay on the main chain, is the limitation of how many transactions you can handle per second for your users dependent on how many Hydra nodes you are running or what? What kind of infrastructure would be needed for this? From my understanding, one solution for this use case is opening up a Hydra head for every user during the time they are transacting.
For a Cardano sidechain, what are the limitations for how many transactions you can settle per second? Is it just based on the consensus algorithm?

Let me try to answer your questions, although it's very dependent on the actual use case on what structure for off-chain processing of these "tens of thousands transactions per second" would make sense.

For hydra-pay on the main chain, is the limitation of how many
transactions you can handle per second for your users dependent on how
many Hydra nodes you are running or what? What kind of infrastructure would > be needed for this? From my understanding, one solution for this use case is > opening up a Hydra head for every user during the time they are transacting.

hydra-pay is a tool that makes pairwise payment channels based on Hydra Heads easy to create and use. As you are bringing it up, I assume you have a use case where users want to process their transactions with a single other party, e.g. another user or your service.
Infrastructure: In such a pairwise setting, you would have two hydra-nodes running, one for each participant. For highest security, users would have their own hydra-node running on their end, e.g. wrapped up in a client-side application. When using hydra-pay though, nodes are run in a "hosted" way. That is, secrets would stay on the client-side (not yet, future feature), while the actual operation would stay with the service operator of hydra-pay.
Scalability: Now the capability of how many transactions can be processed depends on the performance of the machines running the hydra-nodes, their bandwidth, the latency between them and also of your users' machines which at the very least need to sign transactions - unless you are keeping the keys of your users (which would make the use-case custodial).

For a Cardano sidechain, what are the limitations for how many transactions > you can settle per second? Is it just based on the consensus algorithm?

For the mainchain, for a sidechain, for a Hydra Head.. for any decentralized network the limit on scalabality is a consequence of how decentralized (number of nodes, their latency & bandwidth, minimum system requirements) and how secure a network is (redundant communication, consensus algorithms, cryptographic complexity). It is also important how big and complex the transactions you care about are. All of these influence how long it takes a transaction to be processed & finalized by the network and in consequence how many transactions you can settle per second.

Thank you for the prompt response Sebastian, this has greatly improved my understanding. I have a few follow up questions.
Could you please give further detail about 'For highest security, users would have their own hydra-node running on their end, e.g. wrapped up in a client-side application' ?
Also, for the current implementation of hydra and hydra-pay, is it possible to run it as an L2 for a Cardano sidechain?

And could you please describe the secrets that will stay on the client-side? I assume that the 'actual operations' that would stay with the service operator (server-side) you're referring to are Hydra Head operations like Initializing the head, Committing transactions in the head, Closing the head, etc. Does this sound correct?

The answer to all of these questions is: yes. You seem to have understood the protocol quite well already! The secrets which ideally stay on the client side are: 1) the payment credential for spending the UTxOs on the L2, and 2) the hydra signing key used to sign snapshots of the L2 UTxOs. The latter is not possible to keep outside of the hydra-node as of today, but we plan on supporting client side signing of snapshots eventually.


text:
How to link fractional Fungible tokens to an NFT?
I have the following scenario. We will be minting NFT for assets and then would like to fractionalise them by minting fungible tokens.
I was wondering how to link together the NFT with the minted fungible tokens (say we issue 1000 tokens linked to an NFT) ? So that later when we want to correlated them, we can do this with confidence ? In other words currently one identifies the fungible tokens using information from token registry (and looking at policy id). But how would I know that this token is linked to an NFT (with a particular policy id).
One way could be to "manually include the original NFT policyid in the offchain token registry .." and then use that information to prove this connection.
Is there any other automated smarter ways to connect the fungible tokens to the NFT metadata ?
thanks.

You are probably lookin for CIP68.
Using this metadata standard, you will be able to lock your NFT within the contact that would hold reference NFT for your fungible tokens.
It is worth to also mention Fracada Il Primo by dcSpark.


text:
how to use the transaction created using. cardano cli to be signed by a wallet in frontend
If we create a transaction body in the backend using cardano-cli for example, and only for signing the transaction would like to get the frontend wallet to sign it, how is this done in the best possible way ?

Basically, there are two ways:

After getting the transaction in the frontend, load the CBOR to CSL (cardano-serialization-lib), and proceed from there.

The workflow would be: build the transaction with cardano-cli, sign it with some random wallet stored in backend, send the signed transaction CBOR to frontend, deserialize the CBOR to CSL Transaction object, remove the witness you signed with in backend, call any wallet extension (eternl, nami..) injected signTx() method and get current user witness, add it to the CSL Transaction object and submit it with submitTx() wallet method.
This worked fine for me with Alonzo era and simple transactions, but had some problems with complicated (inline datums, plutusV2 scripts, etc.) Babbage era transactions. You kind of need to dig deep into CSL to make it work. So I chose the second, easier approach.

Build the transaction using cardano-cli, send it to the frontend in order to retrieve a witness, return both transaction CBOR and witness to backend, assemble the transaction and submit it.

In depth steps:

cardano-cli transaction build-raw --babbage-era --cddl-format ...

build instead of build-raw also works. Do not forget to add --cddl-format flag, in order for frontend sign() method to understand the format. Also you do not need to sign the transaction, only build it.

Send built transaction CBOR to frontend

encodedTxVkeyWitnesses = await window.signTx(cbor, true)

Call signTx() wallet method with received CBOR as a parameter. You will get the encdoded witness, which is basically a proof that user signed the transaction. The resulting hex string will look like this: a10081825820cccfe2be401c85342497f6e1e4a241629790b0fb7f2af5f18441779d11f25b1f5840c38a93d63faac9335ecc2f24ead7ca2d46a6637f354ee707bb06eb8192af2fa6a676fb72f8772cd1c42b491ec6dfc798c76b61c55dc4eecab362e71ffab26305

await handleSubmit(cbor, encodedTxVkeyWitnesses)

Call your backend from frontend, and pass the very same transaction CBOR you received from backend and recently acquired witness CBOR.

$witnessCbor = substr($encodedTxVkeyWitnesses, strpos($encodedTxVkeyWitnesses,'825820'), (strlen($encodedTxVkeyWitnesses) - strpos($encodedTxVkeyWitnesses,'825820')));

Note: example is in PHP. signTx() method returns a bit different witness structure than required by cardano-cli. You basically need to strip first 6 chars from the string. They represent data structure, in this case some nested arrays and stuff. You can look at structure differences here, by comparing both stripped and not stripped hex witness CBOR strings: https://cbor.nemo157.com/
6.
transactionCborFile = '
        {
            "type": "Unwitnessed Tx BabbageEra",
            "description": "Ledger Cddl Format",
            "cborHex": "<transaction CBOR here>"
        }
    ';
    $witnessCborFile = '
        {
            "type": "TxWitness BabbageEra",
            "description": "Key Witness ShelleyEra",
            "cborHex": "<stripped witness CBOR here>"
        }
    ';

Create two files as described above containing transaction and witness CBOR, as cardano-cli assemble command require files as parameters.

cardano-cli transaction assemble --tx-body-file <transaction_cbor_file_path> --witness-file <witness_cbor_file_path> --out-file tx.assembled

Use cardano-cli assemble command to combine both transaction and witness CBOR in order to receive a signed transaction. At this point, transaction is signed and is ready to be submitted.

cardano-cli transaction submit $MAGIC --tx-file tx.assembled

That's it!

I cannot thank you enough I have spent 2 days trying to solve this problem using every permutation I could think of and then I stumbled upon this post after being at my wits end. Thankyou!

I have a different type of example that might be helpful to anyone looking for ways to sign (and build) transactions using both a browser wallet and a server side private key.   Code is here https://github.com/lley154/helios-examples/tree/main/nft-multisig
And video https://youtu.be/CSd9ev_XH5w


text:
Mint NFT and FT tokens in same transaction
Is it possible to mint NFT and FT using same policyID and in the same transaction ?

Yes, you can do this.
The policy doesn't prevent this. The policy is used as a mechanism to prove that the tokens are really issued by the correct entity. E.g. I can't create a second HOSKY token with a different policy and pretend it's the real thing.
You can mint multiple different tokens in one transaction. The only difference between an NFT and an FT is that there should only be 1 of each NFT while there can be more than 1 of any particular FT.
As an example, let's look at the mint transaction of the berry NFTs, 50 NFTs were minted in one transaction. You could simply change the metadata and mint multiple of one of the tokens and you have your FT along with some NFTs: https://cexplorer.io/tx/10d3d8ffd9faf14ebfa57e999a9c448972f21ccbae0bcf9f3cd0ab1240870a6e


text:
Verify if signing wallet is same wallet that generated a particular policy id
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?

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']


text:
Track in real time the value of an Oracle
Is there a way to follow in real time the price of an asset like the current price of USD or any other currency, without having to create multiple transactions to update the oracle?

Didn't really get what you are trying to do. Are you trying to create an oracle, or use already existing one.
First of all, Cardano block time is 20 seconds on average, so that is as close to 'real time' as you will get.
Now, on off-chain code you just query the oracle address on the blockchain, find the needed utxo (which represents some oracle value, or multiple of them) and check the datum, where oracle data is stored (like token price or some other data). Depending on oracle implementation, you will get the newest possible data.
On on-chain side (plutus script), in order to utilize oracle efficiently, you need to use reference inputs combined with inline datums. This way, your script can read utxo datum without spending the utxo itself, and utilize this data in the script itself.
To implement this in real world, you should track oracle price changes off-chain and trigger on-chain logic based on some off-chain changes or events. As on-chain code also has the access to this data, it will ensure its validity and
will execute the logic using data present in the oracle at exact execution moment (same block).
Regarding Oracle projects in the ecosystem, currently there is not much you can use, as vast majority of them are still in development. To my understanding all of them will use reference inputs and inline datums introduced by Vasil, as it's the only way to avoid congestion issues.
EDIT:
As for creating an oracle:
Of course, we are not talking about real world oracle implementation. As it needs validation, reputation, slashing and etc mechanisms, before even talking about appearing on Cardano blockchain. That's another topic you can research online out of Cardano scope.
Now, sort of centralized oracle implementation would be, to create a simple validator script (or even a wallet) which would hold different data points in its utxos datums. For example each utxo datum could represent some asset price, and the AssetClass it is representing. Then creating the utxo with cardano-cli you would want to use --tx-out $oracleAddress+$utxoOutput --tx-out-inline-datum-file ${DATUMFILE}, in order to store the datum on the blockchain itself, to be accessed easily by other scripts. You should also add some identity NFT in utxo output, which would ensure the validity of the utxo (meaning it was created by YOU, not some random guy providing random price).
You would also need a service, which constantly fetches the needed asset prices from some source, and submits the transaction which is creating oracle utxo outputs with datums at the oracle contract/wallet address, with each utxo also containing validity NFT/FT, in order for users of the oracle to validate if the utxo is legit.
The only drawback of this implementation, is that it's centralized, meaning the owner of wallet/contract can write any asset prices to it and you need to completely trust them.
Now, in any validator script, you can simply reference this utxo holding specific AssetClass price, by simply providing --read-only-tx-in-reference utxo_hash#0 when building a transaction. PlutusV2 script will be able to retrieve the datum from the referenced utxo and use it in its logic.
Also, this oracle utxo can be used by multiple transactions at once without consuming it.
Hope this gives the rough idea

I want to create an oracle that can contain the current USD price in real time, I want to use it in another contract.
Do you have examples of codes that use 'reference inputs' and 'inline datums'?

edited the answer in regards to creating an oracle

Could I use this type of thing on Plutus?

what I've written is specific to plutus


text:
Nami shows all minted NFTs in "Assets" tab instead of "Collectibles" tab
the following image illustrates my problem: all the NFTs I've been minting is being seen as normal native tokens instead of collectibles.
For example, for the ANIMALSP01#28, the metadata in the transaction is:
{
721:{
   58acb2cb1ae017ede95e8e0a5801e0b3fc3036296adc242490d53cfd: {
      414e494d414c53503031233238: {
         description: "",
         name: "Koala",
         type: "Animal",
         image: "ipfs://QmcYZXh9mjdNC1TfyPKWSbGF2LV5Y7Et75A5DwjjRktMUH",
         Race: "Koala"
      }
   }
}
}

And I am generating this way:
policy = ScriptAll([pub_key_policy, must_before_slot])
policy_id = policy.hash()

NFT_NAME = nft_name.encode("utf8")
metadata = {
            721: {  # 721 refers to the metadata label registered for NFT standard here:
                # https://github.com/cardano-foundation/CIPs/blob/master/CIP-0010/registry.json#L14-L17
                policy_id.payload.hex(): {
                    NFT_NAME: {
                        "description": description,
                        "name": name,
                        "type": type,
                        "image":"ipfs://" + nft.file
                    }
                }
            }
        }

I hope someone can help me :)

The asset name in the metadata should probably be "ANIMALSP01#28" instead of the hex representation ("414e494d414c53503031233238"), according to the version 1 of CIP-025.

you are completely right. I was wrong because of the example given in the pycardano's repository


text:
cardano-node meaning of inbound outbound connection
I'm trying to find out the difference between connection types on the P2P network.
I'm aware of the difference between inbound and outbound TCP connections from a firewalling perspective, but I sense cardano-node also does slightly different behaviours depending on whether a connection is inbound or outbound.
For example Daedalus by default makes an outbound connection, it can send transactions and receive blocks, but it does not appear to relay transactions or blocks.
A full cardano-node has outbound and inbound connections, but I think these may be unidirectional for data propagation based on gLiveView.
P2P seems to add duplex connections, which I assume is Tx and Rx on the same connection, but how is that different to non-P2P?
If someone could clarify that would be appreciated.

In cardano blocks are being pulled via incoming connections. So if you have stake pool, then your relays must have incoming connection for your blocks being populated to the network. Contrary your relay must have outbound connections so it can fetch blocks from other relays.
In non-p2p world relays must have config file with other relays in it from where it will fetch blocks and your relay should be in other config files, otherwise your blocks will not be propagated. In p2p cardano nodes don't need to have manual topology files, where other relays are listed, but rather cardano node will learn peers from ledger/blockchain. Additionally duplex is not mandatory for p2p, you can switch it off, so duplex is not equal to p2p, but rather additional feature. With duplex 2 relays can fetch blocks inside same connections between them, without need to open 2 separate connections.
More details you can find in great video from Andrew Westberg here:
https://www.youtube.com/watch?v=ek_DK6Qoqrc


text:
What makes native assets native on Cardano?
Triggered by this blog post[1] (and forum post[2]) which says "No smart contract is needed to mint tokens on Cardano", isn't it so that to mint or to burn custom assets, one does need to run a smart contract, i.e the minting policy, and that it is only the transfer of custom assets where no interaction with a smart contract is required?

[1] https://cexplorer.io/article/cardano-will-have-stablecoins-without-censorship
[2] https://forum.cardano.org/t/cardano-will-have-stablecoins-without-censorship/113071

Native means it is native to the multi-assets ledger itself and you do not need an additional layer (such as the ERC-{20,721} smart contract on Eth).
Minting policy is just a set of ledger rules that defined the minting or burning of a token, it is not a smart contract.
To discover the differences between ERC20 assets on Eth and native assets on Cardano, see the How does a native token compare to ada and ERC20? document.

Took a while to come back to this! The article you link seems to confirm what triggered me: it is required to run a smart contract to mint or burn a custom asset, only when transferring a custom asset is no smart contract needed. See the second table in the "How does a native token compare to ada and ERC20?" document.

@CigaretteSmokingMan it all depends on your definition of a smart contact. I do not agree the validation scripts are smart contacts (there are just validation script without any kind of complex logic). Generally when speaking of Smart contracts on Cardano, we speak about the Plutus scripting language.

The simple scripts are available on the ledger since Shelley (July 2019) and I think there is a strong consensus these are not considered smart contracts.


text:
Is there a way to find the price of an asset from the JSON object of a transaction received from a Blockfrost webhook?
I am trying to find the price of an asset from a transaction JSON object that I receive from a Blockfrost webhook in which I track transactions from and to JPG store, the object has all the information about a transaction and the UTxOs but none of them have the price of the asset/assets, is it possible to find it by using one of the properties?

What do you mean by transaction JSON object, how does it look, what kind of information do you have access about it? Also, where did that transaction come from? If it's from JPG store than they create transactions in such a way that is possible to know the price of an assets if it's from an unknown marketplace, then you can't know for sure, but you can make assumptions and end up with a value.

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

@Mateus I am receiving this JSON object from a Blockfrost webhook that listens to transactions from and to the JPG store and I have read through the whole object but there is no price attached to an asset, that's why I asked if it is possible to retrieve that using one of the properties.

@Badro I see, can you edit your question to include this information and maybe also what transaction information you have access to through the block frost web hook? I believe you will find the price in the datum, but I can try to make a more developed answer once you edit your question

I have edited it, let me know if it is better now or needs more information :)

The price of the asset is stored within the datum of the order itself by the jpg.store contract.
Let's take the transaction 8698d938588ca9a93663cb1a9e4478390f374873970ced6d46ae9c4e6ac88723 for example.
To find out more information about this order, we need to find out the Datum of the UTXO that has been spent.
$ curl -s -H 'project_id: token' https://cardano-mainnet.blockfrost.io/api/v0/txs/8698d938588ca9a93663cb1a9e4478390f374873970ced6d46ae9c4e6ac88723/utxos | jq .inputs[].data_hash
null
"e782c5dbe30c01d0dee590e474fa0a92c18fd4ff3f459fb74c8253e4c87ddddd"
null

And here, you can the content of the datum.
$ curl -s -H 'project_id: token' https://cardano-mainnet.blockfrost.io/api/v0/scripts/datum/e782c5dbe30c01d0dee590e474fa0a92c18fd4ff3f459fb74c8253e4c87ddddd | jq
{
  "json_value": {
    "fields": [
      {
        "bytes": "bf5be2e0d7246b59b89f9ff57dfed904257985ecde6a20fc66cf7b26"
      },
      {
        "int": 680000000
      },
      {
        "bytes": "86ec26a91051e4d42df00b023202e177a0027dca4294a20a0326a116"
      },
      {
        "bytes": "617175616661726d657231303534"
      },
      {
        "bytes": "baaaa8b9a088f04386cb7119ccf686616fc15f81663f58f459d0bf67"
      },
      {
        "int": 50
      }
    ],
    "constructor": 0
  }
}

As you can see, the second field value is the price.

Thank you for answering, I have tested this with a few transactions in which people have bought assets and I do find the correct price after adding up the values. Same thing for when an asset is listed or its price has changed, thank you very much.


text:
How to deploy the Plutus smart contract
I am following Plutus-pioneer-program to learn smart contract development in Cardano. I have tried the onchain and offchain code, compiled and tested in Plutus playground and also in emulator trace. Now i want to know how can i use these smart contracts and deploy on blockchain. Some of the methods which i know are

By Cardano-cli, but I think it will be having a lot of .sh commands which is not easy to code every time.
By PAB, I tried to run PAB along with cardano-node, chain-index, plutus-pab-examples. But it's quite hectic to wait for days for their syncing. Also I was not able to proceed PAB as the process got killed due to out of memory.
By Alonzo testnet, I am also trying alonzo testnet tutorial, but its full of dependency errors. Also I don't know

Now I need to clear up my mind by having some clear steps of the smart contract compilation, testing, deployment and interaction. How can we do these all with the most recommended and practical way.
Also I need the tutorial/guidance to do deployment of smart contract on Cardano testnet, other than these or with the suitable and most used way.
I have explored many more stuff on Cardano, but I think everything has got quite messed up due to lack of proper guidance on that. Please guide we with a recommendable way and a proper flow of how to do all these stuff.

There are two steps you need to follow in order to create a dApp on Cardano.

Create the script itself - the on-chain code
Create the transaction which will make use of that script, ideally make it abstract enough so that any user can interact with you app - this is called the off-chain code

OnChain code
For step 1, your end goal is to have your script compiled into Plutus-core, whose hex representation you can see here, for example.
In order to produce this code, you will probably want some kind of high-level language. You don't write assembly every time you want to create an API, instead you usually write it in C or some language that can be compiled to Assembly.
Currently we have three languages, two of which are still in early stages of development (Aiken and Eopsin):

PlutusTx
Helios
Aiken
Eopsin

If you are doing the Plutus Pioneers Program, you probably learned PlutusTx. The advantage of PlutusTx is that it was developed by IOG so it will probably always have the most up-to-date code. In the sense that if we have a new feature added to Cardano (like reference inputs were recently), they will most likely be the first to have it implemented.
In the other hand, as you might have found out already, it is a language extremely difficult to understand, develop and test and I still occasionally scream in my sleep when I remember nix-shell and cabal.
Worst of all, it was not very well-designed in the sense that all other languages mentioned above have significant performance and script size improvements (50% above).
So, honestly, I would suggest you to rewrite whatever script you made using PlutusTx in another language (they are quite easy to understand), because it will keep you from turning mad in the long term.
I have used Helios before and it was very easy to use. You can take this repository as a guide to write and compile the script. I think Aiken will be better in the future, but I have not tried it yet and it is very likely to have bugs since it's earlier in its development phase than Helios.
OffChain code
Finally, for your off-chain code, you will need to create two transactions. The first is the one which sends some amount of tokens to the script with a specific datum and the second is the one which will try to spend that script, providing some redeemer.
Every dApp in Cardano needs to revolve around those two types of transaction. Some more complex ones, however, might mix both types by spending a script and sending some tokens back to that script with a new datum.
The theory behind it is out of scope, but there are currently multiple libraries which you can use to build this off-chain code. Some of which are the following:

Lucid
PyCardano
Mesh

Each one is well documented and have their own guides and examples, my advice you would be to use Lucid. PyCardano is great and I have personally used it even more often than lucid, but it builds the transactions in the back-end so you will still need to create a client interface to sign it and submit it. It can be good, however, if you simply want to see your script in the chain and want to test it quickly and easily.

Really? Can i make the smart contract using Helios. Like I did certain RnD on cardano smart contracts, and the only thing i get to know that cardano only supports haskell and plutus, which is truly a language giving you headache. So point is, can i really make any smart contracts like staking etc with helios??

@duaaazhar Yes and there are examples of it already deployed on-chain, I made some my self

@duaaazhar But take a look at Aiken, it looks really easy to use, just maybe not ready for production yet https://aiken-lang.org/getting-started/hello-world

Yah Aiken is seeming bit easy to understand but i also have to go for production environment, so i think i should take start with a mature language like helios right?

I’m a huge Helios fan, so much so I wrote a book on it https://www.amazon.com/Cardano-Smart-Contracts-Helios-Lawrence-ebook/dp/B0BTBK6YM7/
I’ve also released an open source repo of examples from the book as well.
https://github.com/lley154/helios-examples
I also share similar nightmares of nix-shell/cabal hell….thank God I don’t have to do that anymore.

Forgot to mention, not only can you use Helios for on-chain smart contracts, it also has excellent libraries off-chain for Tx building as well.


text:
How to generate CBOR hex of plutus smart contract
How can i generate the CBOR hex of a plutus smart contract. Does it requires to generate CBOR of onchain code only or both onchain and offchain?
Also if have a smart contract which requires parameters e.g. deadline. to run, then how will i be able to pass that argument with that cbor at the time of deployment of plutus smart contract.
Kindly suggest a recommended way for that and also how to interact efficiently with that CBPOR.

You need to create a deploy file that adds parameters to the plutus script and then generates the plutus script to be submitted to the blockchain.  If you look at the generated file, you will see the following contents including the cborHex.
$ cat vesting.plutus | jq
{
  "type": "PlutusScriptV2",
  "description": "",
  "cborHex": "5901e55901e20100003232323232323232323232323232323232323232323232323232323232323232323232323232222533357346660080060040022930b1111919191992999ab9a3370e002900009198168998141981300218048041815a49055653313a200013302833019005300b008302b491055653323a2000123302d133028330160043009008302b4901055653333a200013302833019005300a008302b491055653343a200035573a6ea8004004010c040c038004c03000401400c0048d5d09bac001235742600800246ae84c0080048d5d1180100091aba2375800200800246ae84c02c0048c008c008c0080048d5d098080008009191180219b89002375a0026eb40048ccd5cd000a504a2446601c6eb0c00c0088cdd780080100091aba13002001235744600400246ae88c0080048d5d1180100091aba23002001235744600400246ae88c0080048d5d1180100091aba23002001235573c6ea800488c8ccc00400400c0088894ccd5cd1aba300214a02a666ae68c004d5d08010a51133300300335744004002002464466e20008dd68009bad00122335738600c66008002a6006004004426006666ae6800524104747275650049010566616c736500232230043372c004600a002600600246ea4dcc00091b99375c00244a666ae694008540045281"
}

Here is the old Haskell PlutusTx V2 Way:
https://github.com/lley154/traceability-smart-contract/blob/main/src/Traceability/V2/Deploy.hs
Here is the better Helios way:
https://github.com/lley154/helios-examples/blob/main/vesting/src/deploy-vesting.js
Find our more about Helios here:
Helios Github repo https://github.com/Hyperion-BT/Helios
Cardano Smart Contracts with Helios Book:
https://www.amazon.com/Cardano-Smart-Contracts-Helios-Lawrence-ebook/dp/B0BTBK6YM7/
Helios examples:
https://github.com/lley154/helios-examples

Hi, Actually i am implementing onchain code in Plutus and offchain in Mesh library. So i am puzzled about how can i interact with a parameterized onchain code. Like how to generate the CBOR in the case where the parameters have to be passed runTime like UTXO. And also how can i  validate the customized datums made onchain side. E.g. in case of Vesting contract. I created a custom datum with params of deadline (POSIX) and beneficiary (PayPubKeyHash). But when i pass the same datums on offchain side, my script doesnot detect them and gives the error of "MissingRequiredDatums". Kindly guide me.

One of the big advantages of Helios is that you can compile code to plutus on the fly in the browser.  So this inline Helios code can be passed a UTXO from a browser wallet that will be used in a transaction and then on the fly, be compiled into plutus code and submitted with the transaction.   I'll post the code in a answer so it is formatted better.

One of the big advantages of Helios is that you can compile code to plutus on the fly in the browser.  So this inline Helios code can be passed a UTXO from a browser wallet that will be used in a transaction and then on the fly, compiled into plutus code and submitted with the transaction.
...
   // Off-chain code
   // Get wallet UTXOs
   const walletHelper = new WalletHelper(walletAPI);
   const utxos = await walletHelper.pickUtxos(minUTXOVal);
...

   // On-chain code in mintScript variable
   const mintScript =`minting nft
   const TX_ID: ByteArray = #` + utxos[0][0].txId.hex + `
   const txId: TxId = TxId::new(TX_ID)
   const outputId: TxOutputId = TxOutputId::new(txId, ` + utxos[0][0].utxoIdx + `)

   func main(ctx: ScriptContext) -> Bool {
       tx: Tx = ctx.tx;
       mph: MintingPolicyHash = ctx.get_current_minting_policy_hash();
...

    // Off-chain code
    // Compile the helios minting script
    const mintProgram = Program.new(mintScript).compile(optimize);

    // Add the script as a witness to the transaction
    tx.attachScript(mintProgram);
...

https://github.com/lley154/helios-examples/blob/main/nft/pages/index.tsx
For Datums, you created them during transaction construction and then include them in your transaction.   I’ll use Helios as an example because the code is very easy to understand.
Here is the helios code that gets compiled into plutus code (untyped plutus core).
On-chain code
spending vesting

struct Datum {
    creator: PubKeyHash
    beneficiary: PubKeyHash
    deadline: Time
}

enum Redeemer {
    Cancel
    Claim
}

func main(datum: Datum, redeemer: Redeemer, context: ScriptContext) -> Bool {
    tx: Tx = context.tx;
    now: Time = tx.time_range.start;

    redeemer.switch {
        Cancel => {
            // Check if deadline hasn't passed
            (now < datum.deadline).trace("VS1: ") &&

            // Check that the owner signed the transaction
            tx.is_signed_by(datum.creator).trace("VS2: ")
        },
        Claim => {
           // Check if deadline has passed.
           (now > datum.deadline).trace("VS3: ") &&

           // Check that the beneficiary signed the transaction.
           tx.is_signed_by(datum.beneficiary).trace("VS4: ")
        }
    }
}

https://github.com/lley154/helios-examples/blob/main/vesting/src/vesting.hl
off-chain code
...
   // Construct the datum
   const datum = new ListData([new ByteArrayData(ownerPkh.bytes),
                                 new ByteArrayData(benPkh.bytes),
                                 new IntData(BigInt(deadline.getTime()))]);
   const inlineDatum = Datum.inline(datum);
...

   // Add the destination address and the amount of Ada to lock including a datum
   tx.addOutput(new TxOutput(valAddr, lockedVal, inlineDatum));

https://github.com/lley154/helios-examples/blob/main/vesting/pages/index.tsx


text:
cardano preprod wallet balance is still zero after full node sync
I'm following the instructions laid out in this article.
https://developers.cardano.org/docs/get-started/cardano-wallet-js
I first ran cardano node and wallet using docker-compose on preprod network. I then created a new walletm, sent some test tokens using the faucet portal. The transaction was successful and verifiable on preprod cardano explorer. However the wallet balance when I call the api still shows as zero. I waited for the node to fully sync and change the status to "Ready" but even after that the wallet balance is still zero.
This is the network status(preview)
{
  network_info: { network_id: 'testnet', protocol_magic: 2 },
  network_tip: {
    absolute_slot_number: 7984597,
    epoch_number: 92,
    slot_number: 35797,
    time: '2023-01-25T09:56:37Z'
  },
  next_epoch: { epoch_number: 93, epoch_start_time: '2023-01-26T00:00:00Z' },
  node_era: 'babbage',
  node_tip: {
    absolute_slot_number: 7984492,
    epoch_number: 92,
    height: { quantity: 376281, unit: 'block' },
    slot_number: 35692,
    time: '2023-01-25T09:54:52Z'
  },
  sync_progress: { status: 'ready' },
  wallet_mode: 'node'
}

This is the code to check the balance.
const { Seed, WalletServer } = require("cardano-wallet-js");
(async function () {
let walletServer = WalletServer.init("http://127.0.0.1:8090/v2");
let wallets = await walletServer.wallets();
let id = wallets[0].id;
let wallet = await walletServer.getShelleyWallet(id);
let availableBalance = wallet.getAvailableBalance();
console.log(availableBalance);
})();

Can you please provide more information?

Sure.
Here is the transaction which I did from Faucet to my test preview wallet.
https://preview.cexplorer.io/address/addr_test1qzf90j270zkyfz7y8gtxmgjf02mee35xvzegfs8a93jgkvs89sjsfy7cyzh4me7et5qeldtq94nqn7ec7aejh4lptdaszd2560#data
These funds are not reflected when I run "wallet.getAvailableBalance()" in the code. Balance is still shown as 0.

I updated the question with the code to retrieve balance.

Can you console.log the address of the wallet?

When i run wallet.getNextAddress(), I get below response.
AddressWallet {
  id: 'addr_test1qzf90j270zkyfz7y8gtxmgjf02mee35xvzegfs8a93jgkvs89sjsfy7cyzh4me7et5qeldtq94nqn7ec7aejh4lptdaszd2560',
  state: 'unused'
}

Possibly you're running your local node on one network (preprod) and used the faucet and are checking on the other (preview). Try using the faucet to send assets to that address on the other network (https://docs.cardano.org/cardano-testnet/tools/faucet). And if they appear you have to decide which one you want to use. Here's the config files for each: https://book.world.dev.cardano.org/environments.html

Thank you. I double checked that I'm running the network on preview. I also tried Blockfrost (preview network) and queried those addresses, and I was able to find the balance here. So I suspect the cardano node that I'm running locally using docker is not updating for some reason. I'm running on Windows 11 btw.

Here's a similar issue (unfortunately unresolved, https://forum.cardano.org/t/cardano-wallet-js-debugging/104169/9)
But there might be some good suggestions to 1) check the logs and 2) check the docker configuration; might need to assign more RAM in the settings

I don't see any transaction for this wallet address on the blockchain explorer: https://preprod.cardanoscan.io/address/009257c95e78ac448bc43a166da2497ab79cc68660b284c0fd2c648b32072c250493d820af5de7d95d019fb5602d6609fb38f7732bd7e15b7b

Please look into the preview testnet, not preprod.


text:
Disable color in cardano-node logs
I am wondering, if it is possible to disable the colorization of the cardano-node logs.
Is it possible to disable the colors in the stdoutput of cardano-node?

Yes this is possible
cardano-node "rest of the command" | sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2};?)?)?[mGK]//g"

will do the trick. Credits to this answer.

The proposed line does not disable colors in the cardano-node stdout/logs. This is removing the special sequences for colors.
I am looking for a configuration setting that omits the sequences used for colorized output. Which should happen automatically, when running in a non-interactive shell - but this is unfortunately not the case with the cardano-node CLI tool.


text:
Error when trying to harvest farm in minswap
I have a ADA-MIN farm on app.minswap.org, connected with a Nami wallet.
Since a couple of days the "stake" button switched into "migrate" button.
Since then I could either withdraw nore migrate. I aways receive the failure notice:
"Need additional 5000000 lovelace but only 2939420 lovelace is available to choose."
I put addionial >100 ADA in attached Nami wallet but the problem remains the same.
No clue, what do do anymore.. help is very welcome! :-)

Did you wait for a while after sending additional ADA to your wallet? Sometimes it can take a while until the new UTxOs are picked up by the wallet/dApp.
Not sure but 5'000'000 lovelace sounds like collateral. Have you set up the collateral in Nami? (Open Nami > Click on the icon in the top right corner > Collateral)
Otherwise the MinSwap Discord might be the place to ask for help (and don't forget to come back here and post your solution).

It finally worked out - Thanks and shout out to @eddex♦!
Solution was to set up the collateral in the Nami wallet!

@jay2kay great to hear! Since you are new here I want to quickly mention that you can mark the answer as "accepted" so other people can see that this answer provided the solution for your problem.


text:
Guarantee not dispensing native assets to a Franken address
As I understand it, a "mangled" address can be used to spoof ownership of a wallet who's stake address is NOT of a wallet controlled by the one doing the spoofing.
Put another way: I can use someone else's address, and my own address, combined together to fool a dApp into dispensing some native assets to ME even though they should only be claimable by the owner of the wallet who's stake address I have mangled with my spending address.
What is a very concrete way for a dApp to NEVER fall prey to this "exploit"?
It is put this way on a thread I found:

It is not possible if the dApp does not send native assets to the
address paying the fee, but instead to the address that last did a
delegation of the stake key of the address paying the fee, which
requires a signature of that stake key and, hence, guarantees the
ownership.

So...

what about a wallet that never delegated?

If someone uses a Franken Address to claim something or benefit somehow how can I make sure the TRUE owner is the one claiming/benefiting by finding the address to send to from the last time the stake address portion delegated? This must be a possible lookup in db-sync, and I am not sure how to look it up.

I am looking for a guaranteed way of ensuring native assets will (and ADA?) can only ever be sent to the actual wallet of the stake address, not to a wallet pretending to be that wallet by using a franken address.
I believe the simple way to avoid this as an issue is to ALWAYS require a user SIGN any transaction that sends them something or benefits them somehow...in this way, no spoofing is possible.

What is a very concrete way for a dApp to NEVER fall prey to this "exploit"?

Simple: you do not have keys to sign the payment credentials which are the payment part of the address.
And If a dApp is checking the stake key instead of the payment key, that is a major, major security flaw in their contract.
Your dApp should be using only and only the payment credentials of the address.

what about a wallet that never delegated?

Using the strategy outlined above you cannot accept tokens from users who never delegated, so you would need to handle it somehow in your application and not allow those types of users.

If someone uses a Franken Address to claim something or benefit somehow how can I make sure the TRUE owner is the one claiming/benefiting by finding the address to send to from the last time the stake address portion delegated? This must be a possible lookup in db-sync, and I am not sure how to look it up.

Blockfrost has an endpoint to get someone's delegation history
https://cardano-preprod.blockfrost.io/api/v0/accounts/stake_test123.../delegations?order=desc
Now is this the best way of avoiding the Frankenstein address vulnerability? It depends on your application, but I will say probably not.
A different way would be to ask for a CIP-08 signature from the user stake-key. If he can sign an arbitrary message with his staking-key, it means he has the stake-key, you can require this whenever a user wants to claim something.
Another possibility would be to force the user to include the stake address signature in the transaction and invalidate it otherwise. This is useful if you don't want to require the user to sign something twice like in the example above. You can do this by using the transaction to re-delegate to whatever pool he already was delegated (or to a new one if he wasn't previously). This will tell whatever browser wallet he is using that the transaction needs a staking-key witness.


text:
What is different nami wallet signing and payment.skey signing?
I built transaction at nodejs by using cardano-cli.
cardano-cli transaction build \
--alonzo-era \
--testnet-magic 1 \
--tx-in dbf7f56f844cc4b85daccb62bedf4eeff0a84cb060f0f79b206c7f087b3f0ba1#0 \
--tx-in dbf7f56f844cc4b85daccb62bedf4eeff0a84cb060f0f79b206c7f087b3f0ba1#1  \
--tx-in 61b88efd41ccbb0e71c48aca2cbe63728078ec7fb20ec9c27acfe33d0647248d#0 \
--tx-in-script-file /cardano/plutus/direct-sale.plutus \
--tx-in-datum-file /cardano/temp/testnet/datums/list.json \
--tx-in-redeemer-file /cardano/temp/testnet/redeemers/buy.json \
--required-signer-hash 2be4a303e36f628e2a06d977e16f77ce2b9046b8c56576bb5286d1be \
--tx-in-collateral dbf7f56f844cc4b85daccb62bedf4eeff0a84cb060f0f79b206c7f087b3f0ba1#1 \

... some txout ...

--change-address addr_test1qq47fgcrudhk9r32qmvh0ct0wl8zhyzxhrzk2a4m22rdr0sqcga2xfzv6crryyt0sfphksfr947jjddy3t4u0qwfmmfq2h0pj8 \
--protocol-params-file /cardano/testnet/protocol-parameters.json \
--mint "2 20edea925974af2102c63adddbb6a6e789f8d3a16500b15bd1e1c32b.4143544956495459" \
--mint-script-file /cardano/plutus/activity-minter.plutus \
--mint-redeemer-file /cardano/redeemers/mint.json \
--invalid-before 19059345 \
--invalid-hereafter 19059495 \
--out-file ./tx.raw

After run this command, I got cborHex and I used this at frontend.
When I sign by using name wallet, I got some error.
"transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (WrappedShelleyEraFailure (InvalidWitnessesUTXOW [VKey (VerKeyEd25519DSIGN \"cf949f966b426f25db11b6062edc31312001e3cd0ced4c6c7db3da7b5ac9766b\")])))])"

But when I sign with payment.skey at nodejs, it was worked.
I was discuss Alexd1985 at cardano forum.
https://forum.cardano.org/t/how-to-resolve-shelleytxvalidationerror-shelleybasederababbage-applytxerror-utxowfailure-fromalonzoutxowfail-wrappedshelleyerafailure-invalidwitnessesutxow-error/113555/4
What is solution for this problem?

This is very probably due to a fact that the serialization library that Nami uses to construct transactions keeps a different order of witnesses as cardano-cli does, therefore if you sign a cli transaction with Nami, you get the InvalidWitnessesUTXOW error.
See the blog post entitled How to sign and submit cardano-cli transaction using Nami Wallet how to re-assemble the signing keys.


text:
What block height was the vasil hardfork?
Additionally, did vasil correlate to a change of era for cardano?

The first block appears to be at slot 83548800 according to the /network/eras Blockfrost endpoint.
  {
    "start": {
      "time": 157680000,
      "slot": 72316800,
      "epoch": 365
    },
    "end": {
      "time": 168912000,
      "slot": 83548800,
      "epoch": 391
    },
    "parameters": {
      "epoch_length": 432000,
      "slot_length": 1,
      "safe_zone": 129600
    }

Yes, Vasil has been an era change from Alonzo to Babbage.


text:
Transfering NFT from CLI to your Nami wallet
I created an NFT on preprod via my cardano-cli but I have issues sending it to my Nami wallet. Can anyone point me to the best documentation that covers this. Thank You.

All you need to do is to create a simple transaction sending the asset to your receiving Nami wallet in form of "$tokenamount $policyid.$tokenname".


text:
How do I design a dApp for 1000 NFTs minted per second
I am brainstorming on the architecture of a Cardano dApp that will be able to issue tickets as NFTs and can scale to around 1000 NFT tickets per second. From what I understand so far on UTXO, a minting transaction would need to consume a UTXO to produce the NFT and, since each block takes around 20 seconds, I would theoretically process 1 ticket every 20 seconds.
My understanding is that this issue is the much talked about concurrency issue sometime back. I have researched 'batching agents' but have not yet fully grasped the idea and if that's the solution.
Is batching the correct solution to this problem, and if so, what would the process flow look like to scale ticket issuance?

You can have unlimited UTxOs in an address, so you don't need to wait for the next block to create a new transaction.
You can also create many chained transactions from a single UTxO in one block. You keep track of the outputs and use them in the next transactions, and submit the transactions in the order of creation to the same node.
You won't be able to mint 1000 NFTs per second because there is not enough space in the blocks for the transactions. You can probably mint between 5 to 10 per second with the current network parameters, depending on the congestion.

We need to understand first what is a NFT: It is a token that only exist ONCE. Can't be two tokens the same.
What we mean with two tokens the same? To understand that we need to know how a token is defined in Cardano.
It is defined by a Currency Symbol and a token name. Both together makes a token. To have two tokens the same we need to have same Currency Symbol AND same TokenName.
Following that we can see that we can have NFTs using the same Currency Symbol but different TokenNames.
What is a Currency Symbol? It is just the hash of the Minting Policy used to mint them.
How we assure that a Currency Symbol is unique? Using an UTXO to create a parameterized Minting Policy. The UTXO, that for his nature is unique, becomes hard coded in the Minting Policy, so when you get the hash of that parametrized Minting Policy, the Currency Symbol, is going to be related with that UTXO and is going to be unique. Same Minting Policy with different UTXO parameter will end up with a different hash and a different Currency Symbol.
UTxOs are unique, they exists only once in the blockchain and when they are consumed they disappear. Never will exist another UTxO equal to one that existed before.
So, you need a particular UTXO to have a particular Minting Policy.
You can create a Minting Policy that is going to run only once, if you check if that particular UTXO is used in the transaction.
Then you need to add extra validation to be sure that in this only time that is running it will mint only ONE token. If you let mint two or more tokens, they will not be NFTs anymore (if they share same TokenName)
But if you check in the Minting Policy that they are using different TokenNames, you also can mint several NFTs (1 unit of each of them) in the same transaction using the same UTXO.
You could potentially mint all 10.000 in the same transaction, with 10.000 different TokenNames, but you will end up with too many different assets in one or several outputs UTxOs and that could lead to some problems of transaction size. So your limit here wil be transaction size.
I never tried the limits here. Ill recommend you to use referencial scripts for the Minting Policy so you dont have to add the size of the script in this transaction and you have all the 16Kb to use in your big outtput with many NFTs.

Could you maybe mint 1000 units of the same NFT, then it becomes rather a token with metadata and an image?
When checking the ticket, you could have the app that is showing the ticket either sign it with their user wallet credentials or have the app send it to you in a transaction in which case you keep track of the wallet address that had that ticket


text:
How can an endpoint receive multiple argument?
How can add multiple arguments on a certain endpoint?
How can I add more arguments to “start” function? Like “start x y” or “start x y z”?
{-# LANGUAGE ImportQualifiedPost  #-}
{-# LANGUAGE DataKinds             #-}
{-# LANGUAGE DeriveAnyClass        #-}
{-# LANGUAGE DeriveGeneric         #-}
{-# LANGUAGE FlexibleContexts      #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude     #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE TemplateHaskell       #-}
{-# LANGUAGE TypeApplications      #-}
{-# LANGUAGE TypeFamilies          #-}
{-# LANGUAGE TypeOperators         #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE StrictData            #-}

module TEST where

import Data.Text qualified as T
import Playground.Contract
import Plutus.Contract
import PlutusTx.Prelude
import Prelude qualified as Haskell
import qualified PlutusTx.Numeric as PTN
import qualified PlutusTx.Prelude as PTX
import qualified Data.Text        as  T
import qualified PlutusTx.Ratio   as PTR
import           Prelude                   (String, fromIntegral, ceiling, Float, (*), (-), (/), show, and, const)
import qualified Plutus.Contract as PC
import           Ledger

import           Control.Monad       hiding (fmap)
import           Data.Map            as Map
import           Data.Text           (Text)
import           Data.Void           (Void)
import           PlutusTx            (Data (..))
import qualified PlutusTx
import qualified PlutusTx.Builtins   as Builtins
import           PlutusTx.Prelude    hiding (Semigroup(..), unless)
import           Ledger              hiding (singleton)
import           Ledger.Constraints  as Constraints
import qualified Ledger.Scripts      as Scripts
import           Ledger.Ada          as Ada
import           Playground.Contract (printJson, printSchemas, ensureKnownCurrencies, stage)
import           Playground.TH       (mkKnownCurrencies, mkSchemaDefinitions)
import           Playground.Types    (KnownCurrency (..))
import           Prelude             (IO, Semigroup (..), String)
import           Text.Printf         (printf)
import           Plutus.Contracts.Currency qualified as Currency
import           Data.Text (Text, pack)
import Prelude as Haskell (Int, Semigroup (..), String, div, dropWhile, flip, show, (^), (<>) )

name :: BuiltinByteString
name = "CHOCOLATE":: BuiltinByteString

-- start :: forall w s. Integer -> Integer -> Contract w s Text ()
start x  = do

    pkh <- Plutus.Contract.ownPaymentPubKeyHash
    cs  <- fmap Currency.currencySymbol $
           mapError (pack . show @Currency.CurrencyError) $
           Currency.mintContract pkh [(TokenName name, x)]
    logInfo @Haskell.String ("RESULTADO: "  Haskell.<> (Haskell.show $ cs) )

type DummySchema = Endpoint "start" Integer

endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ start'
  where
       start'  = PC.endpoint @"start" $ do
                                        \a -> start a

mkSchemaDefinitions ''DummySchema

$(mkKnownCurrencies [])

Endpoints can pass multiple parameters.  See this example, where the start endpoint passes four parameters, as defined in StartParams:
data StartParams = StartParams
    { spDeadline :: !POSIXTime
    , spMinBid   :: !Integer
    , spCurrency :: !CurrencySymbol
    , spToken    :: !TokenName
    } deriving (Generic, ToJSON, FromJSON, ToSchema)

In the schema declaration is where you ensure that start passes the parameters StartParams:
type AuctionSchema =
        Endpoint "start" StartParams
    .\/ Endpoint "bid"   BidParams
    .\/ Endpoint "close" CloseParams


text:
Unexpected error coming from Helios library during connection to preview TestNet verification?
My Eternl wallet now has an account that is targeted towards the preview TestNet. I did activate the account for connecting to Cardano dApps. I am able to connect to my wallet from Picoswap. However, during the attempt to by the Helios library to verify the connection to the preview TestNet, I am getting an unexpected error report from the Helios library.
As you can see in the call stack sub-window from the screenshot below, this is occurring in the fromValidatorHash() method that belongs to the Address object. If you look in the Console sub-window you can see that the method was expecting the stakingHash parameter to be a StakeKeyHash object or if not that, a StakingValidator object. Instead that parameter is a ValidatorHash object so the assert() call fails and throws the error.
https://github.com/Hyperion-BT/picoswap
What can I do to fix this?
Also, can someone point me to the documents that describe the data objects the Helios library is trying to parse, in case I have to go it alone here?

Should be resolved now

The issue is related to picoswap code base not being updated to use the latest Helios version (currently v0.11.2) correctly.  It was working on a prior Helios version around v0.9.x but picoswap is not currently in active development.
This issue was discussed on the Helios discord here: https://discord.com/channels/997177025972424815/1000828171161190470/1069692746304077884