PageSourceSearch

https://elastos-wiki.netlify.app/assets/js/47b94119.771f951e.js

js elastos-wiki.netlify.app collected 2026-10-03 10:43:02 UTC 8,787 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4068],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>f});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,r=function(e,t){if(null==e)return{};var n,a,r={},o=Object.keys(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)n=o[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),m=r,f=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return n?a.createElement(f,s(s({ref:t},d),{},{components:n})):a.createElement(f,s({ref:t},d))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[p]="string"==typeof e?e:r,s[1]=i;for(var c=2;c<o;c++)s[c]=n[c];return a.createElement.apply(null,s)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},9605:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>b,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var a=n(7462),r=n(3366),o=(n(7294),n(3905)),s=["components"],i={title:"Mainchain-Sidechain Transfer"},l=void 0,c={unversionedId:"develop/crosschain",id:"develop/crosschain",title:"Mainchain-Sidechain Transfer",description:"How to Transfer ELA from Mainchain to ESC",source:"@site/../docs/3.develop/crosschain.md",sourceDirName:"3.develop",slug:"/develop/crosschain",permalink:"/develop/crosschain",draft:!1,editUrl:"https://github.com/elastos/Elastos.Wiki/edit/master/website/../docs/3.develop/crosschain.md",tags:[],version:"current",lastUpdatedBy:"racollette",lastUpdatedAt:1677304687,formattedLastUpdatedAt:"Feb 25, 2023",frontMatter:{title:"Mainchain-Sidechain Transfer"},sidebar:"developSidebar",previous:{title:"Write",permalink:"/develop/hive/write"},next:{title:"Introduction",permalink:"/sdk/general/connectivity/introduction"}},d={},p=[{value:"How to Transfer ELA from Mainchain to ESC",id:"how-to-transfer-ela-from-mainchain-to-esc",level:3},{value:"How to Withdraw ELA from ESC to Mainchain",id:"how-to-withdraw-ela-from-esc-to-mainchain",level:3},{value:"Transfer Smart Contracts",id:"transfer-smart-contracts",level:2}],u=function(e){return function(t){return console.warn("Component "+e+" was not imported, exported, or provided by MDXProvider as global scope"),(0,o.kt)("div",t)}},m=u("Tabs"),f=u("TabItem"),h={toc:p},y="wrapper";function b(e){var t=e.components,n=(0,r.Z)(e,s);return(0,o.kt)(y,(0,a.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h3",{id:"how-to-transfer-ela-from-mainchain-to-esc"},"How to Transfer ELA from Mainchain to ESC"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Using the ",(0,o.kt)("a",{parentName:"li",href:"/api/mainchain/cli"},"ELA-CLI"),", create a deposit transaction:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"./ela-cli wallet -t create --deposit eth_address(ESC address) --amount recharge_value(amount ela units) --fee recharge_fee(fee ela units)\n")),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Sign transaction:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"./ela-cli wallet -t sign --file to_be_signed.txn -p yourpassword(your keystore password)\n")),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},"Send transaction:")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"./ela-cli wallet -t send --file ready_to_send.txn\n")),(0,o.kt)("h3",{id:"how-to-withdraw-ela-from-esc-to-mainchain"},"How to Withdraw ELA from ESC to Mainchain"),(0,o.kt)("p",null,"Using node.js"),(0,o.kt)(m,{className:"language-tabs",groupId:"code-tabs",mdxType:"Tabs"},(0,o.kt)(f,{value:"\ud83c\udf10 JavaScript",mdxType:"TabItem"})),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},'const Web3 = require("web3");\n\n// set web3 uri\nconst web3 = new Web3("http://127.0.0.1:20636");\n\n// set withdraw contract\nlet contract = new web3.eth.Contract([\n  {\n    constant: false,\n    inputs: [\n      { name: "_addr", type: "string" },\n      { name: "_amount", type: "uint256" },\n      { name: "_fee", type: "uint256" },\n    ],\n    name: "receivePayload",\n    outputs: [],\n    payable: true,\n    stateMutability: "payable",\n    type: "function",\n  },\n  { payable: true, stateMutability: "payable", type: "fallback" },\n  {\n    anonymous: false,\n    inputs: [\n      { indexed: fal
1se, name: "_addr", type: "string" },\n      { indexed: false, name: "_amount", type: "uint256" },\n      { indexed: false, name: "_crosschainamount", type: "uint256" },\n      { indexed: true, name: "_sender", type: "address" },\n    ],\n    name: "PayloadReceived",\n    type: "event",\n  },\n  {\n    anonymous: false,\n    inputs: [\n      { indexed: true, name: "_sender", type: "address" },\n      { indexed: false, name: "_amount", type: "uint256" },\n      { indexed: true, name: "_black", type: "address" },\n    ],\n    name: "EtherDeposited",\n    type: "event",\n  },\n]);\n\n// set eth account address\ncontract.options.address = deploy_contract_address;\n\n// set account contract keystore info\nconst acc = web3.eth.accounts.decrypt(keystore_content, keystore_password);\n\n// call receivePayload function\uff0cparams\uff1a(ELA main chain address\uff0camount(In ela up to convert wei 10000000000)\uff0cfee)\nconst cdata = contract.methods\n  .receivePayload(ELA_address, withdraw_amount, fee)\n  .encodeABI();\n\n// gas minimum is 3000000\uff0cgasPrice is any value\nlet tx = {\n  data: cdata,\n  to: contract.options.address,\n  from: acc.address,\n  gas: "3000000",\n  gasPrice: "20000000000",\n};\n\n// send transaction amount(use receivePayload function amount)\ntx.value = withdraw_amount;\n\nacc\n  .signTransaction(tx)\n  .then((res) => {\n    console.log("coming");\n    stx = res;\n    console.log(stx.rawTransaction);\n    web3.eth.sendSignedTransaction(stx.rawTransaction);\n  })\n  .then(console);\n')),(0,o.kt)("h2",{id:"transfer-smart-contracts"},"Transfer Smart Contracts"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Address"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"ESC Deposit"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("a",{parentName:"td",href:"https://blockchain.elastos.io/address/XVbCTM7vqM1qHKsABSFH4xKN1qbp7ijpWf"},"XVbCTM7vqM1qHKsABSFH4xKN1qbp7ijpWf"))),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"ESC Withdraw"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("a",{parentName:"td",href:"https://esc.elastos.io/address/0xC445f9487bF570fF508eA9Ac320b59730e81e503"},"0xC445f9487bF570fF508eA9Ac320b59730e81e503"))),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"ESC Testnet Deposit"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("a",{parentName:"td",href:"https://blockchain-testnet.elastos.io/address/XWCiyXM1bQyGTawoaYKx9PjRkMUGGocWub"},"XWCiyXM1bQyGTawoaYKx9PjRkMUGGocWub"))),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},"ESC Testnet Withdraw"),(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("a",{parentName:"td",href:"https://esc-testnet.elastos.io/address/0x491bC043672B9286fA02FA7e0d6A3E5A0384A31A"},"0x491bC043672B9286fA02FA7e0d6A3E5A0384A31A"))))))}b.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.