This repository includes a dApp example of an auction. Users can bid for the items in the auction contract by using a sponsored-transaction-enabled token as a payment method (no CCD required in the user's wallet). The project has a front end and a back end.
Clone the root repo with the following command:
git clone --recurse-submodules [email protected]:Concordium/concordium-dapp-examples.git
or
git clone --recurse-submodules https://github.com/Concordium/concordium-dapp-examples.git
To set up the project locally, complete the steps in the README.md
file in the sponsoredTransactionsAuction/frontend
folder and then complete the steps in the README.md
file in the sponsoredTransactionsAuction/backend
folder.
Alternatively, follow the steps to deploy the docker container below. This docker container will set up the frontend as well as the backend.
Run the dockerfile from the repository's root folder with the command:
docker build -t sponsored_transactions -f sponsoredTransactionsAuction/Dockerfile .
Add your ACCOUNT_KEY_FILE
to the repository's root folder and run the image with the command:
docker run -p 8080:8080 --mount type=bind,source="$(pwd)"/<ACCOUNT_KEY_FILE>,target=/KEY,readonly -e ACCOUNT_KEY_FILE="/KEY" -e PORT=<PORT> -e NODE=<NODE> -e LOG_LEVEL=<LOG_LEVEL> -e CIS2_TOKEN_CONTRACT_INDEX=<CONTRACT_INDEX> -e AUCTION_CONTRACT_INDEX=<CONTRACT_INDEX> sponsored_transactions
e.g.
docker run -p 8080:8080 --mount type=bind,source="$(pwd)"/4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export,target=/KEY,readonly -e ACCOUNT_KEY_FILE=/KEY -e PORT=8080 -e NODE=http://node.testnet.concordium.com:20000 -e LOG_LEVEL=debug -e CIS2_TOKEN_CONTRACT_INDEX=7723 -e AUCTION_CONTRACT_INDEX=7724 sponsored_transactions
Note: To get your ACCOUNT_KEY_FILE
(the 4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export
file), export it from the Concordium Browser Wallet for Web. This account should be only used for this service. No transactions should be sent from the account by any other means to ensure the account nonce is tracked
correctly in the service (e.g. don't use the 4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX
account in the browser wallet to send transactions via the front end).
Note: Use the same smart contract indices for the frontend and backend. In other words, use the smart contract indices from the ./frontend/package.json
file when running the image.
You can find an associated tutorial on the developer documentation.