text:
Are transaction witnesses stored on the blockchain?
According to Cardano's ledger spec (page 26), the purpose of witnessing is to make sure that the intended action is authorized by the holder
of the signing key, providing replay protection as a consequence. For example, the signature of a transaction and a Plutus script are both witnesses.
Witnesses are used by block producers to validate transactions. After a transaction is validated by a block producer, it will be included in a new block, which is then propagated to the network, and verified by the rest of pools. Obviously, witnesses are required as part of the block validation. However, theoretically, once a transaction is validated and included in a block, is there a strong reason to keep the witnesses in the block? Can witnesses be discarded after being used in transaction validation in order to reduce the size of the blockchain? What does the lifecycle of witnesses look like in Cardano?

A witness is the public key of the signer and the signature of the txbody using that public key. That is attached to the submitted transaction. It is not possible to query witnesses from db-sync at the moment, but the raw CBOR of the transaction submitted contains all witnesses included in the transaction.

Thanks Samuel. If I understand correctly, your answer confirms that witnesses only live inside transaction bodies, but not in blocks. This raises a question of how we can find the source code of a Plutus program, which is considered as a witness. One simple solution I can think of is to build a service that record all transactions on the network, including their witnesses, so a script address could be indexed to a Plutus script easily. I am happy to hear if there is a plan or solution proposed by IOG or the community.

Blocks are made up of signed transactions. Signed transactions are the raw transaction body + the witnesses for that transaction. cardano-db-sync does not expose witnesses, but the blockchain does store them.


text:
Minting NFT automatically based on transaction
I wish to write a script that will automatically mint NFTs given payment to an address.
Firstly, I haven't found anyone that has shown how to do this, but if anyone has, or is willing to share, please let me know.
I notice the tutorial here suggests using cardano-cli, however, this requires cardano-node to be running which seems very brittle to me, because if you have issues keeping up with the current state of the blockchain, then you'll miss out on payments.
https://developers.cardano.org/docs/integrate-cardano/listening-for-payments-cli/
Would using cardano-wallet be a better or safer option to listen for transactions?
What would be the steps to automatically minting NFTs based on payment?
And would anyone have any recommendations on how you'd host the script once you've written it? Would you have cardano-node constantly running in a virtual machine (e.g. EC2 instance).

