text:
Can a smart contract create a transaction on someone else's behalf?
Must someone send their ADA/tokens to a smart contract address in order for the ADA/tokens to be used in the contract OR, for example with Nami wallet connected on a web page, is it possible for a user to allow some code to execute via some website button which automatically spends some of the UTxOs in their wallet? The latter can be if and only if the user accepts some terms and conditions.

No,  if you dont sign the transaction nobody can spend any of the UTXO in your adress... if the Nami wallet  ask you to do it and you trust the page and sign some tx done by a bad behaved  the web-app yes.. they can make spend your UTXOs.
So you should only interact with recognized decentralized web-apps :) .

I don't know the exact technical details of this question because I have just started studying Cardano blockchain development but what I can say is this:
Let's say in this situation, someone has a hardware wallet. We know the private keys never leave the hardware wallet and every transaction using your wallet requires physical interaction by you, the user. (I assume this should hold true for Daedalus and Yoroi wallets) With that said, you would have to do the same in this case. Therefore you could not just allow a smart contract to make, sign and send transactions from your wallet without approving all transactions. I.e., for the hardware wallet, physically reviewing the transaction on the wallet and approving it.
So I would assume from this that transferring money to the smart contract wallet would be how this works.
Anyone, if I am missing anything with this, please correct me.

I think you're asking two separate questions here:

Must someone send their ADA/tokens to a smart contract address in order for the ADA/tokens to be used in the contract
Is it possible for a user to allow some code to execute via some website     button which automatically spends some of the UTxOs in their wallet

For the first, it's probably useful to discuss how smart contracts on Cardano work.  Unlike other blockchains where the smart contract takes on an active role directing calls to various interfaces.  Smart contracts on Cardano (otherwise known as validators) have a much more limited role.  On Cardano, smart contracts answer the yes or no question, Can these assets be spent in this way?
Because the validator (smart contract) is only checked when the assets are spent, the answer is yes, tokens must first be sent to the smart contract address BEFORE the smart contract does any work.
As for the second question, it's easy enough for a website to direct Nami to send funds to any address you specify.  This can be done without a smart contract and will still prompt the user to confirm and sign the transaction.


text:
Is really any token metadata stored on chain? Or is it the mint TX metadata?
I am aware that offchain metadata is stored using the registration as Cardano Developers portal dictates, my concern is about on-chain metadata.
Is really any NFT-metadata stored on-chain? Like blockfrost says?   Since  NFT are just pairs of police id and name... Where is onchain metadata stored ?  As far as i understand metadata can only be attached to a TX ... So the metadata should be attached to the mint- TX Wich can be always traced and is stored in blockchain,  is this right ?
Or i am getting confused at comparing two different kind of native assets ?

Yes there is NFT metadata stored on-chain and yes they are stored initially on the mint tx although you can update it later (basically overriding it in a new tx). If the NFT metadata follow the CIP25 you'll see it "properly" rendered on several sites such as pool.pm.

So it is TX metadata, not NFT - metadata, but they associate this metadata to the NFT by tracking all the history of the asset to the initial mint , and it's updated in every mint .. if policy allow minting that same asset.. right ?

@AliciaBasilio, strictly speaking it's TX metadata, just remember an NFT is meant to be unique so it should not allow more minting, but of course it all depends on the policy specifications

source: Stack Exchange

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

sort: votes


text:
How would one go about Gating content through ownership of an NFT?
The question is the title, I want to gate access to a URL based on the presence of a specific token in their wallet.
I assume this would be done through a wallet browser plugin? I've heard that this can be done through Nami wallet but would like some more information if anyone can help please?
Many thanks in advance.

In the Nami wallet documentation, it says how to interact with the wallet using web-browser, for example you can run window.cardano.enable(), there is a command for queryng UTXOs.. i have not been able to make it work, but yes the one that query the address.. then you can query the adress using blockfrost, and check the UTXOs sitting in that adress.

Thanks for the answer :)

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


text:
How to burn Cardano token after the 'invalid after' passes?
My token policy script is:
all:
    [
        {
           invalidAfter: 40951072
        },
        {
           pubKey: "36ed345d252a242ad67072db79e5736866fa58ebe3fd782739208ef6"
        }
    ]

Since the slot already passes it looks like I can't burn tokens by cardano-cli 'mint' anymore. The error I get is:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash "6c6d152385ada4cc7606a31090ac37ac267b0b5e2e37ecaf6b47d146"])))])
I wonder is there any other 'best practice' to burn the token?

As Isaac stated, transaction with this policy is not possible anymore. But that does not mean it is not possible to publicly make assets unavailable. There is a great post on the Cardano form that goes in-depth on different types of burning methods [1]. Note that these tokens send to such addresses still exists but can't be transferred anymore by anyone.

You could send it to a wallet you control then destroy any record of your credentials :)

It does not answer the case since I need to 'destroy' them publically. So anyone could be sure that it was burned.

It's impossible to get the policy script to validate since the validity interval has passed. There is actually no way to burn the token because Cardano was designed that way. Take a video of yourself transferring it to a hardware wallet then smashing it with a hammer :)


text:
Can you specify an upper and lower bound for the validity period of a transaction?
I want a transaction to only be valid for a certain period of time relative to some specified start time. I thought that maybe I could use Constraints.mustValidateIn (interval firstInterval $ firstInterval + 10000), but this has failed to validate. It seems that it does not matter what the upper bound is, because it always fails... unless its positive infinity. So this: Constraints.mustValidateIn (from $ firstInterval) always works.
In the docs, Constraints.mustValidateIn has a footnote specifying this: "@mustValidateIn r@ requires the transaction's time range to be contained in @r@."
So I guess what I am asking is what is a transactions time range? And can it be manipulated to fit this scenario?
Thanks!

I discovered this cool function named hull. Here is the function definition from the docs.
-- The function hull gives the smallest interval containing both the given intervals.
hull :: Ord a => Interval a -> Interval a -> Interval a
hull (Interval l1 h1) (Interval l2 h2) = Interval (min l1 l2) (max h1 h2)

I did not expect this to work any better than my previous attempts at specifying some range with an upper limit. But it did.
Here is my constraint now:
Constraints.mustValidateIn (hull (from $ firstInterval)(to $ firstInterval + 8000))


text:
Cabal repl is very slow
I've already setup the IOHK binary cache in /etc/nix/nix.conf, yet when I build PPP lecture #2 I have to build many modules.

whereas it seems Lars only has to process one.

Does anyone know why this might be happening?

That should happen only the first time, when you make the cabal repl because it's building all dependencies.
After that, every cabal repl should look like Lars screen.

Not sure how well it works yet, but the latest GHC release does improve on compilation time and memory footprint.
https://discourse.haskell.org/t/ghc-9-2-1-released/3527


text:
How to handle datum in a decentralized way?
What is the best practice of storing the local state of an UTXO to be publicly visible on-chain?
Thinking about how application would function in the future I thought that in a good DeFi ecosystem all datums should be publicly deducible. That is, no intermediate should be needed to process the state. And since the hash function is a one way function there is no deducing what a hashed state represents.
Right now datums can only be send in a transaction as a hashed values right? The cardano-cli only supports building transactions with the command --tx-out-datum-hash. I do not know what the protocol allows at the moment, maybe it is allowed but the client won't construct such transactions for you. Now to overcome this one can send unhashed metadata with the transaction to publicly anounce the datum in the same transaction. I am missing some other way? This extra hashed datum is a bit redundant, though I know it is needed now since UTXO's with empty datums are unclaimable [1].
I think that the SpaceBudz auction contract is initiated in the above described way, metadata is send with every UTXO that is inbound of the script address [2]. I have not figured out how this metadata is correctly formatted to correspond to datumhash. More explicitly, I am yet to construct a json that hashes to the datum via the command cardano-cli transaction hash-script-data --script-data-file file.json.
Lastly I wonder in general what the impact is of these uncompressed metadata transaction. All plutus core code is serialized to hex and is transformed to CBOR before transacting. Would it be a good habit to do this for metadata as well? I have now idea what the PAB will do in this respect, maybe this is a no-brainer?

An other user on the Cardano forum answered this question, for ease of use I'll will post that answer here as well [1].

The protocol allows to embed datum into the witness set, though the current version of the cardano-cli does not support it. What, you can do is download the latest cli build from Hydra and use that one.
Example:
cardano-cli transaction build --tx-out-datum-embed-file ... # or  --tx-out-datum-embed-value
I highly encourage you to use only the precise JSON i.e. -file option instead of the causal one -value one.
But, what do you mean by uncompressed metadata transaction? The metadata in block is serialized from JSON to CBOR.

And

To clear the things a little bit. Datum hash is in the UTxO or as a map key in the witness set.
And yes a datum should not be act like an un-locking thing (that is why there is redeem) and should be publicly available all the time and or easily be reconstructed off chain. They only should be acting as state holders. iirc there was a discussion in the past whether the whole datum should be the part of the UTxO, but they (IOG) have decided not to go with that route for several reasons.
The problem is that in the current implementation the protocol cannot distinguish between the native script addresses (which do not need datum) and the Plutus script addresses, meaning the transaction validator cannot make decision whether an output in its pending/validating transaction requires a datum or not.
Also, keep in mind, due to the nature of UTxO model, everybody can send to any semi valid address (i.e. valid prefix and valid bytes length based on prefix but not existing address e.g, all 0s 0x80000000000....) to anything, which can mean it can be lost forever (or until there is private key generated which can derive that address).


text:
Block Producer Node no pending Tx's
Please excuse the noob-ic question:
My block producer node shows 0 Total Tx and 0 Pending Tx on gLiveView:

However, my two relay nodes have non-zero total and pending tx values, and seem to only be going up. Here is a screenshot of one:

The BP is connected to the two relays, and the two relays are connected to each other as well as other relays. Is this going to be a problem for block production or is this expected/normal?
Thanks in advance!!

Possible solutions:
First: In your mainnet-config.json file, set "TraceMemPool": true
Then restart the node.

Second: Another issue is that there are no peers in. You need to add your block producer to the topology of the relay node(s).

Update: OP mentioned the issue being with the UFW configuration. For reference, here is an image of how I have my UFW setup on my stake pool. This is 4 Relay nodes, 1 Block Producer node and 1 Stand-By Block Producer node setup.

Thank you so much for the quick reply! it made me realize this whole time I was just being a dingus and my UFW rules were a wee bit off. Just fixed it and it works fine.

No problem! Glad to help!

Wow thanks for sharing your UFW setup! You made these yourself?.. Giving me fuel to step my game up as an SPO!


text:
When is an eUTXO consumed?
Scenario
There are two transactions tx1 and tx2 both trying to consume an arbitrary eUTXo oRef. Both tx1 and tx2 are submitted to the mempool in the same block, and are valid transactions; we can consider them identical for the purpose of the question.
Questions:

When does oRef get consumed? Would oRef exist until the next block?

Would oRef be observable in the same block to a third transaction tx3 which was submitted later than the initial two?

Is there a deterministic mechanism chosing which of the two/three transactions gets accepted?

Some further relevant contextual information transaction events

The question was also answered by a member of the IOHK team, on a secondary channel. I will post the answer here for community reference.
Answer

