Would any of this functionality be possible?
Originating address should be able to update a list of public addresses able to claim against the smart contract. Is it possible for a smart contract to store such a list or could a smart contract check if an address is trusted by the originating address?
Can notes be added to a transaction and stored on the blockchain to make it easier to audit payments to and from the smart contract?
Would it be possible for the contract to be denominated in dollars so that a payment could be, for example $10? The smart contract could then query a trusted oracle specified when the contract was created to get the current currency conversion. The smart contract would then pay out ADA valued at $10.
Hi Peter, I’m currently working on a prototype that uses Plutus, and I think I can answer some of your questions:
Is it possible for a smart contract to store such a list or could a smart contract check if an address is trusted by the originating address?
Each smart contract is configured by a DataScript, which is stored on the blockchain and can be read by the contract. You can put on the DataScript whatever you want, including numbers, arbitrary strings, public keys, or a list of trusted source/destination/whatever addresses.
Can notes be added to a transaction and stored on the blockchain to make it easier to audit payments to and from the smart contract?
Yes, you can create a DataScript for your smart contract that has a field that is an arbitrary text for you to fill, and if you are going to audit the text manually, you can make the smart contract to ignore the contents of that field. Still, the field will be stored on the blockchain.
Would it be possible for the contract to be denominated in dollars so that a payment could be, for example $10? The smart contract could then query a trusted oracle specified when the contract was created to get the current currency conversion. The smart contract would then pay out ADA valued at $10.
There is some prototype of supported multi-currencies in Plutus, but I’m not sure the machinery for accepting dollars (credit card, bank transfers or any other) will ever be implemented in Plutus, as it seems to be a bit outside the project. If you want to construct a service that sells ADA for USD, you will have to deal with some kind of payment processor or exchange or something like that.
Hi Javier, thanks for the response.
Just to clarify, can the datascript be updated/amended after the contract is created and if so are those versions stored on the blockchain?
In terms of multi-currencies after reading your reply it would be interesting if future cross-chain technologies allowed a smart contract to work in multiple currencies. But in this case I was just thinking of a long term smart contract which pays out in ADA but with the amount of ADA denominated in dollars. So for a certain action a smart contract would specify a payment of $10 worth of ADA rather than X amount of ADA. This would be a way of dealing with the fluctuations in crypto valuations without needing a stable coin. But for this to work the contract would need to obtain the current ADA/dollar ratio. Which is why I was hoping that currency conversion rate oracles would be possible.
Many thanks
Peter
Technically, the datascript is immutable, and once has been put in a block it can’t be modified. In practice, what you can do, is create a smart contract that accepts transactions so that whatever spends the ADA in the contract has to spend it into the same smart contract but with a different datascript. This is what Marlowe does. It keeps its state on a datascript, and on each operation it requires the output to be the same smart contract with a datascript that has a new state that is valid from the current state and the circumstances of the world, following the logic that the smart contract demands.
The old datascript is still there on the blockchain, but it’s associated with an spent output, so it’s effectively there only for historical reasons, as you can only read it back. You can’t modify it or spend it again. Which provides a nice audit trail if that what’s you require.
Now we are talking something different, and it makes more sense. If I were to implement such smart contract, my approach would be providing a DataScript indicating $10 of payment required, and a RedeemerScript with an oracle that says that from slot/block X to slot/block Y the accepted exchange rate is M ADA per USD, and the Smart Contract now has to confirm that in the outputs of the transaction, at least the corresponding part after accounting the exchange rate is being delivered to a specific address.