Skip to main content

Chia development commands

Project description

Chia Dev Tools

Install

Initialize a new project directory and cd into it. Then follow the following instructions to get set up:

Ubuntu/MacOSs

python3 -m venv venv
. ./venv/bin/activate
pip install chia-dev-tools
cdv --version

Windows Powershell

py -m venv venv
./venv/Scripts/activate
pip install chia-dev-tools
cdv --version

What's in it?

This python wheel will bring in commands from other chia repositories such as brun or even chia!

The command unique to this repository is cdv. Run cdv --help to see what it does:

Usage: cdv [OPTIONS] COMMAND [ARGS]...

  Dev tooling for Chia development

Options:
  --version   Show the version and exit.
  -h, --help  Show this message and exit.

Commands:
  clsp     Commands to use when developing with chialisp
  decode   Decode a bech32m address to a puzzle hash
  encode   Encode a puzzle hash to a bech32m address
  inspect  Inspect various data structures
  rpc      Make RPC requests to a Chia full node
  test     Run the local test suite (located in ./tests)

Tests

The test command allows you to initialize and run local tests.

cdv test --init
# Make changes to the ./tests/test_skeleton.py file
cdv test

Chialisp Commands

The clsp family of commands are helpful when writing, building, and hashing Chialisp and CLVM programs.

cdv clsp build .\puzzles\password.clsp
cdv clsp retrieve condition_codes sha256tree
cdv clsp treehash '(a 2 3)'
cdv clsp curry .\puzzles\password.clsp.hex -a 0xdeadbeef -a "(q . 'I'm an inner puzzle!')"
cdv clsp disassemble ff0180

Inspect Commands

The inspect family of commands allows you to build and examine certain Chia related objects

cdv inspect -id coins --parent-id e16dbc782f500aa24891886779067792b3305cff8b873ae1e77273ad0b7e6c05 --puzzle-hash e16dbc782f500aa24891886779067792b3305cff8b873ae1e77273ad0b7e6c05 --amount 123
cdv inspect --json spends --coin .\coin.json --puzzle-reveal ff0180 --solution '()'
cdv inspect --bytes spendbundles .\spend_bundle.json
cdv inspect --json any 0e1074f76177216b011668c35b1496cbd10eff5ae43f6a7924798771ac131b0a0e1074f76177216b011668c35b1496cbd10eff5ae43f6a7924798771ac131b0a0000000000000001ff018080

RPC Commands

There are also commands for interacting with the full node's RPC endpoints (in development, more to come). The family of commands finds the full node the same way that the chia commands do. Make sure to have a local node running before you try these.

cdv rpc state
cdv rpc blocks -s 0 -e 1
cdv coinrecords --by id e16dbc782f500aa24891886779067792b3305cff8b873ae1e77273ad0b7e6c05
cdv pushtx .\spend_bundle.json

Python Packages

Being in a virtual environment with this tool will also give your python programs access to all of the chia repository packages. It also comes with a package of its own that lives in the cdv namespace with some helpful utilities. Of particular interest is the cdv.test package which comes with all sorts of tools to help you write lifecycle tests of smart coins. Check out the examples to see it in action.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

chia_dev_tools-0.1.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file chia_dev_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chia_dev_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for chia_dev_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9465297c484709df8dbeba87e5d7539c8e050a634b3c910fc052909cfac668f
MD5 18b6905c6b7d8f643475e8875bb163b9
BLAKE2b-256 c37fc243f64aeec7f61152f37a956b64242422fa5b4837b546763530921a524e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page