# FVM Notes ## Full actor deployment flow to a local FVM net The flow is broken up into 2 parts: 1. The actor *code* is deployed to the network. The actor code's handle is its CID 2. A new *instance* of an actor with code [CID] gets deployed to the network ### Start a local network Full instructions [here](https://lotus.filecoin.io/developers/local-network/) For convenience, env vars to set: ``` export LOTUS_PATH=~/.lotus-local-net export LOTUS_MINER_PATH=~/.lotus-miner-local-net export LOTUS_SKIP_GENESIS_CHECK=_yes_ export CGO_CFLAGS_ALLOW="-D__BLST_PORTABLE__" export CGO_CFLAGS="-D__BLST_PORTABLE__" ``` To get the network started (on `experimental/fvm-m2` branch) `lotus daemon` `lotus-miner run --no-ync` To deploy actor code: `lotus chain install-actor <path to wasm>` > Should output: > sending message... gas limit: 1230014237 waiting for message to execute... Actor Code CID: bafk2bzacebinyzouaopuvpn5r55zhzamfvdy3xfvhwvyhn6jrorkqnuljtihk Installed: true To instantiate actor code: `lotus chain create-actor <actor-cid> <encoded-params>` > sending message... waiting for message to execute... ID Address: t01001 Robust Address: t2sfrzvqn4yvgsisn3fguiqhz45fscitdwhfun6oq You have 2 addresses return that are the address of the actors. ### How to get the state of your actor ``` $ lotus state get-actor <your-actor-address> ``` > Address: t01006 Balance: 0 FIL Nonce: 0 Code: bafk2bzaced5yvsgk4zjv5hko5zdth5pnmjntjxoscrfboq4oybtndoei4gm2s (<unknown>) Head: bafy2bzacebmkw6qgjwwtsrkqqa5jfqrnpnfr3q6dtsga6jo4se56meueuslq2 ``` $ lotus chain get <Head-value> ``` > [ 0, { "/": "bafy2bzaceamp42wmmgr2g2ymg46euououzfyck7szknvfacqscohrvaikwfay" } ] My state is ``` pub struct State { pub count: u64, pub name_register: Cid, } ``` so my counter is 0 and I have the Cid link to query to get the map values. ### Open questions -