Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
alerdenisov committed Jul 20, 2018
0 parents commit d13cb23
Show file tree
Hide file tree
Showing 10 changed files with 2,422 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
builtin
bashrc
.DS_Store
*.log
62 changes: 62 additions & 0 deletions .vscode/c_cpp_properties.json
@@ -0,0 +1,62 @@
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
"/usr/local/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"/usr/include",
"${workspaceRoot}",
"${workspaceRoot}/builtin",
"${workspaceRoot}/../../eos/eos/contracts",
"${workspaceRoot}/../boost"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
"/usr/local/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/include",
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"/usr/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": ["/System/Library/Frameworks", "/Library/Frameworks"]
},
{
"name": "Linux",
"includePath": ["/usr/include", "/usr/local/include", "${workspaceRoot}"],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": ["/usr/include", "/usr/local/include", "${workspaceRoot}"],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
"${workspaceRoot}"
],
"defines": ["_DEBUG", "UNICODE"],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
56 changes: 56 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,56 @@
{
"files.associations": {
"atomic": "cpp",
"utility": "cpp",
"iosfwd": "cpp",
"__bit_reference": "cpp",
"algorithm": "cpp",
"array": "cpp",
"ios": "cpp",
"__tree": "cpp",
"bitset": "cpp",
"set": "cpp",
"deque": "cpp",
"functional": "cpp",
"list": "cpp",
"map": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"*.ipp": "cpp",
"regex": "cpp",
"sstream": "cpp",
"strstream": "cpp",
"__locale": "cpp",
"__functional_base": "cpp",
"istream": "cpp",
"locale": "cpp",
"memory": "cpp",
"thread": "cpp",
"tuple": "cpp",
"variant": "cpp",
"optional": "cpp",
"queue": "cpp",
"stack": "cpp",
"__config": "cpp",
"__nullptr": "cpp",
"exception": "cpp",
"initializer_list": "cpp",
"new": "cpp",
"stdexcept": "cpp",
"typeinfo": "cpp",
"cctype": "cpp",
"cstddef": "cpp",
"cstdlib": "cpp",
"cwctype": "cpp",
"__split_buffer": "cpp",
"iterator": "cpp",
"typeindex": "cpp",
"__hash_table": "cpp",
"forward_list": "cpp",
"string_view": "cpp",
"valarray": "cpp",
"__string": "cpp"
}
}
19 changes: 19 additions & 0 deletions Dockerfile
@@ -0,0 +1,19 @@
FROM eosio/builder
ARG branch=master
ARG symbol=SYS

RUN git clone -b $branch https://github.com/EOSIO/eos.git --recursive \
&& cd eos && echo "$branch:$(git rev-parse HEAD)" > /etc/eosio-version \
&& cmake -H. -B"/opt/eosio" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eosio -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true -DCORE_SYMBOL_NAME=$symbol \
&& cmake --build /opt/eosio --target install \
&& mv /eos/Docker/config.ini / && mv /opt/eosio/contracts /contracts && mv /eos/Docker/nodeosd.sh /opt/eosio/bin/nodeosd.sh && mv tutorials /tutorials \
&& rm -rf /eos

RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl vim psmisc python3-pip && rm -rf /var/lib/apt/lists/*
RUN pip3 install numpy
ENV EOSIO_ROOT=/opt/eosio
RUN chmod +x /opt/eosio/bin/nodeosd.sh
ENV LD_LIBRARY_PATH /usr/local/lib
VOLUME /opt/eosio/bin/data-dir
ENV PATH /opt/eosio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
69 changes: 69 additions & 0 deletions README.md
@@ -0,0 +1,69 @@
# EOS-playground

The easiest way to start develop smart contracts in the EOS Blockchain with Docker

### Set up

```
git clone https://github.com/grigio/eos-playground.git
# latest official docker images images
docker pull eosio/eos && \
docker pull eosio/builder && \
docker pull mongo
# persistance
docker volume create mongo-data-volume && \
docker volume create nodeos-data-volume && \
docker volume create keosd-data-volume
# latest example EOS smart contracts
svn export https://github.com/eosio/eos.git/trunk/contracts playground/contracts
```

You can customize which commands to run at startup in the EOS playground environment

```
cp bashrc.example bashrc
```

### Let's enter in the EOS Development Environment!

When you need, you can run the commands below in 2 terminal windows. The execution order is important.

```
# terminal 1 - Blockchain logs
docker-compose up
# terminal 2 - Interactive EOS environment, eosiocpp, cleos, ..
docker-compose exec -u $( id -u $USER ) builder bash --rcfile /bashrc
```

To test that all the pieces are fine together you can run:

```
playground❯ cleos get info
{
"server_version": "2ae61517",
"head_block_num": 361,
"last_irreversible_block_num": 360,
"head_block_id": "000001697eeb23ecab64cf78365c3ef5c959c543bf4d495c5b79c2ec5456480a",
"head_block_time": "2018-05-09T06:54:30",
"head_block_producer": "eosio"
}
```

You should see the block num increasing.

## Clean up

```
# Reset the persistant data
docker-compose down
docker volume rm mongo-data-volume && \
docker volume rm nodeos-data-volume && \
docker volume rm keosd-data-volume
rm -rfv playground/contracts
```
37 changes: 37 additions & 0 deletions bin/example
@@ -0,0 +1,37 @@
#!/bin/bash

## First run (Remember to save your default wallet master password)
# master password: ..PW5...
cleos wallet create
cp contracts/hello/ . -R
eosiocppfix -o hello/hello.wast hello/hello.cpp
## You can generate or import new keys
# cleos create key
# Private key: 5J21F3YcGvnACPUsAgd7qgnddFQaJtiEPYEMFWerzxrDkwsVRQc
# Public key: EOS8Dx6iX3L6q6Nzs6pqVaqbskhYH3APEo55eVw1S6N1ZF5T87Eqo
# cleos wallet keys
cleos wallet import 5J21F3YcGvnACPUsAgd7qgnddFQaJtiEPYEMFWerzxrDkwsVRQc
cleos create account eosio mycontract EOS8Dx6iX3L6q6Nzs6pqVaqbskhYH3APEo55eVw1S6N1ZF5T87Eqo EOS8Dx6iX3L6q6Nzs6pqVaqbskhYH3APEo55eVw1S6N1ZF5T87Eqo
cleos set contract mycontract hello/ -p mycontract
cleos push action mycontract hi '["luigi"]' -p mycontract

## Second run
cleos wallet unlock --password PW5KiicvVXaJFAsQM3bf9NAQCMdUmb2mgmbD3ckPrH4Eviw6HAAbb
cleos wallet import 5KVZF2vxY4ENugwDw2tCdYLmG7LzSyAc2KEk3x8HFeXtVFP1Xnk

# cleos create key
# Private key: 5KVZF2vxY4ENugwDw2tCdYLmG7LzSyAc2KEk3x8HFeXtVFP1Xnk
# Public key: EOS7ftQ12qreTrSN5BEP7WAJ5RZQg45pu4byhNcpioMEVr6CrnoPm
# cleos wallet keys

cleos create account eosio luigi EOS7ftQ12qreTrSN5BEP7WAJ5RZQg45pu4byhNcpioMEVr6CrnoPm EOS7ftQ12qreTrSN5BEP7WAJ5RZQg45pu4byhNcpioMEVr6CrnoPm
cleos create account luigi luigi.token EOS7ftQ12qreTrSN5BEP7WAJ5RZQg45pu4byhNcpioMEVr6CrnoPm EOS7ftQ12qreTrSN5BEP7WAJ5RZQg45pu4byhNcpioMEVr6CrnoPm
# cleos get accounts EOS7ftQ12qreTrSN5BEP7WAJ5RZQg45pu4byhNcpioMEVr6CrnoPm
cp contracts/eosio.token/ . -R
eosiocppfix -o eosio.token/eosio.token.wast eosio.token/eosio.token.cpp

cleos set contract luigi.token eosio.token -p luigi.token
cleos push action luigi.token create '[ "luigi", "100.0000 GGG", 0, 0, 0]' -p luigi.token
cleos push action luigi.token issue '[ "luigi", "99.0000 GGG", "memo" ]' -p luigi
cleos get currency balance luigi.token luigi
cleos push action luigi.token transfer '[ "luigi", "eosio", "15.0000 GGG", "m" ]' -p luigi
95 changes: 95 additions & 0 deletions config.ini
@@ -0,0 +1,95 @@
# Track only transactions whose scopes involve the listed accounts. Default is to track all transactions.
# filter_on_accounts =

# Limits the maximum time (in milliseconds) processing a single get_transactions call.
get-transactions-time-limit = 3

# File to read Genesis State from
genesis-json = /opt/eosio/bin/data-dir/genesis.json

# override the initial timestamp in the Genesis State file
# genesis-timestamp =

# the location of the block log (absolute path or relative to application data dir)
block-log-dir = "blocks"

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =

# the location of the chain shared memory files (absolute path or relative to application data dir)
shared-file-dir = "blockchain"

# Minimum size MB of database shared memory file
shared-file-size = 8192

# The local IP and port to listen for incoming http connections.
http-server-address = 0.0.0.0:8888

# Specify the Access-Control-Allow-Origin to be returned on each request.
# access-control-allow-origin =

# Specify the Access-Control-Allow-Headers to be returned on each request.
# access-control-allow-headers =

# Specify if Access-Control-Allow-Credentials: true should be returned on each request.
access-control-allow-credentials = false

# The actual host:port used to listen for incoming p2p connections.
p2p-listen-endpoint = 0.0.0.0:9876

# An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint.
# p2p-server-address =

# The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network.
# p2p-peer-address =

# The name supplied to identify this node amongst the peers.
agent-name = "EOS Test Agent"

# True to always send full blocks, false to send block summaries
send-whole-blocks = 1

# Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined.
allowed-connection = any

# Optional public key of peer allowed to connect. May be used multiple times.
# peer-key =

# Tuple of [PublicKey, WIF private key] (may specify multiple times)
# peer-private-key =
# Log level: one of 'all', 'debug', 'info', 'warn', 'error', or 'off'
log-level-net-plugin = info

# Maximum number of clients from which connections are accepted, use 0 for no limit
max-clients = 25

# number of seconds to wait before cleaning up dead connections
connection-cleanup-period = 30

# True to require exact match of peer network version.
network-version-match = 0

# Enable block production, even if the chain is stale.
enable-stale-production = true

# Percent of producers (0-100) that must be participating in order to produce blocks
required-participation = 33

# ID of producer controlled by this node (e.g. inita; may specify multiple times)
# producer-name =

# Tuple of [public key, WIF private key] (may specify multiple times)
private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]

# Plugin(s) to enable, may be specified multiple times
# plugin =
# Plugin(s) to enable, may be specified multiple times
plugin = eosio::producer_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::history_api_plugin
plugin = eosio::http_plugin
; plugin = eosio::mongo_db_plugin

# Enable block production with the testnet producers
producer-name = eosio
22 changes: 22 additions & 0 deletions eosic.json
@@ -0,0 +1,22 @@
{
"name": "eos-oracles",
"version": "0.0.1",
"description": "Generic EOSIC project",
"tests": "./test",
"migrations": "./migrate",
"contracts": {
"masteroracle": {
"name": "masteroracle",
"version": "0.0.1.1",
"description": "Master Oracle Contract",
"entry": "masteroracle.cpp",
"checksum": "7eac72556c849f2fe813345c7eb4d4df"
},
"priceoraclize": {
"name": "priceoraclize",
"version": "0.0.1.1",
"description": "Generic EOS contract",
"entry": "priceoraclize.cpp"
}
}
}
19 changes: 19 additions & 0 deletions package.json
@@ -0,0 +1,19 @@
{
"name": "eos-oracles",
"version": "0.0.1",
"description": "Generic EOSIC project",
"scripts": {
"test": "eosic test",
"compile": "eosic compile",
"migrate": "eosic migrate"
},
"dependencies": {
"binaryen": "37.0.0",
"eosjs": "14.0.0"
},
"devDependencies": {
"chai": "4.1.2",
"eosic": "DucaturFw/eosic",
"mocha": "5.2.0"
}
}

0 comments on commit d13cb23

Please sign in to comment.