text:
'No Corresponding Policy Script' Error when Script Was Provided
Following the Mintin NFTs IOHK tutorial I end up with the following error when crafting the transaction.
Command failed: transaction build  Error: The "--mint" flag specifies an asset with a policy Id, but no corresponding monetary policy script has been provided as a witness (via the "--mint-script-file" flag). The policy Id in question is: ..9570b

I don't understand the error because I am giving the script file with the flag mentioned.
cardano-cli transaction build \
--testnet-magic 1 \
--tx-in ...e6f70#0 \
--tx-out addr_test1...s8qjk+2198569+"1 ...9570b.4d7946697273744e4654" \
--change-address addr_test1vrhwzwj5plmracdydsr57k7putcuxfzktffc2v4hgm7kc8gfs8qjk \
--mint="1 ...9570b.4d7946697273744e4654" \
--mint-script-file policy.script \
--metadata-json-file metadata.json \
--witness-override 2 \
--out-file tx.raw

And here is the policy.script that has the hash of the policy verification key policy.vkey.
{
  "type": "all",
  "scripts":
  [
    {
      "type": "before",
      "slot": 6378920
    },
    {
      "type": "sig",
      "keyHash": "...33060c"
    }
  ]
}

I would like to have a better idea of what can be wrong as the error is not helping in understanding what has gone wrong.

This might be too late.
Have you checked that your policyID is the same as "...9570b"?
Assuming you are following the docs and are in the nft folder you can run echo $(cat policy/policyID)
Otherwise, if you are following the docs to a T and you are not missing any step I would recreate what is written on the docs.
First I would add the era => --babbage-era \
Then if you are following the docs, perhaps the script is in a different folder.
The docs add --invalid-hereafter $slotnumber \ and witness is a WORD, therefore, needs to be written as a string => --witness-override '2' \


text:
Cardano-Cli Transactions with Assets Utxo
I am getting an error when trying to send a transaction with the following Utxos:
                             TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
3a197302622324ebda7b96b39bf566fb408309b8947e635675cbce94efb90bf6     1        2822751 lovelace + TxOutDatumNone
c84758dbea49a9bfd4ce143b074c2f89486027b0595e5e7ca6da5f32a63a3edf     0        5000000 lovelace + 1344000000 698a6ea0ca99f315034072af31eaac6ec11fe8558d3f48e9775aab9d.7444524950 + TxOutDatumNone

and here is the error:
Command failed: cardano-cli transaction submit                  --tx-file ./testnet/trial23_tx.signed                   --testnet-magic 1097911063
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 7822751 (fromList [(PolicyID {policyID = ScriptHash "698a6ea0ca99f315034072af31eaac6ec11fe8558d3f48e9775aab9d"},fromList [("tDRIP",1344000000)])])) (Value 7822751 (fromList [])))))])

is this error due to the fact I am using a Utxo which holds an asset?
I was following this tutorial: https://developers.cardano.org/docs/stake-pool-course/handbook/create-simple-transaction/
is there a tutorial that would help me understand how to create a NOT simple transaction with Utxos + assets?

here is an example of a transaction i send from 2 TxHash, sending ADA + Token
remember, the summary of 2 tx-out must be equal to 2 tx-in.
cardano-cli transaction build-raw
--fee {fee}
--tx-in b98eb283dflkh4582402u40480253c23c0fc35e1a2bcf445e18#0
--tx-in eebb2a5sldfjkdlkfjo485u30ruwldkfjs45346352126b220de8f6f#1
--tx-out addr1qy4hewroi045398753987923oriwrio2u034urrt5rz0vdpmc8lzlpqcj0yznqwaelpl+2000000+"1 0fd9819234872935727sdf7027400df7hg077dc15.5692847553"
--tx-out addr1v9uh244h55jk5k6jk4b2kn42kln53um+7049462+"8 0fd9819234872935727sdf7027400df7hg077dc15.5692847553"
--out-file tx.raw

can one Utxo have more than one asset?

like:
--tx-out "address+5000000 + 5 policyid.assethexname + 100 policyid2.assethexname2" ?

yes for sure
, and you text it the correct way.

You need to specify the Ada and asset in the output so it balances. Something like --tx-out "address+5000000 + 5 policyid.assethexname" with your remaining balance needed to balance the transaction.

source: Stack Exchange

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

sort: votes


text:
Cardano-Cli How to Check Address Delegation Status?
is it possible in cardano-cli to check the status of delegation for any stake.addr?
is there a command that shows which pool a stake.addr is delegated to?
does that require the use of the heavy ledger-state?

cardano-cli query stake-address-info does what you're looking for. It shows the registration status of a stake address, if it's delegated and how many rewards are available for withdrawal.

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


text:
Create Delegation Certificate Transaction
When building the Create Delegation Certificate Transaction with the cardano-cli, do we need to use all the Utxos of a wallet/base.address? or we can just use one Utxo only as long as it covers the fee?
from coincashewnut
cardano-cli transaction build-raw \
    ${tx_in} \ #all the Utxos in an address here? or just one is enough?
    --tx-out $(cat payment.addr)+${txOut} \
    --invalid-hereafter $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --certificate-file deleg.cert \
    --out-file tx.raw

If the only purpose of this transaction is to submit a delegation certificate, then the only costs will be the fee for submitting it. Any UTXO will suffice of the --tx-in, so long as the TX is then signed by the appropriate payment (for the fee) and staking keys (for the delegation). Once submitted, any and all UTXO's residing at the address(es) in the delegation certificate will automatically be delegated to whatever pool you've chosen - no need to manually delegate individual UTXOs.
Fun fact: you can even pay the fee for such a transaction from an address/wallet completely unassociated with the address you are delegating, so long as the Tx contains the appropriate payment signatures.


text:
cardano-wallet-js
I'd like to play around with cardano-wallet-js and see what can be automated with transactions and better understand how things work.
I get that I need first to install cardano-wallet and this is the only instruction I found on how to install it. But I incur in problems as I don't know how to use Docker ERROR: Couldn't connect to Docker at http+docker://localhost - is it running? even though docker service is running.
Is there any more throughout instruction on how to install cardano-wallet and then cardano-wallet-js?
Is there any other way to use cardano-wallet-js?
are there other tools that make it easier for a non very technical guy as me to make scripts for transactions and wallets?

If you don't have experience with docker, don't use it. It just adds another layer of complications. The easiest way to get a wallet up and running is to get the release binaries from the assets at the bottom of this page for your architecture: https://github.com/input-output-hk/cardano-wallet/releases/tag/v2021-12-15
Then you'll need to start both the node and wallet processes on your system. At that point you can run your nodejs code that talks to the API.
On the node side, read this to get a working node:
https://developers.cardano.org/docs/get-started/running-cardano/
On the wallet side, it's the serve command here that you want to run: https://input-output-hk.github.io/cardano-wallet/user-guide/cli:
At that point you can use cardano-wallet CLI to test it out and eventually point your nodejs code at wallet API to run your custom application.


text:
Delegation Deposit
When delegating for the first time there is a 2 ADA deposit being spent.
Is this 2 ADA ever returned? if yes when is it returned and how?

Yes it can be returned. 2 ADA is the current cost of registering your staking key on chain (this is to prevent sybil attacks). If and when you de-register your staking keys, the 2 ADA is returned to the original address it was sent from.

thanks, eventually I found the unstake option in ccvault.io in the wallets settings, scroll down.


text:
How does one decide what is the best stake pool to delegate to?
I'm ready to delegate to a pool. I know the easiest options are to do so using either Daedalus or Yoroi. But, how do I choose which pool to stake to and does it really matter?
I found this post on reddit which does a good job of describing saturation and pledge. It also discusses what the fees mean. What I'm really asking here is that I don't understand why it might matter which pool to delegate to when it seems that any one will give me about 4-6% apy over the whole year. If I'm going to get that APY no matter which pool I delegate to, why does it matter which one I delegate to?

There are lots of reasons to choose a stake pool other than the parameters and the ranking in Daedalus.
It depends on your values. Do you value decentralization? Do you want to support a big pool operation that has multiple pools under one brand or a single pool operator? You could support a pool that gives a percentage of it's operator rewards to charity. You could choose a pool that runs on Raspberry Pi's over a pool that runs on Google servers. You could look for a pool who's operator is easy to contact and interact with, they are active on twitter and/or YouTube. They have a strong web presence with good resources for delegators. Some stake pools are offering extra rewards in the form of ADA lottery or their own Cardano native tokens that they have minted themselves.
The fist pool I delegated to ran on solar panels and was ranked in the top 10. Now, I wouldn't even look at the ranking in the wallet. I've chosen a stake pool because the operator is active in the community and creating valuable content for the community. He is running a single pool on Raspberry Pi, under 1M ADA in active stake. I value supporting smaller pools that are trying to get up and running.
It's very much a personal choice based on countless variables.

How do you recommend searching for a stake pool based on values? Given your example, if I wanted to find a list of small stake pools operated by folks who have been active in the community, and/or ones powered by solar or running on a Raspberry Pi, how would I do that?

Go to pooltool.io

There is a choose portfolio search that can filter based on these kind of preferences. It's not comprehensive, but a good start. You can go to the analysis tab and filter based on active stake and ROS. If you want to support a small pool you could choose a pool with sub 1M active stake and a good average return. There are pool profiles on pooltool.io that have links to social media accounts and websites. It takes some research but in a short amount of time you should be able to find someone that you are comfortable supporting.

There is no "right" answer to this question.  It depends on your personal priorities.
The numbers matter if your sole concern is financial.
In general there are not vast differences in return from one pool to another
There are a multitude of other reasons to back a pool such as:

Geographical location
Community they support
Projects they are working on or associated with
Where their profits are directed
Many, many, others

Most pools go into detail about what makes them special on their own websites.

If you go to https://adapools.org and select "Analysis" > "Cardano Donuts (Groups)" > Select "Single Pool Operators" > Filter by "ROA 1M/Lifetime" you can start the selection of a staking pool based on the following criteria (this is not the full list because you can select many more):

Pledge
Fees
Stake
Check "Last Rewards" if the pool is actively minting
Saturation
Live stake


text:
What are the pros and cons of Cardano's liquid staking over other protocols that use a bonded staking model?
As some background, Cardano has a "liquid" staking model, which means that stake is never locked when it is being delegated. Other, "bonded" staking models require a locking period of various lengths (anywhere from days to months), which means the coins can not be moved and spent. I'm hoping a two-fold answer can be provided that discusses security and economics.

