Tezos environment manager & smart contract development toolkit
This project is a WIP, contact t.me/maht0rz for any questions
Tezos environment manager provides a seamless way to develop smart contracts and dapps locally for public networks such as alphanet
, and private networks such as sandboxnet
alphanet
environment is currently WIP
Sections of readme with 'π ' are only applicable to the
sandboxnet
environment
1. Choose an environment / network
source ./env/sandboxnet.sh
2. Start the apropriate tezos node
make start
3. Open the interactive shell with tezos-client
and liquidity
preconfigured
β οΈ Β All Tezos related commands will be ran inside this shell
make client
Inside the newly started shell, initialize the tezos-client
by running:
# Run this inside the shell created by make client
init-client
β οΈ tezos-client
needs to be initialised only once, unless you delete/restart your bootstrapped network.
4. Confirm the setup by navigating to local TzScan
TzScan is available at http://localhost:8000/.
You should see your sandboxed network with no transactions at block 1, baked by God.
When you start your sandboxnet
node for the first time, make sure to initialize your client in order to get a handful of testing accounts to play with.
init-client
tezos-client list known addresses
tezos-client transfer 1000 from bootstrap1 to bootstrap2 &
tezos-client bake for bootstrap1
tezos-client get balance for bootstrap2
You can find an example smart contract, in all three supported syntaxes: .liq
.reliq
.tz
, under src/contracts/
β οΈ Prievously we've encouraged the use ofrefmt
to convert.re
files into.liq
files, but liquidity now supports ReasonML syntax out of the box, you can learn more here.
liquidity \
--tezos-node $NODE_URL \
--amount 2tz \
tezos-environment-manager/src/contracts/simple.liq \
--run main '5' '1'
The command above, will test our
simple.liq
smart contract, by calling it's entry pointmain
, with it's single argument as1
, while setting it's initial storage value to5
.
β οΈ Β$NODE_URL
is set based on your environment automatically
liquidity \
--tezos-node $NODE_URL \
--amount 2tz \
--fee 1tz \
--delegatable \
--source tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx \
tezos-environment-manager/src/contracts/simple.liq \
--forge-deploy > contract_deployment_op.bytes
tezos-client sign bytes 0x03$(cat ./contract_deployment_op.bytes) for bootstrap1
liquidity \
--tezos-node $NODE_URL \
--signature signature_goes_here \
--inject contract_deployment_op.bytes
π Β Don't forget to bake a new block after injecting an operation
You can use the following command, to get the originated address of your contract. (e.g. KT1GtgAL2VV2R9McZmhPxTp5syB4ysyG2XL1)
tezos-client get receipt for operation_hash_goes_here
tezos-client show address bootstrap1 -S
Liquidity supports syntax of ReasonML in the form of .reliq
files, instead of the traditional .liq
files.
If your file has a .reliq
extension, it'll be automatically parsed as ReasonML.
liquidity \
--tezos-node $NODE_URL \
--amount 2tz \
tezos-environment-manager/src/contracts/simple.reliq \
--run main '5' '1'
Once your local environment is up & running, you can
visit the block explorer (tzscan) at http://localhost:8000
Don't forget to bake a new block after you inject any operations using the client.
π·β Listing of all existing blocks does not seem to work at the moment, however dashboard displays blocks as it should
RPC with Sotez
You can find an attached example of sotez.node.query
in the examples/
folder.
You will need a recent version of NodeJS installed locally
- Install dependencies
npm install
- Run the example
# Get current block/head
npm run head
# Get storage of a deployed smart contract
# Make sure your contract is deployed and the example address is up-to-date
npm run contract
- Automated contract deployment & testing in ReasonML / OCaml & bs-jest
- Alphanet support