text:
How to build a script transaction if the validator expects it to be signed
Given the following smart contract:
{-# INLINEABLE mkValidator #-}
mkValidator :: PubKeyHash -> BuiltinData -> ScriptContext -> Bool
mkValidator beneficiary _ ctx =
  traceIfFalse "tx not signed by beneficiary" signedByBeneficiary
  where
    info :: Ledger.TxInfo
    info = scriptContextTxInfo ctx

    signedByBeneficiary :: Bool
    signedByBeneficiary = txSignedBy info beneficiary

It only allows consumption of its' UTxO if the transaction is signed by a key that's part of the UTxO's datum.
I've sent some funds to the script address and verified the datum is correct.
Now I'm trying to create a transaction that consumes a UTxO from the script address with the cardano-cli transaction build command. However, the command runs the script validator locally before I've had a chance to sign the transaction. Therefore, the command fails with error PT5: tx not signed by beneficiary. This is expected because during that validation, the signature is not available in the ScriptContext.
How can I, either disable the local validator check, or attach a signature to the ScriptContext so the validator succeeds? I've tried the --required-signer option on the cardano-cli transaction build command but to no luck.

The failing command:
cardano-cli transaction build \
--alonzo-era \
--testnet-magic 1097911063 \
--tx-in 213b67f21034e4f4684b871da9a8c7a1ed867ff2eef02232c064e2004b7dc316#1 \
--tx-in-script-file Owner.plutus \
--tx-in-datum-value "\"$(cardano-cli address key-hash --payment-verification-key-file payment.vkey)\"" \
--tx-in-redeemer-value 0 \
--tx-in-collateral 213b67f21034e4f4684b871da9a8c7a1ed867ff2eef02232c064e2004b7dc316#0 \
--change-address $(cat payment.addr) \
--protocol-params-file pparams.json \
--out-file tx.build

How are you constructing the --required-signer part of the command? It should be able to solve the problem you have.

I have payment.vkey and payment.skey. While the verification key (vkey) was used to create the datum value, I used the signing key (skey) for the required signer: --required-signer payment.skey. Since the ordering matters, I used the option right after the --tx-in-redeemer-value option.

I am afraid that via the cardano-cli, you will not be able to do that. Indeed the cli evaluates the execution units before you get to sign the transaction.
Signatories are however available in the script context from a Plutus standpoint. Right now, I don't know any other way than doing it "the Haskell way" and by pre-constructing the transaction via the very same Haskell libraries used by the cardano-ledger. This will allow you to construct the script context necessary for your script to validate. A way to approach this is typically by running your script considering an unlimited budget, and then, replace this "unlimited budget" with the actual cost of execution that your observed -- hoping that this won't change the cost.
Incidentally, calculating script execution for a transaction is a kind of chicken-and-egg situation. For example, you need to know the execution cost of your script in order to balance your transaction for fees, but adjusting outputs for fees may also change the execution cost of your script. To avoid this, the cardano-cli was designed in a way that makes this process easy and deterministic. Yet, it comes with some drawbacks for scripts like yours which require some extra context.
Another option is to raise this as an issue to the team working on the cardano-cli (Github issues) to let them know of the design issue.

Thanks for the answer! Would using PAB be suitable in this scenario? Or using the Emurgo's serialization library: https://github.com/Emurgo/cardano-serialization-lib?

Yes, or cardano-wallet directly as well.


text:
Does the redeemer have to be from a wallet address/contract?
Could a contract be programmed such that the redeemer seemingly comes from nowhere from what the node / someone monitoring the blockchain could tell? I am thinking if you gave the contract some ada and had it pay fees automatically out of itself, you could run totally anonymous logic. Are there restrictions preventing you from doing this?

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

You seem to be misunderstanding how smart contracts work on Cardano.

Does the redeemer have to be from a wallet address(?)

Redeemers don't come from wallet address, they are included on transactions. And transactions must be created by a user off-chain.

I am thinking if you gave the contract some ada and had it pay fees automatically out of itself...

There is no such thing as automated smart contracts in Cardano. The datums at script address only change state as a result of a transaction submitted from off-chain.

I can't imagine how you'd do that.  The validation nodes control fee distribution, only relying on the TX to provide the fees, but not relying on the TX to tell them how/where to distribute them.

I was thinking since in the eUXTO model the redeemer is arbitrary, you could pass unit () as the redeemer. The validation script could be programmed to always accept () and pay a small amount of fee to the node, and the rest to some value in the datum. This is how I would do it in my head, but I don't know if Plutus actually allows this.

source: Stack Exchange

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

sort: votes


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.

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


text:
How do I build the Plutus starter template?
Having trouble building the starter-template: https://github.com/input-output-hk/plutus-starter
$ cabal build
Warning: Requested index-state 2021-08-14T00:00:00Z is newer than
'hackage.haskell.org'! Falling back to older state (2021-08-13T22:58:51Z).
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] next goal: cardano-crypto-class (user goal)
[__0] rejecting: cardano-crypto-class-2.0.0 (conflict: pkg-config package
libsodium-any, not found in the pkg-config database)
[__0] fail (backjumping, conflict set: cardano-crypto-class)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cardano-crypto-class

Not too much information to go off. However, the warning is fairly explicit insofar as telling you what the problem is. Since the plutus-starter repo does suggest trying to run cabal update if you get issues resolving dependencies, I assume you have tried that?

