百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

seahorse-lang

> 编程语言
开源

在 Python 中编写与 Anchor 兼容的 Solana 程序

343 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

在 Python 中编写与 Anchor 兼容的 Solana 程序

seahorse: Write Solana programs in Python

The ease of Python with the safety of Rust.

Seahorse lets you write Solana programs in Python. It is a community-led project built on Anchor.

Developers gain Python's ease-of-use, while still having the same safety guarantees of every Rust program on the Solana chain. Low-level memory problems are handled by default, letting you worry about the important stuff.

Features

  • Compile-time type safety
  • Fully interoperable with Rust code
  • Compatibility with Anchor

The Seahorse compiler generates intermediate Rust artifacts and uses Anchor to do some of the heavy lifting.

Seahorse is beta software. Many features are unimplemented and it's not production-ready.

Get started

Installation

Examples

Example: FizzBuzz

Here's a very simple program that does something similar to the classic FizzBuzz problem.

python
# fizzbuzz
# Built with Seahorse v0.1.0
#
# On-chain, persistent FizzBuzz!

from seahorse.prelude import *

declare_id('Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS')

class FizzBuzz(Account):
  fizz: bool
  buzz: bool
  n: u64

@instruction
def init(owner: Signer, fizzbuzz: Empty[FizzBuzz]):
  fizzbuzz.init(payer = owner, seeds = ['fizzbuzz', owner])

@instruction
def do_fizzbuzz(fizzbuzz: FizzBuzz, n: u64):
  fizzbuzz.fizz = n % 3 == 0
  fizzbuzz.buzz = n % 5 == 0
  if not fizzbuzz.fizz and not fizzbuzz.buzz:
    fizzbuzz.n = n
  else:
    fizzbuzz.n = 0

This shows some basic Seahorse functionality, like account initialization and creating instructions. For more, check out Calculator: Your first Seahorse program or other examples here.

The compiler architecture changed entirely in v0.2.0, here's a brief overview - more details here:

…

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言