Skip to content

Compile Chialisp to CLVM and serialize as hex from your web browser.

Notifications You must be signed in to change notification settings

strategist922/chialisp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matsutake Chialisp

Compile Chialisp to CLVM and serialize as hex from your web browser.

import { Chialisp } from '@matsutake/chialisp/browser';

const exampleProgram = `
(mod (password new_puzhash amount)
    (defconstant CREATE_COIN 51)

    (if (= (sha256 password) (q . 0x2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824))
        (list (list CREATE_COIN new_puzhash amount))
        (x)
    )
)`;
const chialisp = new Chialisp(exampleProgram);
const hex = await chialisp.hex();
const hash = await chialisp.hash();

expect(hex).toBe('ff02ffff01ff02ffff03ffff09ffff0bff0580ffff01a02cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b982480ffff01ff04ffff04ff02ffff04ff0bffff04ff17ff80808080ff8080ffff01ff088080ff0180ffff04ffff0133ff018080');
expect(hash).toBe('4843c869bba5f65aa1e806cd372dae5668ca3b69640d067e86837ca96b324e71');

The hex form can be used to spend coins on the Chia Blockchain. Please enjoy!

matsutake.io

About

Compile Chialisp to CLVM and serialize as hex from your web browser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%