text:
What is the relationship between addresses and stake addresses?
Can anyone tell me if an address can change its stake address? If so when does this happen?
Is there a good place to read about how the addresses and the stake address are related?

Usually, the Shelley address contains the staking address inside (delegation part), so it is not possible to change it. But they are other types of addresses.
One of the best resources to learn about Cardano's addresses is CIP19: Cardano Addresses.

So, technically yes, that is possible. For example the stake part of an address can be changed and then funds sent to that address will continue to be staked in the original wallet (the original wallet still gets the stake rewards). That is how staking will be enabled while funds are in a smart contract. Andrew Westberg has a good video on it (he really should be answering this question).

I do not think you could be staking and use the funds in a contract (I think you mean a mangled address) as the staking within the contact will be managed by the script output.

I can't really argue because I'm not exactly sure on how it works. But I know the plan is to enable staking while your ADA is in a smart contract. Otherwise the network's security is reduced if a large amount of ADA is moved out of staking wallets and into contracts (like DeFi pools for example).

Correct, but this is done by staking the smart contact itself. You are also correct the main reason is PoS security.


text:
"min-ada" bottleneck to Cardano analogous to "gas fee congestion" for Ethereum?
In reference to Min-Ada-Value
Imagine the following scenario:

Alonzo's long anticipated smart contracts finally arrive to the main net
The ERC20 converter is a massive success and ports hundreds of ERC20 tokens over to Cardano
There are a lot of "WhateverSwap" (e.g. SundaeSwap, YaySwap, Minswap, ...) platforms each running a massive amount of swaps
There are a lot of new smart contracts now being used for the former ERC20 tokens
People are sending ADA, native tokens and former ERC20 tokens around like crazy
In Ethiopia, after Cardano + Atala PRISM turned out to be a huge success for the students, the government decided to replace its currency by using Cardano, now every person is paying stuff in ADA
In Tansania, after seing the success in Ethiopia, the government decided to start a pilot project with also thousands of people using Cardano
<your imagination here>...

All this would result in the price of ADA going up, up and up. Now imagine the price of ADA sitting at $14 (conservative estimate). For every transaction, some portion of ADA (currently 1) needs to be sent with it. $14 may still be affordable for most people in the developed countries, but might be a small fortune for some unbanked. So these people would probably become cut off from using Cardano. And even for the developed countries it is not sure if everyone would be happy to pay these fees.
=> My question is: Could Min-Ada ever become a bottleneck for Cardano the same way the present gas fee congestion is a bottleneck for Ethereum?
I know that Min-Ada can and probably will be dynamically adjusted according to the corresponding situation. However, how well thought out is this solution? Could someone explain the mechanics on how this would work?

No, it would not be a bottleneck if Cardano implements babel fees that will enable you to pay (actually arbitrage) your fees in different tokens.
That being said, to keep a decentralized network secure, you always offer something of value for the work of validation blocks. Also, the author of the transaction might not be necessarily be the same party that pays for it.
In the future, most of the transaction will be probably one layer above (for example Hydra) and the final fee will be paid only for a settlement.

source: Stack Exchange

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

sort: votes


text:
Building and Signing Transactions
I'm learning about Cardano. In reading how to set up a node for staking, I came across Building and Signing Transactions. Would someone kindly provide more context when building and signing should take place and by whom? The document showed manual CLI commands for those two procedures. Does that mean if you are administering a staking pool, someone has to build and sign the transactions manually? I don't believe that to be the case as it would take too long.

Pool operators do use the CLI directly, or have some shell scripts to streamline the transaction building steps. There are also several different suites of pool management scripts that automatically build the transactions required, in addition to many other features built on top of calls to cardano-cli.
As a pool operator, administration transactions often require special flags to cardano-cli which wallet software doesn't support. Specifically, pool operators must do these 3 functions:

Register the pool, which involves 2-3 transactions
Every 65 days, renew KES (Key Evolving Signature)
Other pool updates, like changes to fees, relays, and metadata

"A transaction is a binding between inputs and outputs". This is true of all Cardano transactions, but the pool management actions above also include metadata. Some of the metadata fields are special/reserved and passed as flags to the CLI, and some metadata is supplied as user-defined JSON.
The stake pool setup documentation walks through the setup & KES management in much more detail.

Thank you, Ben, for taking the time to answer. Would you mind elaborating on what a transaction from a pool operator perspective is?

Added to my answer. I'll keep the body of the answer as operator-specific, but I will add that most regular users of Cardano don't need the CLI, it's suited for more complicated transactions (like asset minting) and developers.

I appreciate the updated answer, Ben!

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


text:
I would like to run a relay node on Ubuntu 20 server without creating a wallet, what are my options? Are packaged binaries available?
I am looking to setup a full node on an Ubuntu 20.04 server for mainnet and leave it running. I don't intend to run a stakepool. Are there any packaged distributions I can use?

A stake pool is just a full node with some additional configuration, so the binaries are the same.
If you need to run cardano-node, you might want to start with its Getting started documentation and you can find the release binaries on the Github's release page of cardano-node.


text:
Will there be a web-based Daedalus wallet?
Will there be a web version of the official Daedalus wallet? It is possible to build one for the Cardano community?

No.
Daedalus is a full-node wallet, which means it runs cardano-node (no web version) and downloads a copy of the blockchain onto your computer. With a blockchain size of 10GB and growing, it doesn't really make sense for Daedalus to run in a full web browser.
Yoroi is the official web/light wallet, available as a chrome extension, iOS, or Android app. https://yoroi-wallet.com/


text:
Will there be token burn at any point in time in future?
Will there be token burn at any point in time in future ?

Does this answer your question? Ways to burn tokens?

I’m voting to close this question because the questions about the future of Cardano can't be effectively addressed on this site and would be better addressed directly to the Cardano Team on their forum. This site is not operated by the Cardano organization. This site is a place to ask questions about how Cardano works and to ask for help using it.

Decreasing the supply of ADA by burning tokens is a method to artificially raise the value of the remaining supply. It has been repeatedly stated that all ADA has an owner/purpose and supply will not be reduced by burning ADA.
ADA relies on use and utility to increase its value.

You can burn your ADA by making an address with no valid private/public keys if you want to, and send coins to it.
There appears to be no rational reason to do such things though, what motivation is there to do such things.

If you are referring to native tokens, that all depends on the minting policy. If you are referring to ADA, then no. Charles has answered this question many times in AMAs.

The concept of Token burning is funny and Stupid. Think about it. You bought it and you want to artificially pump your bags by burning the supply. If you really believe ADA is a SOV and real money why would we want to burn it? Any serious coin should not do a coin burn. ADA will never ever do a burn or reduce the supply! Our max supply is 45 billion and that will remain. Nothing more, nothing less


text:
Is Cardano working on any solutions to work out disputes between parties?
I know dispute resolution within smart contracts (when used as a method of transaction) is not a simple issue. Is Cardano working through any innovative solutions to work out disputes between two parties?
Thanks!

I’m voting to close this question because the questions about the future of Cardano can't be effectively addressed on this site and would be better addressed directly to the Cardano Team on their forum. This site is not operated by the Cardano organization.

I am developing a conflict resolution platform on Cardano right now.

I'm a little torn here about whether the question will attract opinion-based responses. If answered with facts only then a smart contract has already defined rules, if they are fulfilled there is no room for dispute. Means: Either everyone agrees to these rules or no contract is concluded.
Of course, these results may not meet the expectations of the contractual partner, but this is fundamentally not the problem of smart contracts and to discuss this Stack Exchange is not the right place. For such open questions and extensive discussions, e.g. forum.cardano.org would be a good place.


text:
Where can I find design and documentation resources for Cardano Smart Contracts?
I’d like to better understand the design and features of the upcoming Cardano smart contracts.
Where is the design guidance & documentation posted for them, including their planned functionality, and how we’ll be able to create and use them?
Can community members comment on this / assist with the UX?

I am not a techie. Lars has been posting Plutus videos on YouTube. Plutus is the main language for smart contracts on Cardano. I think it if searchable as Plutus pioneers program. That should get you to the trailhead. I'm not a techie but that is where I would start.

Have a look at the Plutus Pioneer Program for technical details:
https://youtube.com/playlist?list=PLnPTB0CuBOBypVDf1oGcsvnJGJg8h-LII

There is a standalone Haddock Documentaiton which includes a link to the code direclty.

The resources are pretty much being built now. There's a book being written but I can't remember the title. It was mentioned in one of Charles' videos. It is supposed to be a comprehensive guide to Cardano, so I expect it will be quite thick.
Please keep in mind that at the moment Cardano smart contracts are still in beta phase and the Haskell/Plutus libraries are and will be undergoing vast modifications as the use cases are identified and the bugs flushed out. So even if you read some documentation today, it will most likely be obsolete in a year or two. There's an ongoing Plutus Pioneers Program that will generate a cohort of early developers who don't care about the fact that developing smart contracts on Cardano will take a few years to become a fairly stable and straightforward process.
Edit: here's a nice list to get you started:
https://github.com/input-output-hk/essential-cardano/blob/main/essential-cardano-list.md#oracles

There exists a community run documentation for Plutus. It has just been started, so do not expect too much at this point. I believe you have the ability to contribute.


text:
How are unused/outdated smart contracts handled on Cardano?
How will unused, outdated smart contracts be handled? Or say a developer makes a mistake in the contract and needs to redeploy it, what happens to that old contract? Would a lot of Unused contracts cause a lot problems for storage?

For one thing, the validator script associated with a smart contract is not stored on the blockchain; the blockchain only stores the hash just like for a lot of other things. When the code of the validator script changes, the script address also changes, but because the script is not stored on the blockchain, the cost of abandoning a smart contract is like that of abandoning a regular address.
So, there will be no blockchain storage problems with having a lot of unused smart contracts, no more than with having a lot of abandoned regular addresses, and the requirement that each UTXO contains at least a certain amount of ADA limits the number of addresses with non-zero balance.
To avoid losing assets, the developer should move the balance from the old script address to the new script address when he updates the validator script though that may not always be securely feasible without giving the developer/maintainer too much centralized power over the smart contract's operations.
However, someone may build an off-chain metadata service that allows registering validator scripts to facilitate lookups by hash and such a service may accumulate junk and get storage problems unless they address the issue.

