text:
Could someone explain mangled addresses to me?
I am developing a dApp where a user can send a few ada (3) to an address that I am listening to on my backend server, and I send a few tokens back depending on what NFTs they have in the wallet. When the transaction is received, I get the stake key from the sender's address using the Blockfrost API and read all assets they control. I then calculate how many tokens they are owed and send those to them.
I have seen mangled addresses mentioned a few times when developing, but I'm still struggling to wrap my head around them or understand if they would affect my app. Any insight would be much appreciated.

A Cardano/ADA address consists of two components; a spending credential and a staking credential.
By default, the spending and staking credential are derived from the same private key. However it is also possible to create an address from spending and staking credentials from different private keys. This is a mangled address.
For these mangled addresses, the ADA attached to the spending credential is what determines how much staking rewards are earned, but any rewards accruing due to this ADA can only be spent by the holder of the private key that generated the staking credential.

And specifically to your question (and continuing from Erik's answer), yes this can potentially affect your app.  The issue is that since the address may be one of these mangled (or "frankenstein") addresses, if you naively send the rewards to this address they may not be going to the intended person.
One method some people use is to check for the first registration of the staking address, which should normally be by the "real" owner.

What do you mean by the "first registration" and are there any common methods of checking that?

In provider's like blockfrost, when you want to receive list of addresses having a particular staking part, it allows giving this list, sorted with time it first appeared on chain. See https://docs.blockfrost.io/#tag/Cardano-Accounts/paths/~1accounts~1%7Bstake_address%7D~1addresses/get.

Ok, so if I use the "accounts/{stake_address}/addresses" endpoint and send rewards to the oldest address in the list, I will be safer. Is there any risk that when I use the "accounts/{stake_address}/addresses/assets" endpoint it will return assets that the account doesn't own?

yes but only the real owner of the tokens could spoof them to another staking address, which makes no sense for him


text:
Using testnet with Nami
I want to test a dapp on the Prepod testnet with the Nami wallet. I tried to receive tAda with the faucet but nothing is showing up on the wallet interface.
This is the wallet
addr_test1qrgupcpekj8x5wzw4kk37g38eceh9wdyqeap3puky8yy2k5zpumumlqxeggrg9ezllhhnyrqr892v5tdevccaz780d8s7kw9xp
This is the tx hash
c5a3c23285e44688643f79d2be08ae54e50812e6fe6857028260ff80380ea6a0
What can I do to fix the Nami interface? Or what wallet can I use instead?

The currently released version of Nami runs on the old testnet, but here's a vasil-ready branch of it, that you can install separately for testing on the preprod (or preview) testnet:
https://github.com/berry-pool/nami/tree/vasil
You can download the build from here and

Extract the zip. Then go to chrome://extensions, click Load unpacked
at the top left and select the build folder.

Until Nami adds support for pre-prod testnet you'll need to use a wallet that already supports it, like Eternl.

source: Stack Exchange

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

sort: votes


text:
Running preview/preprod Cardano-node on windows
Im trying to run preprod node .
steps i followed :
1- downloaded these files : https://book.world.dev.cardano.org/environments/preprod/
2- run this :
cardano-node.exe run --topology ./configuration/cardano/topology.json --database-path ./db --port 3001 --config ./configuration/cardano/config.json --socket-path .\pipe\cardano-node and
but i get this error :
doesnt happen with mainnet or old dead testnet .... any idea ?

it looks like your socket-path and the wrong facing slashes should be ./pipe/cardano-node.
Also not sure how you built your node but typically the socket path is in the DB folder so in your case ./db and typically socket is ./db/socket

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


text:
Using cardano-wallet for ingame sign in
i have built an in game User interface around Cardano-wallet.
now im looking for a way to let the player sign in using his wallet .
how can i approach it using cardano-wallet?
is there a way to let the player sign some data using his private key , then on the server side i decode it using his public key ?
( one of the solutions i tried is to let the player send 1 ADA from his wallet to a server provided address , and i monitor the transaction to verify ... but bad approach obviously ..)
thank you for your attention.

will wait for message sign / verify gets added to cardano-wallet api itself ,
https://github.com/input-output-hk/cardano-wallet/issues/3537
implementing it from scratch or doing other hacky ways will be inconvenient.

If your game is not browser based, one way to do this is to create a small website on which you let the user sign a message with a browser based wallet. The website can then send the signed message to your server.
To do this you can use the signData() method as specified in CIP-30.
Or if you have the private key of the user's wallet in your game, you can sign a message in your game and send it to the server.
On your server, you have to verify that the message is signed correctly. You can do this using the cardano-serialization-lib. More details on message signing can be found in CIP-8.
If the message is signed correctly, you can return something like an access token (e.g. a JWT) to the user.

This is a very simple example on how this could work and there are a lot of things you'd need to consider when you implement this like franken-address attacks or token lifetimes etc.

Thank you for your suggestion , i was looking for a way that wont force the user to leave the game or get interrupted from his virtual experience ( could be VR , PS5 , anywhere.. ) . https://github.com/input-output-hk/cardano-wallet/issues/3537 having the message sign-in / verify added to the cardano-wallet api itself , would do the trick. happpy to wait for that .


text:
Error cabal build: "Failed to build lzma-0.0.0.3" even in nix-shell and also tried "sudo-apt install liblzma-dev"
I'm trying to run the command "cabal build" the Week02 code of plutus-pioneer-program but it has this error and I have tried everything but the same error keeps appear:
Failed to build lzma-0.0.0.3.
Build log (
/root/.cabal/logs/ghc-8.10.4.20210212/lzma-0.0.0.3-0c9bb4b908cda90da75c6385d28bd3027ce216c08ab1b83c43f13ae414b04d3b.log
):
Configuring library for lzma-0.0.0.3..
Preprocessing library for lzma-0.0.0.3..
compiling dist/build/LibLzma_hsc_make.c failed (exit code 1)
rsp file was: "dist/build/hsc2hscall1082370-0.rsp"
command was: /nix/store/d2fqghv083a8q7j8sjb2m5q6i840h691-gcc-wrapper-10.2.0/bin/cc -c dist/build/LibLzma_hsc_make.c -o dist/build/LibLzma_hsc_make.o -D__GLASGOW_HASKELL__=810 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Idist/build/autogen -Idist/build/global-autogen -include dist/build/autogen/cabal_macros.h -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc-8.10.4.20210212/lib/ghc-8.10.4.20210212/bytestring-0.10.12.0/include -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc-8.10.4.20210212/lib/ghc-8.10.4.20210212/base-4.14.1.0/include -I/nix/store/grcf3skqwdw35pki3d0gf7mj0flskni7-gmp-6.2.1-dev/include -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc-8.10.4.20210212/lib/ghc-8.10.4.20210212/integer-gmp-1.0.3.0/include -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc-8.10.4.20210212/lib/ghc-8.10.4.20210212/include -I/nix/store/wxb1awkkkbjp26jwqf854488qbzlkk25-libffi-3.3-dev/include -I/nix/store/3av3p9ky0lg2f1bc5jgg2sl872z7g4m9-ghc-8.10.4.20210212/lib/ghc-8.10.4.20210212/include/
error: LibLzma.hsc:44:10: fatal error: lzma.h: No such file or directory
compilation terminated.

cabal: Failed to build lzma-0.0.0.3 (which is required by
plutus-pioneer-program-week02-0.1.0.0). See the build log above for details.

Here are the steps I do:

cd into plutus-apps directory then

$ git checkout 81ba78edb1d634a13371397d8c8b19829345ce0d
$ nix-shell

Now I'm inside the nix-shell, I cd into plutus-pioneer-program's Week2 code and then run

[nix-shell:.../plutus-pioneer-program/code/week02]# cabal update
[nix-shell:.../plutus-pioneer-program/code/week02]# cabal build

That's all, the error above appears. After investigating, I think the error is caused by missing lzma.h, I installed liblzma-dev from this thread, but the error remains.
Can anyone help me out please? Thank you very much!

I am also facing the same issue. Have you found any solution?

After the command
nix-shell

execute in the shell
nix-shell -p lzma

I believe you are using the wrong git commit for plutus-apps for week02. It should be 6aff97d596ac9d59460aab5c65627b1c8c0a1528 according to  https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week02/cabal.project#L63
In other words, you should cd into the plutus-apps directory and then:
$ git checkout 6aff97d596ac9d59460aab5c65627b1c8c0a1528
$ nix-shell

And then proceed with the rest of the process the same way you were doing before.


text:
Ogmios: Follow the tutorial but the Server running for few seconds in Docker then auto terminate :?
I'm new to Ogmios. I'm having trouble using it and I would like someone to help me please. My story is I'm following the tutorial, running this command :

docker run -it \
--name cardano-node-ogmios
-p 1337:1337
-v cardano-node-ogmios-db:/db --platform linux/amd64
cardanosolutions/cardano-node-ogmios:latest

I add "--platform linux/amd64" to the command because the original command from the link produce error of not compatible between linux/amd64 (the images platform) and linux/arm64/v8 (my platform, I'm running on M1 mac).
The output of it is like this:

I guess the command run successfully, even though I don't understand what the last 2 lines mean.
However, whenever I start the container in Docker, it only run a few seconds then stop.
Here's the log of it in Docker:

I guess this should not be the behavior. I think the container is supposed to be running continuously so I can send API request to "localhost:1337" to get data from Cardano. Would anyone tell me what is the problem here please? Thank you!

you could check your system logs why those processes were killed, maybe out of memory. Or try running the docker again with as little as possible running in the background.

Hi @DaveStrider, I don't know what you mean about "system logs", all I can receive is the logs of docker, like this "/root/cardano-node-ogmios.sh: line 31:    14 Killed                  cardano-node run --topology /config/cardano-node/topology.json --database-path /db --port 3000 --host-addr 0.0.0.0 --config /config/cardano-node/config.json --socket-path /ipc/node.socket"
I don't know how to check memory exactly, I think my Mac M1 should not have this problem cause I only run this only one container and nothing in the background.

The docker container was build for Linux (with the ogmios binary compiled on Linux). It cannot work on Mac OS. The question was already answered on Discord, you will not get another answer by asking in different places.

@George-APEXStakePool yeah that's me asking, I ask here first but seem like no one answer so I move to discord.

The main cause of the issue, was that memory was running out( nothing was telling me about it... on closer inspection noticed it), i had to increase to maximal memory capacity through settings, if somebody will run in to the same problem.

Did you got it running finally?
I'm having similar issues with running with docker the latest version, with the usual command
docker run -it
--name cardano-node-ogmios
-p 1337:1337
-v cardano-node-ogmios-db:/db
cardanosolutions/cardano-node-ogmios:latest
28 16:58:44.61 UTC] Chain extended, new tip: d46c975338e913e14abad59702c8d0dd5dabbe512fd744032e9490cdf70d5b16 at slot 22060401
/root/cardano-node-ogmios.sh: line 31:    11 Killed                  cardano-node run --topology /config/cardano-node/topology.json --database-path /db --port 3000 --host-addr 0.0.0.0 --config /config/cardano-node/config.json --socket-path /ipc/node.socket
That it will just die out randomly and afterwards restarting it will start syncing but it could randomly fail any time, maybe i need to add something  to add to that command that it will automatically restart when it fails?


text:
Opening Hydra Heads & Other Cost Related Questions
So i have few questions here, which i wasn't able to find direct answers to.

Does it cost ADA from mainchain to activate/close a Hydra head ?
Does Hydra have similar "channel limits" as Lightning network does? as in i create a head and set limit as 5000 ADA, can that number be adjusted afterwards?
When im interacting with Hydra in general in which circumstances/possibilities i will be needing to use Cardano Mainnet to send/transfer/ funds.

I Tried to ask questions best to my ability based on my somewhat limited tech understanding.

You're technical understanding seems to be quite fine and let me point you to some additional resources / answer your questions:

Yes. Opening and closing a Hydra head costs ADA. It depends greatly on how many participants a Head has and how much funds need to be distributed. Also, different versions of the protocol will cost differently. These benchmarks are done on each commit to master and should give you a rough idea how much these transactions cost: https://hydra.family/head-protocol/benchmarks/transaction-cost/

There is no limit in how much value you can store in a Hydra Head. However, we do limit to only commit a single UTxO per party right now (this limit will be removed eventually)

The hydra-node will need a connection to the Cardano network and submit transactions for opening/closing a Head. Furthermore, in the opening of a Hydra Head, the funds to be made usable in it will need to be "comitted" to the head in a layer 1 (mainchain) transaction.


text:
Boostraping a plutus Smart contract project
I'm trying to "play" with Plutus and write some smart contract for the sake of practicing and getting familiar with it.
My problem is I don't know how to bootstrap a smart contract project.
Starting from the Plutus page on the Cardano Developer Portal, I've watched several videos and read through the user documentation but did not find my way to create a Cardano smart contract project.
What could help me would be:

A template for a minimal Haskell project to write such contracts
Explanations on how to automatically test my smart contract
Step by step tutorial on how to go from my Haskell code to having the contract deployed on a dev or test net

See this post
You can write tests with QuickCheck
There are many ways to achieve this. If you aren't concerned about the architecture and are just in it for learning, an easy way is by using lucid + blockfrost.

I don't have a concrete answer to your question but I can tell you this is definitely something that's in the making. Perhaps an adequate starting point would be the part of Hydra project that deals with just the smart contracts:

This is the source tree for the Plutus contracts: https://github.com/input-output-hk/hydra-poc/tree/master/hydra-plutus
The contracts are unit tested here: https://github.com/input-output-hk/hydra-poc/blob/master/hydra-node/test/Hydra/Chain/Direct/ContractSpec.hs but this requires a bit of scaffolding.

I know this is probably not very helpful...

The Plutus Pioneer Program repository is very helpful to get started:

https://github.com/input-output-hk/plutus-pioneer-program/tree/main/code

There are also Youtube videos explaining the code examples here:

https://www.youtube.com/playlist?list=PLNEK_Ejlx3x0mhPmOjPSHZPtTFpfJo3Nd

It's all PlutusV1 as far as I know.

After learning the basic I just used: https://github.com/input-output-hk/plutus-starter to get all the environment I needed for building my first validators in plutus.
beware it is not updated to Vasil code

try the plutus starter project. It is a nix project,using the cardano iogx nix framework so it may take a while for your environment to come up.


text:
How can I interact with smart contract created from Marlowe in the testnet/mainnet?
I create a smart contract with Marlowe from https://play.marlowe-finance.io
I now want to deploy the contract in the preview testnet and later mainnet. I imagine it must be somehow converted into plutus script. And then use the plutus script to create transaction via cardano-cli.
Is there a way to convert Marlowe into plutus script?
If not, how can I interact with smart contract created from Marlowe in the testnet/mainnet?

Here are four methods for running Marlowe on the blockchain, in increasing order of difficulty:

If you want to run your contract at the command line using marlowe-cli, install marlowe-cli and follow the instructions in the tutorial for running contracts with marlowe-cli. Here is a video lecture that provides an overview of marlowe-cli.
If you want to run your contract in a Jupyter notebook, then use git to clone github.com/input-output-hk/marlowe-cardano, run nix develop --command jupyter-lab from the marlowe-cli/ folder, open the notebook marlowe-cli/lectures/04-marlowe-cli-concrete.ipynb, and follow the instructions. Here is a video lecture of running a contract from within a Jupyter notebook.
If you want to run your contract from the command-line using the Marlowe Runtime backend, then follow the tutorial for Marlowe Runtime. Here is a video demonstration.
If you want to run your contract using Marlowe Lambda, follow the example for using Marlowe Lambda from the command line or study the example web application for Marlowe Lambda. Here is video of a command-line example and here is a video of a web app example.

Is there a way to convert Marlowe into plutus script? If not, how can I interact with smart contract created from Marlowe in the testnet/mainnet?

Marlowe contracts are run as datum in the Marlowe validator, which is a Plutus script that can run any Marlowe contract. There is no need (or possibility) of converting a Marlowe contract directly to Plutus.
Also, mainnet is disabled in the Marlowe tools, but you can alter the source code here and/or here to enable mainnet if you want to run there. Note that Marlowe's audit is not complete, so it is not advisable to run on mainnet.

Damn! you're good

Just realize you're the guy in the video, the creator himself. Good job, man.

Here are some more example Marlowe contracts: https://github.com/input-output-hk/real-world-marlowe#gallery-of-marlowe-contracts-on-cardano-mainnet.


text:
Mesh Error: getUsedCollateral not implemented
I'm using mesh and follow this example of always-succeed smartcontract.
I successfully send Lovelace to the script address. But when building transaction for redeeming Lovelace from the script address, there comes this error:
Error: [Transaction] An error occurred during build: Error: getUsedCollateral not implemented..
at Object.build (/root/meshapp/node_modules/@martifylabs/mesh/dist/mesh.cjs:1:51612)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Everything is like the example except:

I use App Wallet (Example: Browser Wallet)
I send Lovelace (Example: 64af286...)
I use preview testnet (Example: preprod, I guess)

The error occur when building the transaction with
const tx = new Transaction({ initiator: wallet })
.redeemValue({
    value: assetUtxo,
    script: {
        version: 'V1',
        code: '4e4d01000033222220051200120011',
    },
    datum: '0000007',
})
.sendValue(address, assetUtxo)
.setRequiredSigners([address]);

const unsignedTx = await tx.build();

"address" is my wallet address and "assetUtxo" is the utxo where the fund is locked. Both are non nil.
How do I fix this?

Yes, getUsedCollateral isn't implemented yet on AppWallet.
It will be done really soon after we sort out other priorities.
for the time being, you can add Collateral from the Browser Wallet if possible

I assume you're in the team. Do you have an approximation of ETA? I really like working with mesh. AppWallet is much easier for my case.

Yes, you can expect it to be done within a month from now, maybe less. We will start working on it as soon as we finish the ongoing work we have right now.

Quickly glancing at Mesh code it looks like this function is not implemented yet and it might not be possible to create Plutus transactions just yet.

However the library is still under heavy development and I'm sure they will add this functionality soon.

Yeah, it is new. Any alternative to Mesh would you recommend?


text:
Module `Ledger.Typed.Scripts' does not export `wrapValidator'
I try to compile code from Plutus Pioneer Program week 4. These lines cause error.
typedValidator :: Scripts.TypedValidator Vesting
typedValidator = Scripts.mkTypedValidator @Vesting
    $$(PlutusTx.compile [|| mkValidator ||])
    $$(PlutusTx.compile [|| wrap ||])
  where
    wrap = Scripts.wrapValidator @VestingDatum @()

Here is the error:
Not in scope: `Scripts.wrapValidator'
Perhaps you meant one of these:
`Scripts.tvValidator' (imported from Ledger.Typed.Scripts),
data constructor `Scripts.TypedValidator' (imported from Ledger.Typed.Scripts)
Module `Ledger.Typed.Scripts' does not export `wrapValidator'.

That is strange because from the documentation there is the instance wrapValidator in Ledger.Typed.Scripts

wrapValidator :: forall d r. (UnsafeFromData d, UnsafeFromData r) => (d -> r -> ScriptContext -> Bool) -> WrappedValidatorType

How do I fix this?

Assuming the week04 code is unchanged, ensure you have run checked out commit ea1bfc in the plutus-apps repo and run nix-shell within plutus-apps. Then switch to the week 4 directory in the nix shell and cabal build should work.


text:
Custom currency error: Cannot build the initial state: Tag "toCardanoPolicyId"
I try to set an initial state of the emulator like so:
test :: IO ()
test = runEmulatorTraceIO' def emCfg myTrace
  where
    dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000)
                        , (receiverWallet, Ada.lovelaceValueOf 100_000_000)
                        ]

    emCfg :: EmulatorConfig
    emCfg = EmulatorConfig (Left dist) def