setting up the cardano node is very simple, and once set-up, as long as your resource is available, the node stays up-to-date with the blockchain. The CoinCashew tutorial (https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node#14-configure-your-topology-files) is great for this & there are a number of YouTube videos that explain what do to do too (although tip from my experience, avoid DigitalOcean as a provider for VMs).
I then used this tutorial (https://developers.cardano.org/docs/native-tokens/minting/), to mint NFTs using the cardano-cli & it worked great. I would imagine that based on this, it shouldn't be too complicated to derive a script to do it automatically.
Unfortunately, I cannot help you on your "minting on payment" answer as I am also just beginning to look into this. Also, I'm sure the new smart contracts would have that functionality?

Code for minting Spacebudz is actually open-source, so you could probably use that with a bit of tweaking.
As far as I know this code should basically mint tokens in order for every new transaction back to the transaction sender.
Here's the link to source repo: https://github.com/Berry-Pool/nft-server

Look into dbsync as that is how you can actually look at transactions and not just the txhashes.
Basic setup would be dbsync server (postgres) + cnode (cli || wallet):
dbsync

query slot every couple seconds to see if new block (new block means new potential transactions)
if new block, then grab any new transactions that meet your criteria (verify the amount of ada and grab the addr)

cli / wallet

Send to minting script and mint and send in same tx :)

side notes

either mint 1 at a time, or do about 30 at a time in one tx.
If you need to do more then 30 you will need multiple addresses. To make this work the address you are sending too is different from the addresses you will be minting from. Assuming thousands of requests per block, you could mint 1200 NFTs, with 40 addresses, just need to keep track of them all

Instead of using db-sync and querying transaction data, why can't you just query for the UTxOs at the receiving wallet address?  You could repeat this query on regular time interval.  I'm just curious why you suggested using db-sync?

You can also use Bakrypt.io which is an API specially made for minting Cardano Tokens (NFTs and Fungible Tokens) individually or in bulk. Hence, creating collections of thousands of assets at once. Bakrypt.io also supports Royalties following CIP-0027 standards.
Opening an account is free, meaning you only pay for confirmed transactions. The free tier offers up to 1gb in IPFS storage for free.

If you have a connection to a commercial product mentioned in your post it should be declared or explicitly denied.  See guidelines in help.

this is what i have written,
https://forum.cardano.org/t/auto-sell-and-send-tokens/94280/2
my next step is to bring NFT auto minting.
is not huge difference to mint from sending the NFT.
if you want, contact me and we can work together on this.

[REPOST: https://cardano.stackexchange.com/questions/4891/is-there-an-open-source-vending-machine-script-for-nft-minting]
We open-sourced one of these on GitHub here: https://github.com/thaddeusdiamond/cardano-nft-vending-machine
It's written in Python but requires no cardano-node (only cardano-cli and a Blockfrost key). There's also a sample script in main.py to show how to use it (or just invoke that script from CLI). Our PFP mint was done on my Macbook Pro. Hopefully that helps!

source: Stack Exchange

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

sort: votes


text:
ADA locked with assets
Can you send just NFTs and the transaction fee or do you always need to send ADA in a transaction. Also is there a way to unlink the ADA and Asset in the receiver wallet?

To make a transaction on the blockchain you will need to pay a transaction fee of ~0.17 Ada (may change) to the block producer
There is also minimum Ada that needs to be sent to the receiving wallet:

1 Ada
or ~1.5 Ada for NFTs

I think you are referring to the minUtxoValue which is a protocol parameter that prevents malicious growth of the UTXO set.
For each new UTXO you create, it needs to have that value (around 1 ADA or so). There is no way to create an UTXO just with native assets.

Recover Any $ADA ‘locked’ with any cnft https://link.medium.com/YbyZABPNepb
$ADA #Cardano

Take a look at the help regarding referencing external sources to see how to improve this.  https://cardano.stackexchange.com/help/referencing

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


text:
Cross-chain Hydra
Been thinking about the Taproot upgrade and what it means for bundling validation into Bitcoin transactions. While Hydra requires three validation scripts in Plutus, the similiarities between EUTxO and UTxO would suggest that there is another validator architecture that would create a compatible isomorphic state channel on Bitcoin. Is this feasible and what sort of hurdles have to be overcome?


text:
What's NODE ID? I'm not talking about pool ID
Was setting up script, sendmytip.sh, to update PoolTool with tip and height information.
I noticed this NODE_ID value:
#!/usr/bin/env bash

## CHANGE THESE TO SUITE YOUR POOL

# your pool id as on the explorer
PT_MY_POOL_ID="xxxx"
# get this from your account profile page on pooltool website
PT_MY_API_KEY="xxxx-xx-xx-xx-xxxx"
# Your node ID (optional, this is reserved for future use and is not captured yet)
PT_MY_NODE_ID="xxxx-xxx-xxx-xxx-xxxx"

It's the last line, and is clearly different from the Pool ID.
Would anyone care to let me know how to find a node id, or explain what they are?
When i read a spec, interface, or proposal, however vague readers are giving a clue. I ask because I did not find one. Interfaces aren’t even told how to handle the property.

As mentioned, the node ID is a variable that has not yet been implemented on Pooltool side so just ignore it at the moment.
Date : September 26th, 2021
As there is no mention of this variable yet in the Pooltool official documentation, one can "assume" that this would be an unique ID to identify each relay node of your pool ID? (would it make sense?)

Thank you, and for all: please don’t downvote in event question has authoritative answer. It is server a purpose until then.


text:
Can eUTxO be an input to multiple transactions on the same block, yet not be spent?
I know that eUTxO can be spent only once per block.
I need to find a way, for multiple transactions to reference/read a same piece of data. So the question arises, if multiple eUTxOs can take some other eUTxO as input in the same block and only check its Datum, without doing anything else?
If not, how can I achieve this in some other way? Maybe minting policies? How it would roughly look like?

This might be an interesting read https://github.com/Emurgo/Emurgo-Research/blob/master/smart-contracts/Unlocking%20The%20Potential%20Of%20The%20UTXO%20Model.md#data-inputs-as-a-powerful-solution

Is it possible for "multiple transactions to reference/read [the] same piece of data" in the same block?
No. But the key word there is "transactions."
Chances are you can include all the actions you want to perform in a single transaction. As long as the actions don't need to happen sequentially, just make them all atomic.
Multiple actions can share data as long as they're performed in the same transaction.
Can eUTxO be an input to [a] transaction... yet not be spent?
Again, no.
But you can write the data validator in such a way that if you spend a datum you must instantiate a new one. So, it will be on a new UTxO, but in the case of an Oracle, etc, it can/must be on the same NFT.


text:
How to deploy plutus/marlowe contract on Cardano blockchain
i am developing smart contract in plutus/marlowe playground which i compiled and simulate contracts successfully but now i want to deploy a contract on Cardano blockchain

You'll need a way to submit the transaction. Most devs have only had a few weeks to see the final version so tools might still be a while away. Are you technically skilled enough to install cardano node on your own?

@PatrickSturm yes I already installed Cardano node and CLI both.

You need to serialise your on-chain validator into Plutus Script. You can use some of the existing examples here https://github.com/james-iohk/Alonzo-testnet/tree/update-cabal-1.29.0/resources/plutus-sources to see how your on-chain codes can be serialised and exported into *.plutus format. Then you can use Cardano cli to construct transaction and play with your smart contract, which is essentially a hash of Plutus Script. This link https://plutus.readthedocs.io/en/latest/plutus/howtos/exporting-a-script.html is also useful as well.

I understand you have the technical know-how so I will just post the link in question. So keep in mind, give it a good read. Marlowe JS compiles to Haskell Plutus which is further compiled to Plutus Bytecode/Opcode, can't recall which, not sure it matters. But at the transaction level, we will always be sending the most raw format, bytecode/opcodes.
See Plutus Enabled Transactions


text:
Error when building HSL for GHC 8.10.4.20210212
I'm trying to get the haskell language server installed on my mac and I"m following the docs at https://docs.plutus-community.com/docs/setup/editors/prerequisites.html but they seem to not work. My GHC version (in a nix shell) is:
11:31AM /Users/paymahn/haskell-language-server nix  ✘ 1 master ✱
 ❯❯❯ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.4.20210212

and when I invoke ./cabal-hls-install hls-8.10.4.20210212 I get the following output:
Error when running Shake build system:
  at want, called at src/Development/Shake/Internal/Args.hs:83:67 in shk-0.19.6-79b14aaa:Development.Shake.Internal.Args
* Depends on: hls-8.10.4.20210212
  at error, called at src/Development/Shake/Internal/Rules/File.hs:179:58 in shk-0.19.6-79b14aaa:Development.Shake.Internal.Rules.File
* Raised the exception:
Error, file does not exist and no rule available:
  hls-8.10.4.20210212

Anyone know what this means and how to fix it?
EDIT: I get the same error if I invoke stack ./install.hs 8.10.4.20210212

Looks like the stack.yaml for 8.10.4 was removed which is why this error happens. Checking out tag 1.4.0 fixes it.


text:
What is the point of borrowing on Defi
In order to take out a loan on a Dapp you have to come with collateral. Whatever you cannot pay back on the loan,  you lose that amount in collateral and the interest accrued. That being the case what is the point for the average user to borrow on Defi? It seems only suited to traders to leverage their money. Is there another use case that anyone knows of?

I personally have many ideas. Some people need to borrow and that's OK. If I were to lend someone money though, I'd expect interest to be paid and the principal to slowly go down and usually, one would go through a bank with lawyers so it will be fairly costly for all this so there are minimums to reach before it becomes profitable to the Everyman. This clearly is an issue if we are to have safe, inclusive and decentralised finances.
Another reason is accessibility. Have you ever asked your bank how much it costs to use their API? Ring them, try it, their only line of questioning will be to ascertain how much they can get from you. With a smart contract, you could, depending on provider, interact with you SC at low cost or you can use your own node / code for free. Bet your bank won't do that.
To summarise, average user won't have immediate benefit other than reduced fees ( which add up quite quickly). So how is it going to change the world? It won't. The old world will simply die, as it does every generation, leaving behind a new people who are more technically knowledgeable and with that, these automated systems will allow users to interact with their finances.
This is obviously my own opinion with no historical backing (as there exists, none) and not everyone will agree. Heck, not sure if I do.So many moving cogs. But as I see it, right now, to the average person, I'd see more benefit in using fiat loans until a point where usage and value of crypto stabilises and only at that point in the not far away future, will it be globally beneficial.

Thanks for the thoughtful answer. I've been bouncing these ideas around in my own head too and I agree. These technologies are new and will eventually  be adopted by the masses and provide much greater efficiencies in financial markets, disintermediating great swaths of the economy. Let's see how long it takes!! I just don't see myself taking out a crypto loan on one of these dapps. I am happy to provide liquidity and make some interest, but I have no idea what I would do with a loan. Not interested in high stakes trading.

I recently borrowed some funds on Defi. The reason I borrowed was so I didn't have to sell my crpto. The collateral required was 4 times the loan. The loan was at 1% interest and my interest on the Defi token paid the 1% interest. I've paid back the loan and the only advantage I see is I didn't initially have to sell my crpto. But when I paid back the loan I had to sell crypto at a lower price because I needed to withdraw some funds permanently. The only way I will take another loan is if the collateral coin is in the initial stage of a bull run. Otherwise, it's best to just sell crypto for needed funds.


text:
HSL error for Datakinds extension in Week01 in VSCode
I'm trying to get type definitions for Plutus code in VSCode and I'm getting an unusual error. The first extension in the file is {-# LANGUAGE DataKinds #-} (<- this is a clickable link)
and the error I'm getting is:
Program error: GHC Core to PLC plugin: E043:Error: Reference to a name which is not a local, a builtin, or an external INLINABLE function: Variable PlutusTx.Eq.$fEqMaybe
            [DFunId(nt)]
            No unfolding
Context: Compiling expr: PlutusTx.Eq.$fEqMaybe
Context: Compiling expr: PlutusTx.Eq.$fEqMaybe @ Week01.EnglishAuction.Bid
Context: Compiling expr: PlutusTx.Eq.$fEqMaybe
                           @ Week01.EnglishAuction.Bid
                           ($c==
// truncated because of Stackoverflow limits

I've set the language server in VSCode to /nix/store/7bjn84ssy2kdzy7k0izqb3id3bvg6pzb-haskell-language-server-exe-haskell-language-server-1.1.0.0/bin/haskell-language-server and interesting when I run cabal build in my shell I don't get a similar error:
 1:22PM /Users/paymahn/plutus-pioneer-program/code/week01 (nix)  ✘ 130 main ◼
 ❮❮❮ cabal build
Build profile: -w ghc-8.10.4.20210212 -O1
In order, the following will be built (use -v for more details):
 - plutus-pioneer-program-week01-0.1.0.0 (lib) (first run)
Configuring library for plutus-pioneer-program-week01-0.1.0.0..
Preprocessing library for plutus-pioneer-program-week01-0.1.0.0..
Building library for plutus-pioneer-program-week01-0.1.0.0..
[1 of 1] Compiling Week01.EnglishAuction ( src/Week01/EnglishAuction.hs, /Users/paymahn/plutus-pioneer-program/code/week01/dist-newstyle/build/x86_64-osx/ghc-8.10.4.20210212/plutus-pioneer-program-week01-0.1.0.0/build/Week01/EnglishAuction.o, /Users/paymahn/plutus-pioneer-program/code/week01/dist-newstyle/build/x86_64-osx/ghc-8.10.4.20210212/plutus-pioneer-program-week01-0.1.0.0/build/Week01/EnglishAuction.dyn_o )

Here's a diff which shows how to get this fixed in VScode: https://github.com/paymog/plutus-pioneer-program/commit/7a1c2ff206aeaca9496075f18e2989901aeda9fe
Note that even with this, VSCode fails to navigate to type definitions:

For me already worked type definition with this error and after I added this switch to ghc options it helped me with other files which include this file to have also type definitions on mouse hover. I used this solution in the other lectures, not in week01.


text:
Cabal build Caradano-cli Cardano-node error
I'm trying to create a Cardano staking pool on a raspberry pi 4 with 8GB of RAM. I've been following the coin cashew tutorial for staking pools: https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node#1-install-cabal-and-ghc
I finally got the cabal build for cardano-cli and cardano-node. I have also checked that ghc is on 8.10.4 but for some reason getting this error:
ghc: could not execute: opt
cabal: Failed to build Diff-0.4.0 (which is required by
test:cardano-cli-golden from cardano-cli-1.29.0). See the build log above for
details.
Failed to build Only-0.1 (which is required by test:cardano-node-test from
cardano-node-1.29.0, exe:cardano-node from cardano-node-1.29.0 and others).
See the build log above for details.
Failed to build StateVar-1.2.1 (which is required by test:cardano-node-test
from cardano-node-1.29.0, exe:cardano-node from cardano-node-1.29.0 and
others). See the build log above for details.
Failed to build Win32-network-0.1.0.0 (which is required by
test:cardano-node-test from cardano-node-1.29.0, exe:cardano-node from
cardano-node-1.29.0 and others). See the build log above for details.
Failed to build abstract-par-0.3.3 (which is required by
test:cardano-node-test from cardano-node-1.29.0, exe:cardano-node from
cardano-node-1.29.0 and others). See the build log above for details.

The logs it's telling you to read are the same ones we'd need to read to be of any assistance.

You dont need to compile the code on raspberrypi. It takes 7+ hours.
Use the prebuilt binaries from armada-alliance.
https://github.com/armada-alliance/cardano-node-binaries/tree/main/static-binaries
Join the telegram channel

Find some resources and prebuilt binaries for arm here.
armada-alliance.com


text:
POSIXTime as payload
I have a parameterized contract that includes a POSIXTime as a field called startTime served via PAB.
What is the appropriate stringified HTTP payload to indicate a date with time such as the 25th of September 2021 at noon (no timezone?).

I had troubles making POSIXTime a part of JSON payload, you can just unwrap the Integer inside and use it instead.
Anyway, JSON serialization is implemented here, you can check that instance for details.
If you need to convert POSIXTime to standard time format, something like this function would be useful.


text:
Query all the transaction details from a given block using cardano db sync
Can someone help out with how can i query the transaction details from a block using cardano db sync table? I actually need fields like epoch no, date of transaction, stake address, pool and the amount of the given transaction? I was trying it from the delegation table, but i am having problem with finding the epoch no and if the amount for a given stake address is input or an output(-ve for outgoing and +ve for incoming amount for a given stake address).

Efficient manner is join.
select block.id as block_identifier,* from tx left join block on block.id=tx.block_index where tx.hash='\x{hash}';

Make sure you pay attention to not mixing ID fields.
Some variables not accurately named, a quick check should help you though. You'll need to login to your postgres instance and connect using \c cexplorer
Then type \dt+ to get tables. \d+ {tablename}

The schema docs (autogenerated) are at https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/schema.md .


text:
PAB webserver not working
Trying to connect to the PAB webserver on port 8080 gives: Error: connect ECONNREFUSED 127.0.0.1:8080
Output from running cabal exec MyPAB:
[INFO] Slot 0: TxnValidate b135806142f3d020fc68e9e72fa6e8e7c8fce34b2a0f17fd23b633641f58944a
[INFO] Starting MyPAB PAB webserver on port 8080. Press enter to exit.
[INFO] Starting PAB backend server on port: 9080

How may I fix the problem?

authors: فاروق محمد حسن علي الشرجبي


text:
Mainnet – How to fix a frozen DB syncing?
I've been trying to sync with the Cardano blockchain in order to use CLI wallet on macOS Big Sur 11.6. But syncing is frozen at epoch 289 on block 6,236,059.
cardano-cli query tip --mainnet

{
    "epoch": 289,
    "hash": "e72579ff89dc9ed325b723a33624b596c08141c7bd573ecfff56a1f7229e4d09",
    "slot": 39916796,
    "block": 6236059,
    "era": "Mary"
}

Terminal says there are two errors. I tried to sync 2 times from scratch. It's all the same.
[xcode:cardano.node.DnsSubscription:Error:67] [2021-09-26 10:46:25.44 UTC]
Domain: "relays-new.cardano-mainnet.iohk.io"
Application Exception: 52.58.171.193:3001
MuxError (MuxIOException Network.Socket.recvBuf:
resource vanished (Connection reset by peer)) "(recv errored)"

[xcode:cardano.node.ErrorPolicy:Warning:52] [2021-09-26 10:46:25.44 UTC]
IP 52.58.171.193:3001 ErrorPolicySuspendPeer
(Just (ApplicationExceptionTrace (MuxError (
                                   MuxIOException Network.Socket.recvBuf:
resource vanished (Connection reset by peer)) "(recv errored)"))) 20s 20s

What should I do to fix it?

Hey mate sorry I didn't see this earlier. As per your output logs, you are currently running Cardano-node correctly however, you are using the wrong version. Your current version is not the latest.
Luckily, not much needs to be done, you just need to recompile the new version in a new folder. Make sure you do this with DB Sync also. Development on Cardano will require frequent updates for next 6 months but it will be worth it (has been for me so far).
Your data may remain intact (wasn't so lucky myself) but I ended up needing to manually copy over the binaries to their locations so be prepared to search /opt AND /usr directories to find the files your looking to replace.
A clever search of your currently running instance on Linux, I use:
ps aux | grep cardano
To find any related processes and using its pid, you should be able to easily find the path of the executable


text:
How are you going to stop scammers?
I was the victim of a scammer today, they were asking for ADA and I lose all my savings. If a scammer gets 500k ADA that in the future for sure will become billions. Is there any chance it will finance terrorism?
Organise crime becomes more sophisticated through time. is there any strategy to stop or remediate these sorts of events?
Thanks.

Perhaps this scam has been working since last year, https://cardanocompany.com/    It has videos in YouTube that redirect to web site, some of the videos have over a hundredth thousand likes… and hasn’t been shutdown by YouTube

About scamming and phishing
Fraudsters have always existed and will continue to exist. In the future, there will probably be network-based mechanisms to protect yourself against fraudsters, but so far the crypto industry is too young.
Currently, the police are reluctant to investigate cases of crypto fraud. The police show zeal only if the case is egregious.
How to protect your assets
Here are some tips for those who new to cryptocurrency.

Use only official or time-tested wallets. Triple check if the software wallet you downloaded doesn't belong to scammers.

Use 24-word seed phrase for backup and strong password for encryption.

Never reveal your private key to anyone. Store your seed phrase or private key in a secure and hard-to-reach place.

For day-to-day small payments use devices like Tangem crypto-note.

Avoid phishing sites. Do not store large amounts of cryptocurrency on a computer connected to the Web.

Do not trust those who give away free ADA via faucet or any promotions. IOHK never gives away ADA for free.

Do not store your assets on a cryptoexchange account.

Be wise!

And here are Cybersecurity guidelines for Cardano users.

There are many algorithms which can be used to search trees for transaction patterns but at the end of the day, people can really only do what they can do now. Call local law enforcement. Cardano in not a privacy coin so ensure you provide the transaction info to them and their success would probably be pretty good... eventually. Vigilantism rarely ends well.


text:
Having a problem with Minting with Cardanocli-js
Im creating a transaction using this code:

const tx = {   txIn: wallet.balance().utxo,   txOut: [
{
address: wallet.paymentAddr,
value: { ...wallet.balance().value, [MARCELOCOIN]: 1 },
}   ],   minting: [
{ action: 'mint', quantity: 100, asset: MARCELOCOIN, script: mintScript },   ],   witnessCount: 2, };

when i try to create the Raw arquive with:

let raw = cardanocliJs.transactionBuildRaw(tx);

It gives me the following error:

option --tx-out:
unexpected "N"
expecting white space or quantity (word64)

Error: Command failed: cardano-cli transaction build-raw                 --tx-in 5896209b2eb8eb2e3b19e06335e787c9856661087e6796fd5f483f0a30b923cc#0 --tx-in c6b914dfd086ac8e776c91ea615e847d1e7dc6f447a8cca467371de506ab64a7#1                  --tx-out "addr_test1qqmjrep08v07cjn4t3852hr54czxw4m2dyv7wynkk3ufl63xjyzlpj9g68r0n0q3sfgc9vtt8z48z7yff3a4lh9kp2fqa0ccru+998825875+NaN undefined+1 43ad91053eb32da8884e1e5c4b67865d5f46f90072110c8e233261b9.MarceloCoin"                                                                                --invalid-hereafter 38296439                 --invalid-before 0                 --fee 0                 --out-file /home/cnode/minter/minter/tmp/tx_4ue4nzska.raw

So you see that there is a 'undefined' inside tx-out. I don't know whats the problem.. Can you help me?

Hello. Cardano cli has changed recently and that had added extra output in the query which maybe not yet been managed to implement by the library developer. Try contacting the developer or raising an issue on Github

I have already, but he is too busy with other stuff to help..

All solved with the actualization of the cardanocli-js to the 4.0.1 version.
The examples are working great!

Yes, version 4.0.0 had problems with extra whitespace in some lines. Version 4.0.1 resolved the issue.

The issue which is simple. The command: cardano-cli query utxo --address {address} --mainnet
Has changed it's output format recently. It now returns an extra field at the end of each TX. A well placed .pop() on the correct JS array will fix it. This extra data belongs to the Smart Contract logics.
Unfortunately I do not use this library and am unfamiliar with it so cannot offer any further guidance.


text:
Ledger wallet initial setup in Daedalus versus restore
What are the differences when a brand new Ledger HW wallet is paired with Daedalus as compared to when a Ledger HW wallet is restored?  The reason I ask is that after the Ledger is initially configured, the wallet only has options for changing the wallet name, viewing the public address and deleting the wallet. After a wallet is deleted and restored there are additional options to change the spending password and to confirm the wallet recovery seed.

Is it possible to get back to the original wallet configuration where there is no spending password?
Is the recovery phrase stored in Daedalus and if not, why is the option to confirm the wallet recovery seed not available before the wallet is restored?

I'm paranoid but I don't even like the fact that I typed in a wallet recovery seed on a computer that could have been monitored in some way.

I think you're confusing creating a wallet within Daedalus (using create/restore by mnemonic) with using a hardware wallet. With restoration of a hardware wallet (whether it be a new one or existing), Daedalus never needs the recovery seed or a spending password. The device itself requires a pin to send funds, and Daedalus only gets the public account key of the hardware wallet so the wallet can identify utxos associated with that wallet and generate new unused addresses.


text:
Cardano db sync sender and receiver address confusion
I am needing help with this. I queried the rows whose tx_id = 133903 from tx_out table from postgres.
select * from tx_out where tx_id = 133903;

and I got two rows having two different indices 0 and 1. The result is below in JSON format.
[
  {
    "id": 240155,
    "tx_id": 133903,
    "index": 0,
    "address": "DdzFFzCqrhskf5Bho1HFpjzFGcVG3avzBMBkP4DUHMJMuqaNmPrt5Cnf1GUxQ3gFxFrbZUHsrxgqUf3fkn5NxjHSDh67SfuKHGLcYYuV",
    "address_raw": "E'\\\\x82D818584283581C3490095835CC47B0D182A0DC054D49816D9782FA42D3D26EFF4F613EA101581E581C740E27451628BDD32329FC359C8FC1C1A48FE25B94908AB8ABB577A1001A7E3A51E8'",
    "payment_cred": null,
    "stake_address_id": null,
    "value": 2936699288244,
    "address_has_script": false,
    "data_hash": null
  },
  {
    "id": 240156,
    "tx_id": 133903,
    "index": 1,
    "address": "DdzFFzCqrht3JYLq1Cc9Y3EeyZvTwzwuu5QZCJqbmjFVMj23miQeSMESfJoSb4f1NNJL9ti1nJryGSB1VK7yFbzkRtcEjamaSvj6LP8k",
    "address_raw": "E'\\\\x82D818584283581CB3CC4806AB502B2EC4FFD82CDA50BF4E5465769B6BCB6C0692C6F797A101581E581CCA3E553C9C63C562EE05D443E8D3D451372D66B450379B9002540A9B001A88AF5021'",
    "payment_cred": null,
    "stake_address_id": null,
    "value": 100000000000,
    "address_has_script": false,
    "data_hash": null
  }
]

Correct me if I am wrong but the address field in the tx_out table basically is the receiver right? I want to get the sender's address. How do I find out the sender of this transaction? I am having some hard time figuring this out. Basically I want to create a table that contains the address of sender and receiver and amount for all the transaction ever recorded in the postgres table.

I am  not 100 % sure of this answer;
The input is stored in tx_in table and the corresponding inputs addresses can be found by
select * from tx_out where tx_id in ( select tx_in_id from tx_in where tx_out_id =133903);
you are getting the address which are inputs to the transaction.

Query:
select prev_tx_out.address sender
     , this_tx_out.address receiver
     , this_tx_out.value

  from tx this_tx

 inner join tx_out this_tx_out
    on this_tx_out.tx_id = this_tx.id

 inner join tx_in this_tx_in
    on this_tx_in.tx_in_id = this_tx.id

 inner join tx_out prev_tx_out
    on prev_tx_out.tx_id = this_tx_in.tx_out_id
   and prev_tx_out.index = this_tx_in.tx_out_index

 where this_tx.id = 133903
;

Result:
                                                  sender                                                  |                                                 receiver                                                 |     value
----------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+---------------
 DdzFFzCqrhsycjyjN1UGhehYVs7ZcCfoUR8PNF7QaXgYtNcEci68gLuFrbioBTyvDPW6ztiEDYPZC3jXH9DqjEgXhzLLGUL5hdENMVF4 | DdzFFzCqrhskf5Bho1HFpjzFGcVG3avzBMBkP4DUHMJMuqaNmPrt5Cnf1GUxQ3gFxFrbZUHsrxgqUf3fkn5NxjHSDh67SfuKHGLcYYuV | 2936699288244
 DdzFFzCqrhsycjyjN1UGhehYVs7ZcCfoUR8PNF7QaXgYtNcEci68gLuFrbioBTyvDPW6ztiEDYPZC3jXH9DqjEgXhzLLGUL5hdENMVF4 | DdzFFzCqrht3JYLq1Cc9Y3EeyZvTwzwuu5QZCJqbmjFVMj23miQeSMESfJoSb4f1NNJL9ti1nJryGSB1VK7yFbzkRtcEjamaSvj6LP8k |  100000000000

Remember that a transaction always spends all the transaction input.
Unless the total (tx_out.value) + fee == tx_in.value there will be two tx_out entries, one for the recipient and the other is the change output that goes back to the sending wallet.

Using the code of @grim_i_am

for transaction 34369121, I have the following.
Am I right to understand that in this transaction, 1 sender send to multiple receiver with different amount? If so, why at the receiver, the receiver's address are duplicated?

For transaction id 34368652,

the sender and receiver are multiple. this is normal?
How can 2 sender can send at the same time? I am not quite understand.

Check the  code used by Koios for getting tx inputs and outputs here

a cardano transaction can have multiple inputs and multiple outputs. In the same way that the multiple outputs can go to different addresses, the multiple inputs can come from different addresses too. As long as the transaction is signed by all the private keys of all the input addresses, the transaction is valid.
Also, a single wallet can have multiple derived addresses. So what you are seeing as multiple senders might actually be the same sender. You can confirm this by checking whether the staking_address_id values of all of the sender addresses are the same.


text:
Is it normal to have an empty body for the input object when viewing a transaction with cardano-wallet?

I was scanning the incoming transactions of a cardano-wallet and a transaction's input body did not contain an address. The other transactions had an address. Is this a normal occurence? If so, how do I work around it to find the sending address?

It depends on what you're exploring. If you're exploring forged coins in Cardano, look at this page of Blockchain Explorer, for example – as you can see there's no inputs in Tx. And this is also possible through constructing a raw transaction via cardano-cli – the only question is what will you achieve with such a transaction.
By the way, in Bitcoin network there's a coinbase transaction  that creates coins from nothing. In other words, it's a reward that miner gets for a successfully mined block.

If I understood your question correctly you are looking for the address used to send the ADA.
Your first image shows an array of inputs used in the transaction and each input points to the transaction with the output index.
So to find out the sending address, you can copy the id(transaction id) and search on testnet.cardanoscan.io OR you click on the below link which takes you to the transaction
https://testnet.cardanoscan.io/transaction/834033b8812a1c1b07f490b42c3c705bb47448215b46ece6f35b10ab02099676
There the UTXOs section "TO ADDRESSES (OUTPUTS)" show the list of addresses with balance and the 0th index address is the address which was used as sending address and you can find that address details with below link
addr_test1qzk97pnpqnt63q736t5qczr9ey48z8crznx252jfc7aze3jxrn7utzx6tyv0paf46udyq543rnve77yhmg70qdlrcgws53045k

So, if I cant find the address in the input object, I should look at the output object and derive from the utxo's?

Input should never have an address it will always contain transaction-id and index which point to the UTXO that will be used in the transaction


text:
Executing cardano-cli inside a docker container from another docker container
Can anyone help me with something, I'm trying to run a web server over the cardano-node docker image.
I have some solutions in mind but I would like to have some feedback from you.
Approach # 1
Build a new image over the cardano-node docker image that install node and runs my server code.
My questions around this are:

Where can I find the cardano-node Dockerfile? I need to know what is already setup and what is the underlaying Linux distro.
Related to the previous one, how can I install Node over the cardano-node image? I have tried multiple mechanisms like apt-get and nothing works.

Approach # 2
Create my webserver in a different docker image and make the container communicate with the cardano-node container.
Questions:

How can I communicate my web server container with the cardano-node container so I can run the cardano-cli commands?

Approach 1 is the only one that makes sense to me in my limited knowledge of Containers. Containers, I understand, are different operating system context, not just different process so there isn't really IPC outside of the Docker api. The TCP/IP stack really shines here. Have a small web service with your Cardano-node / Cardano-cli which does basic things with the software and have an additional webserver act as the application level service, in my opinion.

Yeah, that's something that I've thought about. However, the way the official Docker image was built makes it hard to extend. I have been thinking of creating my own following the Linux setup steps from the docs.
The other part of your answer is that the docker-node image exposes the IPC through a volume, so that makes me think that it is possible to achieve such inter container communication; I don't know-how.
This is my docker-compose.yml

version: '3.1'

services:
  cardano-node:
    image: inputoutput/cardano-node
    environment:
      - NETWORK=testnet
      - CARDANO_NODE_SOCKET_PATH=/ipc/node.socket
    volumes:
      - data:/data
      - node-ipc:/ipc
      - ./dist/apps/cardano-server/outputs:/outputs

volumes:
  data:
  node-ipc:

NIX is used to build the image. There is no Dockerfile (as far as I know).
https://github.com/input-output-hk/cardano-node/blob/master/nix/docker/default.nix

You can establish cross-container communication via node.socket:
docker run -e NETWORK=mainnet -v node-ipc:/ipc inputoutput/cardano-node
docker run -e NETWORK=mainnet -v node-ipc:/ipc inputoutput/some-node-client

https://hub.docker.com/r/inputoutput/cardano-node

Thanks, I might try that later. For now, I'm building upon a community image for the Cardano Node.


text:
Voting fund 6 not working
Can not register for fund 6. In adalight it says enter link description here
Registration for fund 5 voting is closed, and fund 6 is not shown.

Did you already update the app and clear both cache and storage?

Registration for fund6 is now closed, last call was on Oct 4 - 11AM UTC.
As @Aron Neewart said, you probably need to update your app if you don't see fund6. Anyway, now is too late to register, do that for the next fund


text:
How many servers do I need to run cardano-wallet?
I want to automate the sell process of NFTs. It seems to me that the only backend wallet available right now is cardano-wallet. To run cardano-wallet I need to install cardano-node. If you investigate about cardano-node you always read about stake pools which seem to need 3 servers.
If I only want to use cardano-wallet for the purpose mentioned above (no stake pool) do I need 3 servers too?

You can run everything on one server. You can run cardano-node in the background and use cardano-wallet or cardano-cli from your application (just export the CARDANO_NODE_SOCKET_PATH environment variable to the node socket path).
You can run cardano-node in the background either as deamon or you can use something like docker to do it.


text:
Cardan Hobby Project - Concept question
As hobby, I am trying to build a small website (using cardano db and nextjs) that would work as described :

The website displays on its front page a "message" .
The "message" is decided by the owner of pre-defined NFTs (NFT_A and NFT_B)
During odd days, the "message" of NFT_A owner is displayed; (NFT_B
for even days)
"message" should be stored on cardano database and be easily
retrievable from the NFT id

To achieve that, I am considering the following :

"message" will be store as metadata in TX; (the "message" displayed should be the metada on the latest TX)
The message will be retrived by using a blockfrost.io api call

Do you think this is the right approach ? do you have any remark ?
Thank you so much :)

I'm not sure if you will query blockfrost each time someone lands on the website or once per day?
In case you start running into quota you could also run your own cardano-graphql instance to query metadata for asset (token) or you can use already hosted solution by gimbalabs https://gimbalabs.com/dandelion/graphql-api

Thanks for your answer !
I thought about querying blockfrost one per day, and do a static redering of the website.
I am not so familiar with graphql but I thought it would be simpler to just go for an pre build solution ^^


text:
Script unlock cannot submit, budget overspent
I'm  trying to unlock some token at a script address, so I create a tx with cardano-cli transaction build ... this passes successfully, then I sign the tx. It is now ready for submit but when I submit I get this error:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (UtxosFailure (ValidationTagMismatch (IsValid True) (FailedUnexpectedly [PlutusFailure "\nThe 3 arg plutus script (PlutusScript ScriptHash \"9f8863d5eb3f855c406ff38f29daa84e41ba0f3f1203bbe54275cf5f\") fails.\nCekError An error has occurred:  User error:\nThe budget was overspent. Final negative state: ({ cpu: -119092 | mem: -400 })
After this I get a detail of the Tx followed by a big patch of non-readable text. (This same error also appears in the output of the syncing testnet node I'm running)
Anyone knows what's the issue and how to solve it? Thanks

The error says your contract is over resource budget.
 User error:
   The budget was overspent. Final negative state: ({ cpu: -119092 | mem: -400 })


text:
How many transactions can cardano-wallet perform per minute?
Let's say I automate the process to send 5 ADA (or 1 NFT) to 100 wallets.
If I'd do this with Yoroi it would take a lot of time and manual work.
If I'd do this with cardano-wallet there is no manual work...but how much time would this take?
So how many transactions can cardano-wallet perform at once or per minute?

Well it really depends on how much UTxO's you have currently in your wallet. If you use one UTxO per transaction then you can send out multiple transactions in parallel.
Also you can increase output buy making multiple outputs per transaction, if your case is to send funds as quickly as possible.
As far as the real metric goes I don't think it can be easily calculated. But if it means anything for you apparently Cardano currently has 250TPS on layer 1 and will increase to about 1000 after Hydra.


text:
Difference between staked and delegated tokens?
I'd like to clarify my understanding of staked and delegated tokens.
Cardano website says:

Ada held on the Cardano network represents a stake in the network, with the size of the stake proportional to the amount of ada held. The ability to delegate or pledge a stake is fundamental to how Cardano works.

Delegation is the process by which ada holders delegate the stake associated with their ada to a stake pool.

AFAIU, therefore
Total Stake = Delegated Staked Tokens + Non-delegated Staked Tokens,
where Non-delegated Staked Tokens are staked by the pool owners directly to their pools without delegation. Total Stake tokens amount in the Cardano network, therefore, should be always bigger (or equal as extreme) than the total amount of Delegated Staked Tokens.
Is this understanding correct?

Based on the conceptual clarity of that explanation, the meanings of the words within the context of Cardano, and the use of those terms in the passages you cite... yes.
But I don't want you to lose 50 rep in a bounty when it seems you've answered your own question!
Is there some specific technical outgrowth of the question you are interested in?
Or are you looking for an official answer from some organization?

Stake
Your ADA is your stake in the Cardano network. You can do different things with this stake. The most prominent use case is for sure delegating it to a stake pool to secure the network. But you also have a stake in voting in the Catalyst proposals for example.
Therefore the total stake of the Network is the total amount of ADA in circulation. This doesn't equal the amount of ADA that is delegated to stake pools as some people don't stake their ADA.
Stake pools
The stake pool operator has to pay a fee of 500 ADA when registering the pool. This ADA doesn't count towards the pledge or staked amount but will be returned once the pool is retired. The pledge of a stake pool is ADA that is delegated to the stake pool by the owner of the pool. It counts towards the staked amount of the pool like any other delegation.

Total Stake = Delegated Staked Tokens + Pledged Staked + Non-delegated Staked Tokens
Delegated Stake= any Wallet holder
Pledged Stake= Stake Pool owner
Non-delagted Stake= usually lying unused on an exchange/HW Wallet

Delegation is the name of the process that enables staking. There aren't different types of staked ADA tokens or delegation processes.
An SPO doesn't need delegators if they have enough of their own ADA to mint blocks, some pools do this today.
Total Stake in terms of a stake pool means the combined ADA stake from the SPO owner and the delegators who staked with that pool. ADA staked by the pool owner is also referred to as a pledge.

Are you saying that an SPO's pledged stake is ada that they are 'delegating' to themselves? This seems like an abuse of delegate as an english word. On the other hand, (to use the simple meanings of the english words), one does not have to delegate anything (stake it on someone else) in order to stake it per se. I.e. you can stake something on your own competence, and such would not be an instance of delegation.

SPO's pledged ADA is what they are delegating to their own pool. If they don't have the threshold amount of ADA to mint blocks, they would need delegators to make up that difference.
You must complete the delegation process to the stake, if not, the ADA in your wallet will just sit there and do nothing for you. It won't count towards the network's total of staked ADA.
If you want to Stake to your own pool then you'd set up a stake pool and add your pledge to it. After that you just wait for the 3 epochs it takes for the rewards to start generating.


text:
Cardano-cli error when submitting transaction
I am following the cardano developers tutorial to create NFT using Cardano-cli
At the end, when submitting the transaction I get the following error :

Command failed: transaction submit  Error: Error while submitting tx:
ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError
[UtxowFailure (WrappedShelleyEraFailure (UtxoFailure
(OutputTooSmallUTxO [(Addr Testnet (KeyHashObj (KeyHash
"a7102f357a41445de696f938ca97ebe94cc93ec7c587bee7374cffc7"))
StakeRefNull,Value 0 (fromList [(PolicyID {policyID = ScriptHash
"6980e14a6a158448066df02b641657f798275ac1ea1177cf517180c0"},fromList
[("NFT1",1)])]),SNothing)]))),UtxowFailure (WrappedShelleyEraFailure
(UtxoFailure (ValueNotConservedUTxO (Value 996981629 (fromList
[(PolicyID {policyID = ScriptHash
"6980e14a6a158448066df02b641657f798275ac1ea1177cf517180c0"},fromList
[("NFT1",1)])])) (Value 200000 (fromList [(PolicyID {policyID =
ScriptHash
"6980e14a6a158448066df02b641657f798275ac1ea1177cf517180c0"},fromList
[("NFT1",1)])])))))])

I have two questions :

Can someone help me to identify the error ?
Is there some documentation/tool somewhere to understand the cardano-cli errors ? I had some in the past and they are not indicative at all imo

Thank you so much

1) You actually have 2 errors: OutputTooSmallUTxO, ValueNotConservedUTxO.
Error 1: OutputTooSmallUTxO
As mentioned here, it is right that minimum to send ADA is 1 ADA, but since you are sending an NFT, that requirement is roughly 1.4ish ADA on the minimum to attach when sending the NFT (as fee is calculated by size of transaction, check out here Minimum ADA for Token Bundles)
I'd suggest for now just say 1.6 ADA or just go with 2 ADA (2 000 000 lovelace) if you're on testnet if you just want it to work.
Error 2: ValueNotConservedUTxO
This stems from not balancing the transaction. You have to remember that everything that goes in, must go out. So if Anna has 50 ADA and 1 NFT, and wants to send 25 ADA to Bob, the resulting output would be 24 ADA and 1 NFT back to Anna | 25 ADA to Bob | 1 ADA for fee
2) For the errors, just keep reading into them as they explain themselves to an extent. Keep going into the parenthesis and it can help to separate it out by lines. Here is a good resource you can input the errors by specific name: IOHK lookup. You can match the error text to the CLI command you did (if you add your command it can explain better). Most errors are from not balancing the fees, which is sort of fixed with the new cardano-cli transaction build which includes fees and doesn't make you calculate them, but you still need to make sure the tokens are balanced as well (if minting new and all that).

It says that you have OutputTooSmallUTxO which means that your ADA output for the address must been too small. As I can see you're output is 200000 lovelace which is 0.2 ADA.
Minimal ADA per transaction is 1 ADA so try increasing output to at least 1 ADA.

The error you are looking for is ValueNotConservedUTxO.

Not that I know of, but most of them are pretty obvious. If not, usually a quick google does the thing.


text:
Cardano Data for Data Analytics and Data Visualisation
Where can I get Cardano raw data or formatted data (e.g. no. of wallets, ADA price, etc) that I can use for data science, analytics and visualisation?

there are providers such as
https://api.koios.rest/#overview
and
https://blockfrost.io/


text:
Sending many transactions from one address in quick succession?
I was wondering if anyone has figured out an effective way of sending many different transactions in quick succession from the same address? I have an application that can require making 100+ transactions a minute. So far the only solid way I've been able to facilitate this is to use about 50 different addresses, since I have to wait for one transaction to confirm before I can send another one (with CLI and Cardano REST API). I think this occurs because the UTXOs don't update until confirmation, which affects the next transaction attempt. Does anyone know of a more efficient way of sending many transactions in quick succession using CLI, the Cardano Wallet REST API, or even the Cardano Serialization Library?
Thanks!

It depends on the application you are building, but it's possible you could include all the actions in a single transaction.
You can use arbitrarily large amounts of constraints on your transaction in off-chain wallet code for smart contracts. Here is an example with 4 constraints, but you could do as many as you needed to get your job done. I believe you would need to wait until the PAB (Plutus Application Backend) is operational before you can use that wallet code on the mainnet, however.


text:
How to create a programmable NFT?
Is it possible to create a gif or video NFT? For example, every time the user clicks on the image, an animation plays once or on repeat over the image. I do not see any guides on this and would appreciate anyone's insight, thank you.

Perhaps a different question to ask is, “ can I designate ownership of a gif or video using an NFT.”

All of the examples you give are things you can do off the blockchain.
Typically NFTs for art just prove ownership of that art. Sometimes they will include some small piece of metadata that describe the attributes of the art (see Crypto Kitties). This is why people make jokes about how one can just “right click, copy” someone’s NFT.
Not that ownership isn’t important or interesting, just that you can theoretically designate ownership with an NFT for anything you want: an animated gif, video, a website, a tree, your house, etc.

How to create a programmable NFT?

Technically, you can program dApps to interact with your NFTs and do lots of interesting things. You wouldn’t be able/want to program the animation of an NFT on chain though. That’s not the purpose of smart contracts, generally speaking (not here to stifle creativity). You could include metadata about what kind of animations or interactions the NFT art might have, but the actual animation would still happen using off-chain software and there are infinite ways one might go about that.


text:
What are the risks of staking at a pool?
Imagine the pool operator goes offline due to technical reasons, what are the risks for investors staking at that pool?

None, if the pool goes offline then you just can't stake to it.

If you have delegated your funds to the staking pool, you have nothing to worry about, even if this pool went offline. Staking is 100% safe. A delegation to a staking pool is a separate action as opposed to transferring your funds.


text:
How does the CARDANO_NODE_SOCKET_PATH environment variable work for both the mainnet and testnet?
According to the docs,

cardano-cli and other Cardano software components need to know where the node socket file is located. We saved it to the path $HOME/cardano/db/node.socket in the previous example. The components read the shell environment variable CARDANO_NODE_SOCKET_PATH to find this.

It seems like this node socket file is specific to either the testnet or the mainnet, not both. Are you supposed to change the CARDANO_NODE_SOCKET_PATH environment variable every time you want to use the CLI tools with a different network?

It uses the same environment variable. I've not needed to change the node socket when I switch between testnet or mainnet.

Does that mean that carano-node's db directory should be the same for testnet than for mainnet?

no, the test net is a different chain so it wouldn't use the same db as the mainnet.

but it's ok for the node socket path to be in the same directory as the mainnet's db?

yes, a node socket is only telling what port to use to communicate with a given node. So it can be the same port for a mainnet node and testnet node.

When the node is running and you go to that directory where you have your node socket, you'll find its a text file that is made when you run the node.

The node.socket is a mechanism called IPC (Inter-process communication) that basically helps a CLI instance connect to the active node which is currently syncing the blockchain to your PC (local node instance).
Refer to https://developers.cardano.org/docs/get-started/running-cardano/ and search for "--socket-path:" to jump to the relevant section which tells you more about this.
Assuming that you aren't syncing BOTH the mainnet and testnet at the same time, you can provide the same node.socket path to the cardano-node or cardano-cli instance and things should work fine... (Experts, please correct me if this isn't how it works, as I haven't tried syncing both nets at the same time).
In any case, whether you sync to mainnet or testnet, the ledger data itself is downloaded to a particular path using the ----database-path option for cardano-node. As long as you specify different paths for testnet or mainnet, you should be good to go...


text:
Why do some addresses show zero transactions even though they had transactions?
I'm querying this address on testnet, which has had two transactions, yet cardano-cli shows none:
cardano-cli query utxo \
   --testnet-magic 1097911063 \
   --address addr_test1qrth9u0url08lh3wyyvs9t5rehuwvmlymechalx3l4ednt37ljw2qfmeg3wrlqzp6zuswfr65gunuugh8mf80naz28msdws93h

                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------

Why is that?

Could you have sent the utxo query too soon? Sometimes it takes a second for them to show up.

You're querying UTxOs and not transactions. In order to explore list of transactions you're best off using explorer for testnet or mainnet.
If you you need to explore transactions from some app or script either use self-hosted cardano-graphql stack, gimbalabs hosted cardano-graphql and or blockfrost.

You are querying if the specific address contains UTxOs, not past transactions.
cardano-node sees only the current state of the blockchain, not historical events. For that, you will need to use cardano-db-sync or a hosted alternative such as https://blockfrost.io.

I don't understand what the difference between the "current state of the blockchain" and "historical events" is. cardano-node has access to the full ledger, so it should be able to work out which transactions happened at a given address?


text:
Telling a TxId from a contract to use it in a webapp?
I want to submit a transaction and then expose that TxId to the PAB via the contracts tell function.
This TxId can then be used by a front end as a more precise pointer to the onchain representation of some Utxo(with a little bit of drilling).
Is this a viable method of tethering onchain Utxo’s to a web apps interface?
In order for this to work, TxId has to be decoded into a Tx…and I’m not sure if there is a function for that.
The other option is to not tell any state from the contract and just drill into the Utxos at the script address.
This method was shown numerous times in the PPP, but it runs into problems when there are multiple Utxos at the script address locked by the same pk.


text:
What are the key benefits of IOHK's new light wallet over Yoroi?
Found this link that talks about it more:
https://www.youtube.com/watch?v=hbi07kZM_Zk&ab_channel=IOHK


text:
Is there a way to go from a TxId to a Tx?
I looked through the Plutus GitHub and found some info, but I cannot decode it.plutus/plutus-ledger/src/Ledger/Tx.hs
Here it is:
  encode (SomeTx tx eraInMode) = encodedMode eraInMode <> Encoding (TkBytes (C.serialiseToCBOR tx))
    where
      encodedMode :: C.EraInMode era C.CardanoMode -> Encoding
      -- 0 and 1 are for ByronEraInByronMode and ShelleyEraInShelleyMode
      encodedMode C.ByronEraInCardanoMode   = Encoding (TkSimple 2)
      encodedMode C.ShelleyEraInCardanoMode = Encoding (TkSimple 3)
      encodedMode C.AllegraEraInCardanoMode = Encoding (TkSimple 4)
      encodedMode C.MaryEraInCardanoMode    = Encoding (TkSimple 5)
      encodedMode C.AlonzoEraInCardanoMode  = Encoding (TkSimple 6)
  decode = do
    w <- decodeSimple
    case w of
      2 -> decodeTx C.AsByronEra C.ByronEraInCardanoMode
      3 -> decodeTx C.AsShelleyEra C.ShelleyEraInCardanoMode
      4 -> decodeTx C.AsAllegraEra C.AllegraEraInCardanoMode
      5 -> decodeTx C.AsMaryEra C.MaryEraInCardanoMode
      6 -> decodeTx C.AsAlonzoEra C.AlonzoEraInCardanoMode
      _ -> fail "Unexpected value while decoding Cardano.Api.EraInMode"
    where
      decodeTx :: C.IsCardanoEra era => C.AsType era -> C.EraInMode era C.CardanoMode -> Decoder s SomeCardanoApiTx
      decodeTx asType eraInMode = do
        bytes <- decodeBytes
        tx <- either (const $ fail "Failed to decode Cardano.Api.Tx") pure $ C.deserialiseFromCBOR (C.AsTx asType) bytes
        pure $ SomeTx tx eraInMode

How do you go about using something like this?
Thanks!

The answer is no.
A TxId is hash digest (blake2b-256) of the serialized transaction body. By construction, a hash is non-reversible (https://en.wikipedia.org/wiki/Cryptographic_hash_function).
In order to find back a transaction from a TxId, you need an index which keeps track of transactions and enable looking them up.

The validator script has only access to the ScriptContext which contains TxInfo and ScriptPurpose.
TxInfo contains the following:
data TxInfo = TxInfo
  { txInfoInputs      :: [TxInInfo] -- ^ Transaction inputs
  , txInfoOutputs     :: [TxOut] -- ^ Transaction outputs
  , txInfoFee         :: Value -- ^ The fee paid by this transaction.
  , txInfoMint        :: Value -- ^ The 'Value' minted by this transaction.
  , txInfoDCert       :: [DCert] -- ^ Digests of certificates included in this transaction
  , txInfoWdrl        :: [(StakingCredential, Integer)] -- ^ Withdrawals
  , txInfoValidRange  :: POSIXTimeRange -- ^ The valid range for the transaction.
  , txInfoSignatories :: [PubKeyHash] -- ^ Signatures provided with the transaction, attested that they all signed the tx
  , txInfoData        :: [(DatumHash, Datum)]
  , txInfoId          :: TxId
  } deriving stock (Generic, Haskell.Show, Haskell.Eq)

So it looks to me as if you cannot access the Tx in your validator.

I think you you might be a little confused about what I'm asking. After you submit a transaction with submitTxConstraints (off chain code) it returns a type of Tx. You can then compress that Tx into a TxId. Im wondering if there is a way to go from that TxId back to Tx. Everything here is off chain code so the validator scope should not matter.


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

Definitely Linux, thanks to its command-line and server capabilities.
NixOS 21 is a worthy candidate.

What flavor of Linux?

For example NixOS. It's a GNU/Linux distribution that uses Nix as both a package manager and a configuration manager.

What about FreeBSD ? Did somebody try it out ? Does it work ?

Sorry @Jey, I haven't run it on FreeBSD.

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:
What is the Penalty for Running 2 Block Producer Nodes?
I am working on a block producer failover script and am wondering if there is a penalty for having two block producing nodes running at the same time. Basically there could be a slight overlap where 2 BPs are up until the Cronjob I create restarts one as a relay. Reading through different forms I see posts saying that there is a penalty for the pool who runs 2 BPs at the same time. I am looking for details of that penalty as well as an answer to if I am better off programming it to make sure there is ALWAYS only 1 BP online and thus sacrificing a small amount of pool BP uptime (like 2 minutes max). Or programming it to maximize uptime and sacrifice having to BPs online for a small amount of time (~ 2 mins).
Thanks for the help in advance!

I was thinking same about same problem!
First you don't need to have BP all time online. It should be online only when Slot Leader is assigned to you, basically a time when you should forge a block and this is known ahead.
Second, I personally think technically you can have 2 BPs online. Your relays should have topology.json were you can set only 1 producer. So technically relays connects to BP and then it forges a block, if I understood that part correctly. So technically you can have 2 BPs up and running simultaneously and I even have it in my setup, most important that you relays are connected to only one BP.
Per my understanding BPs are connected to relays and your relays are connected to BPs.
In perfect world you can have them online simultaneously only, I think you should not allow one relay to connect to one BP and other relay to another BP.
So probably in your place I would close FW between backup-BP and relays(but you need to recheck it, maybe if we totally block traffic BP will not be in sync) and when main BP is down, you can open FW.
In my current testnet setup I have configured main BP with hostname and when it is down route 53 change IP of that hostname to IP of Backup-BP and relays switches automatically to backup-BP. After experimenting a while with this approach I found out that when main-BP is back online relays do not want to switch back, because connection is up and running relays simply don't need to make new DNS request. So probably I need to write a script what will either restart backup-BP after main-BP is online or I need to play with FW as described below.
Here are my post in Cardano Forum about this:
https://forum.cardano.org/t/redundancy-architecture-what-i-have-in-plan-please-criticize-it/78297

I don't know what happens if both BPs have the exact same operating node certificate, but if either of the BPs has an older certificate, there is no penalty. I used to run two BPs. I switched nodes by updating the operating node certificate (when creating new KES key pairs). The node with the newer certificate creates the assigned block.
This was just an experiment and not very helpful for me as we can calculate our block leader assignment date 1.5 days in advance. Instead of maintaining two nodes, I only have to stay online with one BP when I'm producing a block.

Running 2 block producers is not a recommended option.
Network can penalize.
One option you can do is failover BP. Care should be taken that only one node is acting as BP is used while producing blocks.
I would recommend a private relay (a relay which is not registered in your pool certificate). The advantage of this is that you can quickly convert this to a failover BP and dont have to deal with topology or db related issues. This also helps incase you get DDOS on your registered relays. Ofcourse you will need scripts to have this failover BP. few pools in armada-alliance are looking at this resiliency of stakepool especially for baremetal pools. Here is an idea from my friend QXT pool
https://twitter.com/PgwadaS/status/1451218689135579142

Don't know the answer for your question, but I´d avoid that, create a custom script to restart the second node in Core Mode (BP). Therefore the second node is running in relay mode until activated by a custom event

The network will penalize you and will not assign you any blocks


text:
What should I do with a validator which exceeds the maximum size?
In the recent months, I've been working on a conflicts resolution project and was starting to write the Plutus script. The problem is that, because of the complexity required, the script ended up exceeding the current maximum size by a lot (4x). My questions are:

Are there any plans to significantly increase the maximum validator size? (5000)
If there are not, is there anything I can do to continue the project on Cardano? Keep in mind that the script complexity will certainly require a size greater than 5000 (maybe not 4x more though)

Im very interested in how you can split the validation in several validators There is any model or framework to follow?
Any example around?
Could somebody at least share some words of insights about it?
Will be very much aprecciated
Thanks

You can split it into multiple validators.
Each validator would have an NFT that can only be spent if the requirements for its validator are met (including returning the NFT to the script address with a new datum).
Your core validator would then validate that transactions include all the required NFTs.


text:
Endpoint contract response from PAB
Is there a way to return values that are not the unit in JSON form from an endpoint?
Currently, any successful endpoint call over HTTP returns "[]".
The only way we have to debug content is on the PAB side, from which we can read logs.
Does this have to do with the final parameter of the Contract w s e a where a is generally the unit in most starter PAB code?
According to the docs, a is a semigroup. If we return some type there we still don't get a result from the PAB.

As I understand, it's not possible to return a value different to unit because the endpoint response always returns unit () check here in endpoint line
Here is the call to endpoint:
:<|> "endpoint" :> Capture "endpoint-name" String :> ReqBody '[JSON] JSON.Value :> Description "Call an endpoint." :> Post '[JSON] ()
Post receives a JSON with JSON.Value value and returns a JSON with a () value.
Anyway, you can use status to debug and read logs, which returns ContractInstanceClientState including:

observableState
logs
lastLogs

You call status in this way:
/api/contract/instance/<contract-instance-id>/status


text:
How to convert BuiltinString or BuiltinByteString to String?
Is there a way to convert BuiltinString or BuiltinByteString to String ?
There are these functions in the module PlutusTx.Builtins.Class
stringToBuiltinByteString :: String -> BuiltinByteString

stringToBuiltinString :: String -> BuiltinString

Are there functions to perform the inverse operation?

Yes, per the definition, BuiltinByteString derives Show, so you can write show bbs, where bbs is your variable, and it will convert your BuiltinByteString into a String

Thanks for pointing this out!


text:
Nami wallet showing getBalance returning a NaN
Hi i just recently started working with Nami Wallet to be implementes in a web app, but when im trying to get my wallet balance:
window.cardano.getBalance().then(res => console.log(res))

its returning an string.

"1a3b983883"

would love to know what that is and if i can convert that to an actual number.
Picture:

getBalance function returns cbor encoded hex string, so you should actually decode it.
Easiest way to do it is by using Cardano Serialization Lib.
After you've downloaded the library you can decoded it by doing this:
import * as wasm from '@emurgo/cardano-serialization-lib-browser';

window.cardano.getBalance().then(res => {
   const balance = wasm.Value.from_bytes(Buffer.from(res, 'hex'));
   const lovelaces = balance.coin().to_str();

   console.log(lovelaces);
})

EDIT:
Thanks to Hernan Rajchert for explaining on how to get lovelaces from Values object.

thanks! but this code returns this object "{ptr: 1180552}", what to do with that?

Yeah I got the same response so I'm not too sure about it. I'd recommend you rather building your transactions using TransactionBuilder, because it offers you nice way to specify change address and etc.

@DanielDiaz, that is a pointer to the WASM object, if you need to get the lovelace value as string you can do balance.coin().to_str()

Yes as DanielDias suggested thats the way to go I got my balance in lovelaces

I'll update my answer and tag @HernanRajchert

Why do I get "Uncaught ReferenceError: Buffer is not defined"?

//another way to convert hex string to bytes without Buffer
function hexToBytes(hex) {
for (var bytes = [], c = 0; c < hex.length; c += 2)
bytes.push(parseInt(hex.substr(c, 2), 16));
return bytes;
}

@HernanRajchert or anybody else know how I can view the contents of these WASM objects that you're referring to?

You have to use the cbor npm package to extract the balance value:
import cbor from 'cbor';

const getAdaBalance = (string) => {
  const decoded = cbor.decode(string)
  return ((typeof decoded === 'number') ? decoded : decoded[0]) / 1_000_000;
}

let myBalance = getAdaBalance(await window.cardano.getBalance());


text:
Error running Testnet node: unwrapEnvelopeErr = ObsoleteNodeCHAIN BlockNo 2989599 SlotNo 39614381
I am trying to run a testnet node (version 1.29) but it stops sync with this error:
$ cardano-node run --topology testnet-topology.json \
  --database-path ~/cardano/db/ \
  --socket-path ~/cardano/db/node.socket \
  --host-addr 127.0.0.1 \
  --port 3001 \
  --config testnet-config.json

[danicuki:cardano.node.DnsSubscription:Notice:109] [2021-10-13 16:48:29.61 UTC] Domain: "relays-new.cardano-testnet.iohkdev.io" Connection Attempt End, destination 52.58.117.45:3001 outcome: ConnectSuccess
[danicuki:cardano.node.DnsSubscription:Notice:112] [2021-10-13 16:48:29.62 UTC] Domain: "relays-new.cardano-testnet.iohkdev.io" Connection Attempt End, destination 3.128.220.55:3001 outcome: ConnectSuccessLast
[danicuki:cardano.node.ErrorPolicy:Notice:52] [2021-10-13 16:48:29.62 UTC] IP 54.250.11.33:3001 ErrorPolicySuspendConsumer (Just (ConnectionExceptionTrace (SubscriberError {seType = SubscriberParallelConnectionCancelled, seMessage = "Parallel connection cancelled", seStack = []}))) 1s
[danicuki:cardano.node.ErrorPolicy:Notice:52] [2021-10-13 16:48:29.62 UTC] IP 18.132.238.21:3001 ErrorPolicySuspendConsumer (Just (ConnectionExceptionTrace (SubscriberError {seType = SubscriberParallelConnectionCancelled, seMessage = "Parallel connection cancelled", seStack = []}))) 1s
[danicuki:cardano.node.ErrorPolicy:Notice:52] [2021-10-13 16:48:29.62 UTC] IP 18.159.64.253:3001 ErrorPolicySuspendConsumer (Just (ConnectionExceptionTrace (SubscriberError {seType = SubscriberParallelConnectionCancelled, seMessage = "Parallel connection cancelled", seStack = []}))) 1s
[danicuki:cardano.node.ErrorPolicy:Notice:52] [2021-10-13 16:48:29.62 UTC] IP 54.241.77.32:3001 ErrorPolicySuspendConsumer (Just (ConnectionExceptionTrace (SubscriberError {seType = SubscriberParallelConnectionCancelled, seMessage = "Parallel connection cancelled", seStack = []}))) 1s
[danicuki:cardano.node.ErrorPolicy:Notice:52] [2021-10-13 16:48:29.63 UTC] IP 54.151.49.138:3001 ErrorPolicySuspendConsumer (Just (ConnectionExceptionTrace (SubscriberError {seType = SubscriberParallelConnectionCancelled, seMessage = "Parallel connection cancelled", seStack = []}))) 1s
[danicuki:cardano.node.DnsSubscription:Error:112] [2021-10-13 16:48:30.29 UTC] Domain: "relays-new.cardano-testnet.iohkdev.io" Application Exception: 3.128.220.55:3001 HeaderError (At (Block {blockPointSlot = SlotNo 39614475, blockPointHash = 1acb3ab3338115eb485e8ae73e8abc24b2c48f2ddb4880bd85ca586aa6dcfd5b})) (HeaderEnvelopeError (OtherHeaderEnvelopeError (HardForkEnvelopeErrFromEra S (S (S (S (Z (WrapEnvelopeErr {unwrapEnvelopeErr = ObsoleteNodeCHAIN 6 5})))))))) (Tip (SlotNo 39614381) 809a09ac9273bf7c468622c0f6f480deb8f81946c4381e7dbdf1aae63195c678 (BlockNo 2984847)) (Tip (SlotNo 39774427) bd48afea977bc086e9329a6de76ce094ff20c0a960c6e9e7e761c4322d6e3392 (BlockNo 2989605))
[danicuki:cardano.node.ErrorPolicy:Warning:52] [2021-10-13 16:48:30.29 UTC] IP 3.128.220.55:3001 ErrorPolicySuspendPeer (Just (ApplicationExceptionTrace (HeaderError (At (Block {blockPointSlot = SlotNo 39614475, blockPointHash = 1acb3ab3338115eb485e8ae73e8abc24b2c48f2ddb4880bd85ca586aa6dcfd5b})) (HeaderEnvelopeError (OtherHeaderEnvelopeError (HardForkEnvelopeErrFromEra S (S (S (S (Z (WrapEnvelopeErr {unwrapEnvelopeErr = ObsoleteNodeCHAIN 6 5})))))))) (Tip (SlotNo 39614381) 809a09ac9273bf7c468622c0f6f480deb8f81946c4381e7dbdf1aae63195c678 (BlockNo 2984847)) (Tip (SlotNo 39774427) bd48afea977bc086e9329a6de76ce094ff20c0a960c6e9e7e761c4322d6e3392 (BlockNo 2989605))))) 200s 200s
[danicuki:cardano.node.DnsSubscription:Error:109] [2021-10-13 16:48:30.58 UTC] Domain: "relays-new.cardano-testnet.iohkdev.io" Application Exception: 52.58.117.45:3001 HeaderError (At (Block {blockPointSlot = SlotNo 39614475, blockPointHash = 1acb3ab3338115eb485e8ae73e8abc24b2c48f2ddb4880bd85ca586aa6dcfd5b})) (HeaderEnvelopeError (OtherHeaderEnvelopeError (HardForkEnvelopeErrFromEra S (S (S (S (Z (WrapEnvelopeErr {unwrapEnvelopeErr = ObsoleteNodeCHAIN 6 5})))))))) (Tip (SlotNo 39614381) 809a09ac9273bf7c468622c0f6f480deb8f81946c4381e7dbdf1aae63195c678 (BlockNo 2984847)) (Tip (SlotNo 39774427) bd48afea977bc086e9329a6de76ce094ff20c0a960c6e9e7e761c4322d6e3392 (BlockNo 2989605))
[danicuki:cardano.node.ErrorPolicy:Warning:52] [2021-10-13 16:48:30.58 UTC] IP 52.58.117.45:3001 ErrorPolicySuspendPeer (Just (ApplicationExceptionTrace (HeaderError (At (Block {blockPointSlot = SlotNo 39614475, blockPointHash = 1acb3ab3338115eb485e8ae73e8abc24b2c48f2ddb4880bd85ca586aa6dcfd5b})) (HeaderEnvelopeError (OtherHeaderEnvelopeError (HardForkEnvelopeErrFromEra S (S (S (S (Z (WrapEnvelopeErr {unwrapEnvelopeErr = ObsoleteNodeCHAIN 6 5})))))))) (Tip (SlotNo 39614381) 809a09ac9273bf7c468622c0f6f480deb8f81946c4381e7dbdf1aae63195c678 (BlockNo 2984847)) (Tip (SlotNo 39774427) bd48afea977bc086e9329a6de76ce094ff20c0a960c6e9e7e761c4322d6e3392 (BlockNo 2989605))))) 200s 200s

My configs are downloaded from this source:
https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/testnet-config.json
https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/testnet-byron-genesis.json
https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/testnet-shelley-genesis.json
https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/testnet-alonzo-genesis.json
https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/testnet-topology.json

What is wrong with my configs?

Before trying anything else have you tried using cardano-node 1.30.1?

The solution for this problem is to download the latest version of cardano-node. 1.29 is broken for testnet, but the 1.30.1 works perfectly.
Download here:
(https://hydra.iohk.io/build/7739444)

This worked for me, thanks!


text:
What are the differences between IOHK, Emurgo and the Cardano Foundation?
What are the similarities and differences between IOHK, Emurgo and the Cardano Foundation? How do they independently provide value to the ecosystem? What are their individual mandates? Do they oversee each other in any way?

IOHK is one of the world's pre-eminent blockchain infrastructure research and engineering companies.
The company builds high-assurance blockchain infrastructure solutions for public, private sector and government clients
EMURGO is a global blockchain technology company providing solutions for developers, startups, enterprises, and governments.
The Company develops, supports, and incubates commercial ventures and help integrate these businesses into cardano decentralized blockchain ecosystem. EMURGO also provides technical support services.
Cardano is a third-generation, decentralized proof-of-stake (PoS) blockchain platform designed to be a more efficient alternative to proof-of-work (PoW) networks. Scalability, interoperability, and sustainability on PoW networks like Ethereum are limited by the infrastructure burden of growing costs, energy use, and slow transaction times.
The Cardano platform runs on the Ouroboros consensus protocol. Ouroboros, created by Cardano in its foundation phase, is the first PoS protocol that not only was proved to be secure, but also was the first to be informed by scholarly academic research.


text:
In depth resources about the Cardano sidechain research and vision
During the 2021 Summit Aggelos briefly mentions a future of Cardano which includes sidechains which will, among other things, enable integration with other blockchains.
Does anyone have in depth resources (eg: whitepapers, IOHK blog posts, etc) which elaborate on this idea so that I can learn more?

I would take a look at Hydra.

Hydra is a state channel (like lightning), not a sidechain, right?

According to Charles, the Catalyst Voting System is running on a sidechain.

AFAIU, Hydra is the mechanism that will enable cross-chain communication. Sidechains would be a single usecase for Hydra.


text:
Minting and distributing to different wallets
I am trying to build a transaction that mints a number of tokens and distributes them to different wallets. Like here:
vote :: forall w s. Poll -> Contract w s Text ()
vote poll = do
  ...
  let lookups = mintingPolicy (receiptPolicyI $ ReceiptPolicy "")
                <> mintingPolicy (votePolicyI $ VotePolicy "")
  let tx = (mustMintValue $ assetClassValue voteAC -10)
            <> (mustMintValue $ assetClassValue receiptAC 10)
            <> (mustPayToPubKey wallet1 (assetClassValue receiptAC 5))
            <> (mustPayToPubKey wallet2 (assetClassValue receiptAC 5))
  ledgerTx <- submitTxConstraintsWith @Polling lookups tx

In this example 10 votes are burned and 10 receipts are minted. The 10 receipts shall be paid to 2 wallets.
Now when I test this, an error is thrown. It complains that there are insufficient funds in the wallet that submits the transaction. It says that 10 assets of type receiptAC are missing.
Now, of course these assets are missing in the wallet because I want to mint them in the same transaction that also distributes them.
How can I achieve this ? Maybe I am using mustPayToPubKey wrong and should indicate the distribution differently.

Are you testing with the emulator trace? Is the error from the emulator?
I'd recommend constraining everything so the only thing you're trying to do is mint to two wallets: remove the vote stuff and set your minting policies to just True.

In fact, can you include your entire error message in your question?

Hi Mitchell, thank you for the feedback. I'm testing in the emulator trace and printing out additional logs to trace. I'll simplify the code and test again. Your comment gives me confidence that it is an error on my part. I was already afraid that this behaviour was expected. That would have been very bad for me : ).

I'd suggest you introduce delay between the transaction doing the minting and the transaction that pays into the different PubKeyHash by not submitting them in one transaction.

Here comes the answer: The example code above is a simplified extract of the real code I was running. In the latter, I wasn't setting the value to be minted to the constant 10 but using a function to derive it from a data structure. And here was the problem. It evaluated to 0 because of a small mistake. So I was not minting any receipt-tokens. I had not seen it because another, very similar use case was running without problems.
So the good message is, there is absolutely no issue in Plutus. Minting and distributing tokens to arbitrary output-utxos in a single transaction is absolutely feasible.
Thanks, Mitchell, for the rapid support.


text:
How to calculate the transaction Id of a given signed transaction?
How do you calculate the Id of a given transaction?
I have hex encoded signed transaction like this:
83a40081825820e6121528557c30515de581cf9284cedaa28d0e2f3967796fe597362ae3dc685901018282583900d445112afba4f34d531df640655a5d14b705fac06bfda87a5726d22d92a2116978a42962d86b55a65ce4f2057c38554a94af14a2d5cbd9631a000f42408258390068f9a99aee42f752737bcfc55058caabce8506752d86ee15d03b389457f91c8a1d4e92e22cecc222ecad40d5945cff39ef5e0571d2799abd1a3b772070021a00029204031a025fca45a1008182582030e0387eec27858662d4c2b233b604a1c9c64087656df6d5c8bd767109fadd1858402c5c17e237f01ebc2679c56984391fe42a323e9ea649e02d0fc4141a27ff621048d8a9f80c23affa95de83cdc1d9cf1b5c776edebdd32e87731eb2515b4cca0ff6

When I broadcasted the data, I got the following id:
6eee20dfb476e0d113d22a18246bec044bbb857d97e892f0789e05d486b27fde
So I was wondering if there's a way for me to calculate the id with given transaction data. I found this article:
https://emurgo.io/en/blog/understanding-unspent-transaction-outputs-in-cardano
and tried Blake2b256 hash, but it produced different value.
76b1d252029ef367eb95c782968a41eb7bb1d6f4968f6f38be0ae03ec283bce4

You are looking for blake2b-256 digest of the cbor-encoded transaction body.
Thanks to KtorZ to help with this.

I see, thank you!


text:
What is the size limit of transaction's metadata?
Is there a size limit on transaction metadata?
If there is a limit, is it varying or fixed size?

At the moment maxTxSize = 16384 bytes (including metadata).
If we talk about the max number of characters in a 16 KB text file with UTF-8 encoding (8-bit), then this is 16384 characters, since each character weighs exactly 1 byte. This is more than enough, to describe transaction's body and add a reach metadata to it.

Here is an important note regarding Tx metadata:

There is no limit on the number of key-value pairs (except the overall transaction size limit) or on individual structured values. However, there is a limit on the size of text strings and byte strings within the structured values, which is implemented to mitigate the problem of unpleasant or illegal content being posted to the blockchain.

P.S.
During Basho era the size of Tx might be increased up to 512 KB.

Clarifying: The 16384 bytes is inclusive of everything in the transaction, not just the metadata correct?

Yes, exactly....

@AndyJazz, I need to buy you a beer! Found your answer after hours of debugging.... Thanks you are awesome!

Thanx @tjacks3, nice drink!

Values change, so this is safe for the current parameters:
  $ cardano-cli query protocol-parameters --mainnet | jq .maxTxSize
  16384

But these are in flux, so you can try to be mindful of upcoming changes. Metadata is so versatile that if it didn't get larger there would probably be a way to deal with this, but it's in as much flux as many of the other pool parameters.
I don't know the best way to stay on top of these changes.


text:
Is there any way to connect to cardano testnet without running the cardano-node on local computer?
Since the KEVM or EVM devnet seem to be crashed, I Want to access the Cardano testnet, but I don't want to run a Cardano node on my machine and sync the info.
so I wonder is there any tool that can be used as a remote Cardano node like the provider or infura in Ethereum?
Maybe Cardano-wallet? I am not sure if it also needs the Cardano-node running. Thanks.

If you are looking for a tool like Infura's or Alchemy's API, I'd suggest blockfrost.io
They have several standard endpoints you can fetch from, using standard HTTP methods.

Thanks~ I will have a try

If you are looking for a hosted solution, have a look at Blockfrost.io.

Thanks~ I will have a try


text:
How to create and sign a transaction on a mobile device?
I would like to create a simple mobile application (iOS) that would create and sign a transaction and submit it through an API like Blockfrost to the network. Preferably that transaction would interact with a smart contract address.
Is it currently possible to do that? I would suspect it is since it seems Yoroi works like that but how can this be done? I don't see any SDKs for iOS or Android that would enable such functionality.

Yes, sure, you can use Emurgo's serialization library to create the transactions and Blockfrost's Swift 5 SDK to submit it and fetch Cardano blockchain data.
Yoroi-mobile project might be an inspiration.

Thanks those are helpful but I was looking for native iOS and Android SDKs. The serialization library is a Rust crate which cannot be easily used from a native app. It has bindings to Javascript and I see that Yoroi is a React Native app but I was looking for a Swift version of those.

Ah, sadly, I do not think native version exists at this moment.


text:
I have a cardano internal error
I ran the Cardano node command and it was fetching new tips for like a minuet then i get this error:
cardano-node: internal error: Unable to commit 1048576 bytes of memory
(GHC version 8.10.4 for x86_64_unknown_linux)
Please report this as a GHC bug: report a bug · Wiki · Glasgow Haskell Compiler / GHC · GitLab
here is a screenshot:

what's your hardware specification?
That error is thrown by RAM depletion.
You may be able to tune RTS parameters, check it out here

upgrading the RAM may avoid this error

https://downloadmoreram.com/

This message appears when the process runs out of memory. Usually, increasing the amount of memory will solve the problem, but not always. Try completely replacing the memory, if it's not soldered to the board.
If that doesn't help - report an issue to the Cardano team.

As mentioned by others above, allocate more RAM to this system.
Check the IOG specs for minimum RAM needed, I think it's 16GB now.
You can also increase your swap space to say 20GB as a temp work around - this is not ideal but is quick to action.
Use command free -h to check RAM and swap space usage.
Also make sure you have enough disk space on the volume where the chain is being saved. Use command df -h


text:
How can you listen to all incoming transactions of a wallet address?
For a web app, I'm wondering is there an API/SDK that enables you to execute some code every time an address receives ADA, NFT, or native token? The wallet address receiving does not change. If not, what repos should I start at for building this sort of functionality?
For example, I'm selling NFTs on my website and my wallet address is shown which anyone can send a specific amount of ADA to in order to get a random NFT from the collection. I want to execute the functions which pick a random NFT from the collection to mint every time my wallet receives the specified amount of ADA.

You have a lot of answers, good time to mark one as accepted :-)

There are different ways.
You can do what jnprogrammer said, or you can run the graphql setup https://github.com/input-output-hk/cardano-graphql providing an entire stack of tools including the API (graphQL).
The graphQL query you're looking for could look like this
query {
  transactions(where: {outputs: {address: {_eq:"addr1..."}}}) {
    outputs {
      address
      value
    }
  }
}

and you'll receive a list of sending address and receiving address with the amounts in lovelace
If you don't want to build and run any of that yourself, you could also use a public API. I am not sure if there are any reliable public graphQL endpoints out there, but e.g. blockfrost.io offers a REST API.
The downside of that is you rely on a third party and you depend on that service being up to date with the network and always up and running. On the other hand, depending on your experience and admin skills, it can also be the more reliable option :)

Thanks for the reply! That's exactly what I was looking for from an API standpoint, and your clarification is much appreciated, I may go with the REST API after some investigating. Now if I can just find a way to get that query to trigger every few minutes or so in my web app, it would be as close as possible to constantly "listening" to all sending addresses.

Just to follow on this good answer, you might use the websocket-link with Blockfrost https://github.com/blockfrost/blockfrost-websocket-link

I believe this guide would help you out:
https://developers.cardano.org/docs/integrate-cardano/listening-for-payments-wallet/

this is polling, not listening

All the above solutions can do the job, but you'll end up polling the blockchain on each one. Another solution though is using tangocrypto services. Their webhooks feature will allow you to "react" to different blockchain events such as PAYMENT. So you just need to set up a webhook and start listening to a specific address. You will get a callback notifying you every time the address receive a payment.

What info do you wanna get specifically? If it is just the UTXO's at an address and you are running a node then the following script suffices.

#!/bin/bash
cardano-cli query utxo --mainnet --address $(cat ~/path/to/file.addr) > ~/UtxosAtAddress

If you would like more info on transactional data you could run the cardano-db-sync package in along side the node. Via this you can query a lot of data, but it does require some PostgreSQL knowledge.
Now if you have no interest in running a node or the cardano-db-sync, you could also query third party api's. A nice one to mention is Blockfrost that has multiple languages supported. For more info on this see their website [1]

How about running a Cardano node and build a script that queries the target address and produces something consumable by your API?

Thanks for the reply! This sounds something I would be interested in doing, but where do I start with this "script"? Excuse me for my inexperience, but this script is somehow connected to the cardano-node I'm running? Something "consumable" by my API means an output the code in my web app could interpret?


text:
What does TXOutDatumHasNone mean when you query utxo?
I sent a transaction from Daedalus to my node version 1.30.1 on mainnet and when I query utxo it reads amount* + TXOutDatumHasNone
Are those tokens burned? What does it mean?

TXOutDatumHasNone means that the specific UTXO does not contain any Datum.
As per docs.cardano.org:

The datum is a piece of information that can be associated with a UTXO
and is used to carry script state information such as its owner or the
timing details (which define when the UTXO can be spent). It is
frequently used in combination with a redeemer – which is arbitrary
information included in a transaction to provide an input to the
script.

Its like a text you can add to a transaction. And hold information about spending the asset too, can be use with a script too.


text:
ScriptWitnessNotValidatingUTXOW error when submitting transaction
I can send simple transactions to yoroi without any errors. However when I submit a transaction with NFT policy cardano-cli returns an error.
node version 1.30.1 (relay node)
system: ubuntu 20.4
tip:
{
    "epoch": 296,
    "hash": "32a29af3a31fa24e6d731e9adfeb35eb065eb8f688a611da9b479f2770870a01",
    "slot": 42857090,
    "block": 6380067,
    "era": "Alonzo",
    "syncProgress": "100.00"
}

nft meta :
{
  "721": {
    "policyid": {
      "name": {
        "name": "name",
        "artist": "artist",
        "description": "",
        "image": "ipfs://"
      }
    }
  }
}

create policy
cardano-cli address key-gen \
--verification-key-file policy/policy.vkey \
--signing-key-file policy/policy.skey

keyhash:
cardano-cli address key-hash --payment-verification-key-file policy/policy.vkey

policy script:
{
    "type": "all",
    "scripts": [
        {
            "type": "before",
            "slot": 42862090
        },
        {
            "keyHash": "keyhash",
            "type": "sig"
        }
    ]
}

address:
hash     0        5000000 lovelace + TxOutDatumHashNone

calculate fee:
cardano-cli transaction calculate-min-fee --tx-body-file keys/nfttx.raw --tx-in-count 1 --tx-out-count 2 --witness-count 2 --mainnet --protocol-params-file keys/protocol.json --byron-witness-count 0

transaction:
cardano-cli transaction build-raw --fee 198721 --tx-in hash#0 --tx-out $(cat keys/payment.addr)+2000000 --tx-out $(cat keys/payment.addr)+2801279+"1 $(cat policy/nft/policy.id).head00" --mint="1 $(cat policy/nft/policy.id).head00" --minting-script-file policy/nft/nft_policy.script --metadata-json-file policy/nft/nft_meta.json --invalid-hereafter=42862090 --out-file keys/nfttx.raw --invalid-before 42857090

sign transaction
cardano-cli transaction sign  --tx-body-file keys/nfttx.raw  --signing-key-file keys/payment.skey --mainnet  --out-file keys/tx.signed

error:
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash "keyhash"])))])

EDIT: I get the same error even when submitting a transaction without the invalidation of the policy script part.

Please add add the commands that your are executing

@raghu I think I forgot signing the transaction with my policy.skey. If you update your answer I'll accept it.

I'm having the same problem. Did you find a solution?

@cardadodev The transaction needs to be signed with the policy.skey and the payment.skey together.

Would you mind changing the

`"keyHash": "keyhash",

in the policy script with you key hash. You can generate key hash using

cardano-cli address key-hash --payment-verification-key-file policy.vkey

exact command will depend on the location of your key files.
After including this Key Hash in the policy script, the minting transaction must be signed by the corresponding signing ket(policy.skey). The transaction also has to be signed by the wallet which is paying the fee.
Unless these two signing keys are proper the transaction will not get submitted.

I just changed it for the question. I put the correct keyhash in the script.

@Bahamas so why did you accept this answer if it didn't help you?

I also got this error trying to mint a native token. In my case, adding the invalid-hereafter parameter to the cardano-cli transaction build-raw command fixed it.  I made sure the value was the same slot number as the policy script before value.
I did not include the invalid-before parameter like the OP.