Steps to deploy & use a custom module in local testnet

Hi!

What are the steps to deploy & execute a module ?

  1. start a local testnet
  2. set type = “Open”
  3. write a mvir contract
  4. compile it ( https://github.com/libra/libra/blob/master/language/compiler/README.md )
  5. ?

Thanks!

6 Likes

Seconded, it’s not obvious how to execute a custom transaction in a local test net node

We are working on a repl so that we can test custom modules locally. The code is already in repl.rs but it’s not yet published and it was pretty hacky. Will put out detailed instructions once we clean that up.

1 Like

Basic idea is that you need to serialize the compiled code and craft a SignedTransaction whose program field contains your new module. We ware working on more helper functions to help you do that. Stay tuned.

As a workaround, put your mvir contract under libra/language/functional_tests/tests/testsuite/ and run the tests. See this post for details.

(Note this does not actually spawn a node, but at least it allows you to test the semantics of your mvir code. As @runtianz mentioned we’re working on tools to support local nodes.)

2 Likes