myTrace :: EmulatorTrace ()
myTrace = do
  void $ Emulator.payToWallet (senderWallet) (receiverWallet) $ Ada.lovelaceValueOf 5_000_000
  void $ Emulator.waitNSlots 1

It works perfectly. However when I set a custom currency ff with:
    dist = Map.fromList [ (senderWallet, Ada.lovelaceValueOf 100_000_000
                           <> Value.singleton "ff" "TokenName" 100_000_000)
                        , (receiverWallet, Ada.lovelaceValueOf 100_000_000)
                        ]

The script compiles but after running test I get this error:

*** Exception: Cannot build the initial state: Tag "toCardanoPolicyId" (Tag "1 bytes" DeserialisationError) CallStack (from HasCallStack):
error, called at src/Wallet/Emulator/Stream.hs:171:12 in
plutus-contract-1.0.0.0-68585fe6251fbab3f7ee7ae8755133e693587e4f6afa588ae8db3b056e79dcc0:Wallet.Emulator.Stream

This is plutus-apps v.1.0.0. This code works with some other tags.
How do I fix this? Is this a bug?

ff is not a valid PolicyId (aka CurrencySymbol). It must be 28 bytes.
For examples, see this answer on this similar Github issue https://github.com/input-output-hk/plutus-apps/issues/732#issuecomment-1265261105

Thanks. That solves it. "ff" seems to be ok with earlier version of plutus. Not anymore.


text:
Example/documentation of Reference Input (CIP31) and Inline Datum (CIP32) with Emulator?
I am finding an example implementation of Reference Input (CIP31) and Inline Datum (CIP32) and want to test it with the Plutus.Trace.Emulator. I see some answers like here talking about mustReferenceOutput and mustPayWithInlineDatumToPubKey. Not sure if they are them. playground.plutus.iohkdev.io is my main go-to for plutus documentation. But both are not shown in it. An example cabal project would be very helpful.
Is there one out there?

You can run an updated version of the Haddock documentation via the plutus-apps repo. Git clone this repo and checkout v1.0.0. Enter a nix-shell in the repo and perform build-and-serve-docs. The hosted version you refer to is outdated. The functions that you want are defined in the Ledger.Constraints module.

I've been assuming the hosted version is updated or at least fairly so. This helps. Thanks.

