基于区块链的毕业设计Etho Boost – A crowdfund app built on Etherium – Etho Boost-一款基于Etherium的众筹应用程序

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Etho Boost – A crowdfund app built on Etherium – Etho Boost-一款基于Etherium的众筹应用程序 是一篇很好的国外资料

Etho Boost – A crowdfund app built on Etherium

  • Setup
  • Database Setup
  • Seeding The Database
  • Updating The Database
  • API Endpoints

Setup

App Setup Instructions
  1. Install Python, Pipenv and Postgres on your machine, if you do not have them already
  • To install Pipenv on a Mac, you can run $ brew install pipenv
  1. You should have Python 3.8.5
$ python3 --version => Python 3.8.5 
  1. You should have Postgres
$ which psql => /Applications/Postgres.app/Contents/Versions/latest/bin/psql 
  1. You should have pipenv
$ pipenv --version => pipenv, version 2020.8.13 
  1. Fork and clone down the repository
  2. Change into the directory $ cd eth_crowdfund_be
  3. You will need to work in a virtual environment. Why? Using a virtual environment for Python projects allows us to have an isolated working copy of Python so we can work on a specific project without worrying about affecting other projects.
  4. Within the root directory:
    a. Run # pipenv --three to create the virtual environment
    c. Run $ pipenv install to install all dependencies
    d. Run $ createdb eth_crowdfund_api_db to create the app database
    e. Run $ createdb eth_crowdfund_api_db_test to create the testing database
    f. Run $ touch .env to create an enviornment file e. Within the .env file add appropriate environment values for flask enviornment, database URLs, and localhost port
 FLASK_ENV=development  SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost/eth_crowdfund_api_db"  SQLALCHEMY_TEST_DATABASE_URI="postgresql://postgres:password@localhost/eth_crowdfund_api_db_test"  PORT=3000 
  1. Run the following to activate the project virtual environment. When you are done working on the project, you should execute $ exit to exit the virtual environment
