I want to deploy a smart contract for tracing cars. For example, say I am producing 10 cars

Now what I want is to create a smart contract for tracing cars.

So my smart contract will have three features

RegisterCar {





Check Status ( can be called using a specified key from the blockchain)


Features will be



Milage: AcceptOwnership.Milage


currentOwner: transferOwnership.currentOwner(

isOK: Acceptownership.carStatus





Authentication with a private key from the current Owner like a password


** for this part I want to require a passcode from the current owner to be transferred and the passcode needs to be updated when AcceptOwnership is completed.

In acceptOwnership a user can set up the password for transfer ownership.







Any recommendations regarding this?

How do I implement the part TransferOwnership which must ask the user for a passkey

and then in the new owner can set up the transferOwnership Passkey

Thanks in advance

1 Answer 1


You don't need a password system as the user signs the transactions with its private key.

If I understand well your use case you want to :

  1. The current car owner offers to a next car owner his car with transferOwnership.
  2. The next car owner accepts the transaction with acceptOwnership.

One solution would be to use the approve/transferFrom pattern of the ERC721 standard (https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md) :

function approve(address _nextOwner, uint256 _carId) external payable;

This method would play the role of your transferOwnership function and is called by the current car owner.

function transferFrom(address _currentOwner, address _nextOwner, uint256 _carId) external payable;

This method would be the acceptOwnership function and is called by the approved next owner.


You seem to confuse structures and functions.

A car struct would be for example :

struct Car {
uint256 carId;
address carOwner;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.