Digital Assets on Tezos

Digital Assets on Tezos

  • Docs
  • TQ Tezos
  • Tezos.com
  • GitHub

›Setup

Digital Assets on Tezos

  • Welcome

Setup

  • Tezos Client
  • Sandbox

Token Contracts

    FA1.2

    • Introduction
    • FA1.2 LIGO
    • FA1.2 Lorentz
    • FA1.2 Archetype

    FA2

    • FA2-SmartPy
    • FA2 NFT Tutorial LIGO

    Specialized Multisig

    • Introduction
    • Originate and Use

    Transferlist

    • Introduction
    • Originate and Use

    AdminLambda

    • AdminLambda Quick Start

    Vesting

    • Vesting Contract Quick Start

Oracle

  • Oracle Quick Start

Experimental

  • Ticket NFT Auction in Ligo

Run a Public Node with AWS Cloud

  • Running a Public Tezos Node with AWS Cloud
  • Create VPC
  • Key Pair and Github Access Key
  • Deploy the Tezos Updater
  • Deploy Your Tezos Nodes
  • Confirm the Nodes

Use Docker and Flextesa to Run an Independent Tezos Sandbox

Running ephemeral and isolated sandboxes can be useful to experiment with faster networks or to automate reproducible tests.

Here we use Flextesa to run one or more Tezos nodes, bakers, and endorsers contained in a sandbox environment. The default sandbox is configured to be compatible with the tezos-client installed in the “Client-setup” section.

Dependencies

This example requires Docker, available for Linux, Mac or Windows at https://www.docker.com.

Starting and Using a Sandbox

Start the sandbox in the background (will run with baking enabled):

docker run --rm --name my-sandbox --detach -p 20000:20000 \
       tqtezos/flextesa:20210316 edobox start

After a few seconds this should succeed:

tezos-client config reset        # Cleans-up left-over configuration.
tezos-client --endpoint http://localhost:20000 bootstrapped

Configure the client to communicate with the sandbox:

tezos-client --endpoint http://localhost:20000 config update

Then, instead of using a public faucet one can just use ꜩ by importing accounts already existing in the sandbox. They are visible with:

 $ docker run --rm tqtezos/flextesa:20210316 edobox info

Usable accounts:

- alice
  * edpkvGfYw3LyB1UcCahKQk4rF2tvbMUk8GFiTuMjL75uGXrpvKXhjn
  * tz1VSUr8wwNhLAzempoch5d6hLRiTh8Cjcjb
  * unencrypted:edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq
- bob
  * edpkurPsQ8eUApnLUJ9ZPDvu98E8VNj4KtJa1aZr16Cr5ow5VHKnz4
  * tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6
  * unencrypted:edsk3RFfvaFaxbHx8BMtEW1rKQcPtDML3LXjNqMNLCzC3wLC1bWbAt

Root path (logs, chain data, etc.): /tmp/mini-box (inside container).

You may then just import them:

tezos-client import secret key alice unencrypted:edsk3QoqBuvdamxouPhin7swCvkQNgq4jP5KZPbwWNnwdZpSpJiEbq --force
tezos-client import secret key bob unencrypted:edsk3RFfvaFaxbHx8BMtEW1rKQcPtDML3LXjNqMNLCzC3wLC1bWbAt --force

Check their balances:

tezos-client get balance for alice

Using The Sandbox

See also the Tezos Client section or the Wallet-usage tutorial of the Tezos manual.

For instance, one can originate the most minimalistic contract:

# Download the contract:
wget https://gitlab.com/tezos/tezos/raw/mainnet/src/bin_client/test/contracts/attic/id.tz
# Run origination:
tezos-client originate contract hello-id transferring 0 from bob running id.tz --init "\"hello world\"" --burn-cap 1 --force

Shutting Down The Sandbox

When you're done playing, just destroy the container:

docker kill my-sandbox

Advanced Usage

Tweak Protocol Constants

One can see the configuration of the protocol running in the sandbox with:

tezos-client rpc get /chains/main/blocks/head/context/constants

One important field is "time_between_blocks": [ "5" ], which means that blocks are baked every 5 seconds (as opposed to 60 seconds on Mainnet).

This constant can be configured with the block_time environment variable, see example below:

docker run --rm --name my-sandbox -e block_time=2 --detach -p 20000:20000 \
       tqtezos/flextesa:20210316 edobox start

The above command runs a full sandbox with the Edo protocol and a faster time-between-blocks of 2 seconds.

Many other parameters are set by the edobox script. All the configuration options available can be seen with the command:

docker run --rm -it tqtezos/flextesa:20210316 flextesarl mini-net --help

Try The Florence Protocol

The Docker image also contains a flobox script:

docker run --rm --name my-sandbox --detach -p 20000:20000 \
       tqtezos/flextesa:20210316 flobox start

On can then check that the protocol hash is PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:

 $ tezos-client rpc get /chains/main/blocks/head/metadata | grep protocol
{ "protocol": "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",
  "next_protocol": "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",

or that the maximal length of operations has been increased to 32 KiB:

 $ tezos-client rpc get /chains/main/blocks/head/context/constants | grep max_operation_data_length
  "max_anon_ops_per_block": 132, "max_operation_data_length": 32768,

Further Reading

For more issues or questions, see the Flextesa repository, and for even more advanced usage, see the documentation (esp. for the mini-net command).

← Tezos ClientIntroduction →
  • Dependencies
  • Starting and Using a Sandbox
  • Using The Sandbox
  • Shutting Down The Sandbox
  • Advanced Usage
    • Tweak Protocol Constants
    • Try The Florence Protocol
  • Further Reading
Digital Assets on Tezos
Copyright © 2021 Tocqueville Group, Inc. All rights Reserved.
  • Home
  • Partnerships
  • Assets
  • Events
  • Blog
  • Jobs
  • Contact
  • TwitterRedditMediumLinkedIn
  • White Paper
  • Position Paper
  • Agora | Governance
  • Developer Portal
  • Start Baking
  • TwitterRedditMediumLinkedIn