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,
A minimalistic JSON-RPC 2.0 client implementation in Clojure. Check this file for example usage.
Pedestal conditional interceptors and content negotiation.
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.
curl -i \
-X POST \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
http://localhost:8890/besu/block-number
Note: There are known networking limitations when running Docker on Windows. Try these workarounds,
Currently, these APIs are exposed,
#{["/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/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.
Check out Clojure in 15 Minutes.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close