@Fermat BTW, is there a way to get to the documentation without entering a nix-shell and compile the whole thing?

@Adam There's a new hosted alternative coming very soon, should be a few weeks max. Look out for PR in plutus and plutus-apps repos for hosted Haddock docs.

Plutus Playground is no longer maintained and that instance will soon be taken down in favour of using the Trace Emulator.
Take a look at some of the plutus-contract integration tests for examples of using each of these constraints with the Trace Emulator. https://github.com/input-output-hk/plutus-apps/tree/main/plutus-contract/test/Spec/Contract/Tx/Constraints.
Note that mustPayWithInlineDatumToPubKey is deprecated in favour of mustPayToPubKeyWithInlineDatum

This is one hell of examples I didn't know existed. Right there in the git. Thanks.


text:
How to generate a .skey file
I've minted some tokens using the JS library lucid. To add these to the Cardano token registry I need to use a .skey file. Is there a way to generate this with lucid? Or another library perhaps?

you could use lucid, as outlined in

generate-credentilas.ts script

here


text:
Unable to sign nft minting transaction using skey
I have an API endpoint that I use in my app to create cardano NFTs. This works fine when creating new policies but I'd like to let the user provide their policy script and skey file to mint on an existing policy.
The transaction fails to sign because I haven't provided the .skey file but I can't figure out where I'm supposed to do this.
const policyId = lucid.utils.mintingPolicyToId(mintingPolicy);
console.log("Policy ID: ", policyId);

const unit = policyId + fromText("My NFT - " + Date.now().toString());

const tx = await lucid
  .newTx()
  .mintAssets({ [unit]: BigInt(1) })
  .attachMintingPolicy(mintingPolicy)
  .complete();

const signedTx = await tx.sign().complete();

The error occurs because you are not explicitly providing the private key (.skey) needed to sign the transaction under the existing policy. Without this key, the signing process fails.
Error

Cause: Calling .sign() without the private key for the policy.
Solution: Load the .skey file and use signWithPrivateKey to sign the transaction.

Fix
Load the .skey file:
const fs = require('fs');
const skey = JSON.parse(fs.readFileSync("path_to_user_provided_skey_file.skey", 'utf8'));

Sign the transaction:
const policyId = lucid.utils.mintingPolicyToId(mintingPolicy);
console.log("Policy ID: ", policyId);

const unit = policyId + fromText("My NFT - " + Date.now().toString());

const tx = await lucid
  .newTx()
  .mintAssets({ [unit]: BigInt(1) })
  .attachMintingPolicy(mintingPolicy)
  .complete();

const signedTx = await tx.signWithPrivateKey(skey.cborHex).complete();

Why It Works
The .skey file contains the private key (cborHex) required to sign and authorize transactions for the minting policy.
Using signWithPrivateKey ensures the transaction is properly signed and ready for submission.


text:
How to install/use cardano-serialization-lib
I follow this guide to get start with cardano-serialization-lib.
Install nodejs package with:
npm i @emurgo/cardano-serialization-lib-nodejs

Still can't get it running. The module 'rust-lib' can't be found. And of course when try to import 'rust-lib' there is an error:
error TS2307: Cannot find module 'rust-lib' or its corresponding type declarations.

So how do I get the module visible?
Step-by-step guide would be really appreciated. I don't have very deep knowledge about how nodejs or rust works.

I thought I have to import 'rust-lib' but instead I have to
import CardanoWasm = require('@emurgo/cardano-serialization-lib-nodejs')

Get the idea from this answer.


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

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

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

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

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


text:
Failed cardano-node build on mac m1
I've followed the installing-cardano-node#macos guide on the developer portal and about 10 things fail to build and all of them are giving me the same error.
Cannot specify -O# and --passes=/--foo-pass, use -passes='default<O#>,other-pass'
`opt' failed in phase `LLVM Optimiser'. (Exit code: 1)

I also followed the steps on this link and I'm still getting the same errors.
https://github.com/mallapurbharat/cardano-tx-sample/blob/main/0_installation/preview_preprod_network/1_macos_m1_process.md
Thank you for your help.

This looks to be an issue with LLVM version 15, as per https://gitlab.haskell.org/ghc/ghc/-/issues/21936
Looks like reverting to LLVM 14 should work for you.

Reverted to LLVM 13 and it worked! (I was getting some other errors on LLVM 14)

Nice one, glad it worked ok.


text:
Get list of users addresses that minted native asset NFT
I would like to get a list of user addresses, that minted a native asset NFT. Is this possible? I do not want current holders of the NFT, but the original minting NFT holders.

Is a solution using cardano-db-sync acceptable?

@ErikdeCastroLopo yes

Here's a way using the https://blockfrost.io API:
Fist you need to get the asset id, I assume you already have this because you know which NFT you want to look up.
Then you would query all transactions of this asset using the Cardano > Assets > Asset Transactions API endpoint:
https://docs.blockfrost.io/#tag/Cardano-Assets/paths/~1assets~1{asset}~1transactions/get
This returns a list of transactions, where this asset has been involved.
[
  {
    "tx_hash": "8788591983aa73981fc92d6cddbbe643959f5a784e84b8bee0db15823f575a5b",
    "tx_index": 6,
    "block_height": 69,
    "block_time": 1635505891
  },
  {
    "tx_hash": "52e748c4dec58b687b90b0b40d383b9fe1f24c1a833b7395cdf07dd67859f46f",
    "tx_index": 9,
    "block_height": 4547,
    "block_time": 1635505987
  },
  {
    "tx_hash": "e8073fd5318ff43eca18a852527166aa8008bee9ee9e891f585612b7e4ba700b",
    "tx_index": 0,
    "block_height": 564654,
    "block_time": 1834505492
  }
]

Now you take the tx_hash of the transaction with the lowest block_height and query the Cardano > Transactions > Transaction UTxOs endpoint:
https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}~1utxos/get
This will result in an object like this:
{
  "hash": "1e043f100dce12d107f679685acd2fc0610e10f72a92d412794c9773d11d8477",
  "inputs": [ ... ],
  "outputs": [
    {
      "address": "addr1q9ld26v2lv8wvrxxmvg90pn8n8n5k6tdst06q2s856rwmvnueldzuuqmnsye359fqrk8hwvenjnqultn7djtrlft7jnq7dy7wv",
      "amount": [
        {
          "unit": "lovelace",
          "quantity": "42000000"
        },
        {
          "unit": "b0d07d45fe9514f80213f4020e5a61241458be626841cde717cb38a76e7574636f696e",
          "quantity": "12"
        }
      ],
      "output_index": 0,
      "data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710",
      "inline_datum": "19a6aa",
      "collateral": false,
      "reference_script_hash": "13a3efd825703a352a8f71f4e2758d08c28c564e8dfcce9f77776ad1"
    }
  ]
}

Go through the outputs of this object and find the one that contains your NFT in the list of amount objects. The address of this output is the original receiver of your NFT.


text:
Does Cardano has flash loans DeFi?
Does Cardano has flash loans implemented? Are they available in production?
If not: are there potential problems with eUTxO model, preventing their usage?

The only information I could find is https://www.essentialcardano.io/glossary/flash-loan .


text:
What number of confirmations is considered secure in Cardano?
There is k finalization param in Ouroboros, but it is absolutely non-practical. It takes around 36 hours AFAIU.

Related questions: https://cardano.stackexchange.com/questions/8760/what-is-your-comfort-level-for-number-of-confirmations-and-why

It depends on the amount of ADA at risk.
Personally I would be happy with 3 block confirmations for a value of US $10, but would want more than that for US $10,000.
Rollbacks of more than 3 blocks are roughly once a year events.

Agree, DbSync waits two blocks before inserting in database, just for reference

Rollbacks of more than 3 blocks are roughly once a year events.

Are there any stats available on rollbacks?


text:
Examples of open source production level DApps on Cardano?
I am looking for Cardano DApps which are:

Actually deployed and used on mainnet
Have published their source code (at least on-chain part)

Examples of non-Plutus PL used (like Plutarch, Aiken, ...) are especially important to me.
I am interested in non Open Source projects as well, but I think it would make question too broad.

Plutarch team provided two examples for me:

https://github.com/Liqwid-Labs/agora/
https://github.com/mlabs-haskell/cardano-open-oracle-protocol


text:
CIP25 Metadata standard version 2 token name
I have seen recently that CIP25 was updated to include version 2. The main change in this is that the token name is now a bytes type whereas before it was a string.
My question is, what type actually is this? Is it a JavaScript Buffer, a byte array, a hex encoded string, or something else?

On the blockchain, the token name was never actually a string and was always bytes. Usually they are ASCII encoded, but they may also be UTF8, UTF-16 or even some other encoding.


text:
Ledger 24-word seed vs Daedalus/Yoroi 24-word seed recovery process does not generate the same ADAs addresses
Using a Daedalus/Yoroi wallet with the 24-word seed and a new Ledger Nano S Plus.
I tried to use the 24-word seed to "recover" the (daedalus) wallet in a new Ledger Nano S Plus, (using Ledger live) the addresses were not the same and obviously not the same wallets. So my questions are:
Why are not the same?. If they are BIP39, the result should be the same?
Second, if I use a new Cardano wallet in a Ledger Nano S Plus, later how can I recover the wallet only with the 24-word seed? (Assuming the hardware was lost and the Ledger company was out of bussines). Is there a way to recover the wallet not using Ledger hardware?
Thank you


text:
How do you interact with smartcontract on jpg.store
Does anyone know how you interact with smart contract on jpg. store
Do we need this?
https://github.com/jpg-store/current-jpg-store-contracts
if so how do we do so?

I don't think you can. Validator are sent with the transaction, so you either have the source code or their CBOR to add to your transaction.
When they move to Vasil and Plutus V2 you'll have reference scripts with that you only need to find a transaction to get the reference to the script.


text:
Cardano-Node Preprod Testnet PeerStatusChangeFailure on Mac
I am trying to run Cardano-node with preprod testnet configuration files from :
curl -O -J https://book.world.dev.cardano.org/environments/preprod/config.json
curl -O -J https://book.world.dev.cardano.org/environments/preprod/db-sync-config.json
curl -O -J https://book.world.dev.cardano.org/environments/preprod/submit-api-config.json
curl -O -J https://book.world.dev.cardano.org/environments/preprod/topology.json
curl -O -J https://book.world.dev.cardano.org/environments/preprod/byron-genesis.json
curl -O -J https://book.world.dev.cardano.org/environments/preprod/shelley-genesis.json
curl -O -J https://book.world.dev.cardano.org/environments/preprod/alonzo-genesis.json

I am using node version 1.35.3 on MacOS Monterey 12.4 using the command :
cardano-node run \
--config $HOME/cardano/preprod/config.json \
--database-path $HOME/cardano/preprod/db/ \
--socket-path $HOME/cardano/preprod/db/node.socket \
--host-addr 0.0.0.0 \
--port 1337 \
--topology $HOME/cardano/preprod/topology.json

