Sourcify ?‍??? – 变酸?‍???区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,Sourcify ?‍??? – 变酸?‍???区块链毕设代写 是一篇很好的国外资料

Sourcify ?‍???

Sourcify wants to help make contract interactions on the blockchain safer and more transparent for users.

To achieve this goal, Sourcify supports several efforts to foster adoption of open-source source file verification, metadata files and NatSpec comments.

ℹ️ This repository only contains the main components, the Sourcify monorepo with main services and the verification UI. The Sourcify Github organization contains all other auxiliary services and components.

At its core, Sourcify currently maintains:

  • an interface that helps developers to verify metadata and contract source code. It is accessible via sourcify.dev.
  • a decentralized contract repository of all verified contracts, powered by IPFS, accessible via sourcify.dev and verificat.eth.
  • a monitoring & verifier service that checks for new contracts on selected EVM-compatible chains and tries to verify them automatically.
  • verify & fetch plugins for several IDEs.

Sourcify aims to provide a base layer allowing other tools build on top of it. Its main purpose is to keep metadata and source files available via IPFS and Swarm (preventing that the links in the bytecode turn into dead links).

Besides the technical infrastructure, Sourcify is also a collective initiative to bring transparency and awareness to the space. We want to educate and build bridges between development tools, wallets, interfaces and other components which all play an important role in demystifying interaction with smart contracts for the end user and hence making blockchain interactions safer.

Have questions or improvement ideas?

? Chat with us on Gitter or Discord (channels are bridged).

? Follow us and help us spread the word on Twitter.

The Basic Concept

Sourcify verifies that Ethereum bytecode was compiled from a certain Solidity source code and maintains a public repository of contract metadata.

The repository indexes metadata with IPFS or Swarm hashes which the solc compiler embeds in contract bytecode. By fetching code on-chain and extracting this hash, it is possible to obtain related metadata from Sourcify’s records.

Read more about Sourcify in the FAQ. Information on metadata can be found in Solidity documentation.

The Technical Details

As mentioned above, Sourcify has several components:

  • a “monitoring & verifier service” which watches public Ethereum networks for contract deployments and tries to associate them with sources and metadata published to Swarm or IPFS. It currently watches:

    • Ethereum Mainnet
    • Ropsten
    • Rinkeby
    • Kovan
    • Goerli
    • xDai
    • POA Network Sokol
    • Polygon (previously Matic)
    • Mumbai Testnet (Polygon/Matic)
    • Binance Smart Chain Mainnet (monitoring temporarily suspended)
    • Binance Smart Chain Testnet (monitoring temporarily suspended)
    • Celo Mainnet
    • Celo Alfajores Testnet
    • Celo Baklava Testnet
    • Avalanche Fuji Testnet
    • Avalanche Mainnet
    • Arbitrum Testnet Rinkeby
  • a website which allows you to submit sources and metadata for a specific contract address manually

    • https://sourcify.dev (Stable)
    • https://staging.sourcify.dev (Unstable)
    • https://draft.staging.sourcify.dev (New UI design)
  • a public metadata repository that contains uploaded (or discovered) metadata and their sources:

    • https://repo.sourcify.dev (Stable)
    • https://repo.staging.sourcify.dev (Unstable)

Getting Metadata

Using solc directly on the commandline:

solc --metadata --metadata-literal <mySource.sol> 

or with JSON/IO

{   "settings": {     "metadata": { "useLiteralContent": true }   } } 

Using the Monitoring Service

If your Solidity code compiles with solc >= 0.6.0, all you need to do is to upload your contract metadata and sources to IPFS as part of your deployment process. The monitoring service will automatically add your files to the metadata repository when it sees your contract created on the network.

A simple example for Truffle projects can be found at cgewecke/metacoin-source-verify which contains a script to publish to IPFS directly from a Truffle compilation artifact.

Security Precautions

Please note that source code verification is only reliable if it is performed on the creation bytecode, i.e. the bytecode payload used when the contract was created. The deployed bytecode, i.e. the bytecode stored in the blockchain as code is not sufficient, because the constructor can still be different and set arbitrary storage entries.

