text:
How is it possible to create a mangled address (aka. franken-address) without the private stake key?
I've read a lot about mangled/franken addresses recently. A mangled address is an address, where the payment part of the address belongs to a different wallet than the stake part. This is an important thing to consider when building DApps on Cardano.
I'm wondering how it is possible to create such an address.
To create a payment address using the cardano-cli, both the private payment key and the private stake key are required:
cardano-cli address build \
    --payment-verification-key-file payment.vkey \
    --stake-verification-key-file stake.vkey \
    --out-file payment.addr \
    --mainnet

Let's say we have Alice who owns wallet A and Bob who owns wallet B.
Alice doesn't have access to the private keys of Bob, so how can Alice create an address with the payment part of her wallet A and the stake part of Bob's wallet B?
Or the other way around: How can Alice create a mangled address with Bob's payment part of wallet B and her stake part of wallet A?

The vkey are just the verification keys not your private (signing) keys which have skey suffixes. So creating a franken address only requires someones else's payment or stake vkey.

You can extract the PubKeyHash of a given address and hence you can also create a franken address combining the payment PKH with your stake PKH.

@William-BerlinPool But to spend the utxos i would still need both skeys, isn't it?

@wutzebaer To Spend a UTxO you just need the skey of the payment part of the address. The staking part is not relevant for spending.

For spending any UTxO, you either need the payment skey for the address that the UTxO belongs to, if it is a wallet address. In case of it being a script address, then the on-chain validator logic needs to pass in order for the UTxO to be spent.
Addresses are made up of one or two parts (payment part & an optional staking part). In order to create any address you'll need the verification key (vkey) of each part. All this is only applicable for shelley addresses. Byron addresses don't follow that structure.

Your cardano-cli example is correct - only the verification (public) keys are needed to build addresses, not the private keys. Therefore, we can build shelley addresses with any pair of payment.vkey and stake.vkey, regardless of whether or not they are derived from the same master seed.
"Mangled" in this case just means the payment and stake vkey's are derived from different master seeds.

ADA addresses (ignoring the bootstrap address type) consist of two components, like this (from here):
  = Addr Network (PaymentCredential c) (StakeReference c)

If you have two address, from two different wallets, you can create a franken address by taking the PaymentCredential from one address and the StakeReference from the other.

I am pretty sure its not possible to create one of these franken addresses with any of the standard tools. However, if you are relatively competent in Haskell its probably not difficult to write a tool to do it.
If you do not write Haskell, it may even be possible to do it with the JS library cardano-serialization-lib (which I have never looked at).

While a tool would ofc be helpful, the main goal of this question is to understand how it is possible to craft such an address when usually the private keys are required to create addresses.


text:
Is there documentation on the Prerequisites for Plutus Pioneer code?
I'm trying to run the Plutus Pioneer code on a Docker container based on https://hub.docker.com/r/nixos/nix.
I've followed this guide to install Cabal and GHC https://www.reddit.com/r/haskell/comments/dg4dvs/install_ghc_in_25mins_or_ghcjs_in_one_sleep_with/
I haven't been able to get GHCJS installed, though I'm not sure if it is necessary.
Is there any guide on pre-requisites for the Plutus Pioneer Program, ideally with install instructions?

