Skip to main content

A small example package

Project description

Aptos Verify

Aptos Verify is a Python library for verifying a module on Aptos Blockchain

Installation

Before install package, you need to setup Rust, Cargo and Aptos Cli

install Rust and Cargo: https://learning-rust.github.io/docs/installation/

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

install Aptos Cli: https://aptos.dev/tools/aptos-cli/install-cli/

curl -fsSL "https://aptos.dev/scripts/install_cli.py" | python3

Use the package manager pip to install aptos_verify.

pip install aptos-verify

Run with docker by load image from folder docker

Option 1 Build docker: 
docker build -t aptos-verify-dk . 

Option 2 Load docker by image: 
docker load -i aptos-verify-dk.tar   

Start container: 
docker run -d -p 9998:9998 aptos-verify-dk

Usage

Use with CLI

Verify with source code that's published onchain
aptos-verify -m 0x8d2d7bcde13b2513617df3f98cdd5d0e4b9f714c6308b9204fe18ad900d92609::admin

Verify with source code on github
aptos-verify -m 0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12::liquidity_pool -vm github -git https://github.com/pontem-network/liquidswap

Verify with local path (source code path)
aptos-verify -m 0x190d44266241744264b964a37b8f09863167a12d3e70cda39376cfb4e3561e12::liquidity_pool -vm local -path /<local_path>

Result:
**************** Rule: Compare bytecode between published bytecode and published source code onchain *****************
                    Result: True
                    Error Code: 0
                    Message: Verify success
                    Exception Class: 

Use with sdk

from aptos_verify.main import start_verify
from aptos_verify.schemas import VerifyParams
import asyncio
async def main():
    print('Start verify module: 0x8d2d7bcde13b2513617df3f98cdd5d0e4b9f714c6308b9204fe18ad900d92609::admin')
    rs = await start_verify(
        VerifyArgs(
            module_id='0x8d2d7bcde13b2513617df3f98cdd5d0e4b9f714c6308b9204fe18ad900d92609::admin',
        )
    )
    print('Result:')
    print(rs)
if __name__ == "__main__":
    asyncio.run(main())

Use with docker and API

http://localhost:9998/verify/<module_address>

Example: 
http://localhost:9998/verify/0x8d2d7bcde13b2513617df3f98cdd5d0e4b9f714c6308b9204fe18ad900d92609::admin

Result:
{"message":"success","data":[{"title":"Compare bytecode between published bytecode and published source code onchain","message":"Verify success","is_skip":false,"error_code":0,"exeption_name":"","result":true,"traceback":"","error_message":""}]}

Run tests

pytest -s

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Error Code

List error codes that returned from tool

Error Code Message
0 No Errors
1 Package Not Found
2 Module Not Found
3 Module Has No Source Code
4 Validation Error

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

aptos_verify-1.0.4-1-py3-none-any.whl (18.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page