GithubHelp home page GithubHelp logo

beaker-calculator's Introduction

Showcasing Beaker

This is a direct comparison of the simple calculator contract written in Beaker and bare PyTeal and it shows how Beaker simplifies writing smart contracts and interacting with them.

Contents

calculator-pyteal/ - Directory containing calculator app and interactions in bare PyTeal and Python SDK
approval.teal - autogenerated calculator TEAL approval program
clear.teal - autogenerated calculator TEAL clear program
contract.json - A JSON file describing the interface of the contract to be read by SDK clients
contract.py - A calculator PyTeal contract that generates a set of methods that can be called as ABI methods
interact.py - A set of interaction calls that uses the Python SDK to interact with the calculator app
sandbox.py - helper method that fetch accounts from sandbox

calculator-beaker/ - Directory containing calculator app and interactions in Beaker
calculator.py - A calculator Beaker contract and interaction calls with Beaker

Development Environment

Install Sandbox

Install the sandbox to start a local private node and start it with the source configuration.

NOTE: Currently Beaker requires a sandbox running with the source config (or any config that contains this commit)

If you're in the sandbox directory run:

./sandbox up source

Clone repository

Next, clone this repository and cd to the root directory.

Setup Virtual Environment

Create a virtual environment inside the project directory.

python3 -m venv venv

Activate virtual environment.

source ./venv/bin/activate

requirements.txt file contains all of the required dependencies and packages. Install them in your virtual environment by running:

pip install -r requirements.txt

Check all dependencies and packages install in your virtual environment by running:

pip list

Testing Calculator App with Bare PyTeal and Python SDK

Compile Contract

After double checking that sandbox is running, go into the calculator-pyteal directory and run:

python3 contract.py

This will create the teal source files in approval.teal and clear.teal, and contract.json ABI file.

Deploy and Interact

python3 interact.py 

This will deploy and interact with the calculator app.

Testing Calculator App with Beaker

Compile, Deploy, and Interact

Go into the calculator-beaker directory and run:

python3 calculator.py

This will compile, deploy, and interact with the calculator app.

beaker-calculator's People

Contributors

iskysun96 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.