text:
Is there an established pathway yet for someone with a purely mathematical background to become a fully equipped Cardano developer? If so, what is it?
Title asks my question. I have a mathematics degree (undergrad) and have dipped a toe in the water of software development in Python, but have no clue where the optimal place to start to become an effective Cardano developer would be. Presumably someone here has walked the path I’m hoping to set out on towards building on Cardano, I’d love some advice.
Thanks in advance.

Welcome, Brody Alden. I feel math and Cardano goes hand in hand. Most of the core team including the founder is a mathematician. However, this is an opinion-based question and it is best suited in the Cardano forum at https://forum.cardano.org/ . Hoping to see you often with technical questions on Cardano here.

You can start learning Haskell which will help you in Math too. Then you can migrate to smart contract development with Plutus. haskell.mooc.fi/ is one of the site for starting Haskell. https://www.youtube.com/watch?v=igV7kMXcdpw is the best material to start learning Haskell.

Take a look on this: https://cardano.stackexchange.com/questions/4444/i-am-completely-new-to-cardano-eco-system-to-learn-it-from-the-absolute-basic

I would suggest reading the book Mastering Bitcoin (https://github.com/bitcoinbook/bitcoinbook) and then following the videos of the Plutus Pioneer Program (https://youtube.com/playlist?list=PLK8ah7DzglhgV7W6BHcoIzRArjzs_UuSY).


text:
Programmatically creating the policyid / scripthash in Javascript (Browser)
I'm looking for a Javascript implementation of the CLI's cardano-cli transaction policyid function, can anyone point me in the right direction here?
Trying to replicate it with blakejs (https://github.com/dcposch/blakejs) and cbor-web (https://github.com/hildjj/node-cbor/tree/main/packages/cbor-web), but failing to get the hashes to match the output of the CLI.
Eg I want to create a PolicyID / ScriptHash from this policy script:
{
  "type": "all",
  "scripts":
  [
   {
     "type": "before",
     "slot": 42863577
   },
   {
     "type": "sig",
     "keyHash": "46a26617f9b59cc48945ccc6c0aecee732f7698fadbe8b5624b44b9e"
   }
  ]
}

(CLI gives me this policyid: 463e9264962cea64efafa576d44c8d2821d09c0c7495c253d4101a9a)
In JS I'm trying something along these lines:
[removed, see correct answer below]

(gives me this: 5db35cd45775e7d7b0d1bd5491a9baea7ac54b41772a8c96ce587579)
Any guidance is very much appreciated

You can do this using the 10.0 beta version of cardano-serialization-lib which should make it into stable pretty soon (I'm in the process of testing this, you can follow the status on this Github issue).
This should be enough to get you started:
const ttl = protocolParameters.slot+invalidHereafter
const timelockExpiry = S.TimelockExpiry.new(ttl)
const timeLockedPolicyScript = S.NativeScript.new_timelock_expiry(timelockExpiry)
const policyScripts = S.NativeScripts.new()
const policyScripts.add(timeLockedPolicyScript)
const scriptHash = S.ScriptHash.from_bytes(timeLockedPolicyScript.hash().to_bytes())
const policyID = bytesToString(timeLockedPolicyScript.hash().to_bytes())

In order for that code to work, you'll need some valid protocolParameters object which can be retrieved from Blockfrost using this code from Nami wallet, as well as the bytesToString function which is defined using Buffer:
export const bytesToString = (bytes) => {
  return Buffer.from(bytes, "hex").toString("hex")
}

Nice, thanks, that looks pretty elegant!

Finally got my head around this, thanks to this version in Python: Re-Implementing Policy Hashing in Python by @tycl.
Basically we need to

Parse the policy (JSON)
Follow the CDDL specifications to translate the policy to an array
(see link below)
Use the array as input to cbor.encode().
Prepend a "0" byte to the result.
Run that new byte array through blake2bHex.

And we're done.
Here's an example:
The policy used is the one from above and I translate it manually to the array via https://github.com/input-output-hk/cardano-ledger/blob/683bef2e40cbd10339452c9f2009867c855baf1a/shelley-ma/shelley-ma-test/cddl-files/shelley-ma.cddl#L228-L246;
Cbor-Web used from here: https://github.com/hildjj/node-cbor/tree/main/packages/cbor-web
Blakejs package from here: https://github.com/dcposch/blakejs
// Values from policy json
const keyhash = "46a26617f9b59cc48945ccc6c0aecee732f7698fadbe8b5624b44b9e";
const slot = 42863577;

// Translation via CDDL link above
// [1, [X]] => "script_all"
// [5, slot] => "invalid_hereafter" (~ "valid before")
// [0, keyHashBytes] => "script_pubkey"
// Remember: 1) Buffer conversion and 2) Order matters.
const cborInput = [1, [[5, slot], [0, Buffer.from(hexToBytes(keyhash))]]]

// Cbor encode
let cborResult = cbor.encode(cborInput);

// Prepend the 0 byte
let tmp = new Uint8Array(cborResult.length + 1);
tmp.set(Uint8Array.of(0), 0);
tmp.set(cborResult, 1);
cborResult = tmp;

// Run the result through blake2d with digest size / output length of 28
const blakeHexResult = Blake.blake2bHex(cborResult, null, 28);
console.log(blakeHexResult);

awesome, thanks for linking to cddl!

source: Stack Exchange

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

sort: votes


text:
Using cardano-wallet to mint native assets
The cardano-wallet api documentation describes an endpoint which appears useful for minting native assets (https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/mintBurnAssets). Everything in the request seems pretty straightforward except for the way in which you would go about defining the monetary policy. For example, we want our policy to allow future minting by a specific wallet id, among other attributes.
The only field in this api call which appears related to monetary policy is the monetary_policy_index field inside the mint_burn list. This field takes a string, but as there is no example usage, it's unclear to me how to use that to define a complex monetary policy.
Does anyone have a concrete example of minting native assets using cardano-wallet?

To deal minting policy we should consider 2 parts:

On-chain part

We need to have a minting script that is written in Plutus. In this minting script, we could define the logic we want to have. For instance, which wallet can mint/burn, a list of wallets can mint/burn, the limited time range allows minting/burning, etc.
The following is an example of a minting script that requires a specific address to mint.
https://github.com/input-output-hk/plutus-pioneer-program/blob/3bfe927ae0b229290a00f2746fc248d02f0ca9d5/code/Week05/lecture/Signed.hs

Off-chain part

Off-chain part is for creating transactions that use the minting script prepared above to mint or burn native assets. In this part, we can define how many native assets we would like to mint/burn in those transactions.
The following is the off-chain code to use the minting script above (It uses lucid library instead of cardano-wallet, but I think the approach is almost the same).
https://github.com/input-output-hk/plutus-pioneer-program/blob/3bfe927ae0b229290a00f2746fc248d02f0ca9d5/code/Week05/lecture/lucid-signed.ts
Thus, the cardano-wallet mentioned in the API documentation is for the off-chain part only I think. And we need On chain part to create native assets.
See more,

https://www.youtube.com/watch?v=g_VoKPK-tk0&ab_channel=IOGAcademy
https://www.youtube.com/watch?v=Faru8_Br2Xg&ab_channel=IOGAcademy

Hope this is helpful!

It is not possible to create complex monetary policies using the cardano-wallet. As far as I know, it is not even possible to create a time lock for the policy in it.

For example, we want our policy to allow future minting by a specific wallet id, among other attributes.

For such policy, you might need to use Plutus.

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


text:
Is there any way to debug/log variables in validator?
As a newbie in Plutus and Haskell, I write code by printing/logging variables to see their value, which is the only reason why I managed to write Contract, off-chain Plutus part.
My question is, are there any possible ways (even hacky ones, doesn't matter), to inspect variable value in on-chain, validator Plutus part.
I am aware of trace, traceIfFalse, etc. All of the functions can be found here:
https://playground.plutus.iohkdev.io/doc/haddock/plutus-tx/html/PlutusTx-Trace.html
But it doesn't help, as you can't inspect variables.
This enhancement seems to be dead:
https://github.com/input-output-hk/plutus/issues/3164
Searched a lot of sources and found nothing useful. I am aware why it's difficult (BuiltInString, absence of Show), only asking for possible solutions/tricks/hacks and not for explanation why it's impossible.
This question is related:
Logging in validator
Thanks
EDIT:
let's image I have a validator:
mkValidator :: Order -> Order -> OrderAction -> ScriptContext -> Bool
mkValidator o oDatum act ctx = True

how can I print the value of for example ctx (ScriptContext), or oDatum, then executing the whole script with Emulator, so that whole script compiles and I can see ctx Value somewhere in EmulatorTrace (or any other way)?
I mean something like this:
mkValidator o oDatum act ctx = trace "test" ctx && True

Why is impossible to inspect variables with trace? Could you include specific examples of what you're trying to do?

let's image I have a validator:
mkValidator :: Order -> Order -> OrderAction -> ScriptContext -> Bool
mkValidator o oDatum act ctx = True.
how can I print the value of for example ctx (ScriptContext), or oDatum, then executing the whole script with Emulator, so that whole script compiles and I can see ctx Value somewhere in EmulatorTrace?
I mean something like this:
mkValidator o oDatum act ctx = trace "test" ctx && True

There is a recent update regarding the error message from validator onchain here https://github.com/input-output-hk/cardano-node/releases
If you update your cardano-node to version 1.31.0, you will be able to see log message from traceIfFalse. Something like
The provided Plutus code called 'error'.
Script debugging logs: UTxO not consumed

Like @Calin answered, you can always run any test with the Emulator Trace, which gives you where it fails onchain.

It is still just a pre-prepared string logging, not variable logging though

Yes, that's right, but at least it gets improved and now while testing on testnet/mainnet we at least know which condition doesn't meet.

I could not find a way to work around this yet. Validation is a side effect free function (a pure function) so it can't write to any log.
What I do is create a debug endpoint in my contract log info there
So I will have something like this
debug :: AsContractError e => () -> Contract w Schema e ()
debug _ = do
        utxos <- utxosAt address
        Contract.logInfo @String $ show utxos
        Contract.logInfo @String $ show (length utxos)
        wallet1Utxos <- utxosAt . walletAddress $ knownWallet 2
        Contract.logInfo @String $ show wallet1Utxos
        wallet2Utxos <- utxosAt . walletAddress $ knownWallet 1
        Contract.logInfo @String $ "Utxos for wallet 2: " ++ show wallet2Utxos

And then use that in a EmulatorTrace()
mintAndTransfer :: EmulatorTrace ()
mintAndTransfer = do
        let tn = "USDC"
        h1 <- activateContractWallet (knownWallet 1) (endpoints @ContractError)
        callEndpoint @"mint" h1 $ MintParams
                { mintParamsTokenName = tn
                , mintParamsAmount = 100 }
        void $ waitNSlots 1
        callEndpoint @"mint" h1 $ MintParams
                { mintParamsTokenName = tn
                , mintParamsAmount = 200 }
        void $ waitNSlots 1
        callEndpoint @"transferToWallet" h1 $ TransferToWalletParams
                { tpTo = walletPubKeyHash $ knownWallet 2
                , tpAmount = 50
                , tpTokenName = tn }
        void $ waitNSlots 1
        callEndpoint @"debug" h1 ()
        void $ waitNSlots 1

Not ideal I know but it helps sometime.


text:
How to lock funds in a smart contract?
What I want to do: Send 25 ADA and lock it all at the script address until 1 of the 2 scenarios happen:

100 ADA is sent by Nov 25th (today is Nov 20th) and all ADA at the script address is sent out to some arbitrary address (total 125 ADA sent out)
It is Nov 25th and 100 ADA has not been sent and locked at the script address by now, so all ADA at the script address is burned (25 ADA and whatever else that was sent below 100 ADA is burned)

Is this possible with Plutus smart contracts? Is there anyway at all a smart contract like this can be implemented on the Cardano blockchain?

Yes. Something like this is relatively trivial for a Plutus script (Essentially, locking funds and some data at an address is the only thing  scripts do).
Here is one approach you could take. There are many other ways you could do this, but this is fairly reusable construction:
Your datum type could have the fields:

Target Amount
Deadline
Recipient "Arbitrary" Address (if you want it to go to a specific party)

The script will ensure that the Datum UTxO can only be redeemed if:

The OUTPUT of the spending Tx includes a UTxO paid to the Recipient of value >= Target Amount && the Tx was executed before the Deadline, OR
The Datum is replaced with a new identical Datum and a UTxO of >= the value on the previous Datum.

You can see an example of scripts requiring the datum is replaced with a new one in the
PPP Oracle example or the Uniswap example, with their
corresponding off-chain code here and here.
The case where the deadline is passed and the ADA is burned is implicit in a Datum that can no longer be redeemed--if no-one can reach the funds, they are as good as burned (there is no actual way to burn ADA anyway).
To initialize the script, you will create the Datum with an attached 25 ADA. There would be nothing ensuring that the initial value is 25 ADA, but that doesn't seem like an issue. A script that makes that requirement would need to be more complex.

Thank you, Mitchell! Your level of detail is much appreciated. If we could get even deeper, I'm wondering about the 2nd option of redemption you mention. Do you have any references/examples for how to replace a Datum from within the smart contract? I'm assuming it's in Haskell, or could it be done another way?

Added some examples to my answer. This will require you to write Plutus (on-chain script) and Haskell (off-chain code). If you aren't familiar with writing Plutus smart contracts, I'd highly encourage you to go through the Plutus Pioneer Program lectures. Unfortunately, Plutus is a young language and not trivially easy to pick up.


text:
When Hydra will be ready for production?
I understand that Hydra is a work in progress, but it already has a POC version. If there is no clear deadline, where can I find a development plan at least ?

FWIW We created a Github project to serve as our public roadmap: https://github.com/orgs/input-output-hk/projects/21
It does show individual features, in what releases they are planned to be included and roughly in what time frame we aim to be tackling them. The quarters in one of the views are only forecasts and any impact in velocity will change them - it's a research & development project after all!

There is no official roadmap just yet, but we plan to publish it soon. However, don't expect definite deadlines on that, but rather a sequence of features with frequent & incremental releases. Research & development is an inaccurate art :) Where and in which form would you expect such a roadmap?

I think something like Cardano roadmap (https://roadmap.cardano.org/) would be useful. There could be a list of phases of development. As for where, it would be great to have it on cardano.org, probably it would also be something like public assurance.

Also it'd be great to have an infographic of sorts detailing what functions are possible with each iteration of Hydra along the approximate roadmap.


text:
How does custom Plutus data type map to cardano-cli --tx-in-datum-file content?
Let's say I have validator, which checks datum against two numbers, hash, time and a string and there are some funds locked at this script address and I would like to unlock these funds using cardano-cli --tx-in-datum-file... by providing datum file. Inside source code I have a custom data type like so:
data CustomDatum = CustomDatum
    { num1 :: Integer
    , num2 :: Integer
    , hash1 :: PubKeyHash
    , time1 :: POSIXTime
    , string1 :: String
    }
    deriving Show

PlutusTx.unstableMakeIsData ''VestingDatum

What are the rules to form correct datum file?
How should typed and not typed datum file look like to match my CustomDatum inside Plutus script?
How are values mapped between datum file and custom data inside Plutus script?

Here is an example of a haskell executable that will convert any of your custom data types to the right JSON format :
https://github.com/OnChainLabs/Martify/blob/main/app/datum-json.hs
In this file we convert the type NFTSale which is defined like so :
data NFTSale = NFTSale
    { nSeller    :: !PubKeyHash
    , nPrice     :: !Integer
    , nCurrency  :: !CurrencySymbol
    , nToken     :: !TokenName
    } deriving (Generic, ToJSON, FromJSON)

But it works for any other data type.

I managed to make a working example with more than one parameter. I still don't understand underlying principles, but at least here is something to start working with:
data CustomDatum = CustomDatum
    { num1 :: Integer
    , num2 :: Integer
    }
    deriving Show

PlutusTx.makeIsDataIndexed ''CustomDatum [('CustomDatum, 0)]

-- mkValidator :: Datum -> Redeemer -> ScriptContext -> ()
{-# INLINABLE mkValidator #-}
mkValidator :: CustomDatum -> () -> ScriptContext -> Bool
mkValidator dat () ctx = traceIfFalse "Numbers are missing" numbersAreCorrect
  where
    numbersAreCorrect :: Bool
    numbersAreCorrect = ((num1 dat) == 24) && ((num2 dat) == 42)

Example datum
{
    "constructor":0,
    "fields":
    [
        {
            "int":24
        },
        {
            "int":42
        }
    ]
}

Example redeemer
{ "constructor": 0, "fields":[] }

And as for the PubKeyHash, "bytes":"25e1081f483086365f62fa37618ad6c4768864806fc874b56abe59d7" works


text:
Return tAda using Cardano-CLI
I want to return test ADA to the test faucet. Is there an easy way to return the tAda? I'm using this documentation to create and submit a transaction to testnet: How to create a metadata transaction using cardano-cli
cardano-cli query utxo --testnet-magic 1097911063 --address $(cat payment.addr)

cardano-cli transaction build-raw \
--tx-in dfb99f8f103e56a856e04e087255dbaf402f3801acb71a6baf423a1054d3ccd5#0 \
--tx-out $(cat testfaucet.addr)+999825875 \
--metadata-json-file metadata.json \
--fee 174125 \
--out-file tx.draft

cardano-cli transaction sign \
--tx-body-file tx.draft \
--signing-key-file payment.skey \
--testnet-magic 1097911063 \
--out-file tx.signed

cardano-cli transaction submit \
--tx-file tx.signed \
--testnet-magic 1097911063

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ValueNotConservedUTxO (Value 0 (fromList [])) (Value 1000000000 (fromList []))))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (BadInputsUTxO (fromList [TxIn (TxId {_unTxId = SafeHash "dfb99f8f103e56a856e04e087255dbaf402f3801acb71a6baf423a1054d3ccd5"}) 0]))))])

This is the easiest way to return your tADA:

When you have finished using your test tokens, please return them to the faucet so that other members of the community can use them. Please return your test tokens to this address:

addr_test1qqr585tvlc7ylnqvz8pyqwauzrdu0mxag3m7q56grgmgu7sxu2hyfhlkwuxupa9d5085eunq2qywy7hvmvej456flknswgndm3

Thank you, I'm wondering how to do this? I have the wallet address, but don't know how to send the tokens to the address.

The same way as tADA, but with fee...

You'd need to set a --ttl <SLOT NUMBER> parameter for the transaction build-raw command


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

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

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

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

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

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

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

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

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

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

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

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

Address

Amount

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

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

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

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

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

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

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


text:
Is it a problem for BPs to talk to Relays using different versions of cardano-node?
If my BP is running cardano node 1.30.1 and I just upgraded one of my relays to cardano-node 1.31.0, will they still be able to talk to each other or will all nodes have to be updated?

I was actually wondering this same thing and was going to test it. I believe they should be fine for between these 2 versions but not sure if that holds true for other different versions. I'll post my results as an answer after I test it (for 1.30.1 BP and 1.31.0 relay).

Figured it out! They can talk to each other. And yea I believe for soft forks like 1.30.1 -> 1.31.0 they are fully compatible.
The issue turned out to be a silly loopback error. My mistake!


text:
If you run a stake pool at home, and have to move, what is the best transition approach?
If you say are a single stake pool operator running a bare metal server from home, what happens if you have to move? How do you make the transition without going offline? What is the best recommended approach?

I think there are 3 main options for doing this, below if a list order by easiest to more difficult.
Option 1: Temporary Cloud Servers
I think the quick way to do this would be to spin up cloud servers to run your pool. Once the cloud servers are up and synching the blockchain, point your DNS records at them. Make sure to cutover your block producer in such a way that you only have 1 running at a time. At this point you can power off your servers and move. After the move, re-point your DNS records back to your bare metal, let them synch up with the blockchain and finally power off the cloud servers. Again, doing this in such a way to only ever have 1 BP online.
Option 2: The Chuck!
Currently, a good friend of mine and I run a stake pool out of our homes. We live in geographically different locations and create the 'Chuck Pattern.' Essentially, this involves us both running 2 relays and a block producer, with 1 block producer running on standby. For this setup, all we have to do is power off the live block producer and restart the standby block producer with the keys if we need downtime (or need to move). I did a few writeups about this, this one is about how we decided on this setup, and this one is the details of the setup. Obviously this does require a partnership to achieve, but it is cost effective.

Option 3: Buy Duplicate Hardware
For this option, you would just buy another set of hardware and then buy a second internet connection for a short time. Basically would do the same thing as the Cloud option but with your own servers and internet connections.
I hope this helps!

Awesome thank you!

authors: 港豐人民幣找換匯款有限公司


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

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

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

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

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


text:
Is there a way to find the total number of tokens in circulation generated by a minting policy
I've wrote a minting policy that will allow minting of some token, the token can then by transferred of course to other wallets.
Is there a way to find the total number of tokens in circulation?
(ideally from plutus code)

As plutus does not have access to the entire blockchain, it would not, unless you create some kind of a counter in the minting script.


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

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

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


text:
Is the KEVM Testnet Faucet working as described in this Document?
I see there has been plenty of Activity around KEVM but after 25hrs of trying I ONLY et an Error when I requestFunds().
I'd like to see this working so I could test my Solidity DApp. I am migrating from Ethereum due to the Gas Fees.
IS THE KEVM Testnet Faucet working ? The Errors I am getting are Thrown or Page Not found ...
https://testnets.cardano.org/en/virtual-machines/kevm/getting-started/mallet-end-to-end/
H

So this is one Error I get.                    mallet> selectAccount(myAccount)
'0xb95a646539f77f393ec0edad764472b58b10ff72'
mallet> getBalance(myAccount)
Thrown:
Error: Invalid JSON RPC response: undefined
at Object.InvalidResponse (/mnt/c/mallet/lib/web3/web3/errors.js:38:16)
at HttpProvider.send (/mnt/c/mallet/lib/web3/web3/httpprovider.js:102:18)
at RequestManager.send (/mnt/c/mallet/lib/web3/web3/requestmanager.js:65:32)
at Eth.send [as getBalance] (/mnt/c/mallet/lib/web3/web3/method.js:145:58)
at Mallet.getBalance (/mnt/c/mallet/lib/mallet.js:238:26)
mallet>

I'm not 100% sure about this but, based in some research and the activity seen in this Cardano Forum, it seems that all KEVM efforts were taken over by Milkomeda (which in my opinion makes sense).
If you want to build/test a DApp using Solidity, you can try that chain instead, which is already running Mainnet as well.
More information here: https://www.milkomeda.com/

Milkomeda isn't working on the KEVM.

if you're migrating from the Ethereum L1/ecosystem into the Cardano ecosystem with an EVM-dependent project then Milkomeda is currently the go-to EVM-compatible extension of Cardano.
It's presently compatible with common tools like Remix and wallet software like Metamask.
Also, it's cheaper(fractions of a US cent) and faster(with fast finality) to operate on.
Good luck!


text:
Cardano-cli errors when submitting
I can build and sign a tx with no errors using:
cardano-cli transaction build --alonzo-era \
--testnet-magic 8 \
--tx-in 20445d5c68e1759f1371a86ecca773b76463fba3831f128fd2f7834de38ae6ec#0  \
--tx-in 20445d5c68e1759f1371a86ecca773b76463fba3831f128fd2f7834de38ae6ec#1 \
--tx-in-script-file ./scripts/elidSplit.plutus \
--tx-in-datum-file ./datums/elidInit/elid.json \
--tx-in-redeemer-file ./redeemers/unit.json \
--required-signer ./wallet2/payment.skey \
--tx-in-collateral 20445d5c68e1759f1371a86ecca773b76463fba3831f128fd2f7834de38ae6ec#0  \
--tx-out $(cat addresses/dump.addr)+1689618+"1 71344f6919d4ee401df384b52bd627ae551c4db7a0242fad7e1d5d10.SD2" \
--tx-out-datum-embed-file ./datums/unit.json \
--tx-out $(cat addresses/eli.addr)+1689618+"1 71344f6919d4ee401df384b52bd627ae551c4db7a0242fad7e1d5d10.ELI2" \
--tx-out-datum-embed-file ./datums/eliInit/eli.json \
--tx-out $(cat addresses/elidSplit.addr)+1689618+"1 fb3fe9858ed4020bc7df6ea31ec9bf25baa5fedb4a2b8cbf7c23ab64.ELID" \
--tx-out-datum-embed-file ./datums/eliInit/elid.json \
--mint "1 71344f6919d4ee401df384b52bd627ae551c4db7a0242fad7e1d5d10.SD2"+"1 71344f6919d4ee401df384b52bd627ae551c4db7a0242fad7e1d5d10.ELI2" \
--mint-script-file ./scripts/elfSplit.plutus \
--mint-redeemer-file ./redeemers/unit.json  \
--change-address $ADDRESS2 \
--invalid-before 8148593 \
--invalid-hereafter 8167069 \
--protocol-params-file pparams.json \
--out-file ./txs/eliInit/tx.build

cardano-cli transaction sign --tx-body-file txs/eliInit/tx.build --testnet-magic 8 --signing-key-file ./wallet2/payment.skey --out-file txs/eliInit/tx.signed

My 1 input datum and 2 output datums add up to a total of 2888 bytes.
bash-4.4# du -b datums/elidInit/elid.json
481     datums/elidInit/elid.json
bash-4.4# du -b datums/eliInit/elid.json
477     datums/eliInit/elid.json
bash-4.4# du -b datums/eliInit/eli.json
1930    datums/eliInit/eli.json

Yet when I try to submit, I run into the following error:
bash-4.4# cardano-cli transaction submit --testnet-magic 8 --tx-file txs/eliInit/tx.signed
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (ExUnitsTooBigUTxO (WrapExUnits {unWrapExUnits = ExUnits' {exUnitsMem' = 30000000, exUnitsSteps' = 10000000000}}) (WrapExUnits {unWrapExUnits = ExUnits' {exUnitsMem' = 40134886, exUnitsSteps' = 14936123959}})))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (MaxTxSizeUTxO 19142 16384)))])

