text:
What is the best formula to track ROS tax liabilities for delegators?
Hello fellow Cardanians,
It is my tentative understanding that in the United States, it is assumed that staking rewards are taxed as income the day they are added to a stakers address regardless of whether or not they make a formal transaction to withdrawal the rewards to their wallet per epoch payout. If this is correct, how would one best design a spreadsheet formula or api/script to calculate fair market value of ADA?
I have been using a combination of Coin Gecko's 180 day chart (which seems to possibly average the ADA daily price on the chart, but it's tedious to use the GUI) and Vipers staking calendar(https://viperstaking.com/ada-pools/staking-calendar-2021/).
Is there a canonical way for a website to, for example allow a user to enter their ADA staking address(es), and have the epoch payout spot price be calculated for each reward payout?
Also, does the spot price at the exact time of the rewards payment matter for establishing the fair market value, or does a daily average spot price from a major exchange suffice? I see on the Viper staking calendar, the exact UTC is included, but it would be very tedious to manually match up exchange chart UI spot price, as opposed to just finding the daily average.
Seems like a few apis/scripts, and a bit of professional tax reporting advice would be the way to go. Before I dig into designing something, I'd love to have some feedback to save time on non-compliant experiments/iterations.
I appreciate the help, peace and love!
-CPG

Cexplorer provides functionality that shows tax information for a single stake address:
https://cexplorer.io/stake/stake1u80t4aj3rqzs88f08avadmcnyhgana4zds2xm4n0dhnfykcgptjla/tax (random example address)

This is great thanks so much, I'll follow up with Ada Pools to help evolve this effort!

Pretty sure https://pooltool.io/ has similar functionality.

This lists the reward payouts into a spreadsheet (rather than a web page) at the time they happen, even without a formal transaction happening.
But it does not yet convert them to USD, so half answer only.
https://github.com/pixelsoup42/cardano_account_pandas_dumper


text:
Any update on RINA?
Recursive Interconnect Network Architecture was being discussed for Cardano. Is the networking team or anyone looking into this?

Wayne Jones has written on Blockchain Reporter the following:

To scale its network, Cardano has adopted RINA (Recursive Web Architecture).

So, when Basho era launches, we'll see RINA's implementation in action.

source: Stack Exchange

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

sort: votes


text:
Is awaitTxConfirmed mandatory?
I am running into timing issues, and am considering leaving out awaitTxConfirmed.
Is that wise?

You may broadcast transactions in fire and forget manner. If the fact whether it got into a block or not is not important to you, skipping  awaitTxConfirmed is not a bad idea.

If you don't care whether a transaction has not been added to the ledger, then you can skip awaitTxConfirmed. But in that case, do you need to use blockchain in the first place?
What are the timing issues? Why do you have timing issues? What are you trying to accomplish? Do you need confirmation that a transaction has been added to the ledger? What if it hasn't and you're assuming the transaction has been confirmed and you act upon a false assumption?
There's not enough information to give you an answer, but these questions might help you in coming up with your own answer.

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


text:
Data and metadata protection
Original question:
Where is confidential data held and how is access to it controlled?
response:
It depends on the context, but if you include metadata in a transaction, those metadata will be publicly available. However, you can always encrypt your metadata. When you encrypt metadata and attach it to a UTXO, whoever else has the secret key to decrypt those metadata will be able to read decipher it, but nobody else will be able to.
Additional questions related to above:
For holding confidential data: I see how encrypting data on chain can keep it confidential for some years until the crypto is broken and maybe that’s OK for some data and expectations of confidentiality. Quorum (when last I spoke to them) don’t put encrypted data on chain since they share my assumption that crypto works for a limited time. How would access to the secret key you mention be tied to UTXO? I don’t see that linkage

Blockchain is not designed for use in communication/secure storage. It is ideal for proving the existence of a digital resource at a point in time. Therefore it is not supporting the exchange of encrypted data or its key.
However, if you want to prove that you are holding a digital copy of some file you can post the hash of that file as metadata in the blockchain. Say after 10 years if someone denies that you had access to the document you can prove them wrong (Proof of existence).  Proof of ownership of an asset and proof of the existence of an asset is the primary service of the blockchain.


text:
Validating transactions
Original question:
When 51% or more of consensus participants validate any transaction for recording on-chain, against what evidence are they validating?
Original Answer:
Each transaction is broadcast, and the slot leader creates a block from all of the transactions in a given slot. That block is then broadcast to the rest of the network. The network relays the blocks until everyone has a copy, and each time a block is relayed, information about the sender is verified. See Ouroboros Praos for the set of properties tested when receiving a transaction.
Additional question related to original:
What I really wanted to explore was whether the data required for truly validating the correctness of any transaction is viewable to the participants or if it’s held confidential (like it might be encrypted) would that validation really mean anything? With bitcoin, everyone can see whether you have enough coin to give away what you propose to give; but if there’s a scheme where information like that is confidential, then the validation means nothing and few would want to participate in a transaction that cannot be validated. There will be some contradictions that will find their ways into these new systems.

Every block contains enough information to validate that
a.) The pool that produced the block was allowed to produce the block in that slot. The header contains a proof and hash of the pool's vrf keys that any consumer of the block can verify.
b.) Every transaction in the block is signed by the appropriate keys that allow the transaction to spend the utxos.


