Skip to content

Decentralized Cryptocurrency Payment Gateway built with AI Agents

License

Notifications You must be signed in to change notification settings

miladtsx/dcpay-DEMO

 
 

Repository files navigation

DCPay

image

DCPay is a decentralized cryptocurrency payment gateway that enables businesses to accept crypto payments securely and independently. Built on the OLAS stack, it leverages decentralization and consensus to ensure reliability and trust, with payment records stored on IPFS for long-term accessibility and security. more details.

OLAS Functionalities Used

  • Decentralized Consensus based decision making
  • API
  • IPFS

Rounds

  • CollectInvoicesRound Read Invoices [API] For Demo, read invoices from a json file. If no Invoice exists, wait for 10s and try again.
  • DecisionMakingRound Monitor Invoice Settlement On-Chain [API] Keep Settled Invoices Records on [IPFS]
  • SelectKeeperRound Select a keepr to invoke the webhook
  • ConfirmationRound Confirm Settlement via Webhook [API]
  • Reset and Start Again

Flow

image image image image image

TODO

  • Read Invoices from Remote API
  • Select Keeper Randomly [DRAND]
  • Setup local DB to facilitate Admin Dashboard
  • Call Remote Webhook

System requirements

Run you own agent

Get the code

  1. Clone this repo:

    git clone --depth 1 https://github.com/miladtsx/academy-learning-agent-service
    
    
  2. Create the virtual environment:

    cd academy-learning-service
    poetry shell
    poetry install
    
  3. Sync packages:

    autonomy packages sync --update-packages
    

Prepare the data

  1. Prepare a keys.json file containing wallet address and the private key for each of the four agents.

    autonomy generate-key ethereum -n 4
    
  2. Prepare a ethereum_private_key.txt file containing one of the private keys from keys.json. Ensure that there is no newline at the end.

  3. Create a Tenderly account and from your dashboard create a fork of ETHEREUM chain (virtual testnet).

  4. From Tenderly, fund your agents and Safe with some ETH and USDC (0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48).

  5. Make a copy of the env file:

    cp sample.env .env
    
  6. Fill in the required environment variables in .env. These variables are:

  • ALL_PARTICIPANTS: a list of your agent addresses. This will vary depending on whether you are running a single agent (run_agent.sh script) or the whole 4-agent service (run_service.sh)
  • GNOSIS_LEDGER_RPC: set it to your Tenderly fork Admin RPC.

Run a single agent locally

  1. Verify that ALL_PARTICIPANTS in .env contains only 1 address.

  2. Run the agent:

    bash run_agent.sh
    

Run the service (4 agents) via Docker Compose deployment

  1. Verify that ALL_PARTICIPANTS in .env contains 4 address.

  2. Check that Docker is running:

    docker
    
  3. Run the service:

    bash run_service.sh
    
  4. Look at the service logs for one of the agents (on another terminal):

    docker logs -f learningservice_abci_0
    

About

Decentralized Cryptocurrency Payment Gateway built with AI Agents

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Languages

  • Python 94.6%
  • Makefile 2.8%
  • Shell 2.6%