How do I get the transaction to not error our when submitting? My scripts conduct some time checks, signing checks, and checks on the output datums.

Apparently there is a problem with the size of your transaction, which is: 19142
But there is a limit, you can find it on the protocol-params file:

maxTxSize: 16384 bytes

Try to modify it, to decrease the size of the transaction.

I am pretty sure that the size of the transaction is relatively small from the above numbers. Is there any way to tell where that size is coming from?

It's not the max Tx size, but rather the exunits. Try lowering those


text:
Alonzo purple node not syncing
My Alonzo Purple stopped earlier today at:
{
    "epoch": 1138,
    "hash": "6da227172643387f26e2b95e7f8d781938a6084bc745fb5026134fa901bd5ef8",
    "slot": 8190079,
    "block": 358864,
    "era": "Alonzo",
    "syncProgress": "99.42"
}

https://explorer.alonzo-purple.dev.cardano.org/en is also stuck at the same place it seems
How do I get further?

Alonzo network is dead, you should move your testing to the Cardano testnet.

authors: COSMOS 環宇海外移民服務


text:
Where can I find community governance info for Cardano?
I recently spoke to some other members in the Cardano community and I'd like to know more about governance. For example how the community can engage in meaningful discussions about the protocol and how it should and can be governed by the community. Much thanks.

