text:
Does the rewards on the pledge stake address count toward the stake pool pledge?
The pledge is just a delegation to the stake pool signed with the owner key. My question about the pledge amount, are the stake address' rewards counting towards the stake pool pledge as well or just the UTxO funds on their associated addresses?

Normally, (UTxO + stake rewards) constitute the total stake. So the rewards are part of the pledge. One confirmation would be nice !

it should count, but can someone confirm that?

source: Stack Exchange

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

sort: votes


text:
OutputTooSmallUTxO even with 2 ADA
I get OutputTooSmallUTxO even with 2 ADA, is there any formula to predict the min output?
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (OutputTooSmallUTxO [(Addr Testnet (KeyHashObj (KeyHash "fd39564503fb2202a2fcbe55dd3bb54cc4121c9a5d729a384e432d49")) (StakeRefBase (KeyHashObj (KeyHash "b4f1c2fbf4268fb784ff29631c4bb96e9d6cb3c6764f9c0718ab641b"))),Value 2000000 (fromList [(PolicyID {policyID = ScriptHash "c3a79051ed13af016c01b2d639518620939328b4850c573169c35a65"},fromList [("43dff6dc96b32060",1),("ALIENS1",1),("SpaceBeep",1),("ack2",1),("electri2c",1),("electric",1),("shock2a",1),("spacesound",1)])]))])))])

I’m voting to close this question because it was easily researchable (answer found in ~15 min) and is not up to the standards of comprehensive, unique questions that is usually expected of Stack Exchange answers.

Didn't see this before, but also look at @NikeDattani 's comment below under the answer for more feedback.

wutzeber: I was not one of the 2 users that downvoted, nor was I the one that initiated the close voting. But ignoring this advice here has started to cost you, and it will probably get worse over time if you continue to (appear to) take no notice.

It seems we have an answer in the Cardano documentation library Native tokens - Minimum Ada value requirement:
For a UTxO containing a token bundle B the min-ada-value calculation is as follows :
Case 1 : Token bundle B in the UTxO u contains only ada (no other tokens) minAda (u) = minUTxOValue

Case 2 : Token bundle B in the UTxO u contains ada as well as other tokens minAda (u) = max (minUTxOValue, (quot (minUTxOValue, adaOnlyUTxOSize)) * (utxoEntrySizeWithoutVal + (size B)))

it is too much information to fully paste it here

Users throughout the SE network are expected to "basic research" before asking a question, which is the reason why the network is respected so much for having "high-quality content'. If you were able to find the answer in 14 minutes after asking the question, perhaps you shouldn't have asked the question? I do appreciate the enthusiasm though!

@NikeDattani thank you i was looking for this information pretty long, it was a fortuity that i found the answer shortly after posting here, but maybe i just was to dumb to find the right keywords, hope others are smarter than me =)

Disagree this should have been closed.
The docs are wordy, unclear, and talks of 'change at fork' (years ago). Plutus lib doesn't implement this fn and its "minUtxo" is hard coded.
A lot of people hit this error. There still isn't a good answer to this Q

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


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:
1.33.0 cardano-cli query stake-snapshot does not generate json
I'm trying to generate leaderlogs on cardano-node 1.33.0
when i try to query the stake snapshot with
cardano-cli query stake-snapshot --stake-pool-id 3bd3996595321d951291b11e1331061c5d8659d9e69390536dfc922c --mainnet
it does not generate a json file but wired output
86  # list(6)
   19 01 3b  # int(315)
   b9 04 51  # map(1105)
       # key
      58 1c 00 00 00 36 d5 15 e1 2e 18 cd 3c 88 c7 4f
      09 a6 79 84 c2 c2 79 a5 29 6a a9 6e fe 89  # bytes(28)
       # value
      18 41  # int(65)
       # key
      58 1c 00 00 00 f6 6e 28 b0 f1 8a ef 20 55 5f 4c
      49 54 23 4e 32 70 df bb dc c1 3f 54 e7 99  # bytes(28)
       # value
      18 3b  # int(59)
       # key
      58 1c 00 00 01 10 09 3e ff bf 3c e7 88 ae bd 3e
      75 06 b8 03 22 bd 39 95 ad 43 2e 61 fa d5  # bytes(28)
       # value
      0b  # int(11)
       # key
      58 1c 00 00 01 b8 44 f4 e4 c9 00 ae 0d fd c8 4a
      88 45 f7 10 90 b8 2f b4 73 e6 c7 0a 31 ee  # bytes(28)
       # value
      18 1b  # int(27)
       # key
      58 1c 00 00 06 6c 3b 2b 15 f7 ae ce 35 5a 11 2e
      f1 41 e9 fe 84 d2 e2 15 2d 43 98 98 6e 40  # bytes(28)
       # value
      01  # int(1)

and therefore jq .poolStakeMark <<< $SNAPSHOT fails
Did the output of the command change?

I’m voting to close this question because user solved their problem already.

This is not a helpdesk.  It is intended to be a library of solutions that others can refer to for quite some time to come.  Solving the problem doesn't mean it should be closed.  Please take a look at the [tour] and [help/dont-ask]

Ok seems the problem was that i used an older cardano-cli with a newer cardano-node


text:
How can a node verify a transaction with a script address without the script?
How can a node verify a transaction with a script address without the script?
I mean when i start a node months after the transaction has been minted into a block. How can my node verify that the script conditions were met since only the hash is persisted in the chain?

By inspecting the current ledger CDDL specifications, you can see that each block contains a transaction_witness_sets field, where each transaction_witness_set is defined as:
transaction_witness_set =
  { ? 0: [* vkeywitness ]
  , ? 1: [* native_script ]
  , ? 2: [* bootstrap_witness ]
  }

Here, native_script, if present, contains some rules that need to be respected in order for the transaction to be valid (for instance, some minting policy):
native_script =
  [ script_pubkey
  // script_all
  // script_any
  // script_n_of_k
  // invalid_before
     ; Timelock validity intervals are half-open intervals [a, b).
     ; This field specifies the left (included) endpoint a.
  // invalid_hereafter
     ; Timelock validity intervals are half-open intervals [a, b).
     ; This field specifies the right (excluded) endpoint b.
  ]

So not only the script hash is included in the chain, but also the actual rules it contains.

A node initially executes a valid Plutus transaction and records it to the chain, it also adds an "isValid" tag to that transaction record.
When a new node starts syncing up and arrives at a Plutus transaction, it only looks out for the "isValid" tag and then adds that transaction to its chain if it does have the tag, this way new nodes don't have to re-execute the script but still have proof they belong on the chain.

hm sounds bad, when a validator can just set isValid=true and everybody beleves it

Cardano transactions are deterministic and compliant with the Ledger rules, a block producer cannot just slap an "isValid" tag on a transaction anyhow, it has to be validated by them and according to rules so if a block producer acts adversarially then other validators who do decide to do the heavy-lifting will notice and consensus rules take charge. Also an isValid tag doesn't mean a client will just speed run by default, they can still revalidate the Tx if they choose. Vas points to the data they need in their response.

"Can" revalidate sounds vague, i think the other answer is more appropriate and the script is always attached to the transaction and all nodes re-evaluate that the condition were valid.


text:
Plutus devcontainer build fails with 'devcontainer' not found
I cloned the current plutus repo
git clone https://github.com/input-output-hk/plutus

And i'm on the current commit
3f8c1e22292d68d92f01f9a62a60621df01cdd4e

But building the dev container does not work (before some weeks it worked on the same machine)
wutze@wutze-pc:~/workspace/plutus$ sudo docker load < $(nix-build default.nix -A devcontainer)
error: attribute 'devcontainer' in selection path 'devcontainer' not found
-bash: $(nix-build default.nix -A devcontainer): ambiguous redirect

Any ideas what's wrong?

The devcontainer is existing in this git commit
c801b70016856b320a0deaab1f35f7b1ca9efa27

They have moved the devcontainer to The Plutus Application Framework
As per the README in the plutus repository. This repository used to contain the code for the Plutus Application Framework and Marlowe. These have now moved:
Plutus Application Framework

Marlowe

thanks didn't notice that it was moved to a different repo


text:
Why is there no real Wallet Plugin for Firefox
It seems that wallets are not able to implement cip30 for firefox, what is the hurden to do it, and why does it work for chrome?

This has been an issue since a long time. At least for Nami, it is possible to add the extension to Firefox, but the performance is horrible.
See: https://github.com/berry-pool/nami/issues/68
It seems like no one took the time to look into this yet even though there are quite some users requesting Firefox support.

so it is technically possible but there is just not enough demand?

Yes, it is for sure technically feasible. Ethereum wallets like Metamask also work in Firefox.

i mean not a wallet it self, i mean the CIP-30 connector, which enables websites to communicate with the wallet


text:
Setup dev enviroment locally fails on cabal test homework
Hi i setup the dev environment according to the youtube video, "cabal update" worked,  but the second command does not work for me:
root@c26be85e2bf4:/workspace/code/Week02# cabal test homework
Resolving dependencies...
cabal: The test command can only run test suites as a whole, not files or
modules within them, but the target 'Homework' refers to the module Homework
in the library week08.

root@c26be85e2bf4:/workspace/code/Week02#

i used https://github.com/input-output-hk/plutus-pioneer-program at latest commit b55a7d2409cbf09a04ab471796f410083129acb6

Running cabal test without a target should work. If you want to specify the target, you can check all of them in the Week0X.cabal file.  For example, for week 2, you'll see that there's a test-suite week02-homework target in the Week02.cabal file, so cabal test week02-homework should run those tests specifically.

I am running into the same issue. Did you ever get this resolved on your end?