I tried to change the host-addr and downloaded all the config files for preprod but still getting this error :
[ip-192-1:cardano.node.Server:Notice:56] [2022-10-20 13:37:56.26 UTC] TrServerStarted [0.0.0.0:1337]
[ip-192-1:cardano.node.LocalRootPeers:Info:54] [2022-10-20 13:37:56.26 UTC] TraceLocalRootDomains [(1,fromList [])]
[ip-192-1:cardano.node.PeerSelection:Notice:55] [2022-10-20 13:37:56.27 UTC] TraceTargetsChanged (PeerSelectionTargets {targetNumberOfRootPeers = 0, targetNumberOfKnownPeers = 0, targetNumberOfEstablishedPeers = 0, targetNumberOfActivePeers = 0}) (PeerSelectionTargets {targetNumberOfRootPeers = 100, targetNumberOfKnownPeers = 100, targetNumberOfEstablishedPeers = 50, targetNumberOfActivePeers = 2})
[ip-192-1:cardano.node.LocalRootPeers:Info:54] [2022-10-20 13:37:56.26 UTC] TraceLocalRootGroups (fromList [(1,fromList [])])
[ip-192-1:cardano.node.PeerSelection:Info:55] [2022-10-20 13:37:56.27 UTC] TracePublicRootsRequest 100 0
[ip-192-1:cardano.node.LedgerPeers:Info:50] [2022-10-20 13:37:56.27 UTC] [String "FetchingNewLedgerState",Number 0.0]
[ip-192-1:cardano.node.LedgerPeers:Info:50] [2022-10-20 13:37:56.27 UTC] [String "FallingBackToBootstrapPeers"]
[ip-192-1:cardano.node.LedgerPeers:Info:50] [2022-10-20 13:37:56.27 UTC] [String "UseLedgerAfter",Number 4642000.0]
[ip-192-1:cardano.node.PublicRootPeers:Info:60] [2022-10-20 13:37:56.27 UTC] TracePublicRootRelayAccessPoint [RelayAccessDomain "preprod-node.world.dev.cardano.org" 30000]
[ip-192-1:cardano.node.PublicRootPeers:Info:60] [2022-10-20 13:37:56.27 UTC] TracePublicRootRelayAccessPoint [RelayAccessDomain "preprod-node.world.dev.cardano.org" 30000]
[ip-192-1:cardano.node.PublicRootPeers:Info:60] [2022-10-20 13:37:56.34 UTC] TracePublicRootResult "preprod-node.world.dev.cardano.org" [(3.72.231.105,60)]
[ip-192-1:cardano.node.PeerSelection:Info:55] [2022-10-20 13:37:56.34 UTC] TracePublicRootsResults (fromList [3.72.231.105:30000]) 0 60s
[ip-192-1:cardano.node.PeerSelectionCounters:Info:55] [2022-10-20 13:37:56.34 UTC] PeerSelectionCounters {coldPeers = 1, warmPeers = 0, hotPeers = 0}
[ip-192-1:cardano.node.PeerSelection:Info:55] [2022-10-20 13:37:56.34 UTC] TracePromoteColdPeers 50 0 (fromList [3.72.231.105:30000])
[ip-192-1:cardano.node.ConnectionManager:Info:65] [2022-10-20 13:37:56.34 UTC] TrConnectionManagerCounters (ConnectionManagerCounters {fullDuplexConns = 0, duplexConns = 0, unidirectionalConns = 0, inboundConns = 0, outboundConns = 0})
[ip-192-1:cardano.node.ConnectionManager:Info:65] [2022-10-20 13:37:56.48 UTC] TrConnectionManagerCounters (ConnectionManagerCounters {fullDuplexConns = 0, duplexConns = 0, unidirectionalConns = 0, inboundConns = 0, outboundConns = 1})
[ip-192-1:cardano.node.ConnectionManager:Info:66] [2022-10-20 13:37:56.63 UTC] TrConnectionHandler (ConnectionId {localAddress = 172.27.228.239:1337, remoteAddress = 3.72.231.105:30000}) (TrError OutboundError (MuxError MuxBearerClosed "<socket: 30> closed when reading data, waiting on next header False") ShutdownPeer)
[ip-192-1:cardano.node.ConnectionManager:Info:66] [2022-10-20 13:37:56.63 UTC] TrConnectionManagerCounters (ConnectionManagerCounters {fullDuplexConns = 0, duplexConns = 0, unidirectionalConns = 0, inboundConns = 0, outboundConns = 0})
[ip-192-1:cardano.node.ConnectionManager:Info:65] [2022-10-20 13:37:56.63 UTC] TrConnectionManagerCounters (ConnectionManagerCounters {fullDuplexConns = 0, duplexConns = 0, unidirectionalConns = 0, inboundConns = 0, outboundConns = 0})
[ip-192-1:cardano.node.PeerSelectionActions:Error:65] [2022-10-20 13:37:56.63 UTC] PeerStatusChangeFailure (ColdToWarm Nothing 3.72.231.105:30000) (HandleFailure (MuxError MuxBearerClosed "<socket: 30> closed when reading data, waiting on next header False"))
[ip-192-1:cardano.node.PeerSelection:Info:55] [2022-10-20 13:37:56.63 UTC] TracePromoteColdFailed 50 0 3.72.231.105:30000 6.615296391013s (MuxError MuxBearerClosed "<socket: 30> closed when reading data, waiting on next header False")

Preprod environment is currently is being relaunched, so you need to wait at least 2 more days from today(20-Oct-2022).
https://t.me/SPOannouncements/227

Can you help me on how to use RPC calls on the preprod testnet server


text:
Error Minting Native Asset: " unexpected '.', expecting space, letter or digit, white space, "+" or end of input "
I am writing a script to automate minting native assets. Everything works well, up until this point:
echo "Building transaction..."
cardano-cli transaction build \
            --babbage-era \
            $NETWORK \
            --tx-in $txhash#$txix \
            --tx-out $address+$output+"$tokenamount $policyid.$tokenhash" \
            --mint "$tokenamount $policyid.$tokenhash" \
            --minting-script-file "$tokenname"/policy/policy.script \
            --change-address $address \
            --out-file "$tokenname"/tx.build;

but every time I run the script, I get this error for "--tx-out":
Building transaction...
option --tx-out:
unexpected '.'
expecting space, letter or digit, white space, "+" or end of input

I followed the official Cardano documentation for how to format the command, but for some reason the 'dot' between $policyid and $tokenhash is giving issues.
Is there something I'm missing? I know the documentation can be notoriously out of date, but nothing I've found online and elsewhere has helped so far.

have you tried substituting the variables with actual values? Could possibly be caused by empty value in one of the variables on tx-out line

Try echoing all those evnvironment variables to make sure none of the have a . character.

Okay, tried the suggestions, now the error I'm getting "Command failed: transaction build  Error: The script language SimpleScriptLanguage SimpleScriptV1 is not supported in the Babbage era."


text:
Attempting to build (NFT) transaction in Python and push through Cardano-cli

right now I am getting the system can't find the path specified but I have tried with and without passing the path in as a variable.
I am running this in Python 3.6+ in Visual Studio Code on Windows.

Is there a particular reason why you don't use a Python library (like Pycardano) for building transactions?

I know there are other libaries, but I am looking to build from ground up just to understand the process.


text:
Use of multi-signature and multi-witness transaction creation
I'm working on a pseudo-centralized product that manages users wallets, protected by multi-signature verification.
I want to know if it is possible for me to batch about 50-100 transactions from various accounts to other accounts, and send them to other accounts but pay the least amount of fees.
For example, in a 1 minute period, there are 5 users sending transactions. Can I pay the fee from my account, while allowing the users to make their transactions.
Accounts/UTXO example:
A -> Z
B -> Y
C -> X
D -> W
E -> V
Pay with ADA from my account F.
How would I handle having each user sign the transaction including me for the fee? How would I even calculate that fee?
Thank you

If I understand correctly, what you are trying to achieve is:

User A indicates that he wants to send VAL1 to Z. Transaction TX1 is
created to implement the transfer, and user A signs it.
User B indicates that he wants to send VAL2 to Y. Transaction TX2 is
created to implement the transfer and includes TX1 inputs and outputs
and user B signs the transaction.
...
User E indicates that he wants to send VAL5 to V. Transaction TX5 is
created including TX4 inputs and outputs, to implement the transfer,
and user E signs the transaction.

This is not possible. The reason being after a transaction has been signed,the witness is only valid for this exact transaction, as it includes transaction's body hash. If you add an input or output that hash will change and the witness won't be valid for the transaction anymore.

What is possible instead :

User A indicates that he wants to send VAL1 to Z, he gets a loading screen 1.
User B indicates that he wants to send VAL2 to Y, he gets a loading screen 1.
...
User E indicates that he wants to send VAL5 to V, he gets a loading
screen 1.
You create the transaction TX with every needed inputs/outputs, calculate tx fees, and divide it among users A...E weighted by  VAL1...VAL5 for instance.
Loading screen 1 over for every users , users A...E sign TX, then get a loading screen 2.
When everybody has signed, loading screen 2 over, then you submit TX, and show a loading screen 3 until TX has been confirmed.


text:
Transaction error from staking account on cardano
I'm trying to get back my funds from my stake.addr from Cardano but I have this error message:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [DelegsFailure (DelplFailure (DelegFailure (StakeKeyNonZeroAccountBalanceDELEG (Just (Coin 500000000)))))])

This error message appears when I run these scripts below:
cardano-cli stake-address deregistration-certificate \
--stake-verification-key-file stake.vkey \
--out-file stake-deregistration.cert

cardano-cli transaction build \
    --tx-in 75e262eb49ba1237b1ee00a4854935d67bd05988baed5472a7ff97b49551d386#0 \
    --tx-out $(cat stake.addr)+500000000 \
    --change-address $(cat stake.addr) \
    --mainnet  \
    --out-file tx.raw \
    --certificate-file stake-deregistration.cert \
    --witness-override 2

cardano-cli transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file stake.skey \
    --mainnet \
    --out-file tx.signed

cardano-cli transaction submit \
    --tx-file tx.signed \
    --mainnet

I can see I have the funds on the explorer here. Thank you if you can help me.

You have 500 ADA rewards at that stake address. First you need to withdraw the 500 ADA, only after that you should deregister your stake key.
You cannot send funds to a stake address, so you cannot use the stake-address in a --tx-out or --change-address line. And if you want to send all the funds to a single address, you just use --change-address, without any --tx-out line. You need to have your payment address in the payment.addr file, but I believe you already have it, since you are signing with payment.skey.
cardano-cli transaction build \
    --tx-in 75e262eb49ba1237b1ee00a4854935d67bd05988baed5472a7ff97b49551d386#0 \
    --withdrawal "$(stake.addr)+500000000" \
    --change-address $(cat payment.addr) \
    --mainnet  \
    --out-file tx.raw \
    --witness-override 2

Then sign it and submit it with the commands you had in your message.
After the transactions completes, you can do another transaction to deregister the stake key, just like you did before. You will need to use a different UTxO as input for the new transaction (because the one from the first transaction will be consumed). You will be able to use the output of your previous transaction.
cardano-cli transaction build \
    --tx-in <new UTxO>#0 \
    --change-address $(cat payment.addr) \
    --certificate-file stake-deregistration.cert \
    --mainnet  \
    --out-file tx.raw \
    --witness-override 2