It might be easier to start with the plutus-starter container, although I can't get it to work right now - I'm not sure if it's broken or that's just me (https://github.com/input-output-hk/plutus/issues/3405)

There are instructions on the official input-output-hk/plutus-pioneer-program repo in the exercises chapter here: https://github.com/input-output-hk/plutus-pioneer-program#exercises
I think you may be missing the following step:

Set-up IOHK binary caches How to set up the IOHK binary caches. "If you do not do this, you will end up building GHC, which takes several hours. If you find yourself building GHC, STOP and fix the cache."

As far as I can tell, GHCJS is not necessary, but I haven't tested this.

I do have the binary caches set up. The instructions in the input-output-hk/plutus-pioneer-program repo assume quite a lot is set up already. This includes but may not be limited to : nix, ghc, cabal and npm. I have installed all these and the Plutus Client is still not working for me. I was hoping for a one page "How to set up an environment from scratch". A ready made docker container would be even better.

I am running the Plutus Pioneer code in a nixos/nix based Docker container and it works a treat. I use the nix-shell as recommended in the pioneer program repo and I only needed to set up the IOHK binary caches and install git (using nix) as a prerequisite. I added curl and tmux to make it more user friendly. I use tmux to set up a three pane session containing the Plutus server, the playground GUI and one for interactive cabal. Below is the contents of the Dockerfile I use to buid the image.
FROM nixos/nix

RUN echo "substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/" >> /etc/nix/nix.conf && \
    echo "trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" >> /etc/nix/nix.conf && \
    nix-env --install git && \
    nix-env --install curl && \
    nix-env --install tmux

It is important to map the /nix folder to a data volume for better performance and to keep the size of the running container down. This folder can easily contain a few tens of Gb of data.
I keep the Plutus and Pioneer code repos on the host and map a data volume to bring it into the container:
docker run -it -p 8009:8009 -v hkvb_nixos_plutus:/nix -v $(pwd):/plutus hkvb/nixos.plutus:original sh

This command only exposes the port of the Playground UI. The hkvb/nixos.plutus image was built using the Dockerfile above and is available on Docker Hub.
There is one minor change required in the Plutus code to make the playground accessible from outside the container. This is in the webpack.config.js file of the plutus-playground-client. THe DevServer is only bound to the localhost network interface (of the container). Adding the line
host: "0.0.0.0",

makes the server available external to the container.
[UPDATE 08/08/2021]
I have found out that it is best to start from a freshly cloned (or new copy) of the Plutus repository when changing commits for build. Changing commit on a Plutus repository that was already used for a build often resulted in problems for me, often leading to never ending builds, especially when building the documentation.

I'm trying to get this work on my MacOS host, but when I run the Dockerfile, the resulting container has no nix commands available on it.
I must be missing something, and will have to do some more research about this, but shouldn't the docker image at nixos/nix have nix already set up on it?

I found the issue with this for me: when I build the image, the nix folder is there in the image, but when I run it, mounting the /nix folder as a volume overrides the nix folder from the image, so it has nothing in it.
I've now made a new Ubuntu based Dockerfile that sets up Nix, which is very similar to how the Nixos/Nix Dockerfile sets it up on Alpine, but I skip mounting the nix folder to a host volume.

source: Stack Exchange

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

sort: votes


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

What are cnfts?

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

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

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

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

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

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

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


text:
How does Cardano differentiate itself in the DeFi space?
How does Cardano differentiate itself in the DeFi space? What's the fastest way to start experimenting with applications?

Cardano differentiates itself as smart contracts are written in a more functional way than Ethereum Solidity contracts, so you can test Cardano contracts on your local machine, confident that they will run the same on the production network. Also, Cardano has things like Native assets, which simplifies handling of tokens.

At this moment, they are no DeFi applications deployed on Cardano as we're waiting for smart contracts.

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question. - From Review

Right, hard to answer as Cardano does not differentiate itself in the DeFi space as it is not in DeFi space.

Are there any perceived or hypothetical advantages that are known at the moment based on the properties we know to be true about the behavior of eutxos and plutus?


text:
Should I hold ADA as company to pay fees and issue Native Tokens for my game?
As far I know Carano will allow to pay fees in Native Tokens, so fees will be on ADA + a reward. But I have questions about it after reading this blog post from IOHK.
If I'm running the economy of my game, for instance as premium currency Gems with ticker GEMS let's have in mind these transactions:
t1. Player buys GEMS in-game, so will pay 1.45$ for 1$ worth GEMS + Apple/Google commissions + blockchain fees.

Q1. Either including an external payment system or validating Apple/Google transaction, Where is coming the liquidity? Me, as Company, should I hold a bag of ADA to pay fees and issue the equivalent in GEMS?
Q2. How a staking pool decide to accept which Native Tokens?
Q3. Is the staking pool nodes getting ADA + GEMS with every transaction?

Thanks for the help!

What exactly do you mean with "pay fees in Native Tokens"? Are you referring to the transaction fees?

Yes, not sure if I understand it properly, you pay transaction fees in ADA and... you also send your native token to the pool?

Stake-pools don't do anything with native tokens. Everything a stake-pool does is done with ADA. ADA is delegated to the pool and rewards are paid in ADA. It's not possible to delegate native tokens to a stake-pool.

alright! thanks a lot

This blog post is (to my understanding) just a thought experiment. I haven't heard of any plans for Cardano to support something like the "Babel fees" described in the blog post.

Q1: In order to send some native tokens to another wallet, you need to have your own wallet with the native tokens and some ADA to cover transaction fees. There is a minimum amount of ADA that needs to be sent together with any native tokens (currently ~1.4 ADA). This amount will be transferred to the wallet of the player who buys your GEMS. Then you also have to cover the transaction fee of ~0.17 ADA.
Q2: There is no such feature in stake-pools as of now and to my best knowledge it is not planned to have such a feature. There are projects that do something called an ISO (initial stake pool offering). A company creates a stake-pool and takes all rewards as fees. Then they send some of their native tokens (e.g. GEMS) to the people who delegated their ADA to the pool. But this is not what you want I think.
Q3: No, stake-pools only receive rewards in ADA.


text:
How do I get my Native Token listed on an exchange?
What does it require to be able to list my Native Token in exchanges, so that users of my ecosystem can buy it?

This is a very broad question. In general any centralized exchange (Binance, Coinbase, ...) has strict screening and a process through which the issuers would be required to showcase the viability of the token and their business model. Not an easy task to get your coin listed for sure.
Listing a token on a DEX (decentralized exchange) on the other hand is pretty easy. Uniswap for example allows to trade any token by importing them. However, there needs to be someone that provides liquidity for your token against another token, otherwise it won't be tradeable.
Cardano currently doesn't have any DEX, but there are a few projects in the making that should launch shortly after Alonzo has been released.


text:
Are there any C# libraries to connect to a Cardano node/acting as a wrapper for cardano-cli?
There are a few libraries in other languages (Java, JavaScript, ...) that act as an abstraction layer between the Cardano node or the cardano-cli and your own code. I'm looking for a C# library that can do the same.
I found the following 2 libraries:

https://github.com/tugolukov/cardano (built on the old REST API of Daedalus I think)
https://github.com/KanLei/AdaSharp (seems like a rough prototype)

They both haven't been updated in 2 years and to me it doesn't look like they are in a usable state. So are there any other projects to connect to a Cardano node using C#? Or has anybody any experience with making calls to the cardano-cli from C#?

There is a new library called CardanoSharp.Wallet which can be used to generate mnemonics, create private and public keys, create addresses, build transactions and sign transactions.
As of now this seems to be the only C# library out there.

As of now, there is a feature JS library wrapping cardano-cli.
Link: https://github.com/Berry-Pool/cardanocli-js
Kindly refer to https://developers.cardano.org/tools for further information on tools available for developers.
There are plans for developing tools and wrappers for a variety of languages.
I will update this space in case any good community project pops up.


text:
Is it possible to send a native token to another wallet while sending the minimum amount of ADA to my own wallet?
Every transaction needs to include at least 1 ADA (See: Is there a minimum amount of ADA I can send in a transaction?).
I want to send a native token to someone else, but I don't want to send them the 1 ADA.
Let's say we have the following wallets (TokenX is a native token or NFT):

WalletA:

UTxO: 2 ADA
UTxO: 1 TokenX

Wallet B:

UTxO: 10 ADA

WalletA wants to send 1 TokenX to WalletB. Can I construct a transaction where I send 1 TokenX to WalletB and 1 ADA to my own WalletA address?
The end result would look like this (ignoring transaction fees for simplicity):

WalletA:

UTxO: 2 ADA

Wallet B:

UTxO: 10 ADA
UTxO: 1 TokenX

How can this be done and is this possible in Yoroi or Daedalus?

Every transaction needs to include at least 1 ADA (See: Is there a minimum amount of ADA I can send in a transaction?).

No, every UTxO (i.e. output you're sending asset to) needs to be atleast 1 ADA. This was included to prevent dust and spamming on blockchain. In future , it will be possible to offload this minUtxo fee to block creators who may opt-in to this feature.
You can read more about it here. There will be updates to protocol parameters as part of Alonzo, but this will likely not change in immediate future.

Thanks for the answer. This kind of sucks as it makes small payments (e.g. tips) using native assets (as well as ADA) pretty much impossible since you always have to pay 1 ADA (currently >$1) extra plus the fees.

With babel (link in the reply) , you dont pay for any minimum output, as it will be offloaded to block producers. The idea is to reduce dust transactions on chain, you would still be able to use scripts for alternate fee models, once plutus is fully live.

Emmanuel is correct, based on the coin name there is an amount of ADA that needs to be sent to every target address.
My native token requires 1.444443 ADA to be sent to each and every target address, i.e. if I want to send 1 Bingo Token to 100 individual addresses, I have to send 1.444443 ADA to each target address, irrespective of whether I batch them all into one transaction.
Really hope this falls away sooner rather than later.

"based on the coin name" - this statement looks like it is incorrect - see comments below.

Can you please elaborate on how the token name influences the amount of ADA needed to send the token?

@eddex, I saw in a thread in discord that it has to do with the length of your native token name and the amount of decimals, but can't vouch for the accuracy. Actually, after looking into it, I found another example of a 1.44443 minimum ada on a token with 4 letters while I have the same minimum with 5 letters.
Here is a reddit thread discussing the fee: https://www.reddit.com/r/ADAXPRO/comments/o6cnle/moving_adax_to_yoroi_wallet/

Every Native Asset is sort of conjoined to 1.4XXXXXX ADA from my experience and so it basically impossible to simply just send the native asset by itself. It’s a part of it. You’ll end up having to cover transaction fees with part of your 2 ADA.
This is all from my time manually minting and sending assets with the CLI. Will advise further research.

What do you mean by "conjoined to 1.4 ADA"? To my understanding native assets are completely independent assets that live next to ADA. You only need ADA to pay for transaction fees and to cover the minimum amount that needs to be sent in a transaction.

Every native asset UTXO must move with at least 1ADA. It’s called the min-ada-value. With time and parameter adjustments that value will change.


text:
How to identify who sent a transaction
We are trying to figure out how to identify the sender (source address) of a given transaction retrieved using cardano-wallet.
Here is an example datastructure from the api. Be aware the field values are randomized (not real):
{
  inserted_at: {
    height: { quantity: 4263, unit: "block" },
    time: "2021-11-21T18:00:39Z",
    epoch_number: 190,
    absolute_slot_number: 4323,
    slot_number: 132423,
  },
  status: "in_ledger",
  withdrawals: [],
  amount: { quantity: 2000000, unit: "lovelace" },
  inputs: [
    {
      id: "80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e",
      index: 0,
    },
  ],
  direction: "incoming",
  fee: { quantity: 0, unit: "lovelace" },
  outputs: [
    {
      amount: { quantity: 2000000, unit: "lovelace" },
      address:
        "addr_test1qzwtzc4vrase42ytaj8nqam6z4322x5dx08gj2gxtjqy05wl5feqsw9lgy9askcyzjemw4d8x94n25nq204j6kqfpmhsn64us7",
      assets: [],
    },
    {
      amount: { quantity: 56, unit: "lovelace" },
      address: "addr_test1vqd00tpc537seq9hy64pupcu7s88x5w9jdln4lqyfees3swgmk",
      assets: [],
    },
  ],
  metadata: None,
  depth: { quantity: 370, unit: "block" },
  id: "d6c29eb3a8865b1e79d5cf2beb4d04b6685145a2c73d910d70e8f80080384",
  deposit: { quantity: 0, unit: "lovelace" },
  collateral: [],
  mint: [],
};

Now, the source address is listed in one of the outputs, since the transaction must send the remainder of the balance to it. However, this isn't a great way to identify the source address because it might not be there if there is no remainder, or there may be 3 or more outputs.
I expected the inputs to contain the address, but it just has an id.
I see no other mentions of the source address. How does one figure out who sent a transaction?

Not sure what you mean by the source of a TX, tx's in cardano consume a bunch of utxo's and create a bunch of utxo's, anyone with a wallet can create a TX and will need to sign it, so if the creator is what you mean by source, then the source is your wallet (or the wallet that created the tx)

All of that is accurate. So, based on the above data struct, can you tell me what wallet created the transaction?

Not really, a wallet can verify that it signed a transaction, so in a way you can have a wallet claim the tx.

You cannot find the sender address using cardano-wallet. You will need to install cardano-db-sync for that and query it, or you will have to use an external API (like blockfrost.io) and make a call to the endpoint documented here: https://docs.blockfrost.io/#tag/Cardano-Transactions/paths/~1txs~1{hash}~1utxos/get

A transaction consumes UTXOs not addresses, therefore you can see the 80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e#0 which is the UTXO being consumed.
To find out the originating address, you might need to list the transaction that created this UTXO.
I do not think cardano-wallet supports finding the wallet of a given address, so you would need to look through all the wallets to find your address.

Does this mean I would have to iterate through every wallet in existence looking for that utxo id in the wallet's transaction history? I don't think even that would work as the cardano-wallet api does not provide this kind of information in the wallet endpoint. There must be a way to figure out the sender, no? Wallets like daedalus show the sender. Is cardano-wallet just a red herring project which is unused?

You can query the input transaction hash, in your case 80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e using a block explorer like cardanoscan, or from your own running node using cardano-db-sync
For example, when I search the above Tx Hash in cardanoscan, I get:
https://testnet.cardanoscan.io/address/80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e
It seems like an unused address, but you mentioned the values were randomized. Try querying using the real TX hash that you are interested in. You should then be able to gather the info you need.

This is a good approach, but requires db-sync. I was trying to figure out a way using cardano-wallet.

You all are way over complicating this.. It's as easy as:
def get_return_address_from_utxo(utxo):
try:
    r = requests.get(f"https://cardanoscan.io/transaction/{utxo}")

    content = r.content.decode("utf-8").split(
        'FROM ADDRESSES (INPUTS)

Address

Amount

')
    sub = content[1].split("span")
    address = sub[0]
    address = address.replace("<", "")
    return address
except requests.exceptions.RequestException as e:
    return ''
except IndexError as e:
    return ''

This is a pretty cool solution. Unfortunately, it relies on third party data (cardanoscan) which introduces a vector for attack. If it were a fun website providing data this would be fine but as a payment processor this isn't an acceptable security tradeoff.

Something similar could just as easily be built using https://explorer.cardano.org/ which is IOHK and not third party..

iohk is a third party. But, maybe trustworthy depending on what you're building for.

Also, parsing HTML content that can change at any time is pretty fragile.

You can use db-sync. I wrote an article about how to do it on Medium
How to identify who sent a Cardano transaction using db-sync

Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.


text:
When will all 45 billion coins be in circulation?
I cannot find any accurate information with what speed and based on what formula the coins which are not in circulation will be in circulation and when (approximately) all coins will be in circulation.

The formula is quite complex, but at a high level it's an exponential decay like Bitcoin.
Up to 0.3% of the remaining reserves may be mined at each epoch (5 days), however it depends on various factors such as how many blocks were mined, so currently the average is closer to 0.2% per epoch.
At 0.2% per epoch, that corresponds to 13.59% of remaining reserves mined every year:
1 - (1 - 0.002)^(365/5) = 0.1359

So assuming 0.2% per epoch, it would take roughly 16 years (from genesis) for 90% of the supply to be in circulation, and 32 years for 99% to be in circulation.

So each year the percentage of minted coins is less because the transactions are more (they cover the rewards for the SPOs and the delegators)?

This is just what's coming from the reserve, transaction fees are in addition to that and are independent AFAIK.


text:
ERC721 Converter?
I've heard that Cardano will be releasing an ERC20 converter. I'm wondering if there are plans for the converter to work with ERC721 tokens as well.
I'm interested in how to make a new NFT token program interoperable between ETH and ADA.
Thanks!

There have not been any plans announced to create an ERC721 converter.  ERC-721 defines some functions with compliance to ERC-20. This makes it easier for existing wallets to display simple token information.  However, they have differing capabilities and attributes.
The Cardano solution for the foreseeable future seems to be issuance of a native token on the Cardano blockchain.
It is likely that the value of creating an ERC721 converter is outweighed by the work required.


text:
What prevents a bad user to provide a wrong signature to a transaction?
What prevents a bad user to provide a wrong PubKeyHash and sign it with a different signature in the Signed.hs example from the Plutus Pioneer Program NFT lecture?
Policy:
Policy:mkPolicy :: PubKeyHash -> ScriptContext -> Bool
mkPolicy pkh ctx = txSignedBy (scriptContextTxInfo ctx) pkh

Wallet-Code:
pkh <- pubKeyHash <$> Contract.ownPubKey
...
lookups = Constraints.monetaryPolicy $ policy pkh

Couldn't he just use a different pkh and change the transaction signature to mint the token?
What prevents that?
Update:
My question seems to lead people in the wrong directions, so to clarify:
I'm wondering how a transaction is actually signed and why that can't be manipulated.

I think your question will be clearer if you don't require readers to watch a video that is > 1 hour to get the necessary context. You could include the necessary context in your question and make references to the video unnecessary.

The video is actually not that important. It just provides a good example for signature checking. As already multiple times stated: I'm just wondering why signatures can't be manipulated and how that is working. But thanks for your feedback. :)

I don't know the specifics, but I believe under the hood the corresponding private key is used to sign the transaction and the public key is used for verification. So you cannot use any other public key, since you do not know the corresponding private key.

I'm no cryptographic expert. That answer goes in the right direction. Would be great if someone could extend it.
I suspect that a private key is sent around because then it could be stolen, right?

The 'txSignedBy (scriptContextTxInfo ctx) pkh' takes the given PubKeyHash and checks the  txInfoSignatories.
If the provided PubKeyHash is in the signatory, it will validate. The only way for that specific PubKeyHash to be in the signatory is if it is the original creator of the validation script. So only the original creator can validate this contract.
Check this github out, it is super helpful.
https://github.com/input-output-hk/plutus/blob/d958880388c285e369abaeabea28952a78703441/plutus-ledger-api/src/Plutus/V1/Ledger/Contexts.hs

I know all that already. What prevents somebody to provide a wrong transaction signature?

The policy can indeed be used by anyone to mint their tokens. However the actual minting policy script is dependent on the PubKeyHash, i.e. mkPolicy isn't the minting policy but mkPolicy pkh is. So for each PubKeyHash you get a different minting policy script and therefore a different CurrencySymbol. So with your PubKeyHash you will only be able to mint tokens for your CurrencySymbol because the minting policy will only validate those transactions.
As for the txInfoSignatories in TxInfo in ScriptContext, this is what the docs say about it:

Signatures provided with the transaction, attested that they all signed the tx

I'm assuming that checking the transaction signatures won't be done by the Plutus code itself once it's been integrated into the Cardano node. That is because validating transaction signatures is a very basic check that every blockchain node has to do anyways.

The first part is clear to me. It is well explained in the lecture.
I'm relatively sure that the signature will be checked within the Plutus Core code on-chain since it is compiled to that.

I'm wondering how a transaction is actually signed and why that can't be manipulated.

Transactions are signed using the signers private key. It is then legitimized by taking the signed transaction and the public key of the signer, and doing some cryptographic magic to determine if signer of the transaction also had access to the private key behind the public key. Watch this video https://www.youtube.com/watch?v=xIDL_akeras

If you want to know how it's done in Plutus right now check out validateTransaction (https://github.com/input-output-hk/plutus/blob/master/plutus-ledger/src/Ledger/Index.hs#L168) and follow checkValidInputs -> checkMatch -> signedBy (https://github.com/input-output-hk/plutus/blob/master/plutus-ledger-api/src/Plutus/V1/Ledger/Crypto.hs#L127).
Keep in mind that once Alonzo goes live Plutus will be integrated to the Cardano node (github.com/input-output-hk/cardano-node) which provides the actual executable. So far when working with Plutus we are just using a blockchain Emulator.


text:
Plutus Pioneer Program Week missing commit
The cabal.project file for Week 5 of the Plutus Pioneer program points to commit 8f1a47674a99ac9bc2aba3231375d8d6de0641d2 for the Plutus repo but that commit seems to not exist based on:
 2:22PM /Users/paymahn/plutus master ✱
 ❯❯❯ git checkout 8f1a47674a99ac9bc2aba3231375d8d6de0641d2
fatal: reference is not a tree: 8f1a47674a99ac9bc2aba3231375d8d6de0641d2

and this github search for the commit. Is this known? What's the correct Plutus commit for the week 5 homework? This is preventing cabal build and cabal repl from running successfully:
 2:24PM /Users/paymahn/plutus-pioneer-program/code/week05 (nix) main ✱ ◼
 ❯❯❯ cabal build
remote: Enumerating objects: 728, done.
remote: Counting objects: 100% (728/728), done.
remote: Compressing objects: 100% (285/285), done.
remote: Total 728 (delta 451), reused 666 (delta 400), pack-reused 0
Receiving objects: 100% (728/728), 184.31 KiB | 174.00 KiB/s, done.
Resolving deltas: 100% (451/451), completed with 138 local objects.
From https://github.com/input-output-hk/plutus
   daeb13477..c5083fce6  master                             -> origin/master
 * [new branch]          SCP-2858-chain-index-securityParam -> origin/SCP-2858-chain-index-securityParam
 + b63ecf5b2...4b94768e7 bezirg/costparams-test             -> origin/bezirg/costparams-test  (forced update)
 + 1d4eb1d72...4bd02c105 bezirg/retained-csv                -> origin/bezirg/retained-csv  (forced update)
 + 9441f7f66...971377a54 component-modules                  -> origin/component-modules  (forced update)
   7f77abdb3..a0258b9ba  hkm/ghcjs-cross                    -> origin/hkm/ghcjs-cross
 + 4f24c5258...a8be7ab68 hrajchert/scp-2779-fix-toast-when-reloading -> origin/hrajchert/scp-2779-fix-toast-when-reloading  (forced update)
   a1db411af..ed7e61160  jmchapman/ck-cek-eq                -> origin/jmchapman/ck-cek-eq
   b59aebf75..fec18d337  kwxm/list-sort-benchmarks          -> origin/kwxm/list-sort-benchmarks
 * [new branch]          merivale/marlowe-run-architecture  -> origin/merivale/marlowe-run-architecture
   ffb13a295..116d4d116  scp-1582-actus-quick-check         -> origin/scp-1582-actus-quick-check
 + 5a78a0736...879fed306 scp-2782-sqlite-in-freer-extras    -> origin/scp-2782-sqlite-in-freer-extras  (forced update)
 + 9b1ca49b0...d3fb79c45 scp-2783-chain-index-pagination    -> origin/scp-2783-chain-index-pagination  (forced update)
 + 8d679192d...0b8e46ead scp-2796-chain-index-query-utxo-currenty -> origin/scp-2796-chain-index-query-utxo-currenty  (forced update)
 * [new branch]          scp-2883-actus-derivative-contracts -> origin/scp-2883-actus-derivative-contracts
fatal: reference is not a tree: 8f1a47674a99ac9bc2aba3231375d8d6de0641d2

Turns out using the commit from Week06, 8a20664f00d8f396920385947903761a9a897fe0, is the cleanest solution (too bad it wasn't merged at the time of asking this question): https://github.com/input-output-hk/plutus-pioneer-program/pull/36
This commit doesn't require any changes to the endpoints or updating any imports.

You should be aware that plutus is changing constantly, so some commits aren't working anymore.
In this case, you can use this commit hash: 547e22a975d9b688ad2121f56e63691bead661cc (or this one 9ed85d6cc8e817270220f263a11e738135eb0ad3 as mentioned in following comment) but remember to update your cabal.project according to this, from Antonio Ibarra IOHK:

when you update the Plutus Hash in the cabal.project file, you will also need to update the hash of all source repositories. To do that you can go to the cabal.project original repository in the defined commit (in this case https://github.com/input-output-hk/plutus/blob/9ed85d6cc8e817270220f263a11e738135eb0ad3/cabal.project), copy from line 39 to the end of the file and then paste it in the cabal.project file of the week 10 replacing old source repositories below the note The following sections are copied from the 'plutus' repository

Also you should update the endpoints code, as it has changed (you can take for reference endpoints code from TokenSale.hs in Lesson 08). Consider that endpoint function returns a promise now.
endpoints :: Contract () FreeSchema Text ()
endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ endpoint @"mint" $ mint

------------ UPDATE ---------
547e22a975d9b688ad2121f56e63691bead661cc
It's working for lessons 05, 08 and 10

Got it thanks. How did you arrive at the conclusion that 547e22a975d9b688ad2121f56e63691bead661cc is the appropriate commit? Is that documented somewhere or did you test out various commits until you found one that works?

Just tried it. It's working for lesson 05, 08 and 10.

Great! I'm seeing the compilation problem generally fixed too but I can't seem to figure out how to update the endpoints function to work. Any chance you can provide that too? I see that in the TokenSale of lesson 8 they use forever and awaitPromise but trying to use that code isn't very straightforward for me as a haskell novice.

Sorry for the delay, I took a few days off. Check my updated answer.

Much ❤ - thanks for the update


text:
Limit the number for each Token (AssetName) within one Currency Symbol (Policy ID)
is there any way to limit number for each tokens within one minting policy, in Plutus validator?
For example for policy ab12 I want to allow users minting tokens, in different transactions. Сan the validator reject minting if the user try to mint the Token ab12.A_1 but the token with name 'A_1' has already been minted (i.e. max number is 1)? It is assumed that the number in the name means the maximum possible number of tokens with this name. The names of the tokens are not known in advance, i.e. unfortunately it is impossible to determine the list of tokens and send it in datum or something like that. But I hope that maybe there is another way?

Is the space of names that you allow bounded? And if so, how large is this space?

It can be very large, 10K or even more

I think there are two approaches to this, the classical and the cryptographic way of doing this.
The classical method: In this method, you do the same as you would do on any computer. You store the list of minted names (in a UTxO). Given a new mint, the stateful minting policy would check that the new name is not in the list and makes sure the new state has it in its list. The problem with this design is that a blockchain is bound in transaction size. Currently, any transaction cannot exceed 16kb (more or less). So theoretically, the database cannot exceed this limit (note that this is the absolute upper bound, in practice it will be much lower).
Now you can also decide to shard the database captured by multiple UTxO's. For example, store all names that start with the letter "a" in one UTxO and the letters "b" in another. This method might work, since upon minting a new name, only the database of that letter is needed in a transaction. Now this is again limited since it might be the case that names that start with the letter "c" get minted a lot, rendering the database full at some point. So choosing a method how to shard is the key here, and this depends totally on your constraints on the name. But remember that this subdivision has to be deterministic, a validator should be able to decide if the appropriate database is used given a name!
The cryptographic method: Since space and time are bound on a blockchain, there are some clever ways to create bound algorithms that proof a statement. For example, using Merkle tree's you can prove that something is a member of a database in a relatively low-impact way. But these are involved from a dev perspective. Similarly, I found this paper that lets you prove that you correctly failed to prove membership of an element, effectively proving that it is not a member. The paper also has a nice non-interactive algorithm where a minting policy could probably act as the verifier. Note, however, that this paper leverage pairing curves, which won't be available until next HF (if we are optimistic!).
So to conclude, there are ways, but it depends on your specific application.

Thanx for the very detailed answer, Fermat! At first glance Zero-Knowledge Proofs of Non-Membership looks like exactly what I'm looking for. Well, it looks like I have to wait for the next (or for the next after next) HF :)


text:
What is the best/recommended OS to run a stake pool?
What is the best/recommended Linux OS to run a stake pool?

On ARM hardware such as a Raspberry Pi 4B, I highly recommend this Alpine Linux setup written about by some members of the Armada Alliance of SPOs. It does a great job running Cardano static binaries while using very little power, CPU, and memory.
My pool (Adaberry Pi [00000]) runs both Alpine and Ubuntu nodes very reliably on these little single-board computers.

is it still running with the new node version?

The RPi 4B 8G runs 1.34.1 without problems.

I am a Windows expert since 3.0 (1988), and Linux/Unix almost as long.  I am proficient in Windows 2019 and 10.  Although there is a Windows solution for running a Cardano stake pool, I would not recommend it for many reasons.  As far as Linux distros go, Ubuntu is an excellent one that I have worked with for almost 15 years, and I highly recommend it.  It is backed by a successful commercial enterprise, but it is free to the community.  As a Debian fork, it is relatively easy to use and well-supported.  And, if that isn't enough to convince you, the shell scripts and installation documentation & courses are all using it as an example.
One thing you should know, is that Ubuntu labels their OS versions by year and 6-month release cycle.  So for example, 18.04 was released in 2018 in April, while 18.10 was released in October.  The April releases are more proven/solid, the October releases more experimental.  Every other year is a Long-Term-Support release, or LTS, so 20.04 LTS has a longer-term support commitment from Canonical Software.
Also, for the Stake Pool I operate (PLL), I did some research and it is recommended to apply automatic OS updates, so we enabled that.
If you need more help, give us a shout on Telegram at https://t.me/tprevolution

For cardano-node 1.30.1, it is:

Linux 64-bit (Ubuntu 18.04 LTS, 20.04 LTS; Mint 19.3, 20; Debian 10.3)
Windows 64-bit (8.1, 10)
MacOS 10.13, 10.14, 10.15


text:
Understanding this transaction - why isn't it spending the full amount?
I'm doing some analysis on Db-sync and I came across a situation where it appeared the full EUTXO at an address was not being spent so wanted to see what I was misunderstanding.
Here is the first transaction:
https://cardanoscan.io/transaction/23141e4c6fed6114dc77f5e7d1bd6e115d983e5704dd2206b0af3a41fe924c2b
Notice there are 2 amounts going to the address ending in 3d for 6.4 Ada and 118k Ada.
Now look at what I believe to be the only transaction that consumes the EUTXO at this address.
https://cardanoscan.io/transaction/10beefe48f417f3fdb9d164da95adf78e9efaf22f24c0a24893b68fe8e322f68
I can see the 6.4 Ada being spent but not the 118k. They do have different 'index' fields in db-Sync so is that why? i.e. it's not all the Ada at one address that gets sent, but only enough indexes as needed?
-- Edit --
Just to add clarity:
a) The first transaction has two amounts going back to the same user. This I presume means it's getting back two separate EUTXOs - one containing additional tokens, and the other just Ada.
b) When I look for these transaction outputs in DbSync (tx_out table) the only way I can identify them as separate EUTXOs is if I treat Address + Transaction ID + Index as the unique ID
c) Therefore is it fair to say that when making a transaction the wallet treats everything with a unique Address + Transaction ID + Index as a separate EUTXO, and this is why the wallet did not need to consume the 118k EUTXO from the first transaction?

I think there might be a misunderstanding in the fact that a transaction has several "outputs" - and those outputs are called "UTXO"'s (as long as they are unspent; hence "unspent transaction outputs") - and those can be spent separately.
So one of the UTXOs created by your first transaction holds only Ada (~118k). That output is not used in the second transaction your linking to, though.
Regarding the edit, you can identify any tx output or utxo by "transaction id" + "output index".
The ~118k Ada UTXO for example is still sitting at output index 2 of the transaction 23141e4c6fed6114dc77f5e7d1bd6e115d983e5704dd2206b0af3a41fe924c2b - ready to be spent.

In the first transaction (starting with 23141), there is a single input UTXO with three outputs - the first output (4.5 ADA) going to a non-staking address, the second and third outputs are going back to the sender's address, likely as change.

The second transaction (starting with 10beef) has three inputs and three outputs. The first two inputs are from the sender, and the third input is from a different address, likely a script address. The first output is to the same non-staking address as the first output in the first (above) TX, and the last two outputs are again going back to the sender.

UTXOs are always consumed in whole when used as inputs. The confusion may have been in the fact that the majority of the contents in both transactions go back to the same address, but they do so in the form of new UTXOs. In this case, a lot of ADA and other tokens were all sitting in a single UTXO, so when the user ordered the swap, the entire UTXO was consumed and most of its contents were returned back as change in a new UTXO. Whatever assets were required for the swap were output as separate UTXOs.

Thanks for this. See Edit I've made to my question and see if you agree.

Put more simply, the 118k UTXO was not consumed because none of its contents were needed for the transaction.


text:
How to calculate the current reward of a pool at current Epoch using graphql
Having this Graphql query I know how many blocks this pool has produced on this epoch.
query stakePoolById($poolId: StakePoolID!) #$epochId: Int
{
  stakePools(where: { id: { _eq: $poolId } }) {
    url
    margin
    fixedCost
    blocks {
      epoch {
        number
        fees
      }
    }
  }
}

The problem is that I don't know how much a pool get for each block produced. I guess that knowing that constant I can sum all the blocks produced and subtract the margin and the fixedCost.
Is this the right approach?

Where can one find the schema you're querying? To me, this comes out of nowhere.

I'm using https://graphql-api.mainnet.dandelion.link/ and https://input-output-hk.github.io/cardano-graphql/

It is not a per-block constant. Reward calculation certainly is based on the number of blocks a pool makes, but along with a set of parameters and complex algorithm.
The reward calculation is done based on the below params,

the monetary expansion ratio
fees collected during an epoch
TAU - the percentage of rewards to go into the treasury
slot-co-eff and number of slots per epoch
total number of blocks minted by all pools in an epoch
total stake in the epoch by all pools
total stake controlled by a pool
pledge of the stake pool

Plus, the calculation also includes all these parameters based on epoch snapshots. The full calculation is quite big. But I hope I could give you a path to start with. You can find the documentation regarding the same at the below link,
https://docs.cardano.org/en/latest/explore-cardano/understanding-pledging-and-rewards.html
Also, these parameters and snapshots are not available in graphQL, you can use ledger state dump for rewards calculation.

Would you say that all those params can be extracted from the blockchain using Graphql to make the perfect calculation. Or am I losing my time?

You can get all the details you need from the ledger state dump. Graphql does not provide enough information for rewards calculation.

Do you have any idea on how to make a good estimation instead of the perfect calculation?

you can look at the previous epoch rewards data for a pool at cardanoscan.io, and consider the per block reward by dividing total rewards by the number of blocks it minted. NOTE that this is a very very high-level estimation.

The link in the answer is currently broken, does anyone knows where it has been moved to?


text:
cardano-node goes down after "cardano-cli query pool-params"
Making this query to my cardano-cli
cardano-cli query pool-params \
    --stake-pool-id pool13crd2ljx87988umk22er6ynwadfwdqupdpcq6prc6v59z62kxse \
    --mainnet

Makes my cardano-node goes down. Is this normal behaviour?
I guess not. How can I check why is this happening?
This is the log:
Jun 18 08:38:21 ip-172-31-10-236 cardano-node[1948]: [ip-172-3:cardano.node.ChainDB:Notice:540] [2021-06-18 08:38:21.15 UTC] Chain extended, new tip: 47e663c6efcfd52f6895e020032bfb672deddb8a3d1047a1c40d4ef186177ff0 at slot 32439210
Jun 18 08:39:21 ip-172-31-10-236 cardano-node[1948]: [ip-172-3:cardano.node.BlockFetchDecision:Info:550] [2021-06-18 08:39:21.53 UTC] [TraceLabelPeer (ConnectionId {localAddress = 172.31.10.236:34107, remoteAddress = 52.15.190.154:6000}) (Right [At (Block {blockPointSlot = SlotNo 32439270, blockPointHash = 449361583216f3fe0ec748bc32ea22f3ef3a9fe3e951845e017e49698b65a6fb})])]
Jun 18 08:39:21 ip-172-31-10-236 cardano-node[1948]: [ip-172-3:cardano.node.ChainDB:Notice:540] [2021-06-18 08:39:21.54 UTC] Chain extended, new tip: 449361583216f3fe0ec748bc32ea22f3ef3a9fe3e951845e017e49698b65a6fb at slot 32439270
Jun 18 08:39:49 ip-172-31-10-236 cardano-node[1947]: /home/ubuntu/cardano-my-node/startBlockProducingNode.sh: line 9:  1948 Killed                  /usr/local/bin/cardano-node run --topology ${TOPOLOGY} --database-path ${DB_PATH} --socket-path ${SOCKET_PATH} --host-addr ${HOSTADDR} --port ${PORT} --config ${CONFIG}
Jun 18 08:39:49 ip-172-31-10-236 systemd[1]: cardano-node.service: Main process exited, code=exited, status=137/n/a
Jun 18 08:39:49 ip-172-31-10-236 systemd[1]: cardano-node.service: Failed with result 'exit-code'.
Jun 18 08:39:54 ip-172-31-10-236 systemd[1]: cardano-node.service: Scheduled restart job, restart counter is at 1.
Jun 18 08:39:54 ip-172-31-10-236 systemd[1]: Stopped Cardano node service.
Jun 18 08:39:54 ip-172-31-10-236 systemd[1]: Started Cardano node service.
Jun 18 08:39:56 ip-172-31-10-236 cardano-node[64305]: Listening on http://127.0.0.1:12798
Jun 18 08:39:57 ip-172-31-10-236 cardano-node[64305]: [ip-172-3:cardano.node.networkMagic:Notice:5] [2021-06-18 08:39:56.52 UTC] NetworkMagic 764824073

I don't have any problem with queries like:
cardano-cli query utxo --address ...

Can you elaborate on what "goes down" means? Can you share the cardano node log?

There is a high likelyhood that you run out of memory when running that query, as it involves querying subset of ledger, which can cause a spike to your memory usage (if it is marginal to minimum recommendations). Assuming you're on Linux , you can check via dmesg -T | grep cardano to see if it was caused by OOM event.
If not, you'd need to check logs and provide more details

Yes, that was the reason. Thank you. Here the log: [Fri Jun 18 08:39:48 2021] Out of memory: Killed process 1948 (cardano-node) total-vm:1074772472kB, anon-rss:5803728kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:11620kB oom_score_adj:0


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

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

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

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

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

From projects

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

Videos

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

Minswap reflecting on the incident that sparked the FUD storm

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

Indie contributions

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

I think this article from Maladex also deserves some attention.

Appreciate it @JelilAkjaly. Adding this.

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

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

Looking forward to learning more about that approach.

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

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

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

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

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

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

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

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

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

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

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

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


text:
What's better for cloud Virtual Private Server stake pool operations, persistent disk or local ssd?
I'm comparing various cloud server providers and I'm trying to understand the best storage options to run a stake pool in the cloud.
Is a persistent disk better than an attached SSD? A persistent disk can be replicated across zones and the data on it can be saved when the VM is deleted. I assume it has higher latency.
The locally attached SSD is obviously faster but it is deleted if the VM is deleted.

Might help to expand VPS in the text or remove it from the title.  It's not a common abbreviation.

Apparently I haven’t been around long enough to edit my own questions. Lol.

The members with more reputation get prompted to edit first posts and a number of other categories.  Welcome aboard, I hope I did your intent justice.  There are not too many places you get free proof-readers and editors.   :-)

