Giter VIP home page Giter VIP logo

chia-dev-tools's Introduction

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 --extra-index-url https://pypi.chia.net/simple/ 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 --extra-index-url https://pypi.chia.net/simple/ 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
# The following for Linux/MacOS
python3 -m venv venv
. ./venv/bin/activate
# The following for Windows
py -m venv venv
./venv/Scripts/activate
# To install chia-dev-tools
pip install --extra-index-url https://pypi.chia.net/simple/ .

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
  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
  test     Run the local test suite (located in ./tests)

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
# 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 rpc coinrecords --by id 6ce8fa56321d954f54ba27e58f4a025eb1081d2e1f38fc089a2e72927bcde0d1
cdv rpc 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.

chia-dev-tools's People

Contributors

altendky avatar chiaautomation avatar cmmarslender avatar dependabot[bot] avatar emlowe avatar geoffwalmsley avatar hoffmang9 avatar jack60612 avatar justinengland avatar kimsk avatar nirajpathak13 avatar ojura avatar paninaro avatar prozacchiwawa avatar quexington avatar rightsexyorc avatar trepca avatar wallentx avatar wizicer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chia-dev-tools's Issues

Attempt to change the block reward address fails

My simulator has a wallet with the prefarm and a few block rewards:

Chia wallet show
Wallet height: 8
Sync status: Synced
Balances, fingerprint: 3446212044

Chia Wallet:
   -Total Balance:         21000012.0 txch (21000012000000000000 mojo)
   -Pending Total Balance: 21000012.0 txch (21000012000000000000 mojo)
   -Spendable:             21000012.0 txch (21000012000000000000 mojo)
   -Type:                  STANDARD_WALLET
   -Wallet ID:             1

Attempt to farm a block with a different reward address:

cdv sim farm -a txch1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm6ksh7qddh
Farmed 1 Transaction blocks
Block Height is now: 9

The original wallet still received the farming reward:

chia wallet show
Wallet height: 9
Sync status: Synced
Balances, fingerprint: 3446212044

Chia Wallet:
   -Total Balance:         21000014.0 txch (21000014000000000000 mojo)
   -Pending Total Balance: 21000014.0 txch (21000014000000000000 mojo)
   -Spendable:             21000014.0 txch (21000014000000000000 mojo)
   -Type:                  STANDARD_WALLET
   -Wallet ID:             1

fullnode rpc get_puzzle_and_solution info error

curl --insecure --cert ~/.chia/testnet10/config/ssl/full_node/private_full_node.crt --key ~/.chia/testnet10/config/ssl/full_node/private_full_node.key -d '{"coin_id": "0x47f1cd7198c178ce86e97efe44add10c8587d088ed817fbbe049ec862619368e", "height": 1489939}' -H "Content-Type: application/json" -X POST https://localhost:8555/get_puzzle_and_solution | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 800 100 700 100 100 46585 6655 --:--:-- --:--:-- --:--:-- 57142
{
"error": "can't cast <class 'chia.types.blockchain_format.program.SerializedProgram'> (ff02ffff01ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b081e576328ffc00a4937afdec46ad07d1f66717d7bc1b766035539f981f956109a435793182b23bf31084741e2e5909f3ff018080) to bytes",
"success": false
}

chia-blockchain 1.5.1 error

pip install chia-dev-tools

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
cat-admin-tool 0.0.1 requires chia-blockchain==1.5.0, but you have chia-blockchain 1.5.1 which is incompatible.

error "GENERATOR_RUNTIME_ERROR" raised while Creating a multiple mint CAT

What happened?

I followed the tutorials "Creating a multiple mint CAT" linked below,but an error

 '79dbe19341d1e6b787b6133099448e1b8301b0e75298a033a16ad99278035abc, error '
 "GENERATOR_RUNTIME_ERROR', 'success': False}")

raied in the last step. I dont's get Where is it wrong?

https://chialisp.com/docs/tutorials/CAT_Launch_Process_Linux_MacOS