Project Catalyst is Cardano's first major Governance product. You can submit proposals for new tools, features or improvements during the submission period of a fund cycle.
This is a community-built dashboard that aggregates a lot of important info about Catalyst.

The best way to learn about the CIP process is to review the CIP1: CIP process.
Discussion is mostly happening on the CIP github using the pull requests but also on bi-weekly CIP meetings.


text:
Build transaction script ERROR in cardano .Not support the policyid with tokenname
this is my transaction build script

cardano-cli transaction build
--mainnet
--alonzo-era
--tx-in $txhash#$txix
--tx-out $address+$output+"$tokenamount $policyid.$tokenname"
--change-address $address
--mint="$tokenamount $policyid.$tokenname"
--minting-script-file $script
--metadata-json-file metadata.json
--invalid-hereafter $slotnumber
--witness-override 2
--out-file matx.raw

And i get this error when i add tokenname with policy id
if i remove the tokenname then its working fine.and also not showing tokenname in cardanoscan

option --tx-out:
unexpected 'N'
expecting alphanumeric asset name, white space, "+" or end of input

Are you using cardano-cli v1.31?
If so, please refer to Errror cardano-cli build-raw: AssetName deserisalisation failed expecting hexadecimal digit

This line is problematic:

--tx-out $address+$output+"$tokenamount $policyid.$tokenname"

One your variables is not set. To try it out, just put echo  in front of the command to print out what the command really is with variables filled in.

--tx-out addr_test1vzzql63nddp8qdgka578hx6pats290js9kmn4uay5we9fwsgza0z3+1400000+1 71421b480f31fd04905d50d0fa5026a459f545acf78ba3f359cc053b.NFT1

above is the echo result of tx-out

authors: PJ Food 優質食材網購批發


text:
Comparing protocol upgrades in Cardano vs Ethereum
I’ve read some of the available Hard Fork combinator press release info like the IOHK release blogpost but as a blockchain newb, I don’t have a good grasp of how this substantially improves upon the stakepool operator experience when compared with other L1 Blockchains like Ethereum.
Can anyone unpack what a protocol upgrade currently looks like for an Ethereum miner (or any other comparable L1 blockchain)?


text:
Are on-chain validator Integer comparing functions working correctly?
In the validator, I have defined:
txInfo :: TxInfo
txInfo = scriptContextTxInfo ctx

feePaid :: Integer
feePaid = Ada.getLovelace (Ada.fromValue (txInfoFee txInfo))

the strange thing is, when I do:
traceIfFalse "fee test" (feePaid >= 0)

