# @phala/sdk

> Phala Phat Contract JS SDK

Latest version **0.5.10** (published 2024-03-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @phala/sdk
pnpm add @phala/sdk
yarn add @phala/sdk
bun add @phala/sdk
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.10 |
| Published | 2024-03-01 |
| First published | 2021-10-02 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 13 |
| Unpacked size | 2.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 370 |
| Maintainers | phala, 133cha31 |
| Keywords | phala, phala-network, phat-contract |

## Links

- npm: https://www.npmjs.com/package/@phala/sdk
- Repository: https://github.com/Phala-Network/phala-blockchain
- Homepage: https://github.com/Phala-Network/phala-blockchain/tree/master/frontend/packages/sdk#readme
- Issues: https://github.com/Phala-Network/phala-blockchain/issues
- npm.io page: https://npm.io/package/@phala/sdk

## Dependencies (13)

- [rxjs](https://npm.io/package/rxjs.md) ^7.8.1
- [viem](https://npm.io/package/viem.md) ^1.5.0
- [protobufjs](https://npm.io/package/protobufjs.md) ^7.2.4
- [cross-fetch](https://npm.io/package/cross-fetch.md) ^4.0.0
- [randombytes](https://npm.io/package/randombytes.md) ^2.1.0
- [@polkadot/api](https://npm.io/package/@polkadot/api.md) ^10.9.1
- [@polkadot/util](https://npm.io/package/@polkadot/util.md) ^12.3.2
- [@polkadot/types](https://npm.io/package/@polkadot/types.md) ^10.9.1
- [@polkadot/keyring](https://npm.io/package/@polkadot/keyring.md) ^12.3.2
- [browserify-cipher](https://npm.io/package/browserify-cipher.md) ^1.0.1
- [@polkadot/util-crypto](https://npm.io/package/@polkadot/util-crypto.md) ^12.3.2
- [@polkadot/api-contract](https://npm.io/package/@polkadot/api-contract.md) ^10.9.1
- [@polkadot/types-augment](https://npm.io/package/@polkadot/types-augment.md) ^10.9.1

## Recent versions

- 0.5.10 (latest) — 2024-03-01
- 0.6.0-beta.19 (beta) — 2024-03-15
- 0.5.8-canary.2 (canary) — 2023-12-20
- 0.6.0-beta.18 — 2024-03-15
- 0.6.0-beta.17 — 2024-03-15
- 0.6.0-beta.16 — 2024-02-28
- 0.5.9 — 2024-02-28
- 0.6.0-beta.15 — 2024-02-02
- 0.6.0-beta.14 — 2024-01-26
- 0.6.0-beta.13 — 2024-01-12
- 0.6.0-beta.12 — 2024-01-12
- 0.6.0-beta.11 — 2024-01-11
- 0.6.0-beta.10 — 2024-01-05
- 0.6.0-beta.9 — 2023-12-30
- 0.6.0-beta.8 — 2023-12-30
- … 128 more at https://npm.io/package/@phala/sdk/versions

## README

# Phala Blockchain

![Build](https://github.com/Phala-Network/phala-blockchain/actions/workflows/build.yml/badge.svg)

Phala Network is the offchain computing protocol, powering the decentralized execution layer for AI agents.

## Native Build

### Dependencies

<details><summary>Expand</summary>

- System dependencies
  - Ubuntu (tested with 22.04)
  ```bash
  apt install -y build-essential pkg-config libssl-dev protobuf-compiler
  ```

  - macOS
  ```bash
  brew install protobuf
  ```

  - See [here](https://grpc.io/docs/protoc-installation/) for more protobuf installation options

- Rust

  ```bash
  curl https://sh.rustup.rs -sSf | sh
  ```

- Substrate dependencies:

   ```bash
   git submodule update --init
   sh ./scripts/init.sh
   ```

- LLVM 14

  ```bash
  wget https://apt.llvm.org/llvm.sh
  chmod +x llvm.sh
  ./llvm.sh 14
  ```

</details>

### Build the blockchain and bridge

Make sure you have Rust and LLVM-10 installed.

> Note for Mac users: you also need `llvm` and `binutils` from Homebrew or MacPort, and to add their binaries to your $PATH

Run `git submodule update --init` to fetch submodules before build if you haven't add option `--recursive ` when clone code.

```bash
cargo build --release
```

The build script enforces LLVM-10 or newer is used. LLVM-10 is needed because of the wasm port of rust
crypto library, `ring`. We have to compile the C code into wasm while keeping the compatibility with
the _current_ rustc.

## Run

Please refer to [the run scripts](./scripts/run)

## Sub-pages

- [RPC](./docs/rpc.md): RPC documentations
- [Test](./docs/test.md): How to test the components

## External Resources

- [Docs](https://docs.phala.network): Phala Network Documentations
- [Security Audit](./audit): Audit reports
- [phala-docker](https://github.com/Phala-Network/phala-docker): The production dockerfiles, including the blockchain, pherry, and pRuntime.
- [Responsible Disclosure](./docs/responsible-disclosure.md): moved to the [Phala Cloud policy](https://github.com/Phala-Network/phala-cloud/blob/main/SECURITY.md); this repository is retired

---
_Source: https://npm.io/package/@phala/sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