env:testnet7

my steps:

wallet_address:
txch1jq0wd7q3r7hruzc2ee8kan2p65f074dxjh5c6e5yn44effevk2mqcgtwhj

master_publick_key:
ad588f4b093dc221e1dc8c1607156ddab4ac131ff54eb80bcb4f69e6fa5dfb4f76b96a7f99a5ffbb212302b05d0f5a6e

cats --tail ./reference_tails/delegated_tail.clsp.hex --curry 0xad588f4b093dc221e1dc8c1607156ddab4ac131ff54eb80bcb4f69e6fa5dfb4f76b96a7f99a5ffbb212302b05d0f5a6e --send-to txch1jq0wd7q3r7hruzc2ee8kan2p65f074dxjh5c6e5yn44effevk2mqcgtwhj -a 20000 --as-bytes --select-coin

coin id:
830111fc660e83f522803b6eac9659a0690f5bfb2b7bfff5ca17e9f0c65f1740

cdv clsp curry ./reference_tails/genesis_by_coin_id.clsp.hex -a 0x830111fc660e83f522803b6eac9659a0690f5bfb2b7bfff5ca17e9f0c65f1740 --treehash

ph:
e216d99bcdbf104a0e55ac87275a93a08481ed8fa5c1e3d31141d976cc3f62b7

fingerprint:
945233328

chia keys sign -d e216d99bcdbf104a0e55ac87275a93a08481ed8fa5c1e3d31141d976cc3f62b7 -f 945233328 -t m -b

sign:
b1c1b3a4dd0860f2834f8a34f4df32e3a8cab7bd952fa4babbddd21f8b28d2d2baa34a44404f92f988c75fdc2b1d65cd08bc622628c60fe3376913fb1c98e2c6afb1c462f9c5d0bea6ba76615070c7f708a00552686ace2e4fec56bb34cbf81d

cats --tail ./reference_tails/delegated_tail.clsp.hex --curry 0xad588f4b093dc221e1dc8c1607156ddab4ac131ff54eb80bcb4f69e6fa5dfb4f76b96a7f99a5ffbb212302b05d0f5a6e --send-to txch1jq0wd7q3r7hruzc2ee8kan2p65f074dxjh5c6e5yn44effevk2mqcgtwhj -a 20000 --as-bytes --solution "(e216d99bcdbf104a0e55ac87275a93a08481ed8fa5c1e3d31141d976cc3f62b7 ())" --signature b1c1b3a4dd0860f2834f8a34f4df32e3a8cab7bd952fa4babbddd21f8b28d2d2baa34a44404f92f988c75fdc2b1d65cd08bc622628c60fe3376913fb1c98e2c6afb1c462f9c5d0bea6ba76615070c7f708a00552686ace2e4fec56bb34cbf81d

