Giter Club home page Giter Club logo

pongpingpong's Introduction

pongpingpong

Tutorial on EOS Contracts and some Windows tooling

EOS Account

Introduction

Hello and welcome to a fun little tutorial around some great tooling created by us, EOS New York, that hopefully will make the life of the elusive Windows EOS Developer a bit easier.

So what is a pongpingpong you may be asking. pongpingpong is an EOS smart contract tutorial that revolves around EOS Easy Contract, Windows Developers, and eventually some more advanced smart contract contracts. Part I will focus on getting everyone up to speed on creating, compiling, and deploying their smart contract. Follow up sections will revolve around more advanced smart contracts such as inline actions, multi-index databases, and "the Trust and Confirm model". At the end of this tutorial you should be able to setup a Windows environment for smart contract development.

Prerequistes This project requires Docker for Windows (of course) and my new favorite text editor, IDE, and all around good guy VS Code. Both of these tools have great communites with tons of information available regarding setup and customization. The final requirement is the brainchild of our very own Warrick. He spent a rainy weekend holed up creating EOS Easy Contract. We will be using this project to create, compile, and deploy a smart contract.

Goals

Our goal here is to get any developers from the Windows world who may be unsure of how get into the EOS development game. There is a ton of tooling for Mac and Linux but no love for the Windows Dev. Hopefully this opens some doors for those characters.

Environment setup

I am going to assume that you have installed Docker and VS Code using the links above. Now it is time to get EOS Easy Contract heading to the github link and following the setup instructions there.

Now that you have completed the install of EOS Easy Contract it is now time to start building your first smart contract.

Part I: Create, Compile, and Deploy Your Smart Contract

1. First create the pongpingpong project

> EOSEasyContract.exe template new --path %USERPROFILE% --name pongpingpong

Template output

2. Open up the project in VS Code

code %USERPROFILE%\pongpingpong

3. Compile the code

Hit Ctrl-Shift-B to build the sample contract Compile output

4. Check out the built files

Now in the build directory you should be able to see the wasm and abi files

build output

5. Start the development docker image

a. First find the docker image name from the build output.

In this case it is EOSCDT-CB6FACF96E87DAA7FAB531911B0B8683

container output

b. Open the terminal

Hit Ctrl-Shift-\` to open a terminal

docker exec -it EOSCDT-CB6FACF96E87DAA7FAB531911B0B8683 /bin/bash

start docker output

6. Start a single node testnet

The below steps are captured in a script that can be copied to the machine and run.

a. Start nodeos
# send output to a log file and start a background process
nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin &> /var/log/nodeos.log & 
tail /var/log/nodeos.log

nodeos output

b. Create wallet and import key
# create wallet named "default"
cleos wallet create --file /tmp/default.w

# import the default private key
cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

# the wallet will lock occasionally so you would need to unlock it
cleos wallet unlock --password `cat /tmp/default.w`

wallet output

c. Load up the bios contract
cleos set contract eosio /opt/eosio/contracts/eosio.bios/ -p eosio@active

bios output

d. Create an account

For the sake of this tutorial we are using the default key. DO NOT USE THIS KEY FOR ANYTHING BUT DEVELOPMENT

# create the account
cleos create account eosio pongpingpong EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV 

# check the account
cleos get account pongpingpong

account output

e. Load up the contract
# load up the wasm file
cleos set code pongpingpong /data/build/pongpingpong.wasm

# load the abi
cleos set abi pongpingpong /data/build/pongpingpong.abi

set code output

f. Push a test transaction
cleos push action pongpingpong hi '{"user" : "pongpingpong"}' -p pongpingpong

action output

pongpingpong's People

Contributors

deckb avatar gleehokie avatar

Stargazers

 avatar

Watchers

 avatar  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.