, it evaluates to True, but
traceIfFalse "fee test" (feePaid == 0)

and
traceIfFalse "fee test" (feePaid > 0)

evaluates to False! How is this possible? Am I doing something wrong?
The very same thing happens when using Plutus.V1.Ledger.Contexts functions.
For example valueProduced (of ADA, using valueOf, so getting Integer) - valueSpent (same, Integer) equates to true if using >= or <= operator, but is neither >, < or ==.
Evaluating using Emulator Trace.
valueProduced, valueSpent example:
test :: TxInfo -> Order -> Integer
test info ord = subtractInteger (valueOf (valueProduced info) (quoteAssetSymbol ord) (quoteAssetName ord)) (valueOf (valueSpent info) (quoteAssetSymbol ord) (quoteAssetName ord))

Order has quoteAssetSymbol which is of type CurrencySymbol and is ADA (""), quoteAssetSymbol is of type TokenName, and is also ADA ("").
Tried using greaterThanEqualsInteger, equalsInteger, etc.. Same result

I think you're not using the correct comparison operators. Make sure you import PlutusTx.Prelude and use == function from there, like described here:
https://cardano.stackexchange.com/a/8323/5085


text:
What is the Nakamoto Coefficient of Cardano?
Balaji introduced the Nakamoto Coefficient several years ago:

The basic idea is to (a) enumerate the essential subsystems of a decentralized system, (b) determine how many entities one would need to be compromised to control each subsystem, and (c) then use the minimum of these as a measure of the effective decentralization of the system. The higher the value of this minimum Nakamoto coefficient, the more decentralized the system is.

He also tried to perform an initial analysis of the coefficient for:
bitcoin:

and ethereum:

What's the Nakamoto Coefficient for Cardano? Charles regularly claims Cardano is (among) the most decentralized cryptocurrencies in the world - has anyone tried to quantify that?

this graphs show the nakamoto coefficient and mav factor epoch by epoch
https://datastudio.google.com/u/0/reporting/3136c55b-635e-4f46-8e4b-b8ab54f2d460/page/p_9vyfu6gorc

Wow that's amazing. If I'm reading this correctly (which I might not be since it's new to me) the graph represents the Nakamoto coefficient when looking just at stake pools. As I understand the concept of the coefficient, it should look at the ecosystem as a whole. For example, there might be many stake pools but they all run the same software and maybe that software is highly centralized in some way. Do you know if there's a more holistic measure of the Nakamoto Coefficient for the ADA ecosystem?

You are correct, see the interesting CIP-50 define k-effective.
https://github.com/michael-liesenfelt/CIPs/blob/CIP-Liesenfelt-Shelleys_Voltaire_decentralization_update/CIP-Liesenfelt-Shelleys_Voltaire_decentralization_update/README.md


text:
Our valid transaction never posts to the chain. TraceMempoolRemoveTxs in log
We are programatically submitting transactions to the blockchain using cardano-wallet. Everything seems to be fine when we do so. cardano-wallet returns a 202 indicating success along with a transaction id and everything else you would expect. However, when we go check the blockchain explorer for the tx it isn't there. As you might expect, the chain never reflects the change (customers don't receive what we send them).
The only thing we see in the logs is that sometime after sending the tx the cardano node will provide the TraceMempoolRemoveTxs error. Here is he full line from the node:
cardano-node-1    | [c7e60f27:cardano.node.Mempool:Info:59] [2021-11-24 20:24:55.43 UTC] fromList [("txs",Array [Object (fromList [("txid",String "txid: TxId {_unTxId = SafeHash \"53625bb985197b9af7e41b12449f70666dcebf8fe9afc65dae29557b31d02d14\"}")])]),("mempoolSize",Object (fromList [("bytes",Number 0.0),("numTxs",Number 0.0)])),("kind",String "TraceMempoolRemoveTxs")]

Now, this event occurs more often than not, but it does not always occur. Sometimes our transactions successfully make it through to the blockchain. We can find no clear pattern on when they do or not.
Does anyone know what is happening here or how we can deal with it?

HTTP code 202 does not mean success. It means "The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place."

This occurred because our time_to_live in the transaction was too low. The recommended value in iohk documentation is 10 which is woefully inadequate. If this is happening to you bump this up. We set ours to 300 which has been working great.


