Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a readme. #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
58 changes: 58 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Filecoin Hello World Actor

This repo contains a simple "Hello, World!" Filecoin actor, written in Rust. It is provided as an example for early builders to get experimenting with developing and deploying actors for the Filecoin Virtual Machine.

## Instructions

1. Compile the actor to wasm.

```
cargo build
```

2. Set up a Lotus devnet

You should use checkout the `experimental/fvm-m2` branch, and build from source -- follow the instructions [here](https://lotus.filecoin.io/developers/local-network/).

3. _Install_ the actor.

```
lotus chain install-actor <path-to-wasm-bytecode>

```

Here `path-to-wasm-bytecode = /target/debug/wbuild/fil_hello_world_actor/fil_hello_world_actor.compact.wasm`

You should see an actor code CID printed.

4. _Instantiate_ the actor.

```
lotus chain create-actor <code-cid> <encoded-params>
```

Here the `code-cid` can be copy-pasted from the output of the previous step, and `encoded-params` can be left empty (since the constructor does not take any parameters).

This command sends a message to the network invoking a method on the builtin init actor.

5. _Invoke_ the actor.

```
lotus chain invoke <address> <method_num>
```

Here the `address` can be copy-pasted from the output of the previous step, and `method_num` should be 2.

You can pipe the output through `base64` to decode it:

```
echo "<output>" | base64 -d
```

If you invoke the method again, you should see a different output due to a change of state of the actor.

## Next steps

You can then make some interesting changes to the actor and repeat the process, and go on to develop your own use case or developer tooling based on what you learn.

You can feedback your experience via the fvm early builders working group.