You should run some tests to check throughput for both of them.
However, from my experience of running a Monero node I can tell you that persistent storage generated a lot of problems with responsiveness and overall uptime. Switching to SSD removed most of them. And keep in mind that Monero is a PoW coin with 2 minute block time. There are no time-critical operations even close to Cardano's getting a slot or missing it.
I'd say definitely SSD, but do your tests to be sure.

Do you mean attached SSD or persistence storage SSD? I wonder if it matters which cloud provider is used. I heard anecdotally that google cloud compute was much faster than digital ocean for storage access.

SSD all the way.
The reason for this is simple: a stake pool needs to be able to perform creating a block fast. That's it. Storing and replicating data is of little concern since its a public blockchain-it can always be re-synced. I realize you wouldn't want to wait for a node to sync from scratch if you spin up a new one, but there's other ways to speed that up. Also, there should be nothing sensitive (e.g., cold keys and spending keys) or critical (e.g., the only copy of your run script). In short, a node doesn't host critical data, it makes blocks.

There are multiple factors that I would consider important here:

Cost: What's the difference in cost? If one is significantly less expensive, this can be a big factor if you're an SPO.
Ability to replicate: You should have a backup of all important keys somewhere else. So if you delete the VM or the disk, it should be no problem to create a new node and restore your keys from the backup. Creating a new node can take some time though, so replicating a disk might be useful. However, this could also be solved by using containerization (e.g. Docker).
Speed: The case where you delete a VM and then want to use the same disk on a new VM is probably quite rare, so this would speak for the attached SSD. Besides that, an SSD is definitely faster than a persistent disk but you'd have to test if you run into problems with the persistent disk speed.

