メインコンテンツまでスキップ

Basic Concepts

Games need to communicate not just with their UI, but also the rest of the web2 world that may want to interact with the game state. Paima exposes multiple different endpoints to help both with humans and tools to access the game state.

(REST) OpenAPI

Paima Engine comes with support for OpenAPI in two ways:

  • (for humans) http://localhost:3333/docs/rest/ui to visually see the REST API generated for the node
  • (for robots) http://localhost:3333/docs/rest/spec.json to access the OpenAPI specification for the node

Notably, the specification can be combined with tools like openapi-typescript to generate a typescript library for your application.

To have your game's OpenAPI definition also show up in the docs, simply place an openapi.json file inside the packaged folder generated by your game, and Paima will automatically detect it (this is done automatically for you in the Paima game templates)

(MQTT) AsyncAPI

Paima Engine comes with support for AsyncAPI in two ways:

  • (for humans) http://localhost:3333/docs/asyncapi/ui to visually see the AsyncAPI generated for the node
  • (for robots) http://localhost:3333/docs/asyncapi/spec.yml to access the AsyncAPI specification for the node

You don't typically have to interact with the specification directly, as you typically interact with these through the event log system

(JSON-RPC) EVM RPC API

Some tools only support the EVM JSON-RPC specification. Since Paima applications are non-EVM in nature (they aggregate multiple stacks, some of which might not even be EVM at all), it doesn't support this specification fully.

However, Paima nodes expose a EVM RPC wrapper API that tries its best to emulate the same behavior as EVM.

You can access the wrapper API at http://localhost:3333/rpc/evm

NOTE: this feature is still experimental, and we will update which endpoints work and which ones don't as well as subtle differences at a later time

(JSON) Precompile information

You can find information about all the precompiles of the node at http://localhost:3333/docs/precompiles