In my understanding, hardening the system by locking your coins is great. It has the disadvantage of not being a realistic economic policy, where the velocity of money (i.e. using it) is a must for sustainance. GDP = VELOCITY X MONETARY BASE, for example.
Cardano solves this by taking snapshots of the locked coins, so the next epoch happens in, sort of, a parallel universe where all the tokens are locked, but lets the economy of the ecosystem be heakthy by letting then move freely. Then the next snapshot happens, and hence the system keeps being secure no matter if there is a large dump, things change hands or tokens are sold for fiat.
I hope I made myself clear, otherwise let me know and I will give you a more structured answer.

Pros (advantages)

Coins are not locked while staked and can be freely spent or transferred
Staked coins do not slow the velocity of value transfer in the ecosystem
Staking pools for existing wallets can be changed at any time

Cons (disadvantages)

Coins will not be staked until the next staking snapshot occurs
New wallets need to exist for a period of time before staking becomes active on them
Existing wallets have a delay between changing staking pool and it taking effect

Those cons largely apply to bonded staking as well, since time delays are part of the system. Another disadvantage is that liquid staking being a unique/novel concept requires education for each new ADA holder, specifically around re-defining the word "stake"


text:
Lucid Error "End of input in bytes"
I am running the simple vesting script from PPP for the first time with Lucid and I continuosly get an error which doesn't give me much to understand what could realistically be the source of.
the validator goes:
data MisteryDatum = MisteryDatum
    { beneficiary1 :: PubKeyHash
    , beneficiary2 :: PubKeyHash
    , deadline     :: POSIXTime
    }

unstableMakeIsData ''MisteryDatum