text:
The Plutus script evaluation failed
Running into this error when attempting to build a tx.
Command failed: transaction build  Error: The following scripts have execution failures:
the script for transaction input 1 (in the order of the TxIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 6228000431
| mem: -2515
})
Script debugging logs:
the script for policyId 0 (in the order of the PolicyIds) failed with:
The Plutus script evaluation failed: An error has occurred:  User error:
The budget was overspent. Final negative state: ({ cpu: 6209175329
| mem: -4312
})```

Any ideas for how to solve it?

Had to use cardano-cli transaction build-raw and set my scripts to use more memory and cpu via the following flags (for example):
--tx-in-execution-units="(5000000000, 5000000)" \
   ...
--mint-execution-units="(5000000000, 5000000)" \

I used the following divisions as they add up to the maximum tx mem and cpu units for testnet (as of 11/24/2021) and split the units halfway between both of them, since both scripts were failing.


text:
How to deploy a marlowe smart contract on cardano
I'm  a beginner, I have the haskell code and I wnat to know the following steps, I couldn't find specific information how can i deploy a smart contract on the mainet or testnet.

Submitting transactions on Cardano is a bit like submitting your taxes to the federal agency. The agency won’t tell you how to compile the documents and how to calculate the amount due, but it will check them and tell you if you did something wrong (actually only if the mistake is at their disadvantage. It is not a perfect analogy).
The Cardano blockchain is this federal agency. It will check the transaction and validate the smart contracts. But is has no knowledge of how to construct this transaction. This logic is implemented in your off-chain code. This code is as the name says never deployed to the blockchain. It needs to be executed by someone, though. In a centralized service it is usually the server backend of the party that provides the service. But you can also make the off-chain scripts publicly available so that anyone can use them.

Here is a tutorial that should help you get started with executing your Plutus script.
Plutus scripts are not actually "deployed" to the blockchain, rather once they are serialised to Plutus (from Haskell or other languages) they are used to generate script address and then are submitted to the generated address in a transaction.
The tutorial should walk you thought on how to submit transaction once you have serialised plutus script.

The question was about Marlowe, not Plutus, and I have the same question.  It is really hard to understand why simple things seem so difficult.  Is there any way, in Feb 2022, to enter into even the simplest possible financial contract with somebody else, without writing your own Plutus script?  Thanks :)

Here are lectures that explain the process of running Marlowe contracts on the Cardano blockchain. The third lecture includes a step-by-step example.

authors: موقع شقق العقاري


text:
Advantages and data load sharing of blockchain tech for consumer applications
I want to have an application developped (for on pc) and actually I have several questions about blockchain advantages for this purpose and more.
My blockchain of preference is naturally, Cardano.
I'm not pc tech savvy myself so pardon me if the questions might seem a bit daft to you.
The way I vision it is that blockchain is a kind of hyve technology and every point (node) in the chain communicates to each other and is actually one but at the same time many and at many places (decentralized) and so increases security and shares in the data transference / a.k.a. load.
This last part is important for me to understand so as to find out if and how I can best use Cardano blockchain for the desired application.
When I launch a pc application, normally I will need to use servers to have the ability to scale horizontally and/or vertically to make available the application for download as well as updates, etcetera.

Is it correct to assume that when I have the application build on blockchain, that when people dowload / install it for use, that because of the blockchain tech, basically the downloads / updates and more will or can be shared by the network as a whole? And therefore
diminishing or making obsolete the entire use of servers in the traditional way?

What other advantages might you get by building applications on blockchain rather than the traditional way?

The number of languages and manners through which one can build on Cardano is a bit dizzying to me. I understand that Haskell is quite a big deal to use and that most developers are not equipped to use this language.
Therefore, what can you, the community advise on how to build on Cardano in the most reachable way?

The application I'm seeking to have built, has got to do with privacy and security.
Since blockchain seems to be very good at reading and logging data, can a privacy & security app really keep people's stuff private on the Cardano blockchain?

So this covers my questions and I hope the community can be of assistance.
Thank you very much.

1.) So you would never have an app stored on the blockchain that clients download. By that I mean, you are not going to be able to store an executable on the chain. Instead you are more than likely going to build a smart contract script on the chain and build a interface (that is not on chain) to interact with it.
For an example of this, let's look at NFTs. NFTs are generally made for (but not limited to) images. These images are not actually stored on the blockchain. What is stored on the chain is a signed hashing of the image with a link pointing to the image. This meaning the image itself is not on the blockchain, as this would make the chain incredibly large. This process is significant because it allows someone to create an original copy of an image and the world can verify it.
In summary, servers still have a place in application architecture for blockchain applications.
2.) There are a lot of potential advantages. The biggest being an immutable public ledger.
3.) I would point someone to the Cardano Developer Portal.
4.) I couldn't answer this without a lot more details on what is trying to be accomplished. I would just say to think of blockchain as a public ledger and not a database.
I hope this is helpful! Welcome to the community!

authors: บุญจันทร์ สว่างบ้าน


text:
How can I get my public wallet address for tax software?
ADA addresses that start in:
Ae2
DdzFF
addr1

are supported by accointing.com -> to submit tax reports.
The address I get (in Daedalus) is acct_
Can I turn the acct_ into one of the other formats?

I would guess acct_ is the address of your stake key, therefore belongs to the account ledger.
For payments, you would need to gather each of your payment addresses (these prefixes you shared) one by one.
If you tax software supports only payment addresses, it will omit rewards, which might or might not be a problem depending on your jurisdiction.

Ouch, this could be quiet a process. Is there some central mechanism to query this?

Check out blockfrost.io, it might help you if you do not want to run the node with the db-sync stack.

authors: 金匙室內設計工程有限公司


text:
Stake pool blockchain sync is incredibly slow
Has anyone synced a node lately? It has been 3 days and I've only reached 75% of the tip. This is much slower than a few months ago. I'm currently only connected to the IOHK North America relay with a valency of 3.

This is expected, depending on your hardware, mostly CPU and disk speed, it can take some time.
Cardano mainnet launched about 4 years ago, but just in the last 3 months, the storage taken by the db synced chain has doubled from 30G to 60G.


text:
Is there any script or smart contract which send tokens?
I wondering if is there any script o smart contract example which when i send X ada to a wallet after i receive a native token

You can do this with multisignatures (no smart contract required). Because of how flexible the (e)UTXO model is, it's possible to construct a transaction that spends from two different addresses, as long as both of the parties involved sign the transaction with their signing key. Imagine party A has 10 ADA, and party B has 1 native asset lets call it XDA, the aim is for party A to buy one XDA from party B in exchange for 10 ADA.
Party A: build Tx with their own utxos as input, and as output they set 10 ADA to party B, and then they add another input using the UTXO of party B, and as output they set 1 XDA to party A address. So you get a transaction like so:
INPUTS
  partyAUtxo [containing ADA]
  partyBUtxo [containing XDA]

OUTPUTS
  10 ADA -> partyBAddress
  1  XDA -> partyAAddress

party A now signs this transaction and sends the serialized signed transaction to party B. Now party B verifies that the trade seems fair (simply checking the price is fair or whatever), signs it with their keys and submits the transaction to the blockchain.
This constructs an atomic swap in a SINGLE TX, which would require two transactions if using a smart contract (lock, and unlock).
I would include the code here, but it'd require quite a bit of code to give you a working demo so I can just guide you to checkout cardano-serialization-lib, and Nami wallet - these two libraries/APIs provide all of the above functionality in terms of getting UTXOs, constructing transactions from UTXOs with custom outputs, building/serializing the transaction, signing it with a wallet, and submitting a transaction to Blockfrost. If I get a simple demonstration of this in action soon I will update here.

There are no such example that I know of, but you can create one, by monitoring an incoming address for new transaction and trigger a faucet server, something like cardano-faucet.
If you are looking for a smart contract and not a federated solution, you are probably thinking about a token swap.
In the Plutus Pioneer Program, the Lecture #10 explains an uniswap contract, which might be helpful to you.


text:
Yoroi Chrome plugin wallet is not syncing
My Yoroi wallet is not syncing even after running Resync Wallet. It has been many days and the wallet seems to not have made any progress. Is complete restoration the only way out of this?

This is probably a problem with Emurgo servers. You might want to reach out to their support at their website.
Scam warning: never, never, NEVER trust anyone on social media, always go to the Yoroi official site to reach their suport.

Their backend is probably down, in the meantime you can use your recovery phrase to restore your wallet on another platform, like Daedalus or Adalite.io


text:
Why Ouroboros Chronos and Proof-of-History need synchronization of time?
Which problem is solved if the time is synchronized between nodes?
I know of two protocols which implement time synchronization: Ouroboros Chronos and Proof-of-History, how do they differ?

Having an internal clock greatly reduces the overhead for block propagation, as it would allow for a more forward, almost "UDP"-like, block stream. Nodes are then able to order blocks locally, rather than having to wait for sequential sharing of blocks.
The Ouroboros Chronos paper was submitted in July of 2019. https://eprint.iacr.org/2019/838.pdf
Solana Proof of History went live on Mainnet Beta mid-2020.
In my limited (non-PhD) understanding, both allow for the aforementioned internal clock, but are designed for completely different ledger styles (UTXO vs Accounts). Both allow for great increases in block-prop time.

In classic PoS there was a block "drift" consensus element that was needed to help properly order blocks.
A block-chain can be viewed as a set of sequential time-stamps moving from the past to the future, but if the nodes making the blocks dont have synchronized clocks time stamps can be out of order.
Block "a" being at time "t" while block "a + 1" is at time "t - 1" is tricky to manage, especially if people might try to front run or pre-compute valid block-hashes to create forks.  Like I said there was often a +/- drift factor and if block timestamps were outside of that the block might be rejected.  Blocks with inverse timestamps could have odd effects like messing up block difficulty Targets and make the chain run too fast or too slow etc.
I dont know Ouroboros well enough to know how critical time is, but its a really good thing to have consensus over ordering of blocks and transactions, and this becomes especially important where blocks are potentially coming every few seconds or even less.

Doesn't Ouroboros (Ouroboros Genesis and Ouroboros Praos) already have a consensus mechanism for ordering of blocks in a form of slot number? As I understand each newly produced block has a slot number, which acts as a timestamp.

A slot is every one second.  So if my clock and your clock are running at slightly different speeds, after some time we may disagree what slot it is now.  This could result in the node with the faster clock, creating a block at a future time from the relative perspective of the node with the slower clock.  Or the reverse where a block is created in a slot before a block that comes after it.  Does that really cause a problem, Im not sure, but avoiding it seems like a benefit.


text:
Will Hydra protocol implementation require changes in consensus protocol (Ouroboros)?
As I understand Hydra protocol has two main components:

Hydra Head protocol
Hydra Interhead protocol

Does any of these components require changes to current consensus protocol? If not, how will it be implemented? My guess is as a smart contract + some network communication protocol (possibly p2p).

No.
Hydra is a layer-two solution which works "on top of" Cardano. A hydra-node which implements the Hydra Head protocol will run alongside the cardano-node and provide an isomorphic state channel which has the same transaction format and ledger rules as Cardano, but with a much simpler consensus. The fact that not the whole network needs to agree to reach consensus in a single Hydra Head, but only the participants of a particular Head, makes this faster & cheaper than to process transactions on the mainchain.

Small addition: while it may not require changes in the current consensus protocol, Hydra makes heavy use of Plutus smart validators and it may require changes in the Plutus core built-ins to cope with fancy crypto and fancy structures used to manage the Hydra head on-chain state.

Also, as I understand it, Hydra subnetworks will be capable of their own consensus/trust models, as well as their own ledger models.


text:
how can i show my minted NFT images on cardano testnet
this my minted nft address

https://testnet.cardanoscan.io/transaction/38415ba47ba757b5ccb7240962fc064be56850b19f820e9a837aeed6e56e8081?tab=utxo

Now i wants to show these minted NFT Images to any testnet marketplace if i want to create my own marketplace then how should i display my minted nfts there
or is there anyway to show nfts images to wallet like solana wallet

Also you can fetch all the assets in your wallet using the  BlockFrost Api https://blockfrost.io/, and then set the image src in you HTML to the corresponding IPFS URL.

Adatools has a way to display minted NFTs on the Testnet:
https://testnet.adatools.io/nft

Nami wallet can switch between testnet and mainnet in the settings:

And it also supports visualising your NFTs, though the NFTs I have aren't image files so Nami doesn't load them properly. If the NFT was minted with proper metadata, and contains an image, Nami will load the image from IPFS in place of the big "T" here:


text:
What kind of dapps can scale using hydra?
I've been reading through the paper on the hydra protocol and seems to have a lot of nice properties. However, what isn't directly clear from the paper is in what kinds of dApps hydra could help scale.
There seems to me to be a couple of limits (please add/debate the list)

All head members must be online
A head member can force the head to be closed
resource heavy? Could I run a head on a mobile phone?

Let consider NFT-maker/pro as an example application. Could they use hydra to
lower the NFT minting fees? The buyers of the NFTs are on the mainchain so setting up an entire head for one transaction isn't reasonable.
What kind of apps would hydra be able to scale?

You may want to read (and contribute to) the discussion happening here: https://github.com/input-output-hk/hydra-poc/discussions/113

Great link, thanks!

Keep in mind that Hydra is a whole suite of protocols, some of which are still in the research phase.
On Hydra Head specifically, you can think of it as a protocol for creating and maintaining fully composable and dynamically available state machines between willing participants, with snapshots being periodically committed to the CSL.
Participants of the Hydra Head are analogous to SPOs; except they are tasked with maintaining consensus only on the state of the head. Depending on the size, scope, and function of each head, the consensus and ledger mechanics may greatly differ between some head protocols, but will nevertheless be settle-able on the main chain. Additionally, the Hydra Inter-head paper describes ways to create channels between heads without having to close them or pre-settle on the CSL.
Hydra Tail is an upcoming paper that, according to the having-read-about-it-long-ago whispers of my mind, describes how individual head participants can offer centralized services to individuals. (i.e. I, as a lone L2 state operator, can offer you and many others some sort of service on my machines).
People with thin clients/mobile devices in remote regions would be able to transact through a single or small handful of trusted operators.
This would in effect, create the first fully interoperable stack of protocols across the ENTIRE length of the THROUGHPUT -------- DECENTRALIZATION spectrum. For the first time ever, we'd have a family of protocols that make the security of a decentralized settlement layer and the throughput of a centralized compute layer interoperable.

Ah, I see, I will have to do some further reading. :)

Is there any paper (or other detailed description) available for the Hydra Tail protocol?

Not yet. So far, papers have been publish about heads, and about cross-head communication.


text:
How to mint a NFT with a policy of Multiple key-hash with Nami Wallet and Cardano Serialization Lib
I am building a daap and i want the user to be able to mint their app-tokens but the policy of the token must include the signature of the app wallet as well, for this I did the policy with the following code: where appKeyHash and clientKeyHash are the respective hashes for client and app addresses
const nativeScripts = Loader.Cardano.NativeScripts.new();
  const script = Loader.Cardano.ScriptPubkey.new(clientKeyHash);
  const nativeScript = Loader.Cardano.NativeScript.new_script_pubkey(script);
  const appScript = Loader.Cardano.ScriptPubkey.new(appKeyHash);
  const appNativeScript =
    Loader.Cardano.NativeScript.new_script_pubkey(appScript);

  const lockScript = Loader.Cardano.NativeScript.new_timelock_expiry(
    Loader.Cardano.TimelockExpiry.new(ttl)
  );
  nativeScripts.add(nativeScript);
  nativeScripts.add(appNativeScript);
  nativeScripts.add(lockScript);

  const finalScript = Loader.Cardano.NativeScript.new_script_all(
    Loader.Cardano.ScriptAll.new(nativeScripts)
  );
  const policyId = Buffer.from(
    Loader.Cardano.ScriptHash.from_bytes(
      finalScript.hash().to_bytes()
    ).to_bytes(),
    "hex"
  ).toString("hex");

Then I do all the transaction fee calculation and use Nami wallet to partial-sign the Tx (in the client side). Then I send to my backend the partial-signed transaction, and I add one vkeywitness using the private key of the app and Cardano-Serialization-Lib with the following code:
 const tx = CardanoWasm.Transaction.from_bytes(Buffer.from(txString, "hex"));
const body = tx.body();
const txHash = CardanoWasm.hash_transaction(body);
const txWitnesses = tx.witness_set();
const txVkeys = txWitnesses.vkeys();
const txScripts = txWitnesses.native_scripts();

const addWitnesses = CardanoWasm.TransactionWitnessSet.new();
const vkeyWitnesses = CardanoWasm.Vkeywitnesses.new();

const vkeyWitness = CardanoWasm.make_vkey_witness(txHash, prvKey);
vkeyWitnesses.add(vkeyWitness);
addWitnesses.set_vkeys(vkeyWitnesses);
const addVkeys = addWitnesses.vkeys();
const addScripts = addWitnesses.native_scripts();

const totalVkeys = CardanoWasm.Vkeywitnesses.new();
const totalScripts = CardanoWasm.NativeScripts.new();
if (txVkeys) {
  for (let i = 0; i < txVkeys.len(); i++) {
    totalVkeys.add(txVkeys.get(i));
  }
}
if (txScripts) {
  for (let i = 0; i < txScripts.len(); i++) {
    totalScripts.add(txScripts.get(i));
  }
}
if (addVkeys) {
  for (let i = 0; i < addVkeys.len(); i++) {
    totalVkeys.add(addVkeys.get(i));
  }
}
if (addScripts) {
  for (let i = 0; i < addScripts.len(); i++) {
    totalScripts.add(addScripts.get(i));
  }
}
const totalWitnesses = CardanoWasm.TransactionWitnessSet.new();
totalWitnesses.set_vkeys(totalVkeys);
totalWitnesses.set_native_scripts(totalScripts);
const signedTx = CardanoWasm.Transaction.new(
  tx.body(),
  totalWitnesses,
  tx.auxiliary_data()
);

Where tx is the hex-CBOR transaction i get from my front end (with the front-end witnessvkey already attached)
But when i try to send it i get the following error :
"transaction submit error ShelleyTxValidationError ShelleyBasedEraAlonzo (ApplyTxError [UtxowFailure (WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash \"afae51e0836484a4196a3ef11018ab78990008df6459e70f7db6cfb4\"]))),UtxowFailure (WrappedShelleyEraFailure (UtxoFailure (FeeTooSmallUTxO (Coin 187325) (Coin 187193))))])"

The first error its because i am not correctly validating the transaction, the seccond is because the fees go up a little because I added one extra signature. I am not worried about the seccond error, what i do not underestand is
why is happening the first error:
WrappedShelleyEraFailure (ScriptWitnessNotValidatingUTXOW (fromList [ScriptHash \"afae51e0836484a4196a3ef11018ab78990008df6459e70f7db6cfb4\"])))

Even if i signed the Tx with the correponding privakekeys ?

Can you share the body of minting nft. I am also facing this issue. I have done from the cardano-cli but i want to make it within react project and want to use nami wallet for minting that user can do from his wallet. If its possible or you can help in this?

After days of searching I finally found my mistake: I was tryng to do the signing from backend, so I needed to generate the prvKey for this I followed the instructions provided in Cardano Serialization Lib, my code was
const Bip32PrivateKey =
  "xprv1wrgj3q60pxt5uq094h6f9nj00jx4hrwddgqrnv632a86llc94egpkn77l9mg9ewham96309yj6yv4zdsdr05flv6xsntjgcgj3pfp59ef589a87gen99t4ru5jhnfm4ar0tvlry4guz6l95tnjcjtnf4jv3rf52k";
const prvKeyBip32 = CardanoWasm.Bip32PrivateKey.from_bech32(Bip32PrivateKey);

function harden(num) {
  return 0x80000000 + num;
}

const rootKey = CardanoWasm.Bip32PrivateKey.from_bech32(Bip32PrivateKey);
const accountKey = rootKey
  .derive(harden(1852)) // purpose
  .derive(harden(1815)) // coin type
  .derive(harden(0)); // account #0

const utxoPubKey = accountKey
  .derive(0) // external
  .derive(0)
  .to_public();

const stakeKey = accountKey
  .derive(2) // chimeric
  .derive(0)
  .to_public();

const baseAddr = CardanoWasm.BaseAddress.new(
  CardanoWasm.NetworkInfo.testnet().network_id(),
  CardanoWasm.StakeCredential.from_keyhash(utxoPubKey.to_raw_key().hash()),
  CardanoWasm.StakeCredential.from_keyhash(stakeKey.to_raw_key().hash())
);

const prvKey = rootKey.to_raw_key();

And I was trying to sign with prvKey, for a UTXO in baseAddr, that did not work, but if O do
const prvKey = accountKey
  .derive(0)
  .derive(0)
  .to_raw_key();

Then I can sign and submit the tx for UTXOs in the baseAddr.

There seems to be a bug on @emurgo/cardano-serialization-lib end related to the issue that you are facing, submitted here

Thank  you andy! but i am afraid that that bug seems to be related with the fees and not with the signing. I tried to find the issue in my code, running a simpler Tx and sending using Blockfrost. but that did not for the same issue, so i think i am doing something wrong in the signing. Could  you please share the code that you use to sign? In the reported bug you show above  the only issue is the fees, so validation is working fine! Or maybe the fact that I am signing with a private key i got from my 24 words recovery phrase.

This is not a particularly trivial task, as we faced it today! I can't tell exactly what is off about your code, but it's possibly something very minor. I've noticed that the JS -> WASM handover can cause some weird type confusion for example if you pass a TimelockExpiry object into txBuilder.set_ttl it will actually set it to 0. It's very easy to make mistakes!
I can however offer an example that we tested and is working, based off some existing code we had as well as andycandy's example on the Github Issue. You can find the Gist here (hopefully it will help you figure out what is wrong with your code!):
https://gist.github.com/lovalabs/83d08796ab9ff65cbf188fbca8d03343
Note that we're in the process of releasing a minting SDK for cardano-serialization-lib that will be wrap around these low-level details and make minting assets much easier. Since the version of csl this is based off is still in beta, we're waiting for it to be stable before releasing.
EDIT:
After some further testing I've discovered that there may be a bug in the TransactionBuilder implementation of build() vs build_tx() which could be the reason for your error. When I do this:
const tx = txBuilder.build_tx()

I don't get a ScriptWitnessNotValidatingUTXOW error. But if I do this:
const txBody = txBuilder.build()
const tx = S.Transaction.new(
        txBody,
        txWitnessSet,
        auxiliaryData
)

Then I do get a ScriptWitnessNotValidatingUTXOW error. Will investigate further before raising an issue on Github though perhaps you could confirm this.

Thank you so much i dont see the method txBuilder.build_tx(), i think as you said the bug could be there... What version are you using?

I got to see that i added the vkey correctly ...  but it does not match with the one in the transaction that i sent. I change all my code to only do a simple transaction. and yet i cant do it. I do not know what is the problem

There might be an issue with the policy id generated in your first code block.
The hash function on NativeScript should take a namespace parameter (see here https://github.com/Emurgo/cardano-serialization-lib/blob/3e5dc377829d1ba46348713196b35476d8604bd9/rust/pkg/cardano_serialization_lib.js.flow#L2699),
that is prepended when calculating the hash (see here https://github.com/Emurgo/cardano-serialization-lib/blob/da6eba20a5ffab2eeae1b1823c26ee67b1426f42/rust/src/lib.rs#L1629)
Try adding the zero like this:
const nativeScript = CardanoWasm.NativeScript.new_script_all(CardanoWasm.ScriptAll.new(nativeScripts))

const policyId = Buffer.from(nativeScript.hash(0).to_bytes()).toString('hex');

instead of this part:
const finalScript = Loader.Cardano.NativeScript.new_script_all(
  Loader.Cardano.ScriptAll.new(nativeScripts)
);
const policyId = Buffer.from(
  Loader.Cardano.ScriptHash.from_bytes(
    finalScript.hash().to_bytes()
  ).to_bytes(),
  "hex"
).toString("hex");

No I dont think so. If I quit one address and left only one and sign with nami ot works.. the problem is related to the signing off-line with cardano serialization lib... I can not do it ! I tried with a simpler tx and is giving me the same error

Hm then maybe the error might not be in the code posted here, but in-between, where you 1) create the transaction in the frontend, 2) cbor / hex encode it for sending to the backend and then 3) decode the payload there.
Maybe you could just verify the whole thing works by testing it only in the frontend first incl. the cbor + hex encoding / decoding etc.
Maybe something like this:

const signedTx = CardanoWasm.Transaction.new(...); const txhex = toHex(cbor.encode(signedTx.to_bytes())); const payload = { txhex }; // -> This payload would be sent to the backend, but now test in frontend const hexDecode = cbor.decode(fromHex(payload.txhex)); const txFromBytes = CardanoWasm.Transaction.from_bytes(hexDecode); let witnessSet = txFromBytes.witness_set(); let witnesses = ws.vkeys(); witnesses.add(scriptWitness); witnessSet.set_vkeys(witnesses); witnessSet.set_native_scripts(nativeScripts); // ...


text:
How do I learn Plutus
I am having a hard time learning plutus the all of the plutus pioneer code doesn't work anymore due to rapid expansion of the plutus librarys. What other paths are out there for me to learn this skill in a more relevant state?

Take a look on this: https://cardano.stackexchange.com/questions/4444/i-am-completely-new-to-cardano-eco-system-to-learn-it-from-the-absolute-basic

You can start learning from here
https://github.com/iohkedu/haskell-2020
the course is an introduction to Haskell and Block-Chain.
Also try to first learn Haskell as well as how to use Cabal, I highly recommend to learn all these tools before jumping into Plutus.

all of the plutus pioneer code doesn't work anymore

For each week, you can look at the SHA for the version of Plutus they are using. You can check out that version of Plutus (via git) before running nix-shell (you probably can't use the Dev Docker image for the PPP homework).
Other than that, I'd recommend three things:

Go through all the Plutus Pioneer Program lectures and homework. You don't need to understand everything the first time, but get comfortable reading the code and general concepts.
Give yourself additional challenges that are simple enough to stay engaged. It's easy to bite off too much. Variations on the PPP code is a great place to start.
Try to answer questions here on the StackExchange that you want to understand. Every bit helps, especially since the community is still young.

If you want to learn Plutus you must have a solid understanding of Haskell, the resource that Alicia pointed is really a good starting point. Very likely in Q1 2022, there will be another iteration of the Plutus Pioneer program which will be taught using the PAB (set a reminder for this, here ). Now, if you really can't wait, go over the iteration #2 on YouTube and make sure to  cabal build Plutus with the tag that was working about 4 months ago, you can have a look at Gimbalabs, to get around this.


text:
I'm getting errors in Week05 Solution.hs
Im trying to run Week05's home work solution 1 on the online plutus playground enviornment but I keep getting errors in lines 79 to 84 dose anybody know how to fix this?
code pasted below along with errors
endpoints :: Contract () SignedSchema Text ()
endpoints = mint' >> endpoints
  where
    mint' = endpoint @"mint" >>= mint

errors
Compilation Error, Line 80, Column 13 (jump)

 error:
    * Couldn't match type `(->) (a0 -> Contract w0 s0 e0 b0)'
                     with `Contract () SignedSchema Text'
      Expected type: Contract () SignedSchema Text ()
        Actual type: (a0 -> Contract w0 s0 e0 b0) -> ()
    * Probable cause: `(>>)' is applied to too few arguments
      In the expression: mint' >> endpoints
      In an equation for `endpoints':
          endpoints
            = mint' >> endpoints
            where
                mint' = endpoint @"mint" >>= mint
   |
80 | endpoints = mint' >> endpoints
   |             ^^^^^^^^^^^^^^^^^^

Compilation Error, Line 80, Column 22 (jump)

 error:
    * Couldn't match type `Contract () SignedSchema Text'
                     with `(->) (a0 -> Contract w0 s0 e0 b0)'
      Expected type: (a0 -> Contract w0 s0 e0 b0) -> ()
        Actual type: Contract () SignedSchema Text ()
    * In the second argument of `(>>)', namely `endpoints'
      In the expression: mint' >> endpoints
      In an equation for `endpoints':
          endpoints
            = mint' >> endpoints
            where
                mint' = endpoint @"mint" >>= mint
   |
80 | endpoints = mint' >> endpoints
   |                      ^^^^^^^^^

Compilation Error, Line 82, Column 13 (jump)

 error:
    * Couldn't match type `Promise w s e b' with `MintParams'
      Expected type: (a -> Contract w s e b) -> MintParams
        Actual type: (a -> Contract w s e b) -> Promise w s e b
    * In the first argument of `(>>=)', namely `endpoint @"mint"'
      In the expression: endpoint @"mint" >>= mint
      In an equation for mint': mint' = endpoint @"mint" >>= mint
    * Relevant bindings include
        mint' :: (a -> Contract w s e b) -> ()
          (bound at /tmp/web-ghc-work-5bba159ebc709aaf/Main.hs:82:5)
   |
