Skip to content

Commit d89cbd8

Browse files
updated: deps, contract deployment log, wait for receipt
1 parent 272b60c commit d89cbd8

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

.github/workflows/e2e.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818

1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222
- name: Set up Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626
# - name: Install Windows Build Tools (if needed)
@@ -45,9 +45,9 @@ jobs:
4545

4646
steps:
4747
- name: Checkout code
48-
uses: actions/checkout@v3
48+
uses: actions/checkout@v4
4949
- name: Set up Python ${{ matrix.python-version }}
50-
uses: actions/setup-python@v4
50+
uses: actions/setup-python@v5
5151
with:
5252
python-version: ${{ matrix.python-version }}
5353
- name: Install Python dependencies

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ A simple IoT and Blockchain based application to demonstrate the use of blockcha
88

99
- [Node.js](https://nodejs.org/en/download/)
1010
- [Python](https://www.python.org/downloads/)
11-
- Windows 8+ or MacOS X
11+
- Windows 8+ (for simulating GPIO pins on Windows), Raspberry Pi (for using actual GPIO pins)
12+
- [Windows Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) - Only for Windows (Simulating GPIO pins on Windows)
1213

1314
> Note: _Windows Build Tools is required to install web3. Install through Powershell(Admin) if not installed already_
1415

app.py

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
contract = w3.eth.contract(abi=abi, bytecode=bytecode)
6060
tx_hash = contract.constructor().transact()
6161
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
62+
print('Contract deployed at:', tx_receipt.contractAddress)
6263
contract_instance = w3.eth.contract(address=tx_receipt.contractAddress, abi=abi)
6364

6465
# Get initial pin status
@@ -83,6 +84,9 @@ def set_pin_status(pin_id, action):
8384
tx_hash = contract_instance.functions.setPinStatus(pin_number, pin_status).transact({'from': w3.eth.accounts[0]})
8485
print('Transaction submitted:', tx_hash.hex())
8586

87+
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
88+
print('Transaction confirmed in block:', tx_receipt.blockNumber)
89+
8690
pin_status = contract_instance.functions.pinStatus(pin_number).call()
8791
print(f'Pin {pin_number} status changed to {pin_status}')
8892

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "iot-blockchain-demo",
3-
"version": "1.0.0",
3+
"version": "2.2.0",
44
"description": "First implementation of enhanced security in IoT using Blockchain",
55
"main": "",
66
"scripts": {
@@ -13,7 +13,7 @@
1313
"license": "ISC",
1414
"dependencies": {},
1515
"devDependencies": {
16-
"hardhat": "2.17.2",
16+
"hardhat": "2.20.1",
1717
"pip": "0.0.1"
1818
}
1919
}

requirements.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
flask~=2.3.3
2-
web3==6.9.0
3-
simplejson==3.19.1
1+
flask~=3.0.2
2+
web3==6.15.1
3+
simplejson==3.19.2
44
GPIOSimulator==0.1 #Rasp-pi Simulator package
55
#RPi.GPIO==0.7.0 #use when connected to real rasp-pi

static/style.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
body {
2-
background-image: url("background.jpg");
2+
background: url("background.jpg");
33
font-family: "Courgette", cursive;
44
background-attachment: fixed;
55
color: white;

0 commit comments

Comments
 (0)