text:
Calculate timestamp from slot
Is it possible to calculate a timestamp from a slot no? Since one slot is one second it should be pretty easy. But...
The current slot now (Tue 18 May 2021 05:46:04 PM CEST) is 29786450.
In mainnet-shelley-genesis.json i can see systemStart  "2017-09-23T21:44:51Z"
Which is acually 1506203091 as unix timestamp.
If i calculate 1506203091 + 29786450 i get 1535989541 which is Sep 3, 2018, 5:45:41 PM something in 2018.
Is there a simple formular? It seems that the actual start date must be something like June 7, 2020 but i cannot find anything abount this date.

You did not account for Byron, where one slot was 20 seconds.
To make it easier, take the start time of epoch 209 which is the Shelley hardfork and started at 1596491091 unix time on slot 4924800.
Therefore to calculate the time of the current slot, you might try something like: 1596491091 + (current_slot - 4924800).

thank you, is this timestamp documented anywhere?

Not directly documented, it's on chain, I used blockfrost to retrieve it: https://cardano-mainnet.blockfrost.io/api/v0/epochs/209 (need blockfrost.io token).

Hi i cannot accept your answer, because if i calculate 1596491091+29786450=1626277541 => 14.07.2021 - 17:45:41 which is far away from Tue 18 May what am i doing wrong?

Oh right, the epoch 209 started on slot 4924800. So you need to do: 1596491091+(current_slot - 4924800), I have edited my answer to mention this.

looks good, thank you

Hi, I'm trying to do the same thing in testnet. What unix-time/slot should I use  for testnet ? Thanks in advance.

Note this answer could change if a hard fork changes parameters.
The Shelly unix time is the start time of the Shelly era and the Shelly slot is the corresponding slot. We use these values to ignore the Bryon era (with odd slot value).
Calculate a slot: (returns the Cardano slot)
UNIX_TARGET_TIME - 1596491091+ 4924800

Check a slot: (returns unix timestamp)
1596491091 + (SLOT - 4924800)

Python example:
from datetime import datetime

SHELLY_UNIX = 1596491091
SHELLY_SLOT = 4924800

def getSlotFromUnixTime(ut):
    return ut - SHELLY_UNIX + SHELLY_SLOT

def getUTCEstimateFromSlot(slot):
    ts = SHELLY_UNIX + (slot - SHELLY_SLOT)
    print(datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))

source code: https://github.com/pixel-pool/PythonCardanoSlotsScript

Calculating a timestamp from a slot number is risky!
Theoretically, the slot duration could be changed by a hard fork for example because of performance reasons (as has already happened). So it's probably best to use an oracle for now.
But because time is used so frequently, it would probably be best if Cardano would support a more reliable native solution that avoids oracle fees.

ok thank you i thought slotnumbers were a reliable timestamp

That is very unlikely. This is the reason that the coefficient number was introduced. This parameter will be used to tune the network pace, not the slot number. The reason for the change in Shelley was this exact bad design, that is now fixed.

Also, Cardano will likely lean into having to use an oracle, as evidenced by their explicit relying on a random global oracle for Ouroboros Chronos, and their overall trend towards distributed systems, not just distributed payment channels.


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:
Why Strict Evaluation Operator "!" used in record definition implemented in Plutus Core?
While declaring records for use in Plutus strict operator is used like this:
data Auction = Auction
   { aSeller   :: !PubKeyHash
   , aDeadline :: !Slot
   , aMinBid   :: !Integer
   , aCurrency :: !CurrencySymbol
   , aToken    :: !TokenName
   } deriving (Show, Generic, ToJSON, FromJSON, ToSchema)

Does this mean that Plutus Core does not use lazy evaluation?

This is correct. Plutus Core uses eager evaluation. You can see this in the first section of the Plutus Core Specification. I'm not sure why however I'd expect it is to allow you to accurately estimate fees and avoid infinite data structures.
This PDF contains the formal language specifications of the Plutus Core language.


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

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

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

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


text:
How to verify if KES is valid without needing to wait for the next minted block?
With reference to my previous question regarding inconsistent reading of KES validity given by cardano-node and gLiveView, is there any way I could objectively verify KES validity without waiting for the next block?

Things you can verify:

Current opcert counter is higher than previous counter on chain in a block created by your pool (you can use dbsync or query a public instance) - you already saw in your previous thread that expected OCert for your node was 6). Starting Vasil fork, it is expected that - upon rotation, your opcert counter is higher by exactly 1
Expiry date of KES  (can query EKG or also just check gLiveView).
Make sure your cert was derived using kes from your cold key using which pool was created.

Once each of above is verified, it's simply a matter of waiting for your next block to get the proof/assurance. The above are pretty much the only checks you can perform.

What if you haven't done any blocks yet? Mine is currently up to 9, no blocks done, and the cert instantly expires.

@Cyberience - "instantly expires" => That suggests you're likely not using right start period for KES (assuming you're verifying it correctly using right files and post node restart)

Try the 2 commands below to see if they give you the info that you need.
1 - Cardano version 1.34.0 (and 1.34.1?) has a bug that does not show KES calculations correctly - this should be fixed in 1.35.0. Below is from 1.34.1 after I did a KES rotation earlier today.
$cardano-cli query kes-period-info --mainnet --op-cert-file op.cert

✓ The operational certificate counter agrees with the node protocol state counter
✓ Operational certificate's kes period is within the correct KES period interval
{
    "qKesNodeStateOperationalCertificateNumber": 14,
    "qKesCurrentKesPeriod": 505,
    "qKesOnDiskOperationalCertificateNumber": 15,
    "qKesRemainingSlotsInKesPeriod": 6783509,
    "qKesMaxKESEvolutions": 62,
    "qKesKesKeyExpiry": "2022-09-22T21:44:51Z",
    "qKesEndKesInterval": 558,
    "qKesStartKesInterval": 496,
    "qKesSlotsPerKesPeriod": 129600
}

2 - Try using the localhost HTTP metrics details via CLI - note your port number may vary:
$curl -s 127.0.0.1:12798/metrics | grep KES

cardano_node_metrics_operationalCertificateExpiryKESPeriod_int 567
cardano_node_metrics_currentKESPeriod_int 505
cardano_node_metrics_remainingKESPeriods_int 62
cardano_node_metrics_operationalCertificateStartKESPeriod_int 505


text:
Nix shell fails to start for Plutus
maciej@ola:~/workdir/plutus/plutus$ nix-env --version
nix-env (Nix) 2.3.12

Running the nix-shell command for the default.nix in Plutus and getting a genuine http 404 error that stops the whole nix shell from starting.
trying https://bintray.com/joneshf/generic/download_file?file_path=purty-6.2.0-linux.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
error: cannot download download_file?file_path=purty-6.2.0-linux.tar.gz from any mirror
builder for '/nix/store/g0drypafpyzckkpwzplp9k9amx4bf7a4-download_file?file_path=purty-6.2.0-linux.tar.gz.drv' failed with exit code 1
building '/nix/store/a7wvz8wy4iqy5ynbx49lf23a4w7dxixg-drv.r29349.tar.xz.drv'...
cannot build derivation '/nix/store/wdgbj9xf3rz44xz5afw20m1ns0n8llpg-purty-6.2.0.drv': 1 dependencies couldn't be built

Git log
git log
commit e11d59a181f558fb5d2e5b0a2a32afd496660bc1 (HEAD -> master, origin/master, origin/HEAD)
    Author: Jann Müller <j-mueller@users.noreply.github.com>
    Date:   Tue Jun 22 08:28:10 2021 +0200

Am I using a wrong Plutus branch? If so which branch / tag should I use to start the Plutus Playground.

I got stuck here, any ideas? I've done all steps needed, so not sure what the problem is.

I was just able to pull down the latest Plutus code and start a nix shell so I don't think it is the branch.
What does your binary cache configuration look like?
https://github.com/input-output-hk/plutus#how-to-set-up-the-iohk-binary-caches

Neither the /etc/nix/nix.conf nor the /.config/nix/nix.conf exists, so I take I don't have caches set up.

I had to manually create these files on my machine

Thanks. The way I read it is this, could it be that you only managed to succeed to run nix-shell because you had binary caches specified, i.e., you downloaded the binaries without actually building plutus that is? Or did you succeed with running nix-shell without binary caches?

Actually, I don't need to build it if I can just use the binaries. Thanks.


text:
Is KES rotation operation time sensitive? Does the datetime of the offline machine need to be set correctly?
Talking about key-gen-KES and issue-op-cert operations of cardano-cli.
Does the output of these functions depends on the machine clock?
They are part of rotating the KES process of which one of the steps if performed on an off-line machine, meaning no NTP time synchronization over the network. And if we combine that we no battery on the off-line machine that we get a date time that is far from current.
Hence my question. Do the KES rotating operation need to be performed on machines that have date and time set correctly? Can the offline machine clock be off by hours? days? months?
   cardano-cli node key-gen-KES \
        --verification-key-file kes.vkey \
        --signing-key-file kes.skey

and
cardano-cli node issue-op-cert \
    --kes-verification-key-file kes.vkey \
    --cold-signing-key-file $HOME/cold-keys/node.skey \
    --operational-certificate-issue-counter $HOME/cold-keys/node.counter \
    --kes-period <startKesPeriod> \
    --out-file node.cert

I did a quick search on the cardano-node Github repo for both
key-gen-KES and issue-op-cert but I am not familiarized with the cardano-node codebase enough to make any sense of it.

The notion of time is based on the input startKesPeriod, which is taken from the most current KES period of the blockchain.
You get the current KES period by dividing current slot number of the blockchain with the slotsPerKESPeriod parameter.
Hope that helps.

Thanks. Yes, obviously but this is an explicit input. I should have been more verbose in my question perhaps as it is the implicit inputs that I am concerned about. Not the explicit ones that users provide themselves. In other words, can you tell if the only datetime reference that is needed for either of these two operations is the kesperiod?

That's a great question. I've done some research, but without fully understanding the code behind cardano-cli, I can't say for sure. Hope someone from IOG will answer this.