are you sure the contract is not stored? how could a node revialidate tha chain? What about this? https://cardano.stackexchange.com/questions/24/how-can-a-node-verify-a-transaction-with-a-script-address-without-the-script

At the top level, there is block, which contains transaction_bodies & transaction_witness_sets. Similarly, a transaction contains transaction_body & transaction_witness_set. transaction_body is all about hashes and transaction_witness_set enables mapping script hashes to actual scripts. The transaction_witness_set is like a proof that the transaction_body is valid. I think a node may choose to delete the transaction_witness_set after some time to save space.


text:
Is there a Browser-based wallet for Cardano?
Will we have a Cardano Browser Wallet?
Something like Metamask on Ethereum.

Updated: April 18, 2023.
Native Web3 wallet
Today (April 18) IOG released a native browser-based Cardano 1.0 wallet called Lace (I believe it's still about Lovelace ), with digital assets, easy staking, NFT gallery and DApp Connector. Lace 1.0 wallet currently supports only Google Chrome.

Third party wallets
There's the open-source Nami Wallet – a browser-based wallet extension to interact with the Cardano blockchain. You can run it on Edge, Brave, Chrome and any other chrome-based browsers. As you can imagine, the Berry Pool's wallet does support staking. And it has nice and simple UI.

The user of Nami wallet can only import one seed phrase, but from that one they can create sub-accounts. Each account is its own wallet and independent from each other.

Also, you can try 4 other web wallets that support ADA and tokens:

ccvault – Wallet staking, external/internal addresses, hardware wallets support, multiple wallets/accounts, browser extension option
GUARDA – Crypto exchange and external staking
SimpleHold – Private key import, hardware wallets support
GameChanger – DApps cart, playground editor

Do you know if they still only allow staking to Berry pool?

Hi Matthew, I'll add it to my answer in 45 mins...

Thanks Andy. I just went and checked the site. They will support staking integrations through 'external staking interfaces' e.g. an SPO website. And only BERRY staking is supported in the wallet itself.

We have Yoroi Web extensión for Chrome, Firefox and Edge.
www.yoroi-wallet.com

I wouldn't recommend yoroi. It's not very actively being developed/ enhanced.
Check out Eternl.io (formerly CCVault.io) or Nami (very simple) or soon Lace.io

It's called Yoroi. It's a browser extension like Metamask.

There is something similar, though it's more a "web wallet", not a browser plugin wallet like Metamask.
Checkout AdaLite

GeroWallet was launched a couple of weeks ago and it works exactly like Yoroi.

Eternl (https://eternl.io/), previously known as ccvault.io, provides browser extension (DApp connector & DApp Browser) for Chrome, Edge, Brave and Opera browser.

DApp Browser: users can connect their wallets to DApps listed in Eternl's DApp Browser.
Supports different testnet networks or other supported Cardano based networks.
TxBuilder feature: it allows you to add multiple outputs to a transaction and choose which utxos you want to spend. It also has support for custom json metadata.
Dark Mode.

The team consists of developers of community stake pools [TITAN] TITANstaking and [AHL] AHLNET.

Here’s a growing list:
Yoroi (legacy, by Emurgo)
Nami (by BERRY stake pool, supports testnet)
ccvault.io (coming soon for browser extension)
Flint (new but nice, by dc_Spark / Sebastian)
Gero (nice UI)

There is Yoroi, developed bei Emurgo, which also has a PC program and also a mobile app.

Yoroi is the famous one for ADA browser wallets.


text:
How can smart-contract disputes be addressed?
How will disputes in a smart-contract obligation be managed? How is fraud prevented if a party does not fulfil an obligation?
When there are various jurisdictions, there may be different governing bodies.

I suppose 'disputes' refers to ambiguities outside the blockchain, not on the blockchain, which should be unambiguous, so this seems more like a legal and political question than a technical question and I'm not sure how an objective answer can be found.

Obligations that are written into the contract, can't be disputed. For example, if a contract allows money to be withdrawn from the contract address, only if the party leaves their money inside for some period of time, then it can be made impossible for a withdrawal to occur before the time is up, using the programming language of the contract.
For things that can't be made impossible through code, then in some cases we can rely on penalties and rewards to enforce the desired running of the contract. One could code in a reward to any entities who provide a proof that a party was trying to cheat the contract, and penalise those parties who are caught. But for this to work, we need ways of providing proofs about the real world that our contracts can understand, which is why oracles will be an essential part of such systems.
For any obligations that are not written in the code of the contract, they will rely on the same things that are in place today, court systems and public reputation. Legal systems may choose to recognise smart contracts as legally binding, and provide some pathway for dispute resolution when a smart contract has failed to do what was intended or otherwise.

The governing idea behind a smart contract is the efficiency gained from "Code is law" philosophy that allows humans to do away with the archaic inefficient contract law that has been present since the middle ages.
Before interacting (transacting) with a smart contract you should be well aware of the contract you are using and the implications and terms thereof. The obligations and terms of any smart contract are immutably written into the contract itself, so there can be no unintended disputes, only a lack of understanding of the person executing the smart contract.
All of this is to say that you are in the driver seat when it comes to blockchain and the web3 world. Do your own research before interacting with any smart contract, and fully understand what you are dealing with. If you lose money due to a lack of understanding of how the contract worked and feel wronged, there is no mechanism, unless written into the smart contract when it was deployed for dispute resolution. A smart contract has no concept of the laws of one legal jurisdiction or another, once the transaction is submitted you cannot utilise the legal system to retrieve any funds you may have unintentionally used.
Technically, even if a judge were to rule in your favor that somehow a smart contract you willingly transacted with was "fraud", the chance that the smart contract was created by someone governed by the same legal jurisdiction is very, very small and I wouldn't count on it. According to some quick research there is approximately 320 legal jurisdictions in the world. Not what I would bet on, especially in this distributed global ecosystem like Cardano.

+1 for the informative answer! I'd recommend to remove (or at least change) the first sentence though, as it could be portrayed as antagonistic to a brand new user.


text:
Are there plans to keep the blockchain/node size small enough to maintain decentralisation?
One issue bitcoiners like to mention is node size in relation to decentralisation. Currently we are at like 10gb, I saw that the max growth is apparently 100gb a year. Are there any plans for reducing this? Or do we think technological improvements will be fast enough in the hard drive space that 100gb a year is fine? I agree with the importance of making it available to the average person to run a node.

I assume with "blockchain/node size" you mean the growing size of the immutable ledger database. The current growth rate is pretty linear. In the last 100 days it grew from 7 up to 10.5 GB

So we see a growth rate of about 1 GB per month, which would result in a 12 GB per year.
Keep in mind the ledger DB folder now contains every UTXO action since Nov-2017, not just since Shelley-Mainnet launch in Aug-2020.
New capabilities like Metadata or additional activities from native Tokens, NFTs and soon Smart-Contracts may increase the growth rate a bit.
So existing Hard drives with 2-12 TeraByte capacity should provide plenty of space for the next years.


text:
Signs for the trustworthiness of the SundaeSwap project?
I would like to know, what are known signs about the trustworthiness of the project SudaeSwap?
What could be technically achievable black swan scenarios?
Is it a project that is connected with Cardano?

This question seems to be opinion based, which may cause it to be closed. For instance, in my opinion Sundaeswap is a trustworthy project but not everyone shares this opinion. I would recommend changing your question.

It's a bit fishy the whole 'come stake at our pool with 100% fees and then we'll give you tokens when we launch', what's to stop them from disappearing and not releasing anything while keeping all the ADA rewards minted all that time?

Opinion based questions are better asked in Reddit's Cardano subreddit

As much as I'm voting to close this question as it is opinion based, I'm going to provide my insight as it can save people money.
For me, they are not trustworthy because:

The initial team and most of the team is anonymous
They have no track record of previous projects
They have a plan to take millions of dollars from the community but they do not have a value-offering by having at least a whitepaper. Several dates promising the whitepaper has been posted but later deleted by the team
They are banning people raising concerns from their twitter and discord, censoring discussion
They have no skills to even run their own pool and are trying to outsource it, which is a basic technical skill when you try to build on Cardano

Several highly trusted community members have already warned about the red flags, for example Sebastien.

Charles Hoskinson has posted on Twitter that he has a meeting with SundaeSwap's team sometime soon and will advise on his feedback about the project. It is not clear when the meeting will take place but my best guess is that it will be within the next 30 days.


text:
Can I run a stakepool on a home router without a fixed IP address?
My ISP assigns an IP address to my internet modem -- it's not a permanently assigned static IP address but stays the same for months or years. Can I use the NAT service on my router to channel the ports to an internal node running on my home network?

You could but it is not recommended. You could use DynDNS service, associate the address with an actual DNS entry from your domain. But, from years of experience managing infrastructures, you will run into problems.


text:
Will ADA always be deflationary?
Considering ADA has a max circulating supply, and productivity of goods and services always tends to grow, does that mean ADA will always be deflationary in the long run? Couldn't that lead to recurring recession environments which discourage people to spend/borrow?

Yes Sir. ADA has a fixed supply and just like Bitcoin it is always going to be deflationary. It's the mindset. What is "deflationary"? That's only when you convert it to FIAT correct? The whole purpose of Crypto is not ultimately converting it into FIAT. If you remove FIAT from the picture, people will use it as SOV and also for transactions as value exchange. Then the whole concept of "deflationary" will slowly die and we will only be talking about "finite supply".

What is SOV in this context?

Store of Value.

I’m not talking about deflationary when converted to fiat currency. Deflationary means that as time passes, you need less units of currency to buy the same things. If we remove FIAT from the picture, it can still be deflationary. Suppose you can buy 1 coffee with 1 ADA now, than next year you can buy 2 coffees with 1 ADA, then 5 and so on. That means ADA is deflationary. If productivity of goods and services tends to always increase, that means things get cheaper, and if the currency supply is limited, that means its always going to be deflationary in the long run, discouraging people to spend

In Cardano, ADA is a synthetic resource that is used for many purposes. Charles explained it in detail in this video https://youtu.be/lMZ1xQzWtl4
So the finite supply is a desirable feature. The deflationary effect is a consequence.
The differences between Store of Value (SOV) and a unit of exchange is natural because they don't serve the same purpose. People expect SOV to hold its value over time and protect them from any inflation, including the inflation that results from growth in productivity.
Your concern is genuine that there is an incentive to hold (HODL) any store of value, not just ADA. Stable coins and fiat currencies are designed to be units of exchange and lose value with inflation. So there is an incentive to spend them before they lose value. So there is a place for both; we need SOV for long-term savings and units of exchange for short-term disposable cash.
In our financial systems we have both; however, the conversion between the two has a lot of friction caused by layers of middlemen and by the burden of record-keeping required by laws designed to prevent money laundering and terrorist financing.

Gold was a store of value and a unit of exchange before going off the gold standard. Dollars and notes were just an easier way to represent the gold. I think BTC and crypto has a strong HODL incentive in the early stages now (make lots of money) but will degrade as the market caps level out at a maxim

Also keep in mind that until all ADA is minted (i.e. until circulating supply = total supply), it is actually inflationary with a smoothly decreasing inflation rate.
At that time it truly becomes deflationary. And that won't happen for hundreds of years I think.

It can be deflationary while increasing (slowly) the circulating supply. If the productivity of goods and services increases, the price for those items decrease (it requires much less work now to produce a car or a cellphone or a potato, than 10 or 100 years ago). So even if the currency supply is increasing, if the productivity of things is increasing even more, the currency is deflationary, because things gets cheaper.


text:
Can the max supply of ADA be decreased or burned?
would decrease the amount of the max supply of ADA tokens?
With the limited supply, it can build more demand and that might be benefit for the team and also the investors.

This is a StackExchange site, not a connection to the Cardano developers.

See help for guidance on how to ask good quality questions

I’m voting to close this question because the questions about the future of Cardano can't be effectively addressed on this site and would be better addressed directly to the Cardano Team on their forum. This site is not operated by the Cardano organization.

Decreasing the supply is a method to artificially raise the value of the remaining supply.  It has been repeatedly stated that all ADA has an owner/purpose and supply will not be reduced.  ADA relies on use and utility to increase its value.

If you're interested in supply/demand, look at the staking metrics and the effect that is has on the price of ADA. The price of ADA denominated in USD and BTC has held up very well on this recent market drop.
Currently ~71% of the circulating supply is staked leaving ~29% either in wallets & unstaked or for trading purposes/on exchanges. This really didn't budge during the recent downturn -> a sign of positive community sentiment, but also Cardano saw the most inflows (+10M) this past week from Institutional Investors compared to BTC(-110.9M) and ETH(-12.6M) outflows.
Overtime as more people/corporations/institutions recognize Cardano's value proposition, the demand will continue to build and they'll all be bidding more and more for less and less available ADA.

The maximum supply is set. There are two obvious ways supply can absolutely reduce.

The person holding the secret key for addresses with unspent transaction outputs (UXTO) destroys or permanently loses the encryption keys for those outputs. This effectively means destroying/losing the wallet recovery key for the wallet that generated those addresses.

Paying the ADA to a script transaction that will never validate a transaction from that address. There is a straightforward way to do this: a script that deliberately or accidentally returns error on any spending transaction.

Any normal participant will avoid these two scenarios.


text:
Why are staking rewards still coming to my Daedalus wallet when I moved the funds to a hardware wallet?
I recently moved my funds from a Daedalus Wallet that was receiving staking rewards around 18 days ago to a Ledger for cold storage.
My staking rewards are still being sent to my previous wallet, is this just the snapshot doing it's magic?  I ask because I thought the snapshot was only for an Epoch, and it has been happening for 3 Epochs now, nothing bad, I am still receiving my rewards, just curious, thanks!
Ledger still on the Daedalus wallet.

Did you unstake the ADA in your 'hot' wallet before moving it to the 'cold' wallet? Or initiate an unstaking procedure of any sort in the 'hot' wallet?

You start getting rewards 3 epochs after you first delegate. You will be getting your reward for the next 3 epochs after you move, unless you un-delegate and get back the 2 Ada you initially deposited.

This is due, as you said, to the way Cardano is setup with epochs. Your ADA in your Daedalus wallet were included in a snap shot and then you moved your ADA. Once ADA is included in a snap shot, it takes 1 epoch before it becomes active, and then another epoch for rewards to be calculated, and then its paid out after that epoch (three epoch delay). The rewards that you just received were from the epoch snap shot just prior to you moving your funds. Next epoch the hardware wallet will receive rewards.
Note that if you don't un-stake your Daedalus wallet, you will continue to receive rewards on the small amount still in there. We see this all the time with "ghost" wallets. There are many wallets with a small amount of ADA staked in pools where someone moved their ADA but didn't un-stake the old wallet. Then they got rewards for the next three epochs and those are still sitting there earning small rewards.


text:
Not in scope: data constructor ‘PayToPubKey’ - Fixing the Week 1 Pioneers Exercise
So in week 3 of the Plutus Pioneers program, the Plutus build changed which meant code in weeks 1 and 2 would no longer work. From what I can find, no one has published an updated set of code for weeks 1 and 2 that work with the latest build. I had a go myself and made some progress but I'm stumped by these two errors:
Compilation Error, Line 169, Column 13 (jump)
 error:
    Not in scope: data constructor ‘PayToPubKey’
    |
169 |             PayToPubKey   -> traceError "wrong output type"
    |             ^^^^^^^^^^^
Compilation Error, Line 170, Column 13 (jump)
 error:
    Not in scope: data constructor ‘PayToScript’

Any suggestions on how to fix?

The updated code for this looks like this:
ownOutput   :: TxOut
outputDatum :: AuctionDatum
(ownOutput, outputDatum) = case getContinuingOutputs ctx of
    [o] -> case txOutDatumHash o of
        Nothing   -> traceError "wrong output type"
        Just h -> case findDatum h info of
            Nothing        -> traceError "datum not found"
            Just (Datum d) ->  case PlutusTx.fromData d of
                Just ad' -> (o, ad')
                Nothing  -> traceError "error decoding data"
    _   -> traceError "expected exactly one continuing output"

The TxOutInfo type has now been replaced with TxOut which combines the data for a public key address and a script address. A public key address will not have a Datum, hence the Maybe.
data TxOut = TxOut {
  txOutAddress   :: Address,
  txOutValue     :: Value,
  txOutDatumHash :: Maybe DatumHash
}

The updated code for week 1 is now available in iteration 2 of the program, currently in the main branch of the Plutus Pioneer Program repo.

authors: Παύλος Τσότρας


text:
When is Hydra going to be completed?
I’m impressed with all the work that you have done. I’ve been amazed by Hydra, and everything you continue to do with Cardano.

Not really an appropriate question, see the help for guidance.

Questions of timing are rarely appropriate for StackExchange, they are more suitable for the Cardano Reddit Forums.

I’m voting to close this question because the questions about the future of Cardano can't be effectively addressed on this site and would be better addressed directly to the Cardano Team on their forum. This site is not operated by the Cardano organization.

We will see some form of Hydra in action by end of 2021 or the first quarter of 2022. Charles mentioned a couple of times that a separate team is always working on it and will try to release it sooner than previously planned.


text:
Is there a Daedalus wallet planned for mobile devices (Android and/or Apple)?
Will I be able to delegate to a stake pool from my mobile phone with Daedalus?

There is talk about Daedalus lite for mobiles. Charles mentioned it a couple of times. But I don't think it will be any time soon. It will be part of the next 5 year plan from IOG. But there will definitely be a Daedalus lite one day. For now it's Yoroi!

Definitely would be great to have a Daedalus lite for mobile devices. Nothing against Yoroi, haven't used it yet, so don't really have an opinion. Even if they were to make it a read-only mobile app where we can only check and see our ADA rewards and balance I'll be ok with that. But I'm sure it's easier said than done.

Yoroi may not be that intuitive but it does the job and its always with you on the mobile. I use both Daedalus and Yoroi. No complaints :). Oh don't you worry. When they do come up with Daedalus lite it will be awesome like everything else. "Quality" & "usability" are the main ingredients of anything built on Cardano! I have that much confidence by now.