In the end it comes down to your preference, both options work.


text:
How is inflation offsetting staking rewards?
I'm wondering how much staking rewards offset the circulating supply inflation rate right now.
We know that annual staking rewards are around 5.5%, but the only metrics I could find about annual inflation rate are here:
https://datastudio.google.com/u/0/reporting/3136c55b-635e-4f46-8e4b-b8ab54f2d460/page/azvBC
So it's around 2% per year.
Which means that people who don't stake actually lose 2% (if we're ignoring coin price appreciation) per year, while people who do stake gain 5.5% - 2% = 3.5% per year.
Does anyone have more information about this?
Edit: I also found this but I'm not sure if it is valid data: https://pastebin.com/raw/a7x2Gu2g

Each epoch .22 % of the remaining pool are distributed as rewards (therefore .22 % of a slowly declining pool) . So there will be a smooth reduction of inflation. This is unlike Bitcoin where inflation rate only adjusts every four years (when it gets cut in half). Although I have not done the math, I've heard that the .22 % rate was chosen so that the rate of inflation will effectively be the same as Bitcoin (i.e. four years from now it will be  about half what it is today.)

Can I have a source for the .22% value you mentioned?

Mr D - https://forum.cardano.org/t/ada-non-inflationary-policy/49736

Perfect, thanks!