text:
I got error while building package plutus-core-0.1.0.0 when installing cardano-wallet using stack
I'm using MacOS Monterey with M1 chip and trying to install cardano-wallet. I've already installed pre-requisites cardano-node and cardano-cli no problem, and already synced with the testnet.
I was following this guide
https://developers.cardano.org/docs/get-started/installing-cardano-wallet
At step $ stack build --test --no-run-tests, I got the following error happening at 443/460

This is after I tried running $ stack build --test --no-run-tests again right after

Can somebody help me?

I'm not a Mac guy but the error looks like a mismatch between x86 and ARM arch code. Maybe look more into using Rosetta (Intel emulation).
This might help too: https://cardano.stackexchange.com/questions/4035/installing-cardano-node-on-an-m1-mac

Did you build cardano-node or download the binary?

@MC_Brisbane Thanks, but I will try to follow the Github guide first on cardano-wallet repo itself, since the Cardano Developer website seems outdated.
I built the cardano-node from the source using cabal, didn't download the binary

Ok good, since you built the node from source that is a good sign that your env is/was working ok without fundamental issues.


text:
How to switch from Legacy Testnet into Preview / Pre Production Testnet?
I have previously installed node 1.33.0, and now I've upgraded my node to 1.35.0. I already have a 'db' folder when I'm using 1.33.0. If I want to switch to Preview / Pre Production configuration and environment, should I create a separate 'db' folder and download the full blockchain from the beginning, or can I use my previous 'db' folder from the Legacy Testnet? Will it cause any conflict?

First, you need to upgrade to 1.35.3 for Preview or Preprod.
You will need the new configuration files for Preview or Preprod (https://book.world.dev.cardano.org/environments.html), and you need to delete the db folder and sync from scratch (which is very fast now, as the blockchains are small).

Thank you. I have follow-up questions:

Are there any binary or executables that are ready to download for MacOS, so I don't have to build using Nix?

What is the difference between Preview and Preprod? I read it here that the Preprod is still on Alonzo and not Plutus V2 updated

I don't know if you can find the binaries for MacOS.
The difference in explained in the link I gave you in the answer. And correct, preview is forked, preprod still in Alonzo.


text:
How do we check if cardano wallet made by the community is safe to use?
Daedalus and Yoroi were made by IOHK and Emurgo (indirectly), so the credibility is there right from the start, and we can trust it (that it is not meant for malicious intent).
But when it comes to wallets that are made by the community, how do I know that it is safe to use? What are the parameters we should check first, to make us certain that our private key or seed phrase is not being collected by the wallet platform?

DO YOUR OWN RESEARCH!!!
Not to sound pretentious or unhelpful, but lets imagine a spectrum of trust:
On one end, there is the super paranoid computer nerd who doesn't use any software unless they can read and audit the code themselves. On the other end, there is the naive grandma who downloads/executes anything the screen tells her to. Where the rational person falls on this spectrum should vary GREATLY on a case-by-case basis.
For example, your criteria for trusting a proprietary social media platform with your personal info will (hopefully) be very different from your criteria for trusting an open financial platform with your assets. Ask yourself: "If I trust software developed by IOHK, how did I come to such a conclusion, and how can I use the same process to come to conclusions for other open source products?".
Software reliability should not be thought of in absolute terms. The amount of trust you place in any kind of software product is a personal choice that YOU must make in accordance with your individual circumstances and what YOU believe is appropriate. Ask yourself:

What is your level of expertise?
What (or how much) is at stake?
How much expertise are you willing to outsource to members/developers of the community, and how do you go about doing so?

As a personal example, I have very little coding experience, but from hours of community engagement here and on other forums, something like Nami Wallet SEEMS like it is trustworthy. The creator has a solid track record of community engagement, it is recommended by many community members on several different forums/info-sources, and nowhere have I seen anything catastrophically negative said about it (I can say the same for several other SPO tools such as CNCLI and the Guild Operators suite). Would I store millions of dollars of assets on it? No, but nor would I store all of my assets on any one single wallet, even one developed by IOHK.
To summarize:
One must figure out an appropriate "amount of trust", per "unit-of-value", to place in a product of a "perceived-reliability".
Sorry if this response is long-winded or over-generalized, but I believe that everyone in the this community is pioneering the shift towards a world of true data sovereignty. It is therefore imperative that we develop the necessary skills and habits to thrive in such a world, because with great power comes great responsibility... just my two cents.
So say it with me:
DO YOUR OWN RESEARCH!!!
:)


text:
Can I restore my Yoroi account with only 12 words?
Yoroi wants 15 words from me, but I only wrote down 12. I know it was a Shelley wallet, and can see all details about my Cardano.
Can I restore my account without seed phrase?

Yoroi uses 15 words for its seed phrase. You did probably used Daedalus to generate it. I recommend you to try to use Daedalus to restore it.

For anyone having this problem in the future:
There are a couple of wallets I know of that do support importing a 12 word seed phrase for Shelley era Cardano wallet:
Eternl Wallet
Atomic Wallet


text:
How to decode a pointer from Shelley address?
I'm writing an address parser based on CIP-0019. The part I have problems with is the POINTER data structure which consists of three "variable-length positive numbers". The format of the number is described as:
VARIABLE-LENGTH-UINT = (%b1 | UINT7 | VARIABLE-LENGTH-UINT)
                     / (%b0 | UINT7)

So, IIUC, I should read bytes while their oldest bit is 1, then read one byte more. I should also clear the oldest bits from them. Then I finish with a bunch of UINT7.
How should I convert them to the final integer value?

The following Python code does the thing. Iterating from right, those 7-bit UINTs should be cleared of the oldest bit, then shifted right by their right-index.
def popvarlenuint(data):
    _intbytes = []
    while data:
        b = data[0]
        data = data[1:]
        _intbytes.append(b & 0x7F)
        if b & 0x80 == 0:
            break
    val = 0
    for idx, b in enumerate(reversed(_intbytes)):
        val = val | (b << (8 * idx) - idx)
    return val, data


text:
Cannot build cardano-wallet-2021-12-15
I'm trying to build cardano-wallet with cabal. However, it fails wit the following error:
[19 of 20] Compiling Cardano.Ledger.TxIn ( src/Cardano/Ledger/TxIn.hs, dist/build/Cardano/Ledger/TxIn.o, dist/build/Cardano/Ledger/TxIn.dyn_o )

src/Cardano/Ledger/TxIn.hs:108:12: error:
    Not in scope: ‘HS.viewHash32’
    Module ‘Cardano.Crypto.Hash.Class’ does not export ‘viewHash32’.
    |
108 |       case HS.viewHash32 (extractHash sh) of
    |            ^^^^^^^^^^^^^

src/Cardano/Ledger/TxIn.hs:109:9: error:
    Not in scope: data constructor ‘HS.ViewHashNot32’
    Module ‘Cardano.Crypto.Hash.Class’ does not export ‘ViewHashNot32’.
    |
109 |         HS.ViewHashNot32 -> TxInCompactOther tid (fromIntegral index)
    |         ^^^^^^^^^^^^^^^^

src/Cardano/Ledger/TxIn.hs:110:9: error:
    Not in scope: data constructor ‘HS.ViewHash32’
    Module ‘Cardano.Crypto.Hash.Class’ does not export ‘ViewHash32’.
    |
110 |         HS.ViewHash32 a b c d -> TxInCompact32 a b c d (fromIntegral index)
    |         ^^^^^^^^^^^^^

src/Cardano/Ledger/TxIn.hs:118:38: error:
    Not in scope: ‘HS.unsafeMkHash32’
    Module ‘Cardano.Crypto.Hash.Class’ does not export ‘unsafeMkHash32’.
    |
118 |     tid = TxId (unsafeMakeSafeHash $ HS.unsafeMkHash32 a b c d)
    |                                      ^^^^^^^^^^^^^^^^^
cabal: Failed to build cardano-ledger-core-0.1.0.0 (which is required by
test:unit from cardano-wallet-core-2021.12.15, exe:local-cluster from
cardano-wallet-2021.12.15 and others). See the build log above for details.

I've found a solution for similar error but adding the constraint of hashable < 1.3.4.0 doesn't change anything.
Has anyone succeeded with a cabal build?

Recommended way to build cardano-wallet is with stack. Check out this manual:
https://developers.cardano.org/docs/get-started/installing-cardano-wallet
I tried to build wallet recently and it was successful. Let me know if you will still have issues building it with stack. Cheers!


text:
Multisig wallet for Cardano?
Does Cardano support multisig wallets? If not, are there any ongoing projects to have them implemented, any standards defined or at least drafts proposed?

The node does support multi-signatures (for instance you can do a multi-signature when minting NFTs). However, the wallets do not yet support this. But its coming eventually!

Are there any docs on those multi-signatures?

@MarekMahut-StakeNuts The links seems to be broken (404)

Github Link for the comprehensive guide
You can create your own Multisig Wallet using cardano-cli locally. However, this is for a technical people and with basic knowledge on how Cardano UTXO works and the concept of private/public key to sign transaction etc. The development of creating a user-friendly multi-sig wallet is still ongoing Round Table
There's a guide on how to create Cardano's Multi-sig Wallet + ability to stake the wallet.
Here's the general overview:

Generate public key pair of payment.vkey and stake.vkey (verification key) for your wallet and the participant's wallet
Create the script policy (using Native Script) and provide this information *basically telling who are the people that need to sign / approve transactions for this wallet
Create the address (called Script Address)
Everytime you want to do transaction with this wallet, participants need to sign the .raw transaction file using their private payment.skey or stake.skey file locally.

This is at the core level / behind the scene on how to create and use multi-sig wallet on Cardano.

I just launched https://broclan.io
Anyone looking for a multisig wallet on Cardano can give it a try :)

Leo, is broclan still up and running. As far as I can tell, it doesn't seem ready for mainnet yet?

