PolySwarmPolySwarmPolySwarmPolySwarm
Go to PolySwarm
Home

Using Your Engine's Development Community

Every Engine on PolySwarm UI has a Development Community to test the Engine using real bounties sent by the PolySwarm Marketplace. This Development Community allows an Engine developer to send isolated bounties that are only shared with the in-development Engine. The Development Community is disabled by default when an Engine is created. To enable, follow the instructions to enable Development Mode.

Development Mode is the first of many states in Engine development. It freezes the Engine configuration in PolySwarm UI and lets the Engine receive bounties from the Development Community.

From here, we should turn on the Engine.

If ngrok is not running, start it up, and create a matching Webhook in PolySwarm UI. Make sure to test the Webhook and update the Engine to point to the new Webhook.

From PolySwarm UI get the Webhook Secret from the Webhooks page. Copy that into docker/docker-compose.yaml under the microengine-webhooks service. Run all the Engine components to have a fully working Engine.

$ docker-compose -f docker/docker-compose.yaml up

Once the Engine is running, go back to PolySwarm UI, and look at the Engine. The engine has a Development Community name and api-key that you will use when sending scans into your Development Community.

Now we need a way to submit scans into your Development Community. To do that, we will use polyswarm-cli. Follow the instructions in the polyswarm-cli docs to install polyswarm-cli. When running it, we will use your Development Community name as the "Community Name" and api-key as the "API KEY".

Now it is time to send a scan. To scan EICAR, download it from the EICAR website. Assuming the downloaded file name is eicar.com.txt, you can submit it as follows:

(psvenv) $ polyswarm -a <api-key> -c <community-name> scan file eicar.com.txt

You can use this same command to submit any files that are needed to test your Engine.

Additionally, if you've already submitted a file once, you can rescan the same file using only the hash, as follows:

(psvenv) $ polyswarm -a <api-key> -c <community-name> rescan 275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f

After submitting a scan, go to the PolySwarm UI to look at the Development Results. You can follow along with the scan in progress, and see the results returned from your Engine. At any point in the process, you can set the expected result. The expected result helps PolySwarm validate Engines when it comes time to move the Engine to a production community. Refer back to the Engine UI Docs to set the expected value and view Development Results.

You will also see results of the scan in your Terminal, but it will not be displayed until the scan completes.


Next Steps

When you are satisfied that you've completed all necessary testing, and your Engine is operating as you want, it is time to get it ready for production operation.

2021 © PolySwarm Pte. Ltd.