assert id:88cea92795206294825a1782a684579fe42a4320211f23e7c43bf312244efe4a
spend_bundle:
000000026d68ae429040e2d9b3813f1a51592e5bad6dadfa0e78350272d07dd5e6f14af5901ee6f8111fae3e0b0ace4f6ecd41d512ff55a695e98d66849d6b94a72cb2b6000000174876e800ff02ffff01ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0a5e78ca7174491bdac536df5affb52e97253ec8a66e5375713fdbbff422a2e34f6992aa4c2f20b04b884654159d7fb09ff018080ff80ffff01ffff33ffa0f85f1fe04afe663b73d38f2bb5bc9eaac0212432427dc426724a776e49c67619ff824e2080ffff33ffa099fab77d3fb848267a465f987e1ebfdbf8d9a4531000fc95cadbc59232699c30ff8517487699e080ffff3cffa052d4a883e55975e06ea822172a113e24787c4e46324b2f7f60ba547b58ce90928080ff8080830111fc660e83f522803b6eac9659a0690f5bfb2b7bfff5ca17e9f0c65f1740f85f1fe04afe663b73d38f2bb5bc9eaac0212432427dc426724a776e49c676190000000000004e20ff02ffff01ff02ffff01ff02ff5effff04ff02ffff04ffff04ff05ffff04ffff0bff2cff0580ffff04ff0bff80808080ffff04ffff02ff17ff2f80ffff04ff5fffff04ffff02ff2effff04ff02ffff04ff17ff80808080ffff04ffff0bff82027fff82057fff820b7f80ffff04ff81bfffff04ff82017fffff04ff8202ffffff04ff8205ffffff04ff820bffff80808080808080808080808080ffff04ffff01ffffffff81ca3dff46ff0233ffff3c04ff01ff0181cbffffff02ff02ffff03ff05ffff01ff02ff32ffff04ff02ffff04ff0dffff04ffff0bff22ffff0bff2cff3480ffff0bff22ffff0bff22ffff0bff2cff5c80ff0980ffff0bff22ff0bffff0bff2cff8080808080ff8080808080ffff010b80ff0180ffff02ffff03ff0bffff01ff02ffff03ffff09ffff02ff2effff04ff02ffff04ff13ff80808080ff820b9f80ffff01ff02ff26ffff04ff02ffff04ffff02ff13ffff04ff5fffff04ff17ffff04ff2fffff04ff81bfffff04ff82017fffff04ff1bff8080808080808080ffff04ff82017fff8080808080ffff01ff088080ff0180ffff01ff02ffff03ff17ffff01ff02ffff03ffff20ff81bf80ffff0182017fffff01ff088080ff0180ffff01ff088080ff018080ff0180ffff04ffff04ff05ff2780ffff04ffff10ff0bff5780ff778080ff02ffff03ff05ffff01ff02ffff03ffff09ffff02ffff03ffff09ff11ff7880ffff0159ff8080ff0180ffff01818f80ffff01ff02ff7affff04ff02ffff04ff0dffff04ff0bffff04ffff04ff81b9ff82017980ff808080808080ffff01ff02ff5affff04ff02ffff04ffff02ffff03ffff09ff11ff7880ffff01ff04ff78ffff04ffff02ff36ffff04ff02ffff04ff13ffff04ff29ffff04ffff0bff2cff5b80ffff04ff2bff80808080808080ff398080ffff01ff02ffff03ffff09ff11ff2480ffff01ff04ff24ffff04ffff0bff20ff2980ff398080ffff010980ff018080ff0180ffff04ffff02ffff03ffff09ff11ff7880ffff0159ff8080ff0180ffff04ffff02ff7affff04ff02ffff04ff0dffff04ff0bffff04ff17ff808080808080ff80808080808080ff0180ffff01ff04ff80ffff04ff80ff17808080ff0180ffffff02ffff03ff05ffff01ff04ff09ffff02ff26ffff04ff02ffff04ff0dffff04ff0bff808080808080ffff010b80ff0180ff0bff22ffff0bff2cff5880ffff0bff22ffff0bff22ffff0bff2cff5c80ff0580ffff0bff22ffff02ff32ffff04ff02ffff04ff07ffff04ffff0bff2cff2c80ff8080808080ffff0bff2cff8080808080ffff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff2effff04ff02ffff04ff09ff80808080ffff02ff2effff04ff02ffff04ff0dff8080808080ffff01ff0bff2cff058080ff0180ffff04ffff04ff28ffff04ff5fff808080ffff02ff7effff04ff02ffff04ffff04ffff04ff2fff0580ffff04ff5fff82017f8080ffff04ffff02ff7affff04ff02ffff04ff0bffff04ff05ffff01ff808080808080ffff04ff17ffff04ff81bfffff04ff82017fffff04ffff0bff8204ffffff02ff36ffff04ff02ffff04ff09ffff04ff820affffff04ffff0bff2cff2d80ffff04ff15ff80808080808080ff8216ff80ffff04ff8205ffffff04ff820bffff808080808080808080808080ff02ff2affff04ff02ffff04ff5fffff04ff3bffff04ffff02ffff03ff17ffff01ff09ff2dffff0bff27ffff02ff36ffff04ff02ffff04ff29ffff04ff57ffff04ffff0bff2cff81b980ffff04ff59ff80808080808080ff81b78080ff8080ff0180ffff04ff17ffff04ff05ffff04ff8202ffffff04ffff04ffff04ff24ffff04ffff0bff7cff2fff82017f80ff808080ffff04ffff04ff30ffff04ffff0bff81bfffff0bff7cff15ffff10ff82017fffff11ff8202dfff2b80ff8202ff808080ff808080ff138080ff80808080808080808080ff018080ffff04ffff01a072dec062874cd4d3aab892a0906688a1ae412b0109982e1797a170add88bdcdcffff04ffff01a088cea92795206294825a1782a684579fe42a4320211f23e7c43bf312244efe4affff04ffff01ff01ffff33ff80ff818fffff02ffff01ff02ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff82027fff80808080ff80808080ffff02ff82027fffff04ff0bffff04ff17ffff04ff2fffff04ff5fffff04ff81bfff82057f80808080808080ffff04ffff01ff31ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0ad588f4b093dc221e1dc8c1607156ddab4ac131ff54eb80bcb4f69e6fa5dfb4f76b96a7f99a5ffbb212302b05d0f5a6eff018080ffffc04065323136643939626364626631303461306535356163383732373561393361303834383165643866613563316533643331313431643937366363336636326237ff808080ffff33ffa0901ee6f8111fae3e0b0ace4f6ecd41d512ff55a695e98d66849d6b94a72cb2b6ff824e20ffffa0901ee6f8111fae3e0b0ace4f6ecd41d512ff55a695e98d66849d6b94a72cb2b6808080ff0180808080ff80ff80ffa0e1befbb92544a95770ae868a6aaf7134b1d1e5ce20670138a1c1ef0611e37a8dffffa0830111fc660e83f522803b6eac9659a0690f5bfb2b7bfff5ca17e9f0c65f1740ffa0f85f1fe04afe663b73d38f2bb5bc9eaac0212432427dc426724a776e49c67619ff824e2080ffffa0830111fc660e83f522803b6eac9659a0690f5bfb2b7bfff5ca17e9f0c65f1740ffa0ebcd7960978c7202a58b1ae579db02e3359f59aaed22cfb8afaea115d7089d11ff824e2080ff80ff8080863590e764459d0058ae21851118c4b5493b210211f4928509a2a7caf344518e939296aae598a762a2435d507f482afd1215c1ec0e3da6e37d9d6c08671b49419bfb80d3d90a55af93a4b31f16bc255f3eac8f8687b77aaa4619a4c0c9bdd884