{-# INLINABLE mkMisteryValidator #-}
mkMisteryValidator :: MisteryDatum -> () -> ScriptContext -> Bool
mkMisteryValidator dat () ctx =
    traceIfFalse "Benificiary1 did not sign or to late" checkCondition1 ||
    traceIfFalse "Benificiary2 did not sign or is to early" checkCondition2
    where
        txInfo :: TxInfo
        txInfo = scriptContextTxInfo ctx

        txValidRange :: POSIXTimeRange
        txValidRange  = txInfoValidRange txInfo

        checkCondition1 :: Bool
        checkCondition1 = txSignedBy txInfo (beneficiary1 dat) &&
                          contains (to (deadline dat)) txValidRange

        checkCondition2 :: Bool
        checkCondition2 = txSignedBy txInfo (beneficiary2 dat) &&
                          contains (from (1 + deadline dat)) txValidRange

while the Lucid function that causes the error is:
async function claimVestedFunds(): Promise<TxHash> {
  const dtm: Datum = Data.to<VestingDatum>(datum,VestingDatum);
  const utxoAtScript: UTxO[] = await lucid.utxosAt(vestingAddress);
  const ourUTxO: UTxO[] = utxoAtScript.filter((utxo) => utxo.datum == dtm);

  if (ourUTxO && ourUTxO.length > 0) {
      console.log(ourUTxO)
      const tx = await lucid
          .newTx()
          .collectFrom(ourUTxO, Data.void())
          .addSignerKey(beneficiaryPKH)
          .attachSpendingValidator(vestingScript)
          .validFrom(Date.now())
          .complete();

      const signedTx = await tx.sign().complete();
      const txHash = await signedTx.submit();
      return txHash
  }
  else return "No UTxO's found that can be claimed"
}

I checked date and beneficiary many times and they are correct, the only problem could be that I am using the same address public key for both benificiary1 and benificiary2. But that shouldn't be a problem right?
Anyway the function above shows the right UTxO
[
  {
    txHash: "a1d743f6a6c795dff9a5691ee25f1831485dd59f57476d6d9260691aaf65c3e6",
    outputIndex: 0,
    assets: { lovelace: 8700000n },
    address: "addr_test1wznyv36t3a2rzfs4q6mvyu7nqlr4dxjwkmykkskafg54yzs735734",
    datumHash: undefined,
    datum: "d8799f581ccecc6981a300d41fac6ae169c569a297c2837b1d8988762034ba4a65581ccecc6981a300d41fac6ae169c569a2...",
    scriptRef: null
  }
]

At this point something in the validation fails before the transaction is even sent and I receive the followign error:
error: Uncaught (in promise) "Redeemer (Spend, 0): end of input bytes"

I don't understand what could cause it as everything seem right and the error isn't articulated enough to give me precise indications, but what seem to cause that error is the line .collectFrom(ourUTxO, Data.void()) which seem fine to me as the UTxO is the right UTxO and the redeemer has to be void.

Quoted from the answer linked below:
The error tells you that there is an error but you don't catch it. This is how you can catch it:
claimVestedFunds().then(response => {
    console.log(response);
}).catch(e => {
    console.log(e);
});

https://stackoverflow.com/questions/37624322/uncaught-in-promise-undefined-error-when-using-with-location-in-facebook-gra

thanks, but even then all it tells me is "Redeemer (Spend, 0): end of input bytes"

@user3755529 I wonder if it's possible your line for filtering is not working? This line const ourUTxO: UTxO[] = utxoAtScript.filter((utxo) => utxo.datum == dtm); Are you getting a valid utxo every time?

yes, the console.log at the beginning of the if always shows the right UTxO

@user3755529 Can you try a couple things? Preferably 1 at a time to narrow it down. 1. Instead of passing Data.void() into collectFrom, set a const and pass it in like follows const Redeemer = () => Data.void();
2. You are calling complete() twice on the same tx. I'm guessing you just need to do this once.
3. I would also try not passing Data.void() at all, since it's supposed to be optional. It looks like the lucid code checks if it's undefined, so really it should work without passing anything.

oh wow, yes, that seem to work, I get another error after at submit stage, need to look on it, but it seem the previous error is gone and I pass validation, thanks!

although now when I use const Redeemer = () => Data.void(); it tells me encoding/hex: invalid byte: (return new Error(.. and when I put nothing the transaction fails saying it lacks a redeemer .. (ApplyTxError [UtxowFailure (FromAlonzoUtxowFail (MissingRedeemers ..

@user3755529 Can you post the entire error for the invalid byte issue? Might be a red herring tho. The complete() call should come directly after the sign() call. I should have mentioned that before when I said you only needed one. Sadly Lucid's docs are sparse. I would also try it without validFrom. In its entirety ```
const Redeemer = () => Data.void();
const tx = await lucid
.newTx()
.collectFrom(ourUTxO, Redeemer)
.addSignerKey(beneficiaryPKH)
.attachSpendingValidator(vestingScript);
  const signedTx = await tx.sign().complete();```

if I don't use complete in the first variable tx I get TypeError: tx.sign is not a function       const signedTx = await tx.sign().complete()

error: Uncaught (in promise) Error: encoding/hex: invalid byte: (
return new Error(
^
at errInvalidByte (https://deno.land/std@0.100.0/encoding/hex.ts:15:10)
at fromHexChar (https://deno.land/std@0.100.0/encoding/hex.ts:35:9)
at decode (https://deno.land/std@0.100.0/encoding/hex.ts:78:15)
at decodeString (https://deno.land/std@0.100.0/encoding/hex.ts:110:10)
at fromHex (https://deno.land/x/lucid@0.9.1/src/utils/utils.ts:577:10)

at https://deno.land/x/lucid@0.9.1/src/lucid/tx.ts:80:41
at Tx.complete (https://deno.land/x/lucid@0.9.1/src/lucid/tx.ts:534:13)
at claimVestedFunds (file:///workspace/code/Week04/lecture/homework1.ts:97:34)
at async file:///workspace/code/Week04/lecture/homework1.ts:112:13

@user3755529 Looks like the line above this error is missing. The carat ^ is pointing to the actual char thats bad. Is there a line above this error that you can paste here.
Error: encoding/hex: invalid byte: ( return new Error( ^ at errInvalidByte
Maybe try changing the collectFrom to this.
.collectFrom([ourUTxO], Redeemer)

the ^ is pointing at n  in new Error

Review your vestingScript in Lucid. It's supposed to be structured as follows:
const vestingScript: SpendingValidator = {
    type: "PlutusV2",
    script: "590b30590b2d010000323……”,
};

However, after compiling, the JSON output is formatted differently:
{
    "type": "PlutusScriptV2",
    "description": "",
    "cborHex": "590b30590b2d010000323……"
}


text:
Burning tokens after the 'before' time slot?
For a minting policy that specifies a 'before' slot requirement, it is impossible to mint new tokens after the specified time slot. Is it also impossible to burn existing tokens after the specified time slot?

Not right now, but IOG is working for a way to burn these, so for now, keep them around!


text:
How does the ERC20 converter actually work?
Since Ethereum & Cardano are distinct networks, when the ERC20 converter moves tokens between them in either direction ensuring conservation of token (the process does not destroy or create tokens), what is actually happening? Is the ERC20 converter a centralized process that operates on both networks or something more decentralized and trustless? If it's not a centralized process, I would be very interested to know how conservation of tokens is maintained considering that the two networks do not directly interact with each other.

From the IOHK blog post: Bringing ERC20 to Cardano

Our ERC20 converter is a tool that will allow issuing organizations
and their users to handle ERC20 token migration to Cardano. It is
designed for token issuers (organizations that wish to enable the
migration of their tokens to Cardano), and their users (token holders)
to use the tool to move their ERC20 tokens to the Cardano network.
Users can convert their Ethereum tokens in just a few clicks, and when
moved across, these tokens will be ‘translated’ into a special native
token on Cardano that has the same value and works just like an ERC20.
Additionally, if the user wishes to do so at a later stage, they can
move their tokens back to the source network by burning them on
Cardano. Two-way convertibility is baked in.

After logging into the ERC20 converter, Users must authenticate their source account via Metamask and provide their Daedelus address for token delivery.  Tokens are then migrated to to the Cardano address.  All operations on the migrated token are visible on both Cardano explorer and Etherscan
Conversion is token specific and adding a token for conversion requires partnership to add a token to the list of tokens available for conversion.

OK, but that still doesn't explain how the conversion actually happens on a blockchain level. Metamask is just the UI. How does the conversion atomically remove an ERC20 token from Ethereum and put a matching native token on Cardano? Is it done by a central program that interacts with both blockchains? If not, how?

It's the best answer I could come up with, not the best answer there is.  As I understand it, the Ethereum ecosystem sees it as having a Cardano address and all the ERC-20 properties.  The Cardano ecosystem sees it as a native token.  I suspect the burn process transfers it back to an Ethereum address but I couldn't confirm these assumptions.

The answer is EVM. Ethereum Virtual Machine. You should definitely look into how they work.
It works the same way centralized exchanges like Binance and CryptoCom work.
The coins value is intrinsically already a part of the system and the coin itself is a native token on the Cardano network regardless if its ERC-20 or not.
By using the EVM technology they can convert coins instead of wrap them by having a bridge between both networks and having a version of both ADA on ERC-20 and ETH natively on Cardanos network. Liquidity providing is how you know your coin is still your coin and because it's on the blockchain its verified by the entire network that the transaction took place for garunteed no duplication.


text:
General approach for allowing multiple smart contract transactions per block
In some applications, multiple users interact with the same smart contract and may want to do it at about the same time. Such interaction involves updating the state of the smart contract as embodied in the UTXOs of the smart contract address. One example application is a DEX.
Because all the users interact with the same smart contract, potentially spending existing UTXOs and creating new ones, potentially only one user can succeed in each block and the other users have their transactions rejected due to double-spending the UTXOs, limiting the throughput of the application.
Is there a general approach for dealing with this kind of situation to allow more transactions for a smart contract to succeed in each block?

Not as far as I know. The current model is limited to one state change (transaction) per block per smart contact.
However, depending on the specific smart contact and its use case, I can see people using a centralized entity (or a group of users) post transition proposals and then have an incentive to bundle all of those up into one that actually modifies the global state. Not ideal, but this is the price to pay to have a state-full smart contact design.

This has been bugging me for a while now. I'm not as worried about it as I was before though. Here are some thoughts:
Lars says there are ways around the problem:

Of course there are ways around. You need to parallelize. In an auction contract, for example, you can have several UTxO's instead of just one.

This seems fine to me. Of course there is still a chance of collision. A collision isn't the end of the world, but you could make as many UTxOs as you want to minimize the worry. You can also do things off-chain to pseudo-randomly choose a UTxO (with the modulo of your hashed redeemer, for example).
Back of napkin estimates
If you look at something like Uniswap, which has on the order of ~100K transactions/day and ~50 Liquidity pools. Cardano has 4320 blocks/day, so that would be an average of around .5 tx/block/lp (obviously some pools are much more popular). But having somewhere between 10-100 UTxO/pool should be plenty.
How does it work?
EDIT: This actually still has problems. I can't think of how you would determine the rates without including all the UTxOs in a txn--which defeats the purpose. Hmm, still need to think things through.
For a Uniswap, the way it could work is the sum of all the datums on liquidity pool NFT UTxOs in a pool equal the total liquidity for that pool. Anyone adding or removing from the pool can modify any number of the UTxOs, but for the sake of fees they would tend to modify the minimum number necessary to add/remove from the pool. For pools with a lot of collisions, there might even be a way to incentivize participants to open new pools or even add more UTxOs to existing pools perhaps? The factory token would just need to keep track of how many liquidity NFTs are floating around for each pool.

Theoretically, you can just create multiple eUTxOs to reduce collisions. But that isn't an ideal solution. For example, an oracle would have to maintain a lot of different eUTxOs and create new ones to update the oracle value. This would cause a lot of transaction fees for the oracle provider, linearly increasing by count.
Additionally, I'm wondering How can an oracle guarantee certain update rates respectively uptime?

Please see my article "Scaling with UTXOs." I outline several different approaches. These include buffering, state sharding / replication, and using transactions which do not consume UTXOs.
https://journal.platonic.systems/p/scaling-with-utxos

One possible solution for this is that instead of letting the users of your dapp compete for a single UTxO you let them publish a "request for transaction" and then let an open bot network compete to aggregate and execute these transactions into a single block. If your dapp relies on a single state stored in a single UTxO then only one bot will be able to consume that UTxO but you can design your smart contracts in a way that will allow the winning bot to execute multiple "request for transaction" together with consuming the state UTxO. If these "request for transaction" contain a bounty then bots will be incentivized to execute as many "request for transaction" as possible and it doesn't matter which bot wins since all bots will try to execute all transactions.
Variations of this solution are described in the following blog posts:
https://medium.com/meld-labs/concurrent-deterministic-batching-on-the-utxo-ledger-99040f809706
https://medium.com/minswap/introducing-laminar-an-eutxo-scaling-protocol-for-accounting-style-smart-contract-d1ac8847dde8


text:
Difference between "normal key" and "extended key" in cardano-cli address key-gen
With cardano-cli address key-gen, what is the difference between a normal key (obtained with --normal-key) and an extended key (obtained with --extended-key)?

I'll preface with the note that cardano-cli is a legacy project from the Byron era prior to the restructuring of cardano-sl into the modern infrastructure used today. You likely want to use the cardano-address if you can. The Adrestia repo keeps track of the official tools, libraries, and APIs as well as their support for the various eras.
To give a short explanation, the way key generation in Cardano works is as follows:

You create a Recovery or Seed Phrase. This is a deterministic seed that then derives your extended private key. This is the famous 24 word phrase that you store. It derives your xprv key but it does not represent it. This means if you do not have a seed phrase, you can not get one and you'll have to create a new wallet to get it.

You create the Extended Private Key. This is the root key from which all other keys are derived (including the extended public key). This key can either be created from scratch or derived from a seed phrase. If you want your key to be loadable into Daedalus/Yoroi without poking around in the internals and manually editing the SQLite database, you need to start from a seed phrase.

You derive Child Private Keys. These are various keys that serve specific purposes. Examples include the delegation(staking) keys, the various stake pool keys, and spending keys. As the protocol grows, there'll be more of these keys however as long as you have your extended private key or seed phrase, you'll be able to gain access to those with little to no action required.

You derive whatever else from the Child Private Keys. This is where you would derive addresses, stake pool certificates, etc. This is essentially all handled by the node itself and you don't really have to worry about much of this stuff unless you are doing something specific.

So in summary, the seed phrase is the "seed" that creates everything else (and is easy to store/remember), the extended key is your "master key", and the normal key (now called a spending key) derives from the extended key and lets you spend your funds.
Also note that the terminology differs a bit between eras. Byron used a rather different key system so you should generally avoid using it unless you absolutely have to. Icarus established the basis for modern key derivation in the Cardano ecosystem and Shelley has extended upon that (with staking related keys).

The Adrestia repo README lists cardano-wallet among other tools so you seem to be implying that cardano-cli is deprecated and that I should use cardano-wallet instead. I'm trying to mint some native tokens, which I know how to do with cardano-cli. Is minting supported by newer tools like cardano-wallet? A cursory inspection of the cardano-wallet help reveals no minting functionality. If cardano-cli is the only way to mint native tokens, then I'm missing the bridge between how cardano-cli manages keys and addresses and how the newer tools (e.g. cardano-address) do it.

I'll report back after I do a bit of research first. From my understanding cardano-cli kinda supports Shelley and Mary. I think the development of native assets started on cardano-cli and is still being ported over to cardano-wallet. It is ultimately just metadata Tx which cardano-wallet supports. From what I can tell atm it looks like if you want to mint native assets with cardano-wallet, you can do it but it's a manual process. The fields and validation seem to exist in the backend but there doesn't seem to be a cli interface other than the metadata interface exposed at the moment.


text:
What are some ways a SPO can attack the network and what mechanisms exist to discourage or mitigate such attacks?
What are some ways a SPO can attack the Cardano blockchain? E.g. in Bitcoin, a miner could intentionally exclude certain transactions to the extend that the miner's hash power allows. Is something like this possible in Cardano? What about other forms of attack? What discourages such attacks or mitigates the harm they can cause?

I am still researching if it is possible for a SPO to choose and exclude transactions when they are elected to create the block. I am pretty sure it isn't something you can just do 'out of the box,' I believe you would need to modify the client code of your block producer. With that said, if they could do that, it still wouldn't cause much damage. The reason why is because there is enough entropy built into the slot leader selection that the next block would pick up the excluded transaction. This is because it would be a new slot leader, thus only causing a ~20 second delay. This kind of attack is also discouraged because there is not incentive for just 1 pool operator to cherry pick (choose some, exclude others) transactions because the rewards are pooled and distributed at the end of the epoch. Meaning that if there were a lot of full-blocks, you could very slightly increase the overall rewards. However, after dividing it out to all the SPOs who created blocks, it likely wouldn't be worth your time. Now if multiple SPOs worked together on something like this, and we were constantly creating full blocks there could be incentive to choose the transactions that have larger fees (like ETH).

The most feasible (and most well-established) method by which any kind of validator (be it a miner, SPO, etc) can game the system is through Miner Extractable Value (MEV), a.k.a front-running. It is an endemic (though non-catastrophic) problem for any public blockchain network that is maintained in a trust-less fashion.
In a nutshell, when a validator creates a new block, she temporarily gains a non-insignificant glimpse into the future of the blockchain before the rest of the network does. This is because there is a small amount of time elapsed between the validator making the block locally and that block being validated and incorporated into the rest of the network. Let's call this the MEV-window. If during this window the issuing validator is quick enough to act, they can gain an arbitrage opportunity over the rest of the network. This is especially true if the validator in question is responsible for more than just good 'ol block production on the CSL, but is also providing oracle data, babel fee liquidity, DEX scooping, and/or a variety of other distributed services.
For example, if I'm an SPO and an oracle provider, and I see that the block I'm about to publish contains a sudden surge of transactions towards a known exchange address(es), I may conclude that the price is about to go down, so I may then include some of my own buy orders in the same block. I can also adjust my oracle feeds to match where I expect the price to go before anyone else does; I'd be using my position as a block producer (in that moment) to front-run the market. This is just one of many ways MEV can be used to game the system.
As far as I am aware, there is no generalized solution to the problem of MEV, and I believe it is widely accepted as an issue that can only be minimized, but not completely eliminated. The good news is there may be ways to minimize this problem to the point of relative obscurity. Things like minimizing the MEV window, clever use of ZK-technology, or just building applications with a highly meticulous approach to the underlying game theory, just like IOG did with the development of Cardano.

Decentralization is the mitigation against attacks in almost all of these systems, they all assume that a centralized player has not gained the power to control consensus.
An SPO could theoretically re-write their block producers software to do anything, like award themselves a million ADA.  But it doesnt have any effect because no other SPOs agree that should happen.
Chain forks are probably the next thing an SPO could try to do, if they could create a dummy chain they could double-spend ADA.  Ouroborous can withstand at least 6 blocks in any 22 blocks being created by attackers trying to fork the chain, and with 15 confirmations no users will be duped onto the wrong chain.  It would be very hard for any SPO to co-ordinate more than 6 in 22 blocks becaise of the random nature of slot leader selection, unless they had a very high amount of stake and could wait for the the right time.  Of course the problem there is that having a lot of stake on the system and damaging the system is stupid, because you are damaging your own value.
Forking is also dis-incentivized by the fact that all SPOs earn more if there are more successful blocks on the main chain.  As rewards are held to the epoch end and distributed to SPOs based on the number of blocks they created on the main chain, its an incentive for all SPOs to find and stay on the main chain.


text:
Randomness in a smart contract
Is it possible to get randomness in a smart contract? E.g. I would like the validator to randomly choose between two conditions to use to validate a transaction. Such a capability could be used for example to implement a lottery smart contract.
If so, what are the mechanics of the randomness?
If not, how could the lack of randomness be circumvented to implement something like a lottery smart contract?

Validation is deterministic, so decidedly non-random. And this is a desirable feature, because it means you can validate a transaction off-chain before ever submitting it, thus being sure you'll never have to pay fees for a transaction that will turn out to be invalid.
In order to get randomness, one could for example use an oracle that provides entropy.
Alternatively, one could use a commitment scheme: In your example, the lottery operator publishes the hash of the random draw up-front, then later, after players have signed on, reveals it. The operator can't cheat, because he has committed already (by publishing the hash up front).


text:
Providing metadata to `cardano-cli transaction build-raw`
What command-line options and input file content can I provide to cardano-cli transaction build-raw to specify a transaction with metadata similar to the one in this transaction? https://explorer.cardano.org/en/transaction?id=ff126032aeccf0079a02168f9810a81d9632a8ac34e50cad278771be2423aa86
I initially thought that I just needed to give --metadata-json-file a JSON file with the corresponding desired JSON content (like the JSON show under 'metadata' on the webpage), but that just gives an error message about integer keys. In the Transaction Metadata reference for cardano-node, it says that the top-level keys must be integers, but I don't understand the significance or meaning of the values of the top-level integer keys or how the whole thing relates to an actual JSON I want to appear in the explorer.cardano.org transaction webpage.

Looks like you are using the CLI correctly, and the question was really about the NFT metadata standard. The usage of "721" as the top level key is to be compatible with Etherium token metadata and 3rd party sites that showcase ETH NFTs.
Alessandro of BERRY/SpaceBudz is the one who proposed this as a CIP on the Cardano forums and it seems to have been widely adopted at this point.
Edit: See also Is there a metadata standard for native assets (talking about fungible tokens first) in Cardano?

I still do not know the meaning of the values given to top-level integer keys, but I was able to get cardano-cli transaction build-raw to work by putting my original JSON as a value of a top-level integer key of 721. On cardanoscan.io, I noticed that the metadata has a 'label', which explorer.cardano.org lacks. I surmised that the label is the top-level integer key, but I don't know of a way to confirm that.
So the short answer is that the JSON given to cardano-cli must be an object with integer keys.


text:
Automatic Token Distribution?
Is there a way to automatically distribute a token to every wallet that holds ada?
This would be a mechanism to distribute DAO voting rights automatically to all ada wallets. Voting power would be proportional to the amount of ada in the wallet. 1 DAO token per 10000 ADA. A wallet owner could choose to either burn the token or sell them to someone else if they are not interested in participating in the DAO.
Could this be executed in a single trasaction?

If you are talking about all ADA wallets that exist, this is certainly not possible in a single transaction.
If there are 142 addresses or less (that you are distributing to), it should be possible in a single transaction, otherwise the transaction size will be too large (above the 16 KB limit). You also need to send about 1.3 ADA (depending on the token name and the amount of tokens you send) to each address together with the tokens.

Ok, thanks for the information.


text:
Can Daedalus be used to query the blockchain, like a passive node?
Daedalus is a full node wallet application, but can I use the full node to query the ledger?

Daedalus runs its own instance of cardano-node under the hood, so by installing and using cardano-cli, one can connect to this node and interact with the blockchain directly.

Start Daedalus, and wait until it reaches the wallet home screen; the cardano-node.socket file is only made available after the cardano-node has started fully.
Use cardano-cli: [Documentation]

Ubuntu Example (Bash)
export CARDANO_NODE_SOCKET_PATH=/home/$USER/.local/share/Daedalus/mainnet/cardano-node.socket
cardano-cli query tip --mainnet

MacOS Example
export CARDANO_NODE_SOCKET_PATH=~/Library/Application\ Support/Daedalus\ Mainnet/cardano-node.socket
cardano-cli query tip --mainnet

Windows Example (PowerShell)
On Windows, a socket file isn't used, instead we specify the pipe used, which has a different name every time Daedalus runs.
cd "C:\Program Files\Daedalus Mainnet"
$ENV:CARDANO_NODE_SOCKET_PATH = (Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node*"}).FullName
.\cardano-cli.exe query tip --mainnet

Would be nice to have Windows and MacOS examples too, at least the default socket paths

Ah I forgot how awkward it was to get the Windows named pipe :D

@soccer193 Trying it via PowerShell doesn't appear to work. Deadalus is running, node fully sync'd.  "Shelley command failed: query tip  Error: Error while looking up environment variable: CARDANO_NODE_SOCKET_PATH  Error: "CARDANO_NODE_SOCKET_PATH""
If I run:
Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node-mainnet*"}

It returns nothing.  Currently using PowerShell 7.1.3

Hey @ChadCarter, left you a response in the 'Cardano' chat room on the right of this page.

@soccer193 I posted a response in the chat the other day. If you have any ideas on where the socket path should be in Windows, I'd love to know.

I'm no powershell expert. It seems simply calling Get-ChildItem \.\pipe\ doesn't return anything related to cardano.  However, when I downloaded the sysinternals PipeList and ran the 64bit version ( https://download.sysinternals.com/files/PipeList.zip ) I saw a ton more named pipe entries including one called "cardano-node-mainnet.18404.5".  So I ran $ENV:CARDANO_NODE_SOCKET_PATH = "\.\pipe\cardano-node-mainnet.18404.5"      followed by the cli query line and got the result I was after.  What can we do to get PS to see it?

$env:CARDANO_NODE_SOCKET_PATH = [System.IO.Directory]::GetFiles("\\.\\pipe\\") | where { $_ -like "*cardano-node*" }

If you really have to use standard Windows CMD (instead of PowerShell) we first need to get the PID of the right "Daedalus Mainnet" process (there are multiple) eg 12345, then set CARDANO_NODE_SOCKET_PATH eg:
cd "C:\Program Files\Daedalus Mainnet"
set CARDANO_NODE_SOCKET_PATH=\\.\pipe\cardano-node-mainnet.12345.0

(Swap the 12345 with your PID value, see below. You might need to change the .0 too)
Then run your cardano-cli commands eg
cardano-cli query tip --mainnet

This should then work until you restart Daedalus.
Note: make sure Daedalus is fully synced before running cardano-cli
To get the PID manually via Task manager:
I see 4 processes named "Daedalus Mainnet" under the Processes tab in Windows11. Select the one with extra details after the name eg "(4.8.0#23001)" and right-click "Go To Details", note the PID eg 12345.
To get the PID via PowerShell, run:
(Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node*"}).FullName

(Thanks to soccer193 and Tend for this PS snippet)


text:
How to delegate ada to several staking pools using only one wallet?
At the moment if you want to delegate different amount of ada to more than one staking pool you should have two or more wallets. Is there a way to delegate a portion of the coins to one staking pool and another portion to other staking pools?

In Nami wallet you can create "extra accounts" to delegate to other pools. You do have to keep into account that other wallets will not show these "extra accounts".

In Yoroi, it is possible to delegate to multiple pools using a single wallet, but not in Daedalus. To delegate to multiple pools in Daedalus, you will need to create separate wallets. The stake associated with each wallet can then be delegated to a specific stake pool.
It is worth noting that multiple-pool delegation using a single wallet will not be supported on the mainnet.
Source : https://cardano.org/stake-pool-delegation/ (At the bottom, "Can i delegate to multiple stake pools ?")

Interesting, but this is only valid for the Yoroi browser extension? Can't find this option in the Android App.

What does it mean "multiple-pool delegation using a single wallet will not be supported on the mainnet"?


text:
What is the difference between Plutus (Marlowe) and Glow?
What is the use case of Glow when you have Plutus and why a developer would use it instead of the other smart contract language which is natively supported by Cardano?

From https://glow-lang.org/ :

In other words: what usually takes a huge amount of lines of code, and many experts in various fields, has been automated and abstracted by Glow.

Glow is a higher-level language than Plutus and Solidity. It aims to give developers a way to easily specify the dynamics of a dapp, namely 'who' can do 'what', 'when', and leaves the low-level implementation details to the compiler. Benefits to their approach include the ability to perform formal verification of programs written in Glow, and the ease of auditability of the code (because Glow programs are written much closer to how a person would describe the dapp verbally to another person).
Marlowe is also a high-level language, but provides a smaller, curated set of smart contract building blocks as compared to Glow, to enable non-technical people to draft, write and run their own financial contracts. Marlowe may be useful for a person writing a one-off contract between two people/organisations, while Glow may be useful for a developer who wants to write a dapp used by many people.

Plutus is specific to Cardano while Glow works across multiple blockchains. Saying this, Glow is a 'domain specific language' which is only meant to be used for programming DApps while Plutus is a Haskell library.


text:
What is the expected ROA (Return of ADA) after all coins are minted?
After all coins are minted as far as I know the rewards will come from the transactions fees. At the moment we have 4.5 to 6.0% annual return of staked ADAs. When and how this will change after we reach 45 000 000 000 coins in circulation?

To start, all ADA does already exist and is accounted for, as seen in the Introduction section on page 4 of the Cardano ledger spec. The spec states that, from genesis, there was about 13,000,000,000 ADA locked up in reserves (monetary expansion), which are to be slowly released on a per epoch basis at a rate of decay that is defined by a network parameter, rho. With the current setting of 0.003, it should take over 100 years before these reserves are depleted.
How the APY will change after the reserves are depleted depends mainly on the transaction volume because transaction fees are what will pay the rewards after the reserves are depleted. The reserve depletion is so far out in the future that it is difficult to say how the APY will be effected when that happens.

Are you sure about the current setting of 0.003? Is this "Influence factor (a0)" and "Expansion rate (% of reserves released per epoch)" which can be found under advanced settings here: https://cardano.org/calculator
From this page I can see that this value is 0.3 not 0.003 for both of them.

0.3 is the percentage. The actual value is 0.003

OK, this means that if 100% is 13 000 000 000 then after 333 epochs (1665 days or 4,5 years counting from mid 2020) all of these coins will be consumed if we assume that there is no additional income from the confirmation of the transactions right?
I cannot understand why we have such a discrepancy 100 years vs. 4,5 years?

@PetarEnchev - according to this answer, the difference comes from the formula, which is a rate of decay, not a simple division of the starting amount: https://cardano.stackexchange.com/a/852/2107
It decelerates as it goes.

In ADA all coins are already minted. The total supply is 45 billion tokens. About 13 billion coins are not used and are "locked" in the treasury. It is used to be able to pay out the rewards for every block created by the stakepool and from where you will get delegators' awards. Because there not so many transactions to pay for, all the block awards the missing coins are used from the treasury. Once the transaction fees are sufficient to pay out all the block rewards, the treasury will only be used to fund proposals in what is now called Catalyst which in due time will start to solve the Voltaire stage. When Voltaire is ready it will be up to the community what to do with the rest of all ADA from Treasury.
And this is a very interesting idea to vote the greedy out in favor of the Cardano Ecosystem to be sustainable.

This is incorrect. The treasury is not used for block rewards. The 13 billion coins you reference are in the "reserves"


text:
How and when we will be able to use Catalyst for our own projects to vote?
I know that voting project Catalyst is still under development and it will be most probably in this state till end of 2025 but can we expect to vote on our own projects inside Cardano ecosystem and also outside Cardano (using only the infrastructure)?
If this is possible how this will gona happen and when?

You can already vote using the Catalyst mobile app if you have ADA in a wallet you control.
That said, it's still in a kind of beta phase that depends on the Ideascale platform.
In the end, there will probably be a voting section inside the Daedalus and Yoroi wallets and we will no longer need Ideascale for the voting process.
It is unknown yet how long it will take to build this and finish Voltaire era.


text:
Is there an easy way to export a CSV file of all transactions from a specific address or wallet?
Is there an easy way, without writing code, to export a CSV file of all transactions from a specific address or wallet? (not Daedalus)

If you're using Nami you can use this https://github.com/Et9797/tx-history-viewer

There are two ways of doing this. One is with cardano-db-sync as mentioned in @zhekson's response.
The other way is by querying the cardano-wallet executable (bundled with Daedalus) as per the documentation at https://input-output-hk.github.io/cardano-wallet/api/edge/
I have a script like this:
#!/bin/bash -eu

# https://input-output-hk.github.io/cardano-wallet/api/edge/

progname=$(basename "$0")

curl --version > /dev/null 2>&1 || { echo "${progname}: 'curl' program is missing." >&2 ; exit 1 ; }
jq --version > /dev/null 2>&1 || { echo "${progname}: 'jq' program is missing." >&2 ; exit 1 ; }

wallet_pid=$(pidof cardano-wallet)
http_port=$(lsof -Pan -iTCP -sTCP:LISTEN -p "${wallet_pid}" | tail -1 | sed 's/.*://;s/ .*//')

function api () {
  curl --silent --cert ~/.local/share/Daedalus/mainnet/tls/client/client.crt \
    --cacert ~/.local/share/Daedalus/mainnet/tls/client/ca.crt \
    --key ~/.local/share/Daedalus/mainnet/tls/client/client.key \
    "https://localhost:${http_port}/v2/$1"
}

function wallets () {
  api wallets | jq '.[] | {name: .name, id: .id, state:.state.status, pool:.delegation.active.target, balance: (.balance.total.quantity / 1000000) }'
}

function transactions () {
  echo "TransactionId,Timestamp,Direction,AmountAda"
  api "wallets/$1/transactions" \
    | jq -r '.[] | [.id, .inserted_at.time, .direction, .amount.quantity / 1000000] | @csv' \
    | sort --field-separator=',' --key 2
}

function usage_exit {
  echo
  echo "Usage:"
  echo "  $progname wallets                   - List the known wallets."
  echo "  $progname transactions <wallet>     - List all transactions for a given wallet."
  echo
  exit 0
}

case "${1:-""}" in
  wallets)
    wallets
    ;;
  transactions)
    shift
    if test $# -eq 1 ; then
      transactions "$1"
    else
      echo
      echo "Error: A wallet needs to be specified."
      usage_exit
      fi
    ;;
  *)
    usage_exit
  esac

Address or wallet?
The distinction is important for UTXO chains following the BIP-44 standard, because a single extended public key (wallet key) can generate a virtually infinite number of addresses. Are you looking to query a single one of these addresses, or all of the addresses associated with a single wallet?
In the case of the former, I am unaware of any easy third party solution for TX export by individual addresses. If there are none, the only option would be to query from an API endpoint like Blockfrost, or to query from your own db-sync instance.
In the case of the latter however, light wallets (like Eternl) have easy export options for the entire wallet history. You do not have to fully restore your wallet to access these features. You can instead import your wallet as read-only (requiring only the extended public key of the wallet, no signing keys), and export TX history in CSV format.


text:
Query next epoch from postgresql
How can I get the next Epoch.No using Postgresql. If I use

'SELECT no FROM epoch ORDER BY no desc limit 1'

, it returned last epoch/currentEpoch, if I want to receive the next Epoch.No, what should I do? Thanks for your help

The epoch table is populated at the beginning of the epoch, actually more accurately at the first block received for that epoch. You can't get data that doesn't exist. If you're wondering what the next epoch is though, just take the result of that query and add 1.


text:
Is ada an asset, token, both, neither?
According to the docs, ADA is an asset and a token, but they also indicate that tokens are on-chain versions of some off-chain asset. They also compare ADA and tokens in ways to imply that they are not the same kind of thing.
So, what is it? what is it called?

Ada is a digital token on the Cardano blockchain. Its currency symbol is the empty string - "".
It is similar to any other token that can be minted on the Cardano blockchain. However, there is a key difference.
A token are represented by a currency symbol which is the hash of the minting policy that is used to create it.
A minting policy describes how a token can be minted and burned, and no policy can mint or burn Ada, hence the empty string, which no policy can hash to.

"Ada is a digital token"
so, you're saying that ada is not an asset?

I think the terms are not mutually exclusive @wolverineks. Ada is a digital token, the native currency of Cardano, and it is an asset specified by those two properties I just named.
Tokens can also represent off chain assets; this valuable property is part of what makes those tokens assets-- that is, a valuable thing to own (rough def. of 'asset').
I could be wrong if I'm unfamiliar with some specific technical meanings of the terms, but that is how it appears to me, prima facie.

are all tokens digital? iow, are there non-digital tokens on cardano?
are all tokens currencies on cardano?
are there non-native currencies?
tokens can represent an asset, but do they have to?

I would probably go down the route of calling ADA a financial instrument. From a technical perspective, IT IS a token with no currency symbol. Thus, IT IS a native token, it just can't be minted or burnt (unless you take the PoB paper published by IOG and implement it - I have spent some time reading that paper and it seemed to me as though you could only accomplish PoB with P2PKH addresses - maybe if you flipped some bits in Byron addresses? - but you could just create an address and destroy/rm the private key and throw away the key derivation phrase, if you REALLY wanted to burn some ADA).


text:
How are transaction fees determined for bulk sends?
I have a use case where I want to send to many addresses on a regular basis.
Let's say I want to send to 1 million addresses. I've read that Cardano enforces a "minimum transaction fee." But is this fee applied to each recipient address in a bulk transaction? Or is it for the overall transaction?
If it's the case where I pay a fixed fee per bulk send, what is the maximum number of addresses I can send to in one bulk transaction?

The minimum fee is for the transaction as a whole, calculated as a * size(tx) + b, where a and b are protocol parameters. However, there is a Min-Ada-Value of 1 ADA which is the minimum size of a UTxO. The maximum possible UTxO set of Cardano is actually 45 billion for this reason. Anyway, you'd need to send 1 ADA per UTxO (which can be in the same transaction) and then the only limit should be the size of the transaction being less than the size limit of a block.
You can read more about this here:
Docs:
https://cardano-ledger.readthedocs.io/en/latest/explanations/min-utxo.html
Implementation:
https://github.com/input-output-hk/cardano-ledger-specs/blob/master/shelley-ma/impl/src/Cardano/Ledger/ShelleyMA/Rules/Utxo.hs

Let's say I want to send to 1 million addresses. I've read that
Cardano enforces a "minimum transaction fee." But is this fee applied
to each recipient address in a bulk transaction? Or is it for the
overall transaction?

As Edd, already mention in his post, a protocol parameter minUtxoValue is in place to make sure the dust is causing the UTXO to grow too much. Right now it is set to 1 ADA.

If it's the case where I pay a fixed fee per bulk send, what is the maximum number of addresses I can send to in one bulk transaction?

There is no maximum number of addresses per transaction directly, but this is limited by the protocol parameter maxTxSize which is right now set to 16384 bytes, which dictates how large in size one transaction can be. So, it all depends on your usage of addresses, number of inputs, number of outputs etc.


text:
What advantages does Cardano have over other "fast" blockchains?
I'm a developer looking into starting my first dApp project. I've been waiting for Cardano to release smart contracts due to Ethereum's insane gas fees and low transaction throughput.
I recently discovered another blockchain (Solana) that already supports smart contracts and has even cheaper transaction fees and very high transaction throughput. Since it's not even possible for me to build my project on Cardano at this moment, and my original reasons for considering Cardano were low fees and high TPS, I'm beginning to consider building on the Solana platform instead.
I'd like to get your insights on what unique advantages Cardano offers over other platforms before making my decision.

You will probably get better answers to this opinion question on https://www.reddit.com/r/CardanoDevelopers/  You will get a wider variety of responses than here.

I recently discovered Solana too and found that it has awesome speed. Here are my thoughts from a little review:

Decentralized limit: Hardware recommended requirements for Solana nodes are pretty advanced which limits the amount of nodes that can be run.
Speed: Project Hydra from Cardano has a theoretical limit of 1M TPS acheiving 1/10 of that will still be significant.
Adoption: Its not always just about technology, I like IOG approach to get adoption with deals. Even if the Africa deal falls through they are still pursuing other opportunities.
Transparency: I honestly couldnt find any way to actually connect with the people behind Solara. It just looks like they are popping out high performance tools. I do wonder if there is a tradeoff being done for speed.

Finally, I really like the goal of Cardano which is about making the world a better place by building for the globe.
Most of the crypto ecosystem is mainly in first world countries.

The transparency part seems to be the biggest one for me. It seems like there was/is some controversy with how they dealt with the token distribution.

I do want to invest into it, however I like being a part of a community building together rather than investing for the purpose of price sky rocketing. If you find anything that makes you want to get involved with solara, please do share!

Research papers and correctness proofs
Transparency

The first will be hard for other chains to reproduce, though some of the results are not specific to Cardano / Ouroboros so they could be adopted by other chains.
The second is an on-going process and it would be possible for another chain to surpass Cardano either due to governance failures in Cardano or exceptional transparency of the other chain, but I don't belive this has yet (2021-04-28) happened.


text:
How will dapps handle cardano inflation from staking rewards?
Let's say I would like to lock up some ADA in a smart contract for about 3 months. How will this compete with ~5% APR from staking rewards? Do all dApps need to provide a minimum ~5% APR just to keep up with inflation?

There are many ways how to handle this and it's really up to the dApp creator.
But, keep in mind, that the smart contact can delegate their ADA too and earn rewards on it as well. I can see some dApps redistributing this rewards back to the users in the future.

Ah I see, I didnt know that smart contract had delegation enabled


text:
How does DApp front-end integrate with user wallets?
I'm familiar with using the Plutus Playground and Plutus TraceEmulator library to configure the wallet actions for the endpoints of a smart contract.  These simulators are great for testing the smart contract interactions.
I'd like to understand how a real-world DApp would integrate with user wallets. If the DApp front-end is a web-app running in the browser, would the app require users to set up something like a MetaMask plugin to link their wallets and give permission to the DApp to submit operations from their wallet?  Is there another way to let user grant access to a wallet node?  In general, how does the DApp front-end get access to user wallets and will the DApp front-end need to be deployed on the same machine as the wallet is running?

If you've found an answer to this, please post it. I'll be looking into it too soon.

@marcel_g, no, not yet.  I'd like to build a simple example of using a wallet connector, but have some server-side exploration work planned next. Pls let me know, what wallet connectors you try and how it goes.

Good question, this is one that many people are curious about as the only real way to interact with the Cardano blockchain is through cardano-node, but obviously a dApp user visiting a website isn't going to run their own node to submit transactions and interact with smart contracts themselves.
In my view, Yoroi looks best positioned at the moment to become the MetaMask of Cardano but as always, look into things for yourself and determine the best solution for your particular use-case.
https://www.emurgo.io/blog/emurgo-launches-beta-version-of-yoroi-wallet-dapp-connector
As you can see dApp Browser integration is slated for sometime 2021, I think this is the direction you should look. Also worthy of looking into is the ATALA Prism which also seeks to provide DIDs (Digital Identities) on the cardano blockchain and I'm assuming will at some point try and provide some dApp connector solution for the browser.

I guess after 1 year, this deserves a more up-to date answer. There are two ways you can integrate with a browser wallet, you can take a server-based approach and a client-based one.
Server Constructed Transaction
The First way is to have a back-end that will create the transaction and send the CBOR result to the front-end so the wallet can sign it and send it back to be submitted.
This is what you would do with the PAB, for example, and it's what DJED is using in their testnet. The problem is that if a lot of users are requesting a transaction at the same time, it will overload your back-end.
Other than the PAB you can use basically any tool that supports creating a cardano transaction. For me, pycardano has been really useful since I am more familiar with Python than Haskell and the PAB is just not very well documented right now in my opinion. You can see an example here.
Client Constructed Transaction
The second way would be to do everything in the client-side. So you would build the transaction, sign and submit from the user browser. The drawback here is that the front-end application get's a little bit more heavy and there is not a great support for plutus and smart contracts with the current tools.
The most used tool right now is the cardano-serialization-lib and you can see an example of a transaction being fully built on the client side here.
As I said, it doesn't offer great support for plutus right now (if any) and you would need to use a custom module for doing most of the things (like in the example I mentioned). There are some other tools, though, that could be more useful depending on the case: cardano-multiplatform-lib from dcspark and lucid from alessandro are the ones that come to my mind.


text:
Write a policy script with a custom redeemer type, but do NOT use `Plutus.liftCode`
I'd like to write a policy script that receives a custom data type for the Redeemer argument, but does not use Plutus.liftCode to "bake the argument value" into the compiled Plutus script.  Instead, I want to be able to compile the policy script with no redeemer value upfront and just declare the type of the argument (e.g. my custom data type) that will be received when the transaction is executed.  This will mean that the custom redeemer data will be submitted with the transaction instead.
There are examples of this for Validator, e.g. TypedValidator example from PPP, but I cannot figure out how to do the equivalent thing for a PolicyScript.  All the policy script examples I've seen use Plutus.liftCode.
Here's the starting point of the code I'm trying to write.  I put brackets around the places in the code that I need an equivalent idea for PolicyScript.
data CustomRedeemer = CustomRedeemer
    { txOut :: TxOutRef
    , nftName :: String
    } deriving Show

PlutusTx.unstableMakeIsData ''CustomRedeemer

{-# INLINABLE mkNftPolicy #-}
mkNftPolicy :: CustomRedeemer -> ScriptContext -> Bool
mkNftPolicy custom ctx = traceIfFalse "UTxO not consumed"   hasUTxO           &&
                         traceIfFalse "wrong amount minted" checkMintedAmount
  where (...)

data MyTypedInstance
instance <equivalent-of: Scripts.ValidatorTypes> MyTypedInstance where
    type instance RedeemerType MyTypedInstance = CustomRedeemer

typedPolicy :: <equivalent-of: Scripts.TypedValidator> MyTypedInstance
typedPolicy =  <equivalent-of: Scripts.mkTypedValidator> @MyTypedInstance
    $$(PlutusTx.compile [|| mkNftPolicy ||])
    $$(PlutusTx.compile [|| wrap ||])
  where
    wrap = <equivalent-of: Scripts.wrapValidator> @CustomRedeemer

Thanks!

It's pretty simple:

Define the redeemer with the proper types (they must be part of UnsafeFromData typeclass in order to use PlutusTx.unstableMakeIsData (2))

Do PlutusTx.unstableMakeIsData ''CustomRedeemer.

Define the policy with mkMintingPolicyScript $$(PlutusTx.compile [|| Scripts.wrapMintingPolicy mkPolicy ||]) where mkPolicy doesn't have any lifted parameters.

Have fun.

Important: If you define the custom redeemer along with PlutusTx.unstableMakeIsData in the same module as your minting policy script, the compiler complains in Scripts.wrapMintingPolicy saying that PlutusTx.UnsafeFromData CustomRedeemer must be imported, not defined locally. SOLUTION: Define it in a separate module. This must be Template Haskell stuff...

Additionally, I share a simple example of all of this:
[custom redeemer types module]
{-# LANGUAGE TemplateHaskell     #-}
{-# LANGUAGE NoImplicitPrelude   #-}

module Week05.WithCustomRedeemerTypes where

import           PlutusTx.Prelude
import           Prelude          (Show (..))
import qualified PlutusTx
import           Ledger           (TokenName)

data CustomRedeemer = CustomRedeemer
    { nftName     :: TokenName
    , description :: BuiltinByteString
    } deriving Show

PlutusTx.unstableMakeIsData ''CustomRedeemer

[minting policy module]
{-# LANGUAGE DataKinds           #-}
{-# LANGUAGE DeriveAnyClass      #-}
{-# LANGUAGE DeriveGeneric       #-}
{-# LANGUAGE FlexibleContexts    #-}
{-# LANGUAGE NamedFieldPuns      #-}
{-# LANGUAGE NoImplicitPrelude   #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell     #-}
{-# LANGUAGE TypeApplications    #-}
{-# LANGUAGE TypeFamilies        #-}
{-# LANGUAGE TypeOperators       #-}

module Week05.WithCustomRedeemer where

import           Control.Monad          hiding (fmap)
import           Data.Aeson             (ToJSON, FromJSON)
import           Data.Text              (Text)
import           GHC.Generics           (Generic)
import           Plutus.Contract        as Contract
import           Plutus.Trace.Emulator  as Emulator
import qualified PlutusTx
import           PlutusTx.Prelude       hiding (Semigroup(..), unless)
import           Ledger                 hiding (mint, singleton)
import           Ledger.Constraints     as Constraints
import qualified Ledger.Typed.Scripts   as Scripts
import           Ledger.Value           as Value
import           Prelude                (IO, Show (..), String)
import           Text.Printf            (printf)
import           Wallet.Emulator.Wallet

import           Week05.WithCustomRedeemerTypes

{-# INLINABLE mkNftPolicy #-}
mkNftPolicy :: CustomRedeemer -> ScriptContext -> Bool
mkNftPolicy CustomRedeemer{nftName} _ =
    let expected = TokenName "kurt"
    in traceIfFalse "Kurt is sad because the nft is not called kurt :(" $ nftName == expected

policy :: Scripts.MintingPolicy
policy = mkMintingPolicyScript $$(PlutusTx.compile [|| Scripts.wrapMintingPolicy mkNftPolicy ||])

curSymbol :: CurrencySymbol
curSymbol = scriptCurrencySymbol policy

data MintParams = MintParams
    { mpTokenName :: !TokenName
    , mpAmount    :: !Integer
    } deriving (Generic, ToJSON, FromJSON)

type FreeSchema = Endpoint "mint" MintParams

mint :: MintParams -> Contract w FreeSchema Text ()
mint mp = do
    let tn = mpTokenName mp
        redeemer = Redeemer $ PlutusTx.toBuiltinData $ CustomRedeemer tn "a description"
        val      = Value.singleton curSymbol (mpTokenName mp) (mpAmount mp)
        lookups  = Constraints.mintingPolicy policy
        tx       = Constraints.mustMintValueWithRedeemer redeemer val
    ledgerTx <- submitTxConstraintsWith @Scripts.Any lookups tx
    void $ awaitTxConfirmed $ getCardanoTxId ledgerTx
    Contract.logInfo @String $ printf "forged %s" (show val)

endpoints :: Contract () FreeSchema Text ()
endpoints = mint' >> endpoints
  where
    mint' = awaitPromise $ endpoint @"mint" mint

happyKurt :: IO ()
happyKurt = runEmulatorTraceIO $ do
    let tn = "kurt"
    h1 <- activateContractWallet (knownWallet 1) endpoints
    callEndpoint @"mint" h1 $ MintParams
        { mpTokenName = tn
        , mpAmount    = 555
        }
    void $ Emulator.waitNSlots 1

sadKurt :: IO ()
sadKurt = runEmulatorTraceIO $ do
    let tn = "bob"
    h1 <- activateContractWallet (knownWallet 1) endpoints
    callEndpoint @"mint" h1 $ MintParams
        { mpTokenName = tn
        , mpAmount    = 555
        }
    void $ Emulator.waitNSlots 1

You can find the previous code integrated with week05 in my plutus-pioneer-program repo:
https://github.com/kindofdev/plutus-pioneer-program-iter3/blob/main/code/week05/src/Week05/WithCustomRedeemer.hs

Lol!  "Kurt is happy" because you've given him a concrete example of how to do this!  You are right, too-- it looks simple enough.  I actually ran into that error you described "must be imported", but I didn't know how to interpret it.  Now, I see what the resolution is.  I highly appreciate this complete answer!

Any security/exploitation problems with an untyped Redeemer? I ask that question under the assumption that unstableMakeIsData is allowing transactions with arbitrary Redeemers for this script.

@jerome, I'd say no, because a Redeemer (Typed or BuiltinData (untyped)) is just data.


text:
Understand purpose of tx-out-datum-hash in Lars' lobster NFT minting example
When the Alonzo era started on mainnet, Lars deployed a smart contract example, in which he minted a lobster NFT as part of a lobster naming challenge.
In the policy script used to mint the lobster NFT - link to policy/validator code, the argument inputs for the tokenName and the UTxO are baked into the compiled Plutus script, since it's a parameterized typed policy/validator. By "baked in" I mean the  validator code compiled to plutus already includes the token name and UTxO, so these args do not need to passed as datum when executing the transaction.
However, in the deploy script to mint the lobster NFT - link to deploy script, there is an parameter tx-out-datum-hash set in the cardano-cli transaction build.  What datum does this hashed value represent and how is the hash computed?  In Lars' example code, the value is hard-coded and no explanation is given for what it represents.

That value is the hash value of an empty list. You can calculate it in the repl as follows:
import Ledger qualified
import PlutusTx qualified

emptyListDatum = Ledger.Datum $ PlutusTx.toBuiltinData ([] :: [()])
emptyListDatumHash = Ledger.datumHash emptyListDatum -- 45b0cfc220ceec5b7c1c62c4d4193d38e4eba48e8815729ce75f9c0ab0e4c1c0

Note that the datum selected by Lars is completely arbitrary because it's not used in the validator script.

That's brilliant.  Thanks @kindofdev.

You’re more than welcome. Glad to help!


text:
How to achieve a minting policy script that locks after certain number of images (assets) have been minted on the fly
Let's say I want to run an NFT campaign, where the minting policy only allows minting of 100 NFTs (each one is different), and then the policy should lock.
If this minting policy were a Plutus script, I'm assuming I would need to pass in a parameter holding the current mintCount and then the validation would test if the mintCount is less than the limit.
That seems simple enough, but I'm assuming this relies on the off-chain code obtaining an accurate count of total mints under the policy for the parameter input and serializing access to the transaction minting process (i.e., avoid running minting transactions in parallel).  Is this correct?
Suppose this minting policy should lock because the max number of NFTs have been reached, but the off-chain code screws up and passes in a mintCount parameter that allows more minting to occur.  Is there some way to write a script that locks for good, once a previous transaction has failed?
Besides passing in a mintCount, are there other strategies for enforcing a minting policy that locks after a certain number of NFTs has been reached?  Instead of on-the-fly minting, is there some strategy of minting NFTs up-front that could achieve a certain max count?

You could use a combination of a plutus validator script with a specific datum and a minting policy.
The minting policy just checks for the validator script has ran.
And the validator script checks the datum's counter to be increased correctly and it fails when your max number has been passed, see other related question below.
Collection Uniqueness using Counter as asset name


text:
Invoking lock endpoint on the plutus-starter guessing game is giving me "endpoint not available" error
Using the nix-shell approach, I'm able to build and execute the plutus starter PAB project, which includes the guessing game contract. GIT repo link
In a separate terminal window, I can run the GET request to see the contract definition.  The response shows the GameContract along with the schema, which has lock and guess endpoints.
I successfully call the activate endpoint for each of wallet1 and wallet2.
However, when I call the lock endpoint for wallet1 ID, it gives me the following error. If I look at the logs in the terminal, where the PAB is running, there is no evidence that an endpoint execution failed.
curl -H "Content-Type: application/json" \
>   --request POST \
>   --data '{"amount":{"getValue":[[{"unCurrencySymbol":""},[[{"unTokenName":""},90]]]]},"secretWord":"eagle"}' \
>   http://localhost:8080/api/new/contract/instance/2acb116b-5488-4672-99c2-f2940cfd7b3a/endpoint/lock

EndpointCallError (EndpointNotAvailable (ContractInstanceId {unContractInstanceId = 2acb116b-5488-4672-99c2-f2940cfd7b3a}) (EndpointDescription {getEndpointDescription = "lock"}))

The format of the API call appears correct.  Based on PAB docs, it should be
POST /api/new/contract/instance/:contract-instance-id/endpoint/:endpoint-name

Has anyone had this issue?  What am I missing?

I can reproduce this - it was happening prior recent Plutus bump pull request as well. I'm not sure what the root cause is yet - week10 example from plutus-pioneers works.
Tests in plutus-starter pass as well but they don't call HTTP API at all. Check that pab executable logs Exposing endpoint <name> message as well (it does for me but I'm not able to call lock).


text:
Plutus Pioneer Program - Lecture #1 Problem with cabal build
I ran into this dependencies error on Ubuntu when I try to build the English Auction, does anyone have an idea how to solve it ?

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

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

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

Please, include exact steps to reproduce this problem, from which repository, which branch, which version of operating system you are using.

It looks like your cabal version is too old.
You can make sure you have the right one if you first start a nix-shell at the top-level directory of the plutus-repository, then cd to the code folder of the plutus-pioneer-program-repository and run cabal build from within that nix-shell.

awesome, thanks :)


text:
403 Forbidden when trying to run nix-shell during setup for Plutus Pioneer Program
I've seen other questions similar to this about a 404 error, but this is different.
I have the IOHK Plutus cache set up as per the instructions.
Getting the following error:
trying https://bintray.com/joneshf/generic/download_file?file_path=purty-6.2.0-linux.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 403 Forbidden
error: cannot download download_file?file_path=purty-6.2.0-linux.tar.gz from any mirror
builder for '/nix/store/g0drypafpyzckkpwzplp9k9amx4bf7a4-download_file?file_path=purty-6.2.0-linux.tar.gz.drv' failed with exit code 1
building '/nix/store/m63hg37ygw5xkjkd429xds19qkffr6m3-easy-file-lib-easy-file-0.2.2-config.drv'...
cannot build derivation '/nix/store/wdgbj9xf3rz44xz5afw20m1ns0n8llpg-purty-6.2.0.drv': 1 dependencies couldn't be built
error: build of '/nix/store/05snx37ayscns4jfqq62v8ignps9izml-plutus-pab-generate-purs.drv', '/nix/store/08hhl408j6anygi2xf33xjdq4ciy2mxp-loch-th-lib-loch-th-0.2.2.drv', .....

I'm running on windows via WSL (Windows Subsystem for Linux) running Ubuntu

Please try the methods given https://cardano.stackexchange.com/questions/413/im-having-issues-with-nix-shell.

Yes, I've already tried those suggestions. Same result

The nix is trying to download from bintry which is outdated. Please update the question with details of your nix installation including version.

Ok thanks! I'll refresh my vm and try again

I'll update the question too

@raghu looks like I built on an incorrect branch initially, that caused problems later. Thanks for your help

So it looks like I initially built on the master branch by mistake. Switching to the correct branch and recompiling didn't help the situation.
I reset my WSL instance of Ubuntu and started again, more carefully this time. Everything worked as it should.


text:
Can't use PlutusTx.Foldable from other module
I want to write a PlutusTx validator which just checks if a transaction was signed by one of the whitelisted public keys.
This would be a first, naiive implementation:
-- | The whitelist used by 'signedByOneOfWhitelist'.
whitelist :: [PubKeyHash]
whitelist = []

-- | Check whether a transaction was signed by one of the 'whitelist' keys.
{-# INLINEABLE signedByOneOfWhitelist #-}
signedByOneOfWhitelist :: ScriptContext -> Bool
signedByOneOfWhitelist context =
  any (`elem` whitelist) txInfoSignatories
 where
  TxInfo{txInfoSignatories} = txInfo

  ScriptContext{scriptContextTxInfo = txInfo} = context

This works fine if I put this next to my validator / in the same module as `$$compile.
However, if I want to make this re-usable and put it into a dedicated module, say Whitelist with the right imports import Whitelist (signedByOneOfWhitelist) I get the following error by the plutus-tx compiler:
GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable Whitelist.$s$fFoldable[]_$cfoldMap
            No unfolding

Full gist for context: https://gist.github.com/ch1bo/a248087241a0a1690fba41936da45bc9
What am I doing wrong?

A workaround is to not use Foldable by instantiating it and an explicit fold:
{-# INLINEABLE signedByOneOfWhitelist #-}
signedByOneOfWhitelist :: ScriptContext -> Bool
signedByOneOfWhitelist context =
  myAny (`myElem` whitelist) txInfoSignatories
 where
  myAny :: (a -> Bool) -> [a] -> Bool
  myAny fn = \case
    [] -> False
    (x : xs)
      | fn x -> True
      | otherwise -> myAny fn xs

  myElem :: Eq a => a -> [a] -> Bool
  myElem x = myAny (x ==)

  TxInfo{txInfoSignatories} = txInfo

  ScriptContext{scriptContextTxInfo = txInfo} = context

I do not think you do anything wrong. I expected to "resolve" this issue by either inlining whitelist, manually marking it INLINEABLE or enabling -fexpose-all-unfoldings. But none of the above worked. I then took a close look at the PLC output and saw explicit references to
Whitelist.$s$fFoldable[]_$cfoldMap

And thought that this is odd, since it seems like it is trying to reference a foldMap implementation from the Whitelist module itself, which of course does not exist. So I went ahead and added an import:
import Data.Foldable (foldMap)

GHC marks this import as redundant, but the PLC plugin does not complain anymore... and it seems to work. I did not test it rigorously though, so take this with a grain of salt.


text:
Handling time & slots in cardano-node clients
At hydra we do have a protocol which ensures something is not happening before some given deadline. The system would need to submit a transaction to set the deadline (txA) and another transaction once this deadline passed txB. The deadline is determined from a txAs upper validity bound given as slot sA . Let's assume that deadline is at slot sT and our scripts will ensure that txBs lower validity bound sB is sB > sT.
How would should our application determine the "right time" to publish transaction txA and txB?
We would need to know about current time (in slots) to kick things off by determining sA and sT. But also to know when sB is to not have a failing txB. So far we have tried two approaches:

Use getLocalChainTip from cardano-api to get the slot of the current chain tip. This seems to be the slot of the last seen block and hence up to ~20 seconds in the past. Which is fine for txA, but problematic for txB as we would need to know that offset for correctly determining sB .
Use wallclockToSlot from ouroboros-consensus to get the current slot given wall clock. This gives us the projected, actual slot (even hard-fork and era history compatible?) so it's better in determining slots sA and sB. However, we get a ledger error when submitting txB as the ledger seems to think it's still slot of the last block (like option 1). For example: ApplyTxError [UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (OutsideValidityIntervalUTxO (ValidityInterval {invalidBefore = SJust (SlotNo 220), invalidHereafter = SNothing}) (SlotNo 211))))] when wall clock time and the cardano-node logs confirm was around slot 220 and the last block was forged at slot 211.

Any other options or ideas how to handle this in a properly integrated, non-hacky fashion?

What is the scale of difference in time between sA and sT?

Does this difference have bounds? Preferably, a lower one?

For this issue at hand here we can assume sT - sA to be sufficiently low, say 20 to 50 slots. (We have other problems of the period being too high and not being able to compute the POSIXTime equivalent as it's "past the horizon")


text:
Is it safe to point cardano-wallet at Daedalus "wallets" directory?
I'm running an instance of cardano-wallet which is already pointed at my Daedalus node socket. Would it be safe/possible to point to the wallets directory of Deadalus via the --database argument?

I've tried a couple times now and it seems this is not possible. It does not corrupt Daedalus's database but throws errors instead.
Unexpected error following the chain:
user error (restoreBlocks: given chain isn't a valid continuation.
Wallet is at: [...] but the given chain continues starting from: [...])

As long as you have your recovery phrase backed up in a secure place, you can always restore your wallet in case the Daedolus directory gets corrupted. So there's no problem with using cardano-wallet with your Daedolus files.


text:
How are staking rewards stored?
In another question Andrew Westberg mentions that staking rewards are not stored as UTxOs to save space on the blockchain.
My question is: how exactly are those rewards associated with one's stake address? How can the blockchain store something that is not a UTxO and how does this save space?

Cardano is using what we call a chimeric ledger, which means it uses both account (similar to Ethereum) and UTxO (similar to Bitcoin) style accounting systems.
This enables the ledger to take advantages of the UTxO system but at the same time be storage efficient where it comes to specific aspects of the ledger, such as rewards.
I highly recommend a video of Sebastien going thought the paper in question to learn more.


text:
Using cardano-node installed by Daedalus as CLI?
I want to do some transaction with custom metadata and was wondering if I have to install another instance of cardano-node or if it's possible to use the already installed version by Daedalus.

Yes, it is possible.
First, you need to install cardano-cli binary (you can find it in the Hydra build system, depending on your OS which might be Linux, Windows or Mac OS.
After you have your cardano-cli installed, you now need to set your CARDANO_NODE_SOCKET_PATH environmental variable to the location of your cardano-node socket file that is being run by Daedalus.
This code snippet will do just that, extract the path to the socket file from the cardano-wallet instance.
Depending on the network, you will execute the following for testnet:
export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep testnet | sed -r 's/(.*)node-socket //')

# Check var it must be path for file of node socket and not empty
echo $CARDANO_NODE_SOCKET_PATH

Or the following for mainnet:
# Create var CARDANO_NODE_SOCKET_PATH
export CARDANO_NODE_SOCKET_PATH=$(ps ax | grep -v grep | grep cardano-wallet | grep mainnet | sed -r 's/(.*)node-socket //')

# Check var it must be path for file of node socket and not empty
echo $CARDANO_NODE_SOCKET_PATH

After you have done that, you can now try to query the network using your cardano-cli, for testnet:
$ cardano-cli get-tip --testnet-magic 1097911063

Or for mainnet:
$ cardano-cli get-tip --mainnet

Source: this useful gist

Could you expand some more on how to use this? It's not immediately clear to me from just looking at the Gist.

@ValentinWalter can you check now? I tried to elaborate it a little bit more.

I found on Mac OS that the sed -r option doesn't work, but using -E does.


text:
How are DeFi projects funded (beyond Project Catalyst & external funds)
How do DeFi projects such as Uniswap or Synthetix make money to cover their development costs? Would you siphon a small amount of ADA each transaction or is it more common to create your own token and follow an ICO-style model?

You are indeed right. I have seen plenty of DeFi projects get their funds by offering a 2017-style ICO model. YaySwap (not an endorsement, just an example) is one of these projects that takes ADA and plans to distribute their YAY token.
Uniswap also takes a fee. Then there's the genesis allocation to team, investors etc.


text:
Cardano-Ethereum Bridge
What is the best way to write a smart contract that will work across both Cardano and Ethereum? It doesn't have to be released yet but preferably something that will be usable by the end of the year. I believe that this is what the KEVM may allow?

This won't be possible, because Solidy and Plutus are both different languages and even the blockchain accounting system is different on both platforms.
There might be a side chain running KEVM in the future, where you will be able to run Ethereum smart contact and somehow interact with the Cardano mainnet, but this is still just in the planning at the moment and nothing specific has been shared to mention we will have this anytime soon.


text:
Error running cardano-db-sync in docker-compose file as devcontainer
I have a docker-compose.yml file which I use as a devcontainer for VSCode. Part of my application requires access to cardano-db-sync so that I can query the database for transaction information. I am unsure how to get the dev service to communicate with the db-sync service. I have copied the entire docker-compose.yml and config/ directory from cardano-db-sync into my project. The error I'm getting is:
Connecting to network: mainnet
/nix/store/6f4mj582ymmn8zx90j8f8n9sx540hi9x-entry-point/bin/entry-point: line 26: /nix/store/74ky2ipmmh6y7qjxp0q03vh316dxddw2-cardano-db-sync-mainnet: Is a directory
/nix/store/6f4mj582ymmn8zx90j8f8n9sx540hi9x-entry-point/bin/entry-point: line 26: exec: /nix/store/74ky2ipmmh6y7qjxp0q03vh316dxddw2-cardano-db-sync-mainnet: cannot execute: Is a directory
/nix/store/6f4mj582ymmn8zx90j8f8n9sx540hi9x-entry-point/bin/entry-point: line 26: /nix/store/74ky2ipmmh6y7qjxp0q03vh316dxddw2-cardano-db-sync-mainnet: Is a directory
/nix/store/6f4mj582ymmn8zx90j8f8n9sx540hi9x-entry-point/bin/entry-point: line 26: exec: /nix/store/74ky2ipmmh6y7qjxp0q03vh316dxddw2-cardano-db-sync-mainnet: cannot execute: Is a directory

My dev service looks like this:
    dev:
        build:
            context: .
            dockerfile: DevContainer.Dockerfile
        volumes: [
            ../:/app/
        ]
        command: sleep infinity
        ports:
            - "3001:3001"
        networks:
            - dev-network
        cap_add:
            - SYS_PTRACE
        security_opt:
            - seccomp:unconfined

and db-sync is:
    cardano-db-sync:
        image: inputoutput/cardano-db-sync:10.0.0
        environment:
            - NETWORK=${NETWORK:-mainnet}
            - POSTGRES_HOST=postgres
            - POSTGRES_PORT=5432
        depends_on:
            - cardano-node
            - postgres
        secrets:
            - postgres_password
            - postgres_user
            - postgres_db
        volumes:
            - db-sync-data:/var/lib/cdbsync
            - node-ipc:/node-ipc
        networks:
            - dev-network
        restart: on-failure
        logging:
            driver: "json-file"
            options:
                max-size: "200k"
                max-file: "10"

secrets:
    postgres_db:
        file: ./config/secrets/postgres_db
    postgres_password:
        file: ./config/secrets/postgres_password
    postgres_user:
        file: ./config/secrets/postgres_user

volumes:
    db-sync-data:
    postgres:
    node-db:
    node-ipc:

networks:
    dev-network:

saw this GitHub issue
https://github.com/input-output-hk/cardano-db-sync/issues/655

upgrading the image version to 10.0.1 will resolve the entry point issue.
image: inputoutput/cardano-db-sync:10.0.1

Really? The comments on the GitHub issue: https://github.com/input-output-hk/cardano-db-sync/issues/655 say the issue is still unresolved.

@NikeDattani It was resolved by 10.0.1 release. check the issue again.

At the time of your answer, the last comment was "This is still an issue as replicated by @meiblorn." It was hours later than the issue was closed (without really answering that last comment).

@NikeDattani
I saw this pull request.
https://github.com/input-output-hk/cardano-db-sync/pull/698


text:
CIP-30 address format to addr1 style for db-sync
I'm a bit lost. I've got the https://github.com/cardano-foundation/cardano-connect-with-wallet/tree/main working and can get the used addresses from a wallet. I would like to use those to query db-sync. There seems to be conversion problem as the library returns raw addresses (?!?) and in db-sync 'addr1...' style addresses are used.
Is there any way to convert them or use the raw addresses to query db-sync?
Thanks!

Most of the tables that hold addresses have separate columns for the raw address and the Bech32 encoding.
Maybe there are some hints here: https://github.com/IntersectMBO/cardano-db-sync/blob/master/doc/interesting-queries.md

Thanks for the replay. Is it possible that this page isn't up to date? In their examples the table 'tx_out' containers an raw_address field, but not in the latest db_sync?

Some changes were made recently and some more have been proposed. See https://github.com/IntersectMBO/cardano-db-sync/issues/1835

Thank youi for the hints! Getting there.

I switched to https://github.com/MeshJS/mesh which solves the problem.


text:
Address format help CIP-30 to db-sync
could anybody help me figure out how to use the "hex-encoded bytes format" addresses (used addresses) from CIP-30 to query db-sync table tx_out? Are there good examples on how to decode/encode them in a postgres query?

This is very similar to: https://cardano.stackexchange.com/questions/12635/cip-30-address-format-to-addr1-style-for-db-sync/12636?noredirect=1#comment8062_12636

https://github.com/MeshJS/mesh solved my problem.

https://github.com/MeshJS/mesh solved my problem by returning addresses already in the 'addr....' format.