My question revolves around contracts creating subcontracts, and best practices with contract creation.
The Story: I'm creating a tool to help people buy Widgets, Gizmos and Ratchets, all of which are generic commodities. Let's call the tool ACME Industries. Now, ACME doesn't supply the products - other entities send ACME a deposit of ether, along with the prices they charge for each product, and they're listed as sellers. A buyer comes along and clicks on Widgets, chooses from a list of sellers, deposits ether into a contract. Some logic happens and then he gets physical stuff and the seller gets ether and a review with ACME.
The Questions:
ACME Industries is itself a contract (I think) - it has functions like
registerSeller{}
that need to be decentralized and transparent. It also needs to hold mappings likeuint => address[]
. Or can it be just a JS framework for creating contracts (likeacmePurchase{}
)?Should Widgets, Gizmos and Ratchets all have a separate address for contract creation, or should that information be appended to the order data?
Example:
// Product type contained in message
{"value": 555, "sender": "0x0...", "data": {"seller": 23, "product": 2}}
// Product and seller defined by address ether is sent to
{"value": 555, "sender": "0x0..."}
I think I'm having trouble wrapping my head around the fundamental differences in architecture here (versus a centralized transaction database).