text:
is it possible to execute an undecidable off-chain loop, and attack the network in this way?
is it possible to execute an undecidable off-chain loop, and attack the network in this way? taking into account that the off-chain code is flat Haskell code is also complete turing.

The off-chain code is executed by a single node to construct the transaction which is then disseminated to the other nodes. I think it is indeed possible to keep this node busy with a never ending loop in the off-chain code. The thing is that - to my knowledge - there are no public entry points for the nodes to execute arbitrary off-chain code. You must always run the off-chain code on a specific node you have access to and which exposes only a defined set of operations. So basically you can only attack yourself.


text:
Wallets begining with 0x
I've seen multiple blockchains (eth, bnb, avalanche) that support wallets that begin with 0x, that way we have 1 wallet for multiple chains, is this possible with cardano or we are fixed to addresses begining in addr.... ?

This Catalyst proposal is trying to achieve a DNS for Wallets (WNS) on Cardano. Theoretically you can assign different wallets to one address.
Also, Unstoppable Domains might support Cardano soon.

that would be great, because having 1 wallet for each blockchain is just not great. Imagine having a different "real wallet" for each dollar bill you have, ex: 1 wallet for $1, one wallet for bills of $5, etc... I hope this gets implemented

I want to follow up and say that ADA handle will start with Beta sale on Nov 6th.

I’m familia, I’ve been following then. What I don’t know is if that will allow the hex address from metamask to be transformed

source: Stack Exchange

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

sort: votes


text:
Opinions on Payment Integration Within App...?
I'd like some opinions on this possible integration of Cardano payments on my native iOS app. Native as in it runs and can store information on the device. So Apple would pretty much be behind the security from that point on if I store information on the phone.

User enters Daedalus private key in my app and stored on device, never touching my server

User enters Daedalus passphrase in my app and stored on device, never touching my server

Before sending their order to my server, they sign it on device with Ed25519(universal Cardano signing algorithm?)

I can now pass the value from number 3 and go ahead with my transaction where I process it in my server using cardano-cli/cardano-wallet?

Sounds like you want to build your own wallet app, which is certainly possible. If you just want to use ADA payments in your app, it might be better to let the users pay to one of your addresses without entering their private key in your app.

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


text:
Finding related addresses and total balance of wallet for any given address
In the Daedalus wallet under "Receive" it says

Please note that all of your receiving addresses include your stake
key. When you share a receiving address, the recipient can search the
blockchain using your stake key to locate all addresses associated
with your wallet, and also discover your wallet balance and
transaction history.

Does that mean I can query for any address the stake key and therefore all the child addresses with their total balance?
If yes, how can I achieve this using the cardano-cli and cardano-wallet?
I already know, that I can read the balance of a single address with cardano-cli query utxo --address, but how can I discover the related addresses in the same wallet?

I have this exact question. Did you already solved it?

no, but I believe it can be possible with the cardano-graphql api

You need db-sync to analyze wallets that you don't have the account public key for. Given an address from a wallet, you can run cardano-address inspect to identify the stake address:
cardano-address address inspect <<< addr1...
This is a sample query to db-sync that lets you query all addresses for a given stake address.
SELECT * FROM utxo_view INNER JOIN stake_address ON stake_address.id = utxo_view.stake_address_id WHERE stake_address.view = 'stake1...';
One caveat is anyone can send funds to a payment address not associated with your wallet that's associated with your stake key. This means there could be some addresses you query that the user doesn't have control, so you cannot assume the user with the wallet with that stake key can access all the addresses provided.

I did this query but my stake_address table is empty. Any idea why is this happening?

Probably your db-sync never completed syncing.

Some addresses may not belong to a stake pool so no. Any address which is staked can be verified though. Although the cli does not provide a method to do this, you'll need db sync or related tool, specifically one which runs the chainSync mini protocol which is not in the cli.
Cardano wallet will do the trick however.

How does Yoroi or Daedalus do calculate the wallet balance when the address is not staked?

They have 'chain-sync', a smaller subset specifically for your wallet. When you create a new address via standard operation, the wallet already has the info about it locally. DB-sync is for global data and is structured differently, in a much sparser manner. There are 41 tables in total, each having fragments of the overall data. Sure, there is likely some form of link, but you would need to do that man power alone


text:
Can I avoid using a public IP on Block-Producer (BP) node?
My BP and relays are on the same local subnet, I would prefer to give them the private IP address in the topology files.
However, all of the guides I've come across explicitly state using public IPs. Is there a problem with using private IPs in the topology files to connect my BP node and my relay nodes?

Each of your Cardano nodes needs a static IP address to communicate between each other. You can use IP or domain names.
Block Producer (BP) node
For better security, you can choose to set a private IP to your BP node to communicate with your relays (on the same private network) since your BP is hosting sensitive data you don't really want to expose.
Relay nodes
However, it is necessary that the relay nodes have a public IP address as the other external relay servers will need to establish incoming TCP/IP connections with yours to exchange and update informations.
You can set 1 public IP address for each one of your relays but you can also use a single public IP address and port-forward to share with your relays.

Hi @Bao, thank you for the feedback. I guess I was wondering why I would ever use the BP's public IP if I didn't need to, and I don't really see a need to.

As long as your BP can communicate with your relays, it is not required to have a public IP address on your BP. But your relays will need at least 1 public IP to receive incoming TCP/IP connections.

Great that’s all I need to hear, thank you

I dont know how you manage your nodes :)
but for security reasons, i would recommend to use another node, which will be the "Jump-Server".
this Jump-Server has a public_IP, which will be used for you to connect with ssh, and only this system will have access to connect with ssh to the rest of your nodes (BP and Relays)


text:
`Integer` as `Datum` in offchain code
In the onchain validator I used Integer type for Datum and everything was fine
but when I want to use mustPayToOtherScript tx constraint in the offchain code I get the following error:
 • Couldn't match expected type ‘Datum’ with actual type ‘Integer’
 • In the second argument of ‘mustPayToOtherScript’

