npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cudos-tool

v4.0.0

Published

## Contract

Downloads

39

Readme

Cudo Compute PoC

Contract

Building & deploying

Deploying the contract requires first setting up the CLI tool.

Create a wallet called admin on testnet

$ cudos-tool wallet generate admin -n testnet

Now you can build and deploy

$ sh scripts/deploy-contracts.sh

CLI tool

Install

To install from NPM

$ npm install -g cudos-tool
$ cudos-tool ...

To install as a package from source

$ npm run build
$ npm pack
$ npm install -g cudos-tool-*.tgz
$ cudos-tool ...

To use from source without installing

$ npm run build
$ ./bin/cudos-tool.js ...

Adding wallets

To add a new wallet

$ cudos-tool wallet generate <name>

This will generate a wallet and show you the address and mnemonic.

To import an existing wallet

$ cudos-tool wallet import <name> <mnemonic...>

This will recreate the wallet from the mnemonic and show you the address.

Creating VMs

You will need enough funds in your wallet to pay for the VM and running the contracts. The VMs are currently cheap. Running the contracts costs around 0.6cudo each time.

To create a VM, e.g. a small VM for 1 hour:

$ cudos-tool machine add small 1h "ssh-ed25519 AAA..." --wait

To destroy it when you are done, either wait for the time to run out or remove it using the returned from machine add

$ cudos-tool machine rm <id>

Running the provider

The provider requires a GCP service account key able to manage VMs. It must be in a file called google_service_account.json, which cudos-tool will search for in the current directory and upwards.

To run as a provider, your wallet needs to be on the allowed_providers of the contract's configuration.

Notes

Contracts

The cudos-tool tool can be used as a general contract deployment and interaction tool.

The contract named machine is used by the machine commands. cudos-tool does not enforce it, but the contract named machine should usually be the contract in contracts/machine, or one with the same API interface.

Sizes

As of right now, the sizes available are small, medium, and large.

You can view the actual sizes configured using the config command:

$ cudos-tool machine config

If you control a wallet on the config's admin list, you can take that config and modify it

$ cudos-tool machine config <config filename>

Amounts and durations

Some commands 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 the executor on the cloud

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

CLI Tool Help

cudos-tool

Usage: cudos-tool [options] [command]

Options:
  -n, --network <name>  Network name
  -w, --wallet <name>   Wallet name
  -h, --help            display help for command

Commands:
  init                  Initialize cudos-tool
  network|net           Manage networks
  wallet                Manage wallets
  contract              Manage contracts
  machine               Machine commands
  help [command]        display help for command

cudos-tool init

Usage: cudos-tool init [options]

Initialize cudos-tool

Options:
  -h, --help  display help for command

cudos-tool network

Usage: cudos-tool network|net [options] [command]

Manage networks

Options:
  -h, --help          display help for command

Commands:
  list|ls             List networks
  default|def <name>  Set default
  help [command]      display help for command

cudos-tool wallet

Usage: cudos-tool wallet [options] [command]

Manage wallets

Options:
  -h, --help                   display help for command

Commands:
  list [options]               List wallets
  generate <name>              Generate wallet
  import <name> <mnemonic...>  Import existing wallet
  rm <name>                    Forget a wallet
  default [name]               Show or set current wallet
  check|show [name]            Check wallet balance
  send [options] <amount>      Send tokens
  help [command]               display help for command

cudos-tool contract

Usage: cudos-tool contract [options] [command]

Manage contracts

Options:
  -h, --help                          display help for command

Commands:
  list [options]                      List known contracts
  unregister <name>                   Unregister existing contract
  register [options] <name>           Register existing contract
  deploy [options] <name> <file>      Deploy a contract
  query <name> <query>                Query a contract
  query-raw <name> <key>              Raw-query a contract
  execute [options] <name> <execute>  Execute a contract
  help [command]                      display help for command

cudos-tool machine

Usage: cudos-tool machine [options] [command]

Machine commands

Options:
  -h, --help                              display help for command

Commands:
  config [config]                         View or set contract configuration
  list                                    List machines
  add [options] [size] [coins] [ssh-key]  Add a machine request
  get <id>                                Show information about machine ID
  rm <id...>                              Remove machine ID
  earnings                                Show earnings
  collect                                 Collect earnings
  one                                     Process a single operation
  run                                     Start processing machine operations
  help [command]                          display help for command