82 |     mint' = endpoint @"mint" >>= mint
   |             ^^^^^^^^^^^^^^^^

Compilation Error, Line 82, Column 34 (jump)

 error:
    * Couldn't match type `Contract w1 SignedSchema Text'
                     with `(->) (a -> Contract w s e b)'
      Expected type: MintParams -> (a -> Contract w s e b) -> ()
        Actual type: MintParams -> Contract w1 SignedSchema Text ()
    * In the second argument of `(>>=)', namely `mint'
      In the expression: endpoint @"mint" >>= mint
      In an equation for mint': mint' = endpoint @"mint" >>= mint
    * Relevant bindings include
        mint' :: (a -> Contract w s e b) -> ()
          (bound at /tmp/web-ghc-work-5bba159ebc709aaf/Main.hs:82:5)
   |
82 |     mint' = endpoint @"mint" >>= mint
   |

                           ^^^^

It is because endpoint has changed according to:
https://youtu.be/zW3D2iM5uVg?t=1218
You need to use an older version of Plutus Playground which comes together with plutus commit which was in lecture 5. You will need to start it locally.
So in general you will need to do checkout https://github.com/input-output-hk/plutus at the same commit which is https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week05/cabal.project#L28 but this commit is not present anymore so you can use this instead a5e7a257706c7f5fdab17dbd16683c2390c3ab95 and to start plutus-playground server and client like it is described in Readme for Week1 https://github.com/input-output-hk/plutus-pioneer-program
or you can try to change
endpoints = mint' >> endpoints
  where
    mint' = endpoint @"mint" >>= mint

to:
endpoints = forever
          $ handleError logError
          $ awaitPromise
          $ endpoint @"mint" $ mint


text:
Mnemonic seed from signing and verification key?
I followed an iohk tutorial for minting native assets. The result is that I have a eutxo with the assets, but not enough ada in the eutxo to send them out. I added more ada to the wallet, but the process they describe limits your interaction to the eutxo.
I'd like to restore this wallet in daedalus to abstract away this work. I have the payment signing key and payment verification key that the tutorial creates, but it never creates a mnemonic seed. Is there a way to restore a wallet in daedalus using these payment signing and verification keys, or to generate a seed from them?
Here is the guide I followed, for reference:
https://developers.cardano.org/docs/native-tokens/minting/

Here is a brief HD infographic describing wallet key generation in Cardano (and other blockchains like Bitcoin).

The Master Seed is derived from a mnemonic phrase pulled from the BIP-39 wordlist.
As such, all possible mnemonic combinations are actually a subset of all possible master seeds. If a master seed is generated raw without the use of mnemonics, it will likely be outside this subset and will not be convertible to a 24 word phrase.
Your best bet would likely be to generate a new set of wallets derived from mnemonic instead of a raw master seed (used in cardano-cli).

There is no other officially supported way for importing into Daedalus other than the one from mnemonic phrase.
There's also no way to generate mnemonic from the preexisting signature keys.
You should top up the address with ada, so that there is enough ada to be included in your outgoing transactions.
There should be at least minUTxOValue (currently 1Ada) included in each transaction.


text:
Where is the best place to start looking for Haskell Developers?
I'm looking to hire developers for a project and most people I speak with have experience with Solidity and therefore trying to convince me to focus on the Ethereum ecosystem.
I like what the Cardano community is doing, especially the Founder's vision and approach, and accordingly want to focus on the Cardano ecosystem. I'm therefore looking for developers with Haskell experience and don't know where to start. Is there an area within the Cardano community to specifically post jobs and recruit individuals desiring to work on Cardano?

Keep doing that^, and they will come.

You can post your opportunities on IOHK discord. There is a #post-a-job channel, under Lounge category.

I find the Haskell to be still rather niche language, meaning not so many developers out there, thus it's difficult to find someone on common boards.
I would agree with the others that it's a good idea to be looking specifically around Cardano, Haskell and functional programming communities

A nice place worth checking is functional.works-hub.com
functionalprogramming.slack has numerous channels for job postings (#jobs, #haskell-jobs)
Cardano official developer community list

The best places to start looking for Haskell developers are Reddit, LinkedIn and StackOverflow – there is at least a hundred of seasoned Haskell developers on those resources.


text:
How can I secure a Datum value in a smart contract?
I am trying to figure out how to write a script where you can make sure the datum value doesn't change each time an output gets consumed. For example, in the auction script in the pioneer program each step along the way someone wants to consume a previous output to up the bid. Suppose you wanted to store some meta deta in the datum and have it carried on the block chain, like a secondary beneficiary, imagine an auction house fee that gets set when the action is created.
Each end point supplies the the datum to be set as the output of the transaction. The endpoint code runs off chain. So it seems that there is no way to set a static datum value, especially for any script which allows the public to access, like an auction.
Is my understanding correct and this is just a limitation of the cardano smart contract?
Thank you in advance

I have a very similar question that could be answered by answering your question. I would be keen to see an answer to your question.

In the on-chain validator script, you can inspect the transaction outputs through the ScriptContext. An output has a datum hash field available. You can then assert that the hash is equal to the hash of the input datum. Ref: https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Contexts.html#t:TxOut

There are multiple ways to do that.
Option 1:
If you have "script-wide" constants, like your mentioned example of an auction house fee, I suggest parameterizing your contract like it is done in Lecture #3 instead of storing that value in each output's datum.
Option 2:
If you really want to ensure some or all of the datum fields are recreated when it is consumed you can do that too. By default for any spending transaction from a script, Plutus expects you to provide the datum value/file whose hash matches the one stored on-chain for the UTxO you're trying to spend in your transaction.
Your validator can check for an output recreated at its own address with a certain value and datum. If the datum shall be the exact same as previously you can simply check if the hash of the newly created output equals the one you're consuming.
Otherwise, you can also provide the datum (not the hash) of the newly created output in the transaction and validate it within the script. You can do that via the CLI by using:
--tx-out ADDRESS VALUE
[--tx-out-datum-embed-file FILE | --tx-out-datum-embed-value JSON VALUE]

or using CSL:
[...]
TransactionOutputBuilder.new()
    .with_address(yourScriptAddress)
    .with_data_hash(hashOfYourNewDatum) // does not include the datum value
    .next()
    .with_value(Value.new(someOutputValueOrMinADA))
    .build()

// Adding transaction datum values
// Must at least include a datum value for every script output that is being
// spent + optionally any additional datums necessary for the script validation
const datums = PlutusList.new();
datums.add(datumBuilder(1));
datums.add(datumBuilder(2));

const transactionWitnessSet = TransactionWitnessSet.new();
transactionWitnessSet.set_plutus_data(datums);
[...]

export const datumBuilder(n: number): PlutusData {
    const fields = PlutusList.new();
      fields.add(PlutusData.new_integer(BigInt.from_str(`${n}`)));
      return PlutusData.new_constr_plutus_data(
          ConstrPlutusData.new(
            BigNum.from_str('0'),
            fields
          )
        );
}

Once, you've added the datum value of the newly created script output to the transaction you can retrieve it in your Plutus code like similarly to any other datum:
[...]
where
    -- returns new outputs of this script
    ownOutputs :: [TxOut]
    ownOutputs = getContinuingOutputs ctx

    -- returns Datum value for a tx output if it is provided
    outputDatum :: TxOut -> Maybe Datum
    outputDatum o = txOutDatumHash o >>= flip findDatum info

Related answers to that topic:

Post 1


text:
What is the difference between "on-chain-metadata" and "metadata" in the Blockfrost Endpoint
I am fetching my assets using the Blockfrost endpoint for a specific asset:
https://docs.blockfrost.io/#tag/Cardano-Assets/paths/~1assets~1{asset}/get
But there are two metadata entries, one for "on-chain metadata" and one only says "metadata", I have read that metadata is also saved off chain. I think it may be the case for the second option, is it the case?

Yes.

onchain_metadata refers to the metadata stored on the Blockchain, according to: CIP0025
metadata refers to off chain metadata, stored on Cardano Token registry


text:
How to connect to Testnet on Blockfrost API with blockfrost-js
I am getting an error connecting to the Blockfrost API with blockfrost-js

"Network token mismatch. Are you using token for the correct network?
See https://docs.blockfrost.io/#section/Available-networks."

I went to blockfrost.io and requested a API key for the testnet, but I still have this error. What to do?

To connect to the Testnet with blockfrost-js initialize it like this:
const API = new BlockFrostAPI({
  projectId: 'YOURAPIKEYFORTESTNET',
  isTestnet: true
});


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

Generate private key from entropy

Use ECDSA to make a public key

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

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

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


text:
Tried minting from transition in StateMachine an got error MintingPolicyNotFound
I changed transition function in Lecture 7 and added constraint for minting Constraints.mustMintValue:
transition ts s r = case (stateValue s, stateData s, r) of
    (v, _, SetPrice p)   | p >= 0           -> Just ( Constraints.mustBeSignedBy (tsSeller ts) <>
                                                      Constraints.mustMintValue (assetClassValue (tsToken ts) 100)
                                                    , State p v
                                                    )

When I start emulator trace monad I am getting error in log:
Slot 00007: *** CONTRACT LOG: "SMCContractError (ConstraintResolutionError (MintingPolicyNotFound aa))"

I tried also with a different currencyPolicy than "aa", the real one that I got from Lecture 5 - Free.hs but I am getting the same result.
What is the proper way to do minting from State Machine?

HI , Did you solve this issue.? I am Facing the same issue

Try adding a lookup specifying a minting policy. Not sure how to do it in the StateMachine context, but elsewhere I did something like: let lookups = Constraints.mintingPolicy (policy oref).

I had this exact same issue with a StateMachine. I solved it by using runStepWith instead of runStep, which allows you to also supply the minting policy.
See the haddock documentation for details on how to use runStepWith


text:
Is there a way to know if your wallet was restored (accessed) without a transaction being made?
In most cases, I would assume that if your wallet is compromised, your funds are going to be stolen and that is how you are going to know it is compromised. However, let's assume a hypothetical threat actor get's your private keys, and then restores the wallet without making any transactions (without stealing). As an example as to why a threat actor might do this, let's assume that you only have 100 Ada in your wallet and they think you'll deposit more into it later on. In other words, they are going to wait it out hoping to steal more.
My question is: Is there currently a way to know if someone has restored/accessed your wallet without them creating a transaction with your keys?
My understanding is that there is not, so if that is true, my next question is: What could be done, potentially a CIP, that could mitigate this?

Cardano uses the Hierarchical Deterministic key generation scheme (specifically that of BIP44-ed25519), which is an offline process that can be done without an internet connection. As such, there is no way to know that your master key has been compromised unless it is used to submit a transaction. However, clever use of NFTs and Plutus scripts enable us to construct a variety of risk-management protocols with associated trade-offs. Even simple constructions as outlined here may be used create highly complex output gaurds.
A super simple example is that of a "death protection" scheme that I use with my family. My primary key is under my secure control, but in the event that key becomes inaccessible, there is a second, highly accessible key that is only unlocked 10 years from now. Here's the JSON formula I use to build the script-address:
{
  "type": "any",
  "scripts":
  [
    {
      "type": "sig",
      "keyHash": "<PRIMARY KEYHASH>"
    },
    {
      "type": "all",
      "scripts":
      [
        {
          "type": "after",
          "slot": <FUTURE SLOT NUMBER>
        },
        {
          "type": "sig",
          "keyHash": "<EMERGENCY KEYHASH>"
        }
      ]
    }
  ]
}

However, no matter the complexity/design of your scheme, a permissionless blockchain without trusted third-parties will NEVER protect you against catastrophic loss of a master secret.
The only real way around this is to admit some form of centralization/third-party authentication. The question then becomes, in what form should such insurances be?
IOHK actually wrote this paper about "proofs-of-ownership" and "secure hidden fallback" mechanisms that may be leveraged for such purposes.
Quick Summary:
A back-up key can be created upstream of the initial key derivation; one that is never used, even for signing transactions. The only time one would use it is to prove ownership of a child signing key. Ideally, such keys would never see the light of a network and would be kept separate from the primary signing keys. These back-up keys can be used to prove ownership of their associated wallets. This can be extremely useful in the event a (side)chain is rolled back due to some massive security flaw, among other scenarios.

Thanks for the response! Do you happen to have a write up of the details of this death protection scheme, I am very interested in that. So the Plutus script time locks were the kind of thing I was envisioning for this type of protection. I was just wondering if there would be a way to build that into the protocol and if it would be worth it. I am more thinking along the lines of proof of access vs proof of ownership. I do understand there is no way to detect offline access.

No problem! I edited the original answer to include the death-protection scheme.

There is no such thing as wallet-restoral or even initialization on the blockchain. These are purely client-side events happening on the device of the user. As such, there is no way to check if someone in the world has setup a wallet with your keys.
However, what follows after a wallet is set up is that it queries the connected node for available funds. I’m pretty sure that a standard node such as the one from Yoroi does not track which funds of which keys have been queried. But in principle this would be the action that would be traceable. If the thief checks your funds on his own node, however, (for example in Daedalus) there is truely no way to trace this.

This is pretty much what my understanding of this was as well. Do you know why there isn't any kind of wallet restoration event recorded on the blockchain? I realize solutions to this could get complicated really quickly but I guess I am wondering if it is a 'not worth the effort' or if there is a technical reason why a restoration event isn't recorded (I also didn't see any other blockchains that do this either). Maybe the additional transaction fees aren't worth this little benefit?

I'd imagine that any sort of "restoration" mechanic poses a massive risk to the legitimacy of a chain because people would abuse it themselves.

@nomad0, could you give an example of abuse for this?

Sorry for not clarifying, I imagine something along the lines of: I pay you for a legitimate product/service, then claim the transaction was unauthorized and attempt to rollback. Many systems can compensate for this, such as you (the vendor) being able to challenge my rollback request. But now we need arbiters, and things get real weird real quick.

Oh yeah that makes a lot of sense. So I am not thinking proof of ownership as much as just proof of access. Thinking along the lines of a wallet is restored and there is a time lock on the use for that specific restoration (not exactly sure how this would work, maybe mac addresses?). This would allow someone to create a watch service that you subscribe to, to know someone restored the wallet. This would give you time to save your funds while the time lock was active.

Jey, you and nomad0 answered the first bold question but the details of the second question are why I chose nomad0 for the answer. He mentioned the use of time-locks with smart contracts as a solution to this. Also, down voting the question because your answer wasn't accepted is not productive.

I have no problem with my answer not being accepted. I did not notice the second part and downvoted the question upon seeing it because together with the accepted answer, I think it is confusing and would mislead someone seeking to understand.

Thanks for the clarification, @Jey. Any suggestions to editing the question to make it less confusing?

authors: Божидар Шопов

authors: 電訊巴打 - 電訊優惠比較平台


text:
Maximum transaction size
As far as I know the maximum transaction size is 16kB including metadata https://github.com/cardano-foundation/CIPs/blob/master/CIP-0009/CIP-0009.md
However, I recently submitted successfully several transactions whose sizes are larger than 16kB (around 20kB). So I am a bit confused. Please help me clarify it.
Thanks

Please add Tx hashes or something we can query the chain with!

The size corresponds to its representation on chain, not the file you are submitting directly.


text:
Difference betwen collectibles items and Assets in Nami Wallet?
I had been forging some NFTs, but all my NFTs are listed in the Collectible Part of the Nami Wallet. Even when i followed the 721 standard reported in the CIP-25 for my on-chain metadata. This makes me wonder, what makes the distinction between Assets and Collectibles for the Nami-Wallet?

This looks to be the correct behavior - nfts are often considered to be collectible items and used in that way.
I've found this in nami wallet, it's looking for an nft metadata attached to the asset, thats what makes it to be visible in Collectibles tab of Nami.


text:
Create a new wallet on public node
I want to create a wallet and use it but I don’t want to run a node locally. I recently found Blockfrost but, I don’t think it has the option to create a wallet. What can I do?

You can always use Yoroi, which is just a browser extension that connects to trusted remote nodes to interface with the chain.
Additionally, if you want to create a wallet in a completely cold, network-isolated fashion, you can use cardano-cli (and/or cardano-wallet) on an airgapped machine.
Section 10 of Coincashew's SPO guide has a neat bash script for creating mnemonic wallets in an airgapped environment. Perhaps it may be of help in your python script!

I'm writing a python script so I don't think a browser extension helps me a lot.

edited to include a sample bash script

Thanks, That was helpful! But Isn't there any public node like Blockforest to give that service?

Wallet/Key generation is an entirely offline process. Even if there was a public entity that offers such a service, it kind of defeats the purpose of generating keys in a secure/cold fashion.

Thanks man. That was helpful.