UTxO entries are consumed "immediately after" the Tx that uses them as an input is validated. That is "after" in the blockchain order. No subsequent transaction in the same block or later blocks can use the oRef input. This is the "no double spend" property, also enforced for Txs in the mempool of any individual node.

The order of execution is inherently non-deterministic. If one Tx is submitted well before the other then the first one is most likely to make it in first. If they are submitted from different points in the network (i.e. by different users) then it is very much non-deterministic which one makes it first. In future there will be limited ways to prioritise, but this example would still depend on timing and be non-deterministic. (The priority mechanism is aimed at ensuring a certain class of latency for inclusion).

Extra information
Txs, disimilar to bitcoin, don't hang around in the mempool for long. The Cardano mempool only acts as a small buffer to smooth out the traffic flow. If the system is saturated, Txs are held at the edge of the network (e.g. in the mempool of on the local node).
So Txs are not in the mempool for long at all. Its behaviour is more like a narrow pipe of fast-flowing water rather than a pool.

Great questions.

When does oRef get consumed? Would oRef exist until the next block?

oRef will be consumed when a transaction spends it. If txn1 is executed before txn2, even in the same block, txn2 will fail. Luckily, the sender of txn2 will not pay a fee for such a failed transaction.

Would oRef be observable in the same block to a third transaction tx3 which was submitted later than the initial two?

No. See above.

Is there a deterministic mechanism choosing which of the two/three transactions gets accepted?

By default, the block builder will just include the transactions in the order they see them. Of course, no one is able to stop the builder from putting them in whichever order they want (or excluding them altogether). This is where the concept of Miner Extractable Value comes from, which is still possible on Cardano.


text:
What exactly is the script context in Plutus context?
I believe the best way to answer this question would be to give examples of the type of information that the script context could contain.

The context includes two parts: TxInfo and ScriptPurpose.
data ScriptContext = ScriptContext{
    scriptContextTxInfo :: TxInfo,
    scriptContextPurpose :: ScriptPurpose
}

When people are talking about the script context, they are often referring to the data in TxInfo found here:
data TxInfo = TxInfo
    { txInfoInputs      :: [TxInInfo] -- ^ Transaction inputs
    , txInfoOutputs     :: [TxOut] -- ^ Transaction outputs
    , txInfoFee         :: Value -- ^ The fee paid by this transaction.
    , txInfoMint        :: Value -- ^ The 'Value' minted by this transaction.
    , txInfoDCert       :: [DCert] -- ^ Digests of certificates included in this transaction
    , txInfoWdrl        :: Map StakingCredential Integer -- ^ Withdrawals
    , txInfoValidRange  :: POSIXTimeRange -- ^ The valid range for the transaction.
    , txInfoSignatories :: [PubKeyHash] -- ^ Signatures provided with the transaction, attested that they all signed the tx
    , txInfoRedeemers   :: Map ScriptPurpose Redeemer
    , txInfoData        :: Map DatumHash Datum
    , txInfoId          :: TxId
}

This includes information about the entire transaction. So if you are using multiple scripts you can see what is being spent/minted/burned/etc with all the scripts you are accessing. Many smart contracts are made up of multiple scripts, all accessed at the same time. At the risk of stating the obvious, understanding what information is available for all the scripts in a transaction, i.e. the TxInfo, is fundamental to architecting smart contracts with Plutus.

Thank you for the great and clear answer. Looking at the data structures is indeed a very good way to look at this.

Aiming to contribute to the great answer from Mitchell, I'll add this:
Script context can be understood like the summary of the transaction and can be used to validate it. This includes all inputs txInfoInputs and outputs txInfoOutputs (and more!) of the transaction, those inputs and outputs are UTxOs.
Let's take an example from Lesson 06 (on Oracles) of the Plutus Pioneer Program:

In this example we can find two transactions, let's examine the first one:
Tx 1: this transaction contains 3 inputs txInfoInputs and 3 outputs txInfoOutputs

Inputs: UTxOs consumed by the current transaction

UTxO of Oracle script
UTxO of Swap script
UTxO of Buyer

Outputs: UTxOs generated by the current transaction

UTxO of Oracle script
UTxO of Seller
UTxO of Buyer

You can use all of those UTxOs to run any kind of validation from your validator script. So far, that's related to two fields of TxInfo. But there is more to explore: Mitchell answer, as you can also combine your validation with a Minting policy for example.
For more information, you can check following links:

Week 03 - Script Context
Script contexts from Lars Brünjes


text:
Can you run a stake pool pseudonymously?
To be a stake pool operator and run a stake pool, can you do this pseudonymously? If so, What are the pro/cons to this?
Would this be preferred to prevent hacks, enhance DevSecOp, and potentially avoid future KYC requirements from the government?
If the gov recently wants SPOs to KYC their delegators, they must want to KYC the SPO itself?  But if everyone is pseudonymous, can the really stop that?

Can you run a stake pool pseudonymously?
Yes you can. The only things I can think of that could be used to identify you would be your public IP address or, DNS records (at least at a public knowledge level of anonymity.) And there are ways to mask those.
Would this be preferred to prevent hacks, enhance DevSecOp, and potentially avoid future KYC requirements from the government?
It will help with preventing targeted attacks on you personally. By that I mean if someone easily knows who you are and that you own a Cardano wallet pledging XXXXX Ada to a stake pool, you become a bigger target for hackers.
As far as Government KYC requirements go, the law is the law, so if you want to be a legal operation, you will need to meet whatever those requirements might be. Therefore if they require that you operate your stake pool as yourself, then you would have to do so.
If the gov recently wants SPOs to KYC their delegators, they must want to KYC the SPO itself?
Yes, but I would imagine that you could do this and keep yourself pseudonymous to the public.
But if everyone is pseudonymous, can the[y] really stop that?
Yes they could. They could just outlaw Cardano if they really wanted to.


text:
How to update lecture #2 code to work with newer versions of Plutus?
I've been trying to load solution #1 for week 2 of PPP into the public Plutus playground here: https://playground.plutus.iohkdev.io/
and I get several errors :/

I am absolutely perplexed. Does anyone know why newer versions of Plutus are having issues with this endpoint code?

I made a walk-through video for that: https://youtu.be/UbTOZWr1-yM
And a corresponding Github repo: https://github.com/manonthemat/GiftContract-109

OMG thank you! This is so much better than what I was looking for haha


text:
Signing a Tx with Nami wallet
Hello I am tryng to sign a Tx using Nami Wallet, but i have not been able to do it.
I did a Tx using cardano-cli , and i've got a JSON file I take the cBORHex:"86a70081825820eef507b798abbb8a1360efbd..."
but when i try to sign the tx in the Nami Wallet:
window.cardano.signTx("86a70081825820...")

i get: {code: -1, info: 'Inputs do not conform to this spec or are otherwise invalid.'}
My question is: is something wrong in the way i am thinking or implementing cardano-cli with Nami? Am I using correctly the Nami endpoint?

If you want to load transaction to cardano-serialization-lib generated by cardano-cli you'd first have to sign it with some "dummy" signature keys and then take cbor produced by the cardano-cli and load it:
const txCli = wasm.Transaction.from_bytes(Buffer.from(cliTx, "hex"))

You can then take tx body from transaction that you've loaded, create new transaction with new witness-set and auxilary data.
EDIT:
I wrote a full blog post on how to sign cardano-cli tx using nami wallet. Hope this helps

This definitely helps, thanks for sharing it pyropy.

the problem is that a raw transaction from the cardano-cli does actually not conform with the specs. Nami uses the serialization-lib in the back and this one can't recognize the cbor from the cli.
A little transformation is needed here. I assume your transaction has an emtpy witness set, which is represented in the cli cbor as empty array ([]). Changing that one to an empty map ({}) shoud resolve the issue.
Any cbor decoding/encoding tool can help here.

Thank you so much for your answer Alessandro, but i dont fully underestand I traduced it in a cbor decong and i fount this [{0: [[h'EE5966D3759E82463278640E58C3812A15ECA2AAF8DC1AC3063B5BAA43E41BE3', 0]], 13: [], 1: [[h'00756E62FF9667B187209B6FE1B577061491CF6F93A81E1F91741E2E3ACCB864AE67087F69BBD9AB74F71781D13AE40AAB86E1DE30CA7E2117', 974831815], [h'000E352F0CE47FFD66821DA9F002999E05F26534DA85CAE89559078F77561870240E88583B00FBC330B4DCD54E8DA71E5ED5E8729F01E79AFD', 25000000]], 2: 168185, 14: []}, [], [], [], true, null] there appear a lot of "[]" ? where can i read about Nami specs?

Where can i read about Nami Specs? if cardano-cli is not suitable for making Tx compatible with Nami wallet, what tool should i use?

FYI, I've raised an bug fix request with IOHK over this, as we've encountered the same problem whilst integrating our smart validators, at Artifct.app.
If you're encountering this problem too, it wouldn't hurt to add your name to the ticket:
https://github.com/input-output-hk/cardano-node/issues/3370

Thank you so much, but i am not sure it should be called a Bug since Cardano Serialization Lib Says in its documentation something about it. But it would be nice that all our tools would use the same specs.


text:
Staking native assets (to stake pools)?
Is there support built in to Cardano for stake pools to receive staking of native assets?
For example, the Meld Protocol plans to include staking of Meld tokens.
Are they likely to / able to use (their own?) Cardano native stake pool(s) to achieve this?
Note that in Eth/Bsc, when we talk about staking, it means a transaction in which you loose custody of your assets because they are transferred to another wallet, the wallet of the smart contract.  Cardano is clearly different because staking (at least, of Ada) does not need or require this to happen.
This seems a pretty significant difference - hence, does this difference also extend to native assets and future dapp designs, and to what extent is this clear at this point?
Will stake pools take on further functionality down the road?
(I read  that hydra means a subset of stake pools will handle a channel, as a layer 2/ lightning style thing, this being a different additional role, down the road).
Of course, with Plutus, you can undoubtedly implement a staking mechanism for native assets, but I wondered whether it has been planned that the already existing stake pools can take on an additional role like this or any other.

I suppose the raison d'etre for what we currently call stake pools is (entirely) to provide the consensus layer.
Whereas, the same word, "staking", is also used in defi, when the goal is other things, completely unrelated to achieving consensus (e.g., a project wants to provide rewards for locking up tokens to decrease volatility in early stages of a project).
There seems to be a terminology challenge here - in PoW chains, the  double meaning doesn't arise. So, how are we going to handle this?
The term SPO is clearly established, so...  can't think of a good term right now...!

You are definitely right. As a developer lot's of people ask me about staking native tokens. They get confused with staking ada (cardano stake pool), providing liquidity (like to a dex), or just simply a smart contract to vest a native token.
I still don't think native tokens should be added to stake pools at the consensus layer. I think staking through smart contracts is the best possible route and the native token creators can figure out how rewards should be generated and rewards can even be other tokens or ada.