Okay, so I tried to replicate your issue (I'm using nix+cabal), but my cabal build works fine (I got some warnings, but everything compiled). Thus, all I can suggest is that you reclone the repo and try again, I've outlined the steps below, but they can be found in the plutus and plutus-starter repo:
Check your /etc/nix/nix.conf and ensure that you've followed the procedure to set up the binary cache, which it looks like you've already done. At the very least perhaps check to ensure that the /etc/nix/nix.conf matches the config found in the Plutus README.
Clone the plutus-starter repo:
git clone git@github.com:input-output-hk/plutus-starter.git

Change directory into it:
cd plutus-starter

Run a Nix Shell (pretty important, nix manages your environment, not just your cached packages):
nix-shell

Update cabal:
cabal update

Try again:
cabal build

If you're still having issues, then it would seem to me that you'll have to manually change the version of cardano-crypto-class that you're using.
If you're still having issues, some more information may be helpful.

I didn't understand I needed to use nix.
I'm trying to use it now, but it's been building for 3 hours and I have no idea how much longer it's going to keep building. Is there a way to see progress? So far it's up to 17Gb

You've likely not set up the binary cache properly. This has been a massive issue recently, especially for people using M1 RISC chips from Apple. If you're using an intel based machine, the steps outlined in the Plutus README should work. If you're using an M1 machine, I suggest you take a look at this guide.

I'm confused; should I build Plutus Core first?

I think plutus-core is included within the binary cache when you boot up a nix-shell from the root project of plutus-starter, so when you run cabal build, it'll build much faster. Limited knowledge of nix, but I assume you're completely unfamiliar with it? Nix provides a way to manage environments, such that you can have different versions of dependencies for different projects on your local file-system (and it's easy to switch between them). It also provides an 'in-network' cache, so you can pull down heavy pre-built dependencies from a shared address, so it's important to set up.

You're likely building a version of GHC, or perhaps some other heavy dependency that you otherwise wouldn't need to if the binary cache for Nix was set up properly. Perhaps do some reading on nix, such that you have a better understanding of what it actually does? Then things may become clearer.

The instructions you linked me to are for building Plutus Core, not for building Plutus Starter. They say to edit a /etc/nix/nix.conf file, but I have no such file (I installed nix with curl -L https://nixos.org/nix/install | sh)

If you read through the README in plutus-starter, it references the README in plutus, specifically: "Set up your machine to build things with Nix, following the Plutus README (make sure to set up the binary cache!)." - that's why I have also linked the plutus repo.

Okay, but I still can't find a nix.conf file anywhere (in either of the two locations mentioned). I'm on Ubuntu 20.04

Right, I do remember reading somewhere (but I can't remember where, unfortunately, so I can't reference it) that if you do not have a /etc/nix/nix.conf, then you should simply create the directory and place the file in there. Again, I'm no nix guru, but I've done a lot of reading on it in the last day or two, and from what I understand, It may only be included in the multi-user version of nix, which may be why you don't have it. The last thing I can suggest is simply crating it and following the nix binary cache guide in the plutus readme. Good luck.

Oh, it's directly underneath the instructions in the 'setting up binary cache' section in the plutus git repo, silly me! See: "If you don’t have an /etc/nix/nix.conf or don’t want to edit it, you may add the nix.conf lines to ~/.config/nix/nix.conf instead. You must be a trusted user to do this." - and that is for non-NixOS machines, so perfectly fine for Ubuntu 20.04 LTS, I've built a plutus-node from source on 20.04 not too long ago, so you should be good if you follow the instructions.

Yes I saw that,
But as I was saying, I don't have a ~/.config/nix/nix.conf either

In any case, it finished building the slow way, so I guess I'm done for now

Great. However, I would still urge you to set up the binary cache. Lastly, see: https://stackoverflow.com/questions/63142127/where-is-nix-conf-located-when-installed-on-osx - I know it's for Mac, but it looks like the same issue, it does just say create the file. Regardless, I hope this helped & good luck working on projects in the future.

Does this repo https://github.com/input-output-hk/plutus-starter not need updating check dates below:
...:~/plutus-starter$ cat cabal.project
index-state: 2022-02-22T20:47:03Z
packages: ./.
-- You never, ever, want this.
write-ghc-environment-files: never
-- Always build tests and benchmarks.
tests: true
benchmarks: true
-- Plutus apps revision from 2022-04-06
source-repository-package
type: git
location: https://github.com/input-output-hk/plutus-apps.git
tag: v0.1.0
subdir:
doc
freer-extras
playground-common
plutus-chain-index
plutus-chain-index-core
plutus-contract
plutus-example
plutus-contract-certification
plutus-ledger
plutus-ledger-constraints
plutus-pab
plutus-pab-executables
plutus-playground-server
plutus-script-utils
plutus-streaming
plutus-tx-constraints
plutus-use-cases
web-ghc
...


text:
How to Remove Burned NFTs from SQL Output
I am querying the Cardano Postgres DB and can't figure out how to remove NFTs (multi-assets) that have been burned. In the SQL query below, I am selecting the mint transactions for an asset fingerprint that I know to be a duplicate (meaning there was a burn associated with it). The SQL output is below.
After doing some manual research I was able to figure out that the 3rd row in the output is a mint transaction that 'burned' the 1st row's mint transaction (Hence the -1 quantity). The 2nd row is the NFT that is active today.
However, I am unsure how to know the 3rd transaction burned the 1st row and not the 2nd row. I would like to have my SQL script automatically remove the 1st row and only show active (not burned) NFTs.
Any help would be greatly appreciated. Thanks! :)
P.S. Here are the same mint transactions on Cardano scan: https://cardanoscan.io/tokenminttransactions?assetId=b92f6473f18d4b78733d022fd89f3cacc1484fab6eddfd3c5d4b949444503030383436
with policy_assets as (
    select
        id as ma_id
        , encode(policy, 'hex') as policy_id
        , name
        , fingerprint
    from multi_asset
    where encode(policy, 'hex') = 'b92f6473f18d4b78733d022fd89f3cacc1484fab6eddfd3c5d4b9494'
    order by id
)

-- Dupe asset fingerprint
select *
from ma_tx_mint m
inner join policy_assets p
    on m.ident = p.ma_id
where fingerprint in ('asset1x0hrrjs6xtmhnwy8ee60j2jrn4k005awqum4zd')
order by m.id

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

You need to join all the assets for a policy to their transactions and join the transaction addresses to stake addresses. If the most recent transaction has a null stake address that means it's been burned.
select
  a.nft_name,
  sa.view
from
  (
    --selecting (nfts x tx) grouped by most recent tx
    select
      nft_name,
      max(tx_id) as tx_id
    from
      (
        --entire raw set
        select
          convert_from(
            concat('\x', encode(asset.name, 'hex')) :: bytea,
            'UTF8'
          ) as nft_name,
          sa.view as stake_address,
          tx.id as tx_id
        from
          ma_tx_out matx
          inner join multi_asset asset on matx.ident = asset.id
          inner join tx_out tx on tx.id = matx.tx_out_id
          left outer join stake_address as sa on tx.stake_address_id = sa.id
        where
          asset.policy = decode('SOME_POLICY_ID', 'hex')
      ) a
    group by
      nft_name
  ) a
  inner join tx_out tx on tx.id = a.tx_id
  inner join stake_address as sa on tx.stake_address_id = sa.id
order by
  a.nft_name;

The left join to stake address inside the inner query will provide your records where the max tx_id is associated with a null stake id, and the outermost inner join to stake address will filter that result out of the return set.

All tables (other than the epoch table) are designed to be append only (ignoring rollbacks). That means that you need to modify your SQL query to filter out the items that you do not want to see.

Do you know how to modify the SQL to filter out a burned NFT?

I don't know how to do it, but you would start with a query that only returns the burned NFTs and then use that as the filter.


text:
How to connect WSL cardano-cli to Daedalus cardano-node on Windows?
I have the Daedalus wallet/node desktop app installed on Windows 10. And I also have the cardano-cli set up on WSL2 Ubuntu 20.04.
How can I point my WSL cardano-cli to the cardano-node that's inside Daedalus?
Most instructions say to do this:

export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep mainnet | sed -r 's/(.*)node-socket //')

But that's in WSL and I don't think it can see Daedalus in the Windows OS.
So, how do I find the socket path of Daedalus on Windows 10? And after that can I simply assign it to CARDANO_NODE_SOCKET_PATH?

You can't. WSL is a linux container on windows that expects a POSIX socket and Daedalus on windows uses named pipes. They aren't compatible. You may be able to symlink the state directory from Daedalus to WSL and stop daedalus and run a node in WSL, although I've never tested this and don't know if it would work.


text:
npm run start in plutus-playground-client throws several "Could not find module" errors
I'm trying to run the plutus-playground-client. My OS is macOS Big Sur 11.6.2
I have set up the environment with the following steps based on the nix install instructions from:
https://docs.plutus-community.com/docs/setup/MacOS.html
and the playground setup instructions (on page 2) from:
https://docs.google.com/document/d/13112LHG9vVvNUs40oZSqZ-DF6_yFiT_SJZ2NaEmjMM4/edit#
These are the exact steps I've taken for setup:
# install nix
$ sh <(curl -L https://nixos.org/nix/install) --darwin-use-unencrypted-nix-store-volume

# check version
$ nix --version # prints (nix (Nix) 2.5.1)

# edit nix conf file
$ sudo nano /etc/nix/nix.conf

# after edit, contents of conf file are
build-users-group = nixbld
experimental-features = nix-command
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=volume

# restart Mac (confirmed this step is needed, or cache isn't recognized)

# clone plutus-apps repo
$ git clone https://github.com/input-output-hk/plutus-apps

# cd into plutus-apps
$ cd plutus-apps

# checkout latest commit
$ git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a

# build server (confirmed after mac restart, cache is recognized and this builds in 1-2 min)
$ nix-build -A plutus-playground.server

# enter nix-shell (as expected, first time always takes ~1 hour)
$ nix-shell

# once in nix-shell, run playground server
$ cd plutus-playground-client
$ plutus-playground-server

# server builds successfully, output printed below:
plutus-playground-server: for development use only
[Info] Running: (Nothing,Webserver {_port = 8080, _maxInterpretationTime = 80s})
Initializing Context
Initializing Context
Warning: GITHUB_CLIENT_ID not set
Warning: GITHUB_CLIENT_SECRET not set
Warning: JWT_SIGNATURE not set
Interpreter ready

# in second terminal, enter nix-shell
$ nix-shell

# attempt to run client
$ cd plutus-playground-client
$ npm run start

client starts building, but always runs into the following error.
plutus-playground-server: user error (Error evaluating simulation: InterpreterError (CompilationErrors [CompilationError {filename = "\n/private/tmp/web-ghc-work-81ca65233755c126/Main.hs", row = 2, column = 1, text = [" error:","    Could not find module \8216Playground.Contract\8217","    Use -v (or `:set -v` in ghci) to see a list of the files searched for.","  |","2 | import Playground.Contract","  | ^^^^^^^^^^^^^^^^^^^^^^^^^^"]},CompilationError {filename = "/private/tmp/web-ghc-work-81ca65233755c126/Main.hs", row = 3, column = 1, text = [" error:","    Could not find module \8216Plutus.Contract\8217","    Use -v (or `:set -v` in ghci) to see a list of the files searched for.","  |","3 | import Plutus.Contract","  | ^^^^^^^^^^^^^^^^^^^^^^"]},CompilationError {filename = "/private/tmp/web-ghc-work-81ca65233755c126/Main.hs", row = 4, column = 1, text = [" error:","    Could not find module \8216PlutusTx.Prelude\8217","    Use -v (or `:set -v` in ghci) to see a list of the files searched for.","  |","4 | import PlutusTx.Prelude","  | ^^^^^^^^^^^^^^^^^^^^^^^"]}]))
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! plutus-playground-client@1.0.0 start: `plutus-playground-generate-purs && npm install && npm run install:spago && npm run build:webpack:dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the plutus-playground-client@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gmoratorio/.npm/_logs/2022-01-14T20_08_36_926Z-debug.log

It looks like it can't resolve several dependencies
Playground.Contract
Plutus.Contract
PlutusTx.Prelude

but I can't figure out how to fix the resolution.
I've tried wiping my install and starting over several times including running
nix-collect-garbage
nix-build -A plutus-playground.server

after reinstalling nix, and every time I get the same dependency resolution error.
Any help or ideas would be appreciated

This solution https://cardano.stackexchange.com/a/6451/2758 is what finally did it for me:
GC_DONT_GC=1 npm run start

instead of just
npm run start
Heads up to anyone else seeing this issue!
Edit: to clarify, I'd already seen that post, but when OP said the cache clear had resolved the issue for him, I figured it was something else affecting my build (and it was). Thanks to the last commenter on that thread!
Edit2: immediately after solving this issue I ran into dependency issues when trying to compile in the playground. This was resolved by restarting the server with the same prefix
GC_DONT_GC=1 plutus-playground-server

and then reconnecting the client. This post also contains additional steps - https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md

I can confirm this worked for me, darn GC_DONT_GC=1.  macOS i7 monterey (v12.1). Else when I compiled in the playground I got "error Could not find module"

This solution fixed it for me: https://stackoverflow.com/questions/42308879/how-to-solve-npm-error-npm-err-code-elifecycle

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
nix-build -A plutus-playground.client Error
I am part of cohort 3 and setting up on Mac OS also (Big Sur); I am following the notes here:https://docs.plutus-community.com/docs/setup/MacOS.html
Was able to complete Step 9 (build library). But on Step 10 I get this error:
attribute 'plutus-playground' in selection path 'plutus-playground.client' not found
I tried suggestions in other threads (such as edits to nix.conf). And continuing to fishing around. Meanwhile trying to see if anyone else crossed this chasm....

You could try my simplified setup repo/instructions here: https://cardano.stackexchange.com/a/6464/382

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

Try building the PAB library as stated in the README:
cd .../plutus-apps
nix build -f default.nix plutus-apps.haskell.packages.plutus-pab.components.library
nix-shell
cd plutus-playground-client
plutus-playground-server

That worked for me.

Thank you for trying to help. Unfortunately I still get a (similar) errors:
error: attribute 'plutus-apps' in selection path 'plutus-apps.haskell.packages.plutus-playground-server' not found
error: attribute 'plutus-apps' in selection path 'plutus-apps.haskell.packages.plutus-playground-client' not found
Assume you tried on Big Sur also?

@Siva No I am currently running on Monterey. In the tutorial it states to clone https://github.com/input-output-hk/plutus.git but that should be updated to https://github.com/input-output-hk/plutus-apps.git. Have you tried with this repo?

Ok; I followed this link:
https://cardano.stackexchange.com/questions/6380/plutus-playground-client-crashes-on-intel-mac-big-sur
After running for nearly 12 hours and after countless Warnings and Errors, it finally completed. And I enter the Plutus Pioneers Shell Tool welcome message. I am also able to access docs at/localhost:8009/doc. And cardano-cli query tip --testnet-magic 1097911063 works fine.
So something is working! I am sure to find land mines as I go thru rest of pre-work.

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

So glad our improved setup heped you @Siva


text:
/bin/plutus-playground-server: No such file or directory
Can't get plutus-playground-server to start.
plutus-playground-server: for development use only
/nix/store/601kdlvidgan842yfklrmvpbz6a5xkf7-plutus-playground-server/bin/plutus-playground-server: line 10: /bin/plutus-playground-server: No such file or directory
git version: 41149926c108c71831cfe8d244c83b0ee4bf5c8a

Having the same issue and not sure what the problem is! Maybe an issue with latest in the HEAD of plutus-apps repo? Not sure! The dev experience so far is absolutely terrible

I found a solution for this that you can read in the document I wrote to setup Plutus dev environment on your local machine ( https://www.punkbit.com/hacking/plutus-developer-environment-setup-on-macos-monterey/#6-run-the-plutus-playground-service-and-frontend).
The issue is related to a segmentation fault and by disabling the garbage-collector when running the generated commands in the generated source files, solved it for me!
Here's part of the original generated script:
$(nix-build --quiet --no-build-output ../default.nix -A plutus-apps.haskell.packages.plutus-playground-server.components.exes.plutus-playground-server)/bin/plutus-playground-server psgenerator generated

See the --quiet --no-build-output? That's bad! Remove it and you'll see the original error.
$(nix-build ../default.nix -A plutus-apps.haskell.packages.plutus-playground-server.components.exes.plutus-playground-server)/bin/plutus-playground-server psgenerator generated

You should see a segmentation fault.
Prefix the command with GC_DONT_GC=1
Check the article I posted above, its easier.

Rebooted my mac and it worked. I'm on macOS Monterey


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:
upload folder to ipfs using blockfrost
How to upload folder to IPFS using blockfrost.
able to upload a file using the following, but not able to upload a folder
curl "https://ipfs.blockfrost.io/api/v0/ipfs/add" \
  -X POST \
  -H "project_id: $PROJECT_ID" \
  -F "file=@./README.md"

here is the full documentation
any solutions?

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

You can loop over the contents of your folder and upload every file individually using curl.

It is not possible to use curl to upload a folder, as it does not support multipart sending.
You might want to see something like Using a Node.js Script to Upload a Folder to a Remote IPFS Node.


text:
How to resolve npm build failure after running `GC_DONT_GC=1 npm start`?
MacOs Catalina 10.15.7 (Intel)
After facing issue here, I ran the command GC_DONT_GC=1 npm run start and it build some libraries, however failed with following error (plutus-playground-server was up and running):
79 silly inflate node_modules/@xtuc/ieee754
80 http fetch GET 200 https://registry.npmjs.org/@webassemblyjs%2fleb128 119ms (cache revalidated)
81 silly inflate node_modules/@xtuc/long
2686 error                         ^
2686 error ../src/libsass/src/ast.hpp:1616:14: note: use reference type 'const std::__1::basic_string<char> &' to prevent copying
2686 error         for (const auto denominator : denominators)
2686 error              ^~~~~~~~~~~~~~~~~~~~~~~~
2686 error                         &
2686 error 2 warnings generated.
2686 error In file included from ../src/binding.cpp:1:
2686 error In file included from ../../nan/nan.h:56:
2686 error In file included from /Users/CrosbyTop/Library/Caches/node-gyp/17.0.1/include/node/node.h:63:
2686 error In file included from /Users/CrosbyTop/Library/Caches/node-gyp/17.0.1/include/node/v8.h:25:
2686 error In file included from /Users/CrosbyTop/Library/Caches/node-gyp/17.0.1/include/node/v8-array-buffer.h:12:
2686 error In file included from /Users/CrosbyTop/Library/Caches/node-gyp/17.0.1/include/node/v8-local-handle.h:12:
2686 error /Users/CrosbyTop/Library/Caches/node-gyp/17.0.1/include/node/v8-internal.h:566:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
2686 error             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
2686 error                                 ~~~~~^~~~~~~~~~~
2686 error                                      remove_cv
2686 error /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/type_traits:697:50: note: 'remove_cv' declared here
2686 error template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
2686 error                                                  ^
2686 error 1 error generated.
2686 error make: *** [Release/obj.target/binding/src/binding.o] Error 1
2686 error gyp ERR! build error
2686 error gyp ERR! stack Error: `make` failed with exit code: 2
2686 error gyp ERR! stack     at ChildProcess.onExit (/Users/CrosbyTop/projects/cardano/ppp3/plutus-apps/plutus-playground-client/node_modules/node-gyp/lib/build.js:194:23)
2686 error gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
2686 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
2686 error gyp ERR! System Darwin 19.6.0
2686 error gyp ERR! command "/usr/local/Cellar/node/17.0.1/bin/node" "/Users/CrosbyTop/projects/cardano/ppp3/plutus-apps/plutus-playground-client/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
2686 error gyp ERR! cwd /Users/CrosbyTop/projects/cardano/ppp3/plutus-apps/plutus-playground-client/node_modules/node-sass
2686 error gyp ERR! node -v v17.0.1
2686 error gyp ERR! node-gyp -v v7.1.2
2686 error gyp ERR! not ok
2686 error Build failed with error code: 1
2687 verbose exit 1

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

It also helped me to run the server with that prefix as well:
cd plutus-playground-server
GC_DONT_GC=1 plutus-playground-server

I used setup instructions from here and it worked for me: https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md

Actually, changing node-sass version to ^7.0.0 inside package-json helped me, however I am not sure it did not break any dependencies.
Node 17+ is not supported by node-sass ^5.

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


text:
How to resolve the Following Error.?
Command failed: transaction build  Error:
The following scripts have execution failures:
the script for transaction input 1 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The provided Plutus code called 'error'.
Caused by: [ (force (builtin headList)) (con list (data) []) ]
Script debugging logs:

It appears you ended up calling head on an empty list []? That can not work as there is no element to take from an empty list. head only works on lists with at least one element, and fails for the empty list.


text:
Is the Cardano Token Registry on Github abandoned/problematic?
Pretty much what the title says, take a look:
https://github.com/cardano-foundation/cardano-token-registry

There's pull requests 10s of days old,
The CI system is failing  checks everywhere on erroneous data and mixing json files
There only seems to be 1 single maintainer, admin-cf, who seems to be
randomly picking PRs instead of maintaining a FIFO queue once every 7 days

Is the registry abandoned? Has there been another registry to replace it, and I'm looking at the old repo?

Please see the answer here: https://github.com/cardano-foundation/cardano-token-registry/issues/1114

The repository is not abandoned, it is maintained by the Cardano Foundation right now.


text:
nix-build not found inside nix-shell (Linux)
Every time I enter nix-shell, I need to execute the following command, otherwise nix-build and other nix-* commands are not found.
source /home/xxx/.nix-profile/etc/profile.d/nix.sh

I have added the following into file ~/.profile, but it does not seem to be working.
if [ -e /home/xxx/.nix-profile/etc/profile.d/nix.sh ]; then source /home/xxx/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer

What's the reason for that? How can I get source /home/xxx/.nix-profile/etc/profile.d/nix.sh automatically when I run nix-shell?

Welcome to Cardano SE! As a new user be sure to take the [Tour].
Also, this seems to be a nix question rather than a Cardano question and it should not be on this site if that is the case.

This is fairly odd and should not happen. nix-shell would know how to set your profile. So what you are saying is it works in your regular shell, but fails in nix-shell. Can you please provide more info around the context? What system do you run on, ...?

Yes, context information is going to be essential to find the problem here. Perhaps the shell is overwritting the PATH a bit too aggresively. If you have a link or a relevant snippet from the shell.nix, please share

Thanks @nrdxp! I'm running on Ubuntu, I run shell.nix from plutus-apps, should I change the this file somehow?

Hi @gRebel, I had this problem when I run plutus-apps for plutus pioneer program.

If it is a generic nix problem, it shoudn't be here.  If nix is fine and the problem is with the plutus-apps package, then it might be relevant here is if it fits the [help/on-topic] on-topic criteria.

I had trouble getting the plutus playground environment to run properly until I followed the directions in this link https://docs.plutus-community.com/docs/setup/Ubuntu.html and first did the uninstall at the bottom of the page and did the re-install (as explained on the same page from the link provided above) for multiple-user. The multi-user version is recommended on the actual Nix website.  When I got to this line "Note If you will be working on the Plutus Pioneer Project, it will be necessary at this point to git checkout ... a specific commit to match the class materials. That commit hash is listed in the exercises week## directory in the cabal.project", I followed along with the tutorial listed below to compile the "English Auction" code from week01:  https://youtu.be/zPaDp4R9X7o?t=177  Your folders might vary from the instructors, so listen carefully to where you clone the repositories he mentions.

Thanks! I'm aware of the specific commit for the repo, like I said everything works after I do source /home/xxx/.nix-profile/etc/profile.d/nix.sh each time entering nix-shell. I believe the path environment somehow is overwritten incorrectly after nix-shell, but don't know where to change it.

Perhaps related, I think I must have installed Nix twice, or a build or shell, still learning, but I think I created two different profile-link-1 and profile-link-2 in the directory /nix/var/nix/profiles/per-user/.  When I do a nix doctor --verbose I was getting a multiple versions fail (https://cardano.stackexchange.com/questions/6648/nix-doctor-verbose-fail-multiple-versions-of-nix-found-in-path-on-macos-i7). Maybe someone smarter than me can help on how this happens, and if linked.

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
Vim errors when setting up Plutus Environment
I'm following this guide for setting up my Plutus Environment which uses Vagrant & VirtualBox.
At the step:

In the Vagrantfile directory run & wait for provisioning to finish:
vagrant up

I run into multiple Vim errors-
plutus-node-1: Vim: Warning: Output is not to a terminal
plutus-node-1: Vim: Warning: Input is not from a terminal
plutus-node-1: Error detected while processing /home/vagrant/.vimrc:
plutus-node-1: line    1:
plutus-node-1: E488: Trailing characters
plutus-node-1: line    2:
plutus-node-1: E492: Not an editor command: ^M
plutus-node-1: line    3:
plutus-node-1: E116: Invalid arguments for function plug#
plutus-node-1: line    4:
plutus-node-1: E492: Not an editor command: ^M
plutus-node-1: line    5:
plutus-node-1: E488: Trailing characters
plutus-node-1: line    6:
plutus-node-1: E492: Not an editor command: ^M
plutus-node-1: line    7:
plutus-node-1: E492: Not an editor command: ^M
plutus-node-1: line   10:
plutus-node-1: E474: Invalid argument: encoding=utf-8^M
plutus-node-1: line   11:
plutus-node-1: E492: Not an editor command: ^M
plutus-node-1: line   13:
plutus-node-1: E488: Trailing characters: hidden^M
plutus-node-1: line   14:
plutus-node-1: E492: Not an editor command: ^M

Vim: Error reading input, exiting...d/j: screen/page/line down, b/u/k: up, q: quit
plutus-node-1: Vim: Finished.
plutus-node-1: Press ENTER or type command to continueVim: Error reading input, exiting...
plutus-node-1: Vim: Finished.

Any ideas?

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

There are a few things. First of why is there a /home/vagrant/.vimrc in the first place? Second why does it contain ^M (that's effectively \r), in there? dos2unix on /home/vagrant/.vimrc should fix that.
Are you using WSL by any chance? I'm unsure how windows line endings could end up in your .vimrc otherwise.

I'm not using WSL, just using Windows 10 command prompt.
To your first two questions I don't really have an answer, I haven't done anything beyond installing Vagrant & Oracle VM and then the followed the steps indicated in that post.
I tried what you suggested but still doesn't work, I'm getting a new error now I believe ?
Error detected while processing function 8_install[1]..8_update_impl[
plutus-node-1: 114]..8_update_vim[4]..8_tick:
plutus-node-1: line   17:
plutus-node-1: E117: Unknown function: coc#status


text:
time locking policy script native asset
I want to ensure a fixed supply of a native asset and this can be ensured by time locking of the policy id using the policy.script below:
    {
  "type": "all",
  "scripts":
  [
    {
      "type": "before",
      "slot": <insert slot here>
    },
    {
      "type": "sig",
      "keyHash": "insert keyHash here"
    }
  ]
}

The above format is created and run. Following error is shown
Syntax error in script: Error in $: "atLeast" script value not found

when the following command is run:
cardano-cli transaction policyid --script-file policy.script

Does anyone have a clue what is going wrong ? thanks.

Just make sure your keyHash is correctly generated.
cardano-cli address key-hash --payment-verification-key-file policy.vkey

I tried your script with correct values and it's working.

Found the error. I had put the slot as a string instead of integer.

Great, in you script supposedly it was an integer because I didn't see any quotes.


text:
How can I convert Key Hash to bech32 in Cardano serialization lib?
I generate my Key Hash Using the Following Function
const getAddressKeyHash = (address) => {
  return toHex(
    Cardano.Instance.BaseAddress.from_address(
      Cardano.Instance.Address.from_bech32(address)
    )
      .payment_cred()
      .to_keyhash()
      .to_bytes()
  );
};

Now i need to revert this back to Bech32. Can someone help?

Hashing is a one way function; the purpose of it is to verify the authenticity of data, not to encrypt data.
If you hash a piece of data, it should be impossible to revert the hash back to it's original form; this is a key operating principle of any hash function.
Generally, when a key-hash is used there should be a point in the process where an associated public/private key is supplied, and is used in combination with the key-hash to perform some sort of true/false evaluation.


text:
Image size for logo for native tokens
I am uploading an image of just 7Kb and still not able to use that as a icon for the native token. Does anyone know why ? I am using the "token-metadata-creator"(https://github.com/input-output-hk/offchain-metadata-tools).

It would be useful to get more information about what error you are seeing.
But according to the CIP:
An icon to be used to represent the subject. Encoded as a PNG image, maximum size 64kb.


text:
Is eUTxO a generalisation of UTxO
To me it sounds like UTxO is a very specific implementation of the more general eUTxO protocol. So could eUTxO be (in theory) be used to implement UTxO? Not that one would - but just to understand the distinction between the two.

You can think of regular Bitcoin-like UTXO's as a subset of all possible eUTXOs possible to construct on Cardano. Transactions that simply transfer ADA from one wallet to another (and nothing else) are examples of bitcoin-like UTXO's. eUTXO extends this core functionality by allowing one to attach arbitrary data and logic to each transaction, enabling complex lock-and-key mechanics that go way beyond simple public-private key transfers.
So to answer your question - yes; classic UTXO's are already implemented in Cardano and have been since genesis. UTXO's are to eUTXO's like squares are to rectangles.
Read more about the eUTXO model in the official Cardano Documentation


text:
Does plutus-pab support parallel requests?

Does plutus-pab support parallel requests to the same smart contract instance?
Does plutus-pab support parallel requests to different smart contract instances?

By parallel requests I mean calling instance endpoints.


text:
Are Single stakepools losing?
Epoch 315 statistics based on Daedalus-ranking
Epoch 315 numbers for the k500 pools in daedalus:
From the total 500 ranked pools, 340 are multipools, 160 are single stakepools.
In the first 10 ranked pools are 8 multipools.
In the first 100 ranked pools are 87 multipools.
If we want decentralization, should we not focus supporting Single-stakepools with lower saturation?

If we want decentralization, should we not focus supporting Single-stakepools with lower saturation?

Decentralization is a loaded topic that goes way beyond simply delegating ADA to small pools.
A truly decentralized network must incentivize individual participants' behaviors in ways that promote its healthy functioning and long term viability. This is a highly recursive process, because in order to compensate for the inevitable evolution of world conditions, the very definitions of "health" and "viability" too must evolve over time. If the initial conditions are correct, and the first domino is knocked over just right, the result is self-stabilizing feedback loop, which is ultimately the goal.
All of this is to say that, it is unlikely that there can be one-size fits all solution for ranking a set of decentralized service providers (especially for core infrastructure providers like SPOs). These providers are in constant competition with each other, and may offer unique services/incentives that address a particular corner of the delegate market, but is irrelevant for the rest of the stakeholders. The recent sundaeswap ISPO applies to most stakeholders, but is still a good example - how do we rank the 30 participating pools in relation to each other? And harder still - how do we rank them in relation to other sets of pools offering different/additional services?
Even if Daedalus ranking was crowdsourced/decentralized (which it isn't), no ranking system can perfectly keep up with all the variables that may influence stakeholders' decisions. Such is the power and responsibility of decentralization - an entire community cannot rely on any one source of data interpretation. Daedalus ranking may be a start, but is far from holistic.
TLDR; spreading ADA across small pools helps to diversify L1 block production. Decentralization however is a meta-phenomenon that isn't represented by any one such metric. Decentralization is about doing what you, the individual participant, has reasoned to be best for the health and viability of the network.

This topic is years old.. Daedalus stakepool rankings are sorted in a fashion that do not benefit small pools. This concern has been brought up on numerous occassions on Cardano Forums yet nothing has changed. It's not a priority for CF because while the K variable may currently be set to 500, the network needs far fewer than that to be secure. This is why CF doesn't care that multi pools dominate. In addition to that there are currently over 3K pools which is way more than Cardano needs or wants - this is why there hasn't been (and probably won't be based on Charles' recent declaration that there is no planned change to K on the horizon) a change to the sorting mechanism.


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:
Does the plutus playground make all defined function inlinable by defauld?
I noticed that not in all of the examples on the playground the {-# INLINABLE myProgram #-} flag is used. Does the playground natively accept every function as template haskell? Why do some examples not need it?


text:
Plutus pattern/technique for finding original datum preimage of TxOutDatumHash?
Every UTXO at a script address must have a TxOutDatumHash (or will be unspendable). To spend the UTXO at the validator you provide a datum and a redeemer, the script must validate with your redeemer, and the datum you provide must hash to the TxOutDatumHash of the UTXO you're spending. The problem, as discussed in CIP-32:

This is quite inconvenient for users.
Datums tend to represent the result of computation done by the party who creates the output, and as such there is almost no chance that the spending party will know the datum without communicating with the creating party.
That means that either the datum must be communicated between parties off-chain, or communicated on-chain by attaching it to the transaction that creates the output (which is also inconvenient in that the spending party must watch the whole chain to spot it).

But when I look at the code of, for example, the Oracle in Week 6 (or even the English Auction in Week 1), there seems to be a way of pulling the original datum from somewhere:
x <- oracleValue (txOutTxOut o) $ \dh -> Map.lookup dh $ txData $ txOutTxTx o (source)
Can someone please explain what is happening here? I assume it is the "on-chain communication" technique that the CIP mentions. Does the datum need to be explicitly handled in a particular way for this to be possible? What are txOutTxOut and txOutTxTx? Thanks!

Datums are stored on-chain. There is part of PAB called chain-index - it follows the node, pulls Datums and stores them in local database (see here section Plutus Application Backend).
So for your example, you can see couple lines above
utxos <- Map.filter f <$> utxoAt (oracleAddress oracle)

utxoAt performs call to chain-index co-located with PAB. This call will return transaction output(s) with Datum(s) which chain-index saved while following the node (to dig a bit deeper: the hash of the Datum is known from UTxO at script address, so chain-index can find Datum by hash in its database, and provide transaction output with the Datum itself).
One note, that for this to work Datum must be properly embedded to the body of locking transaction (i.e. transaction performed by "party who creates the output"), but Contract monad machinery and PAB doing it for you automatically.

Thanks. What do you mean exactly by "properly embedded to the body of the locking transaction", in a technical description? Where are the datums stored?

It seems like the example you mention uses the plutus-apps stack, which is doing exactly what you suspect:
It includes the datum in the producing transaction and the PAB does keep track of this to provide it as enhanced TxOutTx values.


text:
GLIBC_2.33 Not Found After Installing Cardano Node .?
nix-shell: /nix/store/jsp3h3wpzc842j0rz61m5ly71ak6qgdn-glibc-2.32-54/lib/libc.so.6: version GLIBC_2.33' not found (required by /usr/local/lib/libsodium.so.23)`
My nix-Shell was working fine but after i install cardano node i start giving me this error.

Which system is this on? Potential duplicate of https://cardano.stackexchange.com/questions/6405/nix-installation-issue-on-fedora-35.

Does this answer your question? nix installation issue on Fedora 35


text:
Error when executing npm start in plutus-playground-client
I get this error when I try to execute npm start in the plutus-playground-client directory
10% building 0/1 entries 0/0 dependencies 0/0 modulesℹ ｢wds｣: Project is running at https://0.0.0.0:8009/
ℹ ｢wds｣: webpack output is served from /
ℹ ｢wds｣: Content not from webpack is served from /root/plutus-apps/plutus-playground-client/dist
✖ ｢wdm｣: WARNING in Src   Lib    All
Warnings   0     0/28   0/28
Errors     0     0      0
59 WARNINGS in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)

ERROR in ./static/main.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleError: Module Error (from ./node_modules/sass-loader/dist/cjs.js):
ENOENT: no such file or directory, scandir '/root/plutus-apps/plutus-playground-client/node_modules/node-sass/vendor'
at Object.emitError (/root/plutus-apps/plutus-playground-client/node_modules/webpack/lib/NormalModule.js:525:6)
at getSassImplementation (/root/plutus-apps/plutus-playground-client/node_modules/sass-loader/dist/utils.js:55:21)
at Object.loader (/root/plutus-apps/plutus-playground-client/node_modules/sass-loader/dist/index.js:27:59)
2 ERRORS in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 3 errors and 60 warnings
ℹ ｢wdm｣: Failed to compile.

If I go to https://0.0.0.0:8009/ it seems the plutus playground it's working but I can't see anything in the page. I would be really grateful if someone has figured it out this problem.

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

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.

You need to run this in the nix-shell of plutus-apps and run with GC_DONT_GC=1 npm start


text:
How to payToTheScript recording the Datum hash?
As far as I understand the function Constraints.mustPayToTheScript :: forall i o. ToData o => o -> Value -> TxConstraints i o  is used to command: Hey, pay some money, Value, to the script and record o as Datum in the chain.
How could I pay to a script recording the Datum hash?

I asked my question in Q&A session 2 (3 cohort) to Lars.
His response was that currently is not possible to do it (store only the UTXO's DatumHash (not Datum) in the chain) using PAB. However it is possible using with Cardano Cli.

Let's say you have a Datum like this one:
let d = MyDatum
          { someField = 1
          , someOtherField = 2
          }

And a script:
let lookups = typedValidatorLookups myScriptInstance
              <> otherScript myScriptValidator

Then you can call the function as follows:
let tx = mustPayToTheScript d $ Ada.lovelaceValueOf 1_000_000

And then submit the transaction if you want:
ledgerTx <- mkTxConstraints @MyValidatorTypes lookups tx >>= submitUnbalancedTx . adjustUnbalancedTx
awaitTxConfirmed $ getCardanoTxId ledgerTx

Thanks @Jey, but my question is about how to record the datum hash (not the datum). I only want the hash of datum in the chain.

You could try to strip the datum from the transaction before submitting it. But I think that would make it malformed.


text:
Trouble fulfilling: base, libsystemd-journal, lobemo-scribe-systemd
2 days stucked with this (running on Ubuntu):
[nix-shell:~/plutus-pioneer-program/code/week01]$ cabal build
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.

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

In my case, I needed to put a base dependency version constraint in my cabal file: base ^>=4.14.1.0.

Have you found a solution to this?

I received this error when running nix-shell from the plutus repository. To fix I exited that nix-shell, navigated to plutus-apps repository, and checked out the appropriate hash from the cabal.project file found in the cabal.project file. Then ran nix-shell from plutus-apps instead of plutus.
source-repository-package
  type: git
  location: https://github.com/input-output-hk/plutus-apps.git
  tag: 41149926c108c71831cfe8d244c83b0ee4bf5c8a

$> cd <projects-dir>/plutus-apps
$> git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a
$> nix-shell
$> cd ../plutus-pioneer-program/code/week01
$> cabal repl

the coresponding version for you can find there
$cd ~/code/haskell/plutus-pioneer-program/code/week01/
$less cabal.project
and there is a tag with right version

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
nix doctor --verbose [FAIL] Multiple versions of nix found in PATH, on MacOS i7
After performing a git commit tag update on plutus-apps, I restarted my computer, and ran nix doctor --verbose and got the following FAIL
  [FAIL] Multiple versions of nix found in PATH:
    /nix/store/iq3ra93h9kxmnrw3zlxmqn8ng5w62dra-nix-2.5.1/bin
    /nix/store/j6fqvmsfhl4frzqn2f3bzhn8hr16j5q5-nix-2.5.1/bin

How do I correct this?

Updates on troubleshooting:

performed nix install sh <(curl -L https://nixos.org/nix/install) --daemon
read up on nix-store documentation
performed nix-store --delete /nix/store/j6fqvmsfhl4frzqn2f3bzhn8hr16j5q5-nix-2.5.1/bin to delete both instances, got "error: Cannot delete path /nix/store/... since it is still alive.  To find out why, use: nix-store --query --roots.

I may have created two profiles in /nix/var/nix/profiles/per-user/ as profile-link-1 and profile-link-2, potentially two different user environments.  I may have done something twice and nix made two different user env rather than overrride. See https://nixos.org/manual/nix/stable/introduction.html?highlight=%2Fnix%2Fvar%2Fnix%2Fprofiles%2Fper-user%2F#multi-user-support

I had success with just fully uninstalling nix.
However, uninstalling nix wasn't straight forward either (surprise!).  From my research, here are options that worked.
How to uninstall nix:

Script Github kintsugi/uninstall-nix-osx.sh

(hat tip to the tutorial https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md, see very bottom)
from terminal, cd to desktop (or whatever is easiest)
git clone https://gist.github.com/47e5e9f9d7c3a3a2f6004b6271365f8c.git
in terminal, sudo sh <drag-and-drop-file-here> or sudo sh </path/to/file/and_file_here>

OR

Manually follow Github Issue, How to remove nix #1402

I did this just as backup, #1 already worked, although there were some caution statements.

RESTART COMPUTER

In new tab, in ~/plutus-apps directory

nix doctor --verbose now all passes!

So far, the nix-build, nix-shell have worked too...

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
How does Constraints.modifiesUtxoSet work?
I'm trying to understand how Constraints.modifiesUtxoSet works.
Can anyone give an example?
modifiesUtxoSet :: forall i o. TxConstraints i o -> Bool

Check whether every transaction that satisfies the constraints has to modify the UTXO set.

The SimpleEscrow use case uses it:
https://playground.plutus.iohkdev.io/doc/haddock/plutus-use-cases/html/src/Plutus.Contracts.SimpleEscrow.html#refundEp
Another example is the Crowdfunding use case:
https://playground.plutus.iohkdev.io/doc/haddock/plutus-use-cases/html/src/Plutus.Contracts.Crowdfunding.html#contribute

I've seen them and after looking at the source of modifiesUtxoSet, I'd say that the purpose of modifiesUtxoSet is something like: "check if TxConstraints" does something"


text:
Getting status of daemon-socket: Operation not permitted while invoking nix-shell (MacOs)
Plutus Pioneers Week 01 exercise.

cloned the plutus-app directory
edited the nix.conf file (added the iohk binaries reference)
moved to the plutus-app directory

After downloading, linking and compilation ends, I get the following error  when invoking the nix-shell.
error: getting status of /nix/var/nix/daemon-socket/socket: Operation not permitted
Tried:

Rebooting (in case it was a daemon problem)
sudo in case of permissions problems.

Console output and error.
Setting gitrev of /nix/store/4hwiz5g25mnrjb3a6qjdcvl4fpvkm4fq-cardano-cli-exe-cardano-cli-1.33.0/bin/cardano-cli ... OK
"Bundling /nix/store/vv3k4s0gzkvdbirq5iiah15w920z6aql-zlib-1.2.11/lib/libz.dylib in /nix/store/4hwiz5g25mnrjb3a6qjdcvl4fpvkm4fq-cardano-cli-exe-cardano-cli-1.33.0/bin/cardano-cli"
error: getting status of /nix/var/nix/daemon-socket/socket: Operation not permitted
rewrite-libs: ProcFailed {procCommand = "nix-store", procArguments = ["-r","/nix/store/vv3k4s0gzkvdbirq5iiah15w920z6aql-zlib-1.2.11/lib/libz.dylib"], procExitCode = ExitFailure 1}
error: builder for '/nix/store/9r5f5sz773fnzc6vxch5l13jh9104mwg-cardano-cli-exe-cardano-cli-1.33.0.drv' failed with exit code 1;
       last 10 log lines:
       > Linking dist/build/cardano-cli/cardano-cli ...
       > installing
       > Installing executable cardano-cli in /nix/store/4hwiz5g25mnrjb3a6qjdcvl4fpvkm4fq-cardano-cli-exe-cardano-cli-1.33.0/bin
       > Warning: The directory
       > /nix/store/4hwiz5g25mnrjb3a6qjdcvl4fpvkm4fq-cardano-cli-exe-cardano-cli-1.33.0/bin
       > is not in the system search path.
       > Setting gitrev of /nix/store/4hwiz5g25mnrjb3a6qjdcvl4fpvkm4fq-cardano-cli-exe-cardano-cli-1.33.0/bin/cardano-cli ... OK
       > "Bundling /nix/store/vv3k4s0gzkvdbirq5iiah15w920z6aql-zlib-1.2.11/lib/libz.dylib in /nix/store/4hwiz5g25mnrjb3a6qjdcvl4fpvkm4fq-cardano-cli-exe-cardano-cli-1.33.0/bin/cardano-cli"
       > error: getting status of /nix/var/nix/daemon-socket/socket: Operation not permitted
       > rewrite-libs: ProcFailed {procCommand = "nix-store", procArguments = ["-r","/nix/store/vv3k4s0gzkvdbirq5iiah15w920z6aql-zlib-1.2.11/lib/libz.dylib"], procExitCode = ExitFailure 1}
       For full logs, run 'nix log /nix/store/9r5f5sz773fnzc6vxch5l13jh9104mwg-cardano-cli-exe-cardano-cli-1.33.0.drv'.
error: build of '/nix/store/8a0gn6kmpakh4m1lpmid599hmcckbfrc-cardano-node-exe-cardano-node-1.33.0.drv', '/nix/store/9r5f5sz773fnzc6vxch5l13jh9104mwg-cardano-cli-exe-cardano-cli-1.33.0.drv', '/nix/store/anmrbbdiymirc2npqkcnmf3ih3f06jkn-updateMaterialized.drv', '/nix/store/b0q86i19kw66v5v8r21p1z8rs2mgm6dc-pre-commit-config.json.drv', '/nix/store/h4xywd2yqdgm4qf7ignnaw7llspwwvhs-plutus-playground-generate-purs.drv', '/nix/store/n8124sfkdbmjjjva72lh4yxp9m19r1wd-cardano-wallet-2021.12.15.drv', '/nix/store/spc349lqq5mx4j9fwzfpywqzbjxbqgj9-update-client-deps.drv', '/nix/store/wpz2b0xzw3fi84knb9ldnfp7q5175qhi-plutus-playground-server.drv', '/nix/store/z6xqdvz6grjpxdkkp3k2g47zyd2hw8hq-python3-3.9.6-env.drv' failed

I have found the solution!!
Thanks to
starting nix-shell on mac "Operation not permitted"
MacOs seems to require that the Nix Sandbox setting is set to OFF. I have turned it on, while setting Nix, as I read somewhere that it should be turning  ON (It seems that by default it is OFF in MacOS, so if you didn't changed it in the nix.conf you should be ok)
I was able to have my nix-shell up and running now!

If the question is a duplicate, remove this question and answer.

Please take the tour and see the guidelines in the help cemter


text:
Where can I find design and documentation resources on Plutus Staking smartcontracts?
When I was exploring haddock of Plutus I have found that Plutus script can have Rewarding ScriptPurpose:
data ScriptPurpose
    = Minting CurrencySymbol
    | Spending TxOutRef
    | Rewarding StakingCredential
    | Certifying DCert
    deriving stock (Generic, Haskell.Show, Haskell.Eq)

This raised me a lot of questions like:

How do Rewarding scripts differ from Spending scripts?
How to use Rewarding script, how are Rewarding scripts interacted with?
Can Rewarding scripts be used with native tokens? Could I for example create smartcontract for staking KUGIS native tokens and getting KUGIS coins as a reward?

I have tried searching for resources but couldn't find a single resource on this except one example of the adafinance cardano staking contract on github.

Should one of the answers be marked as accepted?

The best resources I can recommend are the following in regards to StakeValidators:
Plutus Pioneer Program Lecture #10 Cohort 3
Example Implementation StakeValidator
Plutonomicon StakeValidator Intro
How do Rewarding scripts differ from Spending scripts?
Rewarding scripts can only make assertions in regards to the registration/ deregistration of delegation certificates for some provided payment keys. In addition, they can also implement logic that validates withdrawals of staking rewards from a given address as well as ensure delegations to a new pool.
How to use Rewarding script, how are Rewarding scripts interacted with?
This was part of the PPP lecture 10 (see link above). Whenever someone creates a transaction trying to withdraw from an address that is managed by a StakeValidator then the rewarding purpose is used that provides the corresponding StakingCredentials in the ScriptContext. These StakeValidators are implicitly run whenever someone tries to withdraw rewards from an address that was created with a script StakeValidator.
Can Rewarding scripts be used with native tokens?
Could I for example create smartcontract for staking KUGIS native tokens and getting KUGIS coins as a reward?
The rewarding mechanism through staking is as far as I know only done for Cardano's native currency ADA. If you wanted to create your mechanism you could use a minting policy instead for your custom token. So your smart contract/ minting policy would have to validate under what conditions new KUGIS coins can be minted. You could also airdrop coins for participants acting a certain way - such as delegating to a pool etc.

Not sure if I understand, can you clarify? It would be possible to build a reward system of a native token, but not through scripts having Rewarding ScriptContext purpose param. Instead one should use normal minting transactions and smart contracts addresses? How it would work?

StakeValidators are definitely not possible to use for native asset rewards, as they are strictly triggered only for actions involving the (de)registration of DCerts/ delegation to a new pool or withdrawal of rewards.
So the only way to create a rewards scheme for native assets is via a minting policy or a combination of spending validator + minting policy.

You could for instance let users create an output at a script address for a specific rewards scheme (storing the datetime they joined in the output datum) and then allow them to consume it in the future. Based on the amount of time they waited until they consume their output at the script address, they are eligible to mint a specific amount of your native tokens. Your spending validator script can check for the specific output and amount of the native tokens minted.

To me, rewarding refers to Staking Pools Rewards (anybody can correct me on this), which for that, it is also my understanding that it uses a wallet address (rewarding wallet address) different of the payment wallet address (anybody can correct me on this too).
For more information I'd invite to take a look at the documentation for apps related to staking.
On a tangent from this topic:
Less than a week ago, Charles twitted that Cardano may be able to pay transaction fees in custom currencies (first blockchain to be capable of this):
https://twitter.com/IOHK_Charles/status/1484193096178946048?cxt=HHwWgMCqvbzw9JgpAAAA
Paper title: Babel Fees via Limited Liabilities
https://arxiv.org/pdf/2106.01161.pdf
I have not read the details of the paper but possibly then the rewards (your topic) will also be in those custom currencies.


text:
ad-hoc policy lock
It's possible to create a policy which can no longer be used to mint/burn after a given slot. The following object in a policy.script handles that:
{
      "type": "before",
      "slot": <insert slot here>
}

What if, however, one does not include this block (no before object in script) but eventually wants to lock the policy to prevent future burning/minting? Is this possible?

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


text:
What is the GC_DONT_GC=1 variable for when running the Plutus Playground locally?
I tried to look for this but I didn't find anything specifically explaining why this fixes errors when launching Plutus Playground locally, although I definitely found instructions on how to go over the errors themselves. At some point I read somewhere it is related to the garbage collector. Could someone expand a little bit on this?
Thanks!

This really is hard to find, after searching myself.  The best I could find is from this smart fellow. "The GC_DONT_GC is a garbage collector for the heap, to make the evaluator use less ram, GC_DONT_GC=1 just turns it off entirely, so it never GC’s ram during the eval." from http://blog.punkbit.com/hacking/plutus-developer-environment-setup-on-macos-monterey/
hat tip to @punkbits

GC_DONT_GC=1 disables the boehm garbage collector in nix. There are edge cases that our nix expressions can hit, which cause nix to segfault. Disabling the garbage collector in nix "fixes" this. It's not the best solution, but a workaround.  The proper fix would be to fix nix's use of the boehm garbage collector. That however is said much easier than actually done.
So GC_DONT_GC=1 is a workaround for now, until a better nix release is widely available that doesn't need that environment variable anymore.
This also has nothing to do directly with Plutus or Haskell. It's only needed for the evaluation of the build instructions via nix.


text:
Do Cardano NFTs contain stable content?
In our company we discuss the Twitter post of the Signal founder: https://moxie.org/2022/01/07/web3-first-impressions.html. One critique is, that the NFTs don't contain the hash of data (jpg, ...) but a link to a centralized page that is outside of the control of the blockchain and whose content can change.
How does it work for Cardano or CNFT.io for example. Do they contain the hash of the image or a Link to IPFS or something?
When I look at an NFT on CNFT.io I don't find a hash that works with https://explorer.cardano.org/ to check it myself.
Thanks in advance for hints!

Ah, using https://cardanoscan.io/ with the "POLICY ID" of a token on cnft.io I can find the token on the chain. E.g. https://cardanoscan.io/token/8c06b3c611ec9bc9037c76a9e2cf270c7a147341e6daffeda614cdd5426f726733323838. So that part is answered.

I believe the metadata in a Cardano NFT is not set in stone. As in you can decide what it contains. Using a reference to an ipfs storage location is one convenient way to add the actual content of the NFT.
You can read more about the technical process of minting NFT's here:
https://developers.cardano.org/docs/native-tokens/minting-nfts/
There's also an interesting discussion on having a metadata standard going on in this CIP (Cardano improvement proposal):
https://github.com/cardano-foundation/CIPs/pull/85
If you want to see the metadata of a specific NFT you should be able to see it on the marketplace you're using. Personally I've found https://pool.pm/tokens very useful for finding tokens and their metadata.

Thanks a lot. Seeing the NFTs at https://pool.pm/tokens and their metadata with the IPFS link was very useful!


text:
Cloning the Plutus and the Plutus-Apps repositories for Plutus Pioneer Program Cohort #3
In regards to the Plutus Pioneer Program Cohort #3, do I clone the Plutus and Plutus-Apps repositories using HTTPS, an SSH key, or GitHub CLI?

use commands git clone https://github.com/input-output-hk/plutus-apps.git and  git clone https://github.com/input-output-hk/plutus-pioneer-program.git

You can clone them however you like. My preference is always to clone everything using ssh login: git clone git@github.com:input-output-hk/plutus, however you wouldn't be able to push back to that URL anyways so cloning via https as the above answer suggests would be just as good.


text:
Problem with Lesson 5 code on newer version
I am trying to get signed token up and running on the Plutus playground from lesson 5 and I'm running into an issue with I believe is a depreciated variable of PubKeyHash does any body know the solution to this problem. Im using version v2022-01-13.

Please provide the plutus-app version being used. The last time I checked, a PaymentPubKeyHash type has been introduced.


text:
plutus example of interacting with wallet on testnet using haskell
Can anyone proivde an example of how to create a wallet that can be used in the Main.hs file when connected to the testnet?   I have working code for Emulator and Simulator, but all examples against testnet are done via the REST API call to invoke a a contract instance with a wallet.   Here is the code fragment that I need to work for testnet, and I know the wallet ID in advance, but I don't know how to create a Wallet instance that can replace the defaultWallet below.
Simulator code:
main :: IO ()
main = void $ Simulator.runSimulationWith handlers $ do
Simulator.logString @(Builtin StarterContracts) "Starting plutus-starter PAB webserver on port 8080. Press enter to exit."
shutdown <- PAB.Server.startServerDebug
cidInit <- Simulator.activateContract defaultWallet InitContract
adminPkh <- Simulator.handleAgentThread defaultWallet ownPubKeyHash

...
Run code:
main :: IO ()
main = do
runWith (Builtin.handleBuiltin @StarterContracts)
shutdown <- PAB.Server.startServerDebug
cidInit <- Core.activateContract (Wallet ???) InitContract
adminPkh <- Core.handleAgentThread (Wallet ???)  ownPubKeyHash


text:
Is a block winning a height battle with a 43 second prop time a potential form of MEV?
Would someone please be so kind as to explain how a block with a 43 second prop time wins a height battle???

Block #: 6777986
Pool ID: 2cf87fadec7130c7e41910492073ae4dbe65ca462c1fdc3d2a56d015

Perhaps I could use a refresher on shallow forks/rollbacks, but this just doesn't add up in my head... as far as I understand, the only way this is possible is if the higher-slot leader does not "receive" the previous block, and posts their own block in place of the most recent one. For such a large prop time, this seems like a massive arbitrage opportunity for the higher slot leader.
What can be done about, or is there a way to minimize, this?

Here's a very good article about slot battles, but in short, prop time is not a factor in winning or losing...
https://www.beaver-stake-pool.net/post/slot-battles-height-battles-and-orphaned-blocks

Nice article! I see why prop time alone not a factor in winning/losing a height battle. What I am more concerned about is the idea that such a high prop time may be indicative of some sort of malicious MEV. If I understood the article correctly, the stake pool in question here did not receive IOGP's block for a whole 40 seconds before pushing their block to the network. Does this mean that any SPO can orphan any block that comes before theirs just by not accepting it before publishing their own?

OP and @nomad0 Great question and answer.  The answer would be even better if it followed the guidelines at: https://cardano.stackexchange.com/help/referencing

Here is interesting discussion about height and slot battles, what I had.
https://forum.cardano.org/t/how-to-figure-out-when-pool-wins-slot-battles-or-causes-height-battles/90639/14
Here some more details from @BEAVR:
I should clarify and probably update my blog post regarding Height Battles.
From my experience, height battles are actually won by whichever block was received first. The slot number has no effect. We discovered that relays accept which block comes first when looking into this problem:
https://forum.cardano.org/t/how-to-figure-out-when-pool-wins-slot-battles-or-causes-height-battles/90639/14

That is not correct, height battles are won following the same rules as slot battles.
https://github.com/input-output-hk/ouroboros-network/issues/2913#issuecomment-816953407


text:
How are upgrades implemented in Cardano? CIP's?
Are upgrades to Cardano implemented via Cardano Improvement Protocols like Bitcoin? With the upcoming scaling upgrades such as increasing the block size, pipelining and input endorsers it seems that these upgrades are mainly being performed by IOHK/EMURGO. Are these proposals flagged by nodes/pools as yes/no and a fork created if some pools flag no to the proposal?
My question is concerned with decentralization and how it still seems like few entities are contributing/steering the way for the network compared to Bitcoin where some BIP's caused forks and separate chains because of disagreements on the BIP's.
For example with the block size increase. If there are nodes/pools that disagree with the proposal will we have a Cardano fork like Bitcoin and Bitcoin Cash?

Governance on the Cardano blockchain will come with Voltaire improvements at a a later date. Under the current system, update proposals are controlled by the keys IOG, CF and Emurgo control.
Block sizes are a protocol parameter and require signatures by the above 3 entities to take effect. Participants cannot control from a technical level these parameters; however they can influence them through discussions with the above entities.

I can't find who owns # of keys, and where is it documented?


text:
how to convert an "asset32type" to string?
i want to convert an "asset32type" to a string, reason being the datatype in the "name" column of dbsync's multi_asset table is "asset32type".
what is an "asset32type"?

An asset32type is a raw Postgres octet string, but limited to a maximum of 32 bytes. It is defined in schema/migration-1-0004-20201026.sql as:
CREATE DOMAIN asset32type AS bytea CHECK (octet_length (VALUE) <= 32);

eg:
select * from multi_asset limit 3 ;
 id |                           policy                           |         name         |                 fingerprint
----+------------------------------------------------------------+----------------------+----------------------------------------------
  1 | \x00000002df633853f6a47465c9496721d2d5b1291b8398016c0e87ae | \x6e7574636f696e     | asset12h3p5l3nd5y26lr22am7y7ga3vxghkhf57zkhd
  2 | \x3a9241cd79895e3a8d65261b40077d4437ce71e9d7c8c6c00e3f658e | \x4669727374636f696e | asset1aq460y056c3mm4jmuv9vg39n7w8y5gykywjwge
  3 | \x02f68378e37af4545d027d0a9fa5581ac682897a3fc1f6d8f936ed2b | \x4154414441         | asset1tm62f04gz390cjxttq4gz0s43lswr9estr2jcz
(3 rows)

It is stored as a raw Postgres string because there is not guaranetee about the encoding. It might be UTF-8 but it also might not be.

thank you, this makes sense now. i was using convert_from(name, 'UTF8') however it broke for a certain case, the resolve was to use convert_from(name, 'LATIN1') on that record.

The above answer does a great job of explaining what it is, but doesn't answer how you get the value as a string. To pull the value as hex (which is the only thing that makes sense for a policy hash for example), you would encode it like so:
SELECT encode(policy::bytea, 'hex') AS policy_hex FROM multi_asset LIMIT 3;

Likewise, if you want to use a WHERE clause against it, you would decode it:
SELECT * FROM multi_asset WHERE policy = decode('00000002df633853f6a47465c9496721d2d5b1291b8398016c0e87ae', 'hex');

The asset name itself may make sense as ASCII/UTF8 or it might not. There's no guarantees in the system that an asset name resembles anything so should always be treated as raw hex as well and get the actual asset information from the metadata server or metadata on the minting transaction that explains what it actually represents.


text:
1.33.0 cardano-cli query stake-snapshot does not generate json
I'm trying to generate leaderlogs on cardano-node 1.33.0
when i try to query the stake snapshot with
cardano-cli query stake-snapshot --stake-pool-id 3bd3996595321d951291b11e1331061c5d8659d9e69390536dfc922c --mainnet
it does not generate a json file but wired output
86  # list(6)
   19 01 3b  # int(315)
   b9 04 51  # map(1105)
       # key
      58 1c 00 00 00 36 d5 15 e1 2e 18 cd 3c 88 c7 4f
      09 a6 79 84 c2 c2 79 a5 29 6a a9 6e fe 89  # bytes(28)
       # value
      18 41  # int(65)
       # key
      58 1c 00 00 00 f6 6e 28 b0 f1 8a ef 20 55 5f 4c
      49 54 23 4e 32 70 df bb dc c1 3f 54 e7 99  # bytes(28)
       # value
      18 3b  # int(59)
       # key
      58 1c 00 00 01 10 09 3e ff bf 3c e7 88 ae bd 3e
      75 06 b8 03 22 bd 39 95 ad 43 2e 61 fa d5  # bytes(28)
       # value
      0b  # int(11)
       # key
      58 1c 00 00 01 b8 44 f4 e4 c9 00 ae 0d fd c8 4a
      88 45 f7 10 90 b8 2f b4 73 e6 c7 0a 31 ee  # bytes(28)
       # value
      18 1b  # int(27)
       # key
      58 1c 00 00 06 6c 3b 2b 15 f7 ae ce 35 5a 11 2e
      f1 41 e9 fe 84 d2 e2 15 2d 43 98 98 6e 40  # bytes(28)
       # value
      01  # int(1)

and therefore jq .poolStakeMark <<< $SNAPSHOT fails
Did the output of the command change?

I’m voting to close this question because user solved their problem already.

This is not a helpdesk.  It is intended to be a library of solutions that others can refer to for quite some time to come.  Solving the problem doesn't mean it should be closed.  Please take a look at the [tour] and [help/dont-ask]

Ok seems the problem was that i used an older cardano-cli with a newer cardano-node


text:
Vim setup of Lars
I was wondering which Vim setup Lars uses in his video, is this perhaps natively available when we use the nix-shell? In lecture two of the third cohort his vim suggests what I guess common used functions, what plugin is this?

I think we can't give exact definition of Lars' Vim configuration, but regarding the intelligent code completion, there are many Vim add-ons that achieve this. coc and Vim Intellisense are two examples.
If you're keen on modding your Vim configuration, you could also check Neovim, which is a fork that "strives to improve the extensibility and maintainability of Vim".

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Take a look at this. After following this guide and setting up the plugins, you will need to nix-shell inside plutus-apps, and then cabal update and cabal build inside the actual haskell code you are trying to use (as Lars explained in the first lecture). That's it, now you can use vim to open your file and, after some time, you will see some cool little colors.
By the way I suggest neovim, because with vim you don't have any idea of what's going on while haskell-language-server is still loading (also neovim is cooler)

It looks like a language server protocol setup (i.e. haskell-language-server). Basically the same as VSCode, but with a different client.

As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.


text:
Nix build error: experimental Nix feature 'nix-command' is disabled
I have this error when I try to build plutus
:~/code/plutus$ nix build -f default.nix plutus.haskell.packages.plutus-core
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

I also tried this, but I am still getting errors
:~/code/plutus$ nix --extra-experimental-features nix-command build -f default.nix plutus-apps.haskell.packages.plutus-core.components.library
error: executing SQLite statement 'pragma synchronous = normal': unable to open database file (in '/nix/var/nix/db/db.sqlite')

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

It seems like this is a single user installation. Are you running the nix command as the same user that installed nix? That would explain the unable to open database file error. You could validate this looking at the permissions/ownership of the sqlite file in question.
To allow nix-command and flakes, you can create /etc/nix/nix.conf with the contents:
experimental-features = nix-command flakes

I'd also recommend adding the binary caches in that file as well.

Thanks this error got cleared.Thanks


text:
How can I find the IPFS URL for a CNFT.io asset?
I've tried several ways but couldn't find a relyable way to find the IPFS url for a CNFT.io asset.
I tried to find the policy id in https://pool.pm/tokens and in https://cardanoscan.io/. In the latter one I can find the policy id but not the right asset / token and even when I find it by manually searching for it, then I don't find the metadata for it that contains the IPFS URL. Is there a relyable way to find it?

Not sure if this is what you want to know.
For every asset on CNFT.io, there are three dots at the top right side.

Click on Cardanoscan option
It'll open cardanoscan with your token, i.e. https://cardanoscan.io/token/dcb16550b3831a9c675b5bd827ad0ffced2dc0310b0d839c5c1dcd5e.CuteDudes3472
Go to Mint Transactions tab and click on the transaction.
It'll open the transaction in cardanoscan, i.e. https://cardanoscan.io/transaction/35c1c8fb3da4a6a23476b2d05288ae2314468b92e4fb6c87e8801590689f85e7?tab=tokenmint
Go to Metadata tab and click on label 721
There should be displayed the metadata of the NFT, including URL to the image or files.

"For every asset on CNFT.io, there are three dots at the top right side...".
Argh. That was the simple solution that I missed :facepalm:
I tried to find it using the policy id and the asset id. Thanks a lot!


text:
Cannot compile parameterized mintingPolicy to Plutus
I tried compiling a solution from the examples provided in PPP Iteration #2 but got stuck. Any ideas?
Code: https://github.com/ILIYANGERMANOV/cardano-smart-contracts/blob/main/ivy-token/src/MintIvy.hs
Error:
...
Plutus.V1.Ledger.Value.TokenName>_N)) ; PlutusTx.Eq.N:Eq[0]
                                                                                <Plutus.V1.Ledger.Value.TokenName>_N))
                                                                :: GHC.Types.Coercible
                                                                     Plutus.V1.Ledger.Value.TokenName
                                                                     PlutusTx.Builtins.Internal.BuiltinByteString))
                                                       (MintIvy.ivyToken
                                                        `cast` (Sym (Nth:2
                                                                         (Nth:3
                                                                              (((Sym (Plutus.V1.Ledger.Value.N:TokenName[0])
                                                                                ->_R Sym (Plutus.V1.Ledger.Value.N:TokenName[0])
                                                                                ->_R <GHC.Types.Bool>_R) ; Sym (PlutusTx.Eq.N:Eq[0]
                                                                                <Plutus.V1.Ledger.Value.TokenName>_N)) ; PlutusTx.Eq.N:Eq[0]
                                                                                <Plutus.V1.Ledger.Value.TokenName>_N)))
                                                                :: GHC.Types.Coercible
                                                                     Plutus.V1.Ledger.Value.TokenName
                                                                     PlutusTx.Builtins.Internal.BuiltinByteString))
                                                of {
                                                  GHC.Types.False -> GHC.Types.False;
                                                  GHC.Types.True ->
                                                    PlutusTx.Builtins.Internal.ifThenElse
                                                      @ GHC.Types.Bool
                                                      (PlutusTx.Builtins.Internal.equalsInteger
                                                         amt MintIvy.initialAmount)
                                                      GHC.Types.True
                                                      GHC.Types.False
                                                }
                                            };
                                          : _ [Occ=Dead] _ [Occ=Dead] -> GHC.Types.False
                                        }
                                        }
                                    }
                               of {
                                 GHC.Types.False ->
                                   PlutusTx.Builtins.Internal.trace
                                     @ GHC.Types.Bool
                                     (GHC.Magic.noinline
                                        @ (GHC.Base.String -> PlutusTx.Builtins.Internal.BuiltinString)
                                        PlutusTx.Builtins.Class.stringToBuiltinString
                                        (GHC.CString.unpackCString# "wrong amount minted"#))
                                     GHC.Types.False;
                                 GHC.Types.True -> GHC.Types.True
                               }
                           }
                           }
                           }