You cannot use Daedalus on mobile because there is no mobile version. Daedalus is a "full node", i.e., it runs a cardano-node in the background, which maintains a complete copy of the blockchain. This is not intended to happen on mobile due to their limited resources. Mobile wallets like Yoroi work by connecting to a full node in the cloud.
WARNING: There have been apps claiming to be mobile versions of Daedalus pop up on some of the app stores. These are SCAMS! I've talked with people in the community that have had their ADA stolen because they trusted what appeared to be a legitimate Daedalus mobile app.

No, Daedalus has no mobile version right now and there is no mobile version planned in the future. Daedalus is a full node wallet, this means the whole blockchain is downloaded to the device where the wallet is running. On mobile devices this would be impractical as there is usually not that much storage on those devices.

Thanks, I do know that currently there's no Daedalus wallet for mobile devices. But just wanted to know if it's planned in the future.

When you get enough rep, maybe you can convert this to a comment. Alternatively, maybe you can write a little more detail? I know it's a simple question with a simple answer, but it would be good for answers to be a bit more substantial than just 1 line.


text:
Will I be able to stake ada from coinbase?
Will I be able to stake ada from coinbase or will I need to transfer it to another wallet.

This question should not be here, for many reasons. It's not really related to ADA, but to Coinbase, it's contingent to the current state of things (which can change easily), it's not technical at all...

Currently Coinbase does not support staking ADA tokens. Implementation of ADA staking within Coinbase is something you would need to take up with Coinbase.

Coinbase doesn't support staking ADA, but Kraken does. You can stake ADA directly into their pool for a 4-6% earnings. See their May 4th 2021 announcement.
Otherwise, you can stake on Daedalus wallet, in any of the available pools. You can search for available pools inside Daedalus wallet itself, although you may prefer to complement with more information available from Pool.io.