@JacquesBosch its up an on Mainnet. If you need any help please reach out to me on twitter or Discord (links on the broclan website).

Below are 2 more options I have found.
The Summon Platform
https://medium.com/@SummonPlatform/multi-signature-treasuries-ba855e748878

Multi-signature Native scripts are one of the most secure ways of
managing funds on the Cardano blockchain. Current use cases range from
personal backups, trusts, or “fail-safes,” to subDAOs, guilds, working
groups, investment clubs, hedge funds, p2p swaps, and even
multi-player betting or gambling games. And that’s only scratching the
surface. In the future, we expect to see many new and exciting use
cases that benefit from this simple yet secure scripting language.
... The Summon multi-signature treasury system focuses heavily on user
friendliness and easy treasury management. The interface allows you to
assign signers/key holders by simply inputting their Cardano receiving
address or by resolving their $ADAHandle directly in the UI.
Create A Multi-Sig Treasury The Summon multi-signature treasury system
requires no coding experience and is compatible with all popular
Cardano lite wallets. Creating a new treasury is simple: ...

LedgerFlow by Iagon
https://docs.iagon.com/docs/whitepaper/products/ledgerflow/
Here is what they say:

Ledgerflow is an innovative project that operates within the Cardano
blockchain ecosystem. It offers two essential features: Multisender
and Multisignature (Multisig) capabilities. Let's delve into each of
these functionalities:
Multisig is a powerful security feature that enhances the safety of
cryptocurrency wallets and transactions. In a Multisig setup, multiple
parties (often referred to as signatories) collaboratively manage a
wallet. Transactions require approval from a predefined number of
these signatories. For instance, a company treasury might use a
Multisig wallet where three out of five board members must sign off on
any outgoing transaction. This prevents unauthorized access and
provides redundancy.


text:
What are the ways of making NFTs unique?
In the week 5 of Plutus Pioneer Program Lars described how to make NFT by spending an UTxO while minting, therefore ensuring the uniqueness of the token.
Are there any other ways of making NFTs unique?
What if I wanted to create let's say, a collection of thousands of unique tokens. Creating as many UTxOs to refer to them further on would incur significant cost in the fees. Are there any cheaper/simpler ways to do it?
PS: Solutions not available in Plutus yet are also welcome as examples.

"What if I wanted to create let's say, a collection of thousands of unique tokens. Creating as many UTxOs to refer to them further on would incur significant cost in the fees."
Are you hoping to have many NFTs created in a single transaction? AFAIK tokens created from the same script will always have the same currency symbol. It might save on fees if you forge them all in one transaction but different scripts.

NFTs have to be minted in some way or the other. In order to mint you will have to run a script with monetary policy for which you have to pay a fee, so might as well use that UTxO.
You can mint multiple NFTs in a single script though. Remember that a Value is identified by its CurrencySymbol and the TokenName. The CurrencySymbol is unique because of the UTxO input and is shared across all NFTs minted in the same contract. You can use a different TokenName for each NFT to ensure uniqueness.

I've been wondering about this. Are two tokens that share a currency symbol but have unique token names effectively as non-fungible as tokens with unique currency symbols?

I believe that is the case.

So, for example, if I wanted to represent land plot ownership by a NFT, I could mint as many of them as transaction size limit permits, spending a single UTxO. The plot ID would be included in the TokenName and people could trade those tokens freely but wouldn't be able to modify the plot ID within the tokens they own?


text:
How can I write unit tests for Plutus contracts?
I'm a member of Plutus Pioneer Program. I already know about the Plutus Playground and like it very much. However, clicking all the blockchain action scenarios each time is very time-consuming, especially that after changes in the source code the test scenario often gets wiped out.
It would be much better to have a framework to define and run unit tests, as well as not having to edit the code in the browser.
Although I'm new to Haskell, I'm pretty sure there is some unit test environment. Is it also possible to write scenarios in a file and put assertions on blockchain state, instead of clicking them in the Playground?

You can use the EmulatorTrace monad introduced in Lecture #4 for unit testing. You find examples of such tests in https://github.com/input-output-hk/plutus-apps/tree/main/plutus-use-cases/test/Spec .

Thanks Lars.
Do you perhaps want to update the broken link. I found this answer while searching for a related question.

You can also use this https://github.com/mlabs-haskell/plutus-simple-model
I'd say it's better because it's more up to date than the plutus-apps repo needed (for Contract Monad) from IOG (a lot is missing from Vasil)


text:
When actually a validator is deployed to the blockchain?
I'm re-watching the Plutus Pioneer Program and in the video #2 I don't exactly get it here: https://youtu.be/E5KRk5y9KjQ?t=1782
There's the same contract code used by Wallet1 and Wallet2. Each of them submits a transaction calling give() and both of them land in the same block. Both script hashes are identical, well, because the validators are so. (And I understand that script hash is actually a hash of the deployed validator).
How is/are the validator deployed to the blockchain in that scenario?

Does each of the wallets deploy their own copy?
If so, wouldn't the hash clash become a problem?
If both deploy a copy, when Wallet3 refers to the same contract, by calling grab(), which of the validators is being run? Both?

The validator script sits inside the EUTxO. Its job is to permit or deny the consumption of the EUTxO.
So, in the example from the lecture, when wallet1 gives, it actually produces an EUTxO that has our validator script inside it. When wallet2 gives, it produces another EUTxO which has the same validator script inside it.
When wallet3 wants to grab, it finds those two EUTxOs and wants to consume them. When wallet3 wants to consume the first EUTxO, the validator inside
that EUTxO runs and permits its consumption. When wallet3 wants to consume the second EUTxO, the validator inside that EUTxO runs and permits its consumption. Now that wallet3 is allowed to consume those two EUTxOs, it consumes them and produces its own output.


