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
(If you're on an M1 Mac, make sure you are running an ARM64 native python virtual environment)
Windows Powershell
Requires: Installation of Python 3 for Windows
py -m venv venv
./venv/Scripts/activate
pip install chia-dev-tools
cdv --version
From Source
Alternatively, you can clone the repo, and install from source: ``` git clone https://github.com/Chia-Network/chia-dev-tools.git cd chia-dev-tools
python3 -m venv venv . ./venv/bin/activate
py -m venv venv ./venv/Scripts/activate
pip install .[release]
pip install .[main] ```
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 hash SHA256 hash UTF-8 strings or bytes (use 0x prefix for bytes) inspect Inspect various data structures rpc Make RPC requests to a Chia full node sim Configure and make requests to a Chia Simulator Full Node test Run the local test suite (located in ./tests) ```
The test command allows you to initialize and run local tests.
cdv test
Optionally, to make new tests, you can bootstrap the creation of a test file by running: ``` cdv test --init
cdv test ```
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
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
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 rpc coinrecords --by id 6ce8fa56321d954f54ba27e58f4a025eb1081d2e1f38fc089a2e72927bcde0d1
cdv rpc pushtx .\spend_bundle.json
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.
Here is the spend bundle that I use.
json
{
"aggregated_signature": "0xa430d7553f1eecad67adada1afb06457857f7ef6172dd82aefaaa7b5a005d0e4489e026b9d3dd8351931e409b795e8fd03ecc2c94066ab735cf56b765510d7fce2d147f553805bca4338837a28ca1684108ddf0ed83187424597e1cb7ea69ce5",
"coin_solutions": [
{
"coin": {
"amount": 10000,
"parent_coin_info": "0x8fed76dee747e322dfeb50f1cfd7af0391512bae5868f1052ac36958ab386016",
"puzzle_hash": "0x34eb1d688f49866ea05e1cd42067b1ca49ee61688f4bc12d82aa5b34f91c9515"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff02ff5effff04ff02ffff04ffff04ff05ffff04ffff0bff34ff0580ffff04ff0bff80808080ffff04ffff02ff17ff2f80ffff04ff5fffff04ffff02ff2effff04ff02ffff04ff17ff80808080ffff04ffff02ff2affff04ff02ffff04ff82027fffff04ff82057fffff04ff820b7fff808080808080ffff04ff81bfffff04ff82017fffff04ff8202ffffff04ff8205ffffff04ff820bffff80808080808080808080808080ffff04ffff01ffffffff3d46ff02ff333cffff0401ff01ff81cb02ffffff20ff02ffff03ff05ffff01ff02ff32ffff04ff02ffff04ff0dffff04ffff0bff7cffff0bff34ff2480ffff0bff7cffff0bff7cffff0bff34ff2c80ff0980ffff0bff7cff0bffff0bff34ff8080808080ff8080808080ffff010b80ff0180ffff02ffff03ffff22ffff09ffff0dff0580ff2280ffff09ffff0dff0b80ff2280ffff15ff17ffff0181ff8080ffff01ff0bff05ff0bff1780ffff01ff088080ff0180ffff02ffff03ff0bffff01ff02ffff03ffff09ffff02ff2effff04ff02ffff04ff13ff80808080ff820b9f80ffff01ff02ff56ffff04ff02ffff04ffff02ff13ffff04ff5fffff04ff17ffff04ff2fffff04ff81bfffff04ff82017fffff04ff1bff8080808080808080ffff04ff82017fff8080808080ffff01ff088080ff0180ffff01ff02ffff03ff17ffff01ff02ffff03ffff20ff81bf80ffff0182017fffff01ff088080ff0180ffff01ff088080ff018080ff0180ff04ffff04ff05ff2780ffff04ffff10ff0bff5780ff778080ffffff02ffff03ff05ffff01ff02ffff03ffff09ffff02ffff03ffff09ff11ff5880ffff0159ff8080ff0180ffff01818f80ffff01ff02ff26ffff04ff02ffff04ff0dffff04ff0bffff04ffff04ff81b9ff82017980ff808080808080ffff01ff02ff7affff04ff02ffff04ffff02ffff03ffff09ff11ff5880ffff01ff04ff58ffff04ffff02ff76ffff04ff02ffff04ff13ffff04ff29ffff04ffff0bff34ff5b80ffff04ff2bff80808080808080ff398080ffff01ff02ffff03ffff09ff11ff7880ffff01ff02ffff03ffff20ffff02ffff03ffff09ffff0121ffff0dff298080ffff01ff02ffff03ffff09ffff0cff29ff80ff3480ff5c80ffff01ff0101ff8080ff0180ff8080ff018080ffff0109ffff01ff088080ff0180ffff010980ff018080ff0180ffff04ffff02ffff03ffff09ff11ff5880ffff0159ff8080ff0180ffff04ffff02ff26ffff04ff02ffff04ff0dffff04ff0bffff04ff17ff808080808080ff80808080808080ff0180ffff01ff04ff80ffff04ff80ff17808080ff0180ffff02ffff03ff05ffff01ff04ff09ffff02ff56ffff04ff02ffff04ff0dffff04ff0bff808080808080ffff010b80ff0180ff0bff7cffff0bff34ff2880ffff0bff7cffff0bff7cffff0bff34ff2c80ff0580ffff0bff7cffff02ff32ffff04ff02ffff04ff07ffff04ffff0bff34ff3480ff8080808080ffff0bff34ff8080808080ffff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff2effff04ff02ffff04ff09ff80808080ffff02ff2effff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ffff04ffff04ff30ffff04ff5fff808080ffff02ff7effff04ff02ffff04ffff04ffff04ff2fff0580ffff04ff5fff82017f8080ffff04ffff02ff26ffff04ff02ffff04ff0bffff04ff05ffff01ff808080808080ffff04ff17ffff04ff81bfffff04ff82017fffff04ffff02ff2affff04ff02ffff04ff8204ffffff04ffff02ff76ffff04ff02ffff04ff09ffff04ff820affffff04ffff0bff34ff2d80ffff04ff15ff80808080808080ffff04ff8216ffff808080808080ffff04ff8205ffffff04ff820bffff808080808080808080808080ff02ff5affff04ff02ffff04ff5fffff04ff3bffff04ffff02ffff03ff17ffff01ff09ff2dffff02ff2affff04ff02ffff04ff27ffff04ffff02ff76ffff04ff02ffff04ff29ffff04ff57ffff04ffff0bff34ff81b980ffff04ff59ff80808080808080ffff04ff81b7ff80808080808080ff8080ff0180ffff04ff17ffff04ff05ffff04ff8202ffffff04ffff04ffff04ff78ffff04ffff0eff5cffff02ff2effff04ff02ffff04ffff04ff2fffff04ff82017fff808080ff8080808080ff808080ffff04ffff04ff20ffff04ffff0bff81bfff5cffff02ff2effff04ff02ffff04ffff04ff15ffff04ffff10ff82017fffff11ff8202dfff2b80ff8202ff80ff808080ff8080808080ff808080ff138080ff80808080808080808080ff018080ffff04ffff01a037bef360ee858133b69d595a906dc45d01af50379dad515eb9518abb7c1d2a7affff04ffff01a0d5de80924681734e81edaeb0acb314ae1057df0ac850d8c5cb26be7b58f7ed73ffff04ffff01ff01ffff33ff80ff818fffff02ffff01ff02ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff82027fff80808080ff80808080ffff02ff82027fffff04ff0bffff04ff17ffff04ff2fffff04ff5fffff04ff81bfff82057f80808080808080ffff04ffff01ff31ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b08bebf8e5d04e6bf459ea6b9c9d0571ebad521b62141fd49cb1a8f6a9a46ccb1a18366935726b7eff235b644b13aa92bdff018080ffffff02ffff01ff02ffff03ff2fffff01ff0880ffff01ff02ffff03ffff09ff2dff0280ff80ffff01ff088080ff018080ff0180ffff04ffff01a08fed76dee747e322dfeb50f1cfd7af0391512bae5868f1052ac36958ab386016ff018080ff808080ffff33ffa0e8ef29a4c836a85a27e419741dbabb7362d71ac81a395691071e311f03d60036ff822710ffffa0e8ef29a4c836a85a27e419741dbabb7362d71ac81a395691071e311f03d60036808080ff0180808080",
"solution": "0xff80ff80ffa070a52aa8854364ae39e749f16eb92cb9c6d4ff85937f71afcc10937190cee17affffa08fed76dee747e322dfeb50f1cfd7af0391512bae5868f1052ac36958ab386016ffa034eb1d688f49866ea05e1cd42067b1ca49ee61688f4bc12d82aa5b34f91c9515ff82271080ffffa08fed76dee747e322dfeb50f1cfd7af0391512bae5868f1052ac36958ab386016ffa090dc5b4ebe1aeb559da16492f5fe46f5ac86e49ec7be007b49c965fb5e5a424dff82271080ff80ff8080"
}
]
}
I think it's an issue with using as_atom_list() to get the condition variables which won't return a list of hints
.
Simple change to give access to block records via the network interface.
Full Changelog: https://github.com/Chia-Network/chia-dev-tools/compare/v1.1.5...1.1.7-b1
Full Changelog: https://github.com/Chia-Network/chia-dev-tools/compare/v1.1.4...v1.1.5
KeychainLabelInvalid
by @lourkeur in https://github.com/Chia-Network/chia-dev-tools/pull/60Full Changelog: https://github.com/Chia-Network/chia-dev-tools/compare/v1.1.3...v1.1.4
cdv inspect
Full Changelog: https://github.com/Chia-Network/chia-dev-tools/compare/v1.1.1...v1.1.2
chia chia-blockchain chialisp