Questions tagged [on-chain]
The on-chain tag has no usage guidance.
27
questions
0
votes
0
answers
2
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 -&...
0
votes
0
answers
17
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 ...
1
vote
1
answer
32
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 ...
0
votes
1
answer
25
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 ...
3
votes
0
answers
33
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
37
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
22
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
74
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'...
0
votes
2
answers
49
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
44
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
59
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
38
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
0
answers
23
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 ...
0
votes
0
answers
33
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
87
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
51
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
45
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
56
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
166
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
186
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
1
answer
54
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)
{-# ...
2
votes
1
answer
244
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
47
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 ...
0
votes
1
answer
75
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 ...
1
vote
2
answers
86
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
114
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 ...
9
votes
2
answers
324
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 ...