Once the smart contracts are created, how would they be implemented on a case by case basis? Same contract, different case. For example, if the smart contract was for a trainer, how would a contract be applied to a selected date/time for training? I’d imagine the smart contract would be somehow integrated into a calendar? The selection of the date and time would generate a new contract for that specific appointment? If the contract was for something different, such as a project seeking financial support, how would the contract be connected with the project that’s seeking support? How would the projects author begin a contract with specific terms? Would the smart contract identifier then be something like a URL? How would supporters donate and be sure that their donation was connected with the contract for that particular project? I would really like to learn about this to get a better idea of how this technology can be implemented. Thanks in advance.
Depends on how the contract is written.
Payment Plutus contracts are pieces of code that just say yes or no to the question if a transaction from a certain address is allowed. And that address is determined from the hash of the contract itself.
So, you could have some addresses of beneficiaries or something like that hard-coded in the contract. Then, each instance for a specific beneficiary would actually be a different contract with a different hash living on a different address.
Or you could build it in such a way that questions like “For whom?” or “For what?” are recorded in the datum of transactions sent to the contract. Then, all the things for the different people using it would live on the same address. And the contract would ensure that only the correct recipient can withdraw that specific UTxO.
Hello HeptaSean. OK, wow! I have a lot to learn here. Thank you.
It’s interesting to have just learned that the way in which you’d like to implement these smart contracts would govern how you design them. That’s good to learn early on.
It seems like the way that envisioned trying to implement a smart contract in the situation that I have in mind is the latter of the types of solutions that you’ve described. A mechanism that dynamically takes in variables as conditions, and then creates a smart contract structure from those variables.
The part that I’m trying to figure out is how to create that kind of mechanism, and then how it would be integrated into an interface for each party. There would be a party of one that creates the structure and terms, and afterwards multiple parties that would enter into their own contract with the creator of the structure. And once the terms are met, the contracts created by those multiple parties would all execute to the final step.
You did already find https://developers.cardano.org/docs/smart-contracts/? It gives an introduction and links to some of the possible languages in which you could write contracts.
One of the most popular choices recently seems to be: https://aiken-lang.org/fundamentals/getting-started (I’d definitely prefer it to the original Plutus.)
Thank you. I’ll look into that. I’ve also bought a few books, as well.
I’ve looked into what you recommended. And, in regard to Aiken, it’s stated that it’s a new development, a new language, that shouldn’t be put into production yet. What’s your opinion of that statement?
Was written a while ago. From the alternative languages, Aiken arguably has the most active development.
I’d rather take that than taking the huge learning curve and more scattered documentation of Plutus itself. (And the proficiency in the chosen language also has a huge impact if you should use it for production – whatever that means in your case.)
Smart contract development takes weeks and months to learn while tinkering around on the testnets, anyway. And production contracts should be very thoroughly tested on testnet before even considering going live with them on mainnet. So, I personally don’t think it’s such a big problem to try and use the alternative languages.
If you want to start a really big and professional project, it would probably also depend on where you find developers and auditing services for each of the possibilities. Can’t speak to that.
In the context of Marlowe, one would create a template for the contract using Marlowe Playground. Specific contracts would fill in the placeholders for dates, addresses, etc. Any programming language that lets one manipulate JSON could be used, since a Marlowe contract can be serialized as JSON and the program would fill in the blanks before writing the contract.
For Marlowe, each contract is uniquely identified by a UTxO (i.e., a transaction ID followed by an output index). You can browse Marlowe contracts on https://marlowescan.com/ and see the contract IDs there.
One convenient aspect of Marlowe is that one can view the details of the contract (through an explorer like https://marlowescan.com/) and read the contract to make sure the contract is doing what it purports to do, that it is paying the correct parties, etc. That gives participants the information to decide if it is safe for them to interact with the contract.
Here is the link to Marlowe documentation and tutorials: https://docs.marlowe.iohk.io/.
Thank you for your reply. Sorry for the delayed response. I have not given up on this endeavor.
In your reply you stated that a template can be created for the contract via the Marlowe Playground. And that specific contracts would fill in the placeholders for the elements that will vary from contract to contract. And that each contract is identified by a UTxO.
My question is regarding the process involved. Is the template created via the Marlowe Playground what is used to enter the variables for the placeholders, in order to generate specific contracts (after the template is already created)? And then, once that’s done, the contract generated will have a UTxO?
Or am I way off?
Thanks in advance.