From ca33af97e48b55c1a3d57e06e8490ff9e8596378 Mon Sep 17 00:00:00 2001 From: luc10921 Date: Tue, 7 Nov 2023 14:35:46 -0300 Subject: [PATCH 1/6] CU-8678g5b7w - Create an article on neo website explaining how to use cpm for TS offchain sdk generation with neon-dappkit and wcsdk --- .../assets/CPM-logo.png | Bin 0 -> 13997 bytes .../index.md | 109 ++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/assets/CPM-logo.png create mode 100644 tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/index.md diff --git a/tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/assets/CPM-logo.png b/tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/assets/CPM-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..3270ccbf60e7ce5b9581decf27feee0bbf1f1385 GIT binary patch literal 13997 zcmeHudpK0<`}f}ERE`}`37tevQz^!D)zTBtAHRnmbN%!8_7B!H^p{1K_WOkY z_M7Ii`S`O=y{Qk3&A+P}V| z-vH6K*57{HUU6X0?&DVZi9%vJOXlGt&9*R}gh9p(&e=B^w;MSi3 zZI6N;(PYr$Jv3_rgKHky=yU%2`mY53r%PbfPX7Q}Md?lx{-@IZkuJGZ6yHW(@%TtJTvO42J?ZB83`H8D7TkWx3iyNh~JKKeUwrKGsnlvG z>YBZy@&%agblev5y{2BHeq^RN;tZ6$*S@}fRO&zK%YSmsHzfYhU`?s(-z~ir5qPNc z^FI6f{j8jSpv`M}S$~nLVkVdg$G){aX21*BAXQNETSz-w0hd zl7v2JHc!p}a#@3@v!7^;C?8nWV{X3P4^mmRf6UPZV-_lQ-WRIp10aZeTj z8|d0D%i#SgMsXXVdm8pyhr#trP&mJ#f03jG&xb#)jzf#@?acnc-ovh?UZ#oRSXD%nW^+y}M@98ITZd zJP+s_yCj_+867~TKd1b>N>R?tiVMP8p5GNHK8vpjbxh%^R;j!p{)wV)D%6?dBp^*clUReVXPV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}xYYw2LhV{&j761A>CS#)Fp5#7DrnecABpT<6jxywZ!{f27Rn?)R zeBfPJYULRd<+n68PTWAXu;$3x-4=t_ILGI+fvGD;# zN56|Rcg>jFd!o`BD8XwYxjDJHEKyGjH8L_hT-Mdl&?T1-l2cNe4j$%{{#}$a2wCCx ziAci$@9>)Tw{6aYLG!(||80)_|GgvF*w^8P@uL5uTRNW~?;gAS4+7G)q+r`Sv8j4Z5ysUyt^V0w+tI)YM<-4!<@e0!w|8)Pth^rocQu_wxTtZS_5HMDwYgHlw4r0u)h+NrTYSb9JhuH6o^j~ z!*p$*WK?~YyR5m!0^Zg}#uS#vtuQg8gw%?2+9Yd<4g@B3wdhXkc9n_Avv!m{oE{Tj ze#A939j_kiLiMonQrhtgx8NbP`FMSoY<7;gUgdxKzcl=JegBmJDgp0)<-%8=7A_k# S+WmcAAP4rk@5%p@NdI3`WgM;m literal 0 HcmV?d00001 diff --git a/tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/index.md b/tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/index.md new file mode 100644 index 0000000..3ab19f0 --- /dev/null +++ b/tutorials/2023-11-06-offchain-sdk-ts-generation-with-cpm/index.md @@ -0,0 +1,109 @@ +--- +slug: coz-create-ts-sdk-with-cpm +title: 'How to use CPM to generate an off-chain TypeScript SDK' +description: "The tutorial aims to provide a comprehensive guide for developers interested in creating TypeScript SDKs for Neo smart contracts, making it easier for them to leverage CPM and successfully work with off-chain SDKs." +author: coz.io +tags: ["TS", "CPM", "SDK"] +skill: BEGINNER +image: "./assets/CPM-logo.png" +sidebar: true +--- + +[CPM](https://github.com/CityOfZion/cpm) is a tool that can help you download smart contracts and generate on-chain and off-chain SDKs for multiple languages without the need to write them yourself and needing none or minimal changes. + +## 1. Initializing workspace +We recommend using [vite](https://vitejs.dev/guide/) to create your project from a template. You just need to run `npm create vite@latest` and select the prompts to generate your project. After creating your project, it's time to start using CPM to automate the off-chain SDK generation. + +## 2. Using CPM +It's pretty easy to use CPM to add an off-chain SDK to your TypeScript project. After installing CPM you can generate a single SDK directly from the command prompt or setup a configuration file that will be processed and allows for generating multiple SDKs at the same time. In this tutorial, we will be using the easiest one to maintain. + +We need to generate a configuration file by running `cpm init` on the terminal. This creates a `cpm.yaml` file that by default gets the [Props](https://github.com/CityOfZion/props) smart contract. While it is a useful contract, it's probably not the one you want, in this article, let's suppose we want to easily invoke functions from the [Neo Token contract](https://dora.coz.io/contract/neo3/mainnet/0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5). + +The configuration file is divided into 4 different sections that will be tweaked to generate the desired SDK: +- `defaults`: will indicate that we want to generate an off-chain TypeScript SDK inside the `src` folder and that we don't want to download the NEF and manifest; +- `contracts`: will have the Neo Token contract that we want to generate an SDK for; +- `tools`: since we don't want to download the smart contract, this section is unnecessary; +- `networks`: will have the Main Net network where the Neo Token contract is. + +After tweaking the `cpm.yaml` file it should be something like this: + +```yaml +defaults: + contract-source-network: mainnet + contract-generate-sdk: true + contract-download: false + off-chain: + languages: + - ts +    destinations: + ts: src/contracts + +contracts: + - label: NEO token + script-hash: '0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5' + +networks: + - label: mainnet + hosts: + - 'https://mainnet1.neo.coz.io:443' + - 'http://seed1.neo.org:10332' +``` + +> For more information on how to configure `cpm.yaml`, check out [CPM's documentation](https://github.com/CityOfZion/cpm/blob/master/docs/config.md) + +Then just run `cpm run` on the terminal and the SDK should be generated at the `src/contracts/neotoken` folder. Anytime the contract adds or removes method signatures, you'll have to run `cpm run` again to update your SDK. + +## 3. Initializing and running the SDK +Now that the SDK is already generated, you'll need to install the dependencies: [`@types/node`](https://www.npmjs.com/package/@types/node), and [`@cityofzion/neon-dappkit-types`](https://www.npmjs.com/package/@cityofzion/neon-dappkit-types). Then you'll have to import and initialize the SDK to be able to call it. +To initialize the SDK, you'll first need to instantiate a class that implements `Neo3-Invoker`. +To enhance security and user experience, it's advisable to use [`WalletConnect`](https://github.com/CityOfZion/wallet-connect-sdk) for scenarios requiring user authentication, such as signing transactions or accessing user account details. However, for situations where such authentication is unnecessary, [`NeonInvoker`](https://github.com/CityOfZion/neon-dappkit/blob/main/packages/neon-dappkit/src/NeonInvoker.ts) from NeonDappkit offers a more streamlined solution, as it eliminates the need for users to approve requests through their wallets. In our example, we employ both methods: NeonInvoker is utilized when the user is not logged into their wallet. +```ts +import { NeoToken } from './contracts/neotoken' + +import { Neo3Invoker } from "@cityofzion/neon-dappkit-types" +import { NeonInvoker } from "@cityofzion/neon-dappkit" +import WcSdk from '@cityofzion/wallet-connect-sdk-core' + + +let wcSdk: WcSdk +let neonInvoker: NeonInvoker + +async function initInvokers() { + wcSdk = await WcSdk.init({ + projectId: 'a9ff54e3d56a52230ed8767db4d4a810', // the ID of your project on Wallet Connect website + relayUrl: 'wss://relay.walletconnect.com', // we are using walletconnect's official relay server + metadata: { + name: 'MyApplicationName', // your application name to be displayed on the wallet + description: 'My Application description', // description to be shown on the wallet + url: 'https://myapplicationdescription.app/', // url to be linked on the wallet + icons: ['https://myapplicationdescription.app/myappicon.png'], // icon to be shown on the wallet + }, + }) + + neonInvoker = await NeonInvoker.init({ + rpcAddress: NeonInvoker.MAINNET, + }) +} + +function getInvoker(): Neo3Invoker { + if (wcSdk.isConnected()) { + return wcSdk + } else { + return neonInvoker + } +} +``` +> To connect a wallet to your application, checkout [Wallet Connect's documentation](https://github.com/CityOfZion/wallet-connect-sdk/blob/main/USAGE_GUIDE.md#connect-to-the-wallet) + +Then you can invoke the contract methods with this SDK: +```ts +async function main() { + const neoToken = new NeoToken({ + scriptHash: NeoToken.SCRIPT_HASH, + invoker: getInvoker() + }) + console.log(await neoToken.symbol()) // NEO + console.log(await neoToken.decimals()) // 0 + console.log(await neoToken.totalSupply()) // 100000000 +} +``` From 2fac1a52df6d37dbe6c5494ee151324c65e91266 Mon Sep 17 00:00:00 2001 From: Claude Muller Date: Thu, 4 Jan 2024 15:53:31 +0100 Subject: [PATCH 2/6] Increment neow3j version number and add slugs to neow3j tutorial pages. --- tutorials/2023-10-17-neow3j-nep17/index.md | 2 +- tutorials/2023-10-17-neow3j-sdk-quickstart/index.md | 3 ++- tutorials/2023-10-17-neow3j-smart-contract-quickstart/index.md | 3 ++- tutorials/2023-10-28-neow3j-nep11/index.md | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tutorials/2023-10-17-neow3j-nep17/index.md b/tutorials/2023-10-17-neow3j-nep17/index.md index d52cebf..041525f 100644 --- a/tutorials/2023-10-17-neow3j-nep17/index.md +++ b/tutorials/2023-10-17-neow3j-nep17/index.md @@ -12,7 +12,7 @@ sidebar: true
neow3j -

neow3j v3.21.1

+

neow3j v3.21.2

Neow3j is a development toolkit that provides easy and reliable tools to build Neo dApps and Smart Contracts using the diff --git a/tutorials/2023-10-17-neow3j-sdk-quickstart/index.md b/tutorials/2023-10-17-neow3j-sdk-quickstart/index.md index 8f329b7..d240e2a 100644 --- a/tutorials/2023-10-17-neow3j-sdk-quickstart/index.md +++ b/tutorials/2023-10-17-neow3j-sdk-quickstart/index.md @@ -1,4 +1,5 @@ --- +slug: neow3j-sdk-quickstart title: 'neow3j - Java SDK Quickstart' description: "In this quickstart guide, you will set up a neow3j project and get introduced to all tools necessary for interacting with the Neo N3 blockchain using Java." author: AxLabs @@ -11,7 +12,7 @@ sidebar: true
neow3j -

neow3j v3.21.1

+

neow3j v3.21.2

## 1. Introduction diff --git a/tutorials/2023-10-17-neow3j-smart-contract-quickstart/index.md b/tutorials/2023-10-17-neow3j-smart-contract-quickstart/index.md index 0c749a2..4388f70 100644 --- a/tutorials/2023-10-17-neow3j-smart-contract-quickstart/index.md +++ b/tutorials/2023-10-17-neow3j-smart-contract-quickstart/index.md @@ -1,4 +1,5 @@ --- +slug: neow3j-devpack-quickstart title: 'neow3j - Java Smart Contract Quickstart' description: "In this quickstart guide, you will set up a smart contract project and get introduced to all tools necessary for contract development in Java." author: AxLabs @@ -11,7 +12,7 @@ sidebar: true
neow3j -

neow3j v3.21.1

+

neow3j v3.21.2

## 1. Introduction diff --git a/tutorials/2023-10-28-neow3j-nep11/index.md b/tutorials/2023-10-28-neow3j-nep11/index.md index ac4684a..75cf301 100644 --- a/tutorials/2023-10-28-neow3j-nep11/index.md +++ b/tutorials/2023-10-28-neow3j-nep11/index.md @@ -1,4 +1,5 @@ --- +slug: neow3j-nep11 title: 'neow3j - Implementing a NEP-11 (NFT) Smart Contract in Java' description: "This tutorial describes an example implementation of a NEP-11 smart contract developed in Java using the neow3j library." author: AxLabs @@ -11,7 +12,7 @@ sidebar: true
neow3j -

neow3j v3.21.1

+

neow3j v3.21.2

Neow3j is a development toolkit that provides easy and reliable tools to build Neo dApps and Smart Contracts using the From f59a5e95cf4fe88f0fb812e04e6b620f18494d5b Mon Sep 17 00:00:00 2001 From: Celia18305 <32253925+Celia18305@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:03:02 +0800 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index defd3af..0ef5e5b 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Neo Developer Portal is built using [Docusaurus](https://docusaurus.io/) v2. 1. Neo developer portal team will review your PR 2. Acceptable PRs will be approved and merged into `dev` branch 5. Release - 1. Neo developer portal team will periodically merge `dev` into `main` branch and it will automatically deploy to [docs.neo.org](http://docs.neo.org) + 1. Neo developer portal team will periodically merge `dev` into `main` branch and it will automatically deploy to [developers.neo.org](https://developers.neo.org/docs) 2. View history of releases on Github From 6bd814e30a97c276360b5ad3f71fa789db5ff568 Mon Sep 17 00:00:00 2001 From: GZ Date: Tue, 9 Jan 2024 11:23:31 +0800 Subject: [PATCH 4/6] Update setup.md --- docs/n3/node/cli/setup.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/n3/node/cli/setup.md b/docs/n3/node/cli/setup.md index f8a2bda..5494408 100644 --- a/docs/n3/node/cli/setup.md +++ b/docs/n3/node/cli/setup.md @@ -13,7 +13,7 @@ The following table lists the minimum and recommended hardware requirements for | | Minimum | Recommended | | --------- | ---------------------------------------------------- | ---------------------------------------------------- | -| System | Windows 10
Ubuntu 16.04/18.04
CentOS 7.4/7.6 | Windows 10
Ubuntu 16.04/18.04
CentOS 7.4/7.6 | +| System | Windows 10/11
Ubuntu 16.04/18.04/20.04
CentOS 7.4/7.6/7.7 | Windows 10/11
Ubuntu 16.04/18.04/20.04
CentOS 7.4/7.6/7.7 | | CPU | Dual core | Quad core | | Memory | 8G | 16G | | Hard Disk | 50G SSD hard drive | 100G SSD hard drive | @@ -42,7 +42,8 @@ The following table lists the minimum and recommended hardware requirements for ``` "Storage": { - "Engine": "RocksDBStore" + "Engine": "RocksDBStore", + "Path": "Data_RocksDB_{0}" }, ``` @@ -72,7 +73,7 @@ You can download and compile the Neo-CLI source directly from Github. ### Publishing using Visual Studio (Windows) -If you has Visual Studio 2019 installed on your Windows system, this way is recommended: +If you has Visual Studio 2019 or later version installed on your Windows system, this way is recommended: 1. In Visual Studio, open the project file neo-node.sln. 2. In the Solution panel, right click `neo-cli` and select `Publish`. From ebaf0ac006254fea335a4e2db307d61a49e50085 Mon Sep 17 00:00:00 2001 From: GZ Date: Tue, 9 Jan 2024 11:28:09 +0800 Subject: [PATCH 5/6] Update setup.md --- docs/n3/node/cli/setup.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/n3/node/cli/setup.md b/docs/n3/node/cli/setup.md index 5494408..418e3b1 100644 --- a/docs/n3/node/cli/setup.md +++ b/docs/n3/node/cli/setup.md @@ -33,8 +33,8 @@ The following table lists the minimum and recommended hardware requirements for **CentOS:** ``` - sudo wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - sudo yum -y install epel-release-latest-7.noarch.rpm + sudo wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + sudo yum -y install epel-release-latest-9.noarch.rpm sudo yum -y install leveldb-devel libunwind-devel libsqlite3x-devel sqlite3* ``` From 1e4977a9f9a07f8656767a9f1bdde9254e83e98a Mon Sep 17 00:00:00 2001 From: Celia18305 Date: Tue, 9 Jan 2024 17:08:09 +0800 Subject: [PATCH 6/6] fix broken links --- docs/n3/develop/deploy/deploy.md | 2 +- docs/n3/develop/deploy/invoke.md | 2 +- docs/n3/develop/write/framework.md | 2 +- docs/n3/exchange/transaction.md | 2 +- docs/n3/fees.md | 26 ++++++++--------- docs/n3/foundation/Transactions.md | 4 +-- docs/n3/glossary.md | 6 ++-- docs/n3/node/gui/blockchain.md | 2 +- docs/n3/reference/governance_api/index.md | 32 ++++++++++----------- docs/n3/reference/rpc/latest-version/api.md | 3 +- 10 files changed, 41 insertions(+), 40 deletions(-) diff --git a/docs/n3/develop/deploy/deploy.md b/docs/n3/develop/deploy/deploy.md index 12fbcca..481276e 100644 --- a/docs/n3/develop/deploy/deploy.md +++ b/docs/n3/develop/deploy/deploy.md @@ -16,7 +16,7 @@ From the programming language perspective, only when a smart contract will be us Smart contracts are deployed by invoking APIs. Usually we use Neo-CLI or Neo-GUI to deploy smart contracts. -Deploying and invoking smart contracts cost fees. For more information, refer to [Fees](../../reference/fees.md). +Deploying and invoking smart contracts cost fees. For more information, refer to [Fees](../../fees.md). ## Before you start Make sure you have done the following: diff --git a/docs/n3/develop/deploy/invoke.md b/docs/n3/develop/deploy/invoke.md index 0840cfa..634038f 100644 --- a/docs/n3/develop/deploy/invoke.md +++ b/docs/n3/develop/deploy/invoke.md @@ -103,7 +103,7 @@ The key statement is `Contract.Call(scriptHash, method, flags, params)`, where: - `scriptHash` is the script hash of the contract invoked. It is ByteArray type and little endian. - `method` is the method of the contract invoked, such as `name`, `balanceOf`, or `transfer`. String type. -- `flags` defines special behaviors allowed when invoking smart contracts. See [CallFlags Enumerator](https://docs.neo.org/docs/zh-cn/reference/scapi/framework/services/CallFlags.html#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E) for details. +- `flags` defines special behaviors allowed when invoking smart contracts. See [CallFlags Enumerator](../../reference/scapi/framework/services/CallFlags.md) for details. - `params` is the parameter list of the method of the invoked contract. Array type. ### Invocation permission diff --git a/docs/n3/develop/write/framework.md b/docs/n3/develop/write/framework.md index debb614..f6e8eee 100644 --- a/docs/n3/develop/write/framework.md +++ b/docs/n3/develop/write/framework.md @@ -6,5 +6,5 @@ Neo.SmartContract.Framework mainly provides the following API methods: - A series of native contract methods that can be invoked in the smart contract,see [Neo.SmartContract.Framework.Native](https://developers.neo.org/docs/n3/reference/scapi/framework/native). - Interoperability services layer methods, see [Neo.SmartContract.Framework.Service](https://developers.neo.org/docs/n3/reference/scapi/framework/services). -- Methods provided by the framework,see [Neo.SmartContract.Framework](https://developers.neo.org/docs/n3/reference/scapi/framework/framework). +- Methods provided by the framework,see [Neo.SmartContract.Framework](https://developers.neo.org/docs/n3/reference/scapi/framework). diff --git a/docs/n3/exchange/transaction.md b/docs/n3/exchange/transaction.md index 737b1fd..88bbf31 100644 --- a/docs/n3/exchange/transaction.md +++ b/docs/n3/exchange/transaction.md @@ -664,6 +664,6 @@ After sending the request, you will get the following response: ## See Also -[NEP17 Token Standard](https://github.com/neo-project/proposals/blob/nep-17/nep-17.mediawiki) +[NEP17 Token Standard](https://github.com/neo-project/proposals/blob/master/nep-17.mediawiki) [Neo3 Data Conversion](https://neo.org/converter/index) diff --git a/docs/n3/fees.md b/docs/n3/fees.md index c2312a3..50feee8 100644 --- a/docs/n3/fees.md +++ b/docs/n3/fees.md @@ -43,7 +43,7 @@ System fees include: | 0.00000001 | ASSERT, NOP, PUSH0, PUSH1, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSHINT16, PUSHINT32, PUSHINT64, PUSHINT8, PUSHM1, PUSHNULL, PUSHT, PUSHF | | 0 | ABORT, RET, SYSCALL | -Reference: [ApplicationEngine.OpCodePrices.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.OpCodePrices.cs) +Reference: [ApplicationEngine.OpCodePrices.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.OpCodePrices.cs) ### System call fee @@ -76,17 +76,17 @@ Reference: [ApplicationEngine.OpCodePrices.cs](https://github.com/neo-project/ne Reference: -[ApplicationEngine.Contract.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Contract.cs) +[ApplicationEngine.Contract.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Contract.cs) -[ApplicationEngine.Crypto.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Crypto.cs) +[ApplicationEngine.Crypto.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Crypto.cs) -[ApplicationEngine.Contract.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Contract.cs) +[ApplicationEngine.Contract.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Contract.cs) -[ApplicationEngine.Iterator.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Iterator.cs) +[ApplicationEngine.Iterator.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Iterator.cs) -[ApplicationEngine.Runtime.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Runtime.cs) +[ApplicationEngine.Runtime.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Runtime.cs) -[ApplicationEngine.Storage.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Storage.cs) +[ApplicationEngine.Storage.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Storage.cs) ### Native contract execution fee @@ -110,7 +110,7 @@ Reference: The fee for other native contract methods not listed is 0.00032768 GAS. -Reference: [neo/SmartContract/Native](https://github.com/neo-project/neo/tree/master/src/neo/SmartContract/Native) +Reference: [neo/SmartContract/Native](https://github.com/neo-project/neo/tree/master/src/Neo/SmartContract/Native) ### Storage fee @@ -126,7 +126,7 @@ For the key data written to the storage, the fee charged for the first time writ | Subsequent write in. New data size > Old data size | The same as above line | The value modified as `hello neo3.0 preview5`, totally 21 bytes | 0.005 + (21-12)×0.001 = **0.014** GAS | | The value removed | 0 | The value removed | **0** GAS | -Reference: [ApplicationEngine.Storage.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/ApplicationEngine.Storage.cs) +Reference: [ApplicationEngine.Storage.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/ApplicationEngine.Storage.cs) ## Network fee @@ -141,9 +141,9 @@ By default the network byte fee is 0.00001 GAS / Byte. Committee members can dyn Reference: -[PolicyContract.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/PolicyContract.cs) +[PolicyContract.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/Native/PolicyContract.cs) -[Transaction.cs#L302](https://github.com/neo-project/neo/blob/ee898bf41667cdbe3b836b3bd08c2d3199046c2e/src/neo/Network/P2P/Payloads/Transaction.cs#L302) +[Transaction.cs#L302](https://github.com/neo-project/neo/blob/master/src/Neo/Network/P2P/Payloads/Transaction.cs#L302) ### Script verification fee @@ -165,7 +165,7 @@ The script verification fee for a standard address is (OpCode.PUSHDATA1 + OpCode Reference: -[PolicyContract.cs](https://github.com/neo-project/neo/blob/master/src/neo/SmartContract/Native/PolicyContract.cs) +[PolicyContract.cs](https://github.com/neo-project/neo/blob/master/src/Neo/SmartContract/Native/PolicyContract.cs) -[Transaction.cs#L302](https://github.com/neo-project/neo/blob/ee898bf41667cdbe3b836b3bd08c2d3199046c2e/src/neo/Network/P2P/Payloads/Transaction.cs#L302) +[Transaction.cs#L302](https://github.com/neo-project/neo/blob/master/src/Neo/Network/P2P/Payloads/Transaction.cs#L302) diff --git a/docs/n3/foundation/Transactions.md b/docs/n3/foundation/Transactions.md index a62825e..342076a 100644 --- a/docs/n3/foundation/Transactions.md +++ b/docs/n3/foundation/Transactions.md @@ -46,7 +46,7 @@ The system fee depends on the transaction's script, i.e., its size, number and t ![](images/transaction/system_fee.png) -where *OpcodeSet* is opcode set, *OpcodePricei* is the cost of opcode i, *ni* is the execution times of instruction i in the contract script. For each opcode fee refer to [Fees for Instructions](../../reference/fees.md#fees-for-instructions). +where *OpcodeSet* is opcode set, *OpcodePricei* is the cost of opcode i, *ni* is the execution times of instruction i in the contract script. For each opcode fee refer to [Fees for Instructions](../Advances/Neo VM instructions.md). ### netfee @@ -88,7 +88,7 @@ By repeating this step, the invocation script can push multiple signatures for t #### Verification Script -Verification script, commonly known as address script, includes normal address script and multi-signature address script. The address script can be directly obtained from the wallet account. For information about the construction refer to [Wallets](wallets.md#address). +Verification script, commonly known as address script, includes normal address script and multi-signature address script. The address script can be directly obtained from the wallet account. For information about the construction refer to [Wallets](Wallets.md). It can also be used as a custom authentication contract script. diff --git a/docs/n3/glossary.md b/docs/n3/glossary.md index 1a06333..b68a938 100644 --- a/docs/n3/glossary.md +++ b/docs/n3/glossary.md @@ -39,7 +39,7 @@ The script hash is generated from the smart contract script with the RIPEMD-160 #### Opcode -Opcodes are similar to instructions in assembly language. For all OpCode, refer to [OpCode source](https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/OpCode.cs). +Opcodes are similar to instructions in assembly language. For all OpCode, refer to [OpCode source](https://github.com/neo-project/neo/blob/master/src/Neo.VM/OpCode.cs). #### Cryptographic private key @@ -55,7 +55,7 @@ The NEP-17 proposal outlines a token standard for the Neo blockchain that will p #### SysCall -The system call is a special operation code, through which you can call the interoperable service layer interface. By calling the interoperable service layer interface, NeoVM can access data such as block, transaction , contract, and asset information that are required for running smart contracts. For more information refer to the files in [Neo smart contract module](https://github.com/neo-project/neo/tree/master/src/neo/SmartContract) starting with `ApplicationEngine.` , such as `ApplicationEngine.Contract.cs`, `ApplicationEngine.Blockchain.cs`. +The system call is a special operation code, through which you can call the interoperable service layer interface. By calling the interoperable service layer interface, NeoVM can access data such as block, transaction , contract, and asset information that are required for running smart contracts. For more information refer to the files in [Neo smart contract module](https://github.com/neo-project/neo/tree/master/src/Neo/SmartContract) starting with `ApplicationEngine.` , such as `ApplicationEngine.Contract.cs`, `ApplicationEngine.Blockchain.cs`. #### Dynamic Call @@ -63,7 +63,7 @@ A special system call that invokes another contract within a contract. It can be #### Storage -Each smart contract deployed on the Neo blockchain has a private storage area for storing application data. When creating a smart contract or transaction to use this contract, the contract code needs to read and write its storage. Each contract can declare a storage area. For more information refer to [Storage](../reference/scapi/framework/services/storage). +Each smart contract deployed on the Neo blockchain has a private storage area for storing application data. When creating a smart contract or transaction to use this contract, the contract code needs to read and write its storage. Each contract can declare a storage area. For more information refer to [Storage](reference/scapi/framework/services/Storage.md). #### NEF diff --git a/docs/n3/node/gui/blockchain.md b/docs/n3/node/gui/blockchain.md index 2cc37ad..caa4458 100644 --- a/docs/n3/node/gui/blockchain.md +++ b/docs/n3/node/gui/blockchain.md @@ -47,7 +47,7 @@ You can view the following information by switching tabs in this page: - **Transaction**: Displays the basic information of the transaction, such as the block, size, time stamp, as well as the transaction transfer record and the witness of the transaction. - **Notifications**: Displays the execution log of the smart contract in the transaction, including information such as whether the NEP-17 transfer was successful. -For information about the basic concept of transactions refer to [Transaction](../../basic/concept/transaction.md). +For information about the basic concept of transactions refer to [Transaction](../../foundation/Transactions.md). ## Assets diff --git a/docs/n3/reference/governance_api/index.md b/docs/n3/reference/governance_api/index.md index 750b85f..e41a8ee 100644 --- a/docs/n3/reference/governance_api/index.md +++ b/docs/n3/reference/governance_api/index.md @@ -15,8 +15,8 @@ An address can be registered as candidate or unregistered afterwards. Correspond | Method | Parameters | Fee in GAS | | ---- | ------------------------------------ | ---- | -| [`RegisterCandidate`](../smart_contract_api/framework/native/Neo/RegisterCandidate) | ECPoint publicKey | Adjustable, initially 0.00001 | -| [`UnregisterCandidate`](../smart_contract_api/framework/native/Neo/UnregisterCandidate) | ECPoint publicKey | 0.00065536 (CpuFee) | +| [`RegisterCandidate`](../scapi/framework/native/Neo/RegisterCandidate) | ECPoint publicKey | Adjustable, initially 0.00001 | +| [`UnregisterCandidate`](../scapi/framework/native/Neo/UnregisterCandidate) | ECPoint publicKey | 0.00065536 (CpuFee) | :::note Registering / unregistering candidate requires signature. It means candidate registering / unregistering is only self-determined. @@ -30,13 +30,13 @@ Voting contract method is as follows. Please not that voter's signature will be | Method | Parameters | Fee in GAS | | ---- | ------------------------------------ | ---- | -| [`Vote`](../smart_contract_api/framework/native/Neo/Vote) | UInt160 account, byte[] voteTo | 0.00065536 (CpuFee) | +| [`Vote`](../scapi/framework/native/Neo/Vote) | UInt160 account, byte[] voteTo | 0.00065536 (CpuFee) | As voters' votes & held NEO, as well as registered candidates keep changing, candidate set and their votes are re-calculated in every block. | Method | Parameters | Fee in GAS | | ---- | ------------------------------------ | ---- | -| [`GetCandidates`](../smart_contract_api/framework/native/Neo/GetCandidates) | null | 0 | +| [`GetCandidates`](../scapi/framework/native/Neo/GetCandidates) | null | 0 | ## Committee @@ -79,13 +79,13 @@ Furthermore, corresponding reading methods are also supported: | Method | Parameters | Fee in GAS | Contract | | ---- | ------------------------------------ | ---- | ---- | -| [`GetDesignatedByRole`](../smart_contract_api/framework/native/RoleManagement/GetDesignatedByRole) | Role role, uint index | 0.00032768 (CpuFee) | RoleManagement | -| [`GetFeePerByte`](../smart_contract_api/framework/native/Policy/GetFeePerByte) | null | 0.00032768 (CpuFee) | PolicyContract | -| GetExecFeeFactor | null | 0.00032768 (CpuFee) | PolicyContract | -| GetStoragePrice | null | 0.00032768 (CpuFee) | PolicyContract | -| [`IsBlocked`](../smart_contract_api/framework/native/Policy/IsBlocked) | UInt160 account | 0.00032768 (CpuFee) | PolicyContract | +| [`GetDesignatedByRole`](../scapi/framework/native/RoleManagement/GetDesignatedByRole) | Role role, uint index | 0.00032768 (CpuFee) | RoleManagement | +| [`GetFeePerByte`](../scapi/framework/native/Policy/GetFeePerByte) | null | 0.00032768 (CpuFee) | PolicyContract | +| [GetExecFeeFactor](../scapi/framework/native/Policy/GetExecFeeFactor) | null | 0.00032768 (CpuFee) | PolicyContract | +| [GetStoragePrice](../scapi/framework/native/Policy/GetStoragePrice) | null | 0.00032768 (CpuFee) | PolicyContract | +| [`IsBlocked`](../scapi/framework/native/Policy/IsBlocked) | UInt160 account | 0.00032768 (CpuFee) | PolicyContract | | GetPrice | null | 0.00032768 (CpuFee) | OracleContract | -| [`GetGasPerBlock`](../smart_contract_api/framework/native/Neo/GetGasPerBlock) | null | 0.00032768 (CpuFee) | NeoToken | +| [`GetGasPerBlock`](../scapi/framework/native/Neo/GetGasPerBlock) | null | 0.00032768 (CpuFee) | NeoToken | | GetRegisterPrice | null | 0.00032768 (CpuFee) | NeoToken | | GetMinimumDeploymentFee | null | 0.00032768 (CpuFee) | ContractManagement | @@ -99,7 +99,7 @@ Committee members are refreshed every 21 blocks. | Method | Parameters | Fee in GAS | Return value | | ---- | ------------------------------------ | ---- | ---- | -| [`GetCommittee`](../smart_contract_api/framework/native/Neo/GetCommittee) | null | 0.04194304 (CpuFee) | Current committee members in format of ECPoint[] | +| [`GetCommittee`](../scapi/framework/native/Neo/GetCommittee) | null | 0.04194304 (CpuFee) | Current committee members in format of ECPoint[] | ## Consensus Nodes @@ -117,7 +117,7 @@ Similar to committee members, consensus nodes are refreshed every 21 blocks. | Method | Parameters | Fee in GAS | Return value | | ---- | ------------------------------------ | ---- | ---- | -| [`GetNextBlockValidators`](../smart_contract_api/framework/native/Neo/GetNextBlockValidators) | null | 0.04194304 (CpuFee) | Consensus nodes by persisting block in format of ECPoint[] | +| [`GetNextBlockValidators`](../scapi/framework/native/Neo/GetNextBlockValidators) | null | 0.04194304 (CpuFee) | Consensus nodes by persisting block in format of ECPoint[] | ## Token Distribution @@ -133,12 +133,12 @@ NEO and GAS are [Nep17](https://github.com/neo-project/proposals/blob/master/nep | ---- | ---- | ---- | ---- | | [`symbol`](symbol) | null | 0 | Token symbol in String | | [`decimals`](decimals) | null | 0 | Token decimals in UInt | -| [`TotalSupply`](../smart_contract_api/framework/native/Neo/TotalSupply) | null | 0.00032768 (CpuFee) | Token total supply in BigInteger | -| [`BalanceOf`](../smart_contract_api/framework/native/Neo/BalanceOf) | UInt160 account | 0.00032768 (CpuFee) | account balance in BigInteger | -| [`Transfer`](../smart_contract_api/framework/native/Neo/Transfer) | UInt160 from, UInt160 to, BigInteger amount | 0.00131072 (CpuFee) + 0.0000005 (StorageFee) | Send specified amount of token from Address *from* to Address *to*. Please note that it will check *from*'s signature, whether caller is *from*, whether *to* is payable, whether *from*'s balance is enough | +| [`TotalSupply`](../scapi/framework/native/Neo/TotalSupply) | null | 0.00032768 (CpuFee) | Token total supply in BigInteger | +| [`BalanceOf`](../scapi/framework/native/Neo/BalanceOf) | UInt160 account | 0.00032768 (CpuFee) | account balance in BigInteger | +| [`Transfer`](../scapi/framework/native/Neo/Transfer) | UInt160 from, UInt160 to, BigInteger amount | 0.00131072 (CpuFee) + 0.0000005 (StorageFee) | Send specified amount of token from Address *from* to Address *to*. Please note that it will check *from*'s signature, whether caller is *from*, whether *to* is payable, whether *from*'s balance is enough | Contract methods by NEO: | Method | Parameters | Fee in GAS | Return value | | ---- | ------------------------------------ | ---- | ---- | -| [`UnclaimedGas`](../smart_contract_api/framework/native/Neo/UnclaimedGas) | UInt160 account | 0.00131072 (CpuFee) | unclaimed GAS amount of this address in uint | \ No newline at end of file +| [`UnclaimedGas`](../scapi/framework/native/Neo/UnclaimedGas) | UInt160 account | 0.00131072 (CpuFee) | unclaimed GAS amount of this address in uint | \ No newline at end of file diff --git a/docs/n3/reference/rpc/latest-version/api.md b/docs/n3/reference/rpc/latest-version/api.md index b4bf034..52baf39 100644 --- a/docs/n3/reference/rpc/latest-version/api.md +++ b/docs/n3/reference/rpc/latest-version/api.md @@ -2,7 +2,7 @@ Each NEO-CLI node provides an API interface for obtaining blockchain data from it, making it easy to develop blockchain applications. The interface is provided via [JSON-RPC](http://wiki.geekdream.com/Specification/json-rpc_2.0.html), and the underlying protocol uses HTTP/HTTPS for communication. -To start a node that provides an RPC service, you must install the plugin [RpcServer](https://github.com/neo-project/neo-modules/releases). Refer to [Installing plugins](../../../node/cli/config.html#installing-plugins) for instructions. No need to add an argument when starting Neo-CLI. +To start a node that provides an RPC service, you must install the plugin [RpcServer](https://github.com/neo-project/neo-modules/releases). Refer to [Installing plugins](../../../node/cli/config#installing-plugins) for instructions. No need to add an argument when starting Neo-CLI. :::note @@ -116,6 +116,7 @@ You can modify the port in config.json in the RpcServer folder. For RPC API, all the return values related to the amount such as fees, NEP-17 asset balance, wallet balance, transfer amount, etc. are unsigned integer, which are automatically converted according to the asset decimal when requested by [RpcClient](https://github.com/neo-project/neo-modules/tree/master/src/RpcClient) (C# light node SDK). If you write the request by yourselves, you need to convert the amount manually. For example, if the return value is 1234560 and the asset decimal is 8, the actual amount is 0.0123456. ::: + ## GET request example The format of a typical JSON-RPC GET request is as follows: