Questions tagged [on-chain]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

How to generate CBOR hex of plutus smart contract

How can i generate the CBOR hex of a plutus smart contract. Does it requires to generate CBOR of onchain code only or both onchain and offchain? Also if have a smart contract which requires parameters ...
0 votes
1 answer
38 views

How to get all unSpent UTXOs at script address OnChain

Hi i am building CrowdFund where i need to know the total amount raised at the script as an OnChain validation. i was looking at Contexts.findOwnInput but would this only return the tx-in's provided ...
3 votes
1 answer
44 views

How To Verify The Code Of A SmartContract?

There's a lot of talk about open-source code on Cardano, but how can I verify that the SmartContract(s) in a git repo are the actual SmartContracts the project has deployed to the Blockchain? I want ...
1 vote
2 answers
50 views

traceIfFalse is it possible to pass a string not "fixed"

Is this even possible? traceIfFalse ("A"++show(scriptContextTxInfo)) FoundIt As logging onchain is just possible with this traceIfFalse ... I'm not finding a solution to make that line ...
0 votes
1 answer
45 views

Opportunity for theft of funds in Martify marketplace

I am some kinda embarrassed by "mkBuyValidator" in Martify Marketplace on-chain code . For buyer there is only one check for token transfer (on line 68): (valueOf (valuePaidTo info sig) (...
  • 35
0 votes
1 answer
53 views

Whether validation checks are necessary

In Plutonomicon github repo it says by the end of the page: For example, you don't need to prevent an unexpected transaction from locking value away - that's the submitter's own problem - but you do ...
  • 35
0 votes
1 answer
41 views

Workaround for Plutus Scripts that excesses the max Tx Size. Framework or examples for splitted or modular validators?

Im very interested in how you can split the validation in several validator. There is any model or framework to follow? Any example around? Could somebody at least share some words of insights about ...
2 votes
1 answer
281 views

Committing a database to the ledger without storing it on the ledger?

The Cardano blockchain has no global state, this means that shared state needs to be introduced. Is there a design pattern that lets you commit big sets of data to the ledger without storing it? This ...
  • 1,737
3 votes
1 answer
70 views

Is function "isPayToScriptOut" unsafe?

As far as i understood, function "isPayToScriptOut" assumes every output that has a datum hash is a script output. But what if we create new output with datum, assigned to some pub key (for ...
  • 35
0 votes
0 answers
20 views

Interact with the code in blockchain

Correct me if there is any mistake: when the validator code is deployed to the blockchain how the offchain code will interact with it? I don't want to use CLI, I want to use PAB. I know how to deploy ...
0 votes
2 answers
47 views

Providing a list of mappings from datum hashes to values while creating a transaction

I noticed that TxInfo datatype has a txInfoData field which carries a list of mappings from datum hashes to datum values. This seems very useful for validating transactions with multiple input UTxO's. ...
  • 76
3 votes
2 answers
72 views

How to Get the Script Address of A Smart Contract?

Once I have written up the smart contract how to I get the script address value to be able to interact with the script whilst its on chain?
0 votes
1 answer
50 views

How to do on-chain Integer pattern matching?

I want to do Integer pattern matching on-chain but always get an error: GHC Core to PLC plugin: E042:Error: Unsupported feature: Use of Haskell Integer equality, possibly via the Haskell Eq typeclass ...
  • 1,078
0 votes
3 answers
96 views

How to compare BuiltinByteStrings onchain?

I want to check on-chain if a given TokenName is of a specific pattern, for example: aaa1 aaa2 aaa3 I have something like this, but it throws an interpreter exception: checkValidMint :: TokenName -&...
  • 1,078
0 votes
0 answers
22 views

Validator Script with TokenName as Parameter fails compilation

When I compile the on-chain below, the compiler complains GHC Core to PLC plugin: E042:Error: Unsupported feature: Type constructor: GHC.Prim.ByteArray# I don't know what is the problem and how to ...
  • 39
1 vote
1 answer
76 views

How can a validator script be used to mint native tokens, in addition to perform other checks?

Suppose we want a smart contract (validator script) that locks a user' fund (e.g. ADA) that she deposits and releases it back if she withdraws it. Suppose when she deposits some fund into the ...
  • 39
0 votes
2 answers
55 views

Can UTxO sit at a minting policy (currency symbol), like at a validator script address?

Both minting policy and validator script are on-chain code. Validator script can be used to lock fund sitting at its validator script address. A transaction can consume the UTxO only if the validator ...
  • 39
4 votes
2 answers
104 views

How to optimize Plutus smart contracts?

Context I'm creating scripts with hardcoded parameters in my smartcontract and I would like to reduce footprint of them to reduce transaction fees. Right now i'm doing so using parameterized ...
0 votes
1 answer
50 views

How do you Connect ATALA to Plutus Smart Contracts [closed]

I think they use diffrent programming languages, but how can I use DID inside my Plutus contracts?
1 vote
1 answer
42 views

How to know which module to import?

Let's say my smartcontract needs BuiltinData. Quicksearch in documentation reveals that BuiltinData is in: Plutus.V1.Ledger.Api Plutus.V2.Ledger.Api PlutusTx.Builtins.Internal PlutusTx PlutusTx....
2 votes
3 answers
157 views

How to get a base 16 hex BuiltinString from getTxId

I am trying to find a way to inspect the base16 hash from a Tx on-chain using plutus. I get a BuiltinByteString from the txInputs here: getTxIdBBS :: TxInInfo -> BuiltinByteString getTxIdBBS txInfo'...
  • 243
0 votes
2 answers
66 views

Can Queries To the Chain be made From Plutus Smart Contracts?

Considering that Plutus Smart Contracts have two parts (on chain and off chain) is there a way to make Queries to the Cardano Chain in the onchain part of the contract considering that the SC is ...
1 vote
0 answers
57 views

How to use Endpoints and Schema

I doing the PPP but Lars does not cover Endpoints or schema declarations in sufficient detail. I imagine that this is a problem that Plutus devs must overcome, but I cannot find suitable documentation ...
1 vote
1 answer
114 views

How can I configure and send a transaction to the Cardano chain using python

I have written some plutus contracts, but they use parameterisation and the params are gained through a REST API. I am using python3 to interface with the API, but would like to be able to script an ...
0 votes
2 answers
41 views

How do you deploy ready made AI on chain

I have made a bunch of trading bots using python and tensorflow. How do I deploy this stuff on the chain with Plutus? Is this the approach taken by Dr Ben Goetzel at SingularityNet or do they run it ...
0 votes
1 answer
46 views

How to PreSign a transaction

im trying to figure out how to sign a smart contract (SC) and have it put on-chain, where it waits until its validation logic returns True. Edit 1: To clarify what I mean by signing is the private key ...
1 vote
1 answer
64 views

How do Endpoints work?

and cant figure out what Endpoint do (why are they in the code) and most important of all how should I code them. What are the best practices?
0 votes
1 answer
156 views

What is the correct way to compare two instances of Value data type?

Question What is the correct way to compare two instances of Value data type? Context I would like to check if outgoing transaction identified by PubKeyHash has the same Value as Value which was ...
1 vote
1 answer
74 views

Confusion regarding findOwnInput function with on-chain code

Context I was looking for a simple way to get exact TxOut on on-chain code to validate if funds are to be unlocked to correct wallet address. While looking in plutus haddoc I have found this function: ...
3 votes
1 answer
68 views

On-chain and Off-chain code

I've seen the existing similar questions on this topic. I probably still don't get it. So a question: Is it a correct analogy to the JS-Solidity world that the On-chain code corresponds to the ...
1 vote
1 answer
98 views

How to get information about UTxOs which created locking transaction on the on-chain?

I would like to create a smartcontract which makes sure that only the same person who made specific locking transaction can unlock that same specific transaction or to put it into simpler terms if Bob ...
2 votes
2 answers
253 views

How does one check a pool's delegation history?

How does one view addresses that were staking with a specific pool at a specific epoch boundary? If there is any way to view a list of addresses that received staking rewards for a particular block, ...
2 votes
2 answers
275 views

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-...
2 votes
2 answers
74 views

Retrieve only digit from TokenName and use onchain

How can I make the following function to retrieve only digit portion from the TokenName and use it on chain? For example I want to retrieve the number 123 from "AAA123" (TokenName) {-# ...
  • 21
2 votes
1 answer
287 views

Is really any token metadata stored on chain? Or is it the mint TX metadata?

I am aware that offchain metadata is stored using the registration as Cardano Developers portal dictates, my concern is about on-chain metadata. Is really any NFT-metadata stored on-chain? Like ...
1 vote
1 answer
72 views

Does Plutus support floating-point arithmetic for on-chain code?

Plutus provides arithmetic functions for Integers through the modules PlutusTx.Prelude and PlutusTx.Builtins. Are there floating-point arithmetic functions which can be used on chain? If not, why is ...
  • 794
0 votes
1 answer
100 views

How to validate the correctness of another parameterized script address on-chain

I would like to write a factory script that can initialize another parameterized script address by sending it an NFT. The factory validator gets the parameters of the target script as redeemer and has ...
  • 83
2 votes
2 answers
120 views

Is there a way for a validator to get the current time?

Is it possible for a validator to get the current time without it being passed in via the redeemer? My validator is heavily dependent on the time being correct so it would probably be a bad design ...
2 votes
2 answers
140 views

How to parse TokenName to Integer

I have information encoded in the TokenName of an asset. These token names represent integers. According to the Plutus source code, the TokenName is of type BuiltinByteString. How can I parse it to ...
  • 1,419
13 votes
2 answers
485 views

Where is the on-chain code actually stored?

I've just read something that suggests Validators aren't actually kept on the blockchain. To save the space, only the hash of the Validator is kept at the UTxO and users willing to spend it must ...
  • 846