基于区块链的毕业设计Ethlance V.2 (Newlance) – Ethlance V.2(纽兰斯)

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Ethlance V.2 (Newlance) – Ethlance V.2(纽兰斯) 是一篇很好的国外资料

Ethlance V.2 (Newlance)

Ethlance V.2 (Newlance) - Ethlance V.2(纽兰斯)

Ethlance Version 2 is Currently in Development and is subject to change before final release

Development

Here’s a high level overview of the components involved in ethlance.

Ethlance V.2 (Newlance) - Ethlance V.2(纽兰斯)

Prerequisites

The following tools are needed to run different parts making up the Ethlance service. Programming language tools (e.g. nodejs, python, etc.) may require specific versions. To simplify maintaining their versions, asdf version manager is a good tool Ethlance project also has .tool-versions described with appropriate versions

  • NodeJS (Latest LTS Version)
  • Leiningen
  • ganache-cli
  • ipfs
  • make
    • Note: Windows users can use Msys for build essentials (Untested)

Run make check to determine whether you are missing any prerequisites

Setup Backend

Backend development requires:

  1. Postgres database server (provided by docker image)
  2. IPFS server running
  3. Ganache test net running
  • Contracts deployed to testnet
  1. CSS files to be watched & compiled
  2. Node.js server with Shadow CLJS for back-end running
  3. Node.js server with Shadow CLJS for front-end running
  4. Node.js server for GraphQL running

This is quite a few steps to run every time you start developing. To simplify that, a Procfile consuming tool like Foreman (has implementations in various languages) or Invoker can be used.

Then it’s easy as

❯ foreman start 08:37:22 postgres.1         | started with pid 205427 08:37:22 ipfs.1             | started with pid 205428 08:37:22 testnet.1          | started with pid 205429 08:37:22 deploy_contracts.1 | started with pid 205433 08:37:22 css.1              | started with pid 205434 08:37:22 ui.1               | started with pid 205436 08:37:22 server.1           | started with pid 205439 08:37:22 graphql.1          | started with pid 205442 08:37:22 postgres.1         | docker run                                                        08:37:22 ipfs.1             | ipfs daemon 08:37:22 testnet.1          | npx ganache-cli -m district0x --host 0.0.0.0 --port 8549  -l 8000000 08:37:22 css.1              | ./ui/node_modules/less/bin/lessc resources/public/less/main.less resources/public/css/main.css 08:37:22 postgres.1 <...> 

Initial Setup

Note: All instructions start in the root of the project directory

If this is a first time setup, or you accidentally ran make clean-all, you are required to re-install additional node dependencies with:

Tested with GCC 6 & GCC 7, does not appear to work with GCC 8

make deps

If you’re having issues with your environment, you can run this command:

make clean-all deps

First steps, showing example data

In order for the front-end to be able to have the JWT token (kept in LocalStorage), you must sign a transaction. Currently it can be done manually. Open REPL for UI:

lein repl :connect 54872 (shadow/repl :dev-ui) (in-ns 'ethlance.ui.event.sign-in) (re/dispatch [:user/sign-in]) 
  • this will show a pop up and using MetaMask you can create a transaction
  • after doing this successfully the UI graphql requests will have proper Authorization: Bearer ... header

Then to generate some example data you can use server REPL:

lein repl :connect 54872 (shadow/repl :dev-server) (in-ns 'tests.graphql.generator) (generate-for-address "0xafcf1a2bc71acf041c93012a2e552e31026dfeab") 
  • for that the test namespace must be included in the server build (e.g. by adding [tests.graphql.generator :as test-data-generator] to ethlance.server.core)
  • alternatively you can submit the data manually through the forms

Additional Troubleshooting

  • Make sure you are using NodeJS LTS Version. (Latest LTS Version is v10.16.3 as of this posting)

  • GCC 8+ do not work with some of the district libraries. This might change in the future. Please use GCC Version 6, or GCC Version 7.

Testnet Server

Our local development environment requires a testnet in order to run smart contracts. Ethlance Development uses ganache-cli with a default configuration.

$ make testnet # Run in a separate terminal

IPFS Server

IPFS is an essential technology in ensuring that large blobs of data can be stored in a decentralized manner. After installing the ipfs commandline tool, you need to start up a daemon for development

ipfs daemon

Note: Might require additional configuration for CORS

ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]' ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '["*"]' ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Headers '["X-Requested-With"]' ipfs config --json Gateway.Writable true

Deployment

Ethlance product can be prepared for deployment by running:

$ make build

This compiles everything and places it in the ./dist folder

After building, the production build can be run:

$ make run

Testing One-touch

To run all of the tests in a standalone test runner, you must first build the solidity contracts, run an instance of the testnet server, and an instance of the IPFS daemon. The test runner can be run via:

  1. Watch test build (compiles test CLJS files)
  • ./bin/repl-run "(shadow/watch :server-tests) @(promise)"
  1. Run tests:
  • node server/tests/server-tests.js

Contributing

Anyone is welcome to contribute to the ethlance project, here are some brief guidelines:

  • Make sure to squash your commits
  • Reference issue numbers in your pull request
  • Rebase your changes on upstream (git remote add upstream https://github.com/madvas/ethlance.git) master before pushing (git pull --rebase upstream master)
  • Make changes in a separate well-named branch in your forked repo like improve-readme

ethlance V.2(Newlance)

Ethlance版本2目前正在开发中,在最终发布之前可能会有所更改,下面是对Ethlance中涉及的组件的高级概述。

Ethlance V.2 (Newlance) - Ethlance V.2(纽兰斯)

开发

运行组成Ethlance服务的不同部件需要以下工具。编程语言工具(例如nodejs、python等)可能需要特定的版本。为了简化版本维护,asdf version manager是Ethlance项目还拥有的一个很好的工具。使用适当版本描述的工具版本请运行检查以确定是否缺少任何先决条件后端开发需要:

每次开始开发时都要运行相当多的步骤。为了简化这一点,可以使用Foreman(有多种语言的实现)或Invoker之类的Procfile消费工具。

先决条件

然后就很容易了,因为

  • 节点(最新LTS版本)
  • Leiningen
  • ganache cli
  • IPFS
  • 注意:Windows用户可以使用Msysbuild essentials(未测试)

注意:所有指令都从项目目录的根目录开始

设置后端

如果这是第一次安装,或者您意外地运行了make clean All,则需要重新安装附加的节点依赖项:

  1. Postgres数据库服务器(由docker image提供)
  2. 正在运行的IPFS服务器;编译节点.js具有用于后端运行的Shadow CLJS的服务器节点.js具有用于前端运行的Shadow CLJS的服务器节点.js运行GraphQL的服务器
  3. 这将显示一个弹出窗口,使用MetaMask可以创建事务
  • 成功执行此操作后,UI GraphQL请求将具有正确授权:持票人。。。头
  1. ,测试名称空间必须包含在服务器构建中(例如,通过添加[测试.graphql.generator:as test data generator]到ethlance.server.core文件)
  2. 或者,您可以通过表单手动提交数据
  3. 确保您使用的是NodeJS LTS版本。(最新的LTS版本是v10.16.3,截至发帖时)
  4. GCC 8+不适用于某些地区图书馆。这在将来可能会改变。请使用GCC版本6或GCC版本7。

使用GCC 6和GCC 7测试,似乎不适用于GCC 8

如果您的环境有问题,可以运行以下命令:

❯ foreman start 08:37:22 postgres.1         | started with pid 205427 08:37:22 ipfs.1             | started with pid 205428 08:37:22 testnet.1          | started with pid 205429 08:37:22 deploy_contracts.1 | started with pid 205433 08:37:22 css.1              | started with pid 205434 08:37:22 ui.1               | started with pid 205436 08:37:22 server.1           | started with pid 205439 08:37:22 graphql.1          | started with pid 205442 08:37:22 postgres.1         | docker run                                                        08:37:22 ipfs.1             | ipfs daemon 08:37:22 testnet.1          | npx ganache-cli -m district0x --host 0.0.0.0 --port 8549  -l 8000000 08:37:22 css.1              | ./ui/node_modules/less/bin/lessc resources/public/less/main.less resources/public/css/main.css 08:37:22 postgres.1 <...> 

初始设置

为了使前端能够拥有JWT令牌(保存在本地存储中),您必须对事务进行签名。目前可以手动完成。打开REPL for UI:

然后要生成一些示例数据,您可以使用serverrepl:

确保您使用的是NodeJS LTS版本。(最新的LTS版本是v10.16.3,截至发帖时)

make deps

GCC 8+不适用于某些地区图书馆。这在将来可能会改变。请使用GCC版本6或GCC版本7。

make clean-all deps

第一步,显示示例数据

我们的本地开发环境需要一个testnet来运行智能合约。Ethlance开发使用带有默认配置的ganache cli。

lein repl :connect 54872 (shadow/repl :dev-ui) (in-ns 'ethlance.ui.event.sign-in) (re/dispatch [:user/sign-in]) 
  • 监视测试生成(编译测试CLJS文件)
  • 运行测试:

IPFS是确保以分散方式存储大数据块的关键技术。安装ipfs命令行工具后,需要启动一个用于开发的守护程序。

lein repl :connect 54872 (shadow/repl :dev-server) (in-ns 'tests.graphql.generator) (generate-for-address "0xafcf1a2bc71acf041c93012a2e552e31026dfeab") 
  • 节点服务器/测试/server-测试.js
  • 确保压缩提交

其他故障排除

  • 拉取请求中的参考问题号
  • 在上游(git)上重新设置更改的基础远程添加上游https://github.com/madvas/ethlance.git网站)推之前的master(git pull——重新设置上游master的基础)

Testnet Server

此命令编译所有内容,并在生成后将其放入./dist文件夹

$ make testnet # Run in a separate terminal

IPFS Server

,生产构建可以运行:

ipfs daemon

要在独立的测试运行程序中运行所有测试,必须首先构建solidity契约,运行testnet服务器实例和IPFS守护程序实例。测试运行程序可以通过以下方式运行:

ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST", "OPTIONS"]' ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Origin '["*"]' ipfs config --json Gateway.HTTPHeaders.Access-Control-Allow-Headers '["X-Requested-With"]' ipfs config --json Gateway.Writable true

部署

欢迎任何人为ethlance项目做出贡献,以下是一些简短的指导原则:

$ make build

This compiles everything and places it in the ./dist folder

After building, the production build can be run:

$ make run

测试一触式

To run all of the tests in a standalone test runner, you must first build the solidity contracts, run an instance of the testnet server, and an instance of the IPFS daemon. The test runner can be run via:

  1. 在forked repo中的一个单独的名为improve readme的分支中进行更改
  • ./bin/repl-run "(shadow/watch :server-tests) @(promise)"
  1. Run tests:
  • node server/tests/server-tests.js

贡献

Anyone is welcome to contribute to the ethlance project, here are some brief guidelines:

  • Make sure to squash your commits
  • Reference issue numbers in your pull request
  • Rebase your changes on upstream (git remote add upstream https://github.com/madvas/ethlance.git) master before pushing (git pull --rebase upstream master)
  • Make changes in a separate well-named branch in your forked repo like improve-readme

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

www.interchains.cc

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

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Ethlance V.2 (Newlance) – Ethlance V.2(纽兰斯)

提供最优质的资源集合

立即查看 了解详情