Furthermore, if the constructor requires parameters, these have to be checked as well.

Also note that there can still be differences in the source code that are not visible in the bytecode. Variables can be renamed or unused code can be introduced. Since the bytecode contains a hash of the source code, such modifications have to be prepared at deploy time, but it is still a possibility.

Using the Repository

There is a repository which contains all the files that the monitoring service has found on the networks that are being watched.

The repository is accessible via this link.

The repository UI currently looks like this: Sourcify ?‍??? - 变酸?‍???

It offers the option to search, download or open folders.

For example to download:

Sourcify ?‍??? - 变酸?‍???

Or if you want to search something:

Sourcify ?‍??? - 变酸?‍???

The metadata inside is visible as raw, and can be downloaded like that:

Sourcify ?‍??? - 变酸?‍???

Alternatively, if you want to take a look at the contract in the browser, you can open it like this:

Sourcify ?‍??? - 变酸?‍???

Future Plans

  • cope with metadata that does not have in-place source code
  • automatically retrieve the metadata and the source code from SWARM or IPFS, so you only need to supply the metadata hash or bytecode
  • perform source verification given only an address instead of the bytecode or the metadata

How to

Install and run server with UI

$ npx lerna bootstrap $ npx lerna run build $ npm run server:start $ npm run dev:ui 

Run inside docker

Prerequisites

Docker

Docker-compose

How to run

Prepare environment and start by running these commands from the environments directory: To build images locally run: docker-compose -f geth.yaml -f ipfs.yaml -f localchain.yaml -f monitor.yaml -f repository.yaml -f s3.yaml -f server.yaml -f ui.yaml -f build-ipfs.yaml -f build-localchain.yaml -f build-monitor.yaml -f build-repository.yaml -f build-s3.yaml -f build-server.yaml -f build-ui.yaml build --parallel

If you just want to run it do: docker-compose -f ipfs.yaml -f localchain.yaml -f monitor.yaml -f repository.yaml -f s3.yaml -f server.yaml -f ui.yaml up -d (-d flag means that output won’t be printed in stdout)

Note: you don’t need to run all the services, just the ones you want.

How to run

Development

Launch

cp .env.testing .env docker-compose -f ipfs.yaml -f localchain.yaml -f monitor.yaml -f repository.yaml -f s3.yaml -f server.yaml -f ui.yaml up -d 

Other approach would be to run every service in docker except one that you are working on.

This will build the project in docker containers, launching the monitor and server. Verified sources and contract addresses will be stored in repository and db folders in your project root. The directories are created automatically if they don’t exist.

/ui/dist/index.html will be served to http://localhost:1234

UI

To help with manual UI testing, some contracts whose sources and metadata can be found in the test/sources/all folder are automatically deployed to a local ganache instance running on port 8545. Their contract addresses are deterministically generated at:

Contracts Addresses
Simple.sol 0x8168f192F7432C93FCb16e039B57FB890AaB3230
SimpleWithImport.sol 0x0Ef7de872C7110d6020fa5e62d7cD31Fd90FF811

Similar sources are also pre-deployed to Ropsten and can be found in the test/sources/ropsten folder:

Contracts Addresses
Simple.sol 0xEB6Cf7952c666F81f1a5678E80D4fC5Ce3a7bF0b
SimpleWithImport.sol 0x4668b709182F41837c4e06C8de1D3568df7778D9

Shutdown Stop the docker run with ctrl+c. To remove exited containers type docker-compose -f server.yaml -f ... down. You can list all previously started containers with -f flag.

Tests

Run tests with:

lerna run test 

test/sources contains contracts, compilation artifacts and metadata files which can be used for building test cases.

  • contracts/: Solidity files (browser tests)
  • metadata/: raw metadata files (browser tests)
  • pass/: compilation artifacts which should verify (unit tests)
  • fail/: compilation artifacts which should not verify (unit tests)
  • compiler.json: compiler config for generating more cases

Test sources are compiled with 0x’s sol-compiler. This lets you pick any compiler version or settings by modifying the compiler.json file as needed.