Please avoid staking from exchanges. It centralizes the distribution of ADA and also gives the exchange full control of your assets.
To help yourself and the network, delegate directly from your wallet to single staking pool operators. That way you retain full control of your assets, help the network decentralize and help smaller pool operators to grow.

Is this a weakness of Proof of Stake? Inevitably, all of the major exchanges will offer the ability to stake in the future, and a large portion of people will stake their ADA on exchanges out of convenience. Is there any "game theory" Cardano can put in place to discourage this?

I can't think of any way. They would have to have a method to differentiate between a single pool operator and an exchange owned pool. I can't think of any way of prohibiting an exchange from creating a normal staking node like any single individual.

my understanding is the staking rewards diminish with size, thus encouraging smaller pools. But i guess this may still not be enough to prevent the big boys from offering their lower performing but super easy to use staking pools


text:
How can redundancy be established for producer nodes?
It is rather straightforward to create relay redundancy but it is not as clear how to create redundancies for the producer nodes. The best solution I could come up with for the time being are VMware ESXi server farms, over SAN connections, with CARP IPs, etc. creating a physical redundancy but the OS layer remains a single point of failure.
I believe that running redundant producer nodes is not something approved.
Is there anyway to create an Active/Active or Active/Passive environment for the producer nodes?

Currently, a block producer can only send out its blocks if there is an incoming connection to it. So, as long as your backup block producer has no incoming connections, it can be "hot" and ready to produce blocks. I recommend having a relay pointing to a backup block producer, but prevented from connecting by a firewall rule.
Use CNCLI ping to determine if the main block producer is up or down. Depending on the answer, you can add/remove the firewall block to the backup block producer.
Example script to run with cron once per minute. In this example, a backup relay and block producer are installed on the same server.
#!/bin/bash

# are we blocking? In other words, we are not in failover mode
isblocking=`/usr/sbin/iptables --list INPUT --numeric | grep REJECT | grep 5050 | wc -l`

#if [[ $isblocking -eq 1 ]]
#then
#  echo "NON-failover mode. checking..."
#else
#  echo "FAILOVER mode. checking..."
#fi

error=`/home/westbam/.cargo/bin/cncli ping --host relay0.myserver.com --port 5000 | jq .status | grep error | wc -l`
if [[ $error -eq 1 ]]
then
  #echo "relay0 error. check relay1..."
  sleep 10
  error=`/home/westbam/.cargo/bin/cncli ping --host relay1.myserver.com --port 5000 | jq .status | grep error | wc -l`
  if [[ $error -eq 1 ]]
  then
    #echo "relay1 error. check relay2..."
    sleep 10
    error=`/home/westbam/.cargo/bin/cncli ping --host relay2.myserver.com --port 5000 | jq .status | grep error | wc -l`
    if [[ $error -eq 1 ]]
    then
      if [[ $isblocking -eq 1 ]]
      then
        echo "$(date): Enter FAILOVER mode..."
        # remove the local node blocks
        /usr/sbin/iptables --delete INPUT -p tcp --dport 5050 --jump REJECT 2> /dev/null
        /usr/bin/mail -s "FAILOVER" 9999999999@msg.fi.google.com <<< "FAILOVER to relay3 enabled"
      fi
      exit 0
    fi
  fi
fi

if [[ $isblocking -eq 0 ]]
then
  # we're not blocking local traffic, but we SHOULD be. Turn on the blocks
  echo "$(date): Return to NORMAL mode..."
  /usr/sbin/iptables --insert INPUT -p tcp --dport 5050 --jump REJECT 2> /dev/null
  /usr/bin/mail -s "NORMAL" 9999999999@msg.fi.google.com <<< "failover disabled"
fi

Thank you, Andrew. I realized now that I never sent my feedback. It worked perfectly. Thank you again for all you do by sharing your scripts and solutions.

Any non-block-producer full node a passive node. Just load your keys and you now have your block producer.
You can also use any OS specific high-available software, such as pecemaker or corosync.


text:
Where can I learn to make Cardano NFTs that have varying rarity levels when they are purchased for the first time?
I have seen some really cool projects like cryptoknitties and crypties with rarity levels and they usually come in like 5-10k. I have some great ideas but I can't find anywhere to learn how to do this on the internet or Cardano website? Are there any resources available to learn how to do Cardano NFTs like that?

What are cnfts?

@gRebel I think they mean Cardano NFTs (cnfts). In which case we have several helpful question/answers within the community.

I will edit the question based on the assumption that you are correct.  I had assumed the same but was checking with the original poster.

Maybe you can start looking at this guide. They covered all the details needed for mint your own tokens directly from the cli. Also if you want to create it in a mainstream programming language you can take a look at these libraries:

cardano-wallet-js (Javascript)
cardano-client-lib (Java)

You can use this tool to create native tokens or NFTs: https://cardano-native-token.com
This is the easiest userfriendly way at the moment.
It's required to have more technical skills if you want to make more complicate NFT setup.

There's nothing particularly built into Cardano that provides this functionality. You would personally control releases. If you want to mint a single item, do that. If you want to mint 100, do that. Of course as the amount rises, the less convenient it is to do this manually. I imagine anyone that's doing this with any level of seriousness is also writing a stack of custom tools to manage the process from creation through sales.
Eventually there will be marketplaces available that will do a lot of this for you; for a service fee, of course.


text:
Daedalus only has two translated languages. Can the community add more?
I want to help translating Daedalus to Brazilian Portuguese. Where can I find instructions on how to do it ?

From what I read here at https://github.com/input-output-hk/daedalus/issues/2423 (open on Mar 2, closed on Mar 3), there is indeed only 2 languages, English and Japanese, and yes the community already proposed for more translations, but as of now they will focus on the two actual as adding a new language requires to check carefully “every single line of text”. The verdict is that translations cannot be done by external contributions as it requires “internal people that are always present” for last-minutes changes.
I might propose that you could help translating other projects related to Cardano, for example maybe you could connect with people from specific staking pools!
It is a great initiative. :)


text:
What are the technical difficulties with implementing voting on hardware wallets?
Why is it so hard to make voting possible for hardware wallets?
What are the technical difficulties to implement that Feature?

Maybe some additional software needs to be developed by the hardware device manufacturers.

One of the main problems with adding new features to hardware wallets is the long update cycle.
Developers can't just upload a new version. A hardware wallet like Ledger Nano series can only get an update once a month, and it has to go through a 3rd party process beforehand.
Therefore, they lag a bit behind in functionality. You don't usually do iterative updates on hardware wallets. Instead, you release one when it's ready.

Thanks for the explanation! :)

Coming soon. While we do not understand the technical hurdles, at least once it has been mentioned that they are close to releasing voting from hardware wallets. Agreed that it would be great and many more will participate if not for a bit of clumsy process of current voting process. Baby steps. :)


text:
What are the long term micro-transaction plans for Cardano?
I've seen the broader implications of throughput that layer 2 solutions like Hydra will provide for the ecosystem. But I'm curious about how the Cardano ecosystem will provide cost effective solutions for users when Cardano's value starts to increase. For instance, when Cardano reaches $20 (which I am quite sure it will easily do in the not so distant future) if transaction fees remain in the ballpark of .16-.17 ADA we are looking at ~$3.4 for even smaller transactions on the base Cardano chain. How is the community planning on dealing with the "micro-transactionality" that will inevitably come out of Cardano's increasing adoption especially within the rapidly developing community of friends we have in Africa? Would this be a layer 1 solution, or a layer 2 development utilizing a new infrastructure? Cheers!

Micro-transactions could be done one layer above (for example Hydra) and the transaction fees will only for settlement.
Also, it is fairly easy to lower to fees to match the real-world price. In the future, maybe an AI system can do that will a help of oracle.

Hydra is a layer 2 solution where transactions are completed off chain, moving ADA to Hydra will open a Hydra head where transactions will be made, once the Hydra head is closed I think the main chain then confirms transactions within the Hydra head with 1 transaction fee effectively executing hundreds or thousands of tx's for a single fee


text:
How will Cardano address the ledger growth problem?
Once the ledger size grows beyond the terabyte magnitude, how will Cardano address this issue?
Storing and querying anything that large seems impractical to me.

I have no experience on Cardano development, but a couple of years ago I worked on a now defunct cryptocurrency called Unit-e, and we had a proposal that could help mitigating the problem of the ever growing ledger. A sort of cryptographic snapshots: https://github.com/dtr-org/uips/blob/master/UIP-0011.md The key is in Elliptic Curve Multiset Hashes .

The answer to this question is not clear yet, as more research is needed into this problem.
For now, the effort is to prevent the blockchain growing into large sizes with using layer one two solutions such as Hydra and possibly with side-chains, where you won't have just one blockchain but many, so the data might be distributed this way.
Shredding will be used too to provide a light-weight view of the blockchain, but many services such as Blockfrost will still have to run full archived nodes to access all the data on the blockchain.

Exactly! Most serious applications like real estate history needs to query the entire thing for a full audit. Getting only recent parts of the history via shredding would not be an option in such cases. I suppose a protocol that splits the data across many nodes might work, but you'd still need to put in some redundancy for security measures, so a level of chain duplication will be required even if it's not the full chain being copied everywhere.

Querying large data sizes doesn't have to be an issue necessarily, because you can create multiple indices for data access, which speeds up the search process by a large factor.For example think about Google that queries essentially the complete web.
It is expected that the transaction volume grows linearly over time while storage capacity grows exponentially. So the storage problem will likely solve itself over large time frames.
Also see this question:
Are there plans to keep the blockchain/node size small enough to maintain decentralisation?

The blockchain isn't indexed like a database. To benefit from indices, you'd need to ETL the chain information into a queryable database, right? I'm not sure what you mean otherwise. Even then, you'd essentially be making write operations much slower by making the reads faster. And even then, querying any database with billions/trillions of rows would be insanely slow.

