Hi, this topic/problem is part of my Master’s degree project, which I am currently facing. The project is about doing different types of pre-processing in the P4 switch to compress IoT Data and then store them in the Blockchain as also being sent to the IoT Cloud simultaneously.
The problem relies on being unable to connect/send data from my Mininet hosts to the Blockchain Ethereum (Ganache), which runs outside the Mininet environment.
I will describe what I am doing and the outcomes to make it easier to understand. English is not my native language, so feel free to ask if anything is not understandable.
Consider Ethereum (Ganache) is already up and running outside Mininet on the address: HTTP://10.0.2.15:7545
After deploying my BMv2 mininet network, I open h1;
Inside the h1, I run my Python script containing (It is working fine outside Mininet):
from web3 import Web3 (I’ve installed web3 locally)
##For connecting to ganache##
w3 = Web3(Web3.HTTPProvider(“http://10.0.2.15:7545”))
chain_id = 1337
…
The rest of the script interacts with Smart Contract
The Ganache has the following configuration and possible options:
I get the following response after executing the script:
This is the s1.log after executing the script:
It may be possible to make the h1 somehow interact with the Ethereum (Ganache) by changing its interface or IP (I don’t know how). However, this problem I am facing is just the first step to see if I can talk to the Ethereum (Ganache), my second move is going to put this script inside a receive.py, and for every received packet, I would take some headers, as strings and send them to Ethereum (Ganache) as transactions. This last observation is necessary to be said as If somehow h1 can communicate outside Mininet with Ethereum (Ganache), I would still need also to be able to receive packets from other hosts inside the Mininet.