You can sign and submit this transaction with the same commands as before.
It might work to withdraw the 500 ADA and deregister in a single transaction, but I did not test it, so I cannot recommend it. I will test it on testnet when I have the chance to do it (but not very soon). To test it, I will add the --certificate-file stake-deregistration.cert  line after the --change-address $(cat payment.addr) line in the first transaction.
I am not sure if you are able to deregister the stake address without first withdrawing the rewards. This is probably the reason why you have that error.

Thank you so much it worked. Really appreciate. I think Cardano should at least create a section for this it's very important.


text:
Can't register my stake pool on Cardano (StakeDelegationImpossibleDELEG)
I'm following the official process here on the Cardano tutorial.
Firstly, I have to show you I already have the fund here:
// cardano-cli query utxo --address $(cat payment.addr) --mainnet

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
4c782ea34b517b99e508f675ea1019bc6c60738570ae7dbf074d3ad2d44e8eef     0        600000000 lovelace + TxOutDatumNone
75e262eb49ba1237b1ee00a4854935d67bd05988baed5472a7ff97b49551d386     0        17648934 lovelace + TxOutDatumNone
e663b2e14f180ae341a49bcbde247d074d944942cc3b8794277645ac1e49d377     0        8336205 lovelace + TxOutDatumNone

In the process, I've already created my pool-registration.cert file.
We can double-check thanks to this:
// cat pool-registration.cert
{
    "type": "CertificateShelley",
    "description": "Stake Pool Registration Certificate",
    "cborHex": "8a03581ce9c55b1910e7fdcacf2db1be6f20fadff0e5d68d6566b223698031ab58208ad95d9965ca817e7d7d5d6985ba4c92b77a206250fa59f52acb6ab36507c79b1a001e84801a1443fd00d81e820001581de1084cf0adf9fe75b3e479e6c837676bb85016ae891c624cf59004a00981581c084cf0adf9fe75b3e479e6c837676bb85016ae891c624cf59004a009818400190bb9449e8cc08ff682783d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6574737261706861656c2f43617264616e6f2f702f702e6a736f6e5820dee0758d3212808f99698e96446dd9400b4455d5c44286f91f66dd6c5796d064"
}

// cat delegation.cert
{
    "type": "CertificateShelley",
    "description": "Stake Address Delegation Certificate",
    "cborHex": "83028200581c084cf0adf9fe75b3e479e6c837676bb85016ae891c624cf59004a009581ce9c55b1910e7fdcacf2db1be6f20fadff0e5d68d6566b223698031ab"
}

Then after calculating my fees and taking a look at the hereafter, I'm building my transaction like this:
cardano-cli transaction build-raw \
    --tx-in 4c782ea34b517b99e508f675ea1019bc6c60738570ae7dbf074d3ad2d44e8eef#0 \
    --tx-out $(cat payment.addr)+99802951 \
    --invalid-hereafter 75915180 \
    --fee 197049 \
    --out-file tx.raw \
    --certificate-file pool-registration.cert \
    --certificate-file delegation.cert

Finally, I'm signing and sending my message like this:
cardano-cli transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file stake.skey \
    --signing-key-file cold.skey \
    --mainnet \
    --out-file tx.signed

cardano-cli transaction submit \
    --tx-file tx.signed \
    --mainnet

My result after this is:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [DelegsFailure (DelplFailure (DelegFailure (StakeDelegationImpossibleDELEG (KeyHashObj (KeyHash "084cf0adf9fe75b3e479e6c837676bb85016ae891c624cf59004a009")))))])

Thank you if somebody can help, I will add more information if needed.

You first need to create a registration certificate for the stake key, before being able to delegate it.
You can submit all 3 certificates in the same transaction, just add the key registration certificate between the other 2 certificates.
You can see all the steps in my documentation here: https://apexpool.gitbook.io/stake-pool-scripts/stake-pool-registration/stake-pool-scripts/stake-key-registration

After following your documentation, it worked. Really appreciate it, thank you.


text:
Can't submit transaction on Ada on Babbage era. BabbageOutputTooSmallUTxO error
I'm following the official documentation to send a transaction but I'm still getting the same issue even after to double checked my protocol.json. Based on the protocol, it's supposed to be "minUTxOValue": 1000000
On my account on the mainnet we can see my UTXO
// cardano-cli query utxo --address $(cat payment.addr) --mainnet

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
0c1188f9b5eed8ed8c4b7031ba0bd05cd3d38fea947f1acb1467bcc5baba9583     0        40000000 lovelace + TxOutDatumNone
e663b2e14f180ae341a49bcbde247d074d944942cc3b8794277645ac1e49d377     0        8336205 lovelace + TxOutDatumNone

And I'm running this to submit my transaction:
cardano-cli transaction build-raw \
    --tx-in 0c1188f9b5eed8ed8c4b7031ba0bd05cd3d38fea947f1acb1467bcc5baba9583#0 \
    --tx-out $(cat payment2.addr)+20000000 \
    --tx-out $(cat payment.addr)+20000000 \
    --invalid-hereafter 0 \
    --fee 0 \
    --out-file tx.draft

I know the fees can change but keep in mind I'm using the most recent everytime.
cardano-cli transaction calculate-min-fee \
    --tx-body-file tx.draft \
    --tx-in-count 1 \
    --tx-out-count 2 \
    --witness-count 1 \
    --byron-witness-count 0 \
    --mainnet \
    --protocol-params-file protocol.json

The result for this one is: 176765
expr 40000000 - 20000000 - 176765

For this one the result will be: 19823235.
Then, to update my draft I'm doing this:
cardano-cli transaction build-raw \
    --tx-in 0c1188f9b5eed8ed8c4b7031ba0bd05cd3d38fea947f1acb1467bcc5baba9583#0 \
    --tx-out $(cat payment2.addr)+20000000 \
    --tx-out $(cat payment.addr)+19823235 \
    --invalid-hereafter 75301753 \
    --fee 176765 \
    --out-file tx.draft

Finally I'm signing and sending like this:
// to sign
cardano-cli transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --mainnet \
    --out-file tx.signed

// to submit
cardano-cli transaction submit \
    --tx-file tx.signed \
    --mainnet

The result is every time is:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (BabbageOutputTooSmallUTxO [((Addr Mainnet (KeyHashObj (KeyHash "fe424f32d70231494b27921b57a2485fe4e293ae76b7620216703f9c")) (StakeRefBase (KeyHashObj (KeyHash "5d452ab59c3d40e339da2cc8fe5b57d280363eddd5152374adc4cd23"))),Value 826271 (fromList []),NoDatum,SNothing),Coin 969750)])),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SNothing, invalidHereafter = SJust (SlotNo 75259418)}) (SlotNo 75302578))))])

This is my environment:
cardano-cli 1.35.3 - linux-x86_64 - ghc-8.10

I was wondering if it's an issue from Cardano because I'm clearly following the official documentation.
Thank you so much to the people who can help me.

You're building tx.draft then signing tx.raw. Check you're not using an old txbody.

Thank you so much mate <3


text:
Get back my funds after a mistaken self transaction on Cardano
I accidentally made a self-transaction with my account and would like to know if I can get it back.
As you can see my account here, and this is my self-transaction sent 2 weeks ago.
I'm using cardano-cli to run all my commands and was wondering if a script can give me my funds back. This was related to a pool already deregistered.
Thank you guys if you can help me.

Two possibility for given description (I am assuming you meant second case below, but for completion will answer for both cases)

If you're referring to ~1671 ADA left after spending 500 ADA to register WINS pool, you made an outgoing transaction here, which is when most of your funds on mentioned address were depleted. Since this isn't an internal transaction, you should check your target wallet where you sent funds.
In case it helps remember, this target wallet was since delegated to 4ADA pool

If instead you're referring to 500 ADA you spent as pool deposit in referred transaction, then your post is misleading. That was deposit you paid which could have only be returned IF your pool deregistration was fully complete (as long as your stake account remained registered), but seems your reward address is NOT registered, and thus - that account was left dangling and cannot get a refund, it would instead go back to reserves - unfortunately that'd mean you've lost that part due to the human error.

When you make a self transaction, the only loss you should be seeing are the transaction fees.

give me my funds back

Sorry, there is no way to reverse a transaction. You should already have you funds (minus the transaction fees).


text:
Plutus Emulator trace halting with MintingPolicyNotFoundError
I have the following simple minting script:
{-# INLINABLE unrestricted #-}
unrestricted :: () -> ScriptContext -> Bool
unrestricted () _ = True

unrestricted_policy :: MintingPolicy
unrestricted_policy
    = mkMintingPolicyScript
    $ $$(PlutusTx.compile [|| mkUntypedMintingPolicy unrestricted ||])

unrestricted_policy_sym :: CurrencySymbol
unrestricted_policy_sym = scriptCurrencySymbol unrestricted_policy

annd the following off-chain code:
contract0 :: Contract () Empty Text ()
contract0 = do
    Contract.logInfo @String "unrestricted starting..."
    let val = Value.singleton unrestricted_policy_sym (TokenName "ABC") 1
    let lookups = C.mintingPolicy unrestricted_policy
    let tx = C.mustMintValue val
    ledgerTx <- submitTxConstraintsWith @Void lookups tx
    void $ awaitTxConfirmed $ getCardanoTxId ledgerTx
    Contract.logInfo @String "unrestricted done!"

Any ideas why it's failing?
When I run in the emulator I get the following error:
Slot 00001: *** CONTRACT STOPPED WITH ERROR: "\"ConstraintResolutionContractError (MintingPolicyNotFound 3e112e7d22026ab6ad0e1c77c950cbb8fd5c8568bc5a63950e11bda1)\""

I don't think this would even compile with latest main branch due to mintingPolicy :: Versioned MintingPolicy -> ScriptLookups a.
Can you update and replace C.mintingPolicy with C.plutusV1MintingPolicy

Thanks - it's working now!


text:
Unable to attach two reference inputs to a transaction with Plutus Emulator
I have written a script that will fail unless it receives both oref1 and oref2 as reference inputs. I have the following emulator code:
let rule = mempty
                     <> C.mustReferenceOutput oref1
                     <> C.mustReferenceOutput oref2
                     <> C.mustMintValue val
                     <> (C.mustBeSignedBy ppkh)
tx <- mkTxConstraints @Void (plutusV2MintingPolicy policy) rule
submitTxConfirmed tx

The script fails saying that oref1 is not a reference input. But if I comment out C.mustReferenceOutput oref2 then the script fails saying it has not received oref2 as a reference input. It seems I can attach oref1 or oref2 as a reference input, but not both.
On the testnet, this issue does not occur, so it isn't a problem with the script. Is it not possible with the Plutus emulator to attach more than one reference input to a transaction?

It does work with the emulator. Here's a test that demonstrates this being validated on-chain.
https://github.com/input-output-hk/plutus-apps/blob/9bb44b617212fa195701f0c4a59d6f0e60b7764d/plutus-contract/test/Spec/Contract/Tx/Constraints/MustReferenceOutput.hs#L195-L196


text:
I'd like to get assets from the wallet using blockfrost, but some errors occur

export const callApi = async (endPoint: string) => {
try {
const request: string = env.REACT_APP_BLOCKFROST_URL + endPoint
const response = await fetch(request, {
//@ts-ignore
headers: {
"Content-Type": "application/json",
project_id: process.env.REACT_APP_BLOCKFROST_KEY,
},
method: "GET",
})
let data = await response.json()
return data
} catch (error) {}
}
export const findAssets = async (stakeAddress: string) => {
const endPoint = accounts/${stakeAddress}/addresses/assets
const result = await callApi(endPoint)
return result
}

As you can see in the error message, the address you provide is not in the expected format.
Addresses on testnets start with "addr_test1" but the address you provide starts with "addr1" (probably a mainnet address).
Try to add a testnet address to the request and it should work.
Example testnet address: addr_test1qpmtp5t0t5y6cqkaz7rfsyrx7mld77kpvksgkwm0p7en7qum7a589n30e80tclzrrnj8qr4qvzj6al0vpgtnmrkkksnqd8upj0
Also note that you probably want to use the PreProd network instead of the testnet. Testnet has been broken a while ago.

Thanks for your great answer!

You're welcome. I see you're new here. If this has answered your question, you can mark the answer as accepted.

As mentioned in the error message, you're using invalid (mainnet) address against testnet endpoint


text:
NextJS build - Error: Cannot find module 'crypto'
I am facing this error when building nextjs app.

Error: Cannot find module 'crypto'
    at webpackEmptyContext (C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\648.js:9:10)
    at __wbg_require_6461b1e9a0d7c34a (C:\Users\User\Desktop\equine\dev-client-equine\packages\website\.next\server\chunks\8571.js:19424:109)
    at <rand_os::wasm32_bindgen::OsRng as rand_os::OsRngImpl>::new::h9c7a4b6a2b8ae92f (wasm://wasm/00a9b126:wasm-function[1724]:0x13a630)
    at rand_os::OsRng::new::he9ba4878a48d4dc5 (wasm://wasm/00a9b126:wasm-function[4526]:0x1bbe8c)
    at cardano_serialization_lib::crypto::Bip32PrivateKey::generate_ed25519_bip32::h0e42fd6e7efb4205 (wasm://wasm/00a9b126:wasm-function[1262]:0x117108)
    at bip32privatekey_generate_ed25519_bip32 (wasm://wasm/00a9b126:wasm-function[4677]:0x1c069e)
    at Function.generate_ed25519_bip32 (C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\8571.js:2163:83)
    at C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\648.js:4522:165 {
  type: 'Error',
  code: 'MODULE_NOT_FOUND'

My package.json dependencies:
 "dependencies": {
    "@apollo/client": "^3.6.9",
    "@emurgo/cardano-serialization-lib-browser": "^11.0.5",
    "@emurgo/cardano-serialization-lib-nodejs": "^11.1.0",
    "axios": "^0.27.2",
    "big-integer": "^1.6.51",
    "classnames": "^2.3.1",
    "cookie": "^0.5.0",
    "cookies-next": "^2.1.1",
    "formik": "^2.2.9",
    "graphql": "^16.6.0",
    "js-cookie": "^3.0.1",
    "next": "12.2.2",
    "react": "18.2.0",
    "react-cookie": "^4.1.1",
    "react-dom": "18.2.0",
    "react-modal": "^3.15.1",
    "react-responsive": "^9.0.0-beta.10",
    "react-youtube": "^9.0.3",
    "replace-in-file": "^6.3.5",
    "swiper": "^8.3.1",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@types/js-cookie": "^3.0.2",
    "@types/node": "18.0.3",
    "@types/react": "18.0.15",
    "@types/react-dom": "18.0.6",
    "@types/react-modal": "^3.13.1",
    "crypto": "^1.0.1",
    "eslint": "8.19.0",
    "eslint-config-next": "12.2.2",
    "jest": "^29.0.3",
    "next-intercept-stdout": "^1.0.1",
    "sass": "^1.53.0",
    "ts-jest": "^29.0.1",
    "typescript": "4.7.4"
  },

I installed crypto as devDependency to check if it will resolve issue. Failure.
I installed emurgo nodejs to check if it will resolve issue. Failure.

What guide are you running off of? Please post the link to the guide.

What do you mean by guide ?
I have the private api file(cant share), on React (create-react-app) project works fine, but for NextJS this happens.


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

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

will do the trick. Credits to this answer.

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


text:
"You may need an additional loader to handle the result of these loaders."
I'd like to import Mercury module, but some errors occur.
I can't confirm this reason on react version or other things.
Can I solve this error using current react version? If It's impossible, other solution?
Thank you in advance.
"dependencies": {
    "@mercury-chat/react-chat": "^0.1.3",
    "@types/react": "^17.0.13",
    "@types/react-dom": "^17.0.8",
    "@types/react-router": "^5.1.16",
    "@types/react-router-dom": "^5.1.8",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.0",
    "typescript": "~4.0.5",
     ...
 },

import React from 'react';
import { MercuryChat } from '@mercury-chat/react-chat';
const App = () => {
  return (
    <div>
      <MercuryChat />
    </div>
  );
};
export default App;

Failed to compile.
./node_modules/@mercury-chat/react-chat/dist/index.js 509:5
Module parse failed: Unexpected token (509:5)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| //---------------------------------------------------------------------------//
| class EmbeddedWalletAPI {
>   api;
|   wallet;
|   //---------------------------------------------------------------------------//


text:
Error when unpacking snapshot to bootstrap Cardano node by using Mithril
I'm trying to bootstrap a Cardano node on preview network by using Mithril follow this instruction:
https://mithril.network/doc/manual/getting-started/bootstrap-cardano-node/
In step "Restore Selected Snapshot", I had a problem after downloading c9839be0355587c4a9a3bcff4a5285001b12e2f2b7ea3ac38bb2dc1ab25d3baf snapshot.

Then I used all snapshots are listed but it still had encountered the above error.
Please let me know how can I fix it?

You are probably using a wrong aggregator endpoint. In order to make the restoration work, please use the following endpoints:

Cardano preprod network: https://aggregator.release-preprod.api.mithril.network/aggregator
Cardano preview network: https://aggregator.pre-release-preview.api.mithril.network/aggregator

The Mithril networks configurations are also available in our documentation website at https://mithril.network/doc/manual/developer-docs/references#mithril-networks


text:
What is native assets, Also Not able to send my ADA from Exodus Wallet
My name is Adam gil and I am crypto follower. I have been using Cardano from past few months. Recently I tried to send my ADA from Exodus wallet. I have 4600 ADA in my Exodus wallet.
The Issue - When I try to send my ADA, it is allowing me to send 0.776781 ADA and than it displays message saying “Transaction amount is too small to send”.
Next it shows a second message like - “Needed for holding ADA native tokens:1.666665ADA”
Tried multiple times and also by refreshing the system but it doesn't help.
Please help me to understand - what this Native Token is and where I get them?
If you need wallet address I can share in next message.
Thanks in advance.

There is a minimum amount that can be held at a UTxO, see https://docs.cardano.org/native-tokens/minimum-ada-value-requirement.
I guess you have at least one cardano-native token in your wallet, perhaps you traded for one? If Exodus does not show this you can search your wallet address in an explorer such as https://cardanoscan.io/ to see your token balance.
Basically, you have to send more as to satisfy the network minUtxo constraint.

Got it. Thanks!


text:
“USDA” is All Set to launch in Early 2023 | What services will it provide?
According to Emurgo, USDA will go live on the Anzens platform in Q1 2023, allowing users to tokenize their USD into USDA using credit/debit cards, wire transfers, or the conversion of ADA.
USDA is a component of Emurgo’s Anzens program, a larger scheme that would provide customers with a range of financial services and products based on Cardano.
Can some one detail the application/services these programs support?

Based on this EMURGO's blog post, the services and use cases that the Anzens program will have are:

Managing Web3 balance sheets
Making card payments directly with crypto
Regulated lending and borrowing of assets
Conversion to other stablecoins (not only USDA)
Conversion and swaps of other cryptocurrencies
Setting up stake pools that pay out rewards in USDA

For more information, you can check their website.

Thank you for the detailed information.

No worries! If it was helpful, you can mark the answer as accepted using the grey tick. Cheers.


text:
Creating a connect wallet button like JPEG.store
I am creating a React app and I want to integrate a connect wallet button that can then return the users wallet address, similar to JPEG.store. What is the best way to approach this. I tried using Cardano connect with wallet https://github.com/cardano-foundation/cardano-connect-with-wallet but I cant figure out how to return the users address after they have signed in with their wallet. Any help is appreciated.

This could be solved by variety of tools:

Using Lucid, you can first enable (connect) with wallet as outlined in this simple example. Then get address via lucid.wallet.address() (it returns a Promise, so you might need to use async / await). This address is basically obtained from CIP-30's, getUsedAddresses()'s first element.
Like what you have shared in question, Mesh has a prebuilt component for it, which can be seen here. Once connected, you can get address as mentioned in this page.
Regarding library in question, can use decodeHexAddress on browser wallet api's, getUsedAddresses()'s first element.


text:
Is it possible to create a flutter app that would create and sign cardano transaction
I would like to create a simple mobile application using flutter that would create and sign a transaction and submit it through an API like Blockfrost to the network for which it will   interact with a smart contract address.
Is there any supporting library or any approach that can achieve this?

If you are willing to use a javascript library (see https://stackoverflow.com/questions/66145501/how-to-use-a-js-library-and-a-js-function-in-a-flutter-mobile-app) then you can try the helios library: https://github.com/Hyperion-BT/Helios
Helios should be callable from within flutter as it doesn't have any dependencies and uses pure javascript (no wasm).
With helios.js you can build transactions (https://www.hyperion-bt.org/Helios-Book/api/building/index.html). Signing however is usually done by a wallet, and for submitting to blockfrost you would have the call the blockfrost endpoint directly.
helios.js also allows compiling smart contracts written in the Helios language, but you probably won't be needing that.


text:
BlockFrost IPFS error
I can't upload an image to IPFS through
ipfs.blockfrost.io/api/v0/ipfs/add
from browser. I am trying to upload image dircetly from frontend of my application (browser extension). I get this response:
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "Converting circular structure to JSON\n    --> starting at object with constructor 'Socket'\n    |     property 'parser' -> object with constructor 'HTTPParser'\n    --- property 'socket' closes the circle"
}

When I try to do the same request from node.js server everything is fine. I use the same fetch call on both front and back:
let add = await fetch('https://ipfs.blockfrost.io/api/v0/ipfs/add', {
method: 'POST',
headers: {
'project_id': 'ipfsP0t7F3zOIIl6Op5fpM3c2q3CBYyYa7em'
},
body: form
});

It seems like there is a problem on blockfrost's server side with parsing additional headers that browser adds.
Or is this behaviour intentional and I shouldn't be able to send requests from frontend? Then the error seems uninformative.
Has anybody faced a similar problem?

What is your Content-Type header?


text:
Clocks on Air-gapped, Offline Computers
What risks (security-related or otherwise) may potentially inaccurate clocks--that is, clocks that do not synchronize with an Internet time server--on air-gapped, offline computers used to sign transactions create for Cardano mainnet?

Time plays no role in Cardano transactions, so the computer that signs transactions doesn't need a notion of time.
You can however specify a range of slots in which your transaction is valid. (But transaction building, which is distinct from signing, is something you would usually do on an online computer, so you can also easily determine the UTxO IDs to use as inputs.)


text:
Cardano mempool
I have looked at this thread: Is there any platform to read the Mempool? asking if there is a way to read the (historic) cardano mempool. Back then, there was none so I was wondering if anything has changed since then. Anyone familiar with a method/ webpage that reports historic cardano mempool transactions?

There is no "historic" mempool. The mempool is ephemeral. It is updated every time a new block arrives.
It is however possibly to reconstruct the mempool for any point in time using something like cardano-db-sync or by replaying all blocks up to a certain point in time and applying them to the ledger.


text:
Plutus-tx on XEON v2
I am trying to compile plutus script on 'Intel(R) Xeon(R) CPU E5-2680 v2' machine.  I initialized nix flake from input-output-hk/iogx haskell template (tried with ghc96 and ghc92), entered development environment with nix develop and tried to compile simple code like
integerOne :: CompiledCode Integer
integerOne = $$(compile [|| (1 :: Integer) ||])

Compilation fails with
Error: cabal: Failed to build hello-1.0.0.2. The build process terminated with exit code -4

And when I try to load the code to ghci, it reports
Illegal instruction (core dumped)

On my laptop it compiles successfully.
Looking at the coredump I discovered that the instruction was mulx from adx cpu feature.  /proc/cpuinfo says that my laptop has that feature, but the server does not.
Except for compiling with PlutusTx.compile anything other from ghc seems to work on the server well.
The question is, is there any way to run this on my server?  Any flag or fix to plutus-tx or ghc?  Can anyone point me to the part of plutus-tx package (or the proper ghc?) that generates that instruction?

I created the ticket: https://github.com/IntersectMBO/plutus/issues/5842

The problem lies in the blst C library that is a dependency of cardano-crypto-class Haskell library.  blst should be built with -D__BLST_PORTABLE__ flags as in iohk-nix.

try this flake.nix, it uses the iogx as well with plutus-tx >= 1.21.  The corresponding code builds on my lenovo p1 laptop with Xeon CPU. Although, I am not sure if it is the exact CPU as your specs.

Thank you for the reply.  I tried your flake.  I cloned the repo and tried to enter development environment.  When nix built it, it dumped core while compiling plutus-script-utils so I believe the repo also has the same problem.


text:
How to import Plutus.Contracts.Currency
I am trying to build an application that will make use of function mintContract under Plutus.Contracts.Currency, but i have difficulty importing this module. What can i do?

You can import it as follows as then use it with Cur.mintContract.
import Plutus.Contracts.Currency qualified as Cur

Thanks for your reply. But maybe i should have been more explicit on what i've tried before. I did try "import Plutus.Contracts.Currency qualified as XXX", but it said "Could not find module `Plutus.Contracts.Currency'". I tried this on my local playground and https://playground.plutus.iohkdev.io/, it shows the same error message.
I am not sure if it is due to the playground not being up-to-date.

Hey, it seems at the end i can get around with mintContract with singleton and mustMintValue and achieve the same purpose.


text:
convert hex encoded bytes string to something readable
I'm using nami wallet's api, and if I call cardano.getUsedAddresses() it return a "hex encoded bytes string" and I would like to  know how I can convert that to something readable

First, getUsedAddresses() returns a list of all used (included in some on-chain transaction) addresses controlled by the wallet1.
To decode, can use decodeHexAddress on getUsedAddresses() elements.

1 https://cips.cardano.org/cips/cip30/#apigetusedaddressespaginatepaginateundefinedpromiseaddress

that file is written in typescript. I have used javascript. should I switch to typescript?

Entirely up to you. You can import this function inside your JS project, like so: import { decodeHexAddress } from '@cardano-foundation/cardano-connect-with-wallet'.


text:
Cardano Node 1.35.4 problems
I am running cardano node 1.35.4 on Windows 10 it syncs to 100% then gives me the following screen

If you are asking about Unsupported remote target address ... errors (ipv6), then I suspect that you start the node only specifying IPv4 address.  To get IPv6 address either:

do not specify ip addresses at all (then the node should discover which addresses the host machine supports); or
specify both IPv4 and IPv6

If you just specify one of them, the node will only bind to that address, and be able to use outbound connections using that IP version.  This allows us to support environments where IPv4 or IPv6 is not available.

Thanks for your help , I am currently not specifying any IP address
cardano-node run --topology "configuration\cardano\testnet-topology.json" --database-path "db" --socket-path "\.\pipe\cardano-node-testnet" --port 3001 --config "configuration\cardano\testnet-config.json"


text:
Get Delegations in Cardano
I am going to get delegations list for specific pool, epoch.
https://docs.blockfrost.io/#tag/Cardano-Epochs/paths/~1epochs~1{number}~1stakes~1{pool_id}/get
I found blockfrost api and tested.
My test pool: ac66c8efb8edba3991576235e421ef0524ab351a22598de520de7b16, Epoch: 378
I got 9 delegations from blockfrost api.
[
    {
        "stake_address": "stake1uyyp9ydgm834vnhhv0wd9sd9xlxwsmcv37xs6uw0f66626scn5v6z",
        "amount": "3326619748"
    },
    {
        "stake_address": "stake1uy8vrh3a8ujzqanlw2r3rf23lc6uelnd390lanxwulsdhqqudsl8m",
        "amount": "116381727"
    },
    {
        "stake_address": "stake1uyjv3s932h8ar2zudw6q30h65kn76g00v0z7kmz2td5cgdsx5dl7r",
        "amount": "1024314243"
    },
    {
        "stake_address": "stake1uy4kl6dyg3hegqapvx53y6lazgx3z79g4p2ds4rc80lcvuc4j9v4h",
        "amount": "7062695853"
    },
    {
        "stake_address": "stake1u927nhw76vzpmtufuc5fa4nj74tkw9mhugqrqdz9hklw9hctcfv4y",
        "amount": "15260602"
    },
    {
        "stake_address": "stake1ux3rkq6grckauj72qyfm9mcs8y49phzrm9el00rzdh6n3kcnnspzy",
        "amount": "771665304"
    },
    {
        "stake_address": "stake1u820d54llavvwctmuvr6gugytlqlglp4slyy30vl4w43wag6dn4ya",
        "amount": "0"
    },
    {
        "stake_address": "stake1u84euhe0va89n55t02y4xdydtpd0gau48e73wahhmuplj4chr87cv",
        "amount": "169480944"
    },
    {
        "stake_address": "stake1u8aa3nq3vf98jw36977lu6s09pa2xtfr3v65sagl7nywhys5jxvfa",
        "amount": "226565423"
    }
]

If I check by cardanoscan.io explorer, I can see 12 delegators.
https://cardanoscan.io/pool/ac66c8efb8edba3991576235e421ef0524ab351a22598de520de7b16?tab=delegators
I think I should get 12 delegations from api, but I got 9 delegations.
Could anyone help me to get exact delegations?

You are looking at a number of delegators for the active epoch (therefore the state of delegators two epochs ago) and cardanoscan is showing you the live delegations, which are two different things.
To get the current list of delegators, you need to use the /pools/delegators endpoint:
$ curl -s  -H "project_id: ..." "https://cardano-mainnet.blockfrost.io/api/v0/pools/ac66c8efb8edba3991576235e421ef0524ab351a22598de520de7b16/delegators" \
   | jq .[].address \
   | wc -l
12

Thank you for your answer. 378 is current epoch. Could you explain why it is two epochs ago?

When you're talking about delegation against an epoch, you're expected to be looking at active stake of delegators for said epoch (as that's what you're getting blocks assigned for, and rewarded accordingly), not live stake/delegators


text:
Public cardano-wallet service list
While I am checking cardano-wallet-js, I noticed requirement.
Before start using the library you will need a cardano-wallet server running.

Is there any public cardano-wallet server which I can use to initialize walletServer?

No, as the cardano-wallet service holds information about your keys, accounts and so on.
But you can use cardano-wallet with Blockfrost.io in light mode with the need to sync the entire chain which takes few days.


text:
Get pool reward for specific epoch
I want to get pool(private pool) reward for specific epoch.
I searched blockfrost.io apis, can't find reward api.
How can I get reward by api? Or other solution will be fine like graphql.

You need to look at the specific pool's history using the pools/{pool_id}/history endpoint.
[
  {
    "epoch": 233,
    "blocks": 22,
    "active_stake": "20485965693569",
    "active_size": 1.2345,
    "delegators_count": 115,
    "rewards": "206936253674159",
    "fees": "1290968354"
  }
]

See docs.blockfrost.io.

Thank you for your answer. For private pool, reward amount is always 0. It seems all reward value become margin. Is it possible to get margin value in the pool history?

It should not be 0 I think. Are you sure you're not looking at the first epoch of the pool, where it does not participate in staking yet?

The historical values of the pool margin value are available in db-sync.

As the main dev on db-sync I can tell you how to get it there.
In the simplest manner possible (with randomly chosen pool and epoch):
# select id, view from pool_hash where view =
    'pool19u64770wqp6s95gkajc8udheske5e6ljmpq33awxk326zjaza0q' ;
 id |                           view
----+----------------------------------------------------------
 13 | pool19u64770wqp6s95gkajc8udheske5e6ljmpq33awxk326zjaza0q
(1 row)
# select sum (amount) / 1000000 as ada_reward from reward where earned_epoch = 354
    and pool_id = 16 and type = 'member' ;
     ada_reward
--------------------
 13856.795160000000
(1 row)

This could be made into a single query with a join of the two tables.


text:
Transaction in Cardano
I created transfer function with blockfrost.js and cardano-serialization-lib.
I refered following code.
https://github.com/blockfrost/blockfrost-js/tree/master/examples/simple-transaction
When I try to transfer with above code, I am getting following error.
"transaction submit error ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (ValueNotConservedUTxO (Value 0 (fromList [])) (Value 2663366 (fromList []))))),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (BadInputsUTxO (fromList [TxIn (TxId {_unTxId = SafeHash \"***\"}) (TxIx 1)]))))])"

Interesting thing is, transaction is success also, I can see success transaction in cardano explorer.
Can I ignore above error? Or how can I fix above error?

I think this error means you are spending a UTxO that is no longer available.

This probably means that you are trying to spend an UTxO that is already spent.
This can mean few things, but most probably that you are submitting the transaction for the second time.
If you are using Blockfrost, check the /mempool endpoint to see if you transaction is in the mempool or /txs if it is already on-chain.

It is on on-chain. So, what can I know from it? Can I ignore this error?

Depending on your use case. Why are you getting this error in the first place? Are you trying to retry the transaction more times?

Yes. you are correct.

In that case you can ignore the error. :)

Thank you. Could you explain in detail?

The error just says that the utxo you are trying to spend is already spend, so you cannot do it again. Ideally, you would submit transaction once and check if it is in the mempool or txs and only if it is not there, you would resubmit ti again.


text:
How to get balance of enterprise address
https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1%7Baddress%7D~1extended/get
I am using above blockfrost api to get address balance.
However, it isn't working with enterprise address, I am getting 504 error for enterprise address.
I also tried https://api.koios.rest/#post-/address_assets, getting same 504 error.
How can I get balance for enterprise address?

This endpoint also works with enterprise addresses for me.

Can you let me know address?

The endpoint is working with enterprise addresses too (as well as with payment credentials or any other addresses).

$ curl -s  -H "project_id: ..." \
   https://cardano-mainnet.blockfrost.io/api/v0/addresses/addr1v8px4syex8e07e6c2ucfheh27t2tcxxjm5el22g0cw32m5g77jc7x \
   | jq
{
  "address": "addr1v8px4syex8e07e6c2ucfheh27t2tcxxjm5el22g0cw32m5g77jc7x",
  "amount": [
    {
      "unit": "lovelace",
      "quantity": "17374229558"
    }
  ],
  "stake_address": null,
  "type": "shelley",
  "script": false
}

$

As you can see in the example above, this address does not contain any stake_address.

Thank you for your answer. Could you check this address ? addr1v9u7va2sktlnz8dp3qadpnxxlv4m03672jy6elmntlxxs7q9nnwl9 Why is it not working?

It works fine for me. When you open https://cardano-mainnet.blockfrost.io/api/v0/addresses/addr1v9u7va2sktlnz8dp3qadpnxxlv4m03672jy6elmntlxxs7q9nnwl9 what do you get?

Oh, /addresses/{address}api is working. I was trying /addresses/${address}/extended

Not sure why, .../extended also works for enterprise addresses generally, but not for this particular one. Maybe related to the high number of transactions, so could be a bug in blockfrost.


text:
Get Master Key from Mnemonic seed for Cardano Byron wallet
I have wallet in Infinito wallet. My mnemonic seed has 12 words and Yoroi, Daedalus Wallet does not support it.
I can get different Master Private key, address for Cardano Shelley, Byron wallet from mobile wallet app.
I am going to get them from code.
The master private key of Cardano Shelley can be gotten by following code.
const rootKey = CardanoWasm.Bip32PrivateKey.from_bip39_entropy(
  Buffer.from(entropy, 'hex'),
  Buffer.from(''),
);

Ref: https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-keys#bip39-entropy
But I can't get the master private key of Cardano byron wallet.
How can I get the private key and address of Cardano byron wallet from mnemonic?

Can you share what error you are getting when you say you cannot get it with that function?

What prefix does your Byron wallet start with? Ae2 or  Dd?

I don't get any error. I am getting another private key which is different from wallet app. Its prefix is Ae2

Actually, I am getting same private key as Cardano Shelley. I want to know if there is another way to get private key for Cardano byron

did anyone manage to recover the Ada Byron from Infinito wallet?

Hi @u30004 and welcome to the Cardano StackExchange. If you have a question about a new topic, please open a new question instead of posting an answer on a related question. Otherwise people will probably not see it and the likelyhood of getting an answer is close to zero.

The way you obtain the rootKey from the mnemonic is the same for both Shelley and Byron.
For Byron, you then have to do the following to get the right address:
const accountKey = rootKey
  .derive(harden(1852)) // purpose
  .derive(harden(1815)) // coin type
  .derive(harden(0)); // account #0

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

const byronAddr = CardanoWasm.ByronAddress.icarus_from_key(
  utxoPubKey, // Ae2* style icarus address
 CardanoWasm.NetworkInfo.mainnet().protocol_magic()
);

You can have more information here.

I already tried it. But I am getting another byron address which is different from Infinito wallet address. I think Infinito wallet was using old way to get private key and wallet address. Is there any other way to get private key?

I am not familiar with Infinito wallet. Is it possible to ask their team on how they do it?

Update*****. Byron era cardano that is stuck in Infinito wallets can be accessed and moved with the Moonstake wallet app. Tested and works. You import your wallet with your byron private key that Infinito gives you. Thanks to Hazel from the Infinito helpdesk.
There is quite a few of us with cardano stuck in our infinito byron wallet. Late 2022, they added a warning to the app to move our byron to shelly or it would become inaccessible. I had to roll back infinito app to previous version and sideload app install.  Most of us have our 12 word passphrase, private key, and public address. My public address shows the correct ada on block elporers.  Daedalus, yoroi (previous version) browser extension, and a few other wallets like adalite.io will accept 12 key passphrase, but will generate diff keys. So our ada is as of right now inaccessible. Infinito discontinued suppot and do answer emails as far as i know.  If any savy cardano-cl guys could write a script allowing us to insert our private keys and move our ada to shelly...thatd be real nice. Also worth paying a fee to the creator of such a script.  Becuase it is frustrating to have ur crypto stuck even though you have passphrase, pvtkey and pubkeys. I havnt found a solution with any known wallet yet.  The previous versions of infinito no longer have connectivity to a node i suppose. So, I, and many others are currently stuck. Any help would be greatly appreciated.
Side note, I emailed IOHK and Yoroi for help, they both responded promptly. But their solutions were to restore with daedalus or lacy.io, neither worked for me.


text:
cardano-submit-api install error
I'm trying to install cardano-submit-api on my linux node following IOhk documentation:
cardano-node $ cabal install cardano-submit-api --overwrite-policy=always
but I have an error:
...
Got NamedPackage ouroboros-consensus-cardano-tools
CallStack (from HasCallStack):
error, called at src/Distribution/Client/CmdInstall.hs:474:33 in main:Distribution.Client.CmdInstall
Can anybody help me please? I cannot find any solution :(
Many thanks in advance!
Jaialai

What git tag/branch are you using? Starting with 1.35.4, they moved a lot of compilation to CHaP, but for 1.35.4 tag in particular - the cabal install was broken, was fixed on master since. But you should still be able to use build commands for submit-api, and then copy the generated binary to your $PATH

Thanks for your response, yes I'm trying with 1.35.4 version. Finally what I did is take the binary for submit-api directly (compiled for someone who knows more than me :) and it works perfectly. I found it in Armada Alliance Team.
Best regards.


text:
Lucid Vesting demo, signing from two different accounts but same seed
I'm working through the beneficiary vesting example where we have two beneficiaries: beneficiary 2 (giver who can reclaim funds after deadline), and beneficiary 1 (must claim gift before deadline).
In the demo lucid claim function, i tried to parametrize the signer function like so
async function claimVestedFunds(beneficiary: string): Promise<TxHash> {...

But I set up the wallet from the point of view of beneficiary 2 (wallet address):
lucid.selectWalletFromSeed(secretSeed);
const addr: Address = await lucid.wallet.address();
const details: AddressDetails = getAddressDetails(addr);
const beneficiary2: string = details.paymentCredential.hash

Then I hard-coded beneficiary 1 PKH into the Vesting datum, but I'm not sure how to get 1 to do the signing in claimVestedFunds
      const tx = await lucid
            .newTx()
            .collectFrom(ourUTxO, Data.void())
            .addSignerKey(beneficiary)
            .attachSpendingValidator(mistery1)
            .validFrom(Date.now()-100000)
            .complete();

I thought this would work because these two beneficiaries are actually derived from the same seed phrase (i control both accounts).
My code appears to allow beneficiary 2 to vest and reclaim, but i'm not sure how to allow beneficiary 1 to sign


text:
Minting stablecoin Aiken example
I'm having trouble building the off-chain code to mint stable-coins from lecture 9, with Aiken. I deployed the oracle NFT with datum rate as a reference script:
const tx = await lucid
    .newTx()
    .mintAssets({ [token]: 1n }, Data.void())     // no redeemer
    .collectFrom([aliceUTxO])
    .attachMintingPolicy(nftPolicy)
    .payToAddressWithData(oracleAddr, { inline: Data.to(1n), scriptRef: oracleValidator }, { [token]: 1n })
    .complete()

I query the oracle NFT UTxO with rate = 1, but in my mint:
    .newTx()
    .readFrom([oracleScriptUTxO])
    .payToContract(collateralAddr, { inline: collateral_datum }, { lovelace: 20_000_000n })
    .mintAssets({ [USDA]: 10_000_000n }, Data.to(minting_redeemer))
    .attachMintingPolicy(stablecoinPolicy)
    .addSignerKey(bobPKH)
    .complete()

returns
error: Uncaught (in promise) "Redeemer (Mint, 0): The provided Plutus code called 'error'.\n\nExBudget {\n    mem: 148621,\n    cpu: 58366996,\n}\n\n"

The minting branch of the Aiken validator is taken from the lecture:
...
when redeemer is {
      Minting -> {
        let oracle_rate: Int =
          get_oracle_rate(reference_inputs, params.mp_oracle_validator)
        expect [collateral_output]: List<Output> =
          find_script_outputs(outputs, params.mp_collateral_validator)
        let collateral_output_datum: CollateralDatum =
          get_collateral_datum(collateral_output)

        let collateral_output_amount: Int = lovelace_of(collateral_output.value)

        let stablecoin_minted_amount: Int =
          get_total_minted_stablecoin(ctx, policy_id)

        let check_mint_positive = stablecoin_minted_amount > 0

        let check_max_mint =
          max_mint(
            collateral_output_amount,
            oracle_rate,
            params.mp_collateral_minPercent,
          ) >= stablecoin_minted_amount
        // Collateral datum must match params
        let check_collateral_output_datum =
          check_collateral_output_datum(
            collateral_output_datum,
            stablecoin_minted_amount,
            extra_signatories,
            policy_id,
          )

        // Final checks
        and {
          check_mint_positive?,
          check_max_mint?,
          check_collateral_output_datum?,
        }
      }

...


text:
Any helpful resources to build with the Laravel framework and php?
There are good libraries for Javascript frameworks to build dApp like Meshjs, Lucid, etc.
I'm new to PHP and the Laravel framework.

Is it possible to integrate those JavaScript libraries, with the Laravel framework?

Or, are there any dedicated packages or tools available for Laravel framework to build dApp?

The use case is to connect a wallet and send payments.
Thanks.

I've also used Laravel in the past and did a combination of Cardano Serialization Lib (or now Multiplatform Lib) in Javascript.
So on clientside I mainly used JS to interact with:

CIP30 webwallet connections / signTx or getUtxo's or signData, etc
CSL/CML to serialize transactions which are submitted through the client's wallet

For any blockchain queries I used a combination of :

Blockfrost API
DB-sync connection

Hope this helps!


text:
Can I view a Plutus smart contract on the NFT marketplace?
Can I view a Plutus smart contract of an NFT from the marketplace like (JPG store) and what is PubKeyHash ?

You cannot view it directly on the chain.
The PubKeyHash is just the payment part of their contract address.
It is a good custom that the smart contract should be open source, in the case of jpg.store, their contract is released on github as contract-v2.