@Mr.D That's quite hard to answer. I think you can build indices and query data even if the blockchain itself has no API for that. I also think that indexing does not have to be made in sync with write operations. Theoretically, you can create a new index every day for older entries. Maybe you can even outsource indexing.
But you are right that this wouldn't be an easy task.

In the near term, the solution is to keep metadata off chain as much as possible. Proofs/Hashes of the metadata can be used to maintain a reference to the data and guarantee it hasn't changed.
This of course relies on the assumption that said metadata will be available as long as it is needed.
If you look on the IOG GitHub, they have a "testnet" repo for the metadata registry and documentation scattered about in the other repos about this. When the metadata registry format is finalised, documentation should be clearly available. Since these registries are just git repositories, it is trivial to spin one up or mirror one. Additionally, since git is already a decentralised protocol, it will fit in quite well with the existing ecosystem.
With this format it seems the goal will be to have multiple community registries and these community registries will likely have multiple independent mirrors (due to the nature of git). This federated system will allow the community to discard unused data as necessary (and said data can be kept by anyone who needs it).

Other responses have already addressed parts of the long term goal however I would recommend looking through the IOG research catalogue. I believe there are a few papers in there addressing the topic.
Additionally, like other comments have mentioned, side-chains and state channels will allow history to be compressed as much as possible.


text:
Is there any kind of help for people who want to start a stake pool?
I would like to set up a stake pool but I have seen that with less than 800k - 1 million ADA it is not profitable. I would like to know if there is any kind of help for those modest pools that want to start with this type of structure to overcome the first months of life and cover the costs of servers until marketing and advertising do their job. Thank you very much.

I’m voting to close this question because it feels more like a discussion - if you have questions on how to start a stake pool, ask that. This site is a great resource for learning about Cardano but it's not intended to be used to find others to pool up with.

You can apply for support from the Cardano Foundation here. https://iohk.io/en/blog/posts/2021/04/01/announcing-a-new-round-of-community-stake-pool-delegation/
These happen quarterly, there's no guarantee that you'll get it, but it's worth a shot, especially if the mission and vision of your stakepool aligns with that of the foundation.
Edit.
It seems the form is closed, but I'd suggest keeping an eye out for the next round of delegations.

Indeed if you do not have a good amount of delegated ADAs in your pool you will not be able to create blocks with which you will not receive rewards. In fact, some pools have left the cardano network because it did not pay them to keep BP and Relays without the possibility of receiving any reward after months. It is a task that you should take as a business, look for people who want to delegate their ADAs in your pool and make your economic and time investment. Good luck!


text:
cardano-cli calculate-min-fee expects Shelley era transaction body
When using cardano-cli version 1.27.0 I want to calculate the min fee for the transaction. The procedure is to create a dummy transaction and using that to calculate the fee.
When creating the dummy transaction using:
cardano-cli transaction build-raw  --tx-in 1...x#2 --tx-out addr1...a+0 --tx-out addr1...b+0 --invalid-hereafter 30458092 --fee 0 --out-file tx-1622014393N.dummy
The transaction file then contains the correct era indicator:
"type":"TxBodyMary"
However, when I then calculate min fee on this transaction, an error occurs:
cardano-cli transaction calculate-min-fee --tx-body-file /tmp/tx.dummy --protocol-params-file /tmp/protocol.json --tx-in-count 1 --tx-out-count 1 --witness-count 2 --byron-witness-count 0 --mainnet
Response:
Command failed: transaction calculate-min-fee  Error: /tmp/tx.dummy: TextEnvelope decode error: DecoderErrorDeserialiseFailure "Shelley TxBody" (DeserialiseFailure 1 "expected list of length 3")

Looks like the transaction is created with a different version of cardano-cli.
Can you please confirm the file /tmp/tx.dummy is the same as tx-1622014393N.dummy?

Yes. It turns out I indeed created with 1.26.2. Thanks

From you example, it looks like your --tx-out-count is 2 and not 1, unsure about the witness-count, should be 1 I guess. Could fixing this help?


text:
Smart Contract Idea
I wanted to know how one can submit ideas but not in a public domain but the idea is already in the question so it doesn't matter.
So the question is: If I wanted to submit ideas how would I go about it? I understand about NDAs and solicited ideas to companies, so is there a smart contract that can be written to allow the submission of ideas to make it simple and allow the company to pay the creator of the idea? If this could be done I guarantee that it would open the flood gates to ideas coming in.

Hi Benjamin, welcome to the community - please ask a concrete question in the question field.
Example: Where can I submit smart contract ideas publicly?

Cardano StackExchange is a good place to ask technical questions, but I would suggest to visit Cardano Forums or Reddit to discuss ideas.
Voting to close this question.

Ideas can be aired afaik through Project Catalyst. There is also a Catalyst chat group on Instagram I think
You can get link from Daedalus site.

I doubt this would legally work. The first person to post an idea with a smart contract would not be the legal owner of the idea, thus a company would not be legally required to pay for it.
In other words, just because someone had an idea in 1990 and posted it somewhere, if someone else never saw it but came up with it themselves in 2020, they wouldn't have to pay a dime to the guy from 1990.