text:
Compiler Error {-# LANGUAGE DataKinds #-}
I try to compile EnglishAuction.hs code in playground web app and keep on getting compiler error.
"[compiler] [E] loadObj "/nix/store/jmhwwzn1yfjzlxavz16afkf1r4shmp8z-
persistent-sqlite-lib-persistent-sqlite-2.13.0.3/lib/x86_64-linux-ghc-8.10.4.
20210212/persistent-sqlite-2.13.0.3-8rnIaulr0SMFWDeiU7TZN4/HSpersistent-
sqlite-2.13.0.3-8rnIaulr0SMFWDeiU7TZN4.o": failed"

I just removed the module section of the code in EnglishAuction.hs and paste it into playground web. It work and no compiler error.
module Week01.EnglishAuction
( Auction (..)
, StartParams (..), BidParams (..), CloseParams (..)
, AuctionSchema
, start, bid, close
, endpoints
, schemas
, ensureKnownCurrencies
, printJson
, printSchemas
, registeredKnownCurrencies
, stage
) where


text:
Where is the on-chain code actually stored?
I've just read something that suggests Validators aren't actually kept on the blockchain. To save the space, only the hash of the Validator is kept at the UTxO and users willing to spend it must themselves provide the Validator code with matching hash value.
Besides the funny fact that on-chain code doesn't actually live on the chain, that brings a number of questions, of which the first and most obvious will be:

How the actual Validators are stored? I mean the repositories may and should be distributed and each SC author could provide their own source of the code, but
Is there any standard format of such packages (most likely containing also off-chain code) that could be loaded into wallets or other clients?
Since the hash refers to a compiled version of the Validator, i.e. the Plutus Script code, how could users make sure that the binary is a result of compilation of the source the author publishes? Having the compilator and libraries being developed and optimized, it's almost sure the compilation results will vary over time, obviously changing the hash.

As stated by Samuel, the code that a validator runs to check whether a transaction is valid is sent and stored in the transaction body as an input.
So all scripts, be they Plutus or Native scripts, get stored on chain when any UTxO's locked by the script are consumed (though they are not part of the UTxO ledger state, but stored in another part of the ledger) and are retrievable through the chain-indexer, Blockfrost or even in some cases, from some blockchain explorers.
For example, you can use the Blockfrost API "Script CBOR" to access the script CBOR. Here's a link to understand how to do this.
Additionally, if you just look at a sample transaction on CardanoScan itself, for example this transaction claiming an UTxO for the simple "Always succeed" plutus script address [3], we can see that the datum in CBOR is 182a.
Using an online tool caller cbor.me we see that the datum/redeemer was 42 (182a in CBOR hex). The contract bytecode is also listed there, but this is not human-readable plutus core code.
Now for the off-chain part that safely can construct transactions for users, that needs to be distributed by the writer of that script. I know that IOG (also known as IOHK) is building a Dapp store to safely distribute such offline code.
And lastly, you are correct! The plutus script hashes to the address, so if one would change the code, a new address should be used. Note however that complex Dapps may use several contracts, for example look at the Occam dex that they showed off [5] They used 3 contracts to implement certain behavior. So over time use cases may change, and other addresses might be used.
EDIT
After the Vasil HF in the Babbage era, transactions can witness the scripts by referencing them in other UTxO's that may not be consumed in the transaction. This way, scripts do get stored on the active UTxO graph part of the ledger. These referenced validators will also become available inside plutus (6).

Auxiliary scripts are an attribute in the txbody that can have the validator script in it if it's small enough. You could also have metadata that links your users to the script off-chain.


text:
How to connect Yoroi to testnet?
I already have a testnet cardano-node running on my machine. How can I connect Yoroi there? Is the hetwork hardcoded in the wallet or I'm missing some advanced settings?

You need to install Yoroi Nightly.


text:
Minting and spending from the same script in a single transaction
I have a state NFT token locked in an hybrid script written in Aiken. I want to :

spend this NFT state to the script itself ( with a new datum which stores the new issuance state )
mint tokens I want to distribute. ( the state NFT is designed to
store the minting issuance numbers ).

Is it possible ? I have coded my offchain code with lucid, but I can't do both minting and
spending... But I can't figure why it wouldn't be possible to do both in the same transaction.


text:
How is the hash of a stake pool metadata file calculated?
I know how to use the CLI to compute the hash of stake pool metadata file, what I'm not sure of is how the hash is actually computed. What hash algorithm is used? Is the file hashed as raw bytes? Pointers to the cardano-node source code where this is accomplished is also appreciated.

The hash algorithm is Blake2b 256 and it is calculated on the raw metadata bytes.
I do not know where it is in cardano-node, but in cardano-db-sync its calculated at https://github.com/input-output-hk/cardano-db-sync/blob/master/cardano-db-sync/src/Cardano/DbSync/Era/Shelley/OffChain/Http.hs#L153


text:
What do I need to run a stake pool?
I would like to run a stake pool, but don't know if I am capable to do this. What do I need for that?

Running a stake pool requires two main components, technical ability and marketing savvy. I'll outline some of this at a high level for you below.
Technical

Linux server administration. You must be able to setup and administer a server that will run your pool and relay nodes. You will need to be comfortable running applications in the terminal.
Bash scripting (for setting up your pool, running the nodes, etc.)

Marketing

A pool cannot make blocks without attracting delegation. It takes around 1.2M ADA staked in the pool to average one slot per epoch (whether or not you actually forge the block at the assigned slot depends on the technical abilities).
Pools need effective marketing to attract enough delegators unless you own enough ADA yourself.
This is actually the hardest part about running a pool.

One last thing is pledge, currently the pledge only has a small effect on the rewards a pool earns. However, this is set to increase in the future. The exact amount of pledge needed is unknown but will be more than a few thousand ADA. Looking at most of the pools that are out there I would assume anything less than 50-100k ADA will not be sufficient.
There is a plethora of resources for how to setup a node, but hopefully this helps to answer the question of whether or not this is something you want to pursue. Good luck!

I like that you answered the politics side as much as the technical one. As a DevOps Engineer, I was thrilled with the idea of setting my own pool and helping the protocol along the way, until I discovered it's not really "random guy with good technical skills"-friendly.

Lots of time

"It take around 1.2M ADA to average one block per epoch." Can you unpack that for me? I understand you to mean that the return on investment is 1ADA per 1.2M per epoch.

Stake pools have to make blocks in order to earn any rewards. The number of blocks a pool is chosen for is dependent on the amount of ADA staked to it. The size where a pool will average one block each epoch is around 1.2 M.

This is the guide that I used and also included the prerequisites from their site below:
https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node

Prerequisites
Mandatory skills for stake pool operators
As a stake pool operator for Cardano, you will be competent with the following abilities:

operational knowledge of how to set up, run and maintain a Cardano node continuously
a commitment to maintain your node 24/7/365
system operation skills
server administration skills (operational and maintenance).

Mandatory experience for stake pool operators

experience of development and operations (DevOps)
experience on how to harden and secure a server.
passed the official Stake Pool School course.

It's is the most comprehensive guide out there, IMO.  I used it for setting up my own stake pool.

something which is not mentioned....
please remember,

you need 1 Block Producer (BP)
and Relay(s)
1 Relays is enough, but for your Redundancy it is better and recommended to run 2 Relays minimum.

for the Redundancy and High Availability of your BP, it is recommended to run another Node. but we are not allowed to run 2 BP. if you produce a block from 2 BPs, your pool will be penalised.
which means, manually or automatically, you have to prepare a second Node as BP, to run this node as Relay and only if the main BP is down to run this second node as BP, so that you dont loose an assigned Block.
for any further question, dont hesitate to ask.


text:
Are the locked funds in a contract still considered as delegated to a wallet and can get staking rewards?
The question here is if script-locked outputs can still have a staking key associated with them  (decided by the person creating the output) and whether this enables the funds to be delegated in a contract to get staking rewards.

Yes, it will be possible to associate a staking address for script outputs.


text:
What is the maximum timeout for a contract that you can define in Marlowe?
We know that Marlowe contracts always end mandatorily because a maximum timeout is defined. I wonder what the maximum timeout is, it seems like you can put a huge epoch/slot in which would be practically "infinite".

You're correct that the duration of a Marlowe contract could be practically "infinite": there is no specific limit on the timeout slot for a Marlowe contract.

What is your source? The link you provided is not specific enough to qualify as an answer.

(1) Timeout can be any slot number, (2) the Marlowe state machine does not impose any limits on the slot number, and (3) the Marlowe redeem code does not either.


text:
Understanding do notation with Monads in Plutus Pioneer Week 04
I have a question regarding a block of code from th Week04 Plutus Pioneer Program.  The block is in Writer.hs
foo'' :: Writer Int -> Writer Int -> Writer Int -> Writer Int
foo'' x y z = do
    s <- threeInts x y z
    tell ["sum: " ++ show s]
    return s

For reference,
threeInts :: Monad m => m Int -> m Int -> m Int -> m Int
threeInts mx my mz =
mx >>= \k ->
my >>= \l ->
mz >>= \m ->
let s = k + l + m in return s

tell :: [String] -> Writer ()
tell = Writer ()

instance Monad Writer where
    return a = Writer a []

number :: Int -> Writer Int
number n = Writer n $ ["number: " ++ show n]

Why does
foo'' (number 2) (number 3) (number 4)

return
Writer 9 ["number: 2","number: 3","number: 4","sum: 9"]

and not
Writer 9 []

Obviously there are holes in my understanding, but I read the do block as follows:

The result of threeInts x y z is Writer 9 ["number: 2","number: 3","number: 4"]
9 is extracted from this to the definition s
tell ["sum: " ++ show s] results in Writer () ["sum: 9"]
return s results in Writer 9 []

I know that return in Haskell is not the same as it is in an imperative language, but I'm failing miserably to grok how to read this block effectively.  The lambda version producing the same result is more explicit and makes sense to me.
bindWriter :: Writer a -> (a -> Writer b) -> Writer b
bindWriter (Writer a xs) f =
  let
    Writer b ys = f a
  in
    Writer b $ xs ++ ys

foo' :: Writer Int -> Writer Int -> Writer Int -> Writer Int
foo' x y z = x `bindWriter` \k ->
             y `bindWriter` \l ->
             z `bindWriter` \m ->
             let s = k + l + m
             in tell ["sum: " ++ show s] `bindWriter` \_ ->
                Writer s []

I read this backwards where (for my concrete example) Writer 9 [] is bound/combined with Writer () ["sum: 9"] which is then bound/combined with Writer 4 ["number: 4"], Writer 3 ["number: 3"] and Writer 2 ["number: 2"] where the Int values are discarded in the bind process and the "logs" are concatenated.
There is something implicit in the do notation that I'm overlooking or not reading correctly.  Any help appreciated.

The 'secret' is in the bindWriter function that drive the Writer monad.
instance Monad Writer where
    return a = Writer a []
    (>>=) = bindWriter

It is the bindWriter function that aggregates the string list of the Writers and this happens as part of the execution of the do block which is a list of monadic statements.
For instance, comment out the tell line and the do block in foo'' returns
Writer 9 ["number: 2","number: 3","number: 4"]

Rewriting the do block to
foo'' x y z = do
     threeInts x y z

returns the same result. Without return the do block returns the result of the last line (and the compiler complains when it isn't of the right type).
Adding a Writer line returns the Int from the Writer, but the full list of strings:
foo'' x y z = do
     threeInts x y z
     Writer 0 ["adding 0"]

return
Writer 0 ["number: 1","number: 2","number: 3","adding 0"]

The tell function causes a string list to be added ignoring the Int part. The threeInts result needs to be captured because it contains the Int result that needs to be returned (and the tell line needs it for the text line).
This monad allows the writing of functions that operate on the Ints and that can emit appropriate messages that are handled in the background.

This is what I was missing.  Much appreciated!


text:
Building local Plutus documentation
I've been following this guide to build Plutus documentation locally.  The key line is -
[~/plutus] nix-build -A plutus-playground.haddock

This works fine, but I'm following the Pioneer Program and this requires checking out specific commits each week in order to follow the lesson.  When re-building the documentation, the resulting docs doesn't seem to reflect the tag that I've checked out.
My steps are -

git pull origin master to get the latest commits
git checkout of the tag specified for the week
rebuild the documentation using nix-build -A plutus-playground.haddock

I'm guessing that there is some caching going on that I'm not cleaning up but, if I compare the source files in the plutus dir they don't match the source that is linked to in the documentation.
Should mention that I have a superficial understanding of both nix and haddock.
Any guidance appreciated :)

I've not tried building the documentation. But here is what I use

Thanks @Aoaddeola . That works for the latest version, but the API changes quite a lot from week to week. It makes it hard to follow the lectures when the docs that Lars is referencing are different from the latest.  The lectures themselves are a lot to take in, so easier when you can follow what he's pointing out 1:1.

You can say that again, Phil. I also find myself having to figure out the latest signature of functions through searching Github using Keywords... It sure would be nice to know how to build the documentation.

There is also an option to build the documentation using docker, I tried it and it failed when starting it using docker-compose. Have you tried this option? The commands you need are docker-compose build --no-cache followed by docker-compose up in the /docker directory.

I have been building the documentation with
[~/plutus] nix-build -A plutus-playground.haddock

following the Plutus Community guide and
nix build -f default.nix docs.site

from the Plutus repo and they both work as expected, generating the documentation for the current checkout.
The most probable cause for the issue is that git may not have updated as expected, i.e. throwing an error due to changed files in the local repo. That happened to me a few times when I was switching between the pioneer lecture weeks.
And in my opinion it is worth to set up the webserver as per the Plutus Community instructions, it makes the up to date documentation a great resource!

How to build local Plutus document:

cd plutus
nix-shell
nix build -f default.nix docs.site
cd result
python3 -m http.server 8081

Try open http://localhost:8081/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Value.html#g:1

this worked for me

I keep finding myself coming back here as i hate remembering commands.
So I somewhat automated the process. On Ubuntu (Unless you disable your Firefox browser) the following script will build and launch your plutus docs.
To use it copy the script to your plutus folder and activate your environment with nix-shell.
Then run the bash script from the terminal using the command:
sh Make_Docs.sh
You can get the Make_Docs file from my plutus automation repo.


text:
ERC-20 converter transaction history
When Ethereum projects move over to Cardano via the erc20 converter, will their existing transaction history be maintained on the Cardano blockchain?

Not directly, as the token minted on the Cardano blockchain will be a new asset.
If such an use case is needed, one might use an oracle to see it or metadata to record it at the minting time.


text:
Dapp connector for cardano-cli wallets
I've read about the Yoroi dapp connector, but is there a way to connect a wallet which was created with cardano-cli to some dapp?

I tried yesteard i would try with Nami but you must convert your Keys to one compatible with Cardano Serialization Lib, I read that they are compatible here https://github.com/Emurgo/cardano-serialization-lib/blob/master/doc/getting-started/generating-keys.md but i do not know how to use the CBOR in the cardano-cli keys for doing this, but if you start with your 24 words phrase in Cardano-cli, you could use that same 24 words in the Cardano Serialization-Lib, follow the instructions in the page above and connect to Nami.

cardano-cli uses a different way to generate from th other wallets Daedalus or Yoroi.
The creation of the keys via cardano-cli does not include the step of derivation from bip39 mnemonics entropy - which is a prerequisite for using it in other wallets.
Although all the keys conform with the same bip32-Ed25519, cardano-cli do not allow to be recovered via the seed phrase.
It is possible to convert the keys in other direction:
mnemonic-bip39 keys -> cardano-cli vkey/skey format

bip32-Ed25519enter link description here

Thanks for your answer but unfortunately this is not very helpful. Please add more details and clean up the link description to actually answer the question. Ideally your answer should contain all information needed to answer the question.


text:
Can we expect to see already existing stablecoins on Cardano?
I know there is a new stablecoin (AgeUSD) that is supposed to be released on the Cardano blockchain, but I haven't heard anything about having other stablecoins, like Tether (USDT), be added to the Cardano blockchain. Is this something we can hope to see, or is the creation of AgeUSD going to make the addition of Tether not necessary?

As far as I know, the Liquity team is interested to have their protocol deployed on Cardano too. But it is too early to tell.


text:
How does Cardano compare with other blockchains in terms of being eco-friendly?
It is pretty common knowledge now that Bitcoin is extremely energy intensive to mine, and that Cardano is several orders of magnitude less intensive. However, there are other cryptocurrencies that are marketed as eco-friendly, like Nano, but they are not necessarily blockchains. How does Cardano compare to other blockchains and cryptocurrencies in terms of being eco-friendly?
Also, how will this change in the future if Cardano gains the same popularity as Ethereum or Bitcoin? Will this cause Cardano to become more energy intensive to mine, thus making it less eco-friendly?

The rate of transactions per second does not affect Cardano's power consumption significantly, but implementation of smart contracts, scaling mechanisms, etc. may have a measurable impact in the future.
Cardano is largely as eco-friendly as all proof-of-stake blockchains.  Its actual energy consumption is roughly the power consumption of a typical staking pool node times the number of staking pool nodes.  The power consumption per transaction is millions of times more energy efficient than Bitcoin.
In general

Proof-of-work (PoW) blockchains rely on the miner's ability to produce the answer to a question whose answer must be guessed, then proven to be correct.  The more guesses and proofs that the miner can make per second, the higher their odds of winning the next reward.
Proof of stake (PoS) blockchains rely on the quantity of a cryptocurrency owned or delegated to the miner to raise their odds in a fair lottery to win the next reward

PoW blockchains favor miners with the most computing power and PoS blockchains favor miners with the most coins (owned or delegated).
Over time this has led to the two largest PoW cryptocurrencies (Bitcoin and Ethereum) using millions of times more power than PoS blockchains.
Cambridge Bitcoin Electricity Consumption Index


text:
How will DApps work on Cardano?
This may been too broad of a question but I was hoping to ask a few specific questions here rather than over multiple questions. I don't think DApps are available yet but I'm sure people have started preparing for them.
Will we need to learn Plutus to make DApps and how easily can you transition from Solidity to Plutus programming? I'm also wondering what incentive there is to create and launch a DApp on Cardano over Ethereum?
If anyone could answer these question and perhaps point me in the direction of places to find more resources that would be great.

There is a plan to port Solidity to Cardano. I believe there's even a running prototype. There are also plans for a cross-compiler that would transform most popular languages into Plutus. But personally, if you intend to jump in with both feet, I think it's worth learning the native language. For help getting started, look for the Plutus Pioneer lecture videos.
I see two major advantages in adopting Cardano today.

Transaction fees are demonstrably and vastly cheaper than Ethereum which is attractive to you and your end users.
Striking early, now, gives you a first-mover advantage to a captivated audience.

Can you elaborate on transaction fees?

Charles Hoskinson mentioned that first Solidity (the Ethereum smart contracts) will be available in the testnet of Cardano and in the future they will be incorporated as sidechain once the sidechains implementation is in production.
More on Smart Contracts on Cardano check this video.

Is your question how dApps will work or how smart contracts? So far I only see (incomplete) answers for smart contracts, given there is already development in smart contracts including Plutus and Marlowe.
Given that there is already amazing stuff that can be done with the recent releases on the Cardano (test and main) network (TX with metadata, Native tokens including NFTs, Hydra), you can start already building apps (dApps) that take advantage of these.
dApps can already be built with the various libs and tooling being released.
https://docs.cardano.org/getting-started/integrating-with-third-parties
You can manage wallets, accounts and talk to your own Cardano node(s). There are multiple endpoints already ready in these libraries including GraphQL, Rossetta, Wallets, etc.
The developer docs were just released and they look fantastic. https://docs.cardano.org/


text:
Running submit-api on mac for Nami to connect to Daedalus?
I found windows-based instructions for this, and looking to do it on mac. Problem is I know nothing about Windows Powershell.
Could someone help translate the following, suitable for mac terminal?
$ENV:CARDANO_NODE_SOCKET_PATH = (Get-ChildItem \\.\pipe\ | Where-Object {$_.name -like "cardano-node*"}).FullName

Run this to check to see if the command worked.
$ENV:CARDANO_NODE_SOCKET_PATH

You should see something like
\.\pipe\cardano-node-mainnet.12768.1

Now execute the next command to start the Cardano Submit API
.\cardano-submit-api.exe --mainnet --socket-path $ENV:CARDANO_NODE_SOCKET_PATH --config .\tx-submit-mainnet-config.yaml --port 8090

You should see
Running server on 127.0.0.1:8090

To clarify from the above, if I export an env var, what should 'something here' be on mac/linux?
export CARDANO_NODE_SOCKET_PATH='something here'
As for the command to execute, I think it should just be:
.\cardano-submit-api --mainnet --socketpath CARDANO_NODE_SOCKET_PATH --config tx-submit-mainnet-config.yaml --port 8090
Only bit I'm stuck with is what the actual env var is or how it is being set above.

TD;DR
Full instructions for Mac/linux are here: https://pastebin.com/MbjkvgL5
Regarding permissions running unverified applications: https://www.lifewire.com/fix-developer-cannot-be-verified-error-5183898

Long version
Found it going to this video:
https://www.youtube.com/watch?v=sfLhNEtiktA
Under one of the comments was a link to this twitter post:
https://twitter.com/877PSBYTE6/status/1485438232254812163
Which referenced this manual:
https://pastebin.com/MbjkvgL5
Important note
I had to allow about 7-10 lib files which were not allowed by the mac’s default security policy.
Did this by opening “Security & Privacy” in “System Preferences”.
This helped to go through the security: https://www.lifewire.com/fix-developer-cannot-be-verified-error-5183898


text:
How big is the Cardano blockchain (now and in the future)?
This may sound a naively simple question, but...

How big is the blockchian today?

How big is it likely to become in future?

I note that Daedalus' state directory on my machine is currently ~10.3G.
Is it correct then to say that that's the "size of the chain" today?
For the second question, we could hypothesize a number of scenarios, like:
5 million Digital Identities are issued.
What impact is that likely to have on storage requirements of Daedalus?

It's hard to tell how the network will grow into the future because of both varying usage and IOHK introducing new chain optimisations etc.. However we can work out the hypothetical maximum growth using the current chain parameters.
Max_Block_Size = 65536 bytes
Blocks_Per_Epoch = ~21000
Epoch_Length = 5 days

So we could say a rough maximum chain size increase over an Epoch is Max_Block_Size * Blocks_Per_Epoch which comes out as 1.4155776 GB per epoch or around 100 GB per year.

I'm only answering about the size for now: on one of the cardano nodes that I just checked some seconds ago
$ du -sh state-node-mainnet
9.4G

I can't say how fast it grows. I just look at it from time to time.

That is your size containing all the forks probably. Fresh sync of the mainnet is somewhere around 8.5GB.


text:
Does Cardano have a decentralised monetary policy?
I’ve heard people claim that bitcoin is the only crypto currency which has actually decentralised monetary policy (being the basis for the claim that it cannot therefore be changed).
Since minting takes place as part of the proof of work, I can understand this, perhaps, at least at a high level.
Are block producer rewards in Cardano a source of newly minted ada?
Is there any analogy to bitcoin halvings?
How does one go about understanding the monetary policy, to then be able to asses whether it is truly decentralised?

Short answer, all ada in existence was minted in the genesis block, there is no more ada that can be minted or burned.
The minted ada went to the treasury and stake pool operators receive a reward from it until it gets depleted, then all rewards will be generated by fees.
A better an complete read for this is here https://docs.cardano.org/explore-cardano/monetary-policy

Cardano is likely to be the only crypto ecosystem with true decentralization. It aims to achieve this in the Basho era. The monitory policy regarding supply is mathematically frozen since it is mathematically impossible to mint ADA.
All other aspects like inflation in terms of rewards and treasure are controlled by parameters that will be tuned based on "Voting" by ADA holders. The voting process is currently working through Project Catalyst for funding projects in Cardano. Catalyst. The voting system has improved in the last year, and will handle the changes/tunings required in a decentralized way.
In addition to monitory policy, "Cardano Improvement Proposals" can handle future threats in a decentralized manner. For example, there is no way for Bitcoin to migrate to Proof of Stake or other sustainable condenses mechanism since there is no mechanism to handle change. Therefore we can safely claim that Cardno has a truly decentralized ecosystem, since "Change is the only constant in the world" and a protocol that can handle change in a graceful and in a truly decentralized manner is the real decentralized protocol.


text:
cardano-node meaning of inbound outbound connection
I'm trying to find out the difference between connection types on the P2P network.
I'm aware of the difference between inbound and outbound TCP connections from a firewalling perspective, but I sense cardano-node also does slightly different behaviours depending on whether a connection is inbound or outbound.
For example Daedalus by default makes an outbound connection, it can send transactions and receive blocks, but it does not appear to relay transactions or blocks.
A full cardano-node has outbound and inbound connections, but I think these may be unidirectional for data propagation based on gLiveView.
P2P seems to add duplex connections, which I assume is Tx and Rx on the same connection, but how is that different to non-P2P?
If someone could clarify that would be appreciated.

In cardano blocks are being pulled via incoming connections. So if you have stake pool, then your relays must have incoming connection for your blocks being populated to the network. Contrary your relay must have outbound connections so it can fetch blocks from other relays.
In non-p2p world relays must have config file with other relays in it from where it will fetch blocks and your relay should be in other config files, otherwise your blocks will not be propagated. In p2p cardano nodes don't need to have manual topology files, where other relays are listed, but rather cardano node will learn peers from ledger/blockchain. Additionally duplex is not mandatory for p2p, you can switch it off, so duplex is not equal to p2p, but rather additional feature. With duplex 2 relays can fetch blocks inside same connections between them, without need to open 2 separate connections.
More details you can find in great video from Andrew Westberg here:
https://www.youtube.com/watch?v=ek_DK6Qoqrc


text:
What is the protocol for generating addresss in Cardano?
I assume the protocol is similar at a high level to Bitcoin:

Generate private key from entropy

Use ECDSA to make a public key

Do some hashing to generate an address (inc checksums etc.)

What are the specific steps at the lower level, for example if we were to code an address generator outside of a wallet, what functions would we need?

Check out CIP-19 - it describes the structure of addresses in Cardano, and is currently active.
Additionally, you may find skimming through CIP-3 and CIP-5 can complement this, as well as CIP-1852 useful as a refresher.
Cheers!


text:
How are Updatable network parameters rolled out to the decentrlaized network, and how are they depreciated?
CIP-0009 contains upgradeable parameters, if certain keyholders sign them, they appear to be changeable without updates to node software or configuration files: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0009/README.md#updatable-protocol-parameters
We just saw a change to block-size and Plutus script size in epoch 306, how was this change effected if it is not reflected in software or config files, is it an on-chain transaction?  How can we discover those in an explorer?
How are Upgrade-able parameters removed?  For example the decentralization flag still shows in mainnet-shelley-genesis.json, has it been removed now, and if so, how?

Upgrade-able network parameters are modified by changing the parameters by writing a transaction into the block-chain itself, nodes then read the parameters from the block history.
Example transaction that changed the block size for epoch 306: https://cardanoscan.io/transaction/bf095309ba20174d1a5c30ea03580cbf8bfe7dd75da1203d9ed51bfd151bb327?tab=protocolupdates

The "certain keyholders" that you are talking about are called genesis keys, and are (for now) the only real way to affect changes/governance on the actual protocol. Before we get to the Voltaire/Governance era, these keys are controlled by IOG, Emurgo, and the Cardano Foundation. Over time and as we transition into the Voltaire Era, those three entities will slowly relinquish the keys' power over to the community.

Thanks but that doesnt answer my question about how changes are effected


text:
How to stop cardano-node from the CLI?
What is the command or process to gracefully stop a cardano-node instance from the CLI?

Depends on how you started the node. If it was started as a systemd service, you'd run the following: sudo systemctl stop <NODE_SERVICE_NAME>
If the node was started using the raw cli command cardano-node run, then you can just run ctrl-c in the same terminal that the node is running in, and it will perform a graceful shutdown.


text:
How to decode cbor which is generated with cardano-cli build command?
I am trying to sign a transaction which is built on some other place and I can see only cbor for example:
{
    "type": "TxBodyAlonzo",
    "description": "",
    "cborHex": "86a500818258201db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338000d8001828258390003a114d3cf5200be6d1990493620ce2155a756582ec92ae4c532942902053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc6046861a0591fd6482583900cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf592291a000f4240021a000290f90e809fff8080f5f6"
}

With command cardano-cli text-view decode cbor I am getting the following:
$ cardano-cli text-view decode-cbor --in-file tx.build
86  # list(6)
   a5  # map(5)
       # key
      00  # int(0)
       # value
      81  # list(1)
         82  # list(2)
            58 20 1d b7 31 b2 34 9b 2a 16 74 55 12 80 9c 86
            75 6e d4 2e 25 47 f8 cf 7b 93 d8 80 3b d8 8b d6
            83 38  # bytes(32)
            00  # int(0)
       # key
      0d  # int(13)
       # value
      80  # list(0)
       # key
      01  # int(1)
       # value
      82  # list(2)
         82  # list(2)
            58 39 00 03 a1 14 d3 cf 52 00 be 6d 19 90 49 36
            20 ce 21 55 a7 56 58 2e c9 2a e4 c5 32 94 29 02
            05 3e 0c 6f 43 4f 19 a2 05 fb 5c 11 85 00 cc 77
            dc 32 c4 e0 b2 a7 cc bc 60 46 86  # bytes(57)
            1a 05 91 fd 64  # int(93453668)
         82  # list(2)
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)
            1a 00 0f 42 40  # int(1000000)
       # key
      02  # int(2)
       # value
      1a 00 02 90 f9  # int(168185)
       # key
      0e  # int(14)
       # value
      80  # list(0)
   9f  # list(*)
   ff  # break
   80  # list(0)
   80  # list(0)
   f5  # bool(true)
   f6  # null