Cardano's staking rewards are a fairly consistent 5.5%
Annual inflation of fiat currencies varies by time and country.  Unless or until the volatility of ADA drops dramatically it will have far more impact on offsetting fiat inflation than staking rewards.
It is a bit like asking how is inflation in Australia offsetting inflation in the USA.

Cardano’s monetary policy addresses two issues:

The necessity to offer rewards for people who participate in the network

Funding the treasury

Rewards
The expansion and future improvement of the Cardano blockchain will be
greatly influenced by its community, who need to be incentivized
through rewards to participate in Cardano’s development.
Staking rewards for delegators and stake pool operators come from two
sources:

Transaction fees - fees from every transaction from all blocks
produced during every epoch go into a virtual ‘pot’. A fixed
percentage (ρ) of the remaining ada reserves is added to that pot.

Monetary expansion - a certain percentage (τ) of the pot is sent to
the treasury, and the rest is used as epoch rewards.

This system is designed to ensure that the portion of rewards taken
from the reserves is high at the beginning, when transaction numbers
are still relatively low. This incentivizes early adopters to move
quickly to benefit from high initial rewards. Over time, and as the
number of transactions increases, additional fees will compensate for
smaller reserves.
This mechanism also ensures that available rewards are predictable and
do not vary dramatically. Instead, rewards change gradually. The fixed
percentage taken from remaining reserves every epoch guarantees a
smooth exponential decline.