text:
ogmios startup issue
I have a testnet running and now want to attach ogmios server to the cardano node socket, so as to probe the blocks. The ogmios agent is compiled separately and now when i want to attach it to the socket using:
ogmios
--host 0.0.0.0
--node-config $BASE_CONFIG
--node-socket $SOCKET
I am getting the following output:
config is ./../../src/tconfig/testnet-config.json
socket is ./../state-node-shelly-testnet/node.socket
{"severity":"Warning","timestamp":"2021-10-29T20:47:04.921466233Z","thread":"4","message":{"tag":"OgmiosMetrics","metrics":{"recommendation":"run with '+RTS -T'"}},"version":"v4.0.0-59-gc02eeb5c"}
{"severity":"Info","timestamp":"2021-10-29T20:47:04.922465452Z","thread":"4","message":{"tag":"OgmiosNetwork","networkParameters":{"networkMagic":1097911063,"systemStart":"2019-07-24T20:20:16Z","slotsPerEpoch":432000}},"version":"v4.0.0-59-gc02eeb5c"}
{"severity":"Notice","timestamp":"2021-10-29T20:47:04.926252351Z","thread":"6","message":{"tag":"OgmiosHealth","healthCheck":{"tag":"HealthShutdown","reason":"AsyncCancelled"}},"version":"v4.0.0-59-gc02eeb5c"}
ogmios: Network.Socket.bind: resource busy (Address already in use)

I understand that cardano-node is using the socket and hence that error comes. But how then should ogmios work ?

ok. Later found that even if one runs the ogmios within a docker it actually attaches to the parent cardano-node process socket ! Strange. So only when i killed the docker process, then the host socket was free !


text:
How to call a endpoint with a new wallet in a already instantiated contract
So I have this code which uses a modified version of the [guess game] (https://github.com/agocorona/DAppFlow/blob/main/ContractExample/GuessGame.hs) which parameterizes the validateGuess script with a parameter depending on the user hash, so that each user can make a lock to his own scrip instance
I create two instances and the corresponding wallets make a lock of funds to his own instance:
main = Simulator.runSimulationWith handlers $ do

     cid  <- Simulator.activateContract (Wallet 1) GuessGame
     cid2 <- Simulator.activateContract (Wallet 2) GuessGame

     waitNSlots 3
     callEndpointOnInstance  cid  "lock" LockParams{secretWord="world", amount= Ada.adaValueOf 200}
     waitNSlots 3
     callEndpointOnInstance  cid2 "lock" LockParams{secretWord="world", amount= Ada.adaValueOf 200}
     waitNSlots 3
     Simulator.logString @(Builtin TestContracts) "Balances at the end of the simulation"
     b <- Simulator.currentBalances
     Simulator.logBalances @(Builtin TestContracts) b

The balances reflect the operations:
[INFO] Balances at the end of the simulation
[INFO] Wallet 1:
[INFO]     {, ""}: 99799999990
[INFO] Wallet 2:
[INFO]     {, ""}: 99799999990
[INFO] Wallet 3:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 4:
.....
.....
[INFO] Script 4c7d92f39ce436db8cf07bb207ca4272b255673ce988d9642403d7b8:
[INFO]     {, ""}: 200000000
[INFO] Script 8d558e1a3cda0d447eb4d2d5ffe0837c355dc1c8f2519e205b37c439:
[INFO]     {, ""}: 200000000

The scripts have the 200000000 funds allocated and the wallets lost 200000000 + 20 of fees
Now the question is: How I invoke the guess to one of these two instances with a third wallet ?
If I use:
callEndpointOnInstance cid "guess" GuessParams{guessWord="world",userHash=.....}

Then the funds are returned to wallet 1, since it is the wallet with which I initiated the cid contract. How I introduce a third wallet that may guess to each of these two instances?

The script of the link is the non-parameterized version

You need to define contracts for every endpoint that you need to call. So, an endpoint for Lock and other one for Guess
Something like this:
data GuessGameContracts = Lock
                     | Guess
    deriving (Eq, Ord, Show, Generic, FromJSON, ToJSON)

instance Pretty GuessGameContracts where
    pretty = viaShow

instance HasDefinitions GuessGameContracts where
    getDefinitions = [Lock, Guess]
    getContract = getGuessGameContracts
    getSchema = getGuessGameSchema

getGuessGameSchema :: GuessGameContracts -> [FunctionSchema FormSchema]
getGuessGameSchema = \case
    Lock   -> Builtin.endpointsToSchemas @GameSchema
    Guess  -> Builtin.endpointsToSchemas @GameSchema

getGuessGameContracts :: GuessGameContracts -> SomeBuiltin
getGuessGameContracts = \case
    Lock   -> SomeBuiltin $ lock
    Guess  -> SomeBuiltin $ guess

handlers :: SimulatorEffectHandlers (Builtin GuessGameContracts)
handlers =
    Simulator.mkSimulatorHandlers def def (interpret (contractHandler Builtin.handleBuiltin))

And use it like this to activate every contract:
cid1  <- Simulator.activateContract (Wallet 1) Lock
cid2  <- Simulator.activateContract (Wallet 2) Lock
cid3  <- Simulator.activateContract (Wallet 3) Guess

You can find an example in Lesson 10 of PPP - Uniswap

Thanks a lot. I will try it out


text:
Update Daedalus Cardano CLI version?
I'm currently using the cardano-cli that comes with Daedalus, which according to cardano-cli --version is v1.30.1
Is there any way to update the CLI? I'm trying to access the --required-signer flag which I don't believe was released until the latest alpha version.

To answer my own question, you can build your own version of cardano-cli by cloning the cardano-node Github repo and running a nix-shell, then cabal build cardano-cli. Although I'm not sure how to access this cli outside of the nix-shell.

1.30.1 is the latest version of the cli.  If you're trying to add a required signer, you might want to look at the transaction sign operation on the cardano-cli.

Looks like you've worked through this issue.
For anyone else that finds themselves here:
You can download the binaries (Win/Lin/Mac) or make from source.
Details for each approach are on the github repo https://github.com/input-output-hk/cardano-node


text:
Store data in Tx Metadata on Cardano
I would like to notarize some data (like document signatures for example) of less than 500KB on the blockchain and for that I thought to use the Metadata field of a transaction.
So I have 2 questions:

Is this a good (or at least acceptable) use of this field?
Is it better to do it on Cardano directly or wait for the release of an L2 like Hydra?

Thank you.

Currently, transactions on Cardano are limited to a maximum of 16k so you probably wouldn't want to store the document directly onto the blockchain.  That said, you might want to consider storing the document onto something like an IPFS and then referencing the signed document from the metadata.
As for waiting for Hydra, while Hydra may change the fees and throughput associated with the transaction, I imagine the solution would be the same.


text:
What is a Plutus script witnessed tx input?
I'm getting the following error when trying to consume a UTXO at a script address.
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 1 (in the order of the TxIds) failed with:
transaction input 1 (in the order of the TxIds) is not a Plutus script witnessed tx input and cannot be spent using a Plutus script witness.

My first tx-in is the UTXO at the script address I'd like to consume, the second tx-in is just a UTXO with lovelace that I'm attempting to use to pay the script with.
~ Full Details ~
Transaction
cardano-cli transaction build \
--alonzo-era \
--mainnet \
--tx-in b4accf06d29a0d54a83e5d2b623d4cd361c6899408fd87cfa1437f42b83a8628#1 \
--tx-in d3e81062af7a78c02ae7bd3254092f83a647ee239ac65e52b13bd2cc7b9b00d4#0 \
--tx-in-script-file ../Vendere/market.plutus \
--tx-in-datum-file ../Vendere/datum-e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1-Hoskinsons2795.json \
--tx-in-redeemer-file ../Vendere/buy.json \
--required-signer ../Vendere/payment2.skey \
--tx-in-collateral b4accf06d29a0d54a83e5d2b623d4cd361c6899408fd87cfa1437f42b83a8628#0 \
--tx-out "addr1qxynjszluq9wekl4ap0d087cchn3pun5yn34z4nyturcclrpncrywfgdf5yw89f3pwqk86k2cn8d8y8czqaeg9ctsa0sw6z6dr + 1 e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1.Hoskinsons2795" \
--tx-out "addr1q84j8yjtf6lx0f8f4pkecjzj5qu2y38f2l820nuu850qv9z6vk9t3l3dnyxdvqdtqs40hm2d2v8mzk3zqxaf73s7xkase7n4y6 + 50000000" \
--change-address $(cat ../Vendere/payment.addr) \
--protocol-params-file ../Vendere/pparams.json \
--out-file ../Vendere/test-alonzo.tx

Datum
{
  "constructor": 0,
  "fields": [
    {
      "bytes": "01eb23924b4ebe67a4e9a86d9c4852a038a244e957cea7cf9c3d1e06145a658ab8fe2d990cd601ab042afbed4d530fb15a2201ba9f461e35bb"
    },
    { "int": 50000000 },
    { "bytes": "e986d38f4ead45a4f909cb51d61d8d95efc72b12d9302cdd040974d1" },
    { "bytes": "486f736b696e736f6e7332373935" }
  ]
}

Redeemer
{"constructor":1,"fields":[]}

Validator
https://github.com/OnChainLabs/Vendere/blob/main/src/Market/Onchain.hs#L60

Can you share the code that’s giving you this error?

@MitchellTurner Done! Should have all relevant details now

To answer my own question, the order of my commands was wrong. The --tx-in for the script address needs to be just before the --tx-in-script-file :)


text:
Does Cardano support Dynamic CNFTs?
Can we use offchain data through something like ChainLink and channel it to CNFTs to have them change in real time accordingly? Have got a great idea for a dynamic NFT project, but just want to know it's possible on Cardano first.

You would probably want to use native Plutus smart contracts for that.
Imagine a contract that accepts an NFT, burns it and mints a new one, with new properties.

Is it still an NFT if you can burn and mint it at will?

Yes, as long as it keeps to be non-fungible at all time.

Ok, thanks. Think my idea might be a bit too ambitious for that. Unsure it's possible without a hell of a lot more knowledge than I have, or at all. Cheers.

Every real time change would require burning and minting, meaning multiple TXs back to wallets that own one, all needing to be accompanied with ADA from somewhere. Will need to rethink.


text:
How do we check if cardano wallet made by the community is safe to use?
Daedalus and Yoroi were made by IOHK and Emurgo (indirectly), so the credibility is there right from the start, and we can trust it (that it is not meant for malicious intent).
But when it comes to wallets that are made by the community, how do I know that it is safe to use? What are the parameters we should check first, to make us certain that our private key or seed phrase is not being collected by the wallet platform?

DO YOUR OWN RESEARCH!!!
Not to sound pretentious or unhelpful, but lets imagine a spectrum of trust:
On one end, there is the super paranoid computer nerd who doesn't use any software unless they can read and audit the code themselves. On the other end, there is the naive grandma who downloads/executes anything the screen tells her to. Where the rational person falls on this spectrum should vary GREATLY on a case-by-case basis.
For example, your criteria for trusting a proprietary social media platform with your personal info will (hopefully) be very different from your criteria for trusting an open financial platform with your assets. Ask yourself: "If I trust software developed by IOHK, how did I come to such a conclusion, and how can I use the same process to come to conclusions for other open source products?".
Software reliability should not be thought of in absolute terms. The amount of trust you place in any kind of software product is a personal choice that YOU must make in accordance with your individual circumstances and what YOU believe is appropriate. Ask yourself:

What is your level of expertise?
What (or how much) is at stake?
How much expertise are you willing to outsource to members/developers of the community, and how do you go about doing so?