From above the following represents receiving address:
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)

How I can decode this to address?

Been thinking about this question for a while. I haven't yet found a way to decode the specific 57 byte cbor to an addr-style address, but I suspect it will involve using the above keymappings in some sort of cborHex- to ASIC converter (or something along those lines).
However, if all you're looking for is to extract transaction information from an Alonzo body, cardano-cli was just updated to the newest version 1.31.0 which allows you to convert Alonzo era Tx Body's into human readable format:
Saving the above TxBody to file tx.alonzo, I then run the following using cardano-cli version 1.31.0:
cardano-cli transaction view --tx-body-file tx.alonzo
which prints:
auxiliary scripts: null
certificates: null
era: Alonzo
fee: 168185 Lovelace
inputs:
- 1db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338#0
metadata: null
mint: null
outputs:
- address: addr_test1qqp6z9xneafqp0ndrxgyjd3qecs4tf6ktqhvj2hyc5efg2gzq5lqcm6rfuv6yp0mtsgc2qxvwlwr938qk2nue0rqg6rqxewe52
  address era: Shelley
  amount:
    lovelace: 93453668
  datum: null
  network: Testnet
  payment credential:
    key hash: 03a114d3cf5200be6d1990493620ce2155a756582ec92ae4c5329429
  stake reference:
    key hash: 02053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc604686