Yes, I know, which is why I mentioned that I'm ignoring coin price appreciation. So assuming Cardano is an isolated system and ignoring anything else in the markets, how does its staking rewards offset its inflation rate? Does anyone have more info on how inflation rate will evolve as circulating supply gets closer to total supply of 45B?

Added quote from Cardano's Monetary policy docs.  Click on link to read full document.


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

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

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

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

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

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

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

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

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


text:
Cardano Node + DB Sync + Graph QL vs. Blockfrost API
I've been contemplating the value of essentially running all your own infrastructure by deploying a Cardano node alongside DB Sync and exposing it through Cardano GraphQL.
I like the idea of building essentially my own payment gateway into Cardano completely ran by myself, without the use of any third-party APIs.
Given the cost of cloud solutions and per the requirements of the node/db-sync and GraphQL the costs would be around:

On DigitalOcean as an example, the cheapest VM that meets the basic requirements for db-sync is $120/mo
Blockfrost 300,000 tier is roughly $70/mo

Is the convenience of not running your own infrastructure and hooking into Blockfrost the best option for low traffic websites/dApps?
1,000,000 requests per day can go pretty quickly when running a decently sized web3 based website, though the managed IPFS storage and pinning does seem tempting.
To be clear, I think Blockfrost has done a lot for the Cardano ecosystem and will probably end up going with them. This was more of a thought experiment to see both sides of the coin and lay out the strongest possible case for each. I do like the idea of running my own Cardano infrastructure but think that until you're getting into a decent size of traffic it may be better to utilize Blockfrost.

I've been on a bit of a journey with this so might be able to add some insight. We originally started by running our own node inside our Kubernetes cluster, alongside a cardano-wallet container that we used to interact with the Wallet REST API. This proved to be reasonably easy at first while we were on testnet. However, when our app hit mainnet, suddenly we needed a far larger Kubernetes node to run the cardano-node binary. Our hosting costs sky-rocketed to $250+ a month, and we had the extra work of ensuring our node version was kept up-to-date, and that the node was up reliably in order for our app to transact consistently. It suddenly made absolutely no sense for us to continue this model, and we are now in the process of migrating all our code to use Blockfrost instead. Even if we have to pay $70 a month, we'd be saving a massive amount of time and money compared to running the node. Personally, I also can sleep better at night knowing that our Cardano node isn't sat on the internet somewhere, i.e. if someone accidentally modified our Kubernetes config and exposed the API to bad actors.
In the future I hope to go to a hybrid approach where we use a combination of both our node and Blockfrost, since it's also worth noting that if everyone used Blockfrost or similar API's it hurts decentralization.

This is where I'm at as well. If and when my DApp becomes successful enough to warrant running my own infrastructure, $250 will be a small price to pay, but for now Blockfrost just makes sense.

I think the best answer is that it depends on your specific use case.
A lot of people start their project using just Blockfrost as they do not want to invest a lot of resources into their infrastructure before exploring their idea.
Most of the large Blockfrost customers are actually running both, mostly for scaling and fail-over.
Also, I would point out, the cost of cloud resources are not as significant as the effort of providing 24/7 maintenance of the infrastructure and keeping up with different bugs and upgrades of the specific components. However, that strongly depends on how much you value your own time and how much new skill you would have to acquire to become your own devops.
Full disclousure, I'm a Blockfrost developer.
EDIT: Now that Blockfrost is fully open source, you can run your own while preserving decentralization.

I was leaning towards using Blockfrost, atleast for the foreseeable future. I will note that I am surprised to find out that many large projects are running both, but I guess that does make sense to not have a single point of failure.


text:
How to deploy the Plutus smart contract
I am following Plutus-pioneer-program to learn smart contract development in Cardano. I have tried the onchain and offchain code, compiled and tested in Plutus playground and also in emulator trace. Now i want to know how can i use these smart contracts and deploy on blockchain. Some of the methods which i know are

By Cardano-cli, but I think it will be having a lot of .sh commands which is not easy to code every time.
By PAB, I tried to run PAB along with cardano-node, chain-index, plutus-pab-examples. But it's quite hectic to wait for days for their syncing. Also I was not able to proceed PAB as the process got killed due to out of memory.
By Alonzo testnet, I am also trying alonzo testnet tutorial, but its full of dependency errors. Also I don't know

Now I need to clear up my mind by having some clear steps of the smart contract compilation, testing, deployment and interaction. How can we do these all with the most recommended and practical way.
Also I need the tutorial/guidance to do deployment of smart contract on Cardano testnet, other than these or with the suitable and most used way.
I have explored many more stuff on Cardano, but I think everything has got quite messed up due to lack of proper guidance on that. Please guide we with a recommendable way and a proper flow of how to do all these stuff.

There are two steps you need to follow in order to create a dApp on Cardano.

Create the script itself - the on-chain code
Create the transaction which will make use of that script, ideally make it abstract enough so that any user can interact with you app - this is called the off-chain code

OnChain code
For step 1, your end goal is to have your script compiled into Plutus-core, whose hex representation you can see here, for example.
In order to produce this code, you will probably want some kind of high-level language. You don't write assembly every time you want to create an API, instead you usually write it in C or some language that can be compiled to Assembly.
Currently we have three languages, two of which are still in early stages of development (Aiken and Eopsin):

PlutusTx
Helios
Aiken
Eopsin

If you are doing the Plutus Pioneers Program, you probably learned PlutusTx. The advantage of PlutusTx is that it was developed by IOG so it will probably always have the most up-to-date code. In the sense that if we have a new feature added to Cardano (like reference inputs were recently), they will most likely be the first to have it implemented.
In the other hand, as you might have found out already, it is a language extremely difficult to understand, develop and test and I still occasionally scream in my sleep when I remember nix-shell and cabal.
Worst of all, it was not very well-designed in the sense that all other languages mentioned above have significant performance and script size improvements (50% above).
So, honestly, I would suggest you to rewrite whatever script you made using PlutusTx in another language (they are quite easy to understand), because it will keep you from turning mad in the long term.
I have used Helios before and it was very easy to use. You can take this repository as a guide to write and compile the script. I think Aiken will be better in the future, but I have not tried it yet and it is very likely to have bugs since it's earlier in its development phase than Helios.
OffChain code
Finally, for your off-chain code, you will need to create two transactions. The first is the one which sends some amount of tokens to the script with a specific datum and the second is the one which will try to spend that script, providing some redeemer.
Every dApp in Cardano needs to revolve around those two types of transaction. Some more complex ones, however, might mix both types by spending a script and sending some tokens back to that script with a new datum.
The theory behind it is out of scope, but there are currently multiple libraries which you can use to build this off-chain code. Some of which are the following:

Lucid
PyCardano
Mesh

Each one is well documented and have their own guides and examples, my advice you would be to use Lucid. PyCardano is great and I have personally used it even more often than lucid, but it builds the transactions in the back-end so you will still need to create a client interface to sign it and submit it. It can be good, however, if you simply want to see your script in the chain and want to test it quickly and easily.

Really? Can i make the smart contract using Helios. Like I did certain RnD on cardano smart contracts, and the only thing i get to know that cardano only supports haskell and plutus, which is truly a language giving you headache. So point is, can i really make any smart contracts like staking etc with helios??

@duaaazhar Yes and there are examples of it already deployed on-chain, I made some my self

@duaaazhar But take a look at Aiken, it looks really easy to use, just maybe not ready for production yet https://aiken-lang.org/getting-started/hello-world

Yah Aiken is seeming bit easy to understand but i also have to go for production environment, so i think i should take start with a mature language like helios right?

