1

Is it possible to write a Solana program that automatically interacts with the Solana chain whenever something happens?

A simple example would be: Whenever a dex such as Orca swaps USDC for SOL at a price of X, I want to also swap USDC for SOL. Basically the pseudocode is:

0 - Run program...

1 - Program continuously listens to Orca USDC-SOL pool...

2 - Program buys when last Orca price is below $X

Is it possible to have that program run? From the docs, it says that a client has to interact with a program in order for it to run... but can that interaction just be step 0? (Running the program)

1 Answer 1

1

At the moment this is not possible natively. See this proposal.

However, you have some options:

  • You could setup a server to listen to changes on an account you care about and then submit transactions yourself.
  • You can also setup a validator and pipe out data from it using geyser. This would give you a firehouse of data that you can make decisions on.
  • Another approach is to build a crank mechanism into your program and incentivize others to pull the crank. Lots of programs do this, you might even be able to build on top of one.
  • Check out https://www.cronos.so/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.