1. Trang chủ
  2. » Luận Văn - Báo Cáo

Optimizing smart contracts on ethereum

58 0 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY MASTER THESIS IN DATA SCIENCE AND ARTIFICIAL INTELLIGENCE Optimizing smart contracts on Ethereum NGUYEN QUANG THANG thang.nq202710m@sis.hust.edu.vn Supervisor: Dr Do Ba Lam Institution: —————————————- School of Information and Communication Technology 123doc Mang Luôn thay h■■ng l■im■i s■ cam tr■ h■u m■t k■t nghi■m t■im■t s■ cáwebsite nhân mang kho m■ith■ kinh m■ l■i d■n vi■n nh■ng cho doanh ■■u kh■ng ng■■i quy■n chia t■ th■c dùng, l■ s■l■i v■i hi■n t■t công h■n mua ngh■a nh■t 2.000.000 ngh■ báncho tài v■ hi■n ng■■i li■u c■a tài th■ hàng li■u dùng hi■n ■■u ■ thìt■t Khi ■■i, s■p Vi■t c■ khách b■n t■i, l■nh Nam ngh■a online hàng v■c: Táctr■ không v■ tài phong thành c■a khác chuyên c■a thành tíngì d■ng, hàng so nghi■p, viên v■i tri■u cơng c■a b■n hồn nhà ngh■ 123doc g■c bán h■o, thơng B■n hàng ■■ n■p có tin, l■i cao th■ ti■n ngo■i chuy■n tính phóng vào ng■, Khách trách tài giao to,kho■n nhi■m thu sang nh■ c■a ■■i ■■n hàng tùy123doc, v■i v■ ý cót■ng qu■n th■b■n d■ ng■■i lýChào dàng s■ dùng ■■■c m■ng tra c■u M■c h■■ng b■n tàitiêu li■u ■■n nh■ng hàng m■t v■i■■u quy■n cách 123doc c■a l■i123doc.net sau xác,n■p nhanh ti■n tr■ chóng thành website th■ vi■n tài li■u online l■n nh■t Vi■t Nam, cung c■p nh■ng tài li■u ■■c khơng th■ tìm th■y th■ tr■■ng ngo■i tr■ 123doc.net Nhi■u event thú v■, event ki■m ti■n thi■t th■c 123doc luôn t■o c■ h■i gia t■ng thu nh■p online cho t■t c■ thành viên c■a website Mangh■n Luôn Th■a Xu■t Sau Nhi■u 123doc Link h■■ng phát thu■n l■i event cam s■ nh■n xác m■t tr■ t■ h■u k■t s■ thú nghi■m t■i th■c ýxác n■m t■■ng m■t d■ng v■, s■ nh■n s■ website mang event kho m■i ■■■c ■■i, t■o tLink t■ th■ m■ l■i c■ng ki■m ■■ng d■n 123doc CH■P g■i vi■n xác nh■ng cho ■■u ■■ng ti■n v■ th■c h■ kh■ng ng■■i NH■N ■ã ■■a quy■n th■ng thi■t chia t■ng s■ ki■m dùng, l■ ch■ CÁC s■ ■■■c th■c s■ l■i b■■c v■i ti■n email chuy■n ■I■U t■t công h■n mua 123doc g■i online kh■ng nh■t b■n 2.000.000 v■ ngh■ bán KHO■N sang b■ng cho ■■a ■ã tài ■■nh hi■n ■■ng ng■■i li■u ph■n ch■ tài TH■A tài v■ th■ li■u hàng t■o email li■u thơng ky, dùng tríhi■n THU■N hi■u c■ c■a b■n ■■u ■b■n tin t■t h■i Khi ■■i, qu■ vui Vi■t xác c■ ■ã khách gia lòng b■n nh■t, minh l■nh ■■ng Nam t■ng Chào ■■ng online hàng uy tài v■c: l■nh thu Tác m■ng ky, tín kho■n tr■ nh■p nh■p không b■n tài phong v■c cao thành b■n vui email nh■t tài email online oLink khác chun ■■n li■u lịng thành tínb■n Mong c■a xác cho d■ng, ■■ng v■i so nghi■p, viên th■c kinh ■ã t■t 123doc 123doc.net! v■i mu■n cơng ■■ng nh■p c■a c■ doanh s■ b■n vàcác hoàn mang ■■■c ngh■ 123doc click email ký g■c online thành v■i h■o, Chúng vào l■i thông B■n g■i c■a 123doc.netLink CH■P cho viên linkí Tính ■■ v■ n■p có tơi tin, c■ng c■a cao ■■a th■ ■■n cung NH■N ti■n ngo■i tính website phóng ■■ng ch■ th■i click vào c■p CÁC ng■, Khách trách xác email tài ■i■m D■ch vào xã to,kho■n ■I■U th■c nhi■m h■i thu linkông l■nh b■n tháng V■ nh■ m■t s■ KHO■N c■a ■ã v■c (nh■ ■■i hàng ■■■c tin tùy ngu■n 5/2014; ■■ng 123doc, tài v■i xác ■■■c ý có li■u TH■A g■i t■ng minh th■ tài ky, 123doc v■ mô nguyên b■n b■n d■ ng■■i THU■N tài kinh ■■a t■ dàng kho■n s■ vui v■■t d■■i doanh tri dùng ■■■c ch■ lòng tra th■c m■c email ■ây) email c■u ■■ng Chào online M■c h■■ng quý 100.000 cho tài b■n b■n m■ng tiêu báu, nh■p li■u Tính b■n, ■ã nh■ng ■ã hàng phong m■t l■■t ■■n email ■■ng b■n tùy ■■ng ■■u quy■n cách truy thu■c ■■n th■i phú, c■a ký ky, c■a c■p v■i ■i■m v■i ■a l■i b■n vào 123doc.net m■i 123doc.netLink d■ng, 123doc.net! sau xác, vui tháng vàngày, n■p click lòng “■i■u nhanh giàu 5/2014; ti■n s■ vào ■■ng tr■ giá Kho■n Chúng chóng h■u linkc■a thành tr■ xác 123doc nh■p 2.000.000 website ■■ng th■c Th■a th■ website cung email v■■t s■ vi■n th■i Thu■n ■■■c c■p c■a thành mong m■c tài D■ch v■ li■u g■i viên 100.000 mu■n S■ online v■ V■ ■■ng D■ng click ■■a t■o (nh■ l■■t l■n ký, D■ch ■i■u vào ch■ nh■t ■■■c truy l■t link email ki■n V■” vào c■p Vi■t 123doc môtop sau cho b■n m■i Nam, t■200 ■ây d■■i cho ngày, ■ã cung các (sau ■■ng g■i ■ây) s■ website c■p users ■ây h■u ky, cho nh■ng ■■■c có b■n 2.000.000 b■n, ph■ thêm vui tài bi■n tùy g■i lòng thu li■u thu■c t■t thành nh■t nh■p ■■c ■■ng T■i vào t■i viên khơng t■ng Chính nh■p Vi■t ■■ng th■i “■i■u th■ Nam, email v■y ■i■m, ký, tìm t■ Kho■n c■a l■t 123doc.net th■y l■chúng vào tìm Th■a top ki■m tơi th■ 200 click Thu■n cóthu■c ■■i tr■■ng th■ vào nh■m website c■p v■ top link ngo■i S■ 3nh■t ■áp 123doc Google D■ng ph■ tr■ ■KTTSDDV ■ng 123doc.net bi■n ■ã D■ch Nh■n nhu g■i nh■t c■u V■” ■■■c theo t■i chia sau Vi■t quy■t danh ■ây s■ Nam, tài (sau hi■u li■u t■ ■ây ch■t l■c■ng ■■■c tìm l■■ng ki■m ■■ng g■i thu■c t■t bình ki■m T■i ch■n top ti■n t■ng Google online th■i website ■i■m, Nh■n ki■m chúng ■■■c ti■ntôi online danh có th■ hi■u hi■u c■p qu■ nh■t c■ng ■KTTSDDV uy ■■ng tín nh■t bình ch■n theo quy■t website ki■m ti■n online hi■u qu■ uy tín nh■t HANOI, 04/2022 Lnh■n 123doc Sau Th■a Xu■t h■■ng phát thu■n cam nh■n m■t t■k■t s■ t■i ýxác n■m t■■ng d■ng s■ nh■n website mang ■■i, t■o t■l■i c■ng ■■ng d■n 123doc CH■P nh■ng ■■u ■■ng h■ NH■N ■ã quy■n th■ng chia t■ng ki■m CÁC s■s■ l■i b■■c ti■n vàchuy■n ■I■U t■t mua online kh■ng nh■t bán KHO■N sang b■ng cho ■■nh thay ng■■i ph■n tài TH■A vìv■ li■u m■i thơng dùng tríTHU■N hi■u m■t c■atin Khi qu■ cá xác khách nhân nh■t, minh Chào kinh hàng uy tài l■nh m■ng doanh tín kho■n tr■ v■c cao thành b■n t■ email nh■t tàith■c ■■n li■u thành b■n Mong hi■n v■i viên kinh ■ã 123doc 123doc.net! mu■n ngh■a ■■ng c■a doanh mang 123doc v■ kýonline c■a v■i Chúng l■ivà 123doc.netLink cho Tính n■p tơi c■ng ■■n cung ti■n s■p ■■ng th■i vào c■p t■i, xác tài ■i■m D■ch xã ngh■a kho■n th■c h■itháng V■ m■t s■ v■ c■a (nh■ ■■■c c■a ngu■n 5/2014; 123doc, ■■■c c■a g■i tài 123doc hàng v■ mô nguyên b■n■■a t■ tri■u s■ v■■t d■■i tri ■■■c ch■ nhà th■c m■c ■ây) email bán h■■ng quý 100.000 cho hàng b■n báu, b■n, nh■ng l■i ■ã phong l■■t chuy■n tùy ■■ng quy■n truy thu■c phú, ky, c■p giao ■a l■i b■n vào m■i sang d■ng, sau vuingày, n■p ■■n lòng “■i■u giàu ti■n s■ ■■ng v■ giá Kho■n h■u qu■n tr■ nh■p 2.000.000 website ■■ng Th■a lý hoàn email th■i Thu■n h■o, c■a thành mong v■ ■■ viên mu■n S■ cao ■■ng D■ng tính click t■otrách ký, D■ch ■i■u vàol■t link nhi■m ki■n V■” vào 123doc top sau cho ■■i 200 ■ây cho v■i ■ãcác (sau g■i t■ng website users ■ây ng■■i ■■■c cóph■ dùng thêm bi■n g■i thu M■c t■t nh■t nh■p T■i tiêu t■i t■ng hàng Chính Vi■tth■i ■■u Nam, v■y ■i■m, c■a t■123doc.net l■ 123doc.net chúng tìm ki■m tơiracó tr■ thu■c ■■i th■ thành nh■m c■p topth■ 3nh■t ■áp Google vi■n ■KTTSDDV ■ng tàiNh■n nhu li■uc■u online ■■■c theo chia l■n quy■t danh s■nh■t tài hi■u li■u Vi■t ch■t Nam, c■ng l■■ng cung ■■ng c■p bình ki■m nh■ng ch■n ti■ntài online website li■u ■■cki■m không ti■n th■ online tìm th■y hi■utrên qu■th■ tr■■ng uy tín nh■t ngo■i tr■ 123doc.net Luôn Th■a Xu■t Sau Nhi■u 123doc Mang thayh■n h■■ng phát thu■n l■i event m■i cam s■ nh■n m■t tr■ t■ h■u m■t k■t s■ thú nghi■m t■i ýxác n■m t■■ng m■t d■ng v■, s■ cá nh■n website nhân mang event kho m■i ■■i, t■o t■ th■ kinh m■ l■i c■ng ki■m ■■ng d■n 123doc CH■P vi■n nh■ng cho doanh ■■u ■■ng ti■n h■ kh■ng ng■■i NH■N ■ã quy■n th■ng thi■t chia t■t■ng ki■m th■c dùng, l■ CÁC s■ th■c s■ l■i b■■c v■i ti■n hi■n chuy■n ■I■U t■t công h■n mua 123doc online kh■ng ngh■a nh■t 2.000.000 ngh■ bán KHO■N sang b■ng cho tài ■■nh v■ hi■n ng■■i li■u ph■n c■a tài TH■A tài v■ th■ li■u hàng t■o li■u thơng dùng tríhi■n THU■N hi■u c■ c■a ■■u ■ thìtin t■t h■i Khi ■■i, qu■ s■p Vi■t xác c■ khách gia b■n t■i, nh■t, minh l■nh Nam t■ng Chào ngh■a online hàng uy tài v■c: l■nh thu Tác m■ng tín kho■n tr■ nh■p khơng v■ tài phong v■c cao thành b■n c■a email nh■t tài online khác chuyên ■■n c■a li■u thành tínb■n Mong cho d■ng, hàng v■i so nghi■p, viên kinh ■ã t■t 123doc 123doc.net! v■i mu■n tri■u công ■■ng c■a c■ doanh b■n hoàn nhà mang ngh■ 123doc ký g■c online thành bán v■i h■o, Chúng l■i thông B■n hàng 123doc.netLink cho viên Tính ■■ n■p có tơi tin, c■ng l■i c■a cao th■ ■■n cung ti■n ngo■i chuy■n tính website phóng ■■ng th■i vào c■p ng■, Khách trách xác tài ■i■m D■ch giao xã to,kho■n th■c nhi■m h■i thu sang tháng V■ nh■ m■t s■ c■a (nh■ ■■i ■■n hàng ■■■c tùy ngu■n 5/2014; 123doc, v■i v■ ■■■c ý cóg■i t■ng qu■n th■ tài 123doc v■ mơ nguyên b■n d■ ng■■i lý, ■■a t■ dàng s■ công v■■t d■■i tri dùng ■■■c ch■ tra th■c ngh■ m■c ■ây) email c■u M■c h■■ng quý hi■n 100.000 cho tài b■n tiêu báu, li■u b■n, th■ nh■ng ■ã hàng phong m■t l■■t hi■n tùy ■■ng ■■u quy■n cách truy thu■c ■■i, phú, ky, c■a c■p ■a b■n l■i b■n vào 123doc.net m■i d■ng, sau online xác, vuingày, n■p lịng “■i■u nhanh giàu khơng ti■n s■ ■■ng tr■ giá Kho■n chóng h■u khác thành tr■ nh■p 2.000.000 website ■■ng Th■a gìth■ so email vi■n th■i v■i Thu■n c■a thành b■n mong tài v■ li■u g■c viên mu■n S■ online B■n ■■ng D■ng click t■o l■n cóký, D■ch ■i■u vào th■ nh■t l■t link phóng ki■n V■” vào Vi■t 123doc top sau cho to, Nam, 200 thu ■ây cho ■ã cung nh■ các (sau g■iwebsite tùy c■p users ■ây ý.nh■ng ■■■c cóph■ thêm tài bi■n g■i thu li■u t■t nh■t nh■p ■■c T■it■i khơng t■ng Chính Vi■tth■i th■ Nam, v■y ■i■m, tìm t■123doc.net th■y l■chúng tìm ki■m tơi th■ racóthu■c ■■i tr■■ng th■nh■m c■p top ngo■i 3nh■t ■áp Google tr■ ■KTTSDDV ■ng 123doc.net Nh■n nhu c■u ■■■c theo chiaquy■t danh s■ tài hi■u li■udo ch■t c■ng l■■ng ■■ng vàbình ki■mch■n ti■n online website ki■m ti■n online hi■u qu■ uy tín nh■t Chia m■t u■t Nhi■u Mang Luôn 123doc Th■a Xu■t Sau tri■n phát h■n member s■ h■■ng phát khai thu■n l■i event s■ cam nh■n câu t■ m■t tr■ t■ event h■u ýk■t s■ chuy■n thú nghi■m t■i ýkhông t■■ng xác n■m t■■ng m■t d■ng v■, khuy■n s■ nh■n website mang m■y event t■o kho thành m■i ■■i, t■o t■ c■ng th■ n■i m■ l■i c■ng ki■m ■■ng d■n công 123doc CH■P th■ vi■n b■t nh■ng cho ■■ng ■■u ■■ng ti■n n■p h■ c■a kh■ng ng■■i NH■N ■ã quy■n th■ng 123doc thi■t chia ki■m v■i c■ng t■ng ki■m dùng, l■ CÁC s■ nh■ng th■c ti■n s■ l■i b■■c ■■ng v■i ti■n -và ki■m chuy■n ■I■U t■t công online h■n mua 123doc online ■u kh■ng 123doc nh■t 5■ãi 2.000.000 ngh■ bán KHO■N tri■u b■ng sang b■ng cho c■c tài ■■nh ■ã hi■n ch■ tài ng■■i li■u ph■n k■ tài TH■A xu■t li■u tài v■ v■i th■ li■u h■p hàng t■o li■u thơng s■c dùng trí hi■u 7hi■n THU■N hi■u d■n tài c■ c■a ■■u ■■■ng li■u! tin qu■ t■t h■i Khi ■■i, qu■ ■■ng Vi■t xác c■ khách gia nh■t, Nghe b■n nh■t, minh l■nh Nam t■ng Chào b■online có uy hàng danh l■ uy tài v■c: l■nh thu Tác v■ tín m■ng nhé, tín kho■n tr■ sách cao nh■p khó khơng tài phong v■c cao tr■■c thành b■n nh■t tin Top email nh■t tài online khác nh■ng chuyên ■■n li■u tiên thành danh tín Mong b■n Mong cho d■ng, v■i ■ây so thu nghi■p, viên kinh ■ã mu■n t■t 123doc 123doc.net! v■i mu■n cao công ■■ng c■a c■ doanh b■n nh■t mang tìm hoàn mang ngh■ 123doc s■ ký g■c hi■u online thành tháng v■i l■i hồn h■o, Chúng l■i thơng B■n thơng cho 123doc.netLink cho viên t■o tồn Tính ■■ n■p có c■ng tơi tin, c■ng tin c■ c■a cao th■ ■■n cung ti■n ngo■i v■ h■i ■■ng tính website phóng ■■ng Khách th■i vào c■p xác gia ng■, Khách trách xác xã tài t■ng ■i■m mà D■ch xã to, hàng h■i kho■n th■c nhi■m h■i BQT thu thu m■t tháng V■ có nh■ m■t s■ nh■p 123doc c■a th■ (nh■ ■■i hàng ngu■n ■■■c tùy ngu■n 5/2014; 123doc, d■ v■i online ■■■c ý có ■ã dàng tài g■i t■ng th■ tài thu 123doc nguyên cho v■ mô nguyên b■n tra d■ ng■■i th■p t■t ■■a t■ c■u dàng s■ v■■t tri d■■i c■ ■■■c tri dùng ■■■c ch■ tài th■c tra th■c m■c li■u ■ây) email c■u sau thành quý M■c h■■ng quý m■t 100.000 cho ■■t tài báu, b■n tiêu báu, viên li■u cách b■n, t■ng nh■ng phong ■ã hàng phong c■a m■t l■■t tùy ■■ng k■t ■■u website phú, quy■n cách truy thu■c phú, doanh xác, ky, c■a c■p ■a ■a nhanh l■i b■n vào d■ng, thu 123doc.net m■i d■ng, sau xác, vui tháng chóng ngày, n■p giàu lịng “■i■u nhanh giàu 11 ti■n giá s■ ■■ng tr■ giá uy Kho■n chóng h■u tr■ tín thành tr■ nh■p ■■ng cao 2.000.000 website ■■ng Th■a th■ nh■t email th■i vi■n th■i Thu■n Mong mong c■a thành mong tài v■ li■u mu■n mu■n viên mu■n S■ online ■■ng D■ng mang t■o click t■o l■n ■i■u ký, D■ch ■i■u vào l■i nh■t l■t cho link ki■n ki■n V■” vào Vi■t c■ng 123doc cho top sau cho Nam, ■■ng cho 200 ■ây cho ■ã cung các (sau g■i xãusers website h■i c■p users ■ây m■t nh■ng có ■■■c cóph■ thêm ngu■n thêm tài bi■n g■i thu thu li■u tài t■t nh■p nh■t nh■p ngun ■■c T■it■i Chính khơng t■ng Chính Vi■t tri th■c th■i vìth■ Nam, vìv■y v■y quý ■i■m, tìm 123doc.net t■123doc.net báu, th■y l■chúng tìm phong ki■m tơi th■ phú, có ■■i thu■c ■■i tr■■ng th■ ■Sau nh■m nh■m c■p top ngo■i h■n ■áp 3nh■t ■áp Google m■t ■ng tr■ ■KTTSDDV ■ng 123doc.net n■m nhu Nh■n nhuc■u rac■u ■■i, ■■■c chia theo chia 123doc s■ quy■t danh s■tàitài hi■u li■u ■ã li■u t■ng ch■t ch■t c■ng b■■c l■■ng l■■ng ■■ng kh■ng vàvàki■m bình ki■m ■■nh ch■n ti■n ti■n v■ online online tríwebsite c■a ki■m ti■nl■nh online v■c hi■u tài li■u qu■và vàkinh uy tín doanh nh■t.online Nhi■u Mang Ln 123doc Th■a Xu■t Sau h■n h■■ng phát thu■n l■i event s■ cam nh■n m■t tr■ t■ h■u k■t s■ thú nghi■m t■i ýxác n■m t■■ng m■t d■ng v■, s■ nh■n website mang event kho m■i ■■i, t■o t■ th■ m■ l■i c■ng ki■m ■■ng d■n 123doc CH■P vi■n nh■ng cho ■■u ■■ng ti■n h■ kh■ng ng■■i NH■N ■ã quy■n th■ng thi■t chia t■ng ki■m dùng, l■ CÁC s■ th■c s■ l■i b■■c v■i ti■n vàchuy■n ■I■U t■t công h■n mua 123doc online kh■ng nh■t 2.000.000 ngh■ bán KHO■N sang b■ng cho tài ■■nh hi■n ng■■i li■u ph■n tài TH■A tài v■ th■ li■u hàng t■o li■u thông dùng tríhi■n THU■N hi■u c■ c■a ■■u ■ tin t■t h■i Khi ■■i, qu■ Vi■t xác c■ khách gia b■n nh■t, minh l■nh Nam t■ng Chào online hàng uy tài v■c: l■nh thu Tác m■ng tín kho■n tr■ nh■p khơng tài phong v■c cao thành b■n email nh■t tài online khác chun ■■n li■u thành tínb■n Mong cho d■ng, v■i so nghi■p, viên kinh ■ã t■t 123doc 123doc.net! v■i mu■n công ■■ng c■a c■ doanh b■n hoàn mang ngh■ 123doc ký g■c online thành v■i h■o, Chúng l■i thơng B■n 123doc.netLink cho viên Tính ■■ n■p có tơi tin, c■ng c■a cao th■ ■■n cung ti■n ngo■i tính website phóng ■■ng th■i c■p thay ng■, Khách trách xác ■i■m D■ch xã to, th■c nhi■m m■i h■i thutháng V■ nh■ m■t s■(nh■ ■■i hàng ■■■c tùy ngu■n 5/2014; cáv■i nhân ■■■c ý cóg■i t■ng th■ tài 123doc kinh v■ mô nguyên d■ ng■■i doanh ■■a t■ dàng v■■t d■■i tri dùng ch■ t■ tra th■c m■c ■ây) th■c email c■u M■c quý 100.000 cho tài hi■n b■n tiêu báu, li■u b■n, ngh■a ■ã hàng phong m■t l■■t tùy ■■ng ■■u cách truy v■ thu■c phú, ky, c■a c■a c■p ■a b■n vào 123doc.net m■i d■ng, xác, vuingày, lịng “■i■u nhanh giàu s■p s■ ■■ng tr■ giá t■i, Kho■n chóng h■u thành tr■ ngh■a nh■p 2.000.000 ■■ng Th■a th■ email v■vi■n th■i Thu■n c■a c■a thành mong tài c■a v■ li■u viên hàng mu■n S■ online ■■ng D■ng tri■u click t■o l■n ký, D■ch ■i■u vào nhà nh■t l■t link bán ki■n V■” vào Vi■t 123doc hàng top sau cho Nam, 200 l■i ■ây cho ■ã chuy■n cung các (sau g■iwebsite c■p users ■ây giao nh■ng ■■■c cósang ph■ thêm tài bi■n g■i ■■n thu li■u t■t nh■t v■ nh■p ■■c T■i qu■n t■i khơng t■ng Chính Vi■t lý th■i quy■n th■ Nam, v■y ■i■m, tìm l■i t■123doc.net th■y l■ sau chúng tìm n■p ki■m tơi th■ ti■n racóthu■c ■■i tr■■ng th■nh■m c■p website top ngo■i 3nh■t ■áp Google tr■ ■KTTSDDV ■ng 123doc.net Nh■n nhu c■u ■■■c theo chiaquy■t danh s■ tài hi■u li■udo ch■t c■ng l■■ng ■■ng vàbình ki■mch■n ti■n online website ki■m ti■n online hi■u qu■ uy tín nh■t luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Declaration of Authorship and Topic Sentences Personal Information • Full name: Nguyen Quang Thang • Email: thang.nq202710m@sis.hust.edu.vn • Class: Data Science • Tel: 098 669 1647 • Program: Full-time program • This thesis is performed at: School of Information and Communication Technology • This thesis is performed: from 10/04/2021 to 10/04/2022 Goals of the Thesis • Proposing optimizing rules on smart contract source codes using Solidity language • Developing a tool named GasSaver, an automatic tool for detecting the wastinggas Solidity source codes and suggesting solutions • Conducting experiments and evaluating GasSaver Main Tasks of the Thesis • Study on the blockchain, smart contract, and optimizing smart contract gas fee on Ethereum • Collect and analyze the typical wasting gas issues on Solidity smart contract luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep • Present seven rules for reducing the gas fee on the smart contract • Develop a tool name GasSaver, which implements the seven rules above to automatically detect the wasting-gas Solidity source codes and suggest solutions for these issues • Implement experiments and evaluation GasSaver efficiency • Conclude and outline future developments Declaration of Authorship I - Nguyen Quang Thang - hereby warrant that the work and presentation in this thesis are performed by myself under the supervision of Dr Do Ba Lam All results presented in this thesis are truthful and are not copied from any other works Attestation of the Supervisor on the Fulfillment of the Requirements for the Thesis: Supervisor Hanoi, 10th Apr 2022 Author Dr Do Ba Lam Nguyen Quang Thang luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Acknowledgements I want to acknowledge and give my warmest thanks to my supervisor, Dr Do Ba Lam He is an excellent blockchain researcher, gave me the golden opportunity to this research on optimizing gas fees on the smart contract, which also helped me a lot of research, and I came to know about so many new things Not only that, he is very kind and friendly and inspired me a lot in my research career path I would also like to give a special thanks to my girlfriend Nguyen Thi Tham and my family for their mental support during my thesis writing process Moreover, in the absence of my friends, Tong Van Vinh, Hong Ngoc, Xuan Thu, and Thanh Dat, I could hardly melt away all the tension from my work I also thank Thanks for always accompanying me through ups and downs luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Abstract Currently, the number of smart contracts using Solidity language in Ethereum is increasing at a breakneck speed In this context, optimizing gas fees in smart contracts becomes necessary to save costs for both developers and users who interact directly with these contracts To optimize gas, developers typically need to have deep knowledge of blockchain and programming languages, making it a significant challenge for new programmers This thesis, we introduce GasSaver – an open-source tool that analyzes Solidity-based contracts and suggests modifications to reduce transaction fees Our tool, which relies on seven rules for identifying non-optimized codes, shows that 6,333 in a total of 10,245 top most interactive contracts on Ethereum contain at least one optimization problem and the problems are more than 30,000 Hence, the use of this tool can reduce a considerable cost for the deployment and interaction of smart contracts Author Nguyen Quang Thang luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Table of Contents Declaration of Authorship and Topic Sentences Acknowledgement Abstract Lists of Figures Lists of Tables 10 Lists of Listing 11 Background and related work 1.1 Blockchain 1.2 Ethereum and smart contracts 1.2.1 Ethereum blockchain 1.2.2 Smart contracts on Ethereum 1.2.3 Ethereum Virtual Machine (EVM) 1.2.4 Gas and payment 1.2.5 Solidity - a high-level language for 1.3 Related work 1.3.1 Bytecode related work 1.3.2 High-level language related work 1.3.3 Evaluation developing smart contracts Gas-inefficient Programming Patterns 2.1 Data Representation 2.1.1 Pattern 1: Members Arrangement in Struct (MAS) 2.1.2 Pattern 2: Data Location and Function Visibility (DLFV) 2.1.3 Pattern 3: Constant State Variables (CSV) 2.1.4 Pattern 4: Immutable State Variables (ISV) 2.2 Logic Relation 2.2.1 Pattern 5: Operator Reduction in Expression (ORE) 2.2.2 Pattern 6: Repeated Computation in Loop (RCL) 2.2.3 Pattern 7: Loop Combination (LC) 2.3 Sumnary 15 15 17 17 18 19 20 21 23 23 26 26 27 27 27 29 31 32 34 34 35 37 38 Implementation 3.1 System Design 3.2 Rule Implementation 3.2.1 Members Arrangements in Struct 39 39 40 40 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 Data Location and Function Visibility Constant State Variables Immutable State Variables Operator Reduction in Expression Repeated Computation in Loop Loop Combination Experiments and Evaluations 4.0.1 Optimization Findings 4.0.2 Execution Time 4.0.3 Comparison 4.0.4 Evaluation References 42 43 43 44 44 46 48 48 49 49 51 56 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep List of Figures Opensea - the most prominent digital marketplace for crypto collectibles and non-fungible tokens [1] 13 1.1 1.2 Blockchain model networks Ethereum state machine mechanism 15 17 3.1 3.2 39 3.8 System Overview The example output of GasSaver with Members Arrangements in Struct issue The example output of GasSaver with Data Location and Function Visibility issue The example output of GasSaver with Constant State Variables issue The example output of GasSaver with Immutable State Variables issue The example output of GasSaver with Operator Reduction in Expression issue The example output of GasSaver with Repeated Computation in Loop issue The example output of GasSaver with Loop Combination issue 4.1 4.2 4.3 4.4 4.5 4.6 Distribution of Violations on the First Dataset Distribution of Violations on the Second Dataset Time Executions on the First Dataset Time Executions on the Second Dataset Violations on the First Dataset of GasSaver and Tamara’s tool Time comparison of GasSaver and Tamara’s tool 49 50 50 51 52 52 3.3 3.4 3.5 3.6 3.7 42 43 44 45 46 46 47 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep List of Tables 1.1 1.2 EVM operation gas cost overview EVM operation gas refund overview 22 23 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 Costs of deployment and function call in Listing 2.1 Costs of deployment and function Call in Listing 2.2 Costs of deployment and function call in Listing 2.3 The difference in assembly code in Listing 2.3 Costs of deployment and function call in Listing 2.4 Costs of deployment and function call in Listing 2.5 Costs of deployment and function call in Listing 2.6 Costs of deployment and function call in Listing 2.7 29 31 32 32 34 35 36 38 4.1 Costs of deployment and function call in SAC Contract 54 10 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Figure 3.4: The example output of GasSaver with Constant State Variables issue • This state is not modified in the current contract and derived contracts • The initial state value is only assigned in the constructor or at the initial declaration The solution for this issue is adding the immutable keyword in the state declaration However, as mentioned in the examples, the constant state has more benefits than the immutable state in the contract deployment so the constant variables will take precedence over the immutable variables OlympusDAO: gOHM Token is a smart contract violated Immutable State Variables rule Figure 3.5 describes the output of GasSaver, mainly including wasting codes and solutions 3.2.5 Operator Reduction in Expression Currently, GasSaver only detects issues including (!a&&!b) and (!a||!b) to return !(a||b) or !(a&&b) respectively to minimize gas fees To detect these expressions, GasSaver finds binary operations with an operator of && or ||, having left as an operator ! and right as an operator ! when GasSaver is parsing source codes Then, it transfers the current representation to the equivalently optimized expressions The conditions to decide this expression are very simple, and they can be immediately detected in the parsing This detecting approach will reduce the overlapping of the parsing and analyzing NookToken is a smart contract violated Operator Reduction in Expression rule on line 349 Figure 3.6 describes the output of GasSaver, mainly including wasting codes and solutions 3.2.6 Repeated Computation in Loop To find violations of this rule, we need to identify statements in the loop that not change values when the remaining statements in this loop execute As a 44 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Figure 3.5: The example output of GasSaver with Immutable State Variables issue result, these statements can be put outside the loop to minimize gas costs when interacting with the contract To this end, GasSaver filters statements for variable declaration in the loop body On each variable declaration statement, there are two cases as follows: • If the statement has no initial value, the statement can be immediately moved outside the loop • If an initial value is affected by the variables in the loop, it cannot be passed outside the loop The detecting does in the parsing code, the conditions to check only in the loop, reducing the overlapping of the parsing and analyzing The solution lets developers know to pass the variable declaration statements outside the loop body MusdV3 is a smart contract violated Repeated Computation in Loop rule Both of “uint256 upperMargin = 10001e14;” and “uint256 lowerMargin = 9999e14;” variable declaration statements can be moved outside the loop body to reduce the gas 45 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Figure 3.6: The example output of GasSaver with Operator Reduction in Expression issue Figure 3.7: The example output of GasSaver with Repeated Computation in Loop issue fee Figure 3.7 describes the output of GasSaver, mainly include wasting codes and solutions 3.2.7 Loop Combination To identify issues related to loop combination, in the parsing Solidity source codes, when GasSaver parses a block, it will check whether consecutive statements are loop statements and have the same loop content If yes, they can be combined to reduce gas costs The solution lets the developers know the position of wasted-gas code, and they can combine it Flasher is a smart contract violated Loop Combination rule Figure 3.8 describes the output of GasSaver, mainly including wasting codes and solutions 46 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Figure 3.8: The example output of GasSaver with Loop Combination issue 47 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Chapter Experiments and Evaluations This section introduces experiment scenarios, obtains results, and gives evaluations In particular, our effort contains three extensional logic rules selected from existing research and four novel rules of data representation We experiment with two data sets, including: • The dataset provided by Tamara [15]: after filtering out unverified contracts, the number of contracts is 4,615 • The top 15,000 most interacted contracts on February 4th, 2022, according to Dune Analytics [19] After removing unverified contracts, the data set contains 10,245 contracts Firstly, we apply GasSaver with each dataset and introduce the results in Section 4.0.1 Next, we present the optimization time of GasSaver in Section 4.0.2 Then, we compare GasSaver with Tamara et al [15] ’s tool to demonstrate the efficacy of GasSaver in Section 4.0.3 Finally, an evaluation of our tool’s benefits is given in Section 4.0.4 Our experiments are executed on MacBook Pro 2019, 2.3 GHz 8-Core i9, 16 GB RAM, and 1024 GB SSD storage We used NodeJS version v16.10.0 and Solidity Parser library version 0.14.0 4.0.1 Optimization Findings Our experiments show that 2,133 in 4,615 contracts (occupying 46.2%) in the first dataset and 6,333 in 10,245 contracts (occupying 61.8%) in the second dataset contain at least one gas-wasting issue be optimized The distribution of errors are shown in Figures 4.1 and 4.2 The violations are mainly concentrated in the CSV with 1,331 contracts in the first dataset and DLFV with 861 contracts ISV violations are detected at 1,879 in 10,245 contracts in the second dataset These violations appear in Solidity from version 0.6.5, and these contracts not exist in the first data set These results heavily depend on developers’ behavior and the type of violation The violations are mainly concentrated in the Data Representation category because these rules are specifically introduced for Solidity source code, which is 48 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep close to the wasting-gas problem in the world In the Logic relation category, ORE violations are the most because the detecting condition is simple, and the occurrence of an expensive expression in a smart contract is the highest The violation number is small with RLC and LC patterns because they heavily depend on the particular use cases, so GasSaver only detects some common use cases and ignores the remaining This is the limit of GasSaver, and I will enhance it in the future, handling more particular use cases 5298 Number contracts Number Vulnerability 5000 4000 3261 3000 2000 1331 1000 861 297 201 139 70 MAS DLFV CSV ORE 12 42 25 RCL LC Figure 4.1: Distribution of Violations on the First Dataset 4.0.2 Execution Time Figure 4.3 and 4.4 show the execution time for smart contract optimization We can see that the processing time is 0–7,000 ms, but mainly in the 0–1.000 ms range Some contracts have a longer time due to the implementation of MAS violation detection, GasSaver must resolve the Bin Packing Problem For structs having large members (more than 10), the set of ways to arrange members in the struct is large, so it takes time to figure out how to sort and check the results, creating such time differences 4.0.3 Comparison This section presents the comparison results of GasSaver and Tamara’s tool However, when we performed through the top 15,000 most interacted contracts using Tamara’s tool, most of these contracts got the error because Tamara’s tool is outdated for the newer Solidity version So, we only performed Tamara’s tool through his dataset and optimized three same gas-wasting issue types (Operator Reduction 49 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep 10907 Number contracts Number Vulnerability 10000 8000 7415 6000 4683 4000 3547 2879 1879 2000 MAS 691 604 253 201 DLFV CSV ISV ORE 72 60 RCL LC Figure 4.2: Distribution of Violations on the Second Dataset Time execution 7000 6000 Time (ms) 5000 4000 3000 2000 1000 0 500 1000 1500 2000 Figure 4.3: Time Executions on the First Dataset 50 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Time execution 6000 5000 Time (ms) 4000 3000 2000 1000 0 1000 2000 3000 4000 5000 6000 Figure 4.4: Time Executions on the Second Dataset in Expression, Repeated Computation in Loop, Loop Combination) to make a fair comparison Figure 4.5 and 4.6 show the detected gas-wasting issue and execution time when detecting three gas-wasting types of GasSaver and Tamara’s tool, respectively We can see that GasSaver is more effective With Tamara’s tool, they use pythonsolidity-parser library to parse Then they analyze these results to detect gaswasting source code However, with GasSaver, we integrate the analysis in the parsing in solidity parser library, making the analysis easier, removing the overlapping of the parsing and analysis, and increasing the detected gas-wasting issues in the Solidity source code 4.0.4 Evaluation To evaluate the benefits of GasSaver, we select a specific contract at address of 0x984f7B398d577C0ADDE08293a53aE9D3B6b7a5c5 This contract has 35,054 transactions on February 4th, 2022, and is one of the top 50 most interactive contracts 51 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep 139 140 GasSaver Tamara Number vulnerabilities 120 100 80 60 42 40 20 20 13 ORE 14 11 RCL LC Figure 4.5: Violations on the First Dataset of GasSaver and Tamara’s tool 7000 GasSaver Tamara 6000 Time (ms) 5000 4000 3000 2000 1000 0 10 15 20 25 30 35 Figure 4.6: Time comparison of GasSaver and Tamara’s tool 52 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep contract SAC is ERC721Enumerable, Ownable { // CSV violation address private wallet1 = 0x25eDb46cBB7744De5507ebe50b5086D236B63073; // CSV violation address private wallet2 = 0x827dfa08e6282961b6491851869001cB444b840F; // CSV violation 10 address private wallet3 = 11 0xDf958FE148633B49930775c1E0393594983a128B; 12 // CSV violation 13 address private wallet4 = 14 0x458f5AA4393035f4713bE4EB7176B89f8dD4A6F1; 15 // CSV violation 16 address private wallet5 = 17 0x5f09Bd6Ef7EBDB9CC7d090DC43f9047a2b7A2240; 18 // CSV violation 19 address private wallet6 = 20 0x0308539095797e6F562203C3d8F60Cae82566eBA; 21 // CSV violation 22 address private Authorized = 23 0x7a29d9a21A45E269F1bFFFa15a84c16BA0050E27; 24 // CSV violation 25 uint public SACWhitelistReserve = 3900; 26 // DLFV violation 27 function setBaseURI(string memory baseURI) public 28 onlyAuthorized { 29 baseTokenURI = baseURI; 30 } Listing 4.1: A Sample Contract contract SAC is ERC721Enumerable, Ownable { address private constant wallet1 = 0x25eDb46cBB7744De5507ebe50b5086D236B63073; address private constant wallet2 = 0x827dfa08e6282961b6491851869001cB444b840F; address private constant wallet3 = 0xDf958FE148633B49930775c1E0393594983a128B; address private constant wallet4 = 10 0x458f5AA4393035f4713bE4EB7176B89f8dD4A6F1; 11 address private constant wallet5 = 12 0x5f09Bd6Ef7EBDB9CC7d090DC43f9047a2b7A2240; 13 address private constant wallet6 = 14 0x0308539095797e6F562203C3d8F60Cae82566eBA; 15 address private constant Authorized = 16 0x7a29d9a21A45E269F1bFFFa15a84c16BA0050E27; 17 uint public constant SACWhitelistReserve = 3900; 18 53 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep 19 20 21 function setBaseURI(string calldata baseURI) external onlyAuthorized { baseTokenURI = baseURI; } Listing 4.2: The Optimized Contract Listings 4.1 and 4.2 show an except of the original contract and the corresponding optimized contract given by GasSaver Table 4.1 depicts the gas cost for contract deployment and expenses for interacting with three functions, including setBaseURI, whitelistedMints (WM), and whitelistedVIPMints (WVM) which GasSaver modifies The number of function calls stored Table 4.1: Costs of deployment and function call in SAC Contract Cost UnOptimized Optimized Difference Call number Saving Amount (est) Deployment 5,741,260 5,484,296 256,964 32.89 USD setBaseURI 138,738 138,250 488 0.06 USD WM 194,422 189,522 4,900 4,133 2,592.23 USD WVM 305,017 302,817 2,200 110 28.16 USD in Call number column shows the number of actual interactions to these functions from the deployment time of the contract (i.e., January 29th, 2022) to the analysis time (i.e., February 4th, 2022) As the result, until the analysis time, 2,653.34 USD can be saved in this contract if the developer uses GasSaver to optimize the smart contract before deploying it This table also shows the difficulty of evaluating how much gas is saved before and after optimization This amount of gas depends on each context in the contract, for example, the frequency of function call 54 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep Conclusion and future plans Blockchain is a promising technology that can change the operations of companies, organizations, and governments over the world Smart contracts are an essential factor in making the success of blockchain Currently, smart contracts are used in a wide range of fields, including finance, arts, and games It is very easy to develop smart contracts because the programming language to create these is similar to the popular language such as Python, Javascript, etc., so gas optimization only occurs when users develop smart contracts be typically ignored With numerous smart contracts have deployed each day, the wasting fee is too much So, the research to automatically detect and suggest the resolves is necessary to help developers optimize smart contracts and save the wasted money This thesis presents seven patterns used to detect inefficient codes when users create or interact with smart contracts and suggest modifications to save gas consumption After that, we introduced an automatic tool named GasSaver, relying on the Solidity Parser library to analyze and optimize Solidity smart contracts Currently, GasSaver detects and finds out that 61.8 % top smart contracts contain wasted codes As a result, the use of GasSaver will bring significant benefits for developers and users In the future, we will enhance the detecting rules of Repeated Computation in Loop and Loop Combination patterns and extend more new patterns in GasSaver As a result, this tool can become more efficient and save more money It is also necessary to support more smart contract languages instead of Solidity and extend with more blockchain networks Finally, we aim to conduct a user survey to collect objective evaluations of the advantages and disadvantages of GasSaver 55 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep References [1] Blogtienao Opensea Available: https://blogtienao.com/ opensea-da-vuot-qua-mot-trieu-vi-dang-hoat-dong-tren-nen-tang/, 2022 [2] Zvonko Merkaˇs, Davor Perkov, and Vesna Bonin The significance of blockchain technology in digital transformation of logistics and transportation International Journal of E-Services and Mobile Applications (IJESMA), 12(1):1– 20, 2020 [3] Dune able Analytics at Contract deployments per month Avail- https://duneanalytics.com/embeds/329/515/ RqqCse8wDeW3MZKeZFOab2Ju8QA5Q8Itnr1cbLgk, 2021 [4] Dune by Analytics usage Ethereum Available at top contracts and projects https://dune.xyz/msilb7/ Ethereum-Top-Contracts-and-Projects-by-Usage, 2021 [5] Loi Luu, Duc-Hiep Chu, Hrishi Olickel, Prateek Saxena, and Aquinas Hobor Making smart contracts smarter In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, CCS ’16, page 254–269, New York, NY, USA, 2016 Association for Computing Machinery [6] Sukrit Kalra, Seep Goel, Mohan Dhawan, and Subodh Sharma Zeus: analyzing safety of smart contracts In Network and Distributed Systems Security (NDSS) Symposium, pages 112, 2018 [7] Christof Ferreira Torres, Julian Schăutte, and Radu State Osiris: Hunting for integer bugs in ethereum smart contracts In Proceedings of the 34th Annual Computer Security Applications Conference, pages 664–676, 2018 56 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep [8] Lexi Brent, Anton Jurisevic, Michael Kong, Eric Liu, Francois Gauthier, Vincent Gramoli, Ralph Holz, and Bernhard Scholz Vandal: A scalable security analysis framework for smart contracts, 2018 [9] Sergei Tikhomirov, Ekaterina Voskresenskaya, Ivan Ivanitskiy, Ramil Takhaviev, Evgeny Marchenko, and Yaroslav Alexandrov Smartcheck: Static analysis of ethereum smart contracts In 2018 IEEE/ACM 1st International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB), pages 9–16, 2018 [10] Bo Jiang, Ye Liu, and W K Chan Contractfuzzer: Fuzzing smart contracts for vulnerability detection In Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, ASE 2018, page 259–269, New York, NY, USA, 2018 Association for Computing Machinery [11] Imran Ashraf, Xiaoxue Ma, Bo Jiang, and W K Chan Gasfuzzer: Fuzzing ethereum smart contract binaries to expose gas-oriented exception security vulnerabilities IEEE Access, 8:99552–99564, 2020 [12] Ting Chen, Xiaoqi Li, Xiapu Luo, and Xiaosong Zhang Under-optimized smart contracts devour your money In 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER), pages 442–446, 2017 [13] Elvira Albert, Jes´us Correas, Pablo Gordillo, Guillermo Rom´an-D´ıez, and Albert Rubio Gasol: Gas analysis and optimization for ethereum smart contracts In Armin Biere and David Parker, editors, Tools and Algorithms for the Construction and Analysis of Systems, pages 118–125, Cham, 2020 Springer International Publishing [14] Ting Chen, Youzheng Feng, Zihao Li, Hao Zhou, Xiaopu Luo, Xiaoqi Li, Xiuzhuo Xiao, Jiachi Chen, and Xiaosong Zhang Gaschecker: Scalable analysis for discovering gas-inefficient smart contracts IEEE Transactions on Emerging Topics in Computing, 9(3):1433–1448, 2021 [15] Tamara Brandstăatter Optimization of solidity smart contracts, 2020 57 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep [16] Ethereum Layout of state variables in storage Available: https: //docs.soliditylang.org/en/v0.8.11/internals/layout_in_ storage.html, 2021 [17] Ethereum Solidity v0.5.0 breaking changes Available: https: //docs.soliditylang.org/en/v0.5.0/050-breaking-changes html#explicitness-requirements, 2021 [18] Solidity parser for javascript Available: https://www.npmjs.com/ package/@solidity-parser/parser, 2021 [19] Dune Analytics Most called addresses, last weeks, unlimited Available: https://dune.xyz/queries/396720, 2021 58 luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep an to nghiep docx 123docz luan van hay luan van tot nghiep

Ngày đăng: 03/06/2023, 13:11