$ pipenv shell    $ python3 run.py =>  * Serving Flask app "src.app" (lazy loading)     * Environment: development     * Debug mode: on     * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)     * Restarting with stat        /Users/username/.local/share/virtualenvs/eth_crowdfund_be-TvIDdz62/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py:833: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.        warnings.warn(FSADeprecationWarning(     * Debugger is active!     * Debugger PIN: 312-766-617   
  1. In your browser, navigate to http://localhost:3000/ and you should see Etherium for life
  2. To stop the server, ctrl + c

Database Setup

Database Setup Instructions

Path: `eth_crowdfund_be`

  1. Run
$ python3 manage.py db stamp head $ python3 manage.py db init $ python3 manage.py db migrate $ python3 manage.py db upgrade 
  1. You can check the database by running
$ psql $ c eth_crowdfund_api_db $ dt => List of relations    Schema |      Name       | Type  |  Owner    --------+-----------------+-------+----------    public | alembic_version | table | postgres    public | campaigns       | table | postgres    public | requests        | table | postgres  $ SELECT * FROM campaigns; => id | name | description | image | manager | contributors | upvote | min_contribution | address | expiration | created_at | updated_at   ----+------+-------------+-------+---------+--------------+--------+------------------+---------+------------+------------+------------  $ SELECT * FROM requests; => id | campaign_id | description | image | value | recipient | approved | finalized | approvals | created_at | updated_at   ----+-------------+-------------+-------+-------+-----------+----------+-----------+-----------+------------+------------ 
  1. To exit the database, $ exit

Seeding the Database

Database Seeding Instructions

Within the `pipenv shell` virtual environment, run the following:

  1. Ensure you are at /eth_crowdfund_be
  2. Run $ python3 manage.py seed
  3. Start server with $ python3 run.py
  4. Visit localhost:3000/api/v1/campaigns and localhost:3000/api/v1/requests and you should see seeded Campaigns and Requests.

Database Updates

Updating the Database Instructions

Path: /eth_crowdfund_be
To make updates to the database and run a new migration, run the following:

 $ python3 manage.py db stamp head  $ python3 manage.py db init  $ python3 manage.py db migrate  $ python3 manage.py db upgrade 
  • Note: If you encounter any root errors, such as ERROR [root] Error: Target database is not up to date. or ERROR [root] Error: Relative revision -1 didn't produce 1 migrations, run $ python3 manage.py db stamp head to reset the target database to your current database head.

API Endpoints

Campaigns

Create a campaign
  • Path: POST http://localhost:3000/api/v1/campaigns/
  • Example JSON post body:
{     "name": "Test Campaign",     "description": "test description",     "image": "test.jpg",     "contributors": "1",     "upvote": "2",     "manager": "3",     "address": "1",     "min_contribution": 5.0 } 
  • Example response body:
{     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description",     "expiration": null,     "id": 1,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Test Campaign",     "requests": [],     "updated_at": "2020-09-06T15:49:49.445158",     "upvote": 2 } 
Get a Campaign by ID number
  • Path: GET http://localhost:3000/api/v1/campaigns/<insert campaign id here>
  • No body required
  • Example response body
{     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description",     "expiration": null,     "id": 4,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Test Campaign",     "requests": [],     "updated_at": "2020-09-06T15:49:49.445158",     "upvote": 2 } 
Get all Campaigns
  • Path: GET http://localhost:3000/api/v1/campaigns
  • No body required
  • Example response body
[     {         "address": "4",         "contributors": 1,         "created_at": "2020-09-05T20:31:17.196051",         "description": "test description",         "expiration": null,         "id": 1,         "image": "test.jpg",         "manager": "3",         "min_contribution": 5.0,         "name": "Test Campaign",         "requests": [             {                 "approvals": 1,                 "approved": false,                 "campaign_id": 1,                 "created_at": "2020-09-05T20:41:47.774790",                 "description": "test description",                 "finalized": false,                 "id": 1,                 "image": "test.jpg",                 "recipient": "1",                 "updated_at": "2020-09-05T20:41:47.774800",                 "value": 1.0             }         ],         "updated_at": "2020-09-05T20:31:17.196090",         "upvote": 2     },     {         "address": "2",         "contributors": 2,         "created_at": "2020-09-06T16:59:05.367795",         "description": "test description b",         "expiration": null,         "id": 5,         "image": "test_b.jpg",         "manager": "1",         "min_contribution": 5.0,         "name": "Test Campaign B",         "requests": [],         "updated_at": "2020-09-06T16:59:05.367801",         "upvote": 5     } ] 
Update a Campaign by ID number
  • Path: PUT http://localhost:3000/api/v1/campaigns/<insert campaign id here>
  • Example JSON put body
{     "description": "test description updated",     "name": "Better Name Campaign",     "upvote": 4 } 
  • Example response body
{     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description updated",     "expiration": null,     "id": 4,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Better Name Campaign",     "requests": [],     "updated_at": "2020-09-06T16:48:19.902997",     "upvote": 4 } 
Delete a Campaign by ID number
  • Path: DELETE http://localhost:3000/api/v1/campaigns/<insert campaign id here>
  • No body required
  • Example response body
{     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description updated",     "expiration": null,     "id": 4,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Better Name Campaign",     "requests": [],     "updated_at": "2020-09-06T16:48:19.902997",     "upvote": 4 } 

Requests

Create a Request
  • Path POST http://localhost:3000/api/v1/requests/
  • Example JSON post body. campaign_id, value, and recipient are required.
{     "campaign_id": "1",     "description": "test description a",     "image": "request.jpg",     "value": 1.0,     "recipient": "1" } 
  • Example response body
{     "approvals": null,     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T17:11:23.639004",     "description": "test description a",     "finalized": false,     "id": 2,     "image": "request.jpg",     "recipient": "1",     "updated_at": "2020-09-06T17:11:23.639042",     "value": 1.0 } 
Get a Request by ID number
  • Path: GET http://localhost:3000/api/v1/requests/<insert request id here>
  • No body required
  • Example response body
{     "approvals": null,     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T17:11:23.639004",     "description": "test description a",     "finalized": false,     "id": 2,     "image": "request.jpg",     "recipient": "1",     "updated_at": "2020-09-06T17:11:23.639042",     "value": 1.0 } 
Get all Requests
  • Path GET http://localhost:3000/api/v1/requests
  • No body required
  • Example response body
[     {         "approvals": 1,         "approved": false,         "campaign_id": 1,         "created_at": "2020-09-05T20:41:47.774790",         "description": "test description",         "finalized": false,         "id": 1,         "image": "test.jpg",         "recipient": "1",         "updated_at": "2020-09-05T20:41:47.774800",         "value": 1.0     },     {         "approvals": null,         "approved": false,         "campaign_id": 1,         "created_at": "2020-09-06T17:11:23.639004",         "description": "test description a",         "finalized": false,         "id": 2,         "image": "request.jpg",         "recipient": "1",         "updated_at": "2020-09-06T17:11:23.639042",         "value": 1.0     } ] 
Update a Request by ID number
  • Path: PUT http://localhost:3000/api/v1/requests/<insert request id here>
  • Example JSON put body
{     "description": "better description",     "image": "better_image.jpg",     "approvals": "5" } 
  • Example response body
{     "approvals": "5",     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T17:11:23.639004",     "description": "better description",     "finalized": false,     "id": 2,     "image": "better_image.jpg",     "recipient": "1",     "updated_at": "2020-09-06T17:11:47.639042",     "value": 1.0 } 
Delete a Request by ID number
  • Path: DELETE http://localhost:3000/api/v1/requests/<insert request id here>
  • No body required
  • Example response body
{     "approvals": null,     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T18:05:01.891894",     "description": "test description b",     "finalized": false,     "id": 3,     "image": "request_b.jpg",     "recipient": "1",     "updated_at": "2020-09-06T18:05:01.891901",     "value": 2.0 } 
Convert Wei to USD
  • Path: GET http://localhost:3000/api/v1/price_converter?wei={wei_amount}
  • Requires query params with a key of ‘wei’ and value of the amount of wei to be converter
  • No body required
  • Example response
{     "USD": 357 } 
Add a Contributor to a Campaign
  • Path: POST http://localhost:3000/api/v1/campaigns/<campaign_address>/contributor/<contributor_address>
  • No body required
  • Example response body
{     "address": "Hf84jhGE9fdjF9ehfdse45",     "created_at": "2020-09-06T18:41:57.156262",     "description": "Need help serving community",     "expiration": "2020-10-25T00:00:00",     "id": 16,     "image": "https://picsum.photos/200/300",     "manager": "LJHhf82u3hr0d9uhUg4g",     "min_contribution": 1.5,     "name": "Market St. Soup Kitchen",     "requests": [         {             "approvals": 0,             "approved": false,             "campaign_id": 16,             "created_at": "2020-09-06T18:41:57.238755",             "description": "Cleaning supplies",             "eth_id": null,             "finalized": false,             "id": 15,             "image": "https://picsum.photos/200/300",             "recipient": "jhF97hdfha97",             "updated_at": "2020-09-06T18:41:57.238757",             "value": 25.0         }     ],     "updated_at": "2020-09-06T18:41:57.156266",     "upvote": 50,     "value": null } 
View Campaigns by Contributor Address
  • Path: GET http://localhost:3000/api/v1/contributor/<contributor_address>/campaigns
  • No body required
  • Example response body
[     {         "address": "Hf84jhGE9fdjF9ehfdse45",         "created_at": "2020-09-06T18:41:57.156262",         "description": "Need help serving community",         "expiration": "2020-10-25T00:00:00",         "id": 16,         "image": "https://picsum.photos/200/300",         "manager": "LJHhf82u3hr0d9uhUg4g",         "min_contribution": 1.5,         "name": "Market St. Soup Kitchen",         "requests": [             {                 "approvals": 0,                 "approved": false,                 "campaign_id": 16,                 "created_at": "2020-09-06T18:41:57.238755",                 "description": "Cleaning supplies",                 "eth_id": null,                 "finalized": false,                 "id": 15,                 "image": "https://picsum.photos/200/300",                 "recipient": "jhF97hdfha97",                 "updated_at": "2020-09-06T18:41:57.238757",                 "value": 25.0             }         ],         "updated_at": "2020-09-06T18:41:57.156266",         "upvote": 50,         "value": null     },     {         "address": "DFjh489GD74hgls8",         "created_at": "2020-09-06T18:41:57.156312",         "description": "Serving communities hit hard by Covid19",         "expiration": "2020-10-25T00:00:00",         "id": 17,         "image": "https://picsum.photos/200/300",         "manager": "jhF8dfh4jjgfdkjs45",         "min_contribution": 1.5,         "name": "Arc Thrift",         "requests": [],         "updated_at": "2020-09-06T18:41:57.156322",         "upvote": 50,         "value": null     } ] 

Etho Boost-一个构建在Etherium上的众筹应用程序

设置

数据库设置

数据库更新

API端点

活动

请求

  • 设置
  • 数据库设置
  • 设定数据库
  • 更新数据库
  • API端点
  • 在您的计算机上安装Python、Pipenv和Postgres,如果您还没有在Mac上安装Pipenv,可以运行$brew Install Pipenv
  • 您应该有Python 3.8.5
  • 您应该有Postgres
  • 您应该有Pipenv
  • Fork然后克隆存储库
  • 进入目录$cd eth_crowdfund_be
  • 您将需要在虚拟环境中工作。为什么?使用Python项目的虚拟环境可以让我们拥有Python的独立工作副本,这样我们就可以处理特定的项目,而不必担心会影响其他项目。
  • 在根目录中:
    a.运行#pipenv–three创建虚拟环境
    c.运行$pipenv install安装所有依赖项
    d.运行$createdb eth_crowdfund_api_db创建应用数据库
    e.运行$createdb eth_crowdfund_api_db_test创建测试数据库
    f.运行$touch.env创建在.env文件中为flask environment、数据库url和localhost端口添加适当的环境值
  • 运行以下命令激活项目虚拟环境。完成项目工作后,应执行$exit退出虚拟环境
  • 在浏览器中导航到http://localhost:3000/并且您应该看到Etherium for life
  • 要停止服务器,请按ctrl+c
  • 运行
  • 您可以通过运行
  • 退出数据库,$exit来检查数据库
  • 确保您在/eth_crowdfund_be
  • 运行$python3管理.pyseed
  • 用$python3启动服务器运行.py
  • 访问本地主机:3000/api/v1/campaigns以及本地主机:3000/api/v1/requests你应该看到种子活动和请求。
  • 注意:如果遇到任何根错误,例如ERROR[root]ERROR:目标数据库不是最新的。或者ERROR[root]ERROR:Relative revision-1没有生成1个迁移,请运行$python3管理.pydb stamp head将目标数据库重置为当前数据库头。
  • 路径:POSThttp://localhost:3000/api/v1/campaings/
  • 示例JSON post body:
  • 示例响应正文:
  • 路径:GEThttp://localhost:3000/api/v1/campaigns/&lt;在此处插入活动id&gt;
  • 不需要正文
  • 示例响应体
  • 路径:GEThttp://localhost:3000/api/v1/campaigns
  • 无需正文
  • 示例响应正文
  • 路径:PUThttp://localhost:3000/api/v1/campaigns/&lt;在此处插入活动id&gt;
  • 示例JSON put body
  • 示例响应体
  • 路径:DELETEhttp://localhost:3000/api/v1/campaigns/&lt;在此处插入活动id&gt;
  • 不需要正文
  • 示例响应正文
  • 路径公告http://localhost:3000/api/v1/requests/
  • 示例JSON post body。活动标识、值和收件人是必需的。
  • 示例响应体
  • 路径:GEThttp://localhost:3000/api/v1/请求/&lt;在此处插入请求id&gt;
  • 不需要正文
  • 示例响应体
  • 路径GEThttp://localhost:3000/api/v1/requests
  • 不需要主体
  • 示例响应体
  • 路径:PUThttp://localhost:3000/api/v1/requests/&lt;在此处插入请求id&gt;
  • 示例JSON put body
  • 示例响应正文
  • 路径:删除http://localhost:3000/api/v1/requests/&lt;在此处插入请求id&gt;
  • 不需要正文
  • 示例响应正文
  • 路径:GEThttp://localhost:3000/api/v1/价格转换器?wei={wei_amount}
  • 需要关键字为“wei”的查询参数和要转换的wei数量的值
  • 不需要正文
  • 示例响应
  • 路径:POSThttp://localhost:3000/api/v1/campaigns/&lt;campaignu address&gt;/contributor/&lt;contributoru address&gt;
  • 不需要正文
  • 示例响应体
  • 路径:GEThttp://localhost:3000/api/v1/contributor/&lt;contributoru address&gt;/campaigns
  • 不需要正文
  • 示例响应正文
    • 设置
    • 数据库设置
    • 设定数据库
    • 更新数据库
    • API端点

    设置

    App Setup Instructions
    1. 在您的计算机上安装Python、Pipenv和Postgres,如果您还没有在Mac上安装Pipenv,可以运行$brew Install Pipenv
    • 您应该有Python 3.8.5
    1. 您应该有Postgres
    $ python3 --version => Python 3.8.5 
    1. 您应该有Pipenv
    $ which psql => /Applications/Postgres.app/Contents/Versions/latest/bin/psql 
    1. Fork然后克隆存储库
    $ pipenv --version => pipenv, version 2020.8.13 
    1. 进入目录$cd eth_crowdfund_be
    2. 您将需要在虚拟环境中工作。为什么?使用Python项目的虚拟环境可以让我们拥有Python的独立工作副本,这样我们就可以处理特定的项目,而不必担心会影响其他项目。
    3. 在根目录中:
      a.运行#pipenv–three创建虚拟环境
      c.运行$pipenv install安装所有依赖项
      d.运行$createdb eth_crowdfund_api_db创建应用数据库
      e.运行$createdb eth_crowdfund_api_db_test创建测试数据库
      f.运行$touch.env创建在.env文件中为flask environment、数据库url和localhost端口添加适当的环境值
    4. 运行以下命令激活项目虚拟环境。完成项目工作后,应执行$exit退出虚拟环境
     FLASK_ENV=development  SQLALCHEMY_DATABASE_URI="postgresql://postgres:password@localhost/eth_crowdfund_api_db"  SQLALCHEMY_TEST_DATABASE_URI="postgresql://postgres:password@localhost/eth_crowdfund_api_db_test"  PORT=3000 
    1. 在浏览器中导航到http://localhost:3000/并且您应该看到Etherium for life
    $ pipenv shell    $ python3 run.py =>  * Serving Flask app "src.app" (lazy loading)     * Environment: development     * Debug mode: on     * Running on http://127.0.0.1:3000/ (Press CTRL+C to quit)     * Restarting with stat        /Users/username/.local/share/virtualenvs/eth_crowdfund_be-TvIDdz62/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py:833: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future.  Set it to True or False to suppress this warning.        warnings.warn(FSADeprecationWarning(     * Debugger is active!     * Debugger PIN: 312-766-617   
    1. 要停止服务器,请按ctrl+c
    2. 运行

    数据库设置

    Database Setup Instructions

    Path: `eth_crowdfund_be`

    1. 您可以通过运行
    $ python3 manage.py db stamp head $ python3 manage.py db init $ python3 manage.py db migrate $ python3 manage.py db upgrade 
    1. 退出数据库,$exit来检查数据库
    $ psql $ c eth_crowdfund_api_db $ dt => List of relations    Schema |      Name       | Type  |  Owner    --------+-----------------+-------+----------    public | alembic_version | table | postgres    public | campaigns       | table | postgres    public | requests        | table | postgres  $ SELECT * FROM campaigns; => id | name | description | image | manager | contributors | upvote | min_contribution | address | expiration | created_at | updated_at   ----+------+-------------+-------+---------+--------------+--------+------------------+---------+------------+------------+------------  $ SELECT * FROM requests; => id | campaign_id | description | image | value | recipient | approved | finalized | approvals | created_at | updated_at   ----+-------------+-------------+-------+-------+-----------+----------+-----------+-----------+------------+------------ 
    1. 确保您在/eth_crowdfund_be

    数据库更新

    Database Seeding Instructions

    Within the `pipenv shell` virtual environment, run the following:

    1. 运行$python3管理.pyseed
    2. 用$python3启动服务器运行.py
    3. 访问本地主机:3000/api/v1/campaigns以及本地主机:3000/api/v1/requests你应该看到种子活动和请求。
    4. 注意:如果遇到任何根错误,例如ERROR[root]ERROR:目标数据库不是最新的。或者ERROR[root]ERROR:Relative revision-1没有生成1个迁移,请运行$python3管理.pydb stamp head将目标数据库重置为当前数据库头。

    API端点

    Updating the Database Instructions

    路径:/eth_crowdfund_be
    更新数据库并运行新的迁移,运行以下操作:

     $ python3 manage.py db stamp head  $ python3 manage.py db init  $ python3 manage.py db migrate  $ python3 manage.py db upgrade 
    • 路径:POSThttp://localhost:3000/api/v1/campaings/

    活动

    请求

    Create a campaign
    • 示例JSON post body:
    • 示例响应正文:
    {     "name": "Test Campaign",     "description": "test description",     "image": "test.jpg",     "contributors": "1",     "upvote": "2",     "manager": "3",     "address": "1",     "min_contribution": 5.0 } 
    • 路径:GEThttp://localhost:3000/api/v1/campaigns/&lt;在此处插入活动id&gt;
    {     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description",     "expiration": null,     "id": 1,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Test Campaign",     "requests": [],     "updated_at": "2020-09-06T15:49:49.445158",     "upvote": 2 } 
    Get a Campaign by ID number
    • 不需要正文
    • 示例响应体
    • 路径:GEThttp://localhost:3000/api/v1/campaigns
    {     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description",     "expiration": null,     "id": 4,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Test Campaign",     "requests": [],     "updated_at": "2020-09-06T15:49:49.445158",     "upvote": 2 } 
    Get all Campaigns
    • 无需正文
    • 示例响应正文
    • 路径:PUThttp://localhost:3000/api/v1/campaigns/&lt;在此处插入活动id&gt;
    [     {         "address": "4",         "contributors": 1,         "created_at": "2020-09-05T20:31:17.196051",         "description": "test description",         "expiration": null,         "id": 1,         "image": "test.jpg",         "manager": "3",         "min_contribution": 5.0,         "name": "Test Campaign",         "requests": [             {                 "approvals": 1,                 "approved": false,                 "campaign_id": 1,                 "created_at": "2020-09-05T20:41:47.774790",                 "description": "test description",                 "finalized": false,                 "id": 1,                 "image": "test.jpg",                 "recipient": "1",                 "updated_at": "2020-09-05T20:41:47.774800",                 "value": 1.0             }         ],         "updated_at": "2020-09-05T20:31:17.196090",         "upvote": 2     },     {         "address": "2",         "contributors": 2,         "created_at": "2020-09-06T16:59:05.367795",         "description": "test description b",         "expiration": null,         "id": 5,         "image": "test_b.jpg",         "manager": "1",         "min_contribution": 5.0,         "name": "Test Campaign B",         "requests": [],         "updated_at": "2020-09-06T16:59:05.367801",         "upvote": 5     } ] 
    Update a Campaign by ID number
    • 示例JSON put body
    • 示例响应体
    {     "description": "test description updated",     "name": "Better Name Campaign",     "upvote": 4 } 
    • 路径:DELETEhttp://localhost:3000/api/v1/campaigns/&lt;在此处插入活动id&gt;
    {     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description updated",     "expiration": null,     "id": 4,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Better Name Campaign",     "requests": [],     "updated_at": "2020-09-06T16:48:19.902997",     "upvote": 4 } 
    Delete a Campaign by ID number
    • 不需要正文
    • 示例响应正文
    • 路径公告http://localhost:3000/api/v1/requests/
    {     "address": "1",     "contributors": 1,     "created_at": "2020-09-06T15:49:49.445152",     "description": "test description updated",     "expiration": null,     "id": 4,     "image": "test.jpg",     "manager": "3",     "min_contribution": 5.0,     "name": "Better Name Campaign",     "requests": [],     "updated_at": "2020-09-06T16:48:19.902997",     "upvote": 4 } 

    Requests

    Create a Request
    • 示例JSON post body。活动标识、值和收件人是必需的。
    • 示例响应体
    {     "campaign_id": "1",     "description": "test description a",     "image": "request.jpg",     "value": 1.0,     "recipient": "1" } 
    • 路径:GEThttp://localhost:3000/api/v1/请求/&lt;在此处插入请求id&gt;
    {     "approvals": null,     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T17:11:23.639004",     "description": "test description a",     "finalized": false,     "id": 2,     "image": "request.jpg",     "recipient": "1",     "updated_at": "2020-09-06T17:11:23.639042",     "value": 1.0 } 
    Get a Request by ID number
    • 不需要正文
    • 示例响应体
    • 路径GEThttp://localhost:3000/api/v1/requests
    {     "approvals": null,     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T17:11:23.639004",     "description": "test description a",     "finalized": false,     "id": 2,     "image": "request.jpg",     "recipient": "1",     "updated_at": "2020-09-06T17:11:23.639042",     "value": 1.0 } 
    Get all Requests
    • 不需要主体
    • 示例响应体
    • 路径:PUThttp://localhost:3000/api/v1/requests/&lt;在此处插入请求id&gt;
    [     {         "approvals": 1,         "approved": false,         "campaign_id": 1,         "created_at": "2020-09-05T20:41:47.774790",         "description": "test description",         "finalized": false,         "id": 1,         "image": "test.jpg",         "recipient": "1",         "updated_at": "2020-09-05T20:41:47.774800",         "value": 1.0     },     {         "approvals": null,         "approved": false,         "campaign_id": 1,         "created_at": "2020-09-06T17:11:23.639004",         "description": "test description a",         "finalized": false,         "id": 2,         "image": "request.jpg",         "recipient": "1",         "updated_at": "2020-09-06T17:11:23.639042",         "value": 1.0     } ] 
    Update a Request by ID number
    • 示例JSON put body
    • 示例响应正文
    {     "description": "better description",     "image": "better_image.jpg",     "approvals": "5" } 
    • 路径:删除http://localhost:3000/api/v1/requests/&lt;在此处插入请求id&gt;
    {     "approvals": "5",     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T17:11:23.639004",     "description": "better description",     "finalized": false,     "id": 2,     "image": "better_image.jpg",     "recipient": "1",     "updated_at": "2020-09-06T17:11:47.639042",     "value": 1.0 } 
    Delete a Request by ID number
    • 不需要正文
    • 示例响应正文
    • 路径:GEThttp://localhost:3000/api/v1/价格转换器?wei={wei_amount}
    {     "approvals": null,     "approved": false,     "campaign_id": 1,     "created_at": "2020-09-06T18:05:01.891894",     "description": "test description b",     "finalized": false,     "id": 3,     "image": "request_b.jpg",     "recipient": "1",     "updated_at": "2020-09-06T18:05:01.891901",     "value": 2.0 } 
    Convert Wei to USD
    • 需要关键字为“wei”的查询参数和要转换的wei数量的值
    • 不需要正文
    • 示例响应
    • 路径:POSThttp://localhost:3000/api/v1/campaigns/&lt;campaignu address&gt;/contributor/&lt;contributoru address&gt;
    {     "USD": 357 } 
    Add a Contributor to a Campaign
    • 不需要正文
    • 示例响应体
    • 路径:GEThttp://localhost:3000/api/v1/contributor/&lt;contributoru address&gt;/campaigns
    {     "address": "Hf84jhGE9fdjF9ehfdse45",     "created_at": "2020-09-06T18:41:57.156262",     "description": "Need help serving community",     "expiration": "2020-10-25T00:00:00",     "id": 16,     "image": "https://picsum.photos/200/300",     "manager": "LJHhf82u3hr0d9uhUg4g",     "min_contribution": 1.5,     "name": "Market St. Soup Kitchen",     "requests": [         {             "approvals": 0,             "approved": false,             "campaign_id": 16,             "created_at": "2020-09-06T18:41:57.238755",             "description": "Cleaning supplies",             "eth_id": null,             "finalized": false,             "id": 15,             "image": "https://picsum.photos/200/300",             "recipient": "jhF97hdfha97",             "updated_at": "2020-09-06T18:41:57.238757",             "value": 25.0         }     ],     "updated_at": "2020-09-06T18:41:57.156266",     "upvote": 50,     "value": null } 
    View Campaigns by Contributor Address
    • 不需要正文
    • 示例响应正文
    • Example response body
    [     {         "address": "Hf84jhGE9fdjF9ehfdse45",         "created_at": "2020-09-06T18:41:57.156262",         "description": "Need help serving community",         "expiration": "2020-10-25T00:00:00",         "id": 16,         "image": "https://picsum.photos/200/300",         "manager": "LJHhf82u3hr0d9uhUg4g",         "min_contribution": 1.5,         "name": "Market St. Soup Kitchen",         "requests": [             {                 "approvals": 0,                 "approved": false,                 "campaign_id": 16,                 "created_at": "2020-09-06T18:41:57.238755",                 "description": "Cleaning supplies",                 "eth_id": null,                 "finalized": false,                 "id": 15,                 "image": "https://picsum.photos/200/300",                 "recipient": "jhF97hdfha97",                 "updated_at": "2020-09-06T18:41:57.238757",                 "value": 25.0             }         ],         "updated_at": "2020-09-06T18:41:57.156266",         "upvote": 50,         "value": null     },     {         "address": "DFjh489GD74hgls8",         "created_at": "2020-09-06T18:41:57.156312",         "description": "Serving communities hit hard by Covid19",         "expiration": "2020-10-25T00:00:00",         "id": 17,         "image": "https://picsum.photos/200/300",         "manager": "jhF8dfh4jjgfdkjs45",         "min_contribution": 1.5,         "name": "Arc Thrift",         "requests": [],         "updated_at": "2020-09-06T18:41:57.156322",         "upvote": 50,         "value": null     } ] 

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

    www.interchains.cc

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

    区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
    区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Etho Boost – A crowdfund app built on Etherium – Etho Boost-一款基于Etherium的众筹应用程序

    提供最优质的资源集合

    立即查看 了解详情