I am trying to create a smart contract that holds static data (resembling a paper contract) that is able to be sent around different users (a trade).
The tricky part is that I would like different permissions for different account types such as requiring multiple people to authenticate the transaction (buyer, seller and middle-men).
I am struggling to understand a few basic concepts and overall structure of the smart contracts in solidity.
Do I create a "factory" contract that controls the system and assigns different users a 'role' and based on the role the contract will need to be verified by all the required users of each 'role' before being sent?
Maybe if there is an example I can follow or see or even if someone can sketch a basic diagram on how this would work.
I forgot to mention that as a contract is swapped between users, I am not really interested in any monetary representation to be exchanged.
Best Answer
The contract itself cannot be sent to any particular user. It exists within the block chain and is accessible (its methods can be called) to any peer that synchronizes with that block chain.
All data in an account is publicly available. You won't be able to achieve any proper authentication using only the block chain (you need an secure side channel through which peers convey a shared secret).
What you could do on the other hand is employ secret sharing.
You may have done this already but if not have a look at this demo and a few examples.
You can't really do that since contracts are public. What you can do, is filter users out by their address (check the msg.sender attribute at the beginning of each contract method).
Once deployed, the contract is mined and included in the block chain (it is a transaction after all). Afterwards, everyone accessing the block chain "has" the contract.