input-output-hk / smart-contract-backend

Work in progress: Run off-chain smart contract executables server-side in isolation, accessible via a network interface
Apache License 2.0
8 stars 1 forks source link

Smart Contract Backend

Build Status

Run off-chain smart contract executables server-side in isolation, accessible via a GraphQL interface. The server exposes a GraphQL control API for loading contracts and subscribing to signing requests for transactions generated by the contracts. An execution service isolates potentially untrusted code execution, enabling interaction with the contracts via a Docker or NodeJS engine.

For TypeScript/JavaScript applications the provided client will serve as a good starting point, and provides a lightweight approach for most applications.

The primary goal for the project is to deliver a runtime and interaction model for Plutus, however there is no fixed coupling to any particular Smart Contract language.

Project State: Alpha

This system is a work in progress, and dependent on external tooling efforts. The Docker-based engine will likely be first to reach stability, but development on both engines is happening in parallel.

Development

Docker Compose

  1. Uncomment the volumes for the service you are working on in docker-compose.yml
  2. docker-compose up
  3. Run a TypeScript file watcher for live reloading of development changes

Swagger API documentation for docker execution engine available at /docs

Testing

Unit tests are placed inline within the src directory. Integration tests are located in the test directory for each service.

Run the test suit with npm test

A running Docker daemon is required for the tests to run.

Depending on network speed, you may need to run docker pull samjeston/smart_contract_server_mock prior to running the test suite to avoid timeouts.