Giter Club home page Giter Club logo

facet-vm's Introduction

Welcome to the Facet VM!

The Facet VM is an app that interprets certain special ethscriptions as computer commands direct at computer programs called Dumb Contracts.

The VM handles logic, validation, and state persistance and exposes everything it does via an API.

You can interact with the VM using the FacetScan.

Installation Instructions

The VM is a Ruby on Rails app. To install it, follow these steps:

Run this command inside the directory of your choice to clone the repository:

git clone https://github.com/0xfacet/facet-vm

If you don't already have Ruby Version Manager installed, install it:

\curl -sSL https://get.rvm.io | bash -s stable

You might need to run this if there is an issue with gpg:

gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Now install ruby 3.2.2 which the VM uses:

rvm install 3.2.2

On a Mac you might run into an issue with openssl. If you do you might need to run something like this:

rvm install 3.2.2 --with-openssl-dir=$(brew --prefix [email protected])

Install the gems (libraries) the app needs:

bundle install

The VM runs on postgres, so install it if you don't already have it:

brew install postgresql

Create the database:

rails db:create

Migrate the database schema:

rails db:migrate

Set up your env vars by renaming .sample.env to .env.

Run the tests to make sure everything is set up correctly:

rspec

Now run the process to sync ethscriptions from the indexer to your local database and execute the contract commands:

bundle exec clockwork config/clock.rb

And then in another terminal:

bundle exec clockwork config/processor_clock.rb

You'll want to keep these two running in the background so your copy of the VM processes all new contract interactions.

Now start the web server on a port of your choice, for example 4000:

rails s -p 4000

Now you can see all your contract interactions at http://localhost:4000/transactions and call contract static functions at http://localhost:4000/contracts/:contract_id/static-call/:function_name.

If you want to debug your app you can run rails c to open up a console. Once in the console you can run things like Ethscription.count to see the total number of ethscriptions that have been processed and TransactionReceipt.all to list all contract transaction receipts.

Creating Dumb Contracts

Now that you're set up you can try the main attraction: creating your own Dumb Contracts. Dumb Contracts live in app/models/contracts. You can edit and create them without touching any other part of the codebase. See these docs for more!

facet-vm's People

Contributors

rogerpodacter avatar mikeahirsch avatar hyppocritez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.