1.5.0 • Published 2 years ago

cudo-compute v1.5.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Cudo Compute PoC

Contract

Building & deploying

To build and deploy on the default network

$ sh scripts/deploy-contracts.sh

CLI tool

Install

To install from NPM

$ npm install -g cudo-compute
$ cudo-compute ...

To install as a package from source

$ npm run build
$ npm pack
$ npm install -g cudo-compute-1.0.0.tgz
$ cudo-compute ...

To use from source without installing

$ npm run build
$ ./bin/cudo-compute.js ...

Contract

Building & deploying

Building and deploying is mostly managed by the CUDOS blast tool.

$ sh contract/deploy.sh

If boxchain_contract_address does not exist in the project root, this will upload and instantiate the contract and store the address in that file.

If it does exist, it will upload the new code and migrate the existing contract to it.

Off-chain

Preparation

Make sure you have deployed the contract.

Install needed packages.

$ cd offchain
$ npm install
$ sh build.sh

If you are developing, use the watch mode to rebuild main.js automatically

$ sh watch.sh

Use

$ ./boxchain <command...>

Localnet

Unless you are using testnet (or mainnet!), you'll have to start the localnet

$ cd contract
$ blast node start

Client

# List machines
$ ./boxchain -aaccount2 demand list

# Create a machine
$ ./boxchain -aaccount2 demand add [size] [amount]|[duration] [ssh-key]

# Show the status of machine ID
$ ./boxchain -aaccount2 demand get ID

# Delete machine ID (TODO)
$ ./boxchain -aaccount2 demand rm ID

Executor

# Run the server for one supply operation
$ ./boxchain -aaccount3 supply one

# Run the server until manually stopped
$ ./boxchain -aaccount3 supply run

Notes

Amounts and durations

The demand add command accepts an amount in cudos, or a duration. Cudo amounts are simply converted directly to acudos, and durations are converted to acudos via the currently configured rate.

formatunitin cudos
NNNssecondsconfig rate
NNNmminutes60 * config rate
NNNhhours3,600 * config rate
NNNddays43,200 * config rate
NNNyyears15,768,000 * config rate
NNNacudosattocudos1e-18 cudos
NNNfcudosfemtocudos1e-16 cudos
NNNpcudospicocudos1e-12 cudos
NNNncudosnanocudos1e-9 cudos
NNNucudosmicrocudos1e-6 cudos
NNNmcudosmillicudos1e-3 cudos
NNNcudoscudos1 cudo exactly
NNNkcudoskilocudos1e+3 cudos

TODO

  • A web-based UI for the requester

  • Run on testnet

  • Run the executor on the cloud

  • Run the executor on cloud compute resources provisioned by this system :)