Chia Dev Sandbox > Deploying to Testnet
This is a slow and error prone way to deploy a coin, but a very useful exercise to understand how the system works.
- Compile the CLSP program
$ cdv clsp retrieve condition_codes
- import op codes$ cdv clsp build file.clsp
- output filename.clsp.hex (serialized version of the cvlm code) in the cwd
- Test locally
$ brun (cdv clsp disassemble filename.clsp.hex) '(arguments)'
- pass in various values for arguments to suit test cases
- Deploy coin
$ cdv clsp treehash filename.clsp.hex
- Get the puzzle hash (treehash) of filename (this can be used later to retrieve the coin record)$ cdv encode (cdv clsp treehash filename.clsp.hex) --prefix txch
- outputs and encoded address from the treehash$ chia wallet send -a 0 -t [EncodedAddress]
- Wait for the transaction to confirm
- Verify the coin record
$ cdv rpc coinrecords --by puzhash [0xYourPuzzleHash]
We can automate interacting with a chialisp coin via driver files. These scripts can deploy the coin without risking human error, and also make it easier to interact with the coin later. Video Tutorial
Example drivers: Piggybank