0

Basically could someone provide a more technical explanation of this?

It says that it watches(subscribes to) for block headers and when comes in it "through the transactions looking to see if any of them touched our contracts". How does it do this? Does it have to retrieve all the transactions in the block, or is there some clever way for it to know this (a merkle proof or something?)?

It then says "we replay the calls already in the store to refresh any potentially altered data." How do you 'replay a call'? Does that mean it simulates the call, or it fetches the data from the blockchain for every value drizzle is subscribed to?

Lastly (hopefully explaining the above will make this question redundant), how does this scale? If you are watching 100 contract values does that make 100x more calls to the blockchain every block than if you are only subscribed to 1 value?

1 Answer 1

1

Good question! Hope this helps, or starts a discussion.

It says that it watches(subscribes to) for block headers and when comes in it "through the transactions looking to see if any of them touched our contracts". How does it do this? Does it have to retrieve all the transactions in the block, or is there some clever way for it to know this (a merkle proof or something?)?

Nothing so fancy as a Merkle proof. Drizzle maintains a collection of Contracts to watch. When a new block is available, Drizzle filters the blocks' transactions that have those watched contracts in its to or from field. We have to assume state changed for those contract variables and Drizzle will then query the updated value for each contract method it was configured to synchronize.

Lastly (hopefully explaining the above will make this question redundant), how does this scale? If you are watching 100 contract values does that make 100x more calls to the blockchain every block than if you are only subscribed to 1 value?

Drizzle will make a call for all methods of a contract referenced in the to or from field of an new block's transaction. So if you're watching 100 contracts but subscribe to one value in one contract it will only make that one call whenever it contract was dirtied by the transaction.

It's worth noting that these methods being synced are defined as constant methods in the contracts ABI as you evaluate scalability.

Your Answer

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

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