Git Product home page Git Product logo

fogledger-iota's Introduction

FogLedger

FogLedger is a plugin for Fogbed. It is a framework and toolset integration for the rapid prototyping of fog components in virtualized environments using a desktop approach for DLTs. Its design meets the postulated requirements of low cost, flexible setup, and compatibility with real-world technologies. The components are based on a Mininet network emulator with Docker container instances as fog virtual nodes.

Install

Before installing Fogbed it is necessary to install some dependencies and Containernet, as shown in the steps below:

1. Install Containernet

sudo apt-get install ansible
git clone https://github.com/containernet/containernet.git
sudo ansible-playbook -i "localhost," -c local containernet/ansible/install.yml

2. Install Fogbed

sudo pip install fogbed

3. Install FogLedger

sudo pip install -U git+https://github.com/larsid/FogLedger-Iota.git

Get Started

Preparing Blockchain Test

Run example iota

cd examples/iota

Run local network test

sudo python3 test-local-network.py

Run distributed network test

sudo python3 test-distributed-network.py

Example: A local network with four nodes

from fogledgerIota.iota.IotaBasic import (IotaBasic)
from fogledgerIota.iota.config.NodeConfig import (NodeConfig)
from fogledgerIota.iota.config.CoordConfig import (CoordConfig)
from fogledgerIota.iota.config.SpammerConfig import (SpammerConfig)
from fogledgerIota.iota.config.ApiConfig import (ApiConfig)
from fogledgerIota.iota.config.WebAppConfig import (WebAppConfig)
from typing import List
from fogbed import (
    VirtualInstance, setLogLevel, FogbedDistributedExperiment, Worker, Controller
)

setLogLevel('info')


if (__name__ == '__main__'):
    exp = FogbedDistributedExperiment()
    worker = exp.add_worker('YOUR_HOST_IP or HOST_NAME')

    node1 = NodeConfig(name='node1', port_bindings={'8081':'8081', '14265':'14265'})
    node2 = NodeConfig(name='node2', port_bindings={'8081':'8082'})
    node3 = NodeConfig(name='node3', port_bindings={'8081':'8083'})
    node4 = NodeConfig(name='node4', port_bindings={'8081':'8084'})
    
    cord = CoordConfig(name='cord', port_bindings={'8081':'8085'}, interval='60s')
    
    spammer = SpammerConfig(name='spammer', port_bindings={'8081':'8086'}, message ='one-click-tangle.')
   
    api = ApiConfig(name='api', port_bindings={'4000':'4000'})    
    web_app = WebAppConfig(name='web_app', port_bindings={'80':'82'})
    
    iota = IotaBasic(exp=exp, prefix='iota1', conf_nodes=[node1, node2, node3, node4], conf_coord=cord, conf_spammer=spammer)

    for ledger in iota.ledgers:
        worker.add(ledger, reachable=True)
        worker.add_link(edge1, ledger)
    
    try:
        exp.start()
        iota.start_network()
        print("Experiment started")
        input('Press any key...')

    except Exception as ex:
        print(ex)
    finally:
        exp.stop()

fogledger-iota's People

Contributors

matheusnascimentoti99 avatar esaum10 avatar aacoutinho avatar allancapistrano avatar matheustdo avatar wesleisantos 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.