Git Product home page Git Product logo

vm-agent's Introduction

VM Agent Clojars Project cljdoc badge

VM Agent is an agent that runs in an Azure VM and selectively exposes some APIs of the blockchain client running alongside it.

This project features,

Getting Started

  • Install the Clojure CLI tools, preferably in a *nix environment (Windows Subsystem for Linux works fine.) Outside WSL, Windows support is experimental at this point.

  • Build the project and create a Docker image in one step,

      > clojure -A:pack mach.pack.alpha.jib \
                --image-name $DOCKER_REGISTRY/vm-agent:0.1.0 \
                --image-type docker \
                -m vm-agent.server
    

    $DOCKER_REGISTRY is any registry where you want to host the image. For Azure Container Registry, use <registry>.azurecr.io.

  • Start the server,

      > docker run $DOCKER_REGISTRY/vm-agent:0.1.0
    
  • Try one of the examples.

Examples

curl -i \
     -H 'Accept: application/json' \
     http://localhost:8890/besu/block-number

Note: There are known networking limitations when running Docker on Windows. Try these workarounds,

  1. Run Docker in a Vagrant VM.
  2. Run cURL in a container that is attached to the same network.

Currently, these APIs are exposed,

#{["/besu/genesis"              :get    (conj common-interceptors besu/read-genesis)]
  ["/besu/genesis"              :put    (conj common-interceptors besu/create-genesis)]
  ["/besu/block-number"         :get    (conj common-interceptors besu/read-block-number)]
  ["/besu/syncing"              :get    (conj common-interceptors besu/syncing)]
  ["/besu/public-key"           :get    (conj common-interceptors besu/read-public-key)]
  ["/besu/address"              :get    (conj common-interceptors besu/read-address)]
  ["/besu/enode-url"            :get    (conj common-interceptors besu/read-enode-url)]
  ["/besu/accounts/"            :get    (conj common-interceptors besu/read-accounts)]
  ["/besu/peers/"               :get    (conj common-interceptors besu/read-peers)]
  ["/besu/peers/"               :post   (conj common-interceptors besu/add-peer)]
  ["/besu/peers/"               :delete (conj common-interceptors besu/remove-peer)]
  ["/besu/validators/"          :get    (conj common-interceptors besu/read-validators)]
  ["/besu/validators/"          :post   (conj common-interceptors besu/add-validator)]
  ["/besu/validators/"          :delete (conj common-interceptors besu/remove-validator)]
  ["/besu/send-raw-transaction" :post   (conj common-interceptors besu/send-raw-transaction)]

Take a look at the handlers. The code is well documented.

Clojure Crash Course

Check out Clojure in 15 Minutes.

vm-agent's People

Contributors

hindol avatar

Stargazers

 avatar

Watchers

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