As a personal example, I have very little coding experience, but from hours of community engagement here and on other forums, something like Nami Wallet SEEMS like it is trustworthy. The creator has a solid track record of community engagement, it is recommended by many community members on several different forums/info-sources, and nowhere have I seen anything catastrophically negative said about it (I can say the same for several other SPO tools such as CNCLI and the Guild Operators suite). Would I store millions of dollars of assets on it? No, but nor would I store all of my assets on any one single wallet, even one developed by IOHK.
To summarize:
One must figure out an appropriate "amount of trust", per "unit-of-value", to place in a product of a "perceived-reliability".
Sorry if this response is long-winded or over-generalized, but I believe that everyone in the this community is pioneering the shift towards a world of true data sovereignty. It is therefore imperative that we develop the necessary skills and habits to thrive in such a world, because with great power comes great responsibility... just my two cents.
So say it with me:
DO YOUR OWN RESEARCH!!!
:)


text:
Cardano Serialization: How does Ed25519KeyHash work
I'm trying to get cardano-serialization-lib working without up-to-date docs (https://github.com/Emurgo/cardano-serialization-lib/blob/master/doc/getting-started/generating-transactions.md). The example for making a transaction is outdated and the method .from_bech() doesn't exist on PrivateKey property.
Since the txBuilder.add_key_input() function is expecting an ed25519 hash, i thought it could be good to use Ed25519KeyHash but I am getting rust errors somewhere in the wasm hand-off.
Can anyone explain how to generate a root key and properly pass into the txBuilder.add_key_input() function?
Ultimately my goal to to generate and sign transactions from javascript without running a node and sync'd wallet. Any suggestions are welcome comments.
const cardano = (async () => { return await import('@emurgo/cardano-serialization-lib-browser') })()