I’m a huge Helios fan, so much so I wrote a book on it https://www.amazon.com/Cardano-Smart-Contracts-Helios-Lawrence-ebook/dp/B0BTBK6YM7/
I’ve also released an open source repo of examples from the book as well.
https://github.com/lley154/helios-examples
I also share similar nightmares of nix-shell/cabal hell….thank God I don’t have to do that anymore.

Forgot to mention, not only can you use Helios for on-chain smart contracts, it also has excellent libraries off-chain for Tx building as well.


text:
Track incoming payment of an address using cardano-db-sync
I have a cardano-node with cardano-db-sync installed. In this node, I also have a separate database named CDT, and a web UI to connect to this CDT database.
I defined an address named addr1xxxxxx which I want to track incoming payment. In the web, I display this address as QR code to users.
When users see this QR code, they have to send a certain ADA to this address within a certain time. If they do send enough ADA, they will be redirected to the next step and so on.
What I want to do this to get know whether users have sent enough ADA to this address or not. I can check cexplorer database to know this, but in many cases I am afraid that cardano-db-sync is not synced fast enough to get the latest from the blockchain.
I have heard of webhooks services of blockfrost or tangocrypto. They maybe a good solutions. But it relies on third-party services.
Can you suggest another solution?

Check out Oura which gets you a tail feed of events. Should be the fastest solution not relying on third parties.


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

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

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


text:
How can i generate new wallet address using cardano-wallet cli and cardano wallet api after created my wallet?
yoroi and daedalus provide UI to generate new wallet address, how can i use cardano-wallet cli and cardano rest api to generate new address?

Once you have your cardano-wallet runnig, you can create a new wallet using CLI with the following command:
$ cardano-wallet wallet create from-recovery-phrase "My Wallet"
Please enter a 15–24 word recovery-phrase sentence: <enter generated recovery-phrase words here>
(Enter a blank line if you do not wish to use a second factor.)
Please enter a 9–12 word recovery-phrase second factor: <skip or enter new recovery-phrase words here>
Please enter a passphrase: ****************
Enter the passphrase a second time: ****************
$

See more cardano-wallet cli commands.

To create a new wallet using cardano-wallet REST API, you can use the following command:
$ curl -vX POST http://localhost:8090/v2/wallets \
   -H "Content-Type: application/json; charset=utf-8" \
   -d '{
        "name": "Shelley",
        "mnemonic_sentence": ["identify", "screen", "lock", "bargain", "inch", "drop", "canyon", "flock", "dry", "zone", "wash", "argue", "system", "glory", "light"],
        "passphrase": "Secure Passphrase",
        "address_pool_gap": 20
        }'

See REST API documentation for more information about this call.

I know how to create wallet, I have already read the documentation. I want to know how to generate new address when you created your own wallet, there is 20 address in your wallet after created, I want to generate more.

This is what address_pool_gap is for, you can specify more than 20 address, but be careful!  Using values other than 20 automatically makes your wallet invalid with regards to BIP-44 address discovery (https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki). It means that you will not be able to fully restore your wallet in a different software which is strictly following BIP-44.

Do you mean something like that?
# generate keys
cardano-cli address key-gen --verification-key-file payment.vkey --signing-key-file payment.skey
# build address from pubkey
cardano-cli address build --payment-verification-key-file payment.vkey --out-file payment.addr --mainnet

yeah, but instead of using cardano-cli, i'm using cardano-wallet cli and wallet backend restful api.


text:
How to convert xvk to svk?
I use cardano-address cli export extended private key, but i want to use it with cardano-cli command, how to convert it?

Yes, if you have created your cardano-wallet wallet using a mnemonic, you can restore a private key from it.
An excellent tool for this is cardano-addresses.

Generate your root private key.

cardano-address key from-recovery-phrase Shelley < phrase.prv > root.xsk
root_xsk1hqzfzrgskgnpwskxxrv5khs7ess82ecy8za9l5ef7e0afd2849p3zryje8chk39nxtva0sww5me3pzkej4rvd5cae3q3v8eu7556n6pdrp4fdu8nsglynpmcppxxvfdyzdz5gfq3fefjepxhvqspmuyvmvqg8983

Generate your payment verification key for the first address. Notice here, the /0/0 is the address index, increase the last digit to generate your other addresses.

cardano-address key child 1852H/1815H/0H/0/0 < root.xsk | cardano-address key public --with-chain-code > addr.xvk
addr_xvk1grvg8qzmkmw2n0dm4pd0h3j4dv6yglyammyp733eyj629dc3z28v6wk22nfmru6xz0vl2s3y5xndyd57fu70hrt84c6zkvlwx6fdl7ct9j7yc

You should be able to use your payment key to sign a transaction using cardano-cli.

Create your payment address to double check it is correct.

cardano-address address payment --network-tag testnet < addr.xvk > payment.addr
addr_test1vp2fg770ddmqxxduasjsas39l5wwvwa04nj8ud95fde7f7guscp6v

Sign payment key (xxx.skey) generated by cardano-cli is a json file, in your case addr.xvk file is not a json file, is there any command line tool i can use to convert addr.xvk to a standard json file to meet the cardano-cli 's demand ?


text:
Is there any eth_sign equivalent signing method in plutus?
I want to use my private key to sign a message, and submit the message and signatures to third party server, the third party server can verify that signatures through plutus smartcontract.
In ethereum eth_sign can achieve this, the smartcontract side have a method to recover address related to the oringal signing private key:
pragma solidity ^0.4.25;

library ECDSA {

  /**
   * @dev Recover signer address from a message by using their signature
   * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
   * @param signature bytes signature, the signature is generated using web3.eth.sign()
   */
  function recover(bytes32 hash, bytes signature)
    internal
    pure
    returns (address)
  {
    bytes32 r;
    bytes32 s;
    uint8 v;

    // Check the signature length
    if (signature.length != 65) {
      return (address(0));
    }

    // Divide the signature in r, s and v variables with inline assembly.
    assembly {
      r := mload(add(signature, 0x20))
      s := mload(add(signature, 0x40))
      v := byte(0, mload(add(signature, 0x60)))
    }

    // Version of signature should be 27 or 28, but 0 and 1 are also possible versions
    if (v < 27) {
      v += 27;
    }

    // If the version is correct return the signer address
    if (v != 27 && v != 28) {
      return (address(0));
    } else {
      // solium-disable-next-line arg-overflow
      return ecrecover(hash, v, r, s);
    }
  }

  /**
    * toEthSignedMessageHash
    * @dev prefix a bytes32 value with "\x19Ethereum Signed Message:"
    * and hash the result
    */
  function toEthSignedMessageHash(bytes32 hash)
    internal
    pure
    returns (bytes32)
  {
    return keccak256(
      abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
    );
  }
}

You can find functions for message signing and signature checking in packacke plutus-ledger, module Ledger.Oracle.
Also, why whould you need a smart contract for this?


text:
cardano-cli: QueryEncoderUnsupportedQuery Query GetSystemStart TopLevelQueryDisabled
cardano-cli --version
cardano-cli 1.27.0 - linux-x86_64 - ghc-8.10
git rev d870347b48c8ba0a81566876153eff23fce3ec64

cardano-cli query tip --mainnet
cardano-cli: QueryEncoderUnsupportedQuery Query GetSystemStart TopLevelQueryDisabled

I'm trying to get the current tip(slot) for my my transaction ttl.
eidt:
cardano-cli query tip --shelley-mode --mainnet
Command failed: query tip  Error: Unsupported mode: ShelleyMode

after i added --shelley-mode flag, it still doesn't work.

Can you try running the query with --shelley-mode flag?

You're not using the release version, which - for 1.27.0 (current mainnet) - is 8fe46140a52810b6ca456be01d652ca08fe730bf.
Using commits later than current stable release should only be done if you're sure if a specific commit is compatible and works - and should be done on testnet instead


text:
cardano-cli verification key bech32 encoding
In the cardano-cli tool,
it is possible to accept both --payment-verification-key-file and --payment-verification-key when running cardano-cli address key-hash
From the docs, it seems that the --payment-verification-key is supposed to be bech32 encoded.
But it is unclear how that is achieved.
How can I convert from the key-file to the key-string?

So after some experiments, the answer is to
Remove the first 2 bytes (5820) from the cborhex and pipe the output to bech32 with addr_vk
For example
$ cat vkey
{
    "type": "PaymentVerificationKeyShelley_ed25519",
    "description": "Payment Verification Key",
    "cborHex": "5820ba6e94a603da493604a0e0d0e8c4f3465ba299a0d0967a1cafd4c0fa0ab882ad"
}

$ echo "ba6e94a603da493604a0e0d0e8c4f3465ba299a0d0967a1cafd4c0fa0ab882ad" | bech32 addr_vk > vkeystring

$ cardano-cli address key-hash --payment-verification-key $(cat vkeystring)
$ cardano-cli address key-hash --payment-verification-key-file vkey

Both key-hash should be the same.

thank you for the answer! What are the first 2 bytes?

