cudo-compute
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

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.

format unit in cudos
NNNs seconds config rate
NNNm minutes 60 * config rate
NNNh hours 3,600 * config rate
NNNd days 43,200 * config rate
NNNy years 15,768,000 * config rate
NNNacudos attocudos 1e-18 cudos
NNNfcudos femtocudos 1e-16 cudos
NNNpcudos picocudos 1e-12 cudos
NNNncudos nanocudos 1e-9 cudos
NNNucudos microcudos 1e-6 cudos
NNNmcudos millicudos 1e-3 cudos
NNNcudos cudos 1 cudo exactly
NNNkcudos kilocudos 1e+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 :)

Readme

Keywords

none

Package Sidebar

Install

npm i cudo-compute

Weekly Downloads

1

Version

1.5.0

License

ISC

Unpacked Size

659 kB

Total Files

145

Last publish

Collaborators

  • nbaum