To generate more test data, go to the test/sources directory, add Solidity files to the contracts folder and run:

npx sol-compiler 

Compilation artifacts will be written to an artifacts folder.

API

We also provide publicly available API for both environments that you can use. You can find examples in our Postman collection in the root of this project Sourcify.postman_collection.json.

Server API

  • Check by addresses : GET /check-by-addresses?addresses={address}&chainIds={chainIds}
  • Verification API (v1)
    • Verify : POST / or POST /verify
  • Verification API (v2 – session based)
    • Add input files : POST /input-files
    • Verify validated : POST /verify-validated
    • Get session data : GET /session-data
    • Restart session : POST /restart-session
  • Get file tree (full match) : GET /files/tree/:chain/:address
  • Get source files (full match) : GET /files/:chain/:address
  • Get file tree (full or partial match) : GET /files/tree/any/:chain/:address
  • Get source files (full or partial match) : GET /files/any/:chain/:address
  • Server health : GET /health

Repository API

This paragraph should be read with the following in mind:

  • <MATCH_QUALITY> is either full_match or partial_match.
  • <CHAIN_ID> is the respective ID of the chain (e.g. 1 for Ethereum Mainnet, 5 for Görli). See the full list here.
  • <CONTRACT_ADDRESS> is the hexadecimal address of the contract (40 hex digits prefixed by 0x).
  • <FILE_PATH> is the original path of a source file. Sourcify doesn’t flatten the file hierarchy, so everything is provided as during compilation.