text:
Re: staking using ada with Yoroi mobile
Well, two questions: (I'm a newbie so please go easy)

So, I started staking with mobile Yoroi my Ada coins. I've looked all over the interwebs, there is no info on this topic:. While my ada is being staked, do the coins go up & down with market pricing as if they were in my exchange wallet? I'm sure it does otherwise it would be extremely lame to stake if a project like ada is going up in value!!?? Please can someone clarify!

Why in my Yoroi wallet does it only give me my token count? It doesn't give me an estimated market value in dollar amount??? It's 2021, that would be nice, then I wouldn't be asking the above first question. Thanks and please go easy on me, only been in crypto for 10 months. MG

Welcome to Cardno SE Mike G.

Few points regarding staking are as follows.

Staking will not affect the market value of ADA in any manner.

Staking ( as I understand) is a way to implicitly trust the Stakepool you had delegate and give it more power while participating in Block production.

You can decide to change your deligation(which stake pool you trust) at any time you want.

You can remove any amount of ADA from staking at any time you want and sell the coins by transferring them back to exchange at the market rate.

Yes, it would be nice if the market rate is shown by Yoroi wallet, like Daedelus.

yes, your staked ADA will continue to fluctuate in value as the ADA price changes, like all ADA does. Your staked ADA never leaves your wallet, so as Raghu points out above, you can remove your stake at any time (although doing so before the end of an epoch means that you may lose your rewards)


text:
Setting up a stake pool relay node
I am in the initial steps of creating a stake pool and I've learnt that I need a block producer and a relay node. For the process of getting AWS instances, I would like to know:

Do I need two relay nodes?
Are the server requirements for a relay node the same as those of a block producer?
For a start, is there a specific pledge amount with no delegators yet, that would have chances of producing a block?

You do not need two relays nodes, in fact, you do not need even a relay, but it is a recommended practice.
Yes, the requirement is for the cardano-node and it is same being a relay, as well as a block producer.
Right now, you need little bit more than 1M ADA to mint a block.

Here are some directions that might help you move forward
1. Do I need 2 relay nodes?
It is not necessary to have two relay nodes but each stake pool must run at least one block-producing node and one relay node. The block-producing node holds the keys and certificates necessary to issue blocks and rewards payments, but it should not be directly connected to the network because you don't want to be exposed.
For security reasons, it must be connected only to one or more relay nodes controlled by the stake pool operator. Then, the relay nodes connect to other relays on the network. This setup is configured in the topology.json file.
2. Are the server requirements for a relay node the same as those of a block producer?
Officially, the minimum required is the same for a BP and a relay node. However, from my personal experience with equivalent servers the relays consume on average slightly more RAM.

3. For a start, is there a specific pledge amount with no delegators yet, that would have chances of producing a block?

You need to have 500 ADA for the pool deposit
It is not a question of knowing if you are going to produce a block
or not for such or such amount of stake/pledge but rather to know how often?
With 100k ADA your pool will produce about 7 blocks per year. You can take 5 minutes to read this interesting thread "Actual Cost to Operate vs Actual Returns thoughts?" on the official Cardano forum.


text:
How to talk to Cardano blockchain using Javascript
How would I go about making a Javascript script which can get information from the cardano blockchain. Like what library or framework can I use.

While I have not used this API myself, the Blockfrost API has a JavaScript SDK that can do that. There is a free tier.

Ogmios runs alongside a cardano node and provides a websocket api to sync or query the chain. Documentation is available here. If you don't want to host the node yourself, or want to get up and runnning as quickly as possible, you could check out the instance hosted by Gimbalabs

Nami wallet injects a bunch of functions yo your browser, similar to meta mask:
https://namiwallet.io/

The MESH JS SDK is ideally suited for Javascript or Typescript interaction with Cardano, including functions abstracting most of the core functionality and "Providers" which can be used to get data from Blockfrost, Koios, Ogmios etc. There are also React elements, and starter kits and basic templates.

You can also interact with cardano blockchain via cli, and there is a nice library that i use personally a lot named cardanocli-js


text:
Constraints.mustValidateIn in a StateMachine
I have an issue with Constraints.mustValidateIn in a StateMachine.
In the case using Interval.to deadline everything works as expected. But in the case: Interval.from deadline the constraint is never valid.
I also tried to build the interval by hand to exclude issues with closure: Interval {ivFrom = LowerBound (Finite $ deadline object) False, ivTo = UpperBound PosInf True} Tried with and without closure but it does not have any effect. Also waiting and use the transition in a slot which is far beyond the deadline does not work.
Docs say :
 mustValidateIn :: forall i o. POSIXTimeRange -> TxConstraints i o

 *mustValidateIn r requires the transaction's time range to be contained in r.*

If I understand it correct, in this case it means the transaction have to happen between deadline and infinity, which should be represented by the interval above?
I define the deadline in the trace as : slotToEndPOSIXTime def 25
Very confusing is: when I change it to slotToBeginPOSIXTime def 25 without changing anything else the behavior turns around...
Anyway my waitForNSlots in the trace are always minimum 3 slots so it should also not run in some limit case.
The actual distance between slotToBeginPOSIXTime and slotToEndPOSIXTime is, if calculated in repl, 999 milliseconds as I would expect with a slot time of 1s.
(Also tried to add / subtract some seconds from the POSIXTime, which had no effect)
Do am I miss something here?
Thank you for support

I had the same issue. Slots are 1 second and cannot be broken down any further. So when you use the slotToEndPOSIXTime def 25, you will get something like 1596059104999. This number is number is in milliseconds, and is not a valid slot because of the trailing 999. You need to add 1 to this number to bump it up to 1596059105000 so that it is evenly divisible by 1000(1000ms/1Second).
I hope that helps!


text:
How to submit a script transaction using `cardano-cli`
I'm trying to go through the Alonzo Testnet exercises to get more familiar with the deployment process for Plutus contracts. I've gotten confused by the instructions in sheet 3:

Download the pre-built AlwaysSucceeds.plutus Plutus script, and obtain the script address. cardano-cli address build …

I've downloaded the file and saved it as AlwaysSucceeds.plutus but when I run the command:
cardano-cli address build --payment-script-file AlwaysSucceeds.plutus --testnet-magic 1097911063

I get the error:
Command failed: address build  Error: AlwaysSucceeds.plutus: AlwaysSucceeds.plutus: openBinaryFile: does not exist (No such file or directory)

The ellipses ... are throwing me off, like it's supposed to be obvious what to include. Could someone point me in the right direction of what I'm missing? Maybe I just skipped some docs, but I suspect I'll be similarly confused with subsequent ellipses.

Your command invocation looks correct. But the error suggests that the file AlwaysSucceeds.plutus is not in the directory where you are running the command. Either make sure you run the command from the directory the file is in, or give the full path to the file.

I've given the full path, and that doesn't help. I'm running from the Docker container, so I thought maybe the CLI's path was from in the container. I've tried copying the Plutus file over to the container and using the absolute path, but I'm getting the same error.

AlwaysSucceeds.plutus: openBinaryFile: does not exist (No such file or directory) means the file is missing.


text:
Cardano Blockchain backup
I wanted to make a backup of the Cardano DB for a faster restoration in the future.
Should I make a backup of all the folder DB or just the folder ledger ?
and when I need to restore should I restore the full DB folder or only some part of it?
Thank you

You should make a backup of the entire db folder as the majority of the data is inside the immutable folder.
For restoring, just copy all the content of the folder in the new node.


text:
what is happening behind the scenes when you buy a cardano nft, from a privte website
I m starting to get into coding, and I did not manage to find an answer to this question.
When you buy an nft you are asked to send an X amount of ada to a wallet, and then few min after the website automatically sends you the nft.
How do I begin to learn how to do it myself?

The documentation here is a solid way to get started: https://developers.cardano.org/docs/native-tokens/minting-nfts

I will try to answer this question as there are a few ways this could be happening. So far, I've seen the following

Cardano Smart Contract (most decentralized solution and preferred)
Minting Machine (very centralized and code cannot be verified)
Manually sending

Cardano smart contracts - There is an onchain portion and and off chain portion to consider but in general you can consume a utxo at a smart contract address by simply sending a transaction that meets the contracts parameters for successful validation. When you send ada, you are creating a transaction and submitting it. The smart contract verifies that you have met the requirements and the NFT gets transferred to your wallet. (This is made more seamless with a wallet connector. Connecting a wallet and signing the transaction on the site can trigger the submit and execute the smart contract)
Minting Machines - I've seen a lot of these around and I don't like them as they are not really part of of the blockchain. It's a bash script that gets executed if it detects a deposit of ada coming into an address. Some of the ada that comes in is used to build a transaction to mint the nft. Then another transaction to send the nft to the buyers address is created and sent to the original sender.
Manual - As a developer, I've gotten request to do this manually until they build out one of the other options listed above. My recommendation is to learn the cardano-cli and try some transactions on a node. Then learn haskell and plutus to build smart contracts.

Per his description, I think he means the second option (minting machine), since he sends X amount of ADA to an address, instead of consuming a script

And with smart contracts you lose a critical feature: you know exactly what NFT you are buying, so there is no randomness behind the scenes


text:
Creating Cardano Non-Fungible Tokens with royalties for newbies
I've been looking around since last week and I need directions to create my own non-fungible tokens with royalties.
Do I need to learn how to create a smart contract for this myself? or are there templates that I can trust?
I'm looking for best practices and good sources.
How do I approach this?

There's a discussion about this topic on the Cardano forum.
Some members of the community created a CIP that you can see on GitHub.
This is the most recent information there is (and it's still work in progress). Since native assets can be sent around without any smart contracts, royalties can't be enforced for Cardano NFTs. With the proposal in the CIP, you rely on the honesty of the people (or at least the NFT marketplaces) who sell your NFTs.

You would probably need to write the smart contract for yourself.  There isn't really a set of well tested templates or anything like that (as far as I know) besides the sample exercise code provided in the plutus pioneers program.

Do you have the sample exercise code at hand? or link to it?

authors: 北京做假证_北京办文凭毕业证 - spam


text:
Finding the redeemer of another UTxO in a transaction
I want to have a minting policy that checks some conditions of another input-utxo of the transaction. Fetching all transaction inputs and iterating over them is possible using txInfoInputs (see plutus-docs). But how do I check which redeemer is handed over to these utxos?
I have the below code. It checks that there is an input utxo with a defined nft. Now I try to check that the redeemer of this storeUtxO is of type BuyTickets. How do I do this?
-- What are we doing here ? We are just checking that the transaction
-- includes a utxo-input with the defined store nft and that the redeemer
-- of the store utxo is 'BuyTickets'. We want that the store takes care
-- of validating the ticket purchase.
{-# INLINABLE mkTicketPolicy #-}
mkTicketPolicy :: Store -> () -> ScriptContext -> Bool
mkTicketPolicy st () ctx =
    traceIfFalse "store nft not found" hasStoreNft
    && traceIfFalse "wrong redeemer" hasCorrectRedeemer
  where
    let (c, t) = storeNft st -- storeNFT :: Store -> AssetClass

    storeUtxO :: TxInInfo
    storeUtxO = find
        (\i -> (valueOf (txOutValue $ txInInfoResolved $ i) c t) == 1)
        (txInfoInputs $ scriptContextTxInfo $ ctx)

    hasStoreNft :: Bool
    hasStoreNft = case storeUtxO of
        Nothing -> False
        Just _ -> True

    hasCorrectRedeemer :: Bool
    -- TODO

if I got you right, what you want to do is not possible.
The spending transaction sends the reedemer for each UTXO the transaction wants to spend.
The spending transaction is created by your offline code and the redeemers for the specific scripts send together with that transaction. The redeemer is not carried on the UTXO, so the UTXO holding the NFT does not have that information, just the datumHash (Datum).
You can use the redeemer with the script validating the NFTs UTXO, e.g. if it is allowed to spend it (as for an oracle). If the validator decline, the UTXO is not spend, which leads to a missing input for "mkTicketPolicy".
So you have to check in your "mkTicketPolicy" if the NFTs UTXO will be spend. But you cannot check out of another validator script the redeemer backwards.
By submitting your transaction for your "mkTicketPolicy" validator you have to attach another constraint which triggers the validator script for the NFTs UTXO. A good example how to do that is the oracle script from the Plutus Pioneer course.
I hope I could explain it in an understandable way.
Edit:
let v       = txOutValue (txOutTxOut o) <> lovelaceValueOf (oFee oracle)
                        p       = assetClassValue (oAsset oracle) $ price (lovelaces $ txOutValue $ txOutTxOut o') x
                        lookups = Constraints.otherScript (swapValidator oracle)                     <>
                                  Constraints.otherScript (oracleValidator oracle)                   <>
                                  Constraints.unspentOutputs (Map.fromList [(oref, o), (oref', o')])
                        tx      = Constraints.mustSpendScriptOutput oref  (Redeemer $ PlutusTx.toBuiltinData Use) <>
                                  Constraints.mustSpendScriptOutput oref' (Redeemer $ PlutusTx.toBuiltinData ())  <>
                                  Constraints.mustPayToOtherScript
                                    (validatorHash $ oracleValidator oracle)
                                    (Datum $ PlutusTx.toBuiltinData x)
                                    v                                                                             <>
                                  Constraints.mustPayToPubKey pkh' p
                    ledgerTx <- submitTxConstraintsWith @Swapping lookups tx
                    awaitTxConfirmed $ txId ledgerTx

This is copied from the Swap.hs of the oracle example from the pioneers course. You see that two scripts with two reedemers are part of the transaction. Maybe this clarifies a bit better.
Here is the link to the complete example:
https://github.com/input-output-hk/plutus-pioneer-program/tree/main/code/week06/src/Week06/Oracle

I understand that constructing the scripts and the redeemers is done off-chain. But the transaction - to be executable and validable by a Cardano node - must (in some form) include all the scripts and their redeemers. If the transaction coming to the node includes all these information, wouldn't they be accessible by the validator scripts of the included input UTxOs? I thought the validators have access to the whole transaction.

But I see the issue. If every validator has access to all the validator scripts, their redeemers, and the datums, then it could also run any other validator, potentially, causing an infinite loop. So I guess, it is not correct to say that the whole transaction is visible to the validator scripts.

The whole transaction is visible, but just the transaction which is relevant for the specific UTXO. What you want to achieve is possible but not in the way you are trying it.
Your first comment is correct - the transaction contains all the scripts and information validable by the cardano node - it is just split into two scripts.

The validator script which checks if the utxo with the NFT can be spend
the validator script for mkTicketPolicy which checks if the UTXO is available and additional checks.
So your approach is solving 2. already, you still need to do 1.

Thank you for your input. The oracle example of the Plutus Pioneer program is another use case. There, the swap validator just needs the exchange rate of the oracle. This rate is in the datum of the oracle utxo and therefore accessible to all validators. What I want to achieve is a bit different. I can shift the logic into the store, there is no problem. I was just under the impression that my way would be possible. So in conclusion, only the transaction without the scripts and redeemers is visible to the validators. Is this correct?

I don't know what exactly you want to achieve, but what I described beside the oracle example also does not need the datum. With the example I wanted to point on the Constraints.otherScript and Constraints.mustSpendScriptOutput. This you can validate   without the need of redeemer or datum. But what you say is basically correct if you see it from the view of an utxo which does not belong to the actual executed validation script so e.g. an input.

I think you are confusing something here. Validation can never happen off-chain. The oracle value is needed in the swap validator. You can see the datum being fetched on line 70 here: https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week06/src/Week06/Oracle/Swap.hs

Exactly, but you want in the oracle case to check for the datums value. Directly above that from line 57 to 68 its just checked if exactly one input form the address you passed is available. So If you make sure in your other script its just spend under a certain condition, you know that condition was matched when the input is available. The condition is specified in the other script. If we take the oracle example it is e.g. that the NFT and the datum of the new utxo created for the oracle are identical and the fee is paid. Edit: I assume you are in control of both scripts.

The reason I want to do what I described is that the transaction will include many utxo outputs with minted tokens in the 'BuyTickets' case. So I want the store-utxo (the one with the nft) to check the validity. This utxo will also have other cases beside 'BuyTickets'. As I don't want to check that no tokens are minted in these other cases, I thought that it would be easiest to check in the minting policy that the store-utxo is spent with redeemer 'BuyTickets'.

Ok I am not sure If I understood it completely, but can you not just check if the nft is available in the values and select the utxo's where the nft is available as input? I Guess they all have the same currency symbol or tokenName for identification?
For the "store-utxo" with the redeemer "BuyTickets" case as you describe I would maybe write to the datum it is in the state "BuyTicket" and make a transition to a neutral state when the NFT arrived in the store-utxo? I am sorry I do not know enough about your system for helping with a clear solution.

Each issued ticket has its own token name but the same currency symbol. The token name is an integer representing the ticket number. One can easily see that the validation can not be done on a per ticket base if the tx contains minting of multiple tickets. The validation needs to know all minted tickets of the tx. Hence the idea of letting the store-utxo handle it. Storing the redeemer in the datum seems like a very hacky way to me. I thought of it but I think that it is better to let the minting policy validate all tx as long as it contains the store-nft and let the store-utxo do the rest.

Is my understanding correct with this:
You have a store, the store has its own NFT to be identified, someone issues a "buy ticket" with a arbitrary amount of tickets. Each ticket is a ticket-NFT which you want to mint from the mkTicketPolicy. You hand over some store-parameters containing e.g. the cn and tn of the store-NFT (possibly also the cn tn of the ticket-NFT). You check the store-NFT is available in inputs of the minting policy and matches the passed parameters to know the correct ticket-NFTs are minted. Is this correct?
What else you want to check with the minting policy?

Everything is correct except "to know the correct ticket-NFTs are minted". The correctness is a bit tricky. The store-utxo has a counter in its datum. The token names must satisfy the conditions that they are (i) all different (ii) represent integers, (iii) strictly follow each other in at least one order, (iv) at least one of them is equal to the incremented counter. Additionally the transaction is a collection of buy requests put together to overcome the one-transaction-per-slot issue. The tickets can, therefore, be issued to a multitude of different pub key addresses.

But all this was a distraction from the initial question: Is it possible to access other scripts redeemers ? Does the documentation say something on this ?

Thank you for the explanations, you have a very interesting project. As far as I know it is not possible in on-chain code to access other scripts redeemers. The docs support that as I could not find anything for the script context what holds information about that.


text:
Cardano marketplace that allows selling a batch of NFTs
anyone aware of a cardano marketplace that allows us to mint NFTs in batches that will launch with smart contracts launch or at least close to the launch? So e.g. 1 policy ID, 10000 asset names that is available for sale for a week - something like this.
Cheers

You can publish multiple NFTs at once in the following marketplaces:

CNFT.io
Tokhun

authors: Николай Елисеев


text:
What security exists in Daedalus for protecting the private key
If the wallet private key is in \AppData\Roaming\Daedalus\Secrets-1.0 what security exists from physical access to this file?
Per this https://forum.cardano.org/t/where-are-the-public-and-private-keys-located-in-daedalus/6522/2 a user states this file is encrypted but I assume a attack can could still result in retrieval if access is available while Daedalus is running.

About password and physical access
First of all, your wallet must be password-protected and then, as you already said, it will be encrypted. You also need a strong OS password to protect your computer from physical access. And yes, remote attacks are highly possible (in case you installed Daedalus on a machine that's used for web surfing). So Firewall is a good choice, as well as HDD/SSD encryption.
However, if someone downloaded a file containing your private key, the probability of guessing a password for this file depends on the complexity of your password – it can be up to 255 characters long. Brute force methods are still alive (you can explore some rainbow tables for simple and frequently used passwords).
Official docs page says:

Note that password only works to encrypt/decrypt your private key on the computer where your wallet is restored. Anyone with access to the recovery phrase can restore the wallet on a different machine and set a different spending password on that. So keeping your recovery phrase secure is vital!

Hardware wallet pair
The solution is banal – keep your coins on a hardware cold wallet, or, at least, use hardware wallet in combination with Daedalus. In my opinion, "pure" Daedalus (without pairing it with hardware wallet) is suitable for storing a small amount of coins (equivalent of $500 to $1000). Although everyone has their own personal opinion about security.

P.S.
When you're spending your coins, you need to enter your password. At this very moment, the private key must be decrypted, and after sending the funds, it must be immediately encrypted again.
As far as I understand, there's no need to decrypt/re-encrypt a private key at staking stage...

I kinda disagree. The largest attack vector for both a hardware and a software wallet is the human factor of keeping the key safe. Hardware wallet offers more potential attack vectors such as someone simply forcing someone plug it in and press the button. Where if I have a software wallet over a protected user account over a encrypted disk it actually seems much safer. My question was more of a technical what happens behind the scenes when Daedalus references the key how/when does it unencrypt it and reecrypt it. Does it ever need to un-encrypt the file after its initially established etc.

I've updated my answer.


text:
How can I mint a token without a name for NFT royalties?
The proposal for Cardano NFT royalties CIP-0027 suggests that a nameless token should be used to store the royalties information.
Usually a mint transaction looks something like this:
cardano-cli transaction build-raw \
--mary-era \
--fee 195509 \
--tx-in b1ddb0347fed2aecc7f00caabaaf2634f8e2d17541f6237bbed78e2092e1c414#0 \
--tx-out $(cat payment.addr)+4804491+"1 677d3bbe3e01eeab498cd8786f7d261d92bd6ecea12109a332e86374.MountainGorilla"\
--mint="1 677d3bbe3e01eeab498cd8786f7d261d92bd6ecea12109a332e86374.MountainGorilla"\
--out-file matx.raw

Source: https://silas-stulz.medium.com/you-want-to-create-your-own-nft-heres-how-you-do-it-on-the-cardano-blockchain-9a0bbf8caa39

As we can see in the mint part, the new token is a combination of the policy id 677d... and the token name MountainGorilla.
Is there any example how a nameless token can be minted?

Native assets as far as I’m aware can have the empty string for the token name. In theory you should be able to just leave the token name empty so the token ID will just be the policy ID. I’m not sure if the . is still required though, but as you can see from the docs, it’s just a ByteString object, which can be empty.
https://alpha.marlowe.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Value.html#g:2


text:
nix-shell stuck on Building library for hnix
I'm just gonna post a problem that I've been experiencing for a few days (and having a hard time searching for the answer on the internet) and the solution, so that future questions can refer to this solution.
Hardware
I'm using Macbook Pro Intel 2020, macOS Monterrey Beta 6
Problem
So the problem was when I was running nix-shell in the plutus repository for the first time, and after downloading all the dependencies, the nix-shell stuck at Building library for hnix-#.#.# and [1 of 50] Compiling Nix.Atoms.
What I did before compiling was installing Nix from the official documentation https://nixos.org/download.html
I also did configure the binary cache from https://github.com/input-output-hk/plutus#iohk-binary-cache
Also tried to start with and without https://github.com/input-output-hk/plutus#nix-on-macos
All to no success, still stuck at Building library for hnix-#.#.# and [1 of 50] Compiling Nix.Atoms

can I ask how you installed nix-darwin ?
I have the same issue as you had (Building library for hnix-#.#.# and [1 of 50] Compiling Nix.Atoms.)
I get this error when I try to install it: ~ % nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at /nix/store/v1rhxl3ln24zlx8dbmhcrwbwydfmzj6a-master.tar.gz/default.nix:1:13
zsh: no such file or directory: ./result/bin/darwin-installer

So the solution was simply to install nix-darwin
https://github.com/LnL7/nix-darwin
simply follow the instruction on the github page above, and now I can access my nix-shell

What is nix-darwin and why does installing it fix this issue?

@runeks it's like a driver or plugin to make nix compatible with macos

where did read this? As far as I can see it's a way to configure macOS using a declarative configuration (similar to NixOS).
I don't see the connection between this and fixing nix-build hanging when building hnix.

I've installed nix-darwin but still have the same behavior.

@DanielCukier which terminal application and CPU architecture do you use? On my MacBook Pro M1, I just experienced the compilation of Nix.Atoms hang in iTerm2 running with Rosetta emulation (so that the command arch run in this terminal outputs i386). Then I tried to compile using the built-in Terminal app without Rosetta emulation (so that the command arch run in this terminal outputs arm64) and this successfully compiled Nix.Atoms. Given that OP is on Intel hardware it may, somehow, be the terminal application that causes the hang...

I had the same problem on my Mac M1 Pro and my issue had to do with my ghc installation. I had installed version 8.10.7 through nix-darwin and when I switched from that installation to the same version of ghc installed using ghcup the problem disappeared (as a side note, when you're in the nix-shell, make sure you're using the shell's version of ghc and not your own, should be 8.10.4.20210212).
If that still doesn't solve your problem, I would suggest downloading the repo that broke and try running cabal build --verbose inside of it, that's how I figured out what the problem was.
Check what the src is of the nix derivation that breaks:
$ nix show-derivation /nix/store/kkjbrl5bbpmirwfhhs89k1q7ahm7zqih-hnix-lib-hnix-0.14.0.5.drv

{
   ...
   "src": "/nix/store/ymkyz2z612zsi183x5mjqbn65vy1a6li-hnix-0.14.0.5.tar.gz",
   ...
}

The problem I had was that the cabal build gave me a Clang error due to some missing library (libz).


text:
May I lose my coins when staking in Exodus wallet?
Is there any potential risk of losing all my ADA coins when staking with Exodus partner Everstake?

As you can see on the everstake website they have a pool called EVE1. This is a normal Cardano stake pool. You can see some details about this pool on adapools.org (or any other site that provides a similar service).
The pool has a 3% fee, this means you can stake with it from any Cardano wallet without risking your ADA. One thing that is very important: The ADA will always stay in your wallet, you never have to send it somewhere else. If some stake pool requests you to send all your ADA to another address, it's a scam.
Generally it's recommended to use one of the official wallets for storing your ADA. This is either Daedalus or Yoroi. But as long as you control your keys, also other wallets can be used to stake ADA as long as you trust the creators of the wallets.


text:
How does Edwards curve used for generating public key look like?
What equation suitable for generation of a public key is used for Edwards curve Ed25519?
The problem is the following – info on Edwards Elliptic Curve on Wikipedia page presents an equation y^2 + x^2 = 1 + d * y^2 * x^2 that doesn't allow us to plot a curve depicted on the first picture.
So, what equation is used for Ed25519? This one?
y^2 + x^2 = 1 - d * y^2 * x^2

Or this one?
y^2 + x^2 = 1 + d * y^2 * x^2

I haven't found any documentation covering this topic.

The general equation of the Edwards curve is

for Ed25519
a = -1, d = -121665/121666.
The curve is also living in the prime field. The equation is
I could not plot this equation in geograba, I guess due to the nature of the prime field over which the equation is defined.(?)

I think IOHK used different a and d values for Ed25519 equation. As far as we can easily build a Bitcoin curve (secp256k1) over definite field using its native equation y^2 = x^3 + 7, we'll also be able to build a Cardano curve.


text:
Where can I find an official docs about private and public keys' generation?
Is there an official documentation showing us a process of creation of private key, public key (including EdDSA math), and wallet address, with examples written in Python or C?

This page is pretty good with the cli commands needed for doing this: https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet
I remember seeing some examples in Python that just made calls to these cli commands via the shell module and parsed the results. There is also a cardano-python module being developed you may want to check out.
Or you could try using the REST API docs via the python requests module. You can run this locally by going to the first link I posted and searching for Starting cardano-wallet as a REST API server

Thank you for you answer Matt! Could you tell me, where I can find info on Cardano algorithm EdDSA?


text:
Exception trying to run test node
I am trying to run a node for testing. I have been through the installation and downloaded the config files from iohk but I am getting an exception when the configs are parsed:
AesonException "Error in $: parsing PartialNodeConfiguration failed, expected Object, but encountered String"

cardano-node: Aeson exception:
Error in $: parsing PartialNodeConfiguration failed, expected Object, but encountered String

The command I am using is:
cardano-node run \
--config /home/mark/cardano_configs/testnet/testnet-config.json \
--database-path /home/mark/cardano_configs/testnet/db/ \
--socket-path /home/mark/cardano_configs/testnet/db/node.socket \
--host-addr 127.0.0.1 \
--port 1337 \
--topology /home/mark/cardano_configs/testnet/testnet-topology.json

Any help appreciated

The links to the json files in the tutorial are out of date.  If you open them they contain url to the new location.  I downloaded them with curl so didnt notice.

Please update the question with the link you had used.


text:
Haskell example programs
So I've been trying to learn Haskell for a week now but I think it's time to do some small projects (like, a small guessing game or such). Can you all direct me into some project's I can take a look at and try and recreate.

I had used https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems . These are the best set of algo programs.

A place that I like for practicing problems is Exercism
Apart from the unit testing validation, volunteers check your code and give you human feedback.
https://exercism.org/tracks/haskell


text:
Ouroboros – Which version is currently implemented?
I was reading this blog post From Classic to Hydra and I was wondering which version of Ouroboros is currently implemented in Cardano: Classic, BFT or Praos?

Updated: July 20, 2023.
Ouroboros family implementations

Classic implemented in 2017
BFT implemented
Praos is currently running
Genesis    (development's in progress...)
Hydra      (development's in progress...)
Crypsinous (development’s in progress...)
Chronos    (development’s in progress...)
Leios      (development’s in progress...)
Omega      (brings together Classic, Praos, Genesis, Redux, Chronos, etc...)

Details you can find in my medium story Twenty interesting facts about Cardano.
Eras
Some of the above algorithms have mutually dependent ingredients for launching a certain era:

Byron Era (Foundation) – reached in 2017
Shelley Era (Decentralization and delegation) – reached in 2020

Allegra Sub-Era (Token locking mechanism)
Mary Sub-Era (Multi-asset implementation)

Goguen Era (Smart Contracts, DeFi, Dapps) – hit Testnet in September 2021

Alonzo Sub-Era (Smart Contracts implementation)
Babbage Sub-Era (Eliminates flaws of Alonzo)
Vasil Sub-Era (Increases network's scaling capabilities) – reached in July 2022

Basho Era (Scalability and Interoperability) – be ready for it in 2023
Voltaire Era (Governance) – development's in progress...

And Omega is in planned state as far as I know. If everything is OK next year should be implemented.

Thanx a lot @PetarEnchev, I've inserted it.

Very clear. Thank you very much!

What about Ouroboros Chronos and Ouroboros Crypsinous?

Ouroboros Chronos has been available since 2019: https://eprint.iacr.org/2019/838

According to this tweet Ouroboros Chronos should be part of Omega.

Thanks a lot @user142, I've included both in the list.

still Praos? was genesis published in 2018?

Hey @Rong, as far as I know Ouroboros Genesis will be deployed in January 2024.


text:
Entropy problem in addresses generated by Daedalus wallet
I've created a new wallet in Daedalus, and I've noticed that 20 new generated addresses have the same repeating pattern in the second part of each address. Here's how it looks like:
addr1..............29995jus7mml099y23nh0q6ak33kgwtq7algrytcj45.............
addr1..............29995jus7mml099y23nh0q6ak33kgwtq7algrytcj45.............
addr1..............29995jus7mml099y23nh0q6ak33kgwtq7algrytcj45.............

Is it a common practice for Daedalus wallet to generate addresses this way?

This must be the Payment address from your wallet. It is your stake key. All your Payment addresses will have the stake key which shows up in all receive addresses of the wallet. Its nothing to do with entropy in the Private Key which is generated using an opensource library.
It may be seen as a privacy issue to include the same staking key in all your addresses. But if you want privacy you can use cli to generate receiving addresses without the stake key.

Hi @raghu, thank you for your answer. Why are you calling these addresses Payment? Is there something special about them?

@Andy Fedoroff. There are several types in addresses in the Cardano ecosystem. The one used for sending and receiving payments are called Payment address. Reference https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet/


text:
Retrieve NFT transaction metadata
i've minted some NFTs with 721 metadata in the transaction and am now looking to retrieve the metadata information for further processing. I've send these NFTs around a bit so the   utxo is not the minting transaction. Is there a way to retrieve this information using the cardano-cli or cardano-wallet commandline? Or are there other suggestions for doing this. I'm working on the testnet currently.
Thanks a lot in advance!

I found that it is possible in the following way:

Use the Wallet API to find a minting transaction from a list of all of your wallet's transactions https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listTransactions. You can find here also metadata but for a better format, you can proceed to the below step.
Use blockfrost.io API to get metadata from minting transaction https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}~1metadata/get

Alternatively, you can use https://github.com/input-output-hk/cardano-db-sync to sync the whole node to Postgres DB from where you can query metadata https://forum.cardano.org/t/cardano-db-sync-query-metadata/74386
The third way is to use https://input-output-hk.github.io/offchain-metadata-tools/. By my understanding, the main purpose of this tool is to verify native tokens. It requires to be done pull request to git and after approval, you can do a query with this https://input-output-hk.github.io/offchain-metadata-tools/api/latest/

Cardanoscan can be used to browse the metadata. Similar services is also available in test net.
Sample output is like this

I guess the problem is to find a specific transaction, among all millions or billions of transactions that may exist on the block-chain. There are efforts like covalent ( https://www.covalenthq.com) that provide search services but I don't know if that is available for cardano.


text:
PAB requesting CONFIG_FILE on CLI
Trying to run PAB by executing:
cabal exec -- myapp-pab webserver
returns the following error:
[Error] The --config option is required
However, the lecture by Prof. Lars (PPP Lecture 6) didn't make mention of any config files.
What am I missing?

Aoaddeola.. thank you for sharing your knowledge with knowledge seekers. You are golden! I am just learning Haskell.. next Plutus. Have some minimal programming experience but very technical mind. Would love some suggestions for self education on the above mentioned languages. Thank you kindly!

@StephenSmith, you can learn Haskell here and Plutus here

You have to be in the right commit if you use the PAB as described in lecture 6 of the ppp, otherwise you will face problems. PAB and some other stuff changed.
I assume you build the project with cabal build without errors, try to cabal run NAME_OF_EXECUTABLE, e.g. cabal run oracle-pab. You don't need config files.
If you want a more up to date example use the Uniswap example form lecture 10, the implementation is still working with the latest plutus.
https://github.com/input-output-hk/plutus-pioneer-program/tree/main/code/week10


text:
Added more ADA on Yoroi while staking
I just added more ADA on my Yoroi Wallet while staking in a pool. Will the new ADA be automatically added into the current staking pool?
And do I need to withdraw my rewards in order to restake it?

Yes, and to the same pool. You don't need to do anything.

New ADAs will be added to the pool automatically but they will not be considered for 1 epoch, because snapshot need to be submitted. You can check here how the staking timeline works.
Rewards are automatically added to your wallet, you only need to withdraw if you want to spend them


text:
Minting a NFT (collection) with Blockfrost
I see al lot of NFT projects where you can buy 1 or multiple NFT's for a certain price. Like unsigned_algorithms, CardanoTrees etc. I am curious how these projects are created without the use of smart contracts, is it something that can be done using Blockfrost?

I am not an expert but I think you can't mint NFTs with Blockfrost and maybe never will.

You don't need blockfrost, just learn the cardano-cli and you can make anything. https://developers.cardano.org/docs/native-tokens/minting-nfts/
Download the Testnet version of Daedalus and get tADA (Test ADA) from the faucet and practice making them.
I also recommend looking at nftmaker pro for quickly minting your own NFT collection. https://www.nft-maker.io/

We can mint NFTs on cardano without smart contracts. There are some projects which help to do it in a browser like https://namiwallet.io/, but you can do it via CLI

The main reason that we can mint NFTs without smart contracts is native tokens on the Cardano blockchain.
A good explanation is found here https://www.youtube.com/watch?v=ccLgnM3ErUE at around 3 minutes.
There are multiple websites out there now that can take care of the minting process for you.
For example: https://metromermaids.com/mint/v0.104/ or https://www.nft-maker.io/ as well as various NFT marketplaces now also offering token minting support.

you just need :

cardano CLI to mint NFT
cardano node to be connected with the rest of the network
Cardano wallet :) for payment address
blockfrost to find info about Cardano blockchain, in case of sales, you need to find the Address of the wallet, which paid for your NFT
IPFS for Storage decentralize solution
some ubuntu / programming / scripting knowledge, for automation sales machine :)

enjoy decentralization and Digital art!!!
theTokenSquare17
pool operator for TTS17 pool


text:
Minting NFTs via cardano-cli: How to mint several NFTs consecutively?
I followed the NFT minting docs on https://developers.cardano.org/docs/native-tokens/minting-nfts which works very well for the first transaction.
I'm currently stuck trying to mint a second NFT. It's not clear to me, what kind of data has to be regenerated and what needs to be kept for the cli commands their parameters.
for the second transaction I've tried with and without regenerating policy keys and policyID. I adjusted the txhash and funds values, as those have changed after the first transaction. nothing really works.
here is the error I'm getting:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 999813423 (fromList [(PolicyID {policyID = ScriptHash "b5c707bc10063ae8ab04c2f7b99c3ed1f0bdd82266369367a7bef050"},fromList [("NFT1",1)]),(PolicyID {policyID = ScriptHash "fcd60019e5c25602201d5a28f73b7749e85efab6a31dbb7aa461132b"},fromList [("NFT1",1)])])) (Value 999813423 (fromList [(PolicyID {policyID = ScriptHash "b5c707bc10063ae8ab04c2f7b99c3ed1f0bdd82266369367a7bef050"},fromList [("NFT1",1)])])))))])

I hope someone can give me advice what kind of parameters need to change after the first transaction is done.
best

Sorry for not providing more context and code / scripts in the original question. however, I found the solution to my problem and want to share it in case anyone else has a similar issue.
for the very first transaction from/to a given address, the --tx-out param looked something like this:
--tx-out addr_test1vqjf8aak5fn3u2la4dgwyda98s2py3f9pqcmnhfq93ugq0qkctw7v+0+1 "90fa8ff2fb851f92fd239574334a37762bc22dcdf0595a269ad300c8.NFT1"
which is basically $address+$fees+"$tokenamount $policyID.$tokenname"
for the second transaction I just tried to replace $fees, $tokenamount, $policyID and $tokennamewith values from another NFT. what I didn't know is that $tokenamount, $policyID and $tokenname of the first transaction (or from all previous transactions) also have to be appended to the new value for the --tx-out param. so it would look like this:
--tx-out addr_test1vqjf8aak5fn3u2la4dgwyda98s2py3f9pqcmnhfq93ugq0qkctw7v+0+1 "90fa8ff2fb851f92fd239574334a37762bc22dcdf0595a269ad300c8+NFT1" "1 9bb49c25ea28964c96d119ecb3a9425d39a390e6c34974f2637c750e.NFT2
best

You should wait until transaction is finished and UTxO's are updated in your wallet.
A way to do it is to create a script that will query UTxO's for your wallet and once UTxO's are changed you run next transaction.
You can query it either directly from CLI and parse the results, or you can query it via cardano-graphql or Blockfrost.io API.


text:
cardano-cli: Network.Socket.connect: <socket: 11>: does not exist
I'm at this part of the docs. The node is running (left terminal in the image below), but now I'm trying to query the blockchain from another terminal and receive the error:
cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (No such file or directory)

I'm running the cardano node on a windows laptop inside an ubuntu terminal that I downloaded from the windows store (as recommended in the cardano docs here):

I think that maybe the two Ubuntu terminals are completely independent from each other and that's why the right terminal can't find the socket? I tried to install the cardano node on a raspberry Pi 4 also, so that I have a native environment, but the raspberry was just to slow for it...
EDIT:
I have set the socket path now like this at the bottom of my ~/.bashrc file:

then restarted the terminal, but still I receive the same error.

have you mentioned the socket location when starting the node?

I have set the same socket path as I used in the cardano-node run command:
export CARDANO_NODE_SOCKET_PATH="~/cardano-src/cardano-node/db/node.socket"
My cardano-node run command looks like this:
cardano-node run --topology ~/cardano-src/cardano-node/config-files/testnet-topology.json --database-path ~/cardano-src/cardano-node/db --socket-path ~/cardano-src/cardano-node/db/node.socket --host-addr 127.0.0.1 --port 3001 --config ~/cardano-src/cardano-node/config-files/testnet-config.json
and the query command: cardano-cli query tip --testnet-magic 1097911063

when I run echo $CARDANO_NODE_SOCKET_PATH in my terminal, it gives me the correct path back: ~/cardano-src/cardano-node/db/node.socket

But when I run ls -al $CARDANO_NODE_SOCKET_PATH I receive the error: ls: cannot access '~/cardano-src/cardano-node/db/node.socket': No such file or directory

Alright, the problem were the quotation marks. In the docs they use quotation marks too:
export CARDANO_NODE_SOCKET_PATH="/home/user/cardano/db/node.socket"
But here the guy didn't use quotation marks: https://forum.cardano.org/t/cardano-cli-network-socket-connect-socket-11-does-not-exist/38987/7
So I tried it without it in my ~/.bashrc file:

and it worked after re-starting the cardano-node and the second terminal:

I have found the solution for myself on a Coincashew tutorial.
https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node#2-build-the-node-from-source-code
Basically i executed this:
echo export CARDANO_NODE_SOCKET_PATH="$NODE_HOME/db/socket" >> $HOME/.bashrc
source $HOME/.bashrc

That rewired the node path to socket (on the place of node.socket). Don't know what is the real difference but this way worked while the 'node.socket' path don't.

I was having this issue while trying to get the Plutus PAB to connect to the node. I tried lots of solutions but didn't get it to work until I changed the "testnet/node.sock" in the config (testnet/pab-config.yml). Perhaps it needed to be relative?
plutus-apps/plutus-pab/test-node/testnet/pab-config.yml
...
nodeServerConfig:
  pscSocketPath: testnet/node.sock
...

When you are specifying CARDANO_NODE_SOCKET_PATH in these formats:
"$NODE_HOME/db/socket" you must use double quotes around it
~/cardano/db/node.socket you don't need to give double quotes around it


text:
What is the technical configuration difference between a cardano-node relay and producer?
More specifically, how does one know or how does one check if a cardano-node process is acting/functioning as a relay versus a producer?

BP settings ->

folder files : topology.json will be on BP only your realys
from BP we dont run topologyUpdater
to run a BP, you need minimum 3-4 files (hot.skey, op.cert, vrf.skey, vrf.vkey) - the rest of the files, need to be stored and secured in a private offline node for your security.

Relay Settings ->

you run script "topologyUpdater" so that you have every hour new peers.
in the "topologyUpdater" you have to define specific Nodes, you want to be connected additionally to the list of the Nodes from the script

It depends on how you configure your nodes, there are few things that changes between a block producer and a relay node. In the block producer's topology.json you should only have your 1/2 "private" relays. Another thing that you can check is the start up script of the node, the block producer need to include different keys: kes, vrf, ecc inside of it.
The last thing that comes to my mind is that if everything is configured in the corrected way, you should be able to see different things by opening the liveview of the node, first of all, it tells you if you are running a core or a relay node. If you are watching the core node, you should be able to see processed tx and mempool tx/bytes, plus the kes expiration date, if not, you should be able to see peers/other's pools relay nodes.

The presence of

--shelley-kes-key
--shelley-vrf-key
--shelley-operational-certificate

startup parameters, makes cardano-node acts as a Block Producer.

all answers a great for general infos...
i think based on your questions, you want to find if a node is BP or Relay,
please execute the command below
sudo systemctl status cnode
if you find the 3 files below on the executed command, means it is running a BP

hot.skey
vrf.skey
op.cert

if you need more info / support, let us know
TTS17


text:
Why Is Daedalus Mainnet taking so long to Sync My Transaction History with the Blockchain?
I'm running version 4.3.1 and started yesterday morning at approximately 8:30 AM now almost 24 hours later it's still synching at 89.6% complete.
I have 186GB free on C:\ drive and a hard wired internet connection and it's taking quite a bit of CPU/Memory

Is this normal?
Thanks

There is NO MOBILE APP for Daedalus. Be careful !!!! Lots of thieves out there!!!

Daedalus is a full node. You are syncing the entire history of the Cardano blockchain. If you are on a lower end PC with a less powerful processor this isn't out of the ordinary.
If you would like a light wallet I advise you to look into Yoroi or Nami.
Worthy of note, I heard through the grapevine that Daedalus is indeed working on a light wallet for mobile and the browser, but I don't think it's been officially confirmed as of yet.

Unfortunately my wallet is using a 12 word seed.  Looks like Yoroi and Nami need a 15 word seed phrase.

you can use adalite.io with 12, 15, 24 or 27-word wallet mnemonic seed phrases

No it's Input Output (IOHK) that is coming with a light wallet, called Lace. Daedalus is just Deadalus, which is also part of Input Output (IOHK).

Link: https://www.lace.io/

The Cardano blockchain is more than 16GB in size  as of October 2021, and it is predicted here that a full sync should take about 6 hours if you have a relatively good machine by recent standards (your 8GB of RAM may now be considered to be slightly on the lower end) and a broadband connection (I'm assuming you do). So it may be a bit of a surprise that it's only 89.6% complete after almost 24 hours.
These are some of the reasons why it might be taking you much longer than usual. First, Daedalus Mainset is only consuming 64.5% out of the 98% CPU usage that you display in that screenshot, so something else is consuming (or trying to consume!) a significant amount of your CPU too, and when overall CPU usage gets that high, things can slow down considerably because the computer has to "ration" its resources.
The next thing is your RAM usage, from which things are not easy to tell. 8GB of RAM is very often not enough these days, depending on what else you have running on your computer (evidently there's more than just Daedalus Mainsetbecause that's only using 68% of your CPU usage, whereas your overall CPU usage is at 98%). Even though you're only using 49% of your RAM, it appears to be almost all by Daedalus Mainset, and this suggests that it might have been possible that you ran into RAM issues (close to 100% usage) earlier, which caused paging (a process in which data that is intended to be stored in RAM gets transferred to disk to act as "virtual memory", which can slow down I/O enormously (this StackOverflow answer says it can be 100,000 times slower!).
Finally, you point out that you have 186GB free on your drive, which I don't think plays much of a role here since the Cardano blockchain is not even 20GB in size. You have plenty more space available than you need for this task, and also your disk usage is listed in your screenshot as only being 4% of your machine's capacity.
The problem may also simply be your slow internet connection, since the 100 Kbps displayed in your screenshot, would require about 41 years just to download a 16GB blockchain. I'm sure your network speed is faster from time to time, but if it's going down to 100 Kbps for long enough of a stretch of time, this could easily cause your lengthy syncing process.

100 kbps will NOT take you 41 years for 16 GB, you typed 0.1 kbps instead of 0.1 mbps.
Would be about 2 weeks


text:
Did I lose a lot of ADA after updating Cardano node?? Alonzo hardfork
So, the context is I have cardano-wallet and node deployed via docker-compose. I do have mnemonic codes, wallet passphrase, id/label, everything. For alonzo hardfork, I had to upgrade my node which I did. Firstly, since its docker-compose I had to change versions, removed current running containers and build new ones. I did, but node never started, kept restarting, upon investigation logs it was some linux user/permission issue. It made sense that it wasn't going to just work with previous volumes. I went ahead and purged volumes, tried again and good that this time it worked and started syncing.
Using RPC API I restored my wallets, there are about 65k addresses in 1 wallet and 4-5 thousand addresses in other 2 wallets. After restoring, I matched addresses and all of them are a 100% match which validates that private key has been restored correctly but even after complete sync all addresses are marked as "unused" and wallet has "0" balance. :((((
Any help will be appreciated, I have a lot of money in ADA and assets on the line here.

Hey @FieldMarshal, let us know what you figured out (as it's been 21 days). It will help others in the future who may have similar problems.

Check your node sync status with cardano-cli query tip. Likely your wallet is synced, but your node is not caught up yet.


text:
Is there a good tutorial to mint Cardano NFT using plutus script?
I used to mint Cardano NFT using "Time locking" following this guide https://developers.cardano.org/docs/native-tokens/minting-nfts/. But I know the more formal way is to use plutus script to mint NFT after the introduction of smart contract. Is there a similar guide on how to achieve this? I know Lars did a tutorial on that https://www.youtube.com/watch?v=SsaVjSsPPcg. But I am too dumb to follow. Any simplified step-by-step instructions available?

I am answering my own question. After several days of studies and testing, I finally mint NFT using plutus script. Please find my articles below:
https://edwardtam919.medium.com/how-to-mint-cardano-nft-using-smart-contract-part-i-1d75a0398cd2
https://edwardtam919.medium.com/how-to-mint-cardano-nft-using-smart-contract-part-ii-ec7eccc77686

Really interesting stuff.  I believe @Berry put out a sample for how to do this as well on his Github page: https://github.com/Berry-Pool/plutus-contracts/tree/master/NFTSeries


text:
How to prevent economic DOS attacks against Plutus contracts
Many people wrote about the eUTXO model and the benefits it brings compared to Ethereum.
However, eUTXO also comes with some challenges.
In particular, eUTXO is susceptible to "economic denial of service (DOS) attacks".
Let me give you an example of an economic DOS attack.
Consider the following NFT-auction from the Plutus pioneer program: https://plutus-pioneer-program.readthedocs.io/en/latest/pioneer/week1.html
This contract is a simple auction where anybody can bid for an NFT until a specified deadline has passed.
However, this contract is vulnerable to an economic DOS attack where a malicious bidder creates a sequence of low bids that prevent other people from placing their bids (e.g. 0.001 ADA, 0.002 ADA and so on).
Such an attack is possible because each eUTXO can be spent only once, and if the attacker is faster than you, then you fail to place your bid on the Cardano blockchain.
It requires some technical sophistication to execute an economic DOS attack, but an average (non-technical) wallet-user cannot defend against it.
Although economic DOS attacks are also possible on Ethereum, it is much harder to execute them successfully within Ethereum's account model.
See the following paper for more details about economic DOS attacks:
https://docs.google.com/document/u/0/d/12atK0oEME0y1GHo_HmqhrcZ3pQeEqB_0tFKknhsjsLY/mobilebasic
So my question is:
(1.) How would you implement a Plutus-NFT-auction that defends against economic DOS attacks and (2.) how would you generalize a defense-pattern for other Plutus-contracts?

These types of attacks are inherent to the auction model and are not dependent on the technology used. To protect against these, auctions have a minimum bid increase. Other solutions would be (i) a whitelist of known wallets making sure that every participants has at most one wallet, or (ii) bidding fees making DoS attacks expensive.
If you want to run an auction without identity control opened to the general public, minimum bid increases would be the way to go, in my opinion.

My point is that those attacks are much easier with eUTXO/Cardano than on Solidity. It is incredibly expensive to "stall" the Ethereum-mainnet for multiple blocks, whereas it is much cheaper to re-generate a single Cardano-UTXO over multiple blocks. So the defense becomes more important because the attack-tresholds are lower.

Minimum bid increases are doable, but I still find it problematic if you compare it with Ethereum. I strongly believe that there should be a more general solution which increases the cost of conducting DOS attacks. Those attacks will always be theoretically possible, but we need to think about the cost of performing the attacks.

Many of the people complaining about the UTxO model only think that Ethereum has less problems because they don't understand what happens there behind the scenes. I personally think that the issues of Ethereum are unfixable. The fact that you can write your question above shows how transparent the Cardano model is and how it allows developers to reason about it and think about what could go wrong and what can be done about it. The only way to prevent DoS in open networks is to make them expensive or difficult. UTxO are not more vulnerable than other models.

I am definitely not a chain maximalist since different models have different tradeoffs. I would not claim that Ethereum is better, but I am interested in this particular concurrency-attack.

One important thing to consider is the 'why'. What does an attacker gain from such an attack? Blocking other people from placing a bid doesn't gain the attacker anything. The attacker will just pay fees each block. So while this is theoretically possible, it's not worth it. At least not in your example.

He would gain by winning the auction when the deadline is reached.

You are right, you would need a pretty valuable NFT to make this attack profitable. Nevertheless, the attack would be much cheaper than a comparable attack on EVM-chains. Moreover, the NFT auction is just one example of the larger problem.

@Jey This class of attack, contention of a shared resource, is something I believe can only happen on a UTxO chain. So I believe it's not correct to say that "These types of attacks are inherent to the auction model and are not dependent on the technology used." Within a global-state system like the EVM, nearly an entire block could be filled up with bids to a particular contract and it still wouldn't prevent someone else from posting a bid. No whitelist system or bidding fee would be necessary.

One solution as proposed by Minswap and others are batching bots. Basically you split the bidding process in two steps. First transaction is a b as tch request to add your bid to the contract. Batching bots will compete to collect as many batch requests as possible and construct the actual bidding transaction. Their incentive is that they get a small fee for each processed batch request. Anyone can run auch a bot.

@Xiaofei This resolves the concurrency issue but does not protect agains DoS attacks as a malicious user could monopolise the bottleneck UTxO by continuously batching only his requests. @ Maximilian You have a point here but only if you don't take Ethereum's flaws into account. I think Ethereum trades its concurrency model for the MEV issue which is at least as bad. It is like a rug that is too large to fit into a room. Cardano and Ethereum each pull the rug to fit into a different corner.

@jey multiple batchers will compete to get their transactions on the block. Stake pools have an incentive to append large transactions to the block to increase the reward pool, so they'd prefer the honest batcher's transaction bundle over the other.

@Xiaofei Very good point! I think this is the answer to the question. If stake pools have an incentive to choose the honest batches, the DoS attack problem is solved.

I can think of a different way to structure the contract to avoid this attack.
If you allow all the bidders to lock up their funds at the same time, in separate UTxOs, the auctioneer could just choose which to accept when the deadline has past. This works in Plutus because you can redeem multiple datums in a single transaction, and have the validators check that the other UTxO is being spent, i.e. the PickWinner redemption path for a Auction datum would requires a Bid datum get redeemed as well, and vice-versa.
And say someone wants to update their bid, the Bid datum would have a redeemer of Update, otherwise your funds are locked until after some grace-period has passed.
This might come with some drawbacks, like the opportunity cost of all the losing bids being locked up, but I can think of ways to minimize those pain. In many cases, it seems like a reasonable cost to pay regardless.

People are talking about how order-book style DEXs are going to be more popular on Cardano because it fits the UTxO model better than the Ethereum accounts model. It would work similarly to what I just explained, however a DEX has a Many-to-Many market, unlike an auction which is Many-to-One. So a DEX is a little more difficult to architect than an auction.

Thanks for your detailed answer. I see several drawbacks with separate UTXOs. Firstly, the need of longer locking periods. Secondly, the highest bider does not automatically win, which might lead to more corruption. Sure, all of this can be solved, but I don‘t know whether all those eUTXO troubles are worth the effort.

I don't see the eUTxO model as a problem to be solved. I see it as a way to move the complexity of safety to a lower level. There have been billions of dollars lost in Solidity contracts that could have been prevented with the restrictions Plutus has. And those Solidity contracts aren't less complex, Solidity just has a lower barrier to entry to Plutus. Best of all, it gives an dApp developer options.

I agree that Solidity has too many bugs right now, but those can be solved. For example, reentrancy bugs can be prevented with compiler-inserted locks, although those locks have some gas-cost-overhead. For Plutus, however, we still need to ask the feasibility question: Is it even feasible to build an atomically composable DeFi-ecosystem with Plutus? I mean not only a DEX, but a composition of complex protocols like flash-loans

One more sidenote: Just because someone like SundaeSwap has a workaround for the concurrency-problem does not mean that the problem is solved. In contrast, the following "Scooper model" questions the ability of eUTXO to run a truly decentralized DEX without any off-chain-sequencer or sidechain: https://sundaeswap-finance.medium.com/sundaeswap-labs-presents-the-scooper-model-678d6054318d

"Is it even feasible to build an atomically composable DeFi-ecosystem with Plutus?" Oh. Absolutely. All the smart contracts I've looked at are compositions of multiple scripts. Plutus actually is great for composition.

I'm familiar with SundaeSwap's proposed architecture. I hope it meets their needs. From a first principles perspective I don't get this allergy to "off-chain-sequencer or sidechain". Ethereum is expensive, so they're looking for layer 2 solutions. I'm excited for those. I'm excited for Cardano to have them too. Luckily the Cardano devs took the usefulness of layer 2, sidechannels, and side chains into account when designing the system. Sounds like we're getting Hydra in the Spring. That's pretty soon. I know there is an arms race going on within DeFi, but I'm hoping for sustainable solutions.

I agree that layer 2 solutions are necessary, however this should not come at the cost of increased centralization. If SundaeSwap is forced to run a semi-centralized sequencer because of eUTXO-limitations, then this is a cause for concern. Remember that SundaeSwap's sequencer is not even a layer 2 solution, instead it is a traditional webservice that works around their concurrency problems.

Yeah. For sure, there are trade-offs. The blockchain is an awesome tool, but just because we have it doesn't mean that everything needs be completely decentralized to achieve a useful/compelling product. On the other hand, SundaeSwap's model might fail due to too much centralization/bad game theory, and then we can learn from it. Still lots to learn.

In my view, a good layer 2 solution should provide not only decentralization, but also the capability of running a smart contract forever, without any monitoring or additional infrastructure. For example, If I deploy a smart contract on a layer 2 solution, then I don't want to run my own sequencing-services, and neither do I want to incentivize other actors to run sequencing-services for me. Of course there might be solutions for decentralized sequencing, but I wonder what research the Cardano-team has done during the last 5 years if they have not even thought about basic eUTXO-sequencing.

I think it boils down to the concurrency issue that's been floating around recently. When that's solved (which some projects claim they did), this problem goes away.

Yes it is related to the concurrency issue, but it's not exactly the same. For example, I could imagine a DEX that solved the regular concurrency issue with a decentralized auction-order-book, but is still vulnerable to economic DOS attacks within its order-book.

How would you implement a Plutus-NFT-auction that defends against
economic DOS attacks?

My approach is a little bit complex, since it involves thinking about the problem in a very different way, so sorry for that.
Instead of having a unique UTxO to handle bids, you could create an "account" script. So each user that want's to be part of an auction would need to create an "account", sending the bid value (e.g. 100 ADA) or the auction value (e.g. random NFT) to this account address (creating a new UTxO).
The datum would also be important, since we don't have a way of looking at the value and knowing if it's an auction or a bid and, if it is a bid, we don't know what auction is it bidding on. Therefore the datum could hold a special data type that, if it's an auction, should indicate what is being auctioned and what the deadline is and, if it's a bid, should indicate the value being offered and the auction which it's part of.
Example
data AccountDatum = Auction Value POSIXTime | Bid Value Auction

One problem you could see is that we are still not able to identify who is offering what (since we only have values inside the datum and not public keys). Also, anyone can create any arbitrary Datum in a newly created UTxO. Therefore, we need a way of "authenticating" these UTxOs and "stamp" them, signalizing who the owner of the account is.
This can easily be done with minting policies, as they can execute arbitrary logic without consuming any UTxOs (preserving concurrency). In our case, our policy should make sure that the datum is not corrupted, that the token name it is minting corresponds to the user's public key hash (since we want to identify the owner) and that the minted amount is being transferred (and locked) to the right script (our account script).
After all this is done, the account script can handle transactions however you want. For example, the auction bidders shouldn't be able to change their bid for a smaller amount or retrieve it before the auction deadline is passed. Also, no DOS would be doable since only the owner of this account and the owner of the auction he is bidding on could consume this UTxO (and only if certain conditions are met).
Bidders would be able to compare their bids with other by verifying (off-chain) what other valid accounts are offering. The auction seller would, after the deadline, be able to consume one account UTxO from a bidder by giving it the desired NFT or token of any sort.

how would you generalize a defense-pattern for other Plutus-contracts?

I believe this "account model" (unfortunate name lol) is very general, I'm using it in a project I'm working on that has nothing to do with auctions. The main idea you should keep in mind when designing a validator script is to create multiple UTxOs that can only be consumed by the people interested, so if a DOS would happen, it would only affect the attacker him-self.

Thanks for the detailed proposal. One more question about your proposal: How can you withdraw a losing bid very fast? It would not be good to lock all losing bids until the the entire auction is finished


text:
I've found a small error in the Node running documentation, do I correct that, and if so, how?
I installed the Cardano node today and found a small error in the documentation.
https://developers.cardano.org/docs/get-started/running-cardano/
Basically, the config file for the Alonzo era needs to be added (alonzo-genesis.json).
There was an update page button that would allow me to do it, but it requires me to have a Github account, which I don't have.

Have you considered creating a GitHub account? It's free. Sorry if this comment sounds snarky, I don't mean for it to come off that way.

I appreciate your response

Great job in finding a gap in the documentation.
Signing up for a Github account and submitting a Pull Request (via the update page button you already found) is indeed the way to go. It allows the team to review your proposed changes and once approved automatically deploy these so your edits become live.

alright, I guess I better bite the bullet. Thank you for the encouragement

Turned out I still had an account (I'm dying with embarrassment). It started all sorts of automated shenanigans. I hope I did it right


text:
Syntax error in script when generating policyid
On Windows I'm trying to mint some NFTs on Cardano testnet using this guide.
The problem is that when I'm trying to generate policyID I'm getting this error even though the JSON is valid:
cardano-cli transaction policyid --script-file policy.script >> policyID
Command failed: transaction policyid  Error: policy.script: Syntax error in script: Error in $: Failed reading: not a valid json value

Script is here:
{
  "scripts": [
    {
      "type": "before",
      "slot": 37102595
    },
    {
      "type": "sig",
      "keyHash": "5d4b345b91acf751d7d591f327c10c731024f25db6daed4cabdXXXXX"
    }
  ],
  "type": "all"
}

At first I thought it was some Windows distro bug, but after rebuilding 1.29 version from source on Ubuntu 20.04 LTS (ran over wsl 2) I get the same error.
Out of desperation I also tried removing all spaces like I read in some other answers to similar error when using cardano-cli, that didn't help.

Were you able to resolve it. if yes what was the issue

If you put a correct key hash it works.

Just in case this might be useful for you or for others Typhon Wallet Dapp Connector supports Minting tokens/NFTs using NativeScript using a simple method. ```js
const receivingAddress = "addr_test1qz2qzz8d4unvpkes7nt7tjkwx0sff3cfkrvl528mgkdzt5kmt68vuzvz4nzgs00x0shrgywvy674v6r2zcs8fxvvq27qqycj9a"; const decoded = typhonjs.utils.decodeBech32(receivingAddress);
const pubKeyHash = decoded.value.slice(2, 56 + 2); const nativeScript = { pubKeyHash: pubKeyHash,
};
const nativeScriptFactory = new typhonjs.NativeScriptFactory(nativeScript);
const policyId = nativeScriptFactory.policyId().toString("hex


text:
Why does the Plutus script need be provided in the transaction?
Why does the Plutus script need be provided in the transaction?
My understanding is that a script address is just a hash of the script. In order to spend a UTxO from a script address the spending transaction needs to include the script. The validator will check if the attached script's hash matches the script address and then execute the script to check if the input is allowed to be spent.
So the script needs to be known to whoever wants to spend a UTxo from a script address. The actual script can be attached to the UTxO when it is created on the script address so you can know what script needs to be used to unlock the funds. However, you still need to provide the script in the spending transaction.
This means that any time a UTxO from a smart contract address is spent, the transaction needs to include the script. If the script was stored separately on the address, then a spending transaction would only need to point to that script instead of spamming the blockchain with duplicate data. What am I missing here?

Having the script not attached to the UTxO outputs but to the spending transaction reduces the memory consumption of the nodes because UTxOs are stored in memory. Transactions can be pushed to the storage and erased from the cache once the transaction is confirmed and the slot added to the blockchain. Also (though I don't know if Cardano does this optimisation) you could reduce transaction sizes by having each script attached only once to the transaction when multiple UTxOs of the transaction need the same script.

Is the script attached to the block and counts towards blocksize? If it is then we would trade tps for lower memory consumption, correct?

The script is part of the transaction and adds to the block size (it is also counted when evaluating the max transaction size). As a transaction needs to contain all the information needed for nodes to validate it, it must include all scripts in an executable format (hence not as hash). There is no way around it. The only thing the blockchain can do, is decide where to attach the scripts, and having them attached to the transaction instead of the individual output UTxO seems to be the smarter way.

An update on one part of the question that hasn't been addressable till now

If the script was stored separately on the address, then a spending
transaction would only need to point to that script instead of
spamming the blockchain with duplicate data. What am I missing here?

Well, this is exactly what a new Cardano Improvement Proposals called CIP-33 (Reference scripts) seems to be rooting for.
From the CIP-33 proposal

We propose to allow scripts ("reference scripts") to be attached to
outputs, and to allow reference scripts to be used to satisfy script
requirements during validation, rather than requiring the spending
transaction to do so. This will allow transactions using common
scripts to be much smaller.

at the end it summarizes as below:

The key idea of this proposal is stop sending frequently-used scripts
to the chain every time they are used, but rather make them available
in a persistent way on-chain.

So fingers crossed, if this makes it into some future release, we will have enormous reduction in size of transactions and a lot more transactions would fit in into a block.
UPDATE: The Vasil hard fork is happening on mainnet on 22 Sep 2022 (already available on testnet)
Other CIPs of interest :

CIP32 - Inline Datums
CIP31 - Reference Inputs

If the script was stored separately on the address, then a spending transaction would only need to point to that script instead of spamming the blockchain with duplicate data.

It's true that you could minimalize the size of transactions gossiped around the network by storing the script on-chain, but there are other resources to consider. Storage on the blockchain is very expensive because everything on there is permanent. Once something is added, it will need to be included every time someone builds a node for all eternity (with the exception of pruned networks).
I think in a world where we stream Netflix at 4K, including the script in the transaction seems like a negligible cost to me. The payoff might not be there for the busiest dApps, but seems like a safer bet for a vast majority of junk on the chain.

But isn't the script that's attached to the transaction also stored on the chain? How else would a node be able to validate old transactions?

Ah. Very good point. Hmm... not sure then.


text:
nix-build alonzo mainnet
I've installed cardano-node via nix-build:
git clone https://github.com/input-output-hk/cardano-node
cd cardano-node
git checkout tags/1.29.0 -b 1_29_0
nix-build -A scripts.mainnet.node -o mainnet-node-local
nix-build -A cardano-cli -o cardano-cli-mainnet

But somehow I end up in the Byron era:
$CARDANO_CLI query tip --mainnet
{
    "epoch": 10,
    "hash": "237925228211660d367c77f6af0b50542ace82985339c55a48fed0ff201a1217",
    "slot": 222403,
    "block": 222371,
    "era": "Byron",
    "syncProgress": "3.55"
}

which script is the correct one for nix-build for alonzo mainnet past HFC event?

You're doing the right thing.
"syncProgress" refers to the percentage of the chain you've synced. Once you get to around 70% it will say "Shelley" and only the most recent epoch will say "Alonzo". This takes a while, unfortunately.


text:
Can I Share Daedalus Public Key?
I am trying to add my accounts to a coin baalance tracker, but am having a hard time with Daedalus.
The only option that seems to make any sense is sharing the public key with the tracker apps. Is this safe?

for the sake of potential loss of your balance i wold say dont untill your absolutely sure but you would assume yes seeing as its called a public key meaning its publicly visible

Cryptography is the science of secret writing with the intention of keeping the data secret. Cryptography is classified into symmetric cryptography, asymmetric cryptography and hashing.
Private Key:
In Private key, the same key (secret key) is used for encryption and decryption. In this key is symmetric because the only key is copy or share by another party to decrypt the cipher text. It is faster than the public key cryptography.
Public Key:
In Public key, two keys are used one key is used for encryption and another key is used for decryption. One key (public key) is used for encrypt the plain text to convert it into cipher text and another key (private key) is used by receiver to decrypt the cipher text to read the message.


text:
Documentation for smart contract deployment on testnet & mainnet
Can somebody point out where I can get the doc for smart contract deployment on testnet & mainnet? I am testing on plutus playground now and would deploy on testnet to try. Thanks in advance.

The present status is to use the method described in the Lobster challenge. https://github.com/input-output-hk/lobster-challenge. Please see the associated Youtube video too.

You can also find an example here, from Alonzo-tesnet repo (that repo includes another interesting exercises).
That was part of the Exercise 4.
Exercise4-solution


text:
cardano-db-sync build instructions?
The ones I found seems to be out of date.
https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/building-running.md
Warning: Requested index-state 2021-07-02T00:00:00Z is newer than
    'hackage.haskell.org'! Falling back to older state (2021-07-01T22:06:28Z).
    Resolving dependencies...
    cabal: Could not resolve dependencies:
    [__0] trying: Win32-network-0.1.0.0 (user goal)
    [__1] trying: base-4.14.2.0/installed-4.14.2.0 (dependency of Win32-network)
    [__2] trying: byron-spec-chain-0.1.0.0 (user goal)
    [__3] trying: microlens-th-0.4.3.10 (dependency of byron-spec-chain)
    [__4] trying: template-haskell-2.16.0.0/installed-2.16.0.0 (dependency of
    microlens-th)
    [__5] trying: pretty-1.1.3.6/installed-1.1.3.6 (dependency of
    template-haskell)
    [__6] trying: hedgehog-1.0.5 (dependency of byron-spec-chain)
    [__7] trying: time-1.9.3/installed-1.9.3 (dependency of hedgehog)
    [__8] trying: text-1.2.4.1/installed-1.2.4.1 (dependency of hedgehog)
    [__9] trying: cardano-api-1.29.0 (user goal)
    [_10] trying: scientific-0.3.7.0 (dependency of cardano-api)
    [_11] trying: aeson-1.5.6.0 (dependency of cardano-api)
    [_12] trying: cardano-db-11.0.0 (user goal)
    [_13] trying: postgresql-simple-0.6.4 (dependency of cardano-db)
    [_14] trying: postgresql-libpq-0.9.4.3 (dependency of postgresql-simple)
    [_15] rejecting: postgresql-libpq:-use-pkg-config (constraint from config
    file, command line flag, or user target requires opposite flag selection)
    [_15] rejecting: postgresql-libpq:+use-pkg-config (conflict: pkg-config
    package libpq>=9.3, not found in the pkg-config database)
    [_15] fail (backjumping, conflict set: postgresql-libpq,
    postgresql-libpq:use-pkg-config)
    After searching the rest of the dependency tree exhaustively, these were the
    goals I've had most trouble fulfilling: postgresql-simple, base,
    postgresql-libpq, aeson, text, time, postgresql-libpq:use-pkg-config,
    scientific, cardano-db, cardano-api, hedgehog, pretty, template-haskell,
    byron-spec-chain, microlens-th, Win32-network
    Try running with --minimize-conflict-set to improve the error message.

It looks like you are missing the libpq-dev package.

nix-build! :-)
Specifically, this line in the linked docs:
nix-build -A cardano-db-sync -o db-sync-node

Nix as suggest by @sorki is one solution.
Another is to install the development versions of the libraries:
sudo apt install pkg-config libpq-dev


text:
Is there a Cardano API to transfer ADA from one wallet to another using a backend server?
I'm really new to crypto but I've been a dev for a long time now in App and Web Development. I have an app where I'd like to accept payments In ADA.
My question is if there's a Cardano API to transfer ADA from one wallet to another using a backend server?
What I'd Like To Do:
I'd like the user to click a button on my app and when that happens it'll transfer ADA from their wallet to mine. My NodeJS server would handle all requests.
What I've Tried:
I've looked at cardano-wallet but I think it's for only making transactions that are made on your server?(sorry if this isn't correct). Is there a service where they can take the address of one wallet and send to another wallet that wasn't made on your server? Or is that what the new smart contract roll outs are for? Thanks

The way to go is to use a wallet that can connect to your app/website. So far there's only this one: https://github.com/Berry-Pool/nami-wallet but Yoroi should follow soon (I hope).

You would never sign a transaction on your server on behalf of your users. Otherwise, this means they gave you access to their entire wallet. Which I believe many would/should not accept.
As a business, you would like to expose public addresses to your customers. Ideally, you would derive your private key for a new public address every time you have a new transaction. Remember, the private key is what gives you access to manage funds transferred to these addresses and you should keep it private.
After that, you need to receive the txs. On your side, you just need to wait and check the chain, through cardano-node or some other service (graphql, db-sync, etc).
You can facilitate this process integrating with the user's wallet for creating and signing the transaction. For instance, for Yoroi, you may try to integrate through their Service worker API and maybe Daedalus can accept some native deep links (not sure). More support coming soon for sure.


text:
How to instantiate ToSchema for ADT?
If I have
data Thing1 = I Integer | S String

how do I instantiate ToSchema for it?  Note that deriving doesn't work.
And how about for
data Thing2 = I Integer | S

It's not possible to use Sum types with Swagger, see relevant plutus issue, you need to wait for the following PR adding OpenAPI3 support https://github.com/input-output-hk/plutus/pull/3807


text:
How to start coding Cardano Smart Contracts?
I have some ideas which including the use of smart contracts. The thing is that i don't know anything coding them. So my question is, where should i start to learn doing it. I mean every programmer had to start somewhere... It would be a blessing if someone could help me out!
Thanks and regards,
Lukas

Here are the Plutus Pioneer Program lectures. This is how most of us learned how to write Plutus Smart Contracts.
They will require you to have a basic understanding of Haskell and the ecosystem. If you need a crash course for Haskell, I would recommend Learn You a Haskell for Great Good! as the canonical tutorial. IOHK also provides a comprehensive video course here.
People on this site are also generally willing to answer questions you have along the way.


text:
Can a function be passed in as an endpoint argument?
Can a function be passed in as an endpoint argument?
IOW,how can I instantiate a function for FromJSON?


text:
Plutus Pioneer Program Week02: grab endpoint not working and trace log being cut off

Here you can see the 'grab' endpoint being correctly set.

And here you can see the Tx2 slot for the grab endpoint is missing.

Also, some lines of the trace are being cut off, I'm not sure if this is relevant but I'm worried this is because of an issue as well.
Am I missing some important configuration that would cause these issues? I verified that the code is correct via the Solutions so I'm not really sure where these issues could be coming from.

Apologies for bumping an old question. You've surely figured it out long ago, but the question remained unanswered and is still relevant for others, so here goes:

The missing transaction is due to Plutus Playground's requirement that the simulation include a final 'wait' Action of at least one slot for the last transaction to be processed.  Would make sense for Playground to automatically process 1 additional slot after the last declared wallet action, but for now it doesn't.

I've also noticed that the Trace records are truncated, but it also occurs when the simulation being evaluated runs as expected.  Not sure whether it's ubiquitous or peculiar to running Playground within WSL2.

On the topic of interpreting the Logs and Trace listings, here are three points that may make them easier to track:
a. Logs area is presented sequentially for the entire simulation, slot-by-slot.
b. Trace is presented sequentially per Wallet (in case you're as confused as I was at first about the slot numbers not being sequential). Unfortunately, I haven't figured out what the "Iteration" numbers represent yet.
c. It's easy to become lost or overwhelmed with the amount of data in Logs & Traces, but by including a unique tag within all of your traceIfFalse and logInfo messages (e.g., appending [dbg] to each message), and then searching for that tag on Playground's results page, you may find it much easier to track the event flow.


text:
libsodium build warnings
I am working to set up a Cardano staking pool (node).  As I was building the specific reference of libsodium called out in the docs (66f017f1), I got a LOT of unsettling warnings such as (truncated):
In file included from crypto_kx/crypto_kx.c:8:
#warning *** This is unstable, untested, development code.
#warning It might not compile. It might not work as expected.
#warning It might be totally insecure.
#warning Do not use this except if you are planning to contribute code.
#warning Use releases available at https://download.libsodium.org/libsodium/releases/ instead.
#warning Alternatively, use the "stable" branch in the git repository.

Is this normal/okay???
Thanks

The version of libdsodium's code you are compiling is the one used by the majority of Stake Pool Operators (SPO) as it is the reference in all official How-To.
These simple warnings are normal because, as you may have noticed with the url, it is an intentional forked repository maintained by IOHK. But don't worry, it works perfectly with the latest releases of cardano-node.


text:
Using rsync to copy database
I am spinning up another pool. Can I just rsync the database folder, after everything else has been setup?
They're on the same 10GBe switch, so I will try anyway... but just wondering.

Yes you can copy the files to speed up the database synchronization on a new freshly installed and configured node. Try to copy all the db folder and start the node.

Success! BP and relay done before I noticed (and I was just using the relay as the source).