Git Product home page Git Product logo

clockwork's Introduction

Clockwork

Automation engine for the Solana blockchain

code scan Discord Chat License

Deployments

Program Address Devnet Testnet Mainnet Beta
Network 7dgApA7ixgamh8TRJDVqhsPVDxn4RVQgW93xgcSqpzWQ v0.2.0 Soon Soon
Scheduler 7XgnJEERdx6SXiXbv1TqSe1XCYCa81BVC5UYRA1mnN1o v0.2.0 Soon Soon

Notes

  • Clockwork is under active development. All interfaces and implementations are subject to change.
  • Smart contracts are automatically scanned by Sec3's auto-auditing software, but have not been reviewed by a paid auditing firm.
  • Use at your own risk.

Getting started

Download the source code:

git clone https://github.com/clockwork-xyz/clockwork
cd clockwork

The main branch is under active development and subject to bugs. To work with a stable version, checkout a release branch:

git checkout tags/v1.0.2

Build the repo:

./scripts/build-all.sh .
export PATH=$PWD/bin:$PATH

Start a local node for development:

clockwork localnet

To stream program logs:

solana logs --url localhost

Deploying a worker

To run the Clockwork plugin on your Solana validator, you can either build from scratch (shown above) or install the pre-built binary:

curl -s https://api.github.com/repos/clockwork-xyz/clockwork/releases/latest | grep "clockwork-geyser-plugin-release-x86_64-unknown-linux-gnu.tar" | cut -d : -f 2,3 | tr -d \" | wget -qi -
tar -xjvf clockwork-geyser-plugin-release-x86_64-unknown-linux-gnu.tar.bz2
rm clockwork-geyser-plugin-release-x86_64-unknown-linux-gnu.tar.bz2

Next, create a new keypair for signing Clockwork txs. Load this keypair with a small amount of SOL (~0.01 โ—Ž). You will be compensated for lamports spent by the tasks your worker executes. Automation fees (rewards) are implemented and will soon be enabled.

solana-keygen new -o clockwork-worker-keypair.json

Then, setup the plugin config file in a folder where your validator startup script can reference it. Note, the libpath and keypath values should point to the binary and keypair mentioned in the steps above.

{
  "libpath": "/home/sol/clockwork-geyser-plugin-release/lib/libclockwork_plugin.so",
  "keypath": "/home/sol/clockwork-worker-keypair.json",
  "rpc_url": "http://127.0.0.1:8899",
  "slot_timeout_threshold": 150,
  "worker_threads": 10
}

Finally, add an additional line to your startup script to run your validator with the Clockwork plugin (often located at /home/sol/bin/validator.sh):

#!/bin/bash

exec solana-validator \
    --identity /home/sol/validator-keypair.json \
    --known-validator dv1ZAGvdsz5hHLwWXsVnM94hWf1pjbKVau1QVkaMJ92 \
    --known-validator dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV \
    --known-validator dv4ACNkpYPcE3aKmYDqZm9G5EB3J4MRoeE7WNDRBVJB \
    --known-validator dv3qDFk1DTF36Z62bNvrCXe9sKATA6xvVy6A798xxAS \
    --only-known-rpc \
    --full-rpc-api \
    --no-voting \
    --ledger /mnt/ledger \
    --accounts /mnt/accounts \
    --log /home/sol/solana-rpc.log \
    --rpc-port 8899 \
    --rpc-bind-address 0.0.0.0 \
    --dynamic-port-range 8000-8020 \
    --entrypoint entrypoint.devnet.solana.com:8001 \
    --entrypoint entrypoint2.devnet.solana.com:8001 \
    --entrypoint entrypoint3.devnet.solana.com:8001 \
    --entrypoint entrypoint4.devnet.solana.com:8001 \
    --entrypoint entrypoint5.devnet.solana.com:8001 \
    --expected-genesis-hash EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG \
    --wal-recovery-mode skip_any_corrupted_record \
    --limit-ledger-size \
    
    # Add this line! ๐Ÿ‘‡๐Ÿผ
    --geyser-plugin-config /home/sol/geyser-plugin-config.json

Now simply restart your validator however you normally would!

clockwork's People

Contributors

eliascm17 avatar zslayton avatar nickgarfield avatar koenichiwa avatar rasreee avatar nickelc avatar adeschamps avatar elbe0046 avatar mehcode avatar sebest avatar william20111 avatar atouchet avatar deankarn avatar dsander avatar hgzimmerman avatar lholden avatar bittrance avatar rtyler avatar bstrie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.