• Stars
    star
    164
  • Rank 230,032 (Top 5 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created almost 3 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Octane is a gasless transaction relayer for Solana.

Octane

  1. What is Octane?
  2. How does it work?
  3. Getting started
  4. Security
  5. Contributing

What is Octane?

Octane is a gasless transaction relayer for Solana. Octane accepts transactions via an HTTP API, signs them if they satisfy certain conditions and broadcasts to the network.

It's designed for anyone to be able to run for free on Vercel as a collection of serverless Node.js API functions.

Transaction fees on Solana are very inexpensive, but users still need SOL to pay for them, and they often don't know (or forget) this.

How does it work?

Octane provides an API that lets users pay for transactions with SPL token transfers instead of native SOL.

It leverages unique properties of Solana:

  1. Transaction can have multiple signers, one of whom is the transaction fee payer. There is no single "msg.sender".

  2. Transaction can have multiple instructions interacting with different programs that are executed atomically. If one instruction fail, whole transactions fails.

  3. Each instruction refers to accounts it touches as writable or readable. It allows to validate transactions before signing.

A user creates a transaction that contains an instruction for a small token transfer to Octane, along with whatever else their transaction is supposed to do.

The user partially signs the transaction, authorizing it to make the transfer, and so it can't be modified by Octane or MITM attacks.

The user sends the serialized transaction to an Octane REST API endpoint.

Octane validates the transaction, signs it to pay the SOL, and broadcasts it on the Solana network.

When the transaction is confirmed, Octane will have been paid a fee in the token for this service.

Overview of Octane architecture

Getting started

  1. You can use Octane as a server application to deploy on a platform like Render or Vercel.
  2. You can use someone else's node. This way you don't have to support your own server and manage funds on fee payer account. However, you'll be limited by SPL tokens they offer at their price per signature.
  3. You can integrate Octane into your backend by using it as a Node.js library.

Get an overview of Octane's use cases and how to implement them in Recipes.

Setting up your own node

You can get started by following the steps in SETUP. You'll need to support a fee payer account and manage prices in config.json

Using Octane from a client app

If you already have set up an Octane node, or you are using a public endpoint from someone else, it's the time to integrate the node with your client code. Follow this guide to run your first transaction through Octane. You can also view all Octane endpoints and their parameters on this page.

Integrate it as a Node.js library

If you would like to Octane as part of your backend, learn about installation and available methods in this guide.

Managing fee payer account

If you host your own Octane node, you'll need to manage fee payer account. Octane provides a handy CLI for that: it allows to swap tokens to SOL, create accounts and generate config. Go through this guide to learn more.

Example app

octane-demo is an open source app that showcases various types of gasless transactions using Octane:

  • gasless token transfer (equivalent to any other simple transaction)
  • transaction sponsorship for authorized users, including limits and usage of octane-core
  • gasless swaps from tokens to SOL
  • just-in-time swaps to run Metaplex NFT mints and Anchor programs

Common integration scenarios

  1. For wallets: let your users pay transaction fees and associated account initialization fees with liquid SPL tokens.
  2. For wallets: let your users convert liquid SPL tokens to SOL without paying any fees in SOL.
  3. For wallets and dapps: convert tokens to SOL when a user doesn't have enough SOL to execute a transaction.
  4. For dapps and ecosystems: fully sponsor transactions for authorized users.
  5. For dapps with tokens: let your users pay transaction fees in your token.

Learn more about these use cases in Recipes.

Security

Octane operates trustlessly and is designed to be easily run by anyone in an adversarial environment.

It uses ratelimiting, transaction validation, and transaction simulation to mitigate DoS, spam, draining, and other attacks.

However, there are some risks associated with running an Octane node:

  1. Token-to-SOL price spread. Octane is configured to accept specific amounts of SPL tokens for paying fixed transaction fees in SOL. Since the token price relative to SOL can change, Octane could end up in a state where it loses money on every transaction.
  2. Draining possibilities due to Octane software bugs. Octane signs user-generated transactions with fee payer's keypair after confirming a transaction transfers fee and does not try to modify fee payer's accounts. However, if implemented checks are insufficient due to a bug, an attacker could run transaction without paying the fee or modify fee payer's accounts.

Follow these recommendations to minimize risks:

  1. Run Octane on a new separate keypair, not used in governance or within contracts as an authority.
  2. Set SPL token price for transactions with a premium relative to their real cost in SOL.
  3. Don't hold more SOL on the keypair than needed for 3-4 hours of spending on transaction fees for your load expectations. It could be as low as 0.2-1 SOL.
  4. Every hour automatically received swap tokens to SOL (Octane provides a CLI for that).
  5. Regularly check that prices and liquidity of SPL tokens allow your profitably pay for transaction fees in SOL.
  6. If your Octane node makes profit, regularly withdraw that profit to another keypair.
  7. When using Octane as a library in your backend, make sure to:
    1. Never return fee payer's signature of an unconfirmed transaction to a user. You must submit transaction to the network from the backend.
    2. Implement duplicated transaction checks, limits per user and general rate limits.

Contributing

Octane is a great way to start contributing in the Solana ecosystem. Since Octane is just an HTTP server written on Typescript, you don't have know Rust or learn how to build programs on Solana.

Some ideas for your first PRs:

  • More tests with various scenarios focused on Octane security
  • Docs, guides and example code for new people to get started with Octane
  • Add support for more exchange protocols
  • Build apps for consumers on top of Octane

Also, you can run your own Octane node and promote it among developers.

Internals

Octane is built as a monorepo with multiple packages using Lerna.

Core package provides reusable functions that process and sign transactions ("actions").

Server package is a Next.js app that runs the server using API functions. It's also responsible for parsing config.json and managing web-specific security tools (CORS and rate limits).

If you want to create a new action (for example, swap on a new protocol), you'll need to add it as an action in Core and add a new endpoint in Server that calls new action.

Octane utilizes cache for some rate limiting, but generally should be stateless.

Vision

Octane wants to make Solana easier to use by abstracting away some complexity that leads to user confusion and error.

Octane wants to enable SOL-less wallets for new users in crypto, allowing them to operate only in stablecoins.

Octane wants to become integrated with wallets, support multiple tokens with different fees, and perform atomic swaps to pay for transactions or get SOL.

Octane wants to be customizable for decentralized applications that want to sponsor their users transactions.

Octane wants to create a seamless, competitive marketplace for gasless transactions.

Octane wants to be secure, well-tested, well-documented, and easy to use.

More Repositories

1

solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.
Rust
12,934
star
2

solana-program-library

A collection of Solana programs maintained by Solana Labs
Rust
3,441
star
3

solana-web3.js

Solana JavaScript SDK
TypeScript
2,090
star
4

dapp-scaffold

Scaffolding for a dapp built on Solana
TypeScript
1,733
star
5

token-list

The community maintained Solana token registry
Go
1,470
star
6

wallet-adapter

Modular TypeScript wallet adapters and components for Solana applications.
TypeScript
1,180
star
7

solana-pay

A new standard for decentralized payments.
TypeScript
1,173
star
8

example-helloworld

Hello world on Solana
TypeScript
900
star
9

solana-season

337
star
10

break

Break Solana Game
TypeScript
300
star
11

governance-ui

TypeScript
293
star
12

explorer

Explorer for Solana clusters
TypeScript
222
star
13

chatgpt-plugin

TypeScript
179
star
14

defi-hackathon

170
star
15

ecosystem

Project files for Solana ecosystem members
153
star
16

obsolete-spl-zk-token

Obsolete - don't use
Rust
145
star
17

oyster-swap

TypeScript
121
star
18

oyster

TypeScript
115
star
19

solana-solidity.js

Compile, deploy, and use Solidity contracts on Solana
TypeScript
115
star
20

solana-accountsdb-plugin-postgres

Rust
87
star
21

solana-payments-app

Solana Pay for Commerce Platforms
TypeScript
84
star
22

solana-bigtable

Shell
77
star
23

whitepaper

Solana whitepaper LaTeX source
TeX
71
star
24

perpetuals

Solana perpetuals reference implementation
Rust
71
star
25

dexterity

Reference implementation of a decentralized exchange for custom instruments, risk, and fees
Rust
69
star
26

oyster-lending

TypeScript
66
star
27

eslint-plugin-require-extensions

JavaScript
58
star
28

governance-program-library

Rust
48
star
29

wallet-standard

TypeScript
46
star
30

security-audits

Published security audits
45
star
31

solana-perf-libs

C and CUDA libraries to enhance Solana
C
41
star
32

solana-pay-scaffold

Scaffolding for a dapp using Solana Pay
TypeScript
41
star
33

example-token

Obsoleted by https://spl.solana.com/token (Token Example)
Rust
40
star
34

example-tictactoe

Tic-Tac-Toe built on Solana
JavaScript
37
star
35

obsolete-dontuse-example-webwallet

Example Solana Web-based Wallet
JavaScript
36
star
36

browser-extension

Solana Chrome Extension
TypeScript
35
star
37

wormhole-hackathon

34
star
38

example-messagefeed

Simple message feed built on Solana
JavaScript
34
star
39

solana-ping-api

solana ping api server
Go
33
star
40

platform-tools

Shell
30
star
41

cluster

Cluster Infrastructure
Shell
27
star
42

rust-bpf-sysroot

Rust sysroot source for Berkley Packet Filter Rust programs
C
20
star
43

governance-docs

JavaScript
20
star
44

solana-labs.github.io

Organization Pages
17
star
45

wbtc

TypeScript
17
star
46

auto-emissions

Python
16
star
47

example-move

Solana example which runs a Libra Move program
JavaScript
16
star
48

launchpad

Solana launchpad reference implementation
Rust
15
star
49

solana-voib-demo

Voice over Internet & Blockchain (VoIB) demo
Rust
15
star
50

buffer-layout-utils

TypeScript utilities for using buffer-layout with Solana programs
TypeScript
14
star
51

eslint-config-solana

ESLint rules to be shared across all Solana Labs projects
JavaScript
14
star
52

token-ops

Scripts and tools for token accounting and operation
Shell
14
star
53

networkexplorer

Retired
JavaScript
13
star
54

rust-bpf-builder

Dockerfile
13
star
55

network_simulation

Python
13
star
56

sealevel

A parallel runtime for layer 1 blockchains
12
star
57

token-aggregator

Aggregates tokens listed in onchain token registry
TypeScript
12
star
58

twamm

Solana twamm reference implementation
TypeScript
12
star
59

bench-tps-dos-test

UDP and QUIC dos test for buildkite using bench-tps utility
Shell
10
star
60

governance-api

TypeScript
10
star
61

farms

Solana Farms
Rust
10
star
62

interns-codehub

Public repo for Solana interns
TypeScript
10
star
63

solminer

Cross-platform Solana Replicator UI ⛏️
JavaScript
9
star
64

dc-homedir-skeleton

Base directory struct for the `solana` user on Solana's datacenter infrastructure
Shell
9
star
65

newlib

Newlib is a C library intended for use on embedded systems.
C
9
star
66

reddit-scaling-demo

Demo for Reddit scaling
Rust
9
star
67

solana-flagged-accounts

A community-maintained registry of flagged accounts
JavaScript
8
star
68

llvm-builder

Builds customized LLVM for Solana
Dockerfile
8
star
69

ledger-app-solana

Solana app for Ledger Wallet
8
star
70

tour-de-sol

Tour de SOL
Rust
8
star
71

bridge-adapter

TypeScript
8
star
72

secure-wrap-token

Rust
8
star
73

validator-tracker

https://metrics.solana.com:3000/d/jrdi4uUWz/validator-tracker
Shell
7
star
74

oyster-margin

7
star
75

governance-ui-landing

Governance UI Landing Page - realms.today
TypeScript
7
star
76

cargo-run-solana-tests

Cargo command to compile and run BPF test
Rust
7
star
77

contributor-access-policy

This document outlines the procedure for getting contributor access to various Solana Labs source code repositories
7
star
78

inc-20210825

Tool for audit and reclaim of delegated SPL Token accounts
Rust
6
star
79

prettier-config-solana

A Prettier config consistent to all Solana Labs projects
6
star
80

k8s-cluster

5
star
81

solana-pkcs8

A utility to parse DER-encoded PKCS #8 files
Rust
5
star
82

solana-graphql-playground

GraphQL web IDE for working with the Solana RPC-GraphQL resolver
TypeScript
5
star
83

kurtosis-solana-testing

Rust
5
star
84

solana-json-rpc-https-proxy

DEPRECATED - Provides a TLS proxy for web-based Solana JSON RPC users
Shell
4
star
85

solana-build

Rust
4
star
86

governance-sdk

Governance SDK
TypeScript
4
star
87

solana-tokens

Utility for distributing Solana tokens
4
star
88

oyster-bridge

3
star
89

oyster-gov

1
star
90

ipfs-ledger

1
star
91

sync_test

For developing a Github Action to sync solana-labs/solana from anza-xyz/agave
1
star
92

spl-token-subscription

Rust
1
star