cdv rpc pushtx <spend_bundle>
("{'error': 'Failed to include transaction "
 '79dbe19341d1e6b787b6133099448e1b8301b0e75298a033a16ad99278035abc, error '
 "GENERATOR_RUNTIME_ERROR', 'success': False}")

more info

chia show wallet
Choose wallet key:
1) 3678822947
2) 3001635724
3) 945233328
 chia wallet show -f 945233328
Wallet height: 1116346
Sync status: Synced
Balances, fingerprint: 945233328
Wallet ID 1 type STANDARD_WALLET Chia Wallet
   -Total Balance: 0.1 txch (100000000000 mojo)
   -Pending Total Balance: 0.1 txch (100000000000 mojo)
   -Spendable: 0.1 txch (100000000000 mojo)

Version

cdv version 1.0.5

chiablockchia ver 1.2.11.dev264

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

2022-01-07T17:52:59.897 full_node chia.rpc.rpc_server     : WARNING  Error while handling message: Traceback (most recent call last):
  File "/root/protocol_and_cats_rebased/chia-blockchain/chia/rpc/rpc_server.py", line 83, in inner
    res_object = await f(request_data)
  File "/root/protocol_and_cats_rebased/chia-blockchain/chia/rpc/full_node_rpc_api.py", line 536, in push_tx
    raise ValueError(f"Failed to include transaction {spend_name}, error {error.name}")
ValueError: Failed to include transaction 79dbe19341d1e6b787b6133099448e1b8301b0e75298a033a16ad99278035abc, error GENERATOR_RUNTIME_ERROR

Uninstalling chia-blockchain 1.3.0 after installation

I have installed chia-blockchain 1.3.0
After it I Install chia-dev-tools using
pip install chia-dev-tools

And the log says:
Attempting uninstall: chia-blockchain
Found existing installation: chia-blockchain 1.3.0
Uninstalling chia-blockchain-1.3.0:
Successfully uninstalled chia-blockchain-1.3.0
Successfully installed blspy-1.0.6 chia-blockchain-1.2.11 chia-dev-tools-1.0.6

It seems it is installing chia-blockchain 1.3.0- and installing chia-blockchain-1.2.11

No matching distribution found for chia-blockchain==1.6 (from chia-dev-tools)

(venv) root@kuboworker:/home/ubuntu/chia# pip install chia-dev-tools
Collecting chia-dev-tools
Using cached https://files.pythonhosted.org/packages/c9/57/6c8b1ac5b05f52ffdb35d041b7991b6e1e08bad78d28bfde096f2df4a27c/chia_dev_tools-1.1.2-py3-none-any.whl
Collecting chia-blockchain==1.6 (from chia-dev-tools)
Could not find a version that satisfies the requirement chia-blockchain==1.6 (from chia-dev-tools) (from versions: )
No matching distribution found for chia-blockchain==1.6 (from chia-dev-tools)

cdv rpc should return valid json

pprint helps with formatting, but it doesn't produce a valid json. We could use print and json.dumps to produce a valid json. I have some sample code here.

image

command not working

cdv coinrecords --by id e16dbc782f500aa24891886779067792b3305cff8b873ae1e77273ad0b7e6c05

The following code (directly copied from the documentation) does not run (cdv version 1.0.2)

error running chia dev tools

I am following the instructions for installation on ubuntu.
The chia blockchain is installed. Creating a virt env, run pip install, try cdv --version

get this error:

cdv --version
Traceback (most recent call last):
  File "/home/julian/chia-dev/venv/bin/cdv", line 5, in <module>
    from cdv.cmds.cli import main
  File "/home/julian/chia-dev/venv/lib/python3.10/site-packages/cdv/cmds/cli.py", line 14, in <module>
    from cdv.cmds.clsp import clsp_cmd
  File "/home/julian/chia-dev/venv/lib/python3.10/site-packages/cdv/cmds/clsp.py", line 13, in <module>
    from cdv.util.load_clvm import compile_clvm
  File "/home/julian/chia-dev/venv/lib/python3.10/site-packages/cdv/util/load_clvm.py", line 7, in <module>
    from chia.types.blockchain_format.program import Program, SerializedProgram
ImportError: cannot import name 'SerializedProgram' from 'chia.types.blockchain_format.program' (/home/julian/chia-dev/venv/lib/python3.10/site-packages/chia/types/blockchain_format/program.py)

on 2 separate machines

the path and file exists though

Please provide `--network` option for `cdv rpc pushtx` to specify the network (for AGG_SIG_ME)

simulator0 has its own GENESIS_CHALLENGE. However, when trying to use cdv rpm pushtx, it seems to use mainnet one only, so the spend bundle with valid aggregated signature on simulator0 causes BAD_AGGREGATE_SIGNATURE error.

Providing --network option like in cdv inspect spendbundles command or change the default network to simulator0 should help.

image

This is the spend bundle that I used.

