Introducing Gyve (pronounced gɪv)
Introducing Gyve, the first programming language that runs directly on the Ethereum blockchain. Gyve is a Lisp dialect that runs directly on Ethereum, allowing the development of unprecedented on chain experiences by anyone with a little programming experience.
Gyve is a giant leap forward in NFT development. Previously, to develop an on chain NFT, you had to know the intricacies of solidity programming, deploying contracts, and a host of other complex systems. Gyve cuts through all of the complexity, letting anyone write a Gyve program to generate the data and metadata for the NFT collection. That's right, the only thing you need to do is write a Gyve program in order to have your very own ERC721 NFT collection!
Remember, Gyve executes on chain, so there is no reliance on any third party data storage (like IPFS), or any external servers.
NFTs for the Masses
Gyve is like a web site generator for NFTs. When the web started, only a few could participate because of the complexity. The same as NFTs today. Gyve cuts through the complexity, bringing NFTs to the masses. All directly from from our web app.
Turnkey On Chain NFTs
Gyve is the key to Instant NFT. You can have your very own ERC721 NFT up and running on Ethereum in a few minutes for very low cost.
You can use our online editor directly from the web to edit and debug the Gyve script for your NFT. When you are ready, unpause your collection and start minting!
The Gyve programming language can be used for generative art, pfps, or anything you can think of.
Gyve is a traditional Lisp interpreter enhanced to run directly on the EVM. It's a mini lisp implementation that supports:
- 256 bit integers, strings, ETH addresses, symbols, cons cells,
- global variables,
- lexically-scoped local variables,
- closures,
- if conditional, while loops
- many primitive functions, see below,
- user-defined functions,
- a macro system
- ETH contract staticcall
Gyve has many special features built in to make it easy to generate metadata and svg. It takes care of all the encoding and packaging of the metadata payload that is required for on chain art projects.
This document descibes the Gyve features in detail.
Note on Names
Since storing large amounts of string data on the blockchain can be expensive, Gyve uses very short names and symbols to cut down on the number of bytes in Gyve programs. We also recommend that you use short variable and other names where possible to keep the total program size as small as possible.
Literals
Gyve supports integer, string, and ETH address literals, and (), t, and list literals.
- Strings are double quoted.
- () is the only false value.
- t is the true value, and any non () is also true.
- Integers are 256 bit integers.
- The special operator & is used to create an ETH address. The address is a hex string in double quotes (see below).
- List literals are the cons cells quoted by quote. The ' character is a shortcut for quote.
Predefined Functions
+ add integers
- subtract integers
* multiply integers
/ divide integers
% mod integers
$$ create a list (same as lisp list)
($$ x y z ...).
$ create a variable (same as lisp define)
$ name value.
' quoted list
'(x y z ...).
$! set variable (same as lisp setq)
$! name value.
cons
car
cdr
progn
$f (same as lisp defun)
>> output to stream
>> n string, where n in an integer between 0 and 49.
There are 50 streams in Gyve for outputing svg data. When a Gyve program terminates, the 50 streams are concatenated together in order to form the image payload. We give you 50 streams because svg is highly structured, and having 50 streams can make it easier to create correct svg output. It is also done to save string concatentions, which are somewhat expensive in the EVM.
For example, say you are using just one stream, and have added 20K to the stream. Adding one more byte is expensive, since we need to copy the existing string to a new memory area with one extra byte for the new addition. Don't overthink this or worry about it too much until your payloads start getting very large, but be cognizant of the streams that are available.
You can also use the streams for separating the svg output into chunks. For instance, many svgs will use the <defs> sections. So it makes sense to put this part of the svg in a stream.
<< create xml string without an end tag
(<< "tag" "attr1" value1 "attr2" value2 ...)
This will generate an XML string of the form <tag attr="value" attr2="value2">
</ create xml string with an end tag
(</ "tag" "attr1" value1 "attr2" value2 ...)
This will generate an XML string of the form <tag attr="value" attr2="value2"/>
/> create xml end tag
(/> "tag")
This will generate an end XML tag of the form </tag>
while
if
= equality test for integers and strings
!= test for integers and strings
> greater than for integers
< less than for integers
>= greater than or equal for integers
<= greater than for integers
>p print cell
>x convert integer to hex string
>s convert integer to string
, concatentate strings
(, "concat " "some " " strings")
rnd generate random number
rnd% n - generate random number between 0 and n - 1
>& set metadata name or description
(>& 0 or 1 "value")
(>& 0 "some name") sets the name field in the metadata.
(>& 1 "some desc") sets the description field in the metadata.
>@ set metadata property
(>& "attr" "value")
Set a metadata property. Both args must be strings.
nth n list
Select the nth item in a list.
#l list
Return the length of a list.
>id base
Generate a unique string id from a base string. Use this to generate reference id strings in svg.
Contract Method Calls
One of the amazing features of Gyve is that you can call other contracts!
& hexstr
(& "0xf2341234...")
Create an ETH address.
!x external method staticcall
(!x contract signature)
Call a contract method. contract is an ETH address. The signature is the standard abi method call signature as a string. The data sent to the method is preset using the !u, !i, and !s functions.
!u value
Encode an unsigned integer for an external call.
!i value
Encode an integer for an external call.
!s value
Encode a string for an external call.
!0 value
Clear the encoded data area.
!!s value
Decode a string from an external call.
!!u value
Decode an unsigned integer from an external call.
!!i value
Decode an integer from an external call.