let cw = cardano.then(async x => {
  console.log(x, x.Bip32PrivateKey);
  function harden(num) {
    return 0x80000000 + num;
  }

  const rootKey = x.Bip32PrivateKey.from_bech32("xprv17qx9vxm6060qjn5fgazfue9nwyf448w7upk60c3epln82vumg9r9kxzsud9uv5rfscxp382j2aku254zj3qfx9fx39t6hjwtmwq85uunsd8x0st3j66lzf5yn30hwq5n75zeuplepx8vxc502txx09ygjgx06n0p");

  const accountKey = rootKey
    .derive(harden(1852)) // purpose
    .derive(harden(1815)) // coin type
    .derive(harden(0)); // account #0

  const utxoPubKey = accountKey
    .derive(0) // external
    .derive(0)
    .to_public();

  const stakeKey = accountKey
    .derive(2) // chimeric
    .derive(0)
    .to_public();

  console.log({ rootKey, accountKey, utxoPubKey, stakeKey })
  console.log(rootKey, x.PrivateKey.generate_ed25519(accountKey))

  const txBuilder = x.TransactionBuilder.new(
    // all of these are taken from the mainnet genesis settings
    // linear fee parameters (a*size + b)
    x.LinearFee.new(x.BigNum.from_str('44'), x.BigNum.from_str('155381')),
    // minimum utxo value
    x.BigNum.from_str('1000000'),
    // pool deposit
    x.BigNum.from_str('500000000'),
    // key deposit
    x.BigNum.from_str('2000000')
);
// const prvKey = x.PrivateKey.from_bech32("ed25519e_sk16rl5fqqf4mg27syjzjrq8h3vq44jnnv52mvyzdttldszjj7a64xtmjwgjtfy25lu0xmv40306lj9pcqpa6slry9eh3mtlqvfjz93vuq0grl80");
txBuilder.add_key_input(
    new x.Ed25519KeyHash(rootKey),
    x.TransactionInput.new(
        x.TransactionHash.from_bytes(
            Buffer.from("8561258e210352fba2ac0488afed67b3427a27ccf1d41ec030c98a8199bc22ec", "hex")
        ), // tx hash
        0, // index
    ),
    x.Value.new(x.BigNum.from_str('3000000'))
);
  console.log({txBuilder});
  return x
})```

  [1]: https://github.com/Emurgo/cardano-serialization-lib/blob/master/doc/getting-started/generating-transactions.md

In lieu of up-to-date documentation, the best approach is to look at how current projects are using the library. E.g. https://github.com/Berry-Pool/nami-wallet/blob/main/src/api/extension/index.js

Thanks for the attention. Feel free to edit your comment into an answer and I'll be happy to upvote


text:
Developing on Cardano as a beginner
Is there a roadmap to learn Cardano Development as a beginner? I checked the Cardano Developer Portal but I could not find the following:

What is the order in which one should learn things? For instance: is the order learn Haskell, then Pluto, then Marlo, then X, ...correct
Resources that has helped former beginners with and without practical application (I know for Haskell, there is "Learn you a Haskell" recommendation on the portal.
Useful github links for simple projects people have done?
Is Haskell the only way to develop on Cardano? I asked because Haskell has the reputation of being a very difficult language, and thus could a be barrier for a beginner interested in Cardano.

Anyway useful resource recommendation for a beginner is welcome.
Thanks

Let me try to answer.
I am working on building Privacy focused Distributed Deep Neural Net learning called DeepchainAda. I started with stakepool on Cardano and before that I read some of the IOHK research papers and map it to my knowledge of distributed systems
Now I believe in learning ground-up so I have started Video series on Blockchain+Machinelearning and Haskell

What is the order in which one should learn things? For instance: is the order learn Haskell, then Pluto, then Marlo, then X, ...correct

{answer} I would recommend starting from basics of blockchain and why Cardano. Then focus on what you want to build. Start with accounting models using eUTXO and try to understand this. Then you can follow the Haskell->Plutus path. Marlow is a DSL aka domain specific language. So if you have application in finance domain then you can look at that directly. You can also explore the blockfrost support for python and other languages to see if it helps solve the task you are working on. However if your main intention is to become a Cardano developer then knowledge of Plutus is better

Resources that has helped former beginners with and without practical application (I know for Haskell, there is "Learn you a Haskell" recommendation on the portal.

{answer} There is essential Cardano https://iohk.io/en/blog/posts/2021/04/30/the-essential-cardano-list-a-new-resource-for-the-community/
Emurgo also has course on Professional Blockchain Developer. https://emurgo.io/blog/sign-up-now-for-emurgo-academys-cardano-blockchain-developer-program

Useful github links for simple projects people have done?

{Answer} Again the above link can help

Is Haskell the only way to develop on Cardano? I asked because Haskell has the reputation of being a very difficult language, and thus could a be barrier for a beginner interested in Cardano.

{Answer} No, there are support for other languages. Solidity is going to be supported by the milkomeda sidechain and similarly with IELE support (early 2022) you will be able to develop in any language like Java script, Python etc
I suggest you watch the youtube video https://www.youtube.com/watch?v=k8a6tX53YPs
Please note Haskell is not a difficult language if you try and understand the basics of functional programming. Infact many imperative programming language kind of support some of the functional programming concepts.
As I said before I have a video series (1 on Blockchain and other on Haskell) which is kind of ongoing and you can find the details about that in https://www.deepchainada.com/

Thank you. Very helpful

I think enrolling in Emurgo's Cardano Associate Developer and Cardano Professional Developer Program would be very helpful. Each program is $500. The courses are well structured and personally, I think the course fee is reasonable considering what you will learn from the course.
The Associate Program takes you through the fundamentals of blockchain and Cardano in particular. The last section of the course is all about programming in Haskell.
The Professional program is more focused on Plutus.


text:
Is there any limit to the number of UTXO's sitting at a script address?
Just want to foresee if we'll run into any issues sending/consuming thousands, or tens of thousands of UTXO's at a script address.

Is there any limit to the number of UTXO's sitting at a script address?

There shouldn't be any practical limit.
UTxOs aren't stored in some memory at an address. The address determines who can spend a UTxO, not where it resides. And that address is included on the UTxO, not vice versa.
In other words, when you send UTxOs to an address there is no check on which/how many UTxOs are owned by that address. You are just adding a new UTxO to the blockchain that the intended recipient can identify as their own and spend.
Check out my answer here for more details on how UTxOs are associated with addresses.

Thank you! This is exactly the answer I was looking for :)

@Mitchell Turner Since the address is just a hashed string of the script attached to a UTXO, it doesn’t specify where the UTXO resides. So, what does it mean when you say “send UTXOs to an address” in the third paragraph? Does it mean that we create a new UTXO using the same hashed script AS the address attached to that new UTXO?

I mean when you create any transaction that has an output owned by the script address.
I'm using the term "send" loosely. Similar to when you "send" or transfer funds to another wallet. In reality you aren't "sending" it anywhere, you're just creating a new UTxO who's owner is the recipient of the value in the UTxO.
Sorry if that was confusing. I was intentionally mixing vernacular to draw parallels.

This sounds like a two part question:

Is there any limit to the number of UTXOs stored at a script address
Is there any limit to consuming UTXOs stored at a script address

For the first one, yes and no.  While you can theoretically store as many UTXOs as you like at a script address, there are some resource constraints you're likely to run into:

The size of a single transaction is currently limited to 16k and the max size of a single block is 64k.  And while these numbers are adjustable, this puts an upper limit on the rate of ingestion.
The same issue will apply when you wish to spend the UTXO as well.  16k is the limit for the entire transaction, inputs, outputs, witness, all of it.

For the second question, yes, there are a number of limits on consuming UTXOs:

Within the 16k transaction size limit, the smart contract (currently) needs to fit into that space, significantly reducing the amount of space available for UTXO
Odds are, you'll probably want to do some verifications as well on the UTXOs so cpu and memory execution limits may also play a factor
Like the 64k block size limit, there are also block limits for cpu and memory

Official documentation is silent about it.
Since many UTxOs can exist within one wallet address, the same way they can exist within a script address. You can potentially have even 10,000 Tx inputs per script address, but in reality, I'm sure, their number is below 1000, because it'll take a fair amount of network power to scan all inputs and outputs of each such an address. The only way to find out the exact number of tx-ins is to experiment in testnet.
However, the max number of UTxOs processed per transaction is known.

The maximum number of UTxOs per single transaction is about 70. Going higher will likely result in the network rejecting the transaction and defrag-ops.py will warn about this if --max is set higher than 70.

In addition to the above, I think everyone will be interested in reading this post.

This is per transaction, not per script address, right?

I've updated my answer.

Thanks for adding more details! Gave an upvote, but I still don't think this definitively answers the original question of max # of UTXO's allowed to sit at a script address.

I am failing to spend even 10 utxos from the script address because of CPU and memory limits, using AlwaysSucceeds validator. More info:
Transaction memory and cpu usage limits


text:
What exactly are language views?
I read the docs for language views here, but I still don't quite understand what they are: https://github.com/input-output-hk/cardano-ledger-specs/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl#L97
For the Spacebudz marketplace, Alessandro requires this to be set and I'm not sure if it we need to change it for our own dApp: https://github.com/Berry-Pool/spacebudz/blob/main/src/cardano/market/languageViews.js

I think the explanation follows after the canonical encoding description
; For PlutusV1 (language id 0), the script integrity data is a cost_model.
; This is the value of the costmdls map at key 0.

Looks like you need to encode cost-model map as language-views key 0 according to canonical encoding.


text:
Using Cardano for authentication/signin
I am wondering: Is there another way to authenticate a user (wallet) on Cardano instead of sending ADA?
Obviously a beginner question, but I am just starting to wrap my head around all of this :)

Theoretically yes, you can ask wallets like Nami to sign an arbitrary piece of information for you and verify that signature against the addresses pub key hash.  Since this transaction would not have been submitted to the blockchain, no fees should be involved.  Note, I haven't tried this myself.
For Nami, check out the call to signData on this page https://github.com/Berry-Pool/nami-wallet.
In fact, CIP-8, explores doing this on a more official basis, https://github.com/cardano-foundation/CIPs/blob/master/CIP-0008/CIP-0008.md

Wouldn't this introduce trust into a trustless system? By that I mean you are asking someone to sign something and have them trust that you will just disregard it and not submit it. You would also need to be very transparent about what was being signed. With that said, I would be very interested to see if this would work.

No.  Because they are signing an arbitrary piece of information and not a real transaction, this cannot be submitted to the blockchain.  The information would need to contain enough information for the signature to be verified.  As for the contents of what was being signed, I would agree, this should be made transparent to the user.

Right, but wouldn't they be trusting you that it is in fact an arbitrary piece of information and not a real transaction? In other words, what keeps you from saying it is X but it is actually Y?

Today possibly.  But as wallets mature, I would be surprised if wallets didn't prompt you with some clue as to what you were signing.

So I just checked and it looks as Nami does present different messages depending on whether you're signing a tx or arbitrary data, so that's a step in the right direction.

Short Answer: A transaction needs to be singed with the owner's private keys.
Explanation: To be able to authenticate a user to a wallet, you need them to prove they have the private keys to that wallet. In order to do that, you need them to sign a transaction, which could be the sending Ada method you mentioned. There could be an opportunity to prove this identification with other types of signing transactions, but those will still have a transaction fee, thus costing Ada. Update: As pointed out by Matt Ho, you could potentially not submit the TX to the blockchain and therefore not have to pay the transaction fee. However, this could introduce a level of trust in the trustless system. Without testing this, it is hard to know the details of this.
Solution: Atala PRISM is an identity solution worth exploring. Although it is still in development, this will be a way to manage identity.https://atalaprism.io/app


text:
Cardano CLI - Error submitting transaction for minting a token
I am trying to create a token and I've been following the instructions for here:
https://developers.cardano.org/docs/native-tokens/minting/#minting-native-assets
This is on testnet.
Here is some info:
tokenamount="10000000"
tokenname1="Theo2"
My test account has: 10000000 (10 Ada)
So I am trying to send two tokens.
This is the transaction:
fee=$(cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d " " -f1)

output=$(expr $funds - $fee)

receiver="addr_test1qry8yex9gs43tvkzgsvwzg5z7zaak4p2rc8j3qd08vfjtry5vsaj3psfewzrn8nyajhn8qcqdyvkt7uvy6hvaqmguzysaq09fn"
receiver_output="10000000"
txhash="34e30197ad4c5228603256a870ede98720c14b6b6d67fda4e2bc075cc0d35414"
txix="0"
funds="10000000"

cardano-cli transaction build-raw  \
--fee $fee  \
--tx-in $txhash#$txix  \
--tx-out $receiver+$((receiver_output-$fee))+"2 $policyid.$tokenname1"  \
--tx-out $address+$output+"9999998 $policyid.$tokenname1"  \
--out-file rec_matx.raw

fee=$(cardano-cli transaction calculate-min-fee --tx-body-file rec_matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --testnet-magic 1097911063 --protocol-params-file protocol.json | cut -d " " -f1)

output=$(expr $funds - $fee - 1000000)

cardano-cli transaction build-raw  \
--fee $fee  \
--tx-in $txhash#$txix  \
--tx-out $receiver+$((receiver_output-$fee))+"2 $policyid.$tokenname1"  \
--tx-out $address+$output+"9999998 $policyid.$tokenname1"  \
--out-file rec_matx.raw

cardano-cli transaction sign  \
--signing-key-file payment.skey  \
--signing-key-file policy/policy.skey  \
--testnet-magic 1097911063 --tx-body-file rec_matx.raw  \
--out-file rec_matx.signed

cardano-cli transaction submit --tx-file rec_matx.signed --testnet-magic 1097911063

When I submit the transaction I get the following error:
$ cardano-cli transaction submit --tx-file matx.signed --testnet-magic 1097911063
Command failed: transaction submit  Error: Error while submitting tx:
ShelleyTxValidationError ShelleyBasedEraAlonzo
(ApplyTxError [UtxowFailure (WrappedShelleyEraFailure
 (UtxoFailure (ValueNotConservedUTxO (Value 0 (fromList [(PolicyID
{policyID = ScriptHash "09d4abb4a6a768e678332433c789d82c4e3e45a9d98b1722f597fa5c"},fromList [("Theo2",10000000)])])) (Value 10000000 (fromList [(PolicyID {policyID = ScriptHash
"09d4abb4a6a768e678332433c789d82c4e3e45a9d98b1722f597fa5c"},fromList
[("Theo2",10000000)])]))))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure
(BadInputsUTxO (fromList [TxInCompact (TxId {_unTxId = SafeHash
"05117382cb40f2fa194c9a113159372228e54055a07d48c8c0e0e7ac2070b20d"}) 0]))))])

I think the error is related to the amount not matching, but I can't quite figure it out.
Any help would be much appreciated.
P.S: I'm doing this via Daedalus on Windows
Thanks,
Chris

Where you submit transactions to the blockchain, you typically go through the following steps.

build the transaction without any fees
calculate the transaction fees
rebuild the transaction with the correct fees
sign the transactions with the appropriate witness
submit the transaction to the blockchain

Each of these five operations has a specific call on the cardano cli:

cardano-cli transaction build-raw
cardano-cli transaction calculate-min-fee
same as step 1
cardano-cli transaction sign
cardano-cli transaction submit

You'll need to perform each of these operations to successfully submit to the blockchain.  Some tips on creating the transactions:

depending on what shell you're using, you may be need to wrap the arguments in a quote or double-quote so --tx-in "$txhash#$txix" instead of  --tx-in $txhash#$txix.  This is because many shells interpret anything to the right of # as a comment
after you calculate the fees, make sure to adjust the sum of the tx-outs by the fee e.g. subtract the fee.  If you fail to do so do, you'll get a ValueNotConservedUTxO message indicating the inputs do not balance the outputs

Thanks Matt, I have followed all the instructions as listed in the Cardano doc before I got to submit part. I'll try your suggestion and see if that works for me.

Regarding to the docs:

Problem: ValueNotConservedUTxO
Diagnosis: Value not Conserved: (Input UTXO ≠ Fee + Amount sent + Change)
Solution: Check that output amount is equal to input amount

You can find another problems here: Diagnosing transactions problems and troubleshooting
In other words, it's because your transaction is not balanced.
[EDIT] In your case:

Your receiver_output is wrong because is 10000000 (10 ADA), equal to your funds. In the tutorial, they have 1,000 ADA.
You're sending to the receiver: receiver_output-fee and you already deducted fees from output. So you should send to receiver only receiver_output. Try using receiver_output=2000000 (2 ADA)

In general, always follow process from Matt Ho.

Thanks @georgeos, I've updated the commands that I used, can you please let me know if you can see anything missing. Thanks in advance.

@hatsrumandcode Check my updated answer.


text:
Free failed transactions or DoS protection? Which is it?
I've been hearing that in Cardano transaction fees are highly predictable (in contrast to Eth gas fees) and that failed transactions don't pay fees. This is in direct contradiction to the transaction fee equation in the official docs ( https://docs.cardano.org/explore-cardano/fee-structure ) which includes a minimal fee (a) to prevent DoS attacks.
So which is true? Are failed transactions free or do they always have to pay a min fee?
Edit: please elaborate how the system works in these cases for anybody who is reading to understand.

On the Cardano blockchain there are two stages where a transaction can fail.
In the first stage, there are some integrity checks that are run. Also the node checks if the UTxO-inputs of the transaction exist and are free to be spend. No scripts are run at this stage. If the validation fails, no fees are collected.
In the second stage, scripts are executed. If one of them fails, fees are collected. For this purpose, the transaction includes a collateral-UTxO.
In summary, no fees are collected for unpredictable failures and fees are collected for predictable failures. This protects against DoS with scripts that are expensive to execute and fail.
That being said, there can never be a complete protection against DoS in an open network. If the system is flooded by a huge amount of stage-1-invalid transactions, I guess that the Cardano distributed system would get into trouble. But I also think, that this type of attack are probably difficult and expensive to execute.
There is a nice article explaining the topic here:
https://iohk.io/en/blog/posts/2021/09/07/no-surprises-transaction-validation-part-2/

Thank you for the answer and the reference link. The approach makes sense in many ways.

From what I understand nodes pull transactions when they are ready to process them, they are not pushed into the network, so this is an additional layer of DoS protection.


text:
CLI creating a paper wallet
Is a paper wallet the same as doing.
$ cardano-wallet recovery-phrase generate > recovery-phrase.txt
$ cardano-wallet wallet from-recovery-phrase
$ cardano-wallet address list | grep_first_unused.sh | QR_code_generator.sh > wallet_qr.png
$ print_to_paper.sh < wallet_qr.png
$ print_to_paper.sh < recovery-phrase.txt

Or is there more to it than that? I have heard people talk about it but could not find the feature in the latest Daedalus.
Paper wallet as discussed by Charles here: https://www.youtube.com/watch?v=JwhB2YKYFKs&t=1s

It depends on what you mean by "paper wallet". If you want to generate a 24 word mnemonic in secure, ultra-cold fashion, you'd need to use cardano-cli in conjunction with cardano-wallet on an airgapped machine.
If however you do not require something as sexy as a 24 word mnemonic, you can just use cardano-cli address key-gen on an airgapped machine and write down the cborHex of the skey on paper.

Ok yeah I just tried the commands air-gapped. Works like normal, interesting. So you could share an airgapped address with somebody and it will just work?
Oh I changed the command from address create to address list.

Yes, when you key-gen on an airgapped machine, whatever addresses you then build using the created vkey can be accessed/authorized with the associated skey.


text:
How to decode cbor which is generated with cardano-cli build command?
I am trying to sign a transaction which is built on some other place and I can see only cbor for example:
{
    "type": "TxBodyAlonzo",
    "description": "",
    "cborHex": "86a500818258201db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338000d8001828258390003a114d3cf5200be6d1990493620ce2155a756582ec92ae4c532942902053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc6046861a0591fd6482583900cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf592291a000f4240021a000290f90e809fff8080f5f6"
}

With command cardano-cli text-view decode cbor I am getting the following:
$ cardano-cli text-view decode-cbor --in-file tx.build
86  # list(6)
   a5  # map(5)
       # key
      00  # int(0)
       # value
      81  # list(1)
         82  # list(2)
            58 20 1d b7 31 b2 34 9b 2a 16 74 55 12 80 9c 86
            75 6e d4 2e 25 47 f8 cf 7b 93 d8 80 3b d8 8b d6
            83 38  # bytes(32)
            00  # int(0)
       # key
      0d  # int(13)
       # value
      80  # list(0)
       # key
      01  # int(1)
       # value
      82  # list(2)
         82  # list(2)
            58 39 00 03 a1 14 d3 cf 52 00 be 6d 19 90 49 36
            20 ce 21 55 a7 56 58 2e c9 2a e4 c5 32 94 29 02
            05 3e 0c 6f 43 4f 19 a2 05 fb 5c 11 85 00 cc 77
            dc 32 c4 e0 b2 a7 cc bc 60 46 86  # bytes(57)
            1a 05 91 fd 64  # int(93453668)
         82  # list(2)
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)
            1a 00 0f 42 40  # int(1000000)
       # key
      02  # int(2)
       # value
      1a 00 02 90 f9  # int(168185)
       # key
      0e  # int(14)
       # value
      80  # list(0)
   9f  # list(*)
   ff  # break
   80  # list(0)
   80  # list(0)
   f5  # bool(true)
   f6  # null

From above the following represents receiving address:
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)

How I can decode this to address?

Been thinking about this question for a while. I haven't yet found a way to decode the specific 57 byte cbor to an addr-style address, but I suspect it will involve using the above keymappings in some sort of cborHex- to ASIC converter (or something along those lines).
However, if all you're looking for is to extract transaction information from an Alonzo body, cardano-cli was just updated to the newest version 1.31.0 which allows you to convert Alonzo era Tx Body's into human readable format:
Saving the above TxBody to file tx.alonzo, I then run the following using cardano-cli version 1.31.0:
cardano-cli transaction view --tx-body-file tx.alonzo
which prints:
auxiliary scripts: null
certificates: null
era: Alonzo
fee: 168185 Lovelace
inputs:
- 1db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338#0
metadata: null
mint: null
outputs:
- address: addr_test1qqp6z9xneafqp0ndrxgyjd3qecs4tf6ktqhvj2hyc5efg2gzq5lqcm6rfuv6yp0mtsgc2qxvwlwr938qk2nue0rqg6rqxewe52
  address era: Shelley
  amount:
    lovelace: 93453668
  datum: null
  network: Testnet
  payment credential:
    key hash: 03a114d3cf5200be6d1990493620ce2155a756582ec92ae4c5329429
  stake reference:
    key hash: 02053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc604686
- address: addr_test1qrxs7m67uke5ckhe4fq0ex060zyedun7ge9fd4v08efyhnjnu93a5kcawxmc8uph5az7zfgtnhey2p65llkh37l4jg5smqzhph
  address era: Shelley
  amount:
    lovelace: 1000000
  datum: null
  network: Testnet
  payment credential:
    key hash: cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce
  stake reference:
    key hash: 53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf59229
update proposal: null
validity range:
  lower bound: null
  upper bound: null
withdrawals: null

Sorry if this doesn't answer your question directly, but as far as extracting an address (along with all the other Tx info) from a cbor-encoded TxBody, this is the best that I could come up with.


text:
Where is all the unstaked ADA?
Sorry if the question seems trivial/silly, but where is the ~10B ADA that is not actively staked? It seems like any actor (individual, business, exchange, etc) has every incentive to stake their ADA. Even if a lot of people are holding their ADA on exchanges, I would expect that exchange to stake it for them and reap the rewards... so what gives?
(Perhaps we can exclude the ~700 million that is in the catalyst treasury, but still its a a LOT of unstaked ADA.

This is a great question. I was thinking a very similar thought the other day. However, I am thinking it has to be exchanges.
This is speculation but I would imagine staking someone else's Ada posses a legal risk. I don't think it would be far fetched for someone to file an Antitrust law on them for doing so (at least in the U.S). This is also why I think Binance US doesn't allow staking Ada.
Again, this is speculation, but it is what I have came up with as the reasoning.
I hope it helps! And please correct me if any of this is known to be false.

I would agree completely if it weren't for the ~60 or so fully saturated pools that Binance operates on mainnet. Maybe they have some special legal provisions that other exchanges don't have, but for some reason I doubt it. I'm also speculating, but there's no way they own >3B ADA.

You are on the same brainwave as me. I was thinking that Binance is for sure staking US wallets and not rewarding them. But I am thinking Coinbase and other exchanges, maybe?

Gonna have to try and get this one in on one of Charles' next AMA's :)


text:
Can Yoroi (Daedalus...) create a transaction with more than two outputs?
With cardano-wallet or cardano-cli I can combine transactions (= a transaction with more than two outputs).
Is something similar possible with wallets like Yoroi, Daedalus etc.?
Example
I want to send 20 ADA to address1 and 30 ADA to address2 from my wallet in one transaction.

Short Answer: No
Long Answer: Pretty sure no, at least not yet.
In the technical flow section, there is a note explicitly stating that it is not possible.
https://developers.cardano.org/docs/integrate-cardano/multi-witness-transactions-cli
cardano-cli is where its at :)

Your example has two inputs (two different wallets) and one output. I mean the other way around...one input (one wallet!) with two outputs (two different wallets).

My apologies. I misread the question, On first glance, I can't seem to find any technical documentation explicitly stating that multiple Tx outputs is not possible, but as I'm sure you've also tried, I cannot find such an option on either Daedalus or Yoroi. I'm sure this feature will be implemented in the future, as it seems easier to implement 1 -> n than n -> 1


text:
Yoroi from Daedalus and Ledger nano
I'm sorry if this has been answered elsewhere, I couldn't find it specifically.
If I have been using Daedalus with a Ledger Nano and I download Yoroi on Brave browser (I want to get involved in Sundaeswap), what would I need to do to see the funds in there? Do I need to enter the seed phrase? I heard it's generally not a good idea to be typing that in and you'd prefer to avoid it. Is that true? Thanks in advance.

If you have a Ledger, you can just connect to it in Yoroi, no need to restore with your seed phrase or create a new wallet.
With that said, you never should enter your Ledger phrase anywhere except for a Ledger device that you own. Meaning if your device breaks, buy a new one to restore to.
I hope this helps!

Wonderful, thank you. I have it set up now. One quick question, when I was exporting the public key on my ledger, it said something about Byron? Why would Byron have anything to do with it?

My best guess is you have a Byron era wallet on the ledger. How long ago did you get the wallet?

I just checked my emails and the receipt for my ledger was Feb 5th. So it probably arrived and I had it set up by Mid Feb. I can't remember when we went to Shelley.

Oh weird, the hard fork was July 29th, 2020, so I wouldn't think it would be a Byron wallet. But you can tell by what the address begins with if it is addr it is shelly.

Yeah all mine begin with addr. I tried on a new browser (last time was Firefox, this time Brave). I got the same results - after choosing Ledger Nano S - it pops up a grey box on screen about USB etc. Then on the Nano screen it says Export public key. I click both buttons at once - then I get nothing new on Yoroi. I choose Ledger Nano S again and this time it is saying Byron Account #1 and a bunch of letters and numbers and slashes I wrote down. By the way, it is transacting fine in AdaLite.

When I connected to ADALite it says "Export 6 public keys?" and I choose the tick and it works. I have been looking at the advanced tab and it says Keys: Byron Extended Public Key, Shelley Extended Public Key, Staking Key, Reward Address and Staking Key Hash Hex. I also tried Nami and it works but it didn't have any funds. It turns out that only uses the Account #2 while Daedalus had things setup to use Account #1. Yoroi just seems to have an issue with an old Daedalus Shelley wallet so I'll just use Nami I guess.

Thanks for the update. That is very odd. I have a Ledger as well, so I'll try playing with it and seeing if I have a similar experience.

It is recommended to create a separate wallet in Yoroi and transfer some small test funds to carry out the test. Never enter seed phrase in a website.,Never enter seed phrase in a website. Yoroi is a browser extension. In case you decide to migrate to Yoroi in the future you may need to enter the seed phrase. But please do not do it unless you are quite clear on what you are doing. You can refer to this video Restoring a Daedalus Software Wallet in Yoroi

Just to repeat it is recommended that you create a new wallet in Yoroi and use it for testing.


text:
Is it possible to recover ADA sent to wrong address?
I have sent the ADA token to FTX using BNB network. But FTX doesn't support the ADA token. Is is possible to recover/retrieve the ADA token?
Thanks.

To which address you had sent the ADA if it was not supporting? If you have the address use cardanoscan to find the transaction. It is not possible to retrieve unless the address owner can be found and he send it back.

If querying the chain (either directly through CLI or using an explorer like cardanoscan) shows that ADA has been sent outside of any wallet to which you have the signing keys, you no longer have access to that ADA. Plain and simple. :|
The only workaround is if the receiving address decides to send it back to you.

I wonder if one day someone can create a website where you can just input the address the crypto was sent to and dispute the charge proving if the coins are yours or not. What a simple world that would be lol but then again it’s a decentralized world sadly.


text:
Bad inputs, value not conserved
I have a build raw command witch worked very well. But the issue occured when i received some ada for testing purposes
when i run cardano-cli query utxo --address $address --testnet-magic 1097911063 i get this
135cd17e0b9fa7080f9680da51addde5e87ebe9d977536506f37baf9d059677a     0        998685865 lovelace + 234234 1f49b6b44d9c1a8d7b9de0b95247baf757a7280809d144daf6630dc0.asdf + 23423234 30f7743917fb67c65df9689927f716ec368122192d9c6279afc1e958.cool + 234 4d23f4887865b4228a48f59db21d770e6bbc4a94c46c3c96dd72ad3c.asdf + 123123 711c6c84922194c8d2fe43d97769866a35b680c5c6513ac7bf0c19be.sfasfafasdasf + 234 8d4858089e488217d56834fde09d4038f7b675c61fdc883c4efe7934.ölkjasdölfkj + 123123 9c40937c4edf5acad2615b15f4516daad3eefc400913bc563139c5e3.sadfasf + 12234234 c85b75fbfe4810b60d3ff872c0124d811ed637810649800e14371976.asdfasf + TxOutDatumHashNone
23b147e31d0950f1b85b08a35dad87a994b8691598ea071d365248bd3033b50c     0        2391417 lovelace + TxOutDatumHashNone
4f778417a87663e311ff775909f65ba9f8124b4a964313554b8e261a68eca60b     0        2393485 lovelace + TxOutDatumHashNone
9346fa09dab6029344bc531dee5e57ca30d6cdaab04a7fbe69bd86a7d8fc0b9d     0        2007040 lovelace + 11230234 f662fa99ac8c3c9146f12ab34158a4b619c019f38336c3521ecceae1.öasldkfjaösl + TxOutDatumHashNone
a3e7934d43d0f3ae5aedc2d2f14cfb567cb848afc1647d2febe9be5ba1bc6d8b     0        2182573 lovelace + TxOutDatumHashNone
b46316a983cfdf81ed6785d7320feb23547746dea88b04b823c4f5d0d8e32d81     0        5000000 lovelace + TxOutDatumHashNone

This is my function how i build the raw transaction
public buildRaw(date: number,fee: number, address: string, txhash: string, txix: string, output: number, amount: number, policyid: string, tokenname: string,  tokens: { amount: number, tokenHash: string}[]): Promise<string>{
    let matxPath = "matx/" + date + ".raw"
    return new Promise((res, rej) => {
        exec(`cardano-cli transaction build-raw \
        --fee ${fee} \
        --tx-in ${txhash}#${txix} \
        --tx-out ${address}+${output}+"${amount} ${policyid}.${tokenname} ${tokens.reduce((prev, curr) => prev + curr.amount.toString() + ' ' + curr.tokenHash + ' + ', '+ ').slice(0, -2)}" \
        --mint="${amount} ${policyid}.${tokenname}" \
        --minting-script-file policy/${date}.script \
        --out-file ${matxPath}`, (err, data) => {
            if (err) {
                rej(err)
            }
            res(matxPath)
        })
    })
}

I always use the first txhash 135cd17e0b9fa7080f9680da51addde5e87ebe9d977536506f37baf9d059677a with the txix 0
As i said this worked very well. But after i send myself some test ada, as you can see the other transactions, my code does not work anymore. Whats wrong with it?
According to the error i got BadInputs so i guess the problem is in the --tx-in. How do i need structure my --tx-in to make it work?

Are you calculating again your txhash and txix after you receive the test ada?

Make sure that your tx-hash AND your tx-ix are being updated every time you use the function, especially if change is being sent back to yourself, which would raise the value of your tx-ix

You can find the new UTxO with the help of the cli again after submitting a transaction. Otherwise, you are essentially trying to consume the same UTxO multiple times which is not possible.
cardano-cli transaction txid --tx-file $signedTxFile


text:
Disable cardano address generation on transaction
I have instances of cardano-node and cardano-wallet.
Can you tell me how to disable auto-creation of an address for each transaction?
I understand that it is not safe, but I need to do it for tests.

Am I correct in understanding that this is not foreseen because it is contrary to EUTxO?

You can use the same address over and over. There is nothing such as auto-creation. The safety for Shelley addresses is the same.

I think the OP is referring to the auto selection of a change address.

I think you would have to manually calculate the change and provide the change back to the same address as an output to the transaction when using the cardano-wallet transaction builder API.


text:
Impossible to install ghc 8.10.4
with cabal build all,
i receive the message below
[13 of 14] Compiling Generics.SOP.Instances ( src/Generics/SOP/Instances.hs, dist/build/Generics/SOP/Instances.o, dist/build/Generics/SOP/Instances.dyn_o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.2:
        Loading temp shared object failed: /tmp/ghc34004_0/libghc_89.so: failed to map segment from shared object

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

cabal: Failed to build generics-sop-0.5.1.1 (which is required by
exe:plutus-example from plutus-example-1.31.0 and test:cardano-testnet-tests
from cardano-testnet-1.31.0). See the build log above for details.
------
additionally i try to upgrade GHC and i have the errors below :
Configuring library for generics-sop-0.5.1.1..
Preprocessing library for generics-sop-0.5.1.1..
Building library for generics-sop-0.5.1.1..
[ 1 of 14] Compiling Generics.SOP.BasicFunctors ( src/Generics/SOP/BasicFunctors.hs, dist/build/Generics/SOP/BasicFunctors.o, dist/build/Generics/SOP/Basi>
[ 2 of 14] Compiling Generics.SOP.Classes ( src/Generics/SOP/Classes.hs, dist/build/Generics/SOP/Classes.o, dist/build/Generics/SOP/Classes.dyn_o )
[ 3 of 14] Compiling Generics.SOP.Constraint ( src/Generics/SOP/Constraint.hs, dist/build/Generics/SOP/Constraint.o, dist/build/Generics/SOP/Constraint.dy>
[ 4 of 14] Compiling Generics.SOP.Dict ( src/Generics/SOP/Dict.hs, dist/build/Generics/SOP/Dict.o, dist/build/Generics/SOP/Dict.dyn_o )
[ 5 of 14] Compiling Generics.SOP.NP  ( src/Generics/SOP/NP.hs, dist/build/Generics/SOP/NP.o, dist/build/Generics/SOP/NP.dyn_o )
[ 6 of 14] Compiling Generics.SOP.Metadata ( src/Generics/SOP/Metadata.hs, dist/build/Generics/SOP/Metadata.o, dist/build/Generics/SOP/Metadata.dyn_o )
[ 7 of 14] Compiling Generics.SOP.NS  ( src/Generics/SOP/NS.hs, dist/build/Generics/SOP/NS.o, dist/build/Generics/SOP/NS.dyn_o )
[ 8 of 14] Compiling Generics.SOP.Sing ( src/Generics/SOP/Sing.hs, dist/build/Generics/SOP/Sing.o, dist/build/Generics/SOP/Sing.dyn_o )
[ 9 of 14] Compiling Generics.SOP.Type.Metadata ( src/Generics/SOP/Type/Metadata.hs, dist/build/Generics/SOP/Type/Metadata.o, dist/build/Generics/SOP/Type>
[10 of 14] Compiling Generics.SOP.GGP ( src/Generics/SOP/GGP.hs, dist/build/Generics/SOP/GGP.o, dist/build/Generics/SOP/GGP.dyn_o )
[11 of 14] Compiling Generics.SOP.Universe ( src/Generics/SOP/Universe.hs, dist/build/Generics/SOP/Universe.o, dist/build/Generics/SOP/Universe.dyn_o )
[12 of 14] Compiling Generics.SOP.TH  ( src/Generics/SOP/TH.hs, dist/build/Generics/SOP/TH.o, dist/build/Generics/SOP/TH.dyn_o )
[13 of 14] Compiling Generics.SOP.Instances ( src/Generics/SOP/Instances.hs, dist/build/Generics/SOP/Instances.o, dist/build/Generics/SOP/Instances.dyn_o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.2:
        Loading temp shared object failed: /tmp/ghc34004_0/libghc_89.so: failed to map segment from shared object

Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug

nano /home/rel/.ghcup/logs/ghcup.log
Debug: Identified Platform as: Linux Ubuntu, 20.04
Info: downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.6.yaml as file /home/rel/.ghcup/cache/ghcup-0.0.6.yaml
Debug: Read etag: "71004c1fe71d71cd7c6c10cf21ce10e2ff835b28e7f35047c214002c9f4a0cba"
Debug: Status code was 304, not overwriting
Debug: Parsed etag: "71004c1fe71d71cd7c6c10cf21ce10e2ff835b28e7f35047c214002c9f4a0cba"
Debug: Writing etagsFile /home/rel/.ghcup/cache/ghcup-0.0.6.yaml.etags
Debug: Decoding yaml at: /home/rel/.ghcup/cache/ghcup-0.0.6.yaml
Warn: New GHC version available: 9.2.1. To upgrade, run 'ghcup install ghc 9.2.1'
Warn: New Cabal version available: 3.6.2.0. To upgrade, run 'ghcup install cabal 3.6.2.0'
Debug: Requested to install GHC with 8.10.4
Warn: Possibly insufficient disk space on /tmp. At least 5000 MB are recommended, but only 906.16 are free. Consider freeing up disk space or setting TMPD>
Warn: ...waiting for 10 seconds before continuing anyway, you can still abort...
Info: downloading: https://downloads.haskell.org/~ghc/8.10.4/ghc-8.10.4-x86_64-fedora27-linux.tar.xz as file /tmp/ghcup-f4eda7a958f8e287/ghc-8.10.4-x86_64>
Info: verifying digest of: ghc-8.10.4-x86_64-fedora27-linux.tar.xz
Warn: Possibly insufficient disk space on /tmp. At least 5000 MB are recommended, but only 698.57 are free. Consider freeing up disk space or setting TMPD>
Warn: ...waiting for 10 seconds before continuing anyway, you can still abort...
Info: Unpacking: ghc-8.10.4-x86_64-fedora27-linux.tar.xz to /tmp/ghcup-69f45884bccc4e58
Info: Installing GHC (this may take a while)
Error: Process "sh" with arguments ["./configure",
                             "--prefix=/home/rel/.ghcup/ghc/8.10.4"] failed with exit code 1.
Error: Also check the logs in /home/rel/.ghcup/logs

Please post the command you are running.

Did you fix this
" Warn: Possibly insufficient disk space on /tmp. At least 5000 MB are recommended, but only 698.57 are free. Consider freeing up disk space or setting TMPD>
Warn: ...waiting for 10 seconds before continuing anyway, you can still abort... "
When you have insufficient diskspace then the compiler may abort with the reason "impossible happened"

yes , that is what i try to solve, but i dont find the root cause to fix this,,,
please check the output of my disk....
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             15G     0   15G   0% /dev
tmpfs           3.0G  648K  3.0G   1% /run
/dev/sda2       786G   45G  702G   6% /
tmpfs            15G     0   15G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            15G     0   15G   0% /sys/fs/cgroup
/dev/loop0      976M  2.6M  907M   1% /tmp
tmpfs            15G     0   15G   0% /run/shm
/dev/sda1       922M  141M  718M  17% /boot

thank you for your time, i just found and remembered i had implemented this solution for security reasons.
http://bookofzeus.com/harden-ubuntu/server-setup/secure-tmp-var-tmp/
Let's create a 1GB (or what is best for you) filesystem file for the /tmp parition.
sudo fallocate -l 1G /tmpdisk
sudo mkfs.ext4 /tmpdisk
sudo chmod 0600 /tmpdisk
Mount the new /tmp partition and set the right permissions.
sudo mount -o loop,noexec,nosuid,rw /tmpdisk /tmp
sudo chmod 1777 /tmp
Set the /tmp in the fstab.
sudo nano /etc/fstab
: /tmpdisk  /tmp    ext4    loop,nosuid,noexec,rw   0 0
sudo mount -o remount /tmp
Secure /var/tmp.
sudo mv /var/tmp /var/tmpold
sudo ln -s /tmp /var/tmp
sudo cp -prf /var/tmpold/* /tmp/
sudo rm -rf /var/tmpold/


text:
How to connect Yoroi to testnet?
I already have a testnet cardano-node running on my machine. How can I connect Yoroi there? Is the hetwork hardcoded in the wallet or I'm missing some advanced settings?

You need to install Yoroi Nightly.


text:
How to select UTXOs needed for covering a given ada amount using the Cardano Serialization Lib?
Is there any prebuild method in Cardano Serialization Lib that allows to select some UTXOs that cover the balance needed for a transaction?
Or should i make a script that querys all the utxo in that addres and selects the first ones that covers this given amount?

You are speaking about what we call Coin Selection Algorithms and they are described in CIP2.
There are several implementations floating around on Github, such as  BerryPool implementation of the Random-Improve coin selection algorithm or what Yoroi does.

Yes i have seen Berrys implementation, but it semed a little bit too complex, and the CIP2 apears to be in haskell right? I did one script that only querys one by one until it gets the minimun and then the extra is sended back to the owner, i dont know if this is enought for my dapp or if should I use Berry implementation.

No, the CIP describes the algorithm, these are language agnostic.

+1 for the links to the coin selection CIP and the implementations!

The cardano-wallet's implementation in Haskell for coin selection can be found here: https://github.com/input-output-hk/cardano-wallet/blob/fe7632e44bfb6be9171069e3bf70b6a4e43bf6ff/lib/core/src/Cardano/Wallet/Primitive/CoinSelection.hs

@MarekMahut-StakeNuts CIP20 states "Problems relating to network fees, and how to adjust coin selections to pay for such fees, are outside the scope of this article." Any ideas how to solve that?


text:
How can I get a POSIXTime in the Contract monad?
I don't see any way to use IO in Contract and I don't see any functions for getting a POSIXTime from the things I can get within Contract.

there is a currentTime function in Plutus.Contract.Request with the signature
currentTime :: forall w s e. AsContractError e => Contract w s e POSIXTime


text:
How to interpret asset transactions data for a NFT?
Using the blockfrost API I quired the transaction history of a NFT using the following script:

from blockfrost import BlockFrostApi, ApiError, ApiUrls

api = BlockFrostApi(
    project_id='my_secret_key',
    base_url=ApiUrls.mainnet.value,
)

try:
    health = api.health()
    print(health)

    assets = api.assets_policy(my_policy_id)
    asset_history = api.asset_transactions(assets[13].asset, return_type='pandas')
    print(asset_history)

except ApiError as e:
    print(e)

Getting this response:
                                              tx_hash  tx_index  block_height  block_time
0   38ad1c10fce2ff3cc19a47002ea3f0e42257a56d051dc3...         2       6436806  1635591940
1   c379a46550f041e3dd25d534034beb71b04f15ce3f65b1...         7       6439385  1635644577
2   d92447f19d78cae77b57d727ee459e2665839990418233...        37       6439387  1635644654
3   1c6e774d35c6196d6236f0465ca162a5b873a846b2a5eb...        13       6439391  1635644697
4   5c1048c319fcfca8ba8f6992ae894be73c9244d78d9947...        18       6439398  1635644851
5   f71f698da38403c475565c109a143bda06fb87f718ec08...        34       6439401  1635644928
6   e15fb6c7fdc5ccc6ccef234f0645b510f150bf7b2e74b4...        18       6439533  1635647419
7   479995eea8a566384eec7b8933c55ef83db42b08779538...         2       6440258  1635663466
8   0548dab5b72458d0ea31b0e99f13c671d4634d27657e03...         0       6440355  1635665472
9   94141bcb58cdb5822b9fea7eab9b8868845d523f9f190d...         8       6441301  1635685169
10  738bed4f7bccfa426a403e35845bee96c0d3f41e83ea5e...        13       6441422  1635687392
11  4afb4df1d193ceb3bfe24d9de934252a176120888e0a96...         0       6442330  1635706804
12  4e847c23f326821b3565472045e36ea774f496df2f09a5...        70       6442428  1635708878
13  cb19e1da6665375c1b6b3ac1e0e31bb238b1f1c90000f3...         6       6444826  1635758501
14  6ec8b61254f82120c6120a24d41e50977abf613f5c66b7...        23       6445035  1635762659
15  5e644b9c77d6c565c925d15cfecfffd7a279eb9a2c713e...        31       6447594  1635814038
16  8db58815ee4ad5f37aaaddbd7d1ef8719477a87d24452d...         4       6447605  1635814237
17  11fd5b552be255831d82fdc513fff41c4809cf33e7c6b2...        12       6447776  1635818167
18  b05dd10d64764ae7b9aab93c3b1e7ddaa2a6c9c0680461...        26       6462608  1636121671
19  22a8c33a6fe35fd82cfd00544bda4345ea65318188a927...        25       6462612  1636121753
20  f9882f6aea766d9f5a3b503f168c84b635e9be0a349acd...         7       6462673  1636122903
21  0a6fa23b9081d938e986734071ab66c7032f6c50954428...        22       6462904  1636128077
22  8450c04442ba42432edc4d7d1c703e084e28e6ab3e9f8d...         4       6463391  1636138353
23  ade1f612f6d7adcb54c3a804cdb230f343b486f425f32c...         0       6468943  1636250015
24  13fb4e318ba12558819ede20ed37dc2bef7b9dae7cff61...        26       6469165  1636254523
25  3153d200935012eb695ffafd13ffe68c04c4f2fc179c9a...         4       6469171  1636254605
26  fb5e69b4ddb00f23cbe879c2087fe315178ac73fa07c56...        22       6469172  1636254670
27  9555c42315f15a88b29535ebffc05369ccc9b2fc092db8...         4       6482371  1636529118
28  09e430ad3ffde4f1e21fe33564f29a0fbb699213df67f8...         9       6483131  1636544549
29  8949eed31b7cede95c294f0bdec3d6b26ded6b14a18adb...        35       6485203  1636585696
30  50a06e0f0cc53e666d474798f5bc05bffcc1812fd23524...        31       6485216  1636585952
31  e0401628a403a699d91610439606f406d82c9fa4cf655f...        28       6485336  1636588252
32  89a311b10d004da25b3027d4795fc2e245a59a6be30c5e...        54       6485341  1636588391
33  e7b5c1b24ae39bf0f10000237bee03254ea0ac67399002...        16       6485394  1636589435
34  3a319385fe7a8373e3c0ac864727147ccb3edb409abac8...         8       6485404  1636589609
35  7f4a9bd753caae61e6e7e7147269ab6500832aab8d786c...         8       6485406  1636589642
36  1b0965031f3e137f9d787941230894ccf91d89d0beb6b9...        20       6485430  1636590112
37  f526d275da39c46783983aa326da5fe13379270ab12b01...        13       6485447  1636590324
38  cbe3b65fd19364fab8e69062d9075dfa9f6ff90e25f02b...        26       6488527  1636651538

My questions:

Does each line represent a transaction where the NFT was transferred from one address to another address? If not, why are there so many transactions?

What is the tx_index?

Is the block height simply the size of the new block added to the
ledger? (in bytes?)

Where can I find a reference so that I can easily answer these
questions myself and not have to create a StackOverflow post each
time?

Correct, that is the history of transaction of that specific asset
That is the index of the transaction within a block
block_height is the height of the block, in other words, it is the number of the block in the blockchain
Directly on docs.blockfrost.io, go to the specific endpoint and click on the 200 response to roll down the descriptions of each fields:


text:
Is it possible to validate on-chain if two different wallet addresses come from the same person?
My goal is:
I would like to create a smart contract which would verify if unlocking transaction comes from the same person as the wallet address which is known before hand.
What I have tried:
I have went trough https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet/ and https://github.com/input-output-hk/Alonzo-testnet/blob/main/Alonzo-solutions/exercise3/e3SampleSolution.md exercises to understand cardano transactions and wallets better. I have also created my own Yoroi wallet and played around a bit with transactions.
I have also tried looking for functions which could do verification with wallet addresses in Plutus API, but couldn't find anything.
What I got from all of this is that because cardano wallet is created with a single recovery phrase it should be possible to trace down if different wallet addresses belong to the same person.
How I think solution should work:

Transaction comes in into smart contract
Smart contract takes wallet address from which this transaction came
Smart contract checks if already known wallet address (for sending funds to) belongs to the same person as the owner of unlocking transaction wallet

Things I don't quite get it:

Can smart contract on-chain code go trough blockchain to check wallets pub-keys for validation and if so how?
Is the txSignedBy :: TxInfo -> PubKeyHash -> Bool the only function which can be used on-chain to check ownership?
Is it possible to get wallet address from TxInfo in smart contract?
Can PubKeyHash be retrieved from wallet address on-chain and off-chain?

I don't expect an honest well though out answer to all of these questions, but if anyone could lead me a even a little bit on how to achieve my goal I would be really thankful.

I came accross this and was wondering how the currently held Sundaeswap vote is doing this to cast votes only once. Nothing to do with SC but with staking addresses, you might wanna check this topic, maybe it helps: https://cardano.stackexchange.com/questions/3786/finding-related-addresses-and-total-balance-of-wallet-for-any-given-address


text:
Airdrop Mechanism
I'm trying to find information about native token Airdrops. What is the mechanism?
For example, the user send 5 ADA to the wallet of the project and the smart contract will send you back (2.5 x Amount of ADA) of $NATIVETOKENS.
Is there a simple mechanism for this or it needs a smart contract?
How are distributed for example the Meld Tokens? Or the WMT?

I was also searching for this info, but I was not able to find the answer how this is done. Same mechanism is used for an example for the Spacecoins or the newest one Hosky. I do not think you need smart contract for this but I am not sure.
I think this is simply done by the bash script running on some server with synced wallet. You can basically monitor your wallet, once you will receive the ADA you can filter the wallet ID using cli and construct outgoing transaction. And that's it.

Yes that's basically a vending machine script.  There are some scripts available in github

Can you please give some examples and post a few links? Short answers get flagged as the low-quality posts.


text:
Issue compiling pab-local-cluster on M1 processor
I have been trying to get the new PAB beta release to compile on my M1 Mac and have run into an issue.
Build log (
/Users/isaacpadberg/.cabal/logs/ghc-8.10.4/crdn-nd-1.30.0-8154d373.log ):
Configuring executable 'cardano-node' for cardano-node-1.30.0..
Warning: The package has an extraneous version range for a dependency on an
internal library: cardano-node >=0 && ==1.30.0, cardano-node >=0 && ==1.30.0.
This version range includes the current package but isn't needed as the
current package's library will always be used.
Preprocessing executable 'cardano-node' for cardano-node-1.30.0..
Building executable 'cardano-node' for cardano-node-1.30.0..
[1 of 2] Compiling Paths_cardano_node ( dist/build/cardano-node/autogen/Paths_cardano_node.hs, dist/build/cardano-node/cardano-node-tmp/Paths_cardano_node.o )
[2 of 2] Compiling Main             ( app/cardano-node.hs, dist/build/cardano-node/cardano-node-tmp/Main.o )
Linking dist/build/cardano-node/cardano-node ...
Undefined symbols for architecture x86_64:
  "_crypto_vrf_proof_to_hash", referenced from:
      _Lcjo6_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_prove", referenced from:
      _LcjhT_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_verify", referenced from:
      _Lcj0W_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_secretkeybytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_signKeySizzeVRF_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _LcjE7_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_keypair_from_seed", referenced from:
      _LcjaN_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_sk_to_pk", referenced from:
      _Lcj8e_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_publickeybytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_verKeySizzeVRF_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _Lcjsy_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_proofbytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_certSizzeVRF_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_outputbytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRFzuzdcsizzeOutputVRF_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_vrfKeySizzeVRF_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_verify1_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
  "_crypto_vrf_seedbytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRFzuzdcseedSizzeVRF_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRF4_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRF5_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zm3e9b3fc3_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRF2_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
      _LshEK_info in libHScrdn-crypt-prs-2.0.0-3e9b3fc3.a(Praos.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

It seems that the crypto_vrf library is either incompatible with this processor, or its just missing.
Any help is greatly appreciated!

I may suggest you getting into building with nix plutus-apps#nix-on-macos nix should be taking care of those dependencies for you.

I have run into this issue previously with my M1 Mac but forgot the exact solution used. But configuring my cabal build with -external-libsodium-vrf resolved the issue. I ran the following commands:
cabal configure --enable-tests --enable-executable-dynamic -f -external-libsodium-vrf
cabal build plutus-pab-examples

Then I'm able to run
cabal exec -- plutus-pab-examples

Note also that I'm running the above in nix-shell of plutus-apps, which I believe is required for the build to access crypto-vrf.


text:
version `GLIBC_2.33' not found
trying to install nix (on a clean fedora 35 server), getting this error, help!
/nix/store/sbbifs2ykc05inws26203h0xwcadnf0l-glibc-2.32-46/lib/libc.so.6: version `GLIBC_2.33' not found (required by /usr/local/lib/libsodium.so.23)

for me it worked to remove LD_LIBRARY_PATH from env

Try unsetting your LD_LIBRARY_PATH, like this:
unset LD_LIBRARY_PATH

Then restart your installation.
If you need more information, please check this GitHub Issue.