Browse Source

Merge pull request #487 from moxiegirl/010320-update

Updating Clarity docs with changes
feat/clarity-updates
Moxiegirl 5 years ago
committed by GitHub
parent
commit
688e111d2d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      README.md
  2. 9
      _core/smart/clarityRef.md
  3. 26
      _core/smart/tutorial.md
  4. 212
      _data/clarityRef.json
  5. 73
      _data/cliRef.json

40
README.md

@ -91,9 +91,45 @@ As of 8/12/19 Clarity is in the [develop](https://github.com/blockstack/blocksta
5. Build the docker image
6. Run doc gen with the new image
```
```
$ docker run --name docsbuild -it blockstack-test blockstack-core docgen | jsonpp > ~/repos/docs.blockstack/_data/clarityRef.json
```
```
## To view the clarity cli
You can view [the source code](https://github.com/blockstack/blockstack-core/blob/develop/src/clarity.rs).
1. Pull the Blockstack core clarity-developer-preview image from Docker Hub.
```bash
$ docker pull blockstack/blockstack-core:clarity-developer-preview
```
2. Start the Blockstack Core test environment with a Bash shell.
```bash
$ docker run -it -v $HOME/blockstack-dev-data:/data/ blockstack/blockstack-core:clarity-developer-preview bash
```
The command launches a container with the Clarity test environment and opens a bash shell into the container.
3. Run the clarity-cli in the shell.
```bash
root@5b9798633251:/src/blockstack-core# clarity-cli
Usage: clarity-cli [command]
where command is one of:
initialize to initialize a local VM state database.
mine_block to simulated mining a new block.
get_block_height to print the simulated block height.
check to typecheck a potential contract definition.
launch to launch a initialize a new contract in the local state database.
eval to evaluate (in read-only mode) a program in a given contract context.
eval_raw to typecheck and evaluate an expression without a contract or database context.
repl to typecheck and evaluate expressions in a stdin/stdout loop.
execute to execute a public function of a defined contract.
generate_address to generate a random Stacks public address for testing purposes.
```
# Technology Reference

9
_core/smart/clarityRef.md

@ -132,6 +132,15 @@ Response types represent the result of a public function. Use this type to indic
Response types contain two subtypes -- a response type in the event of `ok` (that is, a public function returns an integer code on success) and an `err` type (that is, a function returns a buffer on error).
### Algebraic
Clarity supports limited algebraic data types, it has an `(optional A)` type and a `(response A B)` type. An `(optioanl A)` type can either be `(some A)` or `(none)`, and a `(response A B)` type can either be `(ok A)` or `(err B)`. For example, `(some u3)` and `(none)` would have type `(optional uint)`, and `(ok \"woot!\")` and `(err 'false)` would have type `(response (buff 5) bool)`.
The algebraic data types have two variants (e.g. `(some ...)` or `(none)`; `(ok ...)` or `(err ...)`).
The `default-to`, `expects`, and `expects-err!` functions unpack algebraic data types. To *unpack* means to extract one of the "inner" types. Unpacking an `(optional A)` means to do something to get at `A`, and unpacking `(response A B)` means to do something to get at ether `A` or `B` (where "do something" is specific to the function doing the unpacking). The built-in functions that "unpack" an algebraic data type each behave differently.
## Keyword reference
{% capture keyword_list %}

26
_core/smart/tutorial.md

@ -65,9 +65,9 @@ If you haven't already done so, use the `cat` or `more` command to display the `
The first lines of the `tokens.clar` program contains a user-defined `get-balance` function.
```cl
(define-map tokens ((account principal)) ((balance int)))
(define-map tokens ((account principal)) ((balance uint)))
(define-private (get-balance (account principal))
(default-to 0 (get balance (map-get tokens (tuple (account account))))))
(default-to u0 (get balance (map-get? tokens (tuple (account account))))))
```
`get-balance` is a private function because it is constructed with the `define-private` call. To create public functions, you would use the `define-public` function. Public functions can be called from other contracts or even from the command line with the `clarity-cli`.
@ -79,12 +79,12 @@ Along with the `principal` types, Clarity supports booleans, integers, and fixe
The next sequence of lines shows an `if` statement that allows you to set conditions for execution in the language.
```cl
(define-private (token-credit! (account principal) (amount int))
(if (<= amount 0)
(define-private (token-credit! (account principal) (amount uint))
(if (<= amount u0)
(err "must move positive balance")
(let ((current-amount (get-balance account)))
(begin
(map-set! tokens (tuple (account account))
(map-set tokens (tuple (account account))
(tuple (balance (+ amount current-amount))))
(ok amount)))))
```
@ -94,21 +94,21 @@ Every smart contract has both a data space and code. The data space of a contrac
In the first `token-transfer` public function, you see that it calls the private `get-balance` function and passes it `tx-sender`. The `tx-sender` is a globally defined variable that represents the current principal.
```cl
(define-public (token-transfer (to principal) (amount int))
(define-public (token-transfer (to principal) (amount uint))
(let ((balance (get-balance tx-sender)))
(if (or (> amount balance) (<= amount 0))
(if (or (> amount balance) (<= amount u0))
(err "must transfer positive balance and possess funds")
(begin
(map-set! tokens (tuple (account tx-sender))
(map-set tokens (tuple (account tx-sender))
(tuple (balance (- balance amount))))
(token-credit! to amount)))))
(define-public (mint! (amount int))
(define-public (mint! (amount uint))
(let ((balance (get-balance tx-sender)))
(token-credit! tx-sender amount)))
(token-credit! 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR 10000)
(token-credit! 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G 300)
(token-credit! 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR u10000)
(token-credit! 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G u300)
```
The final two lines of the program pass a principal, represented by a Stacks address, and an amount to the private user-defined `token-credit` function.
@ -234,7 +234,7 @@ In this section, you use the public `mint!` function in the `tokens` contract t
2. Try minting some tokens and sending them to an address we'll use for our demo.
```bash
# clarity-cli execute /data/db $DEMO_ADDRESS.tokens mint! $DEMO_ADDRESS 100000
# clarity-cli execute /data/db $DEMO_ADDRESS.tokens mint! $DEMO_ADDRESS u100000
Transaction executed and committed. Returned: 100000
```
@ -271,7 +271,7 @@ Now, let's register a name using the `names.clar` contract. Names can _only_ be
2. Preorder the name using the _execute_ command:
```bash
# clarity-cli execute /data/db $DEMO_ADDRESS.names preorder $DEMO_ADDRESS 0xb572fb1ce2e9665f1efd0994fe077b50c3a48fde 1000
# clarity-cli execute /data/db $DEMO_ADDRESS.names preorder $DEMO_ADDRESS 0xb572fb1ce2e9665f1efd0994fe077b50c3a48fde u1000
e077b50c3a48fde 1000
Transaction executed and committed. Returned: 0
```

212
_data/clarityRef.json

@ -110,7 +110,7 @@
"output_type": "bool",
"signature": "(and b1 b2 ...)",
"description": "Returns `true` if all boolean inputs are `true`. Importantly, the supplied arguments are evaluated in-order and lazily. Lazy evaluation means that if one of the arguments returns `false`, the function short-circuits, and no subsequent arguments are evaluated.",
"example": "(and 'true 'false) ;; Returns 'false\n(and (eq? (+ 1 2) 1) (eq? 4 4)) ;; Returns 'false\n(and (eq? (+ 1 2) 3) (eq? 4 4)) ;; Returns 'true\n"
"example": "(and 'true 'false) ;; Returns 'false\n(and (is-eq (+ 1 2) 1) (is-eq 4 4)) ;; Returns 'false\n(and (is-eq (+ 1 2) 3) (is-eq 4 4)) ;; Returns 'true\n"
},
{
"name": "or",
@ -118,7 +118,7 @@
"output_type": "bool",
"signature": "(or b1 b2 ...)",
"description": "Returns `true` if any boolean inputs are `true`. Importantly, the supplied arguments are evaluated in-order and lazily. Lazy evaluation means that if one of the arguments returns `false`, the function short-circuits, and no subsequent arguments are evaluated.",
"example": "(or 'true 'false) ;; Returns 'true\n(or (eq? (+ 1 2) 1) (eq? 4 4)) ;; Returns 'true\n(or (eq? (+ 1 2) 1) (eq? 3 4)) ;; Returns 'false\n(or (eq? (+ 1 2) 3) (eq? 4 4)) ;; Returns 'true\n"
"example": "(or 'true 'false) ;; Returns 'true\n(or (is-eq (+ 1 2) 1) (is-eq 4 4)) ;; Returns 'true\n(or (is-eq (+ 1 2) 1) (is-eq 3 4)) ;; Returns 'false\n(or (is-eq (+ 1 2) 3) (is-eq 4 4)) ;; Returns 'true\n"
},
{
"name": "not",
@ -126,15 +126,15 @@
"output_type": "bool",
"signature": "(not b1)",
"description": "Returns the inverse of the boolean input.",
"example": "(not 'true) ;; Returns 'false\n(not (eq? 1 2)) ;; Returns 'true\n"
"example": "(not 'true) ;; Returns 'false\n(not (is-eq 1 2)) ;; Returns 'true\n"
},
{
"name": "eq?",
"name": "is-eq",
"input_type": "A, A, ...",
"output_type": "bool",
"signature": "(eq? v1 v2...)",
"description": "Compares the inputted values, returning `true` if they are all equal. Note that _unlike_ the `(and ...)` function, `(eq? ...)` will _not_ short-circuit.",
"example": "(eq? 1 1) ;; Returns 'true\n(eq? 1 'false) ;; Returns 'false\n(eq? \"abc\" 234 234) ;; Returns 'false\n"
"signature": "(is-eq v1 v2...)",
"description": "Compares the inputted values, returning `true` if they are all equal. Note that _unlike_ the `(and ...)` function, `(is-eq ...)` will _not_ short-circuit.",
"example": "(is-eq 1 1) ;; Returns 'true\n(is-eq 1 'false) ;; Returns 'false\n(is-eq \"abc\" 234 234) ;; Returns 'false\n"
},
{
"name": "if",
@ -168,6 +168,30 @@
"description": "The `fold` function applies the input function `func` to each element of the\ninput list _and_ the output of the previous application of the `fold` function. When invoked on\nthe first list element, it uses the `initial-value` as the second input. `fold` returns the last\nvalue return by the successive applications.",
"example": "(fold * (list 2 2 2) 1) ;; Returns 8\n(fold * (list 2 2 2) 0) ;; Returns 0"
},
{
"name": "append",
"input_type": "list A, A",
"output_type": "list",
"signature": "(append (list 1 2 3 4) 5)",
"description": "The `append` function takes a list and another value with the same entry type, \nor a buffer and another buffer of length 1 and outputs a buffer or a list of the same type with max_len += 1.",
"example": "(append (list 1 2 3 4) 5) ;; Returns (list 1 2 3 4 5)"
},
{
"name": "concat",
"input_type": "(buff, buff)|(list, list)",
"output_type": "buff|list",
"signature": "(concat buff-a buff-b)",
"description": "The `concat` function takes two buffers or two lists with the same entry type, \nand returns a concatenated buffer or list of the same entry type, with max_len = max_len_a + max_len_b.",
"example": "(concat \"hello \" \"world\") ;; Returns \"hello world\""
},
{
"name": "as-max-len?",
"input_type": "buff|list, uint",
"output_type": "(optional buff|list)",
"signature": "(as-max-len? buffer 10)",
"description": "The `as-max-len?` function takes a length N (must be a literal) and a buffer or list argument, which must be typed as a list \nor buffer of length M and outputs that same list or buffer, but typed with max length N. \nAt runtime, a check is performed, which if it fails, returns a (none) option.",
"example": "(as-max-len? (list 2 2 2) 3) ;; Returns (some (list 2 2 2))"
},
{
"name": "len",
"input_type": "buff|list",
@ -193,52 +217,52 @@
"example": "(var-get cursor) ;; Returns cursor"
},
{
"name": "var-set!",
"name": "var-set",
"input_type": "VarName, AnyType",
"output_type": "bool",
"signature": "(var-set! var-name expr1)",
"description": "The `var-set!` function sets the value associated with the input variable to the \ninputted value.",
"example": "(var-set! cursor (+ cursor 1)) ;; Returns 'true"
"signature": "(var-set var-name expr1)",
"description": "The `var-set` function sets the value associated with the input variable to the \ninputted value.",
"example": "(var-set cursor (+ cursor 1)) ;; Returns 'true"
},
{
"name": "map-get",
"name": "map-get?",
"input_type": "MapName, tuple",
"output_type": "(optional (tuple))",
"signature": "(map-get map-name key-tuple)",
"description": "The `map-get` function looks up and returns an entry from a contract's data map.\nThe value is looked up using `key-tuple`.\nIf there is no value associated with that key in the data map, the function returns a `none` option. Otherwise,\nit returns `(some value)`.",
"example": "(expects! (map-get names-map (tuple (name \"blockstack\"))) (err 1)) ;; Returns (tuple (id 1337))\n(expects! (map-get names-map ((name \"blockstack\"))) (err 1)) ;; Same command, using a shorthand for constructing the tuple\n"
"signature": "(map-get? map-name key-tuple)",
"description": "The `map-get?` function looks up and returns an entry from a contract's data map.\nThe value is looked up using `key-tuple`.\nIf there is no value associated with that key in the data map, the function returns a `none` option. Otherwise,\nit returns `(some value)`.",
"example": "(expects! (map-get? names-map (tuple (name \"blockstack\"))) (err 1)) ;; Returns (tuple (id 1337))\n(expects! (map-get? names-map ((name \"blockstack\"))) (err 1)) ;; Same command, using a shorthand for constructing the tuple\n"
},
{
"name": "contract-map-get",
"name": "contract-map-get?",
"input_type": "ContractName, MapName, tuple",
"output_type": "(optional (tuple))",
"signature": "(contract-map-get .contract-name map-name key-tuple)",
"description": "The `contract-map-get` function looks up and returns an entry from a\ncontract other than the current contract's data map. The value is looked up using `key-tuple`.\nIf there is no value associated with that key in the data map, the function returns a `none` option. Otherwise,\nit returns `(some value)`.",
"example": "(expects! (contract-map-get .names-contract names-map (tuple (name \"blockstack\")) (err 1))) ;; Returns (tuple (id 1337))\n(expects! (contract-map-get .names-contract names-map ((name \"blockstack\")) (err 1)));; Same command, using a shorthand for constructing the tuple\n"
"signature": "(contract-map-get? .contract-name map-name key-tuple)",
"description": "The `contract-map-get?` function looks up and returns an entry from a\ncontract other than the current contract's data map. The value is looked up using `key-tuple`.\nIf there is no value associated with that key in the data map, the function returns a `none` option. Otherwise,\nit returns `(some value)`.",
"example": "(expects! (contract-map-get? .names-contract names-map (tuple (name \"blockstack\")) (err 1))) ;; Returns (tuple (id 1337))\n(expects! (contract-map-get? .names-contract names-map ((name \"blockstack\")) (err 1)));; Same command, using a shorthand for constructing the tuple\n"
},
{
"name": "map-set!",
"name": "map-set",
"input_type": "MapName, tuple_A, tuple_B",
"output_type": "bool",
"signature": "(map-set! map-name key-tuple value-tuple)",
"description": "The `map-set!` function sets the value associated with the input key to the \ninputted value. This function performs a _blind_ update; whether or not a value is already associated\nwith the key, the function overwrites that existing association.",
"example": "(map-set! names-map (tuple (name \"blockstack\")) (tuple (id 1337))) ;; Returns 'true\n(map-set! names-map ((name \"blockstack\")) ((id 1337))) ;; Same command, using a shorthand for constructing the tuple\n"
"signature": "(map-set map-name key-tuple value-tuple)",
"description": "The `map-set` function sets the value associated with the input key to the \ninputted value. This function performs a _blind_ update; whether or not a value is already associated\nwith the key, the function overwrites that existing association.",
"example": "(map-set names-map (tuple (name \"blockstack\")) (tuple (id 1337))) ;; Returns 'true\n(map-set names-map ((name \"blockstack\")) ((id 1337))) ;; Same command, using a shorthand for constructing the tuple\n"
},
{
"name": "map-insert!",
"name": "map-insert",
"input_type": "MapName, tuple_A, tuple_B",
"output_type": "bool",
"signature": "(map-insert! map-name key-tuple value-tuple)",
"description": "The `map-insert!` function sets the value associated with the input key to the \ninputted value if and only if there is not already a value associated with the key in the map.\nIf an insert occurs, the function returns `true`. If a value already existed for\nthis key in the data map, the function returns `false`.",
"example": "(map-insert! names-map (tuple (name \"blockstack\")) (tuple (id 1337))) ;; Returns 'true\n(map-insert! names-map (tuple (name \"blockstack\")) (tuple (id 1337))) ;; Returns 'false\n(map-insert! names-map ((name \"blockstack\")) ((id 1337))) ;; Same command, using a shorthand for constructing the tuple\n"
"signature": "(map-insert map-name key-tuple value-tuple)",
"description": "The `map-insert` function sets the value associated with the input key to the \ninputted value if and only if there is not already a value associated with the key in the map.\nIf an insert occurs, the function returns `true`. If a value already existed for\nthis key in the data map, the function returns `false`.",
"example": "(map-insert names-map (tuple (name \"blockstack\")) (tuple (id 1337))) ;; Returns 'true\n(map-insert names-map (tuple (name \"blockstack\")) (tuple (id 1337))) ;; Returns 'false\n(map-insert names-map ((name \"blockstack\")) ((id 1337))) ;; Same command, using a shorthand for constructing the tuple\n"
},
{
"name": "map-delete!",
"name": "map-delete",
"input_type": "MapName, tuple",
"output_type": "bool",
"signature": "(map-delete! map-name key-tuple)",
"description": "The `map-delete!` function removes the value associated with the input key for\nthe given map. If an item exists and is removed, the function returns `true`.\nIf a value did not exist for this key in the data map, the function returns `false`.",
"example": "(map-delete! names-map (tuple (name \"blockstack\"))) ;; Returns 'true\n(map-delete! names-map (tuple (name \"blockstack\"))) ;; Returns 'false\n(map-delete! names-map ((name \"blockstack\"))) ;; Same command, using a shorthand for constructing the tuple\n"
"signature": "(map-delete map-name key-tuple)",
"description": "The `map-delete` function removes the value associated with the input key for\nthe given map. If an item exists and is removed, the function returns `true`.\nIf a value did not exist for this key in the data map, the function returns `false`.",
"example": "(map-delete names-map (tuple (name \"blockstack\"))) ;; Returns 'true\n(map-delete names-map (tuple (name \"blockstack\"))) ;; Returns 'false\n(map-delete names-map ((name \"blockstack\"))) ;; Same command, using a shorthand for constructing the tuple\n"
},
{
"name": "tuple",
@ -254,7 +278,7 @@
"output_type": "A",
"signature": "(get key-name tuple)",
"description": "The `get` function fetches the value associated with a given key from the supplied typed tuple.\nIf an `Optional` value is supplied as the inputted tuple, `get` returns an `Optional` type of the specified key in\nthe tuple. If the supplied option is a `(none)` option, get returns `(none)`.",
"example": "(get id (tuple (name \"blockstack\") (id 1337))) ;; Returns 1337\n(get id (map-get names-map (tuple (name \"blockstack\")))) ;; Returns (some 1337)\n(get id (map-get names-map (tuple (name \"non-existent\")))) ;; Returns (none)\n"
"example": "(get id (tuple (name \"blockstack\") (id 1337))) ;; Returns 1337\n(get id (map-get? names-map (tuple (name \"blockstack\")))) ;; Returns (some 1337)\n(get id (map-get? names-map (tuple (name \"non-existent\")))) ;; Returns (none)\n"
},
{
"name": "begin",
@ -266,7 +290,7 @@
},
{
"name": "hash160",
"input_type": "buff|int",
"input_type": "buff|uint|int",
"output_type": "(buff 20)",
"signature": "(hash160 value)",
"description": "The `hash160` function computes `RIPEMD160(SHA256(x))` of the inputted value.\nIf an integer (128 bit) is supplied the hash is computed over the little-endian representation of the\ninteger.",
@ -274,7 +298,7 @@
},
{
"name": "sha256",
"input_type": "buff|int",
"input_type": "buff|uint|int",
"output_type": "(buff 32)",
"signature": "(sha256 value)",
"description": "The `sha256` function computes `SHA256(x)` of the inputted value.\nIf an integer (128 bit) is supplied the hash is computed over the little-endian representation of the\ninteger.",
@ -282,7 +306,7 @@
},
{
"name": "sha512",
"input_type": "buff|int",
"input_type": "buff|uint|int",
"output_type": "(buff 64)",
"signature": "(sha512 value)",
"description": "The `sha512` function computes `SHA512(x)` of the inputted value.\nIf an integer (128 bit) is supplied the hash is computed over the little-endian representation of the\ninteger.",
@ -290,7 +314,7 @@
},
{
"name": "sha512/256",
"input_type": "buff|int",
"input_type": "buff|uint|int",
"output_type": "(buff 32)",
"signature": "(sha512/256 value)",
"description": "The `sha512/256` function computes `SHA512/256(x)` (the SHA512 algorithm with the 512/256 initialization vector, truncated\nto 256 bits) of the inputted value.\nIf an integer (128 bit) is supplied the hash is computed over the little-endian representation of the\ninteger.",
@ -298,7 +322,7 @@
},
{
"name": "keccak256",
"input_type": "buff|int",
"input_type": "buff|uint|int",
"output_type": "(buff 32)",
"signature": "(keccak256 value)",
"description": "The `keccak256` function computes `KECCAK256(value)` of the inputted value.\nNote that this differs from the `NIST SHA-3` (that is, FIPS 202) standard. If an integer (128 bit) \nis supplied the hash is computed over the little-endian representation of the integer.",
@ -313,12 +337,12 @@
"example": "(print (+ 1 2 3)) ;; Returns 6"
},
{
"name": "contract-call!",
"name": "contract-call?",
"input_type": "ContractName, PublicFunctionName, Arg0, ...",
"output_type": "(response A B)",
"signature": "(contract-call! .contract-name function-name arg0 arg1 ...)",
"description": "The `contract-call!` function executes the given public function of the given contract.\nYou _may not_ this function to call a public function defined in the current contract. If the public\nfunction returns _err_, any database changes resulting from calling `contract-call!` are aborted.\nIf the function returns _ok_, database changes occurred.",
"example": "(contract-call! .tokens transfer 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR 19) ;; Returns (ok 1)"
"signature": "(contract-call? .contract-name function-name arg0 arg1 ...)",
"description": "The `contract-call?` function executes the given public function of the given contract.\nYou _may not_ this function to call a public function defined in the current contract. If the public\nfunction returns _err_, any database changes resulting from calling `contract-call?` are aborted.\nIf the function returns _ok_, database changes occurred.",
"example": "(contract-call? .tokens transfer 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR 19) ;; Returns (ok 1)"
},
{
"name": "as-contract",
@ -334,15 +358,15 @@
"output_type": "A",
"signature": "(at-block block-hash expr)",
"description": "The `at-block` function evaluates the expression `expr` _as if_ it were evaluated at the end of the\nblock indicated by the _block-hash_ argument. The `expr` closure must be read-only.\n\nThe function returns the result of evaluating `expr`.\n",
"example": "(at-block 0x0000000000000000000000000000000000000000000000000000000000000000 (var-get data))\n(at-block (get-block-info header-hash (- block-height 10)) (var-get data))"
"example": "(at-block 0x0000000000000000000000000000000000000000000000000000000000000000 (var-get data))\n(at-block (get-block-info? header-hash (- block-height u10)) (var-get data))"
},
{
"name": "get-block-info",
"name": "get-block-info?",
"input_type": "BlockInfoPropertyName, BlockHeightInt",
"output_type": "buff | int",
"signature": "(get-block-info prop-name block-height-expr)",
"description": "The `get-block-info` function fetches data for a block of the given block height. The \nvalue and type returned are determined by the specified `BlockInfoPropertyName`. If the provided `BlockHeightInt` does\nnot correspond to an existing block, the function is aborted. The currently available property names \nare `time`, `header-hash`, `burnchain-header-hash`, and `vrf-seed`. \n\nThe `time` property returns an integer value of the block header time field. This is a Unix epoch timestamp in seconds \nwhich roughly corresponds to when the block was mined. **Warning**: this does not increase monotonically with each block\nand block times are accurate only to within two hours. See [BIP113](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki) for more information. \n\nThe `header-hash`, `burnchain-header-hash`, and `vrf-seed` properties return a 32-byte buffer. \n",
"example": "(get-block-info time 10) ;; Returns 1557860301\n(get-block-info header-hash 2) ;; Returns 0x374708fff7719dd5979ec875d56cd2286f6d3cf7ec317a3b25632aab28ec37bb\n(get-block-info vrf-seed 6) ;; Returns 0xf490de2920c8a35fabeb13208852aa28c76f9be9b03a4dd2b3c075f7a26923b4\n"
"output_type": "(optional buff) | (optional uint)",
"signature": "(get-block-info? prop-name block-height-expr)",
"description": "The `get-block-info?` function fetches data for a block of the given block height. The \nvalue and type returned are determined by the specified `BlockInfoPropertyName`. If the provided `BlockHeightInt` does\nnot correspond to an existing block prior to the current block, the function returns `none`. The currently available property names \nare `time`, `header-hash`, `burnchain-header-hash`, and `vrf-seed`. \n\nThe `time` property returns an integer value of the block header time field. This is a Unix epoch timestamp in seconds \nwhich roughly corresponds to when the block was mined. **Warning**: this does not increase monotonically with each block\nand block times are accurate only to within two hours. See [BIP113](https://github.com/bitcoin/bips/blob/master/bip-0113.mediawiki) for more information. \n\nThe `header-hash`, `burnchain-header-hash`, and `vrf-seed` properties return a 32-byte buffer. \n",
"example": "(get-block-info? time u10) ;; Returns (some 1557860301)\n(get-block-info? header-hash u2) ;; Returns (some 0x374708fff7719dd5979ec875d56cd2286f6d3cf7ec317a3b25632aab28ec37bb)\n(get-block-info? vrf-seed u6) ;; Returns (some 0xf490de2920c8a35fabeb13208852aa28c76f9be9b03a4dd2b3c075f7a26923b4)\n"
},
{
"name": "err",
@ -366,7 +390,7 @@
"output_type": "(optional A)",
"signature": "(some value)",
"description": "The `some` function constructs a `optional` type from the input value.",
"example": "(some 1) ;; Returns (some 1)\n(is-none? (some 2)) ;; Returns 'false"
"example": "(some 1) ;; Returns (some 1)\n(is-none (some 2)) ;; Returns 'false"
},
{
"name": "default-to",
@ -374,7 +398,7 @@
"output_type": "A",
"signature": "(default-to default-value option-value)",
"description": "The `default-to` function attempts to 'unpack' the second argument: if the argument is\na `(some ...)` option, it returns the inner value of the option. If the second argument is a `(none)` value,\n`default-to` it returns the value of `default-value`.",
"example": "(default-to 0 (get id (map-get names-map (tuple (name \"blockstack\"))))) ;; Returns 1337\n(default-to 0 (get id (map-get names-map (tuple (name \"non-existant\"))))) ;; Returns 0\n"
"example": "(default-to 0 (get id (map-get? names-map (tuple (name \"blockstack\"))))) ;; Returns 1337\n(default-to 0 (get id (map-get? names-map (tuple (name \"non-existant\"))))) ;; Returns 0\n"
},
{
"name": "asserts!",
@ -382,7 +406,7 @@
"output_type": "bool",
"signature": "(asserts! bool-expr thrown-value)",
"description": "The `asserts!` function admits a boolean argument and asserts its evaluation: \nif bool-expr is `true`, `asserts!` returns `true` and proceeds in the program execution. \nIf the supplied argument is returning a 'false value, `asserts!` _returns_ `thrown-value` and exits the current \ncontrol-flow.",
"example": "(asserts! (eq? 1 1) (err 1)) ;; Returns 'true"
"example": "(asserts! (is-eq 1 1) (err 1)) ;; Returns 'true"
},
{
"name": "expects!",
@ -390,7 +414,7 @@
"output_type": "A",
"signature": "(expects! option-input thrown-value)",
"description": "The `expects!` function attempts to 'unpack' the first argument: if the argument is\nan option type, and the argument is a `(some ...)` option, `expects!` returns the inner value of the\noption. If the argument is a response type, and the argument is an `(ok ...)` response, `expects!` returns\n the inner value of the `ok`. If the supplied argument is either an `(err ...)` or a `(none)` value,\n`expects!` _returns_ `thrown-value` from the current function and exits the current control-flow.",
"example": "(expects! (map-get names-map (tuple (name \"blockstack\"))) (err 1)) ;; Returns (tuple (id 1337))"
"example": "(expects! (map-get? names-map (tuple (name \"blockstack\"))) (err 1)) ;; Returns (tuple (id 1337))"
},
{
"name": "expects-err!",
@ -401,20 +425,20 @@
"example": "(expects-err! (err 1) 'false) ;; Returns 1"
},
{
"name": "is-ok?",
"name": "is-ok",
"input_type": "(response A B)",
"output_type": "bool",
"signature": "(is-ok? value)",
"description": "`is-ok?` tests a supplied response value, returning `true` if the response was `ok`,\nand `false` if it was an `err`.",
"example": "(is-ok? (ok 1)) ;; Returns 'true\n(is-ok? (err 1)) ;; Returns 'false"
"signature": "(is-ok value)",
"description": "`is-ok` tests a supplied response value, returning `true` if the response was `ok`,\nand `false` if it was an `err`.",
"example": "(is-ok (ok 1)) ;; Returns 'true\n(is-ok (err 1)) ;; Returns 'false"
},
{
"name": "is-none?",
"name": "is-none",
"input_type": "(optional A)",
"output_type": "bool",
"signature": "(is-none? value)",
"description": "`is-none?` tests a supplied option value, returning `true` if the option value is `(none)`,\nand `false` if it is a `(some ...)`.",
"example": "(is-none? (get id (map-get names-map (tuple (name \"blockstack\"))))) ;; Returns 'false\n(is-none? (get id (map-get names-map (tuple (name \"non-existant\"))))) ;; Returns 'true"
"signature": "(is-none value)",
"description": "`is-none` tests a supplied option value, returning `true` if the option value is `(none)`,\nand `false` if it is a `(some ...)`.",
"example": "(is-none (get id (map-get? names-map (tuple (name \"blockstack\"))))) ;; Returns 'false\n(is-none (get id (map-get? names-map (tuple (name \"non-existant\"))))) ;; Returns 'true"
},
{
"name": "filter",
@ -427,50 +451,50 @@
{
"name": "ft-get-balance",
"input_type": "TokenName, principal",
"output_type": "int",
"output_type": "uint",
"signature": "(ft-get-balance token-name principal)",
"description": "`ft-get-balance` returns `token-name` balance of the principal `principal`.\nThe token type must have been defined using `define-fungible-token`.",
"example": "\n(define-fungible-token stackaroos)\n(ft-get-balance stackaroos tx-sender)\n"
},
{
"name": "nft-get-owner",
"name": "nft-get-owner?",
"input_type": "AssetName, A",
"output_type": "(optional principal)",
"signature": "(nft-get-owner asset-class asset-identifier)",
"description": "`nft-get-owner` returns the owner of an asset, identified by `asset-identifier`, or `none` if the asset does not exist.\nThe asset type must have been defined using `define-non-fungible-token`, and the supplied `asset-identifier` must be of the same type specified in\nthat definition.",
"example": "\n(define-non-fungible-token stackaroo (buff 40))\n(nft-get-owner stackaroo \"Roo\")\n"
"signature": "(nft-get-owner? asset-class asset-identifier)",
"description": "`nft-get-owner?` returns the owner of an asset, identified by `asset-identifier`, or `none` if the asset does not exist.\nThe asset type must have been defined using `define-non-fungible-token`, and the supplied `asset-identifier` must be of the same type specified in\nthat definition.",
"example": "\n(define-non-fungible-token stackaroo (buff 40))\n(nft-get-owner? stackaroo \"Roo\")\n"
},
{
"name": "ft-transfer!",
"name": "ft-transfer?",
"input_type": "TokenName, int, principal, principal",
"output_type": "(response bool int)",
"signature": "(ft-transfer! token-name amount sender recipient)",
"description": "`ft-transfer!` is used to increase the token balance for the `recipient` principal for a token\ntype defined using `define-fungible-token` by debiting the `sender` principal.\n\nThis function returns (ok true) if the transfer is successful. In the event of an unsuccessful transfer it returns\none of the following error codes:\n\n`(err 1)` -- `sender` does not have enough balance to transfer\n`(err 2)` -- `sender` and `recipient` are the same principal\n`(err 3)` -- amount to send is non-positive\n",
"example": "\n(define-fungible-token stackaroo)\n(ft-mint! stackaroo 100 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)\n(ft-transfer! stackaroo 50 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (ok true)\n(ft-transfer! stackaroo 60 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (err 1)\n"
"output_type": "(response bool uint)",
"signature": "(ft-transfer? token-name amount sender recipient)",
"description": "`ft-transfer?` is used to increase the token balance for the `recipient` principal for a token\ntype defined using `define-fungible-token` by debiting the `sender` principal.\n\nThis function returns (ok true 1) if the transfer is successful. In the event of an unsuccessful transfer it returns\none of the following error codes:\n\n`(err 1)` -- `sender` does not have enough balance to transfer\n`(err 2)` -- `sender` and `recipient` are the same principal\n`(err 3)` -- amount to send is non-positive\n",
"example": "\n(define-fungible-token stackaroo)\n(ft-mint? stackaroo u100 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)\n(ft-transfer? stackaroo u50 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (ok true 50)\n(ft-transfer? stackaroo u60 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (err 1)\n"
},
{
"name": "nft-transfer!",
"name": "nft-transfer?",
"input_type": "AssetName, A, principal, principal",
"output_type": "(response bool int)",
"signature": "(nft-transfer! asset-class asset-identifier sender recipient)",
"description": "`nft-transfer!` is used to change the owner of an asset identified by `asset-identifier`\nfrom `sender` to `recipient`. The `asset-class` must have been defined by `define-non-fungible-token` and `asset-identifier`\nmust be of the type specified in that definition.\n\nThis function returns (ok true) if the transfer is successful. In the event of an unsuccessful transfer it returns\none of the following error codes:\n\n`(err 1)` -- `sender` does not own the asset\n`(err 2)` -- `sender` and `recipient` are the same principal\n`(err 3)` -- asset identified by asset-identifier does not exist\n",
"example": "\n(define-non-fungible-token stackaroo (buff 40))\n(nft-mint! stackaroo \"Roo\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)\n(nft-transfer! stackaroo \"Roo\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (ok true)\n(nft-transfer! stackaroo \"Roo\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (err 1)\n(nft-transfer! stackaroo \"Stacka\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (err 3)\n"
"output_type": "(response bool uint)",
"signature": "(nft-transfer? asset-class asset-identifier sender recipient)",
"description": "`nft-transfer?` is used to change the owner of an asset identified by `asset-identifier`\nfrom `sender` to `recipient`. The `asset-class` must have been defined by `define-non-fungible-token` and `asset-identifier`\nmust be of the type specified in that definition.\n\nThis function returns (ok true 1) if the transfer is successful. In the event of an unsuccessful transfer it returns\none of the following error codes:\n\n`(err 1)` -- `sender` does not own the asset\n`(err 2)` -- `sender` and `recipient` are the same principal\n`(err 3)` -- asset identified by asset-identifier does not exist\n",
"example": "\n(define-non-fungible-token stackaroo (buff 40))\n(nft-mint? stackaroo \"Roo\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)\n(nft-transfer? stackaroo \"Roo\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (ok true 1)\n(nft-transfer? stackaroo \"Roo\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (err 1)\n(nft-transfer? stackaroo \"Stacka\" 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR tx-sender) ;; returns (err 3)\n"
},
{
"name": "nft-mint!",
"name": "nft-mint?",
"input_type": "AssetName, A, principal",
"output_type": "(response bool int)",
"signature": "(nft-mint! asset-class asset-identifier recipient)",
"description": "`nft-mint!` is used to instantiate an asset and set that asset's owner to the `recipient` principal.\nThe asset must have been defined using `define-non-fungible-token`, and the supplied `asset-identifier` must be of the same type specified in\nthat definition.\n\nIf an asset identified by `asset-identifier` _already exists_, this function will return an error with the following error code:\n\n`(err 1)`\n\nOtherwise, on successfuly mint, it returns `(ok 'true)`.\n",
"example": "\n(define-non-fungible-token stackaroo (buff 40))\n(nft-mint! stackaroo \"Roo\" tx-sender)\n"
"output_type": "(response bool uint)",
"signature": "(nft-mint? asset-class asset-identifier recipient)",
"description": "`nft-mint?` is used to instantiate an asset and set that asset's owner to the `recipient` principal.\nThe asset must have been defined using `define-non-fungible-token`, and the supplied `asset-identifier` must be of the same type specified in\nthat definition.\n\nIf an asset identified by `asset-identifier` _already exists_, this function will return an error with the following error code:\n\n`(err 1)`\n\nOtherwise, on successfuly mint, it returns `(ok 'true 1)`.\n",
"example": "\n(define-non-fungible-token stackaroo (buff 40))\n(nft-mint? stackaroo \"Roo\" tx-sender)\n"
},
{
"name": "ft-mint!",
"input_type": "TokenName, int, principal",
"output_type": "(response bool int)",
"signature": "(ft-mint! token-name amount recipient)",
"description": "`ft-mint!` is used to increase the token balance for the `recipient` principal for a token\ntype defined using `define-fungible-token`. The increased token balance is _not_ transfered from another principal, but\nrather minted.\n\nIf a non-positive amount is provided to mint, this function returns `(err 1)`. Otherwise, on successfuly mint, it\nreturns `(ok 'true)`.\n",
"example": "\n(define-fungible-token stackaroo)\n(ft-mint! stackaroo 100 tx-sender)\n"
"name": "ft-mint?",
"input_type": "TokenName, uint, principal",
"output_type": "(response bool uint)",
"signature": "(ft-mint? token-name amount recipient)",
"description": "`ft-mint?` is used to increase the token balance for the `recipient` principal for a token\ntype defined using `define-fungible-token`. The increased token balance is _not_ transfered from another principal, but\nrather minted.\n\nIf a non-positive amount is provided to mint, this function returns `(err 1)`. Otherwise, on successfuly mint, it\nreturns `(ok 'true 1)`.\n",
"example": "\n(define-fungible-token stackaroo)\n(ft-mint? stackaroo u100 tx-sender)\n"
},
{
"name": "define-constant",
@ -493,7 +517,7 @@
"input_type": "MethodSignature, MethodBody",
"output_type": "Not Applicable",
"signature": "(define-public (function-name (arg-name-0 arg-type-0) (arg-name-1 arg-type-1) ...) function-body)",
"description": "`define-public` is used to define a _public_ function and transaction for a smart contract. Public\nfunctions are callable from other smart contracts and may be invoked directly by users by submitting a transaction\nto the Stacks blockchain.\n\nLike other kinds of definition statements, `define-public` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nPublic functions _must_ return a ResponseType (using either `ok` or `err`). Any datamap modifications performed by\na public function is aborted if the function returns an `err` type. Public functions may be invoked by other\ncontracts via `contract-call!`.",
"description": "`define-public` is used to define a _public_ function and transaction for a smart contract. Public\nfunctions are callable from other smart contracts and may be invoked directly by users by submitting a transaction\nto the Stacks blockchain.\n\nLike other kinds of definition statements, `define-public` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nPublic functions _must_ return a ResponseType (using either `ok` or `err`). Any datamap modifications performed by\na public function is aborted if the function returns an `err` type. Public functions may be invoked by other\ncontracts via `contract-call?`.",
"example": "\n(define-public (hello-world (input int))\n (begin (print (+ 2 input))\n (ok input)))\n"
},
{
@ -501,7 +525,7 @@
"input_type": "MethodSignature, MethodBody",
"output_type": "Not Applicable",
"signature": "(define-read-only (function-name (arg-name-0 arg-type-0) (arg-name-1 arg-type-1) ...) function-body)",
"description": "`define-read-only` is used to define a _public read-only_ function for a smart contract. Such\nfunctions are callable from other smart contracts.\n\nLike other kinds of definition statements, `define-read-only` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nRead-only functions may return any type. However, read-only functions\nmay not perform any datamap modifications, or call any functions which\nperform such modifications. This is enforced both during type checks and during\nthe execution of the function. Public read-only functions may\nbe invoked by other contracts via `contract-call!`.",
"description": "`define-read-only` is used to define a _public read-only_ function for a smart contract. Such\nfunctions are callable from other smart contracts.\n\nLike other kinds of definition statements, `define-read-only` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nRead-only functions may return any type. However, read-only functions\nmay not perform any datamap modifications, or call any functions which\nperform such modifications. This is enforced both during type checks and during\nthe execution of the function. Public read-only functions may\nbe invoked by other contracts via `contract-call?`.",
"example": "\n(define-read-only (just-return-one-hundred) \n (* 10 10))"
},
{
@ -510,7 +534,7 @@
"output_type": "Not Applicable",
"signature": "(define-map map-name ((key-name-0 key-type-0) ...) ((val-name-0 val-type-0) ...))",
"description": "`define-map` is used to define a new datamap for use in a smart contract. Such\nmaps are only modifiable by the current smart contract.\n\nMaps are defined with a key tuple type and value tuple type. These are defined using a list\nof name and type pairs, e.g., a key type might be `((id int))`, which is a tuple with a single \"id\"\nfield of type `int`.\n\nLike other kinds of definition statements, `define-map` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).",
"example": "\n(define-map squares ((x int)) ((square int)))\n(define (add-entry (x int))\n (map-insert! squares ((x 2)) ((square (* x x)))))\n(add-entry 1)\n(add-entry 2)\n(add-entry 3)\n(add-entry 4)\n(add-entry 5)\n"
"example": "\n(define-map squares ((x int)) ((square int)))\n(define (add-entry (x int))\n (map-insert squares ((x 2)) ((square (* x x)))))\n(add-entry 1)\n(add-entry 2)\n(add-entry 3)\n(add-entry 4)\n(add-entry 5)\n"
},
{
"name": "define-data-var",
@ -518,14 +542,14 @@
"output_type": "Not Applicable",
"signature": "(define-data-var var-name type value)",
"description": "`define-data-var` is used to define a new persisted variable for use in a smart contract. Such\nvariable are only modifiable by the current smart contract.\n\nPersisted variable are defined with a type and a value.\n\nLike other kinds of definition statements, `define-data-var` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).",
"example": "\n(define-data-var size int 0)\n(define (set-size (value int))\n (var-set! size value))\n(set-size 1)\n(set-size 2)\n"
"example": "\n(define-data-var size int 0)\n(define (set-size (value int))\n (var-set size value))\n(set-size 1)\n(set-size 2)\n"
},
{
"name": "define-fungible-token",
"input_type": "TokenName, <int>",
"input_type": "TokenName, <uint>",
"output_type": "Not Applicable",
"signature": "(define-fungible-token token-name <total-supply>)",
"description": "`define-fungible-token` is used to define a new fungible token class for use in the current contract.\n\nThe second argument, if supplied, defines the total supply of the fungible token. This ensures that all calls to the `ft-mint!`\nfunction will never be able to create more than `total-supply` tokens. If any such call were to increase the total supply\nof tokens passed that amount, that invocation of `ft-mint!` will result in a runtime error and abort.\n\nLike other kinds of definition statements, `define-fungible-token` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nTokens defined using `define-fungible-token` may be used in `ft-transfer!`, `ft-mint!`, and `ft-get-balance` functions",
"description": "`define-fungible-token` is used to define a new fungible token class for use in the current contract.\n\nThe second argument, if supplied, defines the total supply of the fungible token. This ensures that all calls to the `ft-mint?`\nfunction will never be able to create more than `total-supply` tokens. If any such call were to increase the total supply\nof tokens passed that amount, that invocation of `ft-mint?` will result in a runtime error and abort.\n\nLike other kinds of definition statements, `define-fungible-token` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nTokens defined using `define-fungible-token` may be used in `ft-transfer?`, `ft-mint?`, and `ft-get-balance` functions",
"example": "\n(define-fungible-token stacks)\n"
},
{
@ -533,7 +557,7 @@
"input_type": "AssetName, TypeSignature",
"output_type": "Not Applicable",
"signature": "(define-non-fungible-token asset-name asset-identifier-type)",
"description": "`define-non-fungible-token` is used to define a new non-fungible token class for use in the current contract.\nIndividual assets are identified by their asset identifier, which must be of the type `asset-identifier-type`. Asset\nidentifiers are _unique_ identifiers.\n\nLike other kinds of definition statements, `define-non-fungible-token` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nAssets defined using `define-non-fungible-token` may be used in `nft-transfer!`, `nft-mint!`, and `nft-get-owner` functions",
"description": "`define-non-fungible-token` is used to define a new non-fungible token class for use in the current contract.\nIndividual assets are identified by their asset identifier, which must be of the type `asset-identifier-type`. Asset\nidentifiers are _unique_ identifiers.\n\nLike other kinds of definition statements, `define-non-fungible-token` may only be used at the top level of a smart contract\ndefinition (i.e., you cannot put a define statement in the middle of a function body).\n\nAssets defined using `define-non-fungible-token` may be used in `nft-transfer?`, `nft-mint?`, and `nft-get-owner?` functions",
"example": "\n(define-non-fungible-token names (buff 50))\n"
}
],
@ -541,7 +565,7 @@
{
"name": "contract-caller",
"output_type": "principal",
"description": "Returns the caller of the current contract context. If this contract is the first one called by a signed transaction, \nthe caller will be equal to the signing principal. If `contract-call!` was used to invoke a function from a new contract, `contract-caller`\nchanges to the _calling_ contract's principal. If `as-contract` is used to change the `tx-sender` context, `contract-caller` _also_ changes\nto the same contract principal.",
"description": "Returns the caller of the current contract context. If this contract is the first one called by a signed transaction, \nthe caller will be equal to the signing principal. If `contract-call?` was used to invoke a function from a new contract, `contract-caller`\nchanges to the _calling_ contract's principal. If `as-contract` is used to change the `tx-sender` context, `contract-caller` _also_ changes\nto the same contract principal.",
"example": "(print contract-caller) ;; Will print out a Stacks address of the transaction sender"
},
{
@ -552,7 +576,7 @@
},
{
"name": "block-height",
"output_type": "int",
"output_type": "uint",
"description": "Returns the current block height of the Stacks blockchain as an int",
"example": "(> block-height 1000) ;; returns true if the current block-height has passed 1000 blocks."
},

73
_data/cliRef.json

@ -16,7 +16,7 @@
],
"command": "announce",
"group": "Peer Services",
"usage": "Broadcast a message on the blockchain for subscribers to read. The `MESSAGE_HASH` argument must be the hash of a previously-announced zone file. The `OWNER_KEY` used to sign the transaction must correspond to the Blockstack ID to which other users have already subscribed. `OWNER_KEY` can be a single private key or a serialized multisig private key bundle.\n\nIf this command succeeds, it will print a transaction ID. The rest of the Blockstack peer network will process it once the transaction reaches 7 confirmations.\n\nExamples:\n\n $ # Tip: You can obtain the owner key with the get_owner_keys command\n $ export OWNER_KEY=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ blockstack-cli announce 737c631c7c5d911c6617993c21fba731363f1cfe \"$OWNER_KEY\"\n d51749aeec2803e91a2f8bdec8d3e413491fd816b4962372b214ab74acb0bba8\n\n $ export OWNER_KEY=\"2,136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01,1885cba486a42960499d1f137ef3a475725ceb11f45d74631f9928280196f67401,2418981c7f3a91d4467a65a518e14fafa30e07e6879c11fab7106ea72b49a7cb01\"\n $ blockstack-cli announce 737c631c7c5d911c6617993c21fba731363f1cfe \"$OWNER_KEY\"\n 8136a1114098893b28a693e8d84451abf99ee37ef8766f4bc59808eed76968c9\n\n"
"usage": "Broadcast a message on the blockchain for subscribers to read. The MESSAGE_HASH argument must be the hash of a previously-announced zone file. The OWNER_KEY used to sign the transaction must correspond to the Blockstack ID to which other users have already subscribed. OWNER_KEY can be a single private key or a serialized multisig private key bundle.\n\nIf this command succeeds, it will print a transaction ID. The rest of the Blockstack peer network will process it once the transaction reaches 7 confirmations.\n\nExamples:\n\n $ # Tip: You can obtain the owner key with the get_owner_keys command\n $ export OWNER_KEY=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ blockstack-cli announce 737c631c7c5d911c6617993c21fba731363f1cfe \"$OWNER_KEY\"\n d51749aeec2803e91a2f8bdec8d3e413491fd816b4962372b214ab74acb0bba8\n\n $ export OWNER_KEY=\"2,136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01,1885cba486a42960499d1f137ef3a475725ceb11f45d74631f9928280196f67401,2418981c7f3a91d4467a65a518e14fafa30e07e6879c11fab7106ea72b49a7cb01\"\n $ blockstack-cli announce 737c631c7c5d911c6617993c21fba731363f1cfe \"$OWNER_KEY\"\n 8136a1114098893b28a693e8d84451abf99ee37ef8766f4bc59808eed76968c9\n\n"
},
{
"args": [
@ -124,7 +124,7 @@
],
"command": "encrypt_keychain",
"group": "Key Management",
"usage": "Encrypt a 12-word backup phrase, which can be decrypted later with the `decrypt_backup_phrase` command. The password will be prompted if not given.\n\nExample:\n\n $ # password is \"asdf\"\n $ blockstack-cli encrypt_keychain \"section amount spend resemble spray verify night immune tattoo best emotion parrot\"\n Enter password:\n Enter password again:\n M+DnBHYb1fgw4N3oZ+5uTEAua5bAWkgTW/SjmmBhGGbJtjOtqVV+RrLJEJOgT35hBon4WKdGWye2vTdgqDo7+HIobwJwkQtN2YF9g3zPsKk="
"usage": "Encrypt a 12-word backup phrase, which can be decrypted later with the decrypt_backup_phrase command. The password will be prompted if not given.\n\nExample:\n\n $ # password is \"asdf\"\n $ blockstack-cli encrypt_keychain \"section amount spend resemble spray verify night immune tattoo best emotion parrot\"\n Enter password:\n Enter password again:\n M+DnBHYb1fgw4N3oZ+5uTEAua5bAWkgTW/SjmmBhGGbJtjOtqVV+RrLJEJOgT35hBon4WKdGWye2vTdgqDo7+HIobwJwkQtN2YF9g3zPsKk="
},
{
"args": [
@ -161,7 +161,7 @@
],
"command": "gaia_dump_bucket",
"group": "Gaia",
"usage": "Download the contents of a Gaia hub bucket to a given directory. The `GAIA_HUB` argument must correspond to the *write* endpoint of the Gaia hub -- that is, you should be able to fetch `$GAIA_HUB/hub_info`. If `DUMP_DIR` does not exist, it will be created.\n\nExample:\n\n $ export BACKUP_PHRASE=\"section amount spend resemble spray verify night immune tattoo best emotion parrot\n $ blockstack-cli gaia_dump_bucket hello.id.blockstack https://sample.app https://hub.blockstack.org \"$BACKUP_PHRASE\" ./backups\n Download 3 files...\n Download hello_world to ./backups/hello_world\n Download dir/format to ./backups/dir\\x2fformat\n Download /.dotfile to ./backups/\\x2f.dotfile\n 3\n"
"usage": "Download the contents of a Gaia hub bucket to a given directory. The GAIA_HUB argument must correspond to the *write* endpoint of the Gaia hub -- that is, you should be able to fetch $GAIA_HUB/hub_info. If DUMP_DIR does not exist, it will be created.\n\nExample:\n\n $ export BACKUP_PHRASE=\"section amount spend resemble spray verify night immune tattoo best emotion parrot\n $ blockstack-cli gaia_dump_bucket hello.id.blockstack https://sample.app https://hub.blockstack.org \"$BACKUP_PHRASE\" ./backups\n Download 3 files...\n Download hello_world to ./backups/hello_world\n Download dir/format to ./backups/dir\\x2fformat\n Download /.dotfile to ./backups/\\x2f.dotfile\n 3\n"
},
{
"args": [
@ -204,7 +204,7 @@
],
"command": "gaia_getfile",
"group": "Gaia",
"usage": "Get a file from another user's Gaia hub. Prints the file data to stdout. If you want to read an encrypted file, and/or verify a signed file, then you must pass an app private key, and pass 1 for `DECRYPT` and/or `VERIFY`. If the file is encrypted, and you do not pass an app private key, then this command downloads the ciphertext. If the file is signed, and you want to download its data and its signature, then you must run this command twice -- once to get the file contents at `FILENAME`, and once to get the signature (whose name will be `FILENAME`.sig).\n\nGaia is a key-value store, so it does not have any built-in notion of directories. However, most underlying storage systems do -- directory separators in the name of a file in Gaia may be internally treated as first-class directories (it depends on the Gaia hub's driver).As such, repeated directory separators will be treated as a single directory separator by this command. For example, the file name `a/b.txt`, `/a/b.txt`, and `///a////b.txt` will be treated as identical.\n\nExample without encryption:\n\n $ # Get an unencrypted, unsigned file\n $ blockstack-cli gaia_getfile ryan.id http://public.ykliao.com statuses.json\n [{\"id\":0,\"text\":\"Hello, Blockstack!\",\"created_at\":1515786983492}]\n\nExample with encryption:\n\n $ # Get an encrypted file without decrypting\n $ blockstack-cli gaia_getfile ryan.id https://app.graphitedocs.com documentscollection.json\n $ # Get an encrypted file, and decrypt it\n $ # Tip: You can obtain the app key with the get_app_keys command\n $ export APP_KEY=\"3ac770e8c3d88b1003bf4a0a148ceb920a6172bdade8e0325a1ed1480ab4fb19\"\n $ blockstack-cli gaia_getfile ryan.id https://app.graphitedocs.com documentscollection.json \"$APP_KEY\" 1 0\n"
"usage": "Get a file from another user's Gaia hub. Prints the file data to stdout. If you want to read an encrypted file, and/or verify a signed file, then you must pass an app private key, and pass 1 for DECRYPT and/or VERIFY. If the file is encrypted, and you do not pass an app private key, then this command downloads the ciphertext. If the file is signed, and you want to download its data and its signature, then you must run this command twice -- once to get the file contents at FILENAME, and once to get the signature (whose name will be FILENAME.sig).\n\nGaia is a key-value store, so it does not have any built-in notion of directories. However, most underlying storage systems do -- directory separators in the name of a file in Gaia may be internally treated as first-class directories (it depends on the Gaia hub's driver).As such, repeated directory separators will be treated as a single directory separator by this command. For example, the file name a/b.txt, /a/b.txt, and ///a////b.txt will be treated as identical.\n\nExample without encryption:\n\n $ # Get an unencrypted, unsigned file\n $ blockstack-cli gaia_getfile ryan.id http://public.ykliao.com statuses.json\n [{\"id\":0,\"text\":\"Hello, Blockstack!\",\"created_at\":1515786983492}]\n\nExample with encryption:\n\n $ # Get an encrypted file without decrypting\n $ blockstack-cli gaia_getfile ryan.id https://app.graphitedocs.com documentscollection.json\n $ # Get an encrypted file, and decrypt it\n $ # Tip: You can obtain the app key with the get_app_keys command\n $ export APP_KEY=\"3ac770e8c3d88b1003bf4a0a148ceb920a6172bdade8e0325a1ed1480ab4fb19\"\n $ blockstack-cli gaia_getfile ryan.id https://app.graphitedocs.com documentscollection.json \"$APP_KEY\" 1 0\n"
},
{
"args": [
@ -247,7 +247,7 @@
],
"command": "gaia_putfile",
"group": "Gaia",
"usage": "Put a file into a given Gaia hub, authenticating with the given app private key. Optionally encrypt and/or sign the data with the given app private key. If the file is successfully stored, this command prints out the URLs at which it can be fetched.\n\nGaia is a key-value store, so it does not have any built-in notion of directories. However, most underlying storage systems do -- directory separators in the name of a file in Gaia may be internally treated as first-class directories (it depends on the Gaia hub's driver).As such, repeated directory separators will be treated as a single directory separator by this command. For example, the file name `a/b.txt`, `/a/b.txt`, and `///a////b.txt` will be treated as identical.\n\nExample:\n\n $ # Store 4 versions of a file: plaintext, encrypted, signed, and encrypted+signed\n $ # Tip: You can obtain the app key with the get_app_keys command.\n $ export APP_KEY=\"3ac770e8c3d88b1003bf4a0a148ceb920a6172bdade8e0325a1ed1480ab4fb19\"\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file.txt\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file.txt\"\n }\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file-encrypted.txt 1\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file-encrypted.txt\"\n }\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file-signed.txt 0 1\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file-signed.txt\"\n }\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file-encrypted-signed.txt 1 1\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file-encrypted-signed.txt\"\n }\n"
"usage": "Put a file into a given Gaia hub, authenticating with the given app private key. Optionally encrypt and/or sign the data with the given app private key. If the file is successfully stored, this command prints out the URLs at which it can be fetched.\n\nGaia is a key-value store, so it does not have any built-in notion of directories. However, most underlying storage systems do -- directory separators in the name of a file in Gaia may be internally treated as first-class directories (it depends on the Gaia hub's driver).As such, repeated directory separators will be treated as a single directory separator by this command. For example, the file name a/b.txt, /a/b.txt, and ///a////b.txt will be treated as identical.\n\nExample:\n\n $ # Store 4 versions of a file: plaintext, encrypted, signed, and encrypted+signed\n $ # Tip: You can obtain the app key with the get_app_keys command.\n $ export APP_KEY=\"3ac770e8c3d88b1003bf4a0a148ceb920a6172bdade8e0325a1ed1480ab4fb19\"\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file.txt\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file.txt\"\n }\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file-encrypted.txt 1\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file-encrypted.txt\"\n }\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file-signed.txt 0 1\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file-signed.txt\"\n }\n $ blockstack-cli gaia_putfile https://hub.blockstack.org \"$APP_KEY\" /path/to/file.txt file-encrypted-signed.txt 1 1\n {\n \"urls\": \"https://gaia.blockstack.org/hub/19KAzYp4kSKozeAGMUsnuqkEGdgQQLEvwo/file-encrypted-signed.txt\"\n }\n"
},
{
"args": [
@ -303,7 +303,7 @@
],
"command": "gaia_restore_bucket",
"group": "Gaia",
"usage": "Upload the contents of a previously-dumped Gaia bucket to a new Gaia hub. The `GAIA_HUB` argument must correspond to the *write* endpoint of the Gaia hub -- that is, you should be able to fetch `$GAIA_HUB/hub_info`. `DUMP_DIR` must contain the file contents created by a previous successful run of the gaia_dump_bucket command, and both `NAME_OR_ID_ADDRESS` and `APP_ORIGIN` must be the same as they were when it was run.\n\nExample:\n\n $ export BACKUP_PHRASE=\"section amount spend resemble spray verify night immune tattoo best emotion parrot\"\n $ blockstack-cli gaia_restore_bucket hello.id.blockstack https://sample.app https://new.gaia.hub \"$BACKUP_PHRASE\" ./backups\n Uploaded ./backups/hello_world to https://new.gaia.hub/hub/1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc/hello_world\n Uploaded ./backups/dir\\x2fformat to https://new.gaia.hub/hub/1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc/dir/format\n Uploaded ./backups/\\x2f.dotfile to https://new.gaia.hub/hub/1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc//.dotfile\n 3\n"
"usage": "Upload the contents of a previously-dumped Gaia bucket to a new Gaia hub. The GAIA_HUB argument must correspond to the *write* endpoint of the Gaia hub -- that is, you should be able to fetch $GAIA_HUB/hub_info. DUMP_DIR must contain the file contents created by a previous successful run of the gaia_dump_bucket command, and both NAME_OR_ID_ADDRESS and APP_ORIGIN must be the same as they were when it was run.\n\nExample:\n\n $ export BACKUP_PHRASE=\"section amount spend resemble spray verify night immune tattoo best emotion parrot\"\n $ blockstack-cli gaia_restore_bucket hello.id.blockstack https://sample.app https://new.gaia.hub \"$BACKUP_PHRASE\" ./backups\n Uploaded ./backups/hello_world to https://new.gaia.hub/hub/1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc/hello_world\n Uploaded ./backups/dir\\x2fformat to https://new.gaia.hub/hub/1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc/dir/format\n Uploaded ./backups/\\x2f.dotfile to https://new.gaia.hub/hub/1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc//.dotfile\n 3\n"
},
{
"args": [
@ -340,7 +340,7 @@
],
"command": "gaia_sethub",
"group": "Gaia",
"usage": "Set the Gaia hub for a particular application for a Blockstack ID. If the command succeeds, the URLs to your updated profile will be printed and your profile will contain an entry in its \"apps\" key that links the given `APP_ORIGIN` to the given `APP_GAIA_HUB`.\n\nNOTE: Both `OWNER_GAIA_HUB` and `APP_GAIA_HUB` must be the *write* endpoints of their respective Gaia hubs.\n\nYour 12-word phrase (in either raw or encrypted form) is required to re-sign and store your profile and to generate an app-specific key and Gaia bucket. If you give the encrypted backup phrase, you will be prompted for a password.\n\nExample:\n\n $ export BACKUP_PHRASE=\"soap fog wealth upon actual blossom neither timber phone exile monkey vocal\"\n $ blockstack-cli gaia_sethub hello_world.id https://hub.blockstack.org https://my.cool.app https://my.app.gaia.hub \"$BACKUP_PHRASE\"\n {\n \"profileUrls\": {\n \"error\": null,\n \"dataUrls\": [\n \"https://gaia.blockstack.org/hub/1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82/profile.json\"\n ]\n }\n }\n \n $ # You can check the new apps entry with curl and jq as follows:\n $ curl -sL https://gaia.blockstack.org/hub/1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82/profile.json | jq \".[0].decodedToken.payload.claim.apps\"\n {\n \"https://my.cool.app\": \"https://my.app.gaia.hub/hub/1EqzyQLJ15KG1WQmi5cf1HtmSeqS1Wb8tY/\"\n }\n\n"
"usage": "Set the Gaia hub for a particular application for a Blockstack ID. If the command succeeds, the URLs to your updated profile will be printed and your profile will contain an entry in its \"apps\" key that links the given APP_ORIGIN to the given APP_GAIA_HUB. Note that both OWNER_GAIA_HUB and APP_GAIA_HUB must be the *write* endpoints of their respective Gaia hubs.\n\nYour 12-word phrase (in either raw or encrypted form) is required to re-sign and store your profile and to generate an app-specific key and Gaia bucket. If you give the encrypted backup phrase, you will be prompted for a password.\n\nExample:\n\n $ export BACKUP_PHRASE=\"soap fog wealth upon actual blossom neither timber phone exile monkey vocal\"\n $ blockstack-cli gaia_sethub hello_world.id https://hub.blockstack.org https://my.cool.app https://my.app.gaia.hub \"$BACKUP_PHRASE\"\n {\n \"profileUrls\": {\n \"error\": null,\n \"dataUrls\": [\n \"https://gaia.blockstack.org/hub/1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82/profile.json\"\n ]\n }\n }\n \n $ # You can check the new apps entry with curl and jq as follows:\n $ curl -sL https://gaia.blockstack.org/hub/1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82/profile.json | jq \".[0].decodedToken.payload.claim.apps\"\n {\n \"https://my.cool.app\": \"https://my.app.gaia.hub/hub/1EqzyQLJ15KG1WQmi5cf1HtmSeqS1Wb8tY/\"\n }\n\n"
},
{
"args": [
@ -423,7 +423,7 @@
],
"command": "get_blockchain_history",
"group": "Querying Blockstack IDs",
"usage": "Get the low-level blockchain-hosted history of operations on a Blockstack ID. This command is used mainly for debugging and diagnostics, and is not guaranteed to be stable across releases."
"usage": "Get the low-level blockchain-hosted history of operations on a Blocktack ID. This command is used mainly for debugging and diagnostics, and is not guaranteed to be stable across releases."
},
{
"args": [
@ -474,7 +474,7 @@
],
"command": "get_app_keys",
"group": "Key Management",
"usage": "Get the application private key from a 12-word backup phrase and a name or ID-address. This is the private key used to sign data in Gaia, and its address is the Gaia bucket address. If you provide your encrypted backup phrase, you will be asked to decrypt it. If you provide a name instead of an ID-address, its ID-address will be queried automatically (note that this means that the name must already be registered).\n\nNOTE: This command does NOT verify whether or not the name or ID-address was created by the backup phrase. You should do this yourself via the `get_owner_keys` command if you are not sure.\n\nThere are two derivation paths emitted by this command: a `keyInfo` path and a `legacyKeyInfo`path. You should use the one that matches the Gaia hub read URL's address, if you have already signed in before. If not, then you should use the `keyInfo` path when possible.\n\nExample:\n\n $ export BACKUP_PHRASE=\"one race buffalo dynamic icon drip width lake extra forest fee kit\"\n $ blockstack-cli get_app_keys \"$BACKUP_PHRASE\" example.id.blockstack https://my.cool.dapp\n {\n \"keyInfo\": {\n \"privateKey\": \"TODO\",\n \"address\": \"TODO\"\n },\n \"legacyKeyInfo\": {\n \"privateKey\": \"90f9ec4e13fb9a00243b4c1510075157229bda73076c7c721208c2edca28ea8b\",\n \"address\": \"1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc\"\n },\n \"ownerKeyIndex\": 0\n }"
"usage": "Get the application private key from a 12-word backup phrase and a name or ID-address. This is the private key used to sign data in Gaia, and its address is the Gaia bucket address. If you provide your encrypted backup phrase, you will be asked to decrypt it. If you provide a name instead of an ID-address, its ID-address will be queried automatically (note that this means that the name must already be registered). Note that this command does NOT verify whether or not the name or ID-address was created by the backup phrase. You should do this yourself via the \"get_owner_keys\" command if you are not sure.\nThere are two derivation paths emitted by this command: a \"keyInfo\" path and a \"legacyKeyInfo\"path. You should use the one that matches the Gaia hub read URL's address, if you have already signed in before. If not, then you should use the \"keyInfo\" path when possible.\n\nExample:\n\n $ export BACKUP_PHRASE=\"one race buffalo dynamic icon drip width lake extra forest fee kit\"\n $ blockstack-cli get_app_keys \"$BACKUP_PHRASE\" example.id.blockstack https://my.cool.dapp\n {\n \"keyInfo\": {\n \"privateKey\": \"TODO\",\n \"address\": \"TODO\"\n },\n \"legacyKeyInfo\": {\n \"privateKey\": \"90f9ec4e13fb9a00243b4c1510075157229bda73076c7c721208c2edca28ea8b\",\n \"address\": \"1Lr8ggSgdmfcb4764woYutUfFqQMjEoKHc\"\n },\n \"ownerKeyIndex\": 0\n }"
},
{
"args": [
@ -602,7 +602,7 @@
],
"command": "make_zonefile",
"group": "Peer Services",
"usage": "Generate a zone file for a Blockstack ID with the given profile URL. If you know the ID-address for the Blockstack ID, the profile URL usually takes the form of:\n\n {GAIA_URL_PREFIX}/{ADDRESS}/profile.json\n\nwhere `{GAIA_URL_PREFIX}` is the *read* endpoint of your Gaia hub (e.g. https://gaia.blockstack.org/hub) and `{ADDRESS}` is the base58check part of your ID-address (i.e. the string following 'ID-').\n\nExample:\n\n $ blockstack-cli make_zonefile example.id ID-1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82 https://my.gaia.hub/hub\n $ORIGIN example.id\n $TTL 3600\n _http._tcp IN URI 10 1 \"https://my.gaia.hub/hub/1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82/profile.json\"\n\n"
"usage": "Generate a zone file for a Blockstack ID with the given profile URL. If you know the ID-address for the Blockstack ID, the profile URL usually takes the form of:\n\n {GAIA_URL_PREFIX}/{ADDRESS}/profile.json\n\nwhere {GAIA_URL_PREFIX} is the *read* endpoint of your Gaia hub (e.g. https://gaia.blockstack.org/hub) and {ADDRESS} is the base58check part of your ID-address (i.e. the string following 'ID-').\n\nExample:\n\n $ blockstack-cli make_zonefile example.id ID-1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82 https://my.gaia.hub/hub\n $ORIGIN example.id\n $TTL 3600\n _http._tcp IN URI 10 1 \"https://my.gaia.hub/hub/1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82/profile.json\"\n\n"
},
{
"args": [
@ -645,7 +645,7 @@
],
"command": "name_import",
"group": "Namespace Operations",
"usage": "Import a name into a namespace you revealed. The `REVEAL_KEY` must be the same as the key that revealed the namespace. You can only import a name into a namespace if the namespace has not yet been launched (i.e. via `namespace_ready`), and if the namespace was revealed less than a year ago (52595 blocks ago).\n\nA zone file will be generated for this name automatically, if \"ZONEFILE\" is not given. By default, the zone file will have a URL to the name owner's profile prefixed by `GAIA_URL_PREFIX`. If you know the *write* endpoint for the name owner's Gaia hub, you can find out the `GAIA_URL_PREFIX` to use with `curl \"$GAIA_HUB/hub_info\"`.\n\nIf you specify an argument for `ZONEFILE`, then the `GAIA_URL_PREFIX` argument is ignored in favor of your custom zone file on disk.\n\nIf you specify a valid zone file hash for `ZONEFILE_HASH` then it will be used in favor of both `ZONEFILE` and `GAIA_URL_PREFIX`. The zone file hash will be incorporated directly into the name-import transaction.\n\nThis command prints out a transaction ID if it succeeds, and it replicates the zone file (if given) to a transaction broadcaster (you can choose which one with -T). The zone file will be automatically broadcast to the Blockstack peer network when the transaction confirms. Alternatively, you can do so yourself with the `zonefile_push` command.\n\nExample:\n\n $ export REVEAL_KEY=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ export ID_ADDRESS=\"ID-18e1bqU7B5qUPY3zJgMLxDnexyStTeSnvV\"\n $ blockstack-cli name_import example.id \"$ID_ADDRESS\" https://gaia.blockstack.org/hub \"$REVEAL_KEY\"\n f726309cea7a9db364307466dc0e0e759d5c0d6bad1405e2fd970740adc7dc45\n\n"
"usage": "Import a name into a namespace you revealed. The REVEAL_KEY must be the same as the key that revealed the namespace. You can only import a name into a namespace if the namespace has not yet been launched (i.e. via `namespace_ready`), and if the namespace was revealed less than a year ago (52595 blocks ago).\n\nA zone file will be generated for this name automatically, if \"ZONEFILE\" is not given. By default, the zone file will have a URL to the name owner's profile prefixed by GAIA_URL_PREFIX. If you know the *write* endpoint for the name owner's Gaia hub, you can find out the GAIA_URL_PREFIX to use with \"curl $GAIA_HUB/hub_info\".\n\nIf you specify an argument for \"ZONEFILE,\" then the GAIA_URL_PREFIX argument is ignored in favor of your custom zone file on disk.\n\nIf you specify a valid zone file hash for \"ZONEFILE_HASH,\" then it will be used in favor of both ZONEFILE and GAIA_URL_PREFIX. The zone file hash will be incorporated directly into the name-import transaction.\n\nThis command prints out a transaction ID if it succeeds, and it replicates the zone file (if given) to a transaction broadcaster (you can choose which one with -T). The zone file will be automatically broadcast to the Blockstack peer network when the transaction confirms. Alternatively, you can do so yourself with the \"zonefile_push\" command.\n\nExample:\n\n $ export REVEAL_KEY=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ export ID_ADDRESS=\"ID-18e1bqU7B5qUPY3zJgMLxDnexyStTeSnvV\"\n $ blockstack-cli name_import example.id \"$ID_ADDRESS\" https://gaia.blockstack.org/hub \"$REVEAL_KEY\"\n f726309cea7a9db364307466dc0e0e759d5c0d6bad1405e2fd970740adc7dc45\n\n"
},
{
"args": [
@ -737,7 +737,7 @@
],
"command": "namespace_reveal",
"group": "Namespace Operations",
"usage": "Reveal a preordered namespace, and set the price curve and payment options. This is the second of three steps required to create a namespace, and must be done shortly after the associated `namespace_preorder` command."
"usage": "Reveal a preordered namespace, and set the price curve and payment options. This is the second of three steps required to create a namespace, and must be done shortly after the associated \"namespace_preorder\" command."
},
{
"args": [
@ -832,7 +832,7 @@
],
"command": "profile_store",
"group": "Profiles",
"usage": "Store a profile on disk to a Gaia hub. `USER_ID` can be either a Blockstack ID or an ID-address. The `GAIA_HUB` argument must be the *write* endpoint for the user's Gaia hub (e.g. https://hub.blockstack.org). You can verify this by ensuring that you can run `curl \"$GAIA_HUB/hub_info\"` successfully."
"usage": "Store a profile on disk to a Gaia hub. USER_ID can be either a Blockstack ID or an ID-address. The GAIA_HUB argument must be the *write* endpoint for the user's Gaia hub (e.g. https://hub.blockstack.org). You can verify this by ensuring that you can run 'curl \"$GAIA_HUB/hub_info\"' successfully."
},
{
"args": [
@ -894,7 +894,7 @@
],
"command": "renew",
"group": "Blockstack ID Management",
"usage": "Renew a name. Optionally transfer it to a new owner address (`NEW_ID_ADDRESS`), and optionally load up and give it a new zone file on disk (`ZONEFILE`). If the command succeeds, it prints out a transaction ID. You can use with the `get_confirmations` command to track its confirmations on the underlying blockchain -- once it reaches 7 confirmations, the rest of the Blockstack peer network will process it.\n\nIf you create a new zonefile for your name, you will need to later use `zonefile_push` to replicate the zone file to the Blockstack peer network once the transaction reaches 7 confirmations.\n\nExample:\n\n $ # Tip: you can get your owner key from your backup phrase with \"get_owner_keys\".\n $ # Tip: you can get your payment key from your backup phrase with \"get_payment_key\".\n $ export OWNER=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli renew hello_world.id \"$OWNER\" \"$PAYMENT\"\n 3d8945ce76d4261678d76592b472ed639a10d4298f9d730af4edbbc3ec02882e\n\n $ # Renew with a new owner\n $ export NEW_OWNER=\"ID-141BcmFVbEuuMb7Bd6umXyV6ZD1WYomYDE\"\n $ blockstack-cli renew hello_world.id \"$OWNER\" \"$PAYMENT\" \"$NEW_OWNER\"\n 33865625ef3f1b607111c0dfba9e58604927173bd2e299a343e19aa6d2cfb263\n\n $ # Renew with a new zone file.\n $ # Tip: you can create a new zonefile with the \"make_zonefile\" command.\n $ export ZONEFILE_PATH=\"/path/to/new/zonefile.txt\"\n $ blockstack-cli renew hello_world.id \"$OWNER\" \"$PAYMENT\" --zonefile \"$ZONEFILE_PATH\"\n e41ce043ab64fd5a5fd382fba21acba8c1f46cbb1d7c08771ada858ce7d29eea\n $ # wait 7 confirmations\n $ blockstack-cli get_confirmations e41ce043ab64fd5a5fd382fba21acba8c1f46cbb1d7c08771ada858ce7d29eea\n {\n \"blockHeight\": 567890,\n \"confirmations\": 7,\n }\n $ blockstack-cli -H https://core.blockstack.org zonefile_push \"$ZONEFILE_PATH\"\n [\n \"https://core.blockstack.org\"\n ]\n\n"
"usage": "Renew a name. Optionally transfer it to a new owner address (NEW_ID_ADDRESS), and optionally load up and give it a new zone file on disk (ZONEFILE). If the command succeeds, it prints out a transaction ID. You can use with the \"get_confirmations\" command to track its confirmations on the underlying blockchain -- once it reaches 7 confirmations, the rest of the Blockstack peer network will process it.\n\nIf you create a new zonefile for your name, you will need to later use \"zonefile_push\" to replicate the zone file to the Blockstack peer network once the transaction reaches 7 confirmations.\n\nExample:\n\n $ # Tip: you can get your owner key from your backup phrase with \"get_owner_keys\".\n $ # Tip: you can get your payment key from your backup phrase with \"get_payment_key\".\n $ export OWNER=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli renew hello_world.id \"$OWNER\" \"$PAYMENT\"\n 3d8945ce76d4261678d76592b472ed639a10d4298f9d730af4edbbc3ec02882e\n\n $ # Renew with a new owner\n $ export NEW_OWNER=\"ID-141BcmFVbEuuMb7Bd6umXyV6ZD1WYomYDE\"\n $ blockstack-cli renew hello_world.id \"$OWNER\" \"$PAYMENT\" \"$NEW_OWNER\"\n 33865625ef3f1b607111c0dfba9e58604927173bd2e299a343e19aa6d2cfb263\n\n $ # Renew with a new zone file.\n $ # Tip: you can create a new zonefile with the \"make_zonefile\" command.\n $ export ZONEFILE_PATH=\"/path/to/new/zonefile.txt\"\n $ blockstack-cli renew hello_world.id \"$OWNER\" \"$PAYMENT\" --zonefile \"$ZONEFILE_PATH\"\n e41ce043ab64fd5a5fd382fba21acba8c1f46cbb1d7c08771ada858ce7d29eea\n $ # wait 7 confirmations\n $ blockstack-cli get_confirmations e41ce043ab64fd5a5fd382fba21acba8c1f46cbb1d7c08771ada858ce7d29eea\n {\n \"blockHeight\": 567890,\n \"confirmations\": 7,\n }\n $ blockstack-cli -H https://core.blockstack.org zonefile_push \"$ZONEFILE_PATH\"\n [\n \"https://core.blockstack.org\"\n ]\n\n"
},
{
"args": [
@ -931,7 +931,7 @@
],
"command": "register",
"group": "Blockstack ID Management",
"usage": "If you are trying to register a name for a *private key*, use this command.\n\nRegister a name to a single name-owning private key. After successfully running this command, and after waiting a couple hours, your name will be ready to use and will resolve to a signed empty profile hosted on the given Gaia hub (`GAIA_HUB`).\n\nBehind the scenes, this will generate and send two transactions and generate and replicate a zone file with the given Gaia hub URL (`GAIA_HUB`). Note that the `GAIA_HUB` argument must correspond to the *write* endpoint of the Gaia hub (i.e. you should be able to run `curl \"$GAIA_HUB/hub_info\"` and get back data). If you are using Blockstack PBC's default Gaia hub, pass \"https://hub.blockstack.org\" for this argument.\n\nBy default, this command generates a zone file automatically that points to the Gaia hub's read endpoint (which is queried on-the-fly from `GAIA_HUB`). If you instead want to have a custom zone file for this name, you can specify a path to it on disk with the `ZONEFILE` argument.\n\nIf this command completes successfully, your name will be ready to use once both transactions have 7+ confirmations. You can use the `get_confirmations` command to track the confirmations on the transaction IDs returned by this command.\n\nWARNING: You should *NOT* use the payment private key (`PAYMENT_KEY`) while the name is being confirmed. If you do so, you could double-spend one of the pending transactions and lose your name.\n\nExample:\n\n $ export OWNER=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli register example.id \"$OWNER\" \"$PAYMENT\" https://hub.blockstack.org\n 9bb908bfd4ab221f0829167a461229172184fc825a012c4e551533aa283207b1\n\n"
"usage": "If you are trying to register a name for a *private key*, use this command.\n\nRegister a name to a single name-owning private key. After successfully running this command, and after waiting a couple hours, your name will be ready to use and will resolve to a signed empty profile hosted on the given Gaia hub (GAIA_HUB).\n\nBehind the scenes, this will generate and send two transactions and generate and replicate a zone file with the given Gaia hub URL (GAIA_HUB). Note that the GAIA_HUB argument must correspond to the *write* endpoint of the Gaia hub (i.e. you should be able to run 'curl \"$GAIA_HUB/hub_info\"' and get back data). If you are using Blockstack PBC's default Gaia hub, pass \"https://hub.blockstack.org\" for this argument.\n\nBy default, this command generates a zone file automatically that points to the Gaia hub's read endpoint (which is queried on-the-fly from GAIA_HUB). If you instead want to have a custom zone file for this name, you can specify a path to it on disk with the ZONEFILE argument.\n\nIf this command completes successfully, your name will be ready to use once both transactions have 7+ confirmations. You can use the \"get_confirmations\" command to track the confirmations on the transaction IDs returned by this command.\n\nWARNING: You should *NOT* use the payment private key (PAYMENT_KEY) while the name is being confirmed. If you do so, you could double-spend one of the pending transactions and lose your name.\n\nExample:\n\n $ export OWNER=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli register example.id \"$OWNER\" \"$PAYMENT\" https://hub.blockstack.org\n 9bb908bfd4ab221f0829167a461229172184fc825a012c4e551533aa283207b1\n\n"
},
{
"args": [
@ -968,7 +968,7 @@
],
"command": "register_addr",
"group": "Blockstack ID Management",
"usage": "If you are trying to register a name for an *ID-address*, use this command.\n\nRegister a name to someone's ID-address. After successfully running this command and waiting a couple of hours, the name will be registered on-chain and have a zone file with a URL to where the owner's profile should be. This command does NOT generate, sign, or replicate a profile for the name---the name owner will need to do this separately, once the name is registered.\n\nBehind the scenes, this command will generate two transactions, and generate and replicate a zone file with the given Gaia hub read URL (`GAIA_URL_PREFIX`). Note that the `GAIA_URL_PREFIX` argument must correspond to the *read* endpoint of the Gaia hub (e.g. if you are using Blockstack PBC's default Gaia hub, this is \"https://gaia.blockstack.org/hub\"). If you know the *write* endpoint of the name owner's Gaia hub, you can find the right value for `GAIA_URL_PREFIX` by running `curl \"$GAIA_HUB/hub_info\"` .\n\nNo profile will be generated or uploaded by this command. Instead, this command generates a zone file that will include the URL to a profile based on the `GAIA_URL_PREFIX` argument.\n\nThe zone file will be generated automatically from the `GAIA_URL_PREFIX` argument. If you need to use a custom zone file, you can pass the path to it on disk via the `ZONEFILE` argument.\n\nIf this command completes successfully, the name will be ready to use in a couple of hours---that is, once both transactions have 7+ confirmations. You can use the `get_confirmations` command to track the confirmations.\n\nWARNING: You should *NOT* use the payment private key (`PAYMENT_KEY`) while the name is being confirmed. If you do so, you could double-spend one of the pending transactions and lose the name.\n\nExample:\n\n $ export ID_ADDRESS=\"ID-18e1bqU7B5qUPY3zJgMLxDnexyStTeSnvV\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli register_addr example.id \"$ID_ADDRESS\" \"$PAYMENT\" https://gaia.blockstack.org/hub"
"usage": "If you are trying to register a name for an *ID-address*, use this command.\n\nRegister a name to someone's ID-address. After successfully running this command and waiting a couple of hours, the name will be registered on-chain and have a zone file with a URL to where the owner's profile should be. This command does NOT generate, sign, or replicate a profile for the name---the name owner will need to do this separately, once the name is registered.\n\nBehind the scenes, this command will generate two transactions, and generate and replicate a zone file with the given Gaia hub read URL (GAIA_URL_PREFIX). Note that the GAIA_URL_PREFIX argument must correspond to the *read* endpoint of the Gaia hub (e.g. if you are using Blockstack PBC's default Gaia hub, this is \"https://gaia.blockstack.org/hub\"). If you know the *write* endpoint of the name owner's Gaia hub, you can find the right value for GAIA_URL_PREFIX by running \"curl $GAIA_HUB/hub_info\".\n\nNo profile will be generated or uploaded by this command. Instead, this command generates a zone file that will include the URL to a profile based on the GAIA_URL_PREFIX argument.\n\nThe zone file will be generated automatically from the GAIA_URL_PREFIX argument. If you need to use a custom zone file, you can pass the path to it on disk via the ZONEFILE argument.\n\nIf this command completes successfully, the name will be ready to use in a couple of hours---that is, once both transactions have 7+ confirmations. You can use the \"get_confirmations\" command to track the confirmations.\n\nWARNING: You should *NOT* use the payment private key (PAYMENT_KEY) while the name is being confirmed. If you do so, you could double-spend one of the pending transactions and lose the name.\n\nExample:\n\n $ export ID_ADDRESS=\"ID-18e1bqU7B5qUPY3zJgMLxDnexyStTeSnvV\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli register_addr example.id \"$ID_ADDRESS\" \"$PAYMENT\" https://gaia.blockstack.org/hub"
},
{
"args": [
@ -1005,7 +1005,7 @@
],
"command": "register_subdomain",
"group": "Blockstack ID Management",
"usage": "Register a subdomain. This will generate and sign a subdomain zone file record with the given `GAIA_HUB` URL and send it to the given subdomain registrar (`REGISTRAR`).\n\nThis command generates, signs, and uploads a profile to the `GAIA_HUB` url. Note that the `GAIA_HUB` argument must correspond to the *write* endpoint of your Gaia hub (i.e. you should be able to run `curl \"$GAIA_HUB/hub_info\"` successfully). If you are using Blockstack PBC's default Gaia hub, this argument should be \"https://hub.blockstack.org\".\n\nWARNING: At this time, no validation will occur on the registrar URL. Be sure that the URL corresponds to the registrar for the on-chain name before running this command!\n\nExample:\n\n $ export OWNER=\"6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01\"\n $ # NOTE: https://registrar.blockstack.org is the registrar for personal.id!\n $ blockstack-cli register_subdomain hello.personal.id \"$OWNER\" https://hub.blockstack.org https://registrar.blockstack.org\n"
"usage": "Register a subdomain. This will generate and sign a subdomain zone file record with the given GAIA_HUB URL and send it to the given subdomain registrar (REGISTRAR).\n\nThis command generates, signs, and uploads a profile to the GAIA_HUB url. Note that the GAIA_HUB argument must correspond to the *write* endpoint of your Gaia hub (i.e. you should be able to run 'curl \"$GAIA_HUB/hub_info\"' successfully). If you are using Blockstack PBC's default Gaia hub, this argument should be \"https://hub.blockstack.org\".\n\nWARNING: At this time, no validation will occur on the registrar URL. Be sure that the URL corresponds to the registrar for the on-chain name before running this command!\n\nExample:\n\n $ export OWNER=\"6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01\"\n $ # NOTE: https://registrar.blockstack.org is the registrar for personal.id!\n $ blockstack-cli register_subdomain hello.personal.id \"$OWNER\" https://hub.blockstack.org https://registrar.blockstack.org\n"
},
{
"args": [
@ -1055,7 +1055,7 @@
],
"command": "send_btc",
"group": "Account Management",
"usage": "Send some Bitcoin (in satoshis) from a payment key to an address. Up to the given amount will be spent, but likely less---the actual amount sent will be the amount given, minus the transaction fee. For example, if you want to send 10000 satoshis but the transaction fee is 2000 satoshis, then the resulting transaction will send 8000 satoshis to the given address. This is to ensure that this command does not *over*-spend your Bitcoin. If you want to check the amount before spending, pass the `-x` flag to see the raw transaction.\n\nIf the command succeeds, it prints out the transaction ID. You can track its confirmations with the `get_confirmations` command.\n\nExample:\n\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli send_btc 18qTSE5PPQmypwKKej7QX5Db2XAttgYeA1 123456 \"$PAYMENT\"\n c7e239fd24da30e36e011e6bc7db153574a5b40a3a8dc3b727adb54ad038acc5\n\n"
"usage": "Send some Bitcoin (in satoshis) from a payment key to an address. Up to the given amount will be spent, but likely less---the actual amount sent will be the amount given, minus the transaction fee. For example, if you want to send 10000 satoshis but the transaction fee is 2000 satoshis, then the resulting transaction will send 8000 satoshis to the given address. This is to ensure that this command does not *over*-spend your Bitcoin. If you want to check the amount before spending, pass the -x flag to see the raw transaction.\n\nIf the command succeeds, it prints out the transaction ID. You can track its confirmations with the get_confirmations command.\n\nExample:\n\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli send_btc 18qTSE5PPQmypwKKej7QX5Db2XAttgYeA1 123456 \"$PAYMENT\"\n c7e239fd24da30e36e011e6bc7db153574a5b40a3a8dc3b727adb54ad038acc5\n\n"
},
{
"args": [
@ -1098,7 +1098,7 @@
],
"command": "send_tokens",
"group": "Account Management",
"usage": "Send a particular type of tokens to the given `ADDRESS`. Right now, only supported `TOKEN-TYPE` is `STACKS`. Optionally include a memo string (`MEMO`) up to 34 characters long.\n\nIf the command succeeds, it prints out a transaction ID. You can track the confirmations on the transaction via the `get_confirmations` command. Once the transaction has 7 confirmations, the Blockstack peer network will have processed it, and your payment key balance and recipient balance will be updated.\n\nAt this time, token transfers are encoded as Bitcoin transactions. As such, you will need to pay a transaction fee in Bitcoin. Your payment key should have both a Bitcoin balance and a Stacks balance (you can check with the `balance` command).\n\nExample:\n\n $ # check balances of sender and recipient before sending.\n $ # address of the key below is SP2SC16ASH76GX549PT7J5WQZA4GHMFBKYMBQFF9V\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ export BTC_PAYMENT=\"4be95a5987ec727c033aa48a3fb1dbadb750446c1c63a02707a0b1c28e7ec17801\"\n $ blockstack-cli balance SP2SC16ASH76GX549PT7J5WQZA4GHMFBKYMBQFF9V\n {\n \"BTC\": \"125500\"\n \"STACKS\": \"10000000\"\n }\n $ blockstack-cli balance SP1P10PS2T517S4SQGZT5WNX8R00G1ECTRKYCPMHY\n {\n \"BTC\": \"0\"\n \"STACKS\": \"0\"\n }\n\n $ # send tokens\n $ blockstack-cli send_tokens SP1P10PS2T517S4SQGZT5WNX8R00G1ECTRKYCPMHY STACKS 12345 \"$PAYMENT\" \"$BTC_PAYMENT\"\n a9d387a925fb0ba7a725fb1e11f2c3f1647473699dd5a147c312e6453d233456\n\n $ # wait 7 confirmations\n $ blockstack-cli get_confirmations a9d387a925fb0ba7a725fb1e11f2c3f1647473699dd5a147c312e6453d233456\n {\n \"blockHeight\": 567890,\n \"confirmations\": 7,\n }\n\n $ # check balance again. The recipient receives some dust to encode the Stacks transfer,\n $ # and the sender pays for the transaction fee.\n $ blockstack-cli balance SP2SC16ASH76GX549PT7J5WQZA4GHMFBKYMBQFF9V\n {\n \"BTC\": \"117000\"\n \"STACKS\": \"9987655\"\n }\n $ blockstack-cli balance SP1P10PS2T517S4SQGZT5WNX8R00G1ECTRKYCPMHY\n {\n \"BTC\": \"5500\"\n \"STACKS\": \"12345\"\n }\n\n"
"usage": "Send a particular type of tokens to the given ADDRESS. Right now, only supported TOKEN-TYPE is \"STACKS\". Optionally include a memo string (MEMO) up to 34 characters long.\n\nIf the command succeeds, it prints out a transaction ID. You can track the confirmations on the transaction via the get_confirmations command. Once the transaction has 7 confirmations, the Blockstack peer network will have processed it, and your payment key balance and recipient balance will be updated.\n\nAt this time, token transfers are encoded as Bitcoin transactions. As such, you will need to pay a transaction fee in Bitcoin. Your payment key should have both a Bitcoin balance and a Stacks balance (you can check with the \"balance\" command).\n\nExample:\n\n $ # check balances of sender and recipient before sending.\n $ # address of the key below is SP2SC16ASH76GX549PT7J5WQZA4GHMFBKYMBQFF9V\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ export BTC_PAYMENT=\"4be95a5987ec727c033aa48a3fb1dbadb750446c1c63a02707a0b1c28e7ec17801\"\n $ blockstack-cli balance SP2SC16ASH76GX549PT7J5WQZA4GHMFBKYMBQFF9V\n {\n \"BTC\": \"125500\"\n \"STACKS\": \"10000000\"\n }\n $ blockstack-cli balance SP1P10PS2T517S4SQGZT5WNX8R00G1ECTRKYCPMHY\n {\n \"BTC\": \"0\"\n \"STACKS\": \"0\"\n }\n\n $ # send tokens\n $ blockstack-cli send_tokens SP1P10PS2T517S4SQGZT5WNX8R00G1ECTRKYCPMHY STACKS 12345 \"$PAYMENT\" \"$BTC_PAYMENT\"\n a9d387a925fb0ba7a725fb1e11f2c3f1647473699dd5a147c312e6453d233456\n\n $ # wait 7 confirmations\n $ blockstack-cli get_confirmations a9d387a925fb0ba7a725fb1e11f2c3f1647473699dd5a147c312e6453d233456\n {\n \"blockHeight\": 567890,\n \"confirmations\": 7,\n }\n\n $ # check balance again. The recipient receives some dust to encode the Stacks transfer,\n $ # and the sender pays for the transaction fee.\n $ blockstack-cli balance SP2SC16ASH76GX549PT7J5WQZA4GHMFBKYMBQFF9V\n {\n \"BTC\": \"117000\"\n \"STACKS\": \"9987655\"\n }\n $ blockstack-cli balance SP1P10PS2T517S4SQGZT5WNX8R00G1ECTRKYCPMHY\n {\n \"BTC\": \"5500\"\n \"STACKS\": \"12345\"\n }\n\n"
},
{
"args": [
@ -1135,7 +1135,7 @@
],
"command": "transfer",
"group": "Blockstack ID Management",
"usage": "Transfer a Blockstack ID to a new address (`NEW_ID_ADDRESS`). Optionally preserve its zone file (`KEEP_ZONEFILE`). If the command succeeds, it will print a transaction ID. Once the transaction reaches 7 confirmations, the Blockstack peer network will transfer the Blockstack ID to the new ID-address. You can track the transaction's confirmations with the `get_confirmations` command.\n\nNOTE: This command only works for on-chain Blockstack IDs. It does not yet work for subdomains.\n\nAn ID-address can only own up to 25 Blockstack IDs. In practice, you should generate a new owner key and ID-address for each name you receive (via the `get_owner_keys` command).\n\nExample:\n\n $ # Tip: you can get your owner key from your backup phrase with \"get_owner_keys\".\n $ # Tip: you can get your payment key from your backup phrase with \"get_payment_key\".\n $ export OWNER=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli transfer example.id ID-1HJA1AJvWef21XbQVL2AcTv71b6JHGPfDX true \"$OWNER\" \"$PAYMENT\"\n e09dc158e586d0c09dbcdcba917ec394e6c6ac2b9c91c4b55f32f5973e4f08fc\n\n"
"usage": "Transfer a Blockstack ID to a new address (NEW_ID_ADDRESS). Optionally preserve its zone file (KEEP_ZONEFILE). If the command succeeds, it will print a transaction ID. Once the transaction reaches 7 confirmations, the Blockstack peer network will transfer the Blockstack ID to the new ID-address. You can track the transaction's confirmations with the \"get_confirmations\" command.\n\nThis command only works for on-chain Blockstack IDs. It does not yet work for subdomains.\n\nAn ID-address can only own up to 25 Blockstack IDs. In practice, you should generate a new owner key and ID-address for each name you receive (via the \"get_owner_keys\" command).\n\nExample:\n\n $ # Tip: you can get your owner key from your backup phrase with \"get_owner_keys\".\n $ # Tip: you can get your payment key from your backup phrase with \"get_payment_key\".\n $ export OWNER=\"136ff26efa5db6f06b28f9c8c7a0216a1a52598045162abfe435d13036154a1b01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ blockstack-cli transfer example.id ID-1HJA1AJvWef21XbQVL2AcTv71b6JHGPfDX true \"$OWNER\" \"$PAYMENT\"\n e09dc158e586d0c09dbcdcba917ec394e6c6ac2b9c91c4b55f32f5973e4f08fc\n\n"
},
{
"args": [
@ -1160,7 +1160,7 @@
],
"command": "tx_preorder",
"group": "Blockstack ID Management",
"usage": "Generate and send `NAME_PREORDER` transaction, for a Blockstack ID to be owned by a given `ID_ADDRESS`. The name cost will be paid for by the gven `PAYMENT_KEY`. The ID-address should be a never-before-seen address, since it will be used as a salt when generating the name preorder hash.\n\nThis is a low-level command that only experienced Blockstack developers should use. If you just want to register a name, use the \"register\" command.\n"
"usage": "Generate and send NAME_PREORDER transaction, for a Blockstack ID to be owned by a given ID_ADDRESS. The name cost will be paid for by the gven PAYMENT_KEY. The ID-address should be a never-before-seen address, since it will be used as a salt when generating the name preorder hash.\n\nThis is a low-level command that only experienced Blockstack developers should use. If you just want to register a name, use the \"register\" command.\n"
},
{
"args": [
@ -1197,7 +1197,7 @@
],
"command": "tx_register",
"group": "Blockstack ID Management",
"usage": "Generate and send a `NAME_REGISTRATION` transaction, assigning the given `BLOCKSTACK_ID` to the given `ID_ADDRESS`. Optionally pair the Blockstack ID with a zone file (`ZONEFILE`) or the hash of the zone file (`ZONEFILE_HASH`). You will need to push the zone file to the peer network after the transaction confirms (i.e. with `zonefile_push`).\n\nThis is a low-level command that only experienced Blockstack developers should use. If you just want to register a name, you should use the `register` command."
"usage": "Generate and send a NAME_REGISTRATION transaction, assigning the given BLOCKSTACK_ID to the given ID_ADDRESS. Optionally pair the Blockstack ID with a zone file (ZONEFILE) or the hash of the zone file (ZONEFILE_HASH). You will need to push the zone file to the peer network after the transaction confirms (i.e. with \"zonefile_push\").\n\nThis is a low-level command that only experienced Blockstack developers should use. If you just want to register a name, you should use the \"register\" command."
},
{
"args": [
@ -1234,7 +1234,7 @@
],
"command": "update",
"group": "Blockstack ID Management",
"usage": "Update the zonefile for an on-chain Blockstack ID. You can generate a well-formed zone file using the `make_zonefile` command, or you can supply your own. Zone files can be up to 40Kb. Alternatively, if you only want to announce the hash of a zone file (or any arbitrary 20-byte hex string), you can do so by passing a value for `ZONEFILE_HASH`. If `ZONEFILE_HASH` is given, then the value for `ZONEFILE` will be ignored.\n\nIf this command succeeds, it prints out a transaction ID. Once the transaction has 7 confirmations, the Blockstack peer network will set the name's zone file hash to the `RIPEMD160`(SHA256) hash of the given zone file (or it will simply set it to the hash given in `ZONEFILE_HASH`).\n\nOnce the transaction confirms, you will need to replicate the zone file to the Blockstack peer network. This can be done with the `zonefile_push` command. Until you do so, no Blockstack clients will be able to obtain the zone file announced by this command.\n\nExample:\n\n $ # Tip: you can get your owner and payment keys from your 12-word backup phrase using the get_owner_keys and get_payment_key commands.\n $ export OWNER=\"6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ # make a new zone file\n $ blockstack-cli make_zonefile example.id ID-1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82 https://my.gaia.hub/hub > /tmp/zonefile.txt\n \n $ # update the name to reference this new zone file\n $ blockstack-cli update example.id /tmp/zonefile.txt \"$OWNER\" \"$PAYMENT\"\n 8e94a5b6647276727a343713d3213d587836e1322b1e38bc158406f5f8ebe3fd\n \n $ # check confirmations\n $ blockstack-cli get_confirmations e41ce043ab64fd5a5fd382fba21acba8c1f46cbb1d7c08771ada858ce7d29eea\n {\n \"blockHeight\": 567890,\n \"confirmations\": 7,\n }\n \n $ # send out the new zone file to a Blockstack peer\n $ blockstack-cli -H https://core.blockstack.org zonefile_push /tmp/zonefile.txt\n [\n \"https://core.blockstack.org\"\n ]\n\n"
"usage": "Update the zonefile for an on-chain Blockstack ID. You can generate a well-formed zone file using the \"make_zonefile\" command, or you can supply your own. Zone files can be up to 40Kb. Alternatively, if you only want to announce the hash of a zone file (or any arbitrary 20-byte hex string), you can do so by passing a value for ZONEFILE_HASH. If ZONEFILE_HASH is given, then the value for ZONEFILE will be ignored.\n\nIf this command succeeds, it prints out a transaction ID. Once the transaction has 7 confirmations, the Blockstack peer network will set the name's zone file hash to the RIPEMD160(SHA256) hash of the given zone file (or it will simply set it to the hash given in ZONEFILE_HASH).\n\nOnce the transaction confirms, you will need to replicate the zone file to the Blockstack peer network. This can be done with the \"zonefile_push\" command. Until you do so, no Blockstack clients will be able to obtain the zone file announced by this command.\n\nExample:\n\n $ # Tip: you can get your owner and payment keys from your 12-word backup phrase using the get_owner_keys and get_payment_key commands.\n $ export OWNER=\"6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01\"\n $ export PAYMENT=\"bfeffdf57f29b0cc1fab9ea197bb1413da2561fe4b83e962c7f02fbbe2b1cd5401\"\n $ # make a new zone file\n $ blockstack-cli make_zonefile example.id ID-1ArdkA2oLaKnbNbLccBaFhEV4pYju8hJ82 https://my.gaia.hub/hub > /tmp/zonefile.txt\n \n $ # update the name to reference this new zone file\n $ blockstack-cli update example.id /tmp/zonefile.txt \"$OWNER\" \"$PAYMENT\"\n 8e94a5b6647276727a343713d3213d587836e1322b1e38bc158406f5f8ebe3fd\n \n $ # check confirmations\n $ blockstack-cli get_confirmations e41ce043ab64fd5a5fd382fba21acba8c1f46cbb1d7c08771ada858ce7d29eea\n {\n \"blockHeight\": 567890,\n \"confirmations\": 7,\n }\n \n $ # send out the new zone file to a Blockstack peer\n $ blockstack-cli -H https://core.blockstack.org zonefile_push /tmp/zonefile.txt\n [\n \"https://core.blockstack.org\"\n ]\n\n"
},
{
"args": [
@ -1260,6 +1260,31 @@
],
"command": "zonefile_push",
"group": "Peer Services",
"usage": "Push a zone file on disk to the Blockstack peer network. The zone file must correspond to a zone file hash that has already been announced. That is, you use this command in conjunction with the `register`, `update`, `renew`, or `name_import` commands.\n\nExample:\n\n $ blockstack-cli -H https://core.blockstack.org zonefile_push /path/to/zonefile.txt\n [\n \"https://core.blockstack.org\"\n ]\n\n"
"usage": "Push a zone file on disk to the Blockstack peer network. The zone file must correspond to a zone file hash that has already been announced. That is, you use this command in conjunction with the \"register\", \"update\", \"renew\", or \"name_import\" commands.\n\nExample:\n\n $ blockstack-cli -H https://core.blockstack.org zonefile_push /path/to/zonefile.txt\n [\n \"https://core.blockstack.org\"\n ]\n\n"
},
{
"args": [
{
"format": "^([0-9a-z_.+-]{3,37})$|^([0-9a-z_+-]{1,37}).([0-9a-z_.+-]{3,37})$",
"name": "blockstack_id",
"type": "string",
"value": "blockstack_id"
},
{
"format": "^([0-9a-z_.+-]{3,37})$|^([0-9a-z_+-]{1,37}).([0-9a-z_.+-]{3,37})$",
"name": "domain",
"type": "string",
"value": "domain"
},
{
"format": "^([0-9a-f]{64,66})$",
"name": "owner_key",
"type": "string",
"value": "private_key"
}
],
"command": "get_did_configuration",
"group": "DID",
"usage": "Creates a DID configuration for the given blockstack id and domain to create a link between both.The specification is define by the Decentralized Identity Foundation at https://identity.foundation/specs/did-configuration/\nThe DID configuration should be placed in the json file \".well_known/did_configuration\"\nExample:\n\n $ # Tip: you can get your owner keys from your 12-word backup phrase using the get_owner_keys command.\n $ export PRIVATE_OWNER_KEY=\"6e50431b955fe73f079469b24f06480aee44e4519282686433195b3c4b5336ef01\"\n $ blockstack-cli get_did_configuration public_profile_for_testing.id.blockstack helloblockstack.com PRIVATE_OWNER_KEY\n {\n \"entries\": [\n {\n \"did\": \"did:stack:v0:SewTRvPZUEQGdr45QvEnVMGHZBhx3FT1Jj-0\",\n \"jwt\": \"eyJ0eXAiOiJKV1QiL....\"\n }\n ]\n }\n\nThe decoded content of the jwt above is \n {\n \"header\": {\n \"typ\": \"JWT\", \"alg\": \"ES256K\"\n },\n \"payload\": {\n \"iss\": \"did:stack:v0:SewTRvPZUEQGdr45QvEnVMGHZBhx3FT1Jj-0\",\n \"domain\": \"helloblockstack.com\",\n \"exp\": \"2020-12-07T13:05:28.375Z\"\n },\n \"signature\": \"NDY7ISzgAHKcZDvbxzTxQdVnf6xWMZ46w5vHcDpNx_1Fsyip0M6E6GMq_2YZ-gUcwmwlo8Ag9jgnfOkaBIFpoQ\"\n }\n\n"
}
]

Loading…
Cancel
Save