text:
Advantages and data load sharing of blockchain tech for consumer applications
I want to have an application developped (for on pc) and actually I have several questions about blockchain advantages for this purpose and more.
My blockchain of preference is naturally, Cardano.
I'm not pc tech savvy myself so pardon me if the questions might seem a bit daft to you.
The way I vision it is that blockchain is a kind of hyve technology and every point (node) in the chain communicates to each other and is actually one but at the same time many and at many places (decentralized) and so increases security and shares in the data transference / a.k.a. load.
This last part is important for me to understand so as to find out if and how I can best use Cardano blockchain for the desired application.
When I launch a pc application, normally I will need to use servers to have the ability to scale horizontally and/or vertically to make available the application for download as well as updates, etcetera.

Is it correct to assume that when I have the application build on blockchain, that when people dowload / install it for use, that because of the blockchain tech, basically the downloads / updates and more will or can be shared by the network as a whole? And therefore
diminishing or making obsolete the entire use of servers in the traditional way?

What other advantages might you get by building applications on blockchain rather than the traditional way?

The number of languages and manners through which one can build on Cardano is a bit dizzying to me. I understand that Haskell is quite a big deal to use and that most developers are not equipped to use this language.
Therefore, what can you, the community advise on how to build on Cardano in the most reachable way?

The application I'm seeking to have built, has got to do with privacy and security.
Since blockchain seems to be very good at reading and logging data, can a privacy & security app really keep people's stuff private on the Cardano blockchain?

So this covers my questions and I hope the community can be of assistance.
Thank you very much.

1.) So you would never have an app stored on the blockchain that clients download. By that I mean, you are not going to be able to store an executable on the chain. Instead you are more than likely going to build a smart contract script on the chain and build a interface (that is not on chain) to interact with it.
For an example of this, let's look at NFTs. NFTs are generally made for (but not limited to) images. These images are not actually stored on the blockchain. What is stored on the chain is a signed hashing of the image with a link pointing to the image. This meaning the image itself is not on the blockchain, as this would make the chain incredibly large. This process is significant because it allows someone to create an original copy of an image and the world can verify it.
In summary, servers still have a place in application architecture for blockchain applications.
2.) There are a lot of potential advantages. The biggest being an immutable public ledger.
3.) I would point someone to the Cardano Developer Portal.
4.) I couldn't answer this without a lot more details on what is trying to be accomplished. I would just say to think of blockchain as a public ledger and not a database.
I hope this is helpful! Welcome to the community!

authors: บุญจันทร์ สว่างบ้าน


text:
Create a new wallet on public node
I want to create a wallet and use it but I don’t want to run a node locally. I recently found Blockfrost but, I don’t think it has the option to create a wallet. What can I do?

You can always use Yoroi, which is just a browser extension that connects to trusted remote nodes to interface with the chain.
Additionally, if you want to create a wallet in a completely cold, network-isolated fashion, you can use cardano-cli (and/or cardano-wallet) on an airgapped machine.
Section 10 of Coincashew's SPO guide has a neat bash script for creating mnemonic wallets in an airgapped environment. Perhaps it may be of help in your python script!

I'm writing a python script so I don't think a browser extension helps me a lot.

edited to include a sample bash script

Thanks, That was helpful! But Isn't there any public node like Blockforest to give that service?

Wallet/Key generation is an entirely offline process. Even if there was a public entity that offers such a service, it kind of defeats the purpose of generating keys in a secure/cold fashion.

Thanks man. That was helpful.

source: Stack Exchange

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

sort: votes


text:
Similar source for Cardano
I want to generate public and private keys with an address. I found this repository but it doesn't support Cardano. Does anybody know any similar source?

Cardano uses Bip32-Ed25519 standard for deriving keys and uses bech32 for encoding keys/addresses. I'm not aware of any native python libraries for doing the key derivation, but you could wrap cardano-addresses as long as it's in the path as I do here in adawallet: https://github.com/input-output-hk/adawallet/blob/ae8ddbb164b9b95037cd2d7e795e9926dc0f5df6/adawallet/adawallet/lib.py#L326-L332.

This should give you all you need to start generating keys for Cardano in your language of choice. Also check out CIP-1852 and CIP-19

This should help. You can use cardano-wallet and cardano-cli for wallet and addresses management.

The thing is I don't wanna run a full node or using cli. I want to do all the processes in python.

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


text:
Change Address in transaction
I made an address with cardano-cli (here) and I funded it from my Yoroi wallet, but I don't know where this change address came from. Shouldn't the change address be the input itself or Am I missing something here? (transaction)

Cardano utilizes a UTXO-style accounting model (similar to bitcoin, but with extra features), as opposed to an accounting model, like what Ehtereum uses. Here is a quick overview of the differences.
In short, a UTXO is an output of a previous transaction that "sits and waits" at an address to be used as an input for a future transaction. It is analogous to how cash works; if I send you 30 ADA, you can almost imagine that a 30-ADA "bill" (think dollar-bill = UTXO) is created at your address. If you now want to spend this 30-ADA UTXO, you cannot rip off a piece of it anymore than you could rip off a piece of a dollar bill when you want to spend it. Instead, you spend the entire bill, and receive change back in the form of smaller denomination bills. UTXO's work the same way.
In your case, you had a 36 ADA UTXO in your Yoroi wallet, and you wanted to send 1 ADA to your CLI wallet. Yoroi automatically created a transaction with 1 input (the original 36-ADA UTXO), and two outputs (1-ADA UTXO to the CLI wallet, and 35-ADA UTXO sent back as "change" to your Yoroi wallet). Wallet software like Yoroi makes such change management simple and user friendly; it auto-generates a change address for your wallet and send your change there as one of the TX-outputs.
If you now try sending funds from the CLI wallet you'll have to build the full transaction manually, which is a great way to get a feel for how UTXO accounting works.

Thanks, but why the change address is different from the first one? I mean, I had 36 ADA in my wallet at first and transferred one of them to somewhere else. So isn't it more logical to send back the 35 ADA to my first address?

This is possible - in fact you can do this yourself if you use the CLI method. However, it is not done by default for privacy reasons - there is no public-facing cryptographic link between your original address and your change address, so this greatly obfuscates the movement of funds. (Note: staking keys complicate things though, but if we leave that aside, change addresses have virtually zero downside and a great privacy upside)

