Skip to content

Commit b8a119e

Browse files
docs: NEAR ecosystem impact, goals, roadmap (#31)
add NEAR ecosystem impact, goals and roadmap to README.md
1 parent 6a9e5b6 commit b8a119e

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ https://www.youtube.com/watch?v=JBZEr__pid0&list=PLv5wm4YuO4IwVNrSsYxeqKrtQZYRML
99

1010
Also check out the [end-to-end](#end-to-end-tests-using-near-workspaces) tests for how to use the contracts from this project.
1111

12+
# Purpose / NEAR ecosystem impact
13+
14+
The purpose of the project is to provide an example and starting point for adding the Javascript layer in Rust smart contracts. Being able to execute custom Javascript code makes it possible to configure behaviour of Rust smart contracts in a dynamic way through code, and not just JSON configuration. My own motivation was to run Javascript music code inside a smart contract ( see the [WebAssembly Music](https://github.com/petersalomonsen/javascriptmusic) project), and then I also saw this [tweet](https://x.com/ilblackdragon/status/1561368373618941954) that the combination of Javascript and Rust WebAssembly was needed for other projects in the NEAR ecosystem too.
15+
16+
Since this project has examples for various Rust standard smart contracts on NEAR, the desired impact for projects in the NEAR ecosystem is to use these in their smart contract implementations. The combination of a customizable javascript layer on top of a rock solid Rust smart contract aims to provide flexibility without sacrificing robustness. The project also shows you how to use testing framework to ensure full End to End tests of the use cases. A comprehensive example of this is the OpenAI proxy using Fungible Tokens for covering usage costs ( see list of examples below ).
17+
1218
# Devcontainer / github actions
1319

1420
All the pre-requisities for getting the project up and running can be found in the [.devcontainer](./.devcontainer) folder, which will be automaticall set up if using a github codespace.
@@ -39,6 +45,17 @@ A simple mocking of NEAR interfaces for simulation of a smart contract directly
3945

4046
- [NFT](./examples/nft/README.md) - The standard NFT contract, customizable with JavaScript
4147
- [Fungible Token](./examples/fungibletoken/README.md) - The standard FT contract, customizable with JavaScript
48+
- [OpenAI proxy](./examples/aiproxy/REAdME.md) - A proxy to an OpenAI API server interacting with the Fungible Token contract for covering usage costs
4249
- [Minimum Web4](./examples/minimumweb4/README.md) - Implement the web4 interface in JavaScript to serve a website from the smart contract
4350
- "[PureJS](./examples/purejs/README.md)" - Precompile the JS bytecode into the contract, and provide direct exports to the JS functions.
4451
- [Web4 and a WebAssembly Music showcase](./web4/README.md) - JavaScript from WebAssembly Music running in the smart contract
52+
53+
# Goals and roadmap
54+
55+
The project has already fulfilled the goal of compiling QuickJS to WebAssembly and integrate with a Rust smart contract. There is also a proof-of-concept Fungible Token contract integrated with a proxy to an OpenAI API. The goals ahead is to support the live implementations of this into the [WebAssembly Music](https://github.com/petersalomonsen/javascriptmusic) project and [Ariz portfolio](https://github.com/arizas/near-account-report).
56+
57+
Integrating with NEAR AI is also a natural next step in the evolution. Today NEAR AI is accessible by smarts contract emitting events, and with the Javascript layer provided here, it is possible to provide such events in a more dynamic way. The logic to generate the events can be altered without having to redeploy the entire smart contract, and also using function access keys instead of full access keys.
58+
59+
Finally, for the project to get more attention, it needs more documentation. Even though it already contains comprehensive test cases that also serves as code examples, the documentation explaining the concepts can be developed even more.
60+
61+
These are all goals ahead for 2025.

examples/aiproxy/spin.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ component = "openai-proxy"
1212

1313
[component.openai-proxy]
1414
source = "openai-proxy/target/wasm32-wasi/release/openai_proxy.wasm"
15-
allowed_outbound_hosts = ["https://api.openai.com:443", "https://rpc.testnet.near.org:443", "https://rpc.mainnet.near.org:443", "http://localhost:14500", "http://127.0.0.1:3001"]
15+
allowed_outbound_hosts = ["https://api.openai.com:443", "https://*.openai.azure.com", "https://rpc.testnet.near.org:443", "https://rpc.mainnet.near.org:443", "http://localhost:14500", "http://127.0.0.1:3001"]
1616
key_value_stores = ["default"]
1717

1818
[component.openai-proxy.build]

0 commit comments

Comments
 (0)