- address: addr_test1qrxs7m67uke5ckhe4fq0ex060zyedun7ge9fd4v08efyhnjnu93a5kcawxmc8uph5az7zfgtnhey2p65llkh37l4jg5smqzhph
  address era: Shelley
  amount:
    lovelace: 1000000
  datum: null
  network: Testnet
  payment credential:
    key hash: cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce
  stake reference:
    key hash: 53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf59229
update proposal: null
validity range:
  lower bound: null
  upper bound: null
withdrawals: null

Sorry if this doesn't answer your question directly, but as far as extracting an address (along with all the other Tx info) from a cbor-encoded TxBody, this is the best that I could come up with.


text:
How to get all utxos from script with off chain code ordered from the oldest to the newest?
Is it possible to get all utxos from address but with specific order for example from the oldest to the newest ones? I am not sure in which order this function utxosAt returns: https://github.com/input-output-hk/plutus-apps/blob/404af7ac3e27ebcb218c05f79d9a70ca966407c9/plutus-contract/src/Plutus/Contract/Request.hs#L397

I am not familiar with this function, but if you could share a/the result from the function, that might be helpful.

You could use Time Tokens, this solution is proposed by Minswap team:

An effective way to prevent malicious ordering is to make each batch
request hold a time token. A time token can only be created if its
asset name is a timestamp that is after the validation range upper
bound. This prevents anybody from creating a time token in the past.
This BR will only be validated if all BRs in the same transaction are
of the same type and are ordered by this time token. This enforces
that there would only be one way to order BRs in one transaction.

https://medium.com/minswap/introducing-laminar-an-eutxo-scaling-protocol-for-accounting-style-smart-contract-d1ac8847dde8#:~:text=An%20effective%20way,in%20one%20transaction.

The UTxO itself doesn't provide information on the time it was created. However, each UTxO is part of a transaction.

Using blockfrost.io you could query all UTxOs of an address:
https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1{address}~1utxos/get