Yoroi follows the same nomenclature that cardano-wallet does with change addresses. A number of other wallets (adalite, typhon and my python wrapper wallet https://github.com/input-output-hk/adawallet re-use the same address as the change address).
The way it works is explained here in detail: https://github.com/cardano-foundation/CIPs/tree/master/CIP-1852
Addresses are derived from the root key that comes from the mnemonic of your wallet. Receiving payment keys use the derivation path: 1852H/1815H/0H/0/0. However change addresses are derived from 1852H/1815H/0H/1/0. The stake key (currently) is always: 1852H/ 1815H/0H/2/0`.
So essentially anytime you send a tx, it will generate a new address not in the receiving address path and send the change to that address.


text:
Received the transaction id but the transaction never happened
I used to work with Blockfrost API to submit my transactions. A few days ago, I ran into this problem in which my transactions were submitted successfully (The API returned me the transaction id without any error) but the transactions were never actually processed (When I looked for transactions in the Cardanoscan, nothing was found). I decided to submit my transactions on another node, and it did work fine for a couple of days, and now I have the same issue. Does anyone know where the problem might be?

The chain has been pretty congested since sundaeswap launched. It may take some time between transaction submission and inclusion into a block. If your TTL or --invalid-hereafter parameter is too short, the TX may be submitted to the mempool but be invalid by the time it is to be included in a block. Try setting the TTL to something like 10000+ and see if that helps.

Thanks! Would set TTL something very very high cause any problem?

None that I can think of off the top :)

@Foad You could omit the TTL entirely


text:
Sign transaction with multiple inputs
I built a transaction with cardano-cli shelley transaction build-raw command that has multiple inputs. I have the private keys and .skey files of these addresses but I don't know how to sign the transaction with the cardano-cli. How can I do this?

A single transaction in Cardano can contain many inputs and outputs. As long as the transaction is signed by all the private keys associated with each address, it will be valid. In other words, the number of inputs doesn't effect the number of signatures needed, only the number of unique addresses does, where each unique address requires a signature.
For example, if I have constructed an transaction with an arbitrary number of inputs, but those inputs all come from N-number of unique addresses, the command would be:
cardano-cli transaction sign \
--tx-body-file <RAW_TX_FILE> \
--signing-key-file <SKEY_1_FILE> \
--signing-key-file <SKEY_2_FILE> \
--signing-key-file <SKEY_N_FILE> \
--mainnet \
--out-file <SIGNED_TX_FILE>

Does it automatically find which file belongs to which address or I should specify that?

it will automatically find them, There is no need, nor an option, to specify.

Got it, Thanks!

Here's an example of a signing command - just add/remove --signing-key-file parameters as necessary!
cardano-cli transaction sign --signing-key-file payment.skey --signing-key-file policy.skey --mainnet --tx-body-file matx.raw --out-file matx.signed


text:
Serialize a transaction in python
I want to use the "Submit a transaction" method in Blockfrost but it needs an already serialized transaction. Does anybody know how to serialize a transaction in python? (I don't wanna use CLI or anything like that)

Sadly there isn't an easy way of doing this in Python yet, since the serialization library is written in Rust with WASM wrappers. At the moment your best bet is to use Javascript/TypeScript in Node, or use pure Rust, or if you're feeling adventurous it is possible to execute rust functions from a Python code base. It just requires a bit of work, see here.

It is also be possible to construct and sign a transaction using cardano-cli. Quickly searching for a python wrapper I've found https://github.com/creativequotient/automint

Good news, there is a python implementation available! https://github.com/cffls/pycardano
I haven't used it myself but the Readme claims this library is able to build and sign transactions. It even comes with an example for exactly this purpose: https://github.com/cffls/pycardano#transaction-creation-and-signing

That was a lifesaver. Thanks, man!

Can it compile Plutus.  I looked at the docs but I am too new to this whole thing to even be able to tell.  I just want to programmatically generate simple scripts.


text:
"bash: plutus-pab-generate-purs: command not found" issue when run plutus-playground on Ubuntu
I've followed guide for running plutus-playground .
But when I npm run start on plutus-playground-client,  it says 'bash: plutus-pab-generate-purs: command not found'.
Please check screenshot on terminal.

What is issue now?

Can you add the link to the guide(s) you were using. I noticed a similar issue to this and realized it was a result of the guide not being completely current with the repos. Basically one of the steps was changed because something was moved to a different repo.

Having same issue. Any update?

Which guide did you follow? It's best to refer to the plutus-apps repo for up-to-date steps https://github.com/input-output-hk/plutus-apps/tree/main/plutus-playground-client

I am following https://docs.plutus-community.com/docs/setup/MacOS.html
I think I didn't correctly build plutus-pab.
This command : $ nix-build -A plutus-pab fails with error: attribute 'plutus-pab' in selection path 'plutus-pab' not found
I am in the top folder of the plutus-apps repo. Everything else seems to have built.

That content is out of date. Everything for Plutus Playground is in plutus-apps repo now. That cmd would now be $ nix-build ../default.nix -A plutus-apps.haskell.packages.plutus-pab, see https://github.com/input-output-hk/plutus-apps/tree/main/plutus-pab-executables#nix

$ nix-build ../default.nix -A plutus-apps.haskell.packages.plutus-pab works but it doesn't solve my issue.

We're a little different from other sites; this isn't a discussion forum but a Q&A site, where we reserve the answer space for answers. Please check out our short [tour]. Could you please [edit] this to more directly address the question? Thanks.

What is reputation? How do I earn (and lose) it?  Has an explanation of why comments are not an immediate privilege.


text:
How to apply show to TxOutAnyEra datatype from cardano-cli sources?
Example:
testTxOut :: IO ()
testTxOut = do
  let
    testInput = "addr_test1vqwvs32x3wg5ea2l5tr7t93hpta8arwxllr4ey96dhl5d7sytaf9n + 1000000 lovelace"
  case (OutBuilder.getTxOutFrom testInput) of
     Left err -> putStrLn $ show err
     Right tx -> putStrLn $ "passed" -- HOW TO SHOW IT HERE

almost from the Cardano.CLI.Shelley.Parsers because it does not export one
module BuildTxOut
  (getTxOutFrom)
where

import Cardano.Api
import Cardano.CLI.Types
import Cardano.CLI.Shelley.Parsers

import qualified Text.Parsec as Parsec

import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec

parseTxOutAnyEra2 :: Parsec.Parser (TxOutDatumAnyEra -> TxOutAnyEra)
parseTxOutAnyEra2 = do
    addr <- parseAddressAny
    Parsec.spaces
    -- Accept the old style of separating the address and value in a
    -- transaction output:
    Parsec.option () (Parsec.char '+' >> Parsec.spaces)
    val <- parseValue
    return (TxOutAnyEra addr val)

getTxOutFrom :: String -> Either Parsec.ParseError (TxOutDatumAnyEra -> TxOutAnyEra )
getTxOutFrom s = Parsec.parse parseTxOutAnyEra2 "Wrong" s

Here is simplified version got from cardano-cli Parsers that works.
module BuildTxOut
where

import Cardano.Api
import Cardano.CLI.Types
import Cardano.CLI.Shelley.Parsers

import qualified Text.Parsec as Parsec

import qualified Text.Parsec.Language as Parsec
import qualified Text.Parsec.String as Parsec
import qualified Text.Parsec.Token as Parsec

parseTxOutAnyEra2 :: Parsec.Parser (TxOutDatumAnyEra -> TxOutAnyEra)
parseTxOutAnyEra2 = do
    addr <- parseAddressAny
    Parsec.spaces
    -- Accept the old style of separating the address and value in a
    -- transaction output:
    Parsec.option () (Parsec.char '+' >> Parsec.spaces)
    val <- parseValue
    return (TxOutAnyEra addr val)

pTxOut ::  Parsec.Parser TxOutAnyEra
pTxOut = parseTxOutAnyEra2 <*> pTxOutDatum

-- INFO: can be modified to accept all functionality
-- see original implementation

pTxOutDatum ::  Parsec.Parser TxOutDatumAnyEra
pTxOutDatum = pure TxOutDatumByNone

getTxOut :: String -> Either Parsec.ParseError TxOutAnyEra
getTxOut s = Parsec.parse pTxOut "Wrong" s


text:
How to use the plutus pab statemachine with RemoteWalletConfig for Nami and Yoroi
Looking at the demo contract provided in the plutus-apps folder, you can follow the example of the PayToWallet endpoint. In this endpoint, yieldUnbalancedTx provides the instance with an unbalanced TX. When fetching the status of the instance, you will find the tx in cicYieldedExportTxs field. Offcourse the PAB should be configured with this:
walletServerConfig:
  tag: RemoteWalletConfig

I want to have the same behavior with my statemachine contract. The call to the pab should verify the onchain state and return a transaction so the state of the contract can be changed from a remote wallet like Nami or Yoroi. What's the counterpart for this yieldUnbalancedTx function in the statemachine as I believe the SM.runStep tries to submit the Tx instead of returning the tx in the instance.

Welcome to Cardano SE! As a new user be sure to take the [Tour].


text:
How to be approved or reviewed on cardano-token-registry?
I made a pull request on cardano-token-registry
but after days it's still blocked.
How to ask for a review or some type of approval?
My request is #1030
Andrea

You just have to wait, because these are reviewed by human beings working at the Cardano Foundation and it might take few days to work the back queue.

I must say that it's quite frustrating being leaved in a limbo for days just because the first CI run failed for an error in another project and not in mine. However, thank you for your answer.

Merged! Frustration ended! :P


text:
How to generate a verifiable Proof-of-Burn address
I need to generate a Proof-of-Burn address for a project I'm working on.
I'm almost sure I can generate a valid "unspendable" address myself but I don't know how to make it verifiable and if there is a verified utility that can generate such an address.
I tried to read and understand this:
https://iohk.io/en/research/library/papers/proof-of-burn
This is a nice read, but I'm not sure I can fully understand any aspect of it.
For example this simple script I made create what I think is an "unspendable" address:
$ bech32 addr_xvk <<< $(for i in {1..64}; do printf "20"; done) | \
> cardano-address address payment --network-tag 1
addr1vxh2sv3tkgzkyhenvzrleamqj2dvtgxqah56gnhfc32depske34z3

And it's valid, it works, and I can also add some my own text at the beginning to make it unique, instead of 64 spaces...
But is it acceptable as a verifiable Proof-of-Burn address?
Is there any generally approved way to generate a Proof-of-Burn address on Cardano?

Maybe off-topic, but out of curiosity, what do you want to burn? Ada or some native assets ? Third party policy or own policy ?

My token https://pool.pm/bebb83cd0f8bc52c2d2e22bfec9e5f06005be7d545a5d4637d434336.goad, sadly with minUTxOValue of ADA each time but this is another problem... The policy will be locked at the time of project start. https://pool.pm/policy/bebb83cd0f8bc52c2d2e22bfec9e5f06005be7d545a5d4637d434336

I think that the address you generate is plausibly unspendable but not provably. I can imagine that by tweaking a Plutus validator script with a lot of time and computing power you could generate a spendable script that compiles to some regular byte pattern hash that you can than pretend to have derived from an expression such as the one in your example. (Though, a repeating pattern of a two digit number for 128 bytes would probably be impossible to tweak.)
I haven't read the article but the easiest way to get an unspendable script address would be to take an unspendable Plutus validator script (like the one that always evaluates to 'false') and use its script address. This would be verifiable. Even better would be a script that allows cumulating funds so that you can re-use the UTxO and only have to pay the min-Ada once.
This being said, I don't think that these dead-end burn-UTxOs are a sustainable solution. They pollute the ledger and bind Ada. In the long term they inevitably get too expensive. The better solution is to design the currency policy of your token in such a way that tokens can always be burned. This requires the policy to be written in Plutus.

as I know all the computing power of the world for hundreds of times the age of the universe is not enough to crack it, but yes, this is what I'm looking for: a verifiable and credible way to do it... I will take a look at the policy written in Plutus, it may be the best solution afterall. Thank you.

You are right, the tweaking is impossible. So it rather comes down to how believable it is that you took the hash at random and did not use the hash of a spendable script (which is very believable here). I will edit the response.

Really a burn address is quite simple to make on a practical level. If you accept the script address then all you have to do is write a smart contract with a validator that can never be validated but is still acceptable to the standers of the chain.
So put some condition like the current block is the geniuses block and your good to go. This is beacuse of sequential nature of the block chain.
Now when vasil comes out people can easily lool up the specific address and when a decomplier comes out they can verify the contract on chain.
But until then there is still some degree of trust required that you sent the wright contract to the chain.


text:
Obtain data about a CNFT project
I want to obtain some information about a given CNFT project. For instance, the number of asset minted, and all the assets metadata (e.g., attributes). How can I proceed with this? I mainly use R as a statistical/programing tool. Is there an api somewhere to do this? I have been web scraping this information, but it is really cumbersome and I am looking for an alternative.

I think the best option for this is: Blockfrost API
Specifically, Cardano > Assets endpoints
I.e. To retrieve the list of Tokens for a policy, you can use the following code:
curl --location --request GET 'https://cardano-mainnet.blockfrost.io/api/v0/assets/policy/c364930bd612f42e14d156e1c5410511e77f64cab8f2367a9df544d1' \
--header 'project_id: <project_id>'

Where <project_id> is your blockfrost API key.

Thank you very much! I am having a hard time understanding how to use the api. Could you give me just an example on how to pull data from one project via an URL api call (e.g., BCRC: c364930bd612f42e14d156e1c5410511e77f64cab8f2367a9df544d1)? That would really help me out.

@mat please check my updated answer.

thank you so much! But would it be possible to just have a single link? I use R to make api calls and they usually are in a json format or something similar. I Tried https://cardano-mainnet.blockfrost.io/api/v0/assets/policy/c364930bd612f42e14d156e1c5410511e77f64cab8f2367a9df544d1?project_id=<my_blockfrost_api_key> but it did not work...

@mat No, as you need to attach it as a header. You can take a look on this: https://stackoverflow.com/a/65649641/1133816 to use CURL in R with headers.

There are multiple ways.
As per the previous answer you can fetch data from Blockfrost.
But it looks you want to fetch loads of data in bulk, and that could lead to having to pay blockfrost as the basic account only gives you a limited number of api calls.
Alternative is to run cardano-db-sync by yourself https://github.com/input-output-hk/cardano-db-sync
Or leverage some open source like dandelion.link


text:
Plutus and Haskell live references
I am following the plutus pioneer program as an Haskell newbie.
I am using VSCode to look at the snippets and type my code.
I am wondering what is the best way to integrate (if possible) the languages documentation into the IDE. I would love to just reach the function documentation with a couple of clicks!
Thanks

Try working from https://demeter.run, it should have this (I think)

Unfortunately this doesn't work in the plutus pioneer program weeks so far (currently week03). Your IDE uses the haskell language server to get type references but if you run the command haskell-language-server in a nix-shell in the current week's repository you will get an error. This is documented in this question: HLS Compiler Error PPP Week01 (WSL2 + VSCode)

Use this plugin: https://marketplace.visualstudio.com/items?itemName=haskell.haskell
Then from the nix-shell run code . to start VSCode and to let it use the right haskell-language-server version.


text:
Plutus environment set up: pro and cons
I am starting the Pioneer program by setting up the development environment. There are several ways to do that, I think 4!
At the end the two that seems to me more appealing are the one using nix or the one using docker.
The former complex but allows you to create an environment that is more up-to-date.
The latter is more easy (at least for me) and less time consuming.
Is there any real advantage to use the former?
Can we encounter some limitation by following the latter?

I'm afraid that there are more than 4 ways to setup an environment to follow the Plutus Pioneer Program, considering all the combinations of operating systems, virtualization options and application packaging.
The first thing to decide is if we're going to use some kind of virtualization technology to isolate the environment. In my experience this is highly recommended because:

you avoid possible incompatibilities with your host operating system and any already installed software, specially on development systems with many package managers deployed.
it keeps your host clean so you can easily start over from a clean state if things go wrong.
it allows you to choose a base system that is known to work well independently from your host system.
it creates a certain degree of independence from the physical layer (depending on the technology used), to the point where you may decide to setup the exact same environment in the cloud as you don't have the free resources needed in your local computer.

Now, you have two main options to virtualize the environment, a Docker container or a virtual machine.

The Docker option requires that, after installing the software, you run an image that someone has previously built (quick and reproducible option), or that you build it yourself using a Dockerfile. In my opinion it may make sense if someone is maintaining images for each week's environment version, with everything already compiled, aiming to save some time, otherwise a virtual machine can offer more flexibility for this use case, persisting changes without much overhead, and allowing to experiment in a more comfortable way.

The virtual machine option requires that you install a virtualization software, for example Virtualbox, to deploy a local instance, or that you deploy a cloud instance, for example an AWS EC2, and then that you choose/install your preferred operating system, and finally on top of that install the toolset required to compile the Plutus environment. This can be a bit confusing the first time if you're not used to the tools, i.e. nix, cabal, etc...

Be aware that in previous iterations we needed to weekly recompile the environment to make the code samples work, as a consequence of the Playground being under heavy development.
Fortunately the community made an effort to further document the process for a variety of scenarios, and made it available at the website:
https://docs.plutus-community.com/
https://plutus-community.readthedocs.io/
Please consider contributing to the following repository:
https://github.com/input-output-hk/plutus-community
There's an option that in my opinion takes the best of both worlds for this use case, which is to make use of Vagrant to get a running virtual machine but automating all the initial setup process. You can find instructions on the previous links for a Vagrant+Ubuntu setup.
I wanted to use Vagrant+NixOS for its deterministic nature and its native integration with part of the required toolset, so I developed a Vagrant file and a set of scripts to automate the setup process that can be found here:
https://github.com/jmhoms/plutus-pioneer-nixos-vagrant
I plan to follow this third iteration that is about to start, and I'll try to update the scripts as the course moves forward.
I hope this helps.
Cheers!
Josep

I am not familiar with Vagrant, does it have the problem you described for docker of relying on "someone maintaining images for each week's environment version"?

Definetly! For the sake of the learning I will go for an Ubunti virtual box on my windows machine. Then I am gonna use NIX to get the plutus development env and recompile it.
The fact that everithing is under heavy development make things much more exciting!

Mateus, think about Vagrant as a wrapper to easily setup for you (just with a couple of cmd lines) an underlying Virtualbox (or others) virtual machine from a pre made image. At the end, you'll have an operating system with the Plutus toolset compiled. Obviously if some weekly exercise requires a different Playground git commit, you'll need to recompile. For this reason I created a git project with a Vagrantfile that takes care of the initial setup, and some scripts that compile the right commit for each week of iteration 2. I plan to do the same for iteration 3.

So yes, sort of same issue with Vagrant. In my vagrant-nixos scripts, even if nobody takes care of updating them, you should only need to pass the proper commit id (which is specified inside the weekly project file) to the generic script to get the same result. The existent Docker options probably work in a similar way to update the environment, I guess it makes sense to just change the commit id and recreate the image. So in neither case you're really dependant on someone else updating it, but just saving lot of time IF using an image provided by someone else with the environment precompiled.

VirtrualBox is not supported on Apple M1 arm64 architecture. Is it still possible to leverage virtual machines?

Kevin, I'd suggest that you open a new topic for this question, but basically you could use Parallels ( https://www.parallels.com/ ) or maybe a solution based on QEMU. As an alternative, you could run the VM in a cloud provider paying for usage time, or even use a Docker container locally (I think a flag exist to run Intel images on your ARM computer, which would save some time). Cheers!

For those coming now, you can find the new docs website here https://plutus-community.readthedocs.io/

Typically the team loads all new working code to the Nix container. Additionally, it is more compatible with Haskell/Plutus because it is also written under functional paradigm. I tend to suggest everyone using Nix, once you get familiar everything flows smoothly.
You should check at this set up from the First iteration (for your preferred OS):
https://docs.plutus-community.com/docs/setup/Ubuntu.html
Note that the lectures are outdated but the set up is the same

Indeed. I would prefer using Linux, Ubuntu. Saves you lots of time. You can run it together with a windows installation. Building the shell with Nix is the way to go. I have set up instructions over here .. also Mac and Windows.
https://drive.google.com/file/d/1u6QDsZCPnZQ_QiV8hBihgfFh82iTFs7M/view

We're a little different from other sites; this isn't a discussion forum but a Q&A site, where we reserve the answer space for answers. Please check out our short [tour]. Could you please [edit] this to more directly address the question? Thanks.

I agree that Nix is the way to go as it will give you the same processes the Plutus educators and devs are working in. Be sure to follow the instructions offered after the webportal went down.
I went with the canonical plutus-apps repo build for the playground. It is the 3rd option off of the document shared after the portal dropped:
**[Plutus Env: Setup Starter Pack].**

BTW, I am using ubuntu 21.04. I have also done the same install on a straight debian build. Sometime over the next couple days I will do the build on my Win10 laptop (dual booting with the Ubuntu).
I hope this helps & Good luck!


text:
Cabal build error
Ciao folks!
I followed the instruction to build the EnglishAuction.hs contract but I am getting the following when run the cabal build command.
Warning: Requested index-state 2021-10-20T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2021-10-19T23:39:06Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: Win32-network-0.1.0.0 (user goal)
[__1] trying: base-4.14.1.0/installed-4.14.1.0 (dependency of Win32-network)
[__2] trying: lobemo-scribe-systemd-0.1.0.0 (user goal)
[__3] next goal: libsystemd-journal (dependency of lobemo-scribe-systemd)
[__3] rejecting: libsystemd-journal-1.4.5 (conflict: pkg-config package
libsystemd>=209, not found in the pkg-config database)
[__3] rejecting: libsystemd-journal-1.4.4 (conflict:
base==4.14.1.0/installed-4.14.1.0, libsystemd-journal => base>=4.6 && <4.13)
[__3] skipping: libsystemd-journal-1.4.3, libsystemd-journal-1.4.2,
libsystemd-journal-1.4.1, libsystemd-journal-1.4.0, libsystemd-journal-1.3.4,
libsystemd-journal-1.3.3, libsystemd-journal-1.3.1, libsystemd-journal-1.3.0,
libsystemd-journal-1.2.0, libsystemd-journal-1.1.0, libsystemd-journal-1.0.0
(has the same characteristics that caused the previous version to fail:
excludes 'base' version 4.14.1.0)
[__3] fail (backjumping, conflict set: base, libsystemd-journal,
lobemo-scribe-systemd)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, libsystemd-journal,
lobemo-scribe-systemd, Win32-network
Try running with --minimize-conflict-set to improve the error message.

I am running it from the nix-shell after a successful cabal update
Can you help me?

I remember receiving the same error while being in the wrong commit. Did you do git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a inside plutus-apps before nix-shell?

git rev-parse HEAD will show your current commit

Dumb me! was executing the commands outside the nix-shell

The Could not resolve dependencies error is due to not running the command in the nix-shell.


text:
Using `void` vs using `>>` (then) operator
Given a do block which contains these expressions:
void $ submitTx tx
payContract

Would it be feasible to reformat this lines using the then operator, and thus telling the compiler to do something, ignore the output and proceed to do something else? Something like:
submitTx tx >> payContract

If so, what are the benefits of using one over the other? Is any option considered a good or bad practice?

I would say that it’s a matter of taste.

Usually you don't see >>= (bind) and >> (then) inside do blocks--do gives you a more flexible interface with monads and lets you weave in other logic, as you can see in the function you're referring to:
payContract :: Contract () PaySchema Text ()
payContract = do
    pp <- awaitPromise $ endpoint @"pay" return
    let tx = mustPayToPubKey (ppRecipient pp) $ lovelaceValueOf $ ppLovelace pp
    void $ submitTx tx
    payContract

The advantage of a do block is having a more imperative and readable view into the monad.
I usually associate >>= and >> with monad combination outside of do blocks, but I guess there is no reason you couldn't use them inside the block. Feels like mixing and matching, but maybe that's just me; if you're already inside a do block, you might as well use void, <-, etc

There are no benefits of using one over the other. They are equivalent and its simply a matter of choice.

This is an opinion rather than a factual response.  I guarantee that one is more 'readable' than the other and expresses the logic more clearly.  I have always written for clarity first and optimized later.  One may also cost fewer cycles than the other.

That there is no benefit of one over the other is a factual response. The compiler desugars the >>  version to the other so there is zero difference in performance.
Yes, you might find one more readable than the other, but that is an opinion.


text:
Can a contract update the metadata of the NFTs in an entire policy or does this have to be done by a node manually?
Given a policy with a list of non-fungible tokens,

Could a smart contract update the metadata of all NFTs in the collection, under certain conditions?
If not, could this be done "manually" by a node?

On a side note, does my question make any sense or am I missing a fundamental aspect on how the whole protocol works?

On-chain metadata can't be changed, I think the answers in this post may help answer your questions.

Great link resource, but as far as I know on-chain metadata can be changed depending on how you mint it. If you use timelocks native scripts or plutus you can indeed change NFT's metadata - just burn and remint them with new metadata attached.
That's been done before. If you really want to ensure immutability right from the beginning you will have to use plutus and the UTxO based approach to mint NFTs one-time-shot.
That was part of the PPP lecture 5/6 I believe

Depends on what you count as metadata, if you're talking about a datum in a smart contract that changes based on who owns an NFT for example yes metadata can change. Of course you can burn and re-mint but that's not changing the metadata in-place on the chain of an NFT, you're burning that NFT and minting a new NFT entirely.

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes or disappears.

If the policy allows you to mint and burn those same tokens (or NFTs) again, you can update the linked metadata for those NFTs by creating a new minting transaction with the updated metadata and then burning those newly minted tokens.
According to CIP-25 the "valid" metadata for an NFT is that of the latest minting transaction, so just by creating and deleting an exact copy of an NFT you will have "updated" its metadata, since metadata is always connected to transactions, and not to the token itself.
https://cips.cardano.org/cips/cip25/#updatemetadatalinkforaspecifictoken

So one way you could do it is by minting NFTs that have a URL in their metadata that links to your server hosting the corresponding metadata - not IPFS.
Then you can easily change the metadata independently of what's on-chain.
It is not very decentralized, since if you're server goes down the NFT's corresponding metadata is not accessible but it gives you the ability to update them without having to create another transaction.
Alternatively, you can use a so called time-lock based minting policies which allows you to change or update tokens up to a certain deadline.
That way you could burn and re-mint a given NFT in the future to update its metadata. But again, trust is required since you basically are in control of the NFTs at all times.

This re-minting is allowed in any policy which is not locked yet? I thought locking policies would only limit more NFTs to be added in the policy

The time based lock just uses some slot deadline - once that slot has passed any tokens minted under that policy are immutable. No further changes can be made to existing token's metadata etc. + no burns/ additions of tokens


text:
Error on Cabal Build: Failed to build plutus-core-0.1.0.0
Following the instructions from https://github.com/input-output-hk/marlowe-pioneer-program, yet on a Mac M1, running cabal build from within /marlowe-pioneer-program/code main generates 2 errors:

Failed to build byron-spec-ledger-0.1.0.0. (According to the build profile, this is the first item to be built.) The log for this error reads:

Configuring library for byron-spec-ledger-0.1.0.0..
Preprocessing library for byron-spec-ledger-0.1.0.0..
Building library for byron-spec-ledger-0.1.0.0..
[ 1 of 16] Compiling Byron.Spec.Ledger.Core ( src/Byron/Spec/Ledger/Core.hs,     dist/build/Byron/Spec/Ledger/Core.o, dist/build/Byron/Spec/Ledger/Core.dyn_    o )
<command line>: dlopen(/Users/dlindberg/.cabal/store/ghc-8.10.7/lib/libHScrd    n-crypt-clss-2.0.0-3518c5de-ghc8.10.7.dylib, 0x0005): symbol not found in fl    at namespace '_crypto_generichash_blake2b'

Failed to build plutus-core-0.1.0.0. (Third item to be built). Log for this error:

Warning: plutus-core.cabal:312:23: visibility is experimental feature (issue
#5660)
Configuring library for plutus-core-0.1.0.0..
Preprocessing library for plutus-core-0.1.0.0..
Building library for plutus-core-0.1.0.0..
[  1 of 191] Compiling Crypto           ( plutus-core/src/Crypto.hs, dist/bu    ild/Crypto.o, dist/build/Crypto.dyn_o )
[  2 of 191] Compiling Data.Aeson.Flatten ( plutus-core/src/Data/Aeson/Flatt    en.hs, dist/build/Data/Aeson/Flatten.o, dist/build/Data/Aeson/Flatten.dyn_o     )
[  3 of 191] Compiling Data.Aeson.THReader ( plutus-core/src/Data/Aeson/THRe    ader.hs, dist/build/Data/Aeson/THReader.o, dist/build/Data/Aeson/THReader.dy    n_o )
[  4 of 191] Compiling Data.ByteString.Hash ( plutus-core/src/Data/ByteStrin    g/Hash.hs, dist/build/Data/ByteString/Hash.o, dist/build/Data/ByteString/Has    h.dyn_o )
[  5 of 191] Compiling Data.SatInt      ( plutus-core/src/Data/SatInt.hs, di    st/build/Data/SatInt.o, dist/build/Data/SatInt.dyn_o )
[  6 of 191] Compiling ErrorCode        ( common/ErrorCode.hs, dist/build/Er    rorCode.o, dist/build/ErrorCode.dyn_o )
[  7 of 191] Compiling PlutusCore.Builtin.Emitter ( plutus-core/src/PlutusCo    re/Builtin/Emitter.hs, dist/build/PlutusCore/Builtin/Emitter.o, dist/build/P    lutusCore/Builtin/Emitter.dyn_o )

Any advice is greatly appreciated!


text:
Running nix-shell on Mac M1
I successfully installed NixOS on a Mac M1. However, running either nix-shell or GC_DONT_GC=1 nix-shell from within /marlowe-cardano (in the marlowe-pioneers branch) produces:
error: cannot bootstrap GHC on this platform ('aarch64-darwin' with libc 'defaultLibc')

Any ideas on how to get past this?

It seems that you did a multi-user w/ daemon installation. I am aware that a functioning guide is here
so get nix using the darwing unencrypted label
sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

edit your sudo nano /etc/nix/nix.conf  file, by adding IOHK's binaries:
build-users-group = nixbld

substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=

system = x86_64-darwin
extra-platforms = x86_64-darwin aarch64-darwin

sandbox = false
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env
experimental-features = nix-command
extra-experimental-features = flakes

reboot and you should be good to go.
note I am no Nix expert nut if the problem persists then you might need to completely uninstall Nix first, which is not so trivial.

This was spot on, thanks!
I did have to uninstall nix first. Also needed to be in the /marlowe-cardano directory during installation in order to be able to run nix-shell.

Glad it worked! If you upvote and mark my answer as solved it will help other people find it ;)


text:
cabal fails to build plutus-core
When installing plutus starter on a Mac M1 running macOS 12.1 Monterey, the command cabal build logs the following error, even after updating cabal:
Failed to build plutus-core-0.1.0.0.
Build log (
/Users/dlindberg/.cabal/logs/ghc-8.10.7/plts-cr-0.1.0.0-63317e8e.log ):
Configuring library for plutus-core-0.1.0.0..
Preprocessing library for plutus-core-0.1.0.0..
Building library for plutus-core-0.1.0.0..
[  1 of 197] Compiling Crypto           ( plutus-core/src/Crypto.hs, dist/build/Crypto.o, dist/build/Crypto.dyn_o )
[  2 of 197] Compiling Data.Aeson.Flatten ( plutus-core/src/Data/Aeson/Flatten.hs, dist/build/Data/Aeson/Flatten.o, dist/build/Data/Aeson/Flatten.dyn_o )
[  3 of 197] Compiling Data.Aeson.THReader ( plutus-core/src/Data/Aeson/THReader.hs, dist/build/Data/Aeson/THReader.o, dist/build/Data/Aeson/THReader.dyn_o )
[  4 of 197] Compiling Data.ByteString.Hash ( plutus-core/src/Data/ByteString/Hash.hs, dist/build/Data/ByteString/Hash.o, dist/build/Data/ByteString/Hash.dyn_o )
[  5 of 197] Compiling Data.SatInt      ( plutus-core/src/Data/SatInt.hs, dist/build/Data/SatInt.o, dist/build/Data/SatInt.dyn_o )
[  6 of 197] Compiling ErrorCode        ( common/ErrorCode.hs, dist/build/ErrorCode.o, dist/build/ErrorCode.dyn_o )
[  7 of 197] Compiling PlutusCore.Constant.Dynamic.Emit ( plutus-core/src/PlutusCore/Constant/Dynamic/Emit.hs, dist/build/PlutusCore/Constant/Dynamic/Emit.o, dist/build/PlutusCore/Constant/Dynamic/Emit.dyn_o )
[  8 of 197] Compiling PlutusCore.Data  ( plutus-core/src/PlutusCore/Data.hs, dist/build/PlutusCore/Data.o, dist/build/PlutusCore/Data.dyn_o )
[  9 of 197] Compiling PlutusCore.DataFilePaths ( plutus-core/src/PlutusCore/DataFilePaths.hs, dist/build/PlutusCore/DataFilePaths.o, dist/build/PlutusCore/DataFilePaths.dyn_o )
[ 10 of 197] Compiling PlutusCore.Pretty.ConfigName ( plutus-core/src/PlutusCore/Pretty/ConfigName.hs, dist/build/PlutusCore/Pretty/ConfigName.o, dist/build/PlutusCore/Pretty/ConfigName.dyn_o )
[ 11 of 197] Compiling PlutusPrelude    ( prelude/PlutusPrelude.hs, dist/build/PlutusPrelude.o, dist/build/PlutusPrelude.dyn_o )
[ 12 of 197] Compiling PlutusCore.Pretty.Utils ( plutus-core/src/PlutusCore/Pretty/Utils.hs, dist/build/PlutusCore/Pretty/Utils.o, dist/build/PlutusCore/Pretty/Utils.dyn_o )
[ 13 of 197] Compiling PlutusCore.Pretty.Readable ( plutus-core/src/PlutusCore/Pretty/Readable.hs, dist/build/PlutusCore/Pretty/Readable.o, dist/build/PlutusCore/Pretty/Readable.dyn_o )
<command line>: dlopen(/Users/dlindberg/.cabal/store/ghc-8.10.7/lib/libHScrdn-crypt-clss-2.0.0-65075d2b-ghc8.10.7.dylib, 0x0005): symbol not found in flat namespace '_crypto_generichash_blake2b'

Failed to build small-steps-test-0.1.0.0.
Build log (
/Users/dlindberg/.cabal/logs/ghc-8.10.7/smll-stps-tst-0.1.0.0-5d2f50de.log ):
Configuring library for small-steps-test-0.1.0.0..
Preprocessing library for small-steps-test-0.1.0.0..
Building library for small-steps-test-0.1.0.0..
[1 of 5] Compiling Control.State.Transition.Trace ( src/Control/State/Transition/Trace.hs, dist/build/Control/State/Transition/Trace.o, dist/build/Control/State/Transition/Trace.dyn_o )
<command line>: dlopen(/Users/dlindberg/.cabal/store/ghc-8.10.7/lib/libHScrdn-crypt-clss-2.0.0-65075d2b-ghc8.10.7.dylib, 0x0005): symbol not found in flat namespace '_crypto_generichash_blake2b'
cabal: Failed to build plutus-core-0.1.0.0 (which is required by
test:plutus-example-projects-test from plutus-starter-0.1.0.0 and
exe:plutus-starter-pab from plutus-starter-0.1.0.0). See the build log above
for details.
Failed to build small-steps-test-0.1.0.0 (which is required by
exe:plutus-starter-pab from plutus-starter-0.1.0.0 and
test:plutus-example-projects-test from plutus-starter-0.1.0.0). See the build
log above for details.

are you using nix?

Issue solved by following the detailed instructions for Mac M1 installation at  https://github.com/renzwo/cardano-plutus-apps-install-m1

Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.


text:
How to add datum to UTXO in nami
Datum is hashed and assigned to an UTXO
When you send the transaction you can add optional parameters like metadata and/or datum
datum is used by smart contract since it's the only data that smart contract can see.
So in short:

Send the transaction to the address
Add json to metadata
Convert the json to datum and add to UTXO

how to implement "Convert the json to datum and add to UTXO" using NAMI wallet.

Be careful not to confuse metadata and datum, as they are different things. Metadata are part of a transaction, while a datum is part of an UtxO.
Metadata are completely optional and to the discretion of the transaction issuer, while the datum is mandatory when dealing with script addresses.
Some metadata can optionally be attached to a transaction independently of your decision to add some datum to the different UtxO. In addition, you don't send the datum directly, but its hash.
It is only when you want an UtxO back from a script that you have to provide a datum whose hash has to match with the one you defined previously.
This datum will then be part of the script context, as long a additional data you can provide through redeemers.
So, you can indeed record the datum intended for the script in the transaction metadata, but it not mandatory. It is just a mechanism to recover the correct information in case it is not possible otherwise.
Now, for the "how to do that ?", the best is to study some open source code, like the one for the SpaceBudz market. It heavily uses the serialization lib to provide the different information required by this wallet.


text:
Cardano java lib
Can someone help me understand the below error message better. It first started appearing about 2 months ago when I mint tokens, and I cant seem to get to the bottom of it. I understand the BabbageOutputTooSmallUTxO to mean the output is from the tx is too small (ie. not enough input). The annoying thing is it worked well not that long ago
[cardano-wallet.wallet-engine:Error:9588] [2022-09-07 11:12:19.67 UTC] 9351a932: Transaction ef626e5b failed: ErrSubmitTxNetwork (ErrPostTxValidationError "TxValidationErrorInMode (ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (BabbageOutputTooSmallUTxO [((Addr Testnet (KeyHashObj (KeyHash \"d27f32....b0ae3\")) (StakeRefBase (KeyHashObj (KeyHash \"ca75b4....44af711c\"))),Value 172400 (fromList [(PolicyID {policyID = ScriptHash \"e89fd72....cdfdd5\"},fromList [(5275626265724d616e,1)])]),NoDatum,SNothing),Coin 1159390)]))])) BabbageEraInCardanoMode")

I have tested the transaction on Blockfrost and Cardano Wallet API and both produce the same error.
I am using https://cardano-client.bloxbean.com Java library to build the transaction using the methods suggested in the documentation and here https://satran004.medium.com/cardano-client-lib-minting-a-new-native-token-in-java-part-iii-1a94a21cfeeb
This is my decompiled transaction
{
    "burn": {
        "tokens": []
    },
    "certificates": [],
    "collateral": [],
    "collateral_outputs": [],
    "deposits_returned": [],
    "deposits_taken": [],
    "fee": {
        "quantity": 186929,
        "unit": "lovelace"
    },
    "id": "91d16f5c982b401b7c3d039c3bc8b213eea97f6dfbfc0b311682facf34e1627c",
    "inputs": [
        {
            "address": "addr_test1qql63uhskkchjsy74kjyx9tk8azsl9gfjxfk8rarnvsshn3sl2jjsnfkffuhuuug5vywcyh0704hpyldjrzjacts4qpqa40yu4",
            "amount": {
                "quantity": 500000000,
                "unit": "lovelace"
            },
            "assets": [],
            "derivation_path": [
                "1852H",
                "1815H",
                "0H",
                "0",
                "0"
            ],
            "id": "d5432926ad3397aeef7b4287ef6eb09a236e7484a8b7d88ad747e72814333b19",
            "index": 0
        }
    ],
    "metadata": {
        "721": {
            "map": [
                {
                    "k": {
                        "string": "version"
                    },
                    "v": {
                        "string": "1.0"
                    }
                },
                {
                    "k": {
                        "string": "2037e837ffb5536a8795f493ed14c1f91fc9130df3466386750168a1"
                    },
                    "v": {
                        "map": [
                            {
                                "k": {
                                    "string": "TestAsset-Meta"
                                },
                                "v": {
                                    "map": [
                                        {
                                            "k": {
                                                "string": "name"
                                            },
                                            "v": {
                                                "string": "My-Cool_NFT"
                                            }
                                        },
                                        {
                                            "k": {
                                                "string": "image"
                                            },
                                            "v": {
                                                "string": "ipfs://Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu"
                                            }
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        }
    },
    "mint": {
        "tokens": [
            {
                "assets": [
                    {
                        "asset_name": "546573744173736574",
                        "fingerprint": "asset1q0skl97csmvgxtewd2jrrpvdzw4hyg83wcyee2",
                        "quantity": 1
                    }
                ],
                "policy_id": "2037e837ffb5536a8795f493ed14c1f91fc9130df3466386750168a1",
                "policy_script": {
                    "script": "policy_vkh17g7njq60dfrx76xyelltw69lff2c6md7y2guhmdflxm2jgywwgz",
                    "script_type": "native"
                }
            }
        ],
        "wallet_policy_key_hash": "policy_vkh15cnjur9ld37p9gznxafzs2jtqf4qpxlyhwhccwt9kktt53gt76u",
        "wallet_policy_key_index": "0H"
    },
    "outputs": [
        {
            "address": "addr_test1qql63uhskkchjsy74kjyx9tk8azsl9gfjxfk8rarnvsshn3sl2jjsnfkffuhuuug5vywcyh0704hpyldjrzjacts4qpqa40yu4",
            "amount": {
                "quantity": 499640671,
                "unit": "lovelace"
            },
            "assets": [],
            "derivation_path": [
                "1852H",
                "1815H",
                "0H",
                "0",
                "0"
            ]
        },
        {
            "address": "addr_test1qrf87vnetzcmf4vdzhpyatzr90c036xpzkhsdjp4y5as4c72wk6fknuew0vvy6s7jklr2c92t7uf3plyuqvcw390wywql37usz",
            "amount": {
                "quantity": 172400,
                "unit": "lovelace"
            },
            "assets": [
                {
                    "asset_name": "546573744173736574",
                    "policy_id": "2037e837ffb5536a8795f493ed14c1f91fc9130df3466386750168a1",
                    "quantity": 1
                }
            ]
        }
    ],
    "script_validity": "valid",
    "validity_interval": {
        "invalid_before": {
            "quantity": 0,
            "unit": "slot"
        },
        "invalid_hereafter": {
            "quantity": 68437663,
            "unit": "slot"
        }
    },
    "withdrawals": []
}

I understand the BabbageOutputTooSmallUTxO to mean the output is from the tx is too small (ie. not enough input). The annoying thing is it worked well not that long ago

It might have worked in an earlier era (ie Alonzo) but my suspicion is that the rules have changed slightly for the new Babbage error.
The error message also gives the value of 172400 (in lovelace) as being too small and that value does appear in your transaction outputs. Again I suspect that value has increased slightly.

You were right. Thanks for the response

Does somebody know how to update the SDK? I would like to get documentations or something like this please <3

Yes the calculation of the min UTxO value has changed which is explained here. So Erik is correct!
I would try to update the library you're using to create your transaction, because whatever SDK or library you're using, I'd expect it to handle that change for you.

Thank you, I started using the beta version of the lib and it works now. I felt I had already tried it but anyway


text:
Secure pledge with hardware wallet
technical question for securing the pledge with hardware wallet.
Is it possible to have the pledged secured with ledger nano and not having to sign pool updates with it?
I mean, just have the ledger address as second owner for that purpose and every pool update, or actions signed just with normal keys?
Thank you!

Any wallet that is registered as an "owner" wallet (a.k.a. pledge wallet) must witness any submission of a pool certificate, even if the certificate is being submitted for a minor update. If the certificate is submitted without the witness of a (currently) pledged wallet, then that wallet will be removed from "pledge" status the following epoch.
In other words, all owners and/or operators of a pool must witness pool updates, or their wallet(s) will loose pledge status.

OK! Thank you! :)

If you follow the steps below and register as a Pledge wallet you must sign as a witness for any pool update transaction. No way around that.
You'll need to do a few things to set up the 2nd pledge wallet:

Set up your Ledger, delegate, make sure you do this 2 epochs before any pledge changes
Install this to interface with your Ledger
Export your staking keys
Copy your stake.vkey to your cold env and update your stake pool registration certificate. Make sure you have these flags sent in:

--pool-reward-account-verification-key-file [LEDGER-STAKE].vkey
--pool-owner-stake-verification-key-file [NON-LEDGER-STAKE].vkey
--pool-owner-stake-verification-key-file [LEDGER-STAKE].vkey \

Copy your pool.cert back to block producer and prep a new multi-signature transaction
You'll need 4 witnesses:
node.skey
[LEDGER-STAKE].hwsfile
stake.skey
payment.skey
Submit the transaction

Thanks mate, I think I will do it!


text:
How can I get notified offchain when a transaction is included in a block that is validated?
I need to do an offchain action in an application when a transaction is included in a block that is validated.
Is there a way to register a listener for such a notification? Or is there another mechanism?
Thanks!

There is no listener for it. Pooling it in an interval is a common way to do that. The Listening for ada payments using cardano-cli page is worth referring to.
You can also watch the chain from cardano-db-sync or from some Cardano API providers such as Blockfrost.io.
If you use Blockfrost.io, you could use the Websockets link for Blockfrost.io API to create a WebSocket subscription.

Did you find out a way to listen for transaction completion?


text:
How can I determine which smart contracts / script addresses are associated with which dApps?
I have seen numerous examples of blockchain explorers providing information about the on chain activity of specific dApps. For example:

opencnft.io aggregates data about various token marketplaces
cexplorer.io has a list of the most active contracts and their associated dApps
eutxo.org provides information on transactions associated with a specific dApp

How do all of these sites map smart contracts / script addresses to a specific dApp? Do they manually determine which smart contracts a dApp is using or is this info listed somewhere?

I could not even begin to guess how they are doing this. Instead I suggest you ask the people working on those sites.

One way of determining it is to interact with such a dApp and follow the money.

Do they manually determine which smart contracts a dApp is using or is this info listed somewhere?

Yes, they manually gather the data of which script hash belongs to which dApp. This information is not registered anywhere on the blockchain or in any official central place.
There are many ways to gather this information, as suggested in the comments you could use the dApp yourself and check the resulting Tx or simply ask the developers.
If you want to build a new app you could of course also scrape the data from other existing sources like the websites you have listed above.


text:
What is the numerator (supply) when calculating the pool saturation level?
The pool saturation level is calculated by dividing supply by the K parameter. What exactly constitutes supply in this equation?
We have the following pots of Ada (from the db-sync ada_pots tables):

UTXO
Reserves
Treasury
Rewards
Deposits
Fees

Obviously, reserves are not counted towards available supply but I'm not sure about the rest of these. Intuitively I would guess that only the "stakeable supply" should count leaving only UTXO and rewards but I'm not sure.

I think what you're looking for is the formula used here to calculate the "circulating supply" from the UTXOs plus "withdrawable rewards" (rewards minus withdrawals). (You should also find the "withdrawal" table in db-sync.)
https://github.com/input-output-hk/cardano-graphql/blob/831e74b8f19b67bb36ab667609ee2a294551ef44/packages/api-cardano-db-hasura/src/HasuraClient.ts#L122
cardano-graphql exposes it through this query:
query adaSupply {
  ada {
    supply {
      circulating
      max
      total
    }
  }
}

https://github.com/input-output-hk/cardano-graphql/blob/f76e944b70c3419ce5c4b56c6a35cdd904afccf0/packages/api-cardano-db-hasura/src/example_queries/ada/adaSupply.graphql
This will currently be 32167734340, and devided by k=500 gives you the current saturation level above ~64M.


text:
Mainnet genesis block output off by 1,000,000 Lovelace + what is the test Ada from mainnet genesis?
I have been studying utxos on the mainnet and have run into some interesting inconsistencies.
If you run this query against cardano-db-sync's cexplorer database:
select sum(value)
from block
inner join tx on block.id = tx.block_id
inner join tx_out on tx.id = tx_out.tx_id
  -- Get genesis block
where epoch_no is null
  -- Filter "test ada" (idk ctrl f "test ada" here https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/interesting-queries.md)
  -- FYI there is 100,000,000 lovelace worth of "test ada"
  and tx_out.value <> 1000000

----------------------------
3111248464500000000

You will get 31,112,484,645 Ada which is one ada less than the 31,112,484,646 Ada the Cardano website claims was created in the genesis block.
Any insight behind this single extra Ada would be greatly appreciated!
On that same note, the discrepancy becomes 99 Ada if we don't remove the "Test Ada". From what I've seen, the "Test Ada" has been incorporated into the utxo set as if it is normal Ada. Really curious as to what's going on here! I'm building tools for measuring Ada distribution over time and would like to be precise about the accounting.
Anddd if you're feeling extra helpful, I don't understand the story behind why outputs are omitted from genesis after the Allegra hard fork.
Sorry for multiple questions, thanks in advance!

The test ada entries was used for testing the redemption of ada from the genesis block (aka AVVM certificate process).

Ok cool, so after (if) it's redeemed it is just incorporated into the utxo set


text:
VSCode + Docker setup problems on Mac (Intel)
I am following the steps as described in the repository, using VSCode and Docker.
https://github.com/input-output-hk/plutus-starter
All the dependencies looks good, but it failed on building the cardano-node.
Failed to build exe:cardano-node from cardano-node-1.30.0.
Build log (
/Users/rogeriodeleonpereira/.cabal/logs/ghc-8.10.7/crdn-nd-1.30.0-7743fe52.log
):
Configuring executable 'cardano-node' for cardano-node-1.30.0..
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:
      _Lcjn0_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_prove", referenced from:
      _LcjgN_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_verify", referenced from:
      _LciZz_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_secretkeybytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_signKeySizzeVRF_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _LcjD1_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_keypair_from_seed", referenced from:
      _Lcj9q_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_sk_to_pk", referenced from:
      _Lcj6R_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_publickeybytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_verKeySizzeVRF_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _Lcjrs_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_proofbytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_certSizzeVRF_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_outputbytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRFzuzdcsizzeOutputVRF_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_vrfKeySizzeVRF_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_verify1_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
  "_crypto_vrf_seedbytes", referenced from:
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRFzuzdcseedSizzeVRF_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRF4_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRF5_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _crdnzmcryptzmprszm2zi0zi0zmac404e8e_CardanoziCryptoziVRFziPraos_zdfVRFAlgorithmPraosVRF2_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.a(Praos.o)
      _LshDn_info in libHScrdn-crypt-prs-2.0.0-ac404e8e.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)
cabal: Failed to build exe:cardano-cli from cardano-cli-1.30.0 (which is
required by exe:plutus-starter-pab from plutus-starter-0.1.0.0). See the build
log above for details.
Failed to build exe:cardano-node from cardano-node-1.30.0 (which is required
by exe:plutus-starter-pab from plutus-starter-0.1.0.0). See the build log
above for details.

Welcome to Cardano SE! As a new user be sure to take the [Tour].

Can you please provide some more context which instructions you are following exactly, so that the instruction can potentially be amended to be clearer?

These missing symbols _crypto_vrf_* are in libsoidum-vrf library. You seem to be linking the cardano-node against your systems provided libsodium. That sadly doesn't work as the official libsodium does not have the vrf extension.

Thank you for the answer. In my first attempt to build it, I got an error saying that libsodium was missing. I used brew to install it, and in my second attempt, I got the error you just commented. I will remove the libsodium version I have and I will try the version in the repository you shared.

After several more attempts, I figured out that I was building using the wrong terminal window. After changing my docker settings to increase the memory and swap sizes, I made it with no problem.

Can you accept this answer so the question will be closed since this is resolved?


text:
Is it possible to call the `mkValidator` inside the same / another `mkValidator` function for script composibility?
Supposed I have a validator below, checking only if the output value is locked by the same script.
{-# INLINEABLE mkValidator #-}
mkValidator :: TestingParam -> TestingDatum -> TestingRedeemer -> ScriptContext -> Bool
mkValidator param _ red ctx = case red of
  (MergeScript anotherParam) ->
    traceIfFalse "Script provided is incorrect" (valueLockedBy info (valHash anotherParam) == txOutValue ownInput)
  _ -> False
  where
    info :: TxInfo
    info = scriptContextTxInfo ctx

    ownInput :: TxOut
    ownInput = case findOwnInput ctx of
      Nothing -> traceError "input missing"
      Just i -> txInInfoResolved i

{-# INLINABLE typedValidator #-}
typedValidator :: TestingParam -> Scripts.TypedValidator TestingScript
typedValidator param =
  Scripts.mkTypedValidator @TestingScript
    ($$(PlutusTx.compile [||mkValidator||]) `PlutusTx.applyCode` PlutusTx.liftCode param)
    $$(PlutusTx.compile [||wrap||])
  where
    wrap = Scripts.wrapValidator @TestingDatum @TestingRedeemer

{-# INLINABLE validator #-}
validator :: TestingParam -> Validator
validator = Scripts.validatorScript . typedValidator

{-# INLINABLE valHash #-}
valHash :: TestingParam -> Ledger.ValidatorHash
valHash = Scripts.validatorHash . typedValidator

However, it then throws the error GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable OtherScripts.Testing.ReferenceTesting.valHash.
Another similar issue with supplying minting policy here:
Using `curSymbol` function in Validator script
Looked at several sources and stuck with this issue for months. Can someone advises me if it is a dead end current Plutus ability?
If so, happy to see if someone is interested in drafting a CIP for this together, since allowing to use mkValidator or mkMintingPolicy script externally allows another level of scripts composibility which I think is essential for Cardano smart contract to get into mainstream. Also, this would enable scripts to be composed more secured as validator could know the identity of other scripts they are interacting with, instead of just hardcoding-supplying a validator hash externally.

In this case, when compiling your validator, compiler is trying to compute a value (which is only available after successfully compiled your validator) to complete compiling your validator, thus, it's impossible case.
Your validator is parameterized validator so with each different parameter, it's different validator with different validator hash.
If you want to get outputs of the same validator with same parameter then, that's same validator with same validator hash so there is a getContinuingOutputs function you can use or findContinuingOutputs if you are only interested in amount. Also ownHash is available for getting the validator hash within the same validator.
If it's the case that you want to check an output is locked by the same validator but with different parameter, then it's no longer same validator, it's a completely different validator with different validator hash even if the source code is the same. In this case, you probably might want to provide validator hash directly to the validator via datum or redeemer rather than providing the different parameter which is not possible to compute hash from.

I am looking for checking whether some value is correctly paid to "certain parameterized scripts" while I dont know the script address beforehand. Certainly I could remove to parameter field to use getContinuingOutputs entirely, but sometimes I also want to enable it to look at other validator and minting script as well. Any thought any workaround instead of using above code to compute?

If you want to check for "another validator" and have the functionality at hands for future cases, i would suggest you to dynamically provide the validator hash to the validator either via datum or via redeemer.

About computing script's hash (minting script or validator) on chain, i am not sure if it's possible. Let's say, that, it's possible to compute hash on chain from script's binary. How are you going to put binary in the validator? Hard code it? or again, via datum or redeemer? We now came back to the first step. If binary can be hard-coded, why not the hash of it? Same question for datum and redeemer.

Script.validatorHash can not be compiled to Plutus Core (probably for good reason, as it would've resulted in much larger on-chain scripts).
As Erik mentioned, if you only need the hash of your current validator, ownHash is the answer. But if you want to recreate the validator hash of another script on the fly, that's not possible.
A typical solution is to provide this desired validator hash as a parameter to your current script, and therefore make it "aware" of your other script.

Is there any other work-around to calculate script address onchain? Even if others have provided the validator hash in, checking on it seems necessary to prevent bad actors on exploiting the script

Generating a script hash from parameters is a somewhat resource intensive task, so it may not even be possible to achieve that within the 16KB transaction size constraint.
This depends on your contract of course, but one solution might be for your script to demand the presence of a known asset (i.e. native token) from the arbitrary script you're trying to check. This has the additional benefit of making sure that said script is in fact capable of spending its UTxOs.

I suspect that this might actually be a GHC Template Haskell (TH) staging error. My understanding is that when you use TH in a file, it must all be expanded (TH is basically a macro expansion system) on the first TH evaluation pass.
Your function valHash calls typedValidator which includes TH functionality and then you are tying to call that within mkValidator which also uses TH. That is why I think you are actually hitting a staging error due to the implicit recursion of mkValidate -> valHash -> typeValidator -> mkValidate.
The current solution (not really that nice IMO) is to provide (ie hard code) the hash itself to mkValidate. You can probably also write a test to validate that the supplied hash is the same as the actual hash provided by TH.
Update: Apparently there is an ownHash in the Plutus libs that will give you the hash of a validator inside the same validator. I have not tried it.

How about I want to calculate the script address on chain to conduct the checking? Simply submitting a validator hash in provides loophole for bad actors to exploit. Is it somewhat impossible as mentioned by @KeyanM & @Tuvshintsenguun?


text:
Starting a new Plutus Project
I've read a few threads on Cardano Stack exchange on how to start a new Plutus project, but there doesn't seem to be a satisfying answer. I've read the following:

plutus starter course
How to Start a New Project

The answers suggests that we copy the Plutus Pioneer course and use the cabal.project file as a base to build on top of. But what if we the Plutus Pioneer course is over, surely there has to be a way to determine what the correct cabal.project file and its dependencies should be?
Another answer says to follow the plutus-starter repository: https://github.com/input-output-hk/plutus-starter. However this repository doesn't seem to be fully updated. The cabal.project file there hasn't been updated for the past 5 months.
So, the question is, when starting a new Plutus project, especially getting the correct dependencies and tags in the cabal.project file, ensuring that the correct tags are used for the repositories within it, what's the procedure to do this?
Thanks

Please take a look at this answer.

Great point, unfortunately IO has been a bit behind in regards to updating some of its skeleton repos as you've already pointed out.
In regards to the correct tags for repos - there is actually only one thing you have to be make sure is matching up and that's making sure the cabal.project file defines a plutus-apps dependency which references a git tag. That must match the commit you check out after cloning the plutus-apps repo.
After that you're pretty safe to run nix-shell in the plutus-apps repo and switch back to your project.
I've used the pioneer program cohort #3 as template.

The plutus starter is the ideal template to start with new Plutus projects and like William said the IOG repo is quite outdated at this time.
I have created an updated branch for the plutus-starter. I have been using it and it works. I made a PR for the IOG repo, but seems it yet to get attention :)
Here it is if you'd like to use.
https://github.com/gannith/plutus-starter/tree/track-plutus-apps

The official plutus-starter has a new release. https://github.com/input-output-hk/plutus-apps/releases/tag/v2022-04-06


text:
Error on cabal build - Encounterd missing dependesies
I followed the instructions on lecture one - part 3 and I was trying to start week 1 project.
When I run cabal build got the following error:
[nix-shell:~/plutus-pioneer-program/code/week01]$ sudo cabal build
Warning: The build command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-build command
or the legacy v1-build alias as new-style projects will become the default in
the next version of cabal-install. Please file a bug if you cannot replicate a
working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
[__0] trying: plutus-pioneer-program-week01-0.1.0.0 (user goal)
[__1] next goal: base (dependency of plutus-pioneer-program-week01)
[__1] rejecting: base-4.12.0.0/installed-4.1... (conflict:
plutus-pioneer-program-week01 => base^>=4.14.1.0)
[__1] fail (backjumping, conflict set: base, plutus-pioneer-program-week01)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: plutus-pioneer-program-week01, base
Trying configure anyway.
Configuring plutus-pioneer-program-week01-0.1.0.0...
cabal: Encountered missing dependencies:
aeson -any,
base >=4.14.1.0 && <4.15,
data-default -any,
playground-common -any,
plutus-contract -any,
plutus-ledger -any,
plutus-ledger-constraints -any,
plutus-tx -any,
plutus-tx-plugin -any

Could not resolve dependencies and cabal: Encountered missing dependencies is the errors here as far I can understand. I tried again by running cabal update and then cabal build but again I get the same error(s) that I described above. Any ideas? What am I doing wrong?

Why are you using sudo? Try without.
And update of course.

If I don't I get an access denied error. I tried with update and it does not work.

try "cabal update" before "cabal build".

I tried it and it still does not work. Thanks anyway.

Check and make sure that your version of the repo has the correct commit-id.


text:
I am getting a strange error when I try to start the playground server localy:
plutus-playground-server: for development use only
error: creating symlink from '/plutus/plutus-playground-server/result.tmp-10234-376872119' to '/nix/store/hf815gz6hs5px2nrnnvsdjcpf8m0dvwg-ghc-shell-for-packages-ghc-8.10.2.20201118-env': Permission denied
error: creating symlink from '/plutus/plutus-playground-server/result.tmp-10236-1766163927' to '/nix/store/a1g0yvyi27qjkapb04z75d5s8gf8jx6k-plutus-playground-server-exe-plutus-playground-server-0.1.0.0': Permission denied
/nix/store/rm5268gvw75mmh8mhcbb9rs817wvnfhj-plutus-playground-server/bin/plutus-playground-server: line 10: /bin/plutus-playground-server: No such file or directory

Any ideas? Why permission is denied and why it says No such file or directory?

I have same error error: creating symlink from... access denied

Do you have the directory "/bin/plutus-playground-server"?
You can search in bash like:
$ls /bin/plutus-playground-server
That command should return a result/output.
→ It now result is returned the directory "/bin/plutus-playground-server" is set wrong.


text:
How to Deploy / Write NFT Minting Plutus Script?
I am following through the third cohort PPP. With a week of course break, I wish to consolidate my understanding through practice. One exercise is to go through the deployment process of an NFT:

Construct the plutus script (e.g. homework of week 5)
Test it on the plutus playground / run the EmulatorTrace
Write the plutus file through a script like week 3's Deploy.hs.
Build & Submit the transaction on testnet

Following through Lars's lecture, there is no problem for step 1-2. However, I got stuck at step 3. The two relevant lines from week 3's Deploy.hs should be:
writeValidator :: FilePath -> Ledger.Validator -> IO (Either (FileError ()) ())
writeValidator file = writeFileTextEnvelope @(PlutusScript PlutusScriptV1) file Nothing . PlutusScriptSerialised . SBS.toShort . LBS.toStrict . serialise . Ledger.unValidatorScript

writeVestingValidator :: IO (Either (FileError ()) ())
writeVestingValidator = writeValidator "/Users/whatever/Desktop/Plutus-Pioneer-Program/testnet/vesting.plutus" $ validator $ VestingParam
    { beneficiary = Ledger.PaymentPubKeyHash "0d26b900ffa6a3234166ed76467e80fbd8e1f6bad938f75cb884ef6b"
    , deadline    = 1645113135000
    }

The logic should be calling the validator function from the Parameterized.hs at writeVestingValidator, then put it in writeValidator to output the plutus file. However, it cannot directly copy and paste for week 5's NFT haskell scripts as the Ledger.unValidatorScript takes in a Validator as parameter while there is no Validator type inside the NFT policy script.
I have found unMintingPolicyScript in the haddock to replace unValidatorScript, but to no avail. My final attempt is like below:
writeValidator :: FilePath -> Ledger.Validator -> IO (Either (FileError ()) ())
writeValidator file = writeFileTextEnvelope @(PlutusScript PlutusScriptV1) file Nothing . PlutusScriptSerialised . SBS.toShort . LBS.toStrict . serialise . Ledger.unMintingPolicyScript

writeNFTValidator :: IO (Either (FileError ()) ())
writeNFTValidator = writeValidator "/Users/whatever/Desktop/Plutus-Pioneer-Program/testnet/nft/mint-TokenWithMeta.plutus" $ (policy (Ledger.TxOutRef "f79a3a51ecc200b6ccfdb5d083652787fc3c389a30d9d5b75bcd883428b9c9d5#0") (TokenName "TestNFT"))

Sorry its kind of a mess, But somehow I get stuck here.
I have tried to look at different guides, the first is from official Cardano documentation https://developers.cardano.org/docs/native-tokens/minting-nfts/. It doesn't solve my doubt as it seems not using plutus script to mint the NFT.
Another guide (Is there a good tutorial to mint Cardano NFT using plutus script?) has a walk through on deploying NFT plutus script, however, it uses a cabal command link cabal run create-nft-script -- PlutusScriptNFT 6c1160302bff7c84b347e6c9c1cf78cbafc8821efc730f6271589fcd848635f7#0 to serve the purpose. However, I want to perform the write script through haskell script so it can be more repeatable when I start building more complex validator or policy.

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.


text:
How to start plutus pioneers course on canvas
Today is the course start date for pioneers program.
But when i login to canvas, i am not getting any content.
I checked the announcement board and it just shows me up course syllabus and the teacher's bio.
how am i supposed to start learning within the canvas?
thanks!

This is to confirm that I see the same thing, and it seems there is no info on how to proceed.

Hi Shimelis! The first module will be posted on Thursday, but in the meantime pioneers are working on dev env setup-- discussions occurring in Discord. NOTE-- Generally avoid posting questions about how the course is run here in CSE, as such questions tend to have short term utility. I realize initial Canvas setup was confusing, a recent update there + getting into discord should make things clear.

Yes today is the beginning of the Plutus Pioneer 3rd version. However, there are some technical set ups to go through before the first lecture is published, which will occur on Thursday 13th. Some news will come up soon, but I suggest you have a look at
https://docs.plutus-community.com/docs/setup/Ubuntu.html
Where you can sort your set up for your preferred OS (lectures are outdated but the set up should be the same)

Thanks @Igodlab and @Antonio - CSP.
I am thinking to continue with with playground setup.
I didn't want a local setup on my machine.
What do you suggest on this?
pros and cons kind of advice.

The first lesson will be released on Thursday 13 as mentioned in the communication on Discord. In the meantime you can start with the setup of the Plutus environment.


text:
can i use the live playground platform, instead of local installation?
I wen through the environment setup detail and  got a problem.
The thing is my laptop is running out of resources. so i decided to utilize the online playground
environment for the tutorial. I just didn't want to make a local installation.
Tell me your words about it.
Thanks all in advance

At the time of writing playground platform isn't up to date. Progress about this issue is tracked here https://github.com/input-output-hk/plutus-apps/issues/195

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

As the online Plutus Playground is not available at the moment (see
here), and your local computer doesn't have the required resources (around 35GB of disk and 8GB of RAM), I'd recommend to run it in a Linux virtual machine in the cloud (AWS, Azure, Google Cloud, etc.), where you'll be able to pay only for the minutes of running time plus a small amount for the storage if you want it to persist, or you can look for a traditional VPS hosting that you can find for less than $10 a month. Cheers!


text:
On-chain and Off-chain code
I've seen the existing similar questions on this topic. I probably still don't get it. So a question:
Is it a correct analogy to the JS-Solidity world that

the On-chain code corresponds to the SmartContract code I write in Solidity (and lives and executes on each node), while,
the Off-chain code corresponds to the JS client code that shows the UI, prepares and invokes the transaction calls made into the blockchain, and executed by the Smart Contract?

Yes, that's correct. On-chain is exactly what it says. It's logic that happens on every validator syncing the chain. The unique thing with plutus is the on-chain and off-chain code can live together and share e the same types/imports.


text:
Stake Pool Pledge: Must the pledge amount be part of the active stake? Is Live stake okay?
I understand the pledge must be met by the stake pool owners. My question is basically if ada is added it takes 2 epochs to become active stake.
Can I increase the pledge amount immediately after the ada is added to the owner wallet or should I wait 2 epochs until the amount is active?

Can I increase the pledge amount immediately after the ada is added to
the owner wallet -

Yes.

or should I wait 2 epochs until the amount is active?

No.


text:
Is there a limit to the number of tokens you can have at 1 single UTXO?
I believe this situation applies to both native tokens and NFTs.
I'm aware that at a single UTXO we can have multiple tokens. For example:
20000 lovelace + 10000 policyid1.tokenname1 + 1000 policyid2.tokenname2

I am aware that there is a transaction size limit but will anything up to that limit be valid?
I'm wondering if it's better to purposely just split it up into multiple tx-outs and create multiple UTXOs so when the UTXOs are spent those transactions will be much smaller. In this case something like:
    1000000 lovelace + 10000 policyid2.tokenname2
    1000000 lovelace + 10000 policyid1.tokenname1

Both methods are perfectly fine to implement, but your answer to the limit is correct. Any number of tokens up to the TX size limit will work. For NFTs you'll want to factor in the size of the metadata as well - that increases the overall TX size.


text:
Getting PubKey from bech32 address
The verification key is referred to as public. Could it be derived from the bech32 address?
e.g addr1... -> Pubkey [cborHex]

This has been answered before here

Incorrect. I do not need the pubKeyHash, rather the PubKey itself

not directly, but there are some PubKeys in metadata or Plutus datums, you can scrape the blockchain and build an incomplete dictionary

No, the public key (also verification key) cannot be derived from a bech32 address. Only the hash of the public key is encoded in the address.
The verification key is secret as long as it is not used to spend some value from one of the corresponding addresses. When such a transaction is onchain, then you can extract the public key from it (1)(2).

What is the purpose of PubKey? I thought it can be used to verify the signing key (skey). I thought PubKey itself is s type of hashing of skey

The public key is derived from the signing key, and is used to verify the authenticity of a signature. To obscure the public key onchain a hash of it is used in the addresses. A reason to use this is to have a fixed length to represent things. Both a script hash and a public key hash have the same lenght.

Where can I learn about how the verification of signing a tx is done. Say there is one untxo as input, and one signing key given. What is the algorithmic procedure that is done on utxo hash plus skey that guarantees legit signature?

Onchain you can use https://github.com/input-output-hk/plutus/blob/fd927b1b9cb3292ed3409b0d40f0dcf627e13323/plutus-tx/src/PlutusTx/Builtins.hs#L133. What is your goal?

My goal is to educate myself more about Cardano. I would like to have an understanding of high verification is done. This will widen my knowledge about the chain.

As Fermat said, the Bech32 address only contains the PubKey Hash, and therefore we can't reverse it to obtain the PubKey.
The purpose of PubKey is to act as Verify Key, that will verify the authenticity of a signed transaction with its signature
You can refer to this video by Andrew, it will explain how addresses work in Cardano
Video: Cardano Addresses

Hello, Andrew's videos are insightful. I am aware that only the hash of the PubKey could be derived from bech32. Ok, maybe an alternative answer would be how can the witness set be retrieved for a given transaction? After all, BP nodes need to verify Tx's and PubKey purpose is to be shared to validate the owners signature

I haven't found the answer to that either. My assumption is that every time we submit a Tx, we send our SignedTx and our PubKey. I assume you already know how UTxO works, so now the BP node could check the input UTxO address, and compare it with our provided PubKey. If the hash of that PubKey matched, now the PubKey is used to verify the SignedTx. The design decision for this architecture would be to reduce data stored in the blockchain, because we don't have the full PubKey stored in it, just the hash of it

Transactions on chain only have the input utxos and the recipient outputs. I can not find where on chain does the pubkey get stored and attached to a transaction neither its hash

The address IS the PubKey hash, refer to CIP-19. For example, in this transaction we can get the PubKeyHash through bech32 decoding which is addr1q85cjaunup5pjnfuup244v78ccan2mykhhm346fqcf9heqqh8l0k78a59nm52ahfkxpx5r2sucupdaqvdxfk03fqp9kqqagfvq --> 01e9897793e068194d3ce0555ab3c7c63b356c96bdf71ae920c24b7c80173fdf6f1fb42cf74576e9b1826a0d50e63816f40c699367c520096c. Take the first 56 character after 01, and you get the PubKeyHash


text:
Retrieve Witness Set from Transaction ID
Is there a tool or method to get the set of witnesses (public keys) of a transaction given the transaction ID?

If you have the Tx file, you can use $ cardano-cli transaction view --tx-body-file tx.raw to view the witness set. But, if you specifically want to extract from a given Tx ID, you can extract the witnesses' information through their input UTxO. The UTxO contains an address that is made up of a hashed public key, and from there you can list the public key hash needed for this transaction, also known as the witnesses required
Edit:
According to this thread the witness information is actually in the blockchain, but not currently possible to extract it using db-sync. Reference to this specification for proof that the blockchain indeed stored the witnesses' key


text:
How to log/trace/print messages from within the contract ON-chain code, while using cardano-cli?
I'm wondering how to log/print/trace any message during the execution of a contract when submitted to the blockchain via cardano-cli.
So basically I hoped this very simple test script would show me something:
mkValidator :: ContractInfo -> () -> () -> ScriptContext -> Bool
mkValidator _ _ _ _ = (traceIfFalse "Test" False) || True

However, when submitting a transaction with this script to cardano-cli, it gets executed without printing anything.

Your validator is basically False || True, which will always return True. The value from traceIfFalse is only passed to the user if the final result of the validator is False.
So if you are using the most recent version of cardano-cli the error should appear once you try to build a transaction removing the || True part. If you want, however, to log an error even when the validation succeeds, this is impossible with Plutus, at least on-chain.


text:
Is there away to retrieve the senders addresses of a transaction from its hash, using cli?
Is there away to retrieve the senders addresses of a transaction in cli commands, given the transaction hash? How do APIs (like blockfrost) get this data?
I know db-sync stores the data, but how does db-sync know in the first place about these details that are not directly retrievable from the ledger?

You would have to use cardano-db-sync - it is a service that stores ledger (chain) data into a more easy-to-work-with SQL structure. Otherwise, one would have to parse raw chain data (incredibly inefficient), which is why a framework like db-sync is so useful.
All the API's like Blockfrost or Cardanoscan use db-sync at backend to provide their services.

I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my wor

like the other colleagues mentioned it is not possible from cli.
what i would recommend is to

create account in https://blockfrost.io/
take a Project ID

and then "curl" info from the DB using the command below
curl -H 'project_id: Insert_here_youProject_ID'
https://cardano-mainnet.blockfrost.io/api/v0/txs/${tx_hash}/utxos
| jq '.inputs' | jq '.[0]' | jq '.address' | sed 's/^.//;s/.$//'
TX_Hash, you can receive it from
cardano-cli query utxo --address $myAddr --mainnet

I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my work

i dont know if that here is clear for you. github.com/input-output-hk/cardano-db-sync - The purpose of Cardano DB Sync is to follow the Cardano chain and take information from the chain and an internally maintained copy of ledger state. Data is then extracted from the chain and inserted into a PostgreSQL database. SQL queries can then be written directly against the database schema or as queries embedded in any language with libraries for interacting with an SQL database. - i am learning also, and i read so many related infos here –

Yeah I understand, I have been developing on Cardano for awhile now. I like most of the concepts but the fact that you cant get info of input and output addresses is frustrating. It would be much more robust for the ledger to include these info. I know main reason is size and all, but still. Anyways thank you a lot

With Cardano-cli you can only query your UtxOs to get the corresponding tx hash. Unfortunately, there is nothing to go deeper and get additional information.
I dont' understand what you mean by "are not directly retrievable from the ledger", but yes, db-sync has access to this information.

The purpose of Cardano DB Sync is to follow the Cardano chain and take
information from the chain and an internally maintained copy of ledger
state. Data is then extracted from the chain and inserted into a
PostgreSQL database. SQL queries can then be written directly against
the database schema or as queries embedded in any language with
libraries for interacting with an SQL database.

However, you need some non negligible resource to run db-sync. What Blockfrost does is "just" to wrap a web API around the DB in order for everyone to get an easy access to it. Blockfrost is the easiest way to retrieve your sender address.

I am familiar with db-sync and APIs that provide services to provide users with more details than can be found in the ledger. But how does db-sync know this in the first place? since only the utxo hashes are available at the input of a transaction. I am currently using blockfrost, but with congestion it is my weak point and there are times it does not respond, which miss up my work

I don't know exactly how, but a transaction references the Utxo it consumes. This reference is made up of a Tx Hash and UtxO index (from a previous transaction). But, the referenced UtxO belongs to some address, so, somehow, you can get the sender.