Edit: offchain code
start :: AsContractError e => Promise () OwnerSchema e ()
start = endpoint @"start" $ \const -> do
    pkh <- pubKeyHash <$> ownPubKey
    let
        tokenAAmount = 10000000000
        tokenBAmount = 1000000000000
        lt = 100000000000
        value = (V.assetClassValue poolNFT 1) <>
                (V.assetClassValue tokenA tokenAAmount) <>
                (V.assetClassValue tokenB tokenBAmount)
        tx   = mustPayToTheScript (lt) value
    ledgerTx <- submitTxConstraints poolInst' tx
    void $ awaitTxConfirmed $ txId ledgerTx
    void $ waitNSlots 1
    logInfo @String $ printf "created pool UTXO %s at validator hash %s" (show poolParams) (show $ orderBoxVH')
    return ()

Can you please add the mustPayToOtherScript code you wrote?

Sure, I am trying to create a uniswap type pool UTXO which stores the liquidity token supply in its datum (hence of Integer type)

Your off-chain code is using mustPayToTheScript and not mustPayToOtherScript. It's important to note the difference, since mustPayToTheScript will require a datum with the type you defined in poolInst', while mustPayToOtherScript will require a datum of type Datum.
So, I will assume you want to use the latter. In this case, you need to convert your variable of type Integer to a variable of type Datum. This can be easily done with (Datum $ PlutusTx.toBuiltinData lt).
Assuming your logic and other components are working, your code would look like the following:
start :: AsContractError e => Promise () OwnerSchema e ()
start = endpoint @"start" $ \const -> do
    pkh <- pubKeyHash <$> ownPubKey
    let
        tokenAAmount = 10000000000
        tokenBAmount = 1000000000000
        lt = 100000000000
        value = (V.assetClassValue poolNFT 1) <>
                (V.assetClassValue tokenA tokenAAmount) <>
                (V.assetClassValue tokenB tokenBAmount)
        tx   = mustPayToOtherScript (Datum $ PlutusTx.toBuiltinData lt) value
    ledgerTx <- submitTxConstraints poolInst' tx
    void $ awaitTxConfirmed $ txId ledgerTx
    void $ waitNSlots 1
    logInfo @String $ printf "created pool UTXO %s at validator hash %s" (show poolParams) (show $ orderBoxVH')
    return ()

Just so it gets easy to debug in the future, I would suggest you to create a function focused specifically in the contract and another function for handling endpoints.


text:
Staking pool not participating in next couple of epochs?
I started staking yesterday and staked to TSC, which is a new pool started by a YouTuber whose Technical Analysis I appreciate.  But after staking I realized... well, a lot of things.  It's complex. But chiefly it concerns me that the pool hasn't produced any blocks (pool only a week old, so that's maybe a good reason why), but also isn't participating in the current epoch apparently (if the Yoroi dashboard is right), and actually won't participate until epoch 293.  Why isn't this pool participating yet?  Is there a delegator threshold?  Minimum stake threshold?  Waiting period after inception of the pool?
The pool: https://adapools.org/pool/da23e855d5e0a1b72bd384c4adb93ff9e0deba6861233d53cbf4daf2

Pools are allowed to participate in block production based on the amount of ADA deligated. If the amount is less than around 1Million the pool may not produce blocks every epoc( every 5 days).
This may not affect your reward in the long run which will be around 5% per year on average. Since if the deligation is low your % of reward from the pool will be higher.
Please read about this. https://cardano.org/stake-pool-delegation/  . If the pool has low delegation it may not get blocks for a long time but when it gets your % will be high and that's how generally the return stays around 5% . If the deligation is too low there may be no rewards at all.

When you stake your ADA with a pool, your stake will be included in the snapshot at the end of the current epoch (let's call it epoch x). This snapshot, which includes your Ada delegation, will be used as part of the calculation during epoch x+1 to determine how many blocks each pool mints during epoch x+2. During epoch x+3, your rewards, if any, will be calculated. Those rewards will then be paid during epoch x+4.
A pool with a delegation of about a million Ada will produce, on average, about 1 block per epoch. It is normal for a pool of that size to have several epochs where no blocks are produced, and several epochs where more than one block is produced. A pool with a delegation of 20 million Ada will produce, on average, 20 blocks per epoch. It is very unlikely that such a pool would experience a blockless epoch.
Your pool, TSC, currently has around 700k in delegations, and appears to be growing quite quickly. This should plenty enough to ride the waves of luck and average out at roughly 5% per year which is the expected return of any pool.
A pool with a small delegation, let's say 100k, would expect to mint about one block every ten epochs, which may not be enough to overcome the swings of luck in order to average out at 5% - it may be quite a bit more or quite a bit less at the end of the year, but over a long enough period of time, it would average the same return as every other pool.


text:
What is a host address how do I get one
I have been going through the Cardano developer tutorials and they asked me to run this code (posted below) to run a node but it responded with (Failed to parse IPv4 address: x.x.x.x.).
I figured that it's because I didn't use a valid address (line 5) how do I get one?

cardano-node run
--topology path/to/mainnet-topology.json
--database-path path/to/db
--socket-path path/to/db/node.socket
--host-addr x.x.x.x
--port 3001
--config path/to/mainnet-config.json

Try localhost ( 127.0.0.1 ) and it should work

You are launching a Cardano node on your server so you have to bind this node to one of your server's IP addresses.
You can try 127.0.0.1 if you want to stay local or you can go 0.0.0.0 if you want to bind the node to all the IP addresses of your server (assuming that you know what you're doing and that you've already configured the right firewall rules so you don't expose yourself).

Wait so what happens if I bind it to an invalid IP address? And maybe a follow-up, can I bind to multiple addresses? Like for example the local VPC one and the public one

You have to specify the ip address to bind to. Binding to an ip address means you are creating a socket that allows flow of packets from and to that way.
You can bind to virtually any IP (even non-local one, if you permit that in the networking settings), but you'd bind to 0.0.0.0, to bind to any IP on your host, or to any of your local IP on your host, like 192.168.1.100.


text:
Block Producer vs Relay Node setup
Can only Pool operators run Producer nodes? What is the difference between the producer and relay from a setup point and where to get the specifics for each on installing? Being new it's hard to know what is or is not possible because the documentation is often era specific. It's hard to know which documentation still applies and what docs are out dated. Some things are still correct regardless of era, but I'm struggling with the changes.
My goal is to learn how to do most everything (Best practices, Node creation, CLI interaction, Smart Contracts w/NFT and tokens, analysis etc ) accept I'm not planning on running a pool since it seems like there are so many pools that are not doing well for a number of different reasons. I figure it will be a struggle to get enough ADA staked to make it viable. I first want to mint my own NFTs. NFT-maker pro isn't working. I want to limit the fees by doing myself and am struggling with a full road map. If seen the sprout vids and they get me 3 steps forward but are missing certain details.
If nothing else getting a really good starting point would help.
James

If you want to get started with Cardano, setting up a stake pool can be a good start to learn the basics. You will be able to explore the different cli commands as well as the fundamentals of the eUTX0 model.
Regarding my experience, I started by watching this official Stake Pool course by the Cardano Foundation. The information is not all up to date but the explanatory videos make it easy to understand the basics (UTXO transactions, payment keys, staking keys, KES keys ...). It's a good base to experiment a Stake Pool on the Testnet.
Once this course is finished, you can now go to the documentation "How to build a Cardano Stake Pool" on CoinCashew. This is the most complete How-To to learn how to properly install and configure your Stake Pool for the Mainnet. It also includes the routines to maintain and keep your Cardano nodes functional.
If after that you still have difficulties or questions, you can go to the official Cardano forum to ask for help from the community.
Have fun and good luck!


text:
missing node.socket
so I synced towards Alonzo mainnet with cabal build and interrupted at 92% and somehow ~/cardano/db/node.socket is missing. And no matter how many times I restart the node with
cardano-node run \
--config /home/user/cardano/mainnet-config.json \
--database-path /home/user/cardano/db/ \
--socket-path /home/user/cardano/db/node.socket \
--host-addr 127.0.0.1 \
--port 3001 \
--topology /home/user/cardano/mainnet-topology.json

it gets stuck at
Listening on http://127.0.0.1:12798
[hud-PS63:cardano.node.networkMagic:Notice:5] [2021-09-16 02:17:41.27 UTC] NetworkMagic 764824073
[hud-PS63:cardano.node.basicInfo.protocol:Notice:5] [2021-09-16 02:17:41.27 UTC] Byron; Shelley
[hud-PS63:cardano.node.basicInfo.version:Notice:5] [2021-09-16 02:17:41.27 UTC] 1.29.0
[hud-PS63:cardano.node.basicInfo.commit:Notice:5] [2021-09-16 02:17:41.27 UTC] 48429531f0d3d71fadce9a5971bf56a6df396f2d
[hud-PS63:cardano.node.basicInfo.nodeStartTime:Notice:5] [2021-09-16 02:17:41.27 UTC] 2021-09-16 02:17:41.275947702 UTC
[hud-PS63:cardano.node.basicInfo.systemStartTime:Notice:5] [2021-09-16 02:17:41.27 UTC] 2017-09-23 21:44:51 UTC
[hud-PS63:cardano.node.basicInfo.slotLengthByron:Notice:5] [2021-09-16 02:17:41.27 UTC] 20s
[hud-PS63:cardano.node.basicInfo.epochLengthByron:Notice:5] [2021-09-16 02:17:41.27 UTC] 21600
[hud-PS63:cardano.node.basicInfo.slotLengthShelley:Notice:5] [2021-09-16 02:17:41.27 UTC] 1s
[hud-PS63:cardano.node.basicInfo.epochLengthShelley:Notice:5] [2021-09-16 02:17:41.27 UTC] 432000
[hud-PS63:cardano.node.basicInfo.slotsPerKESPeriodShelley:Notice:5] [2021-09-16 02:17:41.27 UTC] 129600
[hud-PS63:cardano.node.basicInfo.slotLengthAllegra:Notice:5] [2021-09-16 02:17:41.27 UTC] 1s
[hud-PS63:cardano.node.basicInfo.epochLengthAllegra:Notice:5] [2021-09-16 02:17:41.27 UTC] 432000
[hud-PS63:cardano.node.basicInfo.slotsPerKESPeriodAllegra:Notice:5] [2021-09-16 02:17:41.27 UTC] 129600
[hud-PS63:cardano.node.basicInfo.slotLengthMary:Notice:5] [2021-09-16 02:17:41.27 UTC] 1s
[hud-PS63:cardano.node.basicInfo.epochLengthMary:Notice:5] [2021-09-16 02:17:41.27 UTC] 432000
[hud-PS63:cardano.node.basicInfo.slotsPerKESPeriodMary:Notice:5] [2021-09-16 02:17:41.27 UTC] 129600
[hud-PS63:cardano.node.basicInfo.slotLengthAlonzo:Notice:5] [2021-09-16 02:17:41.27 UTC] 1s
[hud-PS63:cardano.node.basicInfo.epochLengthAlonzo:Notice:5] [2021-09-16 02:17:41.27 UTC] 432000
[hud-PS63:cardano.node.basicInfo.slotsPerKESPeriodAlonzo:Notice:5] [2021-09-16 02:17:41.27 UTC] 129600
[hud-PS63:cardano.node.addresses:Notice:5] [2021-09-16 02:17:41.27 UTC] [SocketInfo 0.0.0.0:3001]
[hud-PS63:cardano.node.diffusion-mode:Notice:5] [2021-09-16 02:17:41.27 UTC] InitiatorAndResponderDiffusionMode
[hud-PS63:cardano.node.dns-producers:Notice:5] [2021-09-16 02:17:41.27 UTC] [DnsSubscriptionTarget {dstDomain = "relays-new.cardano-mainnet.iohk.io", dstPort = 3001, dstValency = 2}]
[hud-PS63:cardano.node.ip-producers:Notice:5] [2021-09-16 02:17:41.27 UTC] IPSubscriptionTarget {ispIps = [], ispValency = 0}

Is there a log to check what happened during the interruption? where is this stored (following cabal build documentation)

Please check if there is enough disk space. Node.socket will be created only when the node is running

used about 117gb and 17 gb left. I reran, synced to >91% (database at 14 Gb), stopped the sync - checked andnode.socket= still in db folder, once I rerun cardano-node run ... node.socket= is gone.
is 17gb too little?

At this stage, it is normal that your node.socket does not yet exist because your launch has not passed the step IPSubscriptionTarget {ispIps = [], ispValency = 0}. It usually happens because your cardano-node has not been gracefully stopped.
If it continues from there after 30 min or so (assuming that you have a decent CPU with enough memory) it would be a sign of a hard shutdown. We sometimes have the impression that the program has frozen but it is because your cardano-node needs to scan and verify all the data again so it can take a while.
When you see a line like
Opened vol db

your node.socket will be here again.

Yes there has been some issues where my PC shuts down unexpectedly. But waiting for the node.socket to reappear just needs time!

Try exporting the CARDANO_NODE_SOCKET_PATH again. An exported variable will only remain alive while the user who issued the command is active in their session. You can add this also to a startup script in that user's space.


text:
How do I set up a smart contract?
I want to request a payment from a business via a smart contract, do I need to know how to code the contract myself?
I’d also appreciate some guidance on the following;

What do both parties need to ensure the contract works
Where are the details of the contract kept and displayed
Where would the payment then sit once received?

The smart contract is a small program that holds funds given to it and sends it to an address only when specified conditions occur.

Do I have to write the code.?

You can if you want. Else we will have published and verified Dapps which will provide all services that most people want. You can then use these readymade contracts. For example, you need an escrow service you go to a Cardano Escrow app and invite your business partner there and tell him to pay the escrow amount to your instance of a smart contract template. Once he pays it the program will now release the money only if there are the same inputs from both of you, either to return the money to your partner's wallet or pay you for the services you provided. The software will not let a single person to withdraw.

Where are the details of the contract kept and displayed?

The working part of the contract will live in the blockchain(node). People will interact (for example request for releasing a security deposit of a contract ) through a website/mobile app etc. The details of the contract will also be available on these sites or mobile apps.

Where would the payment then sit once received?

Each contract has its address where it can receive payment. Only if a specific condition is a meet that money held by contract comes out. When the conditions are satisfied the program will permit the transfer to a wallet satisfying the laid down condition.


text:
Can same UTXO be consumed multiple times in a same slot/block?
Lets imagine I have UTXO sitting with some Datum, for example storing information about some USDT balance, which I am currently selling to anyone (as in lecture 8 of iteration 2).
Can there be for example 100 buyers in the same slot/block who initiated transaction with UTXO's of their balances and my one and only UTXO holding USDT for sale as input? Would these 'actions' sit in a queue of sorts and be executed one after another, while deducing currency being sold on each iteration?
If not, can anyone think of a theoretical way of allowing multiple users to buy my USDT coin on the same block/slot?
If for example I would 'shard' my selling UTXO into 100 UTXO's holding only part of total balance, how could I match buyer UTXO's with multiple partial selling UTXO's in decentralized way? I don't know, some kind of router or something.
Thank you for the answers

Can same UTXO be consumed multiple times in a same slot/block?

No. Nor can it ever be consumed multiple times. That's what UTxO (Unspent Transaction Output) means, it hasn't been spent yet and can only be spent once.

If not, can anyone think of a theoretical way of allowing multiple users to buy my USDT coin on the same block/slot?

This is an ongoing conversation in the community.
It really depends on what behavior you want. "Shard"ing the UTxO (as you suggest) could be a valid approach, you just need some way to minimize the chance of collision. You could include some entropy in the off-chain code to choose UTxOs at random and that could help, but collisions are bound to happen occasionally--not the end of the world, but messy.
Something I mentioned here is having off-chain services that batch requests to buy USDT. This would enable all the purchases to occur in a single transaction like what Noah Jones mentions in their answer. This kinda adds centralization, but still requires the batcher to meet the smart contracts requirements, so it's a minimal risk. There isn't a risk of extractable value either in the USDT case AFAICT, but that is something to keep in mind as well.

Thanks for the answer. Batcher solution sounds nice, yet it kind of defeats the whole point of decentralization, unless its also decentralized service with transparent code sitting on the blockchain. Regarding random UTxO matching, if all of the buyer and seller UTxO's would be spent on the same block, half of them would fail (not even talking it wouldn't see each others state, which is kind of a must for more advanced solutions like AMM's)

Maybe it would be possible for off-chain Plutus script to block just before block is produced (like slot 18), and only then spending all of the UTxO's accumulated until that point, with only 1 unique seller UTXO?

"yet it kind of defeats the whole point of decentralization" maybe not. The batcher still has to follow rules set on the blockchain--the trust is still decentralized and they are incentivized to batch as many fulfillments as possible into their transaction. Even in the case you get DOSed (by a silly actor), it wouldn't ever drop below 1 txn/block (empty batches wouldn't spend the state UTxO). Also, theoretically, you could be your own batcher, so you don't have to rely on some service.

(We already rely on batchers on the chain, i.e. block producers batch transactions into the blocks)

Yep, it's pretty straightforward: The transaction will consume the 1 UTxO with your 5000 USDT and the 5000 UTxOs submitted by your buyers each purchasing 1 USDT. The output will then be 5000 UTxOs each containing 1 USDT to each of the buyers making a purchase. This all occurs within 1 transaction. In the UTxO model, one transaction can have many inputs and many outputs.


text:
Can a smartcontract access the state of its own address?
As the title says, is there a way for the smart contract to read all UTxOs on its own address and also verify that all UTxOs were used to determine token count on the address.
For example users send funds to the SC address, each in their own utxo as they don't interact with the script. When the total funds (all UTxOs combined) hit a specific amount, you are allowed to withdraw them.

is there a way for the smart contract to read all UTxOs on its own address

No. The transaction submitter can pick and choose which UTxOs to include in the transaction (which UTxOs will be visible to the script).
However, you can write the script in a way that requires a certain set of UTxOs be include in the redeeming transactions.
Hope that helps.

In the off-chain code, you probably want to use the Contract monad. In the on-chain code (validator), you can use TxInfo. So, for each TxOut given by txInfoOutputs you can use txOutValue to get the address, and on that value, you can run valueOf to get the number of Ada or whichever token you are trying to compare the value of. From that, just pop it into the validator and have it throw an error if it is beneath your specified value.
Ref

Thanks. Your answer made me realize that I have to rephrase my question. Please see my edit.

While building your transaction on the off-chain code, you can instruct it to consume all the utxos at a certain address (it can be your SC address).
Then in your smart contract on-chain, you can access these utxos from TxInfo of your Context.
From there you can access the value inside each of those utxos, do your math and act accordingly.


text:
Error Starting plutus-playground-client
I'm having error running the plutus-playground-client. Not sure where to look, here is the complete error log. Any suggestions on how to fix?

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/bin/node',
1 verbose cli   '/nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/bin/npm',
1 verbose cli   'run',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.10
3 info using node@v14.15.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle plutus-playground-client@1.0.0~prestart: plutus-playground-client@1.0.0
6 info lifecycle plutus-playground-client@1.0.0~start: plutus-playground-client@1.0.0
7 verbose lifecycle plutus-playground-client@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle plutus-playground-client@1.0.0~start: PATH: /nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/lib/node_modules/npm/node_module>9 verbose lifecycle plutus-playground-client@1.0.0~start: CWD: /mnt/c/blockchain/cardano/plutus/plutus-playground-client
10 silly lifecycle plutus-playground-client@1.0.0~start: Args: [
10 silly lifecycle   '-c',
10 silly lifecycle   'npm install && plutus-playground-generate-purs && npm run purs:compile && npm run webpack:server'
10 silly lifecycle ]
11 silly lifecycle plutus-playground-client@1.0.0~start: Returned: code: 2  signal: null
12 info lifecycle plutus-playground-client@1.0.0~start: Failed to exec start script
13 verbose stack Error: plutus-playground-client@1.0.0 start: `npm install && plutus-playground-generate-purs && npm run purs:compile && npm run webpack:se>13 verbose stack Exit status 2
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter. (/nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/lib/node_modules/npm/node_modules/npm-lifecycl>13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess. (/nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/lib/node_modules/npm/node_modules/npm-lifecycl>13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid plutus-playground-client@1.0.0
15 verbose cwd /mnt/c/blockchain/cardano/plutus/plutus-playground-client
16 verbose Linux 5.10.16.3-microsoft-standard-WSL2
17 verbose argv "/nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/bin/node" "/nix/store/gi44n1z2xslwsd417sigxsxgr6sxp9ff-nodejs-14.15.4/bin/npm" >18 verbose node v14.15.4
19 verbose npm  v6.14.10
20 error code ELIFECYCLE
21 error errno 2
22 error plutus-playground-client@1.0.0 start: `npm install && plutus-playground-generate-purs && npm run purs:compile && npm run webpack:server`
22 error Exit status 2
23 error Failed at the plutus-playground-client@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

did you find the fix for this? I'm also facing the same issue.

How are you running it? Can you add more details please?

are u on the correct git commit?
did you start the server first?
in the terminal, before entering to nix-shell do this to go to the correct git commit:
in the plutus-apps directory:

git checkout 41149926c108c71831cfe8d244c83b0ee4bf5c8a

then
3. At top of this repo

nix-build -A plutus-playground.server

Enter

nix-shell

only then start the server

cd plutus-playground-client

plutus-playground-server

Wait for server to start, it'll log "Interpreter ready"
5. In second terminal at top of this repo, enter

nix-shell
cd plutus-playground-client
npm run start
Wait for the client to start, it'll log "webpack compiled with …”

In web browser, navigate to url https://localhost:8009/ (need to accept that ssl certificate is invalid)

Welcome to Cardano SE! As a new user be sure to take the [Tour].

authors: Hášíl Páůďýál


text:
Are Smart Contracts bytecode encrypted?
As the title states, is a smart contract's live machine code encrypted, ciphered, or otherwise shielded? Say a user wants to create a SC to send whatever Ada it receives, at a specified interval, to another wallet (or more than one wallet proportionally). Could that be a workaround to preserve privacy with a published public address?

No, on-chain scripts are completely public and can be decoded easily to reveal the data stored inside the contract.


text:
Does Daedalus perform tasks beyond those of a wallet?
I didn't read the user agreement and just installed. Why does it use a full core 100% of the time?
Is it doing work for the health of the network, or any other type of work besides just being my wallet?

You're right. It's a cardano-node wallet's component, who is guilty for excessive CPU usage. There's nothing you can do about it. It consumes over 100% of CPU power, even though Daedalus wallet is a passive full node. With the release of a cardano-light-node utility, the situation will be dramatically changed for the better.
By the way, the Bitcoin Core full node app consumes approximately 25% of CPU power.

I got my numbers from Activity Monitor which I only quote when I need a program that approaches metrics with a white-hot spotlight, exacerbating their performance flaws. But I confirmed it in htop There really is a thread pegged at full load, while three or four other threads dance between not much and 60%.
Watch it in non-threaded mode and the CPU time used for the Wallet moves faster than a normal clock. I can't afford to flight the beta anymore.


text:
Advanced Payment Integration
I understand this is all new and still very early but I'm wondering if more advanced payment integration is possible. I went through the example of accepting payments, but I have an app releasing soon where I charge the customer through credit card only after my service takes place.
I'm able to place a hold on their credit card for x amount and then their order is sent to my server if there's enough funds.
After service is done, I replace the hold on their credit card with variables on what happened during the service(ex: An Uber driver driving 8 miles is going to charge the customer less than driving 20 miles).
Am I able to replicate this kind of flow with Cardano? I'm a holder and was hoping this flow was possible with the blockchain. Again, I understand this is still early but I would love to have Cardano integrated with my app if possible.
I'm bound by the rules that:

Crypto transactions cannot be changed once sent(See my post number 2, my app changing the credit card hold after service is complete )

If I refund their ADA because they aren't able to find a service provider, they'll incur fees from transferring so it isn't an option for them to send ADA first and then have the rest of the app run. My service has to complete before they make a transaction

Is this where smart contracts come in/is the only option? Thanks
Example from website:
https://developers.cardano.org/docs/integrate-cardano/listening-for-payments-cli/

my two cents, so if I am correct you want that a party can commit to paying and have the ability to cancel the service (and thus payment) without inflicting fee's. Possibly you also would want an expiration on the possible transaction. I think something like this is possible right now without any loss of control over funds. To understand the solution we will need some introduction to some technical insides of Cardano.
What is money on Cardano and how is represented account wise? Ada is best represented as cash. Where you might have a real wallet with a 10 and 5 dollar bill you might have a Cardano wallet containing 10 and 5 ada, each separate from each other. Each of these 'bills' we call an UTxO (unspent transaction output). For each transaction you combine bills into one big pot and redistribute them how you would like, the 10 + 5 bills might become 8 and 7 bills (minus fees which I omit). One property that UTxO's have is that they can only be spend once!
How are UTxO's spent? At its root UTxO's are locked by a signature, that is deduced from some seed phrase in a Cardano wallet. This means that to spend an UTxO the owner of it has to see how that money is spend and sign for it. Note that this can be done without settling the transaction indefinitely. This because a valid signature on a transaction does not mean that these two pieces of information are send to the blockchain. In theory one can calculate these signatures with pen and paper. Only when these two are send to a validating node that checks that the signature is correct it becomes immutable.
So what to do? For your app you let the counter party generate a transaction that pays you the amount for the service and sign it. Now neither one of you sends this to the blockchain for settlement. You hold on to it and while you are providing your service you constantly check whether the UTxO('s) in that transaction are not being spend, if so you need to regain a valid transaction with signature. If the service is provided and you want to cash your payment you send the initial transaction to the chain to become permanent. If for some reason you want to abort the payment, just trow away the signed transaction. This inflicts no costs. It is also advisable to set an expiration date on the transaction, to make the transaction invalid after some time.
Now note that discrete predetermined partial payments are also possible since the counter party can generate not 1 but many versions of the first transaction. They can give you the right to claim 10%, 20%,... 100% of the agreed funds once.
Hope this helps, looking forward to your app :)

There is NFT minting transactions where you send a certain amount and the other party decides what to send back. I would think this would be equivalent to gas station putting 100 hold till after gas pump the returns the remaining. Clunky but that's closest thing I can think of.

There's no way of saving the user from paying fees. What you could do, is to refund the full amount and the fee from your company's own pocket when refunding.


text:
Verifying Payment Address
Before funding the payment address on my staking pool, I would like to make sure that the funds can be retrieved by me, as the process of air gapping to create these series of keys and addresses introduces many opportunities for human error.
Would you please let me know if I can use cardano-cli or some other method to ensure the funds won't be lost once sending?
As a sanity-check, I sent a 1 ADA transaction back to my funding source to ensure things were okay. But I would still like a simpler way of checking that my keys are all in line.

To make a long story short, in Cardano's environment, you will need 2 sets of keys. One set to control your funds (send and receive $ADA and tokens) and one other set to control your staking activities (to participate in the protocol delegating your ADA to a stake pool or to earn rewards by operating your own stake pool).
These 2 set of keys will allow you to generate a payment address or a stake address or both meaning a payment address with "staking capacity".
As long as you keep these 2 sets of keys (payment keys and stake keys) in a safe and secured place, it's OK you will be able to have access to your funds.
It is recommended to generate these 2 sets of keys on an offline machine to minimize the risk of hack.
Generate your payment keys pair (payment.skey and payment.vkey):
cardano-cli address key-gen \
--verification-key-file payment.vkey \
--signing-key-file payment.skey

Generate your stake keys pair (stake.skey and stake.vkey):
cardano-cli stake-address key-gen \
--verification-key-file stake.vkey \
--signing-key-file stake.skey

Now for your stake pool, you will need a "payment address with stake capacity" so first we will generate a stake address and then a payment address that can delegate to the stake address.
Generate your stake address from the stake address verification key and store it in stake.addr
cardano-cli stake-address build \
--stake-verification-key-file stake.vkey \
--out-file stake.addr \
--mainnet

Finally, create this "payment address with stake capacity"
cardano-cli address build \
--payment-verification-key-file payment.vkey \
--stake-verification-key-file stake.vkey \
--out-file payment.addr \
--mainnet

That's it, now you can do whatever you want with these addresses as long as you keep your 2 sets of keys safe just for you... (especially the payment keys)
However, if you are too stressed, you can send 1 ADA to this address and then send it back with a simple transaction to make sure you have mastered the process.
You can follow this tutorial to understand how to forge and sign a simple transaction by following the instructions in this official video.
Good luck.

I actually made a typo and worried that i overwrote a private key for the payment address, after I had already staked everything. Some times human error is all it takes, fortunately there are snapshots.

This was a very good explanation, thank you!

If you overwrote by mistake your private key, well... you shouldn't have done it. It is impossible for the signing key (payment.skey) to be deduced, extracted or reverse engineered from the payment.addr. it's a kind of mathematical function that only goes in a single direction.  Just make sure that pairing between the payment address and its corresponding payment key is strict.


text:
What's the point of the "Wallet public key"?
Daedalus wallet > More settings > Public key
produces an acct_XXXXXXXXXXXXXXXXXXXX string.
What can be done with this? What is it useful for?

The public key is used to derive a Cardano wallet address, a wallet address is basically the hash string value that you share with other users to provide them a way to send ADA or other assets in the Cardano blockchain into your wallet. It can also be considered your bank account number. Knowing this someone will be able to send funds to you but not take the fund out of your wallet.
To take funds out of the wallet, a private key will be required. More details are given here


text:
Getting the address of a parameterized contract from within the validator of another script
Suppose I have one contract, Contract 1, that is parameterized by type
Contract1Params{
   tokenName :: BuiltinByteString
}

and I have a minting policy that will only mint a token with tokenName tn to the address of Contract 1 parameterized by c1p where tokenName c1p is tn.
So I need to get the address of parameterized contract from the token name of the token that is attempting to be minted from within the minting policy. Not sure how to do this with on chain code. Any ideas?

Your minting policy should have a parameter related to the address of the contract.
mkPolicy :: Address -> () -> ScriptContext -> Bool

In your off chain code, you send that parameter to your minting policy with something like this:
let val = Value.singleton (mySymbol $ scrAddress cp1) tn 1

Where:

mySymbol is the CurrencySymbol of your minting policy
scrAddress is the Address of your validator script
cp1 is the Parameter of your validator script


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

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

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

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


text:
Individual pledge amount in Stake Pool with multiple pool owners
I have some questions about creating a Cardano Staking Pool with multiple owners.
Context:

Owner 1. Wants to pledge 200,000 ADA.
Owner 2. Wants to pledge 120,000 ADA.
Owner 3. Wants to pledge 80,000 ADA.

As the documentation states (https://github.com/input-output-hk/cardano-node/blob/master/doc/stake-pool-operations/register_stakepool.md), you can provide more than one owner key if there were multiple owners who share the pledge.
So when running the command cardano-cli stake-pool registration-certificate, I specify --pool-pledge 400000000000 for 400K ADA, and including the --pool-owner-stake-verification-key-file stake.vkey (Stake Verification Key) for every owner (3 times).
Now, here is where it breaks down. The documentation says that I need to generate a delegation certificate pr. owner, but does not say anyhing about the amount to pledge from each owner.
is there something I'm missing here?
Is the pledge automatically delegated when submitting the certificate?
Does the owner have to manually delegate the amount to pledge from his/here own wallet that we derived the stake.vkey from?
Anyone know how to manage this?

The pool registration certificate only declares who the owners are and what the total pledge is required to be met. The individual pledge owners must register and delegate their stake key just like any other user from their wallet listed as an owner. If the pledge is not met, pool and all delegators get zero rewards. When pledge is met, all owner rewards are assigned to pool rewards stake address. It also very crucial to at least register the pool rewards stake address otherwise all fees and owner rewards will be sent to treasury instead of the pool's rewards address!


text:
Calculate a policy locking
How can I calculate when the policy is going to be locked? I have the policy script file and I need to specify the before slot but I don't know how to calculate it.
For example, I want the policy to be locked in 6 months.

Given the slot lenght is one second, this is pretty easy.

Find the current slot number.

$ curl -s  -H "project_id: $BLOCKFROST_PROJECT_ID" https://cardano-mainnet.blockfrost.io/api/v0/blocks/latest | jq .slot
40664369

Add 6 months to it (roughly)

$ expr 40664369 + $((60*60*24*30*6))
56216369


text:
Is the Payment Adresss and associated keys considered a wallet?
When staking to the payment address is one effectively sending ADA to another wallet?
I think this is an interesting question because one asks if it could then be added to a wallet application like Daedalus, or something else..

A wallet consists of two sets of keys {private and public} and the addresses derived from them. There are different types of addresses like Payment address and staking address. Payment addresses can be used for receiving payment through transactions that require fees. The reward address of a wallet can not be used for receiving payment.
Overall we can say the public and private keys are the core components of a wallet.
Staking does not involve sending any ADA out of wallet.

Sure sounds like a wallet.

If you want to understand how payment address, public pvt keys etc you can read this chapter
https://docs.armada-alliance.com/ai-blockchain-edu/wallets


text:
zsh: command not found: cardano-cli
Following this guide https://developers.cardano.org/docs/get-started/installing-cardano-node/#macos for Mac OS X. Have completed all steps as per guide. However, I am getting 'zsh: command not found: cardano-cli'.
cardano-cli and cardano-node are clearly in /~.local/bin as you can see below.
ls -l ~/.local/bin
total 160128
-rwxr-xr-x  1 dylankumar  staff  36328576 18 Sep 11:48 cardano-cli
-rwxr-xr-x  1 dylankumar  staff  45651344 18 Sep 11:48 cardano-node

and ~/.local/bin is in path
echo $PATH
~/.local/bin/:/Users/dylankumar/.cabal/bin:/Users/dylankumar/.ghcup/bin:~/.local/bin/:~/.local/bin/:/Users/dylankumar/.cabal/bin:/Users/dylankumar/.ghcup/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin

So I don't know why it's not working. I have have also restarted my computer, but am still getting:
# cardano-cli --version
cardano-node --version
zsh: command not found: cardano-cli
zsh: command not found: cardano-node

Any advice would be greatly appreciated!
EDIT:
Added path+=~/.local/bin/. to the bottom of my ~/.zshrc file, and now working.

You can add the two files directly to the path. For zsh this can be configured in the ~/.zshrc file.
Instructions: https://stackoverflow.com/a/11530176/10069673

Sweet, thanks, that worked. Added path+=~/.local/bin/. to bottom of my ~/.zshrc file.

Read my medium story to find out how to configure .zshrc file in macOS.


text:
Specify balance during wallet creation in PAB simulator
Using the PAB Simulator from the plutus-starter (version 1.0.9, commit: a85818c27926f34d627225636f463cc6698706fc), I'm getting some odd behavior in terms of wallet creation.
I've created a simple contract (GiftContract) and use a shell script to create four wallets. I have not changed the main function within the pab/Main.hs.
Yet, I am getting this output after shutting down the PAB via hitting return.
[INFO]     {, ""}: 59999999960
[INFO] Wallet 36cb1d44654c33ed6b26cbe2da0848de2ebfdb20010679a06c5f609c474f349b8003380446e9159a34504f9fd19da3e93f215efa30cae9455d441be0eac8db66291a5a5e8c961f9da5fb8cb616ab630a6600f4a44acd520fa701b330849e4446d7d1711ac606ae93a2b3d457dd7f4f36b3af92dd0de82a7caf471fb5ed2b5ea3:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 3e983a2291ed95a079bfbbf1c447180c90241c6eb288ca1d7fa9f3a4f1f4879e1d5b3a2dcc7f6a4207c71987e38a66172d5111c8ef874408f786cafba51a74fc2b68037bbb9a4507f9268eea9fc89e8035fa867020d74f16bc9dc65cc8bd876798585d84f5bd641ec9fa6e44be139edbbab1d6fefb42a303415903e79fe19738:
[INFO]     {, ""}: 10000000000
[INFO] Wallet 562f269ac4ce35c9be75343cb9d76b3149d1ea5a509299204de6b61dfec1908ec7a4aeed5057be46ff9881d276f9b4050acf9fbc68b61708e33f64db34f479bddd497ff6d3a59aadc10782de888dc139213f444fe7af7b469cab15d50e1cb6d58fba680762c1963f345178e1a7daf62c2eac026b62ceba08c1c5020326d75c20:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 7628f55f34ca6d864c05aae491e67a5cc0998c4e9461d716fa728fefa837058e3adcc42d910d0404fbddaa157f4d0869f2863faf6cc706eae8eafd204af69a33bd3f819a795f4f7388759a4355436e7bddebbdc14a903df8e4ee733d98616cade35c741d39593e68ea7e331bb145f032cf704ed6d1324d9647ecc1aaaee4f7e8:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 76d5e1291d51f16eb442267faccd0ab51a3b0c4a21eb6b8f72d5f0a4ca467189ac5f70a018c6df3f632b48fd8ead1b68f39a44de06f5a5de42a6a131af0f085d44becd56fa30041efea5ff2637205181837dffd03545d3db1c11e6dcbbd3415ce8f85aad41776b99eb62a797b8c5abbe82061e1634efc4c7d5ac6fff3ca94d7f:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 7e203f38109d82c064e95ff2008d84cf6f5c95ec5dbea86d24f407011f65e3868232a16b2bdab56ccff3ab77e24b6a5c88291dd6519b32943fe85ec52c7e6ffe4ab780e3653ceefb79a9e697805ccd430501b09b9a932def195173d96c91013c8b2e8b948109b07a0cae8725f7a8b2b4a892954971891425b4ef3b2eec05f9a1:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 86c4c1d06a6cd0480865a836fafd97daeba7c79bdc043dff34f9d4553c026e831a4a36760c1d8a0a5458efcb33394ce936b139549570e0f2e80739d50abb6402fcd5201fc11e20cdba72c7440a5e406d314cd1f63fa1d87c83881e0dc1fe3ac5bf6f6a576cf7c56f8d46926bcd24b7de630455a7df7cebb0afadce72d1ede55c:
[INFO]     {, ""}: 100000000000
[INFO] Wallet 86c6ea24ce790fd9e422a3d22fa6cbc4cf72802675f40b8e2783b4cf38bd4a89a20ee5f32e19499768d274044f825d7251d2bf05c0ce85bfd183127b87376acf115f3ee432684888a2a7b059ba6bffedded97918daf53582e3790082d62856450d8e0efdd7e7b81bcba6c333bb10af271637a9c781d8788db7dc8a8a30763b7e:
[INFO]     {, ""}: 10000000000
[INFO] Wallet b6d40a76f3fd73233a7e0c52a1bb99174151b3643f462016b8b39f776acd4081429729fd15129139332ede3e94ac805090d6e80b78e187ea85c29012c7b4f4b6e9929aa98f85a5d3173cfc128f4198c437ee3484f676ae741412698a00603111c2b887a0b36c23620aca53026dddc27a4c078aec919e739e2b81bb2f729c5943:
[INFO]     {, ""}: 100000000000
[INFO] Wallet c6794804ca7d19368487af2aa7324296b34274cc69137d1c6187b18a2cb2ce873cb2519aee42967cb4e9661fb3cd106dd68158f16bdfc9b4da04046d06c9d5accaafea24be9b96b417e47d713c3481db821bce2dab3d4bee156d4ef80b249310f227a7eaefdc7a311ea4c93437610d16b02119e4300778573d96107e829035d7:
[INFO]     {, ""}: 10000000000
[INFO] Wallet ce5bf0869d6720212e4dcf3ea6992cf4a9b88c39261fd9d6a635f046a17da49b6125ba6748c542e5821ec9d1e9d2f0564bc7572c1ec0e1a82cce88951dec70639e228ed6586bd2946247d66f88fac7e266a9cf37ab49ef1b9b17befd34a3db085e5af768f7297f0e1138220378a2d13c470da5a79639d8313911adeb0436d91e:
[INFO]     {, ""}: 100000000000
[INFO] Wallet e6778caeed9911d9b0b49f4fd026052395b6b7025b016052c7ca937e8f332e82338bbe4abdb5d91b348b8361c04117e538f8e6c98f716354837ec822b970419f61636d94a191bc8efbe1e7b53ef59d7b77c67adeb5a3f11fe754ee5ce407045f0da5b9850ac337f62d3bacbbd5ec336736dcb26dcebdea6fb5620b3e4837d177:
[INFO]     {, ""}: 100000000000
[INFO] Wallet e6a9e1d3c75218fe4658682642498ddc2de21d4c852985d86aa574642e4aa98332ee626af31520ec3a6425bfb19492f04bdf09e0a1c9d17c32712870f4649acc8c6ef7b2d2ac09cfbdf8b9894393f8cfd6375a9380864d7003dd52c022e81b449459eccd92f62fb1797abf4dd421772635497fd195a4fd0263a4f1c0d4f64f3c:
[INFO]     {, ""}: 10000000000

As you can see, we have our 10 regular wallets with a balance of 100,000,000,000 lovelaces each. Yet, there is also three wallets with a balance of 10,000,000,000 lovelaces each and a wallet of 59,999,999,960 lovelaces. The sum of those last wallets minus 4 * 10 lovelaces fee (for creation?) would add up to 100,000,000,000 lovelaces (the value of one default simulator wallet), but it is not intuitive nor did I find any documentation on this behavior.
I have followed the repo's readme to create the wallets and activate the contracts in this manner:
#1/bin/sh
export W1=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`
export W2=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`
export W3=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`
export W4=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`

export W1_IID=$(curl -s -H "Content-Type: application/json" -X POST -d '{"caID": "GiftContract", "caWallet":{"getWalletId": '$W1'}}' http://localhost:9080/api/contract/activate | jq .unContractInstanceId | tr -d '"')
export W2_IID=$(curl -s -H "Content-Type: application/json" -X POST -d '{"caID": "GiftContract", "caWallet":{"getWalletId": '$W2'}}' http://localhost:9080/api/contract/activate | jq .unContractInstanceId | tr -d '"')
export W3_IID=$(curl -s -H "Content-Type: application/json" -X POST -d '{"caID": "GiftContract", "caWallet":{"getWalletId": '$W3'}}' http://localhost:9080/api/contract/activate | jq .unContractInstanceId | tr -d '"')
export W4_IID=$(curl -s -H "Content-Type: application/json" -X POST -d '{"caID": "GiftContract", "caWallet":{"getWalletId": '$W4'}}' http://localhost:9080/api/contract/activate | jq .unContractInstanceId | tr -d '"')

To make things more explainable, is there a way for me to disable the automatic creation of the 10 wallets and instead pass how many lovelaces I want the manually created wallets to start with?


text:
Prefund wallets for PAB
How does one prefund wallets for PAB (Plutus Application Backend)?
I do not want to introduce minting code just for this purpose.


text:
Right way to get the Wallet ID when creating?
Having trouble with with the plutus-starter template. The following return null after starting the pab:
export WALLET_ID_1=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`
export WALLET_ID_2=`curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'`

However; if I remove the | jq '.wiWallet.getWalletID' I do get the json returned from create.
Any ideas?

Refreshed from starter repo and it is now working

Version 1.0.9 introduced a new way of creating (and activating wallets). Your code snippet shows the way how to create wallets with version 1.0.9.
Previously, you would not rely on manually creating wallets, but instead just pass a number into the activate endpoint for the respective contract:
curl -s -H "Content-Type: application/json" \
  --request POST \
  --data '{"caID": "GameContract", "caWallet":{"getWallet": 1}}' \
  http://localhost:9080/api/contract/activate | jq

In version 1.0.9, you use the getWalletID from your requests to the wallet create endpoint to activate the given contract (e.g. GameContract that is shipped with the plutus-starter):
curl -s -H "Content-Type: application/json" \
  --request POST \
  --data '{"caID": "GameContract", "caWallet":{"getWalletId": '$WALLET_ID_1'}}' \
  http://localhost:9080/api/contract/activate | jq

Looking at the plutus repo, it appears that the Wallet API has gone through some significant changes. Could it be that your JSON Object did not have the wiWallet.getWalletID but wiWallet.getWallet key? If that's the case, then the jq tool would grab a non-existent key from the JSON object, thus returning null. This would happen if you still have an older plutus version installed while trying to follow the directions that apply to the newer API.
The reason I'm suggesting this as a possibility is this commit: https://github.com/input-output-hk/plutus/commit/58c8b4bde7177a18cd6761ba328bc105e5c82a47#diff-c00cadb75428bc7238834d185e1e7e63dde8e3d1313b34e6a046f623abb78322
Solution: Update your local plutus library so it matches the docs.

Can you post the exact error code that spits out? By the way, for my docker container I had to change:

export WALLET_ID_1=curl -s -d '' http://localhost:9080/wallet/create | jq '.wiWallet.getWalletId'

to

export WALLET_ID_1=curl -s -d '' http://172.17.0.2:9080/wallet/create | jq '.wiWallet.getWalletId'

If you go to your command prompt, get your container ID through "docker ps". Then run "docker inspect CONTAINERID" (replace CONTAINERID with yours). Then scroll to the bottom to get your host IP for your container. Mine was 172.17.0.2, yours might be different. I don't know if this has any impact to you, but I needed to do this to get mine to work.

The issue that you are having is a networking / bridging issue related to docker. This is not specific to plutus.


text:
Plutus Pioneer Program Week01 : Installing plutus - Unable to start server if syncing plutus with plutus-pioneer-program version
In the plutus-pioneer-program/code/week01 folder, I got the tag as tag: ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4
The git log tag for plutus was 9879b31579d0deb863f3cdf27f93419deec3b4bb
So I used git checkout ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 on the plutus repository.
If I try starting the server, it does not start, giving this error after trying for a long time.
[nix-shell:~/plutus/git/plutus/plutus-playground-client]$ plutus-playground-server
plutus-playground-server: for development use only
warning: unable to download 'https://github.com/input-output-hk/hackage.nix/archive/6dba3997f6a39d51fe814d312b1a4b52838a8055.tar.gz': HTTP error 200 (curl error: Timeout was reached); retrying in 347 ms

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
error: program 'tar' failed with exit code 2
(use '--show-trace' to show detailed location information)

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
error: program 'tar' failed with exit code 2
(use '--show-trace' to show detailed location information)

Here is what I have done to try setup my environment.

I am on Win10.  I have git installed.

I chose to use the vagrant based setup.

Downloaded and installed Vagrant and VirtualBox (6.1). Rebooted.

Cloned the vagrant repository, git clone https://github.com/edwint88/plutus-vm plutus-vm

Using git bash, did vagrant up.  It reads Vagrantfile, tries to find the VM, which is not there, so downloads the VM from internet, Ubuntu website. VM has been downloaded on the Windows machine

ssh into the vm using vagrant ssh

Update plutus using
cd /home/vagrant/plutus/git/plutus
git pull
update /bin/bash ../updatePlutus.sh

It updated the plutus repository and git log gives me head as
9879b31579d0deb863f3cdf27f93419deec3b4bb

Run nix-shell
cd to week01 folder
Then did
cabal update
cabal build

Checked tag in cabal.project file.  It had tag as ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4 (this is same as in Video1 of Plutus Pioneer Program - Lecture #1 in both cohorts.

As the tag is not same as plutus's it means we need to get an older version of plutus

Went to plutus dir and git checkout ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4
Verified that git log now shows this tag.

Tried to start the server
cd plutus-playground-client
plutus-playground-server

It is giving the error shown.
Note, earlier when I did not understand I had to update the plutus repo to match, I had tried starting the server, and it came up successfully.

unable to download - this error indicates that there might be an issue with the Internet connection and the tar is broken. Kindly check it again.

Quite possibly.  As now, when I am trying to do nix-shell, it is failing to untar this same tar  file (as it must have got partially downloaded last time).  How to retrigger the redownload this file.

I tried  /bin/bash ../updatePlutus.sh.  Still it is giving same error.  unpacking 'https://github.com/input-output-hk/hackage.nix/archive/6dba3997f6a39d51fe814d312b1a4b52838a8055.tar.gz'...
gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
error: program 'tar' failed with exit code 2
(use '--show-trace' to show detailed location information)

I finally did the entire installation again,  Cleaned up the vagrant VM and redid the steps. Able to compile EnglishAuction.hs in the playground!  Thanks for the help.

Please post the steps as answer. It will help other.


text:
LedgerFailure - Trying to sync to testnet
I am getting an error when trying to sync to testnet with 1.29.0 and using the genesis files from https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/index.html
I have deleted my db several times and tried 1.29.1: Same error and same spot (I think).
error:
[ip-172-3:cardano.node.ChainDB:Error:34] [2021-09-19 09:06:40.67 UTC] Invalid block 7828c58252b1eb59487fc363d88771b6e08fa52841f39e54bf39b5322e45efd4 at slot 36812798: ExtValidationErrorLedger (HardForkLedgerErrorFromEra S (S (S (S (Z (WrapLedgerErr {unwrapLedgerErr = BBodyError (BlockTransitionError [ShelleyInAlonzoPredFail (LedgersFailure (LedgerFailure (UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (UtxosFailure (ValidationTagMismatch (IsValid True) (FailedUnexpectedly [PlutusFailure "\nThe 3 arg plutus script (PlutusScript ScriptHash \"9e7068208dae0dc0aea9e1b17e40ad3a606dead9bfbe4f1dadded7a6\") fails.\nCekError An error has occurred:  User error:\nThe provided Plutus code called 'error'.\nThe data is: List []\nThe redeemer is: List []\nThe context is:\nPurpose: Spending (TxOutRef {txOutRefId = 08629328abe7bf6d6da80d7e8e717be9546be831aee4ce0c13506afa82fb83c8, txOutRefIdx = 1})\nTxInfo:\n  TxId: 94ac30c3c1887333de9e278975e5a1a4f8179473634ce07e185f75137bb405f1\n  Inputs: [ 08629328abe7bf6d6da80d7e8e717be9546be831aee4ce0c13506afa82fb83c8!0 -> - Value (Map [(,Map [(\"\",973242561)])]) addressed to\n                                                                                addressed to PubKeyCredential: ba0971f1837884f35ef6b4a4556034c5db0c1af7ddaa46412f718b18 (no staking credential)\n          , 08629328abe7bf6d6da80d7e8e717be9546be831aee4ce0c13506afa82fb83c8!1 -> - Value (Map [(,Map [(\"\",1930992)]),(4f99b1003eddbd87f229f4ca35723753eb9b941efda6c82f3fc10bfe,Map [(\"LobsterNFT\",1)]),(fda1b6b487bee2e7f64ecf24d24b1224342484c0195ee1b7b943db50,Map [(\"LobsterCounter\",43)])]) addressed to\n                                                                                addressed to ScriptCredential: 9e7068208dae0dc0aea9e1b17e40ad3a606dead9bfbe4f1dadded7a6 (no staking credential) ]\n  Outputs: [ - Value (Map [(,Map [(\"\",972266644)])]) addressed to\n               addressed to PubKeyCredential: ba0971f1837884f35ef6b4a4556034c5db0c1af7ddaa46412f718b18 (no staking credential)\n           , - Value (Map [(,Map [(\"\",2068920)]),(4f99b1003eddbd87f229f4ca35723753eb9b941efda6c82f3fc10bfe,Map [(\"LobsterNFT\",1)]),(fda1b6b487bee2e7f64ecf24d24b1224342484c0195ee1b7b943db50,Map [(\"LobsterCounter\",44),(\"LobsterFinished\",1)])]) addressed to\n               addressed to ScriptCredential: 9e7068208dae0dc0aea9e1b17e40ad3a606dead9bfbe4f1dadded7a6 (no staking credential) ]\n  Fee: Value (Map [(,Map [(\"\",837989)])])\n  Value minted: Value (Map [(fda1b6b487bee2e7f64ecf24d24b1224342484c0195ee1b7b943db50,Map [(\"LobsterCounter\",1),(\"LobsterFinished\",1)])])\n

The command I am running is:
cardano-node run
--topology testnet-topology.json
--database-path db
--socket-path db/node.socket
--host-addr 127.0.0.1
--port 3001
--config testnet-config.json
I built from src following directions here: https://developers.cardano.org/docs/get-started/installing-cardano-node
Only change was checking out 1.29.0 instead of 1.27.0
.. output of cardano-node --version:
cardano-node 1.29.1 - linux-x86_64 - ghc-8.10
git rev 8617cc395b9493d9b5fa05bebc8644a7384c103e

Please update with the process you had followed till you got this error.

I reverted cardano-node back to 1.29.0 and issue resolved itself.


text:
Plutus-starter - cannot start contract instance
I am following the link below. I've successfully built the docker image (literally had to upgrade to 32 GB of RAM, it used 15 GB at peak RAM usage during cabal build). I have the PAB server running successfully and was able to create the two wallets as defined in the tutorial.
When I try to run Section 2: Start the instances:

curl -s -H "Content-Type: application/json" \   --request POST \
--data '{"caID": "GameContract", "caWallet":{"getWalletId": '$WALLET_ID_1'}}' \   http://localhost:9080/api/contract/activate | jq

I get the error code:

parse error: Invalid numeric literal at line 1, column 6

I am new to using jq - I cannot figure out which tag corresponds to "column 6". Can anyone help me out? Am I supposed to change some ' to "? Or do I need to replace $WALLET_ID_1 with the wallet pub key hash? I've tried both with no success.
https://github.com/input-output-hk/plutus-starter
Thanks,

My Plutus build has an old version of the Wallet package (see https://cardano.stackexchange.com/a/3844/3951). I could get the contract instance ID by running:

curl -s -H "Content-Type: application/json" \ --request POST
--data '{"caID": "GameContract", "caWallet":{"getWallet": 1}}' \ http://localhost:9080/api/contract/activate | jq


text:
Is a Ledger Live Native ADA App with Staking and Voting Functionality in Development?
Is a Ledger Live native ADA app with staking and voting functionality in development? If so is there any place to check periodically for road map updates?
I believe IOG has a team that works with exchanges and I'm guessing a Ledger team as well, but I'm not sure who/where to follow for updates.
Thanks for your support!
-CPG

As far as I know, there is no development on these functionality from the Ledger team.


text:
In experience, what distro of Linux is ideal for SPO
I'm at a point where I'll be running an SPO. I am curious from the current SPOs what version of Linux do they recommend. I've practiced setting up a pool on ubuntu and mint.

Ubuntu is the most widely used OS. However, any Linux distribution should be fine. Windows is best avoided.

This is too subjective to be on topic in my opinion. IOHK offers a wide range of support, seemingly equal (for Linux).

The installation of Cardano nodes is done by compiling the source codes, so any Linux distribution can host your node. However, the majority of the "SPO" community is primarily experimenting with Ubuntu LTS (documentation, how-to, Q&A etc.) in the official forum. So if you're new to exploring the Cardano ecosystem, you might want to you start with the Ubuntu distrib in order to benefit from existing feedbacks.
Moreover, if you want an excellent step-by-step tutorial to set up your pool, I recommend the guide "How to build a Cardano Stake Pool" from CoinCashew.
Good luck!


text:
Test for logError in Trace monad
How do I write a Tasty unit-test for an error that may be logged from inside the Trace monad?
import Control.Monad.Freer.Extras (logError, throwError)

trace1 :: Input -> Trace.EmulatorTrace ()
trace1 x =
    case fromInput x of
        Left e ->
            logError @String $ unpack e -- ###########

        Right d -> do
            h1 <- Trace.activateContractWallet (Wallet 1) endpoints
            -- ...


text:
Cardano Wallet setup - No such directory
Hi am trying to setup cardano-wallet locally through wsl2 via this guide https://developers.cardano.org/docs/get-started/installing-cardano-wallet/
On the step where it asks to enter this command cp -p "dist-newstyle/build/x86_64-linux/ghc-8.10.4/cardano-wallet-2021.5.26/x/cardano-wallet/build/cardano-wallet/cardano-wallet" ~/.local/bin/  I get an error stating the file directory cannot be found. cabal build all leaves me with two cardano wallet folders that i think maybe in need to point to

dist-newstyle/build/x86_64-linux/ghc-8.10.4/cardano-wallet-launcher-2021.9.9
dist-newstyle/build/x86_64-linux/ghc-8.10.4/cardano-wallet-core-2021.9.9

Is the specified directory somewhere in there? there is no x/cardano-wallet/build/cardano-wallet/cardano-wallet to be seen :(
Note: I did configure cabal with cabal configure --with-compiler=ghc-8.10.4" instead of cabal configure --with-compiler=ghc-8.10.4 --constraint="random<1.2" as the prior was not letting me sucessfully build.
Any help would be greatly appreciated.

Hmm, seems very unexpected. But yes, pay attention to the version number changes and adjust accordingly. Anyway, what does this command reveal, if anything? find ~/ -name cardano-wallet

Autocorrect capitalized Cardano, if you were searching for that... try again plz.

@LouisWaweru a few different paths which look promising. But all under ghc 8.10.7. /home/isaac/cardano-src/cardano-wallet
/home/isaac/cardano-src/cardano-wallet/dist-newstyle/build/x86_64-linux/ghc-8.10.7/cardano-wallet-2021.9.9/x/cardano-wallet
/home/isaac/cardano-src/cardano-wallet/dist-newstyle/build/x86_64-linux/ghc-8.10.7/cardano-wallet-2021.9.9/x/cardano-wallet/build/cardano-wallet
/home/isaac/cardano-src/cardano-wallet/dist-newstyle/build/x86_64-linux/ghc-8.10.7/cardano-wallet-2021.9.9/x/cardano-wallet/build/cardano-wallet/cardano-wallet

@LouisWaweru also definitely on the right branch v2021-09-09

Honestly, I’m not even going to try to look at this on my phone

Hahhaha fair. pretty much theyre in the folder ghc-8.10.7 not ghc-8.10.4 for some reason

I can't see a reason not to use ghc-8.10.7 so I'll give it a try with the latest wallet tag, and propose updating the docs... It's not a major nor a minor version change, so what harm can it do?

Working Backwards
Major edit: There is a reason the docs are explicit about ghc-8.10.4. I just hit this weird error that went away after downgrading from 8.10.7:
$ cabal build all
cabal: Cannot find the program 'ghc'. User-specified path 'ghc-8.10.5' does
not refer to an executable and the program is not on the system path.

Edit: I think you actually did what you were supposed to do and checked out the latest tag (at the time of writing): https://github.com/input-output-hk/cardano-wallet/tree/v2021-09-09
Yeah, like I was saying, the guides don't always keep up with versions and dependencies. I'm sure the wallet built with ghc-8.10.7 is completely fine, and worth testing out to let the GitHub maintainers know to update their docs.
Solution for You
However, they are probably very well aware of this, and so if must, you can always switch to 8.10.4:
ghcup install ghc 8.10.4
ghcup set ghc 8.10.4

You can start again from:
cabal configure --with-compiler=ghc-8.10.4
(Or even the next line).
Now, their guide should match up as they intended. However, I'd still ask about using 8.10.7... and maybe updating the guide depending on the answer.
If you need to reclaim space, you can remove some stuff:
ghcup rm ghc 8.10.7
du -hs ~/.cabal
rm -rf ./cabal

I would just replace with 2021.5.26 with 2021.9.9, andw= when all is done, run cardano-wallet version to see that you are in fact on the latest build.
$ cp -d "dist-newstyle/build/x86_64-linux/ghc-8.10.4/cardano-wallet-2021.9.9/x/cardano-wallet/build/cardano-wallet/cardano-wallet" ~/.local/bin/
$ cardano-wallet version
v2021-09-09 (git revision: 011a258c1b5ba57ca70f13346109ce3074820032)


text:
What is the recommended way of implementing an NFT sale?
I'm pretty new to crypto development (I've been a professional software engineer for 5+ years now) and would like to get into NFT development using Cardano.
Currently, I'd like to start a collab with a very talented artist to launch an NFT. The end goal would be a dedicated website where NFTs are sold in batches, whereas the price steadily increases (similar to how the SpaceBudz sale worked).
This seems like a very good project for learning, as I'm more the "learning by doing" kind of person.
I've made my way through all the Cardano Docs, watched a lot of videos, listened to a few podcasts and read even more blog posts, but I'm still very confused about what's the recommended way of implementing such a thing.
Should/can I:

Use Plutus
Use Marlowe (not sure if that's even possible)
Host a Node and interact with it using the CLI/a JS wrapper around it (https://spacebudz.medium.com/how-we-pulled-off-the-sale-9dbe54c30ba5)
Use an API like https://blockfrost.io/

If using Plutus, I'd probably need to learn Haskell, which would certainly slow things down.
Which route would you take and why?

Well it depends.
We finally have smart contracts available so I'd say you go that route if you have some time to commit to learning Plutus.
Or, if you're looking to move fast and get those NFT's out on the 'market' you can go with the approach like SpaceBudz did it.
If you're going with the second approach, here's the URL to the repository:
https://github.com/Berry-Pool/nft-server
It's the implementation for their NFT server, you just need to change few things around, create website, artwork and mint the NFT's.
Good Luck!

Yea, I think I will probably take the "centralized" route for now and implement it using Node.js/re-using the code of Berry-Pool. Next time, I'll do a deep dive into Plutus which I'm really looking forward to. Thanks a lot!

Fastest is to use nmkr.io they provide APIs and minting and everything you can imagine you’d need!


text:
How does eUTXO model makes it possible to mint NFTs without smart contracts?
I am watching a video by Coin Bureau and he mentioned that Cardano's eUTXO model makes it possible to mint NFTs without smart contracts.
Unfortunately he does not fully explain how so.
Any one care to explain, or can point to a resource that explains how the eUTXO model makes it possible to mint NFTs on Cardano without smart contracts?

Please refer to the answers to this question. https://cardano.stackexchange.com/questions/5/how-are-nfts-being-minted-without-smart-contract-in-cardano. In Cardano the native token (NFT is a subset of native token and is non-fungible). They are treated at par with ADA in almost all settings.

Native tokens and NFTs were introduced with the Mary Hard Fork somewhere in March.
This could be a good start https://developers.cardano.org/docs/native-tokens/

in addition to the link given above, which is great - I followed those instructions myself to mint tokens & NFTs - you can also check out the youtube that you can find here -> https://developers.cardano.org/docs/get-started/technical-concepts/#unspent-transaction-output-utxo


text:
Can a smart contract read the presence of an NFT in the redeemers wallet?
I want to use an NFT as a form of authentication for a Plutus contract.
I know I can attach the NFT in the Datum when constructing the transaction and return the NFT in the output however I am worried this will "lock" the NFT such that the user can only submit a single transaction.
My use case is an invite mechanism that only holders of a specific NFT are able to execute, this endpoint will generate a UTXO that is used as a required input into the actual signup endpoint.

So based on this example, can the invite endpoint read the presence of the AM NFT in the redeemers wallet without it being sent into the transaction?

Note I am new to a lot of this so feel free to tell me I have got this wrong.

I'd check out using mustSpendPubKeyOutput in your off-chain transaction constraints.
To answer your question directly:

Can a smart contract read the presence of an NFT in the redeemers wallet?

No. A validator script will only validate what's included in a transaction.
But you can include your NFT in the transaction without "lock"ing it. You will want to spend it in the redeeming transaction and return it to the redeemers wallet.
For the transaction to succeed, the validator will  check the UTxOs included in the ScriptContext and if the NFT is included among the values, it will say "yes". The off-chain code could be designed in whatever way that includes the NFT in the transaction, but it sounds like you want to ensure it is returned to the transaction builder's wallet (I'm pretty sure that will be the default behavior if you don't specify a recipient of any UTxOs, but of course check that with tests, etc).


text:
PAB recovering from Errors
In the current version of the Plutus starter repo (commit a85818 which uses plutus-1.0.9), it seems difficult to know where to handle errors. For example, using the Game contract after initialization and wallets are created in accordance with the README, if you supply data that is the incorrect type to the guess endpoint (for example) all subsequent attempts to interact with the contract fail.
Steps to reproduce:

Follow README up to line 177 (Successful wrong guess)
No errors in status of contract instance
Retry last curl with any JSON data that is not the object expected (e.g.):

curl -H "Content-Type: application/json" --data '"duck"' \
    http://localhost:9080/api/contract/instance/$INSTANCE_ID/endpoint/guess

No interactions on this instance will work any longer (non-recoverable).
I have tried adding a handleError with a lambda function to output the error (which it does, logging a WalletError). It states that the last logMessage was waiting for triggering an endpoint, but the general state of the contract has an err status. Is there a general way to catch errors, output them, and then restore the state of the contract instance?


text:
Lobster Challenge: zsh: no matches found error on building transaction
So I'm trying to build the transaction for voting on the naming of Charles Lobster. However whenever i specify the UTXO as TxHash + "#" + TxIx it complains and says
zsh: no matches found: TxHash#TxIx
But then whenever i take out the #TxIx part and leave it as TxHash it complains and says
option --tx-in: unexpected end of input expecting hexadecimal digit or "#"
I don't really know what I'm doing wrong. It's my first time with the cardano node so any help would be appreciated.

I figured it out. For anyone facing the same issue you need to escape the # key by putting a backslash before it like so:
TxHash\#TxIx


text:
How does stake pool saturation prevent centralization?
From cardano.org:

Saturation Parameter (K)
Saturation is a term used to indicate that a particular stake pool has more stake delegated to it than is ideal for the network, while k is the targeted number of desired pools. Once a pool reaches the point of saturation, it will offer diminishing rewards. The saturation mechanism was designed to prevent centralization by encouraging delegators to delegate to different stake pools, and to incentivize operators to set up alternative pools so that they can continue earning maximum rewards. Saturation, therefore, exists to preserve the interests of both ada holders delegating their stake and stake pool operators, and to prevent any single pool from becoming too large.

But, if a stake pool operator starts a second stake pool on the same server as soon as a stake pool gets saturated, how does that help decentralization? It's still the same guy and the same server. What am I missing here?

You're missing nothing, the Reward Sharing Scheme (RSS) Version 1 (RSSv1) is permissionless, and any one entity can open multiple pools. In fact it's quite lucrative because of the minFee at 340. You can open multiple low pledge pools, collect the minFee and have less skin in the game.
The game theory incentives of k (pool saturation limit) and a0 (increased rewards for higher pledge) were meant to encourage an entity to maintain one pool in theory, but in practice that is deeply flawed.
You can see pool groups at balanceanalytics.io 's decentralization charts. It's quite telling.
There's open discussion on a RSSv2 and CIP-50 (among other CIPs) planning on hivemind thinking the new reward sharing scheme.
Right now the best option is education on delegating to single pools with high pledge, they are doing it right.

As the article says, pool saturation helps to "divide" delegated ADA into different pools, this mean that not only big pools can be chosen from the algorithm to verify a block but also the smaller one. In this way the job is split and the decentralization is higher.
If a SPO decide to create a second pool, the level of decentralization is lower. True decentralization is reached only if every operator manage one and only one pool.
You can read more here

The saturation parameter (k) should be considered alongside the pledge influence parameter (a0).
The purpose of a0 is to incentivize pool operators to delegate a larger pledge to their own pool by providing greater rewards to pools with a higher pledge. The idea being that this will encourage operators to concentrate their available Ada into a smaller number of pools, rather than creating lots of pools with a lower pledge.
This is the theory, and I believe it is still a work in progress in terms of tweaking those mechanics as it would seem that this may not be providing a sufficient incentive for pool operators to behave in this way.

authors: Александр Небышинец


text:
using an output of a transaction in the same transaction
is it possible to implement a plutus script that consumes two UTXO's where the output of one is used as an redeemer for the second?

Not sure if I have it clear, but you can't use outputs of one transaction as inputs in the same transaction because every UTxO is unique and once used, you can't reuse it.
But you can use as many eUTxO's as you want in your transaction. It makes eUTxO model very powerful because you can involve many validator scripts and minting policies in same transaction.

What I would like to do is link contracts, I would guess that this is possible but I do see how the Plutus.tx functions need to be used to implement this. Say is have an script at address 1 that mints an NFT for 10 ada, also consider a script at address 2 which create an action. Then I would like to link these two scripts in one transaction.

Yes, you can do that in the same transaction.


text:
When can I move Daedalus` data files to another location?
I have an intentionally small /home partition and a large data partition on Linux. When can I move move Daedalus' data files to my data partition.
I ran out of room on /home and had to move a bunch of stuff elsewhere that I did not want to move.
A long time ago, I tried doing it with symlinks, but that does not work.
I think CH mentioned wanting to add this in one of his AMAs.

Link works. I had shared the immutable folder among three PCs.

2022 Daedalus 5.1.0
Yes this was a big problem. Daedalus just ate up my SSD while I have a mostly free 2TB HDD sitting doing nothing.
It turned out to be very simple though. Here are the steps for Ubuntu based systems;

Make sure that Daedalus is not running.

Copy the ~/.local/share/Daedalus directory somewhere in your harddisk. In my case I copied it to /mnt/P300/Daedalus.

To back up, I renamed the original like ~/.local/share/Daedalus_

Create a symlink in ~/.local/share to point to /mnt/P300/Daedalus like
ln -s /mnt/P300/Daedalus ~/.local/share/Daedalus

We are almost finished. Open ~/.local/bin/daedalus-mainnet with an editor. There are two lines starting with exec. In both of them add -m /mnt:/mnt before -m /home:/home. In my case /mnt is where my HDD is mounted. You should first check the mountpoint of your HDD. Perhaps you need to add -m /media:/media or whatever your mountpoint is.

Finally open ~/.local/share/Daedalus/mainnet/namespaceHelper. (now this file is in fact in the HDD since you have already linked at step 4) with an editor and repeat exactly what we did in step 5.

Say some prayers.

Now you are probably OK and when run, Daedalus should start working on the HDD copy.

Make sure it finalizes replaying the ledger and synching the blockchain.
Make sure everything works just fine.

You may now delete the backup ~/.local/share/Daedalus_ from your SSD.

I still can't try this until I get a new more powerful notebook, but it looks like it will work. Thanks for all the details. I will probably need this in the future.

I use symlinks with Daeadalus all the time. I typically don't symlink the entire Daedalus directory. In my case, state-cardano is a separate zfs volume on my system:
ls -hal ~/.local/share/Daedalus/
total 7.5K
drwxr-xr-x  3 sam users  7 Aug  6 15:25 .
drwxr-xr-x 36 sam users 37 Oct  1 21:23 ..
lrwxrwxrwx  1 sam users 39 Apr 13  2018 devnet -> /home/sam/state-cardano/daedalus-devnet
lrwxrwxrwx  1 sam users 40 Mar 30  2018 mainnet -> /home/sam/state-cardano/daedalus-mainnet
lrwxrwxrwx  1 sam users 40 Feb 17  2021 mainnet_flight -> /home/sam/state-cardano/daedalus-mainnet
drwxr-xr-x  7 sam users  9 Aug  6 15:29 shelley_qa
lrwxrwxrwx  1 sam users 40 Mar 22  2019 testnet -> /home/sam/state-cardano/daedalus-testnet

Finally got around to trying this, but I'm missing something. I created /media/dataspace/data/Cardano and moved (using cp -a) /home/bigbird/.local/share/Daedalus/mainnet/ there and replaced the original with a symlink. When I start Daedalus, I get mkdir: cannot create directory '/home/bigbird/.local/share/Daedalus/mainnet': File exists

I gave up on Daedalus until I get a new notebook. It won't run on mine any more.


text:
Sandbox error when running nix build on macOS
I'm trying to get the exercises for week 1 of the plutus pioneer program working. I've installed nix and have set the IOHK caches.
When I try to run nix build -f default.nix plutus.haskell.packages.plutus-core in the plutus repo I get the following error:
 ❮❮❮ nix build -f default.nix plutus.haskell.packages.plutus-core
trace: To materialize project.plan-nix for Agda entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.
builder for '/nix/store/gpkkaj0mcs6wxaknfjm0jh389x8l4gwb-plutus-core-0.1.0.0-coverage-report.drv' failed with exit code 65; last 1 log lines:
  sandbox-exec: pattern serialization length 71571 exceeds maximum (65535)
[0 built (1 failed), 0.0 MiB DL]

I'm running this command on commit ea0ca4e9f9821a9dbfc5255fa0f42b6f2b3887c4.
I've looked through the plutus community docs but haven't found any mention of this error.
Has anyone run into this before? What does this mean? Is there a known fix?
EDIT: this also happens on master at commit 8ce0d58c0a169f4c8a1104757502f342e750c863

Figured it out. I'm on MacOS and some docs that I followed mentioned turning on the sandbox feature by adding
sandbox = true
extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env

to /etc/nix/nix.conf.
Removing these two lines eliminated the error.

I am in the Cohort 3, and following multiple guides as well, macOS i7 Monterey.  Do you still recommend removing those?  I see here it recommends adding, but no others do... https://github.com/input-output-hk/plutus-apps#nix-on-macos . I had issues building the client.

I found this /etc/nix/nix.conf to work for my macOS i7 Monterey (v12.1).
It was recommended to turn the sandbox FALSE because 'not recommended' per Ref #1 below.
    build-users-group = nixbld

    substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
    trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=volume

    sandbox = false
    extra-sandbox-paths = /System/Library/Frameworks /System/Library/PrivateFrameworks /usr/lib /private/tmp /private/var/tmp /usr/bin/env
    experimental-features = nix-command
    extra-experimental-features = flakes

References:

CSE, @angerman, on macOS Monterey i7, what is the best nix.conf file to use?
Github: Status of macOS support in Nixpkgs

https://github.com/Til-D/cardano-plutus
https://github.com/renzwo/cardano-plutus-apps-install-m1/blob/main/README.md

Answer could be improved by following these guidelines: How to reference material written by others

tracked down reference source and updated per comment.

Well done, you get a whole upvote from me!  Sorry I can't do more.

on debian distro, it works fine with all the details mentioned in developers forum. I built it on VS code debian distro with WSL2.  its tricky as sometime u need to execute chmod command as it wont let u access it.


text:
How to parse TokenName to Integer
I have information encoded in the TokenName of an asset. These token names represent integers.
According to the Plutus source code, the TokenName is of type BuiltinByteString. How can I parse it to type Integer in the on chain code ? In short I am looking for a Plutus-pendant of the Haskell read, but one that returns a Maybe Integer.

I had trouble with the same thing, just going the opposite direction, Slot -> TokenName (Slot is just an Integer under the hood). After a bunch of pain I ended up just coding my own parsing logic:
-- Simplified business code here:
{-# INLINEABLE dcForSlot #-}
tokenNameForSlot :: Slot -> TokenName
tokenNameForSlot slot = TokenName $ Builtins.encodeUtf8 $ intToString $ getSlot slot

{-# INLINEABLE intToString #-}
intToString :: Integer -> Builtins.String
intToString i = Prelude.foldr Builtins.appendString "" strings
  where
    ints = intToInts i
    strings = map (Builtins.charToString . intToChar) ints

{-# INLINEABLE intToInts #-}
intToInts :: Integer -> [Integer]
intToInts i
  | (Builtins.equalsInteger a 0) = [b]
  | otherwise = (intToInts a) ++ [b]
  where
    (a, b) = divMod i 10

{-# INLINEABLE intToChar #-}
intToChar :: Integer -> Haskell.Char
intToChar i
  | (Builtins.equalsInteger i 0) = '0'
  | (Builtins.equalsInteger i 1) = '1'
  | (Builtins.equalsInteger i 2) = '2'
  | (Builtins.equalsInteger i 3) = '3'
  | (Builtins.equalsInteger i 4) = '4'
  | (Builtins.equalsInteger i 5) = '5'
  | (Builtins.equalsInteger i 6) = '6'
  | (Builtins.equalsInteger i 7) = '7'
  | (Builtins.equalsInteger i 8) = '8'
  | (Builtins.equalsInteger i 9) = '9'
  | otherwise = '0' -- Fix this

Feel free to try and reverse this to get what you want. It might be easier going the other direction, I don't have time rn to figure out what it would look like but I feel your pain, so I thought I'd share.

What does 'intToInts' do ?

It splits all the digits of the integer:
intToInts 5701 == [5, 7, 0, 1]

Thank you, I understand. I will post my solution as soon as I have it. It's crazy that we have to use such work arounds on Plutus.

Yeah. It's young still. There's plenty of room for people to add libraries. There's a big chance I missed some tools as well.

This is slow but works.
{-# LANGUAGE  OverloadedStrings  #-}

module StackExchange where

import Prelude
import PlutusTx.Builtins.Class
import PlutusTx.Builtins.Internal
import Data.ByteString hiding (map)
import Data.Char

s = stringToBuiltinByteString "123"

bsToMaybeInteger :: BuiltinByteString -> Maybe Integer
bsToMaybeInteger str
  | Prelude.all (\x -> x >= 48 && x <= 57) unpackedString = Just (Prelude.read (Prelude.map chr unpackedString) :: Integer)
  | otherwise                                             = Nothing
  where
    unpackedString = map fromEnum . unpack . fromBuiltin $ str

Can be tested in a cabal repl session like this:
λ> StackExchange.bsToMaybeInteger StackExchange.s
Just 123

Have you tried this in compiled on-chain code?

fair point, I have not done that yet... I guess there may be some slight modifications necessary.

Yeah. That's where I had the biggest headache, especially since the Plutus compiler doesn't give very helpful error messages.


text:
Define a native token minting policy restricted by NFT
I have found examples indicating that a minting policy can be single shot or restricted by PubKeys, however I would like to secure minting and burning of a token based on if a specific NFT is present in the redeemer.
My current thinking (no code written yet) would be to create an OnChain validator to check for the NFT and set the minting policy to forwardingMintingPolicy.
This makes me a little nervous because from what I understand once a minting policy / token is established it can never be changed which means the validation script can also not be changed.
So with this in mind would it be recommended to make the token contract as simple as possible ie, Mint, Burn only validated as above, then keep any potentially complex behaviour in other contracts that can be changed. Or am I missing something entirely.

Define a native token minting policy restricted by NFT

This is how the Liquidity Token minting works in the Uniswap example.
isUnity v usCoin

checks that there is included one usCoin. The policy also includes some additional flexibility, but that's the general idea.
I think this is going to be a very common pattern in smart contracts.

I've actually been thinking about how to abstract this exact pattern into some library/framework. There is a lot of annoying boilerplate involved in the off-chain and on-chain portions and it would be nice to simplify it to something that writes the script and policy for you to some extent.

Excellent, that nudge helps a lot. Is my initial intuition about the problem correct (or on the right track). If I implement the policy in a similar way to the Uniswap example can I deploy new contracts in the future that mint the coin in new ways (so long as they still provide the NFT as defined in the initial minting policy?). Just trying to get my design right.

Future-proofing these contracts is going to be a big challenge. I'm sure there are ways to do it, and it sounds like you have some ideas, but Plutus and Cardano SCs are so new that there isn't precedence. You can look at projects on Ethereum which have multiple versions. I think many of them just started from scratch with subsequent versions though. My advice would be to create the minimum version of your contract, even if it won't make it to production, and that will give you a much better idea of what options you have for upgrading.


text:
datum hash of bytes is different between cardano-serialization-lib and cardano-cli
I am having trouble using cardano-serialization-lib. I am trying to calculate the datum hash from bytes using this library:
var myBytes = Buffer.from(
    'b1566319045054327346e0043eed1af00eec2a63d9536f65087ca1c8'
  );
  const dtHash = hash_plutus_data(PlutusData.new_bytes(myBytes));

which gives me a4c44696aa4ed831f3a1c0b86e407a8c092cf680e61ed23f0e47a15b73d59c79
but when I tried to do it through cli with cardano-cli transaction hash-script-data --script-data-file $datumFile
where datumFile is
{
    "bytes": "b1566319045054327346e0043eed1af00eec2a63d9536f65087ca1"
}

I got edc92947d6f09957c3fe31c10478e6eeee7fdaec1e2cc7439633325cd9bcf13f instead

Did you manage to solve this?

I'm pretty sure this is a known bug which the devs are aiming to fix in the next hard fork. You can see the discussion here: https://github.com/Emurgo/cardano-serialization-lib/issues/227
Does your transaction work when you submit it? If it doesn't, you should get a relevant error related to the datum which you can use to fix your transaction body.