{
    "aggregated_signature": "0xb3feab7bdd8da63f90732994becc50f259ad69069e64000a12bfa4ce07270c97e65cd897d61ebee321f5a29dbd0e85c319903edd7e9dd07c3d30cb2ace34ad34f320d5168786899285079e868c1febcefe986af2a281b853b5a2bcdc2a57f89a",
    "coin_spends": [
        {
            "coin": {
                "amount": 1000000000001,
                "parent_coin_info": "0xdf2cf850264c22b8bfe7da999b56b8a6689c9ce25be52d0807fe12ed8c9e1b5b",
                "puzzle_hash": "0x6ee43a3c617c5a1ec62ffeff1b605fb53ecc81ba8ccd4024eaff9befc53c6145"
            },
            "puzzle_reveal": "0xff02ffff01ff02ffff01ff02ffff03ffff09ff12ff2f80ffff01ff04ffff04ff14ffff01ff648080ffff04ffff04ff16ffff04ff05ffff01ff8600e8d4a51000808080ffff04ffff04ff10ffff04ff0bffff01ff9072657475726e20746f2073656e646572808080ff80808080ffff01ff02ffff03ffff09ff1aff2f80ffff01ff04ffff04ff16ffff04ff3effff01ff8601d1a94a2001808080ffff04ffff04ff18ffff04ff17ff808080ffff04ffff04ff2effff04ff17ff808080ff80808080ffff01ff04ffff04ff1cffff04ff17ff808080ff808080ff018080ff0180ffff04ffff01ffffff323dff523fffff81ff01ff33ff3ea0eff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9ff018080ffff04ffff01a0d210b94e1c190321d74e68fa697a8da3dce5846bbaf9f2783ba345c431123387ffff04ffff01b096f75bf45d09491e8a5adaedbdb458f6ac46d9b6507a788fe58349f6eb2a56bfbc72bdd70a09eceb060b552f10fb1010ff01808080",
            "solution": "0xff84900ddeedff81ff80"
        }
    ]
}

Feature Request: disable Bitfield

Would it be possible to add a flag to cdv sim create to disable Bitfield processing when creating plots? The reason for this request is that on virtual machines, Bitfield is sometimes (maybe always) not possible.

Caught plotting error: Bitfield plotting not supported by CPU

Currently, in chia/simulator/block_tools.py, args.nobitfield is hard-coded to False. This request would create a command line flag to change this to True, thereby allowing plots to be created using virtual CPUs.

`KeychainLabelInvalid` when using `create -m`

Expected: able to use any valid bip39 mnemonic to bootstrap the simulator

Actual:

Using this Directory: /home/louis/.chia/simulator/main

Traceback (most recent call last):
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/bin/cdv", line 8, in <module>
    sys.exit(main())
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/cdv/cmds/cli.py", line 121, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/cdv/cmds/sim.py", line 86, in create_simulator_config
    asyncio.run(
  File "/nix/store/al6g1zbk8li6p8mcyp0h60d08jaahf8c-python3-3.10.9/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/nix/store/al6g1zbk8li6p8mcyp0h60d08jaahf8c-python3-3.10.9/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/cdv/cmds/sim_utils.py", line 315, in async_config_wizard
    fingerprint = select_fingerprint(fingerprint, mnemonic_string, docker_mode)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/cdv/cmds/sim_utils.py", line 220, in select_fingerprint
    fingerprint = generate_and_return_fingerprint(mnemonic_string)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/cdv/cmds/sim_utils.py", line 207, in generate_and_return_fingerprint
    sk = Keychain().add_private_key(mnemonic, "")
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/chia/util/keychain.py", line 326, in add_private_key
    self.keyring_wrapper.set_label(fingerprint, label)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/chia/util/keyring_wrapper.py", line 549, in set_label
    self.keyring.set_label(fingerprint, label)
  File "/home/louis/.cache/pypoetry/virtualenvs/chia-liquidity-provider--HuvboCq-py3.10/lib/python3.10/site-packages/chia/util/file_keyring.py", line 320, in set_label
    raise KeychainLabelInvalid(label, "label can't be empty or whitespace only")
chia.util.errors.KeychainLabelInvalid: label can't be empty or whitespace only

TypeError: cannot unpack non-iterable async_generator object

I just installed chia-dev-tools on Linux Mint 20.3 following the official instructions.

Next, I tried to execute the test commands to see if everything works:

(chia) $ cdv test --init
(chia) $ cdv test

But after the second command I receive the following error messages:

================================================ test session starts =================================================
platform linux -- Python 3.8.10, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/bartoli/Chia
plugins: asyncio-0.19.0
asyncio: mode=strict
collected 1 item                                                                                                     

tests/test_skeleton.py F                                                                                       [100%]

====================================================== FAILURES ======================================================
____________________________________________ TestSomething.test_something ____________________________________________

self = <tests.test_skeleton.TestSomething object at 0x7f50c6cd05b0>
setup = <async_generator object TestSomething.setup at 0x7f50c6ce5b80>

    @pytest.mark.asyncio
    async def test_something(self, setup):
>       network, alice, bob = setup
E       TypeError: cannot unpack non-iterable async_generator object

tests/test_skeleton.py:15: TypeError
============================================== short test summary info ===============================================
FAILED tests/test_skeleton.py::TestSomething::test_something - TypeError: cannot unpack non-iterable async_generato...
================================================= 1 failed in 0.06s ==================================================

It's an installation from scratch in a new virtual environment, so I don't think there are any errors on my part... has anyone had similar problems or know how I can solve them?

Thanks

ImportError: cannot import name 'SerializedProgram' from 'chia.types.blockchain_format.program'

Error

image

Steps to reproduce

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

Environment

OS: Windows 11
python: 3.10.5
pip: 23.0.1

pip list

Package                Version
---------------------- -------
aiofiles               23.1.0
aiohttp                3.8.4
aiosignal              1.3.1
aiosqlite              0.17.0
anyio                  3.6.2
async-timeout          4.0.2
attrs                  22.2.0
bitstring              4.0.1
blspy                  1.0.16
cffi                   1.15.1
charset-normalizer     3.1.0
chia-blockchain        1.7.1
chia-dev-tools         1.1.5
chia_rs                0.2.4
chiabip158             1.2
chiapos                1.0.11
chiavdf                1.0.8
click                  8.1.3
clvm                   0.9.7
clvm-tools             0.4.6
clvm_tools_rs          0.1.30
colorama               0.4.6
colorlog               6.7.0
concurrent-log-handler 0.9.20
cryptography           39.0.1
dnslib                 0.9.23
dnspython              2.3.0
exceptiongroup         1.1.1
filelock               3.9.0
frozenlist             1.3.3
idna                   3.4
importlib-metadata     6.3.0
iniconfig              2.0.0
jaraco.classes         3.2.3
psutil                 5.9.4
pybind11               2.10.4
pycparser              2.21
pytest                 7.3.1
pytest-asyncio         0.21.0
pytimeparse            1.1.8
pywin32                306
pywin32-ctypes         0.2.0
PyYAML                 6.0
setproctitle           1.3.2
setuptools             58.1.0
sniffio                1.3.0
sortedcontainers       2.4.0
tomli                  2.0.1
typing_extensions      4.5.0
watchdog               2.2.0
yarl                   1.8.2
zipp                   3.15.0
zstd                   1.5.4.0

Clear cache and reinstall chia-dev-tools doesn't help.
Any idea how to solve this issue?
Thank you in advance.

`cdv inspect spendbundles -db` doesn't display `CREATE_COIN` with hint correctly.

image

Here is the spend bundle that I use.

{
    "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.

Example in ReadMe uses invalid coin

cdv rpc coinrecords --by id e16dbc782f500aa24891886779067792b3305cff8b873ae1e77273ad0b7e6c05

The coin listed above is not valid; it produces an empty result.

0x6ce8fa56321d954f54ba27e58f4a025eb1081d2e1f38fc089a2e72927bcde0d1

This one works^

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.