Skip to content

xiangxingxing/aelf-contract-decompiler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aelf-contract-decompiler

Introduction

This tool is a C-Sharp decompiler for Smart Contracts of AElf. It is based on the open-source ILSpy and only works properly on windows platform when compiling contracts in AElf.

Getting Started

The project uses Asp.Net Core Mvc template to serve. Default endpoint has been set to 5566 and you can run the AElfContractDecompiler listening on the specified endpoint.

private static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureLogging(builder =>
	{
		builder.ClearProviders();
		builder.AddConsole();
		builder.SetMinimumLevel(LogLevel.Trace);
	})
	.ConfigureWebHostDefaults(webBuilder =>
	{
		webBuilder.UseStartup<Startup>();
		webBuilder.UseUrls("http://*:5566");
  })
	.UseAutofac();

Then you can send a post request like http://*:5566/getfiles with necessary data in body. The value of Base64String is the base64String converted by a contract dll.

{
 "Base64String":"TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAA...."
}

Interface

Main interfaces of this decompiler are shown below.

IContractDecompileService

It is used to call decompling service of ILSpy.

Task ExecuteDecompileAsync(string[] args);

IFileParserService

It is used to show the hierarchical structure of the decompiled contract.

Task<ResponseTemplate> GetResponseTemplateByPath(string dictPath);

About

AElf contract decompiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 86.1%
  • HTML 9.8%
  • CSS 3.5%
  • JavaScript 0.6%