1

Let's say we have a contract with functions for an online store built on top of the Ethereum blockchain. Whenever a transaction between buyer and seller happens, are new instances of that contract created for each transaction or are all transactions using the same contract?

0

You write the code, so you get to decide this. What you choose will depend on your requirements, but there's certainly no reason you have to use multiple contracts if you don't want to.

0

In your example, all transactions would use the same single instance of a contract. If you had multiple stores, you might consider having each store be a separate contract instance.

  • And what if the value sent by the buyer is not directly transferred to the seller, maybe separately stored on the contract until the buyer receives the product he bought and the event of the buyer receiving the product in turn triggers the value stored in the contract being transferred to the seller? – anonuser1 Mar 4 '18 at 21:09
  • Sounds like your question is about different contract designs. The scenario you describe could be done with one or multiple contracts. From a gas cost perspective, it would typically use more gas to instantiate a new contract per transaction. – eth Mar 11 '18 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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