#hash #repl #input #args #command-line #interactive #stdout #flags #information #run

bin+lib melorun

Melodeon interactive repl and command-line evaluator

27 releases (6 breaking)

0.7.10 Oct 7, 2022
0.7.7 Sep 13, 2022
0.7.0 Jul 24, 2022
0.2.0 Feb 17, 2022
Download history 45/week @ 2022-11-17 9/week @ 2022-12-01 1/week @ 2022-12-08 1/week @ 2022-12-15 1/week @ 2022-12-22 2/week @ 2023-01-05 7/week @ 2023-01-12 7/week @ 2023-01-19 10/week @ 2023-01-26 1/week @ 2023-02-02 50/week @ 2023-02-09 81/week @ 2023-02-16

137 downloads per month

MPL-2.0 and GPL-3.0-only

23KB
379 lines

Melorun: Melodeon multitool

Installation

Install with cargo:

cargo install --locked melorun

Usage

melorun -h gives usage information:

melorun -h
melorun 0.7.2

USAGE:
    melorun [FLAGS] [OPTIONS] [input]

FLAGS:
    -c, --compile        Compiles the program dumps to stdout the hash and hex-encoded MelVM bytecode
    -h, --help           Prints help information
    -i, --interactive    Starts the interactive REPL
    -V, --version        Prints version information

OPTIONS:
    -s, --spend-ctx <spend-ctx>    An optional spend context YAML file

ARGS:
    <input>    The Melodeon program to run

Spend context

The spend context referred to above is a YAML file that lets you ad-hoc specify certain facts about the environment the covenant is to be tested in, without spinning up a whole actual blockchain.

The format of the YAML file is as follows:

# (OPTIONAL) Kind of the spending trasnsaction. Defaults to 0 (Normal)
spender_txkind: 0x00
# (OPTIONAL) Inputs of the spending transaction, other than the coin containing this covenant. Format is a map between integer indices and CoinID structs
spender_other_inputs:
  0:
    txhash: ...
    index: ...
# (MANDATORY) What input index is the covenant-locked coin being spent at? e.g. 0 means that the covenant-locked coin is the first input to the spending transaction
spender_index: 0
# (OPTIONAL) Data field of the spending transaction, in hexadecimal
spender_data: deadbeef
# (OPTIONAL) Outputs of the spending trransaction. A map between integer indices and CoinData structs
spender_outputs:
  0:
    covhash: t1jt0tc9z5zh8j3s7qymvvrd8sh7qq70h9g7q8cn6vcdjyrqm84vcg
    value: 12345 # integer representing microunits
    denom: MEL
    additional_data: deadbeef # hex
# (OPTIONAL) Value of the covenant-locked coin being spent, in microunits. Defaults to 0
parent_value: 123
# (OPTIONAL) Denomination of the coin being spent. Defaults to MEL
parent_denom: MEL
# (OPTIONAL) Additional data of the coin being spent, in hexadecimal. Defaults to the empty string.
additional_data: "cafebabed00d"
# Private keys (in hex) that the signed transaction is signed by. A mapping between the index of the signature and the private key. For example the map {0: K} indicates that the first signature is signed by the private key K.
ed25519_signers:
  0: ...
  1: ...

Dependencies

~19–29MB
~579K SLoC