https://github.com/jcnelson/stacks-node-cli
Stacks node swiss-army knife
https://github.com/jcnelson/stacks-node-cli
Last synced: 9 months ago
JSON representation
Stacks node swiss-army knife
- Host: GitHub
- URL: https://github.com/jcnelson/stacks-node-cli
- Owner: jcnelson
- License: gpl-3.0
- Created: 2022-08-24T16:16:42.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-24T19:18:40.000Z (over 3 years ago)
- Last Synced: 2025-01-15T14:41:30.855Z (over 1 year ago)
- Language: JavaScript
- Size: 37.1 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stacks-node-cli
Stacks node swiss-army knife
## Encoding Clarity values
```
$ ./stacks-node-cli encode
Usage: ./stacks-node-cli encode type value [type value ...]
Where `type` and `value` adhere to the following grammar:
(note that '++' means 'concatenation')
Integer = (any i128 value)
UInteger = (any u128 value)
C32Address = (any Crockford-32 checksum-encoded address)
HexString = "0x" ++ (any string that matches the regex /^[0-9a-f]$/)
ClarityLiteral = (any string that is a valid Clarity literal)
ContractName = (any string that is a valid Clarity contract name)
ASCIIString = " ++ (any string made of just ASCII characters) ++ "
UTF8String = " ++ (any string made of UTF-8 codepoints) ++ "
AddressString = C32Address | C32Address, ContractName
Value = Integer | UInteger | C32CheckString | Boolean | HexString | ASCIIString | UTF8String
Type = "int", Integer | "uint", UInteger | "bool", Boolean | "buff", HexString |
"string-ascii", ASCIIString | "string-utf8", UTF8String | "principal", AddressString |
"some", Type | "none" | "ok", Type | "err", Type | "list", UInteger, { Type, Value } |
"tuple", UInteger, { ClarityLiteral, Type, Value }
Examples:
uint 3
0100000000000000000000000000000003
principal SP1QK1AZ24R132C0D84EEQ8Y2JDHARDR58R72E1ZW
05166f30abe2260231300d411ceba3c29362ac370546
buff 0x1234
02000000021234
some buff 0xdeadbeef
0a0200000004deadbeef
ok some string-ascii "hello world"
070a0d0000000b68656c6c6f20776f726c64
list 3 uint 0 uint 1 uint 2
0b00000003010000000000000000000000000000000001000000000000000000000000000000010100000000000000000000000000000002
tuple 2 field1 int 3 field2 string-utf8 "hello world"
0c00000002066669656c64310000000000000000000000000000000003066669656c64320e0000000b68656c6c6f20776f726c64
```
TODO: finish the rest of the README