As Alan has already answered this for himself I'd like to add that when using an extended verification key you can produce the non-extended key first and then bech32 encode it to produce the hash.
For example, produce non-extended verification key from extended one:
$ cat acct.vkey
  {
      "type": "PaymentExtendedVerificationKeyShelley_ed25519_bip32",
      "description": "Payment Verification Key",
      "cborHex": "58406d2d6c3e1bf46cfab0977279105a87bb89adb4c6dac3eb25ea2f300ef3e9aa0af720099909a8f7a871db0cb1b2158549cedd2019d60d7ac6c4891bf03cfdc652"
  }
$ cardano-cli key non-extended-key --extended-verification-key-file acct.vkey --verification-key-file acct_short.vkey
$ cat acct_short.vkey
  {
      "type": "PaymentVerificationKeyShelley_ed25519",
      "description": "",
      "cborHex": "58206d2d6c3e1bf46cfab0977279105a87bb89adb4c6dac3eb25ea2f300ef3e9aa0a"
  }

Remove first 2 bytes from non-extended key and produce valid encoded address (bech32 binary is included in wallet release bundle):
$ echo "6d2d6c3e1bf46cfab0977279105a87bb89adb4c6dac3eb25ea2f300ef3e9aa0a" | bech32 addr_vk
  addr_vk1d5kkc0sm73k04vyhwfu3qk58hwy6mdxxmtp7kf029ucqaulf4g9q8d6yzn

Produce key hashes and compare:
$ cardano-cli address key-hash --payment-verification-key addr_vk1d5kkc0sm73k04vyhwfu3qk58hwy6mdxxmtp7kf029ucqaulf4g9q8d6yzn
ad2704179252c6343d8e27708b725656ec30bc8a347dbb42bfd5509a
$ cardano-cli address key-hash --payment-verification-key-file acct.vkey
ad2704179252c6343d8e27708b725656ec30bc8a347dbb42bfd5509a


text:
Should I use Marlowe or Plutus to create my native token?
Should I use Marlowe or Plutus to create my token?
I also want to create a TCG in which my token will have an utility.
Where should i start? (tutorial, how-to, examples ...).


text:
What's happened with Cardano Proof of University Diplomas in Greece?
Storing university diplomas was a novel major usability announcement for Cardano back in 2018. It's been over 3 years if my memory serves me right. The plan was to use an enterprise permissioned version of Cardano or something to that extent.
Did IOG do it?
Did it work?

I personally think this is an excellent and on-topic question. I also remember this project and am curious of its current status. I'm voting to reopen this and started a discussion in the meta forum.


text:
Blockfrost, GrapgQL or any API for cardano help, working with javascript
I am building an MERN stack app cardano dex tool, I want to use Blockfrost.
I have installed the SDK in Node.js backend, but there are only very few examples on how to get any kind of data from it.
The Blockfrost documentation gives more info and I know how to use it with fetch, but only url based and don't know how to implement QUERY PARAMETERS into the url request. Here is an example.
function getAssets(){
        fetch(`https://cardano-mainnet.blockfrost.io/api/v0/assets`,{
            headers: {
                "project_id":'API KEY'
            },
        })
        .then(res=>res.json())
        .then(data=>{console.log(data)})
    }
    getAssets()

If there is someone that could explain me a bit how to start using Blockfrost the proper way with a Node.js backend and basically get any kind of information.
Or maybe there is a better solution to get all data from the Cardano network, I have an relay node running with GraphQL, but getting data from that is very difficult if you just starting to use it and I don't know if it will keep working after the Alonzo fork.
Please someone that can help me pointing the right direction would be awesome.

Using the Blockfrost SDK is pretty straight forward, as in this example:
import { BlockFrostAPI } from '../src/index';

async function run() {
  const API = new BlockFrostAPI({
    projectId: 'YOUR API KEY HERE', // see: https://blockfrost.io
  });

  try {
    const latestBlock = await API.blocksLatest();
    const latestEpoch = await API.epochsLatest();
    const health = await API.health();
    const address = await API.addresses(
      'addr1qxqs59lphg8g6qndelq8xwqn60ag3aeyfcp33c2kdp46a09re5df3pzwwmyq946axfcejy5n4x0y99wqpgtp2gd0k09qsgy6pz',
    );

    console.log('address', address);
    console.log('latestEpoch', latestEpoch);
    console.log('latestBlock', latestBlock);
    console.log('health', health);
  } catch (err) {
    console.log('error', err);
  }
}

run();

Basically you can use any of Blockfrost endpoints in the SDK as well, check out the list of available calls. I recommend you using an IDE such as codium as it will autofill these as you code.

Hey, thank you for the reply. Well you are right the wiki you show is very clear. Somehow I missed the right menu to get more specific info.


text:
Does Marlowe Run have the capability to mint NFTs?
I know the easiest way is to mint via https://www.nft-maker.io/ or https://cardano-native-token.com/ but if I want to mint it on my own, is minting in the Terminal the only option?
https://docs.cardano.org/en/latest/native-tokens/getting-started-with-native-tokens.html
I was wondering if Marlowe Run has the feature to mint NFTs in addition to creating smart contracts.

No, it is not planned for Marlowe to have a feature to mint NFTs or native tokens.
However, it will use tokens internally to represent the ownership of a role in contact.

...is minting in the Terminal the only option?

Yes, right now the terminal is the only first party option.
As Marek pointed out, the community may have other ways. https://satran004.medium.com/cardano-client-lib-minting-a-new-native-token-in-java-part-iii-1a94a21cfeeb looks like a good tutorial if you're in the Java programming ecosystem.
If you are not a programmer or terminal guru, I'm pretty sure a web version and/or Daedalus version is mostly likely in the works. The Daedalus version will supposedly allow you to do some ongoing "management" tasks of your minted tokens.
I'm pretty sure they demoed a web page for minting Native Tokens on one of the monthly updates. Charles in one of his AMA also said he wanted to bring that management to both the web, then eventually Daedalus.

I was wondering if Marlowe Run has the feature to mint NFTs...

No, no minting functionality. That tool is specifically for creating smart contracts.

I think this question is specific to Marlowe.

Also, it is not true right now the terminal is the only option to mint NFT. There is tons of libraries already that support this. https://satran004.medium.com/cardano-client-lib-minting-a-new-native-token-in-java-part-iii-1a94a21cfeeb

Thanks for the feedback, considering the question was about a web tool that targets "little to no programming", I was reluctant to provide answers that didn't meet the same standard.


text:
How to stake a smart contract's money?
Is it possible to delegate the money locked in a smart contract? And how? Using what haskell instructions?

Please rephrase into a toplevel question.

@daedalusdaemon sorry but what is a toplevel question?

I meant the Title question.

A shelley address has two parts: payment part and staking part. For each of these parts, you have its specific private key and whoever holds it, has the ability to manage that part. So, you have an address where the payment part if managed by the smart contact, but the staking part is managed by you. This video might be helpful https://www.youtube.com/watch?v=NjPf_b9UQNs
So, a Shelley payment addresses that is used by scripts can still delegate to an associated stake key. When you create the locked output, you decide the staking.

Can you share some documentation or examples of what this might look like?

I think a good documentation for how addresses are working is https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019.md. Basically, as an example, you make a payment address that is used in the contract script, but where the payment address uses your stake address, so you own the stake rights.

What do you mean by a "shelley payment address that use scripts"?

Sorry, that is typo, a payment address used by scripts.

@MarekMahut-StakeNuts So just to clarify, you mean any address used by a smart-contract? Because, you know, I could write a script on my laptop that uses my address and obviously I can do whatever I want with this address. Or did you mean something more precise?

A shelley address has two parts: payment part and staking part. For each of these parts, you have its specific private key and whoever holds it, has the ability to manage that part. So, you have an address where the payment part if managed by the smart contact, but the staking part is managed by you. This video might be helpful https://www.youtube.com/watch?v=NjPf_b9UQNs

@MarekMahut-StakeNuts: I edited your answer to add this comment.


text:
Transaction fees and smart contract complexity
I've read here and there, perhaps incorrectly, that the transaction fees depend on the size of the transaction (in bytes). However, with smart contracts, the difficulty to process a transaction is not proportional to its size: for example, there are small SAT-problem that can never be solved in practice, while it is very easy to answer the query "find the first byte of the sequence ab55..." even if the sequence is huge. Obviously, there should be some cost for the size of the transaction as it has to be stored on-chain, but if the cost is only on the size of the transaction, and not on the complexity of the request, then the chosen memory-time trade-offs will be greatly in favor of using time (free) above using memory (costly).
So, what will be the incentive mechanism for fees in cardano?

I think there are multiple things to consider. The data, as you pointed out, needs to be stored and thus incurs a cost. However, at least in haskell, that task of reading the first byte of the sequence is indeed rather simple if the laziness of haskell is utilized. It'll be interesting to see the exact fee formula.

@MatthiasSieber I do not see how haskell makes anything easier in this context. Indeed, you have to store the complete sequence because you have to check the signature. And it is also very easy to check only the first byte of a sequence in any imperative programming language like python or c. So not sure what you meant.

It's true that currently (prior to Plutus release), the only thing influencing the transaction fee for a transaction is its size in bytes.
However the Cardano development team have indicated that it will get more complex when using Plutus smart contracts. Two more factors will come into play:

Number of virtual instructions executed
Maximum memory used during execution

They are still working on the precise definition of what is a virtual instruction (some operations might count as more than 1, but how many exactly is still work in progress).