This will give you a list of UTxO that look like this:
{
"tx_hash": "39a7a284c2a0948189dc45dec670211cd4d72f7b66c5726c08d9b3df11e44d58",
"output_index": 0,
"amount": [],
"block": "7eb8e27d18686c7db9a18f8bbcfe34e3fed6e047afaa2d969904d15e934847e6",
"data_hash": "9e478573ab81ea7a8e31891ce0648b81229f408d596a3483e6f4f9b92d3cf710"
}

Using the tx_hash of each UTxO, you can query the transactions: https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}/get

Besides other information, you can see the block_time (UNIX timestamp) there:
{
"hash": "1e043f100dce12d107f679685acd2fc0610e10f72a92d412794c9773d11d8477",
"block": "356b7d7dbb696ccd12775c016941057a9dc70898d87a63fc752271bb46856940",
"block_height": 123456,
"block_time": 1635505891,
"slot": 42000000,
...

With this information you can then order your UTxOs. Hope this helps!

Here is one way:
If you print out the result of utxosAt you'll see that each UTxO has a field txValidRange which is the slot range over which the Tx could have been executed. By default that field is set to
txValidRange = Interval {ivFrom = LowerBound NegInf True, ivTo = UpperBound PosInf True}

This isn't helpful in your case, since it means it could have been executed any time.
When constructing a Tx, however, you can constrain the valid range:
Constraints.mustValidateIn (interval (Slot 11) (Slot 11))

Which will change the valid range to:
txValidRange = Interval {ivFrom = LowerBound (Finite (Slot {getSlot = 11})) True, ivTo = UpperBound (Finite (Slot {getSlot = 11})) True}

You can then know that this UTxO was created on slot 11 (if not, the Tx would have failed execution), and use these values to sort the UTxOs.

Notes:
In my experience, the txValidRange is useful in Plutus scripts, since the execution is deterministic, i.e. you can check the valid range of the tx, but you can't check the current slot from within the script. I'm not sure that means the execution slot isn't knowable after the fact though, outside of the script.
I'm going to dig into the codebase a little and see if there is a way to lookup a UTxO after it's added to the chain to see when it was added. For now the above answer is the best I've got.


text:
Will the size of transaction be affected if the same input script is provided multiple times for different utxos?
If there are multiple --tx-in-script-file for the same plutus script file only with different utxos is that means that multiple times will be sent plutus script and that will affect the size of a transaction?
For example:
SCRIPT=AlwaysSucceeds.plutus
...
  --tx-in 941a7f0159053338f4ee97c19b2d3fcf802f137a4d6bdac301871a37da72e97a#1 \
  --tx-in-script-file $SCRIPT \
  --tx-in-datum-value 20 \
  --tx-in-redeemer-value 1 \
  --tx-out addr_test1qqp6z9xneafqp0ndrxgyjd3qecs4tf6ktqhvj2hyc5efg2gzq5lqcm6rfuv6yp0mtsgc2qxvwlwr938qk2nue0rqg6rqxewe52+11900000 \
  \
  --tx-in c5692c4242bfd6a52b1eb33ada17fe65a7291644baeec08644b3df8bfdb0267a#1 \
  --tx-in-script-file $SCRIPT \
  --tx-in-datum-value 30 \
  --tx-in-redeemer-value 100 \
  --tx-out addr_test1qz270xngvhp50nvc5cxktsuh6tf7s3sanh5gyqr4dphx6qzdvmtrj9qmssswlxaty64q9xukz3z3xecqch6hvfcn8tqq0g3wej+1400000+"60 29856eae5151337853ffbd8fd80df78dab8c7f09c37c95799328abb8.RTOK" \
...

Does this mean that size of the transaction will be increased for the size of the script 2 times, or just once independent of how many times is added?

I think the script is only included once in the final transaction, even if you supply it twice. The best way to check though would be to build the transaction both ways and check if the transaction.raw files differ in size.

In the transaction, I have 3 utxos that are consuming from the script and when I remove one of them, the transaction file size from 2059B comes to 1563B. I have datum and redeemer also removed but it looks like it is sending a copy of the script for every utxo.

No it won't. The script needs to only be provided once. This is generally true for any witness in transactions. For example, if two or more inputs require a signature from a same signing key, only one signature is needed to validate all inputs.


text:
How to create signer hash for cardano-cli transaction build --required-signer-hash?
I need to use --required-signer-hash instead of --required-signer because I don't want to have access to the payment signing key, instead I want a user to create a hash and send it to us. How to create the hash of the payment signing key?

The following command gives the hash of a payment address
cardano-cli address key-hash --payment-verification-key-file payment.vkey

Remember to change the file name from payment.vkey


text:
How to download specific cardano-node binary from nixos hydra - https://hydra.iohk.io/
I usually go to https://github.com/input-output-hk/cardano-node/releases and follow the link to download "Hydra binaries" but I want to download version 1.35.2 because 1.35.3 is currently not working on testnet.

How to find version 1.35.2 on https://hydra.iohk.io/ tried with the search but without success?
Is there any connection between Github commits and builds on hydra?

1.35.2 is known to have a bug. Why would you want it for any reason other than testing?

I want to test the newest version but since 1.35.3 is not working on testnet I wanted to use the newest one after that.

In general, there is no good reason to use an older release of cardano-node. However, if you must, you can get it as follows:

First, select the prebuilt binaries for the desired release tag from GitHub. And look for the latest release commit or PR for that version.
Then scroll to the bottom of the page, look for a button that reads "View details", click it, and a list of actions will open.
Select the ci/hydra-eval action and click the "details" link.
You will be redirected to the Hydra evaluation page.
And look for the prebuilt binaries in there. For example, if you wish to download 1.35.2 for Linux, you look for cardano-node-1.35.2-linux, alternatively, if you want 1.35.2 for mac look for cardano-node-1.35.2-macos, and click the table row to go to the build job details.
You will see the direct download link to get a tar.gz file containing the binaries.


text:
How to generate TransactionBody in cardano-serialization lib from cardano-cli's TxBodyAlonzo cborHex
I want to get cborHex from cardano-cli transaction build output and use it with cardano-serialization-lib to recreate the transaction body. I tried the following:
cborHex = '86a80081825820b9f5091d866b60db8ea3548d987fc237e5d89c8159aa6ddcee28fcf98b93860e000d80018282583900c19efef37292ee5b59ec5683ed52b537f43b1763f48469760affda73d6587eb03872ccf2ea313c55a5e6cfee9a409541dfa9b61fe35dfb921a3ab510f983581d70d5fa699784d82763328fbaee27412967a95f3371dfd69df3ceece8e71a004c4b405820851fe9c7b4b2e760c8b5f77a10963ea75a989f9285dcf988f637b814fd89946b021a0002c699031a03162a4508000e80075820f02f7b2a5ec946db2417a9afd42e27528763d39c3bf758fff7e9871230212c8e9fff8080f5d90103a100a1190cffa365646174756da26b636f6e7374727563746f7200666669656c647382a165627974657378386331396566656633373239326565356235396563353638336564353262353337663433623137363366343834363937363061666664613733a163696e741b000000075140a9da6b7573657241646472657373827840616464725f746573743171727165616c686e77326677756b366561337467386d326a6b356d6c67776368763036676736746b70746c613575376b74706c747177782c726a656e657735766675326b6a37646e6c776e6671663273776c34786d706c6336616c7766716e78306466326c77616e746564416d6f756e741b00000007b3d84700'
bytes = Buffer.from(cborHex, 'hex')
CardanoWasm.TransactionBody.from_bytes(bytes)

I am getting error
Uncaught Deserialization failed in TransactionBody because: Invalid cbor: not the right type, expected `Map' byte received `Array'

Is it possible to do this, and if yes what I am doing wrong?

In the new version of cardano-cli which is shipped with cardano-node 1.34 there is a new flag for transaction build --cddl-format which creates the same cbor like it is used in ledger https://github.com/input-output-hk/cardano-node/pull/3505. With this flag results cborHex is compatible with cardano-serialization-lib.
  const txBytes = Buffer.from(cborHex, 'hex')
  const tx = S.Transaction.from_bytes(txBytes)
  const txBody = tx.body()
  const txAuxilaryData = tx.auxiliary_data()
  const txHash = S.hash_transaction(txBody)

  const witnesses = S.TransactionWitnessSet.new()
  const vkeyWitnesses = S.Vkeywitnesses.new()
  vkeyWitnesses.add(S.make_vkey_witness(txHash, signKey))
  witnesses.set_vkeys(vkeyWitnesses)

  const transaction = S.Transaction.new(txBody, witnesses, txAuxilaryData)
  const cborSignedHex = Buffer.from(transaction.to_bytes()).toString('hex')

This solves the problem in the topic but I have currently another problem that auxilary_data is not the same and I got an error on submit ConflictingMetadataHash. Looks like an issue with cardano-serialization-lib https://github.com/Emurgo/cardano-serialization-lib/issues/396

How to get signKey at frontend from nami wallet?


text:
Calculation cpu and memory exUnits on transaction submit is different then on transaction build?
I am trying to build a non-optimized script and during the cardano-cli build transaction I got an error:
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 2 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 3356097790
| mem: -240
})
Script debugging logs:
the script for transaction input 3 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 3356097790
| mem: -240
})
Script debugging logs:
the script for transaction input 4 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 3356097790
| mem: -240
})

After optimization (BuiltinData -> BuiltinData -> BuiltinData -> () and custom ScriptContext)  build succeeded but then submit started to report error:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ExUnitsTooBigUTxO (WrapExUnits {unWrapExUnits = ExUnits' {exUnitsMem' = 16000000, exUnitsSteps' = 10000000000}}) (WrapExUnits {unWrapExUnits = ExUnits' {exUnitsMem' = 18581638, exUnitsSteps' = 6410063947}}))))])

Why does this happen? Shouldn't calculations be the same for build and submit so if it passes build it should pass also submit?