**Context: Compiling definition of: MintIvy.mkPolicy
Context: Compiling expr: MintIvy.mkPolicy
Context: Compiling expr: PlutusTx.Base..
                           @ (() -> Plutus.V1.Ledger.Contexts.ScriptContext -> GHC.Types.Bool)
                           @ Ledger.Typed.Scripts.MonetaryPolicies.WrappedMintingPolicyType
                           @ MintIvy.MintingIvyParam
                           (Ledger.Typed.Scripts.MonetaryPolicies.wrapMintingPolicy
                              @ () PlutusTx.IsData.Instances.$fUnsafeFromData())
                           MintIvy.mkPolicy
Context: Compiling expr at "ivy-token-0.1.0.0-inplace:MintIvy:(93,8)-(93,69)"**
`

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

For some reason checking for equality with the TokenName type isn't possible on-chain (at least that's my theory, maybe TokenName itself is not acceptable). Still, you can define your token as a builtin byte string and then compare that to the token name using pattern mathcing.
So you would have
{-# INLINABLE ivyToken #-}
ivyToken :: BuiltinByteString
ivyToken = "IVY_T1"

Where BuiltinByteString is imported from PlutusTx.Prelude
checkMintedAmount :: Bool
checkMintedAmount = case flattenValue (txInfoMint info) of
    [(cs, (TokenName tn'), amt)] -> cs  == ownCurrencySymbol ctx && tn' == ivyToken && amt == initialAmount
    _                -> False


text:
macOS Monterey i7, what is the best `nix.conf` file to use?
Does anyone have the recommended nix.conf file to use for macOS Monterey i7?
Following a few different tutorials, my current .conf file looks like:
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=volume

However, https://github.com/input-output-hk/plutus-apps#nix-1 for macOS also recommends adding:
sandbox = true
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env

Any other working steps are appreciated.  I wouldn't follow tutorials for the M1 i'm assuming too.  Thanks!
Ref:
[https://www.punkbit.com/hacking/plutus-developer-environment-setup-on-macos-monterey/]

macOS nix setup on x86_64 (Intel, AMD) and aarch64 (Apple Silicon) should be identical.  Running the installer from the official website, should get you a proper install.
You do want to add the iohk substituter to get access to the cached builds:
https://hydra.iohk.io
hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=

I'm fairly sure that the iohk.cachix.org instance is defunct (or not updated anymore really). So it should be fairly safe to remove the following
https://iohk.cachix.org
iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo=

Please don't enable sanboxing on macOS, while that is in principle a good idea, it will lead to crashes with complex nix expressions. See Status of macOS | nixos/nixpkgs#116341

This /etc/nix/nix.conf wound up working for me, based on your help, for my masOS i7 v12.1 monterey: https://cardano.stackexchange.com/a/6745/4012


text:
Figure out transaction id after submitting using cardano cli
It's possible to submit transactions using cardano cli. Here is an example (assumes you have gone through the steps to build the tx):
cardano-cli transaction submit --tx-file matx.signed --mainnet

I would like to follow up on the transaction after submitting. For that I need the transaction ID. Is there a way to derive or otherwise programatically figure out the transaction Id of a tx created in this manner?

For the above example, you would run:
cardano-cli transaction txid --tx-file matx.signed
If instead of inspecting a signed transaction you wish to inspect a transaction body / unsigned draft, it would look similar:
cardano-cli transaction txid --tx-body-file tx.draft
The Txid will be printed to stdout


text:
Timing of finality of a transaction in Mainnet
Hello i am facing some troubles when moving from test-net to main-net, my transactions seems to have to wait a long time for being reflected in the explorer, also i can not do any more transactions until they appear in the explorer, yesterday I had to wait almost 10 minutes. Now I am waiting for more than half an hour! and i can not see my transaction in the explorer neither do any other transaction.
Everything works fine in test-net but on main-net things gets complicated, I have noticed that Nami Wallet and Yoroi work terrific, but sending my transactions from Blockfrost endpoint may be the thing that makes things slow,  Any suggestion?

Just be patient. This behavior is because these days the blockchain has been really saturated, 90-95%.
Additionally, today was the launch of Sundaeswap, that means, more saturation.
This also has an impact in the wallets, you can try CCVault
Your transactions can take 10 minutes or even more when the blockchain is saturated.

Yesterday i waited more than an hour..  went to sleep and only in the morning i could see my transaction today i sent one transaction 3 hours ago... i have the hash 95653ab27d3467908945e21e09efc7d90bff72854f09b9ad969db03a17f8fa37 but.. now 3 hours later i can not see it in the explorer.

Yes, that's the reason this year Cardano will scale: https://iohk.io/en/blog/posts/2022/01/14/how-we-re-scaling-cardano-in-2022/

i have waited 9 hours! today :(

That's too much, I minted an NFT three hours ago, it took like 10 minutes. Try another wallet, CCVault seems to be performing better these days.

I was using blockfronst SendTx Endpoint no browser wallet

now i am getting this error: BlockfrostServerError: Mempool is full, please try resubmitting again later.
but the first was submited so it is not related to blockfrost only but to thw whole blockchain.

Here is a nice tweet with an explanation from Alessadro: https://twitter.com/berry_ales/status/1485198340698562563?t=C3pw53AusKAEcitlLfnpbg&s=09

The blocks are much more saturated on mainnet. It's normal to wait 5-10 minutes for a transaction to get into the block chain when the blocks are saturated.

Yesterday i waited more than an hour..  went to sleep and only in the morning i could see my transaction today i sent one transaction 3 hours age... i have the hash 95653ab27d3467908945e21e09efc7d90bff72854f09b9ad969db03a17f8fa37 but.. now 3 hours later i can not see it in the explorer.

Some wallets are better than others with dealing with the backlog.