项目作者: sayak119

项目描述 :
Ad-Chain
高级语言: JavaScript
项目地址: git://github.com/sayak119/Ad-Chain.git
创建时间: 2019-04-26T16:51:15Z
项目社区:https://github.com/sayak119/Ad-Chain

开源协议:MIT License

下载


Ad-Chain

What is it?

Affiliation based advertisement is approximately a $8 billion industry and using Ad-Chain, we now have the ability to make better, faster and smoother for everyone involved with it. Using Ad-Chain we bring transparency, less hassle, on time payment and satisfaction to this process and make it smooth.

How does it help us?

  • Miscommunication and lack of transparency and information between Affiliators and Sellers affects cash flow in the system.
  • Long verification process for user transactions. It might take 90 days to 120 days.
  • Huge commissions taken by middle men.
  • Payment delays which may be upto 3 months.

How does it work?

Advertiser join the network and create a Smart Contract for an offer. Offer details are stored in IPFS with HASH of offer data in the contract as a transaction Publishers join the network and browse available offers from Advertisers and accept offers and join the Smart Contract. Each Smart Contract will have a set of Publishers who accepted T&C of the offer. Publisher place the offers on their website. Consumers go to the publisher website and click on the offer. Click is tracked as transaction in the Smart Contract with detail data stored in IPFS and consumer is redirected to offer URL. Consumer completes the required action at the redirected Advertiser offer URL. Advertiser confirms the offer conversion as a transaction on the Smart Contract and store the conversion data in the IPFS.

Step by step working can also be seen here.

Setup

  • Node should be installed
  1. node -v
  2. v10.13.0
  • truffle should be installed

    npm install -g truffle

Deploy Contracts to Local Blockchain

Steps:

  1. Compiling ./contracts/Advertiser.sol...
  2. Compiling ./contracts/Publisher.sol...
  3. Writing artifacts to ./client/src/contracts
  • Migrate Contract to Ganache

    truffle migrate or truffle migrate —reset

  1. truffle migrate --reset
  2. Using network 'development'.
  3. Running migration: 1_initial_migration.js
  4. Replacing Migrations...
  5. ... 0x03c8940b3fe9bf3956ea067b995d7e9cf7cb89ff9124d4c416fc598f5067229a
  6. Migrations: 0xc7aacf4a1ae41a3988ae7acd52bf772a5c94285d
  7. Saving successful migration to network...
  8. ... 0x43507196c690c0f359c402c2830460bfda0f6c7e56f07655bed416f2e9663eba
  9. Saving artifacts...
  10. Running migration: 2_deploy_contracts.js
  11. Replacing AdvertiserFactory...
  12. ... 0xea6b5e2eedad908d7a0466010acebc134ded79fddf4d49cf8ab4359e2dd9b580
  13. AdvertiserFactory: 0xf7a942c4143d68c35f8ba75ef447eb06c2ff63aa
  14. Replacing PublisherFactory...
  15. ... 0xcfd1c0e10c0b95d93de18563c5676a4fd7e6708283b85a415c88561cb5c27f43
  16. PublisherFactory: 0xbea049b2084b8247383fd8c292a8601cc22fe99f
  17. Saving successful migration to network...
  18. ... 0x5ac018dcfb58dd25d39aba9a42efb01304750b1485f70466de44ea39576a53de
  19. Saving artifacts...
  • Test Using Local Frontend
    Go inside “client” folder

    npm run start

  • Create frontend build for production.
    Go inside “client” folder

    npm run build

  1. Creating an optimized production build...
  2. Compiled with warnings.
  3. File sizes after gzip:
  4. 416.65 KB build/static/js/1.500508f5.chunk.js
  5. 112.27 KB build/static/js/main.af02dad2.chunk.js
  6. 4 KB build/static/css/main.ae258b2e.chunk.css
  7. 1.61 KB build/static/css/1.b00b63d5.chunk.css
  8. 763 B build/static/js/runtime~main.229c360f.js
  9. The project was built assuming it is hosted at the server root.
  10. You can control this with the homepage field in your package.json.
  11. For example, add this to build it for GitHub Pages:
  12. "homepage" : "http://myname.github.io/myapp",
  13. The build folder is ready to be deployed.
  14. You may serve it with a static server:
  15. yarn global add serve
  16. serve -s build
  17. Find out more about deployment here:
  18. http://bit.ly/CRA-deploy

Flow

Advertiser creation and Offer creation

  1. Go to localhost:3000/advertiser
  • Advertiser Signup
  1. Create a profile for advertiser using MetaMask.

alt text

alt text

  • Offer Creation
    1. Create an offer with filling up needed information.
    alt text

alt text

Publisher creation and Offer registration

  1. Go to localhost:3000/publisher
  • Publisher Signup
  1. Create a profile for publisher using MetaMask preferably different account
  2. from advertisers just for simplicity sake.

alt text

alt text

  • Offer Registration
    1. Register to an existing offer listed out in the all offers sections,
    2. where there will be a collection of offers from all the advertisers.
    alt text

alt text

Click Generation

  1. Ideally this click generation has to be organised from Publisher Back-end,
  2. but for time being and easy demo, we are creating it from the publisher page.
  3. Just fill in the details and submit the form.

alt text

alt text

Conversion Generation

  1. Ideally this too has to be done from Advertiser Back-end which for the
  2. time being we skipped. Here you will provide the UI with Publisher Contract Address
  3. and Click Id which you just generated in the previous step and there you go
  4. with the conversion.

alt text

alt text