From 6373ae2ba315af55950af6ddacf3f17fe7a80702 Mon Sep 17 00:00:00 2001 From: 0xSpaceShard <0xSpaceShard@users.noreply.github.com> Date: Fri, 21 Jun 2024 13:00:58 +0000 Subject: [PATCH] Deploy website - based on 81ed1109ce12283e0d18c72f80131e3b89df4efa --- 404.html | 2 +- assets/js/5fbc5cf1.0b9257a5.js | 1 - assets/js/5fbc5cf1.76587c2d.js | 1 + assets/js/{6d990bb1.f3976d03.js => 6d990bb1.a3d78aa1.js} | 2 +- assets/js/778bcc8b.6f445848.js | 1 + assets/js/778bcc8b.dd9974ab.js | 1 - assets/js/a5ad27b1.19c24872.js | 1 - assets/js/a5ad27b1.a118c206.js | 1 + assets/js/b0477c6d.079d8bef.js | 1 - assets/js/b0477c6d.531ad97a.js | 1 + assets/js/{b4513eec.2a54a4d3.js => b4513eec.48c3c682.js} | 2 +- assets/js/bca784a7.0345585f.js | 1 - assets/js/bca784a7.547f56bd.js | 1 + assets/js/{e28eadbb.28dbb1f2.js => e28eadbb.eb97ff9d.js} | 2 +- assets/js/e44e17f8.c2db0a90.js | 1 + assets/js/e44e17f8.c49d81b4.js | 1 - ...runtime~main.07d34fe8.js => runtime~main.0e391459.js} | 2 +- docs/0.0.6/account-impersonation/index.html | 2 +- docs/0.0.6/api/index.html | 2 +- docs/0.0.6/balance/index.html | 2 +- docs/0.0.6/blocks/index.html | 2 +- docs/0.0.6/category/running/index.html | 2 +- docs/0.0.6/dump-load-restart/index.html | 2 +- docs/0.0.6/forking/index.html | 2 +- docs/0.0.6/historic-state/index.html | 2 +- docs/0.0.6/intro/index.html | 2 +- docs/0.0.6/lite/index.html | 2 +- docs/0.0.6/postman/index.html | 2 +- docs/0.0.6/predeployed/index.html | 2 +- docs/0.0.6/running/cli/index.html | 2 +- docs/0.0.6/running/docker/index.html | 2 +- docs/0.0.6/running/install/index.html | 2 +- docs/0.0.6/server-config/index.html | 2 +- docs/0.0.6/starknet-time/index.html | 2 +- docs/account-impersonation/index.html | 2 +- docs/api/index.html | 2 +- docs/balance/index.html | 2 +- docs/blocks/index.html | 2 +- docs/category/running/index.html | 2 +- docs/dump-load-restart/index.html | 2 +- docs/forking/index.html | 2 +- docs/historic-state/index.html | 2 +- docs/intro/index.html | 2 +- docs/lite/index.html | 2 +- docs/next/account-impersonation/index.html | 2 +- docs/next/api/index.html | 6 +++--- docs/next/balance/index.html | 8 +++++--- docs/next/blocks/index.html | 7 +++++-- docs/next/category/running/index.html | 2 +- docs/next/dump-load-restart/index.html | 6 ++++-- docs/next/forking/index.html | 2 +- docs/next/historic-state/index.html | 2 +- docs/next/intro/index.html | 2 +- docs/next/lite/index.html | 2 +- docs/next/postman/index.html | 9 +++++++-- docs/next/predeployed/index.html | 4 ++-- docs/next/running/cli/index.html | 2 +- docs/next/running/docker/index.html | 2 +- docs/next/running/install/index.html | 2 +- docs/next/server-config/index.html | 7 ++++--- docs/next/starknet-time/index.html | 9 ++++++--- docs/postman/index.html | 2 +- docs/predeployed/index.html | 2 +- docs/running/cli/index.html | 2 +- docs/running/docker/index.html | 2 +- docs/running/install/index.html | 2 +- docs/server-config/index.html | 2 +- docs/starknet-time/index.html | 2 +- index.html | 2 +- markdown-page/index.html | 2 +- 70 files changed, 92 insertions(+), 76 deletions(-) delete mode 100644 assets/js/5fbc5cf1.0b9257a5.js create mode 100644 assets/js/5fbc5cf1.76587c2d.js rename assets/js/{6d990bb1.f3976d03.js => 6d990bb1.a3d78aa1.js} (93%) create mode 100644 assets/js/778bcc8b.6f445848.js delete mode 100644 assets/js/778bcc8b.dd9974ab.js delete mode 100644 assets/js/a5ad27b1.19c24872.js create mode 100644 assets/js/a5ad27b1.a118c206.js delete mode 100644 assets/js/b0477c6d.079d8bef.js create mode 100644 assets/js/b0477c6d.531ad97a.js rename assets/js/{b4513eec.2a54a4d3.js => b4513eec.48c3c682.js} (77%) delete mode 100644 assets/js/bca784a7.0345585f.js create mode 100644 assets/js/bca784a7.547f56bd.js rename assets/js/{e28eadbb.28dbb1f2.js => e28eadbb.eb97ff9d.js} (81%) create mode 100644 assets/js/e44e17f8.c2db0a90.js delete mode 100644 assets/js/e44e17f8.c49d81b4.js rename assets/js/{runtime~main.07d34fe8.js => runtime~main.0e391459.js} (63%) diff --git a/404.html b/404.html index c57d52b90..91b540e18 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ Page Not Found | Starknet Devnet - + diff --git a/assets/js/5fbc5cf1.0b9257a5.js b/assets/js/5fbc5cf1.0b9257a5.js deleted file mode 100644 index f0f6715c1..000000000 --- a/assets/js/5fbc5cf1.0b9257a5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7624],{8946:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>r,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>d});var a=t(4848),i=t(8453);const s={},r="API",o={id:"api",title:"API",description:"Starknet API",source:"@site/docs/api.md",sourceDirName:".",slug:"/api",permalink:"/starknet-devnet-rs/docs/next/api",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/api.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Account impersonation",permalink:"/starknet-devnet-rs/docs/next/account-impersonation"},next:{title:"Account balance",permalink:"/starknet-devnet-rs/docs/next/balance"}},c={},d=[{value:"Starknet API",id:"starknet-api",level:2},{value:"Devnet API",id:"devnet-api",level:2},{value:"Config API",id:"config-api",level:2}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h1,{id:"api",children:"API"}),"\n",(0,a.jsx)(n.h2,{id:"starknet-api",children:"Starknet API"}),"\n",(0,a.jsxs)(n.p,{children:["Unlike Pythonic Devnet, which also supported Starknet's gateway and feeder gateway API, Devnet in Rust supports Starknet's JSON-RPC API. Since JSON-RPC v0.6.0, to find out which JSON-RPC version is supported by which Devnet version, check out the ",(0,a.jsx)(n.a,{href:"https://github.com/0xspaceshard/starknet-devnet-rs/releases",children:"releases page"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The JSON-RPC API is reachable via ",(0,a.jsx)(n.code,{children:"/rpc"})," and ",(0,a.jsx)(n.code,{children:"/"})," (e.g. if spawning Devnet with default settings, these URLs are functionally equivalent: ",(0,a.jsx)(n.code,{children:"http://127.0.0.1:5050/rpc"})," and ",(0,a.jsx)(n.code,{children:"http://127.0.0.1:5050/"}),")"]}),"\n",(0,a.jsx)(n.h2,{id:"devnet-api",children:"Devnet API"}),"\n",(0,a.jsx)(n.p,{children:"Devnet has many other functional features which are available via their own endpoints, which are all mentioned throughout the documentation."}),"\n",(0,a.jsx)(n.h2,{id:"config-api",children:"Config API"}),"\n",(0,a.jsxs)(n.p,{children:["To retrieve the current configuration of Devnet, send a ",(0,a.jsx)(n.code,{children:"GET"})," request to ",(0,a.jsx)(n.code,{children:"/config"}),". Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use ",(0,a.jsx)(n.code,{children:"starknet-devnet --help"})," to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-json",children:'{\n "seed": 4063802897,\n "total_accounts": 10,\n "account_contract_class_hash": "0x61dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f",\n "predeployed_accounts_initial_balance": "1000000000000000000000",\n "start_time": null,\n "gas_price_wei": 100000000000,\n "gas_price_strk": 100000000000,\n "data_gas_price_wei": 100000000000,\n "data_gas_price_strk": 100000000000,\n "chain_id": "SN_SEPOLIA",\n "dump_on": "exit",\n "dump_path": "dump_path.json",\n "state_archive": "none",\n "fork_config": {\n "url": "http://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7",\n "block_number": 26429\n },\n "server_config": {\n "host": "127.0.0.1",\n "port": 5050,\n "timeout": 120,\n "request_body_size_limit": 2000000\n },\n "block_generation": null,\n "lite_mode": false\n}\n'})})]})}function p(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>o});var a=t(6540);const i={},s=a.createContext(i);function r(e){const n=a.useContext(s);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),a.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/5fbc5cf1.76587c2d.js b/assets/js/5fbc5cf1.76587c2d.js new file mode 100644 index 000000000..20c6e313e --- /dev/null +++ b/assets/js/5fbc5cf1.76587c2d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7624],{8946:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>h,frontMatter:()=>r,metadata:()=>o,toc:()=>d});var a=t(4848),i=t(8453);const r={},s="API",o={id:"api",title:"API",description:"Starknet API",source:"@site/docs/api.md",sourceDirName:".",slug:"/api",permalink:"/starknet-devnet-rs/docs/next/api",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/api.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Account impersonation",permalink:"/starknet-devnet-rs/docs/next/account-impersonation"},next:{title:"Account balance",permalink:"/starknet-devnet-rs/docs/next/balance"}},c={},d=[{value:"Starknet API",id:"starknet-api",level:2},{value:"Devnet API",id:"devnet-api",level:2},{value:"Config API",id:"config-api",level:2}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,i.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h1,{id:"api",children:"API"}),"\n",(0,a.jsx)(n.h2,{id:"starknet-api",children:"Starknet API"}),"\n",(0,a.jsxs)(n.p,{children:["Unlike Pythonic Devnet, which also supported Starknet's gateway and feeder gateway API, Devnet in Rust supports Starknet's JSON-RPC API. Since JSON-RPC v0.6.0, to find out which JSON-RPC version is supported by which Devnet version, check out the ",(0,a.jsx)(n.a,{href:"https://github.com/0xspaceshard/starknet-devnet-rs/releases",children:"releases page"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:["The JSON-RPC API is reachable via ",(0,a.jsx)(n.code,{children:"/rpc"})," and ",(0,a.jsx)(n.code,{children:"/"})," (e.g. if spawning Devnet with default settings, these URLs are functionally equivalent: ",(0,a.jsx)(n.code,{children:"http://127.0.0.1:5050/rpc"})," and ",(0,a.jsx)(n.code,{children:"http://127.0.0.1:5050/"}),")"]}),"\n",(0,a.jsx)(n.h2,{id:"devnet-api",children:"Devnet API"}),"\n",(0,a.jsx)(n.p,{children:"Devnet has many other functional features which are available via their own endpoints and JSON-RPC, which are all mentioned throughout the documentation."}),"\n",(0,a.jsx)(n.h2,{id:"config-api",children:"Config API"}),"\n",(0,a.jsxs)(n.p,{children:["To retrieve the current configuration of Devnet, send a ",(0,a.jsx)(n.code,{children:"GET"})," request to ",(0,a.jsx)(n.code,{children:"/config"})," or ",(0,a.jsx)(n.code,{children:"JSON-RPC"})," request with method name ",(0,a.jsx)(n.code,{children:"devnet_getConfig"}),". Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use ",(0,a.jsx)(n.code,{children:"starknet-devnet --help"})," to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-json",children:'{\n "seed": 4063802897,\n "total_accounts": 10,\n "account_contract_class_hash": "0x61dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f",\n "predeployed_accounts_initial_balance": "1000000000000000000000",\n "start_time": null,\n "gas_price_wei": 100000000000,\n "gas_price_strk": 100000000000,\n "data_gas_price_wei": 100000000000,\n "data_gas_price_strk": 100000000000,\n "chain_id": "SN_SEPOLIA",\n "dump_on": "exit",\n "dump_path": "dump_path.json",\n "state_archive": "none",\n "fork_config": {\n "url": "http://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7",\n "block_number": 26429\n },\n "server_config": {\n "host": "127.0.0.1",\n "port": 5050,\n "timeout": 120,\n "request_body_size_limit": 2000000\n },\n "block_generation": null,\n "lite_mode": false\n}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>o});var a=t(6540);const i={},r=a.createContext(i);function s(e){const n=a.useContext(r);return a.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:s(e.components),a.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6d990bb1.f3976d03.js b/assets/js/6d990bb1.a3d78aa1.js similarity index 93% rename from assets/js/6d990bb1.f3976d03.js rename to assets/js/6d990bb1.a3d78aa1.js index 24e270f79..8e9fc2422 100644 --- a/assets/js/6d990bb1.f3976d03.js +++ b/assets/js/6d990bb1.a3d78aa1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2282],{7164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":"unreleased","badge":true,"noIndex":false,"className":"docs-version-current","isLast":false,"docsSidebars":{"docSidebar":[{"type":"link","label":"Intro","href":"/starknet-devnet-rs/docs/next/intro","docId":"intro","unlisted":false},{"type":"category","label":"Running","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Install and run","href":"/starknet-devnet-rs/docs/next/running/install","docId":"running/install","unlisted":false},{"type":"link","label":"Run with Docker","href":"/starknet-devnet-rs/docs/next/running/docker","docId":"running/docker","unlisted":false},{"type":"link","label":"CLI options","href":"/starknet-devnet-rs/docs/next/running/cli","docId":"running/cli","unlisted":false}],"href":"/starknet-devnet-rs/docs/next/category/running"},{"type":"link","label":"Account impersonation","href":"/starknet-devnet-rs/docs/next/account-impersonation","docId":"account-impersonation","unlisted":false},{"type":"link","label":"API","href":"/starknet-devnet-rs/docs/next/api","docId":"api","unlisted":false},{"type":"link","label":"Account balance","href":"/starknet-devnet-rs/docs/next/balance","docId":"balance","unlisted":false},{"type":"link","label":"Blocks","href":"/starknet-devnet-rs/docs/next/blocks","docId":"blocks","unlisted":false},{"type":"link","label":"Dump, load, restart","href":"/starknet-devnet-rs/docs/next/dump-load-restart","docId":"dump-load-restart","unlisted":false},{"type":"link","label":"Forking","href":"/starknet-devnet-rs/docs/next/forking","docId":"forking","unlisted":false},{"type":"link","label":"Historic state support","href":"/starknet-devnet-rs/docs/next/historic-state","docId":"historic-state","unlisted":false},{"type":"link","label":"Lite mode","href":"/starknet-devnet-rs/docs/next/lite","docId":"lite","unlisted":false},{"type":"link","label":"L1-L2 interaction via Postman","href":"/starknet-devnet-rs/docs/next/postman","docId":"postman","unlisted":false},{"type":"link","label":"Predeployed contracts","href":"/starknet-devnet-rs/docs/next/predeployed","docId":"predeployed","unlisted":false},{"type":"link","label":"Server config","href":"/starknet-devnet-rs/docs/next/server-config","docId":"server-config","unlisted":false},{"type":"link","label":"Starknet time","href":"/starknet-devnet-rs/docs/next/starknet-time","docId":"starknet-time","unlisted":false}]},"docs":{"account-impersonation":{"id":"account-impersonation","title":"Account impersonation","description":"This page is about account impersonation. To read about account class selection and deployment, click here.","sidebar":"docSidebar"},"api":{"id":"api","title":"API","description":"Starknet API","sidebar":"docSidebar"},"balance":{"id":"balance","title":"Account balance","description":"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself.","sidebar":"docSidebar"},"blocks":{"id":"blocks","title":"Blocks","description":"Devnet starts with a genesis block (with a block number equal to 0). In forking mode, the genesis block number will be equal to the forked block number plus one.","sidebar":"docSidebar"},"dump-load-restart":{"id":"dump-load-restart","title":"Dump, load, restart","description":"Dumping","sidebar":"docSidebar"},"forking":{"id":"forking","title":"Forking","description":"To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself.","sidebar":"docSidebar"},"historic-state":{"id":"historic-state","title":"Historic state support","description":"With state archive capacity set to full, Devnet will store full state history, enabling its querying by block hash or number. The default mode is none, where no old states are stored and only the latest is available for querying.","sidebar":"docSidebar"},"intro":{"id":"intro","title":"Intro","description":"- Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)!","sidebar":"docSidebar"},"lite":{"id":"lite","title":"Lite mode","description":"To run Devnet in a minimal lite mode, provide the flag:","sidebar":"docSidebar"},"postman":{"id":"postman","title":"L1-L2 interaction via Postman","description":"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.","sidebar":"docSidebar"},"predeployed":{"id":"predeployed","title":"Predeployed contracts","description":"Devnet predeploys a UDC, an ERC20 (fee token) contract and a set of predeployed funded accounts.","sidebar":"docSidebar"},"running/cli":{"id":"running/cli","title":"CLI options","description":"Configure your Devnet instance by specifying CLI parameters on startup.","sidebar":"docSidebar"},"running/docker":{"id":"running/docker","title":"Run with Docker","description":"Devnet is available as a Docker image (Docker Hub link). To download the latest image, run:","sidebar":"docSidebar"},"running/install":{"id":"running/install","title":"Install and run","description":"Requirements","sidebar":"docSidebar"},"server-config":{"id":"server-config","title":"Server config","description":"To read generally about ways to configure your Devnet instance, check out the CLI section.","sidebar":"docSidebar"},"starknet-time":{"id":"starknet-time","title":"Starknet time","description":"Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods /settime and /increasetime generate a new block. This can be changed for /settime by setting the optional parameter generateblock to false. This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated.","sidebar":"docSidebar"}}}}')}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2282],{7164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":"unreleased","badge":true,"noIndex":false,"className":"docs-version-current","isLast":false,"docsSidebars":{"docSidebar":[{"type":"link","label":"Intro","href":"/starknet-devnet-rs/docs/next/intro","docId":"intro","unlisted":false},{"type":"category","label":"Running","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Install and run","href":"/starknet-devnet-rs/docs/next/running/install","docId":"running/install","unlisted":false},{"type":"link","label":"Run with Docker","href":"/starknet-devnet-rs/docs/next/running/docker","docId":"running/docker","unlisted":false},{"type":"link","label":"CLI options","href":"/starknet-devnet-rs/docs/next/running/cli","docId":"running/cli","unlisted":false}],"href":"/starknet-devnet-rs/docs/next/category/running"},{"type":"link","label":"Account impersonation","href":"/starknet-devnet-rs/docs/next/account-impersonation","docId":"account-impersonation","unlisted":false},{"type":"link","label":"API","href":"/starknet-devnet-rs/docs/next/api","docId":"api","unlisted":false},{"type":"link","label":"Account balance","href":"/starknet-devnet-rs/docs/next/balance","docId":"balance","unlisted":false},{"type":"link","label":"Blocks","href":"/starknet-devnet-rs/docs/next/blocks","docId":"blocks","unlisted":false},{"type":"link","label":"Dump, load, restart","href":"/starknet-devnet-rs/docs/next/dump-load-restart","docId":"dump-load-restart","unlisted":false},{"type":"link","label":"Forking","href":"/starknet-devnet-rs/docs/next/forking","docId":"forking","unlisted":false},{"type":"link","label":"Historic state support","href":"/starknet-devnet-rs/docs/next/historic-state","docId":"historic-state","unlisted":false},{"type":"link","label":"Lite mode","href":"/starknet-devnet-rs/docs/next/lite","docId":"lite","unlisted":false},{"type":"link","label":"L1-L2 interaction via Postman","href":"/starknet-devnet-rs/docs/next/postman","docId":"postman","unlisted":false},{"type":"link","label":"Predeployed contracts","href":"/starknet-devnet-rs/docs/next/predeployed","docId":"predeployed","unlisted":false},{"type":"link","label":"Server config","href":"/starknet-devnet-rs/docs/next/server-config","docId":"server-config","unlisted":false},{"type":"link","label":"Starknet time","href":"/starknet-devnet-rs/docs/next/starknet-time","docId":"starknet-time","unlisted":false}]},"docs":{"account-impersonation":{"id":"account-impersonation","title":"Account impersonation","description":"This page is about account impersonation. To read about account class selection and deployment, click here.","sidebar":"docSidebar"},"api":{"id":"api","title":"API","description":"Starknet API","sidebar":"docSidebar"},"balance":{"id":"balance","title":"Account balance","description":"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself.","sidebar":"docSidebar"},"blocks":{"id":"blocks","title":"Blocks","description":"Devnet starts with a genesis block (with a block number equal to 0). In forking mode, the genesis block number will be equal to the forked block number plus one.","sidebar":"docSidebar"},"dump-load-restart":{"id":"dump-load-restart","title":"Dump, load, restart","description":"Dumping","sidebar":"docSidebar"},"forking":{"id":"forking","title":"Forking","description":"To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself.","sidebar":"docSidebar"},"historic-state":{"id":"historic-state","title":"Historic state support","description":"With state archive capacity set to full, Devnet will store full state history, enabling its querying by block hash or number. The default mode is none, where no old states are stored and only the latest is available for querying.","sidebar":"docSidebar"},"intro":{"id":"intro","title":"Intro","description":"- Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)!","sidebar":"docSidebar"},"lite":{"id":"lite","title":"Lite mode","description":"To run Devnet in a minimal lite mode, provide the flag:","sidebar":"docSidebar"},"postman":{"id":"postman","title":"L1-L2 interaction via Postman","description":"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.","sidebar":"docSidebar"},"predeployed":{"id":"predeployed","title":"Predeployed contracts","description":"Devnet predeploys a UDC, an ERC20 (fee token) contract and a set of predeployed funded accounts.","sidebar":"docSidebar"},"running/cli":{"id":"running/cli","title":"CLI options","description":"Configure your Devnet instance by specifying CLI parameters on startup.","sidebar":"docSidebar"},"running/docker":{"id":"running/docker","title":"Run with Docker","description":"Devnet is available as a Docker image (Docker Hub link). To download the latest image, run:","sidebar":"docSidebar"},"running/install":{"id":"running/install","title":"Install and run","description":"Requirements","sidebar":"docSidebar"},"server-config":{"id":"server-config","title":"Server config","description":"To read generally about ways to configure your Devnet instance, check out the CLI section.","sidebar":"docSidebar"},"starknet-time":{"id":"starknet-time","title":"Starknet time","description":"Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods /settime, /increasetime and JSON-RPC methods devnetsetTime, devnetincreaseTime generate a new block. This can be changed for /settime (devnetsetTime) by setting the optional parameter generate_block to false. This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated.","sidebar":"docSidebar"}}}}')}}]); \ No newline at end of file diff --git a/assets/js/778bcc8b.6f445848.js b/assets/js/778bcc8b.6f445848.js new file mode 100644 index 000000000..c627294d0 --- /dev/null +++ b/assets/js/778bcc8b.6f445848.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1527],{9260:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>a,default:()=>l,frontMatter:()=>r,metadata:()=>c,toc:()=>o});var i=n(4848),s=n(8453);const r={},a="Starknet time",c={id:"starknet-time",title:"Starknet time",description:"Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods /settime, /increasetime and JSON-RPC methods devnetsetTime, devnetincreaseTime generate a new block. This can be changed for /settime (devnetsetTime) by setting the optional parameter generate_block to false. This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated.",source:"@site/docs/starknet-time.md",sourceDirName:".",slug:"/starknet-time",permalink:"/starknet-devnet-rs/docs/next/starknet-time",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/starknet-time.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Server config",permalink:"/starknet-devnet-rs/docs/next/server-config"}},d={},o=[{value:"Set time",id:"set-time",level:2},{value:"Increase time",id:"increase-time",level:2},{value:"Start time argument",id:"start-time-argument",level:2}];function m(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h1,{id:"starknet-time",children:"Starknet time"}),"\n",(0,i.jsxs)(t.p,{children:["Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods ",(0,i.jsx)(t.code,{children:"/set_time"}),", ",(0,i.jsx)(t.code,{children:"/increase_time"})," and ",(0,i.jsx)(t.code,{children:"JSON-RPC"})," methods ",(0,i.jsx)(t.code,{children:"devnet_setTime"}),", ",(0,i.jsx)(t.code,{children:"devnet_increaseTime"})," generate a new block. This can be changed for ",(0,i.jsx)(t.code,{children:"/set_time"})," (",(0,i.jsx)(t.code,{children:"devnet_setTime"}),") by setting the optional parameter ",(0,i.jsx)(t.code,{children:"generate_block"})," to ",(0,i.jsx)(t.code,{children:"false"}),". This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated."]}),"\n",(0,i.jsxs)(t.p,{children:["All values should be set in ",(0,i.jsx)(t.a,{href:"https://en.wikipedia.org/wiki/Unix_time",children:"Unix time seconds"}),"."]}),"\n",(0,i.jsx)(t.h2,{id:"set-time",children:"Set time"}),"\n",(0,i.jsx)(t.p,{children:"Sets the exact time and generates a new block."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'POST /set_time\n{\n "time": TIME_IN_SECONDS\n}\n'})}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_setTime",\n "params": {\n "time": TIME_IN_SECONDS\n }\n}\n'})}),"\n",(0,i.jsx)(t.p,{children:"Doesn't generate a new block, but sets the exact time for the next generated block."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'POST /set_time\n{\n "time": TIME_IN_SECONDS,\n "generate_block": false\n}\n'})}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_setTime",\n "params": {\n "time": TIME_IN_SECONDS,\n "generate_block": false\n }\n}\n'})}),"\n",(0,i.jsx)(t.p,{children:"Warning: block time can be set in the past which might lead to unexpected behavior!"}),"\n",(0,i.jsx)(t.h2,{id:"increase-time",children:"Increase time"}),"\n",(0,i.jsx)(t.p,{children:"Increases the block timestamp by the provided amount and generates a new block. All subsequent blocks will keep this increment."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'POST /increase_time\n{\n "time": TIME_IN_SECONDS\n}\n'})}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_increaseTime",\n "params": {\n "time": TIME_IN_SECONDS\n }\n}\n'})}),"\n",(0,i.jsx)(t.h2,{id:"start-time-argument",children:"Start time argument"}),"\n",(0,i.jsxs)(t.p,{children:["Devnet can be started with ",(0,i.jsx)(t.code,{children:"--start-time"})," CLI argument, where ",(0,i.jsx)(t.code,{children:"START_TIME_IN_SECONDS"})," should be greater than 0."]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"$ starknet-devnet --start-time \n"})})]})}function l(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(m,{...e})}):m(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var i=n(6540);const s={},r=i.createContext(s);function a(e){const t=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),i.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/778bcc8b.dd9974ab.js b/assets/js/778bcc8b.dd9974ab.js deleted file mode 100644 index a811d9083..000000000 --- a/assets/js/778bcc8b.dd9974ab.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1527],{9260:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>o,contentTitle:()=>a,default:()=>m,frontMatter:()=>r,metadata:()=>c,toc:()=>d});var i=n(4848),s=n(8453);const r={},a="Starknet time",c={id:"starknet-time",title:"Starknet time",description:"Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods /settime and /increasetime generate a new block. This can be changed for /settime by setting the optional parameter generateblock to false. This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated.",source:"@site/docs/starknet-time.md",sourceDirName:".",slug:"/starknet-time",permalink:"/starknet-devnet-rs/docs/next/starknet-time",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/starknet-time.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Server config",permalink:"/starknet-devnet-rs/docs/next/server-config"}},o={},d=[{value:"Set time",id:"set-time",level:2},{value:"Increase time",id:"increase-time",level:2},{value:"Start time argument",id:"start-time-argument",level:2}];function l(e){const t={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.h1,{id:"starknet-time",children:"Starknet time"}),"\n",(0,i.jsxs)(t.p,{children:["Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods ",(0,i.jsx)(t.code,{children:"/set_time"})," and ",(0,i.jsx)(t.code,{children:"/increase_time"})," generate a new block. This can be changed for ",(0,i.jsx)(t.code,{children:"/set_time"})," by setting the optional parameter ",(0,i.jsx)(t.code,{children:"generate_block"})," to ",(0,i.jsx)(t.code,{children:"false"}),". This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated."]}),"\n",(0,i.jsxs)(t.p,{children:["All values should be set in ",(0,i.jsx)(t.a,{href:"https://en.wikipedia.org/wiki/Unix_time",children:"Unix time seconds"}),"."]}),"\n",(0,i.jsx)(t.h2,{id:"set-time",children:"Set time"}),"\n",(0,i.jsx)(t.p,{children:"Sets the exact time and generates a new block."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'POST /set_time\n{\n "time": TIME_IN_SECONDS\n}\n'})}),"\n",(0,i.jsx)(t.p,{children:"Doesn't generate a new block, but sets the exact time for the next generated block."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'POST /set_time\n{\n "time": TIME_IN_SECONDS,\n "generate_block": false\n}\n'})}),"\n",(0,i.jsx)(t.p,{children:"Warning: block time can be set in the past which might lead to unexpected behavior!"}),"\n",(0,i.jsx)(t.h2,{id:"increase-time",children:"Increase time"}),"\n",(0,i.jsx)(t.p,{children:"Increases the block timestamp by the provided amount and generates a new block. All subsequent blocks will keep this increment."}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:'POST /increase_time\n{\n "time": TIME_IN_SECONDS\n}\n'})}),"\n",(0,i.jsx)(t.h2,{id:"start-time-argument",children:"Start time argument"}),"\n",(0,i.jsxs)(t.p,{children:["Devnet can be started with ",(0,i.jsx)(t.code,{children:"--start-time"})," CLI argument, where ",(0,i.jsx)(t.code,{children:"START_TIME_IN_SECONDS"})," should be greater than 0."]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"$ starknet-devnet --start-time \n"})})]})}function m(e={}){const{wrapper:t}={...(0,s.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(l,{...e})}):l(e)}},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>c});var i=n(6540);const s={},r=i.createContext(s);function a(e){const t=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),i.createElement(r.Provider,{value:t},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a5ad27b1.19c24872.js b/assets/js/a5ad27b1.19c24872.js deleted file mode 100644 index e960dc341..000000000 --- a/assets/js/a5ad27b1.19c24872.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5120],{6989:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>h,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var r=t(4848),d=t(8453);const s={},i="Dump, load, restart",o={id:"dump-load-restart",title:"Dump, load, restart",description:"Dumping",source:"@site/docs/dump-load-restart.md",sourceDirName:".",slug:"/dump-load-restart",permalink:"/starknet-devnet-rs/docs/next/dump-load-restart",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/dump-load-restart.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Blocks",permalink:"/starknet-devnet-rs/docs/next/blocks"},next:{title:"Forking",permalink:"/starknet-devnet-rs/docs/next/forking"}},a={},l=[{value:"Dumping",id:"dumping",level:2},{value:"Loading",id:"loading",level:2},{value:"Loading disclaimer",id:"loading-disclaimer",level:3},{value:"Restarting",id:"restarting",level:2},{value:"Docker",id:"docker",level:2}];function c(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,d.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"dump-load-restart",children:"Dump, load, restart"}),"\n",(0,r.jsx)(n.h2,{id:"dumping",children:"Dumping"}),"\n",(0,r.jsx)(n.p,{children:"To preserve your Devnet instance for future use, these are the options:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Dumping on exit (handles Ctrl+C, i.e. SIGINT; doesn't handle SIGKILL):"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --dump-on exit --dump-path \n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Dumping after each block:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --dump-on block --dump-path \n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Dumping on request requires providing --dump-on mode on the startup. Example usage in ",(0,r.jsx)(n.code,{children:"exit"})," mode (replace ",(0,r.jsx)(n.code,{children:""}),", ",(0,r.jsx)(n.code,{children:""})," and ",(0,r.jsx)(n.code,{children:""})," with your own):"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ starknet-devnet --dump-on exit --dump-path \n$ curl -X POST http://:/dump -d \'{ "path": }\' -H "Content-Type: application/json"\n'})}),"\n",(0,r.jsx)(n.h2,{id:"loading",children:"Loading"}),"\n",(0,r.jsx)(n.p,{children:"To load a preserved Devnet instance, the options are:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Loading on startup (note the argument name is not ",(0,r.jsx)(n.code,{children:"--load-path"})," as it was in Devnet-py):"]}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --dump-path \n"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:"Loading on request:"}),"\n"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'curl -X POST http://:/load -d \'{ "path": }\' -H "Content-Type: application/json"\n'})}),"\n",(0,r.jsxs)(n.p,{children:["Currently, dumping produces a list of received transactions that is stored on disk. Conversely, loading is implemented as the re-execution of transactions from a dump. This means that timestamps of ",(0,r.jsx)(n.code,{children:"StarknetBlock"})," will be different on each load."]}),"\n",(0,r.jsx)(n.h3,{id:"loading-disclaimer",children:"Loading disclaimer"}),"\n",(0,r.jsx)(n.p,{children:"Dumping and loading are not guaranteed to work across versions. I.e. if you dumped one version of Devnet, do not expect it to be loadable with a different version."}),"\n",(0,r.jsxs)(n.p,{children:["If you dumped a Devnet utilizing one class for account predeployment (e.g. ",(0,r.jsx)(n.code,{children:"--account-class cairo0"}),"), you should use the same option when loading. The same applies for dumping a Devnet in ",(0,r.jsx)(n.code,{children:"--block-generation-on demand"})," mode."]}),"\n",(0,r.jsx)(n.h2,{id:"restarting",children:"Restarting"}),"\n",(0,r.jsxs)(n.p,{children:["Devnet can be restarted by making a ",(0,r.jsx)(n.code,{children:"POST /restart"})," request (no body required). All of the deployed contracts (including predeployed), blocks and storage updates will be restarted to the original state, without the transactions and requests that may have been loaded from a dump file on startup."]}),"\n",(0,r.jsxs)(n.p,{children:["If you're using ",(0,r.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin#restart",children:(0,r.jsx)(n.strong,{children:"the Hardhat plugin"})}),", restart with ",(0,r.jsx)(n.code,{children:"starknet.devnet.restart()"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"docker",children:"Docker"}),"\n",(0,r.jsx)(n.p,{children:"To enable dumping and loading with dockerized Devnet, you must bind the container path to the path on your host machine."}),"\n",(0,r.jsx)(n.p,{children:"This example:"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["Relies on ",(0,r.jsx)(n.a,{href:"https://docs.docker.com/storage/bind-mounts/",children:"Docker bind mount"}),"; try ",(0,r.jsx)(n.a,{href:"https://docs.docker.com/storage/volumes/",children:"Docker volume"})," instead."]}),"\n",(0,r.jsxs)(n.li,{children:["Assumes that ",(0,r.jsx)(n.code,{children:"/path/to/dumpdir"})," exists. If unsure, use absolute paths."]}),"\n",(0,r.jsxs)(n.li,{children:["Assumes you are listening on ",(0,r.jsx)(n.code,{children:"127.0.0.1:5050"}),"."]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:["If there is ",(0,r.jsx)(n.code,{children:"mydump"})," inside ",(0,r.jsx)(n.code,{children:"/path/to/dumpdir"}),", you can load it with:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"docker run \\\n -p 127.0.0.1:5050:5050 \\\n --mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \\\n shardlabs/starknet-devnet-rs \\\n --dump-path /path/to/dumpdir/mydump\n"})}),"\n",(0,r.jsxs)(n.p,{children:["To dump to ",(0,r.jsx)(n.code,{children:"/path/to/dumpdir/mydump"})," on Devnet shutdown, run:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"docker run \\\n -p 127.0.0.1:5050:5050 \\\n --mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \\\n shardlabs/starknet-devnet-rs \\\n --dump-on exit --dump-path /path/to/dumpdir/mydump\n"})})]})}function h(e={}){const{wrapper:n}={...(0,d.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var r=t(6540);const d={},s=r.createContext(d);function i(e){const n=r.useContext(s);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(d):e.components||d:i(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a5ad27b1.a118c206.js b/assets/js/a5ad27b1.a118c206.js new file mode 100644 index 000000000..960d26d7d --- /dev/null +++ b/assets/js/a5ad27b1.a118c206.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5120],{6989:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>i,default:()=>h,frontMatter:()=>s,metadata:()=>o,toc:()=>l});var d=t(4848),r=t(8453);const s={},i="Dump, load, restart",o={id:"dump-load-restart",title:"Dump, load, restart",description:"Dumping",source:"@site/docs/dump-load-restart.md",sourceDirName:".",slug:"/dump-load-restart",permalink:"/starknet-devnet-rs/docs/next/dump-load-restart",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/dump-load-restart.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Blocks",permalink:"/starknet-devnet-rs/docs/next/blocks"},next:{title:"Forking",permalink:"/starknet-devnet-rs/docs/next/forking"}},a={},l=[{value:"Dumping",id:"dumping",level:2},{value:"Loading",id:"loading",level:2},{value:"Loading disclaimer",id:"loading-disclaimer",level:3},{value:"Restarting",id:"restarting",level:2},{value:"Docker",id:"docker",level:2}];function c(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(n.h1,{id:"dump-load-restart",children:"Dump, load, restart"}),"\n",(0,d.jsx)(n.h2,{id:"dumping",children:"Dumping"}),"\n",(0,d.jsx)(n.p,{children:"To preserve your Devnet instance for future use, these are the options:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"Dumping on exit (handles Ctrl+C, i.e. SIGINT; doesn't handle SIGKILL):"}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:"$ starknet-devnet --dump-on exit --dump-path \n"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"Dumping after each block:"}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:"$ starknet-devnet --dump-on block --dump-path \n"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["Dumping on request requires providing --dump-on mode on the startup. Example usage in ",(0,d.jsx)(n.code,{children:"exit"})," mode (replace ",(0,d.jsx)(n.code,{children:""}),", ",(0,d.jsx)(n.code,{children:""})," and ",(0,d.jsx)(n.code,{children:""})," with your own):"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:'$ starknet-devnet --dump-on exit --dump-path \n$ curl -X POST http://:/dump -d \'{ "path": }\' -H "Content-Type: application/json"\n'})}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_dump",\n "params": {\n "path": PATH\n }\n}\n'})}),"\n",(0,d.jsx)(n.h2,{id:"loading",children:"Loading"}),"\n",(0,d.jsx)(n.p,{children:"To load a preserved Devnet instance, the options are:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["Loading on startup (note the argument name is not ",(0,d.jsx)(n.code,{children:"--load-path"})," as it was in Devnet-py):"]}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:"$ starknet-devnet --dump-path \n"})}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsx)(n.li,{children:"Loading on request:"}),"\n"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:'curl -X POST http://:/load -d \'{ "path": }\' -H "Content-Type: application/json"\n'})}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_load",\n "params": {\n "path": PATH\n }\n}\n'})}),"\n",(0,d.jsxs)(n.p,{children:["Currently, dumping produces a list of received transactions that is stored on disk. Conversely, loading is implemented as the re-execution of transactions from a dump. This means that timestamps of ",(0,d.jsx)(n.code,{children:"StarknetBlock"})," will be different on each load."]}),"\n",(0,d.jsx)(n.h3,{id:"loading-disclaimer",children:"Loading disclaimer"}),"\n",(0,d.jsx)(n.p,{children:"Dumping and loading are not guaranteed to work across versions. I.e. if you dumped one version of Devnet, do not expect it to be loadable with a different version."}),"\n",(0,d.jsxs)(n.p,{children:["If you dumped a Devnet utilizing one class for account predeployment (e.g. ",(0,d.jsx)(n.code,{children:"--account-class cairo0"}),"), you should use the same option when loading. The same applies for dumping a Devnet in ",(0,d.jsx)(n.code,{children:"--block-generation-on demand"})," mode."]}),"\n",(0,d.jsx)(n.h2,{id:"restarting",children:"Restarting"}),"\n",(0,d.jsxs)(n.p,{children:["Devnet can be restarted by making a ",(0,d.jsx)(n.code,{children:"POST /restart"})," request (no body required) or ",(0,d.jsx)(n.code,{children:"JSON-RPC"})," request with method name ",(0,d.jsx)(n.code,{children:"devnet_restart"}),". All of the deployed contracts (including predeployed), blocks and storage updates will be restarted to the original state, without the transactions and requests that may have been loaded from a dump file on startup."]}),"\n",(0,d.jsxs)(n.p,{children:["If you're using ",(0,d.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin#restart",children:(0,d.jsx)(n.strong,{children:"the Hardhat plugin"})}),", restart with ",(0,d.jsx)(n.code,{children:"starknet.devnet.restart()"}),"."]}),"\n",(0,d.jsx)(n.h2,{id:"docker",children:"Docker"}),"\n",(0,d.jsx)(n.p,{children:"To enable dumping and loading with dockerized Devnet, you must bind the container path to the path on your host machine."}),"\n",(0,d.jsx)(n.p,{children:"This example:"}),"\n",(0,d.jsxs)(n.ul,{children:["\n",(0,d.jsxs)(n.li,{children:["Relies on ",(0,d.jsx)(n.a,{href:"https://docs.docker.com/storage/bind-mounts/",children:"Docker bind mount"}),"; try ",(0,d.jsx)(n.a,{href:"https://docs.docker.com/storage/volumes/",children:"Docker volume"})," instead."]}),"\n",(0,d.jsxs)(n.li,{children:["Assumes that ",(0,d.jsx)(n.code,{children:"/path/to/dumpdir"})," exists. If unsure, use absolute paths."]}),"\n",(0,d.jsxs)(n.li,{children:["Assumes you are listening on ",(0,d.jsx)(n.code,{children:"127.0.0.1:5050"}),"."]}),"\n"]}),"\n",(0,d.jsxs)(n.p,{children:["If there is ",(0,d.jsx)(n.code,{children:"mydump"})," inside ",(0,d.jsx)(n.code,{children:"/path/to/dumpdir"}),", you can load it with:"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:"docker run \\\n -p 127.0.0.1:5050:5050 \\\n --mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \\\n shardlabs/starknet-devnet-rs \\\n --dump-path /path/to/dumpdir/mydump\n"})}),"\n",(0,d.jsxs)(n.p,{children:["To dump to ",(0,d.jsx)(n.code,{children:"/path/to/dumpdir/mydump"})," on Devnet shutdown, run:"]}),"\n",(0,d.jsx)(n.pre,{children:(0,d.jsx)(n.code,{children:"docker run \\\n -p 127.0.0.1:5050:5050 \\\n --mount type=bind,source=/path/to/dumpdir,target=/path/to/dumpdir \\\n shardlabs/starknet-devnet-rs \\\n --dump-on exit --dump-path /path/to/dumpdir/mydump\n"})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,d.jsx)(n,{...e,children:(0,d.jsx)(c,{...e})}):c(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>i,x:()=>o});var d=t(6540);const r={},s=d.createContext(r);function i(e){const n=d.useContext(s);return d.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),d.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b0477c6d.079d8bef.js b/assets/js/b0477c6d.079d8bef.js deleted file mode 100644 index 98e79d13d..000000000 --- a/assets/js/b0477c6d.079d8bef.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5186],{686:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>r,default:()=>b,frontMatter:()=>a,metadata:()=>l,toc:()=>i});var o=t(4848),c=t(8453);const a={},r="Blocks",l={id:"blocks",title:"Blocks",description:"Devnet starts with a genesis block (with a block number equal to 0). In forking mode, the genesis block number will be equal to the forked block number plus one.",source:"@site/docs/blocks.md",sourceDirName:".",slug:"/blocks",permalink:"/starknet-devnet-rs/docs/next/blocks",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/blocks.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Account balance",permalink:"/starknet-devnet-rs/docs/next/balance"},next:{title:"Dump, load, restart",permalink:"/starknet-devnet-rs/docs/next/dump-load-restart"}},s={},i=[{value:"Creating blocks on demand",id:"creating-blocks-on-demand",level:2},{value:"Automatic periodic block creation",id:"automatic-periodic-block-creation",level:2},{value:"Create an empty block",id:"create-an-empty-block",level:2},{value:"Abort blocks",id:"abort-blocks",level:2}];function d(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"blocks",children:"Blocks"}),"\n",(0,o.jsx)(n.p,{children:"Devnet starts with a genesis block (with a block number equal to 0). In forking mode, the genesis block number will be equal to the forked block number plus one."}),"\n",(0,o.jsxs)(n.p,{children:["A new block is generated based on the pending block, once a new block is generated the pending block is restarted. By default, a new block is generated with each new transaction, but you can also ",(0,o.jsx)(n.a,{href:"#create-an-empty-block",children:"create an empty block by yourself"}),"."]}),"\n",(0,o.jsx)(n.h2,{id:"creating-blocks-on-demand",children:"Creating blocks on demand"}),"\n",(0,o.jsxs)(n.p,{children:["If you start Devnet with the ",(0,o.jsx)(n.code,{children:"--block-generation-on demand"})," CLI option, you will enable the possibility to store more than one transaction in the pending block (targetable via block tag ",(0,o.jsx)(n.code,{children:'"pending"'}),")."]}),"\n",(0,o.jsxs)(n.p,{children:["Once you've added the desired transactions into the pending block, you can send a ",(0,o.jsx)(n.code,{children:"POST"})," request to ",(0,o.jsx)(n.code,{children:"/create_block"}),". This will convert the pending block to the latest block (targetable via block tag ",(0,o.jsx)(n.code,{children:'"latest"'}),"), giving it a block hash and a block number. All subsequent transactions will be stored in a new pending block."]}),"\n",(0,o.jsx)(n.p,{children:"In case of demanding block creation with no pending transactions, a new empty block will be generated."}),"\n",(0,o.jsx)(n.p,{children:"The creation of the genesis block is not affected by this feature."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"POST /create_block\n"})}),"\n",(0,o.jsx)(n.p,{children:"Response:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"{'block_hash': '0x115e1b390cafa7942b6ab141ab85040defe7dee9bef3bc31d8b5b3d01cc9c67'}\n"})}),"\n",(0,o.jsx)(n.h2,{id:"automatic-periodic-block-creation",children:"Automatic periodic block creation"}),"\n",(0,o.jsxs)(n.p,{children:["Devnet started with the ",(0,o.jsx)(n.code,{children:"--block-generation-on "})," CLI option, will behave like in ",(0,o.jsx)(n.code,{children:"demand"})," mode but new blocks will be mined automatically in time intervals."]}),"\n",(0,o.jsx)(n.h2,{id:"create-an-empty-block",children:"Create an empty block"}),"\n",(0,o.jsxs)(n.p,{children:["To create an empty block without transactions, ",(0,o.jsx)(n.code,{children:"POST"})," a request to ",(0,o.jsx)(n.code,{children:"/create_block"}),":"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"POST /create_block\n"})}),"\n",(0,o.jsx)(n.p,{children:"Response:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:'{"block_hash": "0x115e1b390cafa7942b6ab141ab85040defe7dee9bef3bc31d8b5b3d01cc9c67"}\n'})}),"\n",(0,o.jsx)(n.h2,{id:"abort-blocks",children:"Abort blocks"}),"\n",(0,o.jsx)(n.p,{children:"This functionality allows simulating block abortion that can occur on mainnet."}),"\n",(0,o.jsx)(n.p,{children:"You can abort blocks and revert transactions from the specified block to the currently latest block. Newly created blocks after the abortion will have accepted status and will continue with numbering where the last accepted block left off."}),"\n",(0,o.jsx)(n.p,{children:"The state of Devnet will be reverted to the state of the last accepted block."}),"\n",(0,o.jsx)(n.p,{children:"E.g. assume there are 3 accepted blocks numbered 1, 2 and 3. Upon receiving a request to abort blocks starting with block 2, the blocks numbered 2 and 3 are aborted and their transactions reverted. The state of network will be as it was in block 1. Once a new block is mined, it will be accepted and it will have number 2."}),"\n",(0,o.jsx)(n.p,{children:"Aborted blocks can only be queried by block hash. Aborting the blocks in forking origin and already aborted blocks is not supported and results in an error."}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:'POST /abort_blocks\n{\n "starting_block_hash": BLOCK_HASH\n}\n'})}),"\n",(0,o.jsx)(n.p,{children:"Response:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:'{\n "aborted": [BLOCK_HASH_0, BLOCK_HASH_1, ...]\n}\n'})})]})}function b(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>r,x:()=>l});var o=t(6540);const c={},a=o.createContext(c);function r(e){const n=o.useContext(a);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function l(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:r(e.components),o.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b0477c6d.531ad97a.js b/assets/js/b0477c6d.531ad97a.js new file mode 100644 index 000000000..5195a144d --- /dev/null +++ b/assets/js/b0477c6d.531ad97a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5186],{686:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>b,frontMatter:()=>r,metadata:()=>a,toc:()=>i});var c=t(4848),o=t(8453);const r={},s="Blocks",a={id:"blocks",title:"Blocks",description:"Devnet starts with a genesis block (with a block number equal to 0). In forking mode, the genesis block number will be equal to the forked block number plus one.",source:"@site/docs/blocks.md",sourceDirName:".",slug:"/blocks",permalink:"/starknet-devnet-rs/docs/next/blocks",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/blocks.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Account balance",permalink:"/starknet-devnet-rs/docs/next/balance"},next:{title:"Dump, load, restart",permalink:"/starknet-devnet-rs/docs/next/dump-load-restart"}},l={},i=[{value:"Creating blocks on demand",id:"creating-blocks-on-demand",level:2},{value:"Automatic periodic block creation",id:"automatic-periodic-block-creation",level:2},{value:"Create an empty block",id:"create-an-empty-block",level:2},{value:"Abort blocks",id:"abort-blocks",level:2}];function d(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h1,{id:"blocks",children:"Blocks"}),"\n",(0,c.jsx)(n.p,{children:"Devnet starts with a genesis block (with a block number equal to 0). In forking mode, the genesis block number will be equal to the forked block number plus one."}),"\n",(0,c.jsxs)(n.p,{children:["A new block is generated based on the pending block, once a new block is generated the pending block is restarted. By default, a new block is generated with each new transaction, but you can also ",(0,c.jsx)(n.a,{href:"#create-an-empty-block",children:"create an empty block by yourself"}),"."]}),"\n",(0,c.jsx)(n.h2,{id:"creating-blocks-on-demand",children:"Creating blocks on demand"}),"\n",(0,c.jsxs)(n.p,{children:["If you start Devnet with the ",(0,c.jsx)(n.code,{children:"--block-generation-on demand"})," CLI option, you will enable the possibility to store more than one transaction in the pending block (targetable via block tag ",(0,c.jsx)(n.code,{children:'"pending"'}),")."]}),"\n",(0,c.jsxs)(n.p,{children:["Once you've added the desired transactions into the pending block, you can send a ",(0,c.jsx)(n.code,{children:"POST"})," request to ",(0,c.jsx)(n.code,{children:"/create_block"})," or ",(0,c.jsx)(n.code,{children:"JSON-RPC"})," request with method name ",(0,c.jsx)(n.code,{children:"devnet_createBlock"}),". This will convert the pending block to the latest block (targetable via block tag ",(0,c.jsx)(n.code,{children:'"latest"'}),"), giving it a block hash and a block number. All subsequent transactions will be stored in a new pending block."]}),"\n",(0,c.jsx)(n.p,{children:"In case of demanding block creation with no pending transactions, a new empty block will be generated."}),"\n",(0,c.jsx)(n.p,{children:"The creation of the genesis block is not affected by this feature."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:"POST /create_block\n"})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_createBlock"\n}\n'})}),"\n",(0,c.jsx)(n.p,{children:"Response:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:"{'block_hash': '0x115e1b390cafa7942b6ab141ab85040defe7dee9bef3bc31d8b5b3d01cc9c67'}\n"})}),"\n",(0,c.jsx)(n.h2,{id:"automatic-periodic-block-creation",children:"Automatic periodic block creation"}),"\n",(0,c.jsxs)(n.p,{children:["Devnet started with the ",(0,c.jsx)(n.code,{children:"--block-generation-on "})," CLI option, will behave like in ",(0,c.jsx)(n.code,{children:"demand"})," mode but new blocks will be mined automatically in time intervals."]}),"\n",(0,c.jsx)(n.h2,{id:"create-an-empty-block",children:"Create an empty block"}),"\n",(0,c.jsxs)(n.p,{children:["To create an empty block without transactions, ",(0,c.jsx)(n.code,{children:"POST"})," a request to ",(0,c.jsx)(n.code,{children:"/create_block"}),":"]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:"POST /create_block\n"})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_createBlock"\n}\n'})}),"\n",(0,c.jsx)(n.p,{children:"Response:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'{"block_hash": "0x115e1b390cafa7942b6ab141ab85040defe7dee9bef3bc31d8b5b3d01cc9c67"}\n'})}),"\n",(0,c.jsx)(n.h2,{id:"abort-blocks",children:"Abort blocks"}),"\n",(0,c.jsx)(n.p,{children:"This functionality allows simulating block abortion that can occur on mainnet."}),"\n",(0,c.jsx)(n.p,{children:"You can abort blocks and revert transactions from the specified block to the currently latest block. Newly created blocks after the abortion will have accepted status and will continue with numbering where the last accepted block left off."}),"\n",(0,c.jsx)(n.p,{children:"The state of Devnet will be reverted to the state of the last accepted block."}),"\n",(0,c.jsx)(n.p,{children:"E.g. assume there are 3 accepted blocks numbered 1, 2 and 3. Upon receiving a request to abort blocks starting with block 2, the blocks numbered 2 and 3 are aborted and their transactions reverted. The state of network will be as it was in block 1. Once a new block is mined, it will be accepted and it will have number 2."}),"\n",(0,c.jsx)(n.p,{children:"Aborted blocks can only be queried by block hash. Aborting the blocks in forking origin and already aborted blocks is not supported and results in an error."}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'POST /abort_blocks\n{\n "starting_block_hash": BLOCK_HASH\n}\n'})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_abortBlocks",\n "params": {\n "starting_block_hash": BLOCK_HASH\n }\n}\n'})}),"\n",(0,c.jsx)(n.p,{children:"Response:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'{\n "aborted": [BLOCK_HASH_0, BLOCK_HASH_1, ...]\n}\n'})})]})}function b(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(d,{...e})}):d(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var c=t(6540);const o={},r=c.createContext(o);function s(e){const n=c.useContext(r);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:s(e.components),c.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/b4513eec.2a54a4d3.js b/assets/js/b4513eec.48c3c682.js similarity index 77% rename from assets/js/b4513eec.2a54a4d3.js rename to assets/js/b4513eec.48c3c682.js index 209be0b55..27c0ee317 100644 --- a/assets/js/b4513eec.2a54a4d3.js +++ b/assets/js/b4513eec.48c3c682.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1863],{9025:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>s,default:()=>p,frontMatter:()=>r,metadata:()=>a,toc:()=>i});var o=t(4848),c=t(8453);const r={},s="Predeployed contracts",a={id:"predeployed",title:"Predeployed contracts",description:"Devnet predeploys a UDC, an ERC20 (fee token) contract and a set of predeployed funded accounts.",source:"@site/docs/predeployed.md",sourceDirName:".",slug:"/predeployed",permalink:"/starknet-devnet-rs/docs/next/predeployed",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/predeployed.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"L1-L2 interaction via Postman",permalink:"/starknet-devnet-rs/docs/next/postman"},next:{title:"Server config",permalink:"/starknet-devnet-rs/docs/next/server-config"}},d={},i=[{value:"Account class selection",id:"account-class-selection",level:2},{value:"Deploying an undeclared account",id:"deploying-an-undeclared-account",level:2},{value:"How to get predeployment info?",id:"how-to-get-predeployment-info",level:2}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"predeployed-contracts",children:"Predeployed contracts"}),"\n",(0,o.jsxs)(n.p,{children:["Devnet predeploys a ",(0,o.jsx)(n.a,{href:"https://docs.openzeppelin.com/contracts-cairo/0.6.1/udc",children:"UDC"}),", an ",(0,o.jsx)(n.a,{href:"https://docs.openzeppelin.com/contracts-cairo/0.8.1/erc20",children:"ERC20 (fee token)"})," contract and a set of predeployed funded accounts."]}),"\n",(0,o.jsxs)(n.p,{children:["The set of accounts can be controlled via ",(0,o.jsx)(n.a,{href:"./running/cli",children:"CLI options"}),": ",(0,o.jsx)(n.code,{children:"--accounts "}),", ",(0,o.jsx)(n.code,{children:"--initial-balance "}),", ",(0,o.jsx)(n.code,{children:"--seed "}),"."]}),"\n",(0,o.jsx)(n.h2,{id:"account-class-selection",children:"Account class selection"}),"\n",(0,o.jsx)(n.p,{children:"Choose between predeploying Cairo 0 (OpenZeppelin 0.5.1) or Cairo 1 (default; OpenZeppelin 0.8.1) accounts by using:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"--account-class [cairo0 | cairo1]\n"})}),"\n",(0,o.jsxs)(n.p,{children:["Alternatively, provide a path to the ",(0,o.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo#compiling-and-running-cairo-files",children:"Sierra artifact"})," of your custom account using:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"--account-class-custom \n"})}),"\n",(0,o.jsx)(n.h2,{id:"deploying-an-undeclared-account",children:"Deploying an undeclared account"}),"\n",(0,o.jsxs)(n.p,{children:["If you want to deploy an instance of an account contract class not predeclared on Devnet, you can use ",(0,o.jsx)(n.a,{href:"./forking",children:"forking"}),". Just fork an origin network which has the needed class already declared, e.g. the Sepolia testnet. Why? Because new versions of wallets like ArgentX and Braavos tend to be declared on testnet/mainnet soon after release."]}),"\n",(0,o.jsx)(n.h2,{id:"how-to-get-predeployment-info",children:"How to get predeployment info?"}),"\n",(0,o.jsxs)(n.p,{children:["The predeployment information is logged on Devnet startup. Predeployed accounts can be retrieved in JSON format by sending a ",(0,o.jsx)(n.code,{children:"GET"})," request to ",(0,o.jsx)(n.code,{children:"/predeployed_accounts"})," of your Devnet."]})]})}function p(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>a});var o=t(6540);const c={},r=o.createContext(c);function s(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),o.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1863],{9025:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>s,default:()=>p,frontMatter:()=>r,metadata:()=>d,toc:()=>i});var o=t(4848),c=t(8453);const r={},s="Predeployed contracts",d={id:"predeployed",title:"Predeployed contracts",description:"Devnet predeploys a UDC, an ERC20 (fee token) contract and a set of predeployed funded accounts.",source:"@site/docs/predeployed.md",sourceDirName:".",slug:"/predeployed",permalink:"/starknet-devnet-rs/docs/next/predeployed",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/predeployed.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"L1-L2 interaction via Postman",permalink:"/starknet-devnet-rs/docs/next/postman"},next:{title:"Server config",permalink:"/starknet-devnet-rs/docs/next/server-config"}},a={},i=[{value:"Account class selection",id:"account-class-selection",level:2},{value:"Deploying an undeclared account",id:"deploying-an-undeclared-account",level:2},{value:"How to get predeployment info?",id:"how-to-get-predeployment-info",level:2}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,c.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.h1,{id:"predeployed-contracts",children:"Predeployed contracts"}),"\n",(0,o.jsxs)(n.p,{children:["Devnet predeploys a ",(0,o.jsx)(n.a,{href:"https://docs.openzeppelin.com/contracts-cairo/0.6.1/udc",children:"UDC"}),", an ",(0,o.jsx)(n.a,{href:"https://docs.openzeppelin.com/contracts-cairo/0.8.1/erc20",children:"ERC20 (fee token)"})," contract and a set of predeployed funded accounts."]}),"\n",(0,o.jsxs)(n.p,{children:["The set of accounts can be controlled via ",(0,o.jsx)(n.a,{href:"./running/cli",children:"CLI options"}),": ",(0,o.jsx)(n.code,{children:"--accounts "}),", ",(0,o.jsx)(n.code,{children:"--initial-balance "}),", ",(0,o.jsx)(n.code,{children:"--seed "}),"."]}),"\n",(0,o.jsx)(n.h2,{id:"account-class-selection",children:"Account class selection"}),"\n",(0,o.jsx)(n.p,{children:"Choose between predeploying Cairo 0 (OpenZeppelin 0.5.1) or Cairo 1 (default; OpenZeppelin 0.8.1) accounts by using:"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"--account-class [cairo0 | cairo1]\n"})}),"\n",(0,o.jsxs)(n.p,{children:["Alternatively, provide a path to the ",(0,o.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo#compiling-and-running-cairo-files",children:"Sierra artifact"})," of your custom account using:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{children:"--account-class-custom \n"})}),"\n",(0,o.jsx)(n.h2,{id:"deploying-an-undeclared-account",children:"Deploying an undeclared account"}),"\n",(0,o.jsxs)(n.p,{children:["If you want to deploy an instance of an account contract class not predeclared on Devnet, you can use ",(0,o.jsx)(n.a,{href:"./forking",children:"forking"}),". Just fork an origin network which has the needed class already declared, e.g. the Sepolia testnet. Why? Because new versions of wallets like ArgentX and Braavos tend to be declared on testnet/mainnet soon after release."]}),"\n",(0,o.jsx)(n.h2,{id:"how-to-get-predeployment-info",children:"How to get predeployment info?"}),"\n",(0,o.jsxs)(n.p,{children:["The predeployment information is logged on Devnet startup. Predeployed accounts can be retrieved in JSON format by sending a ",(0,o.jsx)(n.code,{children:"GET"})," request to ",(0,o.jsx)(n.code,{children:"/predeployed_accounts"})," of your Devnet or ",(0,o.jsx)(n.code,{children:"JSON-RPC"})," request with method name ",(0,o.jsx)(n.code,{children:"devnet_getPredeployedAccounts"}),"."]})]})}function p(e={}){const{wrapper:n}={...(0,c.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>s,x:()=>d});var o=t(6540);const c={},r=o.createContext(c);function s(e){const n=o.useContext(r);return o.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(c):e.components||c:s(e.components),o.createElement(r.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bca784a7.0345585f.js b/assets/js/bca784a7.0345585f.js deleted file mode 100644 index 51627ba3c..000000000 --- a/assets/js/bca784a7.0345585f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8626],{5787:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var s=t(4848),r=t(8453);const a={},o="L1-L2 interaction via Postman",i={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/docs/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/next/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/postman.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/next/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/next/predeployed"}},d={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,s.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,s.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,s.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,s.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin",children:(0,s.jsx)(n.strong,{children:(0,s.jsx)(n.code,{children:"starknet-hardhat-plugin"})})})," to perform these actions, as witnessed in ",(0,s.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/test/postman.test.ts",children:(0,s.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,s.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,s.jsxs)(n.p,{children:["Loads a ",(0,s.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,s.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,s.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,s.jsxs)(n.p,{children:[(0,s.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,s.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,s.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,s.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,s.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,s.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,s.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,s.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,s.jsxs)(n.p,{children:["A running L1 node is required if ",(0,s.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,s.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,s.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,s.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,s.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,s.jsxs)(n.p,{children:["The constructor takes an ",(0,s.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,s.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,s.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,s.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,s.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,s.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,s.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,s.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,s.jsxs)(n.p,{children:["Normally ",(0,s.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,s.jsxs)(n.p,{children:["A running L1 node is ",(0,s.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,s.jsx)(n.p,{children:"Request:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:"Response:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,s.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,s.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,s.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,s.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,s.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,s.jsx)(n.p,{children:"Request:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,s.jsx)(n.p,{children:"Response:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var s=t(6540);const r={},a=s.createContext(r);function o(e){const n=s.useContext(a);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),s.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bca784a7.547f56bd.js b/assets/js/bca784a7.547f56bd.js new file mode 100644 index 000000000..f111c756a --- /dev/null +++ b/assets/js/bca784a7.547f56bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8626],{5787:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var t=s(4848),r=s(8453);const a={},d="L1-L2 interaction via Postman",o={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/docs/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/next/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/postman.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/next/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/next/predeployed"}},c={},i=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-hardhat-plugin"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/test/postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>o});var t=s(6540);const r={},a=t.createContext(r);function d(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e28eadbb.28dbb1f2.js b/assets/js/e28eadbb.eb97ff9d.js similarity index 81% rename from assets/js/e28eadbb.28dbb1f2.js rename to assets/js/e28eadbb.eb97ff9d.js index 7ab127108..98d9aafb7 100644 --- a/assets/js/e28eadbb.28dbb1f2.js +++ b/assets/js/e28eadbb.eb97ff9d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3332],{1498:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>h,frontMatter:()=>i,metadata:()=>d,toc:()=>l});var r=t(4848),s=t(8453);const i={},o="Server config",d={id:"server-config",title:"Server config",description:"To read generally about ways to configure your Devnet instance, check out the CLI section.",source:"@site/docs/server-config.md",sourceDirName:".",slug:"/server-config",permalink:"/starknet-devnet-rs/docs/next/server-config",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/server-config.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/next/predeployed"},next:{title:"Starknet time",permalink:"/starknet-devnet-rs/docs/next/starknet-time"}},c={},l=[{value:"Host and port",id:"host-and-port",level:2},{value:"Logging",id:"logging",level:2},{value:"Timeout",id:"timeout",level:2},{value:"Request body size limit",id:"request-body-size-limit",level:2},{value:"API",id:"api",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"server-config",children:"Server config"}),"\n",(0,r.jsxs)(n.p,{children:["To read generally about ways to configure your Devnet instance, check out the ",(0,r.jsx)(n.a,{href:"/starknet-devnet-rs/docs/next/running/cli",children:"CLI section"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"host-and-port",children:"Host and port"}),"\n",(0,r.jsxs)(n.p,{children:["Specify the host and the port used by the server with ",(0,r.jsx)(n.code,{children:"--host
"})," and ",(0,r.jsx)(n.code,{children:"--port "})," CLI arguments. If running with Docker, check out the ",(0,r.jsx)(n.a,{href:"./running/docker#container-port-publishing",children:"port publishing docs"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"logging",children:"Logging"}),"\n",(0,r.jsxs)(n.p,{children:["By default, the logging level is ",(0,r.jsx)(n.code,{children:"INFO"}),", but this can be changed via the ",(0,r.jsx)(n.code,{children:"RUST_LOG"})," environment variable."]}),"\n",(0,r.jsxs)(n.p,{children:["All logging levels: ",(0,r.jsx)(n.code,{children:"TRACE"}),", ",(0,r.jsx)(n.code,{children:"DEBUG"}),", ",(0,r.jsx)(n.code,{children:"INFO"}),", ",(0,r.jsx)(n.code,{children:"WARN"}),", ",(0,r.jsx)(n.code,{children:"ERROR"})]}),"\n",(0,r.jsx)(n.p,{children:"To specify the logging level and run Devnet on the same line:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ RUST_LOG= starknet-devnet\n"})}),"\n",(0,r.jsx)(n.p,{children:"or if using dockerized Devnet:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ docker run -e RUST_LOG= shardlabs/starknet-devnet-rs\n"})}),"\n",(0,r.jsxs)(n.p,{children:["By default, logging of request and response data is turned off.\nTo see the request and/or response body, additional levels can be specified via the ",(0,r.jsx)(n.code,{children:"RUST_LOG"})," environment variable: ",(0,r.jsx)(n.code,{children:"REQUEST"})," for request body, ",(0,r.jsx)(n.code,{children:"RESPONSE"})," for response body."]}),"\n",(0,r.jsxs)(n.admonition,{type:"note",children:[(0,r.jsxs)(n.p,{children:["Logging request and response requires at least logging level ",(0,r.jsx)(n.code,{children:"INFO"}),"."]}),(0,r.jsxs)(n.p,{children:["For example, the following two commands will log request and response data with log level ",(0,r.jsx)(n.code,{children:"INFO"}),"."]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ RUST_LOG="REQUEST,RESPONSE" starknet-devnet\n'})}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ RUST_LOG="REQUEST,RESPONSE,INFO" starknet-devnet\n'})})]}),"\n",(0,r.jsx)(n.h2,{id:"timeout",children:"Timeout"}),"\n",(0,r.jsx)(n.p,{children:"Specify the maximum amount of time an HTTP request can be served. This makes it possible to deploy and manage large contracts that take longer to execute."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --timeout \n"})}),"\n",(0,r.jsx)(n.h2,{id:"request-body-size-limit",children:"Request body size limit"}),"\n",(0,r.jsx)(n.p,{children:"Specify the maximum size of an incoming HTTP request body. This makes it possible to deploy and manage large contracts that take up more space."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --request-body-size-limit \n"})}),"\n",(0,r.jsx)(n.h2,{id:"api",children:"API"}),"\n",(0,r.jsxs)(n.p,{children:["Retrieve the server config by sending a ",(0,r.jsx)(n.code,{children:"GET"})," request to ",(0,r.jsx)(n.code,{children:"/config"})," and extracting its ",(0,r.jsx)(n.code,{children:"server_config"})," property."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ curl localhost:5050/config | jq .server_config\n"})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>d});var r=t(6540);const s={},i=r.createContext(s);function o(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3332],{1498:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>o,default:()=>h,frontMatter:()=>i,metadata:()=>d,toc:()=>l});var r=t(4848),s=t(8453);const i={},o="Server config",d={id:"server-config",title:"Server config",description:"To read generally about ways to configure your Devnet instance, check out the CLI section.",source:"@site/docs/server-config.md",sourceDirName:".",slug:"/server-config",permalink:"/starknet-devnet-rs/docs/next/server-config",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/server-config.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/next/predeployed"},next:{title:"Starknet time",permalink:"/starknet-devnet-rs/docs/next/starknet-time"}},c={},l=[{value:"Host and port",id:"host-and-port",level:2},{value:"Logging",id:"logging",level:2},{value:"Timeout",id:"timeout",level:2},{value:"Request body size limit",id:"request-body-size-limit",level:2},{value:"API",id:"api",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h1,{id:"server-config",children:"Server config"}),"\n",(0,r.jsxs)(n.p,{children:["To read generally about ways to configure your Devnet instance, check out the ",(0,r.jsx)(n.a,{href:"/starknet-devnet-rs/docs/next/running/cli",children:"CLI section"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"host-and-port",children:"Host and port"}),"\n",(0,r.jsxs)(n.p,{children:["Specify the host and the port used by the server with ",(0,r.jsx)(n.code,{children:"--host
"})," and ",(0,r.jsx)(n.code,{children:"--port "})," CLI arguments. If running with Docker, check out the ",(0,r.jsx)(n.a,{href:"./running/docker#container-port-publishing",children:"port publishing docs"}),"."]}),"\n",(0,r.jsx)(n.h2,{id:"logging",children:"Logging"}),"\n",(0,r.jsxs)(n.p,{children:["By default, the logging level is ",(0,r.jsx)(n.code,{children:"INFO"}),", but this can be changed via the ",(0,r.jsx)(n.code,{children:"RUST_LOG"})," environment variable."]}),"\n",(0,r.jsxs)(n.p,{children:["All logging levels: ",(0,r.jsx)(n.code,{children:"TRACE"}),", ",(0,r.jsx)(n.code,{children:"DEBUG"}),", ",(0,r.jsx)(n.code,{children:"INFO"}),", ",(0,r.jsx)(n.code,{children:"WARN"}),", ",(0,r.jsx)(n.code,{children:"ERROR"})]}),"\n",(0,r.jsx)(n.p,{children:"To specify the logging level and run Devnet on the same line:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ RUST_LOG= starknet-devnet\n"})}),"\n",(0,r.jsx)(n.p,{children:"or if using dockerized Devnet:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ docker run -e RUST_LOG= shardlabs/starknet-devnet-rs\n"})}),"\n",(0,r.jsxs)(n.p,{children:["By default, logging of request and response data is turned off.\nTo see the request and/or response body, additional levels can be specified via the ",(0,r.jsx)(n.code,{children:"RUST_LOG"})," environment variable: ",(0,r.jsx)(n.code,{children:"REQUEST"})," for request body, ",(0,r.jsx)(n.code,{children:"RESPONSE"})," for response body."]}),"\n",(0,r.jsxs)(n.admonition,{type:"note",children:[(0,r.jsxs)(n.p,{children:["Logging request and response requires at least logging level ",(0,r.jsx)(n.code,{children:"INFO"}),"."]}),(0,r.jsxs)(n.p,{children:["For example, the following two commands will log request and response data with log level ",(0,r.jsx)(n.code,{children:"INFO"}),"."]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ RUST_LOG="REQUEST,RESPONSE" starknet-devnet\n'})}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'$ RUST_LOG="REQUEST,RESPONSE,INFO" starknet-devnet\n'})})]}),"\n",(0,r.jsx)(n.h2,{id:"timeout",children:"Timeout"}),"\n",(0,r.jsx)(n.p,{children:"Specify the maximum amount of time an HTTP request can be served. This makes it possible to deploy and manage large contracts that take longer to execute."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --timeout \n"})}),"\n",(0,r.jsx)(n.h2,{id:"request-body-size-limit",children:"Request body size limit"}),"\n",(0,r.jsx)(n.p,{children:"Specify the maximum size of an incoming HTTP request body. This makes it possible to deploy and manage large contracts that take up more space."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ starknet-devnet --request-body-size-limit \n"})}),"\n",(0,r.jsx)(n.h2,{id:"api",children:"API"}),"\n",(0,r.jsxs)(n.p,{children:["Retrieve the server config by sending a ",(0,r.jsx)(n.code,{children:"GET"})," request to ",(0,r.jsx)(n.code,{children:"/config"})," or ",(0,r.jsx)(n.code,{children:"JSON-RPC"})," request with method name ",(0,r.jsx)(n.code,{children:"devnet_getConfig"})," and extracting its ",(0,r.jsx)(n.code,{children:"server_config"})," property."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"$ curl localhost:5050/config | jq .server_config\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_getConfig"\n}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>d});var r=t(6540);const s={},i=r.createContext(s);function o(e){const n=r.useContext(i);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),r.createElement(i.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e44e17f8.c2db0a90.js b/assets/js/e44e17f8.c2db0a90.js new file mode 100644 index 000000000..e5f5d96e1 --- /dev/null +++ b/assets/js/e44e17f8.c2db0a90.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6187],{2470:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>r,contentTitle:()=>d,default:()=>h,frontMatter:()=>s,metadata:()=>o,toc:()=>i});var c=t(4848),a=t(8453);const s={},d="Account balance",o={id:"balance",title:"Account balance",description:"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself.",source:"@site/docs/balance.md",sourceDirName:".",slug:"/balance",permalink:"/starknet-devnet-rs/docs/next/balance",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/balance.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"API",permalink:"/starknet-devnet-rs/docs/next/api"},next:{title:"Blocks",permalink:"/starknet-devnet-rs/docs/next/blocks"}},r={},i=[{value:"Mint token - Local faucet",id:"mint-token---local-faucet",level:2},{value:"Check balance",id:"check-balance",level:2}];function l(e){const n={code:"code",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h1,{id:"account-balance",children:"Account balance"}),"\n",(0,c.jsx)(n.p,{children:"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself."}),"\n",(0,c.jsx)(n.p,{children:"Separate tokens use separate ERC20 contracts for minting and charging fees. These are the token contracts predeployed by Devnet and the addresses where they are located:"}),"\n",(0,c.jsxs)(n.ul,{children:["\n",(0,c.jsxs)(n.li,{children:["ETH: ",(0,c.jsx)(n.code,{children:"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"})]}),"\n",(0,c.jsxs)(n.li,{children:["STRK: ",(0,c.jsx)(n.code,{children:"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"})]}),"\n"]}),"\n",(0,c.jsx)(n.h2,{id:"mint-token---local-faucet",children:"Mint token - Local faucet"}),"\n",(0,c.jsxs)(n.p,{children:["By sending a ",(0,c.jsx)(n.code,{children:"POST"})," request to ",(0,c.jsx)(n.code,{children:"/mint"})," or ",(0,c.jsx)(n.code,{children:"JSON-RPC"})," request with method name ",(0,c.jsx)(n.code,{children:"devnet_mint"})," for a token, you initiate a transaction on that token's ERC20 contract. The response contains the hash of this transaction, as well as the new balance after minting. The token is specified by providing the unit, and defaults to ",(0,c.jsx)(n.code,{children:"WEI"}),"."]}),"\n",(0,c.jsxs)(n.p,{children:["The value of ",(0,c.jsx)(n.code,{children:"amount"})," is in WEI and needs to be an integer (or a float whose fractional part is 0, e.g. ",(0,c.jsx)(n.code,{children:"1000.0"})," or ",(0,c.jsx)(n.code,{children:"1e21"}),")"]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'POST /mint\n{\n "address": "0x6e3205f...",\n "amount": 500000,\n "unit": "WEI" | "FRI"\n}\n'})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_mint",\n "params": {\n "address": "0x6e3205f...",\n "amount": 500000,\n "unit": "WEI" | "FRI"\n }\n}\n'})}),"\n",(0,c.jsx)(n.p,{children:"Response:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'{\n "new_balance": 500000,\n "unit": "WEI" | "FRI",\n "tx_hash": "0xa24f23..."\n}\n'})}),"\n",(0,c.jsx)(n.h2,{id:"check-balance",children:"Check balance"}),"\n",(0,c.jsxs)(n.p,{children:["Check the balance of an address by sending a ",(0,c.jsx)(n.code,{children:"GET"})," request to ",(0,c.jsx)(n.code,{children:"/account_balance"}),". The address should be a 0x-prefixed hex string; ",(0,c.jsx)(n.code,{children:"unit"})," defaults to ",(0,c.jsx)(n.code,{children:"WEI"})," and ",(0,c.jsx)(n.code,{children:"block_tag"})," to ",(0,c.jsx)(n.code,{children:"latest"}),"."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:"GET /account_balance?address=
[&unit=][&block_tag=]\n"})}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_getAccountBalance",\n "params": {\n "address": "0x6e3205f...",\n "unit": "WEI" | "FRI",\n "block_tag": "latest" | "pending"\n }\n}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>d,x:()=>o});var c=t(6540);const a={},s=c.createContext(a);function d(e){const n=c.useContext(s);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:d(e.components),c.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/e44e17f8.c49d81b4.js b/assets/js/e44e17f8.c49d81b4.js deleted file mode 100644 index f7a90ab56..000000000 --- a/assets/js/e44e17f8.c49d81b4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6187],{2470:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>r,contentTitle:()=>d,default:()=>h,frontMatter:()=>s,metadata:()=>o,toc:()=>i});var c=t(4848),a=t(8453);const s={},d="Account balance",o={id:"balance",title:"Account balance",description:"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself.",source:"@site/docs/balance.md",sourceDirName:".",slug:"/balance",permalink:"/starknet-devnet-rs/docs/next/balance",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/balance.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"API",permalink:"/starknet-devnet-rs/docs/next/api"},next:{title:"Blocks",permalink:"/starknet-devnet-rs/docs/next/blocks"}},r={},i=[{value:"Mint token - Local faucet",id:"mint-token---local-faucet",level:2},{value:"Check balance",id:"check-balance",level:2}];function l(e){const n={code:"code",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,a.R)(),...e.components};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.h1,{id:"account-balance",children:"Account balance"}),"\n",(0,c.jsx)(n.p,{children:"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself."}),"\n",(0,c.jsx)(n.p,{children:"Separate tokens use separate ERC20 contracts for minting and charging fees. These are the token contracts predeployed by Devnet and the addresses where they are located:"}),"\n",(0,c.jsxs)(n.ul,{children:["\n",(0,c.jsxs)(n.li,{children:["ETH: ",(0,c.jsx)(n.code,{children:"0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"})]}),"\n",(0,c.jsxs)(n.li,{children:["STRK: ",(0,c.jsx)(n.code,{children:"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"})]}),"\n"]}),"\n",(0,c.jsx)(n.h2,{id:"mint-token---local-faucet",children:"Mint token - Local faucet"}),"\n",(0,c.jsxs)(n.p,{children:["By sending a ",(0,c.jsx)(n.code,{children:"POST"})," request to ",(0,c.jsx)(n.code,{children:"/mint"})," for a token, you initiate a transaction on that token's ERC20 contract. The response contains the hash of this transaction, as well as the new balance after minting. The token is specified by providing the unit, and defaults to ",(0,c.jsx)(n.code,{children:"WEI"}),"."]}),"\n",(0,c.jsxs)(n.p,{children:["The value of ",(0,c.jsx)(n.code,{children:"amount"})," is in WEI and needs to be an integer (or a float whose fractional part is 0, e.g. ",(0,c.jsx)(n.code,{children:"1000.0"})," or ",(0,c.jsx)(n.code,{children:"1e21"}),")"]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'POST /mint\n{\n "address": "0x6e3205f...",\n "amount": 500000,\n "unit": "WEI" | "FRI"\n}\n'})}),"\n",(0,c.jsx)(n.p,{children:"Response:"}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:'{\n "new_balance": 500000,\n "unit": "WEI" | "FRI",\n "tx_hash": "0xa24f23..."\n}\n'})}),"\n",(0,c.jsx)(n.h2,{id:"check-balance",children:"Check balance"}),"\n",(0,c.jsxs)(n.p,{children:["Check the balance of an address by sending a ",(0,c.jsx)(n.code,{children:"GET"})," request to ",(0,c.jsx)(n.code,{children:"/account_balance"}),". The address should be a 0x-prefixed hex string; ",(0,c.jsx)(n.code,{children:"unit"})," defaults to ",(0,c.jsx)(n.code,{children:"WEI"})," and ",(0,c.jsx)(n.code,{children:"block_tag"})," to ",(0,c.jsx)(n.code,{children:"latest"}),"."]}),"\n",(0,c.jsx)(n.pre,{children:(0,c.jsx)(n.code,{children:"GET /account_balance?address=
[&unit=][&block_tag=]\n"})})]})}function h(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,c.jsx)(n,{...e,children:(0,c.jsx)(l,{...e})}):l(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>d,x:()=>o});var c=t(6540);const a={},s=c.createContext(a);function d(e){const n=c.useContext(s);return c.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:d(e.components),c.createElement(s.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.07d34fe8.js b/assets/js/runtime~main.0e391459.js similarity index 63% rename from assets/js/runtime~main.07d34fe8.js rename to assets/js/runtime~main.0e391459.js index 23ae597cd..ebe169fff 100644 --- a/assets/js/runtime~main.07d34fe8.js +++ b/assets/js/runtime~main.0e391459.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,b,f,t,c={},r={};function d(e){var a=r[e];if(void 0!==a)return a.exports;var b=r[e]={id:e,loaded:!1,exports:{}};return c[e].call(b.exports,b,b.exports,d),b.loaded=!0,b.exports}d.m=c,d.c=r,e=[],d.O=(a,b,f,t)=>{if(!b){var c=1/0;for(i=0;i=t)&&Object.keys(d.O).every((e=>d.O[e](b[o])))?b.splice(o--,1):(r=!1,t0&&e[i-1][2]>t;i--)e[i]=e[i-1];e[i]=[b,f,t]},d.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return d.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var t=Object.create(null);d.r(t);var c={};a=a||[null,b({}),b([]),b(b)];for(var r=2&f&&e;"object"==typeof r&&!~a.indexOf(r);r=b(r))Object.getOwnPropertyNames(r).forEach((a=>c[a]=()=>e[a]));return c.default=()=>e,d.d(t,c),t},d.d=(e,a)=>{for(var b in a)d.o(a,b)&&!d.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((a,b)=>(d.f[b](e,a),a)),[])),d.u=e=>"assets/js/"+({134:"b7bb6147",337:"3f194bb7",463:"682c6856",562:"5fadd32f",598:"c25a813d",646:"7b998695",952:"2d66ba60",1235:"a7456010",1316:"1b560adb",1475:"9c3aeb12",1527:"778bcc8b",1863:"b4513eec",1914:"1151f991",2282:"6d990bb1",2408:"9abfa349",2412:"16a2713f",2627:"4769fc4e",2828:"49885c5e",2871:"3c883fc4",2916:"425e1ae2",3332:"e28eadbb",3726:"a5e062ff",3768:"e8953dad",3956:"a0ea14c4",3976:"0e384e19",4134:"393be207",4290:"ae603a5f",4583:"1df93b7f",4676:"24503201",4876:"17682634",5120:"a5ad27b1",5186:"b0477c6d",5480:"80526ee6",5532:"e81f6410",5624:"9b932233",5700:"b9f7b2ab",5742:"aba21aa0",5771:"8f2e4180",5960:"0657c530",6017:"8d981dc3",6061:"1f391b9e",6187:"e44e17f8",6286:"e2f00550",6439:"ad6bd692",6773:"2146f16f",6828:"9976ff42",6900:"cc3979e2",6969:"14eb3368",7098:"a7bd4aaa",7229:"eb78b783",7230:"93f75803",7595:"0debafb6",7624:"5fbc5cf1",7969:"5985dcf4",8401:"17896441",8626:"bca784a7",9048:"a94703ab",9167:"ba738306",9218:"cc2baa30",9378:"5b870ab8",9440:"8d820236",9629:"9875b4b5",9647:"5e95c892",9998:"7923f30a"}[e]||e)+"."+{134:"290a582f",337:"22bfc72a",463:"6d8a69a6",562:"4470b0e4",598:"dcaf95cd",646:"ba2beb82",952:"5554bca5",1235:"7b4b0a20",1316:"0fed137f",1475:"75ce2603",1527:"dd9974ab",1863:"2a54a4d3",1914:"193b4b8f",2237:"ede9a640",2282:"f3976d03",2408:"32a724b9",2412:"7d2fd4b2",2627:"8cd2f5e8",2828:"88fa1633",2871:"d1c841d8",2916:"a5de04d1",3332:"28dbb1f2",3658:"e4ca47ec",3726:"a888e2f6",3768:"ac67425e",3956:"74b8c7b1",3976:"5aa906b8",4134:"030d51d7",4290:"fa5b263f",4583:"f182b925",4676:"bb859ed4",4876:"3d25384a",5120:"19c24872",5186:"079d8bef",5480:"b9a69f3d",5532:"60f06895",5624:"10ce9365",5700:"4aa13ff2",5742:"9ac6642b",5771:"6fb725c9",5960:"aa8fdf00",6017:"77fdfc67",6061:"68f8d4d4",6187:"c49d81b4",6286:"76a5e6d2",6439:"7bc5fb7f",6773:"3e9e5b9b",6828:"8da5bc72",6900:"f2efdc37",6969:"eeb6b7e2",7098:"b82ee0df",7229:"33a8bdeb",7230:"260ce03e",7595:"bf13c614",7624:"0b9257a5",7969:"49afb06c",8401:"4295b40f",8626:"0345585f",9048:"2668bc5b",9167:"0c1ac6c3",9218:"c74667a4",9378:"e5b723a6",9440:"525617f1",9629:"0aaf62d5",9647:"b1f5748f",9998:"4aa28861"}[e]+".js",d.miniCssF=e=>{},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},t="website:",d.l=(e,a,b,c)=>{if(f[e])f[e].push(a);else{var r,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{r.onerror=r.onload=null,clearTimeout(s);var t=f[e];if(delete f[e],r.parentNode&&r.parentNode.removeChild(r),t&&t.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=l.bind(null,r.onerror),r.onload=l.bind(null,r.onload),o&&document.head.appendChild(r)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.p="/starknet-devnet-rs/",d.gca=function(e){return e={17682634:"4876",17896441:"8401",24503201:"4676",b7bb6147:"134","3f194bb7":"337","682c6856":"463","5fadd32f":"562",c25a813d:"598","7b998695":"646","2d66ba60":"952",a7456010:"1235","1b560adb":"1316","9c3aeb12":"1475","778bcc8b":"1527",b4513eec:"1863","1151f991":"1914","6d990bb1":"2282","9abfa349":"2408","16a2713f":"2412","4769fc4e":"2627","49885c5e":"2828","3c883fc4":"2871","425e1ae2":"2916",e28eadbb:"3332",a5e062ff:"3726",e8953dad:"3768",a0ea14c4:"3956","0e384e19":"3976","393be207":"4134",ae603a5f:"4290","1df93b7f":"4583",a5ad27b1:"5120",b0477c6d:"5186","80526ee6":"5480",e81f6410:"5532","9b932233":"5624",b9f7b2ab:"5700",aba21aa0:"5742","8f2e4180":"5771","0657c530":"5960","8d981dc3":"6017","1f391b9e":"6061",e44e17f8:"6187",e2f00550:"6286",ad6bd692:"6439","2146f16f":"6773","9976ff42":"6828",cc3979e2:"6900","14eb3368":"6969",a7bd4aaa:"7098",eb78b783:"7229","93f75803":"7230","0debafb6":"7595","5fbc5cf1":"7624","5985dcf4":"7969",bca784a7:"8626",a94703ab:"9048",ba738306:"9167",cc2baa30:"9218","5b870ab8":"9378","8d820236":"9440","9875b4b5":"9629","5e95c892":"9647","7923f30a":"9998"}[e]||e,d.p+d.u(e)},(()=>{var e={5354:0,1869:0};d.f.j=(a,b)=>{var f=d.o(e,a)?e[a]:void 0;if(0!==f)if(f)b.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var t=new Promise(((b,t)=>f=e[a]=[b,t]));b.push(f[2]=t);var c=d.p+d.u(a),r=new Error;d.l(c,(b=>{if(d.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var t=b&&("load"===b.type?"missing":b.type),c=b&&b.target&&b.target.src;r.message="Loading chunk "+a+" failed.\n("+t+": "+c+")",r.name="ChunkLoadError",r.type=t,r.request=c,f[1](r)}}),"chunk-"+a,a)}},d.O.j=a=>0===e[a];var a=(a,b)=>{var f,t,c=b[0],r=b[1],o=b[2],n=0;if(c.some((a=>0!==e[a]))){for(f in r)d.o(r,f)&&(d.m[f]=r[f]);if(o)var i=o(d)}for(a&&a(b);n{"use strict";var e,a,b,f,t,r={},c={};function d(e){var a=c[e];if(void 0!==a)return a.exports;var b=c[e]={id:e,loaded:!1,exports:{}};return r[e].call(b.exports,b,b.exports,d),b.loaded=!0,b.exports}d.m=r,d.c=c,e=[],d.O=(a,b,f,t)=>{if(!b){var r=1/0;for(i=0;i=t)&&Object.keys(d.O).every((e=>d.O[e](b[o])))?b.splice(o--,1):(c=!1,t0&&e[i-1][2]>t;i--)e[i]=e[i-1];e[i]=[b,f,t]},d.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return d.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var t=Object.create(null);d.r(t);var r={};a=a||[null,b({}),b([]),b(b)];for(var c=2&f&&e;"object"==typeof c&&!~a.indexOf(c);c=b(c))Object.getOwnPropertyNames(c).forEach((a=>r[a]=()=>e[a]));return r.default=()=>e,d.d(t,r),t},d.d=(e,a)=>{for(var b in a)d.o(a,b)&&!d.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((a,b)=>(d.f[b](e,a),a)),[])),d.u=e=>"assets/js/"+({134:"b7bb6147",337:"3f194bb7",463:"682c6856",562:"5fadd32f",598:"c25a813d",646:"7b998695",952:"2d66ba60",1235:"a7456010",1316:"1b560adb",1475:"9c3aeb12",1527:"778bcc8b",1863:"b4513eec",1914:"1151f991",2282:"6d990bb1",2408:"9abfa349",2412:"16a2713f",2627:"4769fc4e",2828:"49885c5e",2871:"3c883fc4",2916:"425e1ae2",3332:"e28eadbb",3726:"a5e062ff",3768:"e8953dad",3956:"a0ea14c4",3976:"0e384e19",4134:"393be207",4290:"ae603a5f",4583:"1df93b7f",4676:"24503201",4876:"17682634",5120:"a5ad27b1",5186:"b0477c6d",5480:"80526ee6",5532:"e81f6410",5624:"9b932233",5700:"b9f7b2ab",5742:"aba21aa0",5771:"8f2e4180",5960:"0657c530",6017:"8d981dc3",6061:"1f391b9e",6187:"e44e17f8",6286:"e2f00550",6439:"ad6bd692",6773:"2146f16f",6828:"9976ff42",6900:"cc3979e2",6969:"14eb3368",7098:"a7bd4aaa",7229:"eb78b783",7230:"93f75803",7595:"0debafb6",7624:"5fbc5cf1",7969:"5985dcf4",8401:"17896441",8626:"bca784a7",9048:"a94703ab",9167:"ba738306",9218:"cc2baa30",9378:"5b870ab8",9440:"8d820236",9629:"9875b4b5",9647:"5e95c892",9998:"7923f30a"}[e]||e)+"."+{134:"290a582f",337:"22bfc72a",463:"6d8a69a6",562:"4470b0e4",598:"dcaf95cd",646:"ba2beb82",952:"5554bca5",1235:"7b4b0a20",1316:"0fed137f",1475:"75ce2603",1527:"6f445848",1863:"48c3c682",1914:"193b4b8f",2237:"ede9a640",2282:"a3d78aa1",2408:"32a724b9",2412:"7d2fd4b2",2627:"8cd2f5e8",2828:"88fa1633",2871:"d1c841d8",2916:"a5de04d1",3332:"eb97ff9d",3658:"e4ca47ec",3726:"a888e2f6",3768:"ac67425e",3956:"74b8c7b1",3976:"5aa906b8",4134:"030d51d7",4290:"fa5b263f",4583:"f182b925",4676:"bb859ed4",4876:"3d25384a",5120:"a118c206",5186:"531ad97a",5480:"b9a69f3d",5532:"60f06895",5624:"10ce9365",5700:"4aa13ff2",5742:"9ac6642b",5771:"6fb725c9",5960:"aa8fdf00",6017:"77fdfc67",6061:"68f8d4d4",6187:"c2db0a90",6286:"76a5e6d2",6439:"7bc5fb7f",6773:"3e9e5b9b",6828:"8da5bc72",6900:"f2efdc37",6969:"eeb6b7e2",7098:"b82ee0df",7229:"33a8bdeb",7230:"260ce03e",7595:"bf13c614",7624:"76587c2d",7969:"49afb06c",8401:"4295b40f",8626:"547f56bd",9048:"2668bc5b",9167:"0c1ac6c3",9218:"c74667a4",9378:"e5b723a6",9440:"525617f1",9629:"0aaf62d5",9647:"b1f5748f",9998:"4aa28861"}[e]+".js",d.miniCssF=e=>{},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},t="website:",d.l=(e,a,b,r)=>{if(f[e])f[e].push(a);else{var c,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{c.onerror=c.onload=null,clearTimeout(s);var t=f[e];if(delete f[e],c.parentNode&&c.parentNode.removeChild(c),t&&t.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=l.bind(null,c.onerror),c.onload=l.bind(null,c.onload),o&&document.head.appendChild(c)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.p="/starknet-devnet-rs/",d.gca=function(e){return e={17682634:"4876",17896441:"8401",24503201:"4676",b7bb6147:"134","3f194bb7":"337","682c6856":"463","5fadd32f":"562",c25a813d:"598","7b998695":"646","2d66ba60":"952",a7456010:"1235","1b560adb":"1316","9c3aeb12":"1475","778bcc8b":"1527",b4513eec:"1863","1151f991":"1914","6d990bb1":"2282","9abfa349":"2408","16a2713f":"2412","4769fc4e":"2627","49885c5e":"2828","3c883fc4":"2871","425e1ae2":"2916",e28eadbb:"3332",a5e062ff:"3726",e8953dad:"3768",a0ea14c4:"3956","0e384e19":"3976","393be207":"4134",ae603a5f:"4290","1df93b7f":"4583",a5ad27b1:"5120",b0477c6d:"5186","80526ee6":"5480",e81f6410:"5532","9b932233":"5624",b9f7b2ab:"5700",aba21aa0:"5742","8f2e4180":"5771","0657c530":"5960","8d981dc3":"6017","1f391b9e":"6061",e44e17f8:"6187",e2f00550:"6286",ad6bd692:"6439","2146f16f":"6773","9976ff42":"6828",cc3979e2:"6900","14eb3368":"6969",a7bd4aaa:"7098",eb78b783:"7229","93f75803":"7230","0debafb6":"7595","5fbc5cf1":"7624","5985dcf4":"7969",bca784a7:"8626",a94703ab:"9048",ba738306:"9167",cc2baa30:"9218","5b870ab8":"9378","8d820236":"9440","9875b4b5":"9629","5e95c892":"9647","7923f30a":"9998"}[e]||e,d.p+d.u(e)},(()=>{var e={5354:0,1869:0};d.f.j=(a,b)=>{var f=d.o(e,a)?e[a]:void 0;if(0!==f)if(f)b.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var t=new Promise(((b,t)=>f=e[a]=[b,t]));b.push(f[2]=t);var r=d.p+d.u(a),c=new Error;d.l(r,(b=>{if(d.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var t=b&&("load"===b.type?"missing":b.type),r=b&&b.target&&b.target.src;c.message="Loading chunk "+a+" failed.\n("+t+": "+r+")",c.name="ChunkLoadError",c.type=t,c.request=r,f[1](c)}}),"chunk-"+a,a)}},d.O.j=a=>0===e[a];var a=(a,b)=>{var f,t,r=b[0],c=b[1],o=b[2],n=0;if(r.some((a=>0!==e[a]))){for(f in c)d.o(c,f)&&(d.m[f]=c[f]);if(o)var i=o(d)}for(a&&a(b);n Account impersonation | Starknet Devnet - + diff --git a/docs/0.0.6/api/index.html b/docs/0.0.6/api/index.html index 5dee42514..99142393d 100644 --- a/docs/0.0.6/api/index.html +++ b/docs/0.0.6/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/0.0.6/balance/index.html b/docs/0.0.6/balance/index.html index 4293c124d..821ca5fb9 100644 --- a/docs/0.0.6/balance/index.html +++ b/docs/0.0.6/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/0.0.6/blocks/index.html b/docs/0.0.6/blocks/index.html index cc4490647..0c2fc7153 100644 --- a/docs/0.0.6/blocks/index.html +++ b/docs/0.0.6/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/0.0.6/category/running/index.html b/docs/0.0.6/category/running/index.html index 5d7fe8d3a..da9bc0108 100644 --- a/docs/0.0.6/category/running/index.html +++ b/docs/0.0.6/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/0.0.6/dump-load-restart/index.html b/docs/0.0.6/dump-load-restart/index.html index 2f68a5569..549fb2786 100644 --- a/docs/0.0.6/dump-load-restart/index.html +++ b/docs/0.0.6/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/0.0.6/forking/index.html b/docs/0.0.6/forking/index.html index af37b9da0..f7455b34e 100644 --- a/docs/0.0.6/forking/index.html +++ b/docs/0.0.6/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/0.0.6/historic-state/index.html b/docs/0.0.6/historic-state/index.html index 3bb3c250d..837ebd7f8 100644 --- a/docs/0.0.6/historic-state/index.html +++ b/docs/0.0.6/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/0.0.6/intro/index.html b/docs/0.0.6/intro/index.html index dc6fdbdab..a1d26fdba 100644 --- a/docs/0.0.6/intro/index.html +++ b/docs/0.0.6/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/0.0.6/lite/index.html b/docs/0.0.6/lite/index.html index a1438f6ae..ff6e85416 100644 --- a/docs/0.0.6/lite/index.html +++ b/docs/0.0.6/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/0.0.6/postman/index.html b/docs/0.0.6/postman/index.html index bf8b25455..15c4f04ce 100644 --- a/docs/0.0.6/postman/index.html +++ b/docs/0.0.6/postman/index.html @@ -4,7 +4,7 @@ L1-L2 interaction via Postman | Starknet Devnet - + diff --git a/docs/0.0.6/predeployed/index.html b/docs/0.0.6/predeployed/index.html index 82d094655..06f124755 100644 --- a/docs/0.0.6/predeployed/index.html +++ b/docs/0.0.6/predeployed/index.html @@ -4,7 +4,7 @@ Predeployed contracts | Starknet Devnet - + diff --git a/docs/0.0.6/running/cli/index.html b/docs/0.0.6/running/cli/index.html index 5f717b90f..80a8a1141 100644 --- a/docs/0.0.6/running/cli/index.html +++ b/docs/0.0.6/running/cli/index.html @@ -4,7 +4,7 @@ CLI options | Starknet Devnet - + diff --git a/docs/0.0.6/running/docker/index.html b/docs/0.0.6/running/docker/index.html index b7881e900..98650c220 100644 --- a/docs/0.0.6/running/docker/index.html +++ b/docs/0.0.6/running/docker/index.html @@ -4,7 +4,7 @@ Run with Docker | Starknet Devnet - + diff --git a/docs/0.0.6/running/install/index.html b/docs/0.0.6/running/install/index.html index 2f237f97c..80d95e7d4 100644 --- a/docs/0.0.6/running/install/index.html +++ b/docs/0.0.6/running/install/index.html @@ -4,7 +4,7 @@ Install and run | Starknet Devnet - + diff --git a/docs/0.0.6/server-config/index.html b/docs/0.0.6/server-config/index.html index 78a20ce89..8909c7b75 100644 --- a/docs/0.0.6/server-config/index.html +++ b/docs/0.0.6/server-config/index.html @@ -4,7 +4,7 @@ Server config | Starknet Devnet - + diff --git a/docs/0.0.6/starknet-time/index.html b/docs/0.0.6/starknet-time/index.html index 1c28ebb79..02b5fae7b 100644 --- a/docs/0.0.6/starknet-time/index.html +++ b/docs/0.0.6/starknet-time/index.html @@ -4,7 +4,7 @@ Starknet time | Starknet Devnet - + diff --git a/docs/account-impersonation/index.html b/docs/account-impersonation/index.html index 85d05e6b7..f1b0ada23 100644 --- a/docs/account-impersonation/index.html +++ b/docs/account-impersonation/index.html @@ -4,7 +4,7 @@ Account impersonation | Starknet Devnet - + diff --git a/docs/api/index.html b/docs/api/index.html index f2fc91bf6..cc7d74af5 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/balance/index.html b/docs/balance/index.html index 6a85d05ac..3e3cca77f 100644 --- a/docs/balance/index.html +++ b/docs/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/blocks/index.html b/docs/blocks/index.html index f3d40c072..feb4b6a49 100644 --- a/docs/blocks/index.html +++ b/docs/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/category/running/index.html b/docs/category/running/index.html index 5389b485e..58aeb94ff 100644 --- a/docs/category/running/index.html +++ b/docs/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/dump-load-restart/index.html b/docs/dump-load-restart/index.html index a1a2dd7e6..c79e4d9b3 100644 --- a/docs/dump-load-restart/index.html +++ b/docs/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/forking/index.html b/docs/forking/index.html index 614d6f69b..680ed6375 100644 --- a/docs/forking/index.html +++ b/docs/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/historic-state/index.html b/docs/historic-state/index.html index 14d77a4a4..19edb8c2c 100644 --- a/docs/historic-state/index.html +++ b/docs/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/intro/index.html b/docs/intro/index.html index 5b417c856..91e87080f 100644 --- a/docs/intro/index.html +++ b/docs/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/lite/index.html b/docs/lite/index.html index 7131b4166..cd391cef6 100644 --- a/docs/lite/index.html +++ b/docs/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/next/account-impersonation/index.html b/docs/next/account-impersonation/index.html index 45e15c493..4a6730585 100644 --- a/docs/next/account-impersonation/index.html +++ b/docs/next/account-impersonation/index.html @@ -4,7 +4,7 @@ Account impersonation | Starknet Devnet - + diff --git a/docs/next/api/index.html b/docs/next/api/index.html index b81bd84d3..1d365f849 100644 --- a/docs/next/api/index.html +++ b/docs/next/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + @@ -13,9 +13,9 @@

Starknet APIUnlike Pythonic Devnet, which also supported Starknet's gateway and feeder gateway API, Devnet in Rust supports Starknet's JSON-RPC API. Since JSON-RPC v0.6.0, to find out which JSON-RPC version is supported by which Devnet version, check out the releases page.

The JSON-RPC API is reachable via /rpc and / (e.g. if spawning Devnet with default settings, these URLs are functionally equivalent: http://127.0.0.1:5050/rpc and http://127.0.0.1:5050/)

Devnet API

-

Devnet has many other functional features which are available via their own endpoints, which are all mentioned throughout the documentation.

+

Devnet has many other functional features which are available via their own endpoints and JSON-RPC, which are all mentioned throughout the documentation.

Config API

-

To retrieve the current configuration of Devnet, send a GET request to /config. Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use starknet-devnet --help to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names.

+

To retrieve the current configuration of Devnet, send a GET request to /config or JSON-RPC request with method name devnet_getConfig. Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use starknet-devnet --help to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names.

{
"seed": 4063802897,
"total_accounts": 10,
"account_contract_class_hash": "0x61dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f",
"predeployed_accounts_initial_balance": "1000000000000000000000",
"start_time": null,
"gas_price_wei": 100000000000,
"gas_price_strk": 100000000000,
"data_gas_price_wei": 100000000000,
"data_gas_price_strk": 100000000000,
"chain_id": "SN_SEPOLIA",
"dump_on": "exit",
"dump_path": "dump_path.json",
"state_archive": "none",
"fork_config": {
"url": "http://rpc.pathfinder.equilibrium.co/integration-sepolia/rpc/v0_7",
"block_number": 26429
},
"server_config": {
"host": "127.0.0.1",
"port": 5050,
"timeout": 120,
"request_body_size_limit": 2000000
},
"block_generation": null,
"lite_mode": false
}
\ No newline at end of file diff --git a/docs/next/balance/index.html b/docs/next/balance/index.html index f153f3384..2180e9c59 100644 --- a/docs/next/balance/index.html +++ b/docs/next/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + @@ -16,13 +16,15 @@
  • STRK: 0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d
  • Mint token - Local faucet

    -

    By sending a POST request to /mint for a token, you initiate a transaction on that token's ERC20 contract. The response contains the hash of this transaction, as well as the new balance after minting. The token is specified by providing the unit, and defaults to WEI.

    +

    By sending a POST request to /mint or JSON-RPC request with method name devnet_mint for a token, you initiate a transaction on that token's ERC20 contract. The response contains the hash of this transaction, as well as the new balance after minting. The token is specified by providing the unit, and defaults to WEI.

    The value of amount is in WEI and needs to be an integer (or a float whose fractional part is 0, e.g. 1000.0 or 1e21)

    POST /mint
    {
    "address": "0x6e3205f...",
    "amount": 500000,
    "unit": "WEI" | "FRI"
    }
    +
    JSON-RPC
    {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "devnet_mint",
    "params": {
    "address": "0x6e3205f...",
    "amount": 500000,
    "unit": "WEI" | "FRI"
    }
    }

    Response:

    {
    "new_balance": 500000,
    "unit": "WEI" | "FRI",
    "tx_hash": "0xa24f23..."
    }

    Check balance

    Check the balance of an address by sending a GET request to /account_balance. The address should be a 0x-prefixed hex string; unit defaults to WEI and block_tag to latest.

    -
    GET /account_balance?address=<ADDRESS>[&unit=<FRI|WEI>][&block_tag=<latest|pending>]
    +
    GET /account_balance?address=<ADDRESS>[&unit=<FRI|WEI>][&block_tag=<latest|pending>]
    +
    JSON-RPC
    {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "devnet_getAccountBalance",
    "params": {
    "address": "0x6e3205f...",
    "unit": "WEI" | "FRI",
    "block_tag": "latest" | "pending"
    }
    }
    \ No newline at end of file diff --git a/docs/next/blocks/index.html b/docs/next/blocks/index.html index b3ef78b14..40912eed8 100644 --- a/docs/next/blocks/index.html +++ b/docs/next/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + @@ -13,10 +13,11 @@

    A new block is generated based on the pending block, once a new block is generated the pending block is restarted. By default, a new block is generated with each new transaction, but you can also create an empty block by yourself.

    Creating blocks on demand

    If you start Devnet with the --block-generation-on demand CLI option, you will enable the possibility to store more than one transaction in the pending block (targetable via block tag "pending").

    -

    Once you've added the desired transactions into the pending block, you can send a POST request to /create_block. This will convert the pending block to the latest block (targetable via block tag "latest"), giving it a block hash and a block number. All subsequent transactions will be stored in a new pending block.

    +

    Once you've added the desired transactions into the pending block, you can send a POST request to /create_block or JSON-RPC request with method name devnet_createBlock. This will convert the pending block to the latest block (targetable via block tag "latest"), giving it a block hash and a block number. All subsequent transactions will be stored in a new pending block.

    In case of demanding block creation with no pending transactions, a new empty block will be generated.

    The creation of the genesis block is not affected by this feature.

    POST /create_block
    +
    JSON-RPC
    {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "devnet_createBlock"
    }

    Response:

    {'block_hash': '0x115e1b390cafa7942b6ab141ab85040defe7dee9bef3bc31d8b5b3d01cc9c67'}

    Automatic periodic block creation

    @@ -24,6 +25,7 @@

    Create an empty block

    To create an empty block without transactions, POST a request to /create_block:

    POST /create_block
    +
    JSON-RPC
    {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "devnet_createBlock"
    }

    Response:

    {"block_hash": "0x115e1b390cafa7942b6ab141ab85040defe7dee9bef3bc31d8b5b3d01cc9c67"}

    Abort blocks

    @@ -33,6 +35,7 @@

    Abort blocksE.g. assume there are 3 accepted blocks numbered 1, 2 and 3. Upon receiving a request to abort blocks starting with block 2, the blocks numbered 2 and 3 are aborted and their transactions reverted. The state of network will be as it was in block 1. Once a new block is mined, it will be accepted and it will have number 2.

    Aborted blocks can only be queried by block hash. Aborting the blocks in forking origin and already aborted blocks is not supported and results in an error.

    POST /abort_blocks
    {
    "starting_block_hash": BLOCK_HASH
    }
    +
    JSON-RPC
    {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "devnet_abortBlocks",
    "params": {
    "starting_block_hash": BLOCK_HASH
    }
    }

    Response:

    {
    "aborted": [BLOCK_HASH_0, BLOCK_HASH_1, ...]
    }
    diff --git a/docs/next/category/running/index.html b/docs/next/category/running/index.html index dcbb5eb85..c51f04c75 100644 --- a/docs/next/category/running/index.html +++ b/docs/next/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/next/dump-load-restart/index.html b/docs/next/dump-load-restart/index.html index 5967fbbc7..ea5f901c7 100644 --- a/docs/next/dump-load-restart/index.html +++ b/docs/next/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + @@ -23,6 +23,7 @@

    Dumping
    $ starknet-devnet --dump-on exit --dump-path <PATH>
    $ curl -X POST http://<HOST>:<PORT>/dump -d '{ "path": <PATH> }' -H "Content-Type: application/json"
    +
    JSON-RPC
    {
    "jsonrpc": "2.0",
    "id": "1",
    "method": "devnet_dump",
    "params": {
    "path": PATH
    }
    }

    Loading

    To load a preserved Devnet instance, the options are: