<p>This is hard to answer without an intricate understanding of the business logic around the vehicle unlocking.</p>
<p>I assume each car has its own smart contract and you want to whitelist a user for a pre-determined time. For simplicity I assume that we're happy for time to be measured in slots, with the business logic working out time-&gt;slots happening off-chain. This would mean all we need to do is send a users identifier to the smart-contract with the time-frame. By checking the users time-frame against the node when unlocking the car you'd be able to limit this to a single transaction like:</p>
<pre><code>{
    user  Address
    start Slot
    end   Slot
}
</code></pre>
<p>Another way to go would be to update a smart contract with Lock and Unlock events setting an Address value and checking this value against the users phone when they attempt to unlock the car. However this would require two transactions and constant internet access to receive the second event.</p>
<p>In terms of transaction spend, one of the perks of Plutus is that you can calculate the cost of a contract up-front and failed transactions don't cost anything. That way you can show the user the fee at the checkout without any surprises. It also means you can prototype this contract and check the cost yourself. As I said without really understanding how you want this contract to work it's difficult to come up with a $$$ value.</p>

CC BY-SA 4.0
2021-08-30T00:46:31.337Z
2021-08-30T00:46:31.337Z
Eddy Schauman-Haigh
<p>I wish to delegate access control with a Phone-As-A-Key DApp for vehicles (for sharing the vehicle, P2P rentals and more).
When delegating access control, the DApp will update a smart contract which needs to be downloaded in the vehicle (so it knows a new user should be whitelisted and so they Phone as a Key will open the vehicle).
Question: how many transactions do you foresee here and what shall the cost be.  Obviously, we cannot have customers (or us) paying large amounts of ADA to delegate access control.</p>

<smart-contract>
Access Control for my company's vehicle
# Access Control for my company's vehicle

(Asked by: username_0 on 2021-08-27)

I wish to delegate access control with a Phone-As-A-Key DApp for vehicles (for sharing the vehicle, P2P rentals and more).
When delegating access control, the DApp will update a smart contract which needs to be downloaded in the vehicle (so it knows a new user should be whitelisted and so they Phone as a Key will open the vehicle).
Question: how many transactions do you foresee here and what shall the cost be. Obviously, we cannot have customers (or us) paying large amounts of ADA to delegate access control.

**Tags:** smart-contract

---

## 1 answers

### Answer by username_1 on 2021-08-30. Score: 0

This is hard to answer without an intricate understanding of the business logic around the vehicle unlocking.
I assume each car has its own smart contract and you want to whitelist a user for a pre-determined time. For simplicity I assume that we're happy for time to be measured in slots, with the business logic working out time->slots happening off-chain. This would mean all we need to do is send a users identifier to the smart-contract with the time-frame. By checking the users time-frame against the node when unlocking the car you'd be able to limit this to a single transaction like:
{
    user  Address
    start Slot
    end   Slot
}

Another way to go would be to update a smart contract with Lock and Unlock events setting an Address value and checking this value against the users phone when they attempt to unlock the car. However this would require two transactions and constant internet access to receive the second event.
In terms of transaction spend, one of the perks of Plutus is that you can calculate the cost of a contract up-front and failed transactions don't cost anything. That way you can show the user the fee at the checkout without any surprises. It also means you can prototype this contract and check the cost yourself. As I said without really understanding how you want this contract to work it's difficult to come up with a $$$ value.


---