text:
Hardcoding currency symbol and token name in validator script
I want to be able to make calls to my custom native token module inside the validator script as I do with the Ada.hs module, but if I try I get a "E042:Error: Unsupported feature: Type constructor: GHC.Prim.ByteArray#" Error. Details below:
Currently I am trying to build a simple contract that once funded with X initial amount of X currency, the contract burn one coin each time an action is executed. For this I created a simple module for my dummy currency similar to the Ada module in Plutus.Ledger:
{-# LANGUAGE DataKinds         #-}
{-# LANGUAGE DeriveAnyClass    #-}
{-# LANGUAGE DeriveGeneric     #-}
{-# LANGUAGE DerivingVia       #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell   #-}
{-# LANGUAGE GeneralizedNewtypeDeriving   #-}
{-# LANGUAGE ScopedTypeVariables   #-}
{-# LANGUAGE MultiParamTypeClasses   #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# OPTIONS_GHC -Wno-identities #-}
{-# OPTIONS_GHC -fno-omit-interface-pragmas #-}

module Week05.Seals(
      Seals (..)
    , getSeals
    , sealsSymbol
    , sealsToken
    -- * Constructors
    , fromValue
    , toValue
    , sealsOf
    , sealsValueOf
    -- * Num operations
    , divide
    -- * Etc.
    , isZero
    , policy
    ) where

import qualified Prelude                          as Haskell

import           Data.Fixed

import           Codec.Serialise.Class            (Serialise)
import           Data.Aeson                       (FromJSON, ToJSON)
import           Data.Tagged
import           Data.Text.Prettyprint.Doc.Extras
import           GHC.Generics                     (Generic)
import qualified Plutus.V1.Ledger.Value           as TH
import qualified PlutusTx                         as PlutusTx
import           PlutusTx.Lift                    (makeLift)
import           PlutusTx.Prelude                 hiding (divide)
import qualified Ledger.Typed.Scripts             as Scripts
import           Ledger                           (txId, PubKeyHash, Tx, TxOutTx (..), ValidatorHash, Address(..), ScriptContext, scriptAddress, mkMonetaryPolicyScript)
import qualified Ledger.Contexts                  as V
import qualified PlutusTx.Prelude                 as P
import qualified Data.ByteString.Char8 as C

-- | Mint Policies

mkPolicy :: ScriptContext -> Bool
mkPolicy _ = True

policy :: Scripts.MonetaryPolicy
policy = mkMonetaryPolicyScript $$(PlutusTx.compile [|| Scripts.wrapMonetaryPolicy mkPolicy ||])

{-# INLINABLE sealsSymbol #-}
-- | The 'CurrencySymbol' of the 'Seals' currency.
sealsSymbol :: TH.CurrencySymbol
sealsSymbol = V.scriptCurrencySymbol policy

{-# INLINABLE sealsToken #-}
-- | The 'TokenName' of the 'Seals' currency.
sealsToken :: TH.TokenName
sealsToken = TH.TokenName "Seal"

-- | The special currency on the Cardano blockchain. The unit of Seals is Seal
newtype Seals = Seals { getSeals :: Integer }
    deriving (Enum)
    deriving stock (Haskell.Eq, Haskell.Ord, Show, Generic)
    deriving anyclass (ToJSON, FromJSON)
    deriving newtype (Eq, Ord, Haskell.Num, AdditiveSemigroup, AdditiveMonoid, AdditiveGroup, MultiplicativeSemigroup, MultiplicativeMonoid, Integral, Real, Serialise, PlutusTx.IsData)

instance Haskell.Semigroup Seals where
    Seals a1 <> Seals a2 = Seals (a1 + a2)

instance Semigroup Seals where
    Seals a1 <> Seals a2 = Seals (a1 + a2)

instance Haskell.Monoid Seals where
    mempty = Seals 0

instance Monoid Seals where
    mempty = Seals 0

makeLift ''Seals

{-# INLINABLE toValue #-}
-- | Create a 'Value' containing only the given 'Seals'.
toValue :: Seals -> TH.Value
toValue (Seals i) = TH.singleton sealsSymbol sealsToken i

{-# INLINABLE fromValue #-}
-- | Get the 'Seals' in the given 'Value'.
fromValue :: TH.Value -> Seals
fromValue v = Seals (TH.valueOf v sealsSymbol sealsToken)

{-# INLINABLE sealsOf #-}
-- | Create 'Seals' representing the given quantity of Seals (the unit of the currency Seals).
sealsOf :: Integer -> Seals
sealsOf = Seals

{-# INLINABLE sealsValueOf #-}
-- | A 'Value' with the given amount of Seals (the currency unit).
--
--   @sealsValueOf == toValue . sealsOf@
--
sealsValueOf :: Integer -> TH.Value
sealsValueOf = TH.singleton sealsSymbol sealsToken

{-# INLINABLE divide #-}
-- | Divide one 'Seals' value by another.
divide :: Seals -> Seals -> Seals
divide (Seals a) (Seals b) = Seals (P.divide a b)

{-# INLINABLE isZero #-}
-- | Check whether an 'Seals' value is zero.
isZero :: Seals -> Bool
isZero (Seals i) = i == 0

Then I start my contract as follows:
mint :: Contract () Schema T.Text ()
mint = do
    MintParams name amount <- endpoint @"mint"
    let val     = Value.singleton Seals.sealsSymbol Seals.sealsToken amount
        datum   = MyDatum 100
        lookups =  Constraints.scriptInstanceLookups starterInstance <> Constraints.monetaryPolicy Seals.policy
        tx      = (Constraints.mustForgeValue val) <> (Constraints.mustPayToTheScript datum val)
    ledgerTx <- submitTxConstraintsWith @Starter lookups tx

    void $ awaitTxConfirmed $ txId ledgerTx
    Contract.logInfo @String $ printf "forged Sym:%s %s" (show Seals.sealsSymbol) (show val)

The "Datum" and the name field in the mint parameters are not being used for anything special, the important part here is that this transaction will create "amount" tokens and pay them to the script.
So my objective is to:

Keep the native tokens inside the contract, they can not be transferred to any other address

The transaction must burn one of the tokens each time.

I am implementing with this some sort of counter, where the contract is started with X funds, then every transaction will decrease the currency by one and won't allow the funds to be transferred to any other address.
This is the validation code:
validateSpend :: MyDatum -> MyRedeemer -> ScriptContext -> Bool
validateSpend (MyDatum num) (MyRedeemer num2) ctx@ScriptContext{scriptContextTxInfo=txInfo@TxInfo{txInfoValidRange}} =
    let
        forged            = V.txInfoForge txInfo
        expected          = Seals.sealsValueOf (-1)
        newValueLocked    = getSeals $ Seals.fromValue (Validation.valueLockedBy txInfo (Validation.ownHash ctx))
        valueSpent        = getSeals $ Seals.fromValue (Validation.valueSpent txInfo)
        valPaidToScript   = getSeals $ Seals.fromValue (valuePaidToScript txInfo (Validation.ownHash ctx))
    in traceIfFalse "Value burned different than 1" (valPaidToScript == (valueSpent - 1)) &&
       traceIfFalse "Wrong number" (num == num2) &&
       traceIfFalse "Value forged different from expected" (expected == forged)

If I try to run this, I get the following error while compiling the contract:
GHC Core to PLC plugin: E042:Error: Unsupported feature: Type constructor: GHC.Prim.ByteArray#
Context: Compiling type: GHC.Prim.ByteArray#
Context: Compiling data constructor type: GHC.Integer.Type.BN#
Context: Compiling type: GHC.Integer.Type.BigNat
Context: Compiling data constructor type: GHC.Natural.NatJ#
Context: Compiling type: GHC.Natural.Natural
Context: Compiling data constructor type: PlutusCore.Core.Type.Version
Context: Compiling type: PlutusCore.Core.Type.Version ann
Context: Compiling data constructor type: UntypedPlutusCore.Core.Type.Program
Context: Compiling type: UntypedPlutusCore.Core.Type.Program
                           PlutusCore.DeBruijn.Internal.DeBruijn
                           PlutusCore.Universe.Default.DefaultUni
                           PlutusCore.Builtins.DefaultFun
                           ()
Context: Compiling type: Plutus.

If I replace the calls to my custom module for my native token with calls to the ADA module (and use the ADA currency) it works (without the burning token part). It seems that any code I execute inside the validator script that calls any of these functions:
{-# INLINABLE sealsSymbol #-}
-- | The 'CurrencySymbol' of the 'Seals' currency.
sealsSymbol :: TH.CurrencySymbol
sealsSymbol = V.scriptCurrencySymbol policy

{-# INLINABLE sealsToken #-}
-- | The 'TokenName' of the 'Seals' currency.
sealsToken :: TH.TokenName
sealsToken = TH.TokenName "Seal"

Causes the error. Both the token name and the currency symbol are stored as ByteStrings, so I am thinking that I can't compile hardcoded bytestrings on the contract validator script?
How can I use my custom currency module inside the validator script?

You can derive (Semigroup, Monoid) via Sum Integer using DerivingVia

The problem is in your sealsToken function, where you use a ByteString-literal. This is not possible if you want to compile to Plutus Script.
A trick to work around this issue is to add an additional argument to your validateSpend function of type TokenName, where you pass in the Seal token name as an additional argument.
I have used this trick in Lecture #7 of the Plutus Pioneer Program.

Yes, I saw it in the lecture and solved it that way. Thanks

@Lars Brünjes : Doesn't that also mean that the token name cannot be enforced by the on chain validator. Is there a way for validator to check for a particular AssetClass?

@lambda No it can still enforce a TokenName, because the TokenName is now being embedded in the script at compile time. So the validator just checks that any tokens being minted match the TokenName supplied when it was compiled.


text:
I am looking for a practical example of a smart contract with three parties
I would like to know if the following scenario involving three parties could make sense in the context of a smart contract.
I am new to blockchain and smart contracts, I have come across some standard two party contracts and one-to-many like crowd funding but I could not find any mention of a three party contract along the following lines:
Let's say Alice and Bob share a boundary between their gardens and Bob is responsible for paying for a fence and Alice has some requirements.
So Bob cannot put up the fence unless Alice says the conditions are met.
Bob is also at the mercy of the weather and his workman,
and the workman is at the mercy of the weather and issues on other jobs.
So in one sense:
Bob has agreement (a) with the workman, John
and a separate agreement (b) with Alice.
However, there could be an interesting interdependency created by Alice's requirements.
She has the option of setting a requirement with a twenty four hours notice or no notice required.
However, since she wants a fence up as soon as possible, if she drops the the 24H notice requirement then John has a option to come at an earlier date if he is stalled on his other job.
With two separate contracts the 24 hour notice/ no notice option could accidentally be different.
I don't know if this is a good example, but I am trying to understand if a single smart contract is ever used in order to hold three parties into an agreement, or should interdependent agreements like this be split into multiple two party contracts?
Or can a parent contract hold two child contracts with an interdependency?
Thanks in advance
Brian

The mediator is a good example of a three party contract. Is there a white paper or explanation giving more detail of scenarios when it would be more effective or less effective. For example, are we talking about resolving non-smart-contract disputes via a mediator using a smart contract to manage the distribution of funds after a decision? Should a mediator have some qualifications, experience and reputation? Can a mediator be a group using voting to make majority verdicts?

Your example is interesting and could be really meaningful if real world data (e.g. weather data) can be included.
Here's a simpler example that I can think of based on your example.
Let's say John put up the fence as Bob instructed, but there is misalignment between Bob's instructions and Alice's requirements. Now Alice is thinking about suing Bob, because in her view, Bob acted against her will. But Alice also does not like the courts. But she heard about this dispute resolution DApp on Cardano (to be build) where an independent third party helps the disputants solve their dispute.
This third party can be a mediator that simply helps the parties find a mutually agreeable solution. The payment of said mediator can be in the form of a smart contract. Alice opens a case and initiates the payment of the mediator for her share (usually mediators and arbitrators get paid an equal amount by both parties). This amount is now in escrow and will only be dispersed if the other party (Bob) agrees to mediate this case as well (by paying the mediation fee).
Instead of having two contracts (one between the mediator and Alice, the other one between the mediator and Bob), both transfers can be rolled up into one smart contract.
Of course, there are many more interesting examples, but I hope this example helps. Btw, I will be proposing a dispute resolution marketplace in an upcoming Project Catalyst fund, so keep an eye out for that. There's a lot of little disagreements between neighbors (as you indicated) where smart contracts has the potential of making life a little bit nicer for communities of varying shapes.

The mediator is a good example of a three party contract.


text:
What should I be doing to become a top tier Plutus Developer?(Besides Plutus-Pioneer-Program)
I want to know everything there is to know about development on Cardano. I am currently following the plutus pioneer program, but would like to dig deeper.
Are there any videos, articles, documents or lectures that some more experienced developers can recommend?
Thanks in advance!

I suggest you re-phrase the question to fit in line with the guidelines: https://cardano.stackexchange.com/help/dont-ask

Can I ask what PRs are? I'm new to this programming but also thinking of learning the basics on many programming languages like Python, Javascript, Java, Solidity and Haskell in 4 month. Maybe do Plutus together with Haskell let's see. But I won't be developing, that I will pay developers to do. But at the same time I need the basics to be able to talk to them and we can understand each other

Yeah PRs is just short for Pull Requests. They are an integral part of working on a git repository with a team. Heres a little explanation on Pull Requests

Thanks however, I don’t understand those things that well. Haha
This is hypothetical and not what I will do. But it will help with some financial calculations.
Could anyine give me an estimation of both how many developers to fork cardano and hydra as it looks today and to some twerking in the protocol/code to be more tailored in what a person would prefer?
Also how long it would take for a specific amount of team?
And an estimated price for this? Both total and per developer and so on.

Fellow Plutus Pioneer here.
Besides following the lectures closely and doing the homework (potentially several times), I would recommend digging into the actual plutus project, go through the source and find your way around. As you know, plutus is currently being developed, so any videos, articles, and documents (even comments in the source code itself) can be outdated rather quickly. So my suggestion is to work with plutus closely. Find some use cases to implement, but also follow the development closely.
See if you can fix some of the issues and/or review the PRs that are made on the GitHub repo and contribute your own.


text:
How can metadata.json properties be changed after a token is minted?
I've minted a token but some of the metadata.jsosn properties don't look so great. Is there a way to update them?
The general form I've tried is:
cardano-cli transaction build-raw \
        --fee $fee \
        --tx-in $txhash#$txix \
        --tx-out $address+$output \
        --metadata-json-file metadata.json  \
        --out-file matx.raw

Technically you cannot change the metadata for a token once its minted. Thats the whole point of putting something on the blockchain-its immutable. On Cardano, token metadata is just metadata in the minting transaction. What you are doing is just adding new metadata to a new transaction with the token. This is not changing the minting metadata. You should just burn the token and start fresh.

This seems to work:
export address="address the token was created on"
export txhash="transaction hash the token was create don"
export txix="index of txhash above"
export funds="funds at the txhash"
export policyid="the token policy id"
export fee="0"
export output="0"
export tokenamount="the countof the token at the txhash"

cardano-cli transaction build-raw \
        --fee $fee \
        --tx-in $txhash#$txix \
        --tx-out $address+$output+"$tokenamount $tokenpolicy.$tokenname" \
        --metadata-json-file metadata.json  \
        --out-file matx.raw

fee=`cardano-cli transaction calculate-min-fee --tx-body-file matx.raw --tx-in-count 1 --tx-out-count 1 --witness-count 1 --mainnet --protocol-params-file=protocol.json | cut -d " " -f1`
echo "Funds? $funds"
echo "Fee? $fee"
output=$(expr $funds - $fee)
echo "Output? $output"
echo "Addr? $address"
echo "txhash: $txhash#$txix"

# redo the transaction aboev w/correct fee
cardano-cli transaction build-raw \
        --fee $fee  \
        --tx-in $txhash#$txix \
        --tx-out $address+$output+"$tokenamount $tokenpolicy.$tokenname" \
        --metadata-json-file metadata.json  \
        --out-file matx.raw \

# sign the transaction
cardano-cli transaction sign \
            --signing-key-file test.skey \
            --signing-key-file policy/policy.skey \
            --tx-body-file matx.raw \
             --mainnet \
            --out-file matx.signed

# submit the transaction
cardano-cli transaction submit --tx-file  matx.signed --mainnet


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

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

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

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

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


text:
When a UTxO becomes available for consumption?
In the Gift.hs example from the second lecture in Plutus Pioneers Program, when I give ada, a UTxO is produced. When I want to grab that ada in the same block, it fails (There is no input or output when simulated in the palyground). But when I wait for one block and then try to grab, It succeeds.
My conclusion is we cannot produce and consume a UTxO in the same block. We can only consume a UTxO from the next block onward. Am I right or...?

That is correct. For a UTxO to be consumed it first has to exist on the blockchain. For it to exist on the blockchain the transaction that created it must exist in a block that has been confirmed by the network.

You can only grab the gift once it's confirmed on the ledger. Search for awaitTxConfirmed in the source code.
That effect may have configurable level of confirmation in the future as indicated in the source code.

It is possible, at least with a recent version of cardano-cli (don't know about earlier ones, but I assume it would work too) to issue two transactions sequentially where the output of tx n is used as the input of tx n + 1. Both transactions will be put into the same block.
Here's a block where I've done so a few days ago, the first two transactions are by me. You can see that the second tx uses the first one as input.
Edit: In the context of plutus smart contracts however, I think Matthias is correct.

This isn't a limitation of Plutus scripts in general, but the plutus-contract library. Transaction chaining is possible with and without Plutus scripts involved.


text:
Where and when do I get a chance to review and contest community advisor (CA) assessments of my proposal?
My proposal is now in the "assess QA" phase.
I am expecting to see the assessments, so that I can propose rejection of any that do not meet the guidelines.
Will they appear in Catalyst or be listed elsewhere?

The assessments made by Community advisors are mailed to the proposer as a Google Sheet. The proposer can mark infringements as he finds in the assessment in the sheet. If a proposer has not received he can contact in the related telegram channel. Please refer this QA Stage


text:
Haskell IDE INLINABLE error help
Have you encountered this error? IDE complains that the validator is not INLINABLE, while it actually is:
Program error: GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable GHC.Base..
            No unfolding
Context: Compiling expr: GHC.Base..
Context: Compiling expr: GHC.Base..
                           @ (Plutus.V1.Ledger.Contexts.ScriptContext -> GHC.Types.Bool)
Context: Compiling expr: GHC.Base..
                           @ (Plutus.V1.Ledger.Contexts.ScriptContext -> GHC.Types.Bool)
                           @ Ledger.Typed.Scripts.Validators.WrappedMonetaryPolicyType
Context: Compiling expr: GHC.Base..
                           @ (Plutus.V1.Ledger.Contexts.ScriptContext -> GHC.Types.Bool)
                           @ Ledger.Typed.Scripts.Validators.WrappedMonetaryPolicyType
                           @ Plutus.V1.Ledger.Value.TokenName
Context: Compiling expr: GHC.Base..
                           @ (Plutus.V1.Ledger.Contexts.ScriptContext -> GHC.Types.Bool)
                           @ Ledger.Typed.Scripts.Validators.WrappedMonetaryPolicyType
                           @ Plutus.V1.Ledger.Value.TokenName
                           Ledger.Typed.Scripts.Validators.wrapMonetaryPolicy
Context: Compiling expr: GHC.Base..
                           @ (Plutus.V1.Ledger.Contexts.ScriptContext -> GHC.Types.Bool)
                           @ Ledger.Typed.Scripts.Validators.WrappedMonetaryPolicyType
                           @ Plutus.V1.Ledger.Value.TokenName
                           Ledger.Typed.Scripts.Validators.wrapMonetaryPolicy
                           Plutus.Contracts.FungibleToken.validator
Context: Compiling expr at "main:Plutus.Contracts.FungibleToken:(19,6)-(19,69)"

Module I'm trying to use IDE in:
{-# LANGUAGE DataKinds       #-}
{-# LANGUAGE TemplateHaskell #-}

module Plutus.Contracts.FungibleToken where

import           Ledger.Typed.Scripts      (MonetaryPolicy)
import qualified Ledger.Typed.Scripts      as Scripts
import           Plutus.V1.Ledger.Contexts (ScriptContext)
import qualified Plutus.V1.Ledger.Scripts  as Scripts
import           Plutus.V1.Ledger.Value    (TokenName, Value)
import qualified PlutusTx

{-# INLINABLE validator #-}
validator :: TokenName -> ScriptContext -> Bool
validator _ _ = True

makeLiquidityPolicy :: TokenName -> MonetaryPolicy
makeLiquidityPolicy tokenName = Scripts.mkMonetaryPolicyScript $
  $$(PlutusTx.compile [|| Scripts.wrapMonetaryPolicy . validator ||])
    `PlutusTx.applyCode`
        PlutusTx.liftCode tokenName

Did you ever solve this problem?

Running into a similar problem with a very basic validator script. This GitHub issue seems to be related: https://github.com/input-output-hk/plutus/issues/3454

The way HLS is enabled without plugin errors is discussed here:

https://github.com/input-output-hk/plutus-starter/pull/23
https://github.com/input-output-hk/plutus-starter/pull/29
https://github.com/input-output-hk/plutus/issues/3454

Basically, you need to enable defer-plugin-errors flag.
You can do this with following command:
cabal configure -f defer-plugin-errors
Remember to turn it off when you actually need to check if validators are compiled properly. This resets configuration:
cabal configure

It works! Thank you

The pragma {-# LANGUAGE NoImplicitPrelude #-} and
import PlutusTx.Prelude might help.
It replaces the implicitly defined functions in Haskell by inlinable alternatives. Here is an example for Boolean operators.

That could have worked, but I tried and the error is still the same. The validator inside module Plutus.Contracts.FungibleToken did not use any functions from Prelude, so that's expectable.


text:
Ideal computer specifications for own staking?
I'm very new to Cardano and staking and would like to run my own vs delegating:

what PC specifications would be ideal to run my own pool for ADA staking?

Why would you want to run your own vs. delegating? This is only advisable if you have millions of ADA or are going to start a stake pool business.

To earn staking rewards, there is no requirement to run your own pool. You can use Yoroi app for Phone or Daedalus application for Computer. You can delegate to pools in the app and earn rewards. Ensure that you are using a verified application else you will lose your funds to scammers.
If you want to start run a stake pool, please read about the economics of running a stake pool. You will require about 1M ADA to run a profitable stake pool at the moment. If you have less money, you need to find people with this much ADA to delegate to your pool. Currently, there are about 2500 pools, and it's a tough business to get delegators.
The recommended specifications for a topology of a stake pool are 1 - Block Producer Node and 2 Relay Nodes. The configuration reference of the computer for this node are:

4 GB of RAM (8-12 GB ideal)
24 GB of hard disk space (200 GB Ideal)
a good network connection and about 1 GB of bandwidth per hour
a public IP4 address


text:
Are there web3.js-like in Cardano?
With the Cardano's Alonzo Hard fork coming, the Cardano testnet will be coming in. I assumed that there is a frontend library for interacting with the Cardano testnet, however I couldn't find anywhere. I wonder if there are libraries that are being developed?
Regards,
Ivan

The only JavaScript library there is right now, is the cardano-serialization-lib developer by Emurgo.
However, as already mentioned, there is a number of Catalyst proposals that you might want to vote for in the upcoming rounds:

Fund4: JavaScript SDK for Blockfrost API (pardon my shameless plug, we're the team behind Blockfrost.io API)
Fund4: Ouroboros Networking Lib in JS
Fund5: Cardano JS API

There isn't currently a Javascript library, but it looks like the Cardanoscan folks are building one for interfacing with the Cardano blockchain (link to article).
The current pioneer's testnet for writing smart contracts uses Plutus. You can read more about this here.

We have https://meshjs.dev/ and https://lucid.spacebudz.io/ now as javascript libraries for Web3 development on Cardano


text:
How do I build a debug configuration of a Plutus project?
When I try to set a breakpoint in a small Plutus project such as this, I always get the following error:
:b Week05.Homework1.mkPolicy
cannot set breakpoint on Week05.Homework1.mkPolicy: module Week05.Homework1 is not interpreted

(Using Windows, cabal version 3.4.0.0, ghc version 8.10.4.)
Removing -fobject-code or adding -fPIC to the ghc-options won't help, which was suggested here for other Haskell projects. -fPIC does even fail as it is not a Windows thing, anyway.
The error is the same for off- and on-chain functions. So the INLINABLE pragma is not to blame.
Does this have anything to do with the PlutusTx compiler?

This may have to do with Haskell being a functional language. Meaning that unlike imperative languages, there are no 'breakpoints' due to the nature of the language. The other link you mentioned only works with I/O operations which follow an 'imperative' style. The answer for your question would be to find a new way to debug functional programs, seeing as they don't work with imperative style debugging.

mkPolicy is an on-chain validator code, is lifted to template Haskell and it gets compiled to core plutus and executed when the UTXO locked by that script is spent. AFAIK, core-plutus is not Haskell, so the breakpoint will be ignored.


text:
How to get intellisense/auto suggestion working for Plutus in VSCode?
I've been seeing Lars get auto suggestions from his terminal when he's typing. I want the same in VSCode, how to get it?
PS: I don't get auto suggestions in cabal repl too.

Simply install the Haskell extension from inside Visual Studio Code. You'll get there by pressing Ctrl+Shift+X and searching for Haskell.
Note that the extension requires a ghc installation (=<8.10.4) on your system. The current release of ghc 9.0.1 is not yet supported.


text:
What is a Redeemer?
So I am currently on lecture 1 on the Plutus Pioneer Program. In the lecture they said the redeemer is the input information that the script uses to decide if a specific UTxO can be spent. I watched a video that was made two years ago that said the redeemer is used to decide if a wallet can receive Ada from a smart contract. The person in that video did say that these things might change because things are still under development. Can someone clear this up for me? What exactly is a redeemer as of right now? What is a redeemer's role in sending transaction and in smart contracts?

From https://iohk.io/en/blog/posts/2021/04/13/plutus-what-you-need-to-know/:

When validating an address, the script will access the data being
carried by the output, the transaction being validated, and some
additional pieces of data called redeemers, which the transaction
provides for every input. By looking up all this information, the
script has enough context to give a ‘yes’ or ‘no’ answer in what can
be highly complex situations and use cases.

In lecture 1 of the current plutus pioneers program, you find a redeemer on the auction validation script. When making a bid, there are essentially five cases to check. All these five cases need to pass or the transaction will not be even committed to the blockchain (which is good, because you're saving on fees for something that won't succeed anyway):

Is the bid sufficient (the bid is >= the minimum valid bid)
The auction hasn't closed

The three other cases also do data checks (output datum/value, bid refund).
The redeemer (in the auction example) itself is a simple data type that we can define (AuctionAction) to do data validation (particularly on inputs).

That was a great explanation.Thanks.

Thank you. If you're happy with the explanation, make sure to mark the answer as a solution to your question as it helps other StackExchange users to see what questions have/haven't been answered sufficiently.

In simple terms, redeemer is the data that the user of the smart contract provides to the smart contract.
In the simple UTxO model, redeemer is your signature. By providing your signature, you prove that you own the UTxO and in return you are allowed to spend that UTxO.
EUTxO takes this one step further. How are you going to spend an EUTxO? You have to provide all the data that EUTxO needs and depending on the data you provide, you are allowed to spend it or not.

Before (E)UTxO - There Was UTxO
Understanding how a UTxO model works (such as BTC) may help you understand the implementation of (E)UTxO in Cardano.
The UTxO Model
A UTxO model, meaning: unspent transaction outputs from previous transactions1 will typically implement a validator and a redeemer for any given new transaction (at least, this is the case in BTC).
Validators and Redeemers
The validators job is to return a boolean value as to whether the UTxO can be spent or not. In BTC the validator is implemented in BitCoin Script and is about as simple as it could be. It does, however, take a redeemer (which in the case of BTC is a representation of transactional digital signatures); and the validator uses the redeemer to either allow the UTxO to be spent or not.
Cardano | The (E)UTxO Model
Within Cardano we use scripts to evaluate whether or not a given (E)UTxO may or may not be spent. An address in Cardano points to a script - the script contains arbitrary logic and takes a redeemer as its input/parameter(s) - which are now also more general in nature, as they need to satisfy the constraints provided by the arbitrary logic within the script.
By triggering the script (attempting to create a new transaction), the redeemer will be passed to the script, the script will be executed and will determine whether or not the (E)UTxO can be spent or not.
Summary
A redeemer is used as input to an (E)UTxO script in order to determine whether or not the extended unspent transaction output may or may not be consumed, given the arbitrary logic provided within the script.
FYI: Cardano addresses point to scripts, the script may be simple or extremely complex.
I found this video by Michael Peyton Jones to be pretty informative and perhaps a little more intuitive than the first lecture presented within the Plutus Pioneer Program:
https://youtu.be/usMPt8KpBeI
However, it may be a little outdated? I'm still working my way through the second cohort.

Footnotes:

Think of an unspent transaction as the change you're given in a shop when you hand a $20 bill for a $5 item, the $15 change is YOUR UTxO and is secured using public-private key cryptography.

In Bitcoin, both the "validator" and "redeemer" is Bitcoin Script. The output of the redeemer is given as input to the validator. In Bitcoin's implementation this amounts to the validator script being executed against the stack produced by the redeemer script. The validator script will then determine if the redeemer is valid based on the stack it leaves behind.

There is an interesting example in one of the Pioneer lectures which implements Uniswap on Cardano.
A redeemer is not only used to justify that a UTxO can be spent, but also the manner in which it will be spent. The validation script will then place the necessary constraints on the creation of the transaciton based on who is trying to spend it and how they are trying to spend it.
In the screenshot attached from lecture 10 of the first iteration of the Plutus Pioneer Program, the blue lines represent the redeemer as an input to the UTxO's validation script (represented by the blue and red circles) which, in this case, is validating the consumption of  a UTxO which represents a liquidity pool.
You can see four different labels on four of the blue lines - Create, Swap, Add and Remove. These represent different constructors for the redeemer data type being used and tell the script what action the user is trying to take.
For further details of exactly what each redeemer does, you can read more and find a link to the video here.

In simple words, a Redeemer is an entity that allows you, according to arbitrary logic, replace the digital signature with itself. Redeemer was conceived to redeem an UTXO from a script address, so it's a crucial part of Tx. Imagine, we can create a validator which outputs true in case the secret number (our redeemer) is, say 12345. Thus, if you know that secret number, you have the right to spend all the UTxOs locked by validator. If there is no redemption, then there must be a refund, right?


text:
How to access the current slot in a Plutus validator script?
At the time the Plutus validator script runs, the transaction is not yet part of the blockchain. But the targeted slot of a transaction is known when a node processes the script. Is it possible to access the target slot inside the validator script?

The context of a validator script Plutus.V1.Ledger.Contexts.ScriptContext gives access to the transaction where txInfoValidRange may provide upper/lower bounds of the slot. This, however, requires that a Ledger.Constraints.mustValidateIn constraint has been specified when the transaction was submitted (as done in this example).

I understand that it is considered to be bad practice for a Plutus validator script to depend on the state of the whole blockchain or unpredictable input such as the target slot because it limits verification/testing possibilities.

Nevertheless, there might be plenty of good use cases for using the current slot; for example, an oracle might check if its data is expired and does not want to enforce its users to provide an upper limit in the mustValidateIn constraint.

Accessing any runtime information (including current slot) should not be possible in the validator by design. The reason is that transaction validity needs to be deterministic on construction. The only reason a transaction cannot be executed afterwards would be, if a UTXO was already consumed or the slot is outside of txInfoValidRange (as explained in this Youtube video).
There might be other use cases, but making sure expired oracle data isn't consumed anymore could also be achieved by deactivating an oracle (which would require the oracle contract to support it). And also it is in the best interest of the party creating a transaction to make sure only trustworthy oracle data is consumed.

Does this mean that there is no way other than putting the burden on the oracle's users to check for expiration? The users may not even know what's the appropriate update-cycle for the data they want.
As an oracle provider, I would know about the reliability of my data source. And I might want to set an expiration date in case my network/blockchain access is broken, etc.
Similarly, SSL certificates also have an expiration date because it is a reasonable default: "not doing anything" means automatically invalidated. This is more secure because it removes the "zombies".

Users of an oracle should be able to acquire this information about an oracle. After all you really have to trust an oracle, so the provider should be as transparent as possible.
The oracle could also provide an expiration Slot in it's Datum and only validate transactions that are valid before that expiration (according to txInfoValidRange). The user then needs to restrict transaction validity to a specific slot range.


text:
How can I find the Haskell source code for the sqrt function?
I am starting to learn Haskell and need to learn how to look things up.
Since I am studying a function that uses sqrt, I want to see how that was made in Haskell.
This is as much an exercise in using reference material as it is in seeing how the sqrt function works under the hood in Haskell. Any advice would be appreciated.

By entering :i sqrt using ghci, we can see that sqrt is

-- Defined in ‘GHC.Float’

A quick google shows that the source code repo is on https://gitlab.haskell.org/ghc/ghc.
Entering sqrt in the search bar for the repository yields several pages of interesting results (including tests). From what I see, using sqrt includes calling the corresponding sqrt operation on a CPU level (check out the x86 related code as one example).
Of course, GHC is not the only implementation of Haskell, but at least within these realms, both terms are most often used as synonyms.
Edit: OP found the implementation detail with this approach in https://gitlab.haskell.org/ghc/ghc/-/blob/master/libraries/base/GHC/Float.hs, where sqrt is defined as follows:
sqrt x              =  x ** 0.5

Thank you @Matthias Sieber
From your instructions, I was delighted to find the following in the source code.
sqrt x  =  x ** 0.5
I found that I could substitute x ** 0.5 for sqrt which tells me a lot about Haskell.
Much thanks for your help

API docs for the core libraries are maintained at haskell.org as well. There's an index link in the upper right where you can look up specific functions and then, on each module's documentation page, there are links to source code. For sqrt:
https://downloads.haskell.org/~ghc/latest/docs/html/libraries/base-4.15.0.0/GHC-Float.html#v:sqrt
Also, bookmark this, the top-level of the latest API docs:
https://downloads.haskell.org/~ghc/latest/docs/html/libraries/index.html

Great resource @dino. Much thanks

The simplest and the most effective way to learn Haskell is to use online playgrounds.
Here's how a square root integer calculation may look like in Haskell:
squareRoot :: Int -> Int
squareRoot n = try n where
   try i | i * i > n = try (i - 1)
         | i * i <= n = i

main = do
   print (squareRoot 749)


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

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


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

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