一、環境準備
目的
把已經上鏈的資料修改掉,比如把下面的input屬性中的65改為56:
原資料:
blockHash: 0xd6e8b6ca32f070169aa044d04455dc9ecbb73362e0a7f3aeaba3347131c88258
blockNumber: 0x6
gas: 0x11e1a300
from: 0x8554566216d3a85e4ed46084fc744cd177524bfe
transactionIndex: 0x0
to: 0x57a6e72c5cb194e1027427a4c9395d41683d7306
nonce: 0x903e745366997d55acf317484e92ea7268de4ea05b2389da6022649b8e3a5e
value: 0x0
hash: 0xff5c565141e0f78187f07fb43f95f262aac39955c7b47e1d8a1184990f21040c
gasPrice: 0x11e1a300
input:
0x4ed3885e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000066269616f67650000000000000000000000000000000000000000000000000000
修改后的資料:
blockHash: 0xd6e8b6ca32f070169aa044d04455dc9ecbb73362e0a7f3aeaba3347131c88258
blockNumber: 0x6
gas: 0x11e1a300
from: 0x8554566216d3a85e4ed46084fc744cd177524bfe
transactionIndex: 0x0
to: 0x57a6e72c5cb194e1027427a4c9395d41683d7306
nonce: 0x903e745366997d55acf317484e92ea7268de4ea05b2389da6022649b8e3a5e
value: 0x0
hash: 0xff5c565141e0f78187f07fb43f95f262aac39955c7b47e1d8a1184990f21040c
gasPrice: 0x11e1a300
input:
0x4ed3885e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000066269616f67560000000000000000000000000000000000000000000000000000
鏈環境
1.下載建鏈腳本
curl -#LO https://github.com/FISCO-BCOS/FISCO-BCOS/releases/download/v2.6.0/build_chain.sh && chmod u+x build_chain.sh
2.安裝以mysql底層存盤的鏈
bash build_chain.sh -s mysql -l 127.0.0.1:2 -p 30300,20200,8545

3.寶塔安裝mysql并創建2個資料庫(node1 node2),因為有2個節點

4.修改資料庫配置資訊(node0 node1都要改),注意這個的mysql的用戶需要root權限才能啟動鏈
node0:

node1:

5.啟動底層鏈

6.查看資料庫表

控制臺環境
1.在節點目錄下執行 download_console.sh

2./root/test/nodes/127.0.0.1/console/conf 目錄下重命名applicationContext-sample.xml為applicationContext.xml

3.復制/root/test/nodes/127.0.0.1/sdk 下的所有檔案到/root/test/nodes/127.0.0.1/console/conf 下

4.啟動控制臺并部署呼叫合約

發現mysql中存盤的是blog型別如下圖所示:
node1:

node2:

發現node1和node2的表資料經過共識后完全一致
安裝區塊鏈瀏覽器更直觀的查看相關的區塊資料
1.克隆相關的代碼
git clone https://github.com/FISCO-BCOS/fisco-bcos-browser.git

2.修改common.properties中的配置

3.安裝
[root@localhost deploy]# python deploy.py installAll
===================== envrionment check... =====================
check git...
check finished Sucessfully.
check wget...
check finished Sucessfully.
check openssl...
check finished Sucessfully.
check curl...
check finished Sucessfully.
check nginx...
check finished sucessfully.
check java...
check finished sucessfully.
check server port..
check finished Sucessfully.
check web port...
check finished Sucessfully.
check db connection...
check finished Sucessfully.
===================== envrionment ready... =====================
===================== deploy start... =====================
fisco-bcos-browser.zip編譯包已經存在,是否重新下載?[y/n]:n
fisco-bcos-browser.zip編譯包已解壓過,是否重新解壓?[y/n]:n
資料庫db_browser已經存在,是否洗掉重建?[y/n]:n
======= server start success! =======
======= web start success! =======
===================== deploy end... =====================
============== 通過以下鏈接訪問,IP改成服務器IP ================
http://IP:5100/
[root@localhost deploy]#
4.訪問http://192.168.119.132:5100/ 新建群組

5.新建節點

二、開始實驗
1.想辦法篡改相關的資料試試,
把hash最后一條資料的最后一位9改為8試試會發生什么

修改后:

2.我們再呼叫合約查詢一下看看,貌似沒什么問題

6. 按照上面的步驟把hash最后一條資料的最后一位9改為8試試會發生什么,查看交易資訊并和mysql中的資料對比, 發現區塊鏈瀏覽器中的hash最后一位為8

同時發現最后一位為9也能訪問

7.猜測資料應該是存在value欄位中(transactions中的input屬性),但是型別為blob還沒深入研究怎么修改,所以把值設為null,看看情況
node1:

node2:

再看看瀏覽器(貌似沒作用,難得是我們弄錯表或者欄位了?):

懷疑區塊鏈瀏覽器有快取重啟一波服務在看看:

還是一樣:

歡迎留言討論
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/167255.html
標籤:其他
