4

I am looking for someone to help clarify the 'stacktrace' of interactions that occur when a client interacts with a smart contract.

Clearly, one has to submit a transaction to a miner, who then has to locate the contract by address (by using his/her own local copy of the blockchain?), and complete the computation set out in the contract.

Is the entire contract then re-written once again into the blockchain with the outputs representing the output of the computation that has taken place?

J-B
  • 8,941
  • 16
  • 46
  • 77
billett
  • 1,255
  • 1
  • 12
  • 18

1 Answers1

4

Indeed the miner locates a contract by using their local copy of the blockchain.

Is the entire contract then re-written once again into the blockchain with the outputs representing the output of the computation that has taken place?

Contracts are immutable. But each contract can have a "hard disk", called storage, and that's where the outputs of computations can be written.

Technically:

The web3.js Javascript API Contract Methods are a way to interact with contracts.

JSON-RPC is a lower-level way of interacting with contracts.

eth
  • 85,679
  • 53
  • 285
  • 406
  • Ok thanks - is the storage located within the original block in which the contract was mined? – billett Feb 11 '16 at 20:02
  • Kind of, it's via pointers to trees. Each block has a "state root" which contains accounts. Each account has a "storage root". Overview at http://ethereum.stackexchange.com/questions/268/ethereum-block-architecture – eth Feb 11 '16 at 20:29
  • Fantastic links & description with pictures. +1 – billett Feb 11 '16 at 21:41