The repository (https://repo.sourcify.dev) provides the following GET endpoints:

  • JSON-formatted metadata file (with ABI): /contracts/<MATCH_QUALITY>/<CHAIN_ID>/<CONTRACT_ADDRESS>/metadata.json
  • JSON-formatted file with constructor arguments (only for fully matched contracts using immutable variables): /contracts/full_match/<CHAIN_ID>/<CONTRACT_ADDRESS>/constructor-args.txt
  • Source file: /contracts/<MATCH_QUALITY>/<CHAIN_ID>/<CONTRACT_ADDRESS>/sources/<FILE_PATH>
  • JSON-formatted full and partial match count per chain: /stats.json
  • JSON-formatted timestamp and version of the repo: /manifest.json

E.g. the following URL fetches browser/OceanMan.sol, a source of the contract deployed on Ethereum Mainnet (chain ID: 1) at address 0x00000000064Ecc11c97AC4a5551F279532Bf9E0D.

  • https://repo.sourcify.dev/contracts/full_match/1/0x00000000064Ecc11c97AC4a5551F279532Bf9E0D/sources/browser/OceanMan.sol

In order to fetch from the staging repository, replace https://repo.sourcify.dev with https://repo.staging.sourcify.dev.

Temporarily replace eth nodes


变酸?‍???

Sourcify希望帮助使区块链blockchain上的合同交互对用户更安全、更透明

为了实现这一目标,Sourcify支持多项努力,以促进采用开源文件验证、元数据文件和NatSpec注释

ℹ️ 此存储库仅包含主要组件、带主要服务的Sourcify monorepo和验证UI。Sourcify Github组织包含所有其他辅助服务和组件

Sourcify目前的核心是:

  • 一个帮助开发人员验证元数据和契约源代码的界面。可通过sourcify.dev访问
  • 一个分散的合同存储库,包含所有已验证的合同,由IPF提供支持,可通过sourcify.dev和verificate.eth访问
  • 一个监控和;验证器服务,用于检查选定EVM兼容链上的新合同,并尝试自动验证这些合同
  • 一个“监控与控制”的概念;“验证服务”,它监视公共以太坊eth网络的合同部署,并尝试将其与发布到Swarm或IPFS的源和元数据关联。它目前正在监视:以太坊eth主网Ropsten Rinkeby Kovan Goerli xDai POA网络Sokol Polygon(以前的Matic)孟买测试网Binance智能链主网(监控暂停)Binance智能链测试网(监控暂停)Celo主网Celo Alfajores测试网Celo Baklava测试网Avalanche FujiTestnet Avalanche Mainnet Arbitrium Testnet Rinkeby以太坊ethMainnet

Sourcify旨在提供一个基础层,允许在其上构建其他工具。其主要目的是通过IPFS和Swarm保持元数据和源文件可用(防止字节码中的链接变成死链接)

除了技术基础设施之外,Sourcify也是一项集体倡议,旨在提高空间的透明度和知名度。我们希望在开发工具、钱包、接口和其他组件之间建立起教育和桥梁,这些工具、钱包、接口和组件在为最终用户解除智能合约交互的神秘性方面发挥着重要作用,从而使区块链blockchain交互更加安全

有问题或改进意见吗

? 在Gitter或Discord上与我们聊天(频道桥接)

? 跟随我们,帮助我们在Twitter上传播信息

基本概念

Sourcify验证以太坊eth字节码是否是从某个可靠的源代码编译而来,并维护合同元数据的公共存储库

存储库使用IPF或Swarm哈希索引元数据,solc编译器将其嵌入到契约字节码中。通过获取链上的代码并提取此哈希,可以从Sourcify的记录中获取相关元数据

阅读常见问题解答中有关Sourcify的更多信息。元数据信息可在Solidity文档中找到

技术细节

如上所述,Sourcify有几个组件:

  • 罗普斯滕
  • 一个允许您手动提交特定合同地址的源代码和元数据的网站。

    • https://sourcify.dev (Stable)
    • https://staging.sourcify.dev (Unstable)
    • https://draft.staging.sourcify.dev (New UI design)
  • 一个包含上传(或发现)元数据及其源代码的公共元数据存储库:

    • https://repo.sourcify.dev (Stable)
    • https://repo.staging.sourcify.dev (Unstable)

使用监控服务获取元数据

直接在命令行上使用solc:

solc --metadata --metadata-literal <mySource.sol> 

或使用JSON/IO

{   "settings": {     "metadata": { "useLiteralContent": true }   } } 

安全预防措施

,如果您的代码为solity使用solc编译&gt;=在0.6.0中,作为部署过程的一部分,您只需将合同元数据和源上传到IPFS。当监控服务看到您在网络上创建的合同时,它会自动将您的文件添加到元数据存储库中

可以在cgewcke/metacoin source verify上找到一个简单的Truffle项目示例,其中包含一个脚本,可以直接从Truffle编译工件发布到IPFS

使用存储库

请注意,只有在创建字节码(即创建合同时使用的字节码有效负载)上执行源代码验证时,源代码验证才可靠。部署的字节码,即作为代码存储在区块链blockchain中的字节码是不够的,因为构造函数仍然可以不同并设置任意存储条目

此外,如果构造函数需要参数,也必须检查这些参数

还要注意,源代码中仍然可能存在字节码中看不到的差异。可以重命名变量或引入未使用的代码。由于字节码包含源代码的散列,因此必须在部署时准备此类修改,但这仍然是可能的

未来计划

有一个存储库,其中包含监控服务在正在监视的网络上找到的所有文件

可通过此链接访问存储库

存储库UI当前看起来是这样的:Sourcify ?‍??? - 变酸?‍???

它提供了搜索、下载或打开文件夹的选项

例如下载:

<Sourcify ?‍???><Sourcify ?‍???>

或者如果你想搜索某个东西:

<Sourcify ?‍???><Sourcify ?‍???>

里面的元数据是原始的,可以这样下载:

<Sourcify ?‍???><Sourcify ?‍???>

或者,如果你想在浏览器中查看合同,您可以这样打开它:

<Sourcify ?‍???><Sourcify ?‍???>

Docker

Docker compose

准备环境,并从环境目录运行以下命令开始:本地构建映像运行:Docker compose-f geth.yaml-f ipfs.yaml-f localchain.yaml-f monitor.yaml-f repository.yaml-f repository.yaml-f s3.yaml-fserver.yaml-f ui.yaml-f build-ipfs.yaml-f build-localchain.yaml-f build-repository.yaml-f build-s3.yaml-f build-server.yaml-f build-ui.yaml build-parallel

如果您只想运行它,请执行以下操作:docker compose-f ipfs.yaml-f localchain.yaml-f monitor.yaml-f repository.yaml-f s3.yaml-f server.yaml-f ui.yaml up-d(-d标志表示输出不会以标准输出)

注意:您不需要运行所有服务,只需要运行您想要的服务

启动

另一种方法是运行docker中的所有服务,但您正在处理的服务除外

这将在docker容器中构建项目,启动监视器和服务器。已验证的源和合同地址将存储在项目根目录中的存储库和db文件夹中。如果目录不存在,则会自动创建这些目录

/ui/dist/index.html将提供给http://localhost:1234

UI

要帮助进行手动UI测试,某些协定的源和元数据可以在test/sources/all文件夹中找到,它们会自动部署到运行在端口8545上的本地ganache实例。它们的协定地址在以下位置确定生成:

类似的源也会预部署到Ropsten,可以在test/sources/Ropsten文件夹中找到:

关机使用ctrl+c停止docker运行。要删除已退出的容器,请键入docker compose-f server.yaml-f。。。放下。您可以使用-f标志列出所有以前启动的容器

使用运行测试:

测试/源包含可用于构建测试用例的契约、编译工件和元数据文件

测试源使用0x的sol编译器编译。这允许您通过根据需要修改compiler.json文件来选择任何编译器版本或设置

要生成更多测试数据,请转到test/sources目录,将Solidity文件添加到contracts文件夹并运行:

编译工件将写入工件文件夹

我们还为您可以使用的两种环境提供公开可用的API。您可以在这个项目Sourcify.Postman_collection.json的根目录中找到我们的Postman集合中的示例

阅读本段时应牢记以下内容:

存储库(https://repo.sourcify.dev)提供以下获取端点:

例如,以下URL获取browser/OceanMan.sol,它是部署在以太坊ethMainnet(链ID:1)上的合同源,地址为0x00000000064Ecc11c97AC4a5551F279532Bf9E0D

要从暂存存储库中提取,请替换https://repo.sourcify.dev 具有https://repo.staging.sourcify.dev.

变酸?‍???

基本概念

技术细节

使用监控服务获取元数据

安全预防措施

使用存储库

未来计划

如何安装并运行具有UI的服务器

在docker内部运行

先决条件

如何运行

如何运行

开发

测试

API

服务器API

存储库API

  • 一个帮助开发人员验证元数据和契约源代码的界面。可通过sourcify.dev访问
  • 一个分散的合同存储库,包含所有已验证的合同,由IPF提供支持,可通过sourcify.dev和verificate.eth访问
  • 一个监控和;验证器服务,用于检查选定EVM兼容链上的新合同,并尝试自动验证这些合同
  • 验证&amp;获取几个IDE的插件

  • 一个“监控与控制”的概念;“验证服务”,它监视公共以太坊eth网络的合同部署,并尝试将其与发布到Swarm或IPFS的源和元数据关联。它目前正在监视:以太坊eth主网Ropsten Rinkeby Kovan Goerli xDai POA网络Sokol Polygon(以前的Matic)孟买测试网Binance智能链主网(监控暂停)Binance智能链测试网(监控暂停)Celo主网Celo Alfajores测试网Celo Baklava测试网Avalanche FujiTestnet Avalanche Mainnet Arbitrium Testnet Rinkeby以太坊ethMainnet
  • 罗普斯滕
  • 林克比
  • 科万

    戈尔利

    xDai

  • POA网络Sokol
  • 多边形(以前的Matic)

  • 孟买测试网(多边形/Matic)
  • 二进制智能链Mainnet(监控)暂时暂停)Binance智能链测试网(监测暂时暂停)
  • Celo Mainnet
  • Celo Alfajores测试网
  • Celo Baklava测试网
  • 雪崩富士测试网

    雪崩Mainnet

    Arbitrum测试网Rinkeby

  • 允许您提交手动获取特定合同地址的源和元数据https://sourcify.dev (稳定)https://staging.sourcify.dev (不稳定)https://draft.staging.sourcify.dev (新的用户界面设计)
  • https://sourcify.dev (稳定)
  • https://staging.sourcify.dev (不稳定)
  • https://draft.staging.sourcify.dev (新的用户界面设计)
  • 包含上载(或发现)元数据及其源的公共元数据存储库:https://repo.sourcify.dev (稳定)https://repo.staging.sourcify.dev (不稳定)
  • https://repo.sourcify.dev (稳定)
  • https://repo.

    Or if you want to search something:

    或者如果你想搜索某个东西:

    The metadata inside is visible as raw, and can be downloaded like that:

    里面的元数据是原始的,可以这样下载:

    或者,如果你想在浏览器中查看合同,您可以这样打开它:

    <Sourcify ?‍???><Sourcify ?‍???>

    Docker

    Docker compose

    准备环境,并从环境目录运行以下命令开始:本地构建映像运行:Docker compose-f geth.yaml-f ipfs.yaml-f localchain.yaml-f monitor.yaml-f repository.yaml-f repository.yaml-f s3.yaml-fserver.yaml-f ui.yaml-f build-ipfs.yaml-f build-localchain.yaml-f build-repository.yaml-f build-s3.yaml-f build-server.yaml-f build-ui.yaml build-parallel

    如果您只想运行它,请执行以下操作:docker compose-f ipfs.yaml-f localchain.yaml-f monitor.yaml-f repository.yaml-f s3.yaml-f server.yaml-f ui.yaml up-d(-d标志表示输出不会以标准输出)

    注意:您不需要运行所有服务,只需要运行您想要的服务

    启动

    另一种方法是运行docker中的所有服务,但您正在处理的服务除外

    这将在docker容器中构建项目,启动监视器和服务器。已验证的源和合同地址将存储在项目根目录中的存储库和db文件夹中。如果目录不存在,则会自动创建这些目录

    /ui/dist/index.html将提供给http://localhost:1234

    UI

    要帮助进行手动UI测试,某些协定的源和元数据可以在test/sources/all文件夹中找到,它们会自动部署到运行在端口8545上的本地ganache实例。它们的协定地址在以下位置确定生成:

    类似的源也会预部署到Ropsten,可以在test/sources/Ropsten文件夹中找到:

    关机使用ctrl+c停止docker运行。要删除已退出的容器,请键入docker compose-f server.yaml-f。。。放下。您可以使用-f标志列出所有以前启动的容器

    使用运行测试:

    测试/源包含可用于构建测试用例的契约、编译工件和元数据文件

    测试源使用0x的sol编译器编译。这允许您通过根据需要修改compiler.json文件来选择任何编译器版本或设置

    要生成更多测试数据,请转到test/sources目录,将Solidity文件添加到contracts文件夹并运行:

    编译工件将写入工件文件夹

    我们还为您可以使用的两种环境提供公开可用的API。您可以在这个项目Sourcify.Postman_collection.json的根目录中找到我们的Postman集合中的示例

    阅读本段时应牢记以下内容:

    存储库(https://repo.sourcify.dev)提供以下获取端点:

    例如,以下URL获取browser/OceanMan.sol,它是部署在以太坊ethMainnet(链ID:1)上的合同源,地址为0x00000000064Ecc11c97AC4a5551F279532Bf9E0D

    要从暂存存储库中提取,请替换https://repo.sourcify.dev 具有https://repo.staging.sourcify.dev.

    变酸?‍???

    基本概念

    技术细节

    使用监控服务获取元数据

    安全预防措施

    使用存储库

    未来计划

    如何安装并运行具有UI的服务器

    在docker内部运行

    先决条件

    如何运行

    如何运行

    开发

    测试

    API

    服务器API

    存储库API

  • 一个帮助开发人员验证元数据和契约源代码的界面。可通过sourcify.dev访问
  • 一个分散的合同存储库,包含所有已验证的合同,由IPF提供支持,可通过sourcify.dev和verificate.eth访问
  • 一个监控和;验证器服务,用于检查选定EVM兼容链上的新合同,并尝试自动验证这些合同
  • 验证&amp;获取几个IDE的插件

  • 一个“监控与控制”的概念;“验证服务”,它监视公共以太坊eth网络的合同部署,并尝试将其与发布到Swarm或IPFS的源和元数据关联。它目前正在监视:以太坊eth主网Ropsten Rinkeby Kovan Goerli xDai POA网络Sokol Polygon(以前的Matic)孟买测试网Binance智能链主网(监控暂停)Binance智能链测试网(监控暂停)Celo主网Celo Alfajores测试网Celo Baklava测试网Avalanche FujiTestnet Avalanche Mainnet Arbitrium Testnet Rinkeby以太坊ethMainnet
  • 罗普斯滕
  • 林克比
  • 科万

    戈尔利

    xDai

  • POA网络Sokol
  • 多边形(以前的Matic)

  • 孟买测试网(多边形/Matic)
  • 二进制智能链Mainnet(监控)暂时暂停)Binance智能链测试网(监测暂时暂停)
  • Celo Mainnet
  • Celo Alfajores测试网
  • Celo Baklava测试网
  • 雪崩富士测试网

    雪崩Mainnet

    Arbitrum测试网Rinkeby

  • 允许您提交手动获取特定合同地址的源和元数据https://sourcify.dev (稳定)https://staging.sourcify.dev (不稳定)https://draft.staging.sourcify.dev (新的用户界面设计)
  • https://sourcify.dev (稳定)
  • https://staging.sourcify.dev (不稳定)
  • https://draft.staging.sourcify.dev (新的用户界面设计)
  • 包含上载(或发现)元数据及其源的公共元数据存储库:https://repo.sourcify.dev (稳定)https://repo.staging.sourcify.dev (不稳定)
  • https://repo.sourcify.dev (稳定)
  • https://repo.

    如何安装并运行具有UI的服务器

    在docker内部运行

    先决条件

    如何运行

    如何运行

    开发

    测试

    API

    • cope with metadata that does not have in-place source code
    • automatically retrieve the metadata and the source code from SWARM or IPFS, so you only need to supply the metadata hash or bytecode
    • perform source verification given only an address instead of the bytecode or the metadata

    在docker内部运行

    先决条件

    $ npx lerna bootstrap $ npx lerna run build $ npm run server:start $ npm run dev:ui 

    如何运行

    如何运行

    Docker

    Docker compose

    开发

    准备环境,并从环境目录运行以下命令开始:本地构建映像运行:Docker compose-f geth.yaml-f ipfs.yaml-f localchain.yaml-f monitor.yaml-f repository.yaml-f repository.yaml-f s3.yaml-fserver.yaml-f ui.yaml-f build-ipfs.yaml-f build-localchain.yaml-f build-repository.yaml-f build-s3.yaml-f build-server.yaml-f build-ui.yaml build-parallel

    如果您只想运行它,请执行以下操作:docker compose-f ipfs.yaml-f localchain.yaml-f monitor.yaml-f repository.yaml-f s3.yaml-f server.yaml-f ui.yaml up-d(-d标志表示输出不会以标准输出)

    注意:您不需要运行所有服务,只需要运行您想要的服务

    测试

    API

    启动

    cp .env.testing .env docker-compose -f ipfs.yaml -f localchain.yaml -f monitor.yaml -f repository.yaml -f s3.yaml -f server.yaml -f ui.yaml up -d 

    另一种方法是运行docker中的所有服务,但您正在处理的服务除外

    这将在docker容器中构建项目,启动监视器和服务器。已验证的源和合同地址将存储在项目根目录中的存储库和db文件夹中。如果目录不存在,则会自动创建这些目录

    /ui/dist/index.html将提供给http://localhost:1234

    UI

    要帮助进行手动UI测试,某些协定的源和元数据可以在test/sources/all文件夹中找到,它们会自动部署到运行在端口8545上的本地ganache实例。它们的协定地址在以下位置确定生成:

    Contracts Addresses
    Simple.sol 0x8168f192F7432C93FCb16e039B57FB890AaB3230
    SimpleWithImport.sol 0x0Ef7de872C7110d6020fa5e62d7cD31Fd90FF811

    类似的源也会预部署到Ropsten,可以在test/sources/Ropsten文件夹中找到:

    Contracts Addresses
    Simple.sol 0xEB6Cf7952c666F81f1a5678E80D4fC5Ce3a7bF0b
    SimpleWithImport.sol 0x4668b709182F41837c4e06C8de1D3568df7778D9

    关机使用ctrl+c停止docker运行。要删除已退出的容器,请键入docker compose-f server.yaml-f。。。放下。您可以使用-f标志列出所有以前启动的容器

    服务器API

    使用运行测试:

    lerna run test 

    测试/源包含可用于构建测试用例的契约、编译工件和元数据文件

    • contracts/: Solidity files (browser tests)
    • metadata/: raw metadata files (browser tests)
    • pass/: compilation artifacts which should verify (unit tests)
    • fail/: compilation artifacts which should not verify (unit tests)
    • compiler.json: compiler config for generating more cases

    测试源使用0x的sol编译器编译。这允许您通过根据需要修改compiler.json文件来选择任何编译器版本或设置

    要生成更多测试数据,请转到test/sources目录,将Solidity文件添加到contracts文件夹并运行:

    npx sol-compiler 

    编译工件将写入工件文件夹

    存储库API

    我们还为您可以使用的两种环境提供公开可用的API。您可以在这个项目Sourcify.Postman_collection.json的根目录中找到我们的Postman集合中的示例

    Server API

    • Check by addresses : GET /check-by-addresses?addresses={address}&chainIds={chainIds}
    • Verification API (v1)
      • Verify : POST / or POST /verify
    • Verification API (v2 – session based)
      • Add input files : POST /input-files
      • Verify validated : POST /verify-validated
      • Get session data : GET /session-data
      • Restart session : POST /restart-session
    • Get file tree (full match) : GET /files/tree/:chain/:address
    • Get source files (full match) : GET /files/:chain/:address
    • Get file tree (full or partial match) : GET /files/tree/any/:chain/:address
    • Get source files (full or partial match) : GET /files/any/:chain/:address
    • Server health : GET /health

    Repository API

    存储库(https://repo.sourcify.dev)提供以下获取端点:

    • <MATCH_QUALITY> is either full_match or partial_match.
    • <CHAIN_ID> is the respective ID of the chain (e.g. 1 for Ethereum Mainnet, 5 for Görli). See the full list here.
    • <CONTRACT_ADDRESS> is the hexadecimal address of the contract (40 hex digits prefixed by 0x).
    • <FILE_PATH> is the original path of a source file. Sourcify doesn’t flatten the file hierarchy, so everything is provided as during compilation.

    例如,以下URL获取browser/OceanMan.sol,它是部署在以太坊ethMainnet(链ID:1)上的合同源,地址为0x00000000064Ecc11c97AC4a5551F279532Bf9E0D

    • JSON-formatted metadata file (with ABI): /contracts/<MATCH_QUALITY>/<CHAIN_ID>/<CONTRACT_ADDRESS>/metadata.json
    • JSON-formatted file with constructor arguments (only for fully matched contracts using immutable variables): /contracts/full_match/<CHAIN_ID>/<CONTRACT_ADDRESS>/constructor-args.txt
    • Source file: /contracts/<MATCH_QUALITY>/<CHAIN_ID>/<CONTRACT_ADDRESS>/sources/<FILE_PATH>
    • JSON-formatted full and partial match count per chain: /stats.json
    • JSON-formatted timestamp and version of the repo: /manifest.json

    要从暂存存储库中提取,请替换https://repo.sourcify.dev 具有https://repo.staging.sourcify.dev.

    • https://repo.sourcify.dev/contracts/full_match/1/0x00000000064Ecc11c97AC4a5551F279532Bf9E0D/sources/browser/OceanMan.sol

    In order to fetch from the staging repository, replace https://repo.sourcify.dev with https://repo.staging.sourcify.dev.

  • Temporarily replace eth nodes

    部分转自网络,侵权联系删除区块链源码网

    www.interchains.cc

    https://www.interchains.cc/23842.html

    区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
    区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » Sourcify ?‍??? – 变酸?‍???区块链毕设代写

    提供最优质的资源集合

    立即查看 了解详情