Version 1.0.0
GitHubCreating Functions Guide
This comprehensive guide will walk you through the process of creating, deploying, and managing Functions on the Neo Service Layer.
Information
This is a basic version of the functions guide. It will be expanded with more detailed content in future updates.
What are Functions?
Functions in the Neo Service Layer allow you to deploy and execute JavaScript code within our secure Trusted Execution Environment (TEE). These functions can be triggered by various events, including scheduled times, blockchain events, or direct API calls.
Creating Your First Function
To create a function, you'll need to write JavaScript code that follows our function structure. Here's a simple example:
hello.js
1function main(args) {
2 // Get the name from arguments or use a default
3 const name = args.name || "World";
4
5 // Log something to the function execution logs
6 console.log("Function executed with name:", name);
7
8 // Return a simple response
9 return {
10 message: `Hello, ${name}!`,
11 timestamp: new Date().toISOString()
12 };
13}
For a more detailed guide on creating your first function, see our step-by-step tutorial.