Skip to content

coremoon/simply

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simply

Command line tooling for SimplicityHL (previously Simfony), a high-level language for Bitcoin's Simplicity smart contracts. Also available as a Python module via PyO3. This projects originates from https://github.com/m-kus/simply


Overview

Simply is a comprehensive tool providing development, testing, and deployment capabilities for SimplicityHL programs. It supports the complete workflow from writing SimplicityHL code to deploying and interacting with Bitcoin smart contracts.

With the Python bindings (pysimply), you can use all CLI commands programmatically from Python scripts.


Installation

Python (PyPI)

pip install pysimply

This is the recommended installation method for Python users.

Rust CLI (optional, for GitHub users)

cargo install --git https://github.com/m-kus/simply simply

The Rust CLI provides the same commands as the Python module.


CLI / Python Commands

Simply exposes all commands via the CLI and Python module:

  • build – compile a SimplicityHL program
  • run – execute a program with optional witness and arguments
  • test – automatically discover and run test functions
  • deposit – generate a P2TR address for the program
  • withdraw – spend a transaction output using the program
  • sign – sign arbitrary data with BIP340

CLI users can run simply <command> [OPTIONS]. Python users can use pysimply.run_cli_command(cmdline).


Python Usage Example

import sys
import pysimply

def main():
    # Setup logging (optional)
    pysimply.setup_logger("info")
    
    # Prepare the CLI command as a space-separated string
    cli_args = sys.argv[1:]
    cmdline = " ".join(cli_args)
    
    # Execute the command
    result = pysimply.run_cli_command(cmdline)
    
    print(result)

    # Uncomment to see the internal logger buffer
    # print(pysimply.get_logs(), flush=True)

if __name__ == "__main__":
    main()

Example usage:

# Run build command via Python
 poetry run python demo/main.py sign --message e59ff97941044f85df5297e1c302d260b85f8bcee3b4b8a0b1b6dddfc6b8c3b0

should give

Signature (BIP340): 955d986df90dccdbd2e4627efa7106f5a3e1d3c696209dc21545696b1995617cb73ec01a2259b24f450465436384564e85743c0804557757e8d480e1ca7efbc8
Message: e59ff97941044f85df5297e1c302d260b85f8bcee3b4b8a0b1b6dddfc6b8c3b0
Public key (x-only): 0b6b1a78c5c1063dcbded6bd599361d79add3824ea27951c2cee22c9fcb21f5b
Private key: 97a34cc12c99a698a44fbbde3bf59f155252e28df9184cc1440f4cbc6d593267
Command executed successfully

Run build command via Python

poetry run python demo.py build --entrypoint main.simf

Run test command via Python

poetry run python demo.py test --entrypoint tests.simf

Logging (Python Module)

  • pysimply.setup_logger(level: str) – initialize logger ("off", "error", "warn", "info", "debug", "trace")
  • pysimply.get_logs() – return the internal log buffer as a string

File Formats

Witness Files

{
  "witness": [...]
}

Argument Files

{
  "arguments": [...]
}

Resources

About

Command line tooling for SimplicityHL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 99.9%
  • Makefile 0.1%