I’m trying to understand where actors live. If you define an “actor” in a browser in javascript, and that actor calls a shared function, does that mean I execute ICP code locally on my browser? Or where does that code get executed?
Thanks!
I’m trying to understand where actors live. If you define an “actor” in a browser in javascript, and that actor calls a shared function, does that mean I execute ICP code locally on my browser? Or where does that code get executed?
Thanks!
Breaking this down into two parts:
You’ll have a backend canister that contains a persistent actor instance with public shared methods that form its interface and logic that performs calculations and stores state etc, this runs on the IC replicas/nodes.
You can also have an application frontend, which could be javascript served to the user and executed in their web browser on their local machine; this uses an agent library that lets you easily create actor instances matching your backend canister’s interface, in order to expose the public methods mentioned above. These actor instances are running in the user’s browser, but they’re not executing the backend canister logic, they’re simply providing a convenient framework to make calls to the backend canister/actor from within your frontend javascript.