Coder Social home page Coder Social logo

cjglory / facet-vm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 0xfacet/facet-vm

1.0 0.0 0.0 1.41 MB

This app processes Dumb Contract interactions and makes the results available via an HTTP API.

Home Page: https://docs.ethscriptions.com/v/ethscriptions-vm/

Ruby 93.90% HTML 0.03% PLpgSQL 6.04% Procfile 0.03%

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.

Important: When pulling changes!

Always run bundle install && rails db:migrate after you pull in the latest changes.

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.3.0 which the VM uses:

rvm install 3.3.0

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.3.0 --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

Set up your env vars by renaming .sample.env to .env, .sample.env.development to .env.development, and .sample.env.test to .env.test. These environment-specific env files just set the database you're using in each environment. You have the option of using a replica database for reads, but you can just leave this blank if you don't want to use it. There's also a .sample.env.production but you'll probably want to set production env vars at the system level.

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

Stargazers

cjglory 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.