text:
What is achieved by invoking endpoint for wallet in the emulator?
As per entire code below, give always mandates that Wallet 2 be given:
thePkh :: PubKeyHash
thePkh = pubKeyHash $ walletPubKey $ Wallet 2

theVal :: Value
theVal = ADA.toValue (ADA.Lovelace 3_000_000)

give :: Contract () PaySchema Text ()
give = do
    let param = PayParam thePkh theVal
    let tx = mustPayToTheScript () theVal
    ledgerTx <- submitTxConstraints (typedValidator param) tx

So why must I also invoke the grab endpoint for Wallet 2 (trace12)? What changes if instead it's invoked for Wallet 3 (trace13)?
trace12 #######################################
...
Final balances
Wallet 1:
    {, ""}: 96999990
Wallet 2:
    {, ""}: 102996448
Wallet 3:
    {, ""}: 100000000
Wallet 4:
    {, ""}: 100000000
Wallet 5:
    {, ""}: 100000000
Wallet 6:
    {, ""}: 100000000
Wallet 7:
    {, ""}: 100000000
Wallet 8:
    {, ""}: 100000000
Wallet 9:
    {, ""}: 100000000
Wallet 10:
    {, ""}: 100000000

Note that if Wallet 3 instead is invoked for grab, then the result is different:
trace13 #######################################
...
Final balances
Wallet 1:
    {, ""}: 96999990
Wallet 2:
    {, ""}: 100000000
Wallet 3:
    {, ""}: 100000000
Wallet 4:
    {, ""}: 100000000
Wallet 5:
    {, ""}: 100000000
Wallet 6:
    {, ""}: 100000000
Wallet 7:
    {, ""}: 100000000
Wallet 8:
    {, ""}: 100000000
Wallet 9:
    {, ""}: 100000000
Wallet 10:
    {, ""}: 100000000
Script 3f3c25dfdfad56d6f08d6d3e8bec53ab14d1950be944bc0ed26957c6:
    {, ""}: 3000000

Why is that? And what does it mean to invoke an endpoint for a wallet altogether?
{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveAnyClass             #-}
{-# LANGUAGE DeriveGeneric              #-}
{-# LANGUAGE FlexibleContexts           #-}
{-# LANGUAGE NoImplicitPrelude          #-}
{-# LANGUAGE OverloadedStrings          #-}
{-# LANGUAGE ScopedTypeVariables        #-}
{-# LANGUAGE TemplateHaskell            #-}
{-# LANGUAGE TypeApplications           #-}
{-# LANGUAGE TypeFamilies               #-}
{-# LANGUAGE TypeOperators              #-}
{-# LANGUAGE MultiParamTypeClasses      #-}
{-# LANGUAGE DerivingStrategies         #-}
{-# LANGUAGE NumericUnderscores         #-}
{-# LANGUAGE TupleSections              #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}

module ASK (trace12, trace13 ) where
import           Control.Monad        hiding (fmap)
import           Data.Map            as Map
import           Data.Monoid               as Mnd ( (<>), Monoid(mconcat) )
import           Data.Text            (Text, unpack)
import           Data.Void            (Void)
import           GHC.Generics         (Generic)
import qualified Prelude              as H--askell

import           Plutus.Contract
import qualified Plutus.Trace.Emulator as Emu
import           PlutusTx             (Data (..))
import qualified PlutusTx
import           PlutusTx.Prelude     hiding (Semigroup(..), unless)
import           Ledger               hiding (singleton)
import           Ledger.Constraints   as Constraints
import qualified Ledger.Typed.Scripts as Scripts
import           Ledger.Value         (Value(Value), geq)
import           Wallet.Emulator.Wallet  (Wallet(Wallet), walletPubKey)
import qualified Plutus.V1.Ledger.Ada as ADA
import qualified Control.Monad.Freer.Extras as Extras

data PayParam = PayParam
    { _pkh :: PubKeyHash
    , _val :: Value
    } deriving H.Show

PlutusTx.makeLift ''PayParam

{-# INLINABLE mkValidator #-}
mkValidator :: PayParam -> () -> () -> ScriptContext -> Bool
mkValidator param () () ctx =
    traceIfFalse "beneficiary's signature missing" signedByBeneficiary
        where
            info :: TxInfo
            info = scriptContextTxInfo ctx

            signedByBeneficiary :: Bool
            signedByBeneficiary = txSignedBy info $ _pkh param

data Lock
instance Scripts.ValidatorTypes Lock where
    type instance DatumType Lock = ()
    type instance RedeemerType Lock = ()

typedValidator :: PayParam -> Scripts.TypedValidator Lock
typedValidator param = Scripts.mkTypedValidator @Lock
    ($$(PlutusTx.compile [|| mkValidator ||]) `PlutusTx.applyCode` PlutusTx.liftCode param)
    $$(PlutusTx.compile [|| wrap ||])
  where
    wrap = Scripts.wrapValidator @() @()

{-# INLINABLE validator #-}
validator :: PayParam -> Validator
validator = Scripts.validatorScript . typedValidator

{-# INLINABLE valHash #-}
valHash :: PayParam -> Ledger.ValidatorHash
valHash = Scripts.validatorHash . typedValidator

{-# INLINABLE scrAddress #-}
scrAddress :: PayParam -> Ledger.Address
scrAddress = scriptAddress  . validator

--------------------------

{-# INLINABLE thePkh #-}
thePkh :: PubKeyHash
thePkh = pubKeyHash $ walletPubKey $ Wallet 2

{-# INLINABLE theVal #-}
theVal :: Value
theVal = ADA.toValue (ADA.Lovelace 3_000_000)

give :: Contract () PaySchema Text ()
give = do
    let param = PayParam thePkh theVal

    let tx = mustPayToTheScript () theVal
    ledgerTx <- submitTxConstraints (typedValidator param) tx

    -- also works fine
    -- let tx = mustPayToOtherScript (valHash param) unitDatum theVal
    -- ledgerTx <- submitTx tx

    void $ awaitTxConfirmed $ txId ledgerTx
    logInfo @H.String "\ngive"

grab :: Contract () PaySchema Text ()
grab = do
    let param = PayParam thePkh theVal

    utxos <- utxoAt $ scrAddress param
    let lookups = Constraints.unspentOutputs utxos <>
                  Constraints.otherScript (validator param) <>
                  Constraints.typedValidatorLookups (typedValidator param)

    let orefs = fst <$> Map.toList utxos

    let tx :: TxConstraints () ()
        tx = PlutusTx.Prelude.mconcat [mustSpendScriptOutput oref unitRedeemer | oref <- orefs]

    ledgerTx <- submitTxConstraintsWith @Lock lookups tx
    awaitTxConfirmed $ txId ledgerTx
    logInfo @H.String "\ngrab"

type PaySchema =
    Endpoint "give" ()
        .\/
    Endpoint "grab" ()

endpoints :: Contract () PaySchema Text ()
endpoints =
    forever
        $ handleError logError
        $ awaitPromise
        $ give' `select` grab'
            where
                give' = endpoint @"give" $ const give
                grab' = endpoint @"grab" $ const grab

trace12 :: H.IO ()
trace12 = Emu.runEmulatorTraceIO $ do
    h1 <- Emu.activateContractWallet (Wallet 1) endpoints
    h2 <- Emu.activateContractWallet (Wallet 2) endpoints
    void $ Emu.waitNSlots 5
    Emu.callEndpoint @"give" h1 ()
    void $ Emu.waitUntilSlot 10
    Emu.callEndpoint @"grab" h2 ()
    void $ Emu.waitUntilSlot 15

trace13 :: H.IO ()
trace13 = Emu.runEmulatorTraceIO $ do
    h1 <- Emu.activateContractWallet (Wallet 1) endpoints
    h3 <- Emu.activateContractWallet (Wallet 3) endpoints
    void $ Emu.waitNSlots 5
    Emu.callEndpoint @"give" h1 ()
    void $ Emu.waitUntilSlot 10
    Emu.callEndpoint @"grab" h3 ()
    void $ Emu.waitUntilSlot 15

plutus commit: plutus-starter-devcontainer/v1.0.7

So why must I also invoke the grab endpoint for Wallet 2 (trace12)? What
changes if instead it's invoked for Wallet 3 (trace13)?

You must invoke it in order to receive funds that are locked in the contract (via give endpoint).
If you invoke grab endpoint on Wallet3, you would no receive anything from the script, because wallet3 is not beneficiary of this vesting contract. You can see that in the logs you posted for trace12 where wallet2 has more ada than in the beginning (102996448) and for trace13 where wallet3 has default initial amount of ADA 100000000, but there are funds locked on Vesting script

Script 3f3c25dfdfad56d6f08d6d3e8bec53ab14d1950be944bc0ed26957c6:
{, ""}: 3000000

which can only be unlocked/claimed (grab-ed) by wallet2 who is beneficiary of contract (defined as param thePkh in give endpoint)

Why is that? And what does it mean to invoke an endpoint for a wallet altogether?

I've explained why above. And for what does it mean to invoke endpoint for a wallet. It just means that you call that contract's offchain endpoint, which creates transaction for that contract/script with specific params and constraints, signed with that wallet's private key.


text:
Spare computer with Yoroi or Daedalus as pseudo cold wallet v. Ledger
Am running through my mind the pros and cons of storing Ada on a spare computer disconnected from the network, not happy with being connected to the Internet 24/7 despite being behind firewall.
Apart from the inconvenience (due to physical size) of storing on a spare wiped and reinstalled computer, what are the security implications versus something like the Ledger cold wallet? Seems to be a few grey areas in that regard.
The computer would be disconnected from the network when not doing transactions but obviously does not have the physical as well as logical separation which something like the Ledger provides. On the other hand, Yoroi sandboxing provides a good level of security, and that coupled with a clean install, a dedicated computer would possibly suffice. Would there be advantages in installing Daedalus in this situation?
Any thoughts on this much appreciated.

The question is, is it worth the trouble instead of spending $70 for a warranted and battle tested hardware wallet?
My answer to your post is that is probably not, if you are not doing anything specific that a hardware wallet can't do (like minting NFTs).

I've done something similar on a Virtual Machine. I have a Linux based operating system for additional security.
Doing as you propose is basically the same as using a Ledger/Trezor. The additional risk with your setup is that you have your wallet on a computer that can run additional code that a hardware wallet can not. Every time you connect it to the internet and run code on it, you are presenting a security risk.
One possible risk I face from running Linux is that when I update my OS I download an app that's been compromised and can somehow run code to steal my funds.
Over using Yoroi and Daedalus, Daedalus is considered the safer option. But in a practical sense, they're as safe as each other and it's only in theory or extreme situations that Daedalus is safer.
The risks between these setups I believe is rather minimal. One advantage of having a big clunky PC is that you can't lose it easily, so at least you always know where it is as a convenience.

I built a fully offline Raspberry Pi solution on another coin years ago using QR codes, and cameras as readers.
Cardano is similar in the fact that you 1. build a transaction, 2. sign a transaction and then 3. broadcast a transaction.  Only the signing part needs access to your keys.
As an early step just transferring the data from step 1 to the computer, and then back after step 2 on a small USB stick would allow you to keep your computer fully offline, you would need to learn to construct raw-transactions in a cardano-node CLI.
If this is really of interest look at the Zymbit HSM6 which is a way to encrypt a Raspberry Pi and it has access to common cryptocurrency key schemes, though I didnt check for compatibility with Cardano.
EDIT: Found my old code, it was never meant for production use, just a fun project, but it gives you a start: https://github.com/Scalextrix/coinofflinewallet

This is similar to what I do with an airgap system, the main difference is the airgap system I use is never connected to the network and only signs transactions. I have a live USB stick that only uses Internet when iso is built, can import a wallet mnemonic via https://github.com/input-output-hk/adawallet, and I build transactions on-line using rosetta to query utxos, then sign on the offline system sneaker netting a usb stick back and forth.

source: Stack Exchange

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

sort: votes


text:
Funding emulator wallets with custom currencies
How exactly can I fund the emulator wallets with custom currencies?
Please show an emulator example doing so.

Here's an example:
import Data.Default (def)
import qualified Data.Map as Map
import qualified Ledger.Ada as Ada
import qualified Ledger.Value as Value
import Wallet.Emulator.Wallet (Wallet(..))
import Plutus.Trace.Emulator (EmulatorTrace, EmulatorConfig(..), runEmulatorTraceIO',
                              activateContractWallet)

main :: IO ()
main = do
  let dist = Map.fromList [ (Wallet 1, Ada.lovelaceValueOf 100_000_000
                                    <> Value.singleton "ffff" "mytoken" 10)
                          , (Wallet 2, Ada.lovelaceValueOf 25_000_000)
                          ]
      emCfg = EmulatorConfig (Left dist) def def
  runEmulatorTraceIO' def emCfg myTrace

In summary, Wallet 1 starts of with 100 ADA, and 10 tokens with currency symbol ffff and token name mytoken. Wallet 2 simply starts with 25 ADA.
The Auction use-case example demonstrates that.

Thanks, but I didn't find as such in the example you pointed to.

Is there a way to show the final fine-grained distribution of Value amongst all the wallets (i.e., all the various currencies)?

If you mean the distribution of Value for all the wallets at the end of emulation, then the answer is that you don't need to do anything more than the example above. The function runEmulatorTraceIO prints the distribution for all wallets in the terminal at the end of emulation.

12/2022, plutus-apps v1.0.0 update on the accepted answer.
Wallet 1 is not working anymore. You can use knownWallet 1.
Or you can import Plutus.Contract.Test (w1, w2) and then use w1 , w2 as your simulated wallets.
Also EmulatorConfig has 2 components, not 3. So it is:
emCfg = EmulatorConfig (Left dist) def
BTW I get error when setting initial state with custom currencies.

the easier way I found:
dist = Map.fromList [ (wallet 1, Ada.lovelaceValueOf 1_000_000_000 ) -- treasury
                        , (wallet 2, Ada.lovelaceValueOf 1_000_000_000
                            <> Value.singleton yacadaNFTSymbol  (U.giveReferralNFTName )  15) -- referral

in : https://github.com/cmorgado/yacada_learning

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


text:
Confusion with cardano db sync schema and UTXO model
I am confused with the tx_in and tx_out schema on Cardano dbsync and the transaction process as a whole. For example:
Alice has 10000 ADA distributed as 3000, 5000 and 2000 ADA in three different EUTXOs. If she wants to send 6000 ADA to Bob then she can sends two EUTXOs to Bob, e.g. 5000 and 2000 ADA (total 7000 ADA) and receives a new EUTXOs of 1000 ADA back, right?.
For Alice, are those 7000 ADA stored in the tx_out table and the 1000 ADA in the tx_in table? Will she get the 1000 ADA back into the same address or a different one? If she receives the 1000 ADA back to a different address, will the same transaction block contain both transaction, i.e. address used to send ADA to Bob and the other address used to receive ADA back? Will they have the same transaction id?

Thanks for your question.

send about 6000ada to bob then he sends the two UTXOs to bob i.e. 5000ada and 2000ada (total 7000 ada) and he receives a new UTXOs of 1000ada back, right?

Correct. For regular transactions, the sum of the transaction inputs values must match the sum of the outputs (This isn't strictly true, as there are fees and the possibility to create native assets in a transaction too)

for alice, is not 7000ada stored in tx_out table and 1000ada in tx_in table?

Correct. A total of 7,000 ₳ would appear in Alice's tx_out and 1000 ₳ in Alice's tx_in, while Bob would see just the outputs of 6,000 ₳ - balancing the transaction inputs and outputs.

Will the receiver(alice) get the 1000ada back to same address or different?

Alice will receive the change to the same address which created the transaction.

Will they have the same transaction id?

Yes, any given transaction can have multiple inputs and multiple outputs.
If you want a patiently presented video that describes the model in an adequate amount of details, I'd recommend The first lecture in the Plutus Pioneers program.

One more thing to add maybe, Alice doesn't "send" the transactions to Bob, they're marked as "spent" and 2 completely new EUTXOs are crated: one with 6000 ADA and the other with 1000 ADA


text:
HELP NEEDED Block producer blocked by DigitalOcean - recover ADA?
can someone please help me? I had just started setting up my stake pool, using DigitalOcean droplets to host the block producer & relay nodes. All was going really well. Then, for some crazy reason that has still not been explained to me, DigitalOcean blocked my account and refuses to give me access. So now I can no longer access the block producer. Fortunately, I copied all keys, certificates etc, payment address, but I cannot find how to recover the ADA that I had pledged to my stake pool. I would also like to know if anyone could also explain how to retire the stake pool after I recover my funds. Any help would be much appreciated and please, if you’re using DigitalOcean, please be careful they don’t do this to you. Thanks in advance, Simon

If you had copied your keys there will be no loss of funds. Please edit your question to include the methods followed by you to install the node and the keys you have in your possession. Do not give out the content of key files to anyone.

if you have all your keys, you can start locally a node. When the node is synced, deregister your pool with cardano-cli by submitting a transaction with a deregistration-certificate created by the command cardano-cli stake-pool deregistration-certificate [...]
You don't have to recover the funds you pledged because you never lost control of your funds : you still have the signing key of the pledge owner address, do you ?
If you want to transfer your funds, you can create a wallet on Daedalus or Yoroi, and submit locally a payment transaction to transfer your pledged ADAs to this wallet. Be careful : sign the transactions offline.
Edited : gave more informations on the way to de-register a pool

Thank you so much for your help. When you mention the "signing key of the pledge owner address" you mean the payment.skey, is that correct? Thanks once again

yes, the payment.skey file

Hi, just to let you know, I followed your suggestions but actually spun up a new service using linode, copied all the files, synchronized, and now everything is up and running fine. Thanks again and thanks so much for your help, greatly appreciated


text:
Convert Plutus Address Credential to real-net address
So in Plutus we have the Address type which has two constructors ScriptCredential which is a ValidatorHash or PubKeyCredential which is a PubKeyHash but all these are not encoded in the same way as addresses on the alonzo testnet or any other real net.
I'm using the script Alwayssucceed from the Alonzo-testnet repo.
When we compile it to .plutus and build its address in cli we get addr_test1wpnlxv2xv9a9ucvnvzqakwepzl9ltx7jzgm53av2e9ncv4sysemm8
But in Plutus if we display its Address we get a totally different output. This is what I tried because Cardano addresses are encoded in bech32.
import Data.ByteString.Base16 as B16
import Codec.Binary.Bech32 as B32

valhash :: Maybe Plutus.ValidatorHash
valhash = toValidatorHash $ scriptAddress validator

transform :: IO ()
transform = let Right prefix = humanReadablePartFromText "addr_test1" in
  case valhash of
    Nothing -> print @String "Nothing"
    Just vhash -> case vhash of
      Plutus.ValidatorHash vhashbs -> print $ B32.encode prefix (dataPartFromBytes $ fromBuiltin vhashbs)

Output : addr_test11xpnaff4z2xn3szgf8z6a2txju6dnsmsar22h2fnmvf7hyx8lpvw
Someone suggested here that in Plutus these Addresses are encoded in Base16, but B16.decode $ fromBuiltin vhashbs returns that it isn't a Base16 encoded bytestring.
My question is, is there a way to convert Plutus addresses to real Cardano addresses? Or will they understand each other when off-chain support (PAB) comes to real blockchains?
Thanks

Have you managed to solve this?

I think the question does not make much sense actually, we can convert from .plutus to bech32 and that's enough, I think when you convert to Address you put it in the format for the Emulator, it is not linked to real net, but honestly I don't know. Currently I'm looking at how to get the right ValidatorHash from the validator, still no clue. This conversion process is very unclear (what format does plutus understand, what format is to be passed on the blockchain...)

Check here please:
https://cardano.stackexchange.com/a/8808/6196
I answered a similar question in a different post


text:
Difference between Ouroboros' Proof of Stake and Solana's Proof of History
What are the key differences between Ouroboros' Proof of Stake and Solana's Proof of History in aspects such as security, decentralization, functionality, efficiency (such as number of transactions per second) and energy use? Are there published papers or articles which compare the two?

https://eprint.iacr.org/2016/889.pdf https://medium.com/solana-labs/proof-of-history-a-clock-for-blockchain-cf47a61a9274 the answer would be found by reviewing the two papers and comparing the two i havent read through either yet but will and post my personal opinion about the two

I think it's too early to talk about security and efficiency of Solana's Proof-of-History consensus (it creates a historical record that proves that an event has occurred at a specific moment in time) which works with Proof-of-Stake mechanism and its additional layers (protocols) but some obvious things are written in a White Paper.
Here's an excerpt from white paper:

The combination of Proof-of-Replication and Proof-of-History provides a defense against forgery of the ledger with respect to time and storage. The protocol is analyzed on a 1 Gbps network, and this paper shows that throughput up to 710,000 transactions per second is possible with todays hardware. The average transaction fee in Solana blockchain is $0.00025.

As you know, when Hydra will be implemented in Cardano, the network can process up to 1,000,000 transactions per second. The average fee for a transaction in Cardano is approximately 0.15 ADA.
Both, Solana and Cardano support smart contracts. Both networks are energy-efficient (it's hard to say which one consumes less energy). Both are fully decentralized, and both are rapidly developing.
P.S.
And a few words about network's reliability. Today Bloomberg reported at 6:40 p.m.: Solana’s blockchain network has stopped processing transactions.


text:
Getting a "Yaml file not found" error when trying to run cardano-node
Following the instructions here on running cardano-node:
https://developers.cardano.org/docs/get-started/running-cardano
I'm running into an error on startup that looks like this:
InvalidYaml (Just (YamlException "Yaml file not found: /path/to/testnet/testnet-config.json"))
Do the configuration files have to be Yaml formatted?

JSON is a proper subset of YAML, so JSON is okay. Are you using the standard testnet config downloaded from here? It is best to wget it.

My stupid mistake, I didn't check the json files and they're improperly formatted.  Thank you!


text:
Why are cardano-cli generated payment addresses shorter than those from Yoroi or Daedalus?
Why are addresses generated by cardano-cli shorter than those generated by Yoroi or Daedalus?
The addresses produced by running
cardano-cli address build

are 58 characters including the "addr" prefix while those from Yoroi and Daedalus are 103 characters.
Are there any cases where these types of addresses are not interchangable?
Is there a way to get the cli to generate an address similar to Yoroi and Daedalus?
Thanks!
Shawn

The first part is a 'payment address', which you're seeing on Yoroi and Daedalus combined with a 'staking address' (cardano-cli stake-address build ...).  If you look at your receiving addresses on those apps you will notice that they all end the same, indicating use of the same staking address for all of them (in the current implementations).
The Cardano-cli gives lower-level access to the finer details of Cardano operations than the wallets.

There seems to be a word missing between the first two words of your answer: "The [?] is ..."

thanks, I re-worded it

It is possible to extend a payment address using cardano-addresses to get a similar one as generated by Yoroi or Daedalus.
See also cardano-address address delegation --help for an example.


text:
When will k parameter be changed?
Is there any news on when k=1000 will happen?

How do you know that it will happen?

Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.

https://iohk.io/en/blog/posts/2020/11/05/parameters-and-decentralization-the-way-ahead/
"As a result, our aim is to move to k=1,000 during March 2021. We recognize the importance of economic factors that also strongly influence pool profitability and will continue to consult widely with the community on the plan; the social dynamics of the network should also not be underestimated."

this really isn't a question for stack exchange.

Epoch 234
On December 06th 2020, IOHK increased the k parameter from 150 to 500. This affected the optimal number of pools in the Cardano network. This change lowered the saturation point for stake pools from 220M ada to 64M, resulting in the loss of some rewards in oversaturated pools.
Epochs 300...320 ?
At the moment there are >3000 stake pools. The Cardano network reached full decentralization and, apparently, very soon, the k parameter will be set to 1000, which will lead to a decrease in the saturation point from 64M to 32M per pool.
k=1000
I think that you don't need to redelegate your stake at the last moment (when k will be changed). You are free to pick a new stake pool below 32M and you will not miss any rewards.


text:
Is there a way to look up for a new payment address with a given payment address?
Given a payment address, is it possible to generate or query the blockchain, using cardano-graphql, cardano-cli, plutus or by other means, so as to obtain a new payment address (unused) for the same wallet?
This is to be achieved without requiring the payment verification key of the receiving wallet.
Illustration of my use case:
Say, a third party has a wallet and I was given one of the payment addresses of that wallet, address1 = addr1apq...
Now, I want to obtain an unused payment address, address2 for this wallet using the address1 above and make payment to it. Is there a way to do that?

No, you would need a extended public key (xPub) for that. You can grab one (account xPub) from Daedalus or derive it using cardano-addresses.


text:
Best setup of your air-gapped offline machine (cold environment)?
What setup are you using for your air gap machine? Did you buy specific hardware, or some old pc laying around? If reusing some of your old hardware did you wipe it before using it again?
Im looking for a cheap solution. I also read that it is possible to use a hardware wallet to create your cold keys. Any experiences with this? And how would you technically do this?

I use a Chromebook with Arch for storing all kind of sensitive data, cheap and powerful enough to do the work gracefully

The way that I choose is to use a live USB with Tails OS and a persistent encrypted storage.
Once Tails OS is installed, you can decide to boot it without network connection or as they call it "Offline mode". Tails also supports OpenPGP, so if you want to be extra secure and encrypt your keys/recovery phrases with a YubiKey or something similar you can do it.
The only hardware that you need are 2 USBs with at least 8GB, one for main usage and one for backups.
If you need help on setting up this solution just let me know, I am here to help.
Edit:
If anyone is interested, I've created a guide on setting up this solution, you can find it here.
If you have any improvements just let me know, I will be happy to make it better over time :-)

That sounds like a very interesting solution! on the backup, you just store your key files, right? or do you also install tails there?

I wouldn't store my backups for private key/recovery phrases files in an unencrypted usb, so I have 2 solution for this, one to install Tails also on the secondary usb, the other one is to use an encrypted usb like this one. There are many of this usbs arround, but with the second solution costs go up. There is a really good video made by Charles Hoskinson where he explains how to store your private key/recovery phrases. I took inspiration from there.

Secure Airgapping
This topic deserves an in-depth guide, which I will begin working on and will link to it as soon as I complete it. For now, I hope the following gives a high level overview of what I use: an ultra-paranoid, pain-in-the-ass, peace-of-mind setup for key storage and transaction signing
Note: Physical access to the machine is kept under strictly authorized access only. If done correctly, the only way to compromise this setup's security is through unauthorized physical access. Any such access will therefore be considered catastrophic, so keep the machine hidden and secure!

The Setup
Step 1: Acquire an old/used laptop and REMOVE the wifi card. This will require unscrewing the back cover and performing a little surgery, but this way there can be no question about wireless attacks.
Step 2: Download the latest Ubuntu Server LTS and flash it onto a USB stick. I also recommend downloading and re-flashing the BIOS for the machine. This is to rid the machine of any (potential) rootkit/BIOS level malicious software. Be careful with this step; doing it improperly can brick the computer.
Note: ALWAYS verify your downloads through PGP and/or SHA checksums.
Step 3: During Ubuntu installation, choose the minimal installation and select full disk encryption. When selecting the password, I recommend a salted static yubikey OTP. You can then use the same salt as the sudo password for the OS.
Step 4: Establish a one-time network connection using an ethernet/USB port to download all necessary software. This will be the one and only time the machine will be exposed to the internet, prior to any key generation.
Step 5: Download all necessary software: ubuntu updates, git, cardano-cli, cardano-wallet (optional, but recommended if you want to generate mnemonic-style keys). qrencode is also highly recommended. If building from source, you'll also need all prerequisite software like git and such. Depending on the machine's specs you may want to install pre-compiled cardano binaries instead of building from source.
Step 6: Terminate the network connection and (for peace of mind) disable all networking interfaces in the OS and/or BIOS. Never connect to any network again.

Inputs and Outputs
You are now ready to generate keys with cardano-cli. Once this is done, there are two options for inputting transaction bodies for signing:

Use a hardware encrypted USB that has write-protection feature. I recommend the Apricorn Aegis NX. Draft transactions on a hot machine, transfer to the Aegis, turn on write protection, and plug into the airgapped machine. This way, even if a malicious payload finds its way into the airgapped machine, there would be no way to exfiltrate the data.
Manually enter the cborHex of the transaction body into the airgapped machine. Use a JSON template so all you have to do is manually type the cborHex. This is the biggest pain of the setup (if you choose to do this), but it makes the system truly airgapped.

For outputting signed transaction bodies, use qrencode to generate qr images in the command line, and use a phone camera to extract the image contents. If the signed tx body is too large to fit into a single qr image, use the split command to break up the file into multiple smaller files and QR each file sequentially.
Note: ALWAYS backup any keys generated on another secure USB drive and/or a paper wallet.

I will expand on this guide on github and will link to it as soon as I feel it is ready. Hope this helps for now!


text:
Starting a Node Startup Help
The team and i have decided to start a node in the Cardano ecosystem.
we have mac book pro with m1 chip that meets the requirement and ubuntu installed but having problems with rufus for some reason can anyone help me get this going.
any info will be appreciated im sure in some way or another

Please try to put some information regarding the specific error so we can help you out

If this is still a topic for you may look at the cnTools guide and framework to setup your Stakepool Relays and BlockProducer
https://cardano-community.github.io/guild-operators/


text:
Find PubKeyHash from String
Given the variable s from
import qualified Wallet.Emulator.Wallet as W
import qualified Ledger

-- Has value of "35dedd2982a03cf39e7dce03c839994ffdec2ec6b04f1cf2d40e61a3"
s :: String
s = show (Ledger.pubKeyHash $ W.walletPubKey $ W.Wallet 1)

How do I turn that back into a PubKeyHash?

module Main ( main) where

import           Data.String (IsString(fromString))
import           Data.Either (fromRight)
import           Data.Text (Text, pack)
import           Ledger (PubKeyHash(..), pubKeyHash)
import           Ledger.Bytes (LedgerBytes(LedgerBytes), fromHex)
import qualified Wallet.Emulator.Wallet as W

main :: IO ()
main = do
    let pkh1 = pubKeyHash $ W.walletPubKey $ W.Wallet 1
    let pkh9 = pubKeyHash $ W.walletPubKey $ W.Wallet 9

    let s = show pkh1
    let eiPkh = pkhFromStr s

    let s' = show $ fromRight pkh9 eiPkh
    let eiPkh' = pkhFromStr s'

    let s'' = show $ fromRight pkh9 eiPkh'

    print s
    print s'
    print s''

pkhFromStr :: String -> Either Text PubKeyHash
pkhFromStr s =
    case fromHex (fromString s) of
        Right (LedgerBytes bytes) -> Right $ PubKeyHash bytes
        Left msg -> Left $ pack ("Could not convert from hex to bytes: " <> msg)

The above code produces the following correct outputs.
"35dedd2982a03cf39e7dce03c839994ffdec2ec6b04f1cf2d40e61a3"
"35dedd2982a03cf39e7dce03c839994ffdec2ec6b04f1cf2d40e61a3"
"35dedd2982a03cf39e7dce03c839994ffdec2ec6b04f1cf2d40e61a3"


text:
How to run Plutus code on Alonzo Purple without the PAB?
I am trying to run my Plutus code on Alonzo Purple. However, the PAB currently isn't able to connect to the Alonzo Purple testnet.
Since the off-chain code lives in the Contract monad, do I need to somehow write code to 'interpret' the Contract monad and issue commands against the wallet and node?
Is there some example code to look at?

For now, and until we have tools for it (the PAB for instance), you have to write your off-chain code as CLI transactions, which is obviously not ideal but the only solution at the moment.
I suggest going through the exercises of the Alonzo-testnet to learn how to interact with Plutus scripts using cardano-cli.
The PAB is under heavy development but we don't have any release date for either the testnet or the mainnet.

What does 'write off-chain code as CLI transactions' mean? I understand that I'll have to call the cardano-node/cardano-cli/wallet to submit transactions and query the blockchain and what not. However, the off-chain code lives in the Contract monad. So, do you think I also need a layer to interpret the effects from the Contract free monad into the CLI? If so, is there any code examples I can take a look at?

No, there is no interpreter for now. What I mean by CLI transactions is, whatever off-chain code you have in your Contract monad you can re write it as a CLI transaction (because off-chain is nothing more than transactions). I suggest looking into the docs of cardano-cli and through the exercises of the Alonzo-testnet.

I looked at the Alonzo-testnet exercises but those pages are just an outline of exercises.  There was no detail and no step-by-step instructions.  Am I missing something?  I will be honest here - trying to learn this is becoming an exercise in frustration due to a lack of quality documentation.

Exercises are meant to have holes, if you want step-by-step check Alonzo-solutions. The documentation is lacking but we have to accept it and keep digging it ourselves.


text:
Historic and Real-Time Data on Cardano Blockchain in csv or json format
I am conducting some research on Cardano and would like to know if there's any historic and real-time information (on daily basis or more granular) for the below area in json or csv format:
(1) Number of wallet addresses (total unique address and active address)
Note: Active address means addresses that made one or more on-chain transaction(s) on a given day.
(2) Daily transaction value (in ADA and USD value)
(3) Daily number of transaction
(4) Total value staked/locked (TVL)
(5) Number of Dapps built on the blockchain
(6) Transaction fees.
(7) Number of stake pool operators
(8) Average staking return (annualized %)
(9) Block time (s) and transaction per seconds (tps)
I figured it'll be nice to have all the above metrics listed on a website so we can track the status easily. Appreciate if you can share with me if you have the sources for anyone of the above metrics. Thank you in advance.
Cheers

Pull this data from the PostgreSQL database associated with DB-Sync, or GraphQL
Pull exchange data.
See 1.
See 1 & note that delegating stake does not lock ada.
Check back after the 12th of September.
Tx Fees currently depend on: https://docs.cardano.org/explore-cardano/fee-structure#gatsby-focus-wrapper
See 1
See 1
You can calculate the average values via the data in 1.
Please have a look at https://bi.stakepoolcentral.com/ and if you have different metrics than what they offer you could reach out to them to collaborate.


text:
Stake Pool Saturation and Rewards changes
Problem Statement: Currently, when delegators delegate to a stake pool, it is done via Yoroi or Daedalus. However, if the stake pool becomes saturated or if the SPO changes the rewards percentage, the delegator would not be aware. Expecting the delegator to constantly check on these is also not entirely realistic, given that some just want to buy, stake and hold.
Question: How will existing delegators know if their stake pool is saturated or if the rewards allocated have changed, if they don't monitor it regularly?

To receive notifications about the changes of the margin of a pool you can use the ADApools.org application (iOS/Android). You can find the pool that you delegated to and then by turning on the notifications, you can check "margin changed".
There are other notifications but not the one of a saturated pool. Maybe they will implement this in the future.
Another way to do what you asked is to use the Telegram Bot, where you can add the pool that you want to monitor and receive notifications about changes, including the saturation of a pool.

The Telegram bot is an awesome tip. Thanks!


text:
What ensures that the supply of ADA is finite, so ADA can definitely be regarded as a store of value?
45 billion is the total eventual supply of ADA (up from from 32 billion or so in circulation now, of which over 71% is staked).
What elements of the code of the Cardano protocols and the structure of the ecosystem ensure that 45 billion is the maximum number of ADA that will ever be in circulation, and when will that maximum be available in circulation for all purposes such as staking etc?

As for the 45 billion ADA it's defined in the genesis JSON file, search for the field "maxLovelaceSupply"

You cannot guarantee that the supply is constantly 45 billion Ada for all eternity, however; you can say with certainty that this particular version of code doesn't support increasing the supply. At some point in the future, the majority of block producing nodes (SPOs) could fork the code base and increase the supply with a future hard fork, but that's the case with any decentralized blockchain.


text:
Building Cardano Wallet
Guys I'm having some error when building cardano-wallet
Error: Could not load module ‘System.Random.Internal’ when building from source.

Edit: I just followed the tutorial on developers.cardano.org
Found the same issue here: https://github.com/input-output-hk/cardano-wallet/issues/2824

To fix this issue you need to run:
git clone https://github.com/input-output-hk/cardano-wallet.git
cd cardano-wallet
git fetch --all --recurse-submodules --tags
git checkout tags/v2021-09-09
cabal configure --with-compiler=ghc-8.10.7 --constraint="random<1.2"
cabal build all -frelease


text:
How to make payment to a payment address using Plutus?
In Plutus, Ledger.Constraints has the following Constraints
mustPayToOtherScript,
mustPayToPubKey,
mustPayToTheScript,
Is there a similar constraint that can used send funds to a payment address in Daedalus or Yoroi wallets, using Plutus?
None of the above there constraints deal with payment addresses the way I understand.

Should one of the answers be marked as accepted?

To pay to a full address, you can use mustPayToPubKeyAddress pkh skh v
This is not using the bech32 format though. You still need to decode the bech32 string into the public key hash (pkh) and the stake key hash (skh).

It's the mustPayToPubKey fn. It takes the hash of the public key of the wallet.
From the validator fn:
let tx = mustPayToPubKey (ppRecipient pp) $ lovelaceValueOf $ ppLovelace pp

where pp is constructed in the off chain code like this (note the use of pubKeyHash fn):
payTrace :: Integer -> Integer -> EmulatorTrace ()
payTrace x y = do
    h1 <- activateContractWallet (Wallet 1) payContractOfficialSolution
    s0 <- Emulator.waitNSlots 1
    Extras.logInfo $ "reached slot " ++ show s0
    callEndpoint @"pay" h1 $ PayParams
        { ppRecipient = pubKeyHash $ walletPubKey $ Wallet 2
          , ppLovelace      = x
        }
...

This is all from the week04 of the Plutus Pioneer Program iteration 1.


text:
How to get all NFTs of a wallet address?
I'm trying to retrieve all assets which are located at the specific wallet address, I queried through the docs but couldn't find anything suitable.
Can anybody provide me some help regarding this please?
What I'm trying to do is, let the user enter his wallet address and showcase him his NFTs in the web. If something like this is not doable please correct me.

Try pool.pm/address

@Distic im trying to do it through an official api, and i dont think its okay to fetch their html data and grawl it

Sorry I read it too fast

You can try using cardano-wallet package on a running node & then using this endpoint to list all assets on a wallet.
There are several ways to run cardano-wallet either a docker container or just installing the compiled binary on a running node which is what I did. You can find the binary here as well as the documentation under the note section.

Try the /accounts/{stake_address}/addresses/assets call using Blockfrost.

There is a tutorial/examples on how to achieve it using blockfrost.
Nft tutorial on Cardano


text:
Test node failure
I successfully setup a testnet node over the weekend, all was running fine - I was able to create wallets and perform transactions etc.
However when I try to run the node today I am getting some errors, I haven't changed any config, I literally just turned the machine off and when I booted back up it didn't work (see error at the bottom)
I have downloaded the latest config files, I also deleted some data from the immutable folder in /db  - it synced up again but then gave the same error
I hope someone can help, many thanks in advance.
Environment
Ubuntu 18.04.5 LTS (Bionic Beaver)

cardano-node 1.27.0 - linux-x86_64 - ghc-8.10
git rev 8fe46140a52810b6ca456be01d652ca08fe730bf

cardano-cli 1.27.0 - linux-x86_64 - ghc-8.10
git rev 8fe46140a52810b6ca456be01d652ca08fe730bf

cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library

The GHCup Haskell installer, version v0.1.16.2

Startup command
cardano-node run \
   --topology /home/adam/dev/cardano-node/relay/testnet-topology.json \
   --database-path /home/adam/dev/cardano-node/db \
   --socket-path /home/adam/dev/cardano-node/relay/node.socket \
   --host-addr 127.0.0.1 \
   --port 1337 \
   --config /home/adam/dev/cardano-node/relay/testnet-config.json

Errors
[HPE-LX-M:cardano.node.ErrorPolicy:Notice:824] [2021-09-01 23:23:22.35 UTC] IP 3.129.133.68:3001 ErrorPolicySuspendConsumer (Just (ConnectionExceptionTrace (SubscriberError {seType = SubscriberParallelConnectionCancelled, seMessage = "Parallel connection cancelled", seStack = []}))) 1s
[HPE-LX-M:cardano.node.DnsSubscription:Error:1037] [2021-09-01 23:23:22.55 UTC] Domain: "relays-new.cardano-testnet.iohkdev.io" Application Exception: 18.132.238.21:3001 MuxError (MuxIOException Network.Socket.recvBuf: resource vanished (Connection reset by peer)) "(recv errored)"
[HPE-LX-M:cardano.node.ErrorPolicy:Warning:824] [2021-09-01 23:23:22.55 UTC] IP 18.132.238.21:3001 ErrorPolicySuspendPeer (Just (ApplicationExceptionTrace (MuxError (MuxIOException Network.Socket.recvBuf: resource vanished (Connection reset by peer)) "(recv errored)"))) 20s 20s
[HPE-LX-M:cardano.node.DnsSubscription:Error:1035] [2021-09-01 23:23:22.69 UTC] Domain: "relays-new.cardano-testnet.iohkdev.io" Application Exception: 3.124.178.139:3001 MuxError (MuxIOException Network.Socket.recvBuf: resource vanished (Connection reset by peer)) "(recv errored)"
[HPE-LX-M:cardano.node.ErrorPolicy:Warning:824] [2021-09-01 23:23:22.69 UTC] IP 3.124.178.139:3001 ErrorPolicySuspendPeer (Just (ApplicationExceptionTrace (MuxError (MuxIOException Network.Socket.recvBuf: resource vanished (Connection reset by peer)) "(recv errored)"))) 20s 20s

Out of mere curiosity, why 1.27.0 and no 1.29.0?

Today the Alonzo hardfork was done on the Testnet, you should update your cardano-node and cardano-cli to version 1.29.0.

I had the same error. I don't know exactly what this is about. But I just deleted the whole db folder and created node.socket again. Resync, then it's back

Thanks all, I will update later and try again and let you know how it goes

All sorted, thanks for the heads up; guess I'd better start keeping up with the updates!


text:
Error with cabal build using plutus-starter-devcontainer on macOS Big Sur
I'm working to set up the plutus-starter-devcontainer integration with VSCode.
Dev Environment:

macOS Big Sur 11.5.2
Docker Desktop 4.0.0

Following the instructions from here: https://github.com/input-output-hk/plutus-starter
Running on a new machine without GHC or Stack installed, I created ~/.cabal/packages directory on my machine.
After running a cabal update, the cabal build command generates the following error:
cabal: Failed to build prettyprinter-configurable-0.1.0.0 (which is required
by test:plutus-example-projects-test from plutus-starter-0.1.0.0 and
exe:plutus-starter-pab from plutus-starter-0.1.0.0). The failure occurred
during the configure step. The exception was:
dieVerbatim: user error (cabal:
'/nix/store/3jdnjxxb855s6q7n01d7p3ivzr1l36r9-ghc-shell-for-packages-ghc-8.10.4.20210212-env/bin/ghc'
exited with an error:
/nix/store/qvv5y4fx4x879rbsbs4g27mypl9wxbb9-gcc-wrapper-10.3.0/bin/ld: line
256: 9581 Killed
/nix/store/hy3lz2vfv9qq2v5jz9nzlx6mmiaq79rj-binutils-2.35.1/bin/ld
${extraBefore+"${extraBefore[@]}"} ${params+"${params[@]}"}
${extraAfter+"${extraAfter[@]}"}
collect2: error: ld returned 137 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
)

Any help much appreciated.

My suggestion would be to report a bug in https://github.com/input-output-hk/plutus/issues

Thanks @kolam. This issue went away after updating to VSCode 1.60.0 and increasing the Docker Memory resource limit to 6GB.

This issue was resolved by updating VSCode to August 2021 release (v1.60.0) and increasing Docker Memory to 6GB.


text:
How do i resolve this cabal error for cardano-node install?
I followed the Linux tutorial at
https://developers.cardano.org/docs/get-started/installing-cardano-node
and I am getting the following error when I run cabal build all
Unrecognized stanza on line 139
/home/xxx/.cabal/config: Unrecognized field installdir on line 116
Warning: Unknown/unsupported 'ghc' version detected (Cabal 2.4.0.1 supports
'ghc' version < 8.7): /home/xxx/.ghcup/bin/ghc-8.10.4 is version 8.10.4
cabal: No cabal file found.
Please create a package description file <pkgname>.cabal
xxx@MSI:~/cardano-src/cardano-node$ echo "package cardano-crypto-praos" >>  cabal.project.local
echo " xxx@MSI:~/cardano-src/cardano-node$ echo "  flags: -external-libsodium-vrf" >>  cabal.project.local
danastos@MSI:~/cardano-src/cardano-node$ cabal build all
Warning: The build command is a part of the legacy v1 style of cabal usage.

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

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

Warning: /home/xxx/.cabal/config: Unrecognized stanza on line 139
/home/xxx/.cabal/config: Unrecognized field installdir on line 116
cabal: No cabal file found.
Please create a package description file <pkgname>.cabal
xxx@MSI:~/cardano-src/cardano-node$

What am I supposed to do here?

With distribution of GNU+Linux are you using? Which version of cabal are you using? Did you use ghcup to install the latest version of ghc? Did you cd in the cardano-src folder (the No cabal file found tells me you're not in the correct folder).
In your question, it would be very helpful if you could describe every step you took until it breaks and show the terminal outputs for each step.

I am in the cardano-node folder and I have
cabal-install version 2.4.0.0
I have The Glorious Glasgow Haskell Compilation System, version 8.6.5 for GHC

I followed this exactly:
I am operating under WSL Windows 10
https://developers.cardano.org/docs/get-started/installing-cardano-node

The tutorial says to install a more recent version of GHC with ghcup install ghc 8.10.4 and ghcup set ghc 8.10.4. Did you do that?

I have version 8.6.5 set
I enter set ghc 8.10.4 but it still shows 8.6.5 ( ghc --version )
It also says GHC ver 8.10.4 already installed;

https://imgur.com/a/RQf88bN

thats a screen shot of the version

The docs say that the command to switch GHC version is ghcup set ghc 8.10.4. You forgot the ghcup.

Same error
https://imgur.com/a/sqwowMo

the GHC version also still remain 8.6.5... that didnt change

https://imgur.com/a/ZAlT0Tb

I unisntalled it and reinstalled it and still get the same 8.6.5 version... it wont go to 8.10.4

Let us continue this discussion in chat.

Ok.. got it figured out. It was path related. Make sure to add /home/xxx/.ghcup/bin to your path.. it needs to be prepended on the path to make sure you are picking up the correct version PATH=/home/xxx/.ghcup/bin:$PATH


text:
What is the most trusted Third party tool for Minting Native Tokens on cardano?
I have come across many Third party minting sites, however, I have a security concern, as per the keys, and policies. So what is the most trusted Third party tool for Minting Native Tokens on cardano?

I've used nft-maker.io and they always have sent me the NFTs that I create. You can also mint them with cardano-cl which is the cheapest and gives you more control.

Thank you jnprogrammer for responding. I know nft-maker.io they are reputable, however, it's not NFTs that I want to mint. I want to mint Fungible tokens. Thanks for answering

Check CNTools - it's a multifunctional tool for Cardano blockchain.
https://github.com/cardano-community/guild-operators

Thank you too matcheek I will check it out, seems it can mint Fungible Tokens too. Thanks again


text:
db-sync makes a rollback after using RESTORE_SNAPSHOT
After the import of the snapshot finishs it rolls back to genisis and starts over
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | ALTER TABLE
cardano-db-sync2_1  | All good!
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:57.73 UTC] Schema migration files validated
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:57.73 UTC] Running database migrations
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using byron genesis file from: "/nix/store/iwq90igv72ihdr9z9nl3m0dsiv0bfh7y-byron-genesis.json"
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using shelley genesis file from: "/nix/store/sr1r1fsqij2bcr3jc1xz7hdgih2w6gp7-shelley-genesis.json"
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.13 UTC] Using alonzo genesis file from: "/nix/store/5qpskcxlvakm8d0qf4gg0mhs3ckr264l-alonzo-genesis.json"
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.43 UTC] NetworkMagic: 764824073
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.70 UTC] Initial genesis distribution present and correct
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.70 UTC] Total genesis supply of Ada: 31112484745.000000
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.71 UTC] Inserting Shelley Genesis distribution
cardano-db-sync2_1  | [db-sync-node:Info:6] [2021-09-02 19:36:58.71 UTC] localInitiatorNetworkApplication: connecting to node via "/node-ipc/node.socket"
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:65] [2021-09-02 19:36:58.71 UTC] Identity Starting Subscription Worker, valency 1
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:66] [2021-09-02 19:36:58.71 UTC] Identity Connection Attempt Start, destination LocalAddress "/node-ipc/node.socket"
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:66] [2021-09-02 19:36:58.71 UTC] Identity Connection Attempt End, destination LocalAddress "/node-ipc/node.socket" outcome: ConnectSuccessLast
cardano-db-sync2_1  | [db-sync-node.Handshake:Info:66] [2021-09-02 19:36:58.71 UTC] WithMuxBearer (ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"}) Send (ClientAgency TokPropose,MsgProposeVersions (fromList [(NodeToClientV_1,TInt 764824073),(NodeToClientV_2,TInt 764824073),(NodeToClientV_3,TInt 764824073),(NodeToClientV_4,TInt 764824073),(NodeToClientV_5,TInt 764824073),(NodeToClientV_6,TInt 764824073),(NodeToClientV_7,TInt 764824073),(NodeToClientV_8,TInt 764824073),(NodeToClientV_9,TInt 764824073)]))
cardano-db-sync2_1  | [db-sync-node.Handshake:Info:66] [2021-09-02 19:36:58.71 UTC] WithMuxBearer (ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"}) Recv (ServerAgency TokConfirm,MsgAcceptVersion NodeToClientV_9 (TInt 764824073))
cardano-db-sync2_1  | [db-sync-node.Mux:Info:66] [2021-09-02 19:36:58.71 UTC] Bearer on ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"} event: Handshake Client end, duration 0.000429297s
cardano-db-sync2_1  | [db-sync-node.Mux:Info:67] [2021-09-02 19:36:58.71 UTC] Bearer on ConnectionId {localAddress = LocalAddress "", remoteAddress = LocalAddress "/ipc/node.socket"} event: State: Mature
cardano-db-sync2_1  | [db-sync-node:Info:70] [2021-09-02 19:36:58.71 UTC] Starting chainSyncClient
cardano-db-sync2_1  | [db-sync-node:Info:70] [2021-09-02 19:36:58.71 UTC] Cardano.Db tip is at slot 38188791, block 6151159
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:36:58.71 UTC] Running DB thread
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:36:58.72 UTC] Rolling back to genesis
cardano-db-sync2_1  | [db-sync-node.Subscription:Notice:65] [2021-09-02 19:36:58.73 UTC] Identity Required subscriptions started
cardano-db-sync2_1  | [db-sync-node:Info:75] [2021-09-02 19:37:11.35 UTC] Deleting 6151159 blocks up to slot 38188791

My config:
  cardano-db-sync:
    image: inputoutput/cardano-db-sync:11.0.0
    environment:
      - NETWORK=${NETWORK:-mainnet}
      - POSTGRES_HOST=postgres
      - POSTGRES_PORT=5432
      - RESTORE_SNAPSHOT=https://update-cardano-mainnet.iohk.io/cardano-db-sync/11/db-sync-snapshot-schema-11-block-6151159-x86_64.tgz
      - RESTORE_RECREATE_DB=N
    depends_on:
      - postgres
    secrets:
      - postgres_password
      - postgres_user
      - postgres_db
    volumes:
      - db-sync-data:/var/lib/cdbsync
      - /relay1-ipc:/node-ipc
      - ./tmp:/tmp
    restart: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "200k"
        max-file: "10"

Any ideas what i'm doing wrong?

I believe this is resolved in latest db-sync. I know we had some bugs about a month ago that have recently been cleaned up.

Yes it is fixed in the newerst version

I’m voting to close this question because it has been a bug in the old version of cardano-db-sync which is now fixed.


text:
Length of Plutus Slot
Is it correct that the length of a Plutus time slot is one second?
I recall that at one point it was twenty seconds, but I understand that that is no longer the case. Where in the Plutus codebase can I find the answer?
Is this the code?: https://github.com/input-output-hk/plutus/blob/2c8161ad142f56b14611cc0f66b0a2803016fe37/plutus-ledger/src/Ledger/TimeSlot.hs#L58

According to the official documentation a time slot is one second.

The Cardano blockchain uses the Ouroboros Praos protocol to facilitate consensus on the chain. Ouroboros Praos divides time into epochs. Each Cardano epoch consists of a number of slots, where each slot lasts for one second. A Cardano epoch currently includes 432,000 slots (5 days). In any slot, zero or more block-producing nodes might be nominated to be the slot leader. On average, one node is expected to be nominated every 20 seconds, for a total of 21,600 nominations per epoch. If randomly elected slot leaders produce blocks, one of them will be added to the chain. Other candidate blocks will be discarded.

I think where you got the 20 seconds from was the block producer node nomination process, which is about 20 seconds on average.
TLDR; One slot = one second.
EDIT:

There is one slight complication with this, and that is that Ouroboros, the consensus protocol powering Cardano doesn’t use POSIX time, it uses slots. But Plutus uses real time, so we need to be able to convert back and forth between real time and slots. This is no problem so long as the slot time is fixed. Right now it is one second, so right now it is easy.

However, this could change in the future. There could be a hard fork with some parameter change that would change the slot time. We can’t know that in advance. We don’t know what the slot length will be in ten years, for example.

EDIT TLDR; One slot = one second. For now.

Note that one second is not set in stone. See https://plutus-pioneer-program.readthedocs.io/en/latest/week3.html?highlight=change#txinfovalidrange _There could be a hard fork with some parameter change that would change the slot time. _

Thank you, updated my answer!


text:
Canonical example of Smart Contract Verification?
Given that the chief benefit of Cardano Smart Contracts over Ethereum Smart Contracts is formal verification (and thus its implied validity, security, and robustness), is there a non-trivial example of the formal verification of a Smart Contract?
Please provide a link... Thanks!

Unfortunately, it speaks volumes that this question has not been answered.  That can be interpreted in two ways - 1. it is a difficult question (granted).  2. There is not a good answer available.  :(

I believe you may find what you are looking for in this video on Formal Verification by Prof. Grigoru Rosu at around 1h17m into the video. https://youtu.be/ip9ihbMI07U?t=4628

I watched that video at the time specified and it does NOT show a canonical example of smart contract verification.  This question has now been unanswered for a month...  Is this a case where the theory is nice but has not been proven in a real-world scenario?

I tried to start a conversation about this here, remains to be seen whether I'll be successful in generating dialogue. But outside of Cardano internals like Ouroboros or the plutus metatheory, the task of formally verifying contracts and dapps built on top of / with those artefacts doesn't appear to me to have a unified solution we can point to yet.
I will update here if my team is successful, we have ideas, but we feel on our own.

Very much interested what you guys might come up with. Perhaps, if you have at hand, you could share the details how it's being done for any of internals, like Ouroboros?


text:
How can we calculate staking rewards per epoch?
Deadalus shows total staking rewards for a wallet.  IIRC, there is a planned feature to show staking rewards per epoch for a wallet.
How we can calculate staking rewards per epoch for a wallet right now?

Should one of the answers be marked as accepted?

You can see the per-epoch rewards on https://adapools.org, example:
https://adapools.org/stake/stake1u94cewwzweul0z7e73462fjgextms4vge44y0f0d0a6rfjgj802t9
Yoroi does show per-epoch rewards too.

Our alliance website has a calculator.
https://armada-alliance.com/
We are an alliance of single pools who run on decentralized bare metal low powered arm devices. Please do not stake with pool splitters or pools located in centralized datacenters.

Another way is by using the Cardano's Official calculator tool, using advanced options you can enter the information about the pool that you are staking to and see the estimated rewards. Without advanced options it's just an esteem and results can be a little bit different from what you will receive at the end.

I also created a calculator which shows Operator and Delegator (SUM) rewards per Epoch and Month based on the given Network and Pool Parameters.
You can find it here: (Download if you want to change inputs)
https://docs.google.com/spreadsheets/d/1ztm6Jov85Vk7AGtZ22BVE3I-BhzIlubnLSTUEomdq4U/edit?usp=sharing

To make it more easy to use I created a Version of the Calculation sheet which includes calculation for an individual delegator.
Here is the new Link: https://docs.google.com/spreadsheets/d/1a2fqlM66wHNAJkRyLFhY8gaJPmwgnL7glx-NewOywdw/edit?usp=sharing
Just fill out the colored cells with the Pools and delegators details you want to use for your calculation and see the results below (Cell B20 and B21)
This calculation considers:

Current Block Rewards (will get lower over time)
Pool Pledge
Pool Fixed Cost
Pool Margin
Poisson Distribution to consider Luck

This calculation does NOT consider

Risk of battles (slot or height battles) - Bigger Pools lose more blocks to battles which decreases the Average Rewards (by up to 10% at a fully saturated pool, depending on network congestion)


text:
Is there a Signal/Telegram/other bot to monitor wallet/address activity?
Pooltool.io monitors rewards and can notify via a Telegram bot on Pool activity, blocks and staking changes.
Is there a bot tool that can monitor wallet activity live, onchain?

Another option might be to checkout the Oura project: https://github.com/txpipe/oura
Essentially, it turns all the block and tx activity into a reactive stream you can plug into Kafka or other streaming sink.
Then its just a matter of wiring the output of a filter up to whatever messaging service you want.  Given that this is a "reactive" solution, you have greater control over back pressure and you aren't going to be beholden to rate limits imposed by blockfrost.  In my experience, reacting to streams of data, in this way, is a bit less cumbersome than having to poll a REST API.

There is not that I know of.
But it would be trivial to build, using blockfrost.io with signal-bot.


text:
Yoroi wallet pool icon
I have a very simple question that I can't seem to get clarification on. When opening a wallet on Yoroi it shows the pool you are delegating to if you are delegating to a pool. The pool has a default icon (See screenshot below) How do stake pool operators change the icon to a custom icon?

Is it related to the PoolMetaData.json?

It is related to PoolMetaData.json as you said, inside the file you can add the link to the extended version of it where you can add different things, for example a description of your hardware, social networks of your pool, and many other things included a pool logo.
You can find an example version of it here
Once you have edited the file, added the things that you want and uploaded the file on your website, you can link it with your pool by adding this line to the existing poolMetaData.json that you have:
extended    "https://YourWebsite/nameOfExtendedMetaDataFile.json"

After that you need to recalculate the hash of the basic metaData file, resubmit the pool registration certificate and the delegation certificate.
Here you can find the guide to resubmit the poolMetaData and its hash file.
Note that after that, in staking section of wallets, your pool will be seen as "unknown" until ADAPools will sync again (every 4 hours).

So I was guessing this is the case. The problem is Adapools is showing the icon specified by the extended.json perfectly but for some reason, it isn't showing up in yoroi?

I checked your pool and I can see a custom logo from Yoroi, maybe it only needs time to sync


text:
Can Token Registry be used for NFTs? Can I self-host a Token Registry?
I just learned about the token registry by way of the NFT docs.
A few newbish questions:

It looks like the Token Registry is currently centralized, and I need to make PRs against github to add my own token to it.  Is this a correct?
Can this Token Registry also be used for NFTs? (I'm asking if it's technically possible, not whether the current PR-based approach can be scaled to suit this use case)
Will dApp developers eventually be able to host their own Token Registries?

Yes
Yes, but there two reason why it will most likely not be used for that: 1. There are sooooo many NFTs it would be unmanageable to maintain a github repo with that many PRs. 2. NFTs work perfectly already storing the associated data in the minting transaction's metadata.
You can fork it any time you like. YOu can propose a CIP for a different way to do this. There is a world of possibilities.


text:
I exchanged for AGIX tokens on my Trezor One but cannot access them. Any ideas on how to get them?
It shows on my Trezor One that my AGIX tokens were rexeived but my Etherium account shows nothing there. Do I need another wallet to sync with my Trezor in order to access these tokens. I would like to eventually convert them and hold them on the Cardano blockchain.

This question is not about Cardano, try to ask in the SingularityNET specific channels.

it is about Cardano in the sense that I am trying to convert these tokens to be used on the Cardano blockchain. I am trying to use the Erc-converter to move these tokens from Etherium to Cardano.


text:
What is the testnet-magic argument and why is it 1097911063?
I am currently running a testnet-node version 1.29.0.
To query the blockain, I use the command cardano-cli query tip --testnet-magic 1097911063 to get the last block.
What is the testnet-magic argument and why is it 1097911063?

I got the command from https://developers.cardano.org/docs/get-started/running-cardano

The testnet magic, aka protocol magic, is a parameter introduced in Cardano during the Byron era. It is used internally by the protocol in cryptographic functions that construct addresses from a seed. Since this value is different in mainnet and testnet, the address obtained from a given path (or seed) is different in both networks.

But why is 1097911063? Are there other testnets with different number?

@G-Unit It's just an identifier, it could have been any other unique number, but I don't know why they chose that specific number. Other testnets used different numbers (I've seen the number 42, for instance)

Possible answer which explains a little bit more about this - https://stackoverflow.com/q/67191023/1336068

A quick update if you are still having this issue then please use this command now
cardano-cli query tip --testnet-magic 1

as testnet arguments have been changed. you can use both 1 and 2 based on your network preview or preprod.


text:
Transaction Notification
is there any tool that sends a notification when a incoming transaction happening on your wallet?
Or what is the best way to check it with a script

You want to poll the list transaction endpoint: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listTransactions

Blockfrost.io has an open source project called websocket-link.


text:
Launch.json for VSCode/Haskell? Learning Haskell Plutus
I have VSCode all set up with the necessary Haskell plugins (except I have GHCI 9.x installed via Chocolatey and the plugins want 8.x, ouch! Unfortunately Chocolatey won't accept an 8.x "--version" number so I can't downgrade). But I can't find any place that shows me how to set up a proper launch.json file to support a Haskell debug session in VSCode.  I want to have a full-fledge debugger for my Haskell learning and I'm sure that I need to learn Haskell to be effective with Plutus.
Does anyone know how to craft a proper launch.json file so that I can use the VSCode IDE for Haskell debugging?
NOTE: I know about the Plutus playground but I would like a full-fledged IDE with a debugger for my Haskell learning. Also, the Plutus playground site is usable, except I can't login because the hand-off to GitHub for 3rd party authorization is currently broken. On that note, is there a GitHub repo for the playground so I can report that problem? I can't figure which of the many Plutus repos on GitHub are for the playground.

Don't use the Plutus playground site, it's quite outdated. Try to build the plutus playground with nix instead, it'd be a nice first exercise ( https://github.com/input-output-hk/plutus/tree/master/plutus-playground-server, https://github.com/input-output-hk/plutus/tree/master/plutus-playground-client )

You can use phoityne-vscode for this.
There's a specific section called Configuration that shows how you can set your launch.json file up.


text:
Cardano Node: Connection reset by peer problem ---
My cardano node was running normal and all of sudden I get this error,
ErrorPolicySuspendPeer (Just (ApplicationExceptionTrace (MuxError (MuxIOException Network.Socket.recvBuf: resource vanished (Connection reset by peer)) "(recv errored)"))) 20s 20s
I have tried restarting the node, but the error is same.
Note: I am using testnet.
Updated Status:

Can you provide us with your node version : cardano-node --version
And the slot and epoch number at which your node stopped syncing. Thanks
The testnet recently hard-forked into Alonzo era and if your node isn't at version 1.29.0 then you'll have issues syncing past the hardfork.
If indeed your node is outdated, download the latest binaries here : Binaries 1.29.0
Also make sure to get the latest configuration files at : Config files
A common fix is also to delete the database folder containing immutable, ledger, ...
So try this if the above doesn't apply or solve your issue (this will re-sync your node from epoch 1).

This was helpful to some extent. I updated to 1.29. My node is fully synced, but when i run cardano-wallet serve. I get this error
cardano-wallet: ExceptionInLinkedThread (ThreadId 15) DecoderFailure

Unfortunately I'm not that familiar with cardano-wallet, though I would also suggest checking that it is up to date. Good luck

removing the db folders immutable and ledger was enough for me, although I'm at version 1.27. After deleting them I re-ran cardano-node run ...
Glad I didn't need to reinstall all of that lol, took me quite some time just yesterday


text:
Query UTxO with PostgreSQL (cardano-db-sync)
How can I query the last UTxO from an address on PostgreSQL (I used cardano-db-sync) like I would do using cardano-cli:

cardano-cli query utxo --address addr_test1vpm4uhupwxc4jjea6c6s5p0t80znlfr03xj4ewygnjtxd3cyjdv8x --testnet-magic 1097911063

I also want to know more information regarding this transaction like who sent, etc.
Thank you very much.

Hi, did you ever find an answer to his? I have the exact same query from cardano-db-sync but have not found a way to do this - thanks

To get the basic utxo you would get from query utxo, you want a join from utxo_view to tx table.
SELECT * FROM utxo_view INNER JOIN tx ON tx.id = utxo_view.tx_id WHERE address = 'addr1...'
To get the list of txins sending the tx, you need to join that to tx_in and then rejoin that to the tx_out table and it will return a row for every output that's being used as an input, but usually at this point of complexity with SQL queries I start to throw for loops into my code.


text:
Whats the difference between the cardano-wallet and cardano-cli for wallet functionalities?
I am reading the different options for a cardano wallet: https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet
Why should I use the cardano-wallet cli or api if all the tutorials like minting an NFT are using the cardano-cli?
Are there functionalities that only cardano-wallet can offer? If so which ones.

cardano-cli utility
cardano-cli v1.30.1 commands are rather era-based commands. As we all know the Shelley era brought staking for ADA holders. cardano-cli provides a "lower"-level information than "higher"-level cardano-wallet.
If you need a hint on any command or sub-command, feel free to use the help in any situation. For example to find out how to undelegate from staking pool, type:
cardano-cli stake-address deregistration-certificate --help

You'll see four available flags with a strong type of each property:
--stake-verification-key STRING
--stake-verification-key-file FILE
--stake-script-file FILE
--out-file FILE

Here are the list of available commands (that have corresponding sub-commands and flags):

address
stake-address
key
transaction
node
stake-pool
query
genesis
governance
text-view
byron (Byron era specific commands)
help
version

Among other things, there's a cardano-node run command for running a node. To run a node, use the following code:
cardano-node run \
    --topology ~/cardano/config/mainnet-topology.json \
    --database-path ~/cardano/db/ \
    --socket-path ~/cardano/db/node.socket \
    --host-addr 127.0.0.1 \
    --port 1495 \
    --config ~/cardano/config/mainnet-config.json

cardano-wallet utility
cardano-wallet v2021-09-29 commands are definitely wallet-based commands. To use transaction commands you need both a node and a server running. To generate a private key you need neither running node nor running server (i.e offline and not-synced).
Command Line info says:

The CLI is a proxy to the wallet server, which is required for most commands. Commands are turned into corresponding API calls, and submitted to an up-and-running server. Some commands do not require an active server and can be run offline (e.g. 'recovery-phrase generate').

Here are the list of available commands (that have corresponding sub-commands and flags):

serve
recovery-phrase
key
wallet
address
transaction
network
stake-pool
help
version

To run a server, use the following code:
cardano-wallet serve \
    --port 8090 \
    --mainnet \
    --database ~/cardano/wallets/db \
    --node-socket $CARDANO_NODE_SOCKET_PATH

On the one hand, the cardano-wallet provides high level commands and automations, you can choose a  token to send ore choose a specific addresses to use... On the other hand, the cardano-cli provides low level commands, meaning that you have to do everything manually, but at least you know exactly the commands you are performing.
There is nothing you cannot do with cardano-cli that you can do with cardano-wallet.
To start, I recommand you to explore all the commands of cardano-cli to dive a little more into the cardano environment and then go back up to cardano-wallet, once you know the different steps and corresponding commands (for example for your NFT minting).


text:
The Concurrency Issue
Are there any solutions to the concurrency issue so far without sacrificing decentralization? MinSwap testnet was experiencing this last night and just looking for some clarification, haven't seen much spoken on this subject, thanks.

I don't know how MinSwap is implemented, so hard to answer. So what concurrency issues do you have?

Does this answer your question? General approach for allowing multiple smart contract transactions per block

Here is a big old list of relevant resources. Some of them claim (credibly, I think) to solve the problem without sacrificing decentralization.
From IO

https://plutus.readthedocs.io/en/latest/plutus/howtos/writing-a-scalable-app.html
https://iohk.io/en/blog/posts/2021/09/06/no-surprises-transaction-validation-on-cardano/
https://iohk.io/en/blog/posts/2021/09/07/no-surprises-transaction-validation-part-2/
https://iohk.io/en/blog/posts/2021/09/10/concurrency-and-all-that-cardano-smart-contracts-and-the-eutxo-model/
https://docs.cardano.org/plutus/concurrency

From projects

https://sundaeswap-finance.medium.com/concurrency-state-cardano-c160f8c07575
https://medium.com/occam-finance/the-occam-fi-technical-series-on-concurrency-cd5bee0b850c
https://medium.com/meld-labs/concurrent-deterministic-batching-on-the-utxo-ledger-99040f809706
https://medium.com/minswap/introducing-laminar-an-eutxo-scaling-protocol-for-accounting-style-smart-contract-d1ac8847dde8
https://github.com/ergolabs/ergo-dex
https://cardax.blog/concurrency-in-perspective/
https://blog.maladex.com/maladex-solves-concurrency-scales-beyond-memory-limits-and-designs-the-best-possible-cardano-dex-391d7e519e67

Videos

https://www.youtube.com/watch?v=xlDlNmIFrFM
https://www.youtube.com/watch?v=TxnvYsBnLjQ

Minswap reflecting on the incident that sparked the FUD storm

https://medium.com/minswap/minswap-testnet-reflections-64b01c5e7c45

Indie contributions

https://twitter.com/DarkeningAges/status/1436308661454975001
https://cryptois.land/posts/2021/09/10/simple-cardano-batching-bots/

I think this article from Maladex also deserves some attention.

Appreciate it @JelilAkjaly. Adding this.

The Occam.fi team claims to have a solution that works for their DEX.

The solution uses an intra-block slot auction system to process multiple transactions simultaneously, which is essential for a fully functional and high-volume DEX.

Looking forward to learning more about that approach.

Another solution I've thought about is introducing an off-chain service provider called a "batcher" who is incentivized and authorized to batch a bunch of concurrent transactions.
Take a DEX for example. If many people are trying to provide liquidity to a pool at the same time, instead of them all trying to access the "liquidity total" datum concurrently, each actor could lock their liquidity + a batching fee in a separate escrow script that requires a minimum amount of liquidity tokens to unlock. They then submit a "batching request" datum to the DEX. The off-chain batcher can filter all the request datums and execute as many as they can simultaneously.
The minimum liquidity token requirement on the escrow script prevents the liquidity providers from being screwed over--they set the terms-- and it also allows some flexibility in a volatile market, but there is still a level of centralization of the batcher. My biggest worry would be regulatory intervention, as the batchers could be seen as MSBs. You could theoretically solve this with federalization of the batching responsibility.

All-in-all, I think there are many ways to solve the concurrency problem. Charles talked about additional side-chain solutions in this video. I think we just need to be comfortable with the idea that the solutions might just look different from what we see on Ethereum, and that's okay. Ethereum has it's own set of problems that needed creative solutions as well.

Thinking about the “batcher” service more, it could be valuable to speak of the concurrency congestion as a small “risk.” In designing an app, you can offload that risk to some party other than the costumers of your dApp’s core business, for a small incentive. So back to the DEX example, you don’t need the batcher to be authorized, just incentivized. The risk being that their transaction doesn’t succeed and the resources needed to pay attention we’re wasted. A small risk, but the fee needs to be high enough that it keeps batchers’  attentions.

In fact, if structured right, the "batchers" might just be the submitters of requests the previous block. You'd just need to be sure that they are incentivized to include other people's requests in their batch.

To my knowledge, there is no concurrency issue on Cardano. If multiple people want to perform some transaction, then on Cardano, you can bundle all of those into one UTxO with several inputs and several outputs. Could you please provide some more details?

The issue (for others) is that they may have 2 transactions attempt to use same tx-in. This problem was solved 40 years ago via serialised access, a staple to the dev community. Be very proud you are not having this issue. It's so simple it's almost juvenile.

SundaeSwap has already addressed this issue. Feel free to give it a read.
https://sundaeswap-finance.medium.com/concurrency-state-cardano-c160f8c07575

The solution is the shortest section in this article cited. And all it basically says is "Stay tuned for more information".

Even though the EUTxO model ensures that outputs are not double spent, therefore limiting dApps to one "transaction" per UTxO every twenty seconds, it is not a requirement to use one UTxO only and there are numerous implementations one could think of in order to preserve concurrency.
Instead of keeping a list of all "pools" in one UTxO and use a NFT so as to ensure their validity, for example, you could have a minting policy that requires some specific Datum in these pools (like you would check in the old implementation when validating) and only allows the minting of these specific tokens if the pool has a valid hash, a valid datum and that the token is being transferred to the pool.
Later, off-chain code would be able to identify "authentic" pools by verifying if they hold the token minted by this minting policy, since they would only receive these tokens if the requirements were met.
This is the logic I'm using in a project I'm working on called DigiServices. More details on the implementation can be found here https://github.com/mateusap1/DigiServices/tree/fdel15/wp-edits-2#i-utxo-identity and here https://github.com/mateusap1/DigiServices/tree/fdel15/wp-edits-2#6-scalability (though the paper needs a lot of adjustments)
I'm sure there are numerous other ideas and ways. The magic of being open to the public is that anyone can design their implementations. In my opinion, the EUTxO model offers a number of advantages when compared to the account model and most of the disadvantages can be overcome with a little bit of creativity and engineering.

No issues, just inexperienced team at miniswap testing and developing. Great publicity for cardano and opportunity to showcase how advanced the protocol is and ready for the future which may not even be Uniswap type DeFi

Answers should be complete, evidence-driven, and with sources/examples - this would be better suited as a comment :) For example a link to an article showing a how a DApp is managing concurrency at scale or a detailed example of why miniswap is wrong would be better.

Please add further details to expand on your answer, such as working code or documentation citations.


text:
Can you the number of NFT's that can be minted in a transaction?
I wanted to understand if you could place a hard limit on the number of tokens minted under a policy.
I've scanned the docs and the policy.script only seems to control permission and the amount of time before the policy is locked.
I'm wondering if this is possible, and if not - what stops NFT creators just minting more than they say they will?
Many thanks

There is not a way to specify the limit for a given native asset in the policy.
Only, once the policy is timelocked, you have the guarantee that the NFT creator does not mint or burn the NFTs.

With a Plutus script, you can absolutely limit the number by ensuring not more than a certain number has been minted by putting it into the validator.

Check out Lars Lecture 5 ... https://youtu.be/SsaVjSsPPcg?t=2471
It explains everything very clearly!


text:
Setting up .ghci for Haskell installation in WSL
I used the ghcup tool to install ghc and cabal, on completion I tried to create a .ghci file to print a new prompt.
It gave me a warning
*** WARNING: .ghci is writable by someone else, IGNORING!
Suggested fix: execute 'chmod go-w .ghci'

Even after doing the suggested fix the same warning appears and nothing happened to the prompt :(

may you try doing chmod 644 .ghci

@elrmndo It did not work either. :(

I am having this problem using Nix on macOS 10.14.6 and 10.15.7 in early 2022. It is frankly embarrassing that this problem, which has been known for more than 8 years, has not been fixed.


text:
Choosing Ubuntu over WSL for Plutus development
I use a low end laptop as my daily driver running a WSL Ubuntu-20.04 as my platform of choice. When trying to run the plutus-playground it often crashes. Should I try using Ubuntu or any other Linux boot for the development or will I get a similar experience there too.

WSL is a hack for running Linux programs. Plutus Playground is very stable once it is installed on a stable platform. I had hosted a playground without any issue for more than a month that too without restart. It is highly recommended that Ubuntu or other Linux OS be used as a base platform than Windows.

Ubuntu is far better, just tried running plutus on it :chef_kiss:.


text:
Plutus-Start for Windows - Cannot get the docker repository to run (A mount config is invalid.)
I am following :
https://github.com/input-output-hk/plutus-starter
I have downloaded VSCode and Docker. I downloaded the Remote Development extension in VSCode. I then ran "mkdir -p ~/.cabal/packages" in the terminal per the tutorial. All is well.
When I try to clone the repository to container it runs for a good bit and then displays this error:

A mount config is invalid. Make sure it has the right format and a
source folder that exists on the machine where the Docker daemon is running.

I can then select "Open devcontainer.json in Recovery Container". Is there some setting I can tweak in this file that fixes the problem? Im on Windows 10, 64-bit, with fresh installs of Docker and VSCode.
My devcontainer.json file looks like this:
{
"name": "Plutus Starter Project",
"image": "docker.io/inputoutput/plutus-starter-devcontainer:v1.0.8",
"remoteUser": "plutus",

"mounts": [
    // This shares cabal's remote repository state with the host. We don't mount the whole of '.cabal', because
    // 1. '.cabal/config' contains absolute paths that will only make sense on the host, and
    // 2. '.cabal/store' is not necessarily portable to different version of cabal etc.
    "source=${localEnv:HOME}/.cabal/packages,target=/home/plutus/.cabal/packages,type=bind,consistency=cached",
],

"settings": {
    // Note: don't change from bash so it runs .bashrc
    "terminal.integrated.shell.linux": "/bin/bash"
},

// IDs of extensions inside container
"extensions": [
    "haskell.haskell"
],

}
Edit: In the .devcontainer/devcontainer.json file, there is a reference to your source folder for cabal/packages. When I replaced the default path with my specific path, I was able to get it to work.

can you please show your full line "source=$...." in your devcontainer.json ? I would like to see exactly how you referred to your source folder in this line .. struggling with this .. Thanks a lot & kind regards,
Pieter

I have the same issue here and can't work out the solution based on the Edit above. Please give an example of a working source folder reference! Thanks!


text:
How do I deploy a smart contract from another smart contract?
If I want to create one top level contract for creating a bunch of other, similar contracts, lets say a top level Uniswap contract that creates liquidity pool contracts and keeps track of the total amount of LP tokens in each of the pool scripts below it. A pool can only be created by a "create" call to the top level contract, and everytime LP tokens are minted or burned, the top level contract updates its datum.
How exactly would I go about that?

Check out the Uniswap example in the plutus-use-cases!
The way it works is there is an NFT they call the "Uniswap coin." In order to create new liquidity pools, that NFT needs to included in the transaction and the new pool needs to be recorded in the Factory datum. That validation happens here.

A pool can only be created by a "create" call to the top level contract, and everytime LP tokens are minted or burned, the top level contract updates its datum.

Luckily you don't need to update the top level datum after each pool is created. The validateCreate path in the SC (what you refer to as the "create" call) also checks that a liquidity pool is created with a Poolstate token here. Since we can be sure that the Poolstate token was created using the Uniswap NFT, we only need to update the Pool datum on the Poolstate token in the future.
Hope that helps :)


text:
When can we expect live deployment of the Plutus Playground
I am working with a low end device, and the live deployment of the playground is what I'm counting on. When can I expect it and is there any community deployed server that is active now?

You may already be aware , but the live deployment is back online, as posted on Discord by Matthew Capps.
For future reference, this was in the ppp-announcements channel on the IOG Discord server. A lot of the most current info is shared out there by IO(HK).
Good luck and wish you the best in this class!

Can you share a link to the deployment? I was not able to find it on Discord.

It looks like it's online and available here. Not sure what version it is though.


text:
How much time does Cardano-graphql take to initialize?
I had configured db-sync and it is synchronizing. I had also started the Cardano-graphql. However, the message seems to be struck at

"msg":"Initializing. This can take a few minutes..."

Will this proceed only after db-synch is fully synchronized?

Yes, it should as soon as the cardano-db-sync is synced. It depends generally on the available resources. It takes usually few days to complete.


text:
Can we dump database of db-synch and use it for initialising a fresh db-synch instance?
Db-sync takes about 48 hours to follow the tip, starting from a fresh installation fully. Is there a way to improve the sync time? Is it possible to dump the database and transfer it to a fresh installation?

You can use the official snapshots, provided by IOHK. Just restore them after setting up the database.
They are usually linked in the release description on Github: https://github.com/input-output-hk/cardano-db-sync/releases
You will find a link to the list of snapshots, grouped by schema version.
As of today, the current schema version is 11 and the list of snapshots are listed here: https://update-cardano-mainnet.iohk.io/cardano-db-sync/index.html#11/

You cannot dump the PostgreSQL directly, as cardano-db-sync depends on other states as well.
You need to use the cardano-db-tool to take and restore the snapshot.


text:
where can I find the active alonzo-test configuration json files
I am not able to fully understand where the active configuration files are located for alonzo test and main net.
I found this link from doing the alonzo-test exercises:
https://hydra.iohk.io/build/7189190/download/1/index.html
but this seems to be for 1.28, and I am currently running 1.29, and I am not able to connect.
Is there a way to know what build I should use for 1.29 configuration?
I am a bit confused.

In this guide is updated (using 7191656)
https://developers.cardano.org/docs/get-started/running-cardano/
So at the end just add
testnet-alonzo-genesis.json or mainnet-alonzo-genesis.json

wow, thanks a lot! I was reading outdated docs.


text:
Plutus pioneer program - Lecture #1 - Can't understand behaviour of transactions
Why is the second bid of wallet 2 getting ignored when I test it like this? If the first transaction of wallet 2 was also valid, then the second suceeds. I'm just curious if this is somehow expected behaviour or if there is some faulty code on the contract.
Print 1: Tested transactions

Print 2: Trace of wallet 2

I expected too see any print related to the second bid at least, can't understand why that doesn't happen.

Isn't the log referring to the first bid  (i.e. Slot 2) made by wallet 2?

@AronNeewart it is, but that is the whole log for wallet 2. In this scenario there should at least be a " found auction utxo with datum" log too around slot 7. The answer by j.karlsson makes sence though.

If I recall correctly there is some problem/bug in the playground, such that when a wallet/transaction fails, no more transactions from that wallet is accepted.
But as you noted when first bid is accepted, the next bid from wallet2 also works.

That would justify it indeed, thank you!


text:
Issues with oracle concurrency
I'm sort of running into an issue with the oracle described in the PPP.
It looks like there is race between the oracle to update the exchange rate and the users to use the exchange rate in a swap.
We could upgrade the current model so that when the oracle updates the exchange rate, a bunch of utxos with "exchange rate tokens" and the new exchange rate in their datum are created, and now, people can swap with those utxos. However, we would need a mechanism for invalidating previous exchange rate utxos when a new value is published and new "exchange rate tokens" are minted.
Is there any way to facilitate such a mechanism where old utxos are invalidated when new tokens are minted? Or any other means of invalidating those transactions?

Maybe you could add a timestamp in the utxo's datum, to set how long this utxo is valid. And after this time has passed the utxo cannot be used in a transaction except that the smart-contract can delete it.

What if the price doesn't change though? We don't want the oracle to be bound to setting the price every so often, only when it changes, which is unknown.

I don't really understand how you have designed the Oracle. Couldn't the Oracle issue tokens with the current exchange rate on demand. And those tokens can be valid for a short period of time to be used in a swap?


text:
How to send a transaction for Cardano native assets via CLI?
For example to list UTXO is something like this
cardano-cli query utxo —mainnet —address addrX

which returns as an example
                               TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
txHashA     0        1500000 lovelace
txHashB     1        1500000 lovelace

but for native assets it returns the UTXO as the following (NFT example)
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
txHashC     0        1500000 lovelace + 1 someHash???.SomeNft1
txHashD     1        1500000 lovelace + 1 someHash???.SomeNft2

My main goal is to understand how to send one to many native assets in a single transaction

I'm having trouble signing this transaction. I get: Invalid argument `payment.vkey'

Basically, according to the docs.cardano.org:
cardano-cli transaction build-raw \
         --mary-era \
             --fee 178393 \
             --tx-in fd0790f3984348f65ee22f35480b873b4eb9862065514f3e3a9c0f04d0a6ad63#0 \
             --tx-out addr_test1vp8s8zu6mr73nvlsjf935k0a38n8xvp3fptkyz2vl8pserqkcx5yz+10000000+"1 328a60495759e0d8e244eca5b85b2467d142c8a755d6cd0592dff47b.melcoin" \
             --tx-out addr_test1vqvlku0ytscqg32rpv660uu4sgxlje25s5xrpz7zjqsva3c8pfckz+989643522+"999999999 328a60495759e0d8e244eca5b85b2467d142c8a755d6cd0592dff47b.melcoin" \
             --out-file rec_matx.raw


text:
How is ADA valued?
Or any other cryptocurrency for that matter. Does the Cardano blockchain have inherent knowledge of the current value of ADA, or is it oblivious to price? Who/what determines how many USD (or another fiat currency) is 1 ADA worth at a given point in time?

The market decides. Supply and demand. If there is someone willing to pay more for the currency, the price will go up, and if no one will buy at the current price, sellers are forced to lower the price.
Different exchanges might have different prices, but they will naturally even out as people arbitrage the difference away.
The network is "oblivious" to all of this. There is nothing in the inherent protocol of Cardano that maps the value of ADA to any fiat currency. Information from off-chain can only be consumed on-chain with the help of Oracles and other such services.


text:
Query all UTXO's from a single Yoroi wallet via CLI?
I wanted to list all assets from my Yoroi wallet via Cardano CLI when I noticed separate privacy addresses had their own UTXO's. Is there a way to resolve all UTXO's from a single  wallet?

The root key of a wallet is derived from BIP39 keywords. Then additional keys are derived beyond that. You would need to check each one individually for funds. You can use the cardano-serialization-lib for this. Many lite wallets like yoroi or ccwallet.io use this. More information about BIP39 can be found in my youtube video on the subject. https://youtu.be/5P1jx1ELUHk


text:
No Cardano Wallet commands are working
I have a testnet cardano node up and running  - fully synced, however when I query the network for cardano-wallet commands i am getting
ConnectionError (HttpExceptionRequest Request {
host                 = "localhost"
port                 = 8090
secure               = False
requestHeaders       = [("Accept","application/json;charset=utf-8,application/json")]
path                 = "/v2/network/information"
queryString          = ""
method               = "GET"
proxy                = Nothing
rawBody              = False
redirectCount        = 10
responseTimeout      = ResponseTimeoutDefault
requestVersion       = HTTP/1.1
}
(ConnectionFailure Network.Socket.connect: <socket: 11>: does not exist (Connection refused)))

Apparently you have to run cardano-wallet serve for some of teh commands to work. However, I tried running it and it keeps shutting down
get this error
cardano-wallet: ExceptionInLinkedThread (ThreadId 15) DecoderFailure (LocalStateQuery HardForkBlock (': ....

I used the followinng command with no success
cardano-wallet serve   --testnet /home/user/cardano/testnet-byron-genesis.json   --node-socket /home/user/cardano/db/node.socket   --database /home/user/cardano/db

Can you check port 8090 is in use?

No.. That port is not in use

Here is an screenshot of the error
https://imgur.com/a/BPOKY7J

It says "Running as v2021.5.26" in the logs, maybe you need to update the binary?

what version should it be?