diff --git a/404.html b/404.html index a14be73bbc..d823edb43b 100644 --- a/404.html +++ b/404.html @@ -8,13 +8,13 @@ - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + diff --git a/assets/js/039e4454.c3085012.js b/assets/js/039e4454.99cc0d70.js similarity index 57% rename from assets/js/039e4454.c3085012.js rename to assets/js/039e4454.99cc0d70.js index 8fe1e23a8a..2c253ea759 100644 --- a/assets/js/039e4454.c3085012.js +++ b/assets/js/039e4454.99cc0d70.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[7009],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>c});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),s=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(o.Provider,{value:t},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(a),h=r,c=p["".concat(o,".").concat(h)]||p[h]||g[h]||l;return a?n.createElement(c,i(i({ref:t},m),{},{components:a})):n.createElement(c,i({ref:t},m))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=h;var d={};for(var o in t)hasOwnProperty.call(t,o)&&(d[o]=t[o]);d.originalType=e,d[p]="string"==typeof e?e:r,i[1]=d;for(var s=2;s{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=a(83117),r=(a(67294),a(3905));const l={},i="Staking",d={unversionedId:"beaconchain/learn/bc-staking",id:"beaconchain/learn/bc-staking",title:"Staking",description:"PoSA Consensus of BNB Smart Chain",source:"@site/docs/beaconchain/learn/bc-staking.md",sourceDirName:"beaconchain/learn",slug:"/beaconchain/learn/bc-staking",permalink:"/docs/beaconchain/learn/bc-staking",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/learn/bc-staking.md",tags:[],version:"current",frontMatter:{}},o={},s=[{value:"PoSA Consensus of BNB Smart Chain",id:"posa-consensus-of-bnb-smart-chain",level:2},{value:"Staking on BNB Beacon Chain",id:"staking-on-bnb-beacon-chain",level:2},{value:"Staking Economics",id:"staking-economics",level:2},{value:"Ranking Algorithm",id:"ranking-algorithm",level:2},{value:"Reward Distrubution",id:"reward-distrubution",level:2},{value:"Main Workflow:",id:"main-workflow",level:3},{value:"Details",id:"details",level:3},{value:"Error handling:",id:"error-handling",level:3},{value:"Fee Table",id:"fee-table",level:2},{value:"Commands",id:"commands",level:2},{value:"Download",id:"download",level:3},{value:"Mainnet",id:"mainnet",level:4},{value:"Testnet",id:"testnet",level:4},{value:"Create BSC Validator",id:"create-bsc-validator",level:3},{value:"Parameters for bsc-create-validator",id:"parameters-for-bsc-create-validator",level:4},{value:"Examples",id:"examples",level:4},{value:"Edit BSC Validator",id:"edit-bsc-validator",level:3},{value:"Parameters for bsc-edit-validator",id:"parameters-for-bsc-edit-validator",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Delegate BNB",id:"delegate-bnb",level:3},{value:"Parameters for staking bsc-delegate",id:"parameters-for-staking-bsc-delegate",level:4},{value:"Examples",id:"examples-2",level:4},{value:"Redelegate BNB",id:"redelegate-bnb",level:3},{value:"Parameters for staking bsc-redelegate",id:"parameters-for-staking-bsc-redelegate",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Undelegate BNB",id:"undelegate-bnb",level:3},{value:"Parameters for staking bsc-unbond",id:"parameters-for-staking-bsc-unbond",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Query side chain vaildator by operator",id:"query-side-chain-vaildator-by-operator",level:3},{value:"Parameters for staking side-validator",id:"parameters-for-staking-side-validator",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Query side chain delegation by delegator and operator",id:"query-side-chain-delegation-by-delegator-and-operator",level:3},{value:"Parameters for staking side-delegation",id:"parameters-for-staking-side-delegation",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Query side chain delegations by delegator",id:"query-side-chain-delegations-by-delegator",level:3},{value:"Parameters for staking side-delegations",id:"parameters-for-staking-side-delegations",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Query side chain unbonding delegation",id:"query-side-chain-unbonding-delegation",level:3},{value:"Parameters for staking side-unbonding-delegation",id:"parameters-for-staking-side-unbonding-delegation",level:4},{value:"Query side chain unbonding delegations by delegator",id:"query-side-chain-unbonding-delegations-by-delegator",level:3},{value:"Parameters for staking side-unbonding-delegations",id:"parameters-for-staking-side-unbonding-delegations",level:4},{value:"Query side chain unbonding delegations by validator",id:"query-side-chain-unbonding-delegations-by-validator",level:3},{value:"Parameters for staking side-val-unbonding-delegations",id:"parameters-for-staking-side-val-unbonding-delegations",level:4},{value:"Query side chain re-delegation",id:"query-side-chain-re-delegation",level:3},{value:"Parameters for staking side-redelegation",id:"parameters-for-staking-side-redelegation",level:4},{value:"Query side chain re-delegations by delegator",id:"query-side-chain-re-delegations-by-delegator",level:3},{value:"Parameters for staking side-redelegations",id:"parameters-for-staking-side-redelegations",level:4},{value:"Query side chain re-delegations by validator",id:"query-side-chain-re-delegations-by-validator",level:3},{value:"Parameters for staking side-val-redelegations",id:"parameters-for-staking-side-val-redelegations",level:4},{value:"Query side chain staking pool",id:"query-side-chain-staking-pool",level:3},{value:"Parameters for staking side-pool",id:"parameters-for-staking-side-pool",level:4},{value:"Query side chain top validators",id:"query-side-chain-top-validators",level:3},{value:"Parameters for staking side-top-validators",id:"parameters-for--staking-side-top-validators",level:4},{value:"Query side chain validators count",id:"query-side-chain-validators-count",level:3},{value:"Parameters for staking side-validators-count",id:"parameters-for-staking-side-validators-count",level:4}],m={toc:s},p="wrapper";function g(e){let{components:t,...a}=e;return(0,r.kt)(p,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"staking"},"Staking"),(0,r.kt)("h2",{id:"posa-consensus-of-bnb-smart-chain"},"PoSA Consensus of BNB Smart Chain"),(0,r.kt)("p",null,"BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/learn/genesis"},"Staked Authority (PoSA) consensus")," that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality."),(0,r.kt)("h2",{id:"staking-on-bnb-beacon-chain"},"Staking on BNB Beacon Chain"),(0,r.kt)("p",null,"Ideally, BNB Smart Chain should build such staking and reward logic into the blockchain, and automatically distribute rewards as the blocking happens. ",(0,r.kt)("a",{parentName:"p",href:"https://hub.cosmos.network/"},"Cosmos Hub"),", who also build on top of Tendermint consensus like BNB Beacon Chain , works in this way."),(0,r.kt)("p",null,"However, as BSC wants to remain compatible with Ethereum as much as possible. On the other side, BNB Beacon Chain already has a staking module and could be extended to support both BC and BSC. In this way, all the staking related operations are recorded in BC. Once there are any changes about BSC's validator set or voting power, the new message will be transferred to BSC through cross-chain communication."),(0,r.kt)("h2",{id:"staking-economics"},"Staking Economics"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The staking token is ",(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("a",{parentName:"strong",href:"https://www.binance.com/cn/trade/BNB_USDT"},"BNB")),", as it is a native token on both blockchains anyway"),(0,r.kt)("li",{parentName:"ol"},"The staking, i.e. token bond and delegation actions and records for BSC, happens on BC."),(0,r.kt)("li",{parentName:"ol"},"The BSC validator set is determined by its staking and delegation logic, via a staking module built on BC for BSC, and propagated every day UTC 00:00 from BC to BSC via Cross-Chain communication."),(0,r.kt)("li",{parentName:"ol"},"The reward distribution happens on BC around every day UTC 00:00 after.")),(0,r.kt)("h2",{id:"ranking-algorithm"},"Ranking Algorithm"),(0,r.kt)("p",null,"Validators are ranked by their power and operator address. The more its delegation tokens, the higher ranking is. If two validators get the same amount of delegated tokens, validator with smaller address bytes has higher ranking."),(0,r.kt)("h2",{id:"reward-distrubution"},"Reward Distrubution"),(0,r.kt)("p",null,"Since BSC uses PoSA as its consensus engine, all the delegators of validators can receive some share of the validators\u2019 reward."),(0,r.kt)("p",null,"However, the rewards(fees) are collected on BSC while the staking info is stored on BC."),(0,r.kt)("p",null,"So the main idea is we transfer all the rewards from BSC to BC once every day and execute the distribution on BC."),(0,r.kt)("h3",{id:"main-workflow"},"Main Workflow:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"ValidatorSet is updated in BreatheBlock, the frequency is once a day. let\u2019s assume it happens on day N."),(0,r.kt)("li",{parentName:"ol"},"The info of validator set changes of day N would be transmitted to BSCthrough interchain communication."),(0,r.kt)("li",{parentName:"ol"},"The validator set contract on BSC would receive and update the new validatorset. After that, it would trigger several interchain transfer to transfer the fees that every ",(0,r.kt)("strong",{parentName:"li"},"previous validators")," collected in this period to their addresses on BC. we can see that fees belongs to the validators of day N-1."),(0,r.kt)("li",{parentName:"ol"},"To make some room for the error handling, we distribute the fees of day N-1 in the next breathe block (day N+1).")),(0,r.kt)("h3",{id:"details"},"Details"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"even if validator set or any their voting powers are not changed on that day, we still transmit the validator set info to BSC."),(0,r.kt)("li",{parentName:"ol"},"the validator set contract maintains the history of the fees that every validators collected after the previous period(We define the ",(0,r.kt)("strong",{parentName:"li"},"period")," as the time between two contract calls of validator set changes). The actual fees are collected on the contract address."),(0,r.kt)("li",{parentName:"ol"},"the interchain transfer to send fees from the contract address to each validator\u2019s distribution address on BC. Note the distribution address is ",(0,r.kt)("strong",{parentName:"li"},"auto generated")," on BC when handling the create-validator tx, so no private key is corresponded to that address and no one except the distribution module can move the tokens on that address. This address is displayed as ",(0,r.kt)("strong",{parentName:"li"},"Distribution Addr")," in validator info.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'Validator\nFee Address: tbnb15mgzha93ny878kuvjl0pnqmjygwccdadpw5dxf\nOperator Address: bva15mgzha93ny878kuvjl0pnqmjygwccdad08uecu\nValidator Consensus Pubkey:\nJailed: false\nStatus: Bonded\nTokens: 5000000000000\nDelegator Shares: 5000000000000\nDescription: {Elbrus "" www.binance.org This is Elbrus org on chapel network.}\nBond Height: 74158\nUnbonding Height: 0\nMinimum Unbonding Time: 1970-01-01 00:00:00 +0000 UTC\nCommission: {rate: 75000000, maxRate: 90000000, maxChangeRate: 3000000, updateTime: 2020-05-22 12:24:19.478568234 +0000 UTC}\nDistribution Addr: tbnb1srkkfjk8qctvvy4s3cllhpnkz9679jphr30t2c\nSide Chain Id: chapel\nConsensus Addr on Side Chain: 0xF474Cf03ccEfF28aBc65C9cbaE594F725c80e12d\nFee Addr on Side Chain: 0xe61a183325A18a173319dD8E19c8d069459E2175\n')),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},"we have a lower limit of the value of interchain transfer, at least the value can cover the transfer fee. Also, interchain transfer will only allow max 8 decimals for the amount. The tiny left part would be kept in the contract or put into the system reward pool."),(0,r.kt)("li",{parentName:"ol"},"the reward: (totalfees ","*"," (1-commissionRate)) would be distributed in proportion to the delegations, the left part would be sent to the validator fee address.")),(0,r.kt)("h3",{id:"error-handling"},"Error handling:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"if the cross-chain transfer failed, the tokens would be sent back to a specified address(i.e. the ",(0,r.kt)("inlineCode",{parentName:"li"},"SideFeeAddr")," in the store section, validators can change this address via the EditValidator tx). After that, validators can manually deposit the tokens to its own ",(0,r.kt)("inlineCode",{parentName:"li"},"DistributionAddr")," on BC via Transfer tx. We do not force the validator to do so, but it\u2019s an indicator that can help delegators choose validators.")),(0,r.kt)("h2",{id:"fee-table"},"Fee Table"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"10")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"0.003")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002")))),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"download"},"Download"),(0,r.kt)("h4",{id:"mainnet"},"Mainnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h4",{id:"testnet"},"Testnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"tbnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h3",{id:"create-bsc-validator"},"Create BSC Validator"),(0,r.kt)("h4",{id:"parameters-for-bsc-create-validator"},"Parameters for bsc-create-validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comment")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, also be used as the validator operator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--address-delegator"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"2000000000000:BNB (means 20000 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"self-delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},"validator name"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional identity signature (ex. UPort or Keybase)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},"optional website"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},"optional details"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The initial commission rate percentage, it has 8 decimal places."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"95000000 (0.95 or 95%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission rate percentage, it has 8 decimal places. You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-change-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"3000000 (0.03 or 3%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission change rate percentage (per day). You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-cons-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"consensus address of the validator on side chain, please use hex format prefixed with 0x"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--home"),(0,r.kt)("td",{parentName:"tr",align:null},"/path/to/cli_home"),(0,r.kt)("td",{parentName:"tr",align:null},"home directory of bnbcli data and config, default to \u201c~/.bnbcli\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("p",null,"Some address parameters we need to highlight here:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Usage"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"DelegatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"Self delegator address. For BC, this address also used to collect fees.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ValidatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"validator operator\u2019s address, used in governance ops like voting.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideConsAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"block producer\u2019s address on side chain, i.e. consensus address. BC has another parameter named ",(0,r.kt)("inlineCode",{parentName:"td"},"PubKey"),", here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideVoteAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"A bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideFeeAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"fees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain . Those BNB will be sent to fee address.")))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Testnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n')),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"If you want a separated self-delegator address, both ",(0,r.kt)("inlineCode",{parentName:"li"},"self-delegator")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"validator operator")," need to sign this transaction. Here we need to use another two commands to support multiple signatures.")),(0,r.kt)("p",null,"a. use the following commands appended with a parameter \u201c",(0,r.kt)("strong",{parentName:"p"},"--generate-only"),"\u201d and save the result to a json file which would be used to be signed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n')),(0,r.kt)("p",null,"b. both validator operator(--from) and self-delegator(--address-delegator) use \u201c",(0,r.kt)("strong",{parentName:"p"},"bnbcli sign"),"\u201d command to sign the file from a)."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Delegator")," address need to sign ",(0,r.kt)("inlineCode",{parentName:"p"},"unsigned.json")," first"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json\n")),(0,r.kt)("p",null,"Then, ",(0,r.kt)("strong",{parentName:"p"},"validator")," operator addres will sign it later."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json\n")),(0,r.kt)("p",null,"c. use \u201c",(0,r.kt)("strong",{parentName:"p"},"bnbcli broadcast"),"\u201d to send the transaction from above to the blockchain nodes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris\n\n## testnet\n./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges\n")),(0,r.kt)("p",null,"Verify your transaction in ",(0,r.kt)("a",{parentName:"p",href:"https://explorer.binance.org/"},"mainnet-explorer")," or ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/"},"testnet-explorer")),(0,r.kt)("h3",{id:"edit-bsc-validator"},"Edit BSC Validator"),(0,r.kt)("h4",{id:"parameters-for-bsc-edit-validator"},"Parameters for bsc-edit-validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that also indicate the validator that you want to edit."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},'validator name (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},'optional identity signature (ex. UPort or Keybase) (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},'optional website (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},'optional details (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The new commission rate percentage"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-1"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Testnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n")),(0,r.kt)("h3",{id:"delegate-bnb"},"Delegate BNB"),(0,r.kt)("h4",{id:"parameters-for-staking-bsc-delegate"},"Parameters for staking bsc-delegate"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h3",{id:"redelegate-bnb"},"Redelegate BNB"),(0,r.kt)("h4",{id:"parameters-for-staking-bsc-redelegate"},"Parameters for staking bsc-redelegate"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-source"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the source validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-dest"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1yyy"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the destination validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Testnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"tbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h3",{id:"undelegate-bnb"},"Undelegate BNB"),(0,r.kt)("h4",{id:"parameters-for-staking-bsc-unbond"},"Parameters for staking bsc-unbond"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-vaildator-by-operator"},"Query side chain vaildator by operator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-validator"},"Parameters for staking side-validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-delegation-by-delegator-and-operator"},"Query side chain delegation by delegator and operator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-delegation"},"Parameters for staking side-delegation"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-delegations-by-delegator"},"Query side chain delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-delegations"},"Parameters for staking side-delegations"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegation"},"Query side chain unbonding delegation"),(0,r.kt)("h4",{id:"parameters-for-staking-side-unbonding-delegation"},"Parameters for staking side-unbonding-delegation"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegations-by-delegator"},"Query side chain unbonding delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-unbonding-delegations"},"Parameters for staking side-unbonding-delegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegations-by-validator"},"Query side chain unbonding delegations by validator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-val-unbonding-delegations"},"Parameters for staking side-val-unbonding-delegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegation"},"Query side chain re-delegation"),(0,r.kt)("h4",{id:"parameters-for-staking-side-redelegation"},"Parameters for staking side-redelegation"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegations-by-delegator"},"Query side chain re-delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-redelegations"},"Parameters for staking side-redelegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegations-by-validator"},"Query side chain re-delegations by validator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-val-redelegations"},"Parameters for staking side-val-redelegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-staking-pool"},"Query side chain staking pool"),(0,r.kt)("h4",{id:"parameters-for-staking-side-pool"},"Parameters for staking side-pool"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-top-validators"},"Query side chain top validators"),(0,r.kt)("h4",{id:"parameters-for--staking-side-top-validators"},"Parameters for staking side-top-validators"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--top"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"number of validators to be returned. set as maximum number of validators by default"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-validators-count"},"Query side chain validators count"),(0,r.kt)("h4",{id:"parameters-for-staking-side-validators-count"},"Parameters for staking side-validators-count"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--jail-involved"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"if true, meaning that the jailed validators will be involved to count"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[7009],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>c});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),s=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(o.Provider,{value:t},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(a),h=r,c=p["".concat(o,".").concat(h)]||p[h]||g[h]||l;return a?n.createElement(c,i(i({ref:t},m),{},{components:a})):n.createElement(c,i({ref:t},m))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=h;var d={};for(var o in t)hasOwnProperty.call(t,o)&&(d[o]=t[o]);d.originalType=e,d[p]="string"==typeof e?e:r,i[1]=d;for(var s=2;s{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=a(83117),r=(a(67294),a(3905));const l={},i="Staking",d={unversionedId:"beaconchain/learn/bc-staking",id:"beaconchain/learn/bc-staking",title:"Staking",description:"PoSA Consensus of BNB Smart Chain",source:"@site/docs/beaconchain/learn/bc-staking.md",sourceDirName:"beaconchain/learn",slug:"/beaconchain/learn/bc-staking",permalink:"/docs/beaconchain/learn/bc-staking",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/learn/bc-staking.md",tags:[],version:"current",frontMatter:{}},o={},s=[{value:"PoSA Consensus of BNB Smart Chain",id:"posa-consensus-of-bnb-smart-chain",level:2},{value:"Staking on BNB Beacon Chain",id:"staking-on-bnb-beacon-chain",level:2},{value:"Staking Economics",id:"staking-economics",level:2},{value:"Ranking Algorithm",id:"ranking-algorithm",level:2},{value:"Reward Distrubution",id:"reward-distrubution",level:2},{value:"Main Workflow:",id:"main-workflow",level:3},{value:"Details",id:"details",level:3},{value:"Error handling:",id:"error-handling",level:3},{value:"Fee Table",id:"fee-table",level:2},{value:"Commands",id:"commands",level:2},{value:"Download",id:"download",level:3},{value:"Mainnet",id:"mainnet",level:4},{value:"Testnet",id:"testnet",level:4},{value:"Create BSC Validator",id:"create-bsc-validator",level:3},{value:"Parameters for bsc-create-validator",id:"parameters-for-bsc-create-validator",level:4},{value:"Examples",id:"examples",level:4},{value:"Edit BSC Validator",id:"edit-bsc-validator",level:3},{value:"Parameters for bsc-edit-validator",id:"parameters-for-bsc-edit-validator",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Delegate BNB",id:"delegate-bnb",level:3},{value:"Parameters for staking bsc-delegate",id:"parameters-for-staking-bsc-delegate",level:4},{value:"Examples",id:"examples-2",level:4},{value:"Redelegate BNB",id:"redelegate-bnb",level:3},{value:"Parameters for staking bsc-redelegate",id:"parameters-for-staking-bsc-redelegate",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Undelegate BNB",id:"undelegate-bnb",level:3},{value:"Parameters for staking bsc-unbond",id:"parameters-for-staking-bsc-unbond",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Query side chain vaildator by operator",id:"query-side-chain-vaildator-by-operator",level:3},{value:"Parameters for staking side-validator",id:"parameters-for-staking-side-validator",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Query side chain delegation by delegator and operator",id:"query-side-chain-delegation-by-delegator-and-operator",level:3},{value:"Parameters for staking side-delegation",id:"parameters-for-staking-side-delegation",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Query side chain delegations by delegator",id:"query-side-chain-delegations-by-delegator",level:3},{value:"Parameters for staking side-delegations",id:"parameters-for-staking-side-delegations",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Query side chain unbonding delegation",id:"query-side-chain-unbonding-delegation",level:3},{value:"Parameters for staking side-unbonding-delegation",id:"parameters-for-staking-side-unbonding-delegation",level:4},{value:"Query side chain unbonding delegations by delegator",id:"query-side-chain-unbonding-delegations-by-delegator",level:3},{value:"Parameters for staking side-unbonding-delegations",id:"parameters-for-staking-side-unbonding-delegations",level:4},{value:"Query side chain unbonding delegations by validator",id:"query-side-chain-unbonding-delegations-by-validator",level:3},{value:"Parameters for staking side-val-unbonding-delegations",id:"parameters-for-staking-side-val-unbonding-delegations",level:4},{value:"Query side chain re-delegation",id:"query-side-chain-re-delegation",level:3},{value:"Parameters for staking side-redelegation",id:"parameters-for-staking-side-redelegation",level:4},{value:"Query side chain re-delegations by delegator",id:"query-side-chain-re-delegations-by-delegator",level:3},{value:"Parameters for staking side-redelegations",id:"parameters-for-staking-side-redelegations",level:4},{value:"Query side chain re-delegations by validator",id:"query-side-chain-re-delegations-by-validator",level:3},{value:"Parameters for staking side-val-redelegations",id:"parameters-for-staking-side-val-redelegations",level:4},{value:"Query side chain staking pool",id:"query-side-chain-staking-pool",level:3},{value:"Parameters for staking side-pool",id:"parameters-for-staking-side-pool",level:4},{value:"Query side chain top validators",id:"query-side-chain-top-validators",level:3},{value:"Parameters for staking side-top-validators",id:"parameters-for--staking-side-top-validators",level:4},{value:"Query side chain validators count",id:"query-side-chain-validators-count",level:3},{value:"Parameters for staking side-validators-count",id:"parameters-for-staking-side-validators-count",level:4}],m={toc:s},p="wrapper";function g(e){let{components:t,...a}=e;return(0,r.kt)(p,(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"staking"},"Staking"),(0,r.kt)("h2",{id:"posa-consensus-of-bnb-smart-chain"},"PoSA Consensus of BNB Smart Chain"),(0,r.kt)("p",null,"BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/learn/genesis"},"Staked Authority (PoSA) consensus")," that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality."),(0,r.kt)("h2",{id:"staking-on-bnb-beacon-chain"},"Staking on BNB Beacon Chain"),(0,r.kt)("p",null,"Ideally, BNB Smart Chain should build such staking and reward logic into the blockchain, and automatically distribute rewards as the blocking happens. ",(0,r.kt)("a",{parentName:"p",href:"https://hub.cosmos.network/"},"Cosmos Hub"),", who also build on top of Tendermint consensus like BNB Beacon Chain , works in this way."),(0,r.kt)("p",null,"However, as BSC wants to remain compatible with Ethereum as much as possible. On the other side, BNB Beacon Chain already has a staking module and could be extended to support both BC and BSC. In this way, all the staking related operations are recorded in BC. Once there are any changes about BSC's validator set or voting power, the new message will be transferred to BSC through cross-chain communication."),(0,r.kt)("h2",{id:"staking-economics"},"Staking Economics"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"The staking token is ",(0,r.kt)("strong",{parentName:"li"},(0,r.kt)("a",{parentName:"strong",href:"https://www.binance.com/cn/trade/BNB_USDT"},"BNB")),", as it is a native token on both blockchains anyway"),(0,r.kt)("li",{parentName:"ol"},"The staking, i.e. token bond and delegation actions and records for BSC, happens on BC."),(0,r.kt)("li",{parentName:"ol"},"The BSC validator set is determined by its staking and delegation logic, via a staking module built on BC for BSC, and propagated every day UTC 00:00 from BC to BSC via Cross-Chain communication."),(0,r.kt)("li",{parentName:"ol"},"The reward distribution happens on BC around every day UTC 00:00 after.")),(0,r.kt)("h2",{id:"ranking-algorithm"},"Ranking Algorithm"),(0,r.kt)("p",null,"Validators are ranked by their power and operator address. The more its delegation tokens, the higher ranking is. If two validators get the same amount of delegated tokens, validator with smaller address bytes has higher ranking."),(0,r.kt)("h2",{id:"reward-distrubution"},"Reward Distrubution"),(0,r.kt)("p",null,"Since BSC uses PoSA as its consensus engine, all the delegators of validators can receive some share of the validators\u2019 reward."),(0,r.kt)("p",null,"However, the rewards(fees) are collected on BSC while the staking info is stored on BC."),(0,r.kt)("p",null,"So the main idea is we transfer all the rewards from BSC to BC once every day and execute the distribution on BC."),(0,r.kt)("h3",{id:"main-workflow"},"Main Workflow:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"ValidatorSet is updated in BreatheBlock, the frequency is once a day. let\u2019s assume it happens on day N."),(0,r.kt)("li",{parentName:"ol"},"The info of validator set changes of day N would be transmitted to BSCthrough interchain communication."),(0,r.kt)("li",{parentName:"ol"},"The validator set contract on BSC would receive and update the new validatorset. After that, it would trigger several interchain transfer to transfer the fees that every ",(0,r.kt)("strong",{parentName:"li"},"previous validators")," collected in this period to their addresses on BC. we can see that fees belongs to the validators of day N-1."),(0,r.kt)("li",{parentName:"ol"},"To make some room for the error handling, we distribute the fees of day N-1 in the next breathe block (day N+1).")),(0,r.kt)("h3",{id:"details"},"Details"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"even if validator set or any their voting powers are not changed on that day, we still transmit the validator set info to BSC."),(0,r.kt)("li",{parentName:"ol"},"the validator set contract maintains the history of the fees that every validators collected after the previous period(We define the ",(0,r.kt)("strong",{parentName:"li"},"period")," as the time between two contract calls of validator set changes). The actual fees are collected on the contract address."),(0,r.kt)("li",{parentName:"ol"},"the interchain transfer to send fees from the contract address to each validator\u2019s distribution address on BC. Note the distribution address is ",(0,r.kt)("strong",{parentName:"li"},"auto generated")," on BC when handling the create-validator tx, so no private key is corresponded to that address and no one except the distribution module can move the tokens on that address. This address is displayed as ",(0,r.kt)("strong",{parentName:"li"},"Distribution Addr")," in validator info.")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'Validator\nFee Address: tbnb15mgzha93ny878kuvjl0pnqmjygwccdadpw5dxf\nOperator Address: bva15mgzha93ny878kuvjl0pnqmjygwccdad08uecu\nValidator Consensus Pubkey:\nJailed: false\nStatus: Bonded\nTokens: 5000000000000\nDelegator Shares: 5000000000000\nDescription: {Elbrus "" www.binance.org This is Elbrus org on chapel network.}\nBond Height: 74158\nUnbonding Height: 0\nMinimum Unbonding Time: 1970-01-01 00:00:00 +0000 UTC\nCommission: {rate: 75000000, maxRate: 90000000, maxChangeRate: 3000000, updateTime: 2020-05-22 12:24:19.478568234 +0000 UTC}\nDistribution Addr: tbnb1srkkfjk8qctvvy4s3cllhpnkz9679jphr30t2c\nSide Chain Id: chapel\nConsensus Addr on Side Chain: 0xF474Cf03ccEfF28aBc65C9cbaE594F725c80e12d\nFee Addr on Side Chain: 0xe61a183325A18a173319dD8E19c8d069459E2175\n')),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},"we have a lower limit of the value of interchain transfer, at least the value can cover the transfer fee. Also, interchain transfer will only allow max 8 decimals for the amount. The tiny left part would be kept in the contract or put into the system reward pool."),(0,r.kt)("li",{parentName:"ol"},"the reward: (totalfees ","*"," (1-commissionRate)) would be distributed in proportion to the delegations, the left part would be sent to the validator fee address.")),(0,r.kt)("h3",{id:"error-handling"},"Error handling:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"if the cross-chain transfer failed, the tokens would be sent back to a specified address(i.e. the ",(0,r.kt)("inlineCode",{parentName:"li"},"SideFeeAddr")," in the store section, validators can change this address via the EditValidator tx). After that, validators can manually deposit the tokens to its own ",(0,r.kt)("inlineCode",{parentName:"li"},"DistributionAddr")," on BC via Transfer tx. We do not force the validator to do so, but it\u2019s an indicator that can help delegators choose validators.")),(0,r.kt)("h2",{id:"fee-table"},"Fee Table"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"10")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"0.003")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002")))),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"download"},"Download"),(0,r.kt)("h4",{id:"mainnet"},"Mainnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h4",{id:"testnet"},"Testnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"tbnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h3",{id:"create-bsc-validator"},"Create BSC Validator"),(0,r.kt)("h4",{id:"parameters-for-bsc-create-validator"},"Parameters for bsc-create-validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comment")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, also be used as the validator operator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--address-delegator"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"2000000000000:BNB (means 20000 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"self-delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},"validator name"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional identity signature (ex. UPort or Keybase)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},"optional website"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},"optional details"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The initial commission rate percentage, it has 8 decimal places."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"95000000 (0.95 or 95%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission rate percentage, it has 8 decimal places. You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-change-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"3000000 (0.03 or 3%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission change rate percentage (per day). You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-cons-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"consensus address of the validator on side chain, please use hex format prefixed with 0x"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--home"),(0,r.kt)("td",{parentName:"tr",align:null},"/path/to/cli_home"),(0,r.kt)("td",{parentName:"tr",align:null},"home directory of bnbcli data and config, default to \u201c~/.bnbcli\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("p",null,"Some address parameters we need to highlight here:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Usage"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"DelegatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"Self delegator address. For BC, this address also used to collect fees.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ValidatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"validator operator\u2019s address, used in governance ops like voting.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideConsAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"block producer\u2019s address on side chain, i.e. consensus address. BC has another parameter named ",(0,r.kt)("inlineCode",{parentName:"td"},"PubKey"),", here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideVoteAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"A bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideFeeAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"fees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain . Those BNB will be sent to fee address.")))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Testnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n')),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"If you want a separated self-delegator address, both ",(0,r.kt)("inlineCode",{parentName:"li"},"self-delegator")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"validator operator")," need to sign this transaction. Here we need to use another two commands to support multiple signatures.")),(0,r.kt)("p",null,"a. use the following commands appended with a parameter \u201c",(0,r.kt)("strong",{parentName:"p"},"--generate-only"),"\u201d and save the result to a json file which would be used to be signed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n')),(0,r.kt)("p",null,"b. both validator operator(--from) and self-delegator(--address-delegator) use \u201c",(0,r.kt)("strong",{parentName:"p"},"bnbcli sign"),"\u201d command to sign the file from a)."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Delegator")," address need to sign ",(0,r.kt)("inlineCode",{parentName:"p"},"unsigned.json")," first"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json\n")),(0,r.kt)("p",null,"Then, ",(0,r.kt)("strong",{parentName:"p"},"validator")," operator addres will sign it later."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json\n")),(0,r.kt)("p",null,"c. use \u201c",(0,r.kt)("strong",{parentName:"p"},"bnbcli broadcast"),"\u201d to send the transaction from above to the blockchain nodes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris\n\n## testnet\n./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges\n")),(0,r.kt)("p",null,"Verify your transaction in ",(0,r.kt)("a",{parentName:"p",href:"https://explorer.bnbchain.org/"},"mainnet-explorer")," or ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/"},"testnet-explorer")),(0,r.kt)("h3",{id:"edit-bsc-validator"},"Edit BSC Validator"),(0,r.kt)("h4",{id:"parameters-for-bsc-edit-validator"},"Parameters for bsc-edit-validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that also indicate the validator that you want to edit."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},'validator name (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},'optional identity signature (ex. UPort or Keybase) (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},'optional website (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},'optional details (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The new commission rate percentage"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-1"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Testnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n")),(0,r.kt)("h3",{id:"delegate-bnb"},"Delegate BNB"),(0,r.kt)("h4",{id:"parameters-for-staking-bsc-delegate"},"Parameters for staking bsc-delegate"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h3",{id:"redelegate-bnb"},"Redelegate BNB"),(0,r.kt)("h4",{id:"parameters-for-staking-bsc-redelegate"},"Parameters for staking bsc-redelegate"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-source"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the source validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-dest"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1yyy"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the destination validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Testnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"tbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h3",{id:"undelegate-bnb"},"Undelegate BNB"),(0,r.kt)("h4",{id:"parameters-for-staking-bsc-unbond"},"Parameters for staking bsc-unbond"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-vaildator-by-operator"},"Query side chain vaildator by operator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-validator"},"Parameters for staking side-validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-delegation-by-delegator-and-operator"},"Query side chain delegation by delegator and operator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-delegation"},"Parameters for staking side-delegation"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-delegations-by-delegator"},"Query side chain delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-delegations"},"Parameters for staking side-delegations"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegation"},"Query side chain unbonding delegation"),(0,r.kt)("h4",{id:"parameters-for-staking-side-unbonding-delegation"},"Parameters for staking side-unbonding-delegation"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegations-by-delegator"},"Query side chain unbonding delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-unbonding-delegations"},"Parameters for staking side-unbonding-delegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegations-by-validator"},"Query side chain unbonding delegations by validator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-val-unbonding-delegations"},"Parameters for staking side-val-unbonding-delegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegation"},"Query side chain re-delegation"),(0,r.kt)("h4",{id:"parameters-for-staking-side-redelegation"},"Parameters for staking side-redelegation"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegations-by-delegator"},"Query side chain re-delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-redelegations"},"Parameters for staking side-redelegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegations-by-validator"},"Query side chain re-delegations by validator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-val-redelegations"},"Parameters for staking side-val-redelegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-staking-pool"},"Query side chain staking pool"),(0,r.kt)("h4",{id:"parameters-for-staking-side-pool"},"Parameters for staking side-pool"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-top-validators"},"Query side chain top validators"),(0,r.kt)("h4",{id:"parameters-for--staking-side-top-validators"},"Parameters for staking side-top-validators"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--top"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"number of validators to be returned. set as maximum number of validators by default"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-validators-count"},"Query side chain validators count"),(0,r.kt)("h4",{id:"parameters-for-staking-side-validators-count"},"Parameters for staking side-validators-count"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"comments")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--jail-involved"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"if true, meaning that the jailed validators will be involved to count"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0480b142.2fa745b3.js b/assets/js/0480b142.2fa745b3.js new file mode 100644 index 0000000000..c06a5e45e4 --- /dev/null +++ b/assets/js/0480b142.2fa745b3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[836],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(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 l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(n),h=o,m=p["".concat(s,".").concat(h)]||p[h]||d[h]||r;return n?a.createElement(m,l(l({ref:t},c),{},{components:n})):a.createElement(m,l({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:o,l[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>i,toc:()=>u});var a=n(83117),o=(n(67294),n(3905));const r={sidebar_label:"Binance Extension Wallet FAQs",hide_table_of_contents:!1,sidebar_position:2},l="Binance Extension Wallet FAQs",i={unversionedId:"faq",id:"faq",title:"Binance Extension Wallet FAQs",description:"How can I download Binance Extension Wallet (BEW)?",source:"@site/docs/faq.md",sourceDirName:".",slug:"/faq",permalink:"/docs/faq",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/faq.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_label:"Binance Extension Wallet FAQs",hide_table_of_contents:!1,sidebar_position:2},sidebar:"bscSideBar",previous:{title:"BSC Cross-chain Communication FAQs",permalink:"/docs/cross"},next:{title:"BNB Beacon Chain FAQ",permalink:"/docs/beaconchain/faq/"}},s={},u=[{value:"How can I download Binance Extension Wallet (BEW)?",id:"how-can-i-download-binance-extension-wallet-bew",level:2},{value:"How to stay safe",id:"how-to-stay-safe",level:2},{value:"Take responsibility for your own funds",id:"take-responsibility-for-your-own-funds",level:2},{value:"Write down your seed phrase",id:"write-down-your-seed-phrase",level:2},{value:"Do Your Own Research",id:"do-your-own-research",level:2},{value:"Tokens not visible after withdrawing from Binance",id:"tokens-not-visible-after-withdrawing-from-binance",level:2},{value:"How Much BNB You Need To Send Tokens",id:"how-much-bnb-you-need-to-send-tokens",level:2},{value:"Current Gas Price",id:"current-gas-price",level:2},{value:"How to Reveal Your Seed Phrase",id:"how-to-reveal-your-seed-phrase",level:2},{value:"What do i do if i lost/forgot my Seed Phrase?",id:"what-do-i-do-if-i-lostforgot-my-seed-phrase",level:2},{value:"Backing Up When Installing",id:"backing-up-when-installing",level:2},{value:"Backing Up After You Install Binance Extension Wallet",id:"backing-up-after-you-install-binance-extension-wallet",level:2},{value:"How to Reset My Password or Import an Account",id:"how-to-reset-my-password-or-import-an-account",level:2},{value:"Which network does BEW support?",id:"which-network-does-bew-support",level:2},{value:"Why my Tokens are not visible?",id:"why-my-tokens-are-not-visible",level:2},{value:"How much BNB you need for sending tokens?",id:"how-much-bnb-you-need-for-sending-tokens",level:2},{value:"How to Recover Crypto Transferred to the Wrong Network on Binance?",id:"how-to-recover-crypto-transferred-to-the-wrong-network-on-binance",level:2},{value:"Extension Wallet Update: Chrome",id:"extension-wallet-update-chrome",level:2},{value:"Extension Wallet Update : Firefox",id:"extension-wallet-update--firefox",level:2},{value:"Why are Tokens not visible after withdrawing from Binance?",id:"why-are-tokens-not-visible-after-withdrawing-from-binance",level:2},{value:"Can I use Extension wallet for Binance DEX",id:"can-i-use-extension-wallet-for-binance-dex",level:2},{value:"How to Recover funds send to Ethereum network",id:"how-to-recover-funds-send-to-ethereum-network",level:2},{value:"Why should I use Wallet Direct?",id:"why-should-i-use-wallet-direct",level:2},{value:"Common issues with Ledger Account",id:"common-issues-with-ledger-account",level:2},{value:"How can dApp connect with BEW?",id:"how-can-dapp-connect-with-bew",level:2},{value:"How to get support about technical issue on full node?",id:"how-to-get-support-about-technical-issue-on-full-node",level:2}],c={toc:u},p="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(p,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"binance-extension-wallet-faqs"},"Binance Extension Wallet FAQs"),(0,o.kt)("h2",{id:"how-can-i-download-binance-extension-wallet-bew"},"How can I download Binance Extension Wallet (BEW)?"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Chrome App Store Link"),": ",(0,o.kt)("a",{parentName:"p",href:"https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp"},"https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Firefox App Store Link"),": ",(0,o.kt)("a",{parentName:"p",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search")),(0,o.kt)("p",null,"Install Binance Extension Wallet "),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"}," This is an example to install BNB Chain Extension Waller on Firefox browser. However, workflow is same for all browsers.")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Open Extension in Firefox: ",(0,o.kt)("a",{parentName:"p",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"))),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Search for BNB Chain\n",(0,o.kt)("img",{parentName:"p",src:"https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/67023396148/original/T7AmJnBZ33pyv-1vmUZvZQvfpdPcvq5_NQ.png?1633501819",alt:"img"})))),(0,o.kt)("p",null,":::warn\nMake sure it\u2019s offered by BNB Chain\n:::"),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},"Click on \u201cAdd to Firefox\u201d\n",(0,o.kt)("img",{parentName:"li",src:"https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/67023396147/original/bvX8Y5NViWZJcFgaBt76ipaB1F8V87TgIw.png?1633501818",alt:"img"}))),(0,o.kt)("p",null,"That\u2019s it! You have successfully installed the BNB Chain Wallet extension in Firefox! "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Binance Wallet Mobile"),": Binance Mobile is a secure and trusted multi-chain wallet. It is your one-stop gateway to store, exchange and earn crypto. "),(0,o.kt)("h2",{id:"how-to-stay-safe"},"How to stay safe"),(0,o.kt)("p",null,"Wallets are a bit of a shift in thinking. Financial freedom and the ability to access and use funds anywhere comes with a bit of responsibility \u2013 there\u2019s no customer support in crypto."),(0,o.kt)("h2",{id:"take-responsibility-for-your-own-funds"},"Take responsibility for your own funds"),(0,o.kt)("p",null,"Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. Just remember you\u2019re trusting that exchange with custody over your funds. If that company is attacked or folds, your funds are at risk."),(0,o.kt)("h2",{id:"write-down-your-seed-phrase"},"Write down your seed phrase"),(0,o.kt)("p",null,"Wallets will often give you a seed phrase that you must write down somewhere safe. This is the only way you\u2019ll be able to recover your wallet."),(0,o.kt)("p",null,"Here's an example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"there aeroplane curve vent formation doge possible product distinct under spirit lamp\n")),(0,o.kt)("p",null,"Don\u2019t store it on a computer. Write it down and keep it safe."),(0,o.kt)("h2",{id:"do-your-own-research"},"Do Your Own Research"),(0,o.kt)("p",null,"If you use a web wallet, bookmark the site to protect yourself against phishing scams."),(0,o.kt)("p",null,"Remember transactions can\u2019t be reversed and wallets can\u2019t be easily recovered so take care."),(0,o.kt)("h2",{id:"tokens-not-visible-after-withdrawing-from-binance"},"Tokens not visible after withdrawing from Binance"),(0,o.kt)("p",null,"Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like MetaMask. So once you've used their withdraw form, what could be scarier than not seeing your tokens?"),(0,o.kt)("p",null,"First, you'll need to use the MetaMask add Custom Network feature to add the BNB Beacon Chain or BNB Smart Chain's RPC URLs endpoints to your MetaMask."),(0,o.kt)("p",null,"Once you've added the BNB Beacon Chain or the BNB Smart Chain to your MetaMask, you will be able to select different networks to view the assets (you may need to add Custom Tokens too) held by your selected account on that network."),(0,o.kt)("h2",{id:"how-much-bnb-you-need-to-send-tokens"},"How Much BNB You Need To Send Tokens"),(0,o.kt)("p",null,"if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee."),(0,o.kt)("p",null,"You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction."),(0,o.kt)("p",null,"A standard Ether transfer TX will be 21000 gas & a gas price of 15 Gwei.\nWith tokens, the amount of gas is typically gas, so the total TX fee increases to 0.002 BNB - 0.003 BNB."),(0,o.kt)("h2",{id:"current-gas-price"},"Current Gas Price"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'curl --location --request POST \'https://bsc-dataseed2.bnbchain.org\' \\\n--header \'Content-Type: application/json\' \\\n--data-raw \'{"jsonrpc":"2.0", "id":1, "method":"eth_gasPrice", "params": []}\'\n')),(0,o.kt)("h2",{id:"how-to-reveal-your-seed-phrase"},"How to Reveal Your Seed Phrase"),(0,o.kt)("p",null,"When dealing with cryptocurrencies or crypto assets like BNB or BUSD, it is important to always be aware of and have your private keys, seed phrases and passwords backed up in case the unexpected occurs."),(0,o.kt)("h2",{id:"what-do-i-do-if-i-lostforgot-my-seed-phrase"},"What do i do if i lost/forgot my Seed Phrase?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Seed phrase is only made known to user directly. In the event that is lost, there is no way of recovering it. "),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"We do advice to user to safeguard their seed phrase and do not share with anyone. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},'If you login from public/shared computer or laptop, please make sure to "Lock" the wallet before walking off. ')))),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"There are multiple login options made available to user : do leverage these options as well. "),(0,o.kt)("p",{parentName:"li"}," a. Safulet "),(0,o.kt)("p",{parentName:"li"}," b. tKey ")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Recovering of seed phrase is possible only if you are able to login to your account. "),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Login to your account. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Access account details on the top right corner. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},'Click on "Settings". ')),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},'View "Seed Phrase". '))))),(0,o.kt)("p",null,"Important Note: Keeping your seed phrases safe is of paramount importance. If they are stolen or lost, your assets cannot be recovered."),(0,o.kt)("h2",{id:"backing-up-when-installing"},"Backing Up When Installing"),(0,o.kt)("p",null,"When you create a new Binance Extension Wallet account, you are given your 12 word seed phrase is the most important bit of information for you to record and keep safe when managing your extension account."),(0,o.kt)("p",null,"You can write your seed phrase down on a piece of paper, store it on a flash drive or we also make it optional to download a file containing this information."),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/n2FtIpBGm0rfQC1WHDUbL44LhT6VVizzV4uBhzOkFCblCIXFdOISvy-OzCF5rEeU6q0suuW8Z6noqgYWW5_u8AU7mjat3ayEzU031SLjULoFSh0pdQOO_spRwGfqBEbSl8TIVOfa",alt:"img"})),(0,o.kt)("h2",{id:"backing-up-after-you-install-binance-extension-wallet"},"Backing Up After You Install Binance Extension Wallet"),(0,o.kt)("p",null,"If for some reason you forgot to record your 12 word seed phrase or you lost the original copy, you can reveal your seed phrase so you can back it up again."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Select Dropdown Menu (on top-right corner) --\x3e Manage Accounts")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh4.googleusercontent.com/ZXAj9X9TFTunfCJfZjHoJQm9eQZxog61rmZ0zWL4AbQlwhQRe0qj74bHvhnarwHobVbRgaBIKyyDPxQZx4acgAeFPaWN6tloNIiIuRMmDUw2mniafpqfc5RS59Nic-_KXVL64sC6",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"click on Download button")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/2t3UwpFojwMSh4_stRc9wdaOdbm2UqmtYxVL2SdLVfiCSoqF2gcOhHl3Qys6pZXJFG_7CsK2IkFOEdgpuSTiHR1_OOEi0pF_uy3nvsLhibC0vxQjGXLI0aV5gcdts3pML4xmNc4y",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Enter your password to reveal your seed words.")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/9WatFdbEVc8A92-6g5zfaHQRZgqrce1EPEQMdpWnHYyEwab9iZqcwz02cal5om_97oni1fSdh-dTJHHqsVqD74K3umO2SlGl3F9f9vQDSeUF4r0fnLOQbMiHdNSwhgbN33Nmg_U2",alt:"img"})),(0,o.kt)("h2",{id:"how-to-reset-my-password-or-import-an-account"},"How to Reset My Password or Import an Account"),(0,o.kt)("p",null,"When resetting your password for your Binance Extension wallet, you will need your 12 or 24 word seed phrase. If you do not already have your seed phrase saved someplace safe, please make sure to read ",(0,o.kt)("a",{parentName:"p",href:"#how-to-reveal-your-seed-phrase"},"How to Reveal Your Seed Phrase"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Before trying these steps, confirm that you have your seed phrase with you as you will not be able to reset your password otherwise and will risk becoming locked out of your wallet.")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"If your wallet is currently unlocked, please lock your wallet first."),(0,o.kt)("li",{parentName:"ol"},"Click Import ",(0,o.kt)("strong",{parentName:"li"},"Import seed phrase"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://camo.githubusercontent.com/9fe8761262f1dd77f01a336ae2356e74c15e3552d78be82d761461ade1107f4b/68747470733a2f2f6c68352e676f6f676c6575736572636f6e74656e742e636f6d2f6350443644303336504f69315f794a5f394a4334656d305a6b37476758645a72373236754d706348626d6649476e666179767865465042455932695076733858325a6d5365345f54574f495f3958644e4a786f65496d3641467a6235395643315735344950357945794d4a4e65764d534a62457955377846423149734b51754352443262334f3576",alt:"img"})),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},'Enter your seed phrase in the "Seed Phrase" text box'),(0,o.kt)("li",{parentName:"ol"},"Enter your new password"),(0,o.kt)("li",{parentName:"ol"},"Retype your password to confirm it was written correctly"),(0,o.kt)("li",{parentName:"ol"},"Click ",(0,o.kt)("strong",{parentName:"li"},"Reset")," ")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/ZeM4cYV3rirCo91zw3OVMYRqqpwqIsrWhPnv-t3sL7YhpD0M_DNQ4QQH-Rw8WmapLrX2OzwETLKcEwKA-Rakjuhlnoy7S707Yt8Y0nUC5OKjg04ADgM2bLSb-1f3GZvUxdkj-BuI",alt:"img"})),(0,o.kt)("h2",{id:"which-network-does-bew-support"},"Which network does BEW support?"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"BNB Beacon Chain (BEP2)"),(0,o.kt)("li",{parentName:"ul"},"BNB Smart Chain (BEP20)"),(0,o.kt)("li",{parentName:"ul"},"Ethereum (ERC20)")),(0,o.kt)("h2",{id:"why-my-tokens-are-not-visible"},"Why my Tokens are not visible?"),(0,o.kt)("p",null,"!!! Note : By default each wallet/network will shows the the main token they support. You will need to add additional token to your list. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"For Binance Extension Wallet users"),"\nYou'll need to switch to BNB Beacon Chain Mainnet (BC) mainnet or BNB Smart Chain (BSC) mainnet"),(0,o.kt)("p",null,"Once you've added the asset to your wallet, you will be able to select different networks to view the assets held by your selected account on that network."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"For Metamask wallet users")),(0,o.kt)("p",null,"You'll need to add BNB Smart Chain (BSC) mainnet network, refer ",(0,o.kt)("a",{parentName:"p",href:"https://academy.binance.com/en/articles/connecting-metamask-to-binance-smart-chain"},"here")," for more details. "),(0,o.kt)("p",null,"Then add tokens manually: ",(0,o.kt)("a",{parentName:"p",href:"https://docs.yearn.finance/how-to-guides/how-to-add-a-custom-token-to-metamask"},"https://docs.yearn.finance/how-to-guides/how-to-add-a-custom-token-to-metamask")),(0,o.kt)("h2",{id:"how-much-bnb-you-need-for-sending-tokens"},"How much BNB you need for sending tokens?"),(0,o.kt)("p",null,"A standard Ether transfer TX will be 21000 gas & a gas price of 5 GWEI. With tokens, the amount of gas is typically gas, so the total TX fee increases to 0.0005 BNB - 0.0007 BNB."),(0,o.kt)("p",null,"if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee."),(0,o.kt)("p",null,"You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction."),(0,o.kt)("h2",{id:"how-to-recover-crypto-transferred-to-the-wrong-network-on-binance"},"How to Recover Crypto Transferred to the Wrong Network on Binance?"),(0,o.kt)("p",null,"Please read ",(0,o.kt)("a",{parentName:"p",href:"https://academy.binance.com/en/articles/how-to-recover-crypto-transferred-to-the-wrong-network-on-binance"},"this")," article"),(0,o.kt)("h2",{id:"extension-wallet-update-chrome"},"Extension Wallet Update: Chrome"),(0,o.kt)("p",null,"It is crucial that you always have the latest wallet version installed. If you know that a new version of an extension is out but Chrome hasn\u2019t updated it, here\u2019s how to do it manually."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Start Google Chrome.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Click the vertical ellipsis icon on the browser toolbar.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},'Click on "Extensions" -> "Manage Extensions".')),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Click the Developer Mode button on the right side of the header")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"From there, you should see the \u201cUpdate\u201d button below the search bar. Click on it to update the extensions."))),(0,o.kt)("h2",{id:"extension-wallet-update--firefox"},"Extension Wallet Update : Firefox"),(0,o.kt)("p",null,"It is crucial that you have the latest version installed. "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},'Click the menu button, click "Add-ons and Themes" and select "Extensions".')),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Click the gear icon in the upper-right area of the Extensions panel.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Choose one of the options below:"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Check for Updates"),": Allows you to check for any updates to your add-ons manually. If there is an update available, you have the option to choose to update it now or later."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"View Recent Updates"),": When you click this option, a Recent Updates panel appears on the left, showing your last updated add-ons."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Update Add-ons Automatically"),": If you want to keep your add-ons up to date, select this option to let them update automatically."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Reset All Add-ons to Update Automatically"),": If any add-ons have been set to update manually, clicking this option will reset all add-ons to update automatically.")))),(0,o.kt)("h2",{id:"why-are-tokens-not-visible-after-withdrawing-from-binance"},"Why are Tokens not visible after withdrawing from Binance?"),(0,o.kt)("p",null,"Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like Binance Extension wallet or MetaMask. So once you've used their withdrawal form, what could be scarier than not seeing your tokens?"),(0,o.kt)("p",null,"First, you'll need to use BNB Beacon Chain Mainnet (BC) mainnet or BNB Smart Chain (BSC) mainnet"),(0,o.kt)("p",null,"Once you've added the asset to your wallet, you will be able to select different networks to view the assets held by your selected account on that network."),(0,o.kt)("h2",{id:"can-i-use-extension-wallet-for-binance-dex"},"Can I use Extension wallet for Binance DEX"),(0,o.kt)("p",null,"No, you cannot now. The support will be added in future release."),(0,o.kt)("h2",{id:"how-to-recover-funds-send-to-ethereum-network"},"How to Recover funds send to Ethereum network"),(0,o.kt)("p",null,"If the fund is sent to one of your existing accounts, please"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to Ethereum network"),(0,o.kt)("li",{parentName:"ul"},"Add your asset"),(0,o.kt)("li",{parentName:"ul"},"Then you should see your tokens in asset list.")),(0,o.kt)("p",null,"If it's sent to accounts in a different wallet, please"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Export seed phrase of this account"),(0,o.kt)("li",{parentName:"ul"},"Recover your account in Binance Extension Wallet"),(0,o.kt)("li",{parentName:"ul"},"Switch to Ethereum network"),(0,o.kt)("li",{parentName:"ul"},"Add your asset"),(0,o.kt)("li",{parentName:"ul"},"Then you should see your tokens in asset list.")),(0,o.kt)("h2",{id:"why-should-i-use-wallet-direct"},"Why should I use Wallet Direct?"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"Seamless Token Transfer"),": Transfer tokens (which support BNB Beacon Chain, BNB Smart Chain and Ethereum) between paired Binance.com account and Binance Extension Wallet. Without the trouble of copy/paste address and memo every time")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"BNB Holding"),": The BNB positions of your Binance.com account will not change."))),(0,o.kt)("h2",{id:"common-issues-with-ledger-account"},"Common issues with Ledger Account"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Wallet direct does not support Ledger account at the moment.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Binance DEX still supports Ledger. However, it is recommended to use BEW if you encounter issues when using Ledger. "))),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Install our BEW extension on your browser and login with your BEW wallet account.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Import ledger to your BEW account.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Use BEW for your transactions."))),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},"Alternatively, you can also reach out to Ledger for support via ",(0,o.kt)("a",{parentName:"li",href:"https://support.ledger.com/hc/en-us/categories/4404369571601-Support?support=true"},"https://support.ledger.com/hc/en-us/categories/4404369571601-Support?support=true")," .")),(0,o.kt)("h2",{id:"how-can-dapp-connect-with-bew"},"How can dApp connect with BEW?"),(0,o.kt)("p",null,"Please read this doc: ",(0,o.kt)("a",{parentName:"p",href:"https://binance-wallet.gitbook.io/binance-chain-wallet/bew-guides/dapp-interaction"},"https://binance-wallet.gitbook.io/binance-chain-wallet/bew-guides/dapp-interaction")),(0,o.kt)("h2",{id:"how-to-get-support-about-technical-issue-on-full-node"},"How to get support about technical issue on full node?"),(0,o.kt)("p",null,"Join our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.com/channels/789402563035660308/912296664004452362"},"node support discord channel")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0480b142.4ee5e226.js b/assets/js/0480b142.4ee5e226.js deleted file mode 100644 index e28fa8dba4..0000000000 --- a/assets/js/0480b142.4ee5e226.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[836],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(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 l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),u=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(s.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},h=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),p=u(n),h=o,m=p["".concat(s,".").concat(h)]||p[h]||d[h]||r;return n?a.createElement(m,l(l({ref:t},c),{},{components:n})):a.createElement(m,l({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,l=new Array(r);l[0]=h;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[p]="string"==typeof e?e:o,l[1]=i;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>r,metadata:()=>i,toc:()=>u});var a=n(83117),o=(n(67294),n(3905));const r={sidebar_label:"Binance Extension Wallet FAQs",hide_table_of_contents:!1,sidebar_position:2},l="Binance Extension Wallet FAQs",i={unversionedId:"faq",id:"faq",title:"Binance Extension Wallet FAQs",description:"How can I download Binance Extension Wallet (BEW)?",source:"@site/docs/faq.md",sourceDirName:".",slug:"/faq",permalink:"/docs/faq",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/faq.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_label:"Binance Extension Wallet FAQs",hide_table_of_contents:!1,sidebar_position:2},sidebar:"bscSideBar",previous:{title:"BSC Cross-chain Communication FAQs",permalink:"/docs/cross"},next:{title:"BNB Beacon Chain FAQ",permalink:"/docs/beaconchain/faq/"}},s={},u=[{value:"How can I download Binance Extension Wallet (BEW)?",id:"how-can-i-download-binance-extension-wallet-bew",level:2},{value:"How to stay safe",id:"how-to-stay-safe",level:2},{value:"Take responsibility for your own funds",id:"take-responsibility-for-your-own-funds",level:2},{value:"Write down your seed phrase",id:"write-down-your-seed-phrase",level:2},{value:"Do Your Own Research",id:"do-your-own-research",level:2},{value:"Tokens not visible after withdrawing from Binance",id:"tokens-not-visible-after-withdrawing-from-binance",level:2},{value:"How Much BNB You Need To Send Tokens",id:"how-much-bnb-you-need-to-send-tokens",level:2},{value:"Current Gas Price",id:"current-gas-price",level:2},{value:"How to Reveal Your Seed Phrase",id:"how-to-reveal-your-seed-phrase",level:2},{value:"What do i do if i lost/forgot my Seed Phrase?",id:"what-do-i-do-if-i-lostforgot-my-seed-phrase",level:2},{value:"Backing Up When Installing",id:"backing-up-when-installing",level:2},{value:"Backing Up After You Install Binance Extension Wallet",id:"backing-up-after-you-install-binance-extension-wallet",level:2},{value:"How to Reset My Password or Import an Account",id:"how-to-reset-my-password-or-import-an-account",level:2},{value:"Which network does BEW support?",id:"which-network-does-bew-support",level:2},{value:"Why my Tokens are not visible?",id:"why-my-tokens-are-not-visible",level:2},{value:"How much BNB you need for sending tokens?",id:"how-much-bnb-you-need-for-sending-tokens",level:2},{value:"How to Recover Crypto Transferred to the Wrong Network on Binance?",id:"how-to-recover-crypto-transferred-to-the-wrong-network-on-binance",level:2},{value:"Extension Wallet Update: Chrome",id:"extension-wallet-update-chrome",level:2},{value:"Extension Wallet Update : Firefox",id:"extension-wallet-update--firefox",level:2},{value:"Why are Tokens not visible after withdrawing from Binance?",id:"why-are-tokens-not-visible-after-withdrawing-from-binance",level:2},{value:"Can I use Extension wallet for Binance DEX",id:"can-i-use-extension-wallet-for-binance-dex",level:2},{value:"How to Recover funds send to Ethereum network",id:"how-to-recover-funds-send-to-ethereum-network",level:2},{value:"Why should I use Wallet Direct?",id:"why-should-i-use-wallet-direct",level:2},{value:"Common issues with Ledger Account",id:"common-issues-with-ledger-account",level:2},{value:"How can dApp connect with BEW?",id:"how-can-dapp-connect-with-bew",level:2},{value:"How to get support about technical issue on full node?",id:"how-to-get-support-about-technical-issue-on-full-node",level:2}],c={toc:u},p="wrapper";function d(e){let{components:t,...n}=e;return(0,o.kt)(p,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"binance-extension-wallet-faqs"},"Binance Extension Wallet FAQs"),(0,o.kt)("h2",{id:"how-can-i-download-binance-extension-wallet-bew"},"How can I download Binance Extension Wallet (BEW)?"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Chrome App Store Link"),": ",(0,o.kt)("a",{parentName:"p",href:"https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp"},"https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Firefox App Store Link"),": ",(0,o.kt)("a",{parentName:"p",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search")),(0,o.kt)("p",null,"Install Binance Extension Wallet "),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"}," This is an example to install BNB Chain Extension Waller on Firefox browser. However, workflow is same for all browsers.")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Open Extension in Firefox: ",(0,o.kt)("a",{parentName:"p",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"))),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Search for BNB Chain\n",(0,o.kt)("img",{parentName:"p",src:"https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/67023396148/original/T7AmJnBZ33pyv-1vmUZvZQvfpdPcvq5_NQ.png?1633501819",alt:"img"})))),(0,o.kt)("p",null,":::warn\nMake sure it\u2019s offered by BNB Chain\n:::"),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},"Click on \u201cAdd to Firefox\u201d\n",(0,o.kt)("img",{parentName:"li",src:"https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/67023396147/original/bvX8Y5NViWZJcFgaBt76ipaB1F8V87TgIw.png?1633501818",alt:"img"}))),(0,o.kt)("p",null,"That\u2019s it! You have successfully installed the Binance Chain Wallet extension in Firefox! "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Binance Wallet Mobile"),": Binance Mobile is a secure and trusted multi-chain wallet. It is your one-stop gateway to store, exchange and earn crypto. "),(0,o.kt)("h2",{id:"how-to-stay-safe"},"How to stay safe"),(0,o.kt)("p",null,"Wallets are a bit of a shift in thinking. Financial freedom and the ability to access and use funds anywhere comes with a bit of responsibility \u2013 there\u2019s no customer support in crypto."),(0,o.kt)("h2",{id:"take-responsibility-for-your-own-funds"},"Take responsibility for your own funds"),(0,o.kt)("p",null,"Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. Just remember you\u2019re trusting that exchange with custody over your funds. If that company is attacked or folds, your funds are at risk."),(0,o.kt)("h2",{id:"write-down-your-seed-phrase"},"Write down your seed phrase"),(0,o.kt)("p",null,"Wallets will often give you a seed phrase that you must write down somewhere safe. This is the only way you\u2019ll be able to recover your wallet."),(0,o.kt)("p",null,"Here's an example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"there aeroplane curve vent formation doge possible product distinct under spirit lamp\n")),(0,o.kt)("p",null,"Don\u2019t store it on a computer. Write it down and keep it safe."),(0,o.kt)("h2",{id:"do-your-own-research"},"Do Your Own Research"),(0,o.kt)("p",null,"If you use a web wallet, bookmark the site to protect yourself against phishing scams."),(0,o.kt)("p",null,"Remember transactions can\u2019t be reversed and wallets can\u2019t be easily recovered so take care."),(0,o.kt)("h2",{id:"tokens-not-visible-after-withdrawing-from-binance"},"Tokens not visible after withdrawing from Binance"),(0,o.kt)("p",null,"Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like MetaMask. So once you've used their withdraw form, what could be scarier than not seeing your tokens?"),(0,o.kt)("p",null,"First, you'll need to use the MetaMask add Custom Network feature to add the BNB Beacon Chain or BNB Smart Chain's RPC URLs endpoints to your MetaMask."),(0,o.kt)("p",null,"Once you've added the BNB Beacon Chain or the BNB Smart Chain to your MetaMask, you will be able to select different networks to view the assets (you may need to add Custom Tokens too) held by your selected account on that network."),(0,o.kt)("h2",{id:"how-much-bnb-you-need-to-send-tokens"},"How Much BNB You Need To Send Tokens"),(0,o.kt)("p",null,"if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee."),(0,o.kt)("p",null,"You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction."),(0,o.kt)("p",null,"A standard Ether transfer TX will be 21000 gas & a gas price of 15 Gwei.\nWith tokens, the amount of gas is typically gas, so the total TX fee increases to 0.002 BNB - 0.003 BNB."),(0,o.kt)("h2",{id:"current-gas-price"},"Current Gas Price"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'curl --location --request POST \'https://bsc-dataseed2.bnbchain.org\' \\\n--header \'Content-Type: application/json\' \\\n--data-raw \'{"jsonrpc":"2.0", "id":1, "method":"eth_gasPrice", "params": []}\'\n')),(0,o.kt)("h2",{id:"how-to-reveal-your-seed-phrase"},"How to Reveal Your Seed Phrase"),(0,o.kt)("p",null,"When dealing with cryptocurrencies or crypto assets like BNB or BUSD, it is important to always be aware of and have your private keys, seed phrases and passwords backed up in case the unexpected occurs."),(0,o.kt)("h2",{id:"what-do-i-do-if-i-lostforgot-my-seed-phrase"},"What do i do if i lost/forgot my Seed Phrase?"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Seed phrase is only made known to user directly. In the event that is lost, there is no way of recovering it. "),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"We do advice to user to safeguard their seed phrase and do not share with anyone. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},'If you login from public/shared computer or laptop, please make sure to "Lock" the wallet before walking off. ')))),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"There are multiple login options made available to user : do leverage these options as well. "),(0,o.kt)("p",{parentName:"li"}," a. Safulet "),(0,o.kt)("p",{parentName:"li"}," b. tKey ")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Recovering of seed phrase is possible only if you are able to login to your account. "),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Login to your account. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Access account details on the top right corner. ")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},'Click on "Settings". ')),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},'View "Seed Phrase". '))))),(0,o.kt)("p",null,"Important Note: Keeping your seed phrases safe is of paramount importance. If they are stolen or lost, your assets cannot be recovered."),(0,o.kt)("h2",{id:"backing-up-when-installing"},"Backing Up When Installing"),(0,o.kt)("p",null,"When you create a new Binance Extension Wallet account, you are given your 12 word seed phrase is the most important bit of information for you to record and keep safe when managing your extension account."),(0,o.kt)("p",null,"You can write your seed phrase down on a piece of paper, store it on a flash drive or we also make it optional to download a file containing this information."),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/n2FtIpBGm0rfQC1WHDUbL44LhT6VVizzV4uBhzOkFCblCIXFdOISvy-OzCF5rEeU6q0suuW8Z6noqgYWW5_u8AU7mjat3ayEzU031SLjULoFSh0pdQOO_spRwGfqBEbSl8TIVOfa",alt:"img"})),(0,o.kt)("h2",{id:"backing-up-after-you-install-binance-extension-wallet"},"Backing Up After You Install Binance Extension Wallet"),(0,o.kt)("p",null,"If for some reason you forgot to record your 12 word seed phrase or you lost the original copy, you can reveal your seed phrase so you can back it up again."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Select Dropdown Menu (on top-right corner) --\x3e Manage Accounts")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh4.googleusercontent.com/ZXAj9X9TFTunfCJfZjHoJQm9eQZxog61rmZ0zWL4AbQlwhQRe0qj74bHvhnarwHobVbRgaBIKyyDPxQZx4acgAeFPaWN6tloNIiIuRMmDUw2mniafpqfc5RS59Nic-_KXVL64sC6",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"click on Download button")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/2t3UwpFojwMSh4_stRc9wdaOdbm2UqmtYxVL2SdLVfiCSoqF2gcOhHl3Qys6pZXJFG_7CsK2IkFOEdgpuSTiHR1_OOEi0pF_uy3nvsLhibC0vxQjGXLI0aV5gcdts3pML4xmNc4y",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Enter your password to reveal your seed words.")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/9WatFdbEVc8A92-6g5zfaHQRZgqrce1EPEQMdpWnHYyEwab9iZqcwz02cal5om_97oni1fSdh-dTJHHqsVqD74K3umO2SlGl3F9f9vQDSeUF4r0fnLOQbMiHdNSwhgbN33Nmg_U2",alt:"img"})),(0,o.kt)("h2",{id:"how-to-reset-my-password-or-import-an-account"},"How to Reset My Password or Import an Account"),(0,o.kt)("p",null,"When resetting your password for your Binance Extension wallet, you will need your 12 or 24 word seed phrase. If you do not already have your seed phrase saved someplace safe, please make sure to read ",(0,o.kt)("a",{parentName:"p",href:"#how-to-reveal-your-seed-phrase"},"How to Reveal Your Seed Phrase"),"."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Before trying these steps, confirm that you have your seed phrase with you as you will not be able to reset your password otherwise and will risk becoming locked out of your wallet.")),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"If your wallet is currently unlocked, please lock your wallet first."),(0,o.kt)("li",{parentName:"ol"},"Click Import ",(0,o.kt)("strong",{parentName:"li"},"Import seed phrase"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://camo.githubusercontent.com/9fe8761262f1dd77f01a336ae2356e74c15e3552d78be82d761461ade1107f4b/68747470733a2f2f6c68352e676f6f676c6575736572636f6e74656e742e636f6d2f6350443644303336504f69315f794a5f394a4334656d305a6b37476758645a72373236754d706348626d6649476e666179767865465042455932695076733858325a6d5365345f54574f495f3958644e4a786f65496d3641467a6235395643315735344950357945794d4a4e65764d534a62457955377846423149734b51754352443262334f3576",alt:"img"})),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},'Enter your seed phrase in the "Seed Phrase" text box'),(0,o.kt)("li",{parentName:"ol"},"Enter your new password"),(0,o.kt)("li",{parentName:"ol"},"Retype your password to confirm it was written correctly"),(0,o.kt)("li",{parentName:"ol"},"Click ",(0,o.kt)("strong",{parentName:"li"},"Reset")," ")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/ZeM4cYV3rirCo91zw3OVMYRqqpwqIsrWhPnv-t3sL7YhpD0M_DNQ4QQH-Rw8WmapLrX2OzwETLKcEwKA-Rakjuhlnoy7S707Yt8Y0nUC5OKjg04ADgM2bLSb-1f3GZvUxdkj-BuI",alt:"img"})),(0,o.kt)("h2",{id:"which-network-does-bew-support"},"Which network does BEW support?"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"BNB Beacon Chain (BEP2)"),(0,o.kt)("li",{parentName:"ul"},"BNB Smart Chain (BEP20)"),(0,o.kt)("li",{parentName:"ul"},"Ethereum (ERC20)")),(0,o.kt)("h2",{id:"why-my-tokens-are-not-visible"},"Why my Tokens are not visible?"),(0,o.kt)("p",null,"!!! Note : By default each wallet/network will shows the the main token they support. You will need to add additional token to your list. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"For Binance Extension Wallet users"),"\nYou'll need to switch to BNB Beacon Chain Mainnet (BC) mainnet or BNB Smart Chain (BSC) mainnet"),(0,o.kt)("p",null,"Once you've added the asset to your wallet, you will be able to select different networks to view the assets held by your selected account on that network."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"For Metamask wallet users")),(0,o.kt)("p",null,"You'll need to add BNB Smart Chain (BSC) mainnet network, refer ",(0,o.kt)("a",{parentName:"p",href:"https://academy.binance.com/en/articles/connecting-metamask-to-binance-smart-chain"},"here")," for more details. "),(0,o.kt)("p",null,"Then add tokens manually: ",(0,o.kt)("a",{parentName:"p",href:"https://docs.yearn.finance/how-to-guides/how-to-add-a-custom-token-to-metamask"},"https://docs.yearn.finance/how-to-guides/how-to-add-a-custom-token-to-metamask")),(0,o.kt)("h2",{id:"how-much-bnb-you-need-for-sending-tokens"},"How much BNB you need for sending tokens?"),(0,o.kt)("p",null,"A standard Ether transfer TX will be 21000 gas & a gas price of 5 GWEI. With tokens, the amount of gas is typically gas, so the total TX fee increases to 0.0005 BNB - 0.0007 BNB."),(0,o.kt)("p",null,"if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee."),(0,o.kt)("p",null,"You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction."),(0,o.kt)("h2",{id:"how-to-recover-crypto-transferred-to-the-wrong-network-on-binance"},"How to Recover Crypto Transferred to the Wrong Network on Binance?"),(0,o.kt)("p",null,"Please read ",(0,o.kt)("a",{parentName:"p",href:"https://academy.binance.com/en/articles/how-to-recover-crypto-transferred-to-the-wrong-network-on-binance"},"this")," article"),(0,o.kt)("h2",{id:"extension-wallet-update-chrome"},"Extension Wallet Update: Chrome"),(0,o.kt)("p",null,"It is crucial that you always have the latest wallet version installed. If you know that a new version of an extension is out but Chrome hasn\u2019t updated it, here\u2019s how to do it manually."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Start Google Chrome.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Click the vertical ellipsis icon on the browser toolbar.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},'Click on "Extensions" -> "Manage Extensions".')),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Click the Developer Mode button on the right side of the header")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"From there, you should see the \u201cUpdate\u201d button below the search bar. Click on it to update the extensions."))),(0,o.kt)("h2",{id:"extension-wallet-update--firefox"},"Extension Wallet Update : Firefox"),(0,o.kt)("p",null,"It is crucial that you have the latest version installed. "),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},'Click the menu button, click "Add-ons and Themes" and select "Extensions".')),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Click the gear icon in the upper-right area of the Extensions panel.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Choose one of the options below:"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Check for Updates"),": Allows you to check for any updates to your add-ons manually. If there is an update available, you have the option to choose to update it now or later."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"View Recent Updates"),": When you click this option, a Recent Updates panel appears on the left, showing your last updated add-ons."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Update Add-ons Automatically"),": If you want to keep your add-ons up to date, select this option to let them update automatically."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"Reset All Add-ons to Update Automatically"),": If any add-ons have been set to update manually, clicking this option will reset all add-ons to update automatically.")))),(0,o.kt)("h2",{id:"why-are-tokens-not-visible-after-withdrawing-from-binance"},"Why are Tokens not visible after withdrawing from Binance?"),(0,o.kt)("p",null,"Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like Binance Extension wallet or MetaMask. So once you've used their withdrawal form, what could be scarier than not seeing your tokens?"),(0,o.kt)("p",null,"First, you'll need to use BNB Beacon Chain Mainnet (BC) mainnet or BNB Smart Chain (BSC) mainnet"),(0,o.kt)("p",null,"Once you've added the asset to your wallet, you will be able to select different networks to view the assets held by your selected account on that network."),(0,o.kt)("h2",{id:"can-i-use-extension-wallet-for-binance-dex"},"Can I use Extension wallet for Binance DEX"),(0,o.kt)("p",null,"No, you cannot now. The support will be added in future release."),(0,o.kt)("h2",{id:"how-to-recover-funds-send-to-ethereum-network"},"How to Recover funds send to Ethereum network"),(0,o.kt)("p",null,"If the fund is sent to one of your existing accounts, please"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to Ethereum network"),(0,o.kt)("li",{parentName:"ul"},"Add your asset"),(0,o.kt)("li",{parentName:"ul"},"Then you should see your tokens in asset list.")),(0,o.kt)("p",null,"If it's sent to accounts in a different wallet, please"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Export seed phrase of this account"),(0,o.kt)("li",{parentName:"ul"},"Recover your account in Binance Extension Wallet"),(0,o.kt)("li",{parentName:"ul"},"Switch to Ethereum network"),(0,o.kt)("li",{parentName:"ul"},"Add your asset"),(0,o.kt)("li",{parentName:"ul"},"Then you should see your tokens in asset list.")),(0,o.kt)("h2",{id:"why-should-i-use-wallet-direct"},"Why should I use Wallet Direct?"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"Seamless Token Transfer"),": Transfer tokens (which support BNB Beacon Chain, BNB Smart Chain and Ethereum) between paired Binance.com account and Binance Extension Wallet. Without the trouble of copy/paste address and memo every time")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"BNB Holding"),": The BNB positions of your Binance.com account will not change."))),(0,o.kt)("h2",{id:"common-issues-with-ledger-account"},"Common issues with Ledger Account"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Wallet direct does not support Ledger account at the moment.")),(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("p",{parentName:"li"},"Binance DEX still supports Ledger. However, it is recommended to use BEW if you encounter issues when using Ledger. "))),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Install our BEW extension on your browser and login with your BEW wallet account.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Import ledger to your BEW account.")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Use BEW for your transactions."))),(0,o.kt)("ol",{start:3},(0,o.kt)("li",{parentName:"ol"},"Alternatively, you can also reach out to Ledger for support via ",(0,o.kt)("a",{parentName:"li",href:"https://support.ledger.com/hc/en-us/categories/4404369571601-Support?support=true"},"https://support.ledger.com/hc/en-us/categories/4404369571601-Support?support=true")," .")),(0,o.kt)("h2",{id:"how-can-dapp-connect-with-bew"},"How can dApp connect with BEW?"),(0,o.kt)("p",null,"Please read this doc: ",(0,o.kt)("a",{parentName:"p",href:"https://binance-wallet.gitbook.io/binance-chain-wallet/bew-guides/dapp-interaction"},"https://binance-wallet.gitbook.io/binance-chain-wallet/bew-guides/dapp-interaction")),(0,o.kt)("h2",{id:"how-to-get-support-about-technical-issue-on-full-node"},"How to get support about technical issue on full node?"),(0,o.kt)("p",null,"Join our ",(0,o.kt)("a",{parentName:"p",href:"https://discord.com/channels/789402563035660308/912296664004452362"},"node support discord channel")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/049c7c64.960a5675.js b/assets/js/049c7c64.ff512ba5.js similarity index 50% rename from assets/js/049c7c64.960a5675.js rename to assets/js/049c7c64.ff512ba5.js index a2140fbf72..e5b7b34dbe 100644 --- a/assets/js/049c7c64.960a5675.js +++ b/assets/js/049c7c64.ff512ba5.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[2596],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>h});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function l(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=n.createContext({}),s=function(e){var a=n.useContext(o),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},m=function(e){var a=s(e.components);return n.createElement(o.Provider,{value:a},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(t),k=r,h=p["".concat(o,".").concat(k)]||p[k]||g[k]||l;return t?n.createElement(h,i(i({ref:a},m),{},{components:t})):n.createElement(h,i({ref:a},m))}));function h(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=k;var d={};for(var o in a)hasOwnProperty.call(a,o)&&(d[o]=a[o]);d.originalType=e,d[p]="string"==typeof e?e:r,i[1]=d;for(var s=2;s{t.r(a),t.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=t(83117),r=(t(67294),t(3905));const l={},i="CLI Commands",d={unversionedId:"stake/cli-commands",id:"stake/cli-commands",title:"CLI Commands",description:"In order to run the CLI commands related to staking and delegation, it important to first download the bnbcli and tbnbcli binaries.",source:"@site/docs/stake/cli-commands.md",sourceDirName:"stake",slug:"/stake/cli-commands",permalink:"/docs/stake/cli-commands",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/stake/cli-commands.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"Overview",permalink:"/docs/stake/Staking"},next:{title:"Staking with Binance Extension Wallet",permalink:"/docs/wallet/staking"}},o={},s=[{value:"Download Binaries",id:"download-binaries",level:3},{value:"For Mainnet",id:"for-mainnet",level:3},{value:"For Testnet",id:"for-testnet",level:3},{value:"Create BSC Validator",id:"create-bsc-validator",level:2},{value:"Parameters for bsc-create-validator",id:"parameters-for-bsc-create-validator",level:3},{value:"Examples Showing Usage of bsc-create-validator",id:"examples-showing-usage-of-bsc-create-validator",level:3},{value:"If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.",id:"if-you-want-to-create-a-validator-with-the-same-operator-address-and-self-delegator-address-you-only-need-one-signature-for-this-transaction",level:4},{value:"If you want a separated self-delegator address, both self-delegator and validator operator need to sign this transaction.",id:"if-you-want-a-separated-self-delegator-address-both-self-delegator-and-validator-operator-need-to-sign-this-transaction",level:4},{value:"Edit BSC Validator",id:"edit-bsc-validator",level:2},{value:"Parameters for bsc-edit-validator",id:"parameters-for-bsc-edit-validator",level:3},{value:"Examples",id:"examples",level:3},{value:"Delegate BNB",id:"delegate-bnb",level:2},{value:"Parameters for staking bsc-delegate",id:"parameters-for-staking-bsc-delegate",level:3},{value:"Example",id:"example",level:3},{value:"Redelegate BNB",id:"redelegate-bnb",level:2},{value:"Parameters for staking bsc-redelegate",id:"parameters-for-staking-bsc-redelegate",level:3},{value:"Undelegate BNB",id:"undelegate-bnb",level:2},{value:"Parameters for staking bsc-unbond",id:"parameters-for-staking-bsc-unbond",level:3},{value:"Example",id:"example-1",level:3},{value:"Query side chain vaildator by operator",id:"query-side-chain-vaildator-by-operator",level:2},{value:"Parameters for staking side-validator",id:"parameters-for-staking-side-validator",level:3},{value:"Example",id:"example-2",level:3},{value:"Query side chain delegation by delegator and operator",id:"query-side-chain-delegation-by-delegator-and-operator",level:2},{value:"Parameters for staking side-delegation",id:"parameters-for-staking-side-delegation",level:3},{value:"Example",id:"example-3",level:3},{value:"Query side chain delegations by delegator",id:"query-side-chain-delegations-by-delegator",level:2},{value:"Parameters for staking side-delegations",id:"parameters-for-staking-side-delegations",level:3},{value:"Example",id:"example-4",level:3},{value:"Query side chain unbonding delegation",id:"query-side-chain-unbonding-delegation",level:2},{value:"Parameters for staking side-unbonding-delegation",id:"parameters-for-staking-side-unbonding-delegation",level:3},{value:"Example",id:"example-5",level:3},{value:"Query side chain unbonding delegations by delegator",id:"query-side-chain-unbonding-delegations-by-delegator",level:3},{value:"Parameters for staking side-unbonding-delegations",id:"parameters-for-staking-side-unbonding-delegations",level:4},{value:"Example",id:"example-6",level:3},{value:"Query side chain unbonding delegations by validator",id:"query-side-chain-unbonding-delegations-by-validator",level:2},{value:"Parameters for staking side-val-unbonding-delegations",id:"parameters-for-staking-side-val-unbonding-delegations",level:3},{value:"Example",id:"example-7",level:3},{value:"Query side chain re-delegation",id:"query-side-chain-re-delegation",level:2},{value:"Parameters for staking side-redelegation",id:"parameters-for-staking-side-redelegation",level:3},{value:"Example",id:"example-8",level:3},{value:"Query side chain re-delegations by delegator",id:"query-side-chain-re-delegations-by-delegator",level:3},{value:"Parameters for staking side-redelegations",id:"parameters-for-staking-side-redelegations",level:4},{value:"Example",id:"example-9",level:3},{value:"Query side chain re-delegations by validator",id:"query-side-chain-re-delegations-by-validator",level:2},{value:"Parameters for staking side-val-redelegations",id:"parameters-for-staking-side-val-redelegations",level:3},{value:"Example",id:"example-10",level:3},{value:"Query side chain staking pool",id:"query-side-chain-staking-pool",level:2},{value:"Parameters for staking side-pool",id:"parameters-for-staking-side-pool",level:3},{value:"Example",id:"example-11",level:3},{value:"Query side chain top validators",id:"query-side-chain-top-validators",level:2},{value:"Parameters for staking side-top-validators",id:"parameters-for--staking-side-top-validators",level:3},{value:"Example",id:"example-12",level:3},{value:"Query side chain validators count",id:"query-side-chain-validators-count",level:2},{value:"Parameters for staking side-validators-count",id:"parameters-for-staking-side-validators-count",level:3},{value:"Example",id:"example-13",level:3}],m={toc:s},p="wrapper";function g(e){let{components:a,...t}=e;return(0,r.kt)(p,(0,n.Z)({},m,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cli-commands"},"CLI Commands"),(0,r.kt)("p",null,"In order to run the CLI commands related to staking and delegation, it important to first download the ",(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"tbnbcli")," binaries."),(0,r.kt)("h3",{id:"download-binaries"},"Download Binaries"),(0,r.kt)("h3",{id:"for-mainnet"},"For Mainnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h3",{id:"for-testnet"},"For Testnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"tbnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h2",{id:"create-bsc-validator"},"Create BSC Validator"),(0,r.kt)("h3",{id:"parameters-for-bsc-create-validator"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"bsc-create-validator")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, also be used as the validator operator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--address-delegator"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"2000000000000:BNB (means 20000 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"self-delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},"validator name"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional identity signature (ex. UPort or Keybase)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},"optional website"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},"optional details"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The initial commission rate percentage, it has 8 decimal places."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"95000000 (0.95 or 95%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission rate percentage, it has 8 decimal places. You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-change-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"3000000 (0.03 or 3%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission change rate percentage (per day). You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-cons-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"consensus address of the validator on side chain, please use hex format prefixed with 0x"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--home"),(0,r.kt)("td",{parentName:"tr",align:null},"/path/to/cli_home"),(0,r.kt)("td",{parentName:"tr",align:null},"home directory of bnbcli data and config, default to \u201c~/.bnbcli\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("p",null,"Some address parameters we need to highlight here:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Usage"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"DelegatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"Self delegator address. For BC, this address also used to collect fees.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ValidatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"validator operator\u2019s address, used in governance ops like voting.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideConsAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"block producer\u2019s address on side chain, i.e. consensus address. BC has another parameter named ",(0,r.kt)("inlineCode",{parentName:"td"},"PubKey"),", here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideVoteAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"A bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal. \uff5c")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideFeeAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"fees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain. Those BNB will be sent to fee address.")))),(0,r.kt)("h3",{id:"examples-showing-usage-of-bsc-create-validator"},"Examples Showing Usage of ",(0,r.kt)("inlineCode",{parentName:"h3"},"bsc-create-validator")),(0,r.kt)("h4",{id:"if-you-want-to-create-a-validator-with-the-same-operator-address-and-self-delegator-address-you-only-need-one-signature-for-this-transaction"},"If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n')),(0,r.kt)("h4",{id:"if-you-want-a-separated-self-delegator-address-both-self-delegator-and-validator-operator-need-to-sign-this-transaction"},"If you want a separated self-delegator address, both ",(0,r.kt)("inlineCode",{parentName:"h4"},"self-delegator")," and ",(0,r.kt)("inlineCode",{parentName:"h4"},"validator operator")," need to sign this transaction."),(0,r.kt)("p",null,"Here we need to use another two commands to support multiple signatures."),(0,r.kt)("p",null,"a. Use the following commands appended with a parameter ",(0,r.kt)("inlineCode",{parentName:"p"},"**--generate-only**")," and save the result to a json file which would be used to be signed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n')),(0,r.kt)("p",null,"b. both validator operator(--from) and self-delegator(--address-delegator) use ",(0,r.kt)("inlineCode",{parentName:"p"},"**bnbcli sign**")," command to sign the file from a)."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Delegator")," address need to sign ",(0,r.kt)("inlineCode",{parentName:"p"},"unsigned.json")," first"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json\n")),(0,r.kt)("p",null,"Then, ",(0,r.kt)("strong",{parentName:"p"},"validator")," operator addres will sign it later."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json\n")),(0,r.kt)("p",null,"c. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"**bnbcli broadcast**")," to send the transaction from above to the blockchain nodes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris\n\n## testnet\n./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges\n")),(0,r.kt)("p",null,"Verify your transaction in ",(0,r.kt)("a",{parentName:"p",href:"https://explorer.binance.org/"},"mainnet-explorer")," or ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/"},"testnet-explorer")),(0,r.kt)("h2",{id:"edit-bsc-validator"},"Edit BSC Validator"),(0,r.kt)("h3",{id:"parameters-for-bsc-edit-validator"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"bsc-edit-validator")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that also indicate the validator that you want to edit."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},'validator name (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},'optional identity signature (ex. UPort or Keybase) (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},'optional website (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},'optional details (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The new commission rate percentage"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n##testnet\nbash tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n")),(0,r.kt)("h2",{id:"delegate-bnb"},"Delegate BNB"),(0,r.kt)("h3",{id:"parameters-for-staking-bsc-delegate"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking bsc-delegate")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h2",{id:"redelegate-bnb"},"Redelegate BNB"),(0,r.kt)("h3",{id:"parameters-for-staking-bsc-redelegate"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking bsc-redelegate")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-source"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the source validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-dest"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1yyy"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the destination validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,"###s Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n\n\n### testnet\n\ntbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h2",{id:"undelegate-bnb"},"Undelegate BNB"),(0,r.kt)("h3",{id:"parameters-for-staking-bsc-unbond"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking bsc-unbond")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-vaildator-by-operator"},"Query side chain vaildator by operator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-validator"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-validator")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-2"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-delegation-by-delegator-and-operator"},"Query side chain delegation by delegator and operator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-delegation"},"Parameters for staking side-delegation"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-3"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-delegations-by-delegator"},"Query side chain delegations by delegator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-delegations"},"Parameters for staking side-delegations"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-4"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node\n")),(0,r.kt)("h2",{id:"query-side-chain-unbonding-delegation"},"Query side chain unbonding delegation"),(0,r.kt)("h3",{id:"parameters-for-staking-side-unbonding-delegation"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-unbonding-delegation")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-5"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegations-by-delegator"},"Query side chain unbonding delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-unbonding-delegations"},"Parameters for staking side-unbonding-delegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-6"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-unbonding-delegations-by-validator"},"Query side chain unbonding delegations by validator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-val-unbonding-delegations"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-val-unbonding-delegations")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-7"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-re-delegation"},"Query side chain re-delegation"),(0,r.kt)("h3",{id:"parameters-for-staking-side-redelegation"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-redelegation")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-8"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegations-by-delegator"},"Query side chain re-delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-redelegations"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h4"},"staking side-redelegations")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-9"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-re-delegations-by-validator"},"Query side chain re-delegations by validator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-val-redelegations"},"Parameters for staking side-val-redelegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-10"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-staking-pool"},"Query side chain staking pool"),(0,r.kt)("h3",{id:"parameters-for-staking-side-pool"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-pool")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-11"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-top-validators"},"Query side chain top validators"),(0,r.kt)("h3",{id:"parameters-for--staking-side-top-validators"},"Parameters for staking side-top-validators"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--top"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"number of validators to be returned. set as maximum number of validators by default"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("h3",{id:"example-12"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-validators-count"},"Query side chain validators count"),(0,r.kt)("h3",{id:"parameters-for-staking-side-validators-count"},"Parameters for staking side-validators-count"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--jail-involved"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"if true, meaning that the jailed validators will be involved to count"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("h3",{id:"example-13"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")))}g.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[2596],{3905:(e,a,t)=>{t.d(a,{Zo:()=>m,kt:()=>h});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function l(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var o=n.createContext({}),s=function(e){var a=n.useContext(o),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},m=function(e){var a=s(e.components);return n.createElement(o.Provider,{value:a},e.children)},p="mdxType",g={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},k=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,l=e.originalType,o=e.parentName,m=d(e,["components","mdxType","originalType","parentName"]),p=s(t),k=r,h=p["".concat(o,".").concat(k)]||p[k]||g[k]||l;return t?n.createElement(h,i(i({ref:a},m),{},{components:t})):n.createElement(h,i({ref:a},m))}));function h(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var l=t.length,i=new Array(l);i[0]=k;var d={};for(var o in a)hasOwnProperty.call(a,o)&&(d[o]=a[o]);d.originalType=e,d[p]="string"==typeof e?e:r,i[1]=d;for(var s=2;s{t.r(a),t.d(a,{assets:()=>o,contentTitle:()=>i,default:()=>g,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=t(83117),r=(t(67294),t(3905));const l={},i="CLI Commands",d={unversionedId:"stake/cli-commands",id:"stake/cli-commands",title:"CLI Commands",description:"In order to run the CLI commands related to staking and delegation, it important to first download the bnbcli and tbnbcli binaries.",source:"@site/docs/stake/cli-commands.md",sourceDirName:"stake",slug:"/stake/cli-commands",permalink:"/docs/stake/cli-commands",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/stake/cli-commands.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"Overview",permalink:"/docs/stake/Staking"},next:{title:"Staking with Binance Extension Wallet",permalink:"/docs/wallet/staking"}},o={},s=[{value:"Download Binaries",id:"download-binaries",level:3},{value:"For Mainnet",id:"for-mainnet",level:3},{value:"For Testnet",id:"for-testnet",level:3},{value:"Create BSC Validator",id:"create-bsc-validator",level:2},{value:"Parameters for bsc-create-validator",id:"parameters-for-bsc-create-validator",level:3},{value:"Examples Showing Usage of bsc-create-validator",id:"examples-showing-usage-of-bsc-create-validator",level:3},{value:"If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.",id:"if-you-want-to-create-a-validator-with-the-same-operator-address-and-self-delegator-address-you-only-need-one-signature-for-this-transaction",level:4},{value:"If you want a separated self-delegator address, both self-delegator and validator operator need to sign this transaction.",id:"if-you-want-a-separated-self-delegator-address-both-self-delegator-and-validator-operator-need-to-sign-this-transaction",level:4},{value:"Edit BSC Validator",id:"edit-bsc-validator",level:2},{value:"Parameters for bsc-edit-validator",id:"parameters-for-bsc-edit-validator",level:3},{value:"Examples",id:"examples",level:3},{value:"Delegate BNB",id:"delegate-bnb",level:2},{value:"Parameters for staking bsc-delegate",id:"parameters-for-staking-bsc-delegate",level:3},{value:"Example",id:"example",level:3},{value:"Redelegate BNB",id:"redelegate-bnb",level:2},{value:"Parameters for staking bsc-redelegate",id:"parameters-for-staking-bsc-redelegate",level:3},{value:"Undelegate BNB",id:"undelegate-bnb",level:2},{value:"Parameters for staking bsc-unbond",id:"parameters-for-staking-bsc-unbond",level:3},{value:"Example",id:"example-1",level:3},{value:"Query side chain vaildator by operator",id:"query-side-chain-vaildator-by-operator",level:2},{value:"Parameters for staking side-validator",id:"parameters-for-staking-side-validator",level:3},{value:"Example",id:"example-2",level:3},{value:"Query side chain delegation by delegator and operator",id:"query-side-chain-delegation-by-delegator-and-operator",level:2},{value:"Parameters for staking side-delegation",id:"parameters-for-staking-side-delegation",level:3},{value:"Example",id:"example-3",level:3},{value:"Query side chain delegations by delegator",id:"query-side-chain-delegations-by-delegator",level:2},{value:"Parameters for staking side-delegations",id:"parameters-for-staking-side-delegations",level:3},{value:"Example",id:"example-4",level:3},{value:"Query side chain unbonding delegation",id:"query-side-chain-unbonding-delegation",level:2},{value:"Parameters for staking side-unbonding-delegation",id:"parameters-for-staking-side-unbonding-delegation",level:3},{value:"Example",id:"example-5",level:3},{value:"Query side chain unbonding delegations by delegator",id:"query-side-chain-unbonding-delegations-by-delegator",level:3},{value:"Parameters for staking side-unbonding-delegations",id:"parameters-for-staking-side-unbonding-delegations",level:4},{value:"Example",id:"example-6",level:3},{value:"Query side chain unbonding delegations by validator",id:"query-side-chain-unbonding-delegations-by-validator",level:2},{value:"Parameters for staking side-val-unbonding-delegations",id:"parameters-for-staking-side-val-unbonding-delegations",level:3},{value:"Example",id:"example-7",level:3},{value:"Query side chain re-delegation",id:"query-side-chain-re-delegation",level:2},{value:"Parameters for staking side-redelegation",id:"parameters-for-staking-side-redelegation",level:3},{value:"Example",id:"example-8",level:3},{value:"Query side chain re-delegations by delegator",id:"query-side-chain-re-delegations-by-delegator",level:3},{value:"Parameters for staking side-redelegations",id:"parameters-for-staking-side-redelegations",level:4},{value:"Example",id:"example-9",level:3},{value:"Query side chain re-delegations by validator",id:"query-side-chain-re-delegations-by-validator",level:2},{value:"Parameters for staking side-val-redelegations",id:"parameters-for-staking-side-val-redelegations",level:3},{value:"Example",id:"example-10",level:3},{value:"Query side chain staking pool",id:"query-side-chain-staking-pool",level:2},{value:"Parameters for staking side-pool",id:"parameters-for-staking-side-pool",level:3},{value:"Example",id:"example-11",level:3},{value:"Query side chain top validators",id:"query-side-chain-top-validators",level:2},{value:"Parameters for staking side-top-validators",id:"parameters-for--staking-side-top-validators",level:3},{value:"Example",id:"example-12",level:3},{value:"Query side chain validators count",id:"query-side-chain-validators-count",level:2},{value:"Parameters for staking side-validators-count",id:"parameters-for-staking-side-validators-count",level:3},{value:"Example",id:"example-13",level:3}],m={toc:s},p="wrapper";function g(e){let{components:a,...t}=e;return(0,r.kt)(p,(0,n.Z)({},m,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cli-commands"},"CLI Commands"),(0,r.kt)("p",null,"In order to run the CLI commands related to staking and delegation, it important to first download the ",(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"tbnbcli")," binaries."),(0,r.kt)("h3",{id:"download-binaries"},"Download Binaries"),(0,r.kt)("h3",{id:"for-mainnet"},"For Mainnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h3",{id:"for-testnet"},"For Testnet"),(0,r.kt)("p",null,"Please download ",(0,r.kt)("inlineCode",{parentName:"p"},"tbnbcli")," binary from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"here")),(0,r.kt)("h2",{id:"create-bsc-validator"},"Create BSC Validator"),(0,r.kt)("h3",{id:"parameters-for-bsc-create-validator"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"bsc-create-validator")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, also be used as the validator operator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--address-delegator"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"2000000000000:BNB (means 20000 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"self-delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},"validator name"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"optional identity signature (ex. UPort or Keybase)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},"optional website"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},"optional details"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The initial commission rate percentage, it has 8 decimal places."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"95000000 (0.95 or 95%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission rate percentage, it has 8 decimal places. You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-max-change-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"3000000 (0.03 or 3%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The maximum commission change rate percentage (per day). You can not update this rate."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-cons-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"consensus address of the validator on side chain, please use hex format prefixed with 0x"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--home"),(0,r.kt)("td",{parentName:"tr",align:null},"/path/to/cli_home"),(0,r.kt)("td",{parentName:"tr",align:null},"home directory of bnbcli data and config, default to \u201c~/.bnbcli\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("p",null,"Some address parameters we need to highlight here:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Field Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Usage"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"DelegatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"Self delegator address. For BC, this address also used to collect fees.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ValidatorAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"validator operator\u2019s address, used in governance ops like voting.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideConsAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"block producer\u2019s address on side chain, i.e. consensus address. BC has another parameter named ",(0,r.kt)("inlineCode",{parentName:"td"},"PubKey"),", here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideVoteAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"A bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal. \uff5c")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SideFeeAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"fees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain. Those BNB will be sent to fee address.")))),(0,r.kt)("h3",{id:"examples-showing-usage-of-bsc-create-validator"},"Examples Showing Usage of ",(0,r.kt)("inlineCode",{parentName:"h3"},"bsc-create-validator")),(0,r.kt)("h4",{id:"if-you-want-to-create-a-validator-with-the-same-operator-address-and-self-delegator-address-you-only-need-one-signature-for-this-transaction"},"If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n')),(0,r.kt)("h4",{id:"if-you-want-a-separated-self-delegator-address-both-self-delegator-and-validator-operator-need-to-sign-this-transaction"},"If you want a separated self-delegator address, both ",(0,r.kt)("inlineCode",{parentName:"h4"},"self-delegator")," and ",(0,r.kt)("inlineCode",{parentName:"h4"},"validator operator")," need to sign this transaction."),(0,r.kt)("p",null,"Here we need to use another two commands to support multiple signatures."),(0,r.kt)("p",null,"a. Use the following commands appended with a parameter ",(0,r.kt)("inlineCode",{parentName:"p"},"**--generate-only**")," and save the result to a json file which would be used to be signed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'## mainnet\nbnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n\n## testnet\ntbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json\n')),(0,r.kt)("p",null,"b. both validator operator(--from) and self-delegator(--address-delegator) use ",(0,r.kt)("inlineCode",{parentName:"p"},"**bnbcli sign**")," command to sign the file from a)."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Delegator")," address need to sign ",(0,r.kt)("inlineCode",{parentName:"p"},"unsigned.json")," first"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json\n\n## testnet\n./tbnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json\n")),(0,r.kt)("p",null,"Then, ",(0,r.kt)("strong",{parentName:"p"},"validator")," operator addres will sign it later."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Online Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Offline Mode")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json\n\n## testnet\n./tbnbcli sign delegator-signed.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json\n")),(0,r.kt)("p",null,"c. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"**bnbcli broadcast**")," to send the transaction from above to the blockchain nodes."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\n./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris\n\n## testnet\n./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges\n")),(0,r.kt)("p",null,"Verify your transaction in ",(0,r.kt)("a",{parentName:"p",href:"https://explorer.bnbchain.org/"},"mainnet-explorer")," or ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/"},"testnet-explorer")),(0,r.kt)("h2",{id:"edit-bsc-validator"},"Edit BSC Validator"),(0,r.kt)("h3",{id:"parameters-for-bsc-edit-validator"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"bsc-edit-validator")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that also indicate the validator that you want to edit."),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"myval1"),(0,r.kt)("td",{parentName:"tr",align:null},'validator name (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--identity"),(0,r.kt)("td",{parentName:"tr",align:null},"xxx"),(0,r.kt)("td",{parentName:"tr",align:null},'optional identity signature (ex. UPort or Keybase) (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--website"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"http://www.example.com"},"www.example.com")),(0,r.kt)("td",{parentName:"tr",align:null},'optional website (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--details"),(0,r.kt)("td",{parentName:"tr",align:null},"some details"),(0,r.kt)("td",{parentName:"tr",align:null},'optional details (default "',"[do-not-modify]",'")'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--commission-rate"),(0,r.kt)("td",{parentName:"tr",align:null},"80000000(that means 0.8 or 80%)"),(0,r.kt)("td",{parentName:"tr",align:null},"The new commission rate percentage"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-vote-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0x1234abcd"),(0,r.kt)("td",{parentName:"tr",align:null},"vote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-fee-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"0xabcd1234"),(0,r.kt)("td",{parentName:"tr",align:null},"address that validator collects fee rewards on side chain, please use hex format prefixed with 0x."),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n\n##testnet\nbash tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli\n")),(0,r.kt)("h2",{id:"delegate-bnb"},"Delegate BNB"),(0,r.kt)("h3",{id:"parameters-for-staking-bsc-delegate"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking bsc-delegate")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n\n## testnet\ntbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h2",{id:"redelegate-bnb"},"Redelegate BNB"),(0,r.kt)("h3",{id:"parameters-for-staking-bsc-redelegate"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking bsc-redelegate")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-source"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the source validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--addr-validator-dest"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1yyy"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the destination validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("p",null,"###s Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"## mainnet\nbnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n\n\n### testnet\n\ntbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h2",{id:"undelegate-bnb"},"Undelegate BNB"),(0,r.kt)("h3",{id:"parameters-for-staking-bsc-unbond"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking bsc-unbond")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--from"),(0,r.kt)("td",{parentName:"tr",align:null},"bnb1xxx/tbnb1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"address of private key with which to sign this tx, that is also the delegator address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--validator"),(0,r.kt)("td",{parentName:"tr",align:null},"bva1xxx"),(0,r.kt)("td",{parentName:"tr",align:null},"bech32 address of the validator, starts with \u201cbva\u201d"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000:BNB (10 BNB)"),(0,r.kt)("td",{parentName:"tr",align:null},"delegation amount, it has 8 decimal places"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-1"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-vaildator-by-operator"},"Query side chain vaildator by operator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-validator"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-validator")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-2"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-delegation-by-delegator-and-operator"},"Query side chain delegation by delegator and operator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-delegation"},"Parameters for staking side-delegation"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-3"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-delegations-by-delegator"},"Query side chain delegations by delegator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-delegations"},"Parameters for staking side-delegations"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of binance chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-4"},"Example"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Mainnet")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node\n")),(0,r.kt)("h2",{id:"query-side-chain-unbonding-delegation"},"Query side chain unbonding delegation"),(0,r.kt)("h3",{id:"parameters-for-staking-side-unbonding-delegation"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-unbonding-delegation")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-5"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-unbonding-delegations-by-delegator"},"Query side chain unbonding delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-unbonding-delegations"},"Parameters for staking side-unbonding-delegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-6"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-unbonding-delegations-by-validator"},"Query side chain unbonding delegations by validator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-val-unbonding-delegations"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-val-unbonding-delegations")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-7"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-re-delegation"},"Query side chain re-delegation"),(0,r.kt)("h3",{id:"parameters-for-staking-side-redelegation"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-redelegation")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-8"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h3",{id:"query-side-chain-re-delegations-by-delegator"},"Query side chain re-delegations by delegator"),(0,r.kt)("h4",{id:"parameters-for-staking-side-redelegations"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h4"},"staking side-redelegations")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations [delegator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-9"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-re-delegations-by-validator"},"Query side chain re-delegations by validator"),(0,r.kt)("h3",{id:"parameters-for-staking-side-val-redelegations"},"Parameters for staking side-val-redelegations"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Usage:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations [operator-addr] [flags]\n")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-10"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-staking-pool"},"Query side chain staking pool"),(0,r.kt)("h3",{id:"parameters-for-staking-side-pool"},"Parameters for ",(0,r.kt)("inlineCode",{parentName:"h3"},"staking side-pool")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"bsc/chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,r.kt)("h3",{id:"example-11"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-top-validators"},"Query side chain top validators"),(0,r.kt)("h3",{id:"parameters-for--staking-side-top-validators"},"Parameters for staking side-top-validators"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"parameter name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--top"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"number of validators to be returned. set as maximum number of validators by default"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("h3",{id:"example-12"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")),(0,r.kt)("h2",{id:"query-side-chain-validators-count"},"Query side chain validators count"),(0,r.kt)("h3",{id:"parameters-for-staking-side-validators-count"},"Parameters for staking side-validators-count"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Parameter Name")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Example")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Explanation")),(0,r.kt)("th",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"th"},"Required")))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-XXX"),(0,r.kt)("td",{parentName:"tr",align:null},"the chain id of BNB Beacon Chain"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--side-chain-id"),(0,r.kt)("td",{parentName:"tr",align:null},"chapel"),(0,r.kt)("td",{parentName:"tr",align:null},"chain-id of the side chain the validator belongs to"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"--jail-involved"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"if true, meaning that the jailed validators will be involved to count"),(0,r.kt)("td",{parentName:"tr",align:null},"Option")))),(0,r.kt)("h3",{id:"example-13"},"Example"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"bnbcli staking side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli\n")))}g.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3ca8d367.3b5a2b29.js b/assets/js/3ca8d367.9e5dce2d.js similarity index 75% rename from assets/js/3ca8d367.3b5a2b29.js rename to assets/js/3ca8d367.9e5dce2d.js index 5b1e61c8f8..2de33e9e9b 100644 --- a/assets/js/3ca8d367.3b5a2b29.js +++ b/assets/js/3ca8d367.9e5dce2d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[2280],{3905:(t,e,a)=>{a.d(e,{Zo:()=>k,kt:()=>o});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function p(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var m=n.createContext({}),d=function(t){var e=n.useContext(m),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},k=function(t){var e=d(t.components);return n.createElement(m.Provider,{value:e},t.children)},N="mdxType",u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},g=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,m=t.parentName,k=i(t,["components","mdxType","originalType","parentName"]),N=d(a),g=r,o=N["".concat(m,".").concat(g)]||N[g]||u[g]||l;return a?n.createElement(o,p(p({ref:e},k),{},{components:a})):n.createElement(o,p({ref:e},k))}));function o(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,p=new Array(l);p[0]=g;var i={};for(var m in e)hasOwnProperty.call(e,m)&&(i[m]=e[m]);i.originalType=t,i[N]="string"==typeof t?t:r,p[1]=i;for(var d=2;d{a.r(e),a.d(e,{assets:()=>m,contentTitle:()=>p,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var n=a(83117),r=(a(67294),a(3905));const l={},p="HTTP API",i={unversionedId:"api-reference/dex-api/paths",id:"api-reference/dex-api/paths",title:"HTTP API",description:"Within the ecosystem of BNB Beacon Chain, there are several accelerated nodes which provides more secure and faster lines to access BNB Beacon Chain and DEX data service including HTTP API.",source:"@site/docs/api-reference/dex-api/paths.md",sourceDirName:"api-reference/dex-api",slug:"/api-reference/dex-api/paths",permalink:"/docs/api-reference/dex-api/paths",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/api-reference/dex-api/paths.md",tags:[],version:"current",frontMatter:{}},m={},d=[{value:"/api/v1/time",id:"apiv1time",level:3},{value:"GET",id:"get",level:5},{value:"/api/v1/node-info",id:"apiv1node-info",level:3},{value:"GET",id:"get-1",level:5},{value:"/api/v1/validators",id:"apiv1validators",level:3},{value:"GET",id:"get-2",level:5},{value:"/api/v1/peers",id:"apiv1peers",level:3},{value:"GET",id:"get-3",level:5},{value:"/api/v1/account/{address}",id:"apiv1accountaddress",level:3},{value:"GET",id:"get-4",level:5},{value:"/api/v1/account/{address}/sequence",id:"apiv1accountaddresssequence",level:3},{value:"GET",id:"get-5",level:5},{value:"/api/v1/tx/{hash}",id:"apiv1txhash",level:3},{value:"GET",id:"get-6",level:5},{value:"/api/v1/tokens",id:"apiv1tokens",level:3},{value:"GET",id:"get-7",level:5},{value:"/api/v1/markets",id:"apiv1markets",level:3},{value:"GET",id:"get-8",level:5},{value:"/api/v1/fees",id:"apiv1fees",level:3},{value:"GET",id:"get-9",level:5},{value:"/api/v1/depth",id:"apiv1depth",level:3},{value:"GET",id:"get-10",level:5},{value:"/api/v1/broadcast",id:"apiv1broadcast",level:3},{value:"POST",id:"post",level:5},{value:"/api/v1/klines",id:"apiv1klines",level:3},{value:"GET",id:"get-11",level:5},{value:"/api/v1/orders/closed",id:"apiv1ordersclosed",level:3},{value:"GET",id:"get-12",level:5},{value:"/api/v1/orders/open",id:"apiv1ordersopen",level:3},{value:"GET",id:"get-13",level:5},{value:"/api/v1/orders/{id}",id:"apiv1ordersid",level:3},{value:"GET",id:"get-14",level:5},{value:"/api/v1/ticker/24hr",id:"apiv1ticker24hr",level:3},{value:"GET",id:"get-15",level:5},{value:"/api/v1/trades",id:"apiv1trades",level:3},{value:"GET",id:"get-16",level:5},{value:"/api/v1/block-exchange-fee",id:"apiv1block-exchange-fee",level:3},{value:"GET",id:"get-17",level:5},{value:"/api/v1/transactions",id:"apiv1transactions",level:3},{value:"GET",id:"get-18",level:5},{value:"/api/v1/transactions-in-block/{blockHeight}",id:"apiv1transactions-in-blockblockheight",level:3},{value:"GET",id:"get-19",level:5},{value:"/api/v2/transactions-in-block/{blockHeight}",id:"apiv2transactions-in-blockblockheight",level:3},{value:"GET",id:"get-20",level:5},{value:"/api/v1/atomic-swaps",id:"apiv1atomic-swaps",level:3},{value:"GET",id:"get-21",level:5},{value:"/api/v1/atomic-swaps/{id}",id:"apiv1atomic-swapsid",level:3},{value:"GET",id:"get-22",level:5},{value:"/api/v1/timelocks/{address}",id:"apiv1timelocksaddress",level:3},{value:"GET",id:"get-23",level:5},{value:"/api/v1/timelock/{account_addr}?(id={recordid})",id:"apiv1timelockaccount_addridrecordid",level:3},{value:"GET",id:"get-24",level:5},{value:"/api/v1/mini/tokens",id:"apiv1minitokens",level:3},{value:"GET",id:"get-25",level:5},{value:"/api/v1/mini/markets",id:"apiv1minimarkets",level:3},{value:"GET",id:"get-26",level:5},{value:"/api/v1/mini/klines",id:"apiv1miniklines",level:3},{value:"GET",id:"get-27",level:5},{value:"/api/v1/mini/orders/closed",id:"apiv1miniordersclosed",level:3},{value:"GET",id:"get-28",level:5},{value:"/api/v1/mini/orders/open",id:"apiv1miniordersopen",level:3},{value:"GET",id:"get-29",level:5},{value:"/api/v1/mini/orders/{id}",id:"apiv1miniordersid",level:3},{value:"GET",id:"get-30",level:5},{value:"/api/v1/mini/ticker/24hr",id:"apiv1miniticker24hr",level:3},{value:"GET",id:"get-31",level:5},{value:"/api/v1/mini/trades",id:"apiv1minitrades",level:3},{value:"GET",id:"get-32",level:5},{value:"Models",id:"models",level:3},{value:"Error",id:"error",level:3},{value:"Times",id:"times",level:3},{value:"Validators",id:"validators",level:3},{value:"Validator",id:"validator",level:3},{value:"Peer",id:"peer",level:3},{value:"Transaction",id:"transaction",level:3},{value:"Account",id:"account",level:3},{value:"AccountSequence",id:"accountsequence",level:3},{value:"Balance",id:"balance",level:3},{value:"Token",id:"token",level:3},{value:"Market",id:"market",level:3},{value:"Fee",id:"fee",level:3},{value:"FixedFeeParams",id:"fixedfeeparams",level:3},{value:"DexFeeFieldParams",id:"dexfeefieldparams",level:3},{value:"MarketDepth",id:"marketdepth",level:3},{value:"Candlestick",id:"candlestick",level:3},{value:"OrderList",id:"orderlist",level:3},{value:"Order",id:"order",level:3},{value:"SubTx",id:"subtx",level:3},{value:"TickerStatistics",id:"tickerstatistics",level:3},{value:"TradePage",id:"tradepage",level:3},{value:"Trade",id:"trade",level:3},{value:"BlockExchangeFeePage",id:"blockexchangefeepage",level:3},{value:"BlockExchangeFee",id:"blockexchangefee",level:3},{value:"TxPage",id:"txpage",level:3},{value:"BlockTx",id:"blocktx",level:3},{value:"BlockTxV2",id:"blocktxv2",level:3},{value:"Tx",id:"tx",level:3},{value:"ExchangeRate",id:"exchangerate",level:3},{value:"ResultStatus",id:"resultstatus",level:3},{value:"NodeInfo",id:"nodeinfo",level:3},{value:"SyncInfo",id:"syncinfo",level:3},{value:"ProtocolVersion",id:"protocolversion",level:3},{value:"ValidatorInfo",id:"validatorinfo",level:3},{value:"AtomicSwapPage",id:"atomicswappage",level:3},{value:"AtomicSwap",id:"atomicswap",level:3},{value:"TxV2",id:"txv2",level:3},{value:"TimeLocks",id:"timelocks",level:3},{value:"MiniTokens",id:"minitokens",level:3}],k={toc:d},N="wrapper";function u(t){let{components:e,...a}=t;return(0,r.kt)(N,(0,n.Z)({},k,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"http-api"},"HTTP API"),(0,r.kt)("p",null,"Within the ecosystem of BNB Beacon Chain, there are several accelerated nodes which provides more secure and faster lines to access BNB Beacon Chain and DEX data service including HTTP API."),(0,r.kt)("p",null,"For mainnet, there are more accelerated nodes."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"dex-atlantic.binance.org")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"dex-asiapacific.binance.org")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"dex-european.binance.org"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Version:")," 1.0.0"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"License:")," ",(0,r.kt)("a",{parentName:"p",href:"http://www.apache.org/licenses/LICENSE-2.0.html"},"Apache 2.0")),(0,r.kt)("h3",{id:"apiv1time"},"/api/v1/time"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get the block time."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the latest block time and the current time according to the HTTP service."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/time"},"https://dex.binance.org/api/v1/time")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/time"},"https://testnet-dex.binance.org/api/v1/time")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#times"},"Times"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1node-info"},"/api/v1/node-info"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-1"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get node information."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets runtime information about the node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/node-info"},"https://dex.binance.org/api/v1/node-info")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/node-info"},"https://testnet-dex.binance.org/api/v1/node-info")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#resultstatus"},"ResultStatus"))))),(0,r.kt)("h3",{id:"apiv1validators"},"/api/v1/validators"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-2"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get validators."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the list of validators used in consensus."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/validators"},"https://dex.binance.org/api/v1/validators")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/validators"},"https://testnet-dex.binance.org/api/v1/validators")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#validators"},"Validators")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1peers"},"/api/v1/peers"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-3"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get network peers."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the list of network peers."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/peers"},"https://dex.binance.org/api/v1/peers")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/peers"},"https://testnet-dex.binance.org/api/v1/peers")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#peer"},"Peer")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1accountaddress"},"/api/v1/account/{address}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-4"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an account."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets account metadata for an address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"},"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/account/tbnb185tqzq3j6y7yep85lncaz9qeectjxqe5054cgn"},"https://testnet-dex.binance.org/api/v1/account/tbnb185tqzq3j6y7yep85lncaz9qeectjxqe5054cgn")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#account"},"Account"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1accountaddresssequence"},"/api/v1/account/{address}/sequence"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-5"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an account sequence."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets an account sequence for an address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m/sequence"},"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m/sequence")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/account/tbnb13g2le062t340klgm2l2khzr57y3qxlekuhfuch/sequence"},"https://testnet-dex.binance.org/api/v1/account/tbnb13g2le062t340klgm2l2khzr57y3qxlekuhfuch/sequence")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#accountsequence"},"AccountSequence"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1txhash"},"/api/v1/tx/{hash}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-6"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get a transaction."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets transaction metadata by transaction ID. By default, transactions are returned in a raw format. You may add ",(0,r.kt)("inlineCode",{parentName:"p"},"?format=json")," to the end of the path to obtain a more readable response."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Seed node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example:")),(0,r.kt)("p",null,"Below is an example response of a send transaction when ",(0,r.kt)("inlineCode",{parentName:"p"},"?format=json")," is used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' {\n code:0,\n hash:"433806D6A4AB6359CB56EC55BA99896DFAB2AF11326B74881A2ABA7049C492D3",\n height:"7850389",\n log:"Msg 0: ",\n ok:true,\n tx:{\n type:"auth/StdTx",\n value:{\n data:null,\n memo:"101192150",\n msg:[\n {\n type:"cosmos-sdk/Send",\n value:{\n inputs:[\n {\n address:"bnb1jafs33u9u6f7w7wzfmm4rr9rzy2cgqzp78kwaw",\n coins:[\n {\n amount:"496429373",\n denom:"BNB",\n\n }\n ],\n\n }\n ],\n outputs:[\n {\n address:"bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23",\n coins:[\n {\n amount:"496429373",\n denom:"BNB",\n\n }\n ],\n\n }\n ],\n\n },\n\n }\n ],\n signatures:[\n {\n account_number:"438",\n pub_key:{\n type:"tendermint/PubKeySecp256k1",\n value:"A3mfgg/i12XNyy9esqCjI7yrkrOs9dngP7c9cDUEJly5",\n\n },\n sequence:"0",\n signature:"VvvGz3qbyirJ7vv01Df8tuAd7K4I+HK+yEBfep+qwtMKuHWQQH3XtMB9Pqtc2jlia0AtDe+BUEMtIyh3/N66IQ==",\n\n }\n ],\n source:"1",\n\n },\n\n },\n\n }\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"hash"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The transaction hash to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"format"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"Response format (",(0,r.kt)("inlineCode",{parentName:"td"},"json")," or amino)"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#transaction"},"Transaction"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1tokens"},"/api/v1/tokens"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-7"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get tokens list."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of tokens that have been issued."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/tokens"},"https://dex.binance.org/api/v1/tokens")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/tokens"},"https://testnet-dex.binance.org/api/v1/tokens")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 100."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#token"},"Token")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1markets"},"/api/v1/markets"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-8"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get market pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the list of market pairs that have been listed."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/markets"},"https://dex.binance.org/api/v1/markets")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/markets"},"https://testnet-dex.binance.org/api/v1/markets")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#market"},"Market")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1fees"},"/api/v1/fees"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-9"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Obtain trading fees information."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the current trading fees settings."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/fees"},"https://dex.binance.org/api/v1/fees")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/fees"},"https://testnet-dex.binance.org/api/v1/fees")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#fee"},"Fee")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1depth"},"/api/v1/depth"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-10"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get the order book."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the order book depth data for a given pair symbol."),(0,r.kt)("p",null,"The given ",(0,r.kt)("em",{parentName:"p"},"limit")," must be one of the allowed limits below."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/depth?symbol=xxx-000_BNB"},"https://dex.binance.org/api/v1/depth?symbol=xxx-000_BNB")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/depth?symbol=xxx-000_BNB"},"https://testnet-dex.binance.org/api/v1/depth?symbol=xxx-000_BNB")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"Market pair symbol, e.g. NNB-0AD_BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"The limit of results. Allowed limits: ","[5, 10, 20, 50, 100, 500, 1000]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#marketdepth"},"MarketDepth"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1broadcast"},"/api/v1/broadcast"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"post"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"POST"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Broadcast a transaction."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Broadcasts a signed transaction. A single transaction must be sent hex-encoded with a ",(0,r.kt)("inlineCode",{parentName:"p"},"content-type")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"text/plain"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/broadcast"},"https://dex.binance.org/api/v1/broadcast")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/broadcast"},"https://testnet-dex.binance.org/api/v1/broadcast")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sync"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"Synchronous broadcast (wait for ",(0,r.kt)("a",{parentName:"td",href:"https://github.com/tendermint/tendermint/wiki/Application-Developers#delivertx"},"DeliverTx"),")?"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"body"),(0,r.kt)("td",{parentName:"tr",align:null},"body"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"binary")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#transaction"},"Transaction")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"401"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Signature"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1klines"},"/api/v1/klines"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-11"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get candlestick bars."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets candlestick/kline bars for a symbol. Bars are uniquely identified by their open time."),(0,r.kt)("p",null,"If the time window is larger than limits, only the first n klines will return. In this case, please either shrink the window or increase the limit to get proper amount of klines."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m"},"https://dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m"},"https://testnet-dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n 1499040000000, // Open time\n "0.01634790", // Open\n "0.80000000", // High\n "0.01575800", // Low\n "0.01577100", // Close\n "148976.11427815", // Volume\n 1499644799999, // Close time\n "2434.19055334", // Quote asset volume\n 308 // Number of trades\n]\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"interval"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"interval. Allowed value: ","[1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M]"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 300; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#candlestick"},"Candlestick")," ]")))),(0,r.kt)("h3",{id:"apiv1ordersclosed"},"/api/v1/orders/closed"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-12"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get closed orders."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets closed (filled and cancelled) orders for a given address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order status list. Allowed value: ","[Ack, IocExpire, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))))),(0,r.kt)("h3",{id:"apiv1ordersopen"},"/api/v1/orders/open"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-13"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get open orders."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets open orders for a given address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1ordersid"},"/api/v1/orders/{id}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-14"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an order."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets metadata for an individual order by its ID."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"order id"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#order"},"Order"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1ticker24hr"},"/api/v1/ticker/24hr"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-15"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get a market ticker."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets 24 hour price change statistics for a market pair symbol. Updated every second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tickerstatistics"},"TickerStatistics")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1trades"},"/api/v1/trades"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-16"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get market trades."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of historical trades."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the buyer/seller address"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"buyer order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"height"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"quote asset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"seller order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tradepage"},"TradePage"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1block-exchange-fee"},"/api/v1/block-exchange-fee"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-17"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Trading fee of the address grouped by block"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get historical trading fees of the address, including fees of trade/canceled order/expired order. Transfer and other transaction fees are not included. Order by block height DESC.\n",(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the seller/buyer address"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 50; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#blockexchangefeepage"},"BlockExchangeFeePage"))))),(0,r.kt)("h3",{id:"apiv1transactions"},"/api/v1/transactions"),(0,r.kt)("hr",null),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," This endpoint will be retired soon, use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/api-reference/dex-api/block-service.html#apiv1txs"},"this api")," instead (please read the migration guide)."),(0,r.kt)("h5",{id:"get-18"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get transactions."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of transactions. Multisend transaction is not available in this API. Currently 'confirmBlocks' and 'txAge' are not supported."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 24 hours;The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 15 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"endTime in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"transaction side. Allowed value: ","[ RECEIVE, SEND]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"transaction type. Allowed value: ","[ TRANSFER,NEW_ORDER,ISSUE_TOKEN,BURN_TOKEN,LIST_TOKEN,CANCEL_ORDER,FREEZE_TOKEN,UN_FREEZE_TOKEN,TRANSFER,PROPOSAL,VOTE,MINT,DEPOSIT,CREATE_VALIDATOR,REMOVE_VALIDATOR,TIME_LOCK,TIME_UNLOCK,TIME_RELOCK,SET_ACCOUNT_FLAG,HTL_TRANSFER,CLAIM_HTL,DEPOSIT_HTL,REFUND_HTL]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#txpage"},"TxPage"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"403"),(0,r.kt)("td",{parentName:"tr",align:null},"Tx is not within 24h query window"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1transactions-in-blockblockheight"},"/api/v1/transactions-in-block/{blockHeight}"),(0,r.kt)("hr",null),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," This endpoint will be retired soon, use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/api-reference/dex-api/block-service.html#apiv1blocksblockheighttxs"},"this api")," instead (please read the migration guide)."),(0,r.kt)("h5",{id:"get-19"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get transactions in the specific block."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get transactions in the block. Multi-send and multi-coin transactions are flattened as transactions. This API is deprecated."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 15 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#blocktx"},"BlockTx"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request. The block to query is higher than current highest block."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv2transactions-in-blockblockheight"},"/api/v2/transactions-in-block/{blockHeight}"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," This endpoint will be retired soon, use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/api-reference/dex-api/block-service.html#apiv1blocksblockheighttxs"},"this api")," instead (please read the migration guide)."),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-20"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," transactions in Block"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get transactions in the block. Multi-send and multi-coin transactions are included as sub-transactions."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 15 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#blocktxv2"},"BlockTxV2"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request. The block to query is higher than current highest block."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1atomic-swaps"},"/api/v1/atomic-swaps"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-21"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," AtomicSwap"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get atomic swaps by address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 60 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time of blockTimestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddress"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"At least one of toAddress and fromAddress should be provided as parameter"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 25; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time of blockTimestamp in Milliseconds; The maximum start - end query window is 3 months; Default query window is the latest 30 days."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddress"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"At least one of toAddress and fromAddress should be provided as parameter"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#atomicswappage"},"AtomicSwapPage"))))),(0,r.kt)("h3",{id:"apiv1atomic-swapsid"},"/api/v1/atomic-swaps/{id}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-22"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," AtomicSwap"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get an AtomicSwap by swap id"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 60 request per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"swap id"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#atomicswap"},"AtomicSwap"))))),(0,r.kt)("h3",{id:"apiv1timelocksaddress"},"/api/v1/timelocks/{address}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-23"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Gets time lock records given an address"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the record id of timelock to query"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#timelocks"},"TimeLocks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"internal server error"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1timelockaccount_addridrecordid"},"/api/v1/timelock/{account_addr}?(id={recordid})"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-24"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get timelock records of an address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get the timelock history of an address.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 60 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the record id of timelock to query"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#timelocks"},"TimeLocks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"internal server error"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1minitokens"},"/api/v1/mini/tokens"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-25"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Gets a list of available mini tokens."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#minitokens"},"MiniTokens"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"internal server error"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1minimarkets"},"/api/v1/mini/markets"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-26"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Gets a list of mini market pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#markets"},"Markets"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1miniklines"},"/api/v1/mini/klines"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-27"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get mini-token candlestick bars."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets candlestick/kline bars for a mini-token symbol pair. Bars are uniquely identified by their open time."),(0,r.kt)("p",null,"If the time window is larger than limits, only the first n klines will return. In this case, please either shrink the window or increase the limit to get proper amount of klines."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n 1499040000000, // Open time\n "0.01634790", // Open\n "0.80000000", // High\n "0.01575800", // Low\n "0.01577100", // Close\n "148976.11427815", // Volume\n 1499644799999, // Close time\n "2434.19055334", // Quote asset volume\n 308 // Number of trades\n]\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"interval"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"interval. Allowed value: ","[1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M]"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 300; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#candlestick"},"Candlestick")," ]")))),(0,r.kt)("h3",{id:"apiv1miniordersclosed"},"/api/v1/mini/orders/closed"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-28"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get closed orders of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets closed (filled and cancelled) orders for a given address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order status list. Allowed value: ","[Ack, IocExpire, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))))),(0,r.kt)("h3",{id:"apiv1miniordersopen"},"/api/v1/mini/orders/open"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-29"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get open orders of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets open orders for a given address.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1miniordersid"},"/api/v1/mini/orders/{id}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-30"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an order of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets metadata for an individual order by its ID.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"order id"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#order"},"Order"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1miniticker24hr"},"/api/v1/mini/ticker/24hr"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-31"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get a market ticker of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets 24 hour price change statistics for a market pair symbol. Updated every second.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tickerstatistics"},"TickerStatistics")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1minitrades"},"/api/v1/mini/trades"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-32"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get market trades of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of historical trades.\n",(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the buyer/seller address"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"buyer order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"height"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"quote asset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"seller order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tradepage"},"TradePage"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"models"},"Models"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"error"},"Error"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"error code"),(0,r.kt)("td",{parentName:"tr",align:null},"400")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"message"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"error message"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"times"},"Times"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ap_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"event time"),(0,r.kt)("td",{parentName:"tr",align:null},"e.g. 2019-01-21T10:30:00Z")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"block_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"the time of latest block"),(0,r.kt)("td",{parentName:"tr",align:null},"e.g. 2019-01-21T10:30:00Z")))),(0,r.kt)("h3",{id:"validators"},"Validators"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"block_height"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"Current block height"),(0,r.kt)("td",{parentName:"tr",align:null},"12345")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"validators"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#validator"},"Validator")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"validator"},"Validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex address)"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"pub_key"),(0,r.kt)("td",{parentName:"tr",align:null},"[ integer ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Public key bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"voting_power"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"validator's voting power"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"accum"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"validator's accumulated voting power"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"peer"},"Peer"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Authenticated identifier"),(0,r.kt)("td",{parentName:"tr",align:null},"8c379d4d3b9995c712665dc9a9414dbde5b30483")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"original_listen_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Original listen address before PeersService changed it"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"listen_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Listen address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"access_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Access address (HTTP)"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"stream_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Stream address (WS)"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"network"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Chain ID"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-Ganges")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"version"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Version"),(0,r.kt)("td",{parentName:"tr",align:null},"0.30.1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Moniker (Name)"),(0,r.kt)("td",{parentName:"tr",align:null},"data-seed-1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"capabilities"),(0,r.kt)("td",{parentName:"tr",align:null},"[ string ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Array of capability tags: node, qs, ap, ws"),(0,r.kt)("td",{parentName:"tr",align:null},"node,ap")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"accelerated"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null},"Is an accelerated path to a validator node"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"transaction"},"Transaction"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"hash"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex)"),(0,r.kt)("td",{parentName:"tr",align:null},"Hash of transaction, it returned as bytes before, and now it returns as hex string"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"log"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Log of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"data"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Data of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"height"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Height of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"Result code of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ok"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"object"),(0,r.kt)("td",{parentName:"tr",align:null},"Detail of transaction, like transaction type, messages and signature"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("p",null,"For example, below is the detail of a send transaction. Most of the fields are fixed, but the detail of msg\nvaries with msg type, if you query with --format=json."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "type": "auth/StdTx", // fixed, type of transaction\n "value": { // fixed, detail of the transaction\n "data": null, // fixed, data of the transaction\n "memo": "", // fixed, memo\n "msg": [ // fixed, msgs of the transaction\n {\n "type": "cosmos-sdk/Send", // vary with msg type\n "value": { // value content vary with mst type\n "inputs": [\n {\n "address": "bnb1vt4zwu5hy7tyryktud6mpcu8h2ehh6xw66gzwp",\n "coins": [\n {\n "amount": "100000000000000",\n "denom": "BNB"\n }\n ]\n }\n ],\n "outputs": [\n {\n "address": "bnb1kg8mh20tndur9d9rry4wjunhpfzcud30qzf0qv",\n "coins": [\n {\n "amount": "100000000000000",\n "denom": "BNB"\n }\n ]\n }\n ]\n }\n }\n ],\n "signatures": [ // fixed, signatures of the transaction\n {\n "account_number": "0",\n "pub_key": {\n "type": "tendermint/PubKeySecp256k1",\n "value": "AoWY3eWBOnnvLPTz4RsUlX1pWCkLLPewu1vAAoTEzxzR"\n },\n "sequence": "1",\n "signature": "6O2TQAgleFNPw4zIWBLaNvOf5dR7DHNSr2DwAPeFK6lokRqZd2KR2BD+WlmaWj4LdLo5N+utN1JtY41E91N0uw=="\n }\n ],\n "source": "0" // fixed, source of the transaction\n }\n}\n')),(0,r.kt)("p",null," | |"),(0,r.kt)("h3",{id:"account"},"Account"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"account_number"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string (address)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"balances"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#balance"},"Balance")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"public_key"),(0,r.kt)("td",{parentName:"tr",align:null},"[ integer ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Public key bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"sequence is for preventing replay attack"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"accountsequence"},"AccountSequence"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"number used for preventing replay attack"),(0,r.kt)("td",{parentName:"tr",align:null},"1")))),(0,r.kt)("h3",{id:"balance"},"Balance"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string (currency)"),(0,r.kt)("td",{parentName:"tr",align:null},"asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"free"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 0.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"locked"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 0.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"frozen"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 0.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")))),(0,r.kt)("h3",{id:"token"},"Token"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"token name"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance Chain Native Token")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"unique token trade symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"BTC-000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"original_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"token symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"BTC")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total_supply"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"total token supply in decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"owner"),(0,r.kt)("td",{parentName:"tr",align:null},"string (address)"),(0,r.kt)("td",{parentName:"tr",align:null},"Address which issue the token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"smart contract address for this token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_decimals"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"the token decimals"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"market"},"Market"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"base_asset_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string (currency)"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol of base asset"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quote_asset_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string (currency)"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol of quote asset"),(0,r.kt)("td",{parentName:"tr",align:null},"ABC-5CA")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"list_price"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form"),(0,r.kt)("td",{parentName:"tr",align:null},"1.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tick_size"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimium price change in decimal form"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000001")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lot_size"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimium trading quantity in decimal form"),(0,r.kt)("td",{parentName:"tr",align:null},"1.00000000")))),(0,r.kt)("h3",{id:"fee"},"Fee"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"msg_type"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Transaction msg type that this fee applies to"),(0,r.kt)("td",{parentName:"tr",align:null},"submit_proposal")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"The fee amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_for"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 = proposer, 2 = all, 3 = free"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"multi_transfer_fee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Fee for multi-transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"200000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lower_limit_as_multi"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"e.g. 2"),(0,r.kt)("td",{parentName:"tr",align:null},"2")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fixed_fee_params"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#fixedfeeparams"},"FixedFeeParams")),(0,r.kt)("td",{parentName:"tr",align:null},"Set if the fee is fixed"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"dex_fee_fields"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#dexfeefieldparams"},"DexFeeFieldParams")),(0,r.kt)("td",{parentName:"tr",align:null},"dex fee"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"fixedfeeparams"},"FixedFeeParams"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"msg_type"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Transaction msg type that this fee applies to"),(0,r.kt)("td",{parentName:"tr",align:null},"submit_proposal")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"The fixed fee amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_for"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 = proposer, 2 = all, 3 = free"),(0,r.kt)("td",{parentName:"tr",align:null},"1")))),(0,r.kt)("h3",{id:"dexfeefieldparams"},"DexFeeFieldParams"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"fee name"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_value"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"fee value"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"marketdepth"},"MarketDepth"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"asks"),(0,r.kt)("td",{parentName:"tr",align:null},"[ string (fixed8) ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Price and qty in decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},'["1.00000000","800.00000000"]')),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bids"),(0,r.kt)("td",{parentName:"tr",align:null},"[ string (fixed8) ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Price and qty in decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},'["1.00000000","800.00000000"]')),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"pending_match"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null},"If new orders inserted in current block and the matching process has not started in the block, return true."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"candlestick"},"Candlestick"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"close"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"closing price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"closeTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"time of closing trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"high"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the highest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"low"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the lowest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"numberOfTrades"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"total trades"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"open"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"open price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"openTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"time of open trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAssetVolume"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the total trading volume in quote asset"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"volume"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the total trading volume"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"orderlist"},"OrderList"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"order"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#order"},"Order")," ]"),(0,r.kt)("td",{parentName:"tr",align:null},"list of orders"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"order"},"Order"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"cumulateQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"total amount of trades that have made"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee on the latest updated block of this order. Multiple assets are split by semicolon."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastExecutedPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"price of last execution"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastExecutedQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"quantity of last execution"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderCreateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"time of order creation"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"owner"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order issuer"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"price"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 for buy and 2 for sell"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"enum ","[Ack, PartialFill, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching, IocExpire]"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading pair symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timeInForce"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 for Good Till Expire(GTE) order and 3 for Immediate Or Cancel (IOC)"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tradeId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"transactionHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"transactionTime"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"time of latest order update, for example, cancel, expire"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"type"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"only 2 is available for now, meaning limit order"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"subtx"},"SubTx"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"value"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"tickerstatistics"},"TickerStatistics"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"askPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"sell price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"askQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"sell quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bidPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"buy price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bidQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"buy quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"closeTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"time of closing"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"count"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"total trade count"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"firstId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of first trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"highPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"highest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of last trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"last price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"last quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lowPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"lowest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"openPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"open price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"openTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"open time"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"prevClosePrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"last close price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"priceChange"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"change of price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"priceChangePercent"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"change of price in percentage"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteVolume"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading volume in quote asset"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"volume"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading volume"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"weightedAvgPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"weighted average price"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"tradepage"},"TradePage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"total number of trades"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"trade"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#trade"},"Trade")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"trade"},"Trade"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"baseAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"base asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the buyer address on the block of this trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"id of buyer"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order id for buyer"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buySingleFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the buyer address on this single trade"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB:0.00000172;")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerSource"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"tx source of buy order"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"price"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"quote asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the seller address on the block of this trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"seller ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"seller order ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellSingleFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the seller address on this single trade"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB:0.00000216;")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerSource"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"tx source of sell order"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tickType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"enum ","[Unknown,SellTaker,BuyTaker,BuySurplus,SellSurplus,Neutral]"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"time"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"trade time"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tradeId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade ID"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blockexchangefeepage"},"BlockExchangeFeePage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockExchangeFee"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#blockexchangefee"},"BlockExchangeFee")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blockexchangefee"},"BlockExchangeFee"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"timestamp of a block"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"total fee collected. Multiple assets are split by semicolon."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tradeCount"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"trade count of the address on the block"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"txpage"},"TxPage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"total sum of transactions"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tx"},"Tx")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blocktx"},"BlockTx"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tx"},"Tx")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blocktxv2"},"BlockTxV2"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#txv2"},"TxV2")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"tx"},"Tx"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"transaction result code"),(0,r.kt)("td",{parentName:"tr",align:null},"0")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"confirmBlocks"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"data"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"from address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timeStamp"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"time of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"to address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAge"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"type of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"value"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"value of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"source"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"swapId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"proposalId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"exchangerate"},"ExchangeRate"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ExchangeRate"),(0,r.kt)("td",{parentName:"tr",align:null},"object"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"resultstatus"},"ResultStatus"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"validator_info"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#validatorinfo"},"ValidatorInfo")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sync_info"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#syncinfo"},"SyncInfo")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"node_info"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#nodeinfo"},"NodeInfo")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"nodeinfo"},"NodeInfo"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Protocol_Version"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#protocolversion"},"ProtocolVersion")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ID"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"listen_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"network"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"version"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"channels"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"other"),(0,r.kt)("td",{parentName:"tr",align:null},"object"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"syncinfo"},"SyncInfo"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_block_hash"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_app_hash"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_block_height"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_block_time"),(0,r.kt)("td",{parentName:"tr",align:null},"time"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"catching_up"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"protocolversion"},"ProtocolVersion"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"P2P"),(0,r.kt)("td",{parentName:"tr",align:null},"integer (uint64)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"block"),(0,r.kt)("td",{parentName:"tr",align:null},"integer (uint64)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"app"),(0,r.kt)("td",{parentName:"tr",align:null},"integer (uint64)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"validatorinfo"},"ValidatorInfo"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hex address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"pub_key"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hex-encoded"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"voting_power"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"atomicswappage"},"AtomicSwapPage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"atomicSwaps"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#atomicswap"},"AtomicSwap")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"atomicswap"},"AtomicSwap"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockTimestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp of block in which the swap is initiated. The unit is millisecond."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"closedTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossChain"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"expectedIncome"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"expireHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"inAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"outAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumber"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipientOtherChain"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"swapId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"string (int64)"),(0,r.kt)("td",{parentName:"tr",align:null},"The timestamp for randomNumberHash calculation, randomNumberHash=sha256(randomNumber, timestamp). The unit is second."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"txv2"},"TxV2"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"0")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"data"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"memo"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is NEW_ORDER"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"proposalId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is PROPOSAL"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"source"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"subTransactions"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#subtx"},"SubTx")," ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction has sub-transactions, such as multi-send transaction or a transaction have multiple assets"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"swapId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timeStamp"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"value"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"timelocks"},"TimeLocks"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"The record id of the timelock transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"description"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"The description of the timelock transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"amount"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"locktime"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"The available unlock time"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"minitokens"},"MiniTokens"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"Binance Chain Mini Token")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"BTC-000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"original_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"BTC")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total_supply"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"token_type"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"Type of the mini token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"owner"),(0,r.kt)("td",{parentName:"tr",align:null},"string (address)"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"mintable"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null},"mintable"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"token_uri"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"URI for token description"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"smart contract address for this token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_decimals"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"the token decimals"),(0,r.kt)("td",{parentName:"tr",align:null})))))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[2280],{3905:(t,e,a)=>{a.d(e,{Zo:()=>k,kt:()=>o});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function p(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var m=n.createContext({}),d=function(t){var e=n.useContext(m),a=e;return t&&(a="function"==typeof t?t(e):p(p({},e),t)),a},k=function(t){var e=d(t.components);return n.createElement(m.Provider,{value:e},t.children)},N="mdxType",u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},g=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,m=t.parentName,k=i(t,["components","mdxType","originalType","parentName"]),N=d(a),g=r,o=N["".concat(m,".").concat(g)]||N[g]||u[g]||l;return a?n.createElement(o,p(p({ref:e},k),{},{components:a})):n.createElement(o,p({ref:e},k))}));function o(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,p=new Array(l);p[0]=g;var i={};for(var m in e)hasOwnProperty.call(e,m)&&(i[m]=e[m]);i.originalType=t,i[N]="string"==typeof t?t:r,p[1]=i;for(var d=2;d{a.r(e),a.d(e,{assets:()=>m,contentTitle:()=>p,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var n=a(83117),r=(a(67294),a(3905));const l={},p="HTTP API",i={unversionedId:"api-reference/dex-api/paths",id:"api-reference/dex-api/paths",title:"HTTP API",description:"Within the ecosystem of BNB Beacon Chain, there are several accelerated nodes which provides more secure and faster lines to access BNB Beacon Chain and DEX data service including HTTP API.",source:"@site/docs/api-reference/dex-api/paths.md",sourceDirName:"api-reference/dex-api",slug:"/api-reference/dex-api/paths",permalink:"/docs/api-reference/dex-api/paths",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/api-reference/dex-api/paths.md",tags:[],version:"current",frontMatter:{}},m={},d=[{value:"/api/v1/time",id:"apiv1time",level:3},{value:"GET",id:"get",level:5},{value:"/api/v1/node-info",id:"apiv1node-info",level:3},{value:"GET",id:"get-1",level:5},{value:"/api/v1/validators",id:"apiv1validators",level:3},{value:"GET",id:"get-2",level:5},{value:"/api/v1/peers",id:"apiv1peers",level:3},{value:"GET",id:"get-3",level:5},{value:"/api/v1/account/{address}",id:"apiv1accountaddress",level:3},{value:"GET",id:"get-4",level:5},{value:"/api/v1/account/{address}/sequence",id:"apiv1accountaddresssequence",level:3},{value:"GET",id:"get-5",level:5},{value:"/api/v1/tx/{hash}",id:"apiv1txhash",level:3},{value:"GET",id:"get-6",level:5},{value:"/api/v1/tokens",id:"apiv1tokens",level:3},{value:"GET",id:"get-7",level:5},{value:"/api/v1/markets",id:"apiv1markets",level:3},{value:"GET",id:"get-8",level:5},{value:"/api/v1/fees",id:"apiv1fees",level:3},{value:"GET",id:"get-9",level:5},{value:"/api/v1/depth",id:"apiv1depth",level:3},{value:"GET",id:"get-10",level:5},{value:"/api/v1/broadcast",id:"apiv1broadcast",level:3},{value:"POST",id:"post",level:5},{value:"/api/v1/klines",id:"apiv1klines",level:3},{value:"GET",id:"get-11",level:5},{value:"/api/v1/orders/closed",id:"apiv1ordersclosed",level:3},{value:"GET",id:"get-12",level:5},{value:"/api/v1/orders/open",id:"apiv1ordersopen",level:3},{value:"GET",id:"get-13",level:5},{value:"/api/v1/orders/{id}",id:"apiv1ordersid",level:3},{value:"GET",id:"get-14",level:5},{value:"/api/v1/ticker/24hr",id:"apiv1ticker24hr",level:3},{value:"GET",id:"get-15",level:5},{value:"/api/v1/trades",id:"apiv1trades",level:3},{value:"GET",id:"get-16",level:5},{value:"/api/v1/block-exchange-fee",id:"apiv1block-exchange-fee",level:3},{value:"GET",id:"get-17",level:5},{value:"/api/v1/transactions",id:"apiv1transactions",level:3},{value:"GET",id:"get-18",level:5},{value:"/api/v1/transactions-in-block/{blockHeight}",id:"apiv1transactions-in-blockblockheight",level:3},{value:"GET",id:"get-19",level:5},{value:"/api/v2/transactions-in-block/{blockHeight}",id:"apiv2transactions-in-blockblockheight",level:3},{value:"GET",id:"get-20",level:5},{value:"/api/v1/atomic-swaps",id:"apiv1atomic-swaps",level:3},{value:"GET",id:"get-21",level:5},{value:"/api/v1/atomic-swaps/{id}",id:"apiv1atomic-swapsid",level:3},{value:"GET",id:"get-22",level:5},{value:"/api/v1/timelocks/{address}",id:"apiv1timelocksaddress",level:3},{value:"GET",id:"get-23",level:5},{value:"/api/v1/timelock/{account_addr}?(id={recordid})",id:"apiv1timelockaccount_addridrecordid",level:3},{value:"GET",id:"get-24",level:5},{value:"/api/v1/mini/tokens",id:"apiv1minitokens",level:3},{value:"GET",id:"get-25",level:5},{value:"/api/v1/mini/markets",id:"apiv1minimarkets",level:3},{value:"GET",id:"get-26",level:5},{value:"/api/v1/mini/klines",id:"apiv1miniklines",level:3},{value:"GET",id:"get-27",level:5},{value:"/api/v1/mini/orders/closed",id:"apiv1miniordersclosed",level:3},{value:"GET",id:"get-28",level:5},{value:"/api/v1/mini/orders/open",id:"apiv1miniordersopen",level:3},{value:"GET",id:"get-29",level:5},{value:"/api/v1/mini/orders/{id}",id:"apiv1miniordersid",level:3},{value:"GET",id:"get-30",level:5},{value:"/api/v1/mini/ticker/24hr",id:"apiv1miniticker24hr",level:3},{value:"GET",id:"get-31",level:5},{value:"/api/v1/mini/trades",id:"apiv1minitrades",level:3},{value:"GET",id:"get-32",level:5},{value:"Models",id:"models",level:3},{value:"Error",id:"error",level:3},{value:"Times",id:"times",level:3},{value:"Validators",id:"validators",level:3},{value:"Validator",id:"validator",level:3},{value:"Peer",id:"peer",level:3},{value:"Transaction",id:"transaction",level:3},{value:"Account",id:"account",level:3},{value:"AccountSequence",id:"accountsequence",level:3},{value:"Balance",id:"balance",level:3},{value:"Token",id:"token",level:3},{value:"Market",id:"market",level:3},{value:"Fee",id:"fee",level:3},{value:"FixedFeeParams",id:"fixedfeeparams",level:3},{value:"DexFeeFieldParams",id:"dexfeefieldparams",level:3},{value:"MarketDepth",id:"marketdepth",level:3},{value:"Candlestick",id:"candlestick",level:3},{value:"OrderList",id:"orderlist",level:3},{value:"Order",id:"order",level:3},{value:"SubTx",id:"subtx",level:3},{value:"TickerStatistics",id:"tickerstatistics",level:3},{value:"TradePage",id:"tradepage",level:3},{value:"Trade",id:"trade",level:3},{value:"BlockExchangeFeePage",id:"blockexchangefeepage",level:3},{value:"BlockExchangeFee",id:"blockexchangefee",level:3},{value:"TxPage",id:"txpage",level:3},{value:"BlockTx",id:"blocktx",level:3},{value:"BlockTxV2",id:"blocktxv2",level:3},{value:"Tx",id:"tx",level:3},{value:"ExchangeRate",id:"exchangerate",level:3},{value:"ResultStatus",id:"resultstatus",level:3},{value:"NodeInfo",id:"nodeinfo",level:3},{value:"SyncInfo",id:"syncinfo",level:3},{value:"ProtocolVersion",id:"protocolversion",level:3},{value:"ValidatorInfo",id:"validatorinfo",level:3},{value:"AtomicSwapPage",id:"atomicswappage",level:3},{value:"AtomicSwap",id:"atomicswap",level:3},{value:"TxV2",id:"txv2",level:3},{value:"TimeLocks",id:"timelocks",level:3},{value:"MiniTokens",id:"minitokens",level:3}],k={toc:d},N="wrapper";function u(t){let{components:e,...a}=t;return(0,r.kt)(N,(0,n.Z)({},k,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"http-api"},"HTTP API"),(0,r.kt)("p",null,"Within the ecosystem of BNB Beacon Chain, there are several accelerated nodes which provides more secure and faster lines to access BNB Beacon Chain and DEX data service including HTTP API."),(0,r.kt)("p",null,"For mainnet, there are more accelerated nodes."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"dex-atlantic.binance.org")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"dex-asiapacific.binance.org")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"dex-european.binance.org"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Version:")," 1.0.0"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"License:")," ",(0,r.kt)("a",{parentName:"p",href:"http://www.apache.org/licenses/LICENSE-2.0.html"},"Apache 2.0")),(0,r.kt)("h3",{id:"apiv1time"},"/api/v1/time"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get the block time."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the latest block time and the current time according to the HTTP service."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/time"},"https://dex.binance.org/api/v1/time")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/time"},"https://testnet-dex.binance.org/api/v1/time")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#times"},"Times"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1node-info"},"/api/v1/node-info"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-1"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get node information."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets runtime information about the node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/node-info"},"https://dex.binance.org/api/v1/node-info")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/node-info"},"https://testnet-dex.binance.org/api/v1/node-info")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#resultstatus"},"ResultStatus"))))),(0,r.kt)("h3",{id:"apiv1validators"},"/api/v1/validators"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-2"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get validators."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the list of validators used in consensus."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/validators"},"https://dex.binance.org/api/v1/validators")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/validators"},"https://testnet-dex.binance.org/api/v1/validators")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#validators"},"Validators")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1peers"},"/api/v1/peers"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-3"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get network peers."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the list of network peers."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/peers"},"https://dex.binance.org/api/v1/peers")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/peers"},"https://testnet-dex.binance.org/api/v1/peers")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#peer"},"Peer")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1accountaddress"},"/api/v1/account/{address}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-4"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an account."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets account metadata for an address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m"},"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/account/tbnb185tqzq3j6y7yep85lncaz9qeectjxqe5054cgn"},"https://testnet-dex.binance.org/api/v1/account/tbnb185tqzq3j6y7yep85lncaz9qeectjxqe5054cgn")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#account"},"Account"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1accountaddresssequence"},"/api/v1/account/{address}/sequence"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-5"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an account sequence."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets an account sequence for an address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m/sequence"},"https://dex.binance.org/api/v1/account/bnb1jxfh2g85q3v0tdq56fnevx6xcxtcnhtsmcu64m/sequence")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/account/tbnb13g2le062t340klgm2l2khzr57y3qxlekuhfuch/sequence"},"https://testnet-dex.binance.org/api/v1/account/tbnb13g2le062t340klgm2l2khzr57y3qxlekuhfuch/sequence")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#accountsequence"},"AccountSequence"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1txhash"},"/api/v1/tx/{hash}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-6"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get a transaction."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets transaction metadata by transaction ID. By default, transactions are returned in a raw format. You may add ",(0,r.kt)("inlineCode",{parentName:"p"},"?format=json")," to the end of the path to obtain a more readable response."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Seed node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example:")),(0,r.kt)("p",null,"Below is an example response of a send transaction when ",(0,r.kt)("inlineCode",{parentName:"p"},"?format=json")," is used."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' {\n code:0,\n hash:"433806D6A4AB6359CB56EC55BA99896DFAB2AF11326B74881A2ABA7049C492D3",\n height:"7850389",\n log:"Msg 0: ",\n ok:true,\n tx:{\n type:"auth/StdTx",\n value:{\n data:null,\n memo:"101192150",\n msg:[\n {\n type:"cosmos-sdk/Send",\n value:{\n inputs:[\n {\n address:"bnb1jafs33u9u6f7w7wzfmm4rr9rzy2cgqzp78kwaw",\n coins:[\n {\n amount:"496429373",\n denom:"BNB",\n\n }\n ],\n\n }\n ],\n outputs:[\n {\n address:"bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23",\n coins:[\n {\n amount:"496429373",\n denom:"BNB",\n\n }\n ],\n\n }\n ],\n\n },\n\n }\n ],\n signatures:[\n {\n account_number:"438",\n pub_key:{\n type:"tendermint/PubKeySecp256k1",\n value:"A3mfgg/i12XNyy9esqCjI7yrkrOs9dngP7c9cDUEJly5",\n\n },\n sequence:"0",\n signature:"VvvGz3qbyirJ7vv01Df8tuAd7K4I+HK+yEBfep+qwtMKuHWQQH3XtMB9Pqtc2jlia0AtDe+BUEMtIyh3/N66IQ==",\n\n }\n ],\n source:"1",\n\n },\n\n },\n\n }\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"hash"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The transaction hash to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"format"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"Response format (",(0,r.kt)("inlineCode",{parentName:"td"},"json")," or amino)"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#transaction"},"Transaction"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1tokens"},"/api/v1/tokens"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-7"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get tokens list."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of tokens that have been issued."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/tokens"},"https://dex.binance.org/api/v1/tokens")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/tokens"},"https://testnet-dex.binance.org/api/v1/tokens")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 100."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#token"},"Token")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1markets"},"/api/v1/markets"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-8"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get market pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the list of market pairs that have been listed."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/markets"},"https://dex.binance.org/api/v1/markets")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/markets"},"https://testnet-dex.binance.org/api/v1/markets")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#market"},"Market")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1fees"},"/api/v1/fees"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-9"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Obtain trading fees information."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the current trading fees settings."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/fees"},"https://dex.binance.org/api/v1/fees")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/fees"},"https://testnet-dex.binance.org/api/v1/fees")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#fee"},"Fee")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1depth"},"/api/v1/depth"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-10"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get the order book."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets the order book depth data for a given pair symbol."),(0,r.kt)("p",null,"The given ",(0,r.kt)("em",{parentName:"p"},"limit")," must be one of the allowed limits below."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Validator node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/depth?symbol=xxx-000_BNB"},"https://dex.binance.org/api/v1/depth?symbol=xxx-000_BNB")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/depth?symbol=xxx-000_BNB"},"https://testnet-dex.binance.org/api/v1/depth?symbol=xxx-000_BNB")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"Market pair symbol, e.g. NNB-0AD_BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"The limit of results. Allowed limits: ","[5, 10, 20, 50, 100, 500, 1000]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#marketdepth"},"MarketDepth"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1broadcast"},"/api/v1/broadcast"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"post"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"POST"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Broadcast a transaction."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Broadcasts a signed transaction. A single transaction must be sent hex-encoded with a ",(0,r.kt)("inlineCode",{parentName:"p"},"content-type")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"text/plain"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Destination:")," Witness node."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/broadcast"},"https://dex.binance.org/api/v1/broadcast")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/broadcast"},"https://testnet-dex.binance.org/api/v1/broadcast")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sync"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"Synchronous broadcast (wait for ",(0,r.kt)("a",{parentName:"td",href:"https://github.com/tendermint/tendermint/wiki/Application-Developers#delivertx"},"DeliverTx"),")?"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"body"),(0,r.kt)("td",{parentName:"tr",align:null},"body"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"binary")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#transaction"},"Transaction")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"401"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Signature"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1klines"},"/api/v1/klines"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-11"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get candlestick bars."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets candlestick/kline bars for a symbol. Bars are uniquely identified by their open time."),(0,r.kt)("p",null,"If the time window is larger than limits, only the first n klines will return. In this case, please either shrink the window or increase the limit to get proper amount of klines."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for mainnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m"},"https://dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"URL for testnet:")," ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m"},"https://testnet-dex.binance.org/api/v1/klines?symbol=NNB-338_BNB&interval=5m")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n 1499040000000, // Open time\n "0.01634790", // Open\n "0.80000000", // High\n "0.01575800", // Low\n "0.01577100", // Close\n "148976.11427815", // Volume\n 1499644799999, // Close time\n "2434.19055334", // Quote asset volume\n 308 // Number of trades\n]\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"interval"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"interval. Allowed value: ","[1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M]"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 300; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#candlestick"},"Candlestick")," ]")))),(0,r.kt)("h3",{id:"apiv1ordersclosed"},"/api/v1/orders/closed"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-12"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get closed orders."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets closed (filled and cancelled) orders for a given address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order status list. Allowed value: ","[Ack, IocExpire, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))))),(0,r.kt)("h3",{id:"apiv1ordersopen"},"/api/v1/orders/open"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-13"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get open orders."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets open orders for a given address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1ordersid"},"/api/v1/orders/{id}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-14"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an order."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets metadata for an individual order by its ID."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"order id"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#order"},"Order"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1ticker24hr"},"/api/v1/ticker/24hr"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-15"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get a market ticker."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets 24 hour price change statistics for a market pair symbol. Updated every second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tickerstatistics"},"TickerStatistics")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1trades"},"/api/v1/trades"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-16"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get market trades."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of historical trades."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the buyer/seller address"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"buyer order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"height"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"quote asset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"seller order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tradepage"},"TradePage"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1block-exchange-fee"},"/api/v1/block-exchange-fee"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-17"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Trading fee of the address grouped by block"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get historical trading fees of the address, including fees of trade/canceled order/expired order. Transfer and other transaction fees are not included. Order by block height DESC.\n",(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the seller/buyer address"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 50; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#blockexchangefeepage"},"BlockExchangeFeePage"))))),(0,r.kt)("h3",{id:"apiv1transactions"},"/api/v1/transactions"),(0,r.kt)("hr",null),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," This endpoint will be retired soon, use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/api-reference/dex-api/block-service.html#apiv1txs"},"this api")," instead (please read the migration guide)."),(0,r.kt)("h5",{id:"get-18"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get transactions."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of transactions. Multisend transaction is not available in this API. Currently 'confirmBlocks' and 'txAge' are not supported."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 24 hours;The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 15 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"endTime in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"transaction side. Allowed value: ","[ RECEIVE, SEND]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"transaction type. Allowed value: ","[ TRANSFER,NEW_ORDER,ISSUE_TOKEN,BURN_TOKEN,LIST_TOKEN,CANCEL_ORDER,FREEZE_TOKEN,UN_FREEZE_TOKEN,TRANSFER,PROPOSAL,VOTE,MINT,DEPOSIT,CREATE_VALIDATOR,REMOVE_VALIDATOR,TIME_LOCK,TIME_UNLOCK,TIME_RELOCK,SET_ACCOUNT_FLAG,HTL_TRANSFER,CLAIM_HTL,DEPOSIT_HTL,REFUND_HTL]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#txpage"},"TxPage"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"403"),(0,r.kt)("td",{parentName:"tr",align:null},"Tx is not within 24h query window"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1transactions-in-blockblockheight"},"/api/v1/transactions-in-block/{blockHeight}"),(0,r.kt)("hr",null),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," This endpoint will be retired soon, use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/api-reference/dex-api/block-service.html#apiv1blocksblockheighttxs"},"this api")," instead (please read the migration guide)."),(0,r.kt)("h5",{id:"get-19"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get transactions in the specific block."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get transactions in the block. Multi-send and multi-coin transactions are flattened as transactions. This API is deprecated."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 15 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#blocktx"},"BlockTx"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request. The block to query is higher than current highest block."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv2transactions-in-blockblockheight"},"/api/v2/transactions-in-block/{blockHeight}"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Note:")," This endpoint will be retired soon, use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/api-reference/dex-api/block-service.html#apiv1blocksblockheighttxs"},"this api")," instead (please read the migration guide)."),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-20"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," transactions in Block"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get transactions in the block. Multi-send and multi-coin transactions are included as sub-transactions."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 1 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 15 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#blocktxv2"},"BlockTxV2"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request. The block to query is higher than current highest block."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1atomic-swaps"},"/api/v1/atomic-swaps"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-21"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," AtomicSwap"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get atomic swaps by address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 60 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time of blockTimestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddress"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"At least one of toAddress and fromAddress should be provided as parameter"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 25; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time of blockTimestamp in Milliseconds; The maximum start - end query window is 3 months; Default query window is the latest 30 days."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddress"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"At least one of toAddress and fromAddress should be provided as parameter"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#atomicswappage"},"AtomicSwapPage"))))),(0,r.kt)("h3",{id:"apiv1atomic-swapsid"},"/api/v1/atomic-swaps/{id}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-22"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," AtomicSwap"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get an AtomicSwap by swap id"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 request per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 60 request per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"swap id"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#atomicswap"},"AtomicSwap"))))),(0,r.kt)("h3",{id:"apiv1timelocksaddress"},"/api/v1/timelocks/{address}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-23"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Gets time lock records given an address"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the record id of timelock to query"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#timelocks"},"TimeLocks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"internal server error"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1timelockaccount_addridrecordid"},"/api/v1/timelock/{account_addr}?(id={recordid})"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-24"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get timelock records of an address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Get the timelock history of an address.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 60 requests per IP per minute."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"The account address to query"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the record id of timelock to query"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#timelocks"},"TimeLocks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"internal server error"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1minitokens"},"/api/v1/mini/tokens"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-25"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Gets a list of available mini tokens."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#minitokens"},"MiniTokens"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"500"),(0,r.kt)("td",{parentName:"tr",align:null},"internal server error"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1minimarkets"},"/api/v1/mini/markets"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-26"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Gets a list of mini market pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"Success"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#markets"},"Markets"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1miniklines"},"/api/v1/mini/klines"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-27"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get mini-token candlestick bars."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets candlestick/kline bars for a mini-token symbol pair. Bars are uniquely identified by their open time."),(0,r.kt)("p",null,"If the time window is larger than limits, only the first n klines will return. In this case, please either shrink the window or increase the limit to get proper amount of klines."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 10 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n 1499040000000, // Open time\n "0.01634790", // Open\n "0.80000000", // High\n "0.01575800", // Low\n "0.01577100", // Close\n "148976.11427815", // Volume\n 1499644799999, // Close time\n "2434.19055334", // Quote asset volume\n 308 // Number of trades\n]\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"interval"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"interval. Allowed value: ","[1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M]"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 300; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"startTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"endTime"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#candlestick"},"Candlestick")," ]")))),(0,r.kt)("h3",{id:"apiv1miniordersclosed"},"/api/v1/mini/orders/closed"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-28"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get closed orders of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets closed (filled and cancelled) orders for a given address."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order status list. Allowed value: ","[Ack, IocExpire, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching]"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"enum string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))))),(0,r.kt)("h3",{id:"apiv1miniordersopen"},"/api/v1/mini/orders/open"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-29"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get open orders of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets open orders for a given address.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the owner address"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#orderlist"},"OrderList"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1miniordersid"},"/api/v1/mini/orders/{id}"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-30"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get an order of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets metadata for an individual order by its ID.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"path"),(0,r.kt)("td",{parentName:"tr",align:null},"order id"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#order"},"Order"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1miniticker24hr"},"/api/v1/mini/ticker/24hr"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-31"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get a market ticker of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets 24 hour price change statistics for a market pair symbol. Updated every second.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tickerstatistics"},"TickerStatistics")," ]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"apiv1minitrades"},"/api/v1/mini/trades"),(0,r.kt)("hr",null),(0,r.kt)("h5",{id:"get-32"},(0,r.kt)("strong",{parentName:"h5"},(0,r.kt)("em",{parentName:"strong"},"GET"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Summary:")," Get market trades of mini-token pairs."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Description:")," Gets a list of historical trades.\n",(0,r.kt)("strong",{parentName:"p"},"Query Window:")," Default query window is latest 7 days; The maximum start - end query window is 3 months.\n",(0,r.kt)("strong",{parentName:"p"},"Rate Limit:")," 5 requests per IP per second."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Parameters")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Located in"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"the buyer/seller address"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"buyer order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"end"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"end time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"height"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"limit"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"default 500; max 1000."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"offset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start with 0; default 0."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"quote asset"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"seller order id"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"order side. 1 for buy and 2 for sell."),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"start"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"start time in Milliseconds"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"long")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"string")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"query"),(0,r.kt)("td",{parentName:"tr",align:null},"total number required, 0 for not required and 1 for required; default not required, return total=-1 in response"),(0,r.kt)("td",{parentName:"tr",align:null},"No"),(0,r.kt)("td",{parentName:"tr",align:null},"integer")))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Responses")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Code"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Schema"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"200"),(0,r.kt)("td",{parentName:"tr",align:null},"OK"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tradepage"},"TradePage"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"400"),(0,r.kt)("td",{parentName:"tr",align:null},"Bad Request"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"404"),(0,r.kt)("td",{parentName:"tr",align:null},"Not Found"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"default"),(0,r.kt)("td",{parentName:"tr",align:null},"Generic error response"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#error"},"Error"))))),(0,r.kt)("h3",{id:"models"},"Models"),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"error"},"Error"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"error code"),(0,r.kt)("td",{parentName:"tr",align:null},"400")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"message"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"error message"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"times"},"Times"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ap_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"event time"),(0,r.kt)("td",{parentName:"tr",align:null},"e.g. 2019-01-21T10:30:00Z")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"block_time"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"the time of latest block"),(0,r.kt)("td",{parentName:"tr",align:null},"e.g. 2019-01-21T10:30:00Z")))),(0,r.kt)("h3",{id:"validators"},"Validators"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"block_height"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"Current block height"),(0,r.kt)("td",{parentName:"tr",align:null},"12345")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"validators"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#validator"},"Validator")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"validator"},"Validator"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex address)"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"pub_key"),(0,r.kt)("td",{parentName:"tr",align:null},"[ integer ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Public key bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"voting_power"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"validator's voting power"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"accum"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"validator's accumulated voting power"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"peer"},"Peer"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Authenticated identifier"),(0,r.kt)("td",{parentName:"tr",align:null},"8c379d4d3b9995c712665dc9a9414dbde5b30483")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"original_listen_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Original listen address before PeersService changed it"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"listen_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Listen address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"access_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Access address (HTTP)"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"stream_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string (RemoteAddr)"),(0,r.kt)("td",{parentName:"tr",align:null},"Stream address (WS)"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"network"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Chain ID"),(0,r.kt)("td",{parentName:"tr",align:null},"Binance-Chain-Ganges")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"version"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Version"),(0,r.kt)("td",{parentName:"tr",align:null},"0.30.1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Moniker (Name)"),(0,r.kt)("td",{parentName:"tr",align:null},"data-seed-1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"capabilities"),(0,r.kt)("td",{parentName:"tr",align:null},"[ string ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Array of capability tags: node, qs, ap, ws"),(0,r.kt)("td",{parentName:"tr",align:null},"node,ap")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"accelerated"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null},"Is an accelerated path to a validator node"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"transaction"},"Transaction"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"hash"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex)"),(0,r.kt)("td",{parentName:"tr",align:null},"Hash of transaction, it returned as bytes before, and now it returns as hex string"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"log"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Log of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"data"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Data of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"height"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Height of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"Result code of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ok"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"object"),(0,r.kt)("td",{parentName:"tr",align:null},"Detail of transaction, like transaction type, messages and signature"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("p",null,"For example, below is the detail of a send transaction. Most of the fields are fixed, but the detail of msg\nvaries with msg type, if you query with --format=json."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "type": "auth/StdTx", // fixed, type of transaction\n "value": { // fixed, detail of the transaction\n "data": null, // fixed, data of the transaction\n "memo": "", // fixed, memo\n "msg": [ // fixed, msgs of the transaction\n {\n "type": "cosmos-sdk/Send", // vary with msg type\n "value": { // value content vary with mst type\n "inputs": [\n {\n "address": "bnb1vt4zwu5hy7tyryktud6mpcu8h2ehh6xw66gzwp",\n "coins": [\n {\n "amount": "100000000000000",\n "denom": "BNB"\n }\n ]\n }\n ],\n "outputs": [\n {\n "address": "bnb1kg8mh20tndur9d9rry4wjunhpfzcud30qzf0qv",\n "coins": [\n {\n "amount": "100000000000000",\n "denom": "BNB"\n }\n ]\n }\n ]\n }\n }\n ],\n "signatures": [ // fixed, signatures of the transaction\n {\n "account_number": "0",\n "pub_key": {\n "type": "tendermint/PubKeySecp256k1",\n "value": "AoWY3eWBOnnvLPTz4RsUlX1pWCkLLPewu1vAAoTEzxzR"\n },\n "sequence": "1",\n "signature": "6O2TQAgleFNPw4zIWBLaNvOf5dR7DHNSr2DwAPeFK6lokRqZd2KR2BD+WlmaWj4LdLo5N+utN1JtY41E91N0uw=="\n }\n ],\n "source": "0" // fixed, source of the transaction\n }\n}\n')),(0,r.kt)("p",null," | |"),(0,r.kt)("h3",{id:"account"},"Account"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"account_number"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string (address)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"balances"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#balance"},"Balance")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"public_key"),(0,r.kt)("td",{parentName:"tr",align:null},"[ integer ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Public key bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"sequence is for preventing replay attack"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"accountsequence"},"AccountSequence"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"number used for preventing replay attack"),(0,r.kt)("td",{parentName:"tr",align:null},"1")))),(0,r.kt)("h3",{id:"balance"},"Balance"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string (currency)"),(0,r.kt)("td",{parentName:"tr",align:null},"asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"free"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 0.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"locked"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 0.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"frozen"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 0.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")))),(0,r.kt)("h3",{id:"token"},"Token"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"token name"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB Chain Native Token")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"unique token trade symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"BTC-000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"original_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"token symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"BTC")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total_supply"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"total token supply in decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"owner"),(0,r.kt)("td",{parentName:"tr",align:null},"string (address)"),(0,r.kt)("td",{parentName:"tr",align:null},"Address which issue the token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"smart contract address for this token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_decimals"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"the token decimals"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"market"},"Market"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"base_asset_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string (currency)"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol of base asset"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quote_asset_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string (currency)"),(0,r.kt)("td",{parentName:"tr",align:null},"symbol of quote asset"),(0,r.kt)("td",{parentName:"tr",align:null},"ABC-5CA")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"list_price"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form"),(0,r.kt)("td",{parentName:"tr",align:null},"1.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tick_size"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimium price change in decimal form"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000001")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lot_size"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimium trading quantity in decimal form"),(0,r.kt)("td",{parentName:"tr",align:null},"1.00000000")))),(0,r.kt)("h3",{id:"fee"},"Fee"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"msg_type"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Transaction msg type that this fee applies to"),(0,r.kt)("td",{parentName:"tr",align:null},"submit_proposal")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"The fee amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_for"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 = proposer, 2 = all, 3 = free"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"multi_transfer_fee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Fee for multi-transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"200000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lower_limit_as_multi"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"e.g. 2"),(0,r.kt)("td",{parentName:"tr",align:null},"2")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fixed_fee_params"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#fixedfeeparams"},"FixedFeeParams")),(0,r.kt)("td",{parentName:"tr",align:null},"Set if the fee is fixed"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"dex_fee_fields"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#dexfeefieldparams"},"DexFeeFieldParams")),(0,r.kt)("td",{parentName:"tr",align:null},"dex fee"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"fixedfeeparams"},"FixedFeeParams"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"msg_type"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Transaction msg type that this fee applies to"),(0,r.kt)("td",{parentName:"tr",align:null},"submit_proposal")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"The fixed fee amount"),(0,r.kt)("td",{parentName:"tr",align:null},"1000000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_for"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 = proposer, 2 = all, 3 = free"),(0,r.kt)("td",{parentName:"tr",align:null},"1")))),(0,r.kt)("h3",{id:"dexfeefieldparams"},"DexFeeFieldParams"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"fee name"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee_value"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"fee value"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"marketdepth"},"MarketDepth"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"asks"),(0,r.kt)("td",{parentName:"tr",align:null},"[ string (fixed8) ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Price and qty in decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},'["1.00000000","800.00000000"]')),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bids"),(0,r.kt)("td",{parentName:"tr",align:null},"[ string (fixed8) ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Price and qty in decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},'["1.00000000","800.00000000"]')),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"pending_match"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null},"If new orders inserted in current block and the matching process has not started in the block, return true."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"candlestick"},"Candlestick"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"close"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"closing price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"closeTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"time of closing trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"high"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the highest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"low"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the lowest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"numberOfTrades"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"total trades"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"open"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"open price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"openTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"time of open trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAssetVolume"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the total trading volume in quote asset"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"volume"),(0,r.kt)("td",{parentName:"tr",align:null},"number"),(0,r.kt)("td",{parentName:"tr",align:null},"the total trading volume"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"orderlist"},"OrderList"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"order"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#order"},"Order")," ]"),(0,r.kt)("td",{parentName:"tr",align:null},"list of orders"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"order"},"Order"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"cumulateQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"total amount of trades that have made"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee on the latest updated block of this order. Multiple assets are split by semicolon."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastExecutedPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"price of last execution"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastExecutedQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"quantity of last execution"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderCreateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"time of order creation"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"owner"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order issuer"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"price"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"side"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 for buy and 2 for sell"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"enum ","[Ack, PartialFill, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching, IocExpire]"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading pair symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timeInForce"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"1 for Good Till Expire(GTE) order and 3 for Immediate Or Cancel (IOC)"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tradeId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"transactionHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"transactionTime"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"time of latest order update, for example, cancel, expire"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"type"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"only 2 is available for now, meaning limit order"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"subtx"},"SubTx"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"value"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"tickerstatistics"},"TickerStatistics"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"askPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"sell price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"askQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"sell quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bidPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"buy price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"bidQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"buy quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"closeTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"time of closing"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"count"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"total trade count"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"firstId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of first trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"highPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"highest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of last trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"last price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lastQuantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"last quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"lowPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"lowest price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"openPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"open price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"openTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"open time"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"prevClosePrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"last close price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"priceChange"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"change of price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"priceChangePercent"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"change of price in percentage"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteVolume"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading volume in quote asset"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"volume"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading volume"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"weightedAvgPrice"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"weighted average price"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"tradepage"},"TradePage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"total number of trades"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"trade"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#trade"},"Trade")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"trade"},"Trade"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"baseAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"base asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the buyer address on the block of this trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"id of buyer"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order id for buyer"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buySingleFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the buyer address on this single trade"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB:0.00000172;")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"buyerSource"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"tx source of buy order"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"price"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade price"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quantity"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade quantity"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"quoteAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"quote asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the seller address on the block of this trade"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"seller ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerOrderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"seller order ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellSingleFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trading fee for the seller address on this single trade"),(0,r.kt)("td",{parentName:"tr",align:null},"BNB:0.00000216;")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sellerSource"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"tx source of sell order"),(0,r.kt)("td",{parentName:"tr",align:null},"1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"asset symbol"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tickType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"enum ","[Unknown,SellTaker,BuyTaker,BuySurplus,SellSurplus,Neutral]"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"time"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"trade time"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tradeId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"trade ID"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blockexchangefeepage"},"BlockExchangeFeePage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockExchangeFee"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#blockexchangefee"},"BlockExchangeFee")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blockexchangefee"},"BlockExchangeFee"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"timestamp of a block"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"total fee collected. Multiple assets are split by semicolon."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tradeCount"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"trade count of the address on the block"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"txpage"},"TxPage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"total sum of transactions"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tx"},"Tx")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blocktx"},"BlockTx"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#tx"},"Tx")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"blocktxv2"},"BlockTxV2"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"tx"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#txv2"},"TxV2")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"tx"},"Tx"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"block height"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"transaction result code"),(0,r.kt)("td",{parentName:"tr",align:null},"0")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"confirmBlocks"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"data"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"from address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"order ID"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timeStamp"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null},"time of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"to address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAge"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"type of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"value"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"value of transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"source"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"swapId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"proposalId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"exchangerate"},"ExchangeRate"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ExchangeRate"),(0,r.kt)("td",{parentName:"tr",align:null},"object"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"resultstatus"},"ResultStatus"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"validator_info"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#validatorinfo"},"ValidatorInfo")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sync_info"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#syncinfo"},"SyncInfo")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"node_info"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#nodeinfo"},"NodeInfo")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"nodeinfo"},"NodeInfo"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Protocol_Version"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#protocolversion"},"ProtocolVersion")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ID"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"listen_addr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"network"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"version"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"channels"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"moniker"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"other"),(0,r.kt)("td",{parentName:"tr",align:null},"object"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"syncinfo"},"SyncInfo"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_block_hash"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_app_hash"),(0,r.kt)("td",{parentName:"tr",align:null},"string (hex)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_block_height"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"latest_block_time"),(0,r.kt)("td",{parentName:"tr",align:null},"time"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"catching_up"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"protocolversion"},"ProtocolVersion"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"P2P"),(0,r.kt)("td",{parentName:"tr",align:null},"integer (uint64)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"block"),(0,r.kt)("td",{parentName:"tr",align:null},"integer (uint64)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"app"),(0,r.kt)("td",{parentName:"tr",align:null},"integer (uint64)"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"validatorinfo"},"ValidatorInfo"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hex address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"pub_key"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"hex-encoded"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"voting_power"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"atomicswappage"},"AtomicSwapPage"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"atomicSwaps"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#atomicswap"},"AtomicSwap")," ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"atomicswap"},"AtomicSwap"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockTimestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp of block in which the swap is initiated. The unit is millisecond."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"closedTime"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossChain"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"expectedIncome"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"expireHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"inAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"outAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumber"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipientOtherChain"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"status"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"swapId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"string (int64)"),(0,r.kt)("td",{parentName:"tr",align:null},"The timestamp for randomNumberHash calculation, randomNumberHash=sha256(randomNumber, timestamp). The unit is second."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"txv2"},"TxV2"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"blockHeight"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"code"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"0")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"data"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"fromAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"memo"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"orderId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is NEW_ORDER"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"proposalId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is PROPOSAL"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sequence"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"source"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"subTransactions"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ",(0,r.kt)("a",{parentName:"td",href:"#subtx"},"SubTx")," ]"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction has sub-transactions, such as multi-send transaction or a transaction have multiple assets"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"swapId"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"Optional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"timeStamp"),(0,r.kt)("td",{parentName:"tr",align:null},"dateTime"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"toAddr"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txAsset"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txFee"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"txType"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"value"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"timelocks"},"TimeLocks"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"id"),(0,r.kt)("td",{parentName:"tr",align:null},"long"),(0,r.kt)("td",{parentName:"tr",align:null},"The record id of the timelock transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"description"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"The description of the timelock transaction"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"amount"),(0,r.kt)("td",{parentName:"tr",align:null},"[ ]"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"locktime"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"The available unlock time"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"minitokens"},"MiniTokens"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"name"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"BNB Chain Mini Token")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"BTC-000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"original_symbol"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"BTC")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"total_supply"),(0,r.kt)("td",{parentName:"tr",align:null},"string (fixed8)"),(0,r.kt)("td",{parentName:"tr",align:null},"In decimal form, e.g. 1.00000000"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00000000")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"token_type"),(0,r.kt)("td",{parentName:"tr",align:null},"integer"),(0,r.kt)("td",{parentName:"tr",align:null},"Type of the mini token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"owner"),(0,r.kt)("td",{parentName:"tr",align:null},"string (address)"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"mintable"),(0,r.kt)("td",{parentName:"tr",align:null},"boolean"),(0,r.kt)("td",{parentName:"tr",align:null},"mintable"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"token_uri"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"URI for token description"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_address"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"smart contract address for this token"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"contract_decimals"),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"the token decimals"),(0,r.kt)("td",{parentName:"tr",align:null})))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/53ba04fa.2bb84c7d.js b/assets/js/53ba04fa.59cffb9a.js similarity index 90% rename from assets/js/53ba04fa.2bb84c7d.js rename to assets/js/53ba04fa.59cffb9a.js index a559324320..cd0f5f7275 100644 --- a/assets/js/53ba04fa.2bb84c7d.js +++ b/assets/js/53ba04fa.59cffb9a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[542],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);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=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=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},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u="mdxType",h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),d=r,m=u["".concat(l,".").concat(d)]||u[d]||h[d]||o;return n?a.createElement(m,s(s({ref:t},p),{},{components:n})):a.createElement(m,s({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[u]="string"==typeof e?e:r,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>h,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(83117),r=(n(67294),n(3905));const o={},s="BNB Beacon Chain Testnet",i={unversionedId:"beaconchain/develop/testnetandexplorer",id:"beaconchain/develop/testnetandexplorer",title:"BNB Beacon Chain Testnet",description:"What is a Testnet?",source:"@site/docs/beaconchain/develop/testnetandexplorer.md",sourceDirName:"beaconchain/develop",slug:"/beaconchain/develop/testnetandexplorer",permalink:"/docs/beaconchain/develop/testnetandexplorer",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/develop/testnetandexplorer.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"BNB Beacon Chain SDK",permalink:"/docs/beaconchain/develop/bcsdk"},next:{title:"Light Client",permalink:"/docs/beaconchain/light-client"}},l={},c=[{value:"What is a Testnet?",id:"what-is-a-testnet",level:3},{value:"What is the Testnet good for?",id:"what-is-the-testnet-good-for",level:3},{value:"How to get Testnet Fund?",id:"how-to-get-testnet-fund",level:3},{value:"Explorers for Testnet",id:"explorers-for-testnet",level:3}],p={toc:c},u="wrapper";function h(e){let{components:t,...n}=e;return(0,r.kt)(u,(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-testnet"},"BNB Beacon Chain Testnet"),(0,r.kt)("h3",{id:"what-is-a-testnet"},"What is a Testnet?"),(0,r.kt)("p",null,"The testnet is a test environment for BNB Chain network, run by the BNB Chain development community, which is open to developers."),(0,r.kt)("p",null,"The validators on the testnet are from development team."),(0,r.kt)("p",null,"You can connect a node to the testnet by downloading the node binary and testnet configuration from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"https://github.com/bnb-chain/node/releases"),"."),(0,r.kt)("h3",{id:"what-is-the-testnet-good-for"},"What is the Testnet good for?"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Create your test address and get your testnet funds."),(0,r.kt)("li",{parentName:"ul"},"Develop applications and try tutorials on BNB Chain without the potential to lose your own assets."),(0,r.kt)("li",{parentName:"ul"},"Test your applications against new versions of BNB Chain."),(0,r.kt)("li",{parentName:"ul"},"Analyze blockchain data on a smaller, non-trivial data set compared to the public network.")),(0,r.kt)("h3",{id:"how-to-get-testnet-fund"},"How to get Testnet Fund?"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: The previous BNB Chain Testnet ",(0,r.kt)("a",{parentName:"p",href:"https://www.binance.com/en/dex/testnet/address"},"Faucet")," is retired at 2020/08/11 at 1:00 PM (UTC). The testnet faucet has migrated to this page: ",(0,r.kt)("a",{parentName:"p",href:"https://testnet.binance.org/faucet-smart"},"https://testnet.binance.org/faucet-smart"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Steps to claim testnet BNB:")),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Create a new Wallet of BNB Smart Chain testnet with ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/docs/Wallet#supported-wallets"},"Trust Wallet or Binance Extension Wallet"))),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Get Testnet Fund: ",(0,r.kt)("a",{parentName:"p",href:"https://testnet.binance.org/faucet-smart"},"https://testnet.binance.org/faucet-smart"))),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Transfer From BNB Smart Chain to BNB Beacon Chain"))),(0,r.kt)("p",null,"You can use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/docs/binance#transfer-testnet-bnb-from-bsc-to-bc"},"Binance Extension Wallet")," for cross-chain transfer."),(0,r.kt)("h3",{id:"explorers-for-testnet"},"Explorers for Testnet"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"BNB Smart Chain Explorer - ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/"},"https://testnet.bscscan.com/")),(0,r.kt)("li",{parentName:"ul"},"BNB Beacon Chain Explorer - ",(0,r.kt)("a",{parentName:"li",href:"https://testnet-explorer.binance.org/"},"https://testnet-explorer.binance.org/"))))}h.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[542],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);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=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=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},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},h="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),h=c(n),d=r,m=h["".concat(l,".").concat(d)]||h[d]||u[d]||o;return n?a.createElement(m,s(s({ref:t},p),{},{components:n})):a.createElement(m,s({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i[h]="string"==typeof e?e:r,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var a=n(83117),r=(n(67294),n(3905));const o={},s="BNB Beacon Chain Testnet",i={unversionedId:"beaconchain/develop/testnetandexplorer",id:"beaconchain/develop/testnetandexplorer",title:"BNB Beacon Chain Testnet",description:"What is a Testnet?",source:"@site/docs/beaconchain/develop/testnetandexplorer.md",sourceDirName:"beaconchain/develop",slug:"/beaconchain/develop/testnetandexplorer",permalink:"/docs/beaconchain/develop/testnetandexplorer",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/develop/testnetandexplorer.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"BNB Beacon Chain SDK",permalink:"/docs/beaconchain/develop/bcsdk"},next:{title:"Light Client",permalink:"/docs/beaconchain/light-client"}},l={},c=[{value:"What is a Testnet?",id:"what-is-a-testnet",level:3},{value:"What is the Testnet good for?",id:"what-is-the-testnet-good-for",level:3},{value:"How to get Testnet Fund?",id:"how-to-get-testnet-fund",level:3},{value:"Explorers for Testnet",id:"explorers-for-testnet",level:3}],p={toc:c},h="wrapper";function u(e){let{components:t,...n}=e;return(0,r.kt)(h,(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-testnet"},"BNB Beacon Chain Testnet"),(0,r.kt)("h3",{id:"what-is-a-testnet"},"What is a Testnet?"),(0,r.kt)("p",null,"The testnet is a test environment for BNB Chain network, run by the BNB Chain development community, which is open to developers."),(0,r.kt)("p",null,"The validators on the testnet are from development team."),(0,r.kt)("p",null,"You can connect a node to the testnet by downloading the node binary and testnet configuration from ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node/releases"},"https://github.com/bnb-chain/node/releases"),"."),(0,r.kt)("h3",{id:"what-is-the-testnet-good-for"},"What is the Testnet good for?"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Create your test address and get your testnet funds."),(0,r.kt)("li",{parentName:"ul"},"Develop applications and try tutorials on BNB Chain without the potential to lose your own assets."),(0,r.kt)("li",{parentName:"ul"},"Test your applications against new versions of BNB Chain."),(0,r.kt)("li",{parentName:"ul"},"Analyze blockchain data on a smaller, non-trivial data set compared to the public network.")),(0,r.kt)("h3",{id:"how-to-get-testnet-fund"},"How to get Testnet Fund?"),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: The previous BNB Chain Testnet ",(0,r.kt)("a",{parentName:"p",href:"https://www.binance.com/en/dex/testnet/address"},"Faucet")," is retired at 2020/08/11 at 1:00 PM (UTC). The testnet faucet has migrated to this page: ",(0,r.kt)("a",{parentName:"p",href:"https://testnet.binance.org/faucet-smart"},"https://testnet.binance.org/faucet-smart"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Steps to claim testnet BNB:")),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Create a new Wallet of BNB Smart Chain testnet with ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/docs/Wallet#supported-wallets"},"Trust Wallet or Binance Extension Wallet"))),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Get Testnet Fund: ",(0,r.kt)("a",{parentName:"p",href:"https://testnet.binance.org/faucet-smart"},"https://testnet.binance.org/faucet-smart"))),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Transfer From BNB Smart Chain to BNB Beacon Chain"))),(0,r.kt)("p",null,"You can use ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/docs/binance#transfer-testnet-bnb-from-bsc-to-bc"},"Binance Extension Wallet")," for cross-chain transfer."),(0,r.kt)("h3",{id:"explorers-for-testnet"},"Explorers for Testnet"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"BNB Smart Chain Explorer - ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/"},"https://testnet.bscscan.com/")),(0,r.kt)("li",{parentName:"ul"},"BNB Beacon Chain Explorer - ",(0,r.kt)("a",{parentName:"li",href:"https://testnet-explorer.bnbchain.org/"},"https://testnet-explorer.bnbchain.org/"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f00e493.52bc563c.js b/assets/js/5f00e493.52bc563c.js new file mode 100644 index 0000000000..47dcabc294 --- /dev/null +++ b/assets/js/5f00e493.52bc563c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[5478],{3905:(e,t,a)=>{a.d(t,{Zo:()=>h,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},h=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,h=l(e,["components","mdxType","originalType","parentName"]),p=c(a),u=r,m=p["".concat(s,".").concat(u)]||p[u]||d[u]||i;return a?n.createElement(m,o(o({ref:t},h),{},{components:a})):n.createElement(m,o({ref:t},h))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[p]="string"==typeof e?e:r,o[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=a(83117),r=(a(67294),a(3905));const i={},o="BNB Beacon Chain Documentation",l={unversionedId:"beaconchain/index",id:"beaconchain/index",title:"BNB Beacon Chain Documentation",description:"Welcome to the BNB Beacon Chain documentation site!",source:"@site/docs/beaconchain/index.md",sourceDirName:"beaconchain",slug:"/beaconchain/",permalink:"/docs/beaconchain/",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/index.md",tags:[],version:"current",frontMatter:{}},s={},c=[{value:"What are BNB Beacon Chain and Binance DEX?",id:"what-are-bnb-beacon-chain-and-binance-dex",level:2},{value:"What is BNB Smart Chain?",id:"what-is-bnb-smart-chain",level:2},{value:"What can I do with BNB Beacon Chain ?",id:"what-can-i-do-with-bnb-beacon-chain-",level:2},{value:"What can I do with BNB Smart Chain ?",id:"what-can-i-do-with-bnb-smart-chain-",level:2},{value:"Comparision Between BC and BSC",id:"comparision-between-bc-and-bsc",level:2},{value:"Get Started",id:"get-started",level:2},{value:"Asset Management",id:"asset-management",level:2},{value:"BEP2 Asset",id:"bep2-asset",level:3},{value:"BEP20 Asset",id:"bep20-asset",level:3},{value:"BNB (and Other Coins) MainNet Switch",id:"bnb-and-other-coins-mainnet-switch",level:2},{value:"BNB Staking",id:"bnb-staking",level:2},{value:"Trading on Binance DEX",id:"trading-on-binance-dex",level:2},{value:"Technology Details",id:"technology-details",level:2},{value:"Acknowledgement",id:"acknowledgement",level:2}],h={toc:c},p="wrapper";function d(e){let{components:t,...a}=e;return(0,r.kt)(p,(0,n.Z)({},h,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-documentation"},"BNB Beacon Chain Documentation"),(0,r.kt)("p",null,"Welcome to the BNB Beacon Chain documentation site!"),(0,r.kt)("p",null,"Please note that both the BNB Beacon Chain software and this documentation site will improve over time and is still a work-in-progress.",(0,r.kt)("br",null),"\nBe sure to engage with our community channels to stay updated."),(0,r.kt)("p",null,"Have fun trading and see you on chain!"),(0,r.kt)("h2",{id:"what-are-bnb-beacon-chain-and-binance-dex"},"What are BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://www.bnbchain.org"},"BNB Beacon Chain")," is a blockchain software system developed by its community.\nBinance DEX refers to the decentralized exchange features developed on top of BNB Beacon Chain."),(0,r.kt)("p",null,"Please read the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/faq/"},"FAQ")," to get started."),(0,r.kt)("h2",{id:"what-is-bnb-smart-chain"},"What is BNB Smart Chain?"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://www.bnbchain.org/en/smartChain"},"BNB Smart Chain")," is an innovative solution to bring programmability and interoperability to BNB Beacon Chain . BNB Smart Chain relies on a system of ",(0,r.kt)("a",{parentName:"p",href:"https://https://github.com/bnb-chain/whitepaper/blob/master/WHITEPAPER.md"},"41 validators with Proof of Staked Authority (PoSA)")," consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality."),(0,r.kt)("p",null,"Please read the ",(0,r.kt)("a",{parentName:"p",href:"/docs/BSC-FAQs-general"},"FAQ")," to get started."),(0,r.kt)("h2",{id:"what-can-i-do-with-bnb-beacon-chain-"},"What can I do with BNB Beacon Chain ?"),(0,r.kt)("p",null,"The purpose of the new blockchain and DEX is to create an alternative marketplace for issuing and exchanging digital assets in a decentralized manner."),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/transfer#web-wallet"},"Send and receive BNB")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://community.binance.org/topic/2487"},"Issue new tokens to digitalize assets"),", and use BNB Beacon Chain as underlying exchange/transfer\nnetwork for the assets"),(0,r.kt)("li",{parentName:"ul"},"Send, receive, ",(0,r.kt)("a",{parentName:"li",href:"/docs/tokens#burn"},"burn"),"/",(0,r.kt)("a",{parentName:"li",href:"/docs/tokens#mint"},"mint")," and ",(0,r.kt)("a",{parentName:"li",href:"/docs/tokens#freeze-unfreeze"},"freeze/unfreeze")," tokens"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/learn/bsc-gov"},"Sumbit an on-chain governance proposal for BNB Smart Chain "))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For traders"),", you can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/list_instruction"},"Propose to create trading pairs")," between two different tokens"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/learn/trading-interface"},"Send orders")," to buy or sell assets through trading pairs created on the chain with",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/exchange-integration#sdks"},"SDK")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1markets"},"Watch the DEX market")," to confirm price and market activity of certain assets")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For developers"),", you can also:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Explore the transaction history and blocks on the chain, via ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org"},"BNB Beacon Chain Explore"),", ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/dex-api/paths"},"API"),"\nand ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/node-rpc"},"node RPC")," interfaces."),(0,r.kt)("li",{parentName:"ul"},"Run a ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/fullnode"},"full node")," to listen to and broadcast live updates on transactions, blocks, and consensus activities"),(0,r.kt)("li",{parentName:"ul"},"Extract other data of BNB Beacon Chain via full node or ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1markets"},"APIs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/exchange-integration#sdks"},"Develop tools")," and application to help users use BNB Beacon Chain and Binance DEX")),(0,r.kt)("h2",{id:"what-can-i-do-with-bnb-smart-chain-"},"What can I do with BNB Smart Chain ?"),(0,r.kt)("p",null,"BNB Smart Chain (BSC) is best described as a blockchain that runs in parallel to the BNB Beacon Chain . Unlike BNB Beacon Chain , BSC boasts smart contract functionality and compatibility with the Ethereum Virtual Machine (EVM). The design goal here was to leave the high throughput of BNB Beacon Chain intact while introducing smart contracts into its ecosystem."),(0,r.kt)("p",null,"Because BSC is EVM-compatible, it launched with support for the rich universe of ",(0,r.kt)("a",{parentName:"p",href:"https://academy.binance.com/en/articles/what-is-ethereum"},"Ethereum")," tools and DApps. In theory, this makes it easy for developers to port their projects over from Ethereum. For users, it means that applications like ",(0,r.kt)("a",{parentName:"p",href:"/docs/wallet/metamask"},"MetaMask")," can be easily configured to work with BSC. Seriously \u2013 it\u2019s just a matter of tweaking a couple of settings. Check out ",(0,r.kt)("a",{parentName:"p",href:"/docs/wallet/metamask"},"Use MetaMask for BNB Smart Chain ")," to get started."),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Send and receive ",(0,r.kt)("a",{parentName:"li",href:"https://docs.bnbchain.org/docs/binance#transfer-testnet-bnb-from-bsc-to-bc"},"BNB")," and other ",(0,r.kt)("a",{parentName:"li",href:"https://docs.bnbchain.org/docs/binance#swap-testnet-bep2-token-to-its-bep20-equivalent"},"BEP2 tokens")," cross-chain"),(0,r.kt)("li",{parentName:"ul"},"Explore the transaction history and blocks on the chain, via ",(0,r.kt)("a",{parentName:"li",href:"https://bscscan.com"},"bscscan"),", API\nand node RPC interfaces."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/wallet/staking"},"Stake you BNB")," to earn some block rewards")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Developers")," can also:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/issue-BEP20"},"Issue")," new tokens to digitalize assets"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bsc-develop-ecosystem"},"Migrate")," existing DApps"),(0,r.kt)("li",{parentName:"ul"},"Run a ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/fullnode"},"full node")," to listen to and broadcast live updates on transactions, blocks, and consensus activities"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/wallet/wallet_api"},"Develop wallets")," and tools to help users use Dapps")),(0,r.kt)("h2",{id:"comparision-between-bc-and-bsc"},"Comparision Between BC and BSC"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null}),(0,r.kt)("th",{parentName:"tr",align:null},"BNB Beacon Chain"),(0,r.kt)("th",{parentName:"tr",align:null},"BNB Smart Chain"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Consensus"),(0,r.kt)("td",{parentName:"tr",align:null},"DPoS"),(0,r.kt)("td",{parentName:"tr",align:null},"PoSA")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"No. of Validators"),(0,r.kt)("td",{parentName:"tr",align:null},"11"),(0,r.kt)("td",{parentName:"tr",align:null},"up to 50")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mean Block Time"),(0,r.kt)("td",{parentName:"tr",align:null},"<1s"),(0,r.kt)("td",{parentName:"tr",align:null},"~5s")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Programmability"),(0,r.kt)("td",{parentName:"tr",align:null},"BEPs"),(0,r.kt)("td",{parentName:"tr",align:null},"Support EVM-compatible smart contracts")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross Chain"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3")," introduces ",(0,r.kt)("em",{parentName:"td"},"Hash Timer Locked Contract functions")," and further ",(0,r.kt)("a",{parentName:"td",href:"https://community.binance.org/topic/1892"},"mechanism")," to handle inter-blockchain tokens peg."),(0,r.kt)("td",{parentName:"tr",align:null},"BSC comes with efficient ",(0,r.kt)("a",{parentName:"td",href:"/docs/learn/cross-chain"},"native dual chain communication"),"; Optimized for scaling high-performance dApps that require fast and smooth user experience.")))),(0,r.kt)("h2",{id:"get-started"},"Get Started"),(0,r.kt)("p",null,"Want to try it ",(0,r.kt)("strong",{parentName:"p"},"BNB Beacon Chain "),"? Just give a peek at the first few of pages of the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/get-started"},"getting started guide"),".",(0,r.kt)("br",null),"\nYou could also have a read through the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/faq/"},"FAQ"),"."),(0,r.kt)("p",null,"Want to develop on ",(0,r.kt)("strong",{parentName:"p"},"BNB Smart Chain "),"? First, read through the ",(0,r.kt)("a",{parentName:"p",href:"/docs/BSC-FAQs-general"},"FAQ")," and learn about tokens ",(0,r.kt)("a",{parentName:"p",href:"/docs/BEP20"},"here"),"."),(0,r.kt)("h2",{id:"asset-management"},"Asset Management"),(0,r.kt)("h3",{id:"bep2-asset"},"BEP2 Asset"),(0,r.kt)("p",null,"BNB Beacon Chain is essentially a digital asset creation and exchange platform.",(0,r.kt)("br",null),"\nThe features listed below are currently supported on BNB Beacon Chain :"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/tokens"},"The Issuance, Burning, Minting and Freezing of Tokens")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/transfer"},"Transfer of Tokens"))),(0,r.kt)("h3",{id:"bep20-asset"},"BEP20 Asset"),(0,r.kt)("p",null,"A token protocol on BSC which is compatible with BEP2 and ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20"),". It extends ERC20 and contains more interfaces, such as ",(0,r.kt)("inlineCode",{parentName:"p"},"getOwner")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"decimals"),". Read the full proposal here: ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP20.md"},"https://github.com/bnb-chain/BEPs/blob/master/BEP20.md")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/issue-BEP20"},"Issue BEP20")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/Wallet"},"Wallet"))),(0,r.kt)("h2",{id:"bnb-and-other-coins-mainnet-switch"},"BNB (and Other Coins) MainNet Switch"),(0,r.kt)("p",null,"Build N Build Coin (BNB) was an ERC20 token on the Ethereum network. After the launch of BNB Beacon Chain, Build N Build Coin (BNB) is being converted into native BNB tokens on the main network via the exchange platform at ",(0,r.kt)("a",{parentName:"p",href:"https://www.binance.com"},"binance.com"),", a pragmatic and efficient way to perform the initial token swap."),(0,r.kt)("p",null,"BNB Beacon Chain is ready for other projects to migrate their tokens to take advantage of performant transactions with more liquidity options and native marketplace features.",(0,r.kt)("br",null),"\nMore information about how projects can set themselves up for this (via ",(0,r.kt)("a",{parentName:"p",href:"https://www.binance.com"},"binance.com")," or partners) will come soon."),(0,r.kt)("h2",{id:"bnb-staking"},"BNB Staking"),(0,r.kt)("p",null,"Please read the guide ",(0,r.kt)("a",{parentName:"p",href:"/docs/wallet/staking"},"here")),(0,r.kt)("h2",{id:"trading-on-binance-dex"},"Trading on Binance DEX"),(0,r.kt)("p",null,"Binance DEX is the native marketplace on BNB Beacon Chain , allowing you to exchange digital assets issued and listed on it.",(0,r.kt)("br",null),"\nThe matching happens within the blockchain nodes and all of the transactions are recorded on-chain, therefore forming a complete, auditable ledger of activity."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ATTENTION"),": The match logic on DEX is quite different from normal centralized exchange.",(0,r.kt)("br",null),"\nPlease go over the trading and match spec below to get the best interests for your orders."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/trading-spec"},"Trading Spec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/match"},"Match Logic")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/anti-frontrun"},"Anti-front-running"))),(0,r.kt)("h2",{id:"technology-details"},"Technology Details"),(0,r.kt)("p",null,"Continue reading below if you are interested in what is happening under the hood!"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/blockchain"},"BNB Beacon Chain as a Block Chain"),": about consensus, software stack, network layout and roles."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/chain-access"},"Connect to BNB Beacon Chain "),": how to connect to BNB Beacon Chain and DEX via different ways."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/fullnode"},"Run a BNB Beacon Chain full node"),": how to run a full node and become part of the p2p network of BNB Beacon Chain ."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/light-client"},"Run a BNB Beacon Chain light client"),": how to run a light client."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/governance"},"BNB Beacon Chain Governance"),": about proposal, vote, and join as a validator.")),(0,r.kt)("h2",{id:"acknowledgement"},"Acknowledgement"),(0,r.kt)("p",null,"Thanks to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/acknowledgement"},"community, our partners and supporters"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f00e493.9e578c00.js b/assets/js/5f00e493.9e578c00.js deleted file mode 100644 index 0da271cdd5..0000000000 --- a/assets/js/5f00e493.9e578c00.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[5478],{3905:(e,t,a)=>{a.d(t,{Zo:()=>h,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),c=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},h=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,h=l(e,["components","mdxType","originalType","parentName"]),p=c(a),u=r,m=p["".concat(s,".").concat(u)]||p[u]||d[u]||i;return a?n.createElement(m,o(o({ref:t},h),{},{components:a})):n.createElement(m,o({ref:t},h))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,o=new Array(i);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[p]="string"==typeof e?e:r,o[1]=l;for(var c=2;c{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=a(83117),r=(a(67294),a(3905));const i={},o="BNB Beacon Chain Documentation",l={unversionedId:"beaconchain/index",id:"beaconchain/index",title:"BNB Beacon Chain Documentation",description:"Welcome to the BNB Beacon Chain documentation site!",source:"@site/docs/beaconchain/index.md",sourceDirName:"beaconchain",slug:"/beaconchain/",permalink:"/docs/beaconchain/",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/index.md",tags:[],version:"current",frontMatter:{}},s={},c=[{value:"What are BNB Beacon Chain and Binance DEX?",id:"what-are-bnb-beacon-chain-and-binance-dex",level:2},{value:"What is BNB Smart Chain?",id:"what-is-bnb-smart-chain",level:2},{value:"What can I do with BNB Beacon Chain ?",id:"what-can-i-do-with-bnb-beacon-chain-",level:2},{value:"What can I do with BNB Smart Chain ?",id:"what-can-i-do-with-bnb-smart-chain-",level:2},{value:"Comparision Between BC and BSC",id:"comparision-between-bc-and-bsc",level:2},{value:"Get Started",id:"get-started",level:2},{value:"Asset Management",id:"asset-management",level:2},{value:"BEP2 Asset",id:"bep2-asset",level:3},{value:"BEP20 Asset",id:"bep20-asset",level:3},{value:"BNB (and Other Coins) MainNet Switch",id:"bnb-and-other-coins-mainnet-switch",level:2},{value:"BNB Staking",id:"bnb-staking",level:2},{value:"Trading on Binance DEX",id:"trading-on-binance-dex",level:2},{value:"Technology Details",id:"technology-details",level:2},{value:"Acknowledgement",id:"acknowledgement",level:2}],h={toc:c},p="wrapper";function d(e){let{components:t,...a}=e;return(0,r.kt)(p,(0,n.Z)({},h,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-documentation"},"BNB Beacon Chain Documentation"),(0,r.kt)("p",null,"Welcome to the BNB Beacon Chain documentation site!"),(0,r.kt)("p",null,"Please note that both the BNB Beacon Chain software and this documentation site will improve over time and is still a work-in-progress.",(0,r.kt)("br",null),"\nBe sure to engage with our community channels to stay updated."),(0,r.kt)("p",null,"Have fun trading and see you on chain!"),(0,r.kt)("h2",{id:"what-are-bnb-beacon-chain-and-binance-dex"},"What are BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://www.bnbchain.org"},"BNB Beacon Chain")," is a blockchain software system developed by its community.\nBinance DEX refers to the decentralized exchange features developed on top of BNB Beacon Chain."),(0,r.kt)("p",null,"Please read the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/faq/"},"FAQ")," to get started."),(0,r.kt)("h2",{id:"what-is-bnb-smart-chain"},"What is BNB Smart Chain?"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://www.bnbchain.org/en/smartChain"},"BNB Smart Chain")," is an innovative solution to bring programmability and interoperability to BNB Beacon Chain . BNB Smart Chain relies on a system of ",(0,r.kt)("a",{parentName:"p",href:"https://https://github.com/bnb-chain/whitepaper/blob/master/WHITEPAPER.md"},"41 validators with Proof of Staked Authority (PoSA)")," consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality."),(0,r.kt)("p",null,"Please read the ",(0,r.kt)("a",{parentName:"p",href:"/docs/BSC-FAQs-general"},"FAQ")," to get started."),(0,r.kt)("h2",{id:"what-can-i-do-with-bnb-beacon-chain-"},"What can I do with BNB Beacon Chain ?"),(0,r.kt)("p",null,"The purpose of the new blockchain and DEX is to create an alternative marketplace for issuing and exchanging digital assets in a decentralized manner."),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/transfer#web-wallet"},"Send and receive BNB")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://community.binance.org/topic/2487"},"Issue new tokens to digitalize assets"),", and use BNB Beacon Chain as underlying exchange/transfer\nnetwork for the assets"),(0,r.kt)("li",{parentName:"ul"},"Send, receive, ",(0,r.kt)("a",{parentName:"li",href:"/docs/tokens#burn"},"burn"),"/",(0,r.kt)("a",{parentName:"li",href:"/docs/tokens#mint"},"mint")," and ",(0,r.kt)("a",{parentName:"li",href:"/docs/tokens#freeze-unfreeze"},"freeze/unfreeze")," tokens"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/learn/bsc-gov"},"Sumbit an on-chain governance proposal for BNB Smart Chain "))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For traders"),", you can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/list_instruction"},"Propose to create trading pairs")," between two different tokens"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/learn/trading-interface"},"Send orders")," to buy or sell assets through trading pairs created on the chain with",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/exchange-integration#sdks"},"SDK")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1markets"},"Watch the DEX market")," to confirm price and market activity of certain assets")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"For developers"),", you can also:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Explore the transaction history and blocks on the chain, via ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org"},"BNB Beacon Chain Explore"),", ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/dex-api/paths"},"API"),"\nand ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/node-rpc"},"node RPC")," interfaces."),(0,r.kt)("li",{parentName:"ul"},"Run a ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/fullnode"},"full node")," to listen to and broadcast live updates on transactions, blocks, and consensus activities"),(0,r.kt)("li",{parentName:"ul"},"Extract other data of BNB Beacon Chain via full node or ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1markets"},"APIs")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/exchange-integration#sdks"},"Develop tools")," and application to help users use BNB Beacon Chain and Binance DEX")),(0,r.kt)("h2",{id:"what-can-i-do-with-bnb-smart-chain-"},"What can I do with BNB Smart Chain ?"),(0,r.kt)("p",null,"BNB Smart Chain (BSC) is best described as a blockchain that runs in parallel to the BNB Beacon Chain . Unlike BNB Beacon Chain , BSC boasts smart contract functionality and compatibility with the Ethereum Virtual Machine (EVM). The design goal here was to leave the high throughput of BNB Beacon Chain intact while introducing smart contracts into its ecosystem."),(0,r.kt)("p",null,"Because BSC is EVM-compatible, it launched with support for the rich universe of ",(0,r.kt)("a",{parentName:"p",href:"https://academy.binance.com/en/articles/what-is-ethereum"},"Ethereum")," tools and DApps. In theory, this makes it easy for developers to port their projects over from Ethereum. For users, it means that applications like ",(0,r.kt)("a",{parentName:"p",href:"/docs/wallet/metamask"},"MetaMask")," can be easily configured to work with BSC. Seriously \u2013 it\u2019s just a matter of tweaking a couple of settings. Check out ",(0,r.kt)("a",{parentName:"p",href:"/docs/wallet/metamask"},"Use MetaMask for BNB Smart Chain ")," to get started."),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Send and receive ",(0,r.kt)("a",{parentName:"li",href:"https://docs.bnbchain.org/docs/binance#transfer-testnet-bnb-from-bsc-to-bc"},"BNB")," and other ",(0,r.kt)("a",{parentName:"li",href:"https://docs.bnbchain.org/docs/binance#swap-testnet-bep2-token-to-its-bep20-equivalent"},"BEP2 tokens")," cross-chain"),(0,r.kt)("li",{parentName:"ul"},"Explore the transaction history and blocks on the chain, via ",(0,r.kt)("a",{parentName:"li",href:"https://bscscan.com"},"bscscan"),", API\nand node RPC interfaces."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/wallet/staking"},"Stake you BNB")," to earn some block rewards")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Developers")," can also:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/issue-BEP20"},"Issue")," new tokens to digitalize assets"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bsc-develop-ecosystem"},"Migrate")," existing DApps"),(0,r.kt)("li",{parentName:"ul"},"Run a ",(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/fullnode"},"full node")," to listen to and broadcast live updates on transactions, blocks, and consensus activities"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/wallet/wallet_api"},"Develop wallets")," and tools to help users use Dapps")),(0,r.kt)("h2",{id:"comparision-between-bc-and-bsc"},"Comparision Between BC and BSC"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null}),(0,r.kt)("th",{parentName:"tr",align:null},"BNB Beacon Chain"),(0,r.kt)("th",{parentName:"tr",align:null},"BNB Smart Chain"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Consensus"),(0,r.kt)("td",{parentName:"tr",align:null},"DPoS"),(0,r.kt)("td",{parentName:"tr",align:null},"PoSA")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"No. of Validators"),(0,r.kt)("td",{parentName:"tr",align:null},"11"),(0,r.kt)("td",{parentName:"tr",align:null},"up to 50")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mean Block Time"),(0,r.kt)("td",{parentName:"tr",align:null},"<1s"),(0,r.kt)("td",{parentName:"tr",align:null},"~5s")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Programmability"),(0,r.kt)("td",{parentName:"tr",align:null},"BEPs"),(0,r.kt)("td",{parentName:"tr",align:null},"Support EVM-compatible smart contracts")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross Chain"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3")," introduces ",(0,r.kt)("em",{parentName:"td"},"Hash Timer Locked Contract functions")," and further ",(0,r.kt)("a",{parentName:"td",href:"https://community.binance.org/topic/1892"},"mechanism")," to handle inter-blockchain tokens peg."),(0,r.kt)("td",{parentName:"tr",align:null},"BSC comes with efficient ",(0,r.kt)("a",{parentName:"td",href:"/docs/learn/cross-chain"},"native dual chain communication"),"; Optimized for scaling high-performance dApps that require fast and smooth user experience.")))),(0,r.kt)("h2",{id:"get-started"},"Get Started"),(0,r.kt)("p",null,"Want to try it ",(0,r.kt)("strong",{parentName:"p"},"BNB Beacon Chain "),"? Just give a peek at the first few of pages of the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/get-started"},"getting started guide"),".",(0,r.kt)("br",null),"\nYou could also have a read through the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/faq/"},"FAQ"),"."),(0,r.kt)("p",null,"Want to develop on ",(0,r.kt)("strong",{parentName:"p"},"BNB Smart Chain "),"? First, read through the ",(0,r.kt)("a",{parentName:"p",href:"/docs/BSC-FAQs-general"},"FAQ")," and learn about tokens ",(0,r.kt)("a",{parentName:"p",href:"/docs/BEP20"},"here"),"."),(0,r.kt)("h2",{id:"asset-management"},"Asset Management"),(0,r.kt)("h3",{id:"bep2-asset"},"BEP2 Asset"),(0,r.kt)("p",null,"BNB Beacon Chain is essentially a digital asset creation and exchange platform.",(0,r.kt)("br",null),"\nThe features listed below are currently supported on BNB Beacon Chain :"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/tokens"},"The Issuance, Burning, Minting and Freezing of Tokens")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/transfer"},"Transfer of Tokens"))),(0,r.kt)("h3",{id:"bep20-asset"},"BEP20 Asset"),(0,r.kt)("p",null,"A token protocol on BSC which is compatible with BEP2 and ",(0,r.kt)("a",{parentName:"p",href:"https://eips.ethereum.org/EIPS/eip-20"},"ERC20"),". It extends ERC20 and contains more interfaces, such as ",(0,r.kt)("inlineCode",{parentName:"p"},"getOwner")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"decimals"),". Read the full proposal here: ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP20.md"},"https://github.com/bnb-chain/BEPs/blob/master/BEP20.md")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/issue-BEP20"},"Issue BEP20")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/Wallet"},"Wallet"))),(0,r.kt)("h2",{id:"bnb-and-other-coins-mainnet-switch"},"BNB (and Other Coins) MainNet Switch"),(0,r.kt)("p",null,"Build N Build Coin (BNB) was an ERC20 token on the Ethereum network. After the launch of BNB Beacon Chain, Build N Build Coin (BNB) is being converted into native BNB tokens on the main network via the exchange platform at ",(0,r.kt)("a",{parentName:"p",href:"https://www.binance.com"},"binance.com"),", a pragmatic and efficient way to perform the initial token swap."),(0,r.kt)("p",null,"BNB Beacon Chain is ready for other projects to migrate their tokens to take advantage of performant transactions with more liquidity options and native marketplace features.",(0,r.kt)("br",null),"\nMore information about how projects can set themselves up for this (via ",(0,r.kt)("a",{parentName:"p",href:"https://www.binance.com"},"binance.com")," or partners) will come soon."),(0,r.kt)("h2",{id:"bnb-staking"},"BNB Staking"),(0,r.kt)("p",null,"Please read the guide ",(0,r.kt)("a",{parentName:"p",href:"/docs/wallet/staking"},"here")),(0,r.kt)("h2",{id:"trading-on-binance-dex"},"Trading on Binance DEX"),(0,r.kt)("p",null,"Binance DEX is the native marketplace on BNB Beacon Chain , allowing you to exchange digital assets issued and listed on it.",(0,r.kt)("br",null),"\nThe matching happens within the blockchain nodes and all of the transactions are recorded on-chain, therefore forming a complete, auditable ledger of activity."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ATTENTION"),": The match logic on DEX is quite different from normal centralized exchange.",(0,r.kt)("br",null),"\nPlease go over the trading and match spec below to get the best interests for your orders."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/trading-spec"},"Trading Spec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/match"},"Match Logic")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/anti-frontrun"},"Anti-front-running"))),(0,r.kt)("h2",{id:"technology-details"},"Technology Details"),(0,r.kt)("p",null,"Continue reading below if you are interested in what is happening under the hood!"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/blockchain"},"BNB Beacon Chain as a Block Chain"),": about consensus, software stack, network layout and roles."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/chain-access"},"Connect to BNB Beacon Chain "),": how to connect to BNB Beacon Chain and DEX via different ways."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/fullnode"},"Run a BNB Beacon Chain full node"),": how to run a full node and become part of the p2p network of BNB Beacon Chain ."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/light-client"},"Run a BNB Beacon Chain light client"),": how to run a light client."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/beaconchain/governance"},"BNB Beacon Chain Governance"),": about proposal, vote, and join as a validator.")),(0,r.kt)("h2",{id:"acknowledgement"},"Acknowledgement"),(0,r.kt)("p",null,"Thanks to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/acknowledgement"},"community, our partners and supporters"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/674b291d.a98a011c.js b/assets/js/674b291d.5b88d5f4.js similarity index 98% rename from assets/js/674b291d.a98a011c.js rename to assets/js/674b291d.5b88d5f4.js index 34b663152e..f58756387e 100644 --- a/assets/js/674b291d.a98a011c.js +++ b/assets/js/674b291d.5b88d5f4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[6212],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>b});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),u=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=u(e.components);return a.createElement(c.Provider,{value:n},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=u(t),f=r,b=d["".concat(c,".").concat(f)]||d[f]||p[f]||o;return t?a.createElement(b,i(i({ref:n},l),{},{components:t})):a.createElement(b,i({ref:n},l))}));function b(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s[d]="string"==typeof e?e:r,i[1]=s;for(var u=2;u{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var a=t(83117),r=(t(67294),t(3905));const o={},i="Offline",s={unversionedId:"beaconchain/offline",id:"beaconchain/offline",title:"Offline",description:"bnbcli support generating and signing all types of transactions offline, then broadcast them. This feature will let users generate and sign their transactions at an offline machine, then use another machine to broadcast it to the network",source:"@site/docs/beaconchain/offline.md",sourceDirName:"beaconchain",slug:"/beaconchain/offline",permalink:"/docs/beaconchain/offline",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/offline.md",tags:[],version:"current",frontMatter:{}},c={},u=[{value:"Generate your unsigned transaction",id:"generate-your-unsigned-transaction",level:2},{value:"Sign your transaction",id:"sign-your-transaction",level:2},{value:"Broadcast Your Transaction",id:"broadcast-your-transaction",level:2}],l={toc:u},d="wrapper";function p(e){let{components:n,...t}=e;return(0,r.kt)(d,(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"offline"},"Offline"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," support generating and signing all types of transactions offline, then broadcast them. This feature will let users generate and sign their transactions at an offline machine, then use another machine to broadcast it to the network"),(0,r.kt)("h2",{id:"generate-your-unsigned-transaction"},"Generate your unsigned transaction"),(0,r.kt)("p",null,"First step is that you need to generate your unsigned transaction and save it in a file."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: ",(0,r.kt)("inlineCode",{parentName:"p"},"--account-number")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"--node")," is not mandatory in unsigned command")),(0,r.kt)("p",null,"You can generate an unsigned transfer transaction on testnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli send --from --account-number --to --amount 200000000:BNB --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --generate-only --offline >> unsigned.json\n")),(0,r.kt)("p",null,"You can generate an unsigned transfer transaction on mainnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./bnbcli send --from --account-number --to --amount 200000000:BNB --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --generate-only --offline >> unsigned.json\n")),(0,r.kt)("p",null,"Then, you can see that the signature of unsigned.json is empty."),(0,r.kt)("h2",{id:"sign-your-transaction"},"Sign your transaction"),(0,r.kt)("p",null,"You can view the unsigned.json to verify that all the info about this transaction is correct. You need to get the account-number and sequence about your address here: ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1accountaddress"},"https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1accountaddress")),(0,r.kt)("p",null,"You can sign an unsigned transfer transaction on testnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name >> signed.json\n")),(0,r.kt)("p",null,"You can sign an unsigned transfer transaction on mainnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./bnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name >> signed.json\n")),(0,r.kt)("p",null,"You need to type in your password in this step"),(0,r.kt)("p",null,"Then, you can see that the signature of signed.json is no longer empty."),(0,r.kt)("h2",{id:"broadcast-your-transaction"},"Broadcast Your Transaction"),(0,r.kt)("p",null,"Please then copy your signed.json to a different server and broadcast this transaction."),(0,r.kt)("p",null,"You can broadcast your transaction on testnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli broadcast signed.json --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"You can broadcast your transaction on mainnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./bnbcli broadcast signed.json --node https://dataseed5.defibit.io:443\n")),(0,r.kt)("p",null,"You can find the list of nodes ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/develop/api-reference/cli#where-to-connect"},"here")),(0,r.kt)("p",null,"If the broadcast is successful, you will see the transaction hash in returned info. Please go and verify it in ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org"},"Explorer"),"."))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[6212],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>b});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=a.createContext({}),u=function(e){var n=a.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=u(e.components);return a.createElement(c.Provider,{value:n},e.children)},d="mdxType",p={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},f=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=u(t),f=r,b=d["".concat(c,".").concat(f)]||d[f]||p[f]||o;return t?a.createElement(b,i(i({ref:n},l),{},{components:t})):a.createElement(b,i({ref:n},l))}));function b(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s[d]="string"==typeof e?e:r,i[1]=s;for(var u=2;u{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var a=t(83117),r=(t(67294),t(3905));const o={},i="Offline",s={unversionedId:"beaconchain/offline",id:"beaconchain/offline",title:"Offline",description:"bnbcli support generating and signing all types of transactions offline, then broadcast them. This feature will let users generate and sign their transactions at an offline machine, then use another machine to broadcast it to the network",source:"@site/docs/beaconchain/offline.md",sourceDirName:"beaconchain",slug:"/beaconchain/offline",permalink:"/docs/beaconchain/offline",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/offline.md",tags:[],version:"current",frontMatter:{}},c={},u=[{value:"Generate your unsigned transaction",id:"generate-your-unsigned-transaction",level:2},{value:"Sign your transaction",id:"sign-your-transaction",level:2},{value:"Broadcast Your Transaction",id:"broadcast-your-transaction",level:2}],l={toc:u},d="wrapper";function p(e){let{components:n,...t}=e;return(0,r.kt)(d,(0,a.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"offline"},"Offline"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"bnbcli")," support generating and signing all types of transactions offline, then broadcast them. This feature will let users generate and sign their transactions at an offline machine, then use another machine to broadcast it to the network"),(0,r.kt)("h2",{id:"generate-your-unsigned-transaction"},"Generate your unsigned transaction"),(0,r.kt)("p",null,"First step is that you need to generate your unsigned transaction and save it in a file."),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: ",(0,r.kt)("inlineCode",{parentName:"p"},"--account-number")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"--node")," is not mandatory in unsigned command")),(0,r.kt)("p",null,"You can generate an unsigned transfer transaction on testnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli send --from --account-number --to --amount 200000000:BNB --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --generate-only --offline >> unsigned.json\n")),(0,r.kt)("p",null,"You can generate an unsigned transfer transaction on mainnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./bnbcli send --from --account-number --to --amount 200000000:BNB --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --generate-only --offline >> unsigned.json\n")),(0,r.kt)("p",null,"Then, you can see that the signature of unsigned.json is empty."),(0,r.kt)("h2",{id:"sign-your-transaction"},"Sign your transaction"),(0,r.kt)("p",null,"You can view the unsigned.json to verify that all the info about this transaction is correct. You need to get the account-number and sequence about your address here: ",(0,r.kt)("a",{parentName:"p",href:"https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1accountaddress"},"https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1accountaddress")),(0,r.kt)("p",null,"You can sign an unsigned transfer transaction on testnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Ganges --offline --name >> signed.json\n")),(0,r.kt)("p",null,"You can sign an unsigned transfer transaction on mainnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./bnbcli sign unsigned.json --account-number --sequence --chain-id Binance-Chain-Tigris --offline --name >> signed.json\n")),(0,r.kt)("p",null,"You need to type in your password in this step"),(0,r.kt)("p",null,"Then, you can see that the signature of signed.json is no longer empty."),(0,r.kt)("h2",{id:"broadcast-your-transaction"},"Broadcast Your Transaction"),(0,r.kt)("p",null,"Please then copy your signed.json to a different server and broadcast this transaction."),(0,r.kt)("p",null,"You can broadcast your transaction on testnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli broadcast signed.json --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"You can broadcast your transaction on mainnet:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./bnbcli broadcast signed.json --node https://dataseed5.defibit.io:443\n")),(0,r.kt)("p",null,"You can find the list of nodes ",(0,r.kt)("a",{parentName:"p",href:"/docs/beaconchain/develop/api-reference/cli#where-to-connect"},"here")),(0,r.kt)("p",null,"If the broadcast is successful, you will see the transaction hash in returned info. Please go and verify it in ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org"},"Explorer"),"."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/675ae01b.c821f21e.js b/assets/js/675ae01b.c821f21e.js new file mode 100644 index 0000000000..88675a24bb --- /dev/null +++ b/assets/js/675ae01b.c821f21e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[6588],{3905:(t,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>k});var a=n(67294);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function r(t){for(var e=1;e=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var s=a.createContext({}),c=function(t){var e=a.useContext(s),n=e;return t&&(n="function"==typeof t?t(e):r(r({},e),t)),n},u=function(t){var e=c(t.components);return a.createElement(s.Provider,{value:e},t.children)},p="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},h=a.forwardRef((function(t,e){var n=t.components,o=t.mdxType,l=t.originalType,s=t.parentName,u=i(t,["components","mdxType","originalType","parentName"]),p=c(n),h=o,k=p["".concat(s,".").concat(h)]||p[h]||m[h]||l;return n?a.createElement(k,r(r({ref:e},u),{},{components:n})):a.createElement(k,r({ref:e},u))}));function k(t,e){var n=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var l=n.length,r=new Array(l);r[0]=h;var i={};for(var s in e)hasOwnProperty.call(e,s)&&(i[s]=e[s]);i.originalType=t,i[p]="string"==typeof t?t:o,r[1]=i;for(var c=2;c{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>r,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var a=n(83117),o=(n(67294),n(3905));const l={sidebar_label:"How to Use",sidebar_position:2,hide_table_of_contents:!1},r="Using Binance Extension Wallet",i={unversionedId:"binance",id:"binance",title:"Using Binance Extension Wallet",description:"What is it?",source:"@site/docs/binance.md",sourceDirName:".",slug:"/binance",permalink:"/docs/binance",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/binance.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_label:"How to Use",sidebar_position:2,hide_table_of_contents:!1},sidebar:"bscSideBar",previous:{title:"Wallet Key Management",permalink:"/docs/create-wallet"},next:{title:"Manually Install Binance Extension Wallet",permalink:"/docs/manual"}},s={},c=[{value:"What is it?",id:"what-is-it",level:2},{value:"Download Link",id:"download-link",level:2},{value:"Install",id:"install",level:2},{value:"Create an account in extension wallet for BNB Smart Chain",id:"create-an-account-in-extension-wallet-for-bnb-smart-chain",level:2},{value:"Recover your account with Mnemonic Phrase",id:"recover-your-account-with-mnemonic-phrase",level:2},{value:"Get Testnet BNB from Faucet",id:"get-testnet-bnb-from-faucet",level:2},{value:"Transfer Testnet BNB from BSC to BC",id:"transfer-testnet-bnb-from-bsc-to-bc",level:2},{value:"Transfer Testnet BNB from BC to BSC",id:"transfer-testnet-bnb-from-bc-to-bsc",level:2},{value:"Swap Testnet BEP2 token to its BEP20 equivalent",id:"swap-testnet-bep2-token-to-its-bep20-equivalent",level:2},{value:"Swap Testnet BEP20 token to its BEP2 equivalent",id:"swap-testnet-bep20-token-to-its-bep2-equivalent",level:2}],u={toc:c},p="wrapper";function m(t){let{components:e,...n}=t;return(0,o.kt)(p,(0,a.Z)({},u,n,{components:e,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"using-binance-extension-wallet"},"Using Binance Extension Wallet"),(0,o.kt)("h2",{id:"what-is-it"},"What is it?"),(0,o.kt)("p",null,"Binance Extension Wallet is a Crypto Wallet for BNB Beacon Chain and BNB Smart Chain. You can send and receive funds on both BNB Beacon Chain and BNB Smart Chain as well as perform cross-chain transfers between both of BNB Chain\u2019s blockchains."),(0,o.kt)("p",null,'In the future, Binance Extension Wallet will add support for Ethereum blockchain and enable access for distributed applications, or "Dapps" in your browser!'),(0,o.kt)("p",null,"It\u2019s supported in Firefox and Chrome browsers."),(0,o.kt)("p",null,"!!! Tip\nFirefox users are more likely to access the latest version timely"),(0,o.kt)("h2",{id:"download-link"},"Download Link"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp"},"Chrome App Store")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"Firefox App Store Link"))),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/docs/manual"},"How to manually install the Binance Extension Wallet")),(0,o.kt)("h2",{id:"install"},"Install"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example: Install BNB Chain Wallet in Firefox browser")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"Open Extension in Firefox:")," ",(0,o.kt)("a",{parentName:"p",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"Search for BNB Chain Wallet")))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/ks5BM5SBqrjbDWdbGhsKymWvuLIJina_JZ4lo_j-skzhnFXvF8laumgJpl8nCv7XC_2Z6bwOhrt7v-oHLXv-eHNLlfY_9qSiQWyiyWuDlN8XKfc329MgTiyUpq9D8K562nH_zdkS",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Note:"))," ",(0,o.kt)("em",{parentName:"p"},"Make sure it\u2019s offered by BNB Chain")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201c",(0,o.kt)("strong",{parentName:"li"},"Add to Firefox"),"\u201d")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh4.googleusercontent.com/BxNDhV2jxT9B7D8cbS7Fh8XY1TVeh_45Sm18xn_sBCTSUGtQzFI086TBS61QHXquLxmikpSpILOAlpE-azn9EWgdwU0kraW1VrCbjqXK8liCylFw_IBfyW40yOk5aNCX34oRi_sX",alt:"img"})),(0,o.kt)("p",null,"That\u2019s it! You have successfully installed the BNB Chain Wallet extension in Firefox!"),(0,o.kt)("p",null,"The workflow is the same for all browsers"),(0,o.kt)("h2",{id:"create-an-account-in-extension-wallet-for-bnb-smart-chain"},"Create an account in extension wallet for BNB Smart Chain"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201c",(0,o.kt)("strong",{parentName:"li"},"I do not own a wallet"),"\u201d")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/qmWsS5xLoF-qpk_3IBeE21vkt20lM0Ew7Wen_TGdgANw-2WEEvfNEqCibw2sUlt9YMS-m7A5iebwpXP40LlJwkXb8vOv8D8BGQcghn7E4CvHOjib1b4NQjaMRHLHit6hH6YVE9cc",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Choose your own Password")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Note: it has to be a strong password")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh4.googleusercontent.com/sYV31JuMNYBK1OoqNwaxp3wRovbeLfkFtRle0_cfBeJMb1vyL3wKRKnp8420PZZKS0PLQrs89w6RJtUYCa3z1UAzZDSvf1FQT5bTOJaFowuYOHCuCNauQ41v8yk9dKlsuwkOssed",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Click on \u201c",(0,o.kt)("strong",{parentName:"p"},"Continue"),"\u201d")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Backup your recovery phrase"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/n2FtIpBGm0rfQC1WHDUbL44LhT6VVizzV4uBhzOkFCblCIXFdOISvy-OzCF5rEeU6q0suuW8Z6noqgYWW5_u8AU7mjat3ayEzU031SLjULoFSh0pdQOO_spRwGfqBEbSl8TIVOfa",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Congratulations! you have created your account!"))),(0,o.kt)("h2",{id:"recover-your-account-with-mnemonic-phrase"},"Recover your account with Mnemonic Phrase"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install BNB Chain extension by following the previous steps"),(0,o.kt)("li",{parentName:"ul"},"firstClick on \u201cI own a wallet\u201d")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/WvqszPDj6yhnt4KhB9VNHQrpR3C4lcIvOnBvZE4BslWsl0fmFbjM0f8dcK1sBFPI8OSt-8RGbk7X7pEdbci7P4RCl0rOoN4_5ce-qbfXj0BnGjSj160oDZ4ObvhljeTn8c4hZmnm",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Type your recovery phrase and choose a strong password")),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/VQbiCEcUSQyyHxcP0rR1FodhZcYBqaXMRpYsFy11NCJFzbtgpdewW6FCoazF1f7KiGaqMnOhL2LoEFvep5HXsJrh7VXjFuu6Qo3s1kI_3feKbOfudQS8q1GjfWSJJygTSsxGmBx5",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201c",(0,o.kt)("strong",{parentName:"li"},"Get started"),"\u201d")),(0,o.kt)("p",null,"Now you are all set!"),(0,o.kt)("h2",{id:"get-testnet-bnb-from-faucet"},"Get Testnet BNB from Faucet"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Go to ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.binance.org/faucet-smart/"},"https://testnet.binance.org/faucet-smart/"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/Q1uDI7LH2lZXvew9selrT5NzL7wKKPtvEnQlPB4mEZW46xb-fphq_Azi9EouvzYKx3IudqwppX6Pai2oFzGlyuJrOvLYlPnZySl2AmHPhpBMeIgEag4sdK_QkycMB826O95tqNQv",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain Testnet after unlock your extension wallet")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/RolgUaF7n1Gxh8FV7_oUqJ4Fgx0cjRob9LPn4jMMS9yGrbZ15ssPo1rsrPpavy8VVooM0Rqr3dDh00Om5C3OvMN-D2s4nhBub6dIJBhtuod6ZCQ0j8fWFGZ0WUOQQXBDOScaap98",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Copy your address")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/4h1Wh2lAYXDOe2j6pxqK97jAmY_RtDr2Uzosc4ZabwcGkRIHC_sbY2wO3MhZu-7mHel5XBIOFeDkjpPVmrJ3z7WNKKFQE73mO4ugIHhQm-AQa6TCV8rgtzoj81HL_Gg7PVFZscIY",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Paste your address in the box and click on \u201cGive me BNB\u201d"),(0,o.kt)("li",{parentName:"ul"},"Click on the \u201c+\u201d and add \u201cBNB\u201d token")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/5NuQ64U7VodRM815S-2EEElre-ox0CMWuKpTHeXfbI5R7kYwUO_nSqoyrcRukrZf5fR5HsZD9E2ZGggMPcvlewNpmFSNelT26gXkuoQdN6W9Xl69ofvCbrsNB38ivKFBZamQAUgN",alt:"img"})),(0,o.kt)("p",null,"After the transfer transaction is sent, you will see an increase in your balance"),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/RTAOcHcPxUIthhOLlHHJ1_wrFnvmZvbZ4DJUvpNR453E4mnWWRjHLBEABMTZZdSQGYMktX5eXJPOIt7iEijMsbmMJBEL29RAShDBD8ZRIDiCnXpfwi741DM7-XiDDyJO4uiLHyNL",alt:"img"})),(0,o.kt)("h2",{id:"transfer-testnet-bnb-from-bsc-to-bc"},"Transfer Testnet BNB from BSC to BC"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Beacon Chain testnet and copy your address after unlock your extension wallet, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"tbnb1"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/K5w_Mbk4rT9Az6eIY130MHaj_ZCicU4Tp3w93z40dtrGdzwFCMZ5qAfwytI5PY_TdztTPrK5WPAf1uHM5ej-1YdEWu7GtVgghRBub1KSf0e63tgi1L-4MkwPBG3pG0SDYHfMpt_J",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Click on the \u201c+\u201d and add \u201cBNB\u201d token")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Switch to BNB Smart Chain testnet and click on \u201cSend\u201d"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/nD5EwfFWmqRuHK21u5D5bcVg2MkXHa-OrAX-rhGMKQQmEGxgLLh57-zVdx4WnAYIUbCjAYaStt0PYt-gthrHK_hsWW0jAh34xOT2maf1skY3Dvy0-vAlaAjred96UihBabkglDMZ",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201cSend\u201d when you have filled in other information. You have to confirm it too")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/zPPVgR5I9s6cQPYfDbBU9E5Ddr5VtBhWt7iyHHE7IUEvaa5sTIMEA79VEGD-DHJJyrnJO-28m3QiVxrmSh82oCFnfjA63lpk-M1mQsdQ3aeTUskla0u8bpDNI3J0oLOFYa5Ahbr4",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch back to BNB Chain Testnet to confirm this cross-chain transfer")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/4PMk41qA7tXxRes-0Oc12A28U_W7JZHQAlJ9WW5njdGcozY8njSVEuPeZzTRt1xfRpiXPUZiea6ES74DQyjnyZNzjPw9NJhL_QNXvSMPich2o54MlbXVgoMJHaMx66xVpqm-2XAu",alt:"img"})),(0,o.kt)("h2",{id:"transfer-testnet-bnb-from-bc-to-bsc"},"Transfer Testnet BNB from BC to BSC"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet after unlock your extension wallet and copy your address, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"0x"))),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/kidAixmzNbNt_ujj0BQqZdZ4ZBXdEkxJLSVIOsWnWxZGOeXUJBjhxYsLlxH6VSQWxNX-dzqBFhqXSW3zmshkL99QYcVxIFGxw6tF7xF9ffXZPMPKnXlt0sWCKvPV6RMJWHSx1H0O",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Click on the \u201c+\u201d and add \u201cBNB\u201d token")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Switch to BNB Chain testnet and click on \u201cSend\u201d"))),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/JuCCpF4-U2FBHIZEIcwf7DNsCBA_RavVtmSX1dRe-thAL3FSm__Maf27aVkEIxaCQ28hl17NEYthBKyAWLJT72NMZ0Lkxzt7AIcVEuej2KDaKzT6ElR-wv_DTy1ip6MKfQk0-U7-",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201cSend\u201d when you have filled in other information. You have to confirm it too")),(0,o.kt)("img",{src:"https://lh4.googleusercontent.com/Ab98BfFApDok7qZdHAerglPc-vEYAKdEa2K-04CBdNfaQy8fE2CiJ_1sRjophAqsAt8p9c3CxA5IAGuhnPjJuZqotCq8zPRUkoEpB2tQir1nneBopVGNSNKlzq4wRVmSrfuQEZFw",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch back to BNB Smart Chain Testnet to confirm this cross-chain transfer")),(0,o.kt)("h2",{id:"swap-testnet-bep2-token-to-its-bep20-equivalent"},"Swap Testnet BEP2 token to its BEP20 equivalent"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to Install Binance Extension Wallet if not ready"),(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to create or Recover your account"),(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Chain testnet after unlock your extension wallet and Click at \u201c+\u201d to add your BEP2 token if necessary")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/P9NrmUZF4yC0_G_KgSuqCtLq3Q0GLw6ZBfyYwBn6f6HFqTxOcER2wChJJtZvAkF8QsEJz9AxN6Ixi2oqlJEHKsig-KTz3qUIAi8Kt7TfhyPalMMzO7Yh3btfyVLMm9MNCcA1bXYL",style:{zoom:"50%"}}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Verify your balance has enough BNB to pay transfer fee")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet and copy your address, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"0x"))),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/kidAixmzNbNt_ujj0BQqZdZ4ZBXdEkxJLSVIOsWnWxZGOeXUJBjhxYsLlxH6VSQWxNX-dzqBFhqXSW3zmshkL99QYcVxIFGxw6tF7xF9ffXZPMPKnXlt0sWCKvPV6RMJWHSx1H0O",style:{zoom:"50%"}}),(0,o.kt)("p",null,"Click at \u201c+\u201d to add your BEP20 token if necessary"),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/fW06aH1A5_7P93r8zSp4kgs5Us1AqYHvnfs6sRxg6aCLsQ7u9Ht_z6zLSExGjbr6J-D0vOmDWXghw544WhaNnkTP-nDAO3TFou5g_WYVvp7nOSrNX7w15PmvmZLyHkhBzLW_i-xi",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Chain testnet and click on \u201cSend\u201d")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/OHYhS0DdJsg6Jt_E-qRrPOxgDi_VMwXlRYVD8OVTrr1w5kwubse2boOfffWpl8PjP15j_h0atYB4O1GEQqNGCFzoKcoRSgmdMgAYQPazoe_I7X6gilZazMqqIGntSz9rz6j47DGk",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201cSend\u201d when you have filled in other information. You have to confirm it too")),(0,o.kt)("img",{src:"https://lh6.googleusercontent.com/gcaynPouCk8R0cRFo10i6tXUp8yVO3N1MB9ihJvo-NmO0i8PWae1Vz83O5i8cAIbuoZ1PIO_8de6PrxtUA3mix3FdxWZePH4KZt4_-Uwr64CZWyJog5d1iYcNgwHp_RumNOGc7B4",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet, you should see your BEP20 token balance change")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/ThOnhoHRzITPpIqfYOj6_Q0NHGSmVXMqmJ11SPjcvVqEzHZ6vcWpxyb9jILtnJ9GxAFDz527jCapq64-8N8l_aqMU1phv2MoAmTIKb1Nse7NjzhFRhdiyObk1mZBb7YQbq7ZkqTV",style:{zoom:"50%"}}),(0,o.kt)("h2",{id:"swap-testnet-bep20-token-to-its-bep2-equivalent"},"Swap Testnet BEP20 token to its BEP2 equivalent"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to Install Binance Extension Wallet if not ready"),(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to create or Recover your account"),(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet and Click at \u201c+\u201d to add your BEP20 token if necessary")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/fW06aH1A5_7P93r8zSp4kgs5Us1AqYHvnfs6sRxg6aCLsQ7u9Ht_z6zLSExGjbr6J-D0vOmDWXghw544WhaNnkTP-nDAO3TFou5g_WYVvp7nOSrNX7w15PmvmZLyHkhBzLW_i-xi",style:{zoom:"50%"}}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Verify your balance has enough BNB to pay transfer fee")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Chain testnet and copy your address, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"tbnb1"))),(0,o.kt)("p",null,"Note: for mainnet, the address starts with ",(0,o.kt)("inlineCode",{parentName:"p"},"bnb1")),(0,o.kt)("img",{src:"https://lh4.googleusercontent.com/kJnKr2dRtAvvMjjQIaMMq3JN9-ljqXjTaLq00u66UgisISIayIUsv1N01GjCbk9Z07WQUruToHX6pCb_dnYGDeP2NKTLbScnFFC317voNd6RTV-MDHAfMHorm8VCMyPKIK8YAEwS",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click at \u201c+\u201d to add your BEP2 token if necessary")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/P9NrmUZF4yC0_G_KgSuqCtLq3Q0GLw6ZBfyYwBn6f6HFqTxOcER2wChJJtZvAkF8QsEJz9AxN6Ixi2oqlJEHKsig-KTz3qUIAi8Kt7TfhyPalMMzO7Yh3btfyVLMm9MNCcA1bXYL",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet and click on \u201cSend\u201d")),(0,o.kt)("img",{src:"https://lh6.googleusercontent.com/m-lXjzWHuiVteM0n0ukSmMCxHm7XSQtO8wJ0LMXMUYL6spDObSmgbN7zoBVuc0hrhBL2mQ1C3GhBvzHpnHYoP_mbOcKSYtZZojQ46R5-2QA_ULXMPlmHyqXcg1Ht_M8Ix0xdUxJb",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Confirm your transaction and verify your balance change")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/675ae01b.eecc4183.js b/assets/js/675ae01b.eecc4183.js deleted file mode 100644 index a13f41bb89..0000000000 --- a/assets/js/675ae01b.eecc4183.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[6588],{3905:(t,e,n)=>{n.d(e,{Zo:()=>u,kt:()=>k});var a=n(67294);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function r(t){for(var e=1;e=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var s=a.createContext({}),c=function(t){var e=a.useContext(s),n=e;return t&&(n="function"==typeof t?t(e):r(r({},e),t)),n},u=function(t){var e=c(t.components);return a.createElement(s.Provider,{value:e},t.children)},p="mdxType",m={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},h=a.forwardRef((function(t,e){var n=t.components,o=t.mdxType,l=t.originalType,s=t.parentName,u=i(t,["components","mdxType","originalType","parentName"]),p=c(n),h=o,k=p["".concat(s,".").concat(h)]||p[h]||m[h]||l;return n?a.createElement(k,r(r({ref:e},u),{},{components:n})):a.createElement(k,r({ref:e},u))}));function k(t,e){var n=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var l=n.length,r=new Array(l);r[0]=h;var i={};for(var s in e)hasOwnProperty.call(e,s)&&(i[s]=e[s]);i.originalType=t,i[p]="string"==typeof t?t:o,r[1]=i;for(var c=2;c{n.r(e),n.d(e,{assets:()=>s,contentTitle:()=>r,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var a=n(83117),o=(n(67294),n(3905));const l={sidebar_label:"How to Use",sidebar_position:2,hide_table_of_contents:!1},r="Using Binance Extension Wallet",i={unversionedId:"binance",id:"binance",title:"Using Binance Extension Wallet",description:"What is it?",source:"@site/docs/binance.md",sourceDirName:".",slug:"/binance",permalink:"/docs/binance",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/binance.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_label:"How to Use",sidebar_position:2,hide_table_of_contents:!1},sidebar:"bscSideBar",previous:{title:"Wallet Key Management",permalink:"/docs/create-wallet"},next:{title:"Manually Install Binance Extension Wallet",permalink:"/docs/manual"}},s={},c=[{value:"What is it?",id:"what-is-it",level:2},{value:"Download Link",id:"download-link",level:2},{value:"Install",id:"install",level:2},{value:"Create an account in extension wallet for BNB Smart Chain",id:"create-an-account-in-extension-wallet-for-bnb-smart-chain",level:2},{value:"Recover your account with Mnemonic Phrase",id:"recover-your-account-with-mnemonic-phrase",level:2},{value:"Get Testnet BNB from Faucet",id:"get-testnet-bnb-from-faucet",level:2},{value:"Transfer Testnet BNB from BSC to BC",id:"transfer-testnet-bnb-from-bsc-to-bc",level:2},{value:"Transfer Testnet BNB from BC to BSC",id:"transfer-testnet-bnb-from-bc-to-bsc",level:2},{value:"Swap Testnet BEP2 token to its BEP20 equivalent",id:"swap-testnet-bep2-token-to-its-bep20-equivalent",level:2},{value:"Swap Testnet BEP20 token to its BEP2 equivalent",id:"swap-testnet-bep20-token-to-its-bep2-equivalent",level:2}],u={toc:c},p="wrapper";function m(t){let{components:e,...n}=t;return(0,o.kt)(p,(0,a.Z)({},u,n,{components:e,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"using-binance-extension-wallet"},"Using Binance Extension Wallet"),(0,o.kt)("h2",{id:"what-is-it"},"What is it?"),(0,o.kt)("p",null,"Binance Extension Wallet is a Crypto Wallet for BNB Beacon Chain and BNB Smart Chain. You can send and receive funds on both BNB Beacon Chain and BNB Smart Chain as well as perform cross-chain transfers between both of BNB Chain\u2019s blockchains."),(0,o.kt)("p",null,'In the future, Binance Extension Wallet will add support for Ethereum blockchain and enable access for distributed applications, or "Dapps" in your browser!'),(0,o.kt)("p",null,"It\u2019s supported in Firefox and Chrome browsers."),(0,o.kt)("p",null,"!!! Tip\nFirefox users are more likely to access the latest version timely"),(0,o.kt)("h2",{id:"download-link"},"Download Link"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp"},"Chrome App Store")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"Firefox App Store Link"))),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/docs/manual"},"How to manually install the Binance Extension Wallet")),(0,o.kt)("h2",{id:"install"},"Install"),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Example: Install BNB Chain Wallet in Firefox browser")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"Open Extension in Firefox:")," ",(0,o.kt)("a",{parentName:"p",href:"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"},"https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("strong",{parentName:"p"},"Search for Binance Chain Wallet")))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/ks5BM5SBqrjbDWdbGhsKymWvuLIJina_JZ4lo_j-skzhnFXvF8laumgJpl8nCv7XC_2Z6bwOhrt7v-oHLXv-eHNLlfY_9qSiQWyiyWuDlN8XKfc329MgTiyUpq9D8K562nH_zdkS",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Note:"))," ",(0,o.kt)("em",{parentName:"p"},"Make sure it\u2019s offered by Binance Chain")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201c",(0,o.kt)("strong",{parentName:"li"},"Add to Firefox"),"\u201d")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh4.googleusercontent.com/BxNDhV2jxT9B7D8cbS7Fh8XY1TVeh_45Sm18xn_sBCTSUGtQzFI086TBS61QHXquLxmikpSpILOAlpE-azn9EWgdwU0kraW1VrCbjqXK8liCylFw_IBfyW40yOk5aNCX34oRi_sX",alt:"img"})),(0,o.kt)("p",null,"That\u2019s it! You have successfully installed the BNB Chain Wallet extension in Firefox!"),(0,o.kt)("p",null,"The workflow is the same for all browsers"),(0,o.kt)("h2",{id:"create-an-account-in-extension-wallet-for-bnb-smart-chain"},"Create an account in extension wallet for BNB Smart Chain"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201c",(0,o.kt)("strong",{parentName:"li"},"I do not own a wallet"),"\u201d")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/qmWsS5xLoF-qpk_3IBeE21vkt20lM0Ew7Wen_TGdgANw-2WEEvfNEqCibw2sUlt9YMS-m7A5iebwpXP40LlJwkXb8vOv8D8BGQcghn7E4CvHOjib1b4NQjaMRHLHit6hH6YVE9cc",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Choose your own Password")),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Note: it has to be a strong password")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh4.googleusercontent.com/sYV31JuMNYBK1OoqNwaxp3wRovbeLfkFtRle0_cfBeJMb1vyL3wKRKnp8420PZZKS0PLQrs89w6RJtUYCa3z1UAzZDSvf1FQT5bTOJaFowuYOHCuCNauQ41v8yk9dKlsuwkOssed",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Click on \u201c",(0,o.kt)("strong",{parentName:"p"},"Continue"),"\u201d")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Backup your recovery phrase"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/n2FtIpBGm0rfQC1WHDUbL44LhT6VVizzV4uBhzOkFCblCIXFdOISvy-OzCF5rEeU6q0suuW8Z6noqgYWW5_u8AU7mjat3ayEzU031SLjULoFSh0pdQOO_spRwGfqBEbSl8TIVOfa",alt:"img"})),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Congratulations! you have created your account!"))),(0,o.kt)("h2",{id:"recover-your-account-with-mnemonic-phrase"},"Recover your account with Mnemonic Phrase"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install BNB Chain extension by following the previous steps"),(0,o.kt)("li",{parentName:"ul"},"firstClick on \u201cI own a wallet\u201d")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/WvqszPDj6yhnt4KhB9VNHQrpR3C4lcIvOnBvZE4BslWsl0fmFbjM0f8dcK1sBFPI8OSt-8RGbk7X7pEdbci7P4RCl0rOoN4_5ce-qbfXj0BnGjSj160oDZ4ObvhljeTn8c4hZmnm",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Type your recovery phrase and choose a strong password")),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/VQbiCEcUSQyyHxcP0rR1FodhZcYBqaXMRpYsFy11NCJFzbtgpdewW6FCoazF1f7KiGaqMnOhL2LoEFvep5HXsJrh7VXjFuu6Qo3s1kI_3feKbOfudQS8q1GjfWSJJygTSsxGmBx5",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201c",(0,o.kt)("strong",{parentName:"li"},"Get started"),"\u201d")),(0,o.kt)("p",null,"Now you are all set!"),(0,o.kt)("h2",{id:"get-testnet-bnb-from-faucet"},"Get Testnet BNB from Faucet"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Go to ",(0,o.kt)("a",{parentName:"li",href:"https://testnet.binance.org/faucet-smart/"},"https://testnet.binance.org/faucet-smart/"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/Q1uDI7LH2lZXvew9selrT5NzL7wKKPtvEnQlPB4mEZW46xb-fphq_Azi9EouvzYKx3IudqwppX6Pai2oFzGlyuJrOvLYlPnZySl2AmHPhpBMeIgEag4sdK_QkycMB826O95tqNQv",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain Testnet after unlock your extension wallet")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/RolgUaF7n1Gxh8FV7_oUqJ4Fgx0cjRob9LPn4jMMS9yGrbZ15ssPo1rsrPpavy8VVooM0Rqr3dDh00Om5C3OvMN-D2s4nhBub6dIJBhtuod6ZCQ0j8fWFGZ0WUOQQXBDOScaap98",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Copy your address")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/4h1Wh2lAYXDOe2j6pxqK97jAmY_RtDr2Uzosc4ZabwcGkRIHC_sbY2wO3MhZu-7mHel5XBIOFeDkjpPVmrJ3z7WNKKFQE73mO4ugIHhQm-AQa6TCV8rgtzoj81HL_Gg7PVFZscIY",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Paste your address in the box and click on \u201cGive me BNB\u201d"),(0,o.kt)("li",{parentName:"ul"},"Click on the \u201c+\u201d and add \u201cBNB\u201d token")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/5NuQ64U7VodRM815S-2EEElre-ox0CMWuKpTHeXfbI5R7kYwUO_nSqoyrcRukrZf5fR5HsZD9E2ZGggMPcvlewNpmFSNelT26gXkuoQdN6W9Xl69ofvCbrsNB38ivKFBZamQAUgN",alt:"img"})),(0,o.kt)("p",null,"After the transfer transaction is sent, you will see an increase in your balance"),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/RTAOcHcPxUIthhOLlHHJ1_wrFnvmZvbZ4DJUvpNR453E4mnWWRjHLBEABMTZZdSQGYMktX5eXJPOIt7iEijMsbmMJBEL29RAShDBD8ZRIDiCnXpfwi741DM7-XiDDyJO4uiLHyNL",alt:"img"})),(0,o.kt)("h2",{id:"transfer-testnet-bnb-from-bsc-to-bc"},"Transfer Testnet BNB from BSC to BC"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Beacon Chain testnet and copy your address after unlock your extension wallet, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"tbnb1"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/K5w_Mbk4rT9Az6eIY130MHaj_ZCicU4Tp3w93z40dtrGdzwFCMZ5qAfwytI5PY_TdztTPrK5WPAf1uHM5ej-1YdEWu7GtVgghRBub1KSf0e63tgi1L-4MkwPBG3pG0SDYHfMpt_J",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Click on the \u201c+\u201d and add \u201cBNB\u201d token")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Switch to BNB Smart Chain testnet and click on \u201cSend\u201d"))),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/nD5EwfFWmqRuHK21u5D5bcVg2MkXHa-OrAX-rhGMKQQmEGxgLLh57-zVdx4WnAYIUbCjAYaStt0PYt-gthrHK_hsWW0jAh34xOT2maf1skY3Dvy0-vAlaAjred96UihBabkglDMZ",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201cSend\u201d when you have filled in other information. You have to confirm it too")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh5.googleusercontent.com/zPPVgR5I9s6cQPYfDbBU9E5Ddr5VtBhWt7iyHHE7IUEvaa5sTIMEA79VEGD-DHJJyrnJO-28m3QiVxrmSh82oCFnfjA63lpk-M1mQsdQ3aeTUskla0u8bpDNI3J0oLOFYa5Ahbr4",alt:"img"})),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch back to BNB Chain Testnet to confirm this cross-chain transfer")),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/4PMk41qA7tXxRes-0Oc12A28U_W7JZHQAlJ9WW5njdGcozY8njSVEuPeZzTRt1xfRpiXPUZiea6ES74DQyjnyZNzjPw9NJhL_QNXvSMPich2o54MlbXVgoMJHaMx66xVpqm-2XAu",alt:"img"})),(0,o.kt)("h2",{id:"transfer-testnet-bnb-from-bc-to-bsc"},"Transfer Testnet BNB from BC to BSC"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet after unlock your extension wallet and copy your address, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"0x"))),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/kidAixmzNbNt_ujj0BQqZdZ4ZBXdEkxJLSVIOsWnWxZGOeXUJBjhxYsLlxH6VSQWxNX-dzqBFhqXSW3zmshkL99QYcVxIFGxw6tF7xF9ffXZPMPKnXlt0sWCKvPV6RMJWHSx1H0O",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Click on the \u201c+\u201d and add \u201cBNB\u201d token")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},"Switch to BNB Chain testnet and click on \u201cSend\u201d"))),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/JuCCpF4-U2FBHIZEIcwf7DNsCBA_RavVtmSX1dRe-thAL3FSm__Maf27aVkEIxaCQ28hl17NEYthBKyAWLJT72NMZ0Lkxzt7AIcVEuej2KDaKzT6ElR-wv_DTy1ip6MKfQk0-U7-",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201cSend\u201d when you have filled in other information. You have to confirm it too")),(0,o.kt)("img",{src:"https://lh4.googleusercontent.com/Ab98BfFApDok7qZdHAerglPc-vEYAKdEa2K-04CBdNfaQy8fE2CiJ_1sRjophAqsAt8p9c3CxA5IAGuhnPjJuZqotCq8zPRUkoEpB2tQir1nneBopVGNSNKlzq4wRVmSrfuQEZFw",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch back to BNB Smart Chain Testnet to confirm this cross-chain transfer")),(0,o.kt)("h2",{id:"swap-testnet-bep2-token-to-its-bep20-equivalent"},"Swap Testnet BEP2 token to its BEP20 equivalent"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to Install Binance Extension Wallet if not ready"),(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to create or Recover your account"),(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Chain testnet after unlock your extension wallet and Click at \u201c+\u201d to add your BEP2 token if necessary")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/P9NrmUZF4yC0_G_KgSuqCtLq3Q0GLw6ZBfyYwBn6f6HFqTxOcER2wChJJtZvAkF8QsEJz9AxN6Ixi2oqlJEHKsig-KTz3qUIAi8Kt7TfhyPalMMzO7Yh3btfyVLMm9MNCcA1bXYL",style:{zoom:"50%"}}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Verify your balance has enough BNB to pay transfer fee")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet and copy your address, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"0x"))),(0,o.kt)("img",{src:"https://lh3.googleusercontent.com/kidAixmzNbNt_ujj0BQqZdZ4ZBXdEkxJLSVIOsWnWxZGOeXUJBjhxYsLlxH6VSQWxNX-dzqBFhqXSW3zmshkL99QYcVxIFGxw6tF7xF9ffXZPMPKnXlt0sWCKvPV6RMJWHSx1H0O",style:{zoom:"50%"}}),(0,o.kt)("p",null,"Click at \u201c+\u201d to add your BEP20 token if necessary"),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/fW06aH1A5_7P93r8zSp4kgs5Us1AqYHvnfs6sRxg6aCLsQ7u9Ht_z6zLSExGjbr6J-D0vOmDWXghw544WhaNnkTP-nDAO3TFou5g_WYVvp7nOSrNX7w15PmvmZLyHkhBzLW_i-xi",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Chain testnet and click on \u201cSend\u201d")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/OHYhS0DdJsg6Jt_E-qRrPOxgDi_VMwXlRYVD8OVTrr1w5kwubse2boOfffWpl8PjP15j_h0atYB4O1GEQqNGCFzoKcoRSgmdMgAYQPazoe_I7X6gilZazMqqIGntSz9rz6j47DGk",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click on \u201cSend\u201d when you have filled in other information. You have to confirm it too")),(0,o.kt)("img",{src:"https://lh6.googleusercontent.com/gcaynPouCk8R0cRFo10i6tXUp8yVO3N1MB9ihJvo-NmO0i8PWae1Vz83O5i8cAIbuoZ1PIO_8de6PrxtUA3mix3FdxWZePH4KZt4_-Uwr64CZWyJog5d1iYcNgwHp_RumNOGc7B4",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet, you should see your BEP20 token balance change")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/ThOnhoHRzITPpIqfYOj6_Q0NHGSmVXMqmJ11SPjcvVqEzHZ6vcWpxyb9jILtnJ9GxAFDz527jCapq64-8N8l_aqMU1phv2MoAmTIKb1Nse7NjzhFRhdiyObk1mZBb7YQbq7ZkqTV",style:{zoom:"50%"}}),(0,o.kt)("h2",{id:"swap-testnet-bep20-token-to-its-bep2-equivalent"},"Swap Testnet BEP20 token to its BEP2 equivalent"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to Install Binance Extension Wallet if not ready"),(0,o.kt)("li",{parentName:"ul"},"Follow the instructions above to create or Recover your account"),(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet and Click at \u201c+\u201d to add your BEP20 token if necessary")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/fW06aH1A5_7P93r8zSp4kgs5Us1AqYHvnfs6sRxg6aCLsQ7u9Ht_z6zLSExGjbr6J-D0vOmDWXghw544WhaNnkTP-nDAO3TFou5g_WYVvp7nOSrNX7w15PmvmZLyHkhBzLW_i-xi",style:{zoom:"50%"}}),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"Verify your balance has enough BNB to pay transfer fee")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Chain testnet and copy your address, start with ",(0,o.kt)("inlineCode",{parentName:"li"},"tbnb1"))),(0,o.kt)("p",null,"Note: for mainnet, the address starts with ",(0,o.kt)("inlineCode",{parentName:"p"},"bnb1")),(0,o.kt)("img",{src:"https://lh4.googleusercontent.com/kJnKr2dRtAvvMjjQIaMMq3JN9-ljqXjTaLq00u66UgisISIayIUsv1N01GjCbk9Z07WQUruToHX6pCb_dnYGDeP2NKTLbScnFFC317voNd6RTV-MDHAfMHorm8VCMyPKIK8YAEwS",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Click at \u201c+\u201d to add your BEP2 token if necessary")),(0,o.kt)("img",{src:"https://lh5.googleusercontent.com/P9NrmUZF4yC0_G_KgSuqCtLq3Q0GLw6ZBfyYwBn6f6HFqTxOcER2wChJJtZvAkF8QsEJz9AxN6Ixi2oqlJEHKsig-KTz3qUIAi8Kt7TfhyPalMMzO7Yh3btfyVLMm9MNCcA1bXYL",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Switch to BNB Smart Chain testnet and click on \u201cSend\u201d")),(0,o.kt)("img",{src:"https://lh6.googleusercontent.com/m-lXjzWHuiVteM0n0ukSmMCxHm7XSQtO8wJ0LMXMUYL6spDObSmgbN7zoBVuc0hrhBL2mQ1C3GhBvzHpnHYoP_mbOcKSYtZZojQ46R5-2QA_ULXMPlmHyqXcg1Ht_M8Ix0xdUxJb",style:{zoom:"50%"}}),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Confirm your transaction and verify your balance change")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6cf6a508.a728b648.js b/assets/js/6cf6a508.b97c02aa.js similarity index 50% rename from assets/js/6cf6a508.a728b648.js rename to assets/js/6cf6a508.b97c02aa.js index ab8bdf699e..e61272bf59 100644 --- a/assets/js/6cf6a508.a728b648.js +++ b/assets/js/6cf6a508.b97c02aa.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[7560],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>b});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=o(a),c=r,b=u["".concat(p,".").concat(c)]||u[c]||m[c]||s;return a?n.createElement(b,l(l({ref:t},d),{},{components:a})):n.createElement(b,l({ref:t},d))}));function b(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,l=new Array(s);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,l[1]=i;for(var o=2;o{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>o});var n=a(83117),r=(a(67294),a(3905));const s={},l="Cross-chain Atomic Swaps",i={unversionedId:"beaconchain/learn/atomic-swaps",id:"beaconchain/learn/atomic-swaps",title:"Cross-chain Atomic Swaps",description:"Atomic Swap",source:"@site/docs/beaconchain/learn/atomic-swaps.md",sourceDirName:"beaconchain/learn",slug:"/beaconchain/learn/atomic-swaps",permalink:"/docs/beaconchain/learn/atomic-swaps",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/learn/atomic-swaps.md",tags:[],version:"current",frontMatter:{}},p={},o=[{value:"Atomic Swap",id:"atomic-swap",level:2},{value:"Hash Timer Locked Contract",id:"hash-timer-locked-contract",level:2},{value:"HTLC on BNB Beacon Chain",id:"htlc-on-bnb-beacon-chain",level:2},{value:"Hash Timer Locked Transfer",id:"hash-timer-locked-transfer",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Outputs",id:"outputs",level:4},{value:"Examples",id:"examples",level:4},{value:"Deposit HTLT",id:"deposit-htlt",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Claim HTLT",id:"claim-htlt",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Examples",id:"examples-2",level:4},{value:"Refund HTLT",id:"refund-htlt",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Query Atomic Swap",id:"query-atomic-swap",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Query Atomic Swap ID By Recipient",id:"query-atomic-swap-id-by-recipient",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Query Atomic Swap ID By Creator",id:"query-atomic-swap-id-by-creator",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Fees",id:"fees",level:2},{value:"Workflows",id:"workflows",level:2},{value:"Preparations",id:"preparations",level:3},{value:"Testnet Deployment",id:"testnet-deployment",level:3},{value:"Swap Tokens from Ethereum to BNB Beacon Chain",id:"swap-tokens-from-ethereum-to-bnb-beacon-chain",level:3},{value:"1. Approve Swap Transaction",id:"1--approve-swap-transaction",level:4},{value:"2. Call HTLT function From Ethereum",id:"2-call-htlt-function-from-ethereum",level:4},{value:"3. Deputy Call HTLT on BNB Beacon Chain",id:"3-deputy-call-htlt-on-bnb-beacon-chain",level:4},{value:"4. Claim HTLT on BNB Beacon Chain",id:"4-claim-htlt-on-bnb-beacon-chain",level:4},{value:"5. Deputy Claim ERC20 Token",id:"5-deputy-claim-erc20-token",level:4},{value:"6. Demo for Client APP: swap erc20 to bep2",id:"6-demo-for-client-app-swap-erc20-to-bep2",level:4},{value:"Swap Tokens from BNB Beacon Chain to Ethereum",id:"swap-tokens-from-bnb-beacon-chain--to-ethereum",level:3},{value:"1. Send HTLT Transaction from BNB Beacon Chain",id:"1-send-htlt-transaction-from-bnb-beacon-chain",level:4},{value:"2. Deputy Approve Tokens",id:"2--deputy-approve-tokens",level:4},{value:"3. Deputy Send HTLT on Ethereum",id:"3-deputy-send-htlt-on-ethereum",level:4},{value:"4. Claim ERC20 Tokens on Ethereum",id:"4-claim-erc20-tokens-on-ethereum",level:4},{value:"5. Deputy Claim on BNB Beacon Chain",id:"5-deputy-claim-on-bnb-beacon-chain",level:4},{value:"6. Demo for Client APP: swap bep2 to erc20",id:"6-demo-for-client-app-swap-bep2-to-erc20",level:4},{value:"Swap between Several BEP2 tokens",id:"swap-between-several-bep2-tokens",level:3},{value:"Swap between Several BEP2 tokens fails",id:"swap-between-several-bep2-tokens-fails",level:3}],d={toc:o},u="wrapper";function m(e){let{components:t,...s}=e;return(0,r.kt)(u,(0,n.Z)({},d,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-chain-atomic-swaps"},"Cross-chain Atomic Swaps"),(0,r.kt)("h2",{id:"atomic-swap"},"Atomic Swap"),(0,r.kt)("p",null,"The problem of an atomic swap is one where (at least) two parties, Alice and Bob, own coins, and want to exchange them without having to trust a third party (centralized exchange)."),(0,r.kt)("p",null,"A non-atomic trivial solution would have Alice send her coins to Bob, and then have Bob send other coins to Alice - but Bob has the option of going back on his end of the bargain and simply not following through with the protocol, ending up with both sets of coins."),(0,r.kt)("p",null,"Atomic swaps can be used for trading between BEP2 tokens, or for trading across different blockchains."),(0,r.kt)("h2",{id:"hash-timer-locked-contract"},"Hash Timer Locked Contract"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts"},"HTLC")," has been used for Atomic Swap and cross payment channel for a few years on Bitcoin and its variant blockchains, and also Ethereum. This BEP defines native transactions to support HTLC on BNB Beacon Chain , and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token, which is called ",(0,r.kt)("inlineCode",{parentName:"p"},"Atomic Peg"),"."),(0,r.kt)("h2",{id:"htlc-on-bnb-beacon-chain"},"HTLC on BNB Beacon Chain"),(0,r.kt)("p",null,"As explained in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3"),", Hash Timer Locked Contract(HTLC) has been used for Atomic Swap and cross payment channels between different blockchains. BEP3 defines native transactions to support HTLC on BNB Beacon Chain and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token.\nDuring the swap process, the related fund will be locked to a purely-code-controlled escrow account.\nA purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account has no its own private key and it's only controled by code in protocol. The code for calculating escrow account is the same as how it's done in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/cosmos/cosmos-sdk/blob/82a2c5d6d86ffd761f0162b93f0aaa57b7f66fe7/x/supply/internal/types/account.go#L40"},"cosmos-sdk"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))\n')),(0,r.kt)("p",null,"The account for mainnet is: ",(0,r.kt)("strong",{parentName:"p"},"bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u")," and the account for testnet is: ",(0,r.kt)("strong",{parentName:"p"},"tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d"),". Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts."),(0,r.kt)("h3",{id:"hash-timer-locked-transfer"},"Hash Timer Locked Transfer"),(0,r.kt)("p",null,"Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain , to serve as HTLC in the first step of Atomic Swap,"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the asset is from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Receiver address, where the asset is to, if the proper condition meets."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of a random number and timestamp, based on SHA256. If left out, a random value will be generated"),(0,r.kt)("td",{parentName:"tr",align:null},"True")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"OutAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},"similar to the Coins in the original Transfer defined in BEP2, assets to swap out"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ExpectedIncome"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},'Expected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HeightSpan"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"CrossChain"),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Specify if the HTLT is for cross chain atomic swap"),(0,r.kt)("td",{parentName:"tr",align:null},"True, the default value is False")))),(0,r.kt)("h4",{id:"outputs"},"Outputs"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number hash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Swap ID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Swap between BEP2 tokens")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --recipient-addr --amount 100:BNB --expected-income --height-span --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }]\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400// height span\n const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example output:")),(0,r.kt)("p",null,"Please take a note of returned ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b\nTimestamp: 1568792486\nRandom number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1\nPassword to sign with 'guest':\nCommitted at block 39984169 (\ntx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,\nresponse: {\n Code:0\n Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n Info: GasWanted:0 GasUsed:0\n ...\n)\n")),(0,r.kt)("p",null,"Besides, the ",(0,r.kt)("inlineCode",{parentName:"p"},"Data")," field in the committed result is the byte array of ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n\nswapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Swap from BNB Beacon Chain to Ethereum")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Clients send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-addr --recipient-other-chain --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Swap from Ethereum to BNB Beacon Chain ")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Once cross-chain is true, --recipient-other-chain must not be empty")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Deputy send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-other-chain --sender-other-chain --recipient-addr --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address\n const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address\n const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract\n const timestamp = 1571383800 //deputy get this value from the event log of swap contract\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("h3",{id:"deposit-htlt"},"Deposit HTLT"),(0,r.kt)("p",null,"Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap."),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the assets are from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Amount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},'The swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"'),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-1"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token deposit --swap-id --amount 10000:TEST-599 --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const amount = [{\n denom: "TEST-599",\n amount: 10000\n }]\n const res = client.swap.depositHTLT(from, swapID, amount)\n')),(0,r.kt)("p",null,"Example output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("p",null,"After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and the ",(0,r.kt)("inlineCode",{parentName:"p"},"in_amount")," must equal to the amount that you balance decreased."),(0,r.kt)("h3",{id:"claim-htlt"},"Claim HTLT"),(0,r.kt)("p",null,"Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once."),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumber"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"The random number to unlock the locked hash, 32 bytes, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-2"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token claim --swap-id --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt\n const res = client.swap.claimHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("h3",{id:"refund-htlt"},"Refund HTLT"),(0,r.kt)("p",null,"Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token refund --swap-id --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const res = client.swap.refundHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Common error:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Already complete")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Not expired")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}\n')),(0,r.kt)("h3",{id:"query-atomic-swap"},"Query Atomic Swap"),(0,r.kt)("p",null,"Query atomic swap allows you to search swap information by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Expected output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",\n "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",\n "out_amount": [\n {\n "denom": "BNB",\n "amount": "100"\n }\n ],\n "in_amount": [\n {\n "denom": "TEST-599",\n "amount": "10000"\n }\n ],\n "expected_income": "10000:TEST-599",\n "recipient_other_chain": "",\n "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",\n "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",\n "timestamp": "1568792486",\n "cross_chain": false,\n "expire_height": "39994169",\n "index": "53",\n "closed_time": "1568792927",\n "status": "Completed"\n}\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-recipient"},"Query Atomic Swap ID By Recipient"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap recipient address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-recipient --recipient-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",\n "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"\n]\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-creator"},"Query Atomic Swap ID By Creator"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"creator-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap creator address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-creator --creator-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",\n "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",\n "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",\n "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",\n "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"\n]\n')),(0,r.kt)("h2",{id:"fees"},"Fees"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")))),(0,r.kt)("h2",{id:"workflows"},"Workflows"),(0,r.kt)("h3",{id:"preparations"},"Preparations"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Deploy smart-contract which supports Atomic Peg Swap (APS), there is already ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"one example")," for Ethereum"),(0,r.kt)("li",{parentName:"ol"},"Deploy ",(0,r.kt)("inlineCode",{parentName:"li"},"deputy")," process for handling swap activities by token owners, there is an existing open-source solution here: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"https://github.com/bnb-chain/bep3-deputy")),(0,r.kt)("li",{parentName:"ol"},"Issue and transfer enough tokens")),(0,r.kt)("h3",{id:"testnet-deployment"},"Testnet Deployment"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"ERC20 contract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098")),(0,r.kt)("li",{parentName:"ul"},"Token Symbol: ",(0,r.kt)("strong",{parentName:"li"},"PPC")),(0,r.kt)("li",{parentName:"ul"},"SmartContract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad"},"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad")),(0,r.kt)("li",{parentName:"ul"},"Its corresponding address on testnet is: ",(0,r.kt)("inlineCode",{parentName:"li"},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"),"on BNB Beacon Chain and ",(0,r.kt)("inlineCode",{parentName:"li"},"0xD93395B2771914E1679155F3EA58C41d89D96098")," on Ethereum testnet")),(0,r.kt)("h3",{id:"swap-tokens-from-ethereum-to-bnb-beacon-chain"},"Swap Tokens from Ethereum to BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193751444",src:a(60214).Z,width:"874",height:"684"})),(0,r.kt)("h4",{id:"1--approve-swap-transaction"},"1. Approve Swap Transaction"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"this page")," and approve some amount of tokens."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"Approve")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_spender: address of smartcontract, which is ",(0,r.kt)("inlineCode",{parentName:"li"},"0x12DCBf79BE178479870A473A99d91f535ed960AD")),(0,r.kt)("li",{parentName:"ul"},"_value: approved amount, should be bumped by e^10")))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Please approve more than 1token. In the following example, 100 PPC token was approved:")),(0,r.kt)("p",null,"Example of approve 100 PPC on ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xfa640b382d3842cf508ac347090d2550e35e2193804d2a9318fbbdcdd54c846b"},"ropsten testnet")),(0,r.kt)("h4",{id:"2-call-htlt-function-from-ethereum"},"2. Call ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," function From Ethereum"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"smartcontract")," and call ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," function"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"htlt")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array"),(0,r.kt)("li",{parentName:"ul"},"_timestamp: it should be about 10 mins span around current timestamp"),(0,r.kt)("li",{parentName:"ul"},"_heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy."),(0,r.kt)("li",{parentName:"ul"},"_recipientAddr: deputy address on Ethereum, it's ",(0,r.kt)("inlineCode",{parentName:"li"},"0x1C002969Fe201975eD8F054916b071672326858e")," for this one"),(0,r.kt)("li",{parentName:"ul"},"_bep2SenderAddr: omit this field with ",(0,r.kt)("inlineCode",{parentName:"li"},"0x0")),(0,r.kt)("li",{parentName:"ul"},"_bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9"),(0,r.kt)("li",{parentName:"ul"},"_outAmount: approved amount, should be bumped by e^10"),(0,r.kt)("li",{parentName:"ul"},"_bep2Amount: _outAmount * exchange rate, the default rate is 1")))),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xa2444cc1e52e09027ec68bf8955e7084235255f9f18d9b837a12fd63e6f0145c"},"transaction")),(0,r.kt)("h4",{id:"3-deputy-call-htlt-on-bnb-beacon-chain"},"3. Deputy Call HTLT on BNB Beacon Chain"),(0,r.kt)("p",null,"Then, Deputy will send ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/tx/99CBC2896F0CF14DDAB0684BDA0A3E9FF2271056E68EC3559AB7FB24E0EE97DE"},"here")),(0,r.kt)("h4",{id:"4-claim-htlt-on-bnb-beacon-chain"},"4. Claim HTLT on BNB Beacon Chain"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Get the ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID")," on BNB Beacon Chain ")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'./tbnbcli token query-swapIDs-by-recipient --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n[\n "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"\n]\n')),(0,r.kt)("p",null,"You can also get swapID by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/javascript-sdk/blob/91b4d39e96e6433c16a3a1288931f84923075543/src/utils/index.js#L266"},"calculateSwapID in javascript-sdk"),". It requires three parameters:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash in client HTLT transaction on Ethereum"),(0,r.kt)("td",{parentName:"tr",align:null},"5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"deputy bep2 address"),(0,r.kt)("td",{parentName:"tr",align:null},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"senderOtherChain"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"client ethereum address"),(0,r.kt)("td",{parentName:"tr",align:null},"0x133d144f52705ceb3f5801b63b9ebccf4102f5ed")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Query the swap by ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",\n "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",\n "out_amount": [\n {\n "denom": "PPC-00A",\n "amount": "9999999000"\n }\n ],\n "in_amount": null,\n "expected_income": "",\n "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",\n "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",\n "random_number": "",\n "timestamp": "1569497984",\n "cross_chain": true,\n "expire_height": "41380567",\n "index": "1947",\n "closed_time": "",\n "status": "Open"\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Verify parameters in the swap:"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"random_number_hash")," must equal to the randomNumberHash in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"to")," must equals to client wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"timestamp")," must equal to the timestamp in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"out_amount")," should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"expire_height")," must not be passed and should be enough for send claim transaction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Send claim transaction on BNB Beacon Chain "))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token claim --swap-id 12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128 --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," tx on ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/tx/6BA714E6D107F1D9634DDC159F560A1FB61393B8E15723EFD70B9EA8B0B1AA9A?format=json"},"testnet")),(0,r.kt)("h4",{id:"5-deputy-claim-erc20-token"},"5. Deputy Claim ERC20 Token"),(0,r.kt)("p",null,"Deputy will claim ERC20 tokens afterwards with ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x3a422bdb273d4eb4d112ae8e51e8acd3ad706b2af67af20a5f15a18e4acc70fc"},"claim transaction")),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-erc20-to-bep2"},"6. Demo for Client APP: swap erc20 to bep2"),(0,r.kt)("p",null,"This is a javascript implementation for client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," to ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/asset/PPC-00A"},"PPC-00A")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 approve erc20 to swap contract address\n //--------------------------------------------\n const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: erc20ContractAddr,\n value: \'0x00\',\n data: approveData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n //----------------------------------------------------------------------------\n //Step2 call swap contract to send htlt transaction on Ethereum\n //----------------------------------------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 1000\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const amount = 10000000000 // 10000000000:PPC\uff0c decimal is 10\n const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A\n\n const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()\n nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n gasPrice = await web3.eth.getGasPrice()\n gasLimit = 3000000\n rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: htltData\n }\n ethereumjs = require(\'ethereumjs-tx\')\n signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters\n //----------------------------------------------------------------------------\n const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()\n console.log(swapID)\n let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n }\n const atomicSwap = await bnbClient.getSwapByID(swapID)\n console.log(atomicSwap)\n const status = await bnbRPC.status()\n expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)\n expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))\n expect(atomicSwap.result.timestamp).toBe(timestamp)\n expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")\n expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)\n\n //----------------------------------------------------------------------------\n //Step4 claim on BNB Beacon Chain \n //----------------------------------------------------------------------------\n const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)\n console.log(res)\n\n //----------------------------------------------------------------------------\n //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum\n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-tokens-from-bnb-beacon-chain--to-ethereum"},"Swap Tokens from BNB Beacon Chain to Ethereum"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193910521",src:a(52273).Z,width:"778",height:"582"})),(0,r.kt)("h4",{id:"1-send-htlt-transaction-from-bnb-beacon-chain"},"1. Send ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," Transaction from BNB Beacon Chain"),(0,r.kt)("p",null,"Please read this ",(0,r.kt)("a",{parentName:"p",href:"#hash-timer-locked-transfer"},"section")," to generate a valid ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction. Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumber")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumberHash"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr --chain-id Binance-Chain-Ganges --height-span 10000 --amount 9900000000:PPC-00A --expected-income 9900000000:PPC --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\nRandom number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e\nTimestamp: 1569578936\nRandom number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e\nCommitted at block 634510 (\n tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,\n response: {\n Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]\n Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2\n ...\n)\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: the swap amount must be positive.")),(0,r.kt)("p",null,"Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"random number"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"random number hash"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"timestamp")," for next steps."),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/tx/9ECECE9E0F08EE78583CFA37FD4C3F03521289F0F229A612886B8B21B9C62D7F"},"here")),(0,r.kt)("p",null,"Then, you can query the the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"SwapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"You can use this ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters."),(0,r.kt)("h4",{id:"2--deputy-approve-tokens"},"2. Deputy Approve Tokens"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has approve enough amount of tokens for atomic swap."),(0,r.kt)("h4",{id:"3-deputy-send-htlt-on-ethereum"},"3. Deputy Send HTLT on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has sent the ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494"},"transaction")," afterwards"),(0,r.kt)("p",null,"To get the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum, you can check this ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"page"),"\n",(0,r.kt)("strong",{parentName:"p"},"0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e")," is the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum."),(0,r.kt)("h4",{id:"4-claim-erc20-tokens-on-ethereum"},"4. Claim ERC20 Tokens on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has already approved enough tokens and"),(0,r.kt)("p",null,"In its ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"event log"),", you should see the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),". Before calling ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function on ethereum, clients should verify the parameters in the ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," event."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_randomNumberHash")," must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_recipientAddr")," must equal to client ethereum wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_timestamp")," must equal to the timestamp in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_outAmount")," should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_expireHeight")," must not be passed and should be enough for send claim transaction")),(0,r.kt)("p",null,"Then, you can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"claim")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_swapID: this is get from event, you can also calculate it from ",(0,r.kt)("inlineCode",{parentName:"li"},"calSwapID")," function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})"),(0,r.kt)("li",{parentName:"ul"},"_randomNumber: reveal your randomNumber")))),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x9cf7cc7891b86987c4eef59e3b4950324d656e6937a38b91786894f52c76f41b"},"here")),(0,r.kt)("h4",{id:"5-deputy-claim-on-bnb-beacon-chain"},"5. Deputy Claim on BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Claim HTLT")," transaction from ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/tx/8C616DEFD2EAA41E13D2DC4844B218DFF8CFE24B4C7A693AAD700381B5FF7B48"},"sent")," afterwards:"),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-bep2-to-erc20"},"6. Demo for Client APP: swap bep2 to erc20"),(0,r.kt)("p",null,"This is a javascript implementation for client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/asset/PPC-00A"},"PPC-00A")," to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 send htlt on BNB Beacon Chain \n //--------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 10000\n const amount = [{\n denom: "PPC-00A",\n amount: 100000000\n }]\n const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC\n\n bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n await wait(1000)\n\n //----------------------------------------------------------------------------\n //Step2 query swap created by deputy on Ethereum and verify swap parameters\n //----------------------------------------------------------------------------\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()\n console.log(swapID)\n\n let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n while (openSwap._randomNumberHash == \'0x0000000000000000000000000000000000000000000000000000000000000000\') {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n }\n let ethBlock = await web3.eth.getBlock(\'latest\')\n let ethLatestHeight = ethBlock.number\n expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)\n expect(Number(openSwap._timestamp)).toBe(timestamp)\n expect(Number(openSwap._outAmount)).toBe(9999990000)\n expect(openSwap._recipient).toBe(clientEthWalletAddr)\n expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)\n\n //----------------------------------------------------------------------------\n //Step3 claim on Ethereum\n //----------------------------------------------------------------------------\n const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: claimData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain \n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens"},"Swap between Several BEP2 tokens"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193422062",src:a(65441).Z,width:"799",height:"374"})),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens-fails"},"Swap between Several BEP2 tokens fails"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193518929",src:a(13745).Z,width:"828",height:"375"})))}m.isMDXComponent=!0},52273:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/bnc2eth-1a89d1368f58b4690f8ab8feb1ce4e4d.png"},60214:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/eth2bnc-7027f7f9453612ac0464d597ca199c09.png"},65441:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/same-chain-aa9d070f81128cb38dfa878047491dbd.png"},13745:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/samechain-fail-5c962e9308de9851a27e1c62beb67e6e.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[7560],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>b});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=o(a),c=r,b=u["".concat(p,".").concat(c)]||u[c]||m[c]||s;return a?n.createElement(b,l(l({ref:t},d),{},{components:a})):n.createElement(b,l({ref:t},d))}));function b(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,l=new Array(s);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,l[1]=i;for(var o=2;o{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>o});var n=a(83117),r=(a(67294),a(3905));const s={},l="Cross-chain Atomic Swaps",i={unversionedId:"beaconchain/learn/atomic-swaps",id:"beaconchain/learn/atomic-swaps",title:"Cross-chain Atomic Swaps",description:"Atomic Swap",source:"@site/docs/beaconchain/learn/atomic-swaps.md",sourceDirName:"beaconchain/learn",slug:"/beaconchain/learn/atomic-swaps",permalink:"/docs/beaconchain/learn/atomic-swaps",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/learn/atomic-swaps.md",tags:[],version:"current",frontMatter:{}},p={},o=[{value:"Atomic Swap",id:"atomic-swap",level:2},{value:"Hash Timer Locked Contract",id:"hash-timer-locked-contract",level:2},{value:"HTLC on BNB Beacon Chain",id:"htlc-on-bnb-beacon-chain",level:2},{value:"Hash Timer Locked Transfer",id:"hash-timer-locked-transfer",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Outputs",id:"outputs",level:4},{value:"Examples",id:"examples",level:4},{value:"Deposit HTLT",id:"deposit-htlt",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Claim HTLT",id:"claim-htlt",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Examples",id:"examples-2",level:4},{value:"Refund HTLT",id:"refund-htlt",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Query Atomic Swap",id:"query-atomic-swap",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Query Atomic Swap ID By Recipient",id:"query-atomic-swap-id-by-recipient",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Query Atomic Swap ID By Creator",id:"query-atomic-swap-id-by-creator",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Fees",id:"fees",level:2},{value:"Workflows",id:"workflows",level:2},{value:"Preparations",id:"preparations",level:3},{value:"Testnet Deployment",id:"testnet-deployment",level:3},{value:"Swap Tokens from Ethereum to BNB Beacon Chain",id:"swap-tokens-from-ethereum-to-bnb-beacon-chain",level:3},{value:"1. Approve Swap Transaction",id:"1--approve-swap-transaction",level:4},{value:"2. Call HTLT function From Ethereum",id:"2-call-htlt-function-from-ethereum",level:4},{value:"3. Deputy Call HTLT on BNB Beacon Chain",id:"3-deputy-call-htlt-on-bnb-beacon-chain",level:4},{value:"4. Claim HTLT on BNB Beacon Chain",id:"4-claim-htlt-on-bnb-beacon-chain",level:4},{value:"5. Deputy Claim ERC20 Token",id:"5-deputy-claim-erc20-token",level:4},{value:"6. Demo for Client APP: swap erc20 to bep2",id:"6-demo-for-client-app-swap-erc20-to-bep2",level:4},{value:"Swap Tokens from BNB Beacon Chain to Ethereum",id:"swap-tokens-from-bnb-beacon-chain--to-ethereum",level:3},{value:"1. Send HTLT Transaction from BNB Beacon Chain",id:"1-send-htlt-transaction-from-bnb-beacon-chain",level:4},{value:"2. Deputy Approve Tokens",id:"2--deputy-approve-tokens",level:4},{value:"3. Deputy Send HTLT on Ethereum",id:"3-deputy-send-htlt-on-ethereum",level:4},{value:"4. Claim ERC20 Tokens on Ethereum",id:"4-claim-erc20-tokens-on-ethereum",level:4},{value:"5. Deputy Claim on BNB Beacon Chain",id:"5-deputy-claim-on-bnb-beacon-chain",level:4},{value:"6. Demo for Client APP: swap bep2 to erc20",id:"6-demo-for-client-app-swap-bep2-to-erc20",level:4},{value:"Swap between Several BEP2 tokens",id:"swap-between-several-bep2-tokens",level:3},{value:"Swap between Several BEP2 tokens fails",id:"swap-between-several-bep2-tokens-fails",level:3}],d={toc:o},u="wrapper";function m(e){let{components:t,...s}=e;return(0,r.kt)(u,(0,n.Z)({},d,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"cross-chain-atomic-swaps"},"Cross-chain Atomic Swaps"),(0,r.kt)("h2",{id:"atomic-swap"},"Atomic Swap"),(0,r.kt)("p",null,"The problem of an atomic swap is one where (at least) two parties, Alice and Bob, own coins, and want to exchange them without having to trust a third party (centralized exchange)."),(0,r.kt)("p",null,"A non-atomic trivial solution would have Alice send her coins to Bob, and then have Bob send other coins to Alice - but Bob has the option of going back on his end of the bargain and simply not following through with the protocol, ending up with both sets of coins."),(0,r.kt)("p",null,"Atomic swaps can be used for trading between BEP2 tokens, or for trading across different blockchains."),(0,r.kt)("h2",{id:"hash-timer-locked-contract"},"Hash Timer Locked Contract"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts"},"HTLC")," has been used for Atomic Swap and cross payment channel for a few years on Bitcoin and its variant blockchains, and also Ethereum. This BEP defines native transactions to support HTLC on BNB Beacon Chain , and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token, which is called ",(0,r.kt)("inlineCode",{parentName:"p"},"Atomic Peg"),"."),(0,r.kt)("h2",{id:"htlc-on-bnb-beacon-chain"},"HTLC on BNB Beacon Chain"),(0,r.kt)("p",null,"As explained in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3"),", Hash Timer Locked Contract(HTLC) has been used for Atomic Swap and cross payment channels between different blockchains. BEP3 defines native transactions to support HTLC on BNB Beacon Chain and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token.\nDuring the swap process, the related fund will be locked to a purely-code-controlled escrow account.\nA purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account has no its own private key and it's only controled by code in protocol. The code for calculating escrow account is the same as how it's done in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/cosmos/cosmos-sdk/blob/82a2c5d6d86ffd761f0162b93f0aaa57b7f66fe7/x/supply/internal/types/account.go#L40"},"cosmos-sdk"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))\n')),(0,r.kt)("p",null,"The account for mainnet is: ",(0,r.kt)("strong",{parentName:"p"},"bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u")," and the account for testnet is: ",(0,r.kt)("strong",{parentName:"p"},"tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d"),". Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts."),(0,r.kt)("h3",{id:"hash-timer-locked-transfer"},"Hash Timer Locked Transfer"),(0,r.kt)("p",null,"Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain , to serve as HTLC in the first step of Atomic Swap,"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the asset is from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Receiver address, where the asset is to, if the proper condition meets."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of a random number and timestamp, based on SHA256. If left out, a random value will be generated"),(0,r.kt)("td",{parentName:"tr",align:null},"True")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"OutAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},"similar to the Coins in the original Transfer defined in BEP2, assets to swap out"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ExpectedIncome"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},'Expected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HeightSpan"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"CrossChain"),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Specify if the HTLT is for cross chain atomic swap"),(0,r.kt)("td",{parentName:"tr",align:null},"True, the default value is False")))),(0,r.kt)("h4",{id:"outputs"},"Outputs"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number hash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Swap ID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Swap between BEP2 tokens")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --recipient-addr --amount 100:BNB --expected-income --height-span --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }]\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400// height span\n const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example output:")),(0,r.kt)("p",null,"Please take a note of returned ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b\nTimestamp: 1568792486\nRandom number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1\nPassword to sign with 'guest':\nCommitted at block 39984169 (\ntx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,\nresponse: {\n Code:0\n Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n Info: GasWanted:0 GasUsed:0\n ...\n)\n")),(0,r.kt)("p",null,"Besides, the ",(0,r.kt)("inlineCode",{parentName:"p"},"Data")," field in the committed result is the byte array of ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n\nswapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Swap from BNB Beacon Chain to Ethereum")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Clients send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-addr --recipient-other-chain --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Swap from Ethereum to BNB Beacon Chain ")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Once cross-chain is true, --recipient-other-chain must not be empty")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Deputy send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-other-chain --sender-other-chain --recipient-addr --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address\n const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address\n const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract\n const timestamp = 1571383800 //deputy get this value from the event log of swap contract\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("h3",{id:"deposit-htlt"},"Deposit HTLT"),(0,r.kt)("p",null,"Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap."),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the assets are from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Amount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},'The swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"'),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-1"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token deposit --swap-id --amount 10000:TEST-599 --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const amount = [{\n denom: "TEST-599",\n amount: 10000\n }]\n const res = client.swap.depositHTLT(from, swapID, amount)\n')),(0,r.kt)("p",null,"Example output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("p",null,"After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and the ",(0,r.kt)("inlineCode",{parentName:"p"},"in_amount")," must equal to the amount that you balance decreased."),(0,r.kt)("h3",{id:"claim-htlt"},"Claim HTLT"),(0,r.kt)("p",null,"Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once."),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumber"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"The random number to unlock the locked hash, 32 bytes, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-2"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token claim --swap-id --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt\n const res = client.swap.claimHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("h3",{id:"refund-htlt"},"Refund HTLT"),(0,r.kt)("p",null,"Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token refund --swap-id --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const res = client.swap.refundHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Common error:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Already complete")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Not expired")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}\n')),(0,r.kt)("h3",{id:"query-atomic-swap"},"Query Atomic Swap"),(0,r.kt)("p",null,"Query atomic swap allows you to search swap information by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Expected output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",\n "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",\n "out_amount": [\n {\n "denom": "BNB",\n "amount": "100"\n }\n ],\n "in_amount": [\n {\n "denom": "TEST-599",\n "amount": "10000"\n }\n ],\n "expected_income": "10000:TEST-599",\n "recipient_other_chain": "",\n "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",\n "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",\n "timestamp": "1568792486",\n "cross_chain": false,\n "expire_height": "39994169",\n "index": "53",\n "closed_time": "1568792927",\n "status": "Completed"\n}\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-recipient"},"Query Atomic Swap ID By Recipient"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap recipient address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-recipient --recipient-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",\n "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"\n]\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-creator"},"Query Atomic Swap ID By Creator"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"creator-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap creator address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-creator --creator-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",\n "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",\n "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",\n "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",\n "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"\n]\n')),(0,r.kt)("h2",{id:"fees"},"Fees"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")))),(0,r.kt)("h2",{id:"workflows"},"Workflows"),(0,r.kt)("h3",{id:"preparations"},"Preparations"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Deploy smart-contract which supports Atomic Peg Swap (APS), there is already ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"one example")," for Ethereum"),(0,r.kt)("li",{parentName:"ol"},"Deploy ",(0,r.kt)("inlineCode",{parentName:"li"},"deputy")," process for handling swap activities by token owners, there is an existing open-source solution here: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"https://github.com/bnb-chain/bep3-deputy")),(0,r.kt)("li",{parentName:"ol"},"Issue and transfer enough tokens")),(0,r.kt)("h3",{id:"testnet-deployment"},"Testnet Deployment"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"ERC20 contract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098")),(0,r.kt)("li",{parentName:"ul"},"Token Symbol: ",(0,r.kt)("strong",{parentName:"li"},"PPC")),(0,r.kt)("li",{parentName:"ul"},"SmartContract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad"},"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad")),(0,r.kt)("li",{parentName:"ul"},"Its corresponding address on testnet is: ",(0,r.kt)("inlineCode",{parentName:"li"},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"),"on BNB Beacon Chain and ",(0,r.kt)("inlineCode",{parentName:"li"},"0xD93395B2771914E1679155F3EA58C41d89D96098")," on Ethereum testnet")),(0,r.kt)("h3",{id:"swap-tokens-from-ethereum-to-bnb-beacon-chain"},"Swap Tokens from Ethereum to BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193751444",src:a(60214).Z,width:"874",height:"684"})),(0,r.kt)("h4",{id:"1--approve-swap-transaction"},"1. Approve Swap Transaction"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"this page")," and approve some amount of tokens."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"Approve")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_spender: address of smartcontract, which is ",(0,r.kt)("inlineCode",{parentName:"li"},"0x12DCBf79BE178479870A473A99d91f535ed960AD")),(0,r.kt)("li",{parentName:"ul"},"_value: approved amount, should be bumped by e^10")))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Please approve more than 1token. In the following example, 100 PPC token was approved:")),(0,r.kt)("p",null,"Example of approve 100 PPC on ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xfa640b382d3842cf508ac347090d2550e35e2193804d2a9318fbbdcdd54c846b"},"ropsten testnet")),(0,r.kt)("h4",{id:"2-call-htlt-function-from-ethereum"},"2. Call ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," function From Ethereum"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"smartcontract")," and call ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," function"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"htlt")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array"),(0,r.kt)("li",{parentName:"ul"},"_timestamp: it should be about 10 mins span around current timestamp"),(0,r.kt)("li",{parentName:"ul"},"_heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy."),(0,r.kt)("li",{parentName:"ul"},"_recipientAddr: deputy address on Ethereum, it's ",(0,r.kt)("inlineCode",{parentName:"li"},"0x1C002969Fe201975eD8F054916b071672326858e")," for this one"),(0,r.kt)("li",{parentName:"ul"},"_bep2SenderAddr: omit this field with ",(0,r.kt)("inlineCode",{parentName:"li"},"0x0")),(0,r.kt)("li",{parentName:"ul"},"_bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9"),(0,r.kt)("li",{parentName:"ul"},"_outAmount: approved amount, should be bumped by e^10"),(0,r.kt)("li",{parentName:"ul"},"_bep2Amount: _outAmount * exchange rate, the default rate is 1")))),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xa2444cc1e52e09027ec68bf8955e7084235255f9f18d9b837a12fd63e6f0145c"},"transaction")),(0,r.kt)("h4",{id:"3-deputy-call-htlt-on-bnb-beacon-chain"},"3. Deputy Call HTLT on BNB Beacon Chain"),(0,r.kt)("p",null,"Then, Deputy will send ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/tx/99CBC2896F0CF14DDAB0684BDA0A3E9FF2271056E68EC3559AB7FB24E0EE97DE"},"here")),(0,r.kt)("h4",{id:"4-claim-htlt-on-bnb-beacon-chain"},"4. Claim HTLT on BNB Beacon Chain"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Get the ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID")," on BNB Beacon Chain ")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'./tbnbcli token query-swapIDs-by-recipient --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n[\n "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"\n]\n')),(0,r.kt)("p",null,"You can also get swapID by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/javascript-sdk/blob/91b4d39e96e6433c16a3a1288931f84923075543/src/utils/index.js#L266"},"calculateSwapID in javascript-sdk"),". It requires three parameters:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash in client HTLT transaction on Ethereum"),(0,r.kt)("td",{parentName:"tr",align:null},"5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"deputy bep2 address"),(0,r.kt)("td",{parentName:"tr",align:null},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"senderOtherChain"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"client ethereum address"),(0,r.kt)("td",{parentName:"tr",align:null},"0x133d144f52705ceb3f5801b63b9ebccf4102f5ed")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Query the swap by ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",\n "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",\n "out_amount": [\n {\n "denom": "PPC-00A",\n "amount": "9999999000"\n }\n ],\n "in_amount": null,\n "expected_income": "",\n "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",\n "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",\n "random_number": "",\n "timestamp": "1569497984",\n "cross_chain": true,\n "expire_height": "41380567",\n "index": "1947",\n "closed_time": "",\n "status": "Open"\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Verify parameters in the swap:"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"random_number_hash")," must equal to the randomNumberHash in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"to")," must equals to client wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"timestamp")," must equal to the timestamp in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"out_amount")," should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"expire_height")," must not be passed and should be enough for send claim transaction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Send claim transaction on BNB Beacon Chain "))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token claim --swap-id 12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128 --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," tx on ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/tx/6BA714E6D107F1D9634DDC159F560A1FB61393B8E15723EFD70B9EA8B0B1AA9A?format=json"},"testnet")),(0,r.kt)("h4",{id:"5-deputy-claim-erc20-token"},"5. Deputy Claim ERC20 Token"),(0,r.kt)("p",null,"Deputy will claim ERC20 tokens afterwards with ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x3a422bdb273d4eb4d112ae8e51e8acd3ad706b2af67af20a5f15a18e4acc70fc"},"claim transaction")),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-erc20-to-bep2"},"6. Demo for Client APP: swap erc20 to bep2"),(0,r.kt)("p",null,"This is a javascript implementation for client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," to ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/asset/PPC-00A"},"PPC-00A")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 approve erc20 to swap contract address\n //--------------------------------------------\n const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: erc20ContractAddr,\n value: \'0x00\',\n data: approveData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n //----------------------------------------------------------------------------\n //Step2 call swap contract to send htlt transaction on Ethereum\n //----------------------------------------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 1000\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const amount = 10000000000 // 10000000000:PPC\uff0c decimal is 10\n const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A\n\n const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()\n nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n gasPrice = await web3.eth.getGasPrice()\n gasLimit = 3000000\n rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: htltData\n }\n ethereumjs = require(\'ethereumjs-tx\')\n signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters\n //----------------------------------------------------------------------------\n const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()\n console.log(swapID)\n let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n }\n const atomicSwap = await bnbClient.getSwapByID(swapID)\n console.log(atomicSwap)\n const status = await bnbRPC.status()\n expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)\n expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))\n expect(atomicSwap.result.timestamp).toBe(timestamp)\n expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")\n expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)\n\n //----------------------------------------------------------------------------\n //Step4 claim on BNB Beacon Chain \n //----------------------------------------------------------------------------\n const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)\n console.log(res)\n\n //----------------------------------------------------------------------------\n //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum\n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-tokens-from-bnb-beacon-chain--to-ethereum"},"Swap Tokens from BNB Beacon Chain to Ethereum"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193910521",src:a(52273).Z,width:"778",height:"582"})),(0,r.kt)("h4",{id:"1-send-htlt-transaction-from-bnb-beacon-chain"},"1. Send ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," Transaction from BNB Beacon Chain"),(0,r.kt)("p",null,"Please read this ",(0,r.kt)("a",{parentName:"p",href:"#hash-timer-locked-transfer"},"section")," to generate a valid ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction. Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumber")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumberHash"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr --chain-id Binance-Chain-Ganges --height-span 10000 --amount 9900000000:PPC-00A --expected-income 9900000000:PPC --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\nRandom number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e\nTimestamp: 1569578936\nRandom number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e\nCommitted at block 634510 (\n tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,\n response: {\n Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]\n Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2\n ...\n)\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: the swap amount must be positive.")),(0,r.kt)("p",null,"Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"random number"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"random number hash"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"timestamp")," for next steps."),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/tx/9ECECE9E0F08EE78583CFA37FD4C3F03521289F0F229A612886B8B21B9C62D7F"},"here")),(0,r.kt)("p",null,"Then, you can query the the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"SwapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"You can use this ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters."),(0,r.kt)("h4",{id:"2--deputy-approve-tokens"},"2. Deputy Approve Tokens"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has approve enough amount of tokens for atomic swap."),(0,r.kt)("h4",{id:"3-deputy-send-htlt-on-ethereum"},"3. Deputy Send HTLT on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has sent the ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494"},"transaction")," afterwards"),(0,r.kt)("p",null,"To get the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum, you can check this ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"page"),"\n",(0,r.kt)("strong",{parentName:"p"},"0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e")," is the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum."),(0,r.kt)("h4",{id:"4-claim-erc20-tokens-on-ethereum"},"4. Claim ERC20 Tokens on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has already approved enough tokens and"),(0,r.kt)("p",null,"In its ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"event log"),", you should see the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),". Before calling ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function on ethereum, clients should verify the parameters in the ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," event."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_randomNumberHash")," must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_recipientAddr")," must equal to client ethereum wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_timestamp")," must equal to the timestamp in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_outAmount")," should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_expireHeight")," must not be passed and should be enough for send claim transaction")),(0,r.kt)("p",null,"Then, you can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"claim")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_swapID: this is get from event, you can also calculate it from ",(0,r.kt)("inlineCode",{parentName:"li"},"calSwapID")," function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})"),(0,r.kt)("li",{parentName:"ul"},"_randomNumber: reveal your randomNumber")))),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x9cf7cc7891b86987c4eef59e3b4950324d656e6937a38b91786894f52c76f41b"},"here")),(0,r.kt)("h4",{id:"5-deputy-claim-on-bnb-beacon-chain"},"5. Deputy Claim on BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Claim HTLT")," transaction from ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/tx/8C616DEFD2EAA41E13D2DC4844B218DFF8CFE24B4C7A693AAD700381B5FF7B48"},"sent")," afterwards:"),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-bep2-to-erc20"},"6. Demo for Client APP: swap bep2 to erc20"),(0,r.kt)("p",null,"This is a javascript implementation for client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/asset/PPC-00A"},"PPC-00A")," to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 send htlt on BNB Beacon Chain \n //--------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 10000\n const amount = [{\n denom: "PPC-00A",\n amount: 100000000\n }]\n const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC\n\n bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n await wait(1000)\n\n //----------------------------------------------------------------------------\n //Step2 query swap created by deputy on Ethereum and verify swap parameters\n //----------------------------------------------------------------------------\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()\n console.log(swapID)\n\n let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n while (openSwap._randomNumberHash == \'0x0000000000000000000000000000000000000000000000000000000000000000\') {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n }\n let ethBlock = await web3.eth.getBlock(\'latest\')\n let ethLatestHeight = ethBlock.number\n expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)\n expect(Number(openSwap._timestamp)).toBe(timestamp)\n expect(Number(openSwap._outAmount)).toBe(9999990000)\n expect(openSwap._recipient).toBe(clientEthWalletAddr)\n expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)\n\n //----------------------------------------------------------------------------\n //Step3 claim on Ethereum\n //----------------------------------------------------------------------------\n const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: claimData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain \n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens"},"Swap between Several BEP2 tokens"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193422062",src:a(65441).Z,width:"799",height:"374"})),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens-fails"},"Swap between Several BEP2 tokens fails"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193518929",src:a(13745).Z,width:"828",height:"375"})))}m.isMDXComponent=!0},52273:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/bnc2eth-1a89d1368f58b4690f8ab8feb1ce4e4d.png"},60214:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/eth2bnc-7027f7f9453612ac0464d597ca199c09.png"},65441:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/same-chain-aa9d070f81128cb38dfa878047491dbd.png"},13745:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/samechain-fail-5c962e9308de9851a27e1c62beb67e6e.png"}}]); \ No newline at end of file diff --git a/assets/js/7d79a86a.3997c67c.js b/assets/js/7d79a86a.3997c67c.js deleted file mode 100644 index 2ee3d1de97..0000000000 --- a/assets/js/7d79a86a.3997c67c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[4835],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>b});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=o(a),c=r,b=u["".concat(p,".").concat(c)]||u[c]||m[c]||s;return a?n.createElement(b,l(l({ref:t},d),{},{components:a})):n.createElement(b,l({ref:t},d))}));function b(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,l=new Array(s);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,l[1]=i;for(var o=2;o{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>o});var n=a(83117),r=(a(67294),a(3905));const s={},l=void 0,i={unversionedId:"beaconchain/atomic-swap",id:"beaconchain/atomic-swap",title:"atomic-swap",description:"Introduction",source:"@site/docs/beaconchain/atomic-swap.md",sourceDirName:"beaconchain",slug:"/beaconchain/atomic-swap",permalink:"/docs/beaconchain/atomic-swap",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/atomic-swap.md",tags:[],version:"current",frontMatter:{}},p={},o=[{value:"Introduction",id:"introduction",level:2},{value:"Commands",id:"commands",level:2},{value:"Hash Timer Locked Transfer",id:"hash-timer-locked-transfer",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Outputs",id:"outputs",level:4},{value:"Examples",id:"examples",level:4},{value:"Deposit HTLT",id:"deposit-htlt",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Claim HTLT",id:"claim-htlt",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Examples",id:"examples-2",level:4},{value:"Refund HTLT",id:"refund-htlt",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Query Atomic Swap",id:"query-atomic-swap",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Query Atomic Swap ID By Recipient",id:"query-atomic-swap-id-by-recipient",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Query Atomic Swap ID By Creator",id:"query-atomic-swap-id-by-creator",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Fees",id:"fees",level:2},{value:"Workflows",id:"workflows",level:2},{value:"Preparations",id:"preparations",level:3},{value:"Testnet Deployment",id:"testnet-deployment",level:3},{value:"Swap Tokens from Ethereum to BNB Beacon Chain",id:"swap-tokens-from-ethereum-to-bnb-beacon-chain",level:3},{value:"1. Approve Swap Transaction",id:"1--approve-swap-transaction",level:4},{value:"2. Call HTLT function From Ethereum",id:"2-call-htlt-function-from-ethereum",level:4},{value:"3. Deputy Call HTLT on BNB Beacon Chain",id:"3-deputy-call-htlt-on-bnb-beacon-chain",level:4},{value:"4. Claim HTLT on BNB Beacon Chain",id:"4-claim-htlt-on-bnb-beacon-chain",level:4},{value:"5. Deputy Claim ERC20 Token",id:"5-deputy-claim-erc20-token",level:4},{value:"6. Demo for Client APP: swap erc20 to bep2",id:"6-demo-for-client-app-swap-erc20-to-bep2",level:4},{value:"Swap Tokens from BNB Beacon Chain to Ethereum",id:"swap-tokens-from-bnb-beacon-chain-to-ethereum",level:3},{value:"1. Send HTLT Transaction from BNB Beacon Chain",id:"1-send-htlt-transaction-from-bnb-beacon-chain",level:4},{value:"2. Deputy Approve Tokens",id:"2--deputy-approve-tokens",level:4},{value:"3. Deputy Send HTLT on Ethereum",id:"3-deputy-send-htlt-on-ethereum",level:4},{value:"4. Claim ERC20 Tokens on Ethereum",id:"4-claim-erc20-tokens-on-ethereum",level:4},{value:"5. Deputy Claim on BNB Beacon Chain",id:"5-deputy-claim-on-bnb-beacon-chain",level:4},{value:"6. Demo for Client APP: swap bep2 to erc20",id:"6-demo-for-client-app-swap-bep2-to-erc20",level:4},{value:"Swap between Several BEP2 tokens",id:"swap-between-several-bep2-tokens",level:3},{value:"Swap between Several BEP2 tokens fails",id:"swap-between-several-bep2-tokens-fails",level:3}],d={toc:o},u="wrapper";function m(e){let{components:t,...s}=e;return(0,r.kt)(u,(0,n.Z)({},d,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"As explained in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3"),", Hash Timer Locked Contract(HTLC) has been used for Atomic Swap and cross payment channels between different blockchains. BEP3 defines native transactions to support HTLC on BNB Beacon Chain and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token.\nDuring the swap process, the related fund will be locked to a purely-code-controlled escrow account.\nA purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code of the protocol. The code for calculating escrow account is the same that is used in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/cosmos/cosmos-sdk/blob/82a2c5d6d86ffd761f0162b93f0aaa57b7f66fe7/x/supply/internal/types/account.go#L40"},"cosmos-sdk"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))\n')),(0,r.kt)("p",null,"The account for mainnet is: ",(0,r.kt)("strong",{parentName:"p"},"bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u")," and the account for testnet is: ",(0,r.kt)("strong",{parentName:"p"},"tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d"),". Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts."),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"hash-timer-locked-transfer"},"Hash Timer Locked Transfer"),(0,r.kt)("p",null,"Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain, to serve as HTLC in the first step of Atomic Swap,"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the asset is from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Receiver address, where the asset is to, if the proper condition meets."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of a random number and timestamp, based on SHA256. If left out, a random value will be generated"),(0,r.kt)("td",{parentName:"tr",align:null},"True")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"OutAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},"similar to the Coins in the original Transfer defined in BEP2, assets to swap out"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ExpectedIncome"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},'Expected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HeightSpan"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"CrossChain"),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Specify if the HTLT is for cross chain atomic swap"),(0,r.kt)("td",{parentName:"tr",align:null},"True, the default value is False")))),(0,r.kt)("h4",{id:"outputs"},"Outputs"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number hash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Swap ID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Swap between BEP2 tokens")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --recipient-addr --amount 100:BNB --expected-income --height-span --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }]\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400// height span\n const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example output:")),(0,r.kt)("p",null,"Please take a note of returned ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b\nTimestamp: 1568792486\nRandom number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1\nPassword to sign with 'guest':\nCommitted at block 39984169 (\ntx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,\nresponse: {\n Code:0\n Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n Info: GasWanted:0 GasUsed:0\n ...\n)\n")),(0,r.kt)("p",null,"Besides, the ",(0,r.kt)("inlineCode",{parentName:"p"},"Data")," field in the committed result is the byte array of ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n\nswapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Swap from BNB Beacon Chain to Ethereum")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Clients send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-addr --recipient-other-chain --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Swap from Ethereum to BNB Beacon Chain ")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Once cross-chain is true, --recipient-other-chain must not be empty")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Deputy send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-other-chain --sender-other-chain --recipient-addr --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address\n const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address\n const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract\n const timestamp = 1571383800 //deputy get this value from the event log of swap contract\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("h3",{id:"deposit-htlt"},"Deposit HTLT"),(0,r.kt)("p",null,"Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap."),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the assets are from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Amount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},'The swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"'),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-1"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token deposit --swap-id --amount 10000:TEST-599 --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const amount = [{\n denom: "TEST-599",\n amount: 10000\n }]\n const res = client.swap.depositHTLT(from, swapID, amount)\n')),(0,r.kt)("p",null,"Example output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("p",null,"After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and the ",(0,r.kt)("inlineCode",{parentName:"p"},"in_amount")," must equal to the amount that you balance decreased."),(0,r.kt)("h3",{id:"claim-htlt"},"Claim HTLT"),(0,r.kt)("p",null,"Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once."),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumber"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"The random number to unlock the locked hash, 32 bytes, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-2"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token claim --swap-id --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt\n const res = client.swap.claimHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("h3",{id:"refund-htlt"},"Refund HTLT"),(0,r.kt)("p",null,"Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token refund --swap-id --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const res = client.swap.refundHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Common error:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Already complete")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Not expired")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}\n')),(0,r.kt)("h3",{id:"query-atomic-swap"},"Query Atomic Swap"),(0,r.kt)("p",null,"Query atomic swap allows you to search swap information by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Expected output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",\n "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",\n "out_amount": [\n {\n "denom": "BNB",\n "amount": "100"\n }\n ],\n "in_amount": [\n {\n "denom": "TEST-599",\n "amount": "10000"\n }\n ],\n "expected_income": "10000:TEST-599",\n "recipient_other_chain": "",\n "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",\n "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",\n "timestamp": "1568792486",\n "cross_chain": false,\n "expire_height": "39994169",\n "index": "53",\n "closed_time": "1568792927",\n "status": "Completed"\n}\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-recipient"},"Query Atomic Swap ID By Recipient"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap recipient address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-recipient --recipient-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",\n "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"\n]\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-creator"},"Query Atomic Swap ID By Creator"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"creator-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap creator address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-creator --creator-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",\n "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",\n "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",\n "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",\n "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"\n]\n')),(0,r.kt)("h2",{id:"fees"},"Fees"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")))),(0,r.kt)("h2",{id:"workflows"},"Workflows"),(0,r.kt)("h3",{id:"preparations"},"Preparations"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Deploy smart-contract which supports Atomic Peg Swap (APS), there is already ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"one example")," for Ethereum"),(0,r.kt)("li",{parentName:"ol"},"Deploy ",(0,r.kt)("inlineCode",{parentName:"li"},"deputy")," process for handling swap activities by token owners, there is an existing open-source solution here: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"https://github.com/bnb-chain/bep3-deputy")),(0,r.kt)("li",{parentName:"ol"},"Issue and transfer enough tokens")),(0,r.kt)("h3",{id:"testnet-deployment"},"Testnet Deployment"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"ERC20 contract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098")),(0,r.kt)("li",{parentName:"ul"},"Token Symbol: ",(0,r.kt)("strong",{parentName:"li"},"PPC")),(0,r.kt)("li",{parentName:"ul"},"SmartContract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad"},"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad")),(0,r.kt)("li",{parentName:"ul"},"Its corresponding address on testnet is: ",(0,r.kt)("inlineCode",{parentName:"li"},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"),"on BNB Beacon Chain and ",(0,r.kt)("inlineCode",{parentName:"li"},"0xD93395B2771914E1679155F3EA58C41d89D96098")," on Ethereum testnet")),(0,r.kt)("h3",{id:"swap-tokens-from-ethereum-to-bnb-beacon-chain"},"Swap Tokens from Ethereum to BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193751444",src:a(60214).Z,width:"874",height:"684"})),(0,r.kt)("h4",{id:"1--approve-swap-transaction"},"1. Approve Swap Transaction"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"this page")," and approve some amount of tokens."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"Approve")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_spender: address of the smartcontract, which is ",(0,r.kt)("inlineCode",{parentName:"li"},"0x12DCBf79BE178479870A473A99d91f535ed960AD")),(0,r.kt)("li",{parentName:"ul"},"_value: approved amount, should be bumped by e^10")))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Please approve more than 1 token. In the following example, 100 PPC token was approved:")),(0,r.kt)("p",null,"Example of approve 100 PPC on ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xfa640b382d3842cf508ac347090d2550e35e2193804d2a9318fbbdcdd54c846b"},"ropsten testnet")),(0,r.kt)("h4",{id:"2-call-htlt-function-from-ethereum"},"2. Call ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," function From Ethereum"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"smartcontract")," and call ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," function"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"htlt")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array"),(0,r.kt)("li",{parentName:"ul"},"_timestamp: it should be about 10 mins span around current timestamp"),(0,r.kt)("li",{parentName:"ul"},"_heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy."),(0,r.kt)("li",{parentName:"ul"},"_recipientAddr: deputy address on Ethereum, it's ",(0,r.kt)("inlineCode",{parentName:"li"},"0x1C002969Fe201975eD8F054916b071672326858e")," for this one"),(0,r.kt)("li",{parentName:"ul"},"_bep2SenderAddr: omit this field with ",(0,r.kt)("inlineCode",{parentName:"li"},"0x0")),(0,r.kt)("li",{parentName:"ul"},"_bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9"),(0,r.kt)("li",{parentName:"ul"},"_outAmount: approved amount, should be bumped by e^10"),(0,r.kt)("li",{parentName:"ul"},"_bep2Amount: _outAmount * exchange rate, the default rate is 1")))),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xa2444cc1e52e09027ec68bf8955e7084235255f9f18d9b837a12fd63e6f0145c"},"transaction")),(0,r.kt)("h4",{id:"3-deputy-call-htlt-on-bnb-beacon-chain"},"3. Deputy Call HTLT on BNB Beacon Chain"),(0,r.kt)("p",null,"Then, Deputy will send ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/tx/99CBC2896F0CF14DDAB0684BDA0A3E9FF2271056E68EC3559AB7FB24E0EE97DE"},"here")),(0,r.kt)("h4",{id:"4-claim-htlt-on-bnb-beacon-chain"},"4. Claim HTLT on BNB Beacon Chain"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Get the ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID")," on BNB Beacon Chain ")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'./tbnbcli token query-swapIDs-by-recipient --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n[\n "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"\n]\n')),(0,r.kt)("p",null,"You can also get swapID by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/javascript-sdk/blob/91b4d39e96e6433c16a3a1288931f84923075543/src/utils/index.js#L266"},"calculateSwapID in javascript-sdk"),". It requires three parameters:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash in client HTLT transaction on Ethereum"),(0,r.kt)("td",{parentName:"tr",align:null},"5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"deputy bep2 address"),(0,r.kt)("td",{parentName:"tr",align:null},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"senderOtherChain"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"client ethereum address"),(0,r.kt)("td",{parentName:"tr",align:null},"0x133d144f52705ceb3f5801b63b9ebccf4102f5ed")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Query the swap by ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",\n "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",\n "out_amount": [\n {\n "denom": "PPC-00A",\n "amount": "9999999000"\n }\n ],\n "in_amount": null,\n "expected_income": "",\n "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",\n "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",\n "random_number": "",\n "timestamp": "1569497984",\n "cross_chain": true,\n "expire_height": "41380567",\n "index": "1947",\n "closed_time": "",\n "status": "Open"\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Verify parameters in the swap:"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"random_number_hash")," must equal to the randomNumberHash in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"to")," must equals to client wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"timestamp")," must equal to the timestamp in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"out_amount")," should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"expire_height")," must not be passed and should be enough for send claim transaction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Send claim transaction on BNB Beacon Chain "))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token claim --swap-id 12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128 --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," tx on ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/tx/6BA714E6D107F1D9634DDC159F560A1FB61393B8E15723EFD70B9EA8B0B1AA9A?format=json"},"testnet")),(0,r.kt)("h4",{id:"5-deputy-claim-erc20-token"},"5. Deputy Claim ERC20 Token"),(0,r.kt)("p",null,"Deputy will claim ERC20 tokens afterwards with ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x3a422bdb273d4eb4d112ae8e51e8acd3ad706b2af67af20a5f15a18e4acc70fc"},"claim transaction")),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-erc20-to-bep2"},"6. Demo for Client APP: swap erc20 to bep2"),(0,r.kt)("p",null,"This is a javascript implementation for client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," to ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/asset/PPC-00A"},"PPC-00A")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 approve erc20 to swap contract address\n //--------------------------------------------\n const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: erc20ContractAddr,\n value: \'0x00\',\n data: approveData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n //----------------------------------------------------------------------------\n //Step2 call swap contract to send htlt transaction on Ethereum\n //----------------------------------------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 1000\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const amount = 10000000000 // 10000000000:PPC\uff0c decimal is 10\n const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A\n\n const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()\n nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n gasPrice = await web3.eth.getGasPrice()\n gasLimit = 3000000\n rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: htltData\n }\n ethereumjs = require(\'ethereumjs-tx\')\n signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters\n //----------------------------------------------------------------------------\n const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()\n console.log(swapID)\n let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n }\n const atomicSwap = await bnbClient.getSwapByID(swapID)\n console.log(atomicSwap)\n const status = await bnbRPC.status()\n expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)\n expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))\n expect(atomicSwap.result.timestamp).toBe(timestamp)\n expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")\n expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)\n\n //----------------------------------------------------------------------------\n //Step4 claim on BNB Beacon Chain \n //----------------------------------------------------------------------------\n const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)\n console.log(res)\n\n //----------------------------------------------------------------------------\n //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum\n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-tokens-from-bnb-beacon-chain-to-ethereum"},"Swap Tokens from BNB Beacon Chain to Ethereum"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193910521",src:a(52273).Z,width:"778",height:"582"})),(0,r.kt)("h4",{id:"1-send-htlt-transaction-from-bnb-beacon-chain"},"1. Send ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," Transaction from BNB Beacon Chain"),(0,r.kt)("p",null,"Please read this ",(0,r.kt)("a",{parentName:"p",href:"#hash-timer-locked-transfer"},"section")," to generate a valid ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction. Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumber")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumberHash"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr --chain-id Binance-Chain-Ganges --height-span 10000 --amount 9900000000:PPC-00A --expected-income 9900000000:PPC --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\nRandom number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e\nTimestamp: 1569578936\nRandom number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e\nCommitted at block 634510 (\n tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,\n response: {\n Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]\n Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2\n ...\n)\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: the swap amount must be positive.")),(0,r.kt)("p",null,"Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"random number"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"random number hash"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"timestamp")," for next steps."),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/tx/9ECECE9E0F08EE78583CFA37FD4C3F03521289F0F229A612886B8B21B9C62D7F"},"here")),(0,r.kt)("p",null,"Then, you can query the the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"SwapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"You can use this ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters."),(0,r.kt)("h4",{id:"2--deputy-approve-tokens"},"2. Deputy Approve Tokens"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has approve enough amount of tokens for atomic swap."),(0,r.kt)("h4",{id:"3-deputy-send-htlt-on-ethereum"},"3. Deputy Send HTLT on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has sent the ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494"},"transaction")," afterwards"),(0,r.kt)("p",null,"To get the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum, you can check this ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"page"),"\n",(0,r.kt)("strong",{parentName:"p"},"0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e")," is the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum."),(0,r.kt)("h4",{id:"4-claim-erc20-tokens-on-ethereum"},"4. Claim ERC20 Tokens on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has already approved enough tokens and"),(0,r.kt)("p",null,"In its ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"event log"),", you should see the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),". Before calling ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function on ethereum, clients should verify the parameters in the ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," event."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_randomNumberHash")," must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_recipientAddr")," must equal to client ethereum wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_timestamp")," must equal to the timestamp in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_outAmount")," should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_expireHeight")," must not be passed and should be enough for send claim transaction")),(0,r.kt)("p",null,"Then, you can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"claim")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_swapID: this has been obtained from event, you can also calculate it from ",(0,r.kt)("inlineCode",{parentName:"li"},"calSwapID")," function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})"),(0,r.kt)("li",{parentName:"ul"},"_randomNumber: reveal your randomNumber")))),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x9cf7cc7891b86987c4eef59e3b4950324d656e6937a38b91786894f52c76f41b"},"here")),(0,r.kt)("h4",{id:"5-deputy-claim-on-bnb-beacon-chain"},"5. Deputy Claim on BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Claim HTLT")," transaction from ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/tx/8C616DEFD2EAA41E13D2DC4844B218DFF8CFE24B4C7A693AAD700381B5FF7B48"},"sent")," afterwards:"),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-bep2-to-erc20"},"6. Demo for Client APP: swap bep2 to erc20"),(0,r.kt)("p",null,"This is a javascript implementation of client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.binance.org/asset/PPC-00A"},"PPC-00A")," to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 send htlt on BNB Beacon Chain \n //--------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 10000\n const amount = [{\n denom: "PPC-00A",\n amount: 100000000\n }]\n const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC\n\n bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n await wait(1000)\n\n //----------------------------------------------------------------------------\n //Step2 query swap created by deputy on Ethereum and verify swap parameters\n //----------------------------------------------------------------------------\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()\n console.log(swapID)\n\n let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n while (openSwap._randomNumberHash == \'0x0000000000000000000000000000000000000000000000000000000000000000\') {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n }\n let ethBlock = await web3.eth.getBlock(\'latest\')\n let ethLatestHeight = ethBlock.number\n expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)\n expect(Number(openSwap._timestamp)).toBe(timestamp)\n expect(Number(openSwap._outAmount)).toBe(9999990000)\n expect(openSwap._recipient).toBe(clientEthWalletAddr)\n expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)\n\n //----------------------------------------------------------------------------\n //Step3 claim on Ethereum\n //----------------------------------------------------------------------------\n const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: claimData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain \n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens"},"Swap between Several BEP2 tokens"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193422062",src:a(65441).Z,width:"799",height:"374"})),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens-fails"},"Swap between Several BEP2 tokens fails"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193518929",src:a(13745).Z,width:"828",height:"375"})))}m.isMDXComponent=!0},52273:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/bnc2eth-1a89d1368f58b4690f8ab8feb1ce4e4d.png"},60214:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/eth2bnc-7027f7f9453612ac0464d597ca199c09.png"},65441:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/same-chain-aa9d070f81128cb38dfa878047491dbd.png"},13745:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/samechain-fail-5c962e9308de9851a27e1c62beb67e6e.png"}}]); \ No newline at end of file diff --git a/assets/js/7d79a86a.b59d4d77.js b/assets/js/7d79a86a.b59d4d77.js new file mode 100644 index 0000000000..664f167897 --- /dev/null +++ b/assets/js/7d79a86a.b59d4d77.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[4835],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>b});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function s(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),o=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=o(e.components);return n.createElement(p.Provider,{value:t},e.children)},u="mdxType",m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,s=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=o(a),c=r,b=u["".concat(p,".").concat(c)]||u[c]||m[c]||s;return a?n.createElement(b,l(l({ref:t},d),{},{components:a})):n.createElement(b,l({ref:t},d))}));function b(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=a.length,l=new Array(s);l[0]=c;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i[u]="string"==typeof e?e:r,l[1]=i;for(var o=2;o{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>o});var n=a(83117),r=(a(67294),a(3905));const s={},l=void 0,i={unversionedId:"beaconchain/atomic-swap",id:"beaconchain/atomic-swap",title:"atomic-swap",description:"Introduction",source:"@site/docs/beaconchain/atomic-swap.md",sourceDirName:"beaconchain",slug:"/beaconchain/atomic-swap",permalink:"/docs/beaconchain/atomic-swap",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/atomic-swap.md",tags:[],version:"current",frontMatter:{}},p={},o=[{value:"Introduction",id:"introduction",level:2},{value:"Commands",id:"commands",level:2},{value:"Hash Timer Locked Transfer",id:"hash-timer-locked-transfer",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Outputs",id:"outputs",level:4},{value:"Examples",id:"examples",level:4},{value:"Deposit HTLT",id:"deposit-htlt",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Examples",id:"examples-1",level:4},{value:"Claim HTLT",id:"claim-htlt",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Examples",id:"examples-2",level:4},{value:"Refund HTLT",id:"refund-htlt",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Query Atomic Swap",id:"query-atomic-swap",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Query Atomic Swap ID By Recipient",id:"query-atomic-swap-id-by-recipient",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Query Atomic Swap ID By Creator",id:"query-atomic-swap-id-by-creator",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Fees",id:"fees",level:2},{value:"Workflows",id:"workflows",level:2},{value:"Preparations",id:"preparations",level:3},{value:"Testnet Deployment",id:"testnet-deployment",level:3},{value:"Swap Tokens from Ethereum to BNB Beacon Chain",id:"swap-tokens-from-ethereum-to-bnb-beacon-chain",level:3},{value:"1. Approve Swap Transaction",id:"1--approve-swap-transaction",level:4},{value:"2. Call HTLT function From Ethereum",id:"2-call-htlt-function-from-ethereum",level:4},{value:"3. Deputy Call HTLT on BNB Beacon Chain",id:"3-deputy-call-htlt-on-bnb-beacon-chain",level:4},{value:"4. Claim HTLT on BNB Beacon Chain",id:"4-claim-htlt-on-bnb-beacon-chain",level:4},{value:"5. Deputy Claim ERC20 Token",id:"5-deputy-claim-erc20-token",level:4},{value:"6. Demo for Client APP: swap erc20 to bep2",id:"6-demo-for-client-app-swap-erc20-to-bep2",level:4},{value:"Swap Tokens from BNB Beacon Chain to Ethereum",id:"swap-tokens-from-bnb-beacon-chain-to-ethereum",level:3},{value:"1. Send HTLT Transaction from BNB Beacon Chain",id:"1-send-htlt-transaction-from-bnb-beacon-chain",level:4},{value:"2. Deputy Approve Tokens",id:"2--deputy-approve-tokens",level:4},{value:"3. Deputy Send HTLT on Ethereum",id:"3-deputy-send-htlt-on-ethereum",level:4},{value:"4. Claim ERC20 Tokens on Ethereum",id:"4-claim-erc20-tokens-on-ethereum",level:4},{value:"5. Deputy Claim on BNB Beacon Chain",id:"5-deputy-claim-on-bnb-beacon-chain",level:4},{value:"6. Demo for Client APP: swap bep2 to erc20",id:"6-demo-for-client-app-swap-bep2-to-erc20",level:4},{value:"Swap between Several BEP2 tokens",id:"swap-between-several-bep2-tokens",level:3},{value:"Swap between Several BEP2 tokens fails",id:"swap-between-several-bep2-tokens-fails",level:3}],d={toc:o},u="wrapper";function m(e){let{components:t,...s}=e;return(0,r.kt)(u,(0,n.Z)({},d,s,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"introduction"},"Introduction"),(0,r.kt)("p",null,"As explained in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3"),", Hash Timer Locked Contract(HTLC) has been used for Atomic Swap and cross payment channels between different blockchains. BEP3 defines native transactions to support HTLC on BNB Beacon Chain and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token.\nDuring the swap process, the related fund will be locked to a purely-code-controlled escrow account.\nA purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code of the protocol. The code for calculating escrow account is the same that is used in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/cosmos/cosmos-sdk/blob/82a2c5d6d86ffd761f0162b93f0aaa57b7f66fe7/x/supply/internal/types/account.go#L40"},"cosmos-sdk"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))\n')),(0,r.kt)("p",null,"The account for mainnet is: ",(0,r.kt)("strong",{parentName:"p"},"bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u")," and the account for testnet is: ",(0,r.kt)("strong",{parentName:"p"},"tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d"),". Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts."),(0,r.kt)("h2",{id:"commands"},"Commands"),(0,r.kt)("h3",{id:"hash-timer-locked-transfer"},"Hash Timer Locked Transfer"),(0,r.kt)("p",null,"Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain, to serve as HTLC in the first step of Atomic Swap,"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the asset is from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Receiver address, where the asset is to, if the proper condition meets."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender-other-chain"),(0,r.kt)("td",{parentName:"tr",align:null},"bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"a byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swap"),(0,r.kt)("td",{parentName:"tr",align:null},"Yes")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"hash of a random number and timestamp, based on SHA256. If left out, a random value will be generated"),(0,r.kt)("td",{parentName:"tr",align:null},"True")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used."),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"OutAmount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},"similar to the Coins in the original Transfer defined in BEP2, assets to swap out"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ExpectedIncome"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},'Expected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8'),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HeightSpan"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null},"number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"CrossChain"),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Specify if the HTLT is for cross chain atomic swap"),(0,r.kt)("td",{parentName:"tr",align:null},"True, the default value is False")))),(0,r.kt)("h4",{id:"outputs"},"Outputs"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Timestamp"),(0,r.kt)("td",{parentName:"tr",align:null},"int64"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Random number hash"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Swap ID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples"},"Examples"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Swap between BEP2 tokens")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --recipient-addr --amount 100:BNB --expected-income --height-span --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }]\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400// height span\n const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Example output:")),(0,r.kt)("p",null,"Please take a note of returned ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b\nTimestamp: 1568792486\nRandom number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1\nPassword to sign with 'guest':\nCommitted at block 39984169 (\ntx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,\nresponse: {\n Code:0\n Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n Info: GasWanted:0 GasUsed:0\n ...\n)\n")),(0,r.kt)("p",null,"Besides, the ",(0,r.kt)("inlineCode",{parentName:"p"},"Data")," field in the committed result is the byte array of ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]\n\nswapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Swap from BNB Beacon Chain to Ethereum")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Clients send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-addr --recipient-other-chain --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number\n const timestamp = Math.floor(Date.now()/1000)// take the current timestamp\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Swap from Ethereum to BNB Beacon Chain ")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Once cross-chain is true, --recipient-other-chain must not be empty")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Deputy send HTLT on BNB Beacon Chain on ",(0,r.kt)("em",{parentName:"li"},"testnet"),":")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token HTLT --from --chain-id Binance-Chain-Ganges --height-span --amount --expected-income --recipient-other-chain --sender-other-chain --recipient-addr --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address\n const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address\n const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address\n const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract\n const timestamp = 1571383800 //deputy get this value from the event log of swap contract\n const amount = [{\n denom: "BNB",\n amount: 100\n }] // swap out token amount\n const expectedIncome = "100:BNB"// expected income\n const heightSpan = 400 // height span\n const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n')),(0,r.kt)("h3",{id:"deposit-htlt"},"Deposit HTLT"),(0,r.kt)("p",null,"Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap."),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address, where the assets are from"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Amount"),(0,r.kt)("td",{parentName:"tr",align:null},"Coins"),(0,r.kt)("td",{parentName:"tr",align:null},'The swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"'),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-1"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token deposit --swap-id --amount 10000:TEST-599 --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const amount = [{\n denom: "TEST-599",\n amount: 10000\n }]\n const res = client.swap.depositHTLT(from, swapID, amount)\n')),(0,r.kt)("p",null,"Example output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("p",null,"After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and the ",(0,r.kt)("inlineCode",{parentName:"p"},"in_amount")," must equal to the amount that you balance decreased."),(0,r.kt)("h3",{id:"claim-htlt"},"Claim HTLT"),(0,r.kt)("p",null,"Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once."),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RandomNumber"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"The random number to unlock the locked hash, 32 bytes, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-2"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token claim --swap-id --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt\n const res = client.swap.claimHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0: Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})\n")),(0,r.kt)("h3",{id:"refund-htlt"},"Refund HTLT"),(0,r.kt)("p",null,"Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"From"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Sender address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("p",null,"Command line:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"./tbnbcli token refund --swap-id --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Javascript:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const client = new BncClient("https://testnet-dex.binance.org")\n const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)\n client.setPrivateKey(privateKey)\n const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap\n const res = client.swap.refundHTLT(from, swapID, randomNumber)\n')),(0,r.kt)("p",null,"Common error:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Already complete")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Not expired")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}\n')),(0,r.kt)("h3",{id:"query-atomic-swap"},"Query Atomic Swap"),(0,r.kt)("p",null,"Query atomic swap allows you to search swap information by ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SwapID"),(0,r.kt)("td",{parentName:"tr",align:null},"32 bytes"),(0,r.kt)("td",{parentName:"tr",align:null},"ID of previously created swap, hex encoding"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Expected output"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-json"},'{\n "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",\n "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",\n "out_amount": [\n {\n "denom": "BNB",\n "amount": "100"\n }\n ],\n "in_amount": [\n {\n "denom": "TEST-599",\n "amount": "10000"\n }\n ],\n "expected_income": "10000:TEST-599",\n "recipient_other_chain": "",\n "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",\n "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",\n "timestamp": "1568792486",\n "cross_chain": false,\n "expire_height": "39994169",\n "index": "53",\n "closed_time": "1568792927",\n "status": "Completed"\n}\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-recipient"},"Query Atomic Swap ID By Recipient"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"recipient-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap recipient address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-recipient --recipient-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",\n "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"\n]\n')),(0,r.kt)("h3",{id:"query-atomic-swap-id-by-creator"},"Query Atomic Swap ID By Creator"),(0,r.kt)("p",null,"Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface."),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Optional"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"creator-addr"),(0,r.kt)("td",{parentName:"tr",align:null},"Address"),(0,r.kt)("td",{parentName:"tr",align:null},"Swap creator address"),(0,r.kt)("td",{parentName:"tr",align:null},"No")))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"On testnet:")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swapIDs-by-creator --creator-addr
--chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[\n "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",\n "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",\n "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",\n "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",\n "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"\n]\n')),(0,r.kt)("h2",{id:"fees"},"Fees"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000375 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")))),(0,r.kt)("h2",{id:"workflows"},"Workflows"),(0,r.kt)("h3",{id:"preparations"},"Preparations"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Deploy smart-contract which supports Atomic Peg Swap (APS), there is already ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"one example")," for Ethereum"),(0,r.kt)("li",{parentName:"ol"},"Deploy ",(0,r.kt)("inlineCode",{parentName:"li"},"deputy")," process for handling swap activities by token owners, there is an existing open-source solution here: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"https://github.com/bnb-chain/bep3-deputy")),(0,r.kt)("li",{parentName:"ol"},"Issue and transfer enough tokens")),(0,r.kt)("h3",{id:"testnet-deployment"},"Testnet Deployment"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"ERC20 contract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098")),(0,r.kt)("li",{parentName:"ul"},"Token Symbol: ",(0,r.kt)("strong",{parentName:"li"},"PPC")),(0,r.kt)("li",{parentName:"ul"},"SmartContract has been deployed here: ",(0,r.kt)("a",{parentName:"li",href:"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad"},"https://ropsten.etherscan.io/address/0x12dcbf79be178479870a473a99d91f535ed960ad")),(0,r.kt)("li",{parentName:"ul"},"Its corresponding address on testnet is: ",(0,r.kt)("inlineCode",{parentName:"li"},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"),"on BNB Beacon Chain and ",(0,r.kt)("inlineCode",{parentName:"li"},"0xD93395B2771914E1679155F3EA58C41d89D96098")," on Ethereum testnet")),(0,r.kt)("h3",{id:"swap-tokens-from-ethereum-to-bnb-beacon-chain"},"Swap Tokens from Ethereum to BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193751444",src:a(60214).Z,width:"874",height:"684"})),(0,r.kt)("h4",{id:"1--approve-swap-transaction"},"1. Approve Swap Transaction"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"this page")," and approve some amount of tokens."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"Approve")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_spender: address of the smartcontract, which is ",(0,r.kt)("inlineCode",{parentName:"li"},"0x12DCBf79BE178479870A473A99d91f535ed960AD")),(0,r.kt)("li",{parentName:"ul"},"_value: approved amount, should be bumped by e^10")))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: Please approve more than 1 token. In the following example, 100 PPC token was approved:")),(0,r.kt)("p",null,"Example of approve 100 PPC on ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xfa640b382d3842cf508ac347090d2550e35e2193804d2a9318fbbdcdd54c846b"},"ropsten testnet")),(0,r.kt)("h4",{id:"2-call-htlt-function-from-ethereum"},"2. Call ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," function From Ethereum"),(0,r.kt)("p",null,"Go to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098#writeContract"},"smartcontract")," and call ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," function"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"htlt")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array"),(0,r.kt)("li",{parentName:"ul"},"_timestamp: it should be about 10 mins span around current timestamp"),(0,r.kt)("li",{parentName:"ul"},"_heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy."),(0,r.kt)("li",{parentName:"ul"},"_recipientAddr: deputy address on Ethereum, it's ",(0,r.kt)("inlineCode",{parentName:"li"},"0x1C002969Fe201975eD8F054916b071672326858e")," for this one"),(0,r.kt)("li",{parentName:"ul"},"_bep2SenderAddr: omit this field with ",(0,r.kt)("inlineCode",{parentName:"li"},"0x0")),(0,r.kt)("li",{parentName:"ul"},"_bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9"),(0,r.kt)("li",{parentName:"ul"},"_outAmount: approved amount, should be bumped by e^10"),(0,r.kt)("li",{parentName:"ul"},"_bep2Amount: _outAmount * exchange rate, the default rate is 1")))),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0xa2444cc1e52e09027ec68bf8955e7084235255f9f18d9b837a12fd63e6f0145c"},"transaction")),(0,r.kt)("h4",{id:"3-deputy-call-htlt-on-bnb-beacon-chain"},"3. Deputy Call HTLT on BNB Beacon Chain"),(0,r.kt)("p",null,"Then, Deputy will send ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/tx/99CBC2896F0CF14DDAB0684BDA0A3E9FF2271056E68EC3559AB7FB24E0EE97DE"},"here")),(0,r.kt)("h4",{id:"4-claim-htlt-on-bnb-beacon-chain"},"4. Claim HTLT on BNB Beacon Chain"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Get the ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID")," on BNB Beacon Chain ")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'./tbnbcli token query-swapIDs-by-recipient --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n[\n "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"\n]\n')),(0,r.kt)("p",null,"You can also get swapID by ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/javascript-sdk/blob/91b4d39e96e6433c16a3a1288931f84923075543/src/utils/index.js#L266"},"calculateSwapID in javascript-sdk"),". It requires three parameters:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"randomNumberHash in client HTLT transaction on Ethereum"),(0,r.kt)("td",{parentName:"tr",align:null},"5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"sender"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"deputy bep2 address"),(0,r.kt)("td",{parentName:"tr",align:null},"tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"senderOtherChain"),(0,r.kt)("td",{parentName:"tr",align:null},"string"),(0,r.kt)("td",{parentName:"tr",align:null},"client ethereum address"),(0,r.kt)("td",{parentName:"tr",align:null},"0x133d144f52705ceb3f5801b63b9ebccf4102f5ed")))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Query the swap by ",(0,r.kt)("inlineCode",{parentName:"li"},"swapID"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'{\n "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",\n "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",\n "out_amount": [\n {\n "denom": "PPC-00A",\n "amount": "9999999000"\n }\n ],\n "in_amount": null,\n "expected_income": "",\n "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",\n "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",\n "random_number": "",\n "timestamp": "1569497984",\n "cross_chain": true,\n "expire_height": "41380567",\n "index": "1947",\n "closed_time": "",\n "status": "Open"\n}\n')),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Verify parameters in the swap:"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"random_number_hash")," must equal to the randomNumberHash in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"to")," must equals to client wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"timestamp")," must equal to the timestamp in client HTLT transaction on ethereum"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"out_amount")," should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"expire_height")," must not be passed and should be enough for send claim transaction"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Send claim transaction on BNB Beacon Chain "))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token claim --swap-id 12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128 --random-number --from --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"Example of ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," tx on ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-dex.binance.org/api/v1/tx/6BA714E6D107F1D9634DDC159F560A1FB61393B8E15723EFD70B9EA8B0B1AA9A?format=json"},"testnet")),(0,r.kt)("h4",{id:"5-deputy-claim-erc20-token"},"5. Deputy Claim ERC20 Token"),(0,r.kt)("p",null,"Deputy will claim ERC20 tokens afterwards with ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x3a422bdb273d4eb4d112ae8e51e8acd3ad706b2af67af20a5f15a18e4acc70fc"},"claim transaction")),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-erc20-to-bep2"},"6. Demo for Client APP: swap erc20 to bep2"),(0,r.kt)("p",null,"This is a javascript implementation for client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," to ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/asset/PPC-00A"},"PPC-00A")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 approve erc20 to swap contract address\n //--------------------------------------------\n const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: erc20ContractAddr,\n value: \'0x00\',\n data: approveData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n //----------------------------------------------------------------------------\n //Step2 call swap contract to send htlt transaction on Ethereum\n //----------------------------------------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 1000\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const amount = 10000000000 // 10000000000:PPC\uff0c decimal is 10\n const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A\n\n const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()\n nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n gasPrice = await web3.eth.getGasPrice()\n gasLimit = 3000000\n rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: htltData\n }\n ethereumjs = require(\'ethereumjs-tx\')\n signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters\n //----------------------------------------------------------------------------\n const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()\n console.log(swapID)\n let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)\n }\n const atomicSwap = await bnbClient.getSwapByID(swapID)\n console.log(atomicSwap)\n const status = await bnbRPC.status()\n expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)\n expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))\n expect(atomicSwap.result.timestamp).toBe(timestamp)\n expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")\n expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)\n\n //----------------------------------------------------------------------------\n //Step4 claim on BNB Beacon Chain \n //----------------------------------------------------------------------------\n const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)\n console.log(res)\n\n //----------------------------------------------------------------------------\n //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum\n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-tokens-from-bnb-beacon-chain-to-ethereum"},"Swap Tokens from BNB Beacon Chain to Ethereum"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193910521",src:a(52273).Z,width:"778",height:"582"})),(0,r.kt)("h4",{id:"1-send-htlt-transaction-from-bnb-beacon-chain"},"1. Send ",(0,r.kt)("inlineCode",{parentName:"h4"},"HTLT")," Transaction from BNB Beacon Chain"),(0,r.kt)("p",null,"Please read this ",(0,r.kt)("a",{parentName:"p",href:"#hash-timer-locked-transfer"},"section")," to generate a valid ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," transaction. Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumber")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"randomNumberHash"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr --chain-id Binance-Chain-Ganges --height-span 10000 --amount 9900000000:PPC-00A --expected-income 9900000000:PPC --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\nRandom number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e\nTimestamp: 1569578936\nRandom number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e\nCommitted at block 634510 (\n tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,\n response: {\n Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]\n Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2\n ...\n)\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: the swap amount must be positive.")),(0,r.kt)("p",null,"Please write down the ",(0,r.kt)("inlineCode",{parentName:"p"},"random number"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"random number hash"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"timestamp")," for next steps."),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/tx/9ECECE9E0F08EE78583CFA37FD4C3F03521289F0F229A612886B8B21B9C62D7F"},"here")),(0,r.kt)("p",null,"Then, you can query the the swap by ",(0,r.kt)("inlineCode",{parentName:"p"},"SwapID"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80\n")),(0,r.kt)("p",null,"You can use this ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters."),(0,r.kt)("h4",{id:"2--deputy-approve-tokens"},"2. Deputy Approve Tokens"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has approve enough amount of tokens for atomic swap."),(0,r.kt)("h4",{id:"3-deputy-send-htlt-on-ethereum"},"3. Deputy Send HTLT on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has sent the ",(0,r.kt)("inlineCode",{parentName:"p"},"htlt")," ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494"},"transaction")," afterwards"),(0,r.kt)("p",null,"To get the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum, you can check this ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"page"),"\n",(0,r.kt)("strong",{parentName:"p"},"0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e")," is the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID")," on Ethereum."),(0,r.kt)("h4",{id:"4-claim-erc20-tokens-on-ethereum"},"4. Claim ERC20 Tokens on Ethereum"),(0,r.kt)("p",null,"You should see that ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," has already approved enough tokens and"),(0,r.kt)("p",null,"In its ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x142fb8db7eb66feb241ca710a028678e36595fc8aea03858672288fcac8e4494#eventlog"},"event log"),", you should see the ",(0,r.kt)("inlineCode",{parentName:"p"},"swapID"),". Before calling ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function on ethereum, clients should verify the parameters in the ",(0,r.kt)("inlineCode",{parentName:"p"},"HTLT")," event."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_randomNumberHash")," must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_recipientAddr")," must equal to client ethereum wallet address"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_timestamp")," must equal to the timestamp in client HTLT transaction on BNB Beacon Chain "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_outAmount")," should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"_expireHeight")," must not be passed and should be enough for send claim transaction")),(0,r.kt)("p",null,"Then, you can call the ",(0,r.kt)("inlineCode",{parentName:"p"},"claim")," function:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Function: ",(0,r.kt)("em",{parentName:"li"},"claim")),(0,r.kt)("li",{parentName:"ul"},"Parameters:",(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},"_swapID: this has been obtained from event, you can also calculate it from ",(0,r.kt)("inlineCode",{parentName:"li"},"calSwapID")," function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})"),(0,r.kt)("li",{parentName:"ul"},"_randomNumber: reveal your randomNumber")))),(0,r.kt)("p",null,"Example is ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/tx/0x9cf7cc7891b86987c4eef59e3b4950324d656e6937a38b91786894f52c76f41b"},"here")),(0,r.kt)("h4",{id:"5-deputy-claim-on-bnb-beacon-chain"},"5. Deputy Claim on BNB Beacon Chain"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Claim HTLT")," transaction from ",(0,r.kt)("strong",{parentName:"p"},"Deputy")," is ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/tx/8C616DEFD2EAA41E13D2DC4844B218DFF8CFE24B4C7A693AAD700381B5FF7B48"},"sent")," afterwards:"),(0,r.kt)("h4",{id:"6-demo-for-client-app-swap-bep2-to-erc20"},"6. Demo for Client APP: swap bep2 to erc20"),(0,r.kt)("p",null,"This is a javascript implementation of client app to swap ",(0,r.kt)("a",{parentName:"p",href:"https://testnet-explorer.bnbchain.org/asset/PPC-00A"},"PPC-00A")," to ",(0,r.kt)("a",{parentName:"p",href:"https://ropsten.etherscan.io/address/0xd93395b2771914e1679155f3ea58c41d89d96098"},"PPC")," with deputy."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"\n const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"\n\n const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"\n const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"\n\n const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"\n const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")\n\n const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"\n const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"\n\n const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))\n const bnbClient = new BncClient("https://testnet-dex.binance.org")\n await bnbClient.initChain()\n bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))\n bnbClient.useDefaultSigningDelegate()\n bnbClient.useDefaultBroadcastDelegate()\n const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")\n\n const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)\n const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)\n\n //--------------------------------------------\n //Step1 send htlt on BNB Beacon Chain \n //--------------------------------------------\n const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"\n const timestamp = Math.floor(Date.now()/1000)\n const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")\n const heightSpan = 10000\n const amount = [{\n denom: "PPC-00A",\n amount: 100000000\n }]\n const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC\n\n bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)\n await wait(1000)\n\n //----------------------------------------------------------------------------\n //Step2 query swap created by deputy on Ethereum and verify swap parameters\n //----------------------------------------------------------------------------\n const hexEncodingClientBNBaddr = \'0x\'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")\n const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()\n console.log(swapID)\n\n let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n while (openSwap._randomNumberHash == \'0x0000000000000000000000000000000000000000000000000000000000000000\') {\n console.log("Waiting for the atomic swap created by deputy")\n await wait(5000)\n openSwap = await swapContract.methods.queryOpenSwap(swapID).call()\n }\n let ethBlock = await web3.eth.getBlock(\'latest\')\n let ethLatestHeight = ethBlock.number\n expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)\n expect(Number(openSwap._timestamp)).toBe(timestamp)\n expect(Number(openSwap._outAmount)).toBe(9999990000)\n expect(openSwap._recipient).toBe(clientEthWalletAddr)\n expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)\n\n //----------------------------------------------------------------------------\n //Step3 claim on Ethereum\n //----------------------------------------------------------------------------\n const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()\n let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, \'pending\')\n let gasPrice = await web3.eth.getGasPrice()\n let gasLimit = 3000000\n let rawTx = {\n nonce: web3.utils.toHex(nonce),\n gasPrice: web3.utils.toHex(gasPrice),\n gasLimit: web3.utils.toHex(gasLimit),\n to: swapContractAddr,\n value: \'0x00\',\n data: claimData\n }\n var ethereumjs = require(\'ethereumjs-tx\')\n var signTx = new ethereumjs(rawTx)\n signTx.sign(clientEthWalletKey)\n var serializedTx = signTx.serialize();\n web3.eth.sendSignedTransaction(\'0x\' + serializedTx.toString(\'hex\')).on(\'receipt\', console.log)\n await wait(20000)\n\n //----------------------------------------------------------------------------\n //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain \n //----------------------------------------------------------------------------\n')),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens"},"Swap between Several BEP2 tokens"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193422062",src:a(65441).Z,width:"799",height:"374"})),(0,r.kt)("h3",{id:"swap-between-several-bep2-tokens-fails"},"Swap between Several BEP2 tokens fails"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"image-20190918193518929",src:a(13745).Z,width:"828",height:"375"})))}m.isMDXComponent=!0},52273:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/bnc2eth-1a89d1368f58b4690f8ab8feb1ce4e4d.png"},60214:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/eth2bnc-7027f7f9453612ac0464d597ca199c09.png"},65441:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/same-chain-aa9d070f81128cb38dfa878047491dbd.png"},13745:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/samechain-fail-5c962e9308de9851a27e1c62beb67e6e.png"}}]); \ No newline at end of file diff --git a/assets/js/820a1e19.da91ab7a.js b/assets/js/820a1e19.e11012f2.js similarity index 94% rename from assets/js/820a1e19.da91ab7a.js rename to assets/js/820a1e19.e11012f2.js index c3c8bab358..259ad97848 100644 --- a/assets/js/820a1e19.da91ab7a.js +++ b/assets/js/820a1e19.e11012f2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[3479],{3905:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>k});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var d=n.createContext({}),N=function(t){var e=n.useContext(d),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=N(t.components);return n.createElement(d.Provider,{value:e},t.children)},p="mdxType",u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,d=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),p=N(a),m=r,k=p["".concat(d,".").concat(m)]||p[m]||u[m]||l;return a?n.createElement(k,i(i({ref:e},s),{},{components:a})):n.createElement(k,i({ref:e},s))}));function k(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var d in e)hasOwnProperty.call(e,d)&&(o[d]=e[d]);o.originalType=t,o[p]="string"==typeof t?t:r,i[1]=o;for(var N=2;N{a.r(e),a.d(e,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>o,toc:()=>N});var n=a(83117),r=(a(67294),a(3905));const l={},i="BNB Beacon Chain FAQ",o={unversionedId:"beaconchain/faq/faq",id:"beaconchain/faq/faq",title:"BNB Beacon Chain FAQ",description:"What is BNB Beacon Chain and Binance DEX?",source:"@site/docs/beaconchain/faq/faq.md",sourceDirName:"beaconchain/faq",slug:"/beaconchain/faq/",permalink:"/docs/beaconchain/faq/",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/faq/faq.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"Binance Extension Wallet FAQs",permalink:"/docs/faq"},next:{title:"How to Contribute",permalink:"/docs/contribute"}},d={},N=[{value:"What is BNB Beacon Chain and Binance DEX?",id:"what-is-bnb-beacon-chain-and-binance-dex",level:2},{value:"What is the design principle of BNB Beacon Chain?",id:"what-is-the-design-principle-of-bnb-beacon-chain",level:2},{value:"What can you do on BNB Beacon Chain?",id:"what-can-you-do-on-bnb-beacon-chain",level:2},{value:"Will BNB Beacon Chain introduce more features and transaction types in the future?",id:"will-bnb-beacon-chain-introduce-more-features-and-transaction-types-in-the-future",level:2},{value:"What is the native coin on BNB Beacon Chain?",id:"what-is-the-native-coin-on-bnb-beacon-chain",level:2},{value:"What is the current Fee Table on BNB Beacon Chain Mainnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain-mainnet",level:2},{value:"What is the current Fee Table on BNB Beacon Chain Testnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain-testnet",level:2},{value:"Can I see balances of others or can other people see my balances?",id:"can-i-see-balances-of-others-or-can-other-people-see-my-balances",level:2},{value:"Information provided through API and their usage",id:"information-provided-through-api-and-their-usage",level:2},{value:"Is there any limit to using the API to send orders or check market data?",id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data",level:3},{value:"What does Wallet and API cost to use?",id:"what-does-wallet-and-api-cost-to-use",level:3},{value:"I forgot the private key for my address, how can I get it back?",id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back",level:2},{value:"My private key got stolen by hackers, how can I recover my assets?",id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets",level:2},{value:"What is the Accelerated Node?",id:"what-is-the-accelerated-node",level:2},{value:"How can I issue an asset?",id:"how-can-i-issue-an-asset",level:2},{value:"What is the consensus algorithm used on BNB Beacon Chain?",id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain",level:2},{value:"Can I run a full node for BNB Beacon Chain?",id:"can-i-run-a-full-node-for-bnb-beacon-chain",level:2},{value:"Does BNB Beacon Chain support Smart Contracts?",id:"does-bnb-beacon-chain-support-smart-contracts",level:2},{value:"How can I transfer tokens, such as Bitcoin, from other blockchains onto BNB Beacon Chain?",id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-blockchains-onto-bnb-beacon-chain",level:2},{value:"How would a third-party integrate with BNB Beacon Chain and Binance DEX?",id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex",level:2}],s={toc:N},p="wrapper";function u(t){let{components:e,...a}=t;return(0,r.kt)(p,(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-faq"},"BNB Beacon Chain FAQ"),(0,r.kt)("h2",{id:"what-is-bnb-beacon-chain-and-binance-dex"},"What is BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"BNB Beacon Chain is the blockchain initially developed by Binance and community. Binance DEX, which is disabled now, is the\ndecentralized exchange module developed on top of the BNB Beacon Chain blockchain."),(0,r.kt)("h2",{id:"what-is-the-design-principle-of-bnb-beacon-chain"},"What is the design principle of BNB Beacon Chain?"),(0,r.kt)("p",null,"The main focuses for the design of BNB Beacon Chain are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"No custody of funds:")," traders maintain control of their private keys and funds."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"High performance:")," low latency, high throughput for a large user base, and high liquidity trading.\nWe target to achieve 1 second block times, with 1 confirmation finality."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Low cost:")," in both fees and liquidity cost."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Easy user experience:")," super user friendly UI for a better experience."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Fair trading:")," minimize front-running, to the extent possible."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Evolvable:")," able to develop with forever-improving technology stack, architecture, and ideas.")),(0,r.kt)("h2",{id:"what-can-you-do-on-bnb-beacon-chain"},"What can you do on BNB Beacon Chain?"),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Send and receive BNB"),(0,r.kt)("li",{parentName:"ul"},"Issue new tokens"),(0,r.kt)("li",{parentName:"ul"},"Send, receive, burn/mint and freeze/unfreeze tokens")),(0,r.kt)("h2",{id:"will-bnb-beacon-chain-introduce-more-features-and-transaction-types-in-the-future"},"Will BNB Beacon Chain introduce more features and transaction types in the future?"),(0,r.kt)("p",null,"Yes, BNB Beacon Chain team and community would cherish the technology advancements and recommended trends and strive to make circulation of assets and value easier and easier."),(0,r.kt)("h2",{id:"what-is-the-native-coin-on-bnb-beacon-chain"},"What is the native coin on BNB Beacon Chain?"),(0,r.kt)("p",null,"BNB is the native asset on BNB Beacon Chain. There are 200M BNB coins in total. There will be no mining. The existing coin burns and freezes will still be in effect on the new BNB Beacon Chain blockchain."),(0,r.kt)("p",null,"The exact number of BNB coins will be destroyed based on the same number of BNB ERC20 tokens that have already been destroyed."),(0,r.kt)("p",null,"Since BNB Beacon Chain is live, all BNB ERC20 tokens will be swapped for BNB Beacon Chain coins. All users who hold BNB ERC20 tokens can deposit them to Binance.com, and upon withdrawal, the new\nBNB Beacon Chain native coins will be sent to their new wallets."),(0,r.kt)("h2",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain-mainnet"},"What is the current Fee Table on BNB Beacon Chain Mainnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for ",(0,r.kt)("strong",{parentName:"p"},"Mainnet")," as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-21")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h2",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain-testnet"},"What is the current Fee Table on BNB Beacon Chain Testnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-17")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h2",{id:"can-i-see-balances-of-others-or-can-other-people-see-my-balances"},"Can I see balances of others or can other people see my balances?"),(0,r.kt)("p",null,"Yes, anyone can see anyone's balances if they know the corresponding addresses.\nBNB Beacon Chain is 100% transparent for transactions and balances."),(0,r.kt)("h2",{id:"information-provided-through-api-and-their-usage"},"Information provided through API and their usage"),(0,r.kt)("h3",{id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data"},"Is there any limit to using the API to send orders or check market data?"),(0,r.kt)("p",null,"Yes, there are rate limits to ensure there is no waste or abuse of the network infrastructure.",(0,r.kt)("br",null),"\nPlease check the API documentation."),(0,r.kt)("h3",{id:"what-does-wallet-and-api-cost-to-use"},"What does Wallet and API cost to use?"),(0,r.kt)("p",null,"No fee or commission at all (free to use)."),(0,r.kt)("h2",{id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back"},"I forgot the private key for my address, how can I get it back?"),(0,r.kt)("p",null,"Sorry, you cannot. Owner of the address takes full responsibility for the private key protection.\nBNB Beacon Chain and official wallets do not have your private key."),(0,r.kt)("h2",{id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets"},"My private key got stolen by hackers, how can I recover my assets?"),(0,r.kt)("p",null,"Sorry, you take full responsibility of your private key ownership and protection. BNB Beacon Chain\nand official wallets will not record, or transfer out your private key."),(0,r.kt)("h2",{id:"what-is-the-accelerated-node"},"What is the Accelerated Node?"),(0,r.kt)("p",null,"While users can submit transactions and most of the queries via normal, self-run full nodes.",(0,r.kt)("br",null),"\nAccelerated Node provides more secure and faster lines to access BNB Beacon Chain."),(0,r.kt)("p",null,"Accelerated Node is special infrastructure built around Validator to facilitate accelerated transaction\nrouting and provide richer, faster user interfaces. There are always several Accelerated Nodes running\nat the same time around the world (owned by different organizations) and you are encouraged to choose\none of them to use, or allow your Wallet choose one randomly.",(0,r.kt)("br",null),"\nFor rapid API access, you'd better stay with one Accelerated Node to get better performance."),(0,r.kt)("h2",{id:"how-can-i-issue-an-asset"},"How can I issue an asset?"),(0,r.kt)("p",null,"Anyone can pay a fee and issue an asset as Token on BNB Beacon Chain, as long as they provide\nproper information for the fields below, and then execute the command through the command line or http interfaces."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Name: a description string of less than 21 characters"),(0,r.kt)("li",{parentName:"ul"},"Symbol: an identifier string less than 9 characters, which must be composed of ","[0-9A-Z]"),(0,r.kt)("li",{parentName:"ul"},"Total Supply: a positive number less than or equal to 90 billions"),(0,r.kt)("li",{parentName:"ul"},"Mint-able: whether the token can increase Total Supply in later time or not")),(0,r.kt)("h2",{id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain"},"What is the consensus algorithm used on BNB Beacon Chain?"),(0,r.kt)("p",null,"BNB Beacon Chain uses BFT and PoS (upcoming) based consensus mechanism to produce blocks among\na series of qualified Validators. This is similar to the architectures of several existing\npopular blockchain platforms such as EOS and NEO.\nThe process for setting up validators among different entities on BNB Beacon Chain is currently being defined. More details will be shared at a later date."),(0,r.kt)("h2",{id:"can-i-run-a-full-node-for-bnb-beacon-chain"},"Can I run a full node for BNB Beacon Chain?"),(0,r.kt)("p",null,"Yes, you can. A full node contains all the information and application logic for BNB Beacon Chain.\nIt can receive and broadcast blocks and transactions with other full nodes and even validators.\nThe only exception is it will not participate in the consensus if the full node is not a Validator."),(0,r.kt)("h2",{id:"does-bnb-beacon-chain-support-smart-contracts"},"Does BNB Beacon Chain support Smart Contracts?"),(0,r.kt)("p",null,"No. This was an intentional design decision to improve the performance of the system and eliminate\nhaving to support unnecessary features."),(0,r.kt)("p",null,"If you have certain must-have feature-s, it might be added as a native implementation instead of using smart contract.",(0,r.kt)("br",null),"\nFeel free to talk to BNB Chain community."),(0,r.kt)("h2",{id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-blockchains-onto-bnb-beacon-chain"},"How can I transfer tokens, such as Bitcoin, from other blockchains onto BNB Beacon Chain?"),(0,r.kt)("p",null,"Right now, there are 2 ways to transfer tokens cross-chain:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"via interoperability among different chains. After the latest \u201cArchimedes\u201d upgrade, ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3")," was introduced and it defines native transactions to support ",(0,r.kt)("a",{parentName:"li",href:"https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts"},"Hash Timelock Contract (HTLC)")," on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.vision/blockchain/atomic-swaps-explained"},"atomic swap")," to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including\uff1a")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"smart-contract solution")," that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"deputy process")," written in GoLang that handles swap activities")),(0,r.kt)("p",null,"Any developer is welcome to test the solutions in testnet and then use them in mainnet."),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"via Binance.com. ",(0,r.kt)("a",{parentName:"li",href:"https://wwww.binance.com"},"Binance"),",the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/BCH-1FD"},"BEP2 BCH"),",",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/XRP-BF2"},"BEP2 XRP"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/LTC-F07"},"BEP2 LTC"),". Pegged tokens such as ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", are 100% backed by the native coin in ",(0,r.kt)("a",{parentName:"li",href:"https://btc.com/3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"},"reserve"),". The reserve addresses are published for anyone to audit. Read this ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.com/en/blog/347360878904684544/Introducing-BitcoinPegged-Token-on-Binance-Chain"},"blog")," to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.")),(0,r.kt)("p",null,"Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them."),(0,r.kt)("p",null,"Please do ",(0,r.kt)("strong",{parentName:"p"},"NOT")," try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins."),(0,r.kt)("h2",{id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex"},"How would a third-party integrate with BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"A wallet provider may choose to support the feature set of BNB Beacon Chain, which would cover wallets, addresses, balances, transfers and etc.",(0,r.kt)("br",null)))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[3479],{3905:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>k});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var d=n.createContext({}),N=function(t){var e=n.useContext(d),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=N(t.components);return n.createElement(d.Provider,{value:e},t.children)},p="mdxType",u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},m=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,d=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),p=N(a),m=r,k=p["".concat(d,".").concat(m)]||p[m]||u[m]||l;return a?n.createElement(k,i(i({ref:e},s),{},{components:a})):n.createElement(k,i({ref:e},s))}));function k(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=m;var o={};for(var d in e)hasOwnProperty.call(e,d)&&(o[d]=e[d]);o.originalType=t,o[p]="string"==typeof t?t:r,i[1]=o;for(var N=2;N{a.r(e),a.d(e,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>o,toc:()=>N});var n=a(83117),r=(a(67294),a(3905));const l={},i="BNB Beacon Chain FAQ",o={unversionedId:"beaconchain/faq/faq",id:"beaconchain/faq/faq",title:"BNB Beacon Chain FAQ",description:"What is BNB Beacon Chain and Binance DEX?",source:"@site/docs/beaconchain/faq/faq.md",sourceDirName:"beaconchain/faq",slug:"/beaconchain/faq/",permalink:"/docs/beaconchain/faq/",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/faq/faq.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"Binance Extension Wallet FAQs",permalink:"/docs/faq"},next:{title:"How to Contribute",permalink:"/docs/contribute"}},d={},N=[{value:"What is BNB Beacon Chain and Binance DEX?",id:"what-is-bnb-beacon-chain-and-binance-dex",level:2},{value:"What is the design principle of BNB Beacon Chain?",id:"what-is-the-design-principle-of-bnb-beacon-chain",level:2},{value:"What can you do on BNB Beacon Chain?",id:"what-can-you-do-on-bnb-beacon-chain",level:2},{value:"Will BNB Beacon Chain introduce more features and transaction types in the future?",id:"will-bnb-beacon-chain-introduce-more-features-and-transaction-types-in-the-future",level:2},{value:"What is the native coin on BNB Beacon Chain?",id:"what-is-the-native-coin-on-bnb-beacon-chain",level:2},{value:"What is the current Fee Table on BNB Beacon Chain Mainnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain-mainnet",level:2},{value:"What is the current Fee Table on BNB Beacon Chain Testnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain-testnet",level:2},{value:"Can I see balances of others or can other people see my balances?",id:"can-i-see-balances-of-others-or-can-other-people-see-my-balances",level:2},{value:"Information provided through API and their usage",id:"information-provided-through-api-and-their-usage",level:2},{value:"Is there any limit to using the API to send orders or check market data?",id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data",level:3},{value:"What does Wallet and API cost to use?",id:"what-does-wallet-and-api-cost-to-use",level:3},{value:"I forgot the private key for my address, how can I get it back?",id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back",level:2},{value:"My private key got stolen by hackers, how can I recover my assets?",id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets",level:2},{value:"What is the Accelerated Node?",id:"what-is-the-accelerated-node",level:2},{value:"How can I issue an asset?",id:"how-can-i-issue-an-asset",level:2},{value:"What is the consensus algorithm used on BNB Beacon Chain?",id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain",level:2},{value:"Can I run a full node for BNB Beacon Chain?",id:"can-i-run-a-full-node-for-bnb-beacon-chain",level:2},{value:"Does BNB Beacon Chain support Smart Contracts?",id:"does-bnb-beacon-chain-support-smart-contracts",level:2},{value:"How can I transfer tokens, such as Bitcoin, from other blockchains onto BNB Beacon Chain?",id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-blockchains-onto-bnb-beacon-chain",level:2},{value:"How would a third-party integrate with BNB Beacon Chain and Binance DEX?",id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex",level:2}],s={toc:N},p="wrapper";function u(t){let{components:e,...a}=t;return(0,r.kt)(p,(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-faq"},"BNB Beacon Chain FAQ"),(0,r.kt)("h2",{id:"what-is-bnb-beacon-chain-and-binance-dex"},"What is BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"BNB Beacon Chain is the blockchain initially developed by Binance and community. Binance DEX, which is disabled now, is the\ndecentralized exchange module developed on top of the BNB Beacon Chain blockchain."),(0,r.kt)("h2",{id:"what-is-the-design-principle-of-bnb-beacon-chain"},"What is the design principle of BNB Beacon Chain?"),(0,r.kt)("p",null,"The main focuses for the design of BNB Beacon Chain are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"No custody of funds:")," traders maintain control of their private keys and funds."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"High performance:")," low latency, high throughput for a large user base, and high liquidity trading.\nWe target to achieve 1 second block times, with 1 confirmation finality."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Low cost:")," in both fees and liquidity cost."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Easy user experience:")," super user friendly UI for a better experience."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Fair trading:")," minimize front-running, to the extent possible."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"Evolvable:")," able to develop with forever-improving technology stack, architecture, and ideas.")),(0,r.kt)("h2",{id:"what-can-you-do-on-bnb-beacon-chain"},"What can you do on BNB Beacon Chain?"),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Send and receive BNB"),(0,r.kt)("li",{parentName:"ul"},"Issue new tokens"),(0,r.kt)("li",{parentName:"ul"},"Send, receive, burn/mint and freeze/unfreeze tokens")),(0,r.kt)("h2",{id:"will-bnb-beacon-chain-introduce-more-features-and-transaction-types-in-the-future"},"Will BNB Beacon Chain introduce more features and transaction types in the future?"),(0,r.kt)("p",null,"Yes, BNB Beacon Chain team and community would cherish the technology advancements and recommended trends and strive to make circulation of assets and value easier and easier."),(0,r.kt)("h2",{id:"what-is-the-native-coin-on-bnb-beacon-chain"},"What is the native coin on BNB Beacon Chain?"),(0,r.kt)("p",null,"BNB is the native asset on BNB Beacon Chain. There are 200M BNB coins in total. There will be no mining. The existing coin burns and freezes will still be in effect on the new BNB Beacon Chain blockchain."),(0,r.kt)("p",null,"The exact number of BNB coins will be destroyed based on the same number of BNB ERC20 tokens that have already been destroyed."),(0,r.kt)("p",null,"Since BNB Beacon Chain is live, all BNB ERC20 tokens will be swapped for BNB Beacon Chain coins. All users who hold BNB ERC20 tokens can deposit them to Binance.com, and upon withdrawal, the new\nBNB Beacon Chain native coins will be sent to their new wallets."),(0,r.kt)("h2",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain-mainnet"},"What is the current Fee Table on BNB Beacon Chain Mainnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for ",(0,r.kt)("strong",{parentName:"p"},"Mainnet")," as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-21")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h2",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain-testnet"},"What is the current Fee Table on BNB Beacon Chain Testnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-17")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h2",{id:"can-i-see-balances-of-others-or-can-other-people-see-my-balances"},"Can I see balances of others or can other people see my balances?"),(0,r.kt)("p",null,"Yes, anyone can see anyone's balances if they know the corresponding addresses.\nBNB Beacon Chain is 100% transparent for transactions and balances."),(0,r.kt)("h2",{id:"information-provided-through-api-and-their-usage"},"Information provided through API and their usage"),(0,r.kt)("h3",{id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data"},"Is there any limit to using the API to send orders or check market data?"),(0,r.kt)("p",null,"Yes, there are rate limits to ensure there is no waste or abuse of the network infrastructure.",(0,r.kt)("br",null),"\nPlease check the API documentation."),(0,r.kt)("h3",{id:"what-does-wallet-and-api-cost-to-use"},"What does Wallet and API cost to use?"),(0,r.kt)("p",null,"No fee or commission at all (free to use)."),(0,r.kt)("h2",{id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back"},"I forgot the private key for my address, how can I get it back?"),(0,r.kt)("p",null,"Sorry, you cannot. Owner of the address takes full responsibility for the private key protection.\nBNB Beacon Chain and official wallets do not have your private key."),(0,r.kt)("h2",{id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets"},"My private key got stolen by hackers, how can I recover my assets?"),(0,r.kt)("p",null,"Sorry, you take full responsibility of your private key ownership and protection. BNB Beacon Chain\nand official wallets will not record, or transfer out your private key."),(0,r.kt)("h2",{id:"what-is-the-accelerated-node"},"What is the Accelerated Node?"),(0,r.kt)("p",null,"While users can submit transactions and most of the queries via normal, self-run full nodes.",(0,r.kt)("br",null),"\nAccelerated Node provides more secure and faster lines to access BNB Beacon Chain."),(0,r.kt)("p",null,"Accelerated Node is special infrastructure built around Validator to facilitate accelerated transaction\nrouting and provide richer, faster user interfaces. There are always several Accelerated Nodes running\nat the same time around the world (owned by different organizations) and you are encouraged to choose\none of them to use, or allow your Wallet choose one randomly.",(0,r.kt)("br",null),"\nFor rapid API access, you'd better stay with one Accelerated Node to get better performance."),(0,r.kt)("h2",{id:"how-can-i-issue-an-asset"},"How can I issue an asset?"),(0,r.kt)("p",null,"Anyone can pay a fee and issue an asset as Token on BNB Beacon Chain, as long as they provide\nproper information for the fields below, and then execute the command through the command line or http interfaces."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Name: a description string of less than 21 characters"),(0,r.kt)("li",{parentName:"ul"},"Symbol: an identifier string less than 9 characters, which must be composed of ","[0-9A-Z]"),(0,r.kt)("li",{parentName:"ul"},"Total Supply: a positive number less than or equal to 90 billions"),(0,r.kt)("li",{parentName:"ul"},"Mint-able: whether the token can increase Total Supply in later time or not")),(0,r.kt)("h2",{id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain"},"What is the consensus algorithm used on BNB Beacon Chain?"),(0,r.kt)("p",null,"BNB Beacon Chain uses BFT and PoS (upcoming) based consensus mechanism to produce blocks among\na series of qualified Validators. This is similar to the architectures of several existing\npopular blockchain platforms such as EOS and NEO.\nThe process for setting up validators among different entities on BNB Beacon Chain is currently being defined. More details will be shared at a later date."),(0,r.kt)("h2",{id:"can-i-run-a-full-node-for-bnb-beacon-chain"},"Can I run a full node for BNB Beacon Chain?"),(0,r.kt)("p",null,"Yes, you can. A full node contains all the information and application logic for BNB Beacon Chain.\nIt can receive and broadcast blocks and transactions with other full nodes and even validators.\nThe only exception is it will not participate in the consensus if the full node is not a Validator."),(0,r.kt)("h2",{id:"does-bnb-beacon-chain-support-smart-contracts"},"Does BNB Beacon Chain support Smart Contracts?"),(0,r.kt)("p",null,"No. This was an intentional design decision to improve the performance of the system and eliminate\nhaving to support unnecessary features."),(0,r.kt)("p",null,"If you have certain must-have feature-s, it might be added as a native implementation instead of using smart contract.",(0,r.kt)("br",null),"\nFeel free to talk to BNB Chain community."),(0,r.kt)("h2",{id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-blockchains-onto-bnb-beacon-chain"},"How can I transfer tokens, such as Bitcoin, from other blockchains onto BNB Beacon Chain?"),(0,r.kt)("p",null,"Right now, there are 2 ways to transfer tokens cross-chain:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"via interoperability among different chains. After the latest \u201cArchimedes\u201d upgrade, ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3")," was introduced and it defines native transactions to support ",(0,r.kt)("a",{parentName:"li",href:"https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts"},"Hash Timelock Contract (HTLC)")," on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.vision/blockchain/atomic-swaps-explained"},"atomic swap")," to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including\uff1a")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"smart-contract solution")," that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"deputy process")," written in GoLang that handles swap activities")),(0,r.kt)("p",null,"Any developer is welcome to test the solutions in testnet and then use them in mainnet."),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"via Binance.com. ",(0,r.kt)("a",{parentName:"li",href:"https://wwww.binance.com"},"Binance"),",the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/BCH-1FD"},"BEP2 BCH"),",",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/XRP-BF2"},"BEP2 XRP"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/LTC-F07"},"BEP2 LTC"),". Pegged tokens such as ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", are 100% backed by the native coin in ",(0,r.kt)("a",{parentName:"li",href:"https://btc.com/3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"},"reserve"),". The reserve addresses are published for anyone to audit. Read this ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.com/en/blog/347360878904684544/Introducing-BitcoinPegged-Token-on-Binance-Chain"},"blog")," to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.")),(0,r.kt)("p",null,"Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them."),(0,r.kt)("p",null,"Please do ",(0,r.kt)("strong",{parentName:"p"},"NOT")," try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins."),(0,r.kt)("h2",{id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex"},"How would a third-party integrate with BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"A wallet provider may choose to support the feature set of BNB Beacon Chain, which would cover wallets, addresses, balances, transfers and etc.",(0,r.kt)("br",null)))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/864b21f2.33d27170.js b/assets/js/864b21f2.33d27170.js new file mode 100644 index 0000000000..7fbc92d5b9 --- /dev/null +++ b/assets/js/864b21f2.33d27170.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[6266],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),s=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=s(e.components);return n.createElement(d.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=s(a),h=r,m=c["".concat(d,".").concat(h)]||c[h]||u[h]||l;return a?n.createElement(m,i(i({ref:t},p),{},{components:a})):n.createElement(m,i({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o[c]="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(83117),r=(a(67294),a(3905));const l={sidebar_label:"BC FAQs",sidebar_position:2,hide_table_of_contents:!0},i="BNB Beacon Chain FAQs",o={unversionedId:"BC-FAQs",id:"BC-FAQs",title:"BNB Beacon Chain FAQs",description:"What is BNB Beacon Chain and Binance DEX?",source:"@site/docs/BC-FAQs.md",sourceDirName:".",slug:"/BC-FAQs",permalink:"/docs/BC-FAQs",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/BC-FAQs.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_label:"BC FAQs",sidebar_position:2,hide_table_of_contents:!0}},d={},s=[{value:"What is BNB Beacon Chain and Binance DEX?",id:"what-is-bnb-beacon-chain-and-binance-dex",level:3},{value:"What is the design principle of BNB Beacon Chain ?",id:"what-is-the-design-principle-of-bnb-beacon-chain-",level:3},{value:"What can you do on BNB Beacon Chain ?",id:"what-can-you-do-on-bnb-beacon-chain-",level:3},{value:"Will BNB Beacon Chain introduce more features and transaction types in the future?",id:"will-bnb-beacon-chain--introduce-more-features-and-transaction-types-in-the-future",level:3},{value:"What is the native coin on BNB Beacon Chain ?",id:"what-is-the-native-coin-on-bnb-beacon-chain-",level:3},{value:"How can I register on BNB Beacon Chain /DEX and start trading?",id:"how-can-i-register-on-bnb-beacon-chain-dex-and-start-trading",level:3},{value:"How can I send orders on Binance DEX?",id:"how-can-i-send-orders-on-binance-dex",level:3},{value:"Order",id:"order",level:4},{value:"What is Immediate Or Cancel order?",id:"what-is-immediate-or-cancel-order",level:4},{value:"Match",id:"match",level:4},{value:"Trade",id:"trade",level:4},{value:"What is Order Expire?",id:"what-is-order-expire",level:4},{value:"Where can I see my assets and trades?",id:"where-can-i-see-my-assets-and-trades",level:4},{value:"When can I see my order on the blockchain after I send it?",id:"when-can-i-see-my-order-on-the-blockchain-after-i-send-it",level:4},{value:"What is the Fee Structure?",id:"what-is-the-fee-structure",level:4},{value:"What is the current Fee Table on BNB Beacon Chain Mainnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain--mainnet",level:3},{value:"What is the current Fee Table on BNB Beacon Chain Testnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain--testnet",level:3},{value:"Can I see orders/balances of others or can other people see my orders/balances?",id:"can-i-see-ordersbalances-of-others-or-can-other-people-see-my-ordersbalances",level:3},{value:"Information provided through API and their usage",id:"information-provided-through-api-and-their-usage",level:3},{value:"Is there any limit to using the API to send orders or check market data?",id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data",level:4},{value:"What does Wallet and API cost to use?",id:"what-does-wallet-and-api-cost-to-use",level:4},{value:"What Market Data can I get?",id:"what-market-data-can-i-get",level:4},{value:"What are the tick size and lot size? Are they fixed?",id:"what-are-the-tick-size-and-lot-size-are-they-fixed",level:4},{value:"Are there limits on notional value of an order?",id:"are-there-limits-on-notional-value-of-an-order",level:4},{value:"What is the decimal precision for prices and quantities on BNB Beacon Chain /DEX?",id:"what-is-the-decimal-precision-for-prices-and-quantities-on-bnb-beacon-chain-dex",level:3},{value:"I forgot the private key for my address, how can I get it back?",id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back",level:3},{value:"My private key got stolen by hackers, how can I recover my assets?",id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets",level:3},{value:"What is the Accelerated Node?",id:"what-is-the-accelerated-node",level:3},{value:"How can I issue an asset?",id:"how-can-i-issue-an-asset",level:3},{value:"What is the consensus algorithm used on BNB Beacon Chain ?",id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain-",level:3},{value:"Can I run a full node for BNB Beacon Chain ?",id:"can-i-run-a-full-node-for-bnb-beacon-chain-",level:3},{value:"Does BNB Beacon Chain support Smart Contracts?",id:"does-bnb-beacon-chain-support-smart-contracts",level:3},{value:"How can I transfer tokens, such as Bitcoin, from other block chains onto BNB Beacon Chain ?",id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-block-chains-onto-bnb-beacon-chain-",level:3},{value:"How is a trading pair created on Binance DEX?",id:"how-is-a-trading-pair-created-on-binance-dex",level:3},{value:"How would a third-party integrate with BNB Beacon Chain and Binance DEX?",id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex",level:3}],p={toc:s},c="wrapper";function u(e){let{components:t,...a}=e;return(0,r.kt)(c,(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-faqs"},"BNB Beacon Chain FAQs"),(0,r.kt)("h3",{id:"what-is-bnb-beacon-chain-and-binance-dex"},"What is BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"BNB Beacon Chain is the blockchain initially developed by Binance and community. Binance DEX is the decentralized exchange module developed on top of the BNB Beacon Chain blockchain."),(0,r.kt)("h3",{id:"what-is-the-design-principle-of-bnb-beacon-chain-"},"What is the design principle of BNB Beacon Chain ?"),(0,r.kt)("p",null,"The main focuses for the design of BNB Beacon Chain are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"No custody of funds: traders maintain control of their private keys and funds."),(0,r.kt)("li",{parentName:"ul"},"High performance: low latency, high throughput for a large user base, and high liquidity trading.\nWe target to achieve 1 second block times, with 1 confirmation finality."),(0,r.kt)("li",{parentName:"ul"},"Low cost: in both fees and liquidity cost."),(0,r.kt)("li",{parentName:"ul"},"Easy user experience"),(0,r.kt)("li",{parentName:"ul"},"Fair trading: minimize front-running, to the extent possible."),(0,r.kt)("li",{parentName:"ul"},"Evolvable: able to develop with forever-improving technology stack, architecture, and ideas.")),(0,r.kt)("h3",{id:"what-can-you-do-on-bnb-beacon-chain-"},"What can you do on BNB Beacon Chain ?"),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Send and receive BNB"),(0,r.kt)("li",{parentName:"ul"},"Issue new tokens"),(0,r.kt)("li",{parentName:"ul"},"Send, receive, burn/mint and freeze/unfreeze tokens"),(0,r.kt)("li",{parentName:"ul"},"Propose to create trading pairs between two different tokens"),(0,r.kt)("li",{parentName:"ul"},"Send orders to buy or sell assets through trading pairs created on the chain")),(0,r.kt)("h3",{id:"will-bnb-beacon-chain--introduce-more-features-and-transaction-types-in-the-future"},"Will BNB Beacon Chain introduce more features and transaction types in the future?"),(0,r.kt)("p",null,"Yes, BNB Beacon Chain team and community would cherish the technology advancements and recommended trends and strive to make circulation of assets and value easier and easier."),(0,r.kt)("h3",{id:"what-is-the-native-coin-on-bnb-beacon-chain-"},"What is the native coin on BNB Beacon Chain ?"),(0,r.kt)("p",null,"The Build N Build Coin, BNB, is the native asset on BNB Beacon Chain . There are 200MM BNB coins in total.\nThere will be no mining. The existing coin burns and freezes will still be in effect on the new\nBNB Beacon Chain blockchain."),(0,r.kt)("p",null,"The exact number of BNB coins will be destroyed based on the same number of BNB ERC20 tokens\nthat have already been destroyed."),(0,r.kt)("p",null,"Since BNB Beacon Chain is live, all BNB ERC20 tokens will be swapped for BNB Beacon Chain coins. All\nusers who hold BNB ERC20 tokens can deposit them to Binance.com, and upon withdrawal, the new\nBNB Beacon Chain native coins will be sent to their new wallets."),(0,r.kt)("h3",{id:"how-can-i-register-on-bnb-beacon-chain-dex-and-start-trading"},"How can I register on BNB Beacon Chain /DEX and start trading?"),(0,r.kt)("p",null,"There is no need to register. All you need is a BNB Beacon Chain address, which can be generated with\nany ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/wallets.md"},"wallet")," that supports BNB Beacon Chain . Then you can trade BNB or other assets stored on that address."),(0,r.kt)("h3",{id:"how-can-i-send-orders-on-binance-dex"},"How can I send orders on Binance DEX?"),(0,r.kt)("h4",{id:"order"},"Order"),(0,r.kt)("p",null,'On Binance DEX, you can send "new order" messages to buy or sell certain assets. You can also\nsend "cancel" messages to cancel existing open orders.'),(0,r.kt)("p",null,"You can use a wallet to send new orders and cancels. Binance DEX also provides API for automated trading."),(0,r.kt)("p",null,"In Binance DEX v1.0, the order message contains:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Symbol: trading pair on the chain"),(0,r.kt)("li",{parentName:"ul"},"Side: buy or sell"),(0,r.kt)("li",{parentName:"ul"},"Price: only limit price orders are supported in BNB Beacon Chain v1.0"),(0,r.kt)("li",{parentName:"ul"},"Amount"),(0,r.kt)("li",{parentName:"ul"},"Time In Force: Binance DEX supports ",(0,r.kt)("inlineCode",{parentName:"li"},"Immediate Or Cancel")," (IOC) and ",(0,r.kt)("inlineCode",{parentName:"li"},"Good Till Expiry"),' (GTE)\norders. GTE orders can quote on the exchange until they are filled by the opposite orders satisfying\nthe limit price, or canceled by client themselves, or expire after 72 hours after 00:00 (UTC).\nCheck the "What is ',(0,r.kt)("inlineCode",{parentName:"li"},"Order Expire"),'" section of the FAQ for more information.')),(0,r.kt)("p",null,"Network nodes examine orders to ensure they are valid. Once the orders are accepted, they are\nbooked on the next block, and get matched accordingly."),(0,r.kt)("h4",{id:"what-is-immediate-or-cancel-order"},"What is ",(0,r.kt)("inlineCode",{parentName:"h4"},"Immediate Or Cancel order"),"?"),(0,r.kt)("p",null,"Immediate Or Cancel is a special order type. Once the order is accepted into a block, Immediate Or\nCancel orders only exist in this block round. The order may get filled to zero, or partially or fully\nfilled by other orders, and then will become expired and removed from the order book right away.\nAs a result, it will not be tradable in the next round of matching. A small fee will be charged\nfor the network usage, if there is no fill at all for the order (deemed as no intention to trade)."),(0,r.kt)("h4",{id:"match"},"Match"),(0,r.kt)("p",null,"Binance DEX does all of its matching on the blockchain, i.e. all nodes perform the matches and\nexpect the same result. This is to ensure the maximum transparency and to mitigate the chance\nfor front-running, even from the block producers. The matching infrastructure is expected to\nevolve and grow in capacity as time progresses."),(0,r.kt)("p",null,"Binance DEX doesn't do continuous matching as most centralized exchanges do. Instead, it matches\nusing periodic auction matching for all the existing open orders received in the past and the\nlatest blocks. The match logic is explained in more detail later."),(0,r.kt)("h4",{id:"trade"},"Trade"),(0,r.kt)("p",null,"Once the orders are filled, the corresponding assets will be automatically moved into buyers'\naddresses. The confirmation is instant and no need to wait for further blocks (i.e. T+0 block).\nBuyers can use the bought asset right away, either send it to another address or trade it again."),(0,r.kt)("h4",{id:"what-is-order-expire"},"What is ",(0,r.kt)("inlineCode",{parentName:"h4"},"Order Expire"),"?"),(0,r.kt)("p",null,"Orders accepted by Binance DEX will either get filled with other orders or remain in the order book,\nbut they will not stay on the order book forever. These orders will expire and be removed from the\norder book after the 1st midnight (UTC) after 72 hours once the order gets accepted. A small fee\nwill be charged for the network usage, if there is no fill at all for the order (deemed as no intention to trade)."),(0,r.kt)("h4",{id:"where-can-i-see-my-assets-and-trades"},"Where can I see my assets and trades?"),(0,r.kt)("p",null,"You can always use wallets that support BNB Beacon Chain to check your asset balances, open orders,\nand (optionally) order/trade history. BNB Beacon Chain Explorer is another tool to check balances\nand transactions."),(0,r.kt)("h4",{id:"when-can-i-see-my-order-on-the-blockchain-after-i-send-it"},"When can I see my order on the blockchain after I send it?"),(0,r.kt)("p",null,"It depends. Normally, if you connect to one of the Accelerated Nodes, your orders should get\naccepted and booked into a block in 1-3 seconds. If the order price is marketable, the order\nwill be filled and trades will come back in about similar time. If you send the order from far-way\n(self-setup full node), or there is heavy network traffic, the order may take longer to reach\na Validator (block producer)."),(0,r.kt)("h4",{id:"what-is-the-fee-structure"},"What is the Fee Structure?"),(0,r.kt)("p",null,"Fees are charged and shared among the block producers (i.e. Validators) to run the network,\nin order to pay for the network usage and prevent abuse and attack. Since all user transactions,\ninclude transfer, new order, cancel etc, they are all recorded in blocks and chain state, the fee will be\nshared among different transactions. New orders are exempt from fees to encourage usage and larger\ntrades will be charged more for their benefits from the liquidity provided in the network.\nOrder Expire and Cancel are also charged with a fee if they fail to provide any liquidity. The current fee table is ",(0,r.kt)("a",{parentName:"p",href:"/docs/trading-spec"},"here")),(0,r.kt)("p",null,"Besides the fees, ",(0,r.kt)("strong",{parentName:"p"},"no other gas will be charged.")),(0,r.kt)("p",null,"Fees can be paid in any asset, but the network will charge BNB first and apply a discount if the\naddress has BNB balance."),(0,r.kt)("p",null,"The fee is subject to periodical review and adjustment, after agreement from validators, via a\nproposal-vote procedure. See a fee-change proposal ",(0,r.kt)("a",{parentName:"p",href:"https://explorer.bnbchain.org/tx/B1E78D8275598CB0538C716997EEDD2F1198B82F4D73959C5BF69CBAF4281240"},"here")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Trade fee is calculated based on trade notional value, while fees for other transactions are fixed."),(0,r.kt)("li",{parentName:"ul"},"It is free to send a new GET order, cancel a partially filled order, or expire a partially filled order."),(0,r.kt)("li",{parentName:"ul"},"Non-Trade related transactions will be charged with a fee when the transactions happen, and can\nonly be paid in BNB. The transaction will be rejected if the address does not have enough BNB."),(0,r.kt)("li",{parentName:"ul"},"Trade-related transactions will be charged with a fee when an order is filled, or\ncanceled/expired/IOC-expired with no fills. If there is enough BNB to pay, BNB fee structure will\nbe used, otherwise, non-BNB fee structure will be used instead."),(0,r.kt)("li",{parentName:"ul"},"If the whole order value and free balance for the receiving asset are not enough to pay the fee,\nall the receiving asset and its residual balance will be charged.")),(0,r.kt)("h3",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain--mainnet"},"What is the current Fee Table on BNB Beacon Chain Mainnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for ",(0,r.kt)("strong",{parentName:"p"},"Mainnet")," as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-21")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h3",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain--testnet"},"What is the current Fee Table on BNB Beacon Chain Testnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-17")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h3",{id:"can-i-see-ordersbalances-of-others-or-can-other-people-see-my-ordersbalances"},"Can I see orders/balances of others or can other people see my orders/balances?"),(0,r.kt)("p",null,"Yes, anyone can see anyone's orders and balances if they know the corresponding addresses.\nBNB Beacon Chain is 100% transparent for transactions and balances."),(0,r.kt)("h3",{id:"information-provided-through-api-and-their-usage"},"Information provided through API and their usage"),(0,r.kt)("h4",{id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data"},"Is there any limit to using the API to send orders or check market data?"),(0,r.kt)("p",null,"Yes, there are rate limits to ensure there is no waste or abuse of the network infrastructure.",(0,r.kt)("br",null),"\nPlease check the API documentation."),(0,r.kt)("h4",{id:"what-does-wallet-and-api-cost-to-use"},"What does Wallet and API cost to use?"),(0,r.kt)("p",null,"No fee or commission at all (free to use)."),(0,r.kt)("h4",{id:"what-market-data-can-i-get"},"What Market Data can I get?"),(0,r.kt)("p",null,"The market data provided via Wallet and API are similar to Binance.com, including ticker data, order book,\ntrade and Kline. They can be seen in the Wallet and read from REST or WebSocket API.",(0,r.kt)("br",null),"\nPlease check the API documentation for details."),(0,r.kt)("h4",{id:"what-are-the-tick-size-and-lot-size-are-they-fixed"},"What are the tick size and lot size? Are they fixed?"),(0,r.kt)("p",null,"Tick size is the minimum unit to increase or decrease for the price (in quote asset) of an order,\nwhile lot size is the minimum unit to increase or decrease for the quantity (in base asset) of an order.",(0,r.kt)("br",null),"\nThey are not the same as on Binance.com. They can be queried from API or checked from Wallet UI."),(0,r.kt)("p",null,"Tick Size and lot size are not fixed. BNB Beacon Chain will automatically/periodically review the values to make\nsure proper order size and notional is applied."),(0,r.kt)("h4",{id:"are-there-limits-on-notional-value-of-an-order"},"Are there limits on notional value of an order?"),(0,r.kt)("p",null,"The smallest order you can send for a trading pair is 1 lot size quantity at 1 tick size price. No other limits."),(0,r.kt)("h3",{id:"what-is-the-decimal-precision-for-prices-and-quantities-on-bnb-beacon-chain-dex"},"What is the decimal precision for prices and quantities on BNB Beacon Chain /DEX?"),(0,r.kt)("p",null,"Amounts are represented as integers, and all coins have a fixed scale of 8.",(0,r.kt)("br",null),"\nThis means that if a balance of 100000000 were to be exposed to a wallet integrator, this will represent a balance of 1 coin."),(0,r.kt)("h3",{id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back"},"I forgot the private key for my address, how can I get it back?"),(0,r.kt)("p",null,"Sorry, you cannot. Owner of the address takes full responsibility for the private key protection.\nBNB Beacon Chain and official wallets do not have your private key."),(0,r.kt)("h3",{id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets"},"My private key got stolen by hackers, how can I recover my assets?"),(0,r.kt)("p",null,"Sorry, you take full responsibility of your private key ownership and protection. BNB Beacon Chain\nand official wallets will not record, or transfer out your private key."),(0,r.kt)("h3",{id:"what-is-the-accelerated-node"},"What is the Accelerated Node?"),(0,r.kt)("p",null,"While users can submit transactions and most of the queries via normal, self-run full nodes.",(0,r.kt)("br",null),"\nAccelerated Node provides more secure and faster lines to access BNB Beacon Chain ."),(0,r.kt)("p",null,"Accelerated Node is special infrastructure built around Validator to facilitate accelerated transaction\nrouting and provide richer, faster user interfaces. There are always several Accelerated Nodes running\nat the same time around the world (owned by different organizations) and you are encouraged to choose\none of them to use, or allow your Wallet choose one randomly.",(0,r.kt)("br",null),"\nFor rapid API access, you'd better stay with one Accelerated Node to get better performance."),(0,r.kt)("h3",{id:"how-can-i-issue-an-asset"},"How can I issue an asset?"),(0,r.kt)("p",null,"Anyone can pay a fee and issue an asset as Token on BNB Beacon Chain , as long as they provide\nproper information for the fields below, and then execute the command through the command line or http interfaces."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Name: a description string of less than 21 characters"),(0,r.kt)("li",{parentName:"ul"},"Symbol: an identifier string less than 9 characters, which must be composed of ","[0-9A-Z]"),(0,r.kt)("li",{parentName:"ul"},"Total Supply: a positive number less than or equal to 90 billions"),(0,r.kt)("li",{parentName:"ul"},"Mint-able: whether the token can increase Total Supply in later time or not")),(0,r.kt)("h3",{id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain-"},"What is the consensus algorithm used on BNB Beacon Chain ?"),(0,r.kt)("p",null,"BNB Beacon Chain uses BFT and PoS (upcoming) based consensus mechanism to produce blocks among\na series of qualified Validators. This is similar to the architectures of several existing\npopular blockchain platforms such as EOS and NEO.\nThe process for setting up validators among different entities on BNB Beacon Chain is currently being defined. More details will be shared at a later date."),(0,r.kt)("h3",{id:"can-i-run-a-full-node-for-bnb-beacon-chain-"},"Can I run a full node for BNB Beacon Chain ?"),(0,r.kt)("p",null,"Yes, you can. A full node contains all the information and application logic for BNB Beacon Chain .\nIt can receive and broadcast blocks and transactions with other full nodes and even validators.\nThe only exception is it will not participate in the consensus if the full node is not a Validator."),(0,r.kt)("h3",{id:"does-bnb-beacon-chain-support-smart-contracts"},"Does BNB Beacon Chain support Smart Contracts?"),(0,r.kt)("p",null,"No. This was an intentional design decision to improve the performance of the system and eliminate having to support unnecessary features."),(0,r.kt)("p",null,"If you have certain must-have features, it might be added as a native implementation instead of using smart contract.",(0,r.kt)("br",null),"\nFeel free to talk to ",(0,r.kt)("a",{parentName:"p",href:"https://forum.bnbchain.org/"},"BNB Chain Community"),"."),(0,r.kt)("h3",{id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-block-chains-onto-bnb-beacon-chain-"},"How can I transfer tokens, such as Bitcoin, from other block chains onto BNB Beacon Chain ?"),(0,r.kt)("p",null,"Right now, there are 2 ways to transfer tokens cross-chain:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"via interoperability among different chains. After the latest \u201cArchimedes\u201d upgrade, ",(0,r.kt)("a",{parentName:"li",href:"https://https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3")," was introduced and it defines native transactions to support ",(0,r.kt)("a",{parentName:"li",href:"https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts"},"Hash Timelock Contract (HTLC)")," on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.vision/blockchain/atomic-swaps-explained"},"atomic swap")," to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including\uff1a")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"smart-contract solution")," that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"deputy process")," written in GoLang that handles swap activities")),(0,r.kt)("p",null,"Any developer is welcome to test the solutions in testnet and then use them in mainnet."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"via Binance.com. ",(0,r.kt)("a",{parentName:"li",href:"https://wwww.binance.com"},"Binance"),",the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/BCH-1FD"},"BEP2 BCH"),",",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/XRP-BF2"},"BEP2 XRP"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/LTC-F07"},"BEP2 LTC"),". Pegged tokens such as ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", are 100% backed by the native coin in ",(0,r.kt)("a",{parentName:"li",href:"https://btc.com/3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"},"reserve"),". The reserve addresses are published for anyone to audit. Read this ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.com/en/blog/347360878904684544/Introducing-BitcoinPegged-Token-on-Binance-Chain"},"blog")," to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.")),(0,r.kt)("p",null,"Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them."),(0,r.kt)("p",null,"Please do ",(0,r.kt)("strong",{parentName:"p"},"NOT")," try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins."),(0,r.kt)("h3",{id:"how-is-a-trading-pair-created-on-binance-dex"},"How is a trading pair created on Binance DEX?"),(0,r.kt)("p",null,"The design philosophy of Binance DEX adheres to the idea that the most efficient and low cost way to perform trading and\nprice-discovery is still to use single order book. This single order book is managed and replicated across all\nfull nodes with the same, deterministic matching logic."),(0,r.kt)("p",null,"Simply allowing trading between two assets seems easy enough, however it is expensive for not only the network\nbut also its users in long term (and liquidity costs can be much larger). In order to efficiently use the\nnetwork, BNB Beacon Chain only list assets against BNB and other widely accepted market quote assets."),(0,r.kt)("p",null,'After an asset is issued, which costs a small fee,\nanyone can "propose" to all validators to list it against particular quote assets.\nValidators then vote to accept the proposal.\nA deposit is taken to prevent network abuse.\nOnce the proposal is accepted, the owner of the base asset can list the trading pair.'),(0,r.kt)("p",null,"For more information about this process please check the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/list.md"},"listing guide"),"."),(0,r.kt)("h3",{id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex"},"How would a third-party integrate with BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"A wallet provider may choose to only support the feature set of BNB Beacon Chain , which would just\ncover wallets, addresses, balances and transfers.",(0,r.kt)("br",null),"\nTo improve their implementation further, they could choose to integrate Binance DEX which would add trading (order placement and cancellation), historical order and trade views, charts, etc."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/864b21f2.65d3e2f2.js b/assets/js/864b21f2.65d3e2f2.js deleted file mode 100644 index 223de43b3f..0000000000 --- a/assets/js/864b21f2.65d3e2f2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[6266],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),s=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},p=function(e){var t=s(e.components);return n.createElement(d.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),c=s(a),h=r,m=c["".concat(d,".").concat(h)]||c[h]||u[h]||l;return a?n.createElement(m,i(i({ref:t},p),{},{components:a})):n.createElement(m,i({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=h;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o[c]="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(83117),r=(a(67294),a(3905));const l={sidebar_label:"BC FAQs",sidebar_position:2,hide_table_of_contents:!0},i="BNB Beacon Chain FAQs",o={unversionedId:"BC-FAQs",id:"BC-FAQs",title:"BNB Beacon Chain FAQs",description:"What is BNB Beacon Chain and Binance DEX?",source:"@site/docs/BC-FAQs.md",sourceDirName:".",slug:"/BC-FAQs",permalink:"/docs/BC-FAQs",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/BC-FAQs.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_label:"BC FAQs",sidebar_position:2,hide_table_of_contents:!0}},d={},s=[{value:"What is BNB Beacon Chain and Binance DEX?",id:"what-is-bnb-beacon-chain-and-binance-dex",level:3},{value:"What is the design principle of BNB Beacon Chain ?",id:"what-is-the-design-principle-of-bnb-beacon-chain-",level:3},{value:"What can you do on BNB Beacon Chain ?",id:"what-can-you-do-on-bnb-beacon-chain-",level:3},{value:"Will BNB Beacon Chain introduce more features and transaction types in the future?",id:"will-bnb-beacon-chain--introduce-more-features-and-transaction-types-in-the-future",level:3},{value:"What is the native coin on BNB Beacon Chain ?",id:"what-is-the-native-coin-on-bnb-beacon-chain-",level:3},{value:"How can I register on BNB Beacon Chain /DEX and start trading?",id:"how-can-i-register-on-bnb-beacon-chain-dex-and-start-trading",level:3},{value:"How can I send orders on Binance DEX?",id:"how-can-i-send-orders-on-binance-dex",level:3},{value:"Order",id:"order",level:4},{value:"What is Immediate Or Cancel order?",id:"what-is-immediate-or-cancel-order",level:4},{value:"Match",id:"match",level:4},{value:"Trade",id:"trade",level:4},{value:"What is Order Expire?",id:"what-is-order-expire",level:4},{value:"Where can I see my assets and trades?",id:"where-can-i-see-my-assets-and-trades",level:4},{value:"When can I see my order on the blockchain after I send it?",id:"when-can-i-see-my-order-on-the-blockchain-after-i-send-it",level:4},{value:"What is the Fee Structure?",id:"what-is-the-fee-structure",level:4},{value:"What is the current Fee Table on BNB Beacon Chain Mainnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain--mainnet",level:3},{value:"What is the current Fee Table on BNB Beacon Chain Testnet?",id:"what-is-the-current-fee-table-on-bnb-beacon-chain--testnet",level:3},{value:"Can I see orders/balances of others or can other people see my orders/balances?",id:"can-i-see-ordersbalances-of-others-or-can-other-people-see-my-ordersbalances",level:3},{value:"Information provided through API and their usage",id:"information-provided-through-api-and-their-usage",level:3},{value:"Is there any limit to using the API to send orders or check market data?",id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data",level:4},{value:"What does Wallet and API cost to use?",id:"what-does-wallet-and-api-cost-to-use",level:4},{value:"What Market Data can I get?",id:"what-market-data-can-i-get",level:4},{value:"What are the tick size and lot size? Are they fixed?",id:"what-are-the-tick-size-and-lot-size-are-they-fixed",level:4},{value:"Are there limits on notional value of an order?",id:"are-there-limits-on-notional-value-of-an-order",level:4},{value:"What is the decimal precision for prices and quantities on BNB Beacon Chain /DEX?",id:"what-is-the-decimal-precision-for-prices-and-quantities-on-bnb-beacon-chain-dex",level:3},{value:"I forgot the private key for my address, how can I get it back?",id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back",level:3},{value:"My private key got stolen by hackers, how can I recover my assets?",id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets",level:3},{value:"What is the Accelerated Node?",id:"what-is-the-accelerated-node",level:3},{value:"How can I issue an asset?",id:"how-can-i-issue-an-asset",level:3},{value:"What is the consensus algorithm used on BNB Beacon Chain ?",id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain-",level:3},{value:"Can I run a full node for BNB Beacon Chain ?",id:"can-i-run-a-full-node-for-bnb-beacon-chain-",level:3},{value:"Does BNB Beacon Chain support Smart Contracts?",id:"does-bnb-beacon-chain-support-smart-contracts",level:3},{value:"How can I transfer tokens, such as Bitcoin, from other block chains onto BNB Beacon Chain ?",id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-block-chains-onto-bnb-beacon-chain-",level:3},{value:"How is a trading pair created on Binance DEX?",id:"how-is-a-trading-pair-created-on-binance-dex",level:3},{value:"How would a third-party integrate with BNB Beacon Chain and Binance DEX?",id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex",level:3}],p={toc:s},c="wrapper";function u(e){let{components:t,...a}=e;return(0,r.kt)(c,(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"bnb-beacon-chain-faqs"},"BNB Beacon Chain FAQs"),(0,r.kt)("h3",{id:"what-is-bnb-beacon-chain-and-binance-dex"},"What is BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"BNB Beacon Chain is the blockchain initially developed by Binance and community. Binance DEX is the decentralized exchange module developed on top of the BNB Beacon Chain blockchain."),(0,r.kt)("h3",{id:"what-is-the-design-principle-of-bnb-beacon-chain-"},"What is the design principle of BNB Beacon Chain ?"),(0,r.kt)("p",null,"The main focuses for the design of BNB Beacon Chain are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"No custody of funds: traders maintain control of their private keys and funds."),(0,r.kt)("li",{parentName:"ul"},"High performance: low latency, high throughput for a large user base, and high liquidity trading.\nWe target to achieve 1 second block times, with 1 confirmation finality."),(0,r.kt)("li",{parentName:"ul"},"Low cost: in both fees and liquidity cost."),(0,r.kt)("li",{parentName:"ul"},"Easy user experience"),(0,r.kt)("li",{parentName:"ul"},"Fair trading: minimize front-running, to the extent possible."),(0,r.kt)("li",{parentName:"ul"},"Evolvable: able to develop with forever-improving technology stack, architecture, and ideas.")),(0,r.kt)("h3",{id:"what-can-you-do-on-bnb-beacon-chain-"},"What can you do on BNB Beacon Chain ?"),(0,r.kt)("p",null,"You can:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Send and receive BNB"),(0,r.kt)("li",{parentName:"ul"},"Issue new tokens"),(0,r.kt)("li",{parentName:"ul"},"Send, receive, burn/mint and freeze/unfreeze tokens"),(0,r.kt)("li",{parentName:"ul"},"Propose to create trading pairs between two different tokens"),(0,r.kt)("li",{parentName:"ul"},"Send orders to buy or sell assets through trading pairs created on the chain")),(0,r.kt)("h3",{id:"will-bnb-beacon-chain--introduce-more-features-and-transaction-types-in-the-future"},"Will BNB Beacon Chain introduce more features and transaction types in the future?"),(0,r.kt)("p",null,"Yes, BNB Beacon Chain team and community would cherish the technology advancements and recommended trends and strive to make circulation of assets and value easier and easier."),(0,r.kt)("h3",{id:"what-is-the-native-coin-on-bnb-beacon-chain-"},"What is the native coin on BNB Beacon Chain ?"),(0,r.kt)("p",null,"The Build N Build Coin, BNB, is the native asset on BNB Beacon Chain . There are 200MM BNB coins in total.\nThere will be no mining. The existing coin burns and freezes will still be in effect on the new\nBNB Beacon Chain blockchain."),(0,r.kt)("p",null,"The exact number of BNB coins will be destroyed based on the same number of BNB ERC20 tokens\nthat have already been destroyed."),(0,r.kt)("p",null,"Since BNB Beacon Chain is live, all BNB ERC20 tokens will be swapped for BNB Beacon Chain coins. All\nusers who hold BNB ERC20 tokens can deposit them to Binance.com, and upon withdrawal, the new\nBNB Beacon Chain native coins will be sent to their new wallets."),(0,r.kt)("h3",{id:"how-can-i-register-on-bnb-beacon-chain-dex-and-start-trading"},"How can I register on BNB Beacon Chain /DEX and start trading?"),(0,r.kt)("p",null,"There is no need to register. All you need is a BNB Beacon Chain address, which can be generated with\nany ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/wallets.md"},"wallet")," that supports BNB Beacon Chain . Then you can trade BNB or other assets stored on that address."),(0,r.kt)("h3",{id:"how-can-i-send-orders-on-binance-dex"},"How can I send orders on Binance DEX?"),(0,r.kt)("h4",{id:"order"},"Order"),(0,r.kt)("p",null,'On Binance DEX, you can send "new order" messages to buy or sell certain assets. You can also\nsend "cancel" messages to cancel existing open orders.'),(0,r.kt)("p",null,"You can use a wallet to send new orders and cancels. Binance DEX also provides API for automated trading."),(0,r.kt)("p",null,"In Binance DEX v1.0, the order message contains:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Symbol: trading pair on the chain"),(0,r.kt)("li",{parentName:"ul"},"Side: buy or sell"),(0,r.kt)("li",{parentName:"ul"},"Price: only limit price orders are supported in BNB Beacon Chain v1.0"),(0,r.kt)("li",{parentName:"ul"},"Amount"),(0,r.kt)("li",{parentName:"ul"},"Time In Force: Binance DEX supports ",(0,r.kt)("inlineCode",{parentName:"li"},"Immediate Or Cancel")," (IOC) and ",(0,r.kt)("inlineCode",{parentName:"li"},"Good Till Expiry"),' (GTE)\norders. GTE orders can quote on the exchange until they are filled by the opposite orders satisfying\nthe limit price, or canceled by client themselves, or expire after 72 hours after 00:00 (UTC).\nCheck the "What is ',(0,r.kt)("inlineCode",{parentName:"li"},"Order Expire"),'" section of the FAQ for more information.')),(0,r.kt)("p",null,"Network nodes examine orders to ensure they are valid. Once the orders are accepted, they are\nbooked on the next block, and get matched accordingly."),(0,r.kt)("h4",{id:"what-is-immediate-or-cancel-order"},"What is ",(0,r.kt)("inlineCode",{parentName:"h4"},"Immediate Or Cancel order"),"?"),(0,r.kt)("p",null,"Immediate Or Cancel is a special order type. Once the order is accepted into a block, Immediate Or\nCancel orders only exist in this block round. The order may get filled to zero, or partially or fully\nfilled by other orders, and then will become expired and removed from the order book right away.\nAs a result, it will not be tradable in the next round of matching. A small fee will be charged\nfor the network usage, if there is no fill at all for the order (deemed as no intention to trade)."),(0,r.kt)("h4",{id:"match"},"Match"),(0,r.kt)("p",null,"Binance DEX does all of its matching on the blockchain, i.e. all nodes perform the matches and\nexpect the same result. This is to ensure the maximum transparency and to mitigate the chance\nfor front-running, even from the block producers. The matching infrastructure is expected to\nevolve and grow in capacity as time progresses."),(0,r.kt)("p",null,"Binance DEX doesn't do continuous matching as most centralized exchanges do. Instead, it matches\nusing periodic auction matching for all the existing open orders received in the past and the\nlatest blocks. The match logic is explained in more detail later."),(0,r.kt)("h4",{id:"trade"},"Trade"),(0,r.kt)("p",null,"Once the orders are filled, the corresponding assets will be automatically moved into buyers'\naddresses. The confirmation is instant and no need to wait for further blocks (i.e. T+0 block).\nBuyers can use the bought asset right away, either send it to another address or trade it again."),(0,r.kt)("h4",{id:"what-is-order-expire"},"What is ",(0,r.kt)("inlineCode",{parentName:"h4"},"Order Expire"),"?"),(0,r.kt)("p",null,"Orders accepted by Binance DEX will either get filled with other orders or remain in the order book,\nbut they will not stay on the order book forever. These orders will expire and be removed from the\norder book after the 1st midnight (UTC) after 72 hours once the order gets accepted. A small fee\nwill be charged for the network usage, if there is no fill at all for the order (deemed as no intention to trade)."),(0,r.kt)("h4",{id:"where-can-i-see-my-assets-and-trades"},"Where can I see my assets and trades?"),(0,r.kt)("p",null,"You can always use wallets that support BNB Beacon Chain to check your asset balances, open orders,\nand (optionally) order/trade history. BNB Beacon Chain Explorer is another tool to check balances\nand transactions."),(0,r.kt)("h4",{id:"when-can-i-see-my-order-on-the-blockchain-after-i-send-it"},"When can I see my order on the blockchain after I send it?"),(0,r.kt)("p",null,"It depends. Normally, if you connect to one of the Accelerated Nodes, your orders should get\naccepted and booked into a block in 1-3 seconds. If the order price is marketable, the order\nwill be filled and trades will come back in about similar time. If you send the order from far-way\n(self-setup full node), or there is heavy network traffic, the order may take longer to reach\na Validator (block producer)."),(0,r.kt)("h4",{id:"what-is-the-fee-structure"},"What is the Fee Structure?"),(0,r.kt)("p",null,"Fees are charged and shared among the block producers (i.e. Validators) to run the network,\nin order to pay for the network usage and prevent abuse and attack. Since all user transactions,\ninclude transfer, new order, cancel etc, they are all recorded in blocks and chain state, the fee will be\nshared among different transactions. New orders are exempt from fees to encourage usage and larger\ntrades will be charged more for their benefits from the liquidity provided in the network.\nOrder Expire and Cancel are also charged with a fee if they fail to provide any liquidity. The current fee table is ",(0,r.kt)("a",{parentName:"p",href:"/docs/trading-spec"},"here")),(0,r.kt)("p",null,"Besides the fees, ",(0,r.kt)("strong",{parentName:"p"},"no other gas will be charged.")),(0,r.kt)("p",null,"Fees can be paid in any asset, but the network will charge BNB first and apply a discount if the\naddress has BNB balance."),(0,r.kt)("p",null,"The fee is subject to periodical review and adjustment, after agreement from validators, via a\nproposal-vote procedure. See a fee-change proposal ",(0,r.kt)("a",{parentName:"p",href:"https://explorer.binance.org/tx/B1E78D8275598CB0538C716997EEDD2F1198B82F4D73959C5BF69CBAF4281240"},"here")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Trade fee is calculated based on trade notional value, while fees for other transactions are fixed."),(0,r.kt)("li",{parentName:"ul"},"It is free to send a new GET order, cancel a partially filled order, or expire a partially filled order."),(0,r.kt)("li",{parentName:"ul"},"Non-Trade related transactions will be charged with a fee when the transactions happen, and can\nonly be paid in BNB. The transaction will be rejected if the address does not have enough BNB."),(0,r.kt)("li",{parentName:"ul"},"Trade-related transactions will be charged with a fee when an order is filled, or\ncanceled/expired/IOC-expired with no fills. If there is enough BNB to pay, BNB fee structure will\nbe used, otherwise, non-BNB fee structure will be used instead."),(0,r.kt)("li",{parentName:"ul"},"If the whole order value and free balance for the receiving asset are not enough to pay the fee,\nall the receiving asset and its residual balance will be charged.")),(0,r.kt)("h3",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain--mainnet"},"What is the current Fee Table on BNB Beacon Chain Mainnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for ",(0,r.kt)("strong",{parentName:"p"},"Mainnet")," as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-21")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h3",{id:"what-is-the-current-fee-table-on-bnb-beacon-chain--testnet"},"What is the current Fee Table on BNB Beacon Chain Testnet?"),(0,r.kt)("p",null,"Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of ",(0,r.kt)("strong",{parentName:"p"},"2021-03-17")," is as follows:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Transaction Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in Non-BNB Asset"),(0,r.kt)("th",{parentName:"tr",align:null},"Pay in BNB"),(0,r.kt)("th",{parentName:"tr",align:null},"Exchange (DEX) Related"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"New Order"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"0"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cancel (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Order Expire (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"IOC (No Fill)"),(0,r.kt)("td",{parentName:"tr",align:null},"Equivalent 0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000005 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"Y")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"crossTransferOut"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Multi-send"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Issue Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"10 BNB"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Mint Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Transfer ownership"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Burn Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Freeze/Unfreeze Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.001 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Lock/unlock/relock Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List Asset"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"200 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000125 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Enable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Disable Memo Check"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"HTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"depositHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"claimHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"refundHTLT"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"TinyIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.4 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"MiniIssueFee"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.6 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SetTokenUri"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.000075 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"List BEP8 Token"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Create A New Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Edit Smart Chain Validator Information"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.2 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Delegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0002 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Redelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0006 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Undelegate Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Unjail A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Byzaitine Behavior Evidence of A Smart Chain Validator"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.5 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Submit Smart Chain Proposal"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"1 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Deposit"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.00025 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Smart Chain Proposal Vote"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Cross transfer out relayer reward"),(0,r.kt)("td",{parentName:"tr",align:null},"N/A"),(0,r.kt)("td",{parentName:"tr",align:null},"0.0004 BNB"),(0,r.kt)("td",{parentName:"tr",align:null},"N")))),(0,r.kt)("h3",{id:"can-i-see-ordersbalances-of-others-or-can-other-people-see-my-ordersbalances"},"Can I see orders/balances of others or can other people see my orders/balances?"),(0,r.kt)("p",null,"Yes, anyone can see anyone's orders and balances if they know the corresponding addresses.\nBNB Beacon Chain is 100% transparent for transactions and balances."),(0,r.kt)("h3",{id:"information-provided-through-api-and-their-usage"},"Information provided through API and their usage"),(0,r.kt)("h4",{id:"is-there-any-limit-to-using-the-api-to-send-orders-or-check-market-data"},"Is there any limit to using the API to send orders or check market data?"),(0,r.kt)("p",null,"Yes, there are rate limits to ensure there is no waste or abuse of the network infrastructure.",(0,r.kt)("br",null),"\nPlease check the API documentation."),(0,r.kt)("h4",{id:"what-does-wallet-and-api-cost-to-use"},"What does Wallet and API cost to use?"),(0,r.kt)("p",null,"No fee or commission at all (free to use)."),(0,r.kt)("h4",{id:"what-market-data-can-i-get"},"What Market Data can I get?"),(0,r.kt)("p",null,"The market data provided via Wallet and API are similar to Binance.com, including ticker data, order book,\ntrade and Kline. They can be seen in the Wallet and read from REST or WebSocket API.",(0,r.kt)("br",null),"\nPlease check the API documentation for details."),(0,r.kt)("h4",{id:"what-are-the-tick-size-and-lot-size-are-they-fixed"},"What are the tick size and lot size? Are they fixed?"),(0,r.kt)("p",null,"Tick size is the minimum unit to increase or decrease for the price (in quote asset) of an order,\nwhile lot size is the minimum unit to increase or decrease for the quantity (in base asset) of an order.",(0,r.kt)("br",null),"\nThey are not the same as on Binance.com. They can be queried from API or checked from Wallet UI."),(0,r.kt)("p",null,"Tick Size and lot size are not fixed. BNB Beacon Chain will automatically/periodically review the values to make\nsure proper order size and notional is applied."),(0,r.kt)("h4",{id:"are-there-limits-on-notional-value-of-an-order"},"Are there limits on notional value of an order?"),(0,r.kt)("p",null,"The smallest order you can send for a trading pair is 1 lot size quantity at 1 tick size price. No other limits."),(0,r.kt)("h3",{id:"what-is-the-decimal-precision-for-prices-and-quantities-on-bnb-beacon-chain-dex"},"What is the decimal precision for prices and quantities on BNB Beacon Chain /DEX?"),(0,r.kt)("p",null,"Amounts are represented as integers, and all coins have a fixed scale of 8.",(0,r.kt)("br",null),"\nThis means that if a balance of 100000000 were to be exposed to a wallet integrator, this will represent a balance of 1 coin."),(0,r.kt)("h3",{id:"i-forgot-the-private-key-for-my-address-how-can-i-get-it-back"},"I forgot the private key for my address, how can I get it back?"),(0,r.kt)("p",null,"Sorry, you cannot. Owner of the address takes full responsibility for the private key protection.\nBNB Beacon Chain and official wallets do not have your private key."),(0,r.kt)("h3",{id:"my-private-key-got-stolen-by-hackers-how-can-i-recover-my-assets"},"My private key got stolen by hackers, how can I recover my assets?"),(0,r.kt)("p",null,"Sorry, you take full responsibility of your private key ownership and protection. BNB Beacon Chain\nand official wallets will not record, or transfer out your private key."),(0,r.kt)("h3",{id:"what-is-the-accelerated-node"},"What is the Accelerated Node?"),(0,r.kt)("p",null,"While users can submit transactions and most of the queries via normal, self-run full nodes.",(0,r.kt)("br",null),"\nAccelerated Node provides more secure and faster lines to access BNB Beacon Chain ."),(0,r.kt)("p",null,"Accelerated Node is special infrastructure built around Validator to facilitate accelerated transaction\nrouting and provide richer, faster user interfaces. There are always several Accelerated Nodes running\nat the same time around the world (owned by different organizations) and you are encouraged to choose\none of them to use, or allow your Wallet choose one randomly.",(0,r.kt)("br",null),"\nFor rapid API access, you'd better stay with one Accelerated Node to get better performance."),(0,r.kt)("h3",{id:"how-can-i-issue-an-asset"},"How can I issue an asset?"),(0,r.kt)("p",null,"Anyone can pay a fee and issue an asset as Token on BNB Beacon Chain , as long as they provide\nproper information for the fields below, and then execute the command through the command line or http interfaces."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Name: a description string of less than 21 characters"),(0,r.kt)("li",{parentName:"ul"},"Symbol: an identifier string less than 9 characters, which must be composed of ","[0-9A-Z]"),(0,r.kt)("li",{parentName:"ul"},"Total Supply: a positive number less than or equal to 90 billions"),(0,r.kt)("li",{parentName:"ul"},"Mint-able: whether the token can increase Total Supply in later time or not")),(0,r.kt)("h3",{id:"what-is-the-consensus-algorithm-used-on-bnb-beacon-chain-"},"What is the consensus algorithm used on BNB Beacon Chain ?"),(0,r.kt)("p",null,"BNB Beacon Chain uses BFT and PoS (upcoming) based consensus mechanism to produce blocks among\na series of qualified Validators. This is similar to the architectures of several existing\npopular blockchain platforms such as EOS and NEO.\nThe process for setting up validators among different entities on BNB Beacon Chain is currently being defined. More details will be shared at a later date."),(0,r.kt)("h3",{id:"can-i-run-a-full-node-for-bnb-beacon-chain-"},"Can I run a full node for BNB Beacon Chain ?"),(0,r.kt)("p",null,"Yes, you can. A full node contains all the information and application logic for BNB Beacon Chain .\nIt can receive and broadcast blocks and transactions with other full nodes and even validators.\nThe only exception is it will not participate in the consensus if the full node is not a Validator."),(0,r.kt)("h3",{id:"does-bnb-beacon-chain-support-smart-contracts"},"Does BNB Beacon Chain support Smart Contracts?"),(0,r.kt)("p",null,"No. This was an intentional design decision to improve the performance of the system and eliminate having to support unnecessary features."),(0,r.kt)("p",null,"If you have certain must-have features, it might be added as a native implementation instead of using smart contract.",(0,r.kt)("br",null),"\nFeel free to talk to ",(0,r.kt)("a",{parentName:"p",href:"https://forum.bnbchain.org/"},"BNB Chain Community"),"."),(0,r.kt)("h3",{id:"how-can-i-transfer-tokens-such-as-bitcoin-from-other-block-chains-onto-bnb-beacon-chain-"},"How can I transfer tokens, such as Bitcoin, from other block chains onto BNB Beacon Chain ?"),(0,r.kt)("p",null,"Right now, there are 2 ways to transfer tokens cross-chain:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"via interoperability among different chains. After the latest \u201cArchimedes\u201d upgrade, ",(0,r.kt)("a",{parentName:"li",href:"https://https://github.com/bnb-chain/BEPs/blob/master/BEP3.md"},"BEP3")," was introduced and it defines native transactions to support ",(0,r.kt)("a",{parentName:"li",href:"https://en.bitcoin.it/wiki/Hash_Time_Locked_Contracts"},"Hash Timelock Contract (HTLC)")," on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.vision/blockchain/atomic-swaps-explained"},"atomic swap")," to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including\uff1a")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-smartcontracts"},"smart-contract solution")," that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/bep3-deputy"},"deputy process")," written in GoLang that handles swap activities")),(0,r.kt)("p",null,"Any developer is welcome to test the solutions in testnet and then use them in mainnet."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"via Binance.com. ",(0,r.kt)("a",{parentName:"li",href:"https://wwww.binance.com"},"Binance"),",the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/BCH-1FD"},"BEP2 BCH"),",",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/XRP-BF2"},"BEP2 XRP"),", ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/LTC-F07"},"BEP2 LTC"),". Pegged tokens such as ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/asset/BTCB-1DE"},"BEP2 Bitcoin"),", are 100% backed by the native coin in ",(0,r.kt)("a",{parentName:"li",href:"https://btc.com/3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb"},"reserve"),". The reserve addresses are published for anyone to audit. Read this ",(0,r.kt)("a",{parentName:"li",href:"https://www.binance.com/en/blog/347360878904684544/Introducing-BitcoinPegged-Token-on-Binance-Chain"},"blog")," to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.")),(0,r.kt)("p",null,"Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them."),(0,r.kt)("p",null,"Please do ",(0,r.kt)("strong",{parentName:"p"},"NOT")," try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins."),(0,r.kt)("h3",{id:"how-is-a-trading-pair-created-on-binance-dex"},"How is a trading pair created on Binance DEX?"),(0,r.kt)("p",null,"The design philosophy of Binance DEX adheres to the idea that the most efficient and low cost way to perform trading and\nprice-discovery is still to use single order book. This single order book is managed and replicated across all\nfull nodes with the same, deterministic matching logic."),(0,r.kt)("p",null,"Simply allowing trading between two assets seems easy enough, however it is expensive for not only the network\nbut also its users in long term (and liquidity costs can be much larger). In order to efficiently use the\nnetwork, BNB Beacon Chain only list assets against BNB and other widely accepted market quote assets."),(0,r.kt)("p",null,'After an asset is issued, which costs a small fee,\nanyone can "propose" to all validators to list it against particular quote assets.\nValidators then vote to accept the proposal.\nA deposit is taken to prevent network abuse.\nOnce the proposal is accepted, the owner of the base asset can list the trading pair.'),(0,r.kt)("p",null,"For more information about this process please check the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/list.md"},"listing guide"),"."),(0,r.kt)("h3",{id:"how-would-a-third-party-integrate-with-bnb-beacon-chain-and-binance-dex"},"How would a third-party integrate with BNB Beacon Chain and Binance DEX?"),(0,r.kt)("p",null,"A wallet provider may choose to only support the feature set of BNB Beacon Chain , which would just\ncover wallets, addresses, balances and transfers.",(0,r.kt)("br",null),"\nTo improve their implementation further, they could choose to integrate Binance DEX which would add trading (order placement and cancellation), historical order and trade views, charts, etc."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a30d6a39.96744a72.js b/assets/js/a30d6a39.59b4f5b6.js similarity index 99% rename from assets/js/a30d6a39.96744a72.js rename to assets/js/a30d6a39.59b4f5b6.js index fe826775f4..71a46715f3 100644 --- a/assets/js/a30d6a39.96744a72.js +++ b/assets/js/a30d6a39.59b4f5b6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[3436],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=o.createContext({}),d=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=d(e.components);return o.createElement(s.Provider,{value:n},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=d(t),m=i,h=p["".concat(s,".").concat(m)]||p[m]||u[m]||a;return t?o.createElement(h,r(r({ref:n},c),{},{components:t})):o.createElement(h,r({ref:n},c))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,r=new Array(a);r[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l[p]="string"==typeof e?e:i,r[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>d});var o=t(83117),i=(t(67294),t(3905));const a={},r="Join Testnet",l={unversionedId:"beaconchain/develop/node/join-testnet",id:"beaconchain/develop/node/join-testnet",title:"Join Testnet",description:"See the node repo for information on the mainnet,",source:"@site/docs/beaconchain/develop/node/join-testnet.md",sourceDirName:"beaconchain/develop/node",slug:"/beaconchain/develop/node/join-testnet",permalink:"/docs/beaconchain/develop/node/join-testnet",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/develop/node/join-testnet.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"Join Mainnet",permalink:"/docs/beaconchain/develop/node/join-mainnet"},next:{title:"Different Sync Types",permalink:"/docs/beaconchain/develop/node/synctypes"}},s={},d=[{value:"Minimum System Requirements",id:"minimum-system-requirements",level:2},{value:"Setting Up a New Node",id:"setting-up-a-new-node",level:2},{value:"Additional Configuration",id:"additional-configuration",level:3},{value:"Get Extra Information From Your Fullnode",id:"get-extra-information-from-your-fullnode",level:2},{value:"Monitor Syncing Process",id:"monitor-syncing-process",level:5},{value:"Prometheus Metrics",id:"prometheus-metrics",level:2},{value:"Testnet Tools",id:"testnet-tools",level:2}],c={toc:d},p="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(p,(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"join-testnet"},"Join Testnet"),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"See the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node"},"node repo")," for information on the mainnet,\nincluding the correct version of the binaries to use and details about the genesis file")),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"You need to install ",(0,i.kt)("a",{parentName:"p",href:"/docs/beaconchain/develop/node/install"},"bnbchaind")," before you go further")),(0,i.kt)("h2",{id:"minimum-system-requirements"},"Minimum System Requirements"),(0,i.kt)("p",null,"The hardware must meet certain requirements to run a Full Node."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Desktop or laptop hardware running recent versions of Mac OS X, Windows, or Linux."),(0,i.kt)("li",{parentName:"ul"},"1 TB of free disk space, accessible at a minimum read/write speed of 100 MB/s."),(0,i.kt)("li",{parentName:"ul"},"4 cores of CPU and 8 gigabytes of memory (RAM)."),(0,i.kt)("li",{parentName:"ul"},"A broadband Internet connection with upload/download speeds of at least 1 megabyte per second.")),(0,i.kt)("h2",{id:"setting-up-a-new-node"},"Setting Up a New Node"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"You need to choose a home folder ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME")," (i.e. ~/.bnbchaind) for BNB Beacon Chain. You can setup this by:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"mkdir ~/.bnbchaind\nmkdir ~/.bnbchaind/config\n")),(0,i.kt)("ol",{start:2},(0,i.kt)("li",{parentName:"ol"},"Download ",(0,i.kt)("inlineCode",{parentName:"li"},"app.toml"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"config.toml")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"genesis.json")," from ",(0,i.kt)("inlineCode",{parentName:"li"},"https://github.com/bnb-chain/node/releases")," and copy them into ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME/config"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'wget $(curl -s https://api.github.com/repos/bnb-chain/node/releases/latest |grep browser_ |grep testnet_config |cut -d\\" -f4)\nunzip testnet_config.zip\n')),(0,i.kt)("p",null,"You can edit this moniker later, in the ~/.bnbchaind/config/config.toml file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml"},'# A custom human readable name for this node\nmoniker = ""\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"Monikers can contain only ASCII characters. Using Unicode characters will render your node unreachable. ")),(0,i.kt)("p",null,"Now your Full Node has been initialized."),(0,i.kt)("ol",{start:3},(0,i.kt)("li",{parentName:"ol"},"The ",(0,i.kt)("inlineCode",{parentName:"li"},"genesis.json")," file will be downloaded along with the other config files in step #2.")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"If you want to understand genesis file, click ",(0,i.kt)("a",{parentName:"p",href:"/docs/beaconchain/learn/genesis"},"here"))),(0,i.kt)("ol",{start:4},(0,i.kt)("li",{parentName:"ol"},"Start your Full Node.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"bnbchaind start &\n")),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"Alternatively, if you choose a different $BNCHOME location and you are not using the suggested default ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.bnbchaind"),", you may start the full node by using below script, where $BNCHOME is your selected directory. "),(0,i.kt)("p",{parentName:"admonition"},"Example: If you set ",(0,i.kt)("inlineCode",{parentName:"p"},"/usr/local/beaconchain-testnet")," as your home directory. Run the Full Node with below command."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"bnbchaind start --home /usr/local/beaconchain-testnet &\n"))),(0,i.kt)("p",null,"If you encounter any issue when running a Full Node, you should read the FAQ provided here."),(0,i.kt)("h3",{id:"additional-configuration"},"Additional Configuration"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Seed node: Your Full Node needs to know how to find peers in the blockchain network. You'll need to add healthy seed nodes to $BNCHOME/config/config.toml. The recommended ",(0,i.kt)("inlineCode",{parentName:"li"},"config.toml")," already contains links to some seed nodes.\nIf those seeds aren't working, you can find more seeds and persistent peers in the HTTP API endpoints: ",(0,i.kt)("a",{parentName:"li",href:"https://testnet-dex.binance.org/api/v1/peers"},"https://testnet-dex.binance.org/api/v1/peers")),(0,i.kt)("li",{parentName:"ul"},"Sync type: By default, new nodes will sync with ",(0,i.kt)("inlineCode",{parentName:"li"},"state-sync")," mode. To change sync mode, read the instructions ",(0,i.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/node/synctypes"},"here")),(0,i.kt)("li",{parentName:"ul"},"Log: The log file is under ",(0,i.kt)("inlineCode",{parentName:"li"},"home"),"- the directory specified when starting ",(0,i.kt)("inlineCode",{parentName:"li"},"bnbchaind"),".\nThe latest log file is ",(0,i.kt)("inlineCode",{parentName:"li"},"bnc.log"),". The process will create a new log file every one hour.\nTo make sure you have sufficient disk space to keep the log files, we strongly recommend you to change the log location by changing ",(0,i.kt)("inlineCode",{parentName:"li"},"logFileRoot")," option in ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME/config/app.toml"),"."),(0,i.kt)("li",{parentName:"ul"},"Service Port: RPC service listens on port ",(0,i.kt)("inlineCode",{parentName:"li"},"27147")," and P2P service listens on port ",(0,i.kt)("inlineCode",{parentName:"li"},"27146")," by default.\nMake sure these two ports are open before starting a full node, unless the full node has to listen on other ports."),(0,i.kt)("li",{parentName:"ul"},"Store: All the state and block data will store under ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME/data"),", do not delete or edit any of these files.")),(0,i.kt)("h2",{id:"get-extra-information-from-your-fullnode"},"Get Extra Information From Your Fullnode"),(0,i.kt)("p",null,"If you have a Full Node running, then you can publish extra messages to local files."),(0,i.kt)("h5",{id:"monitor-syncing-process"},"Monitor Syncing Process"),(0,i.kt)("p",null,"You can verify if state sync is done by ",(0,i.kt)("inlineCode",{parentName:"p"},"curl localhost:27147/status")," several times and see whether ",(0,i.kt)("inlineCode",{parentName:"p"},"latest_block_height")," is increasing in response."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'"sync_info": {\n ...\n "latest_block_height": "878092",\n "latest_block_time": "2019-04-15T00:01:22.610803768Z",\n ...\n}\n')),(0,i.kt)("h2",{id:"prometheus-metrics"},"Prometheus Metrics"),(0,i.kt)("p",null,"Prometheus is enabled on port ",(0,i.kt)("inlineCode",{parentName:"p"},"28660")," by default, and the endpoint is ",(0,i.kt)("inlineCode",{parentName:"p"},"/metrics"),"."),(0,i.kt)("h2",{id:"testnet-tools"},"Testnet Tools"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://testnet-explorer.binance.org/"},"Explorer"))))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[3436],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=o.createContext({}),d=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=d(e.components);return o.createElement(s.Provider,{value:n},e.children)},p="mdxType",u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),p=d(t),m=i,h=p["".concat(s,".").concat(m)]||p[m]||u[m]||a;return t?o.createElement(h,r(r({ref:n},c),{},{components:t})):o.createElement(h,r({ref:n},c))}));function h(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,r=new Array(a);r[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l[p]="string"==typeof e?e:i,r[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>d});var o=t(83117),i=(t(67294),t(3905));const a={},r="Join Testnet",l={unversionedId:"beaconchain/develop/node/join-testnet",id:"beaconchain/develop/node/join-testnet",title:"Join Testnet",description:"See the node repo for information on the mainnet,",source:"@site/docs/beaconchain/develop/node/join-testnet.md",sourceDirName:"beaconchain/develop/node",slug:"/beaconchain/develop/node/join-testnet",permalink:"/docs/beaconchain/develop/node/join-testnet",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/beaconchain/develop/node/join-testnet.md",tags:[],version:"current",frontMatter:{},sidebar:"bscSideBar",previous:{title:"Join Mainnet",permalink:"/docs/beaconchain/develop/node/join-mainnet"},next:{title:"Different Sync Types",permalink:"/docs/beaconchain/develop/node/synctypes"}},s={},d=[{value:"Minimum System Requirements",id:"minimum-system-requirements",level:2},{value:"Setting Up a New Node",id:"setting-up-a-new-node",level:2},{value:"Additional Configuration",id:"additional-configuration",level:3},{value:"Get Extra Information From Your Fullnode",id:"get-extra-information-from-your-fullnode",level:2},{value:"Monitor Syncing Process",id:"monitor-syncing-process",level:5},{value:"Prometheus Metrics",id:"prometheus-metrics",level:2},{value:"Testnet Tools",id:"testnet-tools",level:2}],c={toc:d},p="wrapper";function u(e){let{components:n,...t}=e;return(0,i.kt)(p,(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"join-testnet"},"Join Testnet"),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"See the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/bnb-chain/node"},"node repo")," for information on the mainnet,\nincluding the correct version of the binaries to use and details about the genesis file")),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"You need to install ",(0,i.kt)("a",{parentName:"p",href:"/docs/beaconchain/develop/node/install"},"bnbchaind")," before you go further")),(0,i.kt)("h2",{id:"minimum-system-requirements"},"Minimum System Requirements"),(0,i.kt)("p",null,"The hardware must meet certain requirements to run a Full Node."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Desktop or laptop hardware running recent versions of Mac OS X, Windows, or Linux."),(0,i.kt)("li",{parentName:"ul"},"1 TB of free disk space, accessible at a minimum read/write speed of 100 MB/s."),(0,i.kt)("li",{parentName:"ul"},"4 cores of CPU and 8 gigabytes of memory (RAM)."),(0,i.kt)("li",{parentName:"ul"},"A broadband Internet connection with upload/download speeds of at least 1 megabyte per second.")),(0,i.kt)("h2",{id:"setting-up-a-new-node"},"Setting Up a New Node"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"You need to choose a home folder ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME")," (i.e. ~/.bnbchaind) for BNB Beacon Chain. You can setup this by:")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"mkdir ~/.bnbchaind\nmkdir ~/.bnbchaind/config\n")),(0,i.kt)("ol",{start:2},(0,i.kt)("li",{parentName:"ol"},"Download ",(0,i.kt)("inlineCode",{parentName:"li"},"app.toml"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"config.toml")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"genesis.json")," from ",(0,i.kt)("inlineCode",{parentName:"li"},"https://github.com/bnb-chain/node/releases")," and copy them into ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME/config"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'wget $(curl -s https://api.github.com/repos/bnb-chain/node/releases/latest |grep browser_ |grep testnet_config |cut -d\\" -f4)\nunzip testnet_config.zip\n')),(0,i.kt)("p",null,"You can edit this moniker later, in the ~/.bnbchaind/config/config.toml file:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-toml"},'# A custom human readable name for this node\nmoniker = ""\n')),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"Monikers can contain only ASCII characters. Using Unicode characters will render your node unreachable. ")),(0,i.kt)("p",null,"Now your Full Node has been initialized."),(0,i.kt)("ol",{start:3},(0,i.kt)("li",{parentName:"ol"},"The ",(0,i.kt)("inlineCode",{parentName:"li"},"genesis.json")," file will be downloaded along with the other config files in step #2.")),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"If you want to understand genesis file, click ",(0,i.kt)("a",{parentName:"p",href:"/docs/beaconchain/learn/genesis"},"here"))),(0,i.kt)("ol",{start:4},(0,i.kt)("li",{parentName:"ol"},"Start your Full Node.")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"bnbchaind start &\n")),(0,i.kt)("admonition",{type:"note"},(0,i.kt)("p",{parentName:"admonition"},"Alternatively, if you choose a different $BNCHOME location and you are not using the suggested default ",(0,i.kt)("inlineCode",{parentName:"p"},"~/.bnbchaind"),", you may start the full node by using below script, where $BNCHOME is your selected directory. "),(0,i.kt)("p",{parentName:"admonition"},"Example: If you set ",(0,i.kt)("inlineCode",{parentName:"p"},"/usr/local/beaconchain-testnet")," as your home directory. Run the Full Node with below command."),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"bnbchaind start --home /usr/local/beaconchain-testnet &\n"))),(0,i.kt)("p",null,"If you encounter any issue when running a Full Node, you should read the FAQ provided here."),(0,i.kt)("h3",{id:"additional-configuration"},"Additional Configuration"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Seed node: Your Full Node needs to know how to find peers in the blockchain network. You'll need to add healthy seed nodes to $BNCHOME/config/config.toml. The recommended ",(0,i.kt)("inlineCode",{parentName:"li"},"config.toml")," already contains links to some seed nodes.\nIf those seeds aren't working, you can find more seeds and persistent peers in the HTTP API endpoints: ",(0,i.kt)("a",{parentName:"li",href:"https://testnet-dex.binance.org/api/v1/peers"},"https://testnet-dex.binance.org/api/v1/peers")),(0,i.kt)("li",{parentName:"ul"},"Sync type: By default, new nodes will sync with ",(0,i.kt)("inlineCode",{parentName:"li"},"state-sync")," mode. To change sync mode, read the instructions ",(0,i.kt)("a",{parentName:"li",href:"/docs/beaconchain/develop/node/synctypes"},"here")),(0,i.kt)("li",{parentName:"ul"},"Log: The log file is under ",(0,i.kt)("inlineCode",{parentName:"li"},"home"),"- the directory specified when starting ",(0,i.kt)("inlineCode",{parentName:"li"},"bnbchaind"),".\nThe latest log file is ",(0,i.kt)("inlineCode",{parentName:"li"},"bnc.log"),". The process will create a new log file every one hour.\nTo make sure you have sufficient disk space to keep the log files, we strongly recommend you to change the log location by changing ",(0,i.kt)("inlineCode",{parentName:"li"},"logFileRoot")," option in ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME/config/app.toml"),"."),(0,i.kt)("li",{parentName:"ul"},"Service Port: RPC service listens on port ",(0,i.kt)("inlineCode",{parentName:"li"},"27147")," and P2P service listens on port ",(0,i.kt)("inlineCode",{parentName:"li"},"27146")," by default.\nMake sure these two ports are open before starting a full node, unless the full node has to listen on other ports."),(0,i.kt)("li",{parentName:"ul"},"Store: All the state and block data will store under ",(0,i.kt)("inlineCode",{parentName:"li"},"$BNCHOME/data"),", do not delete or edit any of these files.")),(0,i.kt)("h2",{id:"get-extra-information-from-your-fullnode"},"Get Extra Information From Your Fullnode"),(0,i.kt)("p",null,"If you have a Full Node running, then you can publish extra messages to local files."),(0,i.kt)("h5",{id:"monitor-syncing-process"},"Monitor Syncing Process"),(0,i.kt)("p",null,"You can verify if state sync is done by ",(0,i.kt)("inlineCode",{parentName:"p"},"curl localhost:27147/status")," several times and see whether ",(0,i.kt)("inlineCode",{parentName:"p"},"latest_block_height")," is increasing in response."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'"sync_info": {\n ...\n "latest_block_height": "878092",\n "latest_block_time": "2019-04-15T00:01:22.610803768Z",\n ...\n}\n')),(0,i.kt)("h2",{id:"prometheus-metrics"},"Prometheus Metrics"),(0,i.kt)("p",null,"Prometheus is enabled on port ",(0,i.kt)("inlineCode",{parentName:"p"},"28660")," by default, and the endpoint is ",(0,i.kt)("inlineCode",{parentName:"p"},"/metrics"),"."),(0,i.kt)("h2",{id:"testnet-tools"},"Testnet Tools"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://testnet-explorer.bnbchain.org/"},"Explorer"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/df71083d.58f48ae4.js b/assets/js/df71083d.e95b359e.js similarity index 81% rename from assets/js/df71083d.58f48ae4.js rename to assets/js/df71083d.e95b359e.js index 6cba83d1a8..85d49b5ed2 100644 --- a/assets/js/df71083d.58f48ae4.js +++ b/assets/js/df71083d.e95b359e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[3369],{3905:(t,e,a)=>{a.d(e,{Zo:()=>p,kt:()=>d});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function o(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function l(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var i=n.createContext({}),c=function(t){var e=n.useContext(i),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},p=function(t){var e=c(t.components);return n.createElement(i.Provider,{value:e},t.children)},m="mdxType",h={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,o=t.originalType,i=t.parentName,p=s(t,["components","mdxType","originalType","parentName"]),m=c(a),u=r,d=m["".concat(i,".").concat(u)]||m[u]||h[u]||o;return a?n.createElement(d,l(l({ref:e},p),{},{components:a})):n.createElement(d,l({ref:e},p))}));function d(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=a.length,l=new Array(o);l[0]=u;var s={};for(var i in e)hasOwnProperty.call(e,i)&&(s[i]=e[i]);s.originalType=t,s[m]="string"==typeof t?t:r,l[1]=s;for(var c=2;c{a.r(e),a.d(e,{assets:()=>i,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(83117),r=(a(67294),a(3905));const o={sidebar_label:"Math Wallet",hide_table_of_contents:!1},l="How to use Math Wallet for BNB Smart Chain",s={unversionedId:"wallet/math",id:"wallet/math",title:"How to use Math Wallet for BNB Smart Chain",description:"Install",source:"@site/docs/wallet/math.md",sourceDirName:"wallet",slug:"/wallet/math",permalink:"/docs/wallet/math",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/wallet/math.md",tags:[],version:"current",frontMatter:{sidebar_label:"Math Wallet",hide_table_of_contents:!1},sidebar:"bscSideBar",previous:{title:"Arkane",permalink:"/docs/wallet/arkane"},next:{title:"MyEtherWallet",permalink:"/docs/wallet/myetherwallet"}},i={},c=[{value:"Install",id:"install",level:2},{value:"Setup Your Wallet",id:"setup-your-wallet",level:2},{value:"Get Testnet Fund",id:"get-testnet-fund",level:2},{value:"Transfer BNB from BSC to BC in Testnet",id:"transfer-bnb-from-bsc-to-bc-in-testnet",level:2},{value:"Transfer BEP20 from BSC to BC in Testnet",id:"transfer-bep20-from-bsc-to-bc-in-testnet",level:2},{value:"1. Approve this transactionimg",id:"1-approve-this-transactionimg",level:3},{value:"2. Send BEP20 To BCimg",id:"2-send-bep20-to-bcimg",level:3}],p={toc:c},m="wrapper";function h(t){let{components:e,...a}=t;return(0,r.kt)(m,(0,n.Z)({},p,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"how-to-use-math-wallet-for-bnb-smart-chain"},"How to use Math Wallet for BNB Smart Chain"),(0,r.kt)("h2",{id:"install"},"Install"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Get App from Chrome web store"),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/XbwCKYstUkfmKqHeaZHsU712-id33U5UvR5Dniq2UuwUIRnM8C-cTscbJixIKSFMTCkVBrdb3zmgCa2leASOMlUAgM139TalYkZLyb_eUhWc6xWnTbDj4I8ERd6FI5GlXEYQ2XrL",alt:"img",style:{zoom:"50%"}})),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Add to your browser, for example, Brave"),(0,r.kt)("img",{src:"https://lh6.googleusercontent.com/li_pfeaAEkB4UyYwOl1TdjoF7i7X9lvi8UNPBoUJQJ5Kd7V2Ptaw-00cMzM2CGeKuWb4c_meuE7UWuiPfYpplRTJhrqluYsPyCnfEGNxKJg9znh_o5iyUVitq4kPQ64qNB8zz9ej",alt:"img",style:{zoom:"33%"}}))),(0,r.kt)("img",{src:"https://lh4.googleusercontent.com/b0aBH_0jXMg2U4Ixm-ids57EGqluIih3tQLqOaZIQw3lHW3685vI9QUlcIjCVB7EThsRx86hJwT1jYEGCHHfcyTraY1eStP8VxThXUtgvRypsXyEsw4-bh8Tem9tH2LtUM5_izph",alt:"img",style:{zoom:"50%"}}),(0,r.kt)("h2",{id:"setup-your-wallet"},"Setup Your Wallet"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Set your password")),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("img",{src:"https://lh4.googleusercontent.com/04v_hzZBF2wOiNk3XYDKgXi0CzVtfChzC9bIoT0EwCtHMYpGk1OaDfz1bCHAgegKxNHzA14mtHQDoeFnaOTX_BStwTC_GNb-bTzpOihIwjSumdnb2uZtR1obgDYoJwb3aiURKMMz",alt:"img",style:{zoom:"50%"}})),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Choose BSC network"))),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/vAIW4n_vrcfuqkUJibumqPSGwv3_HeTazQSz0nEFyQz9hntjytTF-i_QiGmPUayUXqMM42dgjJIEdB-dBSygz7i1mrrIJmvQ-6IJNx_HLGtFajxuBDQgXeZd7TTokOX19CSR_OEh",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Choose BNB Smart Chain from this list")),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/k9zfSDN3dSEZDwqqjQriozV-8QiC0Rk1V8U3hWf6i_OD8WvDdmaKL4ZRUVh7nvkAtH0Jl8ZJTj1OEalWwvDY_tdTlRd6jsx3NKYF9pffkMIW97dUMjqmCEDpOcQMNHLv02dfCYHk",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},"Create Your Wallet")),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/ov1JDt8uLKJc8Q8gECGlree_rBkDu6oIUaXLuST6EimwmMSdVlPJIFPBItPIIKl4LqpasKS63y4jRRzKXi5qoT5T_73pD64Q6le9eRI3nXNXEuWSURRdXI-jjl2Pfk0iTQyGMRkz",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("img",{src:"https://lh6.googleusercontent.com/dzx1pjMPq7F4e1N-1UJXrguzRh6W5DNJ3x1t1TsfJktpe2PkhPXWe3gytm-wMroCnhWv-StxFOaz2H54iSUSmIvwup-LshE3-z2AWnVG7ygpyhtE5BK_nOnTasw-CWJAvhOzxtFn",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:5},(0,r.kt)("li",{parentName:"ol"},"Save your private key")),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/fhgMWkIjTo_KE5QloGrYesFfaOSgHS6KdySsGjMBLYFH1mmRunRmLSTu4CD3ia4S7nWn044g9lvGIBLiH9MkikPBbIBetiWrOTY1TlQA84WJYieMbFpUeY5dTiR1L5eDO6m23c3C",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("p",null,"It\u2019s ready, and now you can get some testnet BNB from the faucet."),(0,r.kt)("h2",{id:"get-testnet-fund"},"Get Testnet Fund"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Copy your address.")),(0,r.kt)("img",{src:"https://lh3.googleusercontent.com/1WquPDgLagkXcni9u9yPXzgaagCRd0nzm49cZ516XZSRB_rlOuybVG48C4R2ozhiSlIizxEMI_J7GexZz64E4vUpH362rrAn74GP1ALLOFOZusF8qjM1Xk71cTo5-EWcFvvqpIRL",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Go to ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.binance.org/faucet-smart/"},"https://testnet.binance.org/faucet-smart/"))),(0,r.kt)("p",null,"Go to explorer to verify BNB is sent: ",(0,r.kt)("a",{parentName:"p",href:"https://testnet.bscscan.com/"},"https://testnet.bscscan.com/")),(0,r.kt)("h2",{id:"transfer-bnb-from-bsc-to-bc-in-testnet"},"Transfer BNB from BSC to BC in Testnet"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Create your BNB Chain Ganges Testnet address with tbnbcli")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Download the binary ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/node/releases/tag/v0.8.1"},"here"),(0,r.kt)("blockquote",{parentName:"li"},(0,r.kt)("p",{parentName:"blockquote"},"If you already have a backup of your recovery phrase from BNB Chain Ganges Testnet, it can be reused here.")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"tbnbcli keys add {wallet-alias}\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Go to this page: ",(0,r.kt)("a",{parentName:"li",href:"https://developer.mathwallet.org/bsc02/"},"https://developer.mathwallet.org/bsc02/"))),(0,r.kt)("p",null,"Go to this page for mainnet: ",(0,r.kt)("a",{parentName:"p",href:"https://developer.mathwallet.org/bsc01/"},"https://developer.mathwallet.org/bsc01/")),(0,r.kt)("p",null,"Paste your testnet address to ",(0,r.kt)("inlineCode",{parentName:"p"},"Recipient")," and fill the transfer amount.\n",(0,r.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/jBLdydCWQEKJ-ksWfixIUH8qrFC9JEaLw4SbGRWngKCWXAjQDzl0ZCKs3Ajn2ZILcnd2XJzZxK6x62DHNb7_VHaJFm78qvU6zD-fhp5p7KGyDesNz5q6hilLLRbuv1Ygw-46JoBq",alt:"img"})),(0,r.kt)("p",null,"Please note the fees are also deducted for paying gas and cross-chain transfer."),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Approve your transaction")),(0,r.kt)("p",null,(0,r.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/1LZhflItAfxbbPLppP_2mZQXhKlKbvAhk51-Or41wTaHY7Rs3B5g62QO1_4ymA0rgx8HoEmvCyEWbWSm_LOrxXyvHWZ24EsRVSJoLELHdprSiLAMLd5cDiDm_89Nd5z78CP0fPw5",alt:"img"})),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},"Confirm Reception in explorer\nLink: ",(0,r.kt)("a",{parentName:"li",href:"https://testnet-explorer.binance.org/"},"https://testnet-explorer.binance.org/"))),(0,r.kt)("h2",{id:"transfer-bep20-from-bsc-to-bc-in-testnet"},"Transfer BEP20 from BSC to BC in Testnet"),(0,r.kt)("p",null,"One of the key innovations of a dual-chain architecture is that token issuer can manage its assets on both chains. They could bind BEP2 tokens and BEP20 tokens together. In BNB Chain Ganges Testnet, there are several pegged tokens:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Pegged BTC on ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/testnet/asset/BTC-E24"},"BNB Beacon Chain Testnet")," and ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/address/0x6ce8dA28E2f864420840cF74474eFf5fD80E65B8#code"},"BNB Smart Chain Testnet")),(0,r.kt)("li",{parentName:"ul"},"Pegged ETH on ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/testnet/asset/ETH-64F"},"BNB Beacon Chain Testnet")," and ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/address/0xd66c6b4f0be8ce5b39d52e0fd1344c389929b378#code"},"BNB Smart Chain Testnet")),(0,r.kt)("li",{parentName:"ul"},"Pegged XRP on ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.binance.org/testnet/asset/XRP-C46"},"BNB Beacon Chain Testnet")," and ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/address/0xa83575490d7df4e2f47b7d38ef351a2722ca45b9#code"},"BNB Smart Chain Testnet"))),(0,r.kt)("p",null,"You can get some of these pegged tokens from faucet and transfer them back to BNB Beacon Chain testnet."),(0,r.kt)("h3",{id:"1-approve-this-transactionimg"},"1. Approve this transaction",(0,r.kt)("img",{parentName:"h3",src:"https://lh3.googleusercontent.com/bYfuPLKjeTopR_VUzr6MBEHZWy6UkJ10hlXICxbHh7LvoKi5Hdr2aW7Z_nSDgKphaCc9iOijoignzydzmYU1BGOyN6IRHJPHLKia1XD59651hS-EMU9vboqblgBSziivtZGdQ05e",alt:"img"})),(0,r.kt)("h3",{id:"2-send-bep20-to-bcimg"},"2. Send BEP20 To BC",(0,r.kt)("img",{parentName:"h3",src:"https://lh5.googleusercontent.com/_RKYU23BD2xhw-g63K8O3RRF1sEKGAC5zyTOIpWUJl9scDyn1kbjwEO6gjFPkVCeFMoG-8D0xvqNH17sJSlZP_FxCrduCqEKZqHfk8DtTnBk6XKHnHDLPAaR8VjVcNNWZsAw74FB",alt:"img"})))}h.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkbeta_BNB_Docs=self.webpackChunkbeta_BNB_Docs||[]).push([[3369],{3905:(t,e,a)=>{a.d(e,{Zo:()=>p,kt:()=>d});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function o(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function l(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var i=n.createContext({}),c=function(t){var e=n.useContext(i),a=e;return t&&(a="function"==typeof t?t(e):l(l({},e),t)),a},p=function(t){var e=c(t.components);return n.createElement(i.Provider,{value:e},t.children)},m="mdxType",h={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,o=t.originalType,i=t.parentName,p=s(t,["components","mdxType","originalType","parentName"]),m=c(a),u=r,d=m["".concat(i,".").concat(u)]||m[u]||h[u]||o;return a?n.createElement(d,l(l({ref:e},p),{},{components:a})):n.createElement(d,l({ref:e},p))}));function d(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var o=a.length,l=new Array(o);l[0]=u;var s={};for(var i in e)hasOwnProperty.call(e,i)&&(s[i]=e[i]);s.originalType=t,s[m]="string"==typeof t?t:r,l[1]=s;for(var c=2;c{a.r(e),a.d(e,{assets:()=>i,contentTitle:()=>l,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=a(83117),r=(a(67294),a(3905));const o={sidebar_label:"Math Wallet",hide_table_of_contents:!1},l="How to use Math Wallet for BNB Smart Chain",s={unversionedId:"wallet/math",id:"wallet/math",title:"How to use Math Wallet for BNB Smart Chain",description:"Install",source:"@site/docs/wallet/math.md",sourceDirName:"wallet",slug:"/wallet/math",permalink:"/docs/wallet/math",draft:!1,editUrl:"https://github.com/bnb-chain/bnb-chain.github.io/blob/master/docs/wallet/math.md",tags:[],version:"current",frontMatter:{sidebar_label:"Math Wallet",hide_table_of_contents:!1},sidebar:"bscSideBar",previous:{title:"Arkane",permalink:"/docs/wallet/arkane"},next:{title:"MyEtherWallet",permalink:"/docs/wallet/myetherwallet"}},i={},c=[{value:"Install",id:"install",level:2},{value:"Setup Your Wallet",id:"setup-your-wallet",level:2},{value:"Get Testnet Fund",id:"get-testnet-fund",level:2},{value:"Transfer BNB from BSC to BC in Testnet",id:"transfer-bnb-from-bsc-to-bc-in-testnet",level:2},{value:"Transfer BEP20 from BSC to BC in Testnet",id:"transfer-bep20-from-bsc-to-bc-in-testnet",level:2},{value:"1. Approve this transactionimg",id:"1-approve-this-transactionimg",level:3},{value:"2. Send BEP20 To BCimg",id:"2-send-bep20-to-bcimg",level:3}],p={toc:c},m="wrapper";function h(t){let{components:e,...a}=t;return(0,r.kt)(m,(0,n.Z)({},p,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"how-to-use-math-wallet-for-bnb-smart-chain"},"How to use Math Wallet for BNB Smart Chain"),(0,r.kt)("h2",{id:"install"},"Install"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Get App from Chrome web store"),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/XbwCKYstUkfmKqHeaZHsU712-id33U5UvR5Dniq2UuwUIRnM8C-cTscbJixIKSFMTCkVBrdb3zmgCa2leASOMlUAgM139TalYkZLyb_eUhWc6xWnTbDj4I8ERd6FI5GlXEYQ2XrL",alt:"img",style:{zoom:"50%"}})),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Add to your browser, for example, Brave"),(0,r.kt)("img",{src:"https://lh6.googleusercontent.com/li_pfeaAEkB4UyYwOl1TdjoF7i7X9lvi8UNPBoUJQJ5Kd7V2Ptaw-00cMzM2CGeKuWb4c_meuE7UWuiPfYpplRTJhrqluYsPyCnfEGNxKJg9znh_o5iyUVitq4kPQ64qNB8zz9ej",alt:"img",style:{zoom:"33%"}}))),(0,r.kt)("img",{src:"https://lh4.googleusercontent.com/b0aBH_0jXMg2U4Ixm-ids57EGqluIih3tQLqOaZIQw3lHW3685vI9QUlcIjCVB7EThsRx86hJwT1jYEGCHHfcyTraY1eStP8VxThXUtgvRypsXyEsw4-bh8Tem9tH2LtUM5_izph",alt:"img",style:{zoom:"50%"}}),(0,r.kt)("h2",{id:"setup-your-wallet"},"Setup Your Wallet"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Set your password")),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("img",{src:"https://lh4.googleusercontent.com/04v_hzZBF2wOiNk3XYDKgXi0CzVtfChzC9bIoT0EwCtHMYpGk1OaDfz1bCHAgegKxNHzA14mtHQDoeFnaOTX_BStwTC_GNb-bTzpOihIwjSumdnb2uZtR1obgDYoJwb3aiURKMMz",alt:"img",style:{zoom:"50%"}})),(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("p",{parentName:"li"},"Choose BSC network"))),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/vAIW4n_vrcfuqkUJibumqPSGwv3_HeTazQSz0nEFyQz9hntjytTF-i_QiGmPUayUXqMM42dgjJIEdB-dBSygz7i1mrrIJmvQ-6IJNx_HLGtFajxuBDQgXeZd7TTokOX19CSR_OEh",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Choose BNB Smart Chain from this list")),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/k9zfSDN3dSEZDwqqjQriozV-8QiC0Rk1V8U3hWf6i_OD8WvDdmaKL4ZRUVh7nvkAtH0Jl8ZJTj1OEalWwvDY_tdTlRd6jsx3NKYF9pffkMIW97dUMjqmCEDpOcQMNHLv02dfCYHk",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},"Create Your Wallet")),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/ov1JDt8uLKJc8Q8gECGlree_rBkDu6oIUaXLuST6EimwmMSdVlPJIFPBItPIIKl4LqpasKS63y4jRRzKXi5qoT5T_73pD64Q6le9eRI3nXNXEuWSURRdXI-jjl2Pfk0iTQyGMRkz",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("img",{src:"https://lh6.googleusercontent.com/dzx1pjMPq7F4e1N-1UJXrguzRh6W5DNJ3x1t1TsfJktpe2PkhPXWe3gytm-wMroCnhWv-StxFOaz2H54iSUSmIvwup-LshE3-z2AWnVG7ygpyhtE5BK_nOnTasw-CWJAvhOzxtFn",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:5},(0,r.kt)("li",{parentName:"ol"},"Save your private key")),(0,r.kt)("img",{src:"https://lh5.googleusercontent.com/fhgMWkIjTo_KE5QloGrYesFfaOSgHS6KdySsGjMBLYFH1mmRunRmLSTu4CD3ia4S7nWn044g9lvGIBLiH9MkikPBbIBetiWrOTY1TlQA84WJYieMbFpUeY5dTiR1L5eDO6m23c3C",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("p",null,"It\u2019s ready, and now you can get some testnet BNB from the faucet."),(0,r.kt)("h2",{id:"get-testnet-fund"},"Get Testnet Fund"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Copy your address.")),(0,r.kt)("img",{src:"https://lh3.googleusercontent.com/1WquPDgLagkXcni9u9yPXzgaagCRd0nzm49cZ516XZSRB_rlOuybVG48C4R2ozhiSlIizxEMI_J7GexZz64E4vUpH362rrAn74GP1ALLOFOZusF8qjM1Xk71cTo5-EWcFvvqpIRL",alt:"img",style:{zoom:"33%"}}),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Go to ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.binance.org/faucet-smart/"},"https://testnet.binance.org/faucet-smart/"))),(0,r.kt)("p",null,"Go to explorer to verify BNB is sent: ",(0,r.kt)("a",{parentName:"p",href:"https://testnet.bscscan.com/"},"https://testnet.bscscan.com/")),(0,r.kt)("h2",{id:"transfer-bnb-from-bsc-to-bc-in-testnet"},"Transfer BNB from BSC to BC in Testnet"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Create your BNB Chain Ganges Testnet address with tbnbcli")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Download the binary ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/bnb-chain/node/releases/tag/v0.8.1"},"here"),(0,r.kt)("blockquote",{parentName:"li"},(0,r.kt)("p",{parentName:"blockquote"},"If you already have a backup of your recovery phrase from BNB Chain Ganges Testnet, it can be reused here.")))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"tbnbcli keys add {wallet-alias}\n")),(0,r.kt)("ol",{start:2},(0,r.kt)("li",{parentName:"ol"},"Go to this page: ",(0,r.kt)("a",{parentName:"li",href:"https://developer.mathwallet.org/bsc02/"},"https://developer.mathwallet.org/bsc02/"))),(0,r.kt)("p",null,"Go to this page for mainnet: ",(0,r.kt)("a",{parentName:"p",href:"https://developer.mathwallet.org/bsc01/"},"https://developer.mathwallet.org/bsc01/")),(0,r.kt)("p",null,"Paste your testnet address to ",(0,r.kt)("inlineCode",{parentName:"p"},"Recipient")," and fill the transfer amount.\n",(0,r.kt)("img",{parentName:"p",src:"https://lh6.googleusercontent.com/jBLdydCWQEKJ-ksWfixIUH8qrFC9JEaLw4SbGRWngKCWXAjQDzl0ZCKs3Ajn2ZILcnd2XJzZxK6x62DHNb7_VHaJFm78qvU6zD-fhp5p7KGyDesNz5q6hilLLRbuv1Ygw-46JoBq",alt:"img"})),(0,r.kt)("p",null,"Please note the fees are also deducted for paying gas and cross-chain transfer."),(0,r.kt)("ol",{start:3},(0,r.kt)("li",{parentName:"ol"},"Approve your transaction")),(0,r.kt)("p",null,(0,r.kt)("img",{parentName:"p",src:"https://lh3.googleusercontent.com/1LZhflItAfxbbPLppP_2mZQXhKlKbvAhk51-Or41wTaHY7Rs3B5g62QO1_4ymA0rgx8HoEmvCyEWbWSm_LOrxXyvHWZ24EsRVSJoLELHdprSiLAMLd5cDiDm_89Nd5z78CP0fPw5",alt:"img"})),(0,r.kt)("ol",{start:4},(0,r.kt)("li",{parentName:"ol"},"Confirm Reception in explorer\nLink: ",(0,r.kt)("a",{parentName:"li",href:"https://testnet-explorer.bnbchain.org/"},"https://testnet-explorer.bnbchain.org/"))),(0,r.kt)("h2",{id:"transfer-bep20-from-bsc-to-bc-in-testnet"},"Transfer BEP20 from BSC to BC in Testnet"),(0,r.kt)("p",null,"One of the key innovations of a dual-chain architecture is that token issuer can manage its assets on both chains. They could bind BEP2 tokens and BEP20 tokens together. In BNB Chain Ganges Testnet, there are several pegged tokens:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Pegged BTC on ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/testnet/asset/BTC-E24"},"BNB Beacon Chain Testnet")," and ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/address/0x6ce8dA28E2f864420840cF74474eFf5fD80E65B8#code"},"BNB Smart Chain Testnet")),(0,r.kt)("li",{parentName:"ul"},"Pegged ETH on ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/testnet/asset/ETH-64F"},"BNB Beacon Chain Testnet")," and ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/address/0xd66c6b4f0be8ce5b39d52e0fd1344c389929b378#code"},"BNB Smart Chain Testnet")),(0,r.kt)("li",{parentName:"ul"},"Pegged XRP on ",(0,r.kt)("a",{parentName:"li",href:"https://explorer.bnbchain.org/testnet/asset/XRP-C46"},"BNB Beacon Chain Testnet")," and ",(0,r.kt)("a",{parentName:"li",href:"https://testnet.bscscan.com/address/0xa83575490d7df4e2f47b7d38ef351a2722ca45b9#code"},"BNB Smart Chain Testnet"))),(0,r.kt)("p",null,"You can get some of these pegged tokens from faucet and transfer them back to BNB Beacon Chain testnet."),(0,r.kt)("h3",{id:"1-approve-this-transactionimg"},"1. Approve this transaction",(0,r.kt)("img",{parentName:"h3",src:"https://lh3.googleusercontent.com/bYfuPLKjeTopR_VUzr6MBEHZWy6UkJ10hlXICxbHh7LvoKi5Hdr2aW7Z_nSDgKphaCc9iOijoignzydzmYU1BGOyN6IRHJPHLKia1XD59651hS-EMU9vboqblgBSziivtZGdQ05e",alt:"img"})),(0,r.kt)("h3",{id:"2-send-bep20-to-bcimg"},"2. Send BEP20 To BC",(0,r.kt)("img",{parentName:"h3",src:"https://lh5.googleusercontent.com/_RKYU23BD2xhw-g63K8O3RRF1sEKGAC5zyTOIpWUJl9scDyn1kbjwEO6gjFPkVCeFMoG-8D0xvqNH17sJSlZP_FxCrduCqEKZqHfk8DtTnBk6XKHnHDLPAaR8VjVcNNWZsAw74FB",alt:"img"})))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.70dc13e1.js b/assets/js/runtime~main.0a64dec0.js similarity index 83% rename from assets/js/runtime~main.70dc13e1.js rename to assets/js/runtime~main.0a64dec0.js index ea7c792fd3..a30b34e19f 100644 --- a/assets/js/runtime~main.70dc13e1.js +++ b/assets/js/runtime~main.0a64dec0.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,b,c,d,f={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var b=t[e]={id:e,loaded:!1,exports:{}};return f[e].call(b.exports,b,b.exports,r),b.loaded=!0,b.exports}r.m=f,r.c=t,e=[],r.O=(a,b,c,d)=>{if(!b){var f=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](b[o])))?b.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[b,c,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var f={};a=a||[null,b({}),b([]),b(b)];for(var t=2&c&&e;"object"==typeof t&&!~a.indexOf(t);t=b(t))Object.getOwnPropertyNames(t).forEach((a=>f[a]=()=>e[a]));return f.default=()=>e,r.d(d,f),d},r.d=(e,a)=>{for(var b in a)r.o(a,b)&&!r.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,b)=>(r.f[b](e,a),a)),[])),r.u=e=>"assets/js/"+({26:"f4b7dbf9",41:"ea7f81af",53:"935f2afb",76:"7da45d1b",78:"1a12b3eb",188:"0e19568b",246:"699b933d",276:"0a24bc6c",495:"0d52c50f",512:"a8c31594",542:"53ba04fa",615:"426df75b",617:"dfd3236d",624:"57dfcb57",715:"56834eaf",740:"9e9695ea",754:"592d8667",775:"c9229a84",836:"0480b142",841:"4904453e",844:"f8f60af7",855:"f0b44263",859:"8c20990f",899:"be68102f",905:"00868d8e",910:"6ecc76ed",913:"7819d3b5",929:"097a92d8",933:"97a1f5f3",956:"ae5b1410",961:"5fa0bca2",1015:"adb40ef5",1050:"f1bcd6ab",1051:"a126a101",1120:"e7245c0e",1166:"ea8e0bfc",1208:"586689e4",1224:"45b5f33c",1318:"65fc7665",1327:"8882742c",1372:"1db64337",1373:"c29fd1d9",1502:"305f3035",1544:"a8e5477a",1577:"6974a59e",1595:"936cbf1c",1623:"de5cb490",1637:"c0602f71",1639:"bd2f937f",1731:"0e800433",1753:"073e83ba",1805:"6e83d4d1",1806:"c1d67c6f",1824:"e29e6131",1861:"96b89644",1902:"6dd408b0",1915:"9d12552c",1938:"6639555e",1939:"208ad0b7",1950:"db2ee795",1969:"61b88e35",1994:"776f2dca",1998:"70ebf55c",2010:"1bc24ad6",2025:"02e49d04",2042:"9ee78e3d",2076:"c79c6419",2100:"725bcd8a",2136:"38ea6270",2182:"3f4f1b85",2211:"82c6054d",2212:"7d370da3",2221:"69560f14",2239:"b7a29a20",2248:"4af00c2c",2258:"bb56c414",2264:"7d930281",2271:"6b7ff034",2280:"3ca8d367",2284:"2b9377a0",2303:"fb2aac14",2320:"3c355134",2403:"84c6b5d4",2409:"1f96dd1b",2466:"19ee63d5",2506:"df23e008",2544:"4aeca0dd",2596:"049c7c64",2673:"0d73c327",2691:"c52b2720",2692:"af50bec2",2694:"01df7f3f",2698:"49100cb7",2733:"055d8f40",2800:"168c1296",2853:"95314b82",2939:"2727f0e2",2962:"3b7f1d9e",2970:"8bd870ef",2973:"5d256d9e",2980:"0866dc88",3012:"ceddd399",3085:"1f391b9e",3110:"e3677851",3141:"4c0e0ec5",3160:"1a9c1393",3163:"652c66c5",3226:"c24cede4",3231:"dcec6889",3259:"98ee90af",3268:"5724b0c4",3277:"99ef32f4",3306:"03188927",3311:"8c8eed79",3343:"1d23a3cc",3362:"c09d0117",3369:"df71083d",3406:"767b2b71",3409:"0b13d5e8",3436:"a30d6a39",3442:"92a6a6aa",3470:"2033fe1d",3479:"820a1e19",3550:"39c0d873",3719:"8f96c667",3753:"8864f5f8",3770:"14da9b10",3819:"2fa1e944",3831:"d9b93d98",3913:"7cc7300b",3929:"4479d28a",3990:"c8a2ef77",4002:"59fd2fc7",4099:"86e33bb9",4117:"3ffb3654",4132:"9609c8f6",4165:"bba8d026",4195:"c4f5d8e4",4225:"61509a60",4234:"cc32ad1c",4317:"dbb9ff6e",4330:"5df04955",4341:"b694928c",4365:"b66a59f2",4417:"93991a3d",4450:"89381d81",4466:"ffb2b4d8",4526:"379ce79b",4528:"2fe8ce59",4554:"68396417",4581:"cf85ede8",4621:"a35af971",4662:"e64f9346",4663:"337885e6",4835:"7d79a86a",4935:"0d78eb08",4979:"4b96ce56",4995:"39b3fdd1",5074:"bc8da1ef",5090:"320800f4",5160:"d7c447b7",5174:"54a5b3e2",5178:"aba2fd11",5182:"80118b91",5184:"6d5ccf3c",5188:"37c50b0a",5205:"4b15b3ca",5227:"9ea974a1",5333:"7b6b3838",5334:"28682005",5352:"bef893b8",5353:"b0d837a2",5398:"4e426588",5444:"49850653",5456:"eaea0c8e",5478:"5f00e493",5487:"4df2b942",5511:"05720bc7",5534:"12ad0883",5546:"cd5a7ece",5605:"cff456ab",5614:"b79fb02a",5668:"9d9e3a9f",5677:"913d1df3",5687:"843b88bc",5756:"52188b66",5766:"ab6ec9c9",5816:"b172b294",5827:"2179e181",5845:"e4fcb135",5894:"841a1ae5",5898:"d2ef7841",6022:"8311baf6",6112:"9233b6a0",6128:"61c2b592",6160:"13cbbc45",6175:"3fe1b31e",6197:"18caa820",6212:"674b291d",6266:"864b21f2",6342:"8388d427",6392:"1fe0b14c",6408:"3d2e3c20",6434:"ac3eef92",6453:"7ca3659a",6588:"675ae01b",6670:"7335f490",6711:"db0000f8",6788:"695b1d89",6798:"f4c65d51",6807:"146e3239",6833:"c801e96e",6843:"5dc3c8f6",6865:"42e796b7",6891:"ae1b1adb",6899:"7f9f2386",6911:"2c8e0782",6942:"4356940c",6980:"7bf9570a",7006:"718d2dcc",7009:"039e4454",7021:"b77aed85",7055:"e0350bff",7086:"6794fe4c",7093:"de4a6a6c",7144:"931e9fae",7162:"d589d3a7",7232:"4f0a142f",7331:"b6cb8034",7337:"4e3e8b54",7372:"9bfac0a1",7414:"393be207",7479:"95a2a291",7554:"aa4704fa",7560:"6cf6a508",7608:"d21a06aa",7631:"a9d4f8dd",7671:"14304958",7724:"e588fe04",7729:"658db2fd",7861:"0d351afe",7903:"ada04912",7906:"37390557",7918:"17896441",7920:"1a4e3797",7958:"6b4e7cc0",7976:"e9e588e3",8060:"58a7e9f4",8090:"4248bf8f",8107:"bc5c4e3f",8209:"a3a80959",8247:"fda3c7b4",8374:"f7810842",8452:"a719f608",8475:"eab1b5b1",8478:"4b768e8d",8489:"e48c32e6",8496:"98315e5f",8566:"74da69c6",8573:"ca21e936",8603:"266edd5c",8609:"b5189564",8629:"b8327182",8776:"44bcb8b6",8795:"7b298cde",8852:"b7a8c418",8915:"d72e2d41",8994:"dca35320",9009:"5d035c0c",9109:"601bd9b3",9176:"8353ce31",9247:"12690ca6",9248:"efa021b8",9263:"a1d0e770",9299:"4779363e",9340:"436fdc09",9371:"0a1df218",9373:"31ecfdf3",9392:"76061115",9402:"606e9499",9462:"243acfc7",9514:"1be78505",9539:"a72ad06f",9551:"597afff9",9581:"437509ae",9735:"4ba7e5a3",9835:"6b502c6d",9863:"015c4fcd",9868:"827c765e",9883:"d8c7cd00",9943:"cad38203",9962:"2927d995"}[e]||e)+"."+{26:"96b8055b",41:"af57e2d2",53:"404f490b",76:"44124ea3",78:"6d6bcbb6",188:"19a2bba6",246:"e718c599",276:"28d33775",495:"c2c02740",512:"1997e550",542:"2bb84c7d",615:"e6c4687c",617:"4e1cafaf",624:"f3e3db5d",715:"5595bc4d",740:"bfc96b1a",754:"08fa47de",775:"11a12808",836:"4ee5e226",841:"c1ac5275",844:"064502c7",855:"9062825b",859:"b9ab6251",899:"9bedfd43",905:"c203dcd9",910:"21fd49c7",913:"ca8b336a",929:"c6975893",933:"390b35a7",956:"ac871a31",961:"543672d9",1015:"55c3007b",1050:"08891208",1051:"3d3f63b1",1120:"ccdfab5f",1166:"9048d189",1208:"a8eb7b02",1224:"4e4ae945",1318:"0e270765",1327:"9f0a0c5d",1372:"7f241101",1373:"2789d710",1502:"ad31ea38",1544:"191098bc",1577:"23d1f155",1595:"c61503f5",1623:"dc5629e2",1637:"a6532457",1639:"36f1b932",1731:"4ef576b0",1753:"f335f52f",1805:"d71da16d",1806:"b3968c2c",1824:"5dfc0d72",1861:"57fb505a",1902:"fc4552e5",1915:"c7f17d49",1938:"c2e65a44",1939:"ab202a25",1950:"46536603",1969:"f56392f9",1994:"a1347c2f",1998:"28cddd1d",2010:"f7463294",2025:"48f32295",2040:"b5f0a78a",2042:"3393a79d",2076:"ddd4b7f8",2100:"6e8a0c39",2136:"954d02d3",2182:"2043b977",2211:"1bd2b6f9",2212:"64fdd65a",2221:"9ca30f76",2239:"6b6c90cf",2248:"d7695d79",2258:"6a1e3980",2264:"49cf5e71",2271:"b488cf4d",2280:"3b5a2b29",2284:"0b81078f",2303:"706f884f",2320:"793b455c",2403:"fdbff8aa",2409:"db49ec37",2466:"d2ae9168",2506:"8441a804",2544:"e2c2d10c",2596:"960a5675",2673:"00e4b108",2691:"f813b6d4",2692:"36be5123",2694:"109edf59",2698:"cf0c4df3",2733:"ba9b8eea",2800:"4b02613e",2853:"f6d9fac2",2939:"9de1860d",2962:"be59f268",2970:"6fe1e767",2973:"2d6b2717",2980:"a8ddcdaa",3012:"43f1a9b4",3085:"1266fa24",3110:"e6fc9892",3141:"53b6dab6",3160:"4c9bf0ff",3163:"0c353f3b",3226:"07474248",3231:"e6e4e5f0",3259:"ba1193b7",3268:"67513515",3277:"2adf8d09",3306:"6e59cf56",3311:"bc2604ba",3343:"4e547cf2",3362:"4070a968",3369:"58f48ae4",3406:"7082f47d",3409:"291c160e",3436:"96744a72",3442:"75a04d65",3470:"ce919eb8",3479:"da91ab7a",3550:"8d5edf50",3719:"f3c7f3ca",3753:"0f00a8e7",3770:"88af5bd7",3819:"453d9144",3831:"feda5710",3913:"6a1104d0",3929:"1a84b211",3948:"dea9bfc8",3990:"c156abb8",4002:"a0a4399e",4099:"9c4a7626",4117:"5efd2461",4132:"07b0d818",4165:"598f5a65",4195:"7b613710",4225:"28ecd885",4234:"51aa56f2",4317:"42fd8145",4330:"f557a678",4341:"9505405d",4365:"b2e779c9",4417:"0166ae3c",4450:"29eef9d8",4466:"49d11827",4526:"525a28a4",4528:"32a94044",4554:"ce72cf05",4581:"1e94a228",4621:"8677ab65",4662:"13e04ab3",4663:"7020c133",4835:"3997c67c",4935:"bea55944",4972:"fbceddc1",4979:"013d1b86",4995:"93350492",5074:"594f7882",5090:"6e444dd8",5160:"dcce9f04",5174:"6696276f",5178:"66c90017",5182:"06a0077a",5184:"0bae49c9",5188:"9b7c631b",5205:"b407809f",5227:"77fc280f",5333:"69d38f79",5334:"17af5d95",5352:"b15aca7b",5353:"0590909b",5398:"d14e3010",5444:"efa0012e",5456:"dcb3830e",5478:"9e578c00",5487:"e8a90490",5511:"dde50634",5534:"05c389de",5546:"126fad54",5605:"5a916ccc",5614:"a6066f9e",5668:"85922198",5677:"1fcc43ec",5687:"df382f1a",5756:"a01be6ec",5766:"2d2dd0f7",5816:"a4883174",5827:"ea3c2b6c",5845:"f8edf82c",5894:"2b0f7450",5898:"1b67b080",6022:"29ea12bb",6112:"a0a1ffd7",6128:"5cd544a3",6160:"0d081498",6175:"c59cdc9c",6197:"080a9c5b",6212:"a98a011c",6266:"65d3e2f2",6342:"889839a2",6392:"3eda5d0e",6408:"d23d74ed",6434:"a5ff3211",6453:"ff505ef0",6588:"eecc4183",6670:"acf93fc0",6711:"dac74f98",6788:"3c031b06",6798:"898e649a",6807:"d6091ac8",6833:"6cda1193",6843:"6379637b",6865:"5266a32c",6891:"4c335725",6899:"85a564f1",6911:"003b9995",6942:"914589df",6945:"de5501ca",6980:"c2140051",7006:"3ef357d7",7009:"c3085012",7021:"24aa0eaf",7055:"d01e7f65",7086:"f51b2aac",7093:"d26478e2",7144:"b9f62128",7162:"020bf779",7232:"4d0e75c0",7331:"2bb24b89",7337:"2dfa10c8",7372:"a2ffeae3",7414:"78f56f39",7479:"4e07e9c0",7554:"a5ab7a3f",7560:"a728b648",7608:"d9211708",7631:"cf70099d",7671:"dc263494",7724:"445ce598",7729:"2363d5f8",7861:"3bf30a71",7903:"3d81c50d",7906:"d73acc14",7918:"45947f76",7920:"e7775ca7",7958:"18296143",7976:"9a738974",8060:"789195b9",8090:"346fc489",8107:"78f467fa",8209:"74e9deea",8247:"9c66db8e",8374:"86162268",8452:"a62a3a86",8475:"baf1e42e",8478:"2b00e631",8489:"f29c46a4",8496:"69dcfbf4",8566:"225c30da",8573:"f37adfe9",8603:"0869b318",8609:"aa7a77eb",8629:"63e74855",8776:"89806b67",8795:"e3c4d3c5",8852:"ee6f4262",8894:"8b8574c7",8915:"03bc5f1d",8994:"2c64ec75",9009:"bb6f00b7",9109:"6e98404a",9176:"d63404d8",9247:"6f4775ba",9248:"ce38e442",9263:"2c08d665",9299:"845092cd",9340:"a15bc5df",9371:"cb2a8e65",9373:"1d945b2c",9392:"f1f72bd6",9402:"0ae53c8b",9462:"b705c32c",9514:"4de3a667",9539:"d0ee743b",9551:"a7fe0df7",9581:"6a1339f9",9724:"51fefac4",9735:"d85bb2b7",9835:"d85941e8",9863:"13c5d51d",9868:"bb2e0cc6",9883:"d2798c5d",9943:"49d6575b",9962:"a0987fa8"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),c={},d="beta_BNB_Docs:",r.l=(e,a,b,f)=>{if(c[e])c[e].push(a);else{var t,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=c[e];if(delete c[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={14304958:"7671",17896441:"7918",28682005:"5334",37390557:"7906",49850653:"5444",68396417:"4554",76061115:"9392",f4b7dbf9:"26",ea7f81af:"41","935f2afb":"53","7da45d1b":"76","1a12b3eb":"78","0e19568b":"188","699b933d":"246","0a24bc6c":"276","0d52c50f":"495",a8c31594:"512","53ba04fa":"542","426df75b":"615",dfd3236d:"617","57dfcb57":"624","56834eaf":"715","9e9695ea":"740","592d8667":"754",c9229a84:"775","0480b142":"836","4904453e":"841",f8f60af7:"844",f0b44263:"855","8c20990f":"859",be68102f:"899","00868d8e":"905","6ecc76ed":"910","7819d3b5":"913","097a92d8":"929","97a1f5f3":"933",ae5b1410:"956","5fa0bca2":"961",adb40ef5:"1015",f1bcd6ab:"1050",a126a101:"1051",e7245c0e:"1120",ea8e0bfc:"1166","586689e4":"1208","45b5f33c":"1224","65fc7665":"1318","8882742c":"1327","1db64337":"1372",c29fd1d9:"1373","305f3035":"1502",a8e5477a:"1544","6974a59e":"1577","936cbf1c":"1595",de5cb490:"1623",c0602f71:"1637",bd2f937f:"1639","0e800433":"1731","073e83ba":"1753","6e83d4d1":"1805",c1d67c6f:"1806",e29e6131:"1824","96b89644":"1861","6dd408b0":"1902","9d12552c":"1915","6639555e":"1938","208ad0b7":"1939",db2ee795:"1950","61b88e35":"1969","776f2dca":"1994","70ebf55c":"1998","1bc24ad6":"2010","02e49d04":"2025","9ee78e3d":"2042",c79c6419:"2076","725bcd8a":"2100","38ea6270":"2136","3f4f1b85":"2182","82c6054d":"2211","7d370da3":"2212","69560f14":"2221",b7a29a20:"2239","4af00c2c":"2248",bb56c414:"2258","7d930281":"2264","6b7ff034":"2271","3ca8d367":"2280","2b9377a0":"2284",fb2aac14:"2303","3c355134":"2320","84c6b5d4":"2403","1f96dd1b":"2409","19ee63d5":"2466",df23e008:"2506","4aeca0dd":"2544","049c7c64":"2596","0d73c327":"2673",c52b2720:"2691",af50bec2:"2692","01df7f3f":"2694","49100cb7":"2698","055d8f40":"2733","168c1296":"2800","95314b82":"2853","2727f0e2":"2939","3b7f1d9e":"2962","8bd870ef":"2970","5d256d9e":"2973","0866dc88":"2980",ceddd399:"3012","1f391b9e":"3085",e3677851:"3110","4c0e0ec5":"3141","1a9c1393":"3160","652c66c5":"3163",c24cede4:"3226",dcec6889:"3231","98ee90af":"3259","5724b0c4":"3268","99ef32f4":"3277","03188927":"3306","8c8eed79":"3311","1d23a3cc":"3343",c09d0117:"3362",df71083d:"3369","767b2b71":"3406","0b13d5e8":"3409",a30d6a39:"3436","92a6a6aa":"3442","2033fe1d":"3470","820a1e19":"3479","39c0d873":"3550","8f96c667":"3719","8864f5f8":"3753","14da9b10":"3770","2fa1e944":"3819",d9b93d98:"3831","7cc7300b":"3913","4479d28a":"3929",c8a2ef77:"3990","59fd2fc7":"4002","86e33bb9":"4099","3ffb3654":"4117","9609c8f6":"4132",bba8d026:"4165",c4f5d8e4:"4195","61509a60":"4225",cc32ad1c:"4234",dbb9ff6e:"4317","5df04955":"4330",b694928c:"4341",b66a59f2:"4365","93991a3d":"4417","89381d81":"4450",ffb2b4d8:"4466","379ce79b":"4526","2fe8ce59":"4528",cf85ede8:"4581",a35af971:"4621",e64f9346:"4662","337885e6":"4663","7d79a86a":"4835","0d78eb08":"4935","4b96ce56":"4979","39b3fdd1":"4995",bc8da1ef:"5074","320800f4":"5090",d7c447b7:"5160","54a5b3e2":"5174",aba2fd11:"5178","80118b91":"5182","6d5ccf3c":"5184","37c50b0a":"5188","4b15b3ca":"5205","9ea974a1":"5227","7b6b3838":"5333",bef893b8:"5352",b0d837a2:"5353","4e426588":"5398",eaea0c8e:"5456","5f00e493":"5478","4df2b942":"5487","05720bc7":"5511","12ad0883":"5534",cd5a7ece:"5546",cff456ab:"5605",b79fb02a:"5614","9d9e3a9f":"5668","913d1df3":"5677","843b88bc":"5687","52188b66":"5756",ab6ec9c9:"5766",b172b294:"5816","2179e181":"5827",e4fcb135:"5845","841a1ae5":"5894",d2ef7841:"5898","8311baf6":"6022","9233b6a0":"6112","61c2b592":"6128","13cbbc45":"6160","3fe1b31e":"6175","18caa820":"6197","674b291d":"6212","864b21f2":"6266","8388d427":"6342","1fe0b14c":"6392","3d2e3c20":"6408",ac3eef92:"6434","7ca3659a":"6453","675ae01b":"6588","7335f490":"6670",db0000f8:"6711","695b1d89":"6788",f4c65d51:"6798","146e3239":"6807",c801e96e:"6833","5dc3c8f6":"6843","42e796b7":"6865",ae1b1adb:"6891","7f9f2386":"6899","2c8e0782":"6911","4356940c":"6942","7bf9570a":"6980","718d2dcc":"7006","039e4454":"7009",b77aed85:"7021",e0350bff:"7055","6794fe4c":"7086",de4a6a6c:"7093","931e9fae":"7144",d589d3a7:"7162","4f0a142f":"7232",b6cb8034:"7331","4e3e8b54":"7337","9bfac0a1":"7372","393be207":"7414","95a2a291":"7479",aa4704fa:"7554","6cf6a508":"7560",d21a06aa:"7608",a9d4f8dd:"7631",e588fe04:"7724","658db2fd":"7729","0d351afe":"7861",ada04912:"7903","1a4e3797":"7920","6b4e7cc0":"7958",e9e588e3:"7976","58a7e9f4":"8060","4248bf8f":"8090",bc5c4e3f:"8107",a3a80959:"8209",fda3c7b4:"8247",f7810842:"8374",a719f608:"8452",eab1b5b1:"8475","4b768e8d":"8478",e48c32e6:"8489","98315e5f":"8496","74da69c6":"8566",ca21e936:"8573","266edd5c":"8603",b5189564:"8609",b8327182:"8629","44bcb8b6":"8776","7b298cde":"8795",b7a8c418:"8852",d72e2d41:"8915",dca35320:"8994","5d035c0c":"9009","601bd9b3":"9109","8353ce31":"9176","12690ca6":"9247",efa021b8:"9248",a1d0e770:"9263","4779363e":"9299","436fdc09":"9340","0a1df218":"9371","31ecfdf3":"9373","606e9499":"9402","243acfc7":"9462","1be78505":"9514",a72ad06f:"9539","597afff9":"9551","437509ae":"9581","4ba7e5a3":"9735","6b502c6d":"9835","015c4fcd":"9863","827c765e":"9868",d8c7cd00:"9883",cad38203:"9943","2927d995":"9962"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,b)=>{var c=r.o(e,a)?e[a]:void 0;if(0!==c)if(c)b.push(c[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var d=new Promise(((b,d)=>c=e[a]=[b,d]));b.push(c[2]=d);var f=r.p+r.u(a),t=new Error;r.l(f,(b=>{if(r.o(e,a)&&(0!==(c=e[a])&&(e[a]=void 0),c)){var d=b&&("load"===b.type?"missing":b.type),f=b&&b.target&&b.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+f+")",t.name="ChunkLoadError",t.type=d,t.request=f,c[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,b)=>{var c,d,f=b[0],t=b[1],o=b[2],n=0;if(f.some((a=>0!==e[a]))){for(c in t)r.o(t,c)&&(r.m[c]=t[c]);if(o)var i=o(r)}for(a&&a(b);n{"use strict";var e,a,b,f,c,d={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var b=t[e]={id:e,loaded:!1,exports:{}};return d[e].call(b.exports,b,b.exports,r),b.loaded=!0,b.exports}r.m=d,r.c=t,e=[],r.O=(a,b,f,c)=>{if(!b){var d=1/0;for(i=0;i=c)&&Object.keys(r.O).every((e=>r.O[e](b[o])))?b.splice(o--,1):(t=!1,c0&&e[i-1][2]>c;i--)e[i]=e[i-1];e[i]=[b,f,c]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.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 c=Object.create(null);r.r(c);var d={};a=a||[null,b({}),b([]),b(b)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=b(t))Object.getOwnPropertyNames(t).forEach((a=>d[a]=()=>e[a]));return d.default=()=>e,r.d(c,d),c},r.d=(e,a)=>{for(var b in a)r.o(a,b)&&!r.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,b)=>(r.f[b](e,a),a)),[])),r.u=e=>"assets/js/"+({26:"f4b7dbf9",41:"ea7f81af",53:"935f2afb",76:"7da45d1b",78:"1a12b3eb",188:"0e19568b",246:"699b933d",276:"0a24bc6c",495:"0d52c50f",512:"a8c31594",542:"53ba04fa",615:"426df75b",617:"dfd3236d",624:"57dfcb57",715:"56834eaf",740:"9e9695ea",754:"592d8667",775:"c9229a84",836:"0480b142",841:"4904453e",844:"f8f60af7",855:"f0b44263",859:"8c20990f",899:"be68102f",905:"00868d8e",910:"6ecc76ed",913:"7819d3b5",929:"097a92d8",933:"97a1f5f3",956:"ae5b1410",961:"5fa0bca2",1015:"adb40ef5",1050:"f1bcd6ab",1051:"a126a101",1120:"e7245c0e",1166:"ea8e0bfc",1208:"586689e4",1224:"45b5f33c",1318:"65fc7665",1327:"8882742c",1372:"1db64337",1373:"c29fd1d9",1502:"305f3035",1544:"a8e5477a",1577:"6974a59e",1595:"936cbf1c",1623:"de5cb490",1637:"c0602f71",1639:"bd2f937f",1731:"0e800433",1753:"073e83ba",1805:"6e83d4d1",1806:"c1d67c6f",1824:"e29e6131",1861:"96b89644",1902:"6dd408b0",1915:"9d12552c",1938:"6639555e",1939:"208ad0b7",1950:"db2ee795",1969:"61b88e35",1994:"776f2dca",1998:"70ebf55c",2010:"1bc24ad6",2025:"02e49d04",2042:"9ee78e3d",2076:"c79c6419",2100:"725bcd8a",2136:"38ea6270",2182:"3f4f1b85",2211:"82c6054d",2212:"7d370da3",2221:"69560f14",2239:"b7a29a20",2248:"4af00c2c",2258:"bb56c414",2264:"7d930281",2271:"6b7ff034",2280:"3ca8d367",2284:"2b9377a0",2303:"fb2aac14",2320:"3c355134",2403:"84c6b5d4",2409:"1f96dd1b",2466:"19ee63d5",2506:"df23e008",2544:"4aeca0dd",2596:"049c7c64",2673:"0d73c327",2691:"c52b2720",2692:"af50bec2",2694:"01df7f3f",2698:"49100cb7",2733:"055d8f40",2800:"168c1296",2853:"95314b82",2939:"2727f0e2",2962:"3b7f1d9e",2970:"8bd870ef",2973:"5d256d9e",2980:"0866dc88",3012:"ceddd399",3085:"1f391b9e",3110:"e3677851",3141:"4c0e0ec5",3160:"1a9c1393",3163:"652c66c5",3226:"c24cede4",3231:"dcec6889",3259:"98ee90af",3268:"5724b0c4",3277:"99ef32f4",3306:"03188927",3311:"8c8eed79",3343:"1d23a3cc",3362:"c09d0117",3369:"df71083d",3406:"767b2b71",3409:"0b13d5e8",3436:"a30d6a39",3442:"92a6a6aa",3470:"2033fe1d",3479:"820a1e19",3550:"39c0d873",3719:"8f96c667",3753:"8864f5f8",3770:"14da9b10",3819:"2fa1e944",3831:"d9b93d98",3913:"7cc7300b",3929:"4479d28a",3990:"c8a2ef77",4002:"59fd2fc7",4099:"86e33bb9",4117:"3ffb3654",4132:"9609c8f6",4165:"bba8d026",4195:"c4f5d8e4",4225:"61509a60",4234:"cc32ad1c",4317:"dbb9ff6e",4330:"5df04955",4341:"b694928c",4365:"b66a59f2",4417:"93991a3d",4450:"89381d81",4466:"ffb2b4d8",4526:"379ce79b",4528:"2fe8ce59",4554:"68396417",4581:"cf85ede8",4621:"a35af971",4662:"e64f9346",4663:"337885e6",4835:"7d79a86a",4935:"0d78eb08",4979:"4b96ce56",4995:"39b3fdd1",5074:"bc8da1ef",5090:"320800f4",5160:"d7c447b7",5174:"54a5b3e2",5178:"aba2fd11",5182:"80118b91",5184:"6d5ccf3c",5188:"37c50b0a",5205:"4b15b3ca",5227:"9ea974a1",5333:"7b6b3838",5334:"28682005",5352:"bef893b8",5353:"b0d837a2",5398:"4e426588",5444:"49850653",5456:"eaea0c8e",5478:"5f00e493",5487:"4df2b942",5511:"05720bc7",5534:"12ad0883",5546:"cd5a7ece",5605:"cff456ab",5614:"b79fb02a",5668:"9d9e3a9f",5677:"913d1df3",5687:"843b88bc",5756:"52188b66",5766:"ab6ec9c9",5816:"b172b294",5827:"2179e181",5845:"e4fcb135",5894:"841a1ae5",5898:"d2ef7841",6022:"8311baf6",6112:"9233b6a0",6128:"61c2b592",6160:"13cbbc45",6175:"3fe1b31e",6197:"18caa820",6212:"674b291d",6266:"864b21f2",6342:"8388d427",6392:"1fe0b14c",6408:"3d2e3c20",6434:"ac3eef92",6453:"7ca3659a",6588:"675ae01b",6670:"7335f490",6711:"db0000f8",6788:"695b1d89",6798:"f4c65d51",6807:"146e3239",6833:"c801e96e",6843:"5dc3c8f6",6865:"42e796b7",6891:"ae1b1adb",6899:"7f9f2386",6911:"2c8e0782",6942:"4356940c",6980:"7bf9570a",7006:"718d2dcc",7009:"039e4454",7021:"b77aed85",7055:"e0350bff",7086:"6794fe4c",7093:"de4a6a6c",7144:"931e9fae",7162:"d589d3a7",7232:"4f0a142f",7331:"b6cb8034",7337:"4e3e8b54",7372:"9bfac0a1",7414:"393be207",7479:"95a2a291",7554:"aa4704fa",7560:"6cf6a508",7608:"d21a06aa",7631:"a9d4f8dd",7671:"14304958",7724:"e588fe04",7729:"658db2fd",7861:"0d351afe",7903:"ada04912",7906:"37390557",7918:"17896441",7920:"1a4e3797",7958:"6b4e7cc0",7976:"e9e588e3",8060:"58a7e9f4",8090:"4248bf8f",8107:"bc5c4e3f",8209:"a3a80959",8247:"fda3c7b4",8374:"f7810842",8452:"a719f608",8475:"eab1b5b1",8478:"4b768e8d",8489:"e48c32e6",8496:"98315e5f",8566:"74da69c6",8573:"ca21e936",8603:"266edd5c",8609:"b5189564",8629:"b8327182",8776:"44bcb8b6",8795:"7b298cde",8852:"b7a8c418",8915:"d72e2d41",8994:"dca35320",9009:"5d035c0c",9109:"601bd9b3",9176:"8353ce31",9247:"12690ca6",9248:"efa021b8",9263:"a1d0e770",9299:"4779363e",9340:"436fdc09",9371:"0a1df218",9373:"31ecfdf3",9392:"76061115",9402:"606e9499",9462:"243acfc7",9514:"1be78505",9539:"a72ad06f",9551:"597afff9",9581:"437509ae",9735:"4ba7e5a3",9835:"6b502c6d",9863:"015c4fcd",9868:"827c765e",9883:"d8c7cd00",9943:"cad38203",9962:"2927d995"}[e]||e)+"."+{26:"96b8055b",41:"af57e2d2",53:"404f490b",76:"44124ea3",78:"6d6bcbb6",188:"19a2bba6",246:"e718c599",276:"28d33775",495:"c2c02740",512:"1997e550",542:"59cffb9a",615:"e6c4687c",617:"4e1cafaf",624:"f3e3db5d",715:"5595bc4d",740:"bfc96b1a",754:"08fa47de",775:"11a12808",836:"2fa745b3",841:"c1ac5275",844:"064502c7",855:"9062825b",859:"b9ab6251",899:"9bedfd43",905:"c203dcd9",910:"21fd49c7",913:"ca8b336a",929:"c6975893",933:"390b35a7",956:"ac871a31",961:"543672d9",1015:"55c3007b",1050:"08891208",1051:"3d3f63b1",1120:"ccdfab5f",1166:"9048d189",1208:"a8eb7b02",1224:"4e4ae945",1318:"0e270765",1327:"9f0a0c5d",1372:"7f241101",1373:"2789d710",1502:"ad31ea38",1544:"191098bc",1577:"23d1f155",1595:"c61503f5",1623:"dc5629e2",1637:"a6532457",1639:"36f1b932",1731:"4ef576b0",1753:"f335f52f",1805:"d71da16d",1806:"b3968c2c",1824:"5dfc0d72",1861:"57fb505a",1902:"fc4552e5",1915:"c7f17d49",1938:"c2e65a44",1939:"ab202a25",1950:"46536603",1969:"f56392f9",1994:"a1347c2f",1998:"28cddd1d",2010:"f7463294",2025:"48f32295",2040:"b5f0a78a",2042:"3393a79d",2076:"ddd4b7f8",2100:"6e8a0c39",2136:"954d02d3",2182:"2043b977",2211:"1bd2b6f9",2212:"64fdd65a",2221:"9ca30f76",2239:"6b6c90cf",2248:"d7695d79",2258:"6a1e3980",2264:"49cf5e71",2271:"b488cf4d",2280:"9e5dce2d",2284:"0b81078f",2303:"706f884f",2320:"793b455c",2403:"fdbff8aa",2409:"db49ec37",2466:"d2ae9168",2506:"8441a804",2544:"e2c2d10c",2596:"ff512ba5",2673:"00e4b108",2691:"f813b6d4",2692:"36be5123",2694:"109edf59",2698:"cf0c4df3",2733:"ba9b8eea",2800:"4b02613e",2853:"f6d9fac2",2939:"9de1860d",2962:"be59f268",2970:"6fe1e767",2973:"2d6b2717",2980:"a8ddcdaa",3012:"43f1a9b4",3085:"1266fa24",3110:"e6fc9892",3141:"53b6dab6",3160:"4c9bf0ff",3163:"0c353f3b",3226:"07474248",3231:"e6e4e5f0",3259:"ba1193b7",3268:"67513515",3277:"2adf8d09",3306:"6e59cf56",3311:"bc2604ba",3343:"4e547cf2",3362:"4070a968",3369:"e95b359e",3406:"7082f47d",3409:"291c160e",3436:"59b4f5b6",3442:"75a04d65",3470:"ce919eb8",3479:"e11012f2",3550:"8d5edf50",3719:"f3c7f3ca",3753:"0f00a8e7",3770:"88af5bd7",3819:"453d9144",3831:"feda5710",3913:"6a1104d0",3929:"1a84b211",3948:"dea9bfc8",3990:"c156abb8",4002:"a0a4399e",4099:"9c4a7626",4117:"5efd2461",4132:"07b0d818",4165:"598f5a65",4195:"7b613710",4225:"28ecd885",4234:"51aa56f2",4317:"42fd8145",4330:"f557a678",4341:"9505405d",4365:"b2e779c9",4417:"0166ae3c",4450:"29eef9d8",4466:"49d11827",4526:"525a28a4",4528:"32a94044",4554:"ce72cf05",4581:"1e94a228",4621:"8677ab65",4662:"13e04ab3",4663:"7020c133",4835:"b59d4d77",4935:"bea55944",4972:"fbceddc1",4979:"013d1b86",4995:"93350492",5074:"594f7882",5090:"6e444dd8",5160:"dcce9f04",5174:"6696276f",5178:"66c90017",5182:"06a0077a",5184:"0bae49c9",5188:"9b7c631b",5205:"b407809f",5227:"77fc280f",5333:"69d38f79",5334:"17af5d95",5352:"b15aca7b",5353:"0590909b",5398:"d14e3010",5444:"efa0012e",5456:"dcb3830e",5478:"52bc563c",5487:"e8a90490",5511:"dde50634",5534:"05c389de",5546:"126fad54",5605:"5a916ccc",5614:"a6066f9e",5668:"85922198",5677:"1fcc43ec",5687:"df382f1a",5756:"a01be6ec",5766:"2d2dd0f7",5816:"a4883174",5827:"ea3c2b6c",5845:"f8edf82c",5894:"2b0f7450",5898:"1b67b080",6022:"29ea12bb",6112:"a0a1ffd7",6128:"5cd544a3",6160:"0d081498",6175:"c59cdc9c",6197:"080a9c5b",6212:"5b88d5f4",6266:"33d27170",6342:"889839a2",6392:"3eda5d0e",6408:"d23d74ed",6434:"a5ff3211",6453:"ff505ef0",6588:"c821f21e",6670:"acf93fc0",6711:"dac74f98",6788:"3c031b06",6798:"898e649a",6807:"d6091ac8",6833:"6cda1193",6843:"6379637b",6865:"5266a32c",6891:"4c335725",6899:"85a564f1",6911:"003b9995",6942:"914589df",6945:"de5501ca",6980:"c2140051",7006:"3ef357d7",7009:"99cc0d70",7021:"24aa0eaf",7055:"d01e7f65",7086:"f51b2aac",7093:"d26478e2",7144:"b9f62128",7162:"020bf779",7232:"4d0e75c0",7331:"2bb24b89",7337:"2dfa10c8",7372:"a2ffeae3",7414:"78f56f39",7479:"4e07e9c0",7554:"a5ab7a3f",7560:"b97c02aa",7608:"d9211708",7631:"cf70099d",7671:"dc263494",7724:"445ce598",7729:"2363d5f8",7861:"3bf30a71",7903:"3d81c50d",7906:"d73acc14",7918:"45947f76",7920:"e7775ca7",7958:"18296143",7976:"9a738974",8060:"789195b9",8090:"346fc489",8107:"78f467fa",8209:"74e9deea",8247:"9c66db8e",8374:"86162268",8452:"a62a3a86",8475:"baf1e42e",8478:"2b00e631",8489:"f29c46a4",8496:"69dcfbf4",8566:"225c30da",8573:"f37adfe9",8603:"0869b318",8609:"aa7a77eb",8629:"63e74855",8776:"89806b67",8795:"e3c4d3c5",8852:"ee6f4262",8894:"8b8574c7",8915:"03bc5f1d",8994:"2c64ec75",9009:"bb6f00b7",9109:"6e98404a",9176:"d63404d8",9247:"6f4775ba",9248:"ce38e442",9263:"2c08d665",9299:"845092cd",9340:"a15bc5df",9371:"cb2a8e65",9373:"1d945b2c",9392:"f1f72bd6",9402:"0ae53c8b",9462:"b705c32c",9514:"4de3a667",9539:"d0ee743b",9551:"a7fe0df7",9581:"6a1339f9",9724:"51fefac4",9735:"d85bb2b7",9835:"d85941e8",9863:"13c5d51d",9868:"bb2e0cc6",9883:"d2798c5d",9943:"49d6575b",9962:"a0987fa8"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},c="beta_BNB_Docs:",r.l=(e,a,b,d)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var c=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),c&&c.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/",r.gca=function(e){return e={14304958:"7671",17896441:"7918",28682005:"5334",37390557:"7906",49850653:"5444",68396417:"4554",76061115:"9392",f4b7dbf9:"26",ea7f81af:"41","935f2afb":"53","7da45d1b":"76","1a12b3eb":"78","0e19568b":"188","699b933d":"246","0a24bc6c":"276","0d52c50f":"495",a8c31594:"512","53ba04fa":"542","426df75b":"615",dfd3236d:"617","57dfcb57":"624","56834eaf":"715","9e9695ea":"740","592d8667":"754",c9229a84:"775","0480b142":"836","4904453e":"841",f8f60af7:"844",f0b44263:"855","8c20990f":"859",be68102f:"899","00868d8e":"905","6ecc76ed":"910","7819d3b5":"913","097a92d8":"929","97a1f5f3":"933",ae5b1410:"956","5fa0bca2":"961",adb40ef5:"1015",f1bcd6ab:"1050",a126a101:"1051",e7245c0e:"1120",ea8e0bfc:"1166","586689e4":"1208","45b5f33c":"1224","65fc7665":"1318","8882742c":"1327","1db64337":"1372",c29fd1d9:"1373","305f3035":"1502",a8e5477a:"1544","6974a59e":"1577","936cbf1c":"1595",de5cb490:"1623",c0602f71:"1637",bd2f937f:"1639","0e800433":"1731","073e83ba":"1753","6e83d4d1":"1805",c1d67c6f:"1806",e29e6131:"1824","96b89644":"1861","6dd408b0":"1902","9d12552c":"1915","6639555e":"1938","208ad0b7":"1939",db2ee795:"1950","61b88e35":"1969","776f2dca":"1994","70ebf55c":"1998","1bc24ad6":"2010","02e49d04":"2025","9ee78e3d":"2042",c79c6419:"2076","725bcd8a":"2100","38ea6270":"2136","3f4f1b85":"2182","82c6054d":"2211","7d370da3":"2212","69560f14":"2221",b7a29a20:"2239","4af00c2c":"2248",bb56c414:"2258","7d930281":"2264","6b7ff034":"2271","3ca8d367":"2280","2b9377a0":"2284",fb2aac14:"2303","3c355134":"2320","84c6b5d4":"2403","1f96dd1b":"2409","19ee63d5":"2466",df23e008:"2506","4aeca0dd":"2544","049c7c64":"2596","0d73c327":"2673",c52b2720:"2691",af50bec2:"2692","01df7f3f":"2694","49100cb7":"2698","055d8f40":"2733","168c1296":"2800","95314b82":"2853","2727f0e2":"2939","3b7f1d9e":"2962","8bd870ef":"2970","5d256d9e":"2973","0866dc88":"2980",ceddd399:"3012","1f391b9e":"3085",e3677851:"3110","4c0e0ec5":"3141","1a9c1393":"3160","652c66c5":"3163",c24cede4:"3226",dcec6889:"3231","98ee90af":"3259","5724b0c4":"3268","99ef32f4":"3277","03188927":"3306","8c8eed79":"3311","1d23a3cc":"3343",c09d0117:"3362",df71083d:"3369","767b2b71":"3406","0b13d5e8":"3409",a30d6a39:"3436","92a6a6aa":"3442","2033fe1d":"3470","820a1e19":"3479","39c0d873":"3550","8f96c667":"3719","8864f5f8":"3753","14da9b10":"3770","2fa1e944":"3819",d9b93d98:"3831","7cc7300b":"3913","4479d28a":"3929",c8a2ef77:"3990","59fd2fc7":"4002","86e33bb9":"4099","3ffb3654":"4117","9609c8f6":"4132",bba8d026:"4165",c4f5d8e4:"4195","61509a60":"4225",cc32ad1c:"4234",dbb9ff6e:"4317","5df04955":"4330",b694928c:"4341",b66a59f2:"4365","93991a3d":"4417","89381d81":"4450",ffb2b4d8:"4466","379ce79b":"4526","2fe8ce59":"4528",cf85ede8:"4581",a35af971:"4621",e64f9346:"4662","337885e6":"4663","7d79a86a":"4835","0d78eb08":"4935","4b96ce56":"4979","39b3fdd1":"4995",bc8da1ef:"5074","320800f4":"5090",d7c447b7:"5160","54a5b3e2":"5174",aba2fd11:"5178","80118b91":"5182","6d5ccf3c":"5184","37c50b0a":"5188","4b15b3ca":"5205","9ea974a1":"5227","7b6b3838":"5333",bef893b8:"5352",b0d837a2:"5353","4e426588":"5398",eaea0c8e:"5456","5f00e493":"5478","4df2b942":"5487","05720bc7":"5511","12ad0883":"5534",cd5a7ece:"5546",cff456ab:"5605",b79fb02a:"5614","9d9e3a9f":"5668","913d1df3":"5677","843b88bc":"5687","52188b66":"5756",ab6ec9c9:"5766",b172b294:"5816","2179e181":"5827",e4fcb135:"5845","841a1ae5":"5894",d2ef7841:"5898","8311baf6":"6022","9233b6a0":"6112","61c2b592":"6128","13cbbc45":"6160","3fe1b31e":"6175","18caa820":"6197","674b291d":"6212","864b21f2":"6266","8388d427":"6342","1fe0b14c":"6392","3d2e3c20":"6408",ac3eef92:"6434","7ca3659a":"6453","675ae01b":"6588","7335f490":"6670",db0000f8:"6711","695b1d89":"6788",f4c65d51:"6798","146e3239":"6807",c801e96e:"6833","5dc3c8f6":"6843","42e796b7":"6865",ae1b1adb:"6891","7f9f2386":"6899","2c8e0782":"6911","4356940c":"6942","7bf9570a":"6980","718d2dcc":"7006","039e4454":"7009",b77aed85:"7021",e0350bff:"7055","6794fe4c":"7086",de4a6a6c:"7093","931e9fae":"7144",d589d3a7:"7162","4f0a142f":"7232",b6cb8034:"7331","4e3e8b54":"7337","9bfac0a1":"7372","393be207":"7414","95a2a291":"7479",aa4704fa:"7554","6cf6a508":"7560",d21a06aa:"7608",a9d4f8dd:"7631",e588fe04:"7724","658db2fd":"7729","0d351afe":"7861",ada04912:"7903","1a4e3797":"7920","6b4e7cc0":"7958",e9e588e3:"7976","58a7e9f4":"8060","4248bf8f":"8090",bc5c4e3f:"8107",a3a80959:"8209",fda3c7b4:"8247",f7810842:"8374",a719f608:"8452",eab1b5b1:"8475","4b768e8d":"8478",e48c32e6:"8489","98315e5f":"8496","74da69c6":"8566",ca21e936:"8573","266edd5c":"8603",b5189564:"8609",b8327182:"8629","44bcb8b6":"8776","7b298cde":"8795",b7a8c418:"8852",d72e2d41:"8915",dca35320:"8994","5d035c0c":"9009","601bd9b3":"9109","8353ce31":"9176","12690ca6":"9247",efa021b8:"9248",a1d0e770:"9263","4779363e":"9299","436fdc09":"9340","0a1df218":"9371","31ecfdf3":"9373","606e9499":"9402","243acfc7":"9462","1be78505":"9514",a72ad06f:"9539","597afff9":"9551","437509ae":"9581","4ba7e5a3":"9735","6b502c6d":"9835","015c4fcd":"9863","827c765e":"9868",d8c7cd00:"9883",cad38203:"9943","2927d995":"9962"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(a,b)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)b.push(f[2]);else if(/^(1303|532)$/.test(a))e[a]=0;else{var c=new Promise(((b,c)=>f=e[a]=[b,c]));b.push(f[2]=c);var d=r.p+r.u(a),t=new Error;r.l(d,(b=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var c=b&&("load"===b.type?"missing":b.type),d=b&&b.target&&b.target.src;t.message="Loading chunk "+a+" failed.\n("+c+": "+d+")",t.name="ChunkLoadError",t.type=c,t.request=d,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,b)=>{var f,c,d=b[0],t=b[1],o=b[2],n=0;if(d.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(b);n - + - + diff --git a/docs/BC-FAQs.html b/docs/BC-FAQs.html index de2c327820..bdfe63b93a 100644 --- a/docs/BC-FAQs.html +++ b/docs/BC-FAQs.html @@ -8,7 +8,7 @@ - + @@ -52,7 +52,7 @@ trades will be charged more for their benefits from the liquidity provided in the network. Order Expire and Cancel are also charged with a fee if they fail to provide any liquidity. The current fee table is here

Besides the fees, no other gas will be charged.

Fees can be paid in any asset, but the network will charge BNB first and apply a discount if the address has BNB balance.

The fee is subject to periodical review and adjustment, after agreement from validators, via a -proposal-vote procedure. See a fee-change proposal here

  • Trade fee is calculated based on trade notional value, while fees for other transactions are fixed.
  • It is free to send a new GET order, cancel a partially filled order, or expire a partially filled order.
  • Non-Trade related transactions will be charged with a fee when the transactions happen, and can +proposal-vote procedure. See a fee-change proposal here

    • Trade fee is calculated based on trade notional value, while fees for other transactions are fixed.
    • It is free to send a new GET order, cancel a partially filled order, or expire a partially filled order.
    • Non-Trade related transactions will be charged with a fee when the transactions happen, and can only be paid in BNB. The transaction will be rejected if the address does not have enough BNB.
    • Trade-related transactions will be charged with a fee when an order is filled, or canceled/expired/IOC-expired with no fills. If there is enough BNB to pay, BNB fee structure will be used, otherwise, non-BNB fee structure will be used instead.
    • If the whole order value and free balance for the receiving asset are not enough to pay the fee, @@ -78,7 +78,7 @@ The process for setting up validators among different entities on BNB Beacon Chain is currently being defined. More details will be shared at a later date.

      Can I run a full node for BNB Beacon Chain ?

      Yes, you can. A full node contains all the information and application logic for BNB Beacon Chain . It can receive and broadcast blocks and transactions with other full nodes and even validators. The only exception is it will not participate in the consensus if the full node is not a Validator.

      Does BNB Beacon Chain support Smart Contracts?

      No. This was an intentional design decision to improve the performance of the system and eliminate having to support unnecessary features.

      If you have certain must-have features, it might be added as a native implementation instead of using smart contract.
      -Feel free to talk to BNB Chain Community.

      How can I transfer tokens, such as Bitcoin, from other block chains onto BNB Beacon Chain ?

      Right now, there are 2 ways to transfer tokens cross-chain:

      1. via interoperability among different chains. After the latest “Archimedes” upgrade, BEP3 was introduced and it defines native transactions to support Hash Timelock Contract (HTLC) on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain atomic swap to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including:
      • smart-contract solution that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party.
      • deputy process written in GoLang that handles swap activities

      Any developer is welcome to test the solutions in testnet and then use them in mainnet.

      1. via Binance.com. Binance,the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): BEP2 Bitcoin, BEP2 BCH,BEP2 XRP, BEP2 LTC. Pegged tokens such as BEP2 Bitcoin, are 100% backed by the native coin in reserve. The reserve addresses are published for anyone to audit. Read this blog to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.

      Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them.

      Please do NOT try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins.

      How is a trading pair created on Binance DEX?

      The design philosophy of Binance DEX adheres to the idea that the most efficient and low cost way to perform trading and +Feel free to talk to BNB Chain Community.

      How can I transfer tokens, such as Bitcoin, from other block chains onto BNB Beacon Chain ?

      Right now, there are 2 ways to transfer tokens cross-chain:

      1. via interoperability among different chains. After the latest “Archimedes” upgrade, BEP3 was introduced and it defines native transactions to support Hash Timelock Contract (HTLC) on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain atomic swap to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including:
      • smart-contract solution that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party.
      • deputy process written in GoLang that handles swap activities

      Any developer is welcome to test the solutions in testnet and then use them in mainnet.

      1. via Binance.com. Binance,the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): BEP2 Bitcoin, BEP2 BCH,BEP2 XRP, BEP2 LTC. Pegged tokens such as BEP2 Bitcoin, are 100% backed by the native coin in reserve. The reserve addresses are published for anyone to audit. Read this blog to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.

      Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them.

      Please do NOT try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins.

      How is a trading pair created on Binance DEX?

      The design philosophy of Binance DEX adheres to the idea that the most efficient and low cost way to perform trading and price-discovery is still to use single order book. This single order book is managed and replicated across all full nodes with the same, deterministic matching logic.

      Simply allowing trading between two assets seems easy enough, however it is expensive for not only the network but also its users in long term (and liquidity costs can be much larger). In order to efficiently use the @@ -89,7 +89,7 @@ Once the proposal is accepted, the owner of the base asset can list the trading pair.

      For more information about this process please check the listing guide.

      How would a third-party integrate with BNB Beacon Chain and Binance DEX?

      A wallet provider may choose to only support the feature set of BNB Beacon Chain , which would just cover wallets, addresses, balances and transfers.
      To improve their implementation further, they could choose to integrate Binance DEX which would add trading (order placement and cancellation), historical order and trade views, charts, etc.

      - + diff --git a/docs/BEP20.html b/docs/BEP20.html index 84021bbcb8..b2a31bd803 100644 --- a/docs/BEP20.html +++ b/docs/BEP20.html @@ -8,13 +8,13 @@ - +

      BEP20 Token Introduction

      A BEP20 token must implement the interface IBEP20 in IBEP20.sol. This is a template contract BEP20Token.template. Users just need to fill in _name, _symbol, _decimals and _totalSupply according to their own requirements:

        constructor() public {
      _name = {{TOKEN_NAME}};
      _symbol = {{TOKEN_SYMBOL}};
      _decimals = {{DECIMALS}};
      _totalSupply = {{TOTAL_SUPPLY}};
      _balances[msg.sender] = _totalSupply;

      emit Transfer(address(0), msg.sender, _totalSupply);
      }

      Then users can use Remix IDE and Metamask to compile and deploy the BEP20 contract to BSC.

      Interact with Contract with Web3 and NodeJS.

      Connect to BNB Smart Chain's public RPC endpoint

      const Web3 = require('web3');
      // mainnet
      const web3 = new Web3('https://bsc-dataseed.bnbchain.org');
      // testnet
      const web3 = new Web3('https://data-seed-prebsc-1-s1.bnbchain.org:8545');

      Create a Wallet

      web3.eth.accounts.create([entropy]);

      Output:

      web3.eth.accounts.create();
      {
      address: '0x926605D0729a968266f1BB299d8Df0471C4F5367',
      privateKey: '0x6b4618539d95f205f33e916e89404b301dde545c0c4acc181fd0c0b42708bad3',
      signTransaction: [Function: signTransaction],
      sign: [Function: sign],
      encrypt: [Function: encrypt]
      }

      Recover a Wallet

      const account = web3.eth.accounts.privateKeyToAccount("0xe500f5754d761d74c3eb6c2566f4c568b81379bf5ce9c1ecd475d40efe23c577")

      Check Balance

      web3.eth.getBalance(holder).then(console.log);

      Output (The balance will be bumped by e18 for BNB):

      6249621999900000000

      Create Transaction

      Parameters

      • Object - The transaction object to send:
      • from - String|Number: The address for the sending account. Uses the web3.eth.defaultAccount property, if not specified. Or an address or index of a local wallet in web3.eth.accounts.wallet.
      • to - String: (optional) The destination address of the message, left undefined for a contract-creation transaction.
      • value - Number|String|BN|BigNumber: (optional) The value transferred for the transaction in wei, also the endowment if it’s a contract-creation transaction.
      • gas - Number: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded).
      • gasPrice - Number|String|BN|BigNumber: (optional) The price of gas for this transaction in wei, defaults to web3.eth.gasPrice.
      • data - String: (optional) Either a ABI byte string containing the data of the function call on a contract, or in the case of a contract-creation transaction the initialisation code.
      • nonce - Number: (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
      // Make a transaction using the promise
      web3.eth.sendTransaction({
      from: holder,
      to: '0x0B75fbeB0BC7CC0e9F9880f78a245046eCBDBB0D',
      value: '1000000000000000000',
      gas: 5000000,
      gasPrice: 18e9,
      }, function(err, transactionHash) {
      if (err) {
      console.log(err);
      } else {
      console.log(transactionHash);
      }
      });
      - + diff --git a/docs/BSC-FAQs-delegator.html b/docs/BSC-FAQs-delegator.html index fbbe7eb21d..eee90605dc 100644 --- a/docs/BSC-FAQs-delegator.html +++ b/docs/BSC-FAQs-delegator.html @@ -8,13 +8,13 @@ - +

      BNB Smart Chain Delegator

      What's the role of a delegator?

      A delegator can delegate its BNB to a chosen validator to participate the consensus and earn rewards. Staking BNB directly contributes to the security of the entire network.

      How to delegate my BNB?

      Please read the guide here

      You can use:

      How to undelegate my BNB?

      Delegates and validators themselves may choose to unbond their BNB for a variety of reasons. It is important to note that these BNB are subject to what is known as the UnbondingTime, an on-chain parameterized period of time upon which all delegates, including validators, must wait for their BNB to become fully unbonded. In addition, these BNB are still subject to be potentially slashed upon commitment of any byzantine behavior. The UnbondingTime ensures a variety of security measures in the network, such as accounting for network synchrony assumptions, providing a lower bound for the length of a long-range attack and solving the “nothing-at-stake” problem.

      The current UnbondingTime in BNB Smart Chain mainnet is 7 days.

      How to redelegate my BNB?

      Redelegations between a unique delegator, source validator, and destination validator can only happen once every UnbondingTime

      How many tokens are required to stake BNB?

      The minimum delegated amount is 1BNB.

      How to claim my rewards?

      The rewards will be distributed to every delegators from bscvalidator smart contract everyday.

      You can read about the details here and about staking cli commands here

      When can I receive my staking rewards?

      Since validatorset info is updated every day UTC 00:00, to make some room for the error handling, we distribute the fees of day N-1 in the next breathe block (day N+1). Thus, after you sent delegate transaction, you will receive your first staking rewards at the second UTC 00:00. Afterwards, you will receive your rewards everyday at UTC 00:00.

      When can I receive my undelegated BNB?

      Since Unbonding Period is 7 days. Thus, after you sent undelegate transaction, your staked BNB will not receive any rewards since the next UTC 00:00. After 7 days start from the next UTC 00:00, you will receive your BNB .

      When can I redelegate my staked BNB?

      You can choose to move your staked BNB to a different validator by sending a redelegate transaction. For example, you can redelegate from validator A to validator B. Your BNB are still staked, and you can receive rewards from validator B since next 00:00 UTC

      Redelegations between a unique delegator, source validator, and destination validator can only happen once every 7 days

      What is the potential loss for delegators?

      The only risk for delegators is the loss of rewards when their staked validator is slashed. Their staked BNB will not be impacted.

      Can a validator run away with their delegators' BNB?

      By delegating to a validator, a user delegates voting power. This does not mean that the validator has custody of their delegators' BNB. By no means can a validator run away with its delegator's funds.

      Can I receive my staking rewards if my chosen validator is inactive?

      No, you cannot.

      When can I receive my unstaked BNB?

      After you sent undelegate transaction, you have to wait 7 days. This period starts at UTC 00:00 next day.

      What is APR?

      Annual Percentage Rate (APR) is the annual rate of interest paid to delegators net of commission. The calculation is based on the income of this validator 2 days ago. It is not compounded and updated every 24 hours.

      - + diff --git a/docs/BSC-FAQs-general.html b/docs/BSC-FAQs-general.html index c8d9288aa6..75c0a6fd9b 100644 --- a/docs/BSC-FAQs-general.html +++ b/docs/BSC-FAQs-general.html @@ -8,14 +8,14 @@ - +

      BNB Smart Chain FAQs

      What is BNB Smart Chain?

      BNB Smart Chain brings EVM-compatible programmability and native cross-chain communication with BNB Beacon Chain using an innovative consensus of Proof of Staked Authority (PoSA).

      Why is BNB Smart Chain designed as a separate chain from BNB Beacon Chain?

      The execution of a Smart Contract may slow down the exchange function and add non-deterministic factors to trading. Even if that compromise could be tolerated, it might be a straightforward idea to introduce a new Virtual Machine specification based on Tendermint, based on the current underlying consensus protocol and major RPC implementation of BNB Beacon Chain. But all these will increase the learning requirements for all existing dApp communities, and will not be very welcomed.

      Where will the published whitepaper be found?

      The whitepaper can be found at https://github.com/bnb-chain/whitepaper/blob/master/WHITEPAPER.md. Your feedback is more than welcome.

      Where can I take a look at the BNB Smart Chain code? Is there a GitHub repository?

      The codebase of BSC is open-sourced here:

      What is the consensus model of BSC?

      BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. For more details, refer here.

      Where can I find some support?

      Which are BNB Smart Chain's official channels for communication and information?

      Wallet support for BNB Smart Chain

      How to recover if you choose the wrong network type?

      Please read this guide

      How does BNB Smart Chain work? What are the architecture and consensus used?

      BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees.

      There will be fewer validators on the BNB Smart Chain testnet.

      Can you tell me more about Proof of Staked Authority(PoSA)? What is it?

      PoSA is a combination of PoA and PoS. Blocks are produced by a limited set of validators, they are elected in and out based on staking-based governance. Validators take turns to produce blocks in a PoA manner

      What are the benefits for developers to build on BNB Smart Chain?

      • EVM-compatible: BNB Smart Chain supports all the existing Ethereum tooling

      • Fast Finality: Fast block time

      • Cheaper Cost

      • Native cross-chain transfer & communication: Binance DEX remains a liquid venue of exchange of assets on BNB Beacon Chain and BNB Smart Chain "

      What are the benefits for developers to build on BNB Chain?

      BNB Chain opens the gate for users to take advantage of the fast transferring and trading

      How many assets are issued on BNB Chain?

      There are already 140 assets on BNB Chain

      The introduction of BEP8 is an innovative way for tokenization of properties

      What makes BNB Smart Chain different?

      Key Innovations:

      • Proof-of-staked-authority Consensus

      • Native Cross-Chain Communication

      • Expand the use cases of the BNB token

      BNB Smart Chain is EVM-compatible. What does that mean?

      EVM means Ethereum Virtual Machine. Any smart contract written to run in EVM can be easily ported to BNB Smart Chain.

      Can developers make hybrid Dapps using both BNB Beacon Chain and BNB Smart Chain in one single Dapp?

      Yes, with the help of native cross-chain functions

      How to query the current system parameters

      bnbcli  params side-params  --side-chain-id=bsc   --node  http://dataseed4.bnbchain.org:80   --chain-id=Binance-Chain-Tigris --trust-node --output=json
      • minimum self-delegated amount: 2000BNB

      • minimium delegate amount: 1BNB

      • Unbonding time: 7 days

      • offline Unjail fee: 1BNB

      • offline jail time: 2 day

      • offline slashing amount: 50BNB

      • Double-sign slashing amount: 10000BNB

      • Cross-chain relay fee: 0.004 BNB

      How is BNB Smart Chain Ecosystem?

      https://github.com/bnb-chain/bsc-ecosystem

      What are the incentives for developers to build on BSC Chain?

      Future coding competitions; Hackathons

      What are Pegged tokens on BNB Smart Chain?

      Soon after the launch of BNB Beacon Chain, BNB Chain issued several pegged BEP2 tokens that are running on other blockchain networks, including BTC (BTCB), ETH, XRP, LTC, BCH, and ONT. These tokens are backed by real tokens locked in public addresses and have allowed users to benefit from both the volatility of these tokens as well as the fast transfer and trading experience of BNB Beacon Chain.

      Current list:

      Details are here

      How to Send and Receive BNB on BNB Smart Chain?

      Binance.com can withdraw BNB to BSC.

      1. If you don't have an existing address of BNB Smart Chain, please use these wallets to create one.

      2. On your Binance account, open your Binance Extension wallet then tap on Withdraw. Select BEP20 as the Network. Indicate the amount and paste your BSC address.

      3. Complete the steps to withdraw

      4. Wait for the exchange to process your request. Once it is confirmed, you will immediately receive BNB to your Smart Chain address.

      How to Send and Receive Pegged tokens on Smart Chain?

      Binance.com can withdraw those pegged tokens to BSC.

      1. If you don't have an existing address of BNB Smart Chain, please use these wallets to create one.

      2. On your Binance account, open your wallet then tap on Withdraw. Select BEP20 as the Network. Indicate the amount and paste your BSC address.

      img

      1. Complete the steps to withdraw

      2. Wait for the exchange to process your request. Once it is confirmed, you will immediately receive BNB to your Smart Chain address.

      Which dApps are deployed on BSC?

      Refer to here to learn about the different projects deployed on BSC.

      What to do if I transferred funds to the exchange wallet but the exchange doesn't support the BSC chain?

      Please be careful while doing transactions to other exchanges to check if they support or accept deposits through BSC or not. The confirmed transaction on the blockchain cannot be reverted as we also don't have any access to the wallet address.

      What to do in case of a wrong network withdrawal issue?

      Please try to use the wallet app which supports both BSC and ETH networks in it. So that you can access any network with the same address and transfer your funds out of the wrong network.

      What to do in case of a Missing memo or wrong memo?

      Please try to contact the support of the receiver address to help with the deposit. If it's an exchange wallet address then contact them with the correct memo.

      How to track Cross-chain transfer tx From BC to BSC?

      1. Get the Cross-chain transfer transaction hash of the BNB Beacon Chain

      For example https://explorer.bnbchain.org/tx/8B9B066BAF9DC1C233A9D316C75E8139B985518868C1120B656C5B3EBAC7C498

      Please make sure the “Transaction Type” is “Cross-chain transfer out”

      img

      1. Get Destination Address

      The “TxHash on BSC” is linked to BNB smart chain explorer

      img

      For example https://www.bscscan.com/tx/0x43980b4f9ae4c03685dd61172d23ccae07eb8abb0d677c579bfc7059e447ead9

      If "status" is a success, it means this transaction is successful.

      The tokens were sent from "BSC: Token Hub" to the receiver address.

      img

      How to connect Metamask to BNB Smart Chain?

      Please refer here

      How can I report a scam/ rug pull?

      If you meet any potential Scams, Phishing, Rug Pulls, and Hacks, please report through this portal: https://forms.coinholmes.com

      Coinholmes.com is supported by the Peckshield team (A professional security company)

      How to reset Binance Extension Wallet?

      If the user has a seed phrase then the user can refer to here to reset the wallet.

      How to apply for Pioneer Burn Refunding?

      The self-service window for BNB Pioneer Burn Program is now live. Eligible users who lose tokens as part of mistakes they made while making transactions on BNB Smart Chain can access this page and fill in the application form. We will investigate your case and help retrieve the assets if your case is qualified for the Program.

      - + diff --git a/docs/BSC-FAQs-tokens.html b/docs/BSC-FAQs-tokens.html index 422e098477..314504d537 100644 --- a/docs/BSC-FAQs-tokens.html +++ b/docs/BSC-FAQs-tokens.html @@ -8,13 +8,13 @@ - +

      Tokens in BNB Beacon Chain and BNB Smart Chain

      What role does BNB play in securing BNB Smart Chain ?

      BNB is the token used to prevent nothing-at-stake problem.

      What are tokens on BNB Smart Chain ?

      BNB is the native token for BSC, and pegged BEP2 tokens on BSC is called BEP20.

      What is BEP2?

      A simple token protocol for easy management of asset on BNB Beacon Chain https://github.com/bnb-chain/BEPs/blob/master/BEP2.md

      BNB is BEP2

      What is BEP20?

      A token protocol on BSC which is compatible with BEP2 and ERC20. It extends ERC20 and contains more interfaces, such as getOwner and decimals.

      Read the full proposal here: https://github.com/bnb-chain/BEPs/blob/master/BEP20.md

      What is BEP8?

      It is proposed to accommodate the small or micro projects, intellectual properties, and other small token economies. Similar to SME board in the traditional stock markets, BEP8 tokens markets will increase the liquidity of utility tokens of startups or Intellectual Property (IP) tokens by removing the capital requirements for listing. Besides, any BEP8 token issuer can choose to directly list against BNB and BUSD without the voting process of validators.

      Details:

      How to issue BEP2 tokens?

      Please follow the guide here

      How to issue BEP20 tokens?

      Please follow the guide here

      How can I stake my BNB?

      Please follow the guide here

      How many tokens are required to stake BNB?

      The minimum delegated amount is 1BNB.

      Which wallets can be used to stake BNB?

      You can use:

      Where can I find out more about staking economics and rewards?

      You can read details in White Paper: https://github.com/bnb-chain/whitepaper/blob/master/WHITEPAPER.md#rewarding

      Where do network rewards come from?

      Validators and delegators will earn rewards from the following sources:

      • Calling smart contracts on BSC is metered by gas.
      • Rewards for running a BSC Relayer if validators have one

      Which wallets can I use to store BNB?

      You can see the list here

      How to track Cross-chain transfer tx From BSC to BC?

      1. Get Cross-chain transfer tx hash of BNB Smart Chain

      For example: https://bscscan.com/tx/0xb6b941a3d44fec69902ea632eb96c6ffa51b3098576629c26ab34ce10deaf357

      Please make sure the “Transaction Action” is “Transfer out”

      The transfer amount is denoted in the “value” field.

      img

      1. Get Destination Address

      The “Cross Chain Package” is linked to BNB chain explorer

      img

      For example: https://api.binance.org/cross_chain/v1/tx/0xb6b941a3d44fec69902ea632eb96c6ffa51b3098576629c26ab34ce10deaf357

      If "has_refund" is false, it means this transaction is successful.

      The corresponding transaction hash on BNB Beacon Chain is “cross_chain_tx_hash"

      The tokens were sent to “receiverAddresses”.

      img

      - + diff --git a/docs/BSC-FAQs-validator.html b/docs/BSC-FAQs-validator.html index a618ef2b7f..2ffb28c871 100644 --- a/docs/BSC-FAQs-validator.html +++ b/docs/BSC-FAQs-validator.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ Slashing is a punitive function that is triggered by a validator ’s bad actions. Getting slashed is losing self delegation of a validator. Validators will be slashed for the actions below:

      • Going offline or unable to communicate with the network.
      • Double signing: If a validator node tries to split the network by signing two different blocks and broadcasting them, it will be removed from validator set definitely.

      What is the process of getting selected as a validator node on BSC?

      On BNB Smart Chain (BSC) network, validators are responsible for securing the network by processing transactions and signing blocks. Validator nodes are incentivized in the form of transaction fees for their good behavior. Currently, there are 11 validators on the testnest and 50 validators on the mainnet. Validators are selected every 24 hours. Anyone can become a candidate for the validator. To become part of the selection process of validators, the nodes have to stake their BNB. Validators can self-delegate (self-bound) BNB to themselves and can also receive delegations from any other BNB holders. The minimum amount for self-delegation is 2000BNB. Only the top 29 highest-stake nodes are chosen to be part of the validator set. Get more details here.

      How is the bad or malicious behavior of the validator nodes controlled in the BSC?

      One of the important on-chain governance implementations is the technique of “slashing” along with jailing. When jailed validator cannot participate in the consensus mechanism or earn rewards for set period of time. Slashing ensures that validators who act maliciously or show bad behavior are punished. Furthermore, it is designed to expose any attacker and make execution of their attempts extremely expensive. Anyone can submit BSC slash request. Even though BSC slash request requires slash evidence and transaction cost fees, huge reward is given in case the request is successful. To ensure that the delegators are not punished for the validator’s bad behavior, only the self-bonded BNB of the validator are slashed. Currently, slashing is applied on any node that processes an invalid transaction, performs double-signing or is unavailable for a defined period of time.

      What are the two slashable cases?

      The validators are slashed in cases of self-bound less than the required minimum, double singing, and unavailability.

      Double Signing: refers to an event when a validator node proposes two different blocks at the same block height. A validator will be removed from the validator set definitely, if they try signing two different blocks and broadcasting them. For a BSC slash request for double signing the supporting evidence should indicate two block headers having same block height and same parent block hash sealed by the same validator. Two signatures of these two blocks must not be the same. The time of these two blocks must be within the validity of the evidence, which is 24 hours. Rewards for submitting double-sign evidence is 1000BNB. In case the provided evidence are valid, the validators face a slashing of 10000BNB from their self-delegated BNB and will be ‘jailed’ for a time period of 7 days.

      Unavailability/ Downtime in a 24 hour period: the slash fee for a validator being offline is self-delegated 50BNB accompanied with a jail time of 2 days. If a validator misses at least 50 blocks (~52 minutes of downtime) during 24 hours, they will not be able to receive any rewards during that period of time. Instead their reward will be distributed amongst other better performing validators of the set. Another case of unavailability is when a validator misses over 150 blocks (~157.5 minutes of downtime) during 24 hours. In this case, the validator will not receive reward instead it will be propagated back to BC.

      Self‐bond below minimum: Validators are jailed for 1 day if their self‐bond falls below 2000BNB.

      What is the minimum amount for self-delegation to avoid being jailed?

      The minimum self-delegated amount is 2000BNB.

      What is the unbounding time period?

      Unbonding time: 7 days

      What is the unjail fees for a validator jailed for being offline? What is the offline jail time period?

      offline Unjail fee: 1BNB

      offline Jailed time: 2 days. A validator can only unjail 2 days later after it has been jailed

      What is the slashing amount charged to the validators for being offline and double signing?

      offline slashing amount: 50BNB

      Double-sign slashing amount: 10000BNB

      Where can you monitor the slash contract?

      The slash contract can be monitored on the BSC scanner on the following link

      https://bscscan.com/address/0x0000000000000000000000000000000000001001#events

      Does an inactive validator receive any rewards?

      No, they will not.

      Can I receive my staking rewards if my chosen validator is inactive?

      No, you cannot.

      When can I receive my unstaked BNB?

      After you sent undelegate transaction, you have to wait 7 days. This period starts at UTC 00:00 next day.

      How to get un-jailed?

      Validator nodes that have been jailed due to their malicious or bad behavior can be set to ‘unjailed’ by sending a side-unjail transaction if the validation passed. Furthermore, when unjailed, to join the validator set again, the validator must wait for the next UTC 0:00. The fees to un-jail a smart contract validator is 1BNB. Whereas, the fee for submitting a byzantine behavior evidence of a validator is 10BNB.

      Example:

      bnbcli slashing side-unjail --side-chain-id=bsc –node http://dataseed4.bnbchain.org:80 --chain-id=Binance-Chain-Tigris --trust-node --output=json  --from {the address of the validaator operator}

      What is 'self-delegation'? How can I increase my 'self-delegation'?

      Self-delegation is delegation from a validator to themselves. This amount can be increases by sending a delegate transaction from your validator's operator address.

      What is the command to prune?

      • Stop the node gracefully
      • Run nohup geth snapshot prune-state --datadir {the data dir of your bsc node} &
      • Wait for 5-6 hours to finish, it depends on the size of current storage

      What to do if one can’t run prune-state command In the event when running the geth snapshot prune-state --datadir /chaindata on geth 1.1.5 return the following error

      ERROR[11-02|06:02:55.001] Failed to open snapshot tree err="head doesn't
      match snapshot: have 0x5c17a8fc0164dabedd446e954b64e8a54fc7c8b4fee1bbd707c3cc3ed1e45fff, want 0x431565cee8b7f3d7bbdde1265304fa4574dc3531e511e9ffe43ae79d28e431d6" head doesn't match snapshot: have 0x5c17a8fc0164dabedd446e954b64e8a54fc7c8b4fee1bbd707c3cc3ed1e45fff, want 0x431565cee8b7f3

      This error occurs due to data corruption. You can run geth snapshot verify-state to double confirm whether the data is correct. You can download the latest snapshot from https://github.com/bnb-chain/bsc-snapshots. By doing that, you don't have to prune-state in the future, save precious disk IO, it will help you keep up with syncing.

      What to do if Sync is slow on running the following command

      *_start order: geth --config ./config.toml --datadir /data/server/data-seed/ --cache 20000 --rpc.allow-unprotected-txs --syncmode snap  --txlookuplimit 0_*

      Try pruning the state -- stop geth, then run geth --datadir=node - prune-state. Assuming that datadir is node, change that if it's elsewhere then restart after it's done. Follow https://github.com/bnb-chain/bsc/issues/502 to get more tips about how to maintain a synced node.

      How to start the geth node through snapshot to get node synced?

      The two biggest bottlenecks are CPU and IOPS when syncing. Steps are as follows:

      • Download the latest version of geth from the official site and make it executable, optionally move it /usr/local/bin/geth

      • Download mainnet.zip and unzip

      • Generate genesis using command below, will also create a mainnet folder for blockchain data ./geth_linux --datadir mainnet init genesis.json

      • Download the latest snapshot from here

      • Extract the snapshot

      • Move the snapshot data to mainnet folder

        rm -rf mainnet/geth/chaindata

        rm -rf mainnet/geth/triecache

        mv server/data-seed/geth/chaindata mainnet/geth/chaindata

        mv server/data-seed/geth/triecache mainnet/geth/triecache

      [Optional] Open config.toml and delete the Node Log section, just useful for getting logs straight on the terminal or just use tail to look at the logs

      [Optional] Create a service or use screen to run the command below, so it doesn't stop if you are using SSH. Run screen then press enter, anytime you lose connection via ssh, run screen -r to get back the "screen/terminal" where geth was running Geth Command

      geth --config ./config.toml –datadir ./mainnet --cache 100000 --rpc.allow-unprotected-txs --txlookuplimit 0 --http --maxpeers 100 –ws --syncmode=full --snapshot=false

      What are the few adjustments that can help resolve sync issues?

      • Keep maxpeers at around 30. Either Too large or too less is not suggested
      • Enable snapshot, snapshot is another format of state world, it is designed to improve the performance. You can always set it to true.
      • Upgrade to 1.1.5 and diffsync is enabled
      • Try to reduce amount of peers to 30-50 (more peers need more resources) and make sure you're connected to enough peers with net.peerCount
      • Upgrade your hardware, especially Disk and CPU resources.

      Why is the tx from my dapp not visible on the bscscan even though its hash is generated?

      Due to network congestion, it is possible for the tx to appear after a delay. Another possibility is that the number of pending txs have exceeded the size of the limited tx pool of the network and hence the txs have been dropped.

      What is the best course of actions to make sure the slash indicator for a validator contract doesn’t exceed beyond 150 and getting jailed?

      • Pruning is the top choice.
      • Use better CPU, currently we suggest m5zn.3xlarge, it is 3.2G Hz frequency.
      • IOPS above 10000 is good enough.
      • Running 2-3 backup nodes please.
      • NVMe disk is better than SSD

      Can the location of the validator nodes be considered as playing factor in performance? Is there any way to get the enode or ips of the validator nodes?

      The validators are usually running in a private network making it hard to connect or trace their location. Furthermore, it is suggested by community developers that EU is considered a better location in terms of performance.

      - + diff --git a/docs/BSC-FAQs.html b/docs/BSC-FAQs.html index 2f49238caa..df82bdab0c 100644 --- a/docs/BSC-FAQs.html +++ b/docs/BSC-FAQs.html @@ -8,13 +8,13 @@ - +

      BNB Smart Chain

      What is BNB Smart Chain ?

      BNB Smart Chain brings EVM-compatible programmability and native cross-chain communication with BNB Beacon Chain using an innovative consensus of Proof of Staked Authority(PoSA).

      Why is BNB Smart Chain designed as a separate chain from BNB Beacon Chain ?

      The execution of a Smart Contract may slow down the exchange function and add non-deterministic factors to trading. Even if that compromise could be tolerated, it might be a straightforward idea to introduce a new Virtual Machine specification based on Tendermint, based on the current underlying consensus protocol and major RPC implementation of BNB Beacon Chain . But all these will increase the learning requirements for all existing dApp communities, and will not be very welcomed.

      Where will the published whitepaper be found?

      BNB Smart Chain Whitepaper can be found at https://github.com/bnb-chain/whitepaper, where feedback is more than welcome.

      Where can I take a look at BNB Smart Chain code? Is there a GitHub repository?

      The codebase of BSC is open-sourced here:

      Where can I find some support?

      Which are BNB Smart Chain's official channels for communication and information?

      Wallet support for BNB Smart Chain

      How to recover if you choose the wrong network type?

      Please read this guide

      清阅读以下说明

      How does BNB Smart Chain work? What is the architecture and consensus used?

      BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees.

      There will be fewer validators on BNB Smart Chain testnet.

      Can you tell more about Proof of Staked Authority(PoSA)? What is it?

      PoSA is a combination of PoA and PoS. Blocks are produced by a limited set of validators, they are elected in and out based on a staking based governance. Validators take turns to produce blocks in a PoA manner

      What are the benefits for developers to build on BNB Smart Chain ?

      • EVM-compatible: BNB Smart Chain supports all the existing Ethereum tooling

      • Fast Finality: Fast block time

      • Cheaper Cost

      • Native cross-chain transfer & communication: Binance DEX remains a liquid venue of exchange of assets on BNB Beacon Chain and BNB Smart Chain

      What are the benefits for developers to build on BNB Chain ?

      BNB Chain opens the gate for users to take advantage of the fast transferring and trading

      How many assets are issued on BNB Chain ?

      There are already 140 assets on BNB Chain.

      The introduction of BEP8 is an innovative way for tokenization of properties.

      What make BNB Smart Chain different?

      Key Innovations:

      • Proof-of-staked-authority Consensus

      • Native Cross-Chain Communication

      • Expand the use cases of BNB token

      BNB Smart Chain is EVM-compatible. What does that mean?

      EVM means Ethereum Virtual Machine. Any smart-contract written to run in EVM can be easily ported to BNB Smart Chain .

      Can developers make hybrid Dapps using both BNB Beacon Chain and BNB Smart Chain in one single Dapp?

      Yes, with the help of native cross-chain functions

      How to query the current system parameters

      bnbcli  params side-params  --side-chain-id=bsc   --node  http://dataseed4.bnbchain.org:80   --chain-id=Binance-Chain-Tigris --trust-node --output=json
      • Minimum self-delegated amount: 2000BNB

      • Minimum delegate amount: 1BNB

      • Unbonding time: 7 days

      • Offline Unjail fee: 1BNB

      • Offline jail time: 2 day

      • Offline slashing amount: 50BNB

      • Double-sign slashing amount: 10000BNB

      • Cross-chain relay fee: 0.004BNB

      Which dApps are deployed on BSC?

      Refer to here to learn about the different projects deployed on BSC.

      - + diff --git a/docs/BSC-fast-node.html b/docs/BSC-fast-node.html index 5cf4534145..f6617f217f 100644 --- a/docs/BSC-fast-node.html +++ b/docs/BSC-fast-node.html @@ -8,13 +8,13 @@ - +

      Fast Node on BNB Smart Chain

      Note

      Fast Node does not generate Trie Data when syncing.
      Once the Fast Node is running, there is no way to switch back to Full Node.
      Need to re-download snapshot data to restore it to Full Node.

      Fast Node Functions

      • Stores the full blockchain history on disk and can answer the data request from the network.
      • Receives and validates the new blocks and transactions.
      • Verifies the states of every account.

      Steps to Run a Fast Node

      Download the pre-build binaries from release page or follow the instructions below:

      # Linux
      wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_linux |cut -d\" -f4)
      mv geth_linux geth
      chmod -v u+x geth

      # MacOS
      wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_mac |cut -d\" -f4)
      mv geth_mac geth
      chmod -v u+x geth

      Download the config files

      Download genesis.json and config.toml by:

      wget   $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
      unzip mainnet.zip

      Download snapshot

      Download latest chaindata snapshot from here. Follow the guide to structure your files.

      note

      Your --datadir flag should point to the extracted chaindata folder path

      Prune all trie data

      Fast node does not need trie data anymore, prune the trie data by the following command.

      ./geth snapshot insecure-prune-all --datadir ./node  ./genesis.json

      Start Fast Node Without Snapshot Verification

      You can start Fast Node without snapshot verification by verify nodes.

      ## start a fast node
      ./geth --tries-verify-mode none --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0

      Or start Fast Node With Snapshot Verification

      1. Add verifyNodes peers in config.toml.
      [Node.P2P]
      MaxPeers = 1350
      NoDiscovery = false
      BootstrapNodes = ["enode://...", "enode://...", ...]
      VerifyNodes = ["enode://...", "enode://...", ...]
      StaticNodes = ["enode://...", "enode://...", ...]
      ListenAddr = ":30311"
      EnableMsgEvents = false
      1. Start your fast node with snapshot verification by verify nodes.
      ## start a fast node
      ./geth --tries-verify-mode full --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0
      - + diff --git a/docs/BSC-mainnet-explorers.html b/docs/BSC-mainnet-explorers.html index a7e188181c..7df752ab11 100644 --- a/docs/BSC-mainnet-explorers.html +++ b/docs/BSC-mainnet-explorers.html @@ -8,13 +8,13 @@ - +

      BSC Explorers

      BNB Smart Chain explorers is a graphic user interface designed to allow users to interact with the blockchain. Through this interface, a user can browse information about blocks that have been added to the blockchain, transactions that have occurred on the blockchain, wallet balances, and information about BNB.

      Explorers for Mainnet

      * [BscSCAN](https://bscscan.com/)

      * Bitquery - https://explorer.bitquery.io/bsc
      - + diff --git a/docs/BSC-separate-node.html b/docs/BSC-separate-node.html index 68b899b1ef..7e1aa52ba4 100644 --- a/docs/BSC-separate-node.html +++ b/docs/BSC-separate-node.html @@ -8,13 +8,13 @@ - +

      Separate Node on BNB Smart Chain

      Introduction

      img

      Currently, a BSC node has two kinds of state world: MPT and snapshot. MPT(Merkle Patricia Tries) is a tree-structured state world. The key function of MPT is to generate the state root to ensure state consistency, while the query/commit on MPT is quite slow. Snapshot is a flattened key-value-based state world. Snapshot provides fast queries and commits. The storage size of the snapshot increases slowly even with a large transaction volume. Snapshot is usually used for block processing, while MPT is used for state verification.

      In order to lower the hardware requirement and keep security, we introduce two types of nodes to make full use of different storage, one is named fast node, and the other is named verify node. The fast node will do block processing with snapshot, it will do all verification against blocks except state root. The verify node receives diffhash from the fast node and then responds MPT root to the fast node.

      The fast node doesn’t need to store MPT, so the storage and computation requirement will be much lower.

      Roles

      • Fast Node: It does full sync using only Snapshot and generates difflayer. It needs the confirm message from the verify node before freezing the blocks, it has to wait until it receives a confirm message from the verify node for the ancestor block before inserting new blocks.

      • Verify Node: It is a normal BSC full node that does full sync using Snapshot and MPT, and generates difflayer. It receives diffhash from fast nodes, finds the corresponding difflayer whose diffhash is matched, then responds MPT root message to the fast node.

      Fast Node

      Introduce a new tries-verify-mode setting, there are four modes:

      • local: a normal full node with complete state world(both MPT and snapshot), merkle state root will be verified against the block header.
      • full: a fast node with only snapshot state world. Merkle state root is verified by the trustworthy remote verify node by comparing the diffhash(an identify of difflayer generated by the block) and state root.
      • insecure: same as full mode, except that it can tolerate without verifying the diffhash when verify node does not have it.
      • none: no merkle state root verification at all, there is no need to setup or connect remote verify node at all, it is more light comparing to full and insecure mode, but get a very little chance that the state is not consistent with other peers.

      If the fast node runs in not local mode, the node will disable diff protocol by default, If the fast node runs in full or light mode, the node will enable trust protocol by default.

      ./geth --config ./config.toml --datadir ./node --syncmode full --cache 5000 --tries-verify-mode none

      *Note: fast node can never revert to full node.

      Verify node

      When a full node has enabled the trust protocol, it can serve as a verify node, at the same time, we will recommend you to enable persist diff, disable snap protocol and diff protocol when running a verify node.

      ./geth --config ./config.toml --datadir ./node --syncmode full --cache 5000 --persistdiff --enabletrustprotocol --disablesnapprotocol --disablediffprotocol

      Prune tries node

      Prune the tires node:

      ./geth snapshot insecure-prune-all --datadir ./node  ./genesis.json

      Run Verify Node

      Please read this guide

      Run Fast Node

      Please read this guide

      - + diff --git a/docs/BSC-testnet-explorers.html b/docs/BSC-testnet-explorers.html index 34dcd41df4..54046819b1 100644 --- a/docs/BSC-testnet-explorers.html +++ b/docs/BSC-testnet-explorers.html @@ -8,13 +8,13 @@ - +

      BSC Explorers

      BNB Smart Chain explorers is a graphic user interface designed to allow users to interact with the blockchain. Through this interface, a user can browse information about blocks that have been added to the blockchain, transactions that have occurred on the blockchain, wallet balances, and information about BNB.

      Explorers for Testnet

      * BscSCAN - https://testnet.bscscan.com/

      * Bitquery - https://explorer.bitquery.io/bsc_testnet
      - + diff --git a/docs/BSC-verify-node.html b/docs/BSC-verify-node.html index 0c91ef4494..dc28c34672 100644 --- a/docs/BSC-verify-node.html +++ b/docs/BSC-verify-node.html @@ -8,13 +8,13 @@ - +

      Verify Node on BNB Smart Chain

      Verify Node Functions

      • Stores the full blockchain history on disk and can answer the data request from the network.
      • Receives and validates the new blocks and transactions.
      • Verifies the states of every account.
      • Verifies the states of a Fast Node.

      Steps to Run a Verify Node

      1. Download the pre-build binaries from release page or follow the instructions below:
      # Linux
      wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_linux |cut -d\" -f4)
      mv geth_linux geth
      chmod -v u+x geth

      # MacOS
      wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_mac |cut -d\" -f4)
      mv geth_mac geth
      chmod -v u+x geth
      1. Download the config files

      Download genesis.json and config.toml by:

      wget   $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
      unzip mainnet.zip
      1. Download snapshot

      Download latest chaindata snapshot from here. Follow the guide to structure your files.

      note

      Your --datadir flag should point to the extracted chaindata folder path

      1. Start verify node
      ./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --enabletrustprotocol --disablesnapprotocol --disablediffprotocol
      note

      Make sure you use the version of geth you downloaded with wget above, and not your local installation of geth, which might be the wrong version.

      - + diff --git a/docs/BSCexplorers.html b/docs/BSCexplorers.html index a8f202c01b..479e721c94 100644 --- a/docs/BSCexplorers.html +++ b/docs/BSCexplorers.html @@ -8,13 +8,13 @@ - +

      BNB Smart Chain (BSC) Explorer

      BNB Smart Chain (BSC) explorer is a graphic user interface designed to allow users to interact with the blockchain. Through this interface, a user can browse information about blocks that have been added to the blockchain, transactions that have occurred on the blockchain, wallet balances, and information about BNB.

      BNB Smart Chain (BSC) provides explorers for both its mainnet and testnet.

      Explorers for Mainnet

      Explorers for Testnet

      - + diff --git a/docs/BSCmainnet.html b/docs/BSCmainnet.html index 771109750c..70f729afc6 100644 --- a/docs/BSCmainnet.html +++ b/docs/BSCmainnet.html @@ -8,14 +8,14 @@ - +

      BSC Mainnet

      What is Mainnet?

      Mainnet is the term used to describe when a blockchain protocol is fully developed and deployed, meaning that cryptocurrency transactions are being broadcasted, verified, and recorded on a distributed ledger technology (blockchain).

      BNB Smart Chain's mainnet can be used for deploying actual dApps on the BSC blockchain ad perform real transactions. Since this is the actual network, you will require to purchase real BNB tokens to perform different operations on the network.

      How to Get BNB

      There are multiple ways to purchase BNB Tokens for use on the mainnet. Other than the official Binance Extension Wallet, BNB Smart Chain supports several popular wallets like TrustWallet and MetaMask, to learn more about the supported wallets refer here. For a list of tutorials on how to use different supported wallets with BNB Smart Chain, refer here.

      How to Access BSC

      There are multiple ways to access the BSC mainnet. One possible method is to join the mainnet as a full node. You can also use the RPC endpoints specified here to connect to the mainnet. RPC endpoints may be used to interact with a node directly over HTTP or websockets. Using RPC, you may perform low-level operations like executing ABCI queries, viewing network/consensus state or broadcasting a transaction. RPC endpoints are also used with web wallets like MetaMask to connect to the BSC mainnet.

      Explorers for Mainnet

      How to Know BSC Ecosystem

      To get an overview of the BNB Smart Chain, refer here. To learn more about the ecosystem and the different development tools like APIs, IDEs, wallets, etc., that are available on the BSC network, you can refer here. You can visit DappRadar or BNBProject to view real-time ranking and tracking of BSC projects.

      How to Build on BSC

      You can build deploy smart contracts, NFTs, BEP20 Tokens, and BEP20 Upgradable Contracts on the BNB Smart Chain.

      BSC Outlook

      To get an overview of what is the current state and the future developements that BNB Chain's team is working refer here.

      - + diff --git a/docs/BSCtestnet.html b/docs/BSCtestnet.html index dd51b3f43d..a9302f435b 100644 --- a/docs/BSCtestnet.html +++ b/docs/BSCtestnet.html @@ -8,13 +8,13 @@ - +

      BSC Testnet

      What is a Testnet?

      The testnet is a test environment for BNB Smart Chain network, run by the BNB Chain development community, which is open to developers.

      The validators on the testnet are mainly from the development team.

      What is the Testnet good for?

      • Create your test address and get your testnet funds.
      • Develop applications and try tutorials on BNB Smart Chain without the potential to lose your own assets.
      • Test your applications against new versions of BNB Smart Chain.
      • Analyze blockchain data on a smaller, non-trivial data set compared to the public network.

      How to get Testnet Fund?

      The testnet faucet for BNB Chain can be accessed here.

      Explorers for Testnet

      RPC Endpoints

      BSC RPC Endpoints(ChainID 0x61):

      https://docs.bnbchain.org/docs/BSCtestnet

      - + diff --git a/docs/ERC721.html b/docs/ERC721.html index 7f5a55f908..fc6ad57fc1 100644 --- a/docs/ERC721.html +++ b/docs/ERC721.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ In our case we are minting from the account which deployed the token, which is given the minter role.

      We will mint 1 NFT with token ID 0.

      truffle(develop)> await nft.mint("0x0445c33bdce670d57189158b88c0034b579f37ce")
      { tx:
      '0xd301a60dbb8ac187687f6639f200d4e6f2cfa065923092b3940330e35a26421d',
      receipt:
      { transactionHash:
      '0xd301a60dbb8ac187687f6639f200d4e6f2cfa065923092b3940330e35a26421d',
      transactionIndex: 0,
      blockHash:
      '0x3ad3cfcb26da0c969e9d5a5414a5e90a91a3a862c9e9082afc38a0ec0f1a5d00',
      blockNumber: 5,
      from: '0x0445c33bdce670d57189158b88c0034b579f37ce',
      to: '0xdee9411430c7dd9b67fc6da723de729adab50ad7',
      gasUsed: 156470,
      ...

      We can check the owner of the token and the token URI for the metadata

      truffle(develop)> await nft.ownerOf(1)
      '0x0445c33BdCe670D57189158b88c0034B579f37cE'
      truffle(develop)> await nft.tokenURI(1)

      Metadata

      EIP-721 2 includes an optional metadata extension with a name, symbol and for each tokenID a tokenURI with can point to a JSON file with name, description and image for the given token ID.

      How you create and host this metadata is up to you. I would suggest using a domain that you control to point to where you host the data so that you can move it as required.

      For this tutorial, we will use My JSON Server where we can store a single JSON file in a GitHub repository that we can access via a fake JSON server.

      :warning: For production we need to store our metadata in a permanent location that can exist for the life of the token.

      A sample JSON for tokenID 1 is: http://my-json-server.typicode.com/huangsuyu/nft/tokens/1

      Deploy to a Public Testnet

      Next we will deploy to BNB Smart Chain testnet .

      To deploy, we will use the instructions for Connecting to Public Test Networks with Truffle

      You will need the following:

      • An Infura project ID (or a public node provider of your choice)
      • @truffle/hdwallet-provider installed
      • Configure truffle-config.js for Rinkeby network
      • A funded testnet account and mnemonic
      • A secrets.json or another secret-management solution. Make sure you don’t commit this to GitHub!

      My truffle-config.js has the following rinkeby configuration:

           testnet: {
      provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s1.bnbchain.org:8545`),
      network_id: 97,
      confirmations: 10,
      timeoutBlocks: 200,
      skipDryRun: true
      },
      bsc: {
      provider: () => new HDWalletProvider(mnemonic, `https://bsc-dataseed1.bnbchain.org`),
      network_id: 56,
      confirmations: 10,
      timeoutBlocks: 200,
      skipDryRun: true
      },

      Deploy to BSC Testnet

      $ npx truffle migrate --network testnet

      Compiling your contracts...
      ===========================
      > Everything is up to date, there is nothing to compile.

      Starting migrations...
      ======================
      > Network name: 'develop'
      > Network id: 5777
      > Block gas limit: 6721975 (0x6691b7)


      1_initial_migration.js
      ======================

      Deploying 'Migrations'
      ----------------------
      > transaction hash: 0x9a17a50e6efd52ba3e55245c76c52b065d20587add45aee732c233987033e567
      > Blocks: 0 Seconds: 0
      > contract address: 0x77409B688eA5461078a31450F3138EA8324F72C9
      > block number: 1
      > block timestamp: 1604387655
      > account: 0xc7e4bBc4269fdC62F879834E363173aeE7895F45
      > balance: 99.99616114
      > gas used: 191943 (0x2edc7)
      > gas price: 20 gwei
      > value sent: 0 ETH
      > total cost: 0.00383886 ETH


      > Saving migration to chain.
      > Saving artifacts
      -------------------------------------
      > Total cost: 0.00383886 ETH


      2_deploy.js
      ===========

      Deploying 'ERC721PresetMinterPauserAutoId'
      ------------------------------------------
      > transaction hash: 0xc1a3994c2ad2ba706ac49934b4f480c7b3d9b94241f526afa2dfe91545145a4e
      > Blocks: 0 Seconds: 0
      > contract address: 0xEaB17D581552123695f03F12b09e378EE9463b44
      > block number: 3
      > block timestamp: 1604387655
      > account: 0xc7e4bBc4269fdC62F879834E363173aeE7895F45
      > balance: 99.92142266
      > gas used: 3694586 (0x385ffa)
      > gas price: 20 gwei
      > value sent: 0 ETH
      > total cost: 0.07389172 ETH


      > Saving migration to chain.
      > Saving artifacts
      -------------------------------------
      > Total cost: 0.07389172 ETH


      Summary
      =======
      > Total deployments: 2
      > Final cost: 0.07773058 ETH

      Mint

      We can send a transaction to mint tokens to a given account, from an account with the minter role.

      truffle(develop)> nft = await ERC721PresetMinterPauserAutoId.deployed()
      undefined

      In our case we are minting from the account which deployed the token, which is given the minter role.

      To see configured accounts run the command accounts.

      truffle(rinkeby)> accounts
      [ '0x133d144f52705ceb3f5801b63b9ebccf4102f5ed',

      We will mint 1 NFT with token ID 1. Specify the address that you want to be the token holder (0xc7e4bBc4269fdC62F879834E363173aeE7895F45 is one of my test accounts)

      truffle(rinkeby)> await nft.mint("0x133d144f52705ceb3f5801b63b9ebccf4102f5ed")
      { tx:
      '0x0d90d4a2a4ac3f33d5220deb11e8f65adf14a6669afd18abd4cce8ca7ab58e04',
      receipt:
      { blockHash: '0x724ba66bc1d799820c05a93ae67991b21bb769fd1e9dddd5db9f725f5f633331',
      blockNumber: 3333746,
      contractAddress: null,
      cumulativeGasUsed: 164785,
      from: '0x77737a65c296012c67f8c7f656d1df81827c9541',
      gasUsed: 164785,
      ...
      - + diff --git a/docs/Wallet.html b/docs/Wallet.html index 87bc130542..1182e4463f 100644 --- a/docs/Wallet.html +++ b/docs/Wallet.html @@ -8,13 +8,13 @@ - +

      Wallet Guide

      What is a Wallet?

      A crypto wallet is a device or program used for transfer and storage of cryptocurrency. Crypto wallets can be of different types, such as paper wallets, hardware wallets, and software wallets. There are also several smartphone mobile apps and computer programs that provide a user-friendly way to create and manage wallets. Along with crytocurreny, crypto wallets store a collection of crypto keys that are used for sending, receiving, and taracking ownership of cryptocurrencies.

      A keypair is a cryptographically-derived securely generated private and public keys. A private key and its corresponding public key are together known as a keypair. A wallet contains a collection of one or more keypairs and provides some means to interact with them. The security of any crypto wallet depends upon how the private key is stored.

      The public key is known as the wallet's receiving address or simply its address. The wallet address may be shared and displayed freely. When another party is going to send some amount of cryptocurrency to a wallet, they need to know the wallet's receiving address. Depending on a blockchain's implementation, the address can also be used to view certain information about a wallet, such as viewing the balance, but has no ability to change anything about the wallet or withdraw any tokens.

      In order to send cryptocurrencies to another address or to make any changes to the wallet, the private key is used for digitally signing the transactions. It is important to note that the private key must never be shared and should always be kept securely. If by any means access is gained to the private key attached to a wallet, the attacker can withdraw all the tokens contained. Furthermore, if the private key for a wallet is lost, any tokens that have been sent to or stored in that wallet's address are permanently lost.

      Different wallet solutions offer different approaches to keypair security, interacting with the keypair, and signing transactions to use/spend the tokens. Some are easier to use than others. Some store and back up private keys more securely. BNB Smart Chain supports several wallets, giving its users the right to choose the right wallet for their required security and convenience.

      If you want to be able to receive BNB and other supported tokens on the BNB Smart Chain blockchain, you will first need to create a wallet and configure key management.

      Supported Wallets

      • List of Wallets Supporting BNB Chain
      NumberWallet NameWebsiteStaking Support
      1Binance Extension Wallethttps://binance-wallet.gitbook.io/binance-chain-wallet/Yes
      2BNB Chain Listhttps://www.bnbchainlist.org/No
      3Trust Wallethttps://trustwallet.com/Yes
      4Math Wallethttps://mathwallet.org/en-us/Yes
      5SafePalhttps://safepal.io/No
      6TokenPockethttps://www.tokenpocket.pro/No
      7Arkanehttps://arkane.network/No
      8MetaMaskhttps://metamask.zendesk.com/hc/en-usNo
      9Ledgerhttps://www.ledger.com/Yes
      10Trezorhttps://wallet.trezor.ioNo
      11MEWhttps://www.myetherwallet.com/No
      12ezDeFihttp://ezdefi.comNo
      131inch wallethttps://1inch.io/wallet/No
      14Infinity wallet (Desktop)https://infinitywallet.io/download/No
      15BitKeep (App&Chrome)https://bitkeep.comNo
      16Coin98 Wallet (App Web Extension)https://coin98.com/walletNo
      17Guarda Wallethttps://guarda.com/coins/binance-coin-wallet/No
      18Rabby Wallethttps://rabby.io/No
      19Atomic Wallethttps://atomicwallet.io/Yes
      - + diff --git a/docs/add-account.html b/docs/add-account.html index 9315719d9f..5ff090e48c 100644 --- a/docs/add-account.html +++ b/docs/add-account.html @@ -8,13 +8,13 @@ - +

      How does Add Account Work

      BIP39

      Bitcoin Improvement Proposal (BIP) 39 defines a formula for the generation of a mnemonic sentence (also referred to as mnemonic words, seed phrase, recovery phrase, etc.) the generation of a seed from that mnemonic sentence. The seed phrase is used to produce your private and public keys.

      BIP32

      BIP 32 is a specification for creating Hierarchical Deterministic wallets. They are wallets that from a root can generate multiple "child" private keys in a deterministic way. You only need to remember the "path" of the child key.For example hardware wallets use them from a single root you can generate separate keys for Bitcoin (with path m/44'/0'/0'/0) and Ethereum (path m/44'/60'/0'/0).

      Add Account in Binance Extension Wallet

      Binance Extension wallet would use a similar way to generate keys as Ethereum, i.e. derive the private key using BIP32/BIP44 with HD prefix as "44'/60'/", which is the same as Ethereum's derivation path.

      img

      Whenever you click on “Add Account”, your seed is extended at the end by a counter value which makes it possible to automatically derive an unlimited number of new addresses in your extension wallet.

      - + diff --git a/docs/api-reference/cli.html b/docs/api-reference/cli.html index 38068aa715..067ad77434 100644 --- a/docs/api-reference/cli.html +++ b/docs/api-reference/cli.html @@ -8,7 +8,7 @@ - + @@ -20,7 +20,7 @@ balance, transaction detail by transaction hash and etc.

      Where can I download the BNB CLI?

      You can download BNB CLI releases here: https://github.com/bnb-chain/node/releases

      You can choose to download the version for testnet (tbnbcli) or mainnet (bnblci).

      CLI installation

      Once you have downloaded the binary for your platform, you may drop it into any folder you like. Open a terminal window or cmd.exe in that folder, and then follow the examples on the documentation site.

      For mainnet:

      $  ./bnbcli

      On Windows you would most likely use this instead:

      C:\> bnbcli.exe

      For testnet:

      $  ./tbnbcli

      On Windows you would most likely use this instead:

      C:\> tbnbcli.exe

      Where to connect

      You can manage you keys locally without connecting to any node. But if you want to interact with BNB Beacon Chain, you need to connect to one of BNB Beacon Chain full nodes.

      You can run your own full node, which may automatically connect to BNB Beacon Chain, and you can run your CLI there with your own full node. In the mean time, you can connect to any full nodes provided by other people.

      You could query this API for for a list of full node on mainnet: https://dex.binance.org/api/v1/peers.

      For testnet, visit https://testnet-dex.binance.org/api/v1/peers.

      Full nodes will be denoted as the format of ip:port, you could use access_addr as your peer to get connected, such as https://dataseed4.defibit.io:443

      Please note that there are two types of nodes that offer RPC services. Some support TLS and others don't.

      Which Chain-ID to use

      chain-id is an important field to fill for every transaction sent from bnbcli. The chain-id for mainnet is Binance-Chain-Tigris, and is Binance-Chain-Ganges for testnet. Please choose the correct one in your case.

      Which Private Key To Use

      There are two ways for you to sign transaction:

      • Use Local Keystore File

      This is the default way to sign transactions with bnbcli. It will use the encrypted keystore files saved at bnbcli home. You need to specify which key to decrypt with --from.

      • Use Private Key in Hardware Wallet

      First, you must add --ledger when creating a new address. For example,

      bnbcli keys add test --ledger --index 0 --account 0

      Then, the private key file in ledger will be used to generate a new address.

      You could also specify --account and --index to generate more addresses. After the generation, you could use Ledger for signing.

      When you use the address to sign transactions, bnbcli will send transactions to Ledger and get signatures. Then bnbcli build the signed transactions and boardcast them to full nodes.

      Key manager

      Here we support two types of key: local key and leder key

      Local key

      • Create a local key
      bnbcli keys add test_key

      The newly created local key will be encrypted and saved to the local keystore.

      • Sign transaction with a local key
      bnbcli send --chain-id=<chain-id> --from=test_key --amount=100:BNB --to=<address>

      For instance, if you want to send a token transfer transaction, you can use the above command. The flag --from is used to specify which key should be used to sign the transaction.

      Ledger key

      • Create a local key

      Before creating a new ledger key, make sure you have performed these steps:

      1. Ledger device is installed, binance ledger app and the version should be later or equal to v1.1.3.
      2. Connect your ledger device to your machine and input pin code to unlock it.
      3. Open the binance ledger app on your ledger device.
      bnbcli keys add test_ledger_key --ledger

      Execute the above command to create a ledger key. The private key is only stored in your ledger device. And your local key store will save the corresponding publick key and address.

      bnbcli keys add test_ledger_key_new --ledger --index 0 --account 0

      You can also specify --account and --index to generate more keys.

      • Sign transaction with a ledger key

      Taking transfer transaction for example, please follow these steps:

      1. Execute command in your console:
      bnbcli send --chain-id=<chain-id> --from=test_ledger_key --amount=100:BNB --to=<address>
      1. Your console will print some message like this:
      Please confirm if address displayed on ledger is identical to bnb15339dcwlq5nza4atfmqxfx6mhamywz35evruva (yes/no)?
      1. User can click confirm button on ledger device and input yes to continue following steps.
      2. Then user can preview the transaction data on ledger screen.
      3. After going through all transaction data, user can select sign transaction or reject.
      4. After user selects sign transaction, bnbcli will get the signature and broadcast the signed transaction to blockchain nodes.

      How to use

      When you have downloaded BNB Chain CLI, you can use help subcommand to see all the available commands:

      $  ./bnbcli help
      BNBChain light-client

      Usage:
      bnbcli [command]

      Available Commands:
      init Initialize light client
      status Query remote node for status

      txs Search for all transactions that match the given tags.
      tx Matches this txhash over all committed blocks

      account Query account balance
      send Create and sign a send tx
      transfer

      api-server Start the API server daemon
      keys Add or view local private keys

      version Print the app version
      token issue or view tokens
      dex dex commands
      gov gov commands
      help Help about any command

      Flags:
      -e, --encoding string Binary encoding (hex|b64|btc) (default "hex")
      -h, --help help for bnbcli
      --home string directory for config and data (default "/root/.bnbcli")
      -o, --output string Output format (text|json) (default "text")
      --trace print out full stack trace on errors

      Use "bnbcli [command] --help" for more information about a command.

      Note:there is one special flag --trust-node of most subcommands, if not enabled which is by default the CLI will take an extra 2-4 seconds to verify blockchain proof at current height. You can enable that flag if the peer is trustful so that most commands will accomplish in 500 milliseconds. If your node cannot prove the transaction, there will be the following notice:

      Create verifier failed: Commit: Response error: RPC error -32603 - Internal error: runtime error: invalid memory address or nil pointer dereference
      Please check network connection and verify the address of the node to connect to

      To solve this issue, you need to set --trust-node to true

      CLI Reference

      For detailed usage, you can refer to:

      Use CLI for Different Blockchains

      bnbcli will save data about validatorset changes at home of bnbcli. If you want to use bnbcli for different blockchains, for example, you want to change from testnet to mainnet, the data will be stale. In order to switch between blockchains, you need clean the data folder with rm -rf ~/.bnbcli/.bnblite/ or create a new home folder for bnbcli with --home flag. If you forget to specify a different home folder path, then you will not be able to make queries with bnbcli.

      The same logic applies to tbnbcli.

      - + diff --git a/docs/api-reference/dex-api/paths.html b/docs/api-reference/dex-api/paths.html index 6c3c4104b3..2e0a4a1d2c 100644 --- a/docs/api-reference/dex-api/paths.html +++ b/docs/api-reference/dex-api/paths.html @@ -8,7 +8,7 @@ - + @@ -22,8 +22,8 @@ Rate Limit: 5 requests per IP per second.

      Parameters

      NameLocated inDescriptionRequiredSchema
      symbolquerysymbolNostring

      Responses

      CodeDescriptionSchema
      200OK[ TickerStatistics ]
      400Bad RequestError
      404Not Found
      defaultGeneric error responseError

      /api/v1/mini/trades


      GET

      Summary: Get market trades of mini-token pairs.

      Description: Gets a list of historical trades. Query Window: Default query window is latest 7 days; The maximum start - end query window is 3 months. Rate Limit: 5 requests per IP per second.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addressquerythe buyer/seller addressNostring
      buyerOrderIdquerybuyer order idNostring
      endqueryend time in MillisecondsNolong
      heightqueryblock heightNolong
      limitquerydefault 500; max 1000.Nointeger
      offsetquerystart with 0; default 0.Nointeger
      quoteAssetqueryquote assetNostring
      sellerOrderIdqueryseller order idNostring
      sidequeryorder side. 1 for buy and 2 for sell.Nointeger
      startquerystart time in MillisecondsNolong
      symbolquerysymbolNostring
      totalquerytotal number required, 0 for not required and 1 for required; default not required, return total=-1 in responseNointeger

      Responses

      CodeDescriptionSchema
      200OKTradePage
      400Bad RequestError
      404Not Found
      defaultGeneric error responseError

      Models


      Error

      NameTypeDescriptionExample
      codelongerror code400
      messagestringerror message

      Times

      NameTypeDescriptionExample
      ap_timestringevent timee.g. 2019-01-21T10:30:00Z
      block_timestringthe time of latest blocke.g. 2019-01-21T10:30:00Z

      Validators

      NameTypeDescriptionExample
      block_heightlongCurrent block height12345
      validators[ Validator ]

      Validator

      NameTypeDescriptionExample
      addressstring (hex address)Address
      pub_key[ integer ]Public key bytes
      voting_powerintegervalidator's voting power
      accumintegervalidator's accumulated voting power

      Peer

      NameTypeDescriptionExample
      idstringAuthenticated identifier8c379d4d3b9995c712665dc9a9414dbde5b30483
      original_listen_addrstring (RemoteAddr)Original listen address before PeersService changed it
      listen_addrstring (RemoteAddr)Listen address
      access_addrstring (RemoteAddr)Access address (HTTP)
      stream_addrstring (RemoteAddr)Stream address (WS)
      networkstringChain IDBinance-Chain-Ganges
      versionstringVersion0.30.1
      monikerstringMoniker (Name)data-seed-1
      capabilities[ string ]Array of capability tags: node, qs, ap, wsnode,ap
      acceleratedbooleanIs an accelerated path to a validator node

      Transaction

      NameTypeDescriptionExample
      hashstring (hex)Hash of transaction, it returned as bytes before, and now it returns as hex string
      logstringLog of transaction
      datastringData of transaction
      heightstringHeight of transaction
      codeintegerResult code of transaction
      okboolean
      txobjectDetail of transaction, like transaction type, messages and signature

      For example, below is the detail of a send transaction. Most of the fields are fixed, but the detail of msg -varies with msg type, if you query with --format=json.

      {
      "type": "auth/StdTx", // fixed, type of transaction
      "value": { // fixed, detail of the transaction
      "data": null, // fixed, data of the transaction
      "memo": "", // fixed, memo
      "msg": [ // fixed, msgs of the transaction
      {
      "type": "cosmos-sdk/Send", // vary with msg type
      "value": { // value content vary with mst type
      "inputs": [
      {
      "address": "bnb1vt4zwu5hy7tyryktud6mpcu8h2ehh6xw66gzwp",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ],
      "outputs": [
      {
      "address": "bnb1kg8mh20tndur9d9rry4wjunhpfzcud30qzf0qv",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ]
      }
      }
      ],
      "signatures": [ // fixed, signatures of the transaction
      {
      "account_number": "0",
      "pub_key": {
      "type": "tendermint/PubKeySecp256k1",
      "value": "AoWY3eWBOnnvLPTz4RsUlX1pWCkLLPewu1vAAoTEzxzR"
      },
      "sequence": "1",
      "signature": "6O2TQAgleFNPw4zIWBLaNvOf5dR7DHNSr2DwAPeFK6lokRqZd2KR2BD+WlmaWj4LdLo5N+utN1JtY41E91N0uw=="
      }
      ],
      "source": "0" // fixed, source of the transaction
      }
      }

      | |

      Account

      NameTypeDescriptionExample
      account_numberinteger
      addressstring (address)
      balances[ Balance ]
      public_key[ integer ]Public key bytes
      sequencelongsequence is for preventing replay attack

      AccountSequence

      NameTypeDescriptionExample
      sequencelongnumber used for preventing replay attack1

      Balance

      NameTypeDescriptionExample
      symbolstring (currency)asset symbolBNB
      freestring (fixed8)In decimal form, e.g. 0.000000000.00000000
      lockedstring (fixed8)In decimal form, e.g. 0.000000000.00000000
      frozenstring (fixed8)In decimal form, e.g. 0.000000000.00000000

      Token

      NameTypeDescriptionExample
      namestringtoken nameBinance Chain Native Token
      symbolstringunique token trade symbolBTC-000
      original_symbolstringtoken symbolBTC
      total_supplystring (fixed8)total token supply in decimal form, e.g. 1.000000000.00000000
      ownerstring (address)Address which issue the token
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals

      Market

      NameTypeDescriptionExample
      base_asset_symbolstring (currency)symbol of base assetBNB
      quote_asset_symbolstring (currency)symbol of quote assetABC-5CA
      list_pricestring (fixed8)In decimal form1.00000000
      tick_sizestring (fixed8)Minimium price change in decimal form0.00000001
      lot_sizestring (fixed8)Minimium trading quantity in decimal form1.00000000

      Fee

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1
      multi_transfer_feestringFee for multi-transfer200000
      lower_limit_as_multistringe.g. 22
      fixed_fee_paramsFixedFeeParamsSet if the fee is fixed
      dex_fee_fieldsDexFeeFieldParamsdex fee

      FixedFeeParams

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fixed fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1

      DexFeeFieldParams

      NameTypeDescriptionExample
      fee_namestringfee name
      fee_valueintegerfee value

      MarketDepth

      NameTypeDescriptionExample
      asks[ string (fixed8) ]Price and qty in decimal form, e.g. 1.00000000["1.00000000","800.00000000"]
      bids[ string (fixed8) ]Price and qty in decimal form, e.g. 1.00000000["1.00000000","800.00000000"]
      pending_matchbooleanIf new orders inserted in current block and the matching process has not started in the block, return true.

      Candlestick

      NameTypeDescriptionExample
      closenumberclosing price
      closeTimelongtime of closing trade
      highnumberthe highest price
      lownumberthe lowest price
      numberOfTradesintegertotal trades
      opennumberopen price
      openTimelongtime of open trade
      quoteAssetVolumenumberthe total trading volume in quote asset
      volumenumberthe total trading volume

      OrderList

      NameTypeDescriptionExample
      order[ Order ]list of orders
      totallong

      Order

      NameTypeDescriptionExample
      cumulateQuantitystringtotal amount of trades that have made
      feestringtrading fee on the latest updated block of this order. Multiple assets are split by semicolon.
      lastExecutedPricestringprice of last execution
      lastExecutedQuantitystringquantity of last execution
      orderCreateTimedateTimetime of order creation
      orderIdstringorder ID
      ownerstringorder issuer
      pricestringorder price
      quantitystringorder quantity
      sideinteger1 for buy and 2 for sell
      statusstringenum [Ack, PartialFill, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching, IocExpire]
      symbolstringtrading pair symbol
      timeInForceinteger1 for Good Till Expire(GTE) order and 3 for Immediate Or Cancel (IOC)
      tradeIdstringtrade ID
      transactionHashstringhash of transaction
      transactionTimedateTimetime of latest order update, for example, cancel, expire
      typeintegeronly 2 is available for now, meaning limit order

      SubTx

      NameTypeDescriptionExample
      blockHeightlong
      fromAddrstring
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      TickerStatistics

      NameTypeDescriptionExample
      askPricestringsell price
      askQuantitystringsell quantity
      bidPricestringbuy price
      bidQuantitystringbuy quantity
      closeTimelongtime of closing
      countlongtotal trade count
      firstIdstringID of first trade
      highPricestringhighest price
      lastIdstringID of last trade
      lastPricestringlast price
      lastQuantitystringlast quantity
      lowPricestringlowest price
      openPricestringopen price
      openTimelongopen time
      prevClosePricestringlast close price
      priceChangestringchange of price
      priceChangePercentstringchange of price in percentage
      quoteVolumestringtrading volume in quote asset
      symbolstringtrading symbol
      volumestringtrading volume
      weightedAvgPricestringweighted average price

      TradePage

      NameTypeDescriptionExample
      totallongtotal number of trades
      trade[ Trade ]

      Trade

      NameTypeDescriptionExample
      baseAssetstringbase asset symbol
      blockHeightlongblock height
      buyFeestringtrading fee for the buyer address on the block of this trade
      buyerIdstringid of buyer
      buyerOrderIdstringorder id for buyer
      buySingleFeestringtrading fee for the buyer address on this single tradeBNB:0.00000172;
      buyerSourcelongtx source of buy order1
      pricestringtrade price
      quantitystringtrade quantity
      quoteAssetstringquote asset symbol
      sellFeestringtrading fee for the seller address on the block of this trade
      sellerIdstringseller ID
      sellerOrderIdstringseller order ID
      sellSingleFeestringtrading fee for the seller address on this single tradeBNB:0.00000216;
      sellerSourcelongtx source of sell order1
      symbolstringasset symbol
      tickTypestringenum [Unknown,SellTaker,BuyTaker,BuySurplus,SellSurplus,Neutral]
      timelongtrade time
      tradeIdstringtrade ID

      BlockExchangeFeePage

      NameTypeDescriptionExample
      blockExchangeFee[ BlockExchangeFee ]
      totallong

      BlockExchangeFee

      NameTypeDescriptionExample
      addressstring
      blockHeightlong
      blockTimelongtimestamp of a block
      feestringtotal fee collected. Multiple assets are split by semicolon.
      tradeCountlongtrade count of the address on the block

      TxPage

      NameTypeDescriptionExample
      totallongtotal sum of transactions
      tx[ Tx ]

      BlockTx

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ Tx ]

      BlockTxV2

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ TxV2 ]

      Tx

      NameTypeDescriptionExample
      blockHeightlongblock height
      codeintegertransaction result code0
      confirmBlockslong
      datastring
      fromAddrstringfrom address
      orderIdstringorder ID
      timeStampdateTimetime of transaction
      toAddrstringto address
      txAgelong
      txAssetstring
      txFeestring
      txHashstringhash of transaction
      txTypestringtype of transaction
      valuestringvalue of transaction
      sourcelong
      sequencelong
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      proposalIdstring

      ExchangeRate

      NameTypeDescriptionExample
      ExchangeRateobject

      ResultStatus

      NameTypeDescriptionExample
      validator_info[ ValidatorInfo ]
      sync_info[ SyncInfo ]
      node_info[ NodeInfo ]

      NodeInfo

      NameTypeDescriptionExample
      Protocol_Version[ ProtocolVersion ]
      IDstring
      listen_addrstring
      networkstring
      versionstring
      channelsstring
      monikerstring
      otherobject

      SyncInfo

      NameTypeDescriptionExample
      latest_block_hashstring (hex)
      latest_app_hashstring (hex)
      latest_block_heightlong
      latest_block_timetime
      catching_upboolean

      ProtocolVersion

      NameTypeDescriptionExample
      P2Pinteger (uint64)
      blockinteger (uint64)
      appinteger (uint64)

      ValidatorInfo

      NameTypeDescriptionExample
      addressstringhex address
      pub_keystringhex-encoded
      voting_powerlong

      AtomicSwapPage

      NameTypeDescriptionExample
      atomicSwaps[ AtomicSwap ]
      totallong

      AtomicSwap

      NameTypeDescriptionExample
      blockTimestamplongTimestamp of block in which the swap is initiated. The unit is millisecond.
      closedTimelong
      crossChaininteger
      expectedIncomestring
      expireHeightlong
      fromAddrstring
      inAmountstring
      outAmountstring
      randomNumberstring
      randomNumberHashstring
      recipientOtherChainstring
      statusinteger
      swapIdstring
      timestampstring (int64)The timestamp for randomNumberHash calculation, randomNumberHash=sha256(randomNumber, timestamp). The unit is second.
      toAddrstring

      TxV2

      NameTypeDescriptionExample
      blockHeightlong
      codeinteger0
      datastring
      fromAddrstring
      memostring
      orderIdstringOptional. Available when the transaction type is NEW_ORDER
      proposalIdstringOptional. Available when the transaction type is PROPOSAL
      sequencelong
      sourcelong
      subTransactions[ SubTx ]Optional. Available when the transaction has sub-transactions, such as multi-send transaction or a transaction have multiple assets
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      timeStampdateTime
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      TimeLocks

      NameTypeDescriptionExample
      idlongThe record id of the timelock transaction
      descriptionstringThe description of the timelock transaction
      amount[ ]
      locktimestringThe available unlock time

      MiniTokens

      NameTypeDescriptionExample
      namestringBinance Chain Mini Token
      symbolstringBTC-000
      original_symbolstringBTC
      total_supplystring (fixed8)In decimal form, e.g. 1.000000000.00000000
      token_typeintegerType of the mini token
      ownerstring (address)Address
      mintablebooleanmintable
      token_uristringURI for token description
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals
      - +varies with msg type, if you query with --format=json.

      {
      "type": "auth/StdTx", // fixed, type of transaction
      "value": { // fixed, detail of the transaction
      "data": null, // fixed, data of the transaction
      "memo": "", // fixed, memo
      "msg": [ // fixed, msgs of the transaction
      {
      "type": "cosmos-sdk/Send", // vary with msg type
      "value": { // value content vary with mst type
      "inputs": [
      {
      "address": "bnb1vt4zwu5hy7tyryktud6mpcu8h2ehh6xw66gzwp",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ],
      "outputs": [
      {
      "address": "bnb1kg8mh20tndur9d9rry4wjunhpfzcud30qzf0qv",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ]
      }
      }
      ],
      "signatures": [ // fixed, signatures of the transaction
      {
      "account_number": "0",
      "pub_key": {
      "type": "tendermint/PubKeySecp256k1",
      "value": "AoWY3eWBOnnvLPTz4RsUlX1pWCkLLPewu1vAAoTEzxzR"
      },
      "sequence": "1",
      "signature": "6O2TQAgleFNPw4zIWBLaNvOf5dR7DHNSr2DwAPeFK6lokRqZd2KR2BD+WlmaWj4LdLo5N+utN1JtY41E91N0uw=="
      }
      ],
      "source": "0" // fixed, source of the transaction
      }
      }

      | |

      Account

      NameTypeDescriptionExample
      account_numberinteger
      addressstring (address)
      balances[ Balance ]
      public_key[ integer ]Public key bytes
      sequencelongsequence is for preventing replay attack

      AccountSequence

      NameTypeDescriptionExample
      sequencelongnumber used for preventing replay attack1

      Balance

      NameTypeDescriptionExample
      symbolstring (currency)asset symbolBNB
      freestring (fixed8)In decimal form, e.g. 0.000000000.00000000
      lockedstring (fixed8)In decimal form, e.g. 0.000000000.00000000
      frozenstring (fixed8)In decimal form, e.g. 0.000000000.00000000

      Token

      NameTypeDescriptionExample
      namestringtoken nameBNB Chain Native Token
      symbolstringunique token trade symbolBTC-000
      original_symbolstringtoken symbolBTC
      total_supplystring (fixed8)total token supply in decimal form, e.g. 1.000000000.00000000
      ownerstring (address)Address which issue the token
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals

      Market

      NameTypeDescriptionExample
      base_asset_symbolstring (currency)symbol of base assetBNB
      quote_asset_symbolstring (currency)symbol of quote assetABC-5CA
      list_pricestring (fixed8)In decimal form1.00000000
      tick_sizestring (fixed8)Minimium price change in decimal form0.00000001
      lot_sizestring (fixed8)Minimium trading quantity in decimal form1.00000000

      Fee

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1
      multi_transfer_feestringFee for multi-transfer200000
      lower_limit_as_multistringe.g. 22
      fixed_fee_paramsFixedFeeParamsSet if the fee is fixed
      dex_fee_fieldsDexFeeFieldParamsdex fee

      FixedFeeParams

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fixed fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1

      DexFeeFieldParams

      NameTypeDescriptionExample
      fee_namestringfee name
      fee_valueintegerfee value

      MarketDepth

      NameTypeDescriptionExample
      asks[ string (fixed8) ]Price and qty in decimal form, e.g. 1.00000000["1.00000000","800.00000000"]
      bids[ string (fixed8) ]Price and qty in decimal form, e.g. 1.00000000["1.00000000","800.00000000"]
      pending_matchbooleanIf new orders inserted in current block and the matching process has not started in the block, return true.

      Candlestick

      NameTypeDescriptionExample
      closenumberclosing price
      closeTimelongtime of closing trade
      highnumberthe highest price
      lownumberthe lowest price
      numberOfTradesintegertotal trades
      opennumberopen price
      openTimelongtime of open trade
      quoteAssetVolumenumberthe total trading volume in quote asset
      volumenumberthe total trading volume

      OrderList

      NameTypeDescriptionExample
      order[ Order ]list of orders
      totallong

      Order

      NameTypeDescriptionExample
      cumulateQuantitystringtotal amount of trades that have made
      feestringtrading fee on the latest updated block of this order. Multiple assets are split by semicolon.
      lastExecutedPricestringprice of last execution
      lastExecutedQuantitystringquantity of last execution
      orderCreateTimedateTimetime of order creation
      orderIdstringorder ID
      ownerstringorder issuer
      pricestringorder price
      quantitystringorder quantity
      sideinteger1 for buy and 2 for sell
      statusstringenum [Ack, PartialFill, IocNoFill, FullyFill, Canceled, Expired, FailedBlocking, FailedMatching, IocExpire]
      symbolstringtrading pair symbol
      timeInForceinteger1 for Good Till Expire(GTE) order and 3 for Immediate Or Cancel (IOC)
      tradeIdstringtrade ID
      transactionHashstringhash of transaction
      transactionTimedateTimetime of latest order update, for example, cancel, expire
      typeintegeronly 2 is available for now, meaning limit order

      SubTx

      NameTypeDescriptionExample
      blockHeightlong
      fromAddrstring
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      TickerStatistics

      NameTypeDescriptionExample
      askPricestringsell price
      askQuantitystringsell quantity
      bidPricestringbuy price
      bidQuantitystringbuy quantity
      closeTimelongtime of closing
      countlongtotal trade count
      firstIdstringID of first trade
      highPricestringhighest price
      lastIdstringID of last trade
      lastPricestringlast price
      lastQuantitystringlast quantity
      lowPricestringlowest price
      openPricestringopen price
      openTimelongopen time
      prevClosePricestringlast close price
      priceChangestringchange of price
      priceChangePercentstringchange of price in percentage
      quoteVolumestringtrading volume in quote asset
      symbolstringtrading symbol
      volumestringtrading volume
      weightedAvgPricestringweighted average price

      TradePage

      NameTypeDescriptionExample
      totallongtotal number of trades
      trade[ Trade ]

      Trade

      NameTypeDescriptionExample
      baseAssetstringbase asset symbol
      blockHeightlongblock height
      buyFeestringtrading fee for the buyer address on the block of this trade
      buyerIdstringid of buyer
      buyerOrderIdstringorder id for buyer
      buySingleFeestringtrading fee for the buyer address on this single tradeBNB:0.00000172;
      buyerSourcelongtx source of buy order1
      pricestringtrade price
      quantitystringtrade quantity
      quoteAssetstringquote asset symbol
      sellFeestringtrading fee for the seller address on the block of this trade
      sellerIdstringseller ID
      sellerOrderIdstringseller order ID
      sellSingleFeestringtrading fee for the seller address on this single tradeBNB:0.00000216;
      sellerSourcelongtx source of sell order1
      symbolstringasset symbol
      tickTypestringenum [Unknown,SellTaker,BuyTaker,BuySurplus,SellSurplus,Neutral]
      timelongtrade time
      tradeIdstringtrade ID

      BlockExchangeFeePage

      NameTypeDescriptionExample
      blockExchangeFee[ BlockExchangeFee ]
      totallong

      BlockExchangeFee

      NameTypeDescriptionExample
      addressstring
      blockHeightlong
      blockTimelongtimestamp of a block
      feestringtotal fee collected. Multiple assets are split by semicolon.
      tradeCountlongtrade count of the address on the block

      TxPage

      NameTypeDescriptionExample
      totallongtotal sum of transactions
      tx[ Tx ]

      BlockTx

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ Tx ]

      BlockTxV2

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ TxV2 ]

      Tx

      NameTypeDescriptionExample
      blockHeightlongblock height
      codeintegertransaction result code0
      confirmBlockslong
      datastring
      fromAddrstringfrom address
      orderIdstringorder ID
      timeStampdateTimetime of transaction
      toAddrstringto address
      txAgelong
      txAssetstring
      txFeestring
      txHashstringhash of transaction
      txTypestringtype of transaction
      valuestringvalue of transaction
      sourcelong
      sequencelong
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      proposalIdstring

      ExchangeRate

      NameTypeDescriptionExample
      ExchangeRateobject

      ResultStatus

      NameTypeDescriptionExample
      validator_info[ ValidatorInfo ]
      sync_info[ SyncInfo ]
      node_info[ NodeInfo ]

      NodeInfo

      NameTypeDescriptionExample
      Protocol_Version[ ProtocolVersion ]
      IDstring
      listen_addrstring
      networkstring
      versionstring
      channelsstring
      monikerstring
      otherobject

      SyncInfo

      NameTypeDescriptionExample
      latest_block_hashstring (hex)
      latest_app_hashstring (hex)
      latest_block_heightlong
      latest_block_timetime
      catching_upboolean

      ProtocolVersion

      NameTypeDescriptionExample
      P2Pinteger (uint64)
      blockinteger (uint64)
      appinteger (uint64)

      ValidatorInfo

      NameTypeDescriptionExample
      addressstringhex address
      pub_keystringhex-encoded
      voting_powerlong

      AtomicSwapPage

      NameTypeDescriptionExample
      atomicSwaps[ AtomicSwap ]
      totallong

      AtomicSwap

      NameTypeDescriptionExample
      blockTimestamplongTimestamp of block in which the swap is initiated. The unit is millisecond.
      closedTimelong
      crossChaininteger
      expectedIncomestring
      expireHeightlong
      fromAddrstring
      inAmountstring
      outAmountstring
      randomNumberstring
      randomNumberHashstring
      recipientOtherChainstring
      statusinteger
      swapIdstring
      timestampstring (int64)The timestamp for randomNumberHash calculation, randomNumberHash=sha256(randomNumber, timestamp). The unit is second.
      toAddrstring

      TxV2

      NameTypeDescriptionExample
      blockHeightlong
      codeinteger0
      datastring
      fromAddrstring
      memostring
      orderIdstringOptional. Available when the transaction type is NEW_ORDER
      proposalIdstringOptional. Available when the transaction type is PROPOSAL
      sequencelong
      sourcelong
      subTransactions[ SubTx ]Optional. Available when the transaction has sub-transactions, such as multi-send transaction or a transaction have multiple assets
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      timeStampdateTime
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      TimeLocks

      NameTypeDescriptionExample
      idlongThe record id of the timelock transaction
      descriptionstringThe description of the timelock transaction
      amount[ ]
      locktimestringThe available unlock time

      MiniTokens

      NameTypeDescriptionExample
      namestringBNB Chain Mini Token
      symbolstringBTC-000
      original_symbolstringBTC
      total_supplystring (fixed8)In decimal form, e.g. 1.000000000.00000000
      token_typeintegerType of the mini token
      ownerstring (address)Address
      mintablebooleanmintable
      token_uristringURI for token description
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals
      + diff --git a/docs/api-reference/node-rpc.html b/docs/api-reference/node-rpc.html index bbb7611f6f..797ab3b9d7 100644 --- a/docs/api-reference/node-rpc.html +++ b/docs/api-reference/node-rpc.html @@ -8,7 +8,7 @@ - + @@ -44,7 +44,7 @@ Query Parameters

      ParameterTypeDefaultRequiredDescription
      querystring""trueQuery

      Examples:

          tm.event = 'NewBlock'                               # new blocks
      tm.event = 'CompleteProposal' # node got a complete proposal
      tm.event = 'Tx' AND tx.hash = 'XYZ' # single transaction
      tm.event = 'Tx' AND tx.height = 5 # all txs of the fifth block
      tx.height = 5 # all txs of the fifth block

      Tendermint provides a few predefined keys: tm.event, tx.hash and tx.height. Note for transactions, you can define additional keys by providing tags with DeliverTx response.

              DeliverTx{
      Tags: []*KVPair{
      "agent.name": "K",
      }
      }

      tm.event = 'Tx' AND agent.name = 'K'
      tm.event = 'Tx' AND account.created_at >= TIME 2013-05-03T14:45:00Z
      tm.event = 'Tx' AND contract.sign_date = DATE 2017-01-01
      tm.event = 'Tx' AND account.owner CONTAINS 'Igor'

      See list of all possible events here

      https://godoc.org/github.com/tendermint/tendermint/types#pkg-constants

      For complete query syntax, check out

      https://godoc.org/github.com/tendermint/tendermint/libs/pubsub/query.
      import "github.com/tendermint/tendermint/libs/pubsub/query"
      import "github.com/tendermint/tendermint/types"

      client := client.NewHTTP("tcp://0.0.0.0:27147", "/websocket")
      err := client.Start()
      if err != nil {

      // handle error

      }
      defer client.Stop()
      ctx, cancel := context.WithTimeout(context.Background(), timeout)
      defer cancel()
      query := query.MustParse("tm.event = 'Tx' AND tx.height = 3")
      txs := make(chan interface{})
      err = client.Subscribe(ctx, "test-client", query, txs)

      go func() {


      for e := range txs {
      fmt.Println("got ", e.(types.EventDataTx))
      }

      }()

      The above command returns JSON structured like this:

      {


      "error": "",
      "result": {},
      "id": "",
      "jsonrpc": "2.0"

      }

      6.3.2 Unsubscribe

      Unsubscribe from events via WebSocket.

      Query Parameters

      ParameterTypeDefaultRequiredDescription
      querystring""trueQuery
      client := client.NewHTTP("tcp://0.0.0.0:27147", "/websocket")
      err := client.Start()
      if err != nil {
      // handle error
      }
      defer client.Stop()
      err = client.Unsubscribe("test-client", query)

      The above command returns JSON structured like this:

      {
      "error": "",
      "result": {},
      "id": "",
      "jsonrpc": "2.0"
      }

      6.3.3 UnsubscribeAll

      Unsubscribe from all events via WebSocket.

      client := client.NewHTTP("tcp://0.0.0.0:27147", "/websocket")
      err := client.Start()
      if err != nil {


      // handle error

      }
      defer client.Stop()
      err = client.UnsubscribeAll("test-client")

      The above command returns JSON structured like this:

      {
      "error": "",
      "result": {},
      "id": "",
      "jsonrpc": "2.0"
      }
      - + diff --git a/docs/api-reference/sdk.html b/docs/api-reference/sdk.html index 603b985b8f..3c02c09f23 100644 --- a/docs/api-reference/sdk.html +++ b/docs/api-reference/sdk.html @@ -8,13 +8,13 @@ - +
      - + diff --git a/docs/archivenode.html b/docs/archivenode.html index 6f71fa3dab..c71b80b5be 100644 --- a/docs/archivenode.html +++ b/docs/archivenode.html @@ -8,14 +8,14 @@ - +

      How to Run an Archive Node on BNB Smart Chain

      What is an archive node?

      Simply speaking, an archive node is a full node running with an additional special option, --gcmode archive. It stores all the historical data of the blockchain starting from the genesis block. As compared to a typical full node that just holds all the state change data for some latest blocks, an archive node always stores them for each block.

      Why is an archive node important?

      Developers are limited to querying the limited recent blocks to check the balance of an address and the state of a smart contract with a full node. It is hard to get all what they want as the blockchain is moving forward at the same time, while they can query any block at a specific point in time with an archive node. Archive nodes are used by various applications on the blockchain for challenging use cases, including but not limited to the followings:

      • Automatic trading system needs historical data to optimize trading model
      • Verification modules need state data to verify transactions in time
      • Analytical tools need full historical data to do data analysis
      • Exchange in some wallets depends on archive node for fast and efficient transfers

      Suggested Requirements

      Running an archive node will take a high cost as it includes all the block and state change data. First of all it needs the disk with sufficient capacity; besides this, the CPU and disk performance should be good enough to catch up with the latest block height.

      How to run an archive node for BSC mainnet?

      1. Run with a Geth client

      1.1 Run one segment archive node with a snapshot

      A segment archive node is a node which has all the data from one starting block height to one ending block height, such as [19000000, latest]. To create such one archive node, you need a snapshot with starting block number, less than 19000000.

      You can get snapshot from BNB Chain official documentation:

      • Command to run:
      ./geth --config local_config_dir/config.toml --datadir local_data_dir --pprof.addr 0.0.0.0 --rpc.allow-unprotected-txs --rpccorsdomain * --light.serve 50 --cache 5000 --metrics --snapshot=true --rangelimit --gcmode archive --txlookuplimit 0 --syncmode full --pprof

      1.2 Build one full archive node with segmented archive nodes

      Instead of putting all archive data on a single Geth instance, it is suggested to create multiple segment instances, each of them only serving part of the chain. To get better performance, it is suggested that each segment's size is better to control under 4TB. There will be around 40TB data in all(up to March, 2023). For all BSC snapshots you can refer to Free public BNB Smart Chain Archive Snapshot. The owner has put all BSC archive snapshots on S3. As described this path is public but is configured as requester-pays. This means you'll need an AWS account in order to download them. After having all the segments, you need one proxy to dispatch the requests to the right segment. And thanks the owner, one proxy was also implemented. Please follow the owner's guide to build.

      2. Run with an Erigon client

      Erigon has supported BSC mainnet. You can also refer to Free public BNB Smart Chain Archive Snapshot for the guide to run a BSC archive node with an Erigon client. The owner has switched to using an Erigon client for a BSC archive node recently. You can download the archive snapshot which is a tarball from aws s3. The s3 path is "s3://public-blockchain-snapshots/bsc/erigon-latest.tar.zstd". This path is public, but is configured as requester-pays. Also this means you'll need an AWS account in order to download it.

      • Command to download to local dir:
      aws s3 cp --request-payer=requester  "s3://public-blockchain-snapshots/bsc/erigon-latest.tar.zstd"   local_data_dir

      tar --use-compress-program=unzstd -xvf erigon-latest.tar.zstd
      • Command to run:
      ./erigon --chain=bsc --datadir  local_data_dir

      The known Issue with an Erigon client is that it does not really keep up with the latest blocks as mentioned in the Github. If you want to keep up with the latest blocks it is suggested to run a BSC archive node with high performance disk such as NVME, or run a BSC full node with a Geth client at the same time which means you need one proxy that will ask Erigon if it has the block height and if not forward it to the Geth client.

      Comparison between Geth and Erigon

      • Data size: Up to now(June, 2022), the whole data size is about 35TB with Geth client while it is about 6TB with Erigon client, much smaller.

      • Maturity: Erigon is new and not yet battle tested while Geth has been running a long time, more stable. Archive nodes with Geth client can support all RPC APIs while some of them are not supported well by Erigon client such as eth_getProof.

      • Complexity: It is easier to run one BSC archive node with an Erigon client than that with a Geth client. And it is nearly the same complexity if you want to keep up the latest blocks with a Erigon archive node & a Geth full node at the same time.

      All in all, people can choose one of the methods above to run a BSC archive node based on their own requirements.

      - + diff --git a/docs/band.html b/docs/band.html index 94f854e640..900ee117d1 100644 --- a/docs/band.html +++ b/docs/band.html @@ -8,13 +8,13 @@ - +

      Band Protocol Price Feed on BNB Smart Chain

      Introduction

      Developers building on BNB Smart Chain can now leverage Band’s decentralized oracle infrastructure. With Band’s oracle, they now have access to various cryptocurrency price data to integrate into their applications.

      Supported Tokens

      Currently, the following token symbols are supported. Going forward, this list will continue to expand based on developer needs and community feedback.

      Token NameSymbol
      BNB CoinBNB
      BNB USDBUSD
      BitcoinBTC
      EthereumETH
      TetherUSDT
      XRPXRP
      ChainlinkLINK
      PolkadotDOT
      Bitcoin CashBCH
      LitecoinLTC
      CardanoADA
      Bitcoin SVBSV
      Crypto.com CoinCRO
      EOSEOS
      TezosXTZ
      TronTRX
      StellarXLM
      CosmosATOM
      MoneroXMR
      OKBOKB
      SwipeSXP

      Price Pairs

      The method provided below supports price query with any denomination as long as the base and quote symbols are supported in the list above.

      For example, you can use the APIs in Javascripts and Solidity to query the following price pairs:

      • BTC/USD
      • BNB/ETH

      Querying Prices

      Currently, there are two methods for developers to query prices from Band’s oracle: through Band’s StdReference smart contract on BNB Smart Chain and through their bandchain.js JavaScript helper library.

      Solidity Smart Contract

      To query prices from Band’s oracle through smart contracts, the contract looking to use the price values should reference Band’s StdReference contract. This contract exposes getReferenceData and getReferenceDataBulk functions.

      getReferenceData takes two strings as the inputs, the base and quote symbol, respectively. It then queries the StdReference contract for the latest rates for those two tokens, and returns a ReferenceData struct, shown below.

      struct ReferenceData {
      uint256 rate; // base/quote exchange rate, multiplied by 1e18.
      uint256 lastUpdatedBase; // UNIX epoch of the last time when base price gets updated.
      uint256 lastUpdatedQuote; // UNIX epoch of the last time when quote price gets updated.
      }

      getReferenceDataBulk instead takes two lists, one of the base tokens, and one of the quotes. It then proceeds to similarly queries the price for each base/quote pair at each index, and returns an array of ReferenceData structs.

      For example, if we call getReferenceDataBulk with ['BTC','BTC','ETH'] and ['USD','ETH','BNB'], the returned ReferenceData array will contain information regarding the pairs:

      • BTC/USD
      • BTC/ETH
      • ETH/BNB

      Example Usage

      The contract code below demonstrates a simple usage of the new StdReference contract and the getReferenceData function.

      pragma solidity 0.6.11;
      pragma experimental ABIEncoderV2;

      interface IStdReference {
      /// A structure returned whenever someone requests for standard reference data.
      struct ReferenceData {
      uint256 rate; // base/quote exchange rate, multiplied by 1e18.
      uint256 lastUpdatedBase; // UNIX epoch of the last time when base price gets updated.
      uint256 lastUpdatedQuote; // UNIX epoch of the last time when quote price gets updated.
      }

      /// Returns the price data for the given base/quote pair. Revert if not available.
      function getReferenceData(string memory _base, string memory _quote)
      external
      view
      returns (ReferenceData memory);

      /// Similar to getReferenceData, but with multiple base/quote pairs at once.
      function getReferenceDataBulk(string[] memory _bases, string[] memory _quotes)
      external
      view
      returns (ReferenceData[] memory);
      }

      contract DemoOracle {
      IStdReference ref;

      uint256 public price;

      constructor(IStdReference _ref) public {
      ref = _ref;
      }

      function getPrice() external view returns (uint256){
      IStdReference.ReferenceData memory data = ref.getReferenceData("BTC","USD");
      return data.rate;
      }

      function getMultiPrices() external view returns (uint256[] memory){
      string[] memory baseSymbols = new string[](2);
      baseSymbols[0] = "BTC";
      baseSymbols[1] = "ETH";

      string[] memory quoteSymbols = new string[](2);
      quoteSymbols[0] = "USD";
      quoteSymbols[1] = "USD";
      IStdReference.ReferenceData[] memory data = ref.getReferenceDataBulk(baseSymbols,quoteSymbols);

      uint256[] memory prices = new uint256[](2);
      prices[0] = data[0].rate;
      prices[1] = data[1].rate;

      return prices;
      }

      function savePrice(string memory base, string memory quote) external {
      IStdReference.ReferenceData memory data = ref.getReferenceData(base,quote);
      price = data.rate;
      }
      }

      Contract Addresses

      BlockchainAggregator Contract AddressUpdate EveryExplorer
      BSC (Testnet)0xDA7a001b254CD22e46d3eAB04d937489c93174C35 minslink
      BSC (Mainnet)0xDA7a001b254CD22e46d3eAB04d937489c93174C35 minslink

      BandChain.JS

      Band’s node helper library bandchain.js also supports a similar getReferenceData function. This function takes one argument, a list of token pairs to query the result of. It then returns a list of corresponding rate values.

      Example Usage

      The code below shows an example usage of the function

      const BandChain = require('@bandprotocol/bandchain.js');

      (async () => {
      const endpoint = 'https://poa-api.bandchain.org';

      const bandchain = new BandChain(endpoint);
      const price = await bandchain.getReferenceData(['BAND/USD', 'BTC/ETH', 'EUR/USD', 'EUR/BTC']);
      console.log(price);
      })();

      The corresponding result will then be similar to

      $ node index.js
      [
      {
      pair: 'BAND/USD',
      rate: 6.49,
      updated: { base: 1600676205, quote: 0 },
      rawRate: { value: 6490000000n, decimals: 9 }
      },
      {
      pair: 'BTC/ETH',
      rate: 29.574702955490906,
      updated: { base: 1600676187, quote: 1600676187 },
      rawRate: { value: 29574702955n, decimals: 9 }
      },
      {
      pair: 'EUR/USD',
      rate: 1.185569204,
      updated: { base: 1600676032, quote: 0 },
      rawRate: { value: 1185569204n, decimals: 9 }
      },
      {
      pair: 'EUR/BTC',
      rate: 0.00010899500647220628,
      updated: { base: 1600676032, quote: 1600676187 },
      rawRate: { value: 108995n, decimals: 9 }
      }
      ]

      For each pair, the following information will be returned:

      • pair: The base/quote symbol pair string

      • rate: The resulting rate of the given pair

      • updated: The timestamp at which the base and quote symbols was last updated on BandChain. For USD, this will be the current timestamp

      • rawRate: This object consists of two parts.

        • value is the BigInt value of the actual rate, multiplied by 10^decimals
        • decimals is then the exponent by which rate was multiplied by to get rawRate

      Originally published here

      - + diff --git a/docs/beaconchain.html b/docs/beaconchain.html index d7dc4196f8..2def5c53a9 100644 --- a/docs/beaconchain.html +++ b/docs/beaconchain.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

      BNB Beacon Chain Documentation

      Welcome to the BNB Beacon Chain documentation site!

      Please note that both the BNB Beacon Chain software and this documentation site will improve over time and is still a work-in-progress.
      Be sure to engage with our community channels to stay updated.

      Have fun trading and see you on chain!

      What are BNB Beacon Chain and Binance DEX?

      BNB Beacon Chain is a blockchain software system developed by its community. Binance DEX refers to the decentralized exchange features developed on top of BNB Beacon Chain.

      Please read the FAQ to get started.

      What is BNB Smart Chain?

      BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain . BNB Smart Chain relies on a system of 41 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.

      Please read the FAQ to get started.

      What can I do with BNB Beacon Chain ?

      The purpose of the new blockchain and DEX is to create an alternative marketplace for issuing and exchanging digital assets in a decentralized manner.

      You can:

      For traders, you can:

      For developers, you can also:

      For traders, you can:

      For developers, you can also:

      • Explore the transaction history and blocks on the chain, via BNB Beacon Chain Explore, API and node RPC interfaces.
      • Run a full node to listen to and broadcast live updates on transactions, blocks, and consensus activities
      • Extract other data of BNB Beacon Chain via full node or APIs
      • Develop tools and application to help users use BNB Beacon Chain and Binance DEX

      What can I do with BNB Smart Chain ?

      BNB Smart Chain (BSC) is best described as a blockchain that runs in parallel to the BNB Beacon Chain . Unlike BNB Beacon Chain , BSC boasts smart contract functionality and compatibility with the Ethereum Virtual Machine (EVM). The design goal here was to leave the high throughput of BNB Beacon Chain intact while introducing smart contracts into its ecosystem.

      Because BSC is EVM-compatible, it launched with support for the rich universe of Ethereum tools and DApps. In theory, this makes it easy for developers to port their projects over from Ethereum. For users, it means that applications like MetaMask can be easily configured to work with BSC. Seriously – it’s just a matter of tweaking a couple of settings. Check out Use MetaMask for BNB Smart Chain to get started.

      You can:

      • Send and receive BNB and other BEP2 tokens cross-chain
      • Explore the transaction history and blocks on the chain, via bscscan, API and node RPC interfaces.
      • Stake you BNB to earn some block rewards

      Developers can also:

      • Issue new tokens to digitalize assets
      • Migrate existing DApps
      • Run a full node to listen to and broadcast live updates on transactions, blocks, and consensus activities
      • Develop wallets and tools to help users use Dapps

      Comparision Between BC and BSC

      BNB Beacon ChainBNB Smart Chain
      ConsensusDPoSPoSA
      No. of Validators11up to 50
      Mean Block Time<1s~5s
      ProgrammabilityBEPsSupport EVM-compatible smart contracts
      Cross ChainBEP3 introduces Hash Timer Locked Contract functions and further mechanism to handle inter-blockchain tokens peg.BSC comes with efficient native dual chain communication; Optimized for scaling high-performance dApps that require fast and smooth user experience.

      Get Started

      Want to try it BNB Beacon Chain ? Just give a peek at the first few of pages of the getting started guide.
      You could also have a read through the FAQ.

      Want to develop on BNB Smart Chain ? First, read through the FAQ and learn about tokens here.

      Asset Management

      BEP2 Asset

      BNB Beacon Chain is essentially a digital asset creation and exchange platform.
      @@ -24,7 +24,7 @@ More information about how projects can set themselves up for this (via binance.com or partners) will come soon.

      BNB Staking

      Please read the guide here

      Trading on Binance DEX

      Binance DEX is the native marketplace on BNB Beacon Chain , allowing you to exchange digital assets issued and listed on it.
      The matching happens within the blockchain nodes and all of the transactions are recorded on-chain, therefore forming a complete, auditable ledger of activity.

      ATTENTION: The match logic on DEX is quite different from normal centralized exchange.
      Please go over the trading and match spec below to get the best interests for your orders.

      Technology Details

      Continue reading below if you are interested in what is happening under the hood!

      Acknowledgement

      Thanks to the community, our partners and supporters.

      - + diff --git a/docs/beaconchain/CONTRIBUTING.html b/docs/beaconchain/CONTRIBUTING.html index b39acc3523..ad212f6038 100644 --- a/docs/beaconchain/CONTRIBUTING.html +++ b/docs/beaconchain/CONTRIBUTING.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ appropriate to start the first line of a commit with 'doc' instead of an issue number.

      Finding things to work on

      The first place to start is always looking over the current GitHub issues for the project you are interested in contributing to. Issues marked with [help wanted][help-wanted] are usually pretty self-contained and a good place to get started.

      Of course, feel free to create a new issue if you think something needs to be added or fixed.

      Making Changes

      • Create a topic branch from where you want to base your work.
        • This is usually the master branch.
        • Please avoid working directly on the master branch.
      • Make sure you have added the necessary tests for your changes and make sure all tests pass.

      Submitting Changes

      • Push your changes to a topic branch in your fork of the repository.
      • Submit a pull request to the docs repository in the BNB Chain organization.
        • Include a descriptive [commit message][commit-msg].
        • Changes contributed via pull request should focus on a single issue at a time.
        • Rebase your local changes against the master branch. Resolve any conflicts that arise.

      This document is inspired by:

      - + diff --git a/docs/beaconchain/account.html b/docs/beaconchain/account.html index 5af99fb08d..11f48d89bb 100644 --- a/docs/beaconchain/account.html +++ b/docs/beaconchain/account.html @@ -8,14 +8,14 @@ - +

      Account and Balance

      Each account contains cryptographic authentication info. It is created by a user of the blockchain. It also includes public key, address, and account number/sequence number for replay protection. Whenever a new address receives an asset, the corresponding transaction would create an Account for that address, which contains balances across all assets that are owned on this address.

      The balance (the amount of tokens) of each asset is composed of 3 different parts:

      • Available: the amount of tokens that can be transferred, and spent to swap (buy) other assets
      • Locked: the amount of tokens that has been used in any outstanding orders. Once the order terminates (either filled, canceled or expired), the locked amount will decrease.
      • Frozen: the amount of tokens that has been frozen via Freeze transactions.

      You can query the account info with the following command on mainnet:

      ./bnbcli account <your-address> --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --indent --trust-node

      Example output:

      Please note that the amount is boosted by e^8 for the decimal part.

      {"type":"bnbchain/Account","value":{"base":{"address":"tbnb1sylyjw032eajr9cyllp26n04300qzzre38qyv5","coins":[{"denom":"000-0E1","amount":"10530"},{"denom":"BNB","amount":"247349863800"},{"denom":"BTC.B-918","amount":"113218800"},{"denom":"COSMOS-587","amount":"50000101983748977"},{"denom":"EDU-DD0","amount":"139885964"},{"denom":"MFH-9B5","amount":"1258976083286"},{"denom":"NASC-137","amount":"0"},{"denom":"PPC-00A","amount":"205150260"},{"denom":"TGT-9FC","amount":"33251102828"},{"denom":"UCX-CC8","amount":"1398859649"},{"denom":"USDT.B-B7C","amount":"140456966268"},{"denom":"YLC-D8B","amount":"210572645"},{"denom":"ZZZ-21E","amount":"13988596"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"AhOb3ZXecsIqwqKw+HhTscyi6K35xYpKaJx10yYwE0Qa"},"account_number":"406226","sequence":"29"},"name":"","frozen":null,"locked":[{"denom":"KOGE48-35D","amount":"10000000000"}]}}

      From the output you can see that this account account_number is 406226 and its sequence is 29. This is the important information about this account.

      Create Account

      There are two ways of creating an account on BNB Chain : creating a key in a web wallet and creating a key via bnbcli. Please make sure you backup your mnemonic.

      Web Wallet

      Follow the instructions and set your password (password is used to unlock the keystore file that you will get here):

      create key

      Then click Download Keystore File and you will get a keystore file and be directed to mnemonic page. Make sure to back up mnemonic here as it will be used to restore your key.

      create key

      • You can restore your key here

      Choose Mnenomic Phrase, paste the mnemonic you get above and set your session password:

      create key

      Your wallet will be unlocked and you can get your address here (for this example it is tbnb14m2gcdjq7aqkdtu2m9qrqrl8eevzpqfj9xc0uu):

      create key

      Account Management With Bnbcli

      You can get bnbcli by following instructions here.

      You should get mnemonic if you follow the instructions above. You can restore you key via bnbcli or tbnbcli.

      • Restore your key
      $ ./bnbcli keys add test --recover
      Enter a passphrase for your key:
      Repeat the passphrase:
      > Enter your recovery seed phrase:
      more advice achieve mass clap nose bike bird busy section rigid model doll exchange guard theme catalog junior patrol valley depart decade convince master
      NAME: TYPE: ADDRESS: PUBKEY:
      test local tbnb14m2gcdjq7aqkdtu2m9qrqrl8eevzpqfj9xc0uu bnbp1addwnpepqt7nf2dwgfxv6kmzgwhzlp556yhdfeakfdejc6lp8xcddsv83kq552m63s9
      • Create a new key

      You can also create a new key and you will get a new mnemonic with bnbcli or tbnbcli.

      $ ./bnbcli keys add new_key
      Enter a passphrase for your key:
      Repeat the passphrase:
      NAME: TYPE: ADDRESS: PUBKEY:
      new_key local tbnb1c5dxrdn9xuw0njwcyevzyjrza550z5au8v0hyz bnbp1addwnpepqwdsud63f5rq2wkgrezlvzdauf4x7wp3defzvhrzkwdzl7p0n6uk666ghpa
      **Important** write this seed phrase in a safe place.
      It is the only way to recover your account if you ever forget your password.

      napkin degree boring custom differ smart bundle ball length lyrics auto forest jeans awake entry vocal there repeat rule churn picnic promote screen skull

      Query Account Balance

      Please note that the amount is boosted by e^8 for the decimal part.

      Example on mainnet:

      $  ./bnbcli account bnc1wwgakqy32m7vdnlf00pctf9hnaak37eh7wkmqa --trust-node --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443

      Example on testnet:

      $  ./tbnbcli account bnc1wwgakqy32m7vdnlf00pctf9hnaak37eh7wkmqa --trust-node --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80
      {
      "type":"bnbchain/Account",
      "value":{
      "base":{
      "address":"bnc1wwgakqy32m7vdnlf00pctf9hnaak37eh7wkmqa",
      "coins":[
      {
      "denom":"AAA-254",
      "amount":"19500000000000000"
      }
      ],
      "public_key":{
      "type":"tendermint/PubKeySecp256k1",
      "value":"A1V88I61gCbF2V1RqdCxb0UN/8g95mNUlJGH5htNNC70"
      },
      "account_number":"0",
      "sequence":"337"
      },
      "name":"node0",
      "frozen":null,
      "locked":null
      }
      }

      Get Testnet BNB

      You can get test BNB by following this guide.

      - + diff --git a/docs/beaconchain/acknowledgement.html b/docs/beaconchain/acknowledgement.html index 6013ec8ec0..d8b92b60ef 100644 --- a/docs/beaconchain/acknowledgement.html +++ b/docs/beaconchain/acknowledgement.html @@ -8,13 +8,13 @@ - +

      Acknowledgements

      BNB Beacon Chain has been through several iterations and evolutions, each time building upon work contributed by members of the blockchain community. We would like to acknowledge the outstanding work that we have been able to achieve during development. Let's build the future together!

      Bitcoin and Ethereum

      There is no doubt that these two projects and their communities provided us from day one with countless creativity. They are the root and ground-zero of thought and keep providing us with brilliant utilities and ideas.

      Binance Dexathon

      The Binance Dexathon concluded in September 2018, receiving prize winning submissions from teams that sent in some really impressive projects. Our internal work on BNB Beacon Chain was taking place in parallel to this and we are delighted to say that many of the projects helped to improve the final product.

      Tendermint and Cosmos

      Our current implementation is built on forks of Tendermint and Cosmos SDK. We make use of a revised edition of Tendermint consensus and leverage its p2p networking logic, and Cosmos SDK features such as "bank" which is used for basic token transactions. Some of the changes have been contributed back to the projects.

      Projects like BNB Beacon Chain and Binance DEX are often built as forks of Bitcoin or as smart contracts on platforms like Ethereum. With a foundation of clean, well-structured code from Cosmos SDK, we were able to build on a codebase that we saw as a better alternative. Many thanks to the Cosmos developers and its community for their work (and for being really helpful in our issues and pull requests!)

      Juan Leni, ZondaX

      Thanks to Juan Leni for his work on the open-source Cosmos Ledger app, which we were able to use as a base for the BNB Beacon Chain Ledger app.

      - + diff --git a/docs/beaconchain/anti-frontrun.html b/docs/beaconchain/anti-frontrun.html index 82479bc902..54f9e1aec3 100644 --- a/docs/beaconchain/anti-frontrun.html +++ b/docs/beaconchain/anti-frontrun.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

      Anti Front-Running

      Front-running means someone can get prior knowledge of transactions from other beneficial owners via technology or market advantage, so that they can influence the price beforehand and result in economic gain, which usually brings loss or cost to others. It is a daunting question asked to both centralized and other decentralized exchanges (DEX). Especially on some DEX, front-running actually happens quite often, e.g. via gas or timestamp manipulations, or slow matching.

      There are several design points in Binance DEX that make front-running very difficult to execute.

      Fast Matching

      Binance DEX matches orders in every block (with very fast block times). Fast matching leaves very little room for front-runner to react before the orders get executed properly. This is one of the fundamental parts of making front-running difficult, especially for normal market participants.

      Decentralized, Transparent Match Engine

      It is very difficult to argue that the exchange itself is not front-running if it has a centralized matching engine. Binance DEX have decentralized matching engines running on every block producer and full node. This way everyone can replay the order match manually with the transactions in the latest block with the current order book and can see the order matching in real-time if they run a full node.

      This makes wash trading easily observable!

      Periodic Auction Matching

      Periodic auction matching per block lowers the importance of fast orders, i.e. fast orders do not benefit from high frequency trading behaviors even when being several hundreds of milliseconds faster (which is "really long time" for traditional exchanges). Fast orders do not bring any advantage.

      Periodic auction also adds a non-deterministic layer where no one can exactly know the next execution price unless he/she can exactly know all 3 things listed below:

      1. the matching logic
      2. the current order book and trade price from the last match
      3. all incoming orders for the next block

      1) and 2) may be visible to participants, especially for validators and others who closely watch the blockchain status, such as fast sync trading bots or full nodes. But knowing 3) is very hard for normal market participant. Even if they run powerful accelerated node, they still cannot know all the incoming orders for the next block. Without this knowledge, even when someone can send orders faster, they cannot do effective front-running.

      So with the above, the usual traders and even trading bots cannot do much to front-run others.

      You might point out, that the validators have a chance to get information of 3) when they are "proposers" for the next block, i.e. they would "propose" what transactions to add for the next block. But the BNB Beacon Chain consensus model adds some additional randomness to make it more difficult:

      Due to the fast matching, the bad validator have to prepare everything with earlier information in order to front-run the price. However, he cannot be too fast, because he cannot know the execution price of the last block until the last block is concluded, and the last execution price has direct impact on the execution price according to the match logic. Even more, any validator ahead of the bad validator's proposer turn can run into an issue and increase the consensus round, which would ask for re-arrangement on the proposing sequence. This makes it very hard to pre-determine the exact proposal sequence, making it so hard that the validator cannot be 100% sure when they can delay any other transactions and add their own transactions to the block earlier. Besides all of this, the bad validator cannot hold other transactions for too long: it either makes the bad behavior very observable on chain, or other validators would include the transactions anyway via P2P communication.

      As a result, it is extremely hard to front-run anyone even while being a validator.

      Potential Improvement

      With the above description, you can clearly see that chance of front-running others on Binance DEX is much lower than on centralized exchanges and most of decentralized ones. However, you may still argue that for a very powerful and sophisticated validator, there is still a slim chance to front-run client orders (if they can do every difficult step very fast).

      In the future, deterministic randomness may be applied in selecting the next proposer among validators, and the match of orders proposed to block can be postponed into the next 2 block. These two enhancements can greatly destroy the prediction accuracy of trading price, which would push the chance of front-running to 0. The cost of this is some latency in matching.

      - + diff --git a/docs/beaconchain/atomic-swap.html b/docs/beaconchain/atomic-swap.html index 21959d8575..0aae507ada 100644 --- a/docs/beaconchain/atomic-swap.html +++ b/docs/beaconchain/atomic-swap.html @@ -8,16 +8,16 @@ - +

      atomic-swap

      Introduction

      As explained in BEP3, Hash Timer Locked Contract(HTLC) has been used for Atomic Swap and cross payment channels between different blockchains. BEP3 defines native transactions to support HTLC on BNB Beacon Chain and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token. During the swap process, the related fund will be locked to a purely-code-controlled escrow account. -A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code of the protocol. The code for calculating escrow account is the same that is used in cosmos-sdk:

      AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))

      The account for mainnet is: bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u and the account for testnet is: tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d. Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts.

      Commands

      Hash Timer Locked Transfer

      Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain, to serve as HTLC in the first step of Atomic Swap,

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender address, where the asset is fromNo
      recipient-addrAddressReceiver address, where the asset is to, if the proper condition meets.No
      recipient-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
      sender-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
      RandomNumberHash32 byteshash of a random number and timestamp, based on SHA256. If left out, a random value will be generatedTrue
      Timestampint64Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used.No
      OutAmountCoinssimilar to the Coins in the original Transfer defined in BEP2, assets to swap outNo
      ExpectedIncomestringExpected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8No
      HeightSpanint64number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)No
      CrossChainboolSpecify if the HTLT is for cross chain atomic swapTrue, the default value is False

      Outputs

      NameTypeDescription
      Random number32 bytes
      Timestampint64
      Random number hash32 bytes
      Swap ID32 bytes

      Examples

      1. Swap between BEP2 tokens
      • On testnet:

      Command line

      ./tbnbcli token HTLT --recipient-addr <recipient-addr> --amount 100:BNB --expected-income <expectedIncome> --height-span <heightSpan> --from <from-addr> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
      const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
      const amount = [{
      denom: "BNB",
      amount: 100
      }]
      const expectedIncome = "100:BNB"// expected income
      const heightSpan = 400// height span
      const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)

      Example output:

      Please take a note of returned swapID:

      Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b
      Timestamp: 1568792486
      Random number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1
      Password to sign with 'guest':
      Committed at block 39984169 (
      tx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,
      response: {
      Code:0
      Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]
      Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
      Info: GasWanted:0 GasUsed:0
      ...
      )

      Besides, the Data field in the committed result is the byte array of swapID:

      Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]

      swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
      1. Swap from BNB Beacon Chain to Ethereum
      • Clients send HTLT on BNB Beacon Chain on testnet:

      Command line:

      ./tbnbcli token HTLT --from <from-addr> --chain-id Binance-Chain-Ganges  --height-span <heightSpan> --amount <amount> --expected-income <expectedIncome> --recipient-addr <deputy-bep2-addr>  --recipient-other-chain <client ethereum address>  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
      const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
      const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
      const amount = [{
      denom: "BNB",
      amount: 100
      }] // swap out token amount
      const expectedIncome = "100:BNB"// expected income
      const heightSpan = 400 // height span
      const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
      1. Swap from Ethereum to BNB Beacon Chain

      Note: Once cross-chain is true, --recipient-other-chain must not be empty

      • Deputy send HTLT on BNB Beacon Chain on testnet:

      Command line:

      ./tbnbcli token HTLT --from  <from-addr> --chain-id Binance-Chain-Ganges --height-span  <heightSpan>  --amount <amount> --expected-income <expectedIncome> --recipient-other-chain <deputy ethereum address> --sender-other-chain <client ethereum address> --recipient-addr <client bep2 address> --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
      const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address
      const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address
      const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract
      const timestamp = 1571383800 //deputy get this value from the event log of swap contract
      const amount = [{
      denom: "BNB",
      amount: 100
      }] // swap out token amount
      const expectedIncome = "100:BNB"// expected income
      const heightSpan = 400 // height span
      const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)

      Deposit HTLT

      Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender address, where the assets are fromNo
      SwapID32 bytesID of previously created swap, hex encodingNo
      AmountCoinsThe swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"No

      Examples

      • On testnet:

      Command line:

      ./tbnbcli token deposit --swap-id <swapID>  --amount 10000:TEST-599 --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
      const amount = [{
      denom: "TEST-599",
      amount: 10000
      }]
      const res = client.swap.depositHTLT(from, swapID, amount)

      Example output

      Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

      After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by swapID and the in_amount must equal to the amount that you balance decreased.

      Claim HTLT

      Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender addressNo
      SwapID32 bytesID of previously created swap, hex encodingNo
      RandomNumber32 bytesThe random number to unlock the locked hash, 32 bytes, hex encodingNo

      Examples

      • On testnet:

      Command line:

      ./tbnbcli token claim --swap-id  <swapID> --random-number <random-number> --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt
      const res = client.swap.claimHTLT(from, swapID, randomNumber)

      Example output:

      Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

      Refund HTLT

      Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender addressNo
      SwapID32 bytesID of previously created swap, hex encodingNo

      Examples

      • On testnet:

      Command line:

      ./tbnbcli token refund --swap-id <swapID> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
      const res = client.swap.refundHTLT(from, swapID, randomNumber)

      Common error:

      • Already complete
      ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}
      • Not expired
      ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}

      Query Atomic Swap

      Query atomic swap allows you to search swap information by swapID

      Parameters

      NameTypeDescriptionOptional
      SwapID32 bytesID of previously created swap, hex encodingNo

      Examples

      • On testnet:
      ./tbnbcli token query-swap --swap-id <swapID> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Expected output

      {
      "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",
      "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",
      "out_amount": [
      {
      "denom": "BNB",
      "amount": "100"
      }
      ],
      "in_amount": [
      {
      "denom": "TEST-599",
      "amount": "10000"
      }
      ],
      "expected_income": "10000:TEST-599",
      "recipient_other_chain": "",
      "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",
      "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",
      "timestamp": "1568792486",
      "cross_chain": false,
      "expire_height": "39994169",
      "index": "53",
      "closed_time": "1568792927",
      "status": "Completed"
      }

      Query Atomic Swap ID By Recipient

      Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface.

      Parameters

      NameTypeDescriptionOptional
      recipient-addrAddressSwap recipient addressNo

      Examples

      • On testnet:
      ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Example output:

      [
      "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",
      "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"
      ]

      Query Atomic Swap ID By Creator

      Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface.

      Parameters

      NameTypeDescriptionOptional
      creator-addrAddressSwap creator addressNo

      Examples

      • On testnet:
      ./tbnbcli token query-swapIDs-by-creator  --creator-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Example output:

      [
      "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",
      "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",
      "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",
      "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",
      "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"
      ]

      Fees

      Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
      HTLTN/A0.000375 BNBY
      depositHTLTN/A0.000375 BNBY
      claimHTLTN/A0.000375 BNBY
      refundHTLTN/A0.000375 BNBY

      Workflows

      Preparations

      1. Deploy smart-contract which supports Atomic Peg Swap (APS), there is already one example for Ethereum
      2. Deploy deputy process for handling swap activities by token owners, there is an existing open-source solution here: https://github.com/bnb-chain/bep3-deputy
      3. Issue and transfer enough tokens

      Testnet Deployment

      Swap Tokens from Ethereum to BNB Beacon Chain

      image-20190918193751444

      1. Approve Swap Transaction

      Go to this page and approve some amount of tokens.

      • Function: Approve
      • Parameters:
        • _spender: address of the smartcontract, which is 0x12DCBf79BE178479870A473A99d91f535ed960AD
        • _value: approved amount, should be bumped by e^10

      Note: Please approve more than 1 token. In the following example, 100 PPC token was approved:

      Example of approve 100 PPC on ropsten testnet

      2. Call HTLT function From Ethereum

      Go to smartcontract and call HTLT function

      • Function: htlt
      • Parameters:
        • _randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array
        • _timestamp: it should be about 10 mins span around current timestamp
        • _heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy.
        • _recipientAddr: deputy address on Ethereum, it's 0x1C002969Fe201975eD8F054916b071672326858e for this one
        • _bep2SenderAddr: omit this field with 0x0
        • _bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9
        • _outAmount: approved amount, should be bumped by e^10
        • _bep2Amount: _outAmount * exchange rate, the default rate is 1

      Example of htlt transaction

      3. Deputy Call HTLT on BNB Beacon Chain

      Then, Deputy will send HTLT transaction here

      4. Claim HTLT on BNB Beacon Chain

      • Get the swapID on BNB Beacon Chain
      ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
      [
      "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"
      ]

      You can also get swapID by calculateSwapID in javascript-sdk. It requires three parameters:

      NameTypeDescriptionExample
      randomNumberHashstringrandomNumberHash in client HTLT transaction on Ethereum5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82
      senderstringdeputy bep2 addresstbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr
      senderOtherChainstringclient ethereum address0x133d144f52705ceb3f5801b63b9ebccf4102f5ed
      • Query the swap by swapID
      {
      "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",
      "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",
      "out_amount": [
      {
      "denom": "PPC-00A",
      "amount": "9999999000"
      }
      ],
      "in_amount": null,
      "expected_income": "",
      "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",
      "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",
      "random_number": "",
      "timestamp": "1569497984",
      "cross_chain": true,
      "expire_height": "41380567",
      "index": "1947",
      "closed_time": "",
      "status": "Open"
      }
      • Verify parameters in the swap:

        • random_number_hash must equal to the randomNumberHash in client HTLT transaction on ethereum
        • to must equals to client wallet address
        • timestamp must equal to the timestamp in client HTLT transaction on ethereum
        • out_amount should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees.
        • expire_height must not be passed and should be enough for send claim transaction
      • Send claim transaction on BNB Beacon Chain

      ./tbnbcli token claim --swap-id  12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128  --random-number <random-number> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Example of claim tx on testnet

      5. Deputy Claim ERC20 Token

      Deputy will claim ERC20 tokens afterwards with claim transaction

      6. Demo for Client APP: swap erc20 to bep2

      This is a javascript implementation for client app to swap PPC to PPC-00A with deputy.

        const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
      const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

      const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
      const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

      const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
      const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

      const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
      const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

      const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
      const bnbClient = new BncClient("https://testnet-dex.binance.org")
      await bnbClient.initChain()
      bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
      bnbClient.useDefaultSigningDelegate()
      bnbClient.useDefaultBroadcastDelegate()
      const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")

      const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
      const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

      //--------------------------------------------
      //Step1 approve erc20 to swap contract address
      //--------------------------------------------
      const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()
      let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
      let gasPrice = await web3.eth.getGasPrice()
      let gasLimit = 3000000
      let rawTx = {
      nonce: web3.utils.toHex(nonce),
      gasPrice: web3.utils.toHex(gasPrice),
      gasLimit: web3.utils.toHex(gasLimit),
      to: erc20ContractAddr,
      value: '0x00',
      data: approveData
      }
      var ethereumjs = require('ethereumjs-tx')
      var signTx = new ethereumjs(rawTx)
      signTx.sign(clientEthWalletKey)
      var serializedTx = signTx.serialize();
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
      await wait(20000)
      //----------------------------------------------------------------------------
      //Step2 call swap contract to send htlt transaction on Ethereum
      //----------------------------------------------------------------------------
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
      const timestamp = Math.floor(Date.now()/1000)
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
      const heightSpan = 1000
      const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
      const amount = 10000000000 // 10000000000:PPC, decimal is 10
      const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A

      const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()
      nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
      gasPrice = await web3.eth.getGasPrice()
      gasLimit = 3000000
      rawTx = {
      nonce: web3.utils.toHex(nonce),
      gasPrice: web3.utils.toHex(gasPrice),
      gasLimit: web3.utils.toHex(gasLimit),
      to: swapContractAddr,
      value: '0x00',
      data: htltData
      }
      ethereumjs = require('ethereumjs-tx')
      signTx = new ethereumjs(rawTx)
      signTx.sign(clientEthWalletKey)
      serializedTx = signTx.serialize();
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
      await wait(20000)

      //----------------------------------------------------------------------------
      //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters
      //----------------------------------------------------------------------------
      const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()
      console.log(swapID)
      let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
      while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {
      console.log("Waiting for the atomic swap created by deputy")
      await wait(5000)
      atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
      }
      const atomicSwap = await bnbClient.getSwapByID(swapID)
      console.log(atomicSwap)
      const status = await bnbRPC.status()
      expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)
      expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))
      expect(atomicSwap.result.timestamp).toBe(timestamp)
      expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")
      expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)

      //----------------------------------------------------------------------------
      //Step4 claim on BNB Beacon Chain
      //----------------------------------------------------------------------------
      const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)
      console.log(res)

      //----------------------------------------------------------------------------
      //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum
      //----------------------------------------------------------------------------

      Swap Tokens from BNB Beacon Chain to Ethereum

      image-20190918193910521

      1. Send HTLT Transaction from BNB Beacon Chain

      Please read this section to generate a valid HTLT transaction. Please write down the randomNumber and randomNumberHash.

      ./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr  --chain-id Binance-Chain-Ganges  --height-span 10000 --amount  9900000000:PPC-00A  --expected-income 9900000000:PPC  --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
      Random number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e
      Timestamp: 1569578936
      Random number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e
      Committed at block 634510 (
      tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,
      response: {
      Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]
      Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2
      ...
      )

      Note: the swap amount must be positive.

      Please write down the random number, random number hash, swapID and timestamp for next steps.

      Example is here

      Then, you can query the the swap by SwapID:

      ./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      You can use this swapID for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters.

      2. Deputy Approve Tokens

      You should see that Deputy has approve enough amount of tokens for atomic swap.

      3. Deputy Send HTLT on Ethereum

      You should see that Deputy has sent the htlt transaction afterwards

      To get the swapID on Ethereum, you can check this page -0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e is the swapID on Ethereum.

      4. Claim ERC20 Tokens on Ethereum

      You should see that Deputy has already approved enough tokens and

      In its event log, you should see the swapID. Before calling claim function on ethereum, clients should verify the parameters in the HTLT event.

      • _randomNumberHash must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain
      • _recipientAddr must equal to client ethereum wallet address
      • _timestamp must equal to the timestamp in client HTLT transaction on BNB Beacon Chain
      • _outAmount should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees.
      • _expireHeight must not be passed and should be enough for send claim transaction

      Then, you can call the claim function:

      • Function: claim
      • Parameters:
        • _swapID: this has been obtained from event, you can also calculate it from calSwapID function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})
        • _randomNumber: reveal your randomNumber

      Example is here

      5. Deputy Claim on BNB Beacon Chain

      Claim HTLT transaction from Deputy is sent afterwards:

      6. Demo for Client APP: swap bep2 to erc20

      This is a javascript implementation of client app to swap PPC-00A to PPC with deputy.

        const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
      const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

      const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
      const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

      const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
      const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

      const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
      const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

      const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
      const bnbClient = new BncClient("https://testnet-dex.binance.org")
      await bnbClient.initChain()
      bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
      bnbClient.useDefaultSigningDelegate()
      bnbClient.useDefaultBroadcastDelegate()
      const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")

      const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
      const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

      //--------------------------------------------
      //Step1 send htlt on BNB Beacon Chain
      //--------------------------------------------
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
      const timestamp = Math.floor(Date.now()/1000)
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
      const heightSpan = 10000
      const amount = [{
      denom: "PPC-00A",
      amount: 100000000
      }]
      const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC

      bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
      await wait(1000)

      //----------------------------------------------------------------------------
      //Step2 query swap created by deputy on Ethereum and verify swap parameters
      //----------------------------------------------------------------------------
      const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
      const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()
      console.log(swapID)

      let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
      while (openSwap._randomNumberHash == '0x0000000000000000000000000000000000000000000000000000000000000000') {
      console.log("Waiting for the atomic swap created by deputy")
      await wait(5000)
      openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
      }
      let ethBlock = await web3.eth.getBlock('latest')
      let ethLatestHeight = ethBlock.number
      expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)
      expect(Number(openSwap._timestamp)).toBe(timestamp)
      expect(Number(openSwap._outAmount)).toBe(9999990000)
      expect(openSwap._recipient).toBe(clientEthWalletAddr)
      expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)

      //----------------------------------------------------------------------------
      //Step3 claim on Ethereum
      //----------------------------------------------------------------------------
      const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()
      let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
      let gasPrice = await web3.eth.getGasPrice()
      let gasLimit = 3000000
      let rawTx = {
      nonce: web3.utils.toHex(nonce),
      gasPrice: web3.utils.toHex(gasPrice),
      gasLimit: web3.utils.toHex(gasLimit),
      to: swapContractAddr,
      value: '0x00',
      data: claimData
      }
      var ethereumjs = require('ethereumjs-tx')
      var signTx = new ethereumjs(rawTx)
      signTx.sign(clientEthWalletKey)
      var serializedTx = signTx.serialize();
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
      await wait(20000)

      //----------------------------------------------------------------------------
      //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain
      //----------------------------------------------------------------------------

      Swap between Several BEP2 tokens

      image-20190918193422062

      Swap between Several BEP2 tokens fails

      image-20190918193518929

      - +A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code of the protocol. The code for calculating escrow account is the same that is used in cosmos-sdk:

      AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))

      The account for mainnet is: bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u and the account for testnet is: tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d. Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts.

      Commands

      Hash Timer Locked Transfer

      Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain, to serve as HTLC in the first step of Atomic Swap,

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender address, where the asset is fromNo
      recipient-addrAddressReceiver address, where the asset is to, if the proper condition meets.No
      recipient-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
      sender-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
      RandomNumberHash32 byteshash of a random number and timestamp, based on SHA256. If left out, a random value will be generatedTrue
      Timestampint64Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used.No
      OutAmountCoinssimilar to the Coins in the original Transfer defined in BEP2, assets to swap outNo
      ExpectedIncomestringExpected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8No
      HeightSpanint64number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)No
      CrossChainboolSpecify if the HTLT is for cross chain atomic swapTrue, the default value is False

      Outputs

      NameTypeDescription
      Random number32 bytes
      Timestampint64
      Random number hash32 bytes
      Swap ID32 bytes

      Examples

      1. Swap between BEP2 tokens
      • On testnet:

      Command line

      ./tbnbcli token HTLT --recipient-addr <recipient-addr> --amount 100:BNB --expected-income <expectedIncome> --height-span <heightSpan> --from <from-addr> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
      const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
      const amount = [{
      denom: "BNB",
      amount: 100
      }]
      const expectedIncome = "100:BNB"// expected income
      const heightSpan = 400// height span
      const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)

      Example output:

      Please take a note of returned swapID:

      Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b
      Timestamp: 1568792486
      Random number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1
      Password to sign with 'guest':
      Committed at block 39984169 (
      tx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,
      response: {
      Code:0
      Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]
      Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
      Info: GasWanted:0 GasUsed:0
      ...
      )

      Besides, the Data field in the committed result is the byte array of swapID:

      Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]

      swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
      1. Swap from BNB Beacon Chain to Ethereum
      • Clients send HTLT on BNB Beacon Chain on testnet:

      Command line:

      ./tbnbcli token HTLT --from <from-addr> --chain-id Binance-Chain-Ganges  --height-span <heightSpan> --amount <amount> --expected-income <expectedIncome> --recipient-addr <deputy-bep2-addr>  --recipient-other-chain <client ethereum address>  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
      const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
      const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
      const amount = [{
      denom: "BNB",
      amount: 100
      }] // swap out token amount
      const expectedIncome = "100:BNB"// expected income
      const heightSpan = 400 // height span
      const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
      1. Swap from Ethereum to BNB Beacon Chain

      Note: Once cross-chain is true, --recipient-other-chain must not be empty

      • Deputy send HTLT on BNB Beacon Chain on testnet:

      Command line:

      ./tbnbcli token HTLT --from  <from-addr> --chain-id Binance-Chain-Ganges --height-span  <heightSpan>  --amount <amount> --expected-income <expectedIncome> --recipient-other-chain <deputy ethereum address> --sender-other-chain <client ethereum address> --recipient-addr <client bep2 address> --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
      const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address
      const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address
      const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract
      const timestamp = 1571383800 //deputy get this value from the event log of swap contract
      const amount = [{
      denom: "BNB",
      amount: 100
      }] // swap out token amount
      const expectedIncome = "100:BNB"// expected income
      const heightSpan = 400 // height span
      const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)

      Deposit HTLT

      Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender address, where the assets are fromNo
      SwapID32 bytesID of previously created swap, hex encodingNo
      AmountCoinsThe swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"No

      Examples

      • On testnet:

      Command line:

      ./tbnbcli token deposit --swap-id <swapID>  --amount 10000:TEST-599 --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
      const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
      const amount = [{
      denom: "TEST-599",
      amount: 10000
      }]
      const res = client.swap.depositHTLT(from, swapID, amount)

      Example output

      Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

      After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by swapID and the in_amount must equal to the amount that you balance decreased.

      Claim HTLT

      Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender addressNo
      SwapID32 bytesID of previously created swap, hex encodingNo
      RandomNumber32 bytesThe random number to unlock the locked hash, 32 bytes, hex encodingNo

      Examples

      • On testnet:

      Command line:

      ./tbnbcli token claim --swap-id  <swapID> --random-number <random-number> --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt
      const res = client.swap.claimHTLT(from, swapID, randomNumber)

      Example output:

      Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

      Refund HTLT

      Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

      Parameters

      NameTypeDescriptionOptional
      FromAddressSender addressNo
      SwapID32 bytesID of previously created swap, hex encodingNo

      Examples

      • On testnet:

      Command line:

      ./tbnbcli token refund --swap-id <swapID> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Javascript:

        const client = new BncClient("https://testnet-dex.binance.org")
      const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
      client.setPrivateKey(privateKey)
      const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
      const res = client.swap.refundHTLT(from, swapID, randomNumber)

      Common error:

      • Already complete
      ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}
      • Not expired
      ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}

      Query Atomic Swap

      Query atomic swap allows you to search swap information by swapID

      Parameters

      NameTypeDescriptionOptional
      SwapID32 bytesID of previously created swap, hex encodingNo

      Examples

      • On testnet:
      ./tbnbcli token query-swap --swap-id <swapID> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Expected output

      {
      "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",
      "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",
      "out_amount": [
      {
      "denom": "BNB",
      "amount": "100"
      }
      ],
      "in_amount": [
      {
      "denom": "TEST-599",
      "amount": "10000"
      }
      ],
      "expected_income": "10000:TEST-599",
      "recipient_other_chain": "",
      "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",
      "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",
      "timestamp": "1568792486",
      "cross_chain": false,
      "expire_height": "39994169",
      "index": "53",
      "closed_time": "1568792927",
      "status": "Completed"
      }

      Query Atomic Swap ID By Recipient

      Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface.

      Parameters

      NameTypeDescriptionOptional
      recipient-addrAddressSwap recipient addressNo

      Examples

      • On testnet:
      ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Example output:

      [
      "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",
      "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"
      ]

      Query Atomic Swap ID By Creator

      Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface.

      Parameters

      NameTypeDescriptionOptional
      creator-addrAddressSwap creator addressNo

      Examples

      • On testnet:
      ./tbnbcli token query-swapIDs-by-creator  --creator-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Example output:

      [
      "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",
      "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",
      "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",
      "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",
      "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"
      ]

      Fees

      Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
      HTLTN/A0.000375 BNBY
      depositHTLTN/A0.000375 BNBY
      claimHTLTN/A0.000375 BNBY
      refundHTLTN/A0.000375 BNBY

      Workflows

      Preparations

      1. Deploy smart-contract which supports Atomic Peg Swap (APS), there is already one example for Ethereum
      2. Deploy deputy process for handling swap activities by token owners, there is an existing open-source solution here: https://github.com/bnb-chain/bep3-deputy
      3. Issue and transfer enough tokens

      Testnet Deployment

      Swap Tokens from Ethereum to BNB Beacon Chain

      image-20190918193751444

      1. Approve Swap Transaction

      Go to this page and approve some amount of tokens.

      • Function: Approve
      • Parameters:
        • _spender: address of the smartcontract, which is 0x12DCBf79BE178479870A473A99d91f535ed960AD
        • _value: approved amount, should be bumped by e^10

      Note: Please approve more than 1 token. In the following example, 100 PPC token was approved:

      Example of approve 100 PPC on ropsten testnet

      2. Call HTLT function From Ethereum

      Go to smartcontract and call HTLT function

      • Function: htlt
      • Parameters:
        • _randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array
        • _timestamp: it should be about 10 mins span around current timestamp
        • _heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy.
        • _recipientAddr: deputy address on Ethereum, it's 0x1C002969Fe201975eD8F054916b071672326858e for this one
        • _bep2SenderAddr: omit this field with 0x0
        • _bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9
        • _outAmount: approved amount, should be bumped by e^10
        • _bep2Amount: _outAmount * exchange rate, the default rate is 1

      Example of htlt transaction

      3. Deputy Call HTLT on BNB Beacon Chain

      Then, Deputy will send HTLT transaction here

      4. Claim HTLT on BNB Beacon Chain

      • Get the swapID on BNB Beacon Chain
      ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
      [
      "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"
      ]

      You can also get swapID by calculateSwapID in javascript-sdk. It requires three parameters:

      NameTypeDescriptionExample
      randomNumberHashstringrandomNumberHash in client HTLT transaction on Ethereum5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82
      senderstringdeputy bep2 addresstbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr
      senderOtherChainstringclient ethereum address0x133d144f52705ceb3f5801b63b9ebccf4102f5ed
      • Query the swap by swapID
      {
      "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",
      "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",
      "out_amount": [
      {
      "denom": "PPC-00A",
      "amount": "9999999000"
      }
      ],
      "in_amount": null,
      "expected_income": "",
      "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",
      "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",
      "random_number": "",
      "timestamp": "1569497984",
      "cross_chain": true,
      "expire_height": "41380567",
      "index": "1947",
      "closed_time": "",
      "status": "Open"
      }
      • Verify parameters in the swap:

        • random_number_hash must equal to the randomNumberHash in client HTLT transaction on ethereum
        • to must equals to client wallet address
        • timestamp must equal to the timestamp in client HTLT transaction on ethereum
        • out_amount should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees.
        • expire_height must not be passed and should be enough for send claim transaction
      • Send claim transaction on BNB Beacon Chain

      ./tbnbcli token claim --swap-id  12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128  --random-number <random-number> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      Example of claim tx on testnet

      5. Deputy Claim ERC20 Token

      Deputy will claim ERC20 tokens afterwards with claim transaction

      6. Demo for Client APP: swap erc20 to bep2

      This is a javascript implementation for client app to swap PPC to PPC-00A with deputy.

        const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
      const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

      const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
      const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

      const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
      const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

      const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
      const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

      const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
      const bnbClient = new BncClient("https://testnet-dex.binance.org")
      await bnbClient.initChain()
      bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
      bnbClient.useDefaultSigningDelegate()
      bnbClient.useDefaultBroadcastDelegate()
      const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")

      const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
      const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

      //--------------------------------------------
      //Step1 approve erc20 to swap contract address
      //--------------------------------------------
      const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()
      let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
      let gasPrice = await web3.eth.getGasPrice()
      let gasLimit = 3000000
      let rawTx = {
      nonce: web3.utils.toHex(nonce),
      gasPrice: web3.utils.toHex(gasPrice),
      gasLimit: web3.utils.toHex(gasLimit),
      to: erc20ContractAddr,
      value: '0x00',
      data: approveData
      }
      var ethereumjs = require('ethereumjs-tx')
      var signTx = new ethereumjs(rawTx)
      signTx.sign(clientEthWalletKey)
      var serializedTx = signTx.serialize();
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
      await wait(20000)
      //----------------------------------------------------------------------------
      //Step2 call swap contract to send htlt transaction on Ethereum
      //----------------------------------------------------------------------------
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
      const timestamp = Math.floor(Date.now()/1000)
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
      const heightSpan = 1000
      const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
      const amount = 10000000000 // 10000000000:PPC, decimal is 10
      const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A

      const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()
      nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
      gasPrice = await web3.eth.getGasPrice()
      gasLimit = 3000000
      rawTx = {
      nonce: web3.utils.toHex(nonce),
      gasPrice: web3.utils.toHex(gasPrice),
      gasLimit: web3.utils.toHex(gasLimit),
      to: swapContractAddr,
      value: '0x00',
      data: htltData
      }
      ethereumjs = require('ethereumjs-tx')
      signTx = new ethereumjs(rawTx)
      signTx.sign(clientEthWalletKey)
      serializedTx = signTx.serialize();
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
      await wait(20000)

      //----------------------------------------------------------------------------
      //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters
      //----------------------------------------------------------------------------
      const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()
      console.log(swapID)
      let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
      while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {
      console.log("Waiting for the atomic swap created by deputy")
      await wait(5000)
      atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
      }
      const atomicSwap = await bnbClient.getSwapByID(swapID)
      console.log(atomicSwap)
      const status = await bnbRPC.status()
      expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)
      expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))
      expect(atomicSwap.result.timestamp).toBe(timestamp)
      expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")
      expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)

      //----------------------------------------------------------------------------
      //Step4 claim on BNB Beacon Chain
      //----------------------------------------------------------------------------
      const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)
      console.log(res)

      //----------------------------------------------------------------------------
      //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum
      //----------------------------------------------------------------------------

      Swap Tokens from BNB Beacon Chain to Ethereum

      image-20190918193910521

      1. Send HTLT Transaction from BNB Beacon Chain

      Please read this section to generate a valid HTLT transaction. Please write down the randomNumber and randomNumberHash.

      ./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr  --chain-id Binance-Chain-Ganges  --height-span 10000 --amount  9900000000:PPC-00A  --expected-income 9900000000:PPC  --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
      Random number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e
      Timestamp: 1569578936
      Random number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e
      Committed at block 634510 (
      tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,
      response: {
      Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]
      Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2
      ...
      )

      Note: the swap amount must be positive.

      Please write down the random number, random number hash, swapID and timestamp for next steps.

      Example is here

      Then, you can query the the swap by SwapID:

      ./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

      You can use this swapID for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters.

      2. Deputy Approve Tokens

      You should see that Deputy has approve enough amount of tokens for atomic swap.

      3. Deputy Send HTLT on Ethereum

      You should see that Deputy has sent the htlt transaction afterwards

      To get the swapID on Ethereum, you can check this page +0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e is the swapID on Ethereum.

      4. Claim ERC20 Tokens on Ethereum

      You should see that Deputy has already approved enough tokens and

      In its event log, you should see the swapID. Before calling claim function on ethereum, clients should verify the parameters in the HTLT event.

      • _randomNumberHash must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain
      • _recipientAddr must equal to client ethereum wallet address
      • _timestamp must equal to the timestamp in client HTLT transaction on BNB Beacon Chain
      • _outAmount should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees.
      • _expireHeight must not be passed and should be enough for send claim transaction

      Then, you can call the claim function:

      • Function: claim
      • Parameters:
        • _swapID: this has been obtained from event, you can also calculate it from calSwapID function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})
        • _randomNumber: reveal your randomNumber

      Example is here

      5. Deputy Claim on BNB Beacon Chain

      Claim HTLT transaction from Deputy is sent afterwards:

      6. Demo for Client APP: swap bep2 to erc20

      This is a javascript implementation of client app to swap PPC-00A to PPC with deputy.

        const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
      const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

      const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
      const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

      const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
      const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

      const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
      const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

      const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
      const bnbClient = new BncClient("https://testnet-dex.binance.org")
      await bnbClient.initChain()
      bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
      bnbClient.useDefaultSigningDelegate()
      bnbClient.useDefaultBroadcastDelegate()
      const bnbRPC = new rpcClient("https://data-seed-pre-2-s1.bnbchain.org/", "testnet")

      const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
      const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

      //--------------------------------------------
      //Step1 send htlt on BNB Beacon Chain
      //--------------------------------------------
      const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
      const timestamp = Math.floor(Date.now()/1000)
      const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
      const heightSpan = 10000
      const amount = [{
      denom: "PPC-00A",
      amount: 100000000
      }]
      const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC

      bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
      await wait(1000)

      //----------------------------------------------------------------------------
      //Step2 query swap created by deputy on Ethereum and verify swap parameters
      //----------------------------------------------------------------------------
      const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
      const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()
      console.log(swapID)

      let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
      while (openSwap._randomNumberHash == '0x0000000000000000000000000000000000000000000000000000000000000000') {
      console.log("Waiting for the atomic swap created by deputy")
      await wait(5000)
      openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
      }
      let ethBlock = await web3.eth.getBlock('latest')
      let ethLatestHeight = ethBlock.number
      expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)
      expect(Number(openSwap._timestamp)).toBe(timestamp)
      expect(Number(openSwap._outAmount)).toBe(9999990000)
      expect(openSwap._recipient).toBe(clientEthWalletAddr)
      expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)

      //----------------------------------------------------------------------------
      //Step3 claim on Ethereum
      //----------------------------------------------------------------------------
      const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()
      let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
      let gasPrice = await web3.eth.getGasPrice()
      let gasLimit = 3000000
      let rawTx = {
      nonce: web3.utils.toHex(nonce),
      gasPrice: web3.utils.toHex(gasPrice),
      gasLimit: web3.utils.toHex(gasLimit),
      to: swapContractAddr,
      value: '0x00',
      data: claimData
      }
      var ethereumjs = require('ethereumjs-tx')
      var signTx = new ethereumjs(rawTx)
      signTx.sign(clientEthWalletKey)
      var serializedTx = signTx.serialize();
      web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
      await wait(20000)

      //----------------------------------------------------------------------------
      //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain
      //----------------------------------------------------------------------------

      Swap between Several BEP2 tokens

      image-20190918193422062

      Swap between Several BEP2 tokens fails

      image-20190918193518929

      + diff --git a/docs/beaconchain/bc-tutorials.html b/docs/beaconchain/bc-tutorials.html index 54668c2388..23cfeb3d93 100644 --- a/docs/beaconchain/bc-tutorials.html +++ b/docs/beaconchain/bc-tutorials.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/beaconchain/blockchain.html b/docs/beaconchain/blockchain.html index ded94cf395..1672c20900 100644 --- a/docs/beaconchain/blockchain.html +++ b/docs/beaconchain/blockchain.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ It is expected a block will be produced on a-few-of-seconds level among validators, and can include from 0 up to several thousands of transactions.

      Blockchain State

      Blockchain state stores the below information:

      • account and balances
      • fees
      • token information
      • trading pairs
      • tick size and lot size
      • governance information

      please note the transactions are not stored as chain state, because they are stored in blocks, while trades are not stored as state either, because they can be reproduced via balances and transactions.

      Cryptographic Design

      Account and Address

      For normal users, all the keys and addresses can be generated via Binance Web Wallet.

      This default wallet would use a similar way to generate keys as Bitcoin, i.e. use 256 bits entropy to generate a 24-word mnemonic based on BIP39, and then use the mnemonic and an empty passphrase to generate a seed; finally use the seed to generate a master key, and derive the private key using BIP32/BIP44 with HD prefix as "44'/714'/", which is reserved at SLIP 44.

      Keys

      BNB Beacon Chain uses the same elliptic curve cryptography as the current Bitcoin implementation, i.e. secp256k1. Its private key is 32 bytes while public key is 33 bytes.

      Address

      Addresses on BNB Beacon Chain are 20 bytes and may be expressed as:

      Address = RIPEMD160(SHA256(compressed public key))

      Typically, an address is encoded in the bech32 format which includes a checksum and human-readable prefix (HRP). However, it doesn't use the SegWit address format (because we do not have SegWit function anyway, so no witness program version etc.).

      A BNB Beacon Chain address is therefore more similar to a Bitcoin Cash address, which does not include a SegWit program script.

      Address format pseudo-code:

      Address_Bech32 = HRP + '1' + bech32.encode(convert8BitsTo5Bits(RIPEMD160(SHA256(compressed public key))))

      For BNB Beacon Chain address, the prefix is bnb for production network, and tbnb for testnet.

      Signature

      BNB Beacon Chain uses an ECDSA signature on curve secp256k1 against a SHA256 hash of the byte array of a JSON-encoded canonical representation of the transaction. For more information, please see this page.

      - + diff --git a/docs/beaconchain/chain-access.html b/docs/beaconchain/chain-access.html index 93e3b54e2e..23dd086e49 100644 --- a/docs/beaconchain/chain-access.html +++ b/docs/beaconchain/chain-access.html @@ -8,7 +8,7 @@ - + @@ -28,7 +28,7 @@ block chain, the Sequence Number will be set to the same number as the one of latest transaction.

      This logic forces the client to be aware of the current Sequence Number, either by reading from the blockchain via API, or keep the counting locally by themselves. The recommended way is to keep counting locally and re-synchronize from the blockchain periodically.

      Examples

      SDK in different languages are provided to simplify use of APIs to access BNB Beacon Chain .

      - + diff --git a/docs/beaconchain/dataseed_list.html b/docs/beaconchain/dataseed_list.html index 32b884b4ee..f13c5fd1a1 100644 --- a/docs/beaconchain/dataseed_list.html +++ b/docs/beaconchain/dataseed_list.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/beaconchain/develop/api-reference/block-service-example.html b/docs/beaconchain/develop/api-reference/block-service-example.html index fe41be82e4..ace634a203 100644 --- a/docs/beaconchain/develop/api-reference/block-service-example.html +++ b/docs/beaconchain/develop/api-reference/block-service-example.html @@ -8,13 +8,13 @@ - +

      Example for tx response, for different tx types

      NEW_ORDER

      {
      hash: "5C18F10BA750E65CA662D8F5F16E6CCC85EECEAB35B8165FD6091B35B20F2D05",
      blockHeight: 162412419,
      blockTime: 1620722432270,
      type: "NEW_ORDER",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 687800,
      memo: "",
      log: "Msg 0: ",
      data: "{"orderId":"75B7DCA71844FA7F59634C29A793CD881A15787E-687801","orderType":"LIMIT","price":"14534","quantity":"3469000000000","side":"BUY","symbol":"MITH-C76_BNB","timeInForce":"GTE"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1wkmaefccgna87ktrfs560y7d3qdp27r7ak44x9",
      toAddr: null
      }

      Note: amount field is null - if you want to get the base or quote asset amount, you can parse it from data field.

      CANCEL_ORDER

      {
      hash: "2E0CB6147B60CBABB8E50AEBDD461295F531E330A7B946229E63D51A967CFEF3",
      blockHeight: 162412424,
      blockTime: 1620722434484,
      type: "CANCEL_ORDER",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 35855681,
      memo: "",
      log: "Msg 0: ",
      data: "{"orderId":"1468EE412C3ADC9CFF3EF31ADC7EDD288F5E208E-35855646","symbol":"BNB_BTCB-1DE"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1z35wusfv8twfele77vddclka9z84ugywug48gn",
      toAddr: null
      }

      TRANSFER

      {
      hash: "D3AA7448385BFEDFE2434D18645C4729D441633BF8E2E98EF702188366BEC8AC",
      blockHeight: 162412424,
      blockTime: 1620722434484,
      type: "TRANSFER",
      fee: 7500,
      code: 0,
      source: 2,
      sequence: 3,
      memo: "100258987",
      log: "Msg 0: ",
      data: null,
      asset: "ADA-9F4",
      amount: 4379000000,
      fromAddr: "bnb1hu07yp89lncjwcu4775npe3s5s0p5ekne2d97y",
      toAddr: "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23"
      }

      TRANSFER (multi-send case)

      {
      hash: "1ACF2C07C2B25865A422C6A6EF8256940E813C09F7279430973254F614521980",
      blockHeight: 162635206,
      blockTime: 1620818353134,
      type: "TRANSFER",
      fee: 12000,
      code: 0,
      source: 1,
      sequence: 34520,
      memo: "0",
      log: "Msg 0: ",
      data: "{"outputs":[{"address":"bnb1ffaqy2g92yglhps7vwc3h4dyjf2kq73xlefzkc","amounts":[{"denom":"BNB","amount":50000000}]},{"address":"bnb15qced76xere38hmmpe644u5kd8v4lzl9gsex9w","amounts":[{"denom":"BNB","amount":1}]}],"inputs":[{"address":"bnb1t38ccns9var4ac4yj2ylmu99r9ecmggr8ye5e5","amounts":[{"denom":"BNB","amount":50000000}]},{"address":"bnb15qced76xere38hmmpe644u5kd8v4lzl9gsex9w","amounts":[{"denom":"BNB","amount":1}]}]}",
      asset: null,
      amount: null,
      fromAddr: null,
      toAddr: null
      }

      Note: mutli send transfer is a special kind of TRANSFER. In this case, you can consider this is a bucket, some addresses put tokens into it and other addresses get tokens out of it.

      CROSS_TRANSFER_OUT

      {
      hash: "D4E1B8A31F62065E8894AEC9C3021A19C5D6AC1A0C742589C8446D9E2E533D4A",
      blockHeight: 162412439,
      blockTime: 1620722441110,
      type: "CROSS_TRANSFER_OUT",
      fee: 7500,
      code: 0,
      source: 2,
      sequence: 5,
      memo: "",
      log: "Msg 0: ",
      data: "{"expireTime":1620723042}",
      asset: "BNB",
      amount: 3579779,
      fromAddr: "bnb1v6jqu5lstgwxdc9r6aexdh4mqee70ld7vxrj09",
      toAddr: "0x3c9d8f8fca99bd7b8af284425784e36e45f901ab"
      }

      MINT

      {
      hash: "8206C5136372D6261E9984728D050E12324679CDBBF6F809B1AD1B8BF936A1E0",
      blockHeight: 161931307,
      blockTime: 1620518810151,
      type: "MINT",
      fee: 200000,
      code: 0,
      source: 1,
      sequence: 339,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "TCT-826",
      amount: 100000000000000,
      fromAddr: "bnb1akey87kt0r8y3fmhu2l8eyzdjvt9ptl5cppz0v",
      toAddr: null
      }

      BURN_TOKEN

      {
      hash: "D315E9218178FEF2048FFCB64F1E50712F083215451F7A8752755A00550AAB86",
      blockHeight: 160916832,
      blockTime: 1620091937909,
      type: "BURN_TOKEN",
      fee: 200000,
      code: 0,
      source: 1,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "CTHUCOIN-AACM",
      amount: 100000000,
      fromAddr: "bnb1xsaphxcj3d80hmyv8d8z2mkqwz4tekzepdfq73",
      toAddr: null
      }

      FREEZE_TOKEN

      {
      hash: "529BA70106BCA2BAF741D575015ACC20825C7B15166C7FAF357E2746A07A8F3D",
      blockHeight: 162411486,
      blockTime: 1620722031659,
      type: "FREEZE_TOKEN",
      fee: 100000,
      code: 0,
      source: 0,
      sequence: 39,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "AWC-986",
      amount: 488514694,
      fromAddr: "bnb1xch7xg3t23vl5ugc4ghzpkqv57dzcdtkurr4jc",
      toAddr: null
      }

      UN_FREEZE_TOKEN

      {
      hash: "10B1784B11E3929BE95BF659C9910E1738E81908473579ABDBBB42C70E288733",
      blockHeight: 162410201,
      blockTime: 1620721488567,
      type: "UN_FREEZE_TOKEN",
      fee: 100000,
      code: 0,
      source: 0,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "AWC-986",
      amount: 15400000000,
      fromAddr: "bnb1ajuxdaxnqd6e5d5vq87le4797xkgr9hgqgt7jp",
      toAddr: null
      }

      ISSUE_TOKEN

      {
      hash: "509393BA67C1B801D3F407E866A1C71E40D6E20A1EAB6C3AD8C0BFC2E9AA9910",
      blockHeight: 162222677,
      blockTime: 1620641433340,
      type: "ISSUE_TOKEN",
      fee: 1000000000,
      code: 0,
      source: 1,
      sequence: 32,
      memo: "",
      log: "Msg 0: Issued DVDO-509",
      data: "{"mintable":false,"name":"Davido Social Token","totalSupply":1000000000000000}",
      asset: "DVDO-509",
      amount: 1000000000000000,
      fromAddr: "bnb1ujvzeuft0ezf9fu4u0mk52t8mc7t8geyfkevms",
      toAddr: null
      }

      TINY_TOKEN_ISSUE

      {
      hash: "989F5C9489260F1F89B1C098BA7E6DBCD780DD825CA3E935F823EA0FD3692E62",
      blockHeight: 152840826,
      blockTime: 1616814337995,
      type: "TINY_TOKEN_ISSUE",
      fee: 40000000,
      code: 0,
      source: 1,
      sequence: 0,
      memo: "",
      log: "Msg 0: Issued YFGYM-989M",
      data: "{"mintable":false,"name":"YEAR FINANCE GYM","tokenURI":"https://yfgym.finance/","totalSupply":1000000000000}",
      asset: "YFGYM-989M",
      amount: 1000000000000,
      fromAddr: "bnb19g4d50vev04jlwy6vpqg97etdews6gjld9uz6r",
      toAddr: null
      }

      MINI_TOKEN_ISSUE

      {
      hash: "0347178CB54E04289D834EA9C05383CAD5DC1A661322F2C91B831FD240792050",
      blockHeight: 161286951,
      blockTime: 1620245763946,
      type: "MINI_TOKEN_ISSUE",
      fee: 60000000,
      code: 0,
      source: 1,
      sequence: 0,
      memo: "",
      log: "Msg 0: Issued BZB-034M",
      data: "{"mintable":false,"name":"One million BZE","tokenURI":"https://bargchain.io","totalSupply":100000000000000}",
      asset: "BZB-034M",
      amount: 100000000000000,
      fromAddr: "bnb1aww88fe99fmvd9s9mnlzu299tuwumsjqvudx4y",
      toAddr: null
      }

      MINI_TOKEN_LIST

      {
      hash: "96A73849D5A55FC8BAEB677307F8A0790AD0727BBC9CA4BEB1CD1C93087841FF",
      blockHeight: 161289727,
      blockTime: 1620246951722,
      type: "MINI_TOKEN_LIST",
      fee: 100000000,
      code: 0,
      source: 1,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: "{"baseAsset":"BZB-034M","initPrice":100000000,"quoteAsset":"BNB"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1aww88fe99fmvd9s9mnlzu299tuwumsjqvudx4y",
      toAddr: null
      }

      LIST_TOKEN

      {
      hash: "1E3A50D7900EAA4BE2785AF312C2CF521C8AE318916D860A8E75C220E2B78F7C",
      blockHeight: 150713320,
      blockTime: 1615976164272,
      type: "LIST_TOKEN",
      fee: 20000000000,
      code: 0,
      source: 0,
      sequence: 108,
      memo: "",
      log: "Msg 0: ",
      data: "{"baseAsset":"BURGER-33A","initPrice":400000000,"proposalId":325,"quoteAsset":"BUSD-BD1"}",
      asset: null,
      amount: null,
      fromAddr: "bnb19v2ayq6k6e5x6ny3jdutdm6kpqn3n6mxheegvj",
      toAddr: null
      }

      SIDE_PROPOSAL

      {
      hash: "46032C3047BB1B62A149EA1A0C6DC0715656E8B0B7DC29BB1E9DBD2312E40144",
      blockHeight: 151792920,
      blockTime: 1616399780337,
      type: "SIDE_PROPOSAL",
      fee: 100000000,
      code: 0,
      source: 0,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: "{"description":"{\"key\":\"dynamicExtraIncentiveAmount\",\"value\":\"00000000000000000000000000000000000000000000000000038D7EA4C68000\",\"target\":\"0000000000000000000000000000000000001005\"}","initDeposit":[{"amount":200000000000,"denom":"BNB"}],"proposalId":"7","proposalType":"CrossSideChainParamsChange","proposer":"bnb1mn45vmxzkua7edyr3uzwjcgz4du7fnyaa2r77l","sideChainId":"bsc","title":"set dynamicExtraIncentiveAmount","votingPeriod":1800000000000}",
      asset: "BNB",
      amount: 200000000000,
      fromAddr: "bnb1mn45vmxzkua7edyr3uzwjcgz4du7fnyaa2r77l",
      toAddr: null
      }

      SIDE_VOTE

      {
      hash: "F33281736A31781D95CA899D5B0FCD315D39460461B98277303C4ACB35C9B3DA",
      blockHeight: 151794873,
      blockTime: 1616400614551,
      type: "SIDE_VOTE",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: "{"option":1,"proposalId":7,"sideChainId":"bsc","voter":"bnb1y52k5rfmqv46p8x8jsnppzgkjgzt5m0zg64806"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1y52k5rfmqv46p8x8jsnppzgkjgzt5m0zg64806",
      toAddr: null
      }

      CREATE_SIDECHAIN_VALIDATOR

      {
      hash: "6CB370013BA91ECC401FF4D6980C8C78C0372A30CE1C6DA7E1FD0ACC493C8124",
      blockHeight: 150275610,
      blockTime: 1615802657229,
      type: "CREATE_SIDECHAIN_VALIDATOR",
      fee: 200000000,
      code: 0,
      source: 0,
      sequence: 0,
      memo: "",
      log: "Msg 0: ",
      data: "{"commission":{"rate":25000000,"maxRate":90000000,"maxChangeRate":5000000,"updateTimeInMs":0},"delegation":{"amount":1000000000000,"denom":"BNB"},"delegatorAddr":"bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3","description":{"moniker":"InfStones","identity":"xxx","website":"https://infstones.com","details":"Fueling Blockchains, Infinitely"},"sideChainId":"bsc","sideConsAddr":"0xee226379db83cffc681495730c11fdde79ba4c0c","sideFeeAddr":"0xee226379db83cffc681495730c11fdde79ba4c0c","validatorAddr":"bva1a7n56r44h4tlgrk3mazxx6cavhgpkrm7a8p6g4"}",
      asset: "BNB",
      amount: 1000000000000,
      fromAddr: "bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3",
      toAddr: null
      }

      EDIT_SIDECHAIN_VALIDATOR

      {
      hash: "A516AE597CD41C56B611A015AF85D2D34EEC38F2CD29344CB33C4E1AD5DCC96F",
      blockHeight: 159272334,
      blockTime: 1619413244112,
      type: "EDIT_SIDECHAIN_VALIDATOR",
      fee: 20000000,
      code: 0,
      source: 0,
      sequence: 5,
      memo: "",
      log: "Msg 0: ",
      data: "{"commissionRate":14500000,"description":{"moniker":"InfStones","identity":"xxx","website":"https://infstones.com","details":"Fueling Blockchains, Infinitely"},"sideChainId":"bsc","sideFeeAddr":null,"validatorAddress":"bva1a7n56r44h4tlgrk3mazxx6cavhgpkrm7a8p6g4"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3",
      toAddr: null
      }

      CROSS_BIND

      {
      hash: "CDC29B8B81C8468D68C072D7670565EB67E66662F0FCB47C6AFFAA94CE221852",
      blockHeight: 160097869,
      blockTime: 1619754894601,
      type: "CROSS_BIND",
      fee: 100000000,
      code: 0,
      source: 0,
      sequence: 994,
      memo: "",
      log: "Msg 0: ",
      data: "{"contractAddress":"0x5c7e71f46e49cf816f9863461eeb36e3bc8e3b51","contractDecimal":18,"expireTime":1622340046}",
      asset: "EQL-586",
      amount: 0,
      fromAddr: "bnb1uz0s54rzv022dh66l7atwk83wqcet9qstgg358",
      toAddr: null
      }

      MINI_TOKEN_SET_URI

      {
      hash: "A13FB0491B036BD5EA9FE91A695610B43BC00B719A42AFB78893D2D74C5E6BA5",
      blockHeight: 161047023,
      blockTime: 1620145492229,
      type: "MINI_TOKEN_SET_URI",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 184,
      memo: "",
      log: "Msg 0: ",
      data: "{"uri":"https://imcoinproject.com/"}",
      asset: "IMC-D5AM",
      amount: null,
      fromAddr: "bnb1xwmcqw4vqm32z08gl0c06ydwxgm4z2gnvh2rc4",
      toAddr: null
      }

      SIDECHAIN_UNJAIL

      {
      hash: "7B1AA4F71BD591DE470832EF0A5832BDAE8EA05CD174B881AC276734EEF5AC69",
      blockHeight: 162180199,
      blockTime: 1620623537235,
      type: "SIDECHAIN_UNJAIL",
      fee: 50000000,
      code: 0,
      source: 0,
      sequence: 13,
      memo: "",
      log: "Msg 0: ",
      data: "{"sideChainId":"bsc","validatorAddr":"bva1a7n56r44h4tlgrk3mazxx6cavhgpkrm7a8p6g4"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3",
      toAddr: null
      }

      TIME_LOCK

      {
      hash: "486B93963E8D971AC9B58A803FC5666FFAF5CB81102D70A57CA4A25EBF922008",
      blockHeight: 161218645,
      blockTime: 1620216900755,
      type: "TIME_LOCK",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":20900000000,"denom":"SWINGBY-888"}],"description":"for me","lockId":"2","lockTime":1620507600000}",
      asset: "SWINGBY-888",
      amount: 20900000000,
      fromAddr: "bnb1gnjvszgdt35ysgekxcll3qlfur7l60rat7n8m4",
      toAddr: null
      }

      TIME_UNLOCK

      {
      hash: "981727753AE33BAC05AFB0678A5DD465FBDE0E1F575C8B187C997EBA1F382725",
      blockHeight: 162201236,
      blockTime: 1620632390767,
      type: "TIME_UNLOCK",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 16,
      memo: "",
      log: "Msg 0: ",
      data: "{"lockId":2}",
      asset: null,
      amount: null,
      fromAddr: "bnb1gnjvszgdt35ysgekxcll3qlfur7l60rat7n8m4",
      toAddr: null
      }

      TIME_RELOCK

      {
      hash: "757C44DD729718B578B14C90927DBD929C909756601CC4B9F578457591896813",
      blockHeight: 162210587,
      blockTime: 1620636356636,
      type: "TIME_RELOCK",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 38,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":155303853729657,"denom":"SWINGBY-888"}],"description":"e0797af9059f83b013994edc7bc58ca7e1c09aa558f5781898885534f28e06e2,0x4672f76fE968d6A490c0C79E0920e092afa01C73","lockId":10,"lockTime":1624441844000}",
      asset: "SWINGBY-888",
      amount: 155303853729657,
      fromAddr: "bnb17ed0pdy6fq4q40vc5ra78d9yw7sa0mw0k72apq",
      toAddr: null
      }

      SUBMIT_PROPOSAL

      {
      hash: "95370CAA3A5FEB028ED64B28E500CBC4FE1CC3797EEEB0278223C0BBB52DC2D7",
      blockHeight: 162183625,
      blockTime: 1620624972192,
      type: "PROPOSAL",
      fee: 100000000,
      code: 0,
      source: 0,
      sequence: 24,
      memo: "",
      log: "Msg 0: ",
      data: "{"baseAssetSymbol":"SPARTA-7F3","description":"{\"base_asset_symbol\":\"SPARTA-7F3\",\"quote_asset_symbol\":\"BUSD-BD1\",\"justification\":\"delist SPARTA-7F3 \",\"is_executed\":false}","initDeposit":[{"amount":100000000000,"denom":"BNB"}],"proposalId":"333","proposalType":"DelistTradingPair","proposer":"bnb189jtg9efdgvlj4gwrek8q4wu5jwqlqdpzgmug9","quoteAssetSymbol":"BUSD-BD1","title":"delist SPARTA-7F3","votingPeriod":172800000000000}",
      asset: "BNB",
      amount: 100000000000,
      fromAddr: "bnb189jtg9efdgvlj4gwrek8q4wu5jwqlqdpzgmug9",
      toAddr: null
      }

      VOTE

      {
      hash: "085B69D6749359F95F1BDF11FAFF9039F9D8615FB418729A379A43C167DED4AD",
      blockHeight: 162362506,
      blockTime: 1620701342872,
      type: "VOTE",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 470981,
      memo: "",
      log: "Msg 0: ",
      data: "{"option":1,"proposalId":333,"voter":"bnb167z5qvur7xu85q885l906dgcwmgsvm3ppdarpf"}",
      asset: null,
      amount: null,
      fromAddr: "bnb167z5qvur7xu85q885l906dgcwmgsvm3ppdarpf",
      toAddr: null
      }

      DEPOSIT

      {
      hash: "BB674BC9E9E6A399619BBEEFBF45DA639D9F80479558098BDF40D6004B21A660",
      blockHeight: 149029215,
      blockTime: 1615274824770,
      type: "DEPOSIT",
      fee: 12500,
      code: 0,
      source: 0,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":99900000000,"denom":"BNB"}],"proposalId":315}",
      asset: "BNB",
      amount: 99900000000,
      fromAddr: "bnb189jtg9efdgvlj4gwrek8q4wu5jwqlqdpzgmug9",
      toAddr: null
      }

      DEPOSIT_HTL

      {
      hash: "26B140338C136A587F9355E96763C641D5B88385A8619B02EEBB7915E3B18C99",
      blockHeight: 41455798,
      blockTime: 1571127824815,
      type: "DEPOSIT_HTL",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 0,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":10000000000,"denom":"CBM-4B2"},{"amount":10000000000,"denom":"VRAB-B56"}],"swapId":"3361b6992877abb5e8f9bb9644bea6b4089bd5eb6b113fa64990af0f35b14870"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1vwpx9zyletukt9wvmhqwhr2ahfrvnkt9nraxjs",
      toAddr: null
      }

      CLAIM_HTL

      {
      hash: "E09D9037782F0CAD9FF0643E6CA9736F56900FCEDF700CC3463A5B39A8982B00",
      blockHeight: 162412011,
      blockTime: 1620722255242,
      type: "CLAIM_HTL",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 1886,
      memo: "",
      log: "Msg 0: ",
      data: "{"randomNumber":"f31e0a332a52be39492985bf5a651946f68f99e1655f02bf46cff7c08f3737ef","swapId":"979a817aece6392edc1190b3b8901c74c7d0177b4f5c28e6ea546037efa15a15"}",
      asset: null,
      amount: null,
      fromAddr: "bnb14mhpmvnt5e98lc75v8mphqtavxxgsawkx4dsnx",
      toAddr: null
      }

      REFUND_HTL

      {
      hash: "C3CD313C4BA631BB2919E03D4F2CF13631FE546A58BF55CA329179779046C1F7",
      blockHeight: 162367787,
      blockTime: 1620703589944,
      type: "REFUND_HTL",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 1877,
      memo: "",
      log: "Msg 0: ",
      data: "{"swapId":"e0b3090b8a8e822c34559a36d48444114d2385d06c380ca07aa116738f0c9328"}",
      asset: null,
      amount: null,
      fromAddr: "bnb14mhpmvnt5e98lc75v8mphqtavxxgsawkx4dsnx",
      toAddr: null
      }

      HTL_TRANSFER

      {
      hash: "3A5D25924DA14ED085BA61037DBACABB4F8A364A0D61369468E7C2B793245B0A",
      blockHeight: 162411931,
      blockTime: 1620722220728,
      type: "HTL_TRANSFER",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 1885,
      memo: "",
      log: "Msg 0: swapID: 979a817aece6392edc1190b3b8901c74c7d0177b4f5c28e6ea546037efa15a15",
      data: "{"crossChain":true,"expectedIncome":"300727400BNB","heightSpan":1800,"outAmount":[{"amount":300727400,"denom":"BNB"}],"randomNumberHash":"44d8922418ddc545af63cb5fb4c2a4c07a9c761648d655996aa30c19bec71ee6","recipientOtherChain":"iaa1junhkdhuamtdz3ah6d5mfp6w9sxmlwera7mruz","senderOtherChain":"iaa1f2sgwns3nkqfvq2fafpfvkmr97p2wsrf7rck8z","timestamp":1620722213}",
      asset: "BNB",
      amount: 300727400,
      fromAddr: "bnb14mhpmvnt5e98lc75v8mphqtavxxgsawkx4dsnx",
      toAddr: "bnb1vkjuklnxslahuxka6dkq043u9xhlfu0hge4yqk"
      }

      SIDECHAIN_REDELEGATE

      {
      hash: "A2E1E723997373D328DF1976134A7098658DD205323A62006D67DBD6FEC9DA43",
      blockHeight: 162412117,
      blockTime: 1620722301263,
      type: "SIDECHAIN_REDELEGATE",
      fee: 60000,
      code: 0,
      source: 2,
      sequence: 7,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":{"amount":410255325,"denom":"BNB"},"delegatorAddress":"bnb126qv3623uwh57hkwpmfdqzt6yxgvvx9ekwd5sm","dstValidatorAddress":"bva1nwyq37v4f02wu7zkc2rsynn8y7hh97ura39qyf","sideChainId":"bsc","srcValidatorAddress":"bva1ygrhjdjfyn2ffh5ha5llf5g6l3wxjt29hz9q4s"}",
      asset: "BNB",
      amount: 410255325,
      fromAddr: "bnb126qv3623uwh57hkwpmfdqzt6yxgvvx9ekwd5sm",
      toAddr: null
      }

      SIDECHAIN_DELEGATE

      {
      hash: "9CEC083DDCA3ACF8C68788FF10CC71430289502A709CD8BC3B80B6D5F89306B1",
      blockHeight: 162412416,
      blockTime: 1620722430911,
      type: "SIDECHAIN_DELEGATE",
      fee: 20000,
      code: 0,
      source: 2,
      sequence: 0,
      memo: "",
      log: "Msg 0: ",
      data: "{"delegation":{"amount":113571176,"denom":"BNB"},"delegatorAddr":"bnb1smkcpeh5ku4308q857v002a78qt9hxyalyz8mr","sideChainId":"bsc","validatorAddr":"bva1nwyq37v4f02wu7zkc2rsynn8y7hh97ura39qyf"}",
      asset: "BNB",
      amount: 113571176,
      fromAddr: "bnb1smkcpeh5ku4308q857v002a78qt9hxyalyz8mr",
      toAddr: null
      }

      ORACLE_CLAIM

      {
      hash: "B8ECC7E200C4874914CEF1D7FB08340B45235D3B884726134E96A89EE38AC64A",
      blockHeight: 162412439,
      blockTime: 1620722441110,
      type: "ORACLE_CLAIM",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 706559,
      memo: "",
      log: "Msg 0: ",
      data: "{"chainId":56,"payload":[{"channelId":3,"sequence":1192912,"payload":{"packageType":0,"crossChainFee":200000,"content":{"symbol":"BNB","contractAddress":"0x0000000000000000000000000000000000000000","amounts":[7100000],"receiverAddresses":["bnb1zwyuzhvm55fxc2w6gjxhwr670gxeuxchdc70w8"],"refundAddresses":["0x1533726cfe64da63b6169d249047d0231739308f"],"expireTime":1620722861}}},{"channelId":3,"sequence":1192913,"payload":{"packageType":0,"crossChainFee":200000,"content":{"symbol":"BNB","contractAddress":"0x0000000000000000000000000000000000000000","amounts":[9860839],"receiverAddresses":["bnb1uctxp6pd67q3eqcm9pd8e7xq60yw0zfg2uctkw"],"refundAddresses":["0x1451bd04f1e849113261072925ea5efdf95a1b53"],"expireTime":1620722888}}},{"channelId":3,"sequence":1192914,"payload":{"packageType":0,"crossChainFee":200000,"content":{"symbol":"BNB","contractAddress":"0x0000000000000000000000000000000000000000","amounts":[10000000],"receiverAddresses":["bnb1e47xrdkz28cerg5fzqyk9w08q68v5qccutty07"],"refundAddresses":["0x95f00d266590d325367f4d38c50eae89df84ef3d"],"expireTime":1620722937}}}],"sequence":829118,"validatorAddress":"bva1h9ymecpakr8p8lhchtah2xxx7x4xq099u8e07c"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1h9ymecpakr8p8lhchtah2xxx7x4xq099umclqu",
      toAddr: null
      }

      TRANSFER_TOKEN_OWNERSHIP

      {
      hash: "41B51422C1238BA859B16F3731C34E1150122399994557FEC377D3D701E503E3",
      blockHeight: 146158279,
      blockTime: 1614067191757,
      type: "TRANSFER_TOKEN_OWNERSHIP",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "QQ-EF5M",
      amount: null,
      fromAddr: "bnb1jae4k7eg8s7th0gn7yaxpwpen79a8jsrvwxufu",
      toAddr: "bnb1jae4k7eg8s7th0gn7yaxpwpen79a8jsrvwxufu"
      }

      SET_ACCOUNT_FLAG

      {
      hash: "F0B4A6577EB9FCAB3C4733EE955A9E1165280D812B450493B883168EFD594B25",
      blockHeight: 159194287,
      blockTime: 1619380919117,
      type: "SET_ACCOUNT_FLAG",
      fee: 20000000,
      code: 0,
      source: 0,
      sequence: 404,
      memo: "",
      log: "Msg 0: ",
      data: "{"flags":1}",
      asset: null,
      amount: null,
      fromAddr: "bnb1x0t2mwrqg7gwy8wu04q6f4dty2ztcs40cg9exl",
      toAddr: null
      }

      Example for block response

      Block of height 170155309

      {
      height: 170155309,
      hash: "83EFF62688836D1D5206CDA95F0FC02DF43CDFDB4703C7C00CAEE18FB2D625CB",
      parentHash: "69E12701818A1B1FF6EFFDC22350697E723E1101115175298DA553E9ABDED292",
      time: 1623901978318,
      txCount: 4,
      size: 65536,
      consumeTime: 350,
      proposerAddr: "bnb1jstexazk7zateuwzzwllswu4j3dsllu3dgte4m",
      proposerNode: "Zugspitze",
      fees: [
      {
      blockHeight: 170155309,
      address: "bnb1jstexazk7zateuwzzwllswu4j3dsllu3dgte4m",
      asset: "BNB",
      quantity: 780
      },
      {
      blockHeight: 170155309,
      address: "bnb1jw9xup8arde2jzarzcs2fv49hh28uad92m4ke0",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb16k0gajcczwgymfkk0zsysjzl0sxyxdfckplxlr",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb1xaef2agzycsww32fqyggnk5xgqxs8780vfv2kh",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb13m056plt2646zse2mwxfft92xawnky4nmncxc3",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb17kfuzeza2kn46yqx4twxxmlw2jk2ywp5x4gze2",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb1tpagqqqx36gq09kzw4f5a3a9sk3tq54dpl5ldn",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb1y888axmhzz6yjj464syfy68mkhzy9phlv8fzac",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb19klje94mnu53wj7pmrk0zmtpwgr0uz8th0fcvw",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb19hunw9ps8n9tkrp2j64jvheezgqmfc2eyrxd7a",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb15hx3frkdu7vajy2eulu80vl97vehnhyavu927v",
      asset: "BNB",
      quantity: 772
      }
      ]
      }
      - + diff --git a/docs/beaconchain/develop/api-reference/cli.html b/docs/beaconchain/develop/api-reference/cli.html index 2c39f051a5..2787dbda8f 100644 --- a/docs/beaconchain/develop/api-reference/cli.html +++ b/docs/beaconchain/develop/api-reference/cli.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ balance, transaction detail by transaction hash and etc.

      Where can I download the BNB Beacon Chain CLI?

      You can download BNB Beacon Chain CLI releases here: https://github.com/bnb-chain/node/releases

      You can choose to download the version for testnet (tbnbcli) or mainnet (bnblci).

      CLI installation

      Once you have downloaded the binary for your platform, you may drop it into any folder you like. Open a terminal window or cmd.exe in that folder, and then follow the examples on the documentation site.

      For mainnet:

      $  ./bnbcli

      On Windows you would most likely use this instead:

      C:\> bnbcli.exe

      For testnet:

      $  ./tbnbcli

      On Windows you would most likely use this instead:

      C:\> tbnbcli.exe

      Where to connect

      You can manage your keys locally without connecting to any node. But if you want to interact with BNB Beacon Chain, you need to connect to one of BNB Beacon Chain full nodes.

      You can run your own full node, which may automatically connect to BNB Beacon Chain, and you can run your CLI there with your own full node. In the mean time, you can connect to any full nodes provided by other people.

      You could query this API for a list of full node on mainnet: https://dex.binance.org/api/v1/peers.

      For testnet, visit https://testnet-dex.binance.org/api/v1/peers.

      Full nodes will be denoted as the format of ip:port, you could use access_addr as your peer to get connected, such as https://dataseed4.defibit.io:443

      Please note that there are two types of nodes that offer RPC services. Some support TLS and others don't.

      Which Chain-ID to use

      chain-id is an important field to fill for every transaction sent from bnbcli. The chain-id for mainnet is Binance-Chain-Tigris, and is Binance-Chain-Ganges for testnet. Please choose the correct one in your case.

      Which Private Key To Use

      There are two ways for you to sign transaction:

      • Use Local Keystore File

      This is the default way to sign transactions with bnbcli. It will use the encrypted keystore files saved at bnbcli home. You need to specify which key to decrypt with --from.

      • Use Private Key in Hardware Wallet

      First, you must add --ledger when creating a new address. For example,

      bnbcli keys add test --ledger --index 0 --account 0

      Then, the private key file in ledger will be used to generate a new address.

      You could also specify --account and --index to generate more addresses. After the generation, you could use Ledger for signing.

      When you use the address to sign transactions, bnbcli will send transactions to Ledger and get signatures. Then bnbcli build the signed transactions and boardcast them to full nodes.

      Key manager

      Here we support two types of key: local key and leder key

      Local key

      • Create a local key
      bnbcli keys add test_key

      The newly created local key will be encrypted and saved to the local keystore.

      • Sign transaction with a local key
      bnbcli send --chain-id=<chain-id> --from=test_key --amount=100:BNB --to=<address>

      For instance, if you want to send a token transfer transaction, you can use the above command. The flag --from is used to specify which key should be used to sign the transaction.

      Ledger key

      • Create a local key

      Before creating a new ledger key, make sure you have performed these steps:

      1. Ledger device is installed binance ledger app and the version should be later or equal to v1.1.3.
      2. Connect your ledger device to your machine and input pin code to unlock it.
      3. Open the binance ledger app on your ledger device.
      bnbcli keys add test_ledger_key --ledger

      Execute the above command to create a ledger key. The private key is only stored in your ledger device. And your local key store will save the corresponding publick key and address.

      bnbcli keys add test_ledger_key_new --ledger --index 0 --account 0

      You can also specify --account and --index to generate more keys.

      • Sign transaction with a ledger key

      Taking transfer transaction for example, please follow these steps:

      1. Execute command in your console:
      bnbcli send --chain-id=<chain-id> --from=test_ledger_key --amount=100:BNB --to=<address>
      1. Your console will print some message like this:
      Please confirm if address displayed on ledger is identical to bnb15339dcwlq5nza4atfmqxfx6mhamywz35evruva (yes/no)?
      1. User can click confirm button on ledger device and input yes to continue following steps.
      2. Then user can preview the transaction data on ledger screen.
      3. After going through all transaction data, user can select sign transaction or reject.
      4. After user selects sign transaction, bnbcli will get the signature and broadcast the signed transaction to blockchain nodes.

      How to use

      When you have downloaded BNB Beacon Chain CLI, you can use help subcommand to see all the available commands:

      $  ./bnbcli help
      BNBChain light-client

      Usage:
      bnbcli [command]

      Available Commands:
      init Initialize light client
      status Query remote node for status

      txs Search for all transactions that match the given tags.
      tx Matches this txhash over all committed blocks

      account Query account balance
      send Create and sign a send tx
      transfer

      api-server Start the API server daemon
      keys Add or view local private keys

      version Print the app version
      token issue or view tokens
      dex dex commands
      gov gov commands
      help Help about any command

      Flags:
      -e, --encoding string Binary encoding (hex|b64|btc) (default "hex")
      -h, --help help for bnbcli
      --home string directory for config and data (default "/root/.bnbcli")
      -o, --output string Output format (text|json) (default "text")
      --trace print out full stack trace on errors

      Use "bnbcli [command] --help" for more information about a command.

      Note:there is one special flag --trust-node of most subcommands, if not enabled which is by default the CLI will take an extra 2-4 seconds to verify blockchain proof at current height. You can enable that flag if the peer is trustful so that most commands will accomplish in 500 milliseconds. If your node cannot prove the transaction, there will be the following notice:

      Create verifier failed: Commit: Response error: RPC error -32603 - Internal error: runtime error: invalid memory address or nil pointer dereference
      Please check network connection and verify the address of the node to connect to

      To solve this issue, you need to set --trust-node to true

      CLI Reference

      For detailed usage, you can refer to:

      Use CLI for Different Blockchains

      bnbcli will save data about validatorset changes at home of bnbcli. If you want to use bnbcli for different blockchains, for example, you want to change from testnet to mainnet, the data will be stale. In order to switch between blockchains, you need clean the data folder with rm -rf ~/.bnbcli/.bnblite/ or create a new home folder for bnbcli with --home flag. If you forget to specify a different home folder path, then you will not be able to make queries with bnbcli.

      The same logic applies to tbnbcli.

      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/block-service-example.html b/docs/beaconchain/develop/api-reference/dex-api/block-service-example.html index a268256161..7870898901 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/block-service-example.html +++ b/docs/beaconchain/develop/api-reference/dex-api/block-service-example.html @@ -8,13 +8,13 @@ - +

      Example for tx response, for different tx types

      NEW_ORDER

      {
      hash: "5C18F10BA750E65CA662D8F5F16E6CCC85EECEAB35B8165FD6091B35B20F2D05",
      blockHeight: 162412419,
      blockTime: 1620722432270,
      type: "NEW_ORDER",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 687800,
      memo: "",
      log: "Msg 0: ",
      data: "{"orderId":"75B7DCA71844FA7F59634C29A793CD881A15787E-687801","orderType":"LIMIT","price":"14534","quantity":"3469000000000","side":"BUY","symbol":"MITH-C76_BNB","timeInForce":"GTE"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1wkmaefccgna87ktrfs560y7d3qdp27r7ak44x9",
      toAddr: null
      }

      Note: amount field is null - if you want to get the base or quote asset amount, you can parse it from data field.

      CANCEL_ORDER

      {
      hash: "2E0CB6147B60CBABB8E50AEBDD461295F531E330A7B946229E63D51A967CFEF3",
      blockHeight: 162412424,
      blockTime: 1620722434484,
      type: "CANCEL_ORDER",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 35855681,
      memo: "",
      log: "Msg 0: ",
      data: "{"orderId":"1468EE412C3ADC9CFF3EF31ADC7EDD288F5E208E-35855646","symbol":"BNB_BTCB-1DE"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1z35wusfv8twfele77vddclka9z84ugywug48gn",
      toAddr: null
      }

      TRANSFER

      {
      hash: "D3AA7448385BFEDFE2434D18645C4729D441633BF8E2E98EF702188366BEC8AC",
      blockHeight: 162412424,
      blockTime: 1620722434484,
      type: "TRANSFER",
      fee: 7500,
      code: 0,
      source: 2,
      sequence: 3,
      memo: "100258987",
      log: "Msg 0: ",
      data: null,
      asset: "ADA-9F4",
      amount: 4379000000,
      fromAddr: "bnb1hu07yp89lncjwcu4775npe3s5s0p5ekne2d97y",
      toAddr: "bnb136ns6lfw4zs5hg4n85vdthaad7hq5m4gtkgf23"
      }

      TRANSFER (multi-send case)

      {
      hash: "1ACF2C07C2B25865A422C6A6EF8256940E813C09F7279430973254F614521980",
      blockHeight: 162635206,
      blockTime: 1620818353134,
      type: "TRANSFER",
      fee: 12000,
      code: 0,
      source: 1,
      sequence: 34520,
      memo: "0",
      log: "Msg 0: ",
      data: "{"outputs":[{"address":"bnb1ffaqy2g92yglhps7vwc3h4dyjf2kq73xlefzkc","amounts":[{"denom":"BNB","amount":50000000}]},{"address":"bnb15qced76xere38hmmpe644u5kd8v4lzl9gsex9w","amounts":[{"denom":"BNB","amount":1}]}],"inputs":[{"address":"bnb1t38ccns9var4ac4yj2ylmu99r9ecmggr8ye5e5","amounts":[{"denom":"BNB","amount":50000000}]},{"address":"bnb15qced76xere38hmmpe644u5kd8v4lzl9gsex9w","amounts":[{"denom":"BNB","amount":1}]}]}",
      asset: null,
      amount: null,
      fromAddr: null,
      toAddr: null
      }

      Note: mutli send transfer is a special kind of TRANSFER. In this case, you can consider this is a bucket, some addresses put tokens into it and other addresses get tokens out of it.

      CROSS_TRANSFER_OUT

      {
      hash: "D4E1B8A31F62065E8894AEC9C3021A19C5D6AC1A0C742589C8446D9E2E533D4A",
      blockHeight: 162412439,
      blockTime: 1620722441110,
      type: "CROSS_TRANSFER_OUT",
      fee: 7500,
      code: 0,
      source: 2,
      sequence: 5,
      memo: "",
      log: "Msg 0: ",
      data: "{"expireTime":1620723042}",
      asset: "BNB",
      amount: 3579779,
      fromAddr: "bnb1v6jqu5lstgwxdc9r6aexdh4mqee70ld7vxrj09",
      toAddr: "0x3c9d8f8fca99bd7b8af284425784e36e45f901ab"
      }

      MINT

      {
      hash: "8206C5136372D6261E9984728D050E12324679CDBBF6F809B1AD1B8BF936A1E0",
      blockHeight: 161931307,
      blockTime: 1620518810151,
      type: "MINT",
      fee: 200000,
      code: 0,
      source: 1,
      sequence: 339,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "TCT-826",
      amount: 100000000000000,
      fromAddr: "bnb1akey87kt0r8y3fmhu2l8eyzdjvt9ptl5cppz0v",
      toAddr: null
      }

      BURN_TOKEN

      {
      hash: "D315E9218178FEF2048FFCB64F1E50712F083215451F7A8752755A00550AAB86",
      blockHeight: 160916832,
      blockTime: 1620091937909,
      type: "BURN_TOKEN",
      fee: 200000,
      code: 0,
      source: 1,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "CTHUCOIN-AACM",
      amount: 100000000,
      fromAddr: "bnb1xsaphxcj3d80hmyv8d8z2mkqwz4tekzepdfq73",
      toAddr: null
      }

      FREEZE_TOKEN

      {
      hash: "529BA70106BCA2BAF741D575015ACC20825C7B15166C7FAF357E2746A07A8F3D",
      blockHeight: 162411486,
      blockTime: 1620722031659,
      type: "FREEZE_TOKEN",
      fee: 100000,
      code: 0,
      source: 0,
      sequence: 39,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "AWC-986",
      amount: 488514694,
      fromAddr: "bnb1xch7xg3t23vl5ugc4ghzpkqv57dzcdtkurr4jc",
      toAddr: null
      }

      UN_FREEZE_TOKEN

      {
      hash: "10B1784B11E3929BE95BF659C9910E1738E81908473579ABDBBB42C70E288733",
      blockHeight: 162410201,
      blockTime: 1620721488567,
      type: "UN_FREEZE_TOKEN",
      fee: 100000,
      code: 0,
      source: 0,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "AWC-986",
      amount: 15400000000,
      fromAddr: "bnb1ajuxdaxnqd6e5d5vq87le4797xkgr9hgqgt7jp",
      toAddr: null
      }

      ISSUE_TOKEN

      {
      hash: "509393BA67C1B801D3F407E866A1C71E40D6E20A1EAB6C3AD8C0BFC2E9AA9910",
      blockHeight: 162222677,
      blockTime: 1620641433340,
      type: "ISSUE_TOKEN",
      fee: 1000000000,
      code: 0,
      source: 1,
      sequence: 32,
      memo: "",
      log: "Msg 0: Issued DVDO-509",
      data: "{"mintable":false,"name":"Davido Social Token","totalSupply":1000000000000000}",
      asset: "DVDO-509",
      amount: 1000000000000000,
      fromAddr: "bnb1ujvzeuft0ezf9fu4u0mk52t8mc7t8geyfkevms",
      toAddr: null
      }

      TINY_TOKEN_ISSUE

      {
      hash: "989F5C9489260F1F89B1C098BA7E6DBCD780DD825CA3E935F823EA0FD3692E62",
      blockHeight: 152840826,
      blockTime: 1616814337995,
      type: "TINY_TOKEN_ISSUE",
      fee: 40000000,
      code: 0,
      source: 1,
      sequence: 0,
      memo: "",
      log: "Msg 0: Issued YFGYM-989M",
      data: "{"mintable":false,"name":"YEAR FINANCE GYM","tokenURI":"https://yfgym.finance/","totalSupply":1000000000000}",
      asset: "YFGYM-989M",
      amount: 1000000000000,
      fromAddr: "bnb19g4d50vev04jlwy6vpqg97etdews6gjld9uz6r",
      toAddr: null
      }

      MINI_TOKEN_ISSUE

      {
      hash: "0347178CB54E04289D834EA9C05383CAD5DC1A661322F2C91B831FD240792050",
      blockHeight: 161286951,
      blockTime: 1620245763946,
      type: "MINI_TOKEN_ISSUE",
      fee: 60000000,
      code: 0,
      source: 1,
      sequence: 0,
      memo: "",
      log: "Msg 0: Issued BZB-034M",
      data: "{"mintable":false,"name":"One million BZE","tokenURI":"https://bargchain.io","totalSupply":100000000000000}",
      asset: "BZB-034M",
      amount: 100000000000000,
      fromAddr: "bnb1aww88fe99fmvd9s9mnlzu299tuwumsjqvudx4y",
      toAddr: null
      }

      MINI_TOKEN_LIST

      {
      hash: "96A73849D5A55FC8BAEB677307F8A0790AD0727BBC9CA4BEB1CD1C93087841FF",
      blockHeight: 161289727,
      blockTime: 1620246951722,
      type: "MINI_TOKEN_LIST",
      fee: 100000000,
      code: 0,
      source: 1,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: "{"baseAsset":"BZB-034M","initPrice":100000000,"quoteAsset":"BNB"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1aww88fe99fmvd9s9mnlzu299tuwumsjqvudx4y",
      toAddr: null
      }

      LIST_TOKEN

      {
      hash: "1E3A50D7900EAA4BE2785AF312C2CF521C8AE318916D860A8E75C220E2B78F7C",
      blockHeight: 150713320,
      blockTime: 1615976164272,
      type: "LIST_TOKEN",
      fee: 20000000000,
      code: 0,
      source: 0,
      sequence: 108,
      memo: "",
      log: "Msg 0: ",
      data: "{"baseAsset":"BURGER-33A","initPrice":400000000,"proposalId":325,"quoteAsset":"BUSD-BD1"}",
      asset: null,
      amount: null,
      fromAddr: "bnb19v2ayq6k6e5x6ny3jdutdm6kpqn3n6mxheegvj",
      toAddr: null
      }

      SIDE_PROPOSAL

      {
      hash: "46032C3047BB1B62A149EA1A0C6DC0715656E8B0B7DC29BB1E9DBD2312E40144",
      blockHeight: 151792920,
      blockTime: 1616399780337,
      type: "SIDE_PROPOSAL",
      fee: 100000000,
      code: 0,
      source: 0,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: "{"description":"{\"key\":\"dynamicExtraIncentiveAmount\",\"value\":\"00000000000000000000000000000000000000000000000000038D7EA4C68000\",\"target\":\"0000000000000000000000000000000000001005\"}","initDeposit":[{"amount":200000000000,"denom":"BNB"}],"proposalId":"7","proposalType":"CrossSideChainParamsChange","proposer":"bnb1mn45vmxzkua7edyr3uzwjcgz4du7fnyaa2r77l","sideChainId":"bsc","title":"set dynamicExtraIncentiveAmount","votingPeriod":1800000000000}",
      asset: "BNB",
      amount: 200000000000,
      fromAddr: "bnb1mn45vmxzkua7edyr3uzwjcgz4du7fnyaa2r77l",
      toAddr: null
      }

      SIDE_VOTE

      {
      hash: "F33281736A31781D95CA899D5B0FCD315D39460461B98277303C4ACB35C9B3DA",
      blockHeight: 151794873,
      blockTime: 1616400614551,
      type: "SIDE_VOTE",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: "{"option":1,"proposalId":7,"sideChainId":"bsc","voter":"bnb1y52k5rfmqv46p8x8jsnppzgkjgzt5m0zg64806"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1y52k5rfmqv46p8x8jsnppzgkjgzt5m0zg64806",
      toAddr: null
      }

      CREATE_SIDECHAIN_VALIDATOR

      {
      hash: "6CB370013BA91ECC401FF4D6980C8C78C0372A30CE1C6DA7E1FD0ACC493C8124",
      blockHeight: 150275610,
      blockTime: 1615802657229,
      type: "CREATE_SIDECHAIN_VALIDATOR",
      fee: 200000000,
      code: 0,
      source: 0,
      sequence: 0,
      memo: "",
      log: "Msg 0: ",
      data: "{"commission":{"rate":25000000,"maxRate":90000000,"maxChangeRate":5000000,"updateTimeInMs":0},"delegation":{"amount":1000000000000,"denom":"BNB"},"delegatorAddr":"bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3","description":{"moniker":"InfStones","identity":"xxx","website":"https://infstones.com","details":"Fueling Blockchains, Infinitely"},"sideChainId":"bsc","sideConsAddr":"0xee226379db83cffc681495730c11fdde79ba4c0c","sideFeeAddr":"0xee226379db83cffc681495730c11fdde79ba4c0c","validatorAddr":"bva1a7n56r44h4tlgrk3mazxx6cavhgpkrm7a8p6g4"}",
      asset: "BNB",
      amount: 1000000000000,
      fromAddr: "bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3",
      toAddr: null
      }

      EDIT_SIDECHAIN_VALIDATOR

      {
      hash: "A516AE597CD41C56B611A015AF85D2D34EEC38F2CD29344CB33C4E1AD5DCC96F",
      blockHeight: 159272334,
      blockTime: 1619413244112,
      type: "EDIT_SIDECHAIN_VALIDATOR",
      fee: 20000000,
      code: 0,
      source: 0,
      sequence: 5,
      memo: "",
      log: "Msg 0: ",
      data: "{"commissionRate":14500000,"description":{"moniker":"InfStones","identity":"xxx","website":"https://infstones.com","details":"Fueling Blockchains, Infinitely"},"sideChainId":"bsc","sideFeeAddr":null,"validatorAddress":"bva1a7n56r44h4tlgrk3mazxx6cavhgpkrm7a8p6g4"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3",
      toAddr: null
      }

      CROSS_BIND

      {
      hash: "CDC29B8B81C8468D68C072D7670565EB67E66662F0FCB47C6AFFAA94CE221852",
      blockHeight: 160097869,
      blockTime: 1619754894601,
      type: "CROSS_BIND",
      fee: 100000000,
      code: 0,
      source: 0,
      sequence: 994,
      memo: "",
      log: "Msg 0: ",
      data: "{"contractAddress":"0x5c7e71f46e49cf816f9863461eeb36e3bc8e3b51","contractDecimal":18,"expireTime":1622340046}",
      asset: "EQL-586",
      amount: 0,
      fromAddr: "bnb1uz0s54rzv022dh66l7atwk83wqcet9qstgg358",
      toAddr: null
      }

      MINI_TOKEN_SET_URI

      {
      hash: "A13FB0491B036BD5EA9FE91A695610B43BC00B719A42AFB78893D2D74C5E6BA5",
      blockHeight: 161047023,
      blockTime: 1620145492229,
      type: "MINI_TOKEN_SET_URI",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 184,
      memo: "",
      log: "Msg 0: ",
      data: "{"uri":"https://imcoinproject.com/"}",
      asset: "IMC-D5AM",
      amount: null,
      fromAddr: "bnb1xwmcqw4vqm32z08gl0c06ydwxgm4z2gnvh2rc4",
      toAddr: null
      }

      SIDECHAIN_UNJAIL

      {
      hash: "7B1AA4F71BD591DE470832EF0A5832BDAE8EA05CD174B881AC276734EEF5AC69",
      blockHeight: 162180199,
      blockTime: 1620623537235,
      type: "SIDECHAIN_UNJAIL",
      fee: 50000000,
      code: 0,
      source: 0,
      sequence: 13,
      memo: "",
      log: "Msg 0: ",
      data: "{"sideChainId":"bsc","validatorAddr":"bva1a7n56r44h4tlgrk3mazxx6cavhgpkrm7a8p6g4"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1a7n56r44h4tlgrk3mazxx6cavhgpkrm7amq2k3",
      toAddr: null
      }

      TIME_LOCK

      {
      hash: "486B93963E8D971AC9B58A803FC5666FFAF5CB81102D70A57CA4A25EBF922008",
      blockHeight: 161218645,
      blockTime: 1620216900755,
      type: "TIME_LOCK",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":20900000000,"denom":"SWINGBY-888"}],"description":"for me","lockId":"2","lockTime":1620507600000}",
      asset: "SWINGBY-888",
      amount: 20900000000,
      fromAddr: "bnb1gnjvszgdt35ysgekxcll3qlfur7l60rat7n8m4",
      toAddr: null
      }

      TIME_UNLOCK

      {
      hash: "981727753AE33BAC05AFB0678A5DD465FBDE0E1F575C8B187C997EBA1F382725",
      blockHeight: 162201236,
      blockTime: 1620632390767,
      type: "TIME_UNLOCK",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 16,
      memo: "",
      log: "Msg 0: ",
      data: "{"lockId":2}",
      asset: null,
      amount: null,
      fromAddr: "bnb1gnjvszgdt35ysgekxcll3qlfur7l60rat7n8m4",
      toAddr: null
      }

      TIME_RELOCK

      {
      hash: "757C44DD729718B578B14C90927DBD929C909756601CC4B9F578457591896813",
      blockHeight: 162210587,
      blockTime: 1620636356636,
      type: "TIME_RELOCK",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 38,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":155303853729657,"denom":"SWINGBY-888"}],"description":"e0797af9059f83b013994edc7bc58ca7e1c09aa558f5781898885534f28e06e2,0x4672f76fE968d6A490c0C79E0920e092afa01C73","lockId":10,"lockTime":1624441844000}",
      asset: "SWINGBY-888",
      amount: 155303853729657,
      fromAddr: "bnb17ed0pdy6fq4q40vc5ra78d9yw7sa0mw0k72apq",
      toAddr: null
      }

      SUBMIT_PROPOSAL

      {
      hash: "95370CAA3A5FEB028ED64B28E500CBC4FE1CC3797EEEB0278223C0BBB52DC2D7",
      blockHeight: 162183625,
      blockTime: 1620624972192,
      type: "PROPOSAL",
      fee: 100000000,
      code: 0,
      source: 0,
      sequence: 24,
      memo: "",
      log: "Msg 0: ",
      data: "{"baseAssetSymbol":"SPARTA-7F3","description":"{\"base_asset_symbol\":\"SPARTA-7F3\",\"quote_asset_symbol\":\"BUSD-BD1\",\"justification\":\"delist SPARTA-7F3 \",\"is_executed\":false}","initDeposit":[{"amount":100000000000,"denom":"BNB"}],"proposalId":"333","proposalType":"DelistTradingPair","proposer":"bnb189jtg9efdgvlj4gwrek8q4wu5jwqlqdpzgmug9","quoteAssetSymbol":"BUSD-BD1","title":"delist SPARTA-7F3","votingPeriod":172800000000000}",
      asset: "BNB",
      amount: 100000000000,
      fromAddr: "bnb189jtg9efdgvlj4gwrek8q4wu5jwqlqdpzgmug9",
      toAddr: null
      }

      VOTE

      {
      hash: "085B69D6749359F95F1BDF11FAFF9039F9D8615FB418729A379A43C167DED4AD",
      blockHeight: 162362506,
      blockTime: 1620701342872,
      type: "VOTE",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 470981,
      memo: "",
      log: "Msg 0: ",
      data: "{"option":1,"proposalId":333,"voter":"bnb167z5qvur7xu85q885l906dgcwmgsvm3ppdarpf"}",
      asset: null,
      amount: null,
      fromAddr: "bnb167z5qvur7xu85q885l906dgcwmgsvm3ppdarpf",
      toAddr: null
      }

      DEPOSIT

      {
      hash: "BB674BC9E9E6A399619BBEEFBF45DA639D9F80479558098BDF40D6004B21A660",
      blockHeight: 149029215,
      blockTime: 1615274824770,
      type: "DEPOSIT",
      fee: 12500,
      code: 0,
      source: 0,
      sequence: 3,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":99900000000,"denom":"BNB"}],"proposalId":315}",
      asset: "BNB",
      amount: 99900000000,
      fromAddr: "bnb189jtg9efdgvlj4gwrek8q4wu5jwqlqdpzgmug9",
      toAddr: null
      }

      DEPOSIT_HTL

      {
      hash: "26B140338C136A587F9355E96763C641D5B88385A8619B02EEBB7915E3B18C99",
      blockHeight: 41455798,
      blockTime: 1571127824815,
      type: "DEPOSIT_HTL",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 0,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":[{"amount":10000000000,"denom":"CBM-4B2"},{"amount":10000000000,"denom":"VRAB-B56"}],"swapId":"3361b6992877abb5e8f9bb9644bea6b4089bd5eb6b113fa64990af0f35b14870"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1vwpx9zyletukt9wvmhqwhr2ahfrvnkt9nraxjs",
      toAddr: null
      }

      CLAIM_HTL

      {
      hash: "E09D9037782F0CAD9FF0643E6CA9736F56900FCEDF700CC3463A5B39A8982B00",
      blockHeight: 162412011,
      blockTime: 1620722255242,
      type: "CLAIM_HTL",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 1886,
      memo: "",
      log: "Msg 0: ",
      data: "{"randomNumber":"f31e0a332a52be39492985bf5a651946f68f99e1655f02bf46cff7c08f3737ef","swapId":"979a817aece6392edc1190b3b8901c74c7d0177b4f5c28e6ea546037efa15a15"}",
      asset: null,
      amount: null,
      fromAddr: "bnb14mhpmvnt5e98lc75v8mphqtavxxgsawkx4dsnx",
      toAddr: null
      }

      REFUND_HTL

      {
      hash: "C3CD313C4BA631BB2919E03D4F2CF13631FE546A58BF55CA329179779046C1F7",
      blockHeight: 162367787,
      blockTime: 1620703589944,
      type: "REFUND_HTL",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 1877,
      memo: "",
      log: "Msg 0: ",
      data: "{"swapId":"e0b3090b8a8e822c34559a36d48444114d2385d06c380ca07aa116738f0c9328"}",
      asset: null,
      amount: null,
      fromAddr: "bnb14mhpmvnt5e98lc75v8mphqtavxxgsawkx4dsnx",
      toAddr: null
      }

      HTL_TRANSFER

      {
      hash: "3A5D25924DA14ED085BA61037DBACABB4F8A364A0D61369468E7C2B793245B0A",
      blockHeight: 162411931,
      blockTime: 1620722220728,
      type: "HTL_TRANSFER",
      fee: 7500,
      code: 0,
      source: 0,
      sequence: 1885,
      memo: "",
      log: "Msg 0: swapID: 979a817aece6392edc1190b3b8901c74c7d0177b4f5c28e6ea546037efa15a15",
      data: "{"crossChain":true,"expectedIncome":"300727400BNB","heightSpan":1800,"outAmount":[{"amount":300727400,"denom":"BNB"}],"randomNumberHash":"44d8922418ddc545af63cb5fb4c2a4c07a9c761648d655996aa30c19bec71ee6","recipientOtherChain":"iaa1junhkdhuamtdz3ah6d5mfp6w9sxmlwera7mruz","senderOtherChain":"iaa1f2sgwns3nkqfvq2fafpfvkmr97p2wsrf7rck8z","timestamp":1620722213}",
      asset: "BNB",
      amount: 300727400,
      fromAddr: "bnb14mhpmvnt5e98lc75v8mphqtavxxgsawkx4dsnx",
      toAddr: "bnb1vkjuklnxslahuxka6dkq043u9xhlfu0hge4yqk"
      }

      SIDECHAIN_REDELEGATE

      {
      hash: "A2E1E723997373D328DF1976134A7098658DD205323A62006D67DBD6FEC9DA43",
      blockHeight: 162412117,
      blockTime: 1620722301263,
      type: "SIDECHAIN_REDELEGATE",
      fee: 60000,
      code: 0,
      source: 2,
      sequence: 7,
      memo: "",
      log: "Msg 0: ",
      data: "{"amount":{"amount":410255325,"denom":"BNB"},"delegatorAddress":"bnb126qv3623uwh57hkwpmfdqzt6yxgvvx9ekwd5sm","dstValidatorAddress":"bva1nwyq37v4f02wu7zkc2rsynn8y7hh97ura39qyf","sideChainId":"bsc","srcValidatorAddress":"bva1ygrhjdjfyn2ffh5ha5llf5g6l3wxjt29hz9q4s"}",
      asset: "BNB",
      amount: 410255325,
      fromAddr: "bnb126qv3623uwh57hkwpmfdqzt6yxgvvx9ekwd5sm",
      toAddr: null
      }

      SIDECHAIN_DELEGATE

      {
      hash: "9CEC083DDCA3ACF8C68788FF10CC71430289502A709CD8BC3B80B6D5F89306B1",
      blockHeight: 162412416,
      blockTime: 1620722430911,
      type: "SIDECHAIN_DELEGATE",
      fee: 20000,
      code: 0,
      source: 2,
      sequence: 0,
      memo: "",
      log: "Msg 0: ",
      data: "{"delegation":{"amount":113571176,"denom":"BNB"},"delegatorAddr":"bnb1smkcpeh5ku4308q857v002a78qt9hxyalyz8mr","sideChainId":"bsc","validatorAddr":"bva1nwyq37v4f02wu7zkc2rsynn8y7hh97ura39qyf"}",
      asset: "BNB",
      amount: 113571176,
      fromAddr: "bnb1smkcpeh5ku4308q857v002a78qt9hxyalyz8mr",
      toAddr: null
      }

      ORACLE_CLAIM

      {
      hash: "B8ECC7E200C4874914CEF1D7FB08340B45235D3B884726134E96A89EE38AC64A",
      blockHeight: 162412439,
      blockTime: 1620722441110,
      type: "ORACLE_CLAIM",
      fee: 0,
      code: 0,
      source: 0,
      sequence: 706559,
      memo: "",
      log: "Msg 0: ",
      data: "{"chainId":56,"payload":[{"channelId":3,"sequence":1192912,"payload":{"packageType":0,"crossChainFee":200000,"content":{"symbol":"BNB","contractAddress":"0x0000000000000000000000000000000000000000","amounts":[7100000],"receiverAddresses":["bnb1zwyuzhvm55fxc2w6gjxhwr670gxeuxchdc70w8"],"refundAddresses":["0x1533726cfe64da63b6169d249047d0231739308f"],"expireTime":1620722861}}},{"channelId":3,"sequence":1192913,"payload":{"packageType":0,"crossChainFee":200000,"content":{"symbol":"BNB","contractAddress":"0x0000000000000000000000000000000000000000","amounts":[9860839],"receiverAddresses":["bnb1uctxp6pd67q3eqcm9pd8e7xq60yw0zfg2uctkw"],"refundAddresses":["0x1451bd04f1e849113261072925ea5efdf95a1b53"],"expireTime":1620722888}}},{"channelId":3,"sequence":1192914,"payload":{"packageType":0,"crossChainFee":200000,"content":{"symbol":"BNB","contractAddress":"0x0000000000000000000000000000000000000000","amounts":[10000000],"receiverAddresses":["bnb1e47xrdkz28cerg5fzqyk9w08q68v5qccutty07"],"refundAddresses":["0x95f00d266590d325367f4d38c50eae89df84ef3d"],"expireTime":1620722937}}}],"sequence":829118,"validatorAddress":"bva1h9ymecpakr8p8lhchtah2xxx7x4xq099u8e07c"}",
      asset: null,
      amount: null,
      fromAddr: "bnb1h9ymecpakr8p8lhchtah2xxx7x4xq099umclqu",
      toAddr: null
      }

      TRANSFER_TOKEN_OWNERSHIP

      {
      hash: "41B51422C1238BA859B16F3731C34E1150122399994557FEC377D3D701E503E3",
      blockHeight: 146158279,
      blockTime: 1614067191757,
      type: "TRANSFER_TOKEN_OWNERSHIP",
      fee: 200000,
      code: 0,
      source: 0,
      sequence: 1,
      memo: "",
      log: "Msg 0: ",
      data: null,
      asset: "QQ-EF5M",
      amount: null,
      fromAddr: "bnb1jae4k7eg8s7th0gn7yaxpwpen79a8jsrvwxufu",
      toAddr: "bnb1jae4k7eg8s7th0gn7yaxpwpen79a8jsrvwxufu"
      }

      SET_ACCOUNT_FLAG

      {
      hash: "F0B4A6577EB9FCAB3C4733EE955A9E1165280D812B450493B883168EFD594B25",
      blockHeight: 159194287,
      blockTime: 1619380919117,
      type: "SET_ACCOUNT_FLAG",
      fee: 20000000,
      code: 0,
      source: 0,
      sequence: 404,
      memo: "",
      log: "Msg 0: ",
      data: "{"flags":1}",
      asset: null,
      amount: null,
      fromAddr: "bnb1x0t2mwrqg7gwy8wu04q6f4dty2ztcs40cg9exl",
      toAddr: null
      }

      Example for block response

      Block of height 170155309

      {
      height: 170155309,
      hash: "83EFF62688836D1D5206CDA95F0FC02DF43CDFDB4703C7C00CAEE18FB2D625CB",
      parentHash: "69E12701818A1B1FF6EFFDC22350697E723E1101115175298DA553E9ABDED292",
      time: 1623901978318,
      txCount: 4,
      size: 65536,
      consumeTime: 350,
      proposerAddr: "bnb1jstexazk7zateuwzzwllswu4j3dsllu3dgte4m",
      proposerNode: "Zugspitze",
      fees: [
      {
      blockHeight: 170155309,
      address: "bnb1jstexazk7zateuwzzwllswu4j3dsllu3dgte4m",
      asset: "BNB",
      quantity: 780
      },
      {
      blockHeight: 170155309,
      address: "bnb1jw9xup8arde2jzarzcs2fv49hh28uad92m4ke0",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb16k0gajcczwgymfkk0zsysjzl0sxyxdfckplxlr",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb1xaef2agzycsww32fqyggnk5xgqxs8780vfv2kh",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb13m056plt2646zse2mwxfft92xawnky4nmncxc3",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb17kfuzeza2kn46yqx4twxxmlw2jk2ywp5x4gze2",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb1tpagqqqx36gq09kzw4f5a3a9sk3tq54dpl5ldn",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb1y888axmhzz6yjj464syfy68mkhzy9phlv8fzac",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb19klje94mnu53wj7pmrk0zmtpwgr0uz8th0fcvw",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb19hunw9ps8n9tkrp2j64jvheezgqmfc2eyrxd7a",
      asset: "BNB",
      quantity: 772
      },
      {
      blockHeight: 170155309,
      address: "bnb15hx3frkdu7vajy2eulu80vl97vehnhyavu927v",
      asset: "BNB",
      quantity: 772
      }
      ]
      }
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/block-service.html b/docs/beaconchain/develop/api-reference/dex-api/block-service.html index 8333c2cc6c..610767ff62 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/block-service.html +++ b/docs/beaconchain/develop/api-reference/dex-api/block-service.html @@ -8,13 +8,13 @@ - +

      API reference for block service

      API description for block and transaction service

      Version: V1.0

      Mainnet base path: https://api.binance.org/bc/

      Testnet base path: https://testnet-api.binance.org/bc/

      /api/v1/blocks

      GET

      Summary

      Get a batch of blocks, including fees.

      Rate Limit: 500 request per IP in 5 minutes.

      Parameters
      NameLocated inDescriptionRequiredSchema
      endHeightqueryend of block height, endHeight-startHeight <= 50Yeslong
      startHeightquerystart of block height, startHeight should bigger than 0Yeslong
      Responses
      CodeDescriptionSchema
      200OKBlocksVO
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/blocks/{blockHeight}

      GET

      Summary

      Get a block, including fees, for a particular block height.

      Rate Limit: in together with /api/v1/blocks/{blockHeight}/txs 1500 request per IP in 5 minutes.

      Parameters
      NameLocated inDescriptionRequiredSchema
      blockHeightpathheight of blockYeslong
      Responses
      CodeDescriptionSchema
      200OKBlockVO
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/blocks/{blockHeight}/txs

      GET

      Summary

      Get transactions in a particular block height.

      Rate Limit: in together with /api/v1/blocks/{blockHeight} 1500 request per IP in 5 minutes.

      Parameters
      NameLocated inDescriptionRequiredSchema
      blockHeightpathheight of blockYeslong
      Responses
      CodeDescriptionSchema
      200OKTxsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/txs

      GET

      Summary

      Search transactions by criteria.

      Rate Limit: 500 request per IP in 5 minutes (please read notes for more details).

      Parameters
      NameLocated inDescriptionRequiredSchema
      addressqueryaddressYesstring
      addressTypequeryaddress type: FROM or TONostring
      assetqueryassetNostring
      endTimequeryend time in in milliseconds, endTime - startTime should be smaller than 7 daysYeslong
      limitquerydefault 10, max 50Nointeger
      offsetquerydefault 0, max 10000Nointeger
      startTimequerystart time in millisecondsYeslong
      typequerytypeNostring

      Notes:

      1. The timeframe between endTime and startTime should be less than 7 days. The shorter timeframe will get faster response, and longer timeframe will trigger more strict rate limiter.
      2. type: NEW_ORDER, ISSUE_TOKEN, BURN_TOKEN, LIST_TOKEN, CANCEL_ORDER, FREEZE_TOKEN, UN_FREEZE_TOKEN, TRANSFER, PROPOSAL, SIDE_PROPOSAL, VOTE, SIDE_VOTE, DEPOSIT, SIDE_DEPOSIT, MINT, CREATE_VALIDATOR, REMOVE_VALIDATOR, TIME_LOCK, TIME_UNLOCK, TIME_RELOCK, SET_ACCOUNT_FLAG, HTL_TRANSFER, DEPOSIT_HTL, CLAIM_HTL, REFUND_HTL, CREATE_SIDECHAIN_VALIDATOR, EDIT_SIDECHAIN_VALIDATOR, SIDECHAIN_DELEGATE, SIDECHAIN_REDELEGATE, SIDECHAIN_UNDELEGATE, ORACLE_CLAIM, CROSS_TRANSFER_OUT, CROSS_BIND, CROSS_UNBIND, BSC_SUBMIT_EVIDENCE, SIDECHAIN_UNJAIL, TRANSFER_TOKEN_OWNERSHIP, TINY_TOKEN_ISSUE, MINI_TOKEN_ISSUE, MINI_TOKEN_LIST, MINI_TOKEN_SET_URI
      3. addressType: FROM or TO
      Responses
      CodeDescriptionSchema
      200OKTxsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/txs/{txHash}

      GET

      Summary

      Get a transaction by a hash.

      Rate Limit: 1500 request per IP in 5 minutes.

      Parameters
      NameLocated inDescriptionRequiredSchema
      txHashpathhash of txYesstring
      Responses
      CodeDescriptionSchema
      200OKTxVO
      401Unauthorized
      403Forbidden
      404Not Found

      Models

      BlockVO

      NameTypeDescriptionRequired
      consumeTimelongelapsed time from last blockNo
      fees[ FeeVO ]feesNo
      hashstringblock hashNo
      heightlongblock heightNo
      parentHashstringblock's parent hashNo
      proposerAddrstringproposer's address of the blockNo
      proposerNodestringproposer's nameNo
      sizelongsizeNo
      timelongblock timestampNo
      txCountintegerthe count of tx in the blockNo

      BlocksVO

      NameTypeDescriptionRequired
      blocks[ BlockVO ]blocksNo

      FeeVO

      NameTypeDescriptionRequired
      addressstringaddressNo
      assetstringfee assetNo
      blockHeightlongheight of blockNo
      quantitylongquantity of the assetNo

      FeesVO

      NameTypeDescriptionRequired
      fees[ FeeVO ]feesNo

      TxVO

      NameTypeDescriptionRequired
      amountlongamount of the assetNo
      assetstringassetNo
      blockHeightlongheight of the blockNo
      blockTimelongtimestamp of the blockNo
      codeintegercodeNo
      datastringdifferent schemas for different tx typesNo
      feelongfeeNo
      fromAddrstringfrom addressNo
      hashstringhash of the txNo
      logstringlogNo
      memostringmemoNo
      sequencelongsequenceNo
      sourcelongsourceNo
      toAddrstringto addressNo
      typestringtx typeNo

      TxsVO

      NameTypeDescriptionRequired
      totallongtotal count of txsNo
      txs[ TxVO ]txsNo
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/bridge-widget.html b/docs/beaconchain/develop/api-reference/dex-api/bridge-widget.html index 20cdeeaa83..23d88c8f88 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/bridge-widget.html +++ b/docs/beaconchain/develop/api-reference/dex-api/bridge-widget.html @@ -8,13 +8,13 @@ - +

      Introduction

      Currently, users can't perform any actions with Binance Bridge unless their wallets are connected. This widget is meant to be used client-side to improve the flow of connecting wallets.

      Connect

      You should see a connection request from Binance Bridge. Click on the Connect button to accept it.

      img

      Base URL

      https://www.binance.org/en/bridge?wallet=$wallet_name

      • Supported wallet name in desktop browser: metamask, Binance Wallet.

      • Supported wallet name in mobile app browser: metamask

      Example request

      https://www.binance.org/en/bridge?wallet=metamask

      This URL support both MathWallet and MetaMask. Open the link in the wallet browser.

      Note: please make sure the wallet is connected to BNB Smart Chain mainnet.

      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/bridge.html b/docs/beaconchain/develop/api-reference/dex-api/bridge.html index aafb2d7b0e..fdb3cb05a0 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/bridge.html +++ b/docs/beaconchain/develop/api-reference/dex-api/bridge.html @@ -8,14 +8,14 @@ - +

      Swagger API reference for swap service

      API description for swap service

      Version: V1.0

      Contact information: BNB Beacon Chain

      Base URL: api.binance.org/bridge

      Rate Limit: 2000 request per IP per 5 mins.

      /api/v1/tokens


      GET

      Summary: get

      Parameters

      NameLocated inDescriptionRequiredSchema
      directionqueryIn or OUTNostring

      Responses

      CodeDescriptionSchema
      200OKTokenList
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/tokens/{symbol}/networks


      GET

      Summary: get

      Parameters

      NameLocated inDescriptionRequiredSchema
      symbolpathtoken symbolYesstring

      Responses

      CodeDescriptionSchema
      200OKNetworkList
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/swaps


      GET

      Summary: find

      Parameters

      NameLocated inDescriptionRequiredSchema
      directionquerydirectionNostring
      endTimequeryendTimeNolong
      limitquerylimitNolong
      offsetqueryoffsetNolong
      startTimequerystartTimeNolong
      statusquerystatusNo[ string ]
      symbolquerysymbolNostring
      walletAddressquerywalletAddressYesstring

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodySwapList
      401Unauthorized
      403Forbidden
      404Not Found
      POST

      Summary: create

      Parameters

      NameLocated inDescriptionRequiredSchema
      payloadbodypayloadYesSwapCreationRequest

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodySwapCreation
      201Created
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/swaps/{swapId}


      GET

      Summary: get

      Parameters

      NameLocated inDescriptionRequiredSchema
      swapIdpathswapIdYesstring

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodySwapDetail
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/swaps/{swapId}/email


      PUT

      Summary: createEmail

      Parameters

      NameLocated inDescriptionRequiredSchema
      payloadbodypayloadYesEmailUpdateRequest
      swapIdpathswapIdYesstring

      Responses

      CodeDescriptionSchema
      200OKResponseStatus
      201Created
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/swaps/quota/24hour


      GET

      Summary: getQuota

      Parameters

      NameLocated inDescriptionRequiredSchema
      symbolquerysymbolYesstring
      walletAddressquerywalletAddressYesstring

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodyQuota
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v2/swaps


      GET

      Summary: findV2

      Parameters

      NameLocated inDescriptionRequiredSchema
      endTimequeryendTimeNolong
      limitquerylimitNolong
      offsetqueryoffsetNolong
      startTimequerystartTimeNolong
      statusquerystatusNostring
      symbolquerysymbolNostring
      walletAddressquerywalletAddressYesstring

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodySwapList
      401Unauthorized
      403Forbidden
      404Not Found
      POST

      Summary: createV2

      Parameters

      NameLocated inDescriptionRequiredSchema
      payloadbodypayloadYesSwapCreationRequestV2

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodySwapCreation
      201Created
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v2/tokens


      GET

      Summary: getTokens

      Responses

      CodeDescriptionSchema
      200OKTokenListV2
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v2/tokens/{symbol}/networks


      GET

      Summary: get

      Parameters

      NameLocated inDescriptionRequiredSchema
      symbolpathtoken symbolYesstring

      Responses

      CodeDescriptionSchema
      200OKNetworkListV2
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v1/unknown-deposits


      GET

      Summary: getUnknownDeposits

      Parameters

      NameLocated inDescriptionRequiredSchema
      limitquerylimitNolong
      offsetqueryoffsetNolong
      walletAddressquerywalletAddressYesstring

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodyDepositList
      401Unauthorized
      403Forbidden
      404Not Found

      /api/v2/swaps/validation/ip


      GET

      Summary: validateIP

      Responses

      CodeDescriptionSchema
      200OKResponseStatusBodyboolean
      401Unauthorized
      403Forbidden
      404Not Found

      Models


      EmailUpdateRequest

      NameTypeDescriptionExample
      emailstring
      walletAddressstring

      ResponseStatus

      NameTypeDescriptionExample
      codeinteger
      messagestring

      ResponseStatusBodySwapCreation

      NameTypeDescriptionExample
      codeinteger
      dataSwapCreation
      messagestring

      ResponseStatusBodySwapDetail

      NameTypeDescriptionExample
      codeinteger
      dataSwapDetail
      messagestring

      SwapCreation

      NameTypeDescriptionExample
      amountnumber
      createTimedateTime
      depositAddressstring
      depositAddressLabelstring
      depositTimeoutdateTime
      directionstring
      fromNetworkstring
      idstring
      networkFeenumber
      networkFeePromotedboolean
      statusstring
      swapFeenumber
      swapFeeRatenumber
      symbolstring
      toAddressstring
      toAddressLabelstring
      toNetworkstring
      walletAddressstring

      SwapCreationRequest

      NameTypeDescriptionExample
      amountnumber
      directionstring
      fromNetworkstring
      sourceinteger
      symbolstring
      toAddressstring
      toAddressLabelstring
      toNetworkstring
      walletAddressstring

      SwapDetail

      NameTypeDescriptionExample
      actualFromAmountnumber
      actualNetworkFeenumber
      actualSwapFeenumber
      actualToAmountnumber
      amountnumber
      createTimedateTime
      depositAddressstring
      depositAddressLabelstring
      depositReceivedConfirmsinteger
      depositRequiredConfirmsinteger
      depositTimeoutdateTime
      depositTxIdstring
      depositTxLinkstring
      directionstring
      fromNetworkstring
      idstring
      networkFeenumber
      networkFeePromotedboolean
      statusstring[WaitingForDeposit,DepositInProgress,WithdrawInProgress,Completed,Failed,Cancelled]
      swapFeenumber
      swapFeeRatenumber
      swapTxIdstring
      swapTxLinkstring
      symbolstring
      toAddressstring
      toAddressLabelstring
      toNetworkstring
      updateTimedateTime
      walletAddressstring

      ResponseStatusBodySwapList

      NameTypeDescriptionExample
      codeinteger
      dataSwapList
      messagestring

      SwapList

      NameTypeDescriptionExample
      swaps[ SwapDetail ]
      totallong

      TokenList

      NameTypeDescriptionExample
      swaps[ TokenDetail ]
      totallong

      TokenListV2

      NameTypeDescriptionExample
      swaps[ TokenDetailV2 ]
      totallong

      TokenDetail

      NameTypeDescriptionExample
      namestring
      symbolstring
      bcSymbolstring
      iconstring
      minAmountnumber
      maxAmountnumber
      promotionboolean
      enabledboolean
      bscContractAddressstring
      bscContractDecimalinteger

      TokenDetailV2

      NameTypeDescriptionExample
      namestring
      symbolstring
      bcSymbolstring
      ethSymbolstring
      iconstring
      minAmountnumber
      maxAmountnumber
      promotionboolean
      enabledboolean
      bscContractAddressstring
      bscContractDecimalinteger
      ethContractAddressstring
      ethContractDecimalinteger
      bscGasExchangeEnabledboolean
      bscGasExchangeNetworkFeenumber

      NetworkList

      NameTypeDescriptionExample
      from[ NetworkDetail ]
      to[ NetworkDetail ]

      NetworkDetail

      NameTypeDescriptionExample
      namestring
      supportLabelboolean
      labelNamestring
      labelRegexstring
      txUrlnumber
      enabledboolean
      requiredConfirmsinteger
      tokenStandardstring

      NetworkListV2

      NameTypeDescriptionExample
      from[ NetworkDetailV2 ]
      to[ NetworkDetailV2 ]

      NetworkDetailV2

      NameTypeDescriptionExample
      namestring
      symbolstring
      swapFeeRatenumber
      networkFeenumber
      supportLabelboolean
      labelNamestring
      labelRegexstring
      txUrlnumber
      depositEnabledboolean
      withdrawEnabledboolean
      withdrawAmountUnitnumber
      addressRegexstring
      tokenStandardstring
      requiredConfirmsinteger

      ResponseStatusBodyQuota

      NameTypeDescriptionExample
      codeinteger
      dataQuota
      messagestring

      Quota

      NameTypeDescriptionExample
      leftnumber
      totalnumber
      usednumber

      SwapCreationRequestV2

      NameTypeDescriptionExample
      amountnumber
      exchangeGasAmountnumber0.5,1,2
      fromNetworkstring
      sourceinteger
      symbolstring
      toAddressstring
      toAddressLabelstring
      toNetworkstring
      walletAddressstring
      walletNetworkstring

      ResponseStatusBodyDepositList

      NameTypeDescriptionExample
      codeinteger
      dataDepositList
      messagestring

      Deposit

      NameTypeDescriptionExample
      amountnumber
      confirmTimesinteger
      depositTimelong
      depositTxUrlstring
      fromAddressstring
      labelstring
      networkstring
      refundIdstring
      refundMessagestring
      refundStatusstring
      refundTxstring
      refundTxUrlstring
      statusstring
      swapIdstring
      toAddressstring
      tokenSymbolstring
      txIdstring

      DepositList

      NameTypeDescriptionExample
      deposits[ Deposit ]
      totallong

      ResponseStatusBodyboolean

      NameTypeDescriptionExample
      codeinteger
      databoolean
      messagestring
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/migration-guide.html b/docs/beaconchain/develop/api-reference/dex-api/migration-guide.html index d13f923bf2..5b34711289 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/migration-guide.html +++ b/docs/beaconchain/develop/api-reference/dex-api/migration-guide.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

      Migration Guide

      Target Audience

      This guide will help users migrate their existing calls of /api/v1/transactions-in-block, /api/v2/transactions-in-block, /api/v1/transactions to the new bock and transaction apis. If you are also using undisclosed APIs from Explorer, you can also refer to this document for migration. Otherwise, you can skip this document and refer to the api document.

      Migration of /api/v1/transactions-in-block, /api/v2/transactions-in-block

      New API

      Please call /api/v1/blocks/{blockHeight}/txs instead.

      Main Strengthens

      • The new api can query all historical blocks' transactions, not only blocks in the past 24 hours.
      • The rate limit is 1000 requests per ip in 5 minutes, which is much bigger comparing to the rate limits of /api/v1/transactions-in-block, /api/v2/transactions-in-block.

      Migration Cautions

      • All the amount/quantity/price/fee will be returned as Long. For converting them to floats (as old response in /api/v1/transactions-in-block, /api/v2/transactions-in-block), you need to divide them by 10e8.
      • For the data field, the response in new api could be different, please refer to the tx examples for more details.

      Migration of /api/v1/transactions

      New API

      Please call /api/v1/txs instead.

      Main Strengthens

      • Cross chain support
        • You can search CROSS_TRANSFER_OUT transactions by using BC or BSC addresses.
        • You can search CREATE_SIDECHAIN_VALIDATOR, SIDECHAIN_DELEGATE, SIDECHAIN_REDELEGATE, SIDECHAIN_UNBOND transactions by using validator address.
      • Optimization of address parameter
        • You can search multi send transfers by any address involved in the transaction.
        • You can search HTL_TRANSFER transactions by any address involved in the transaction.
      • Optimization of asset parameter
        • You can search NEW_ORDER, CANCEL_ORDER, MINI_TOKEN_LIST, LISTING transactions using base or quote asset.
        • You can search SUBMIT_PROPOSAL, SIDE_SUBMIT_PROPOSAL transaction if the related proposal is Listing.
        • You can search DEPOSIT_HTL HTL_TRANSFER, SIDE_DEPOSIT, TIME_LOCK, TIME_RELOCK, TRANSFER transactions by any kind of asset involved in the transactions.
      • The rate limit is 500 requests per ip in 5 minutes, which is much bigger comparing to the rate limit of /api/v1/transactions.

      Migration Cautions

      • Some query parameter names changed (e.g., txAsset->asset, txType->type), and some parameters are removed (e.g., blockHeight), please do read the new api docs.
      • All the amount/quantity/price/fee will be returned as Long. For converting them to floats (as old response in /api/v1/transactions), you need to divide them by 10e8.
      • For the data field, the response in new api could be different, please refer to the tx examples for more details.
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/paths-testnet.html b/docs/beaconchain/develop/api-reference/dex-api/paths-testnet.html index 710c14a0dc..83aa811e6a 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/paths-testnet.html +++ b/docs/beaconchain/develop/api-reference/dex-api/paths-testnet.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ Rate Limit: 5 requests per IP per second.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addressquerythe seller/buyer addressNostring
      endqueryend timeNolong
      limitquerydefault 50; max 1000.Nointeger
      offsetquerystart with 0; default 0.Nointeger
      startquerystart time in MillisecondsNolong
      totalquerytotal number required, 0 for not required and 1 for required; default not required, return total=-1 in responseNointeger

      Responses

      CodeDescriptionSchema
      200OKBlockExchangeFeePage

      /api/v1/transactions


      GET

      Summary: Get transactions.

      Description: Gets a list of transactions. Multisend transaction is not available in this API. Currently 'confirmBlocks' and 'txAge' are not supported.

      Query Window: Default query window is latest 24 hours; The maximum start - end query window is 3 months.

      Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addressqueryaddressYesstring
      blockHeightqueryblockHeightNolong
      endTimequeryendTime in MillisecondsNolong
      limitquerylimitNointeger
      offsetqueryoffsetNointeger
      sidequerytransaction side. Allowed value: [ RECEIVE, SEND]Noenum string
      startTimequerystart time in MillisecondsNolong
      txAssetquerytxAssetNostring
      txTypequerytransaction type. Allowed value: [ NEW_ORDER,ISSUE_TOKEN,BURN_TOKEN,LIST_TOKEN,CANCEL_ORDER,FREEZE_TOKEN,UN_FREEZE_TOKEN,TRANSFER,PROPOSAL,VOTE,MINT,DEPOSIT,CREATE_VALIDATOR,REMOVE_VALIDATOR,TIME_LOCK,TIME_UNLOCK,TIME_RELOCK,SET_ACCOUNT_FLAG,HTL_TRANSFER,CLAIM_HTL,DEPOSIT_HTL,REFUND_HTL]Noenum string

      Responses

      CodeDescriptionSchema
      200OKTxPage
      400Bad RequestError
      404Not Found
      defaultGeneric error responseError

      /api/v1/transactions-in-block/{blockHeight}


      GET

      Summary: Get transactions in the specific block.

      Description: Get transactions in the block. Multi-send and multi-coin transactions are flattened as transactions. This API is deprecated.

      Rate Limit: 5 requests per IP per second.

      Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      blockHeightpathblock heightYesstring

      Responses

      CodeDescriptionSchema
      200OKBlockTx
      400Bad Request. The block to query is higher than current highest block.Error
      404Not Found
      defaultGeneric error responseError

      /api/v2/transactions-in-block/{blockHeight}


      GET

      Summary: transactions in Block

      Description: Get transactions in the block. Multi-send and multi-coin transactions are included as sub-transactions.

      Rate Limit: 5 request per IP per second.

      Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      blockHeightpathblockHeightYeslong

      Responses

      CodeDescriptionSchema
      200OKBlockTxV2
      400Bad Request. The block to query is higher than current highest block.Error

      /api/v1/atomic-swaps


      GET

      Summary: AtomicSwap

      Description: Get atomic swaps by address.

      Rate Limit: 5 request per IP per second.

      Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      endTimequeryend time of blockTimestampNolong
      fromAddressqueryAt least one of toAddress and fromAddress should be provided as parameterNostring
      limitquerydefault 25; max 1000.Nointeger
      offsetquerystart with 0; default 0.Nointeger
      startTimequerystart time of blockTimestamp in Milliseconds; The maximum start - end query window is 3 months; Default query window is the latest 30 days.Nolong
      toAddressqueryAt least one of toAddress and fromAddress should be provided as parameterNostring

      Responses

      CodeDescriptionSchema
      200OKAtomicSwapPage

      /api/v1/atomic-swaps/{id}


      GET

      Summary: AtomicSwap

      Description: Get an AtomicSwap by swap id

      Rate Limit: 5 request per IP per second.

      Rate Limit: 60 request per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      idpathswap idYesstring

      Responses

      CodeDescriptionSchema
      200OKAtomicSwap

      /api/v1/timelocks/{address}


      GET

      Summary: Gets time lock records given an address

      Parameters

      NameLocated inDescriptionRequiredSchema
      addresspathThe account address to queryYesstring
      idquerythe record id of timelock to queryNolong

      Responses

      CodeDescriptionSchema
      200SuccessTimeLocks
      400Bad RequestError
      500internal server errorError

      /api/v1/timelock/{account_addr}?(id={recordid})


      GET

      Summary: Get timelock records of an address.

      Description: Get the timelock history of an address. Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addresspathThe account address to queryYesstring
      idquerythe record id of timelock to queryNolong

      Responses

      CodeDescriptionSchema
      200SuccessTimeLocks
      400Bad RequestError
      404Not Found
      500internal server errorError

      /api/v1/mini/tokens


      GET

      Summary: Gets a list of available mini tokens.

      Parameters

      NameLocated inDescriptionRequiredSchema
      offsetqueryoffsetNointeger
      limitquerylimitNointeger

      Responses

      CodeDescriptionSchema
      200SuccessMiniTokens
      400Bad RequestError
      500internal server errorError

      Models


      Error

      NameTypeDescriptionExample
      codelongerror code400
      messagestringerror message

      Times

      NameTypeDescriptionExample
      ap_timestringevent timee.g. 2019-01-21T10:30:00Z
      block_timestringthe time of latest blocke.g. 2019-01-21T10:30:00Z

      Validators

      NameTypeDescriptionExample
      block_heightlongCurrent block height12345
      validators[ Validator ]

      Validator

      NameTypeDescriptionExample
      addressstring (hex address)Address
      pub_key[ integer ]Public key bytes
      voting_powerintegervalidator's voting power
      accumintegervalidator's accumulated voting power

      Peer

      NameTypeDescriptionExample
      idstringAuthenticated identifier8c379d4d3b9995c712665dc9a9414dbde5b30483
      original_listen_addrstring (RemoteAddr)Original listen address before PeersService changed it
      listen_addrstring (RemoteAddr)Listen address
      access_addrstring (RemoteAddr)Access address (HTTP)
      stream_addrstring (RemoteAddr)Stream address (WS)
      networkstringChain IDBinance-Chain-Ganges
      versionstringVersion0.30.1
      monikerstringMoniker (Name)data-seed-1
      capabilities[ string ]Array of capability tags: node, qs, ap, wsnode,ap
      acceleratedbooleanIs an accelerated path to a validator node

      Transaction

      NameTypeDescriptionExample
      hashstring (hex)Hash of transaction, it returned as bytes before, and now it returns as hex string
      logstringLog of transaction
      datastringData of transaction
      heightstringHeight of transaction
      codeintegerResult code of transaction
      okboolean
      txobjectDetail of transaction, like transaction type, messages and signature

      For example, below is the detail of a send transaction. Most of the fields are fixed, but the detail of msg varies with msg type, if you query with --format=json.

      {
      "type": "auth/StdTx", // fixed, type of transaction
      "value": { // fixed, detail of the transaction
      "data": null, // fixed, data of the transaction
      "memo": "", // fixed, memo
      "msg": [ // fixed, msgs of the transaction
      {
      "type": "cosmos-sdk/Send", // vary with msg type
      "value": { // value content vary with mst type
      "inputs": [
      {
      "address": "bnb1vt4zwu5hy7tyryktud6mpcu8h2ehh6xw66gzwp",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ],
      "outputs": [
      {
      "address": "bnb1kg8mh20tndur9d9rry4wjunhpfzcud30qzf0qv",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ]
      }
      }
      ],
      "signatures": [ // fixed, signatures of the transaction
      {
      "account_number": "0",
      "pub_key": {
      "type": "tendermint/PubKeySecp256k1",
      "value": "AoWY3eWBOnnvLPTz4RsUlX1pWCkLLPewu1vAAoTEzxzR"
      },
      "sequence": "1",
      "signature": "6O2TQAgleFNPw4zIWBLaNvOf5dR7DHNSr2DwAPeFK6lokRqZd2KR2BD+WlmaWj4LdLo5N+utN1JtY41E91N0uw=="
      }
      ],
      "source": "0" // fixed, source of the transaction
      }
      }

      | |

      Account

      NameTypeDescriptionExample
      account_numberinteger
      addressstring (address)
      balances[ Balance ]
      public_key[ integer ]Public key bytes
      sequencelongsequence is for preventing replay attack

      AccountSequence

      NameTypeDescriptionExample
      sequencelongnumber used for preventing replay attack1

      Balance

      NameTypeDescriptionExample
      symbolstring (currency)asset symbolBNB
      freestring (fixed8)In decimal form, e.g. 0.000000000.00000000
      lockedstring (fixed8)In decimal form, e.g. 0.000000000.00000000
      frozenstring (fixed8)In decimal form, e.g. 0.000000000.00000000

      Token

      NameTypeDescriptionExample
      namestringtoken nameBNB Beacon Chain Native Token
      symbolstringunique token trade symbolBTC-000
      original_symbolstringtoken symbolBTC
      total_supplystring (fixed8)total token supply in decimal form, e.g. 1.000000000.00000000
      ownerstring (address)Address which issue the token
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals

      Fee

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1
      multi_transfer_feestringFee for multi-transfer200000
      lower_limit_as_multistringe.g. 22
      fixed_fee_paramsFixedFeeParamsSet if the fee is fixed
      dex_fee_fieldsDexFeeFieldParamsdex fee

      FixedFeeParams

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fixed fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1

      DexFeeFieldParams

      NameTypeDescriptionExample
      fee_namestringfee name
      fee_valueintegerfee value

      SubTx

      NameTypeDescriptionExample
      blockHeightlong
      fromAddrstring
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      BlockExchangeFeePage

      NameTypeDescriptionExample
      blockExchangeFee[ BlockExchangeFee ]
      totallong

      BlockExchangeFee

      NameTypeDescriptionExample
      addressstring
      blockHeightlong
      blockTimelongtimestamp of a block
      feestringtotal fee collected. Multiple assets are split by semicolon.
      tradeCountlongtrade count of the address on the block

      TxPage

      NameTypeDescriptionExample
      totallongtotal sum of transactions
      tx[ Tx ]

      BlockTx

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ Tx ]

      BlockTxV2

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ TxV2 ]

      Tx

      NameTypeDescriptionExample
      blockHeightlongblock height
      codeintegertransaction result code0
      confirmBlockslong
      datastring
      fromAddrstringfrom address
      orderIdstringorder ID
      timeStampdateTimetime of transaction
      toAddrstringto address
      txAgelong
      txAssetstring
      txFeestring
      txHashstringhash of transaction
      txTypestringtype of transaction
      valuestringvalue of transaction
      sourcelong
      sequencelong
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      proposalIdstring

      ExchangeRate

      NameTypeDescriptionExample
      ExchangeRateobject

      ResultStatus

      NameTypeDescriptionExample
      validator_info[ ValidatorInfo ]
      sync_info[ SyncInfo ]
      node_info[ NodeInfo ]

      NodeInfo

      NameTypeDescriptionExample
      Protocol_Version[ ProtocolVersion ]
      IDstring
      listen_addrstring
      networkstring
      versionstring
      channelsstring
      monikerstring
      otherobject

      SyncInfo

      NameTypeDescriptionExample
      latest_block_hashstring (hex)
      latest_app_hashstring (hex)
      latest_block_heightlong
      latest_block_timetime
      catching_upboolean

      ProtocolVersion

      NameTypeDescriptionExample
      P2Pinteger (uint64)
      blockinteger (uint64)
      appinteger (uint64)

      ValidatorInfo

      NameTypeDescriptionExample
      addressstringhex address
      pub_keystringhex-encoded
      voting_powerlong

      AtomicSwapPage

      NameTypeDescriptionExample
      atomicSwaps[ AtomicSwap ]
      totallong

      AtomicSwap

      NameTypeDescriptionExample
      blockTimestamplongTimestamp of block in which the swap is initiated. The unit is millisecond.
      closedTimelong
      crossChaininteger
      expectedIncomestring
      expireHeightlong
      fromAddrstring
      inAmountstring
      outAmountstring
      randomNumberstring
      randomNumberHashstring
      recipientOtherChainstring
      statusinteger
      swapIdstring
      timestampstring (int64)The timestamp for randomNumberHash calculation, randomNumberHash=sha256(randomNumber, timestamp). The unit is second.
      toAddrstring

      TxV2

      NameTypeDescriptionExample
      blockHeightlong
      codeinteger0
      datastring
      fromAddrstring
      memostring
      orderIdstringOptional. Available when the transaction type is NEW_ORDER
      proposalIdstringOptional. Available when the transaction type is PROPOSAL
      sequencelong
      sourcelong
      subTransactions[ SubTx ]Optional. Available when the transaction has sub-transactions, such as multi-send transaction or a transaction have multiple assets
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      timeStampdateTime
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      TimeLocks

      NameTypeDescriptionExample
      idlongThe record id of the timelock transaction
      descriptionstringThe description of the timelock transaction
      amount[ ]
      locktimestringThe available unlock time

      MiniTokens

      NameTypeDescriptionExample
      namestringBNB Chain Mini Token
      symbolstringBTC-000
      original_symbolstringBTC
      total_supplystring (fixed8)In decimal form, e.g. 1.000000000.00000000
      token_typeintegerType of the mini token
      ownerstring (address)Address
      mintablebooleanmintable
      token_uristringURI for token description
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/paths.html b/docs/beaconchain/develop/api-reference/dex-api/paths.html index c24116f292..4261046667 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/paths.html +++ b/docs/beaconchain/develop/api-reference/dex-api/paths.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ Rate Limit: 5 requests per IP per second.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addressquerythe seller/buyer addressNostring
      endqueryend timeNolong
      limitquerydefault 50; max 1000.Nointeger
      offsetquerystart with 0; default 0.Nointeger
      startquerystart time in MillisecondsNolong
      totalquerytotal number required, 0 for not required and 1 for required; default not required, return total=-1 in responseNointeger

      Responses

      CodeDescriptionSchema
      200OKBlockExchangeFeePage

      /api/v1/transactions


      Note: This endpoint will be retired soon, use this api instead (please read the migration guide).

      GET

      Summary: Get transactions.

      Description: Gets a list of transactions. Multisend transaction is not available in this API. Currently 'confirmBlocks' and 'txAge' are not supported.

      Query Window: Default query window is latest 24 hours;The maximum start - end query window is 3 months.

      Rate Limit: 15 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addressqueryaddressYesstring
      blockHeightqueryblockHeightNolong
      endTimequeryendTime in MillisecondsNolong
      limitquerylimitNointeger
      offsetqueryoffsetNointeger
      sidequerytransaction side. Allowed value: [ RECEIVE, SEND]Noenum string
      startTimequerystart time in MillisecondsNolong
      txAssetquerytxAssetNostring
      txTypequerytransaction type. Allowed value: [ TRANSFER,NEW_ORDER,ISSUE_TOKEN,BURN_TOKEN,LIST_TOKEN,CANCEL_ORDER,FREEZE_TOKEN,UN_FREEZE_TOKEN,TRANSFER,PROPOSAL,VOTE,MINT,DEPOSIT,CREATE_VALIDATOR,REMOVE_VALIDATOR,TIME_LOCK,TIME_UNLOCK,TIME_RELOCK,SET_ACCOUNT_FLAG,HTL_TRANSFER,CLAIM_HTL,DEPOSIT_HTL,REFUND_HTL]Noenum string

      Responses

      CodeDescriptionSchema
      200OKTxPage
      400Bad RequestError
      404Not Found
      403Tx is not within 24h query window
      defaultGeneric error responseError

      /api/v1/transactions-in-block/{blockHeight}


      Note: This endpoint will be retired soon, use this api instead (please read the migration guide).

      GET

      Summary: Get transactions in the specific block.

      Description: Get transactions in the block. Multi-send and multi-coin transactions are flattened as transactions. This API is deprecated.

      Rate Limit: 1 requests per IP per second.

      Rate Limit: 15 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      blockHeightpathblock heightYesstring

      Responses

      CodeDescriptionSchema
      200OKBlockTx
      400Bad Request. The block to query is higher than current highest block.Error
      404Not Found
      defaultGeneric error responseError

      /api/v2/transactions-in-block/{blockHeight}

      Note: This endpoint will be retired soon, use this api instead (please read the migration guide).


      GET

      Summary: transactions in Block

      Description: Get transactions in the block. Multi-send and multi-coin transactions are included as sub-transactions.

      Rate Limit: 1 request per IP per second.

      Rate Limit: 15 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      blockHeightpathblockHeightYeslong

      Responses

      CodeDescriptionSchema
      200OKBlockTxV2
      400Bad Request. The block to query is higher than current highest block.Error

      /api/v1/atomic-swaps


      GET

      Summary: AtomicSwap

      Description: Get atomic swaps by address.

      Rate Limit: 5 request per IP per second.

      Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      endTimequeryend time of blockTimestampNolong
      fromAddressqueryAt least one of toAddress and fromAddress should be provided as parameterNostring
      limitquerydefault 25; max 1000.Nointeger
      offsetquerystart with 0; default 0.Nointeger
      startTimequerystart time of blockTimestamp in Milliseconds; The maximum start - end query window is 3 months; Default query window is the latest 30 days.Nolong
      toAddressqueryAt least one of toAddress and fromAddress should be provided as parameterNostring

      Responses

      CodeDescriptionSchema
      200OKAtomicSwapPage

      /api/v1/atomic-swaps/{id}


      GET

      Summary: AtomicSwap

      Description: Get an AtomicSwap by swap id

      Rate Limit: 5 request per IP per second.

      Rate Limit: 60 request per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      idpathswap idYesstring

      Responses

      CodeDescriptionSchema
      200OKAtomicSwap

      /api/v1/timelocks/{address}


      GET

      Summary: Gets time lock records given an address

      Parameters

      NameLocated inDescriptionRequiredSchema
      addresspathThe account address to queryYesstring
      idquerythe record id of timelock to queryNolong

      Responses

      CodeDescriptionSchema
      200SuccessTimeLocks
      400Bad RequestError
      500internal server errorError

      /api/v1/timelock/{account_addr}?(id={recordid})


      GET

      Summary: Get timelock records of an address.

      Description: Get the timelock history of an address. Rate Limit: 60 requests per IP per minute.

      Parameters

      NameLocated inDescriptionRequiredSchema
      addresspathThe account address to queryYesstring
      idquerythe record id of timelock to queryNolong

      Responses

      CodeDescriptionSchema
      200SuccessTimeLocks
      400Bad RequestError
      404Not Found
      500internal server errorError

      /api/v1/mini/tokens


      GET

      Summary: Gets a list of available mini tokens.

      Parameters

      NameLocated inDescriptionRequiredSchema
      offsetqueryoffsetNointeger
      limitquerylimitNointeger

      Responses

      CodeDescriptionSchema
      200SuccessMiniTokens
      400Bad RequestError
      500internal server errorError

      Models


      Error

      NameTypeDescriptionExample
      codelongerror code400
      messagestringerror message

      Times

      NameTypeDescriptionExample
      ap_timestringevent timee.g. 2019-01-21T10:30:00Z
      block_timestringthe time of latest blocke.g. 2019-01-21T10:30:00Z

      Validators

      NameTypeDescriptionExample
      block_heightlongCurrent block height12345
      validators[ Validator ]

      Validator

      NameTypeDescriptionExample
      addressstring (hex address)Address
      pub_key[ integer ]Public key bytes
      voting_powerintegervalidator's voting power
      accumintegervalidator's accumulated voting power

      Peer

      NameTypeDescriptionExample
      idstringAuthenticated identifier8c379d4d3b9995c712665dc9a9414dbde5b30483
      original_listen_addrstring (RemoteAddr)Original listen address before PeersService changed it
      listen_addrstring (RemoteAddr)Listen address
      access_addrstring (RemoteAddr)Access address (HTTP)
      stream_addrstring (RemoteAddr)Stream address (WS)
      networkstringChain IDBinance-Chain-Ganges
      versionstringVersion0.30.1
      monikerstringMoniker (Name)data-seed-1
      capabilities[ string ]Array of capability tags: node, qs, ap, wsnode,ap
      acceleratedbooleanIs an accelerated path to a validator node

      Transaction

      NameTypeDescriptionExample
      hashstring (hex)Hash of transaction, it returned as bytes before, and now it returns as hex string
      logstringLog of transaction
      datastringData of transaction
      heightstringHeight of transaction
      codeintegerResult code of transaction
      okboolean
      txobjectDetail of transaction, like transaction type, messages and signature

      For example, below is the detail of a send transaction. Most of the fields are fixed, but the detail of msg varies with msg type, if you query with --format=json.

      {
      "type": "auth/StdTx", // fixed, type of transaction
      "value": { // fixed, detail of the transaction
      "data": null, // fixed, data of the transaction
      "memo": "", // fixed, memo
      "msg": [ // fixed, msgs of the transaction
      {
      "type": "cosmos-sdk/Send", // vary with msg type
      "value": { // value content vary with mst type
      "inputs": [
      {
      "address": "bnb1vt4zwu5hy7tyryktud6mpcu8h2ehh6xw66gzwp",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ],
      "outputs": [
      {
      "address": "bnb1kg8mh20tndur9d9rry4wjunhpfzcud30qzf0qv",
      "coins": [
      {
      "amount": "100000000000000",
      "denom": "BNB"
      }
      ]
      }
      ]
      }
      }
      ],
      "signatures": [ // fixed, signatures of the transaction
      {
      "account_number": "0",
      "pub_key": {
      "type": "tendermint/PubKeySecp256k1",
      "value": "AoWY3eWBOnnvLPTz4RsUlX1pWCkLLPewu1vAAoTEzxzR"
      },
      "sequence": "1",
      "signature": "6O2TQAgleFNPw4zIWBLaNvOf5dR7DHNSr2DwAPeFK6lokRqZd2KR2BD+WlmaWj4LdLo5N+utN1JtY41E91N0uw=="
      }
      ],
      "source": "0" // fixed, source of the transaction
      }
      }

      | |

      Account

      NameTypeDescriptionExample
      account_numberinteger
      addressstring (address)
      balances[ Balance ]
      public_key[ integer ]Public key bytes
      sequencelongsequence is for preventing replay attack

      AccountSequence

      NameTypeDescriptionExample
      sequencelongnumber used for preventing replay attack1

      Balance

      NameTypeDescriptionExample
      symbolstring (currency)asset symbolBNB
      freestring (fixed8)In decimal form, e.g. 0.000000000.00000000
      lockedstring (fixed8)In decimal form, e.g. 0.000000000.00000000
      frozenstring (fixed8)In decimal form, e.g. 0.000000000.00000000

      Token

      NameTypeDescriptionExample
      namestringtoken nameBNB Chain Native Token
      symbolstringunique token trade symbolBTC-000
      original_symbolstringtoken symbolBTC
      total_supplystring (fixed8)total token supply in decimal form, e.g. 1.000000000.00000000
      ownerstring (address)Address which issue the token
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals

      Fee

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1
      multi_transfer_feestringFee for multi-transfer200000
      lower_limit_as_multistringe.g. 22
      fixed_fee_paramsFixedFeeParamsSet if the fee is fixed
      dex_fee_fieldsDexFeeFieldParamsdex fee

      FixedFeeParams

      NameTypeDescriptionExample
      msg_typestringTransaction msg type that this fee applies tosubmit_proposal
      feenumberThe fixed fee amount1000000000
      fee_forinteger1 = proposer, 2 = all, 3 = free1

      DexFeeFieldParams

      NameTypeDescriptionExample
      fee_namestringfee name
      fee_valueintegerfee value

      SubTx

      NameTypeDescriptionExample
      blockHeightlong
      fromAddrstring
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      BlockExchangeFeePage

      NameTypeDescriptionExample
      blockExchangeFee[ BlockExchangeFee ]
      totallong

      BlockExchangeFee

      NameTypeDescriptionExample
      addressstring
      blockHeightlong
      blockTimelongtimestamp of a block
      feestringtotal fee collected. Multiple assets are split by semicolon.
      tradeCountlongtrade count of the address on the block

      TxPage

      NameTypeDescriptionExample
      totallongtotal sum of transactions
      tx[ Tx ]

      BlockTx

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ Tx ]

      BlockTxV2

      NameTypeDescriptionExample
      blockHeightlongblock height
      tx[ TxV2 ]

      Tx

      NameTypeDescriptionExample
      blockHeightlongblock height
      codeintegertransaction result code0
      confirmBlockslong
      datastring
      fromAddrstringfrom address
      orderIdstringorder ID
      timeStampdateTimetime of transaction
      toAddrstringto address
      txAgelong
      txAssetstring
      txFeestring
      txHashstringhash of transaction
      txTypestringtype of transaction
      valuestringvalue of transaction
      sourcelong
      sequencelong
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      proposalIdstring

      ExchangeRate

      NameTypeDescriptionExample
      ExchangeRateobject

      ResultStatus

      NameTypeDescriptionExample
      validator_info[ ValidatorInfo ]
      sync_info[ SyncInfo ]
      node_info[ NodeInfo ]

      NodeInfo

      NameTypeDescriptionExample
      Protocol_Version[ ProtocolVersion ]
      IDstring
      listen_addrstring
      networkstring
      versionstring
      channelsstring
      monikerstring
      otherobject

      SyncInfo

      NameTypeDescriptionExample
      latest_block_hashstring (hex)
      latest_app_hashstring (hex)
      latest_block_heightlong
      latest_block_timetime
      catching_upboolean

      ProtocolVersion

      NameTypeDescriptionExample
      P2Pinteger (uint64)
      blockinteger (uint64)
      appinteger (uint64)

      ValidatorInfo

      NameTypeDescriptionExample
      addressstringhex address
      pub_keystringhex-encoded
      voting_powerlong

      AtomicSwapPage

      NameTypeDescriptionExample
      atomicSwaps[ AtomicSwap ]
      totallong

      AtomicSwap

      NameTypeDescriptionExample
      blockTimestamplongTimestamp of block in which the swap is initiated. The unit is millisecond.
      closedTimelong
      crossChaininteger
      expectedIncomestring
      expireHeightlong
      fromAddrstring
      inAmountstring
      outAmountstring
      randomNumberstring
      randomNumberHashstring
      recipientOtherChainstring
      statusinteger
      swapIdstring
      timestampstring (int64)The timestamp for randomNumberHash calculation, randomNumberHash=sha256(randomNumber, timestamp). The unit is second.
      toAddrstring

      TxV2

      NameTypeDescriptionExample
      blockHeightlong
      codeinteger0
      datastring
      fromAddrstring
      memostring
      orderIdstringOptional. Available when the transaction type is NEW_ORDER
      proposalIdstringOptional. Available when the transaction type is PROPOSAL
      sequencelong
      sourcelong
      subTransactions[ SubTx ]Optional. Available when the transaction has sub-transactions, such as multi-send transaction or a transaction have multiple assets
      swapIdstringOptional. Available when the transaction type is one of HTL_TRANSFER, CLAIM_HTL, REFUND_HTL, DEPOSIT_HTL
      timeStampdateTime
      toAddrstring
      txAssetstring
      txFeestring
      txHashstring
      txTypestring
      valuestring

      TimeLocks

      NameTypeDescriptionExample
      idlongThe record id of the timelock transaction
      descriptionstringThe description of the timelock transaction
      amount[ ]
      locktimestringThe available unlock time

      MiniTokens

      NameTypeDescriptionExample
      namestringBNB Chain Mini Token
      symbolstringBTC-000
      original_symbolstringBTC
      total_supplystring (fixed8)In decimal form, e.g. 1.000000000.00000000
      token_typeintegerType of the mini token
      ownerstring (address)Address
      mintablebooleanmintable
      token_uristringURI for token description
      contract_addressstringsmart contract address for this token
      contract_decimalsintthe token decimals
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/staking.html b/docs/beaconchain/develop/api-reference/dex-api/staking.html index e3b7a194d9..8eb563ef64 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/staking.html +++ b/docs/beaconchain/develop/api-reference/dex-api/staking.html @@ -8,13 +8,13 @@ - +

      Staking API

      Version: 1.0

      Terms of service:

      • Base URL: api.binance.org/

      License: Apache 2.0

      /v1/staking/accounts/{address}/balance


      GET

      Summary: getBalance

      Parameters

      NameLocated inDescriptionRequiredSchema
      addresspathaddressYesstring

      Responses

      CodeDescriptionSchema
      200OKBalanceVo
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/delegators/{delegator}/allowed-dst-validators


      GET

      Summary: getAllowedDstValidators

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      delegatorpathdelegatorYesstring
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger
      src-validatorquerysrc-validatorYesstring

      Responses

      CodeDescriptionSchema
      200OKAllowedDstValidatorsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/delegators/{delegator}/delegations


      GET

      Summary: getDelegationsValByDelegator

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      delegatorpathdelegatorYesstring
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger

      Responses

      CodeDescriptionSchema
      200OKDelegationValsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/delegators/{delegator}/operations


      GET

      Summary: getOperationsByDelegator

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      delegatorpathdelegatorYesstring
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger

      Responses

      CodeDescriptionSchema
      200OKOperationsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/delegators/{delegator}/reds


      GET

      Summary: getDelREDs

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      delegatorpathdelegatorYesstring
      isCompletedqueryisCompletedNointeger
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger

      Responses

      CodeDescriptionSchema
      200OKRedsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/delegators/{delegator}/rewards


      GET

      Summary: getDelRewards

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      delegatorpathdelegatorYesstring
      endTimequeryendTimeNolong
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger
      startTimequerystartTimeNolong

      Responses

      CodeDescriptionSchema
      200OKRewardsDetailVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/delegators/{delegator}/ubds


      GET

      Summary: getDelUBDs

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      delegatorpathdelegatorYesstring
      isCompletedqueryisCompletedNointeger
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger
      validatorqueryvalidatorNostring

      Responses

      CodeDescriptionSchema
      200OKUbdsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/next-reward-time


      GET

      Summary: getNextRewardTime

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring

      Responses

      CodeDescriptionSchema
      200OKobject
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/summary


      GET

      Summary: getSum

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring

      Responses

      CodeDescriptionSchema
      200OKStakingSumVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/validators


      GET

      Summary: getValidators

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      consensus-addressqueryconsensus-addressNostring
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger

      Responses

      CodeDescriptionSchema
      200OKValidatorsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/validators/{validator}


      GET

      Summary: getValidator

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      validatorpathvalidatorYesstring

      Responses

      CodeDescriptionSchema
      200OKValidatorDetailVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/validators/{validator}/delegations


      GET

      Summary: getDelegationsByValidator

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger
      validatorpathvalidatorYesstring

      Responses

      CodeDescriptionSchema
      200OKDelegationsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/validators/{validator}/operations


      GET

      Summary: getOperationsByValidator

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      limitquerylimit, min = 1, max = 100Yesinteger
      offsetqueryoffset, min = 0, max = 5000Yesinteger
      validatorpathvalidatorYesstring

      Responses

      CodeDescriptionSchema
      200OKOperationsVO
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/validators/{validator}/powers


      GET

      Summary: getVotingPower

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      endTimequeryendTimeYeslong
      startTimequerystartTimeYeslong
      validatorpathvalidatorYesstring

      Responses

      CodeDescriptionSchema
      200OK[ VotingPowerVO ]
      401Unauthorized
      403Forbidden
      404Not Found

      /v1/staking/chains/{chain-id}/validators/{validator}/rewards


      GET

      Summary: getValRewards

      Parameters

      NameLocated inDescriptionRequiredSchema
      chain-idpathchain-idYesstring
      endTimequeryendTimeYeslong
      startTimequerystartTimeYeslong
      validatorpathvalidatorYesstring

      Responses

      CodeDescriptionSchema
      200OK[ RewardVO ]
      401Unauthorized
      403Forbidden
      404Not Found

      Models


      AllowedDstValidatorsVO

      NameTypeDescriptionExample
      earliestCompleteTimedateTime
      totallong
      validators[ ValidatorVO ]

      BalanceVo

      NameTypeDescriptionExample
      assetstring
      delegatednumber
      unbondingnumber

      DelegationVO

      NameTypeDescriptionExample
      amountnumber
      delegatorstring
      initialTimedateTime
      validatorstring

      DelegationValVO

      NameTypeDescriptionExample
      amountnumber
      delegatorstring
      initialTimedateTime
      validatorstring
      validatorNamestring
      validatorStatusinteger0: active 1: inactive 2: inJail

      DelegationValsVO

      NameTypeDescriptionExample
      delegations[ DelegationValVO ]
      totallong

      DelegationsVO

      NameTypeDescriptionExample
      delegations[ DelegationVO ]
      totallong
      NameTypeDescriptionExample
      hrefstring
      templatedboolean
      NameTypeDescriptionExample
      Map«string,Link»object

      ModelAndView

      NameTypeDescriptionExample
      emptyboolean
      modelobject
      modelMapobject
      referenceboolean
      statusstring
      viewView
      viewNamestring

      OperationVO

      NameTypeDescriptionExample
      amountnumber
      delegatorstring
      operationTypeinteger0: delegate; 1: undelegate; 2: redelegate
      srcValidatorstring
      timedateTime
      txHashstring
      valNamestring
      validatorstring

      OperationsVO

      NameTypeDescriptionExample
      operations[ OperationVO ]
      totallong

      RedVO

      NameTypeDescriptionExample
      balancenumber
      completeHeightlong
      completeTimedateTime
      creationHeightlong
      delegatorstring
      denomstring
      dstShareslong
      dstValidatorstring
      initialBalancenumber
      srcShareslong
      srcValidatorstring

      RedsVO

      NameTypeDescriptionExample
      redelegations[ RedVO ]
      totallong

      RewardDetailVO

      NameTypeDescriptionExample
      chainIdstring
      delegatorstring
      heightlong
      rewardnumber
      rewardTimedateTime
      valNamestring
      validatorstring

      RewardVO

      NameTypeDescriptionExample
      chainIdstring
      commissionnumber
      heightlong
      rewardTimedateTime
      selfDelegatorstring
      totalRewardnumber
      valTokensnumber
      validatorstring

      RewardWithDistributionAddrVO

      NameTypeDescriptionExample
      chainIdstring
      commissionnumber
      distributionAddrstring
      heightlong
      rewardTimedateTime
      selfDelegatorstring
      totalRewardnumber
      valTokensnumber
      validatorstring

      RewardsDetailVO

      NameTypeDescriptionExample
      rewardDetails[ RewardDetailVO ]
      totallong

      RewardsWithDistributionAddrVO

      NameTypeDescriptionExample
      rewards[ RewardWithDistributionAddrVO ]
      totallong

      StakingSumVO

      NameTypeDescriptionExample
      rewardnumber
      votingPowernumber

      UbdVO

      NameTypeDescriptionExample
      balancenumber
      completeHeightlong
      completeTimedateTime
      creationHeightlong
      delegatorstring
      denomstring
      initialBalancenumber
      validatorstring

      UbdsVO

      NameTypeDescriptionExample
      totallong
      unbondingDelegations[ UbdVO ]

      ValidatorDetailVO

      NameTypeDescriptionExample
      aprnumber
      commissionMaxChangeRatenumber
      commissionMaxRatenumber
      commissionRatenumber
      detailstring
      distributionAddrstring
      identitystring
      selfDelegatorstring
      selfStakenumber
      sideConsAddrstring
      sideFeeAddrstring
      statusinteger
      valNamestring
      validatorstring
      votingPowernumber
      votingPowerProportionnumber
      websitestring

      ValidatorVO

      NameTypeDescriptionExample
      aprnumber
      commissionRatenumber
      statusinteger
      valNamestring
      validatorstring
      votingPowernumber
      votingPowerProportionnumber

      ValidatorsVO

      NameTypeDescriptionExample
      totallong
      validators[ ValidatorVO ]

      View

      NameTypeDescriptionExample
      contentTypestring

      VotingPowerVO

      NameTypeDescriptionExample
      snapshotTimedateTime
      votingPowernumber
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/ws-connection.html b/docs/beaconchain/develop/api-reference/dex-api/ws-connection.html index c701034d3a..90a47961bf 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/ws-connection.html +++ b/docs/beaconchain/develop/api-reference/dex-api/ws-connection.html @@ -8,13 +8,13 @@ - +

      WebSocket Connections

      Several data streams are exposed over standard WebSocket connections, which can be consumed by modern web browsers and server-side WebSocket libraries.

      • The base endpoint for mainnet is: wss://dex.binance.org/api/.
      • The base endpoint for testnet is: wss://testnet-dex.binance.org/api/.
      • Each connection can consume a single stream or multiple streams may be multiplexed through one connection for more complex apps.
      • All symbols in stream names are lowercase.

      Stream names may be provided in the URL or there is a mechanism to subscribe to consume streams on demand through one connection.

      Note: Once the connection is established, the websocket server will send ping frame to the client every 30 seconds. The client should reply with pong frame in time (this has already been implemented by most modern browsers, but programmatical users need to be aware of whether your websocket library supports this), otherwise, the connection might be closed.

      Examples of each of these methods are provided below in JavaScript:

      Method 1: Connect with stream names in the URL

      Using this method, stream names are specified in the URLs used to connect to the data streams:

      • Single streams /ws/<streamName>

      Mainnet Example: Various methods of connecting to streams where stream names are provided in URLs:

        // for personal streams, ex: Account & Transfers
      const accountAndOrdersFeeds = new WebSocket("wss://dex.binance.org/api/ws/<USER_ADDRESS>");

      // for all symbols
      const blockHeight = new WebSocket("wss://dex.binance.org/api/ws/$all@blockheight");

      Testnet Example: Various methods of connecting to streams where stream names are provided in URLs:

        // for personal streams, ex: Account & Transfers
      const accountAndOrdersFeeds = new WebSocket("wss://testnet-dex.binance.org/api/ws/<USER_ADDRESS>");

      // for all symbols
      const blockHeight = new WebSocket("wss://testnet-dex.binance.org/api/ws/$all@blockheight");

      Method 2: Subscribe to streams on demand

      Using this method, streams are be consumed via subscribe and unsubscribe commands, sent through a single WebSocket connection.

      Note: one connection is only allowed to subscribe to one address.

          const conn = new WebSocket("wss://dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      // send Subscribe/Unsubscribe messages here (see below)
      }
      conn.onmessage = function(evt) {
      console.info('received data', evt.data);
      };
      conn.onerror = function(evt) {
      console.error('an error occurred', evt.data);
      };

      After connecting successfully you can subscribe/unsubscribe to different topics.

      Example: To subscribe to transfer events, you should send a socket message with the subscribe payload as below:

          const conn = new WebSocket("wss://dex.binance.org/api/ws/bnb17zw3mqjx64x4dxtwqjqz5tssql6qp2m0cgv06x");
      conn.onopen = function(evt) {
      // for personal topics such as accounts & transfers, an `address` is required
      // Note: one connection is only allowed to subscribe to one address.
      // If you subscribe to a new address, regardless of whether the topic is new, the subscriptions for the previous addresses will be removed.
      conn.send(JSON.stringify({ method: "subscribe", topic: "transfers", address: "bnb17zw3mqjx64x4dxtwqjqz5tssql6qp2m0cgv06x" }));
      }

      Example: To unsubscribe from orders events, you should send a socket message with payloads as below:

          // unsubscribe from topic
      conn.send(JSON.stringify({ method: "unsubscribe", topic: "transfers" }));

      Example: To extend connection life, you should send a message with a payload using the keepAlive method:

          // This will extend the connection time to another 30 minutes
      // It's good to send this message every 30 minutes to maintain the connection life
      conn.send(JSON.stringify({ method: "keepAlive" }));

      Example: To close a connection, you should send a socket message with a payload as below:

          // Connections will auto close after 30 - 60 minutes if no "keepAlive" messages received
      // Connections with no subscriptions will be closed, regardless the keepAlive messages.
      conn.send(JSON.stringify({ method: "close" }));
      - + diff --git a/docs/beaconchain/develop/api-reference/dex-api/ws-streams.html b/docs/beaconchain/develop/api-reference/dex-api/ws-streams.html index 91413b12c5..01cb3ad4bc 100644 --- a/docs/beaconchain/develop/api-reference/dex-api/ws-streams.html +++ b/docs/beaconchain/develop/api-reference/dex-api/ws-streams.html @@ -8,13 +8,13 @@ - +

      WebSocket Streams

      1. Account

      Return account updates.

      Topic Name: accounts | Stream: /ws/address

      Mainnet Connection Example:

          // URL connection
      const accountAndOrderAndTransfers = new WebSocket("wss://dex.binance.org/api/ws/bnb1m4m9etgf3ca5wpgkqe5nr6r33a4ynxfln3yz4v");

      // Or Subscribe method
      const conn = new WebSocket("wss://dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      conn.send(JSON.stringify({ method: "subscribe", topic: "accounts", address: "bnb1m4m9etgf3ca5wpgkqe5nr6r33a4ynxfln3yz4v" }));
      }

      Testnet Connection Example:

          // URL connection
      const accountAndOrderAndTransfers = new WebSocket("wss://testnet-dex.binance.org/api/ws/tbnb1qtuf578qs9wfl0wh3vs0r5nszf80gvxd28hkrc");

      // Or Subscribe method
      const conn = new WebSocket("wss://testnet-dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      conn.send(JSON.stringify({ method: "subscribe", topic: "accounts", address: "tbnb1qtuf578qs9wfl0wh3vs0r5nszf80gvxd28hkrc" }));
      }

      Received Payload:

      {
      "stream": "accounts",
      "data": [{
      "e": "outboundAccountInfo", // Event type
      "E": 1499405658849, // Event height
      "B": [ // Balances array
      {
      "a": "LTC", // Asset
      "f": "17366.18538083", // Free amount
      "l": "0.00000000", // Locked amount
      "r": "0.00000000" // Frozen amount
      },
      {
      "a": "BTC",
      "f": "10537.85314051",
      "l": "2.19464093",
      "r": "0.00000000"
      },
      {
      "a": "ETH",
      "f": "17902.35190619",
      "l": "0.00000000",
      "r": "0.00000000"
      }
      ]
      }]
      }

      2. Transfer

      Return transfer updates if address is involved (as sender or receiver) in a transfer. Multisend is also covered

      Topic Name: transfers | Stream: /ws/address

      Mainnet Connection Example:

          // URL connection
      const accountAndOrderAndTransfers = new WebSocket("wss://dex.binance.org/api/ws/bnb1z220ps26qlwfgz5dew9hdxe8m5malre3qy6zr9");

      // Or Subscribe method
      const conn = new WebSocket("wss://dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      conn.send(JSON.stringify({ method: "subscribe", topic: "transfers", address: "bnb1z220ps26qlwfgz5dew9hdxe8m5malre3qy6zr9" }));
      }

      Testnet Connection Example:

          // URL connection
      const accountAndOrderAndTransfers = new WebSocket("wss://testnet-dex.binance.org/api/ws/tbnb1c346qk3yfk89lzcacwzxsx402rv25gu6v40ghf");

      // Or Subscribe method
      const conn = new WebSocket("wss://testnet-dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      conn.send(JSON.stringify({ method: "subscribe", topic: "transfers", address: "tbnb1c346qk3yfk89lzcacwzxsx402rv25gu6v40ghf" }));
      }

      Received Payload:

      {
      "stream": "transfers",
      "data": {
      "e":"outboundTransferInfo", // Event type
      "E":12893, // Event height
      "H":"0434786487A1F4AE35D49FAE3C6F012A2AAF8DD59EC860DC7E77123B761DD91B", // Transaction hash
      "M":"123456789", // Transaction memo, added for BEP39
      "f":"bnb1z220ps26qlwfgz5dew9hdxe8m5malre3qy6zr9", // From addr
      "t":
      [{
      "o":"bnb1xngdalruw8g23eqvpx9klmtttwvnlk2x4lfccu", // To addr
      "c":[{ // Coins
      "a":"BNB", // Asset
      "A":"100.00000000" // Amount
      }]
      }]
      }
      }

      3. Blockheight

      Streams the latest block height.

      Topic Name: blockheight | Stream: $all@blockheight

      Mainnet Connection Example:

          // URL connection
      const blockHeights = new WebSocket("wss://dex.binance.org/api/ws/$all@blockheight");

      // Or Subscribe method
      const conn = new WebSocket("wss://dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      conn.send(JSON.stringify({ method: "subscribe", topic: "blockheight", symbols: ["$all"] }));
      }

      Testnet Connection Example:

          // URL connection
      const blockHeights = new WebSocket("wss://testnet-dex.binance.org/api/ws/$all@blockheight");

      // Or Subscribe method
      const conn = new WebSocket("wss://testnet-dex.binance.org/api/ws");
      conn.onopen = function(evt) {
      conn.send(JSON.stringify({ method: "subscribe", topic: "blockheight", symbols: ["$all"] }));
      }

      Received Payload:

      {
      "stream": "blockheight",
      "data": {
      "h": 123456789, // Block height
      }
      }
      - + diff --git a/docs/beaconchain/develop/api-reference/http-api.html b/docs/beaconchain/develop/api-reference/http-api.html index e8a4002e07..c0c115cd4e 100644 --- a/docs/beaconchain/develop/api-reference/http-api.html +++ b/docs/beaconchain/develop/api-reference/http-api.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/beaconchain/develop/api-reference/node-rpc.html b/docs/beaconchain/develop/api-reference/node-rpc.html index e94f15a3e6..6b0549d54f 100644 --- a/docs/beaconchain/develop/api-reference/node-rpc.html +++ b/docs/beaconchain/develop/api-reference/node-rpc.html @@ -8,7 +8,7 @@ - + @@ -44,7 +44,7 @@ Query Parameters

      ParameterTypeDefaultRequiredDescription
      querystring""trueQuery

      Examples:

          tm.event = 'NewBlock'                               # new blocks
      tm.event = 'CompleteProposal' # node got a complete proposal
      tm.event = 'Tx' AND tx.hash = 'XYZ' # single transaction
      tm.event = 'Tx' AND tx.height = 5 # all txs of the fifth block
      tx.height = 5 # all txs of the fifth block

      Tendermint provides a few predefined keys: tm.event, tx.hash and tx.height. Note for transactions, you can define additional keys by providing tags with DeliverTx response.

              DeliverTx{
      Tags: []*KVPair{
      "agent.name": "K",
      }
      }

      tm.event = 'Tx' AND agent.name = 'K'
      tm.event = 'Tx' AND account.created_at >= TIME 2013-05-03T14:45:00Z
      tm.event = 'Tx' AND contract.sign_date = DATE 2017-01-01
      tm.event = 'Tx' AND account.owner CONTAINS 'Igor'

      See list of all possible events here

      https://godoc.org/github.com/tendermint/tendermint/types#pkg-constants

      For complete query syntax, check out

      https://godoc.org/github.com/tendermint/tendermint/libs/pubsub/query.
      import "github.com/tendermint/tendermint/libs/pubsub/query"
      import "github.com/tendermint/tendermint/types"

      client := client.NewHTTP("tcp://0.0.0.0:27147", "/websocket")
      err := client.Start()
      if err != nil {

      // handle error

      }
      defer client.Stop()
      ctx, cancel := context.WithTimeout(context.Background(), timeout)
      defer cancel()
      query := query.MustParse("tm.event = 'Tx' AND tx.height = 3")
      txs := make(chan interface{})
      err = client.Subscribe(ctx, "test-client", query, txs)

      go func() {


      for e := range txs {
      fmt.Println("got ", e.(types.EventDataTx))
      }

      }()

      The above command returns JSON structured like this:

      {


      "error": "",
      "result": {},
      "id": "",
      "jsonrpc": "2.0"

      }

      6.3.2 Unsubscribe

      Unsubscribe from events via WebSocket.

      Query Parameters

      ParameterTypeDefaultRequiredDescription
      querystring""trueQuery
      client := client.NewHTTP("tcp://0.0.0.0:27147", "/websocket")
      err := client.Start()
      if err != nil {
      // handle error
      }
      defer client.Stop()
      err = client.Unsubscribe("test-client", query)

      The above command returns JSON structured like this:

      {
      "error": "",
      "result": {},
      "id": "",
      "jsonrpc": "2.0"
      }

      6.3.3 UnsubscribeAll

      Unsubscribe from all events via WebSocket.

      client := client.NewHTTP("tcp://0.0.0.0:27147", "/websocket")
      err := client.Start()
      if err != nil {


      // handle error

      }
      defer client.Stop()
      err = client.UnsubscribeAll("test-client")

      The above command returns JSON structured like this:

      {
      "error": "",
      "result": {},
      "id": "",
      "jsonrpc": "2.0"
      }
      - + diff --git a/docs/beaconchain/develop/api-reference/transactions.html b/docs/beaconchain/develop/api-reference/transactions.html index 498509e8ad..11c4235711 100644 --- a/docs/beaconchain/develop/api-reference/transactions.html +++ b/docs/beaconchain/develop/api-reference/transactions.html @@ -8,13 +8,13 @@ - +

      Transaction Data

      A transaction in tendermint is any sequence of bytes. It's up to the ABCI application to accept or reject the transactions.

      On BNB Beacon Chain, all kinds of transactions are wrapped in type StdTx before marshalling by Amino:

      type StdTx struct {
      Msg `json:"msg"`
      Fee StdFee `json:"fee"`
      Signatures []StdSignature `json:"signatures"`
      }

      All kinds of transactions have the same type of Fee and Signatures, the difference is the msg part.

      Adding new transaction types would not require fork of blockchain, while upgrading transaction would be done via adding new transaction type: e.g. Burn2 vs. Burn.

      Order

      type Msg struct {
      From sdk.Address `json:"from"`
      Id string `json:"id"`
      Pair string `json:"pair"`
      Type int8 `json:"type"`
      Side int8 `json:"side"`
      Price int64 `json:price`
      Quantity int64 `json:"quantity"`
      TimeInForce int8 `json:"tif"
      }

      Issue Msg

      type Msg struct {
      From sdk.Address `json:"from"`
      Name string `json:"name"`
      Symbol string `json:"symbol"`
      Supply int64 `json:"supply"`
      Decimals int8 `json:"decimals"`
      }

      Burn/Freeze/Unfreeze Msg

      type Msg struct {
      From sdk.Address `json:"from"`
      Symbol string `json:"symbol"`
      Amount int64 `json:"amount"`
      }

      IssueTiny/IssueMini Msg

      type Msg struct {
      From sdk.AccAddress `json:"from"`
      Name string `json:"name"`
      Symbol string `json:"symbol"`
      TotalSupply int64 `json:"total_supply"`
      Mintable bool `json:"mintable"`
      TokenURI string `json:"token_uri"`
      }

      SetURI Msg

      type Msg struct {
      From sdk.AccAddress `json:"from"`
      Symbol string `json:"symbol"`
      TokenURI string `json:"token_uri"`
      }

      ListMini Msg

      type Msg struct {
      From sdk.AccAddress `json:"from"`
      BaseAssetSymbol string `json:"base_asset_symbol"`
      QuoteAssetSymbol string `json:"quote_asset_symbol"`
      InitPrice int64 `json:"init_price"`
      }

      Amino Types

      Amino uses 4-byte type prefixes to encode type information. This list was obtained through cdc.PrintTypes(os.Stdout).

      There is an example on how this prefix is used in JavaScript here. We should use varstruct to encode binary structures.

      More documentation is available here

      BNB Beacon Chain JavaScript SDK Amino API example

      TypeNamePrefixLengthNotes
      PubKeyEd25519tendermint/PubKeyEd255190x1624DE640x20
      PubKeySecp256k1tendermint/PubKeySecp256k10xEB5AE9870x21
      PubKeyMultisigThresholdtendermint/PubKeyMultisigThreshold0x22C1F7E2variable
      PrivKeyEd25519tendermint/PrivKeyEd255190xA32889100x40
      PrivKeySecp256k1tendermint/PrivKeySecp256k10xE1B0F79B0x20
      MsgSendcosmos-sdk/Send0x2A2C87FAvariable
      Genesisdex/Genesis0xDE082972variable
      NewOrderMsgdex/NewOrder0xCE6DC043variable
      CancelOrderMsgdex/CancelOrder0x166E681Bvariable
      ListMsgdex/ListMsg0xB41DE13Fvariable
      TradingPairdex/TradingPair0x4F88DF56variable
      FeeConfigdex/FeeConfig0xF7DB5159variable
      OrderBookSnapshotdex/OrderBookSnapshot0x48C09C8Evariable
      ActiveOrdersdex/ActiveOrders0xBB70A053variable
      RecentPricedex/RecentPrice0x278FAD64variable
      IssueMsgtokens/IssueMsg0x17EFAB80variable
      MintMsgtokens/MintMsg0x467E0829variable
      BurnMsgtokens/BurnMsg0x7ED2D2A0variable
      FreezeMsgtokens/FreezeMsg0xE774B32Dvariable
      UnfreezeMsgtokens/UnfreezeMsg0x6515FF0Dvariable
      AppAccountbnbchain/Account0x4BDC4C27variable
      Tokenbnbchain/Token0x140364E6variable
      StdTxauth/StdTx0xF0625DEEvariable
      MsgCreateValidatorcosmos-sdk/MsgCreateValidator0xEB361D01variable
      MsgCreateValidatorProposalcosmos-sdk/MsgCreateValidatorProposal0xDB6A19FDvariable
      MsgEditValidatorcosmos-sdk/MsgEditValidator0xC2E8BCCDvariable
      MsgDelegatecosmos-sdk/MsgDelegate0x921D2E4Evariable
      MsgBeginUnbondingcosmos-sdk/BeginUnbonding0xA3823C9Avariable
      MsgBeginRedelegatecosmos-sdk/BeginRedelegate0x267996D2variable
      MsgSubmitProposalcosmos-sdk/MsgSubmitProposal0xB42D614Evariable
      MsgDepositcosmos-sdk/MsgDeposit0xA18A56E5variable
      MsgVotecosmos-sdk/MsgVote0xA1CADD36variable
      TextProposalgov/TextProposal0xACCBA2DEvariable
      FixedFeeParamsparams/FixedFeeParams0xC2A96FA3variable
      TransferFeeParamparams/TransferFeeParams0x9A3D2769variable
      DexFeeParamparams/DexFeeParam0x495A5044variable
      MiniTokenbnbchain/MiniToken0xE0051C20variable
      ListMiniMsgdex/ListMiniMsg0x4C264019variable
      IssueMiniMsgtokens/IssueMiniMsg0xA3F16C41variable
      IssueTinyMsgtokens/IssueTinyMsg0xED2832D4variable
      SetURIMsgtokens/SetURIMsg0x7B1D34E7variable
      - + diff --git a/docs/beaconchain/develop/bcsdk.html b/docs/beaconchain/develop/bcsdk.html index 63e7ec2860..be04419098 100644 --- a/docs/beaconchain/develop/bcsdk.html +++ b/docs/beaconchain/develop/bcsdk.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/beaconchain/develop/node/extra-info.html b/docs/beaconchain/develop/node/extra-info.html index 715a387244..84a895d7b9 100644 --- a/docs/beaconchain/develop/node/extra-info.html +++ b/docs/beaconchain/develop/node/extra-info.html @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ Then, the full node will save messages that you are interested into Kafka, and you can consume them in your own apps.
      The message is encoded based on Avro serialization system.
      Their schemas are shown below:

      • OrderUpdates:
      {
      "type": "record",
      "name": "ExecutionResults",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "height", "type": "long" },
      { "name": "timestamp", "type": "long" },
      { "name": "numOfMsgs", "type": "int" },
      { "name": "trades", "type": ["null", {
      "type": "record",
      "name": "Trades",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "numOfMsgs", "type": "int" },
      { "name": "trades", "type": {
      "type": "array",
      "items":
      {
      "type": "record",
      "name": "Trade",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "symbol", "type": "string" },
      { "name": "id", "type": "string" },
      { "name": "price", "type": "long" },
      { "name": "qty", "type": "long" },
      { "name": "sid", "type": "string" },
      { "name": "bid", "type": "string" },
      { "name": "sfee", "type": "string" },
      { "name": "bfee", "type": "string" },
      { "name": "saddr", "type": "string" },
      { "name": "baddr", "type": "string" }
      ]
      }
      }
      }
      ]
      }], "default": null },
      { "name": "orders", "type": ["null", {
      "type": "record",
      "name": "Orders",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "numOfMsgs", "type": "int" },
      { "name": "orders", "type": {
      "type": "array",
      "items":
      {
      "type": "record",
      "name": "Order",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "symbol", "type": "string" },
      { "name": "status", "type": "string" },
      { "name": "orderId", "type": "string" },
      { "name": "tradeId", "type": "string" },
      { "name": "owner", "type": "string" },
      { "name": "side", "type": "int" },
      { "name": "orderType", "type": "int" },
      { "name": "price", "type": "long" },
      { "name": "qty", "type": "long" },
      { "name": "lastExecutedPrice", "type": "long" },
      { "name": "lastExecutedQty", "type": "long" },
      { "name": "cumQty", "type": "long" },
      { "name": "fee", "type": "string" },
      { "name": "orderCreationTime", "type": "long" },
      { "name": "transactionTime", "type": "long" },
      { "name": "timeInForce", "type": "int" },
      { "name": "currentExecutionType", "type": "string" },
      { "name": "txHash", "type": "string" }
      ]
      }
      }
      }
      ]
      }], "default": null },
      { "name": "proposals", "type": ["null", {
      "type": "record",
      "name": "Proposals",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "numOfMsgs", "type": "int" },
      { "name": "proposals", "type": {
      "type": "array",
      "items":
      {
      "type": "record",
      "name": "Proposal",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "id", "type": "long" },
      { "name": "status", "type": "string" }
      ]
      }
      }
      }
      ]
      }], "default": null },
      { "name": "stakeUpdates", "type": ["null", {
      "type": "record",
      "name": "StakeUpdates",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "numOfMsgs", "type": "int" },
      { "name": "completedUnbondingDelegations", "type": {
      "type": "array",
      "items":
      {
      "type": "record",
      "name": "CompletedUnbondingDelegation",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "validator", "type": "string" },
      { "name": "delegator", "type": "string" },
      { "name": "amount", "type": {
      "type": "record",
      "name": "Coin",
      "namespace": "org.binance.dex.model.avro",
      "fields": [
      { "name": "denom", "type": "string" },
      { "name": "amount", "type": "long" }
      ]
      }
      }
      ]
      }
      }
      }
      ]
      }], "default": null }
      ]
      }
      • OrderBooksSchema:
      {
      "type": "record",
      "name": "Books",
      "namespace": "com.company",
      "fields": [
      { "name": "height", "type": "long" },
      { "name": "timestamp", "type": "long" },
      { "name": "numOfMsgs", "type": "int" },
      { "name": "books", "type": {
      "type": "array",
      "items":
      {
      "type": "record",
      "name": "OrderBookDelta",
      "namespace": "com.company",
      "fields": [
      { "name": "symbol", "type": "string" },
      { "name": "buys", "type": {
      "type": "array",
      "items": {
      "type": "record",
      "name": "PriceLevel",
      "namespace": "com.company",
      "fields": [
      { "name": "price", "type": "long" },
      { "name": "lastQty", "type": "long" }
      ]
      }
      } },
      { "name": "sells", "type": {
      "type": "array",
      "items": "com.company.PriceLevel"
      } }
      ]
      }
      }, "default": []
      }
      ]
      }
      • AccountBalanceSchema:
      {
      "type": "record",
      "name": "Accounts",
      "namespace": "com.company",
      "fields": [
      { "name": "height", "type": "long" },
      { "name": "numOfMsgs", "type": "int" },
      { "name": "accounts", "type": {
      "type": "array",
      "items":
      {
      "type": "record",
      "name": "Account",
      "namespace": "com.company",
      "fields": [
      { "name": "owner", "type": "string" },
      { "name": "fee", "type": "string" },
      { "name": "balances", "type": {
      "type": "array",
      "items": {
      "type": "record",
      "name": "AssetBalance",
      "namespace": "com.company",
      "fields": [
      { "name": "asset", "type": "string" },
      { "name": "free", "type": "long" },
      { "name": "frozen", "type": "long" },
      { "name": "locked", "type": "long" }
      ]
      }
      }
      }
      ]
      }
      }, "default": []
      }
      ]
      }

      • BlockFeeSchema:
      {
      "type": "record",
      "name": "BlockFee",
      "namespace": "com.company",
      "fields": [
      { "name": "height", "type": "long"},
      { "name": "fee", "type": "string"},
      { "name": "validators", "type": { "type": "array", "items": "string" }}
      ]
      }
      • TransfersSchema:
      {
      "type": "record",
      "name": "Transfers",
      "namespace": "com.company",
      "fields": [
      { "name": "height", "type": "long"},
      { "name": "num", "type": "int" },
      { "name": "timestamp", "type": "long" },
      { "name": "transfers",
      "type": {
      "type": "array",
      "items": {
      "type": "record",
      "name": "Transfer",
      "namespace": "com.company",
      "fields": [
      { "name": "txhash", "type": "string" },
      { "name": "from", "type": "string" },
      { "name": "to",
      "type": {
      "type": "array",
      "items": {
      "type": "record",
      "name": "Receiver",
      "namespace": "com.company",
      "fields": [
      { "name": "addr", "type": "string" },
      { "name": "coins",
      "type": {
      "type": "array",
      "items": {
      "type": "record",
      "name": "Coin",
      "namespace": "com.company",
      "fields": [
      { "name": "denom", "type": "string" },
      { "name": "amount", "type": "long" }
      ]
      }
      }
      }
      ]
      }
      }
      }
      ]
      }
      }
      }
      ]
      }
      - + diff --git a/docs/beaconchain/develop/node/fullnode-faq.html b/docs/beaconchain/develop/node/fullnode-faq.html index ea0a1f4c7c..a40df7e3f7 100644 --- a/docs/beaconchain/develop/node/fullnode-faq.html +++ b/docs/beaconchain/develop/node/fullnode-faq.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ To reset node:

      rm $BNCHOME/data

      rm $BNCHOME/config/priv_validator_key.json

      Then, start again.

      Peer connection error

      • Error log:
      E[2019-04-17|23:52:24.069] Connection failed @ recvRoutine (reading byte) module=p2p peer=[aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146](http://aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146)conn=MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} err=EOF
      E[2019-04-17|23:52:24.070] Stopping peer for error module=p2p peer=&quot;Peer{MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} aea74b16d28d06cbfbb1179c177e8cd71315cce4 out}&quot; err=EOF

      This error is caused by the handshake failing between two peers.

      • Solution

      To solve this problem, you need to make sure node_key.json is under $BNCHOME/config and nodes will try to re-connect automatically, so this issue should not persist.

      Connection Timeout

      • Error log
      Dialing failed module=pex addr=2c1fa9c1698961da38d8cd50da9fe8b4bc433c50@34.202.245.91:26856 err=&quot;dial tcp 34.202.245.91:26856: i/o timeout&quot; attempts=3
      • Solution

      Check your internet connection and make sure it is stable.

      Out of memory

      • Error Log
      fatal error: out of memory
      • Solution

      Your machine must have more than 8 GB of memory, otherwise, it will not handle DB restoration during state sync.

      No priv_validator_state.json after reset

      • Error log
      open /Users/.bnbchaind/data/priv_validator_state.json: no such file or directory
      • Solution

      Delete both priv_validator_state.json & node_key.json file and data folder if you want to reset your full node.

      bnbchaind crashes because of too many open files

      The default number of files Linux can open (per-process) is 1024.
      bnbchaind is likely to open more than 1024 files.
      This causes the process to crash.

      A quick fix is to run ulimit -n 65535 (increase the number of open files allowed) and then restart the process with:

      bnbchaind start

      Verify the number of open files:

      ulimit -a
      core file size (blocks, -c) 0
      data seg size (kbytes, -d) unlimited
      scheduling priority (-e) 0
      file size (blocks, -f) unlimited
      pending signals (-i) 3829
      max locked memory (kbytes, -l) 64
      max memory size (kbytes, -m) unlimited
      open files (-n) 65535
      pipe size (512 bytes, -p) 8
      POSIX message queues (bytes, -q) 819200
      real-time priority (-r) 0
      stack size (kbytes, -s) 8192
      cpu time (seconds, -t) unlimited
      max user processes (-u) 3829
      virtual memory (kbytes, -v) unlimited
      file locks (-x) unlimited

      Please note that open files are different now.

      Forget to Upgrade

      The BNB Beacon Chain has a hardfork upgrade and if you failed to upgrade your fullnode to the latest version, bnbchaind process will stop and even if you restart with the latest version, the following error will appear:

      panic: Tendermint state.AppHash does not match AppHash after replay. Got , expected 393887B67F69B19CAB5C48FB87B4966018ABA893FB3FFD241C0A94D2C8668DD2
      goroutine 1 [running]:
      github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.checkAppHash(0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, 0x20, ...)
      /Users/huangsuyu/go/src/github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus/replay.go:464 +0x213
      github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc000b37980, 0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, ...)

      To recover from the state conflict error, you need to:

      • Backup your home directory, (default is ~/.bnbchaind)

      • Download the tool: state-recover

      • Get the height of upgrade, this height will be announced in the upgrade announcement on the forum. For example, if it's announced as 5000 in the forum and run the following command will make your full node recover to the last block before the upgrade, and that is 4999 :

      ./state_recover 4999 <your_home_path>
      • Restart with the latest version of bnbchaind
      bnbchaind start &

      bnbchaind is not properly killed

      If you started your bnbchaind process after it was not properly killed. You will see the following error:

      panic: ERROR:
      Codespace: 5
      Code: 9
      Message: "Initial ProposalID already set"

      To recover, please reset your node and restart:

      bnbchaind unsafe-reset-all --home<your-home-dir>

      Cannot start bnbchaind

      If you do not download the binaries completely, you will see the following message:

      ./bnbchaind: line 1: version: command not found ./bnbchaind: line 2: oid: command not found /Library/Developer/CommandLineTools/usr/bin/size: 45160816 No such file or directory

      Since the old binaries are stored in git lfs previously, you will see this error if the binary is not complete. Please use this repo to download the binaries.

      Cannot query a specific block

      Once you have your own node running, you can start querying from it. But sometimes you may not be ablt to get the information you want. For example:

      curl 'localhost:27147/block?height=10'

      The reason is because your node is using statesync to catch up. In this way, it will not store all the history blocks before the snapshot height it got. You can only query blocks after that snapshot height.

      To enable query history blocks, you need to use fast-sync

      Cannot query a specific transaction by height

      In some cases, you can search for the transactions in the same block by querying a fullnode. For example,

      curl "localhost:27147/tx_search?query="tx.height=1000000"&prove=true"

      But sometimes, you may not get anything even though there are actually transactions in this block.

      {
      "jsonrpc": "2.0",
      "id": "",
      "result": {
      "txs": [],
      "total_count": "0"
      }
      }

      The reason is that you didn't enable transaction height indexer. To enable this indexer, you need to make the following changes in your config.toml file:

      index_tags= "tx.hash,tx.height"

      Meanwhile, if you wish to enable range query, you also need to enable that setting in config.toml

      enable_range_query = true

      In this way, you can use Operator ["<", ">", ">=", "<="] in your query. For example,

      curl "http://localhost:27147/tx_search?query=\"tx.height>59970127 AND tx.height<59973127\"&prove=true"
      - + diff --git a/docs/beaconchain/develop/node/fullnodeissue.html b/docs/beaconchain/develop/node/fullnodeissue.html index 24d6c82e3d..49c6136142 100644 --- a/docs/beaconchain/develop/node/fullnodeissue.html +++ b/docs/beaconchain/develop/node/fullnodeissue.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ To reset node:

      rm $BNCHOME/data

      rm $BNCHOME/config/priv_validator_key.json

      Then, start again.

      Peer connection error

      • Error log:
      E[2019-04-17|23:52:24.069] Connection failed @ recvRoutine (reading byte) module=p2p peer=[aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146](http://aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146)conn=MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} err=EOF
      E[2019-04-17|23:52:24.070] Stopping peer for error module=p2p peer=&quot;Peer{MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} aea74b16d28d06cbfbb1179c177e8cd71315cce4 out}&quot; err=EOF

      This error is caused by the handshake failing between two peers.

      • Solution

      To solve this problem, you need to make sure node_key.json is under $BNCHOME/config and nodes will try to re-connect automatically, so this issue should not persist.

      Connection Timeout

      • Error log
      Dialing failed module=pex addr=2c1fa9c1698961da38d8cd50da9fe8b4bc433c50@34.202.245.91:26856 err=&quot;dial tcp 34.202.245.91:26856: i/o timeout&quot; attempts=3
      • Solution

      Check your internet connection and make sure it is stable.

      Out of memory

      • Error Log
      fatal error: out of memory
      • Solution

      Your machine must have more than 8 GB of memory, otherwise, it will not handle DB restoration during state sync.

      No priv_validator_state.json after reset

      • Error log
      open /Users/.bnbchaind/data/priv_validator_state.json: no such file or directory
      • Solution

      Delete both priv_validator_state.json & node_key.json file and data folder if you want to reset your full node.

      bnbchaind crashes because of too many open files

      The default number of files Linux can open (per-process) is 1024.
      bnbchaind is likely to open more than 1024 files.
      This causes the process to crash.

      A quick fix is to run ulimit -n 65535 (increase the number of open files allowed) and then restart the process with:

      bnbchaind start

      Verify the number of open files:

      ulimit -a
      core file size (blocks, -c) 0
      data seg size (kbytes, -d) unlimited
      scheduling priority (-e) 0
      file size (blocks, -f) unlimited
      pending signals (-i) 3829
      max locked memory (kbytes, -l) 64
      max memory size (kbytes, -m) unlimited
      open files (-n) 65535
      pipe size (512 bytes, -p) 8
      POSIX message queues (bytes, -q) 819200
      real-time priority (-r) 0
      stack size (kbytes, -s) 8192
      cpu time (seconds, -t) unlimited
      max user processes (-u) 3829
      virtual memory (kbytes, -v) unlimited
      file locks (-x) unlimited

      Please note that open files are different now.

      Forget to Upgrade

      The BNB Beacon Chain has a hardfork upgrade and if you failed to upgrade your fullnode to the latest version, bnbchaind process will stop and even if you restart with the latest version, the following error will appear:

      panic: Tendermint state.AppHash does not match AppHash after replay. Got , expected 393887B67F69B19CAB5C48FB87B4966018ABA893FB3FFD241C0A94D2C8668DD2
      goroutine 1 [running]:
      github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.checkAppHash(0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, 0x20, ...)
      /Users/huangsuyu/go/src/github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus/replay.go:464 +0x213
      github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc000b37980, 0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, ...)

      To recover from the state conflict error, you need to:

      • Backup your home directory, (default is ~/.bnbchaind)

      • Download the tool: state-recover

      • Get the height of upgrade, this height will be announced in the upgrade announcement on the forum. For example, if it's announced as 5000 in the forum and run the following command will make your full node recover to the last block before the upgrade, and that is 4999 :

      ./state_recover 4999 <your_home_path>
      • Restart with the latest version of bnbchaind
      bnbchaind start &

      bnbchaind is not properly killed

      If you started your bnbchaind process after it was not properly killed. You will see the following error:

      panic: ERROR:
      Codespace: 5
      Code: 9
      Message: "Initial ProposalID already set"

      To recover, please reset your node and restart:

      bnbchaind unsafe-reset-all --home<your-home-dir>

      Cannot start bnbchaind

      If you do not download the binaries completely, you will see the following message:

      ./bnbchaind: line 1: version: command not found ./bnbchaind: line 2: oid: command not found /Library/Developer/CommandLineTools/usr/bin/size: 45160816 No such file or directory

      Since the old binaries are stored in git lfs previously, you will see this error if the binary is not complete. Please use this repo to download the binaries.

      Cannot query a specific block

      Once you have your own node running, you can start querying from it. But sometimes you may not be ablt to get the information you want. For example:

      curl 'localhost:27147/block?height=10'

      The reason is because your node is using statesync to catch up. In this way, it will not store all the history blocks before the snapshot height it got. You can only query blocks after that snapshot height.

      To enable query history blocks, you need to use fast-sync

      - + diff --git a/docs/beaconchain/develop/node/install.html b/docs/beaconchain/develop/node/install.html index cd90e98b30..90cdde14c3 100644 --- a/docs/beaconchain/develop/node/install.html +++ b/docs/beaconchain/develop/node/install.html @@ -8,13 +8,13 @@ - +

      Install Binaries

      This guide will explain how to install the binaries: bnbchaind and bnbcli, onto your server. With these installed on a server, you can participate in the mainnet or testnet as a Full Node. Full Nodes of BNB Beacon Chain also help the network by accepting transactions from other nodes and then relaying them to the core BNB Chain network.

      Supported Platforms

      We support running a full node on Mac OS, Windows and Linux.

      Please go to changelog to get the information about the latest release of full node version.

      Option One: Download the pre-build binaries

      1. Download from the release page or follow below.
      # Linux
      wget $(curl -s https://api.github.com/repos/bnb-chain/node/releases/latest |grep browser_ |grep linux_binary |cut -d\" -f4)
      unzip linux_binary.zip

      # MacOS
      wget $(curl -s https://api.github.com/repos/bnb-chain/node/releases/latest |grep browser_ |grep macos_binary |cut -d\" -f4)
      unzip macos_binary.zip

      # Windows
      wget $(curl -s https://api.github.com/repos/bnb-chain/node/releases/latest |grep browser_ |grep windows_binary |cut -d\" -f4)
      unzip windows_binary.zip
      1. Copy the executables (i.e.bnbchaind or bnbcli) to /usr/local/bin
      2. Verify that everything is OK:
      $ bnbchaind version
      $ bnbcli version

      Option Two: Build binaries on your machine

      1. Execute below commands.
      git clone https://github.com/bnb-chain/node.git
      cd node && make build

      Then you will get binaries in ./build/ folder.

      1. Copy the executables (i.e.bnbchaind or bnbcli) to /usr/local/bin
      2. Verify that everything is OK:
      $ bnbchaind version
      $ bnbcli version

      Next

      Now you can join the mainnet, the public testnet or create you own testnet

      - + diff --git a/docs/beaconchain/develop/node/join-mainnet.html b/docs/beaconchain/develop/node/join-mainnet.html index 641fedf9af..1f89e35846 100644 --- a/docs/beaconchain/develop/node/join-mainnet.html +++ b/docs/beaconchain/develop/node/join-mainnet.html @@ -8,7 +8,7 @@ - + @@ -20,7 +20,7 @@ The latest log file is bnc.log. The process will create a new log file every one hour. To make sure you have sufficient disk space to keep the log files, we strongly recommend you to change the log location by changing logFileRoot option in $BNCHOME/config/app.toml.
    • Service Port: RPC service listens on port 27147 and P2P service listens on port 27146 by default. Make sure these two ports are open before starting a full node, unless the full node has to listen on other ports.
    • Store: All the state and block data will store under $BNCHOME/data, do not delete or edit any of these files.

    Get Extra Information From Your Fullnode

    If you have a Full Node running, then you can publish extra messages to local files.

    Monitor Syncing Process

    You can verify if state sync is done by curl localhost:27147/status several times and see whether latest_block_height is increasing in response.

    "sync_info": {
    ...
    "latest_block_height": "878092",
    "latest_block_time": "2019-04-15T00:01:22.610803768Z",
    ...
    }

    Prometheus Metrics

    Prometheus is enabled on port 28660 by default, and the endpoint is /metrics.

    Mainnet Tools

    - + diff --git a/docs/beaconchain/develop/node/join-testnet.html b/docs/beaconchain/develop/node/join-testnet.html index ed0788854e..b7c5bc2a85 100644 --- a/docs/beaconchain/develop/node/join-testnet.html +++ b/docs/beaconchain/develop/node/join-testnet.html @@ -8,7 +8,7 @@ - + @@ -18,8 +18,8 @@ If those seeds aren't working, you can find more seeds and persistent peers in the HTTP API endpoints: https://testnet-dex.binance.org/api/v1/peers
  • Sync type: By default, new nodes will sync with state-sync mode. To change sync mode, read the instructions here
  • Log: The log file is under home- the directory specified when starting bnbchaind. The latest log file is bnc.log. The process will create a new log file every one hour. To make sure you have sufficient disk space to keep the log files, we strongly recommend you to change the log location by changing logFileRoot option in $BNCHOME/config/app.toml.
  • Service Port: RPC service listens on port 27147 and P2P service listens on port 27146 by default. -Make sure these two ports are open before starting a full node, unless the full node has to listen on other ports.
  • Store: All the state and block data will store under $BNCHOME/data, do not delete or edit any of these files.

Get Extra Information From Your Fullnode

If you have a Full Node running, then you can publish extra messages to local files.

Monitor Syncing Process

You can verify if state sync is done by curl localhost:27147/status several times and see whether latest_block_height is increasing in response.

"sync_info": {
...
"latest_block_height": "878092",
"latest_block_time": "2019-04-15T00:01:22.610803768Z",
...
}

Prometheus Metrics

Prometheus is enabled on port 28660 by default, and the endpoint is /metrics.

Testnet Tools

- +Make sure these two ports are open before starting a full node, unless the full node has to listen on other ports.
  • Store: All the state and block data will store under $BNCHOME/data, do not delete or edit any of these files.
  • Get Extra Information From Your Fullnode

    If you have a Full Node running, then you can publish extra messages to local files.

    Monitor Syncing Process

    You can verify if state sync is done by curl localhost:27147/status several times and see whether latest_block_height is increasing in response.

    "sync_info": {
    ...
    "latest_block_height": "878092",
    "latest_block_time": "2019-04-15T00:01:22.610803768Z",
    ...
    }

    Prometheus Metrics

    Prometheus is enabled on port 28660 by default, and the endpoint is /metrics.

    Testnet Tools

    + diff --git a/docs/beaconchain/develop/node/localnetwork.html b/docs/beaconchain/develop/node/localnetwork.html index 9935d9b0c7..3ccbbb895f 100644 --- a/docs/beaconchain/develop/node/localnetwork.html +++ b/docs/beaconchain/develop/node/localnetwork.html @@ -8,14 +8,14 @@ - +

    Run a Local Testnet

    Single-node on Local Testnet

    This guide helps you create a single validator node that runs a network locally for testing and other development related uses.

    Requirements

    Create Genesis File and Start the Network

    # You can run all of these commands from your home directory
    cd $HOME
    1. Initialize the config.toml file that will help you to bootstrap the network
    bnbchaind init --home /Users/huangsuyu/Documents/work/localnet --moniker test
    1. Initialize the genesis file that will help you to bootstrap the network bnbchaind testnet --v 1 --chain-id local-testnet

    2. Copy genesis.json and others to $home/config

    cp ./mynetwork/config/genesis $home/config
    1. Edit app.toml to set ugrade height
    FixSignBytesOverflowHeight = 1
    1. Start our node
    # Now its safe to start `bnbchaind`
    bnbchaind start --home $home
    - + diff --git a/docs/beaconchain/develop/node/nodetypes.html b/docs/beaconchain/develop/node/nodetypes.html index e17021dfcb..e6f2f300ff 100644 --- a/docs/beaconchain/develop/node/nodetypes.html +++ b/docs/beaconchain/develop/node/nodetypes.html @@ -8,7 +8,7 @@ - + @@ -23,7 +23,7 @@ at the same time around the world (owned by different organizations) and you are encouraged to choose one of them to use, or allow your Wallet choose one randomly.
    For rapid API access, you'd better stay with one Accelerated Node to get better performance.

    For mainnet, there are more accelerated nodes.

    • dex-atlantic.binance.org
    • dex-asiapacific.binance.org
    • dex-european.binance.org

    For testnet, there are 2 accelerated nodes setup as below. API users should try to use them directly.

    • testnet-dex-atlantic.binance.org
    • testnet-dex-asiapacific.binance.org

    To see the existing endpoints provided by Accelerated node, check the list here!

    - + diff --git a/docs/beaconchain/develop/node/snapshot.html b/docs/beaconchain/develop/node/snapshot.html index d53cbd115d..63468b6a52 100644 --- a/docs/beaconchain/develop/node/snapshot.html +++ b/docs/beaconchain/develop/node/snapshot.html @@ -8,14 +8,14 @@ - +

    Chain Data Snapshots

    A snapshot is a recording of the state of BNB Beacon Chain at a particular block height.

    Latest snapshot of April 1st: download

    Size: 588 GB

    sha1sum: 397796fe4886a59601f6aa21fcca44b852c057bb

    Latest snapshot of March 1st: download

    Size: 565 GB

    sha1sum: 0caf6f8df5c9106a8195e29c97feb34ac9498bb9

    Latest snapshot of February 1st: download

    Size: 528 GB

    sha256sum: b859f90fd487be0ec9d5d50e6641af659fd199c94ad536eeeeb084d50c32f3a6

    Latest snapshot of December 1st: download

    Size: 478 GB

    sha256sum: 04fc2f6c0dd0e9958d4b4c30cab0fd6eab18e20b612ec018d1917a87994e6732

    Latest snapshot of November 1st: download

    Size: 444 GB

    sha256sum: e1687272467355bee1034b7ab23a6f6ca2249441a6a300e10026a214fc925f57

    Latest snapshot of Sep 1st: download

    Size: 409 GB

    sha256sum: 194cbad7e1adcaafc16df94576f0a3b4a26245e4019cef93c51a3183bef71d73

    Latest snapshot of July 1st: download

    Size: 353 GB

    Snapshot of June 1st: download

    Size: 309 GB

    sha256sum: c6ba5edbf1b424696eec670f4dad864e09ebbae46c3c127360e1d1f15e27d4df)

    This snapshot can be used for jumpstarting a newly setup fullnode to avoid waiting a long time for getting all blocks. In BNB Beacon Chain , the average block time is less than a second. As a result, it will take several weeks to sync from genesis block.

    !!! Note Ensure there is enough disk space for both the tar file AND its uncompressed contents. Double the space or more.

    1. Download Archive

    nohup curl -s https://s3.ap-northeast-1.amazonaws.com/dex-bin.bnbstatic.com/s3-witness-data-download/data_20200909.tgz\?AWSAccessKeyId=\AKIAYINE6SBQPUZDDRRO\&Expires=\1625569110\&Signature=\%2BotMZCFW7bRSaK4DdRW6Qe3a4bw%3D > data_20200909.tgz &

    1. Extract File to replace the contents under data folder of home directory
    tar -xzf data_20200909.tgz -d $HOME/data
    1. Start your node
    bnbchaind start
    - + diff --git a/docs/beaconchain/develop/node/synctypes.html b/docs/beaconchain/develop/node/synctypes.html index 1bcf3e6bd7..9ffa41d353 100644 --- a/docs/beaconchain/develop/node/synctypes.html +++ b/docs/beaconchain/develop/node/synctypes.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Different Sync Types

    There are three ways for you to get synced with other peers in blockchain network and these methods can be used together.

    • Fast Sync
    • State Sync
    • Hot Sync

    Fast Sync

    In fast sync, you need to download all the blocks from your peers and execute all the transactions in every block. The sync speed is about 20 blocks/sec, which is slower than state sync.

    Configuration is located in $BNCHOME/config/config.toml:

    • fast_sync Must be set to true
    • state_sync_reactor Can be set to false or true
    • state_sync Can be set to false or true

    State Sync

    The default way to get newly joined Full Node syncing with other Full Node is state sync. Once your Full Node is synced to a snapshot, it will switch to fast-sync mode to catch up with its peers.

    State sync can help fullnode in same status with other peers within short time (according to our test, a one month ~800M DB snapshot in BNB Beacon Chain testnet can be synced in around 45 minutes). As explained in BEP18, State sync will get the application state of your full node to be up to date without downloading all of the blocks.The sync speed is faster than fast sync. Now you do not need to allocate more memories to your full node for this feature to work.

    Configuration is located in $BNCHOME/config/config.toml:

    • state_sync_reactor Must be set to true
    • recv_rate Must set to 102428800
    • ping_interval Recommendation is set to 10m30s
    • pong_timeout Recommendation is set to 450s
    • state_sync_height Recommendation is set to 0, so it allows to state sync from the peers's latest height.

    State sync can help you receive latest blocks/transactions and query latest status of orderbook, account balances etc.. But state sync DOES NOT download historical blocks before state sync height, if you start your node with state sync and it synced at height 10000, then your local database would only have blocks after height 10000.

    Switch From Fast Sync to State Sync

    If full node has already started, suggested way is to delete the (after backup) $BNCHOME/data directory and $BNCHOME/config/priv_validator_key.json before enabling state sync.

    If you turn on the state_sync_reactor, the snapshots of heights will be saved at $HOME/data/snapshot/ automatically. To save disk space, you can delete the directory or turn off the state_sync_reactor.

    Recover From State Sync Failure

    If state sync did not succeed, please repeat deletion of $BNCHOME/data directory and $BNCHOME/config/priv_validator_key.json before starting full node next time in case of data inconsistency.

    Skip Blocks in State Sync

    Once state sync succeeded, later full node restart would not state sync anymore (in case the local blocks are not continuous). But if you do want state sync again (don't care that there are missing blocks between last stop and latest state sync snapshot) and you want to keep already synced blocks, you can just delete $BNCHOME/data/STATESYNC.LOCK.

    For example, you start your full node at Jan 1st with state sync at height 10000 and after a while you shut it down at height 22000 on Feb 10th. Now its Mar 1st, latest sync-able block height is 50000, you don't care blocks between 22000 and 50000, you can delete $BNCHOME/data/STATESYNC.LOCK before start your node. Then the full node would continue state sync from height 50000.

    Turning off state_sync_reactor and state_sync can save your memory after you successfully state synced.

    Hot Sync

    In BNB Beacon Chain network, almost every fullnode operator will first enable state-sync to get synced with peers. After downloading all the state machine changes, the fullnode will go back to fast-sync mode and eventually in consensus mode. In fast-sync mode, the fullnode will have high delay because it needs to be aware of peers’ heights. It downloads all the blocks in parallel and verifying their commits. On the other hand, when a fullnode is under consensus state, it will consume a lot of bandwidth and CPU resources because it receives a lot of redundant messages for consensus engine and writes more WAL. To increase the efficiency for fullnodes, the hot-sync protocol is introduced. A fullnode under hot-sync protocol will pull the blocks from its peers and it will subscribe these blocks in advance. It will skip the message for prevotes and only subscribe to maj23 precommit and block proposal messages. At the same time, it will put its peers in different buckets and subscribe to peers in active buckets. Hot-Sync can help fullnodes gossip blocks in low latency, while cost less network, memory, cpu and disk resources than Tendermint consensus protocol. Even cheap hardware can easily run a fullnode, and a fullnode can connect with more peers than before by saving network and CPU resources.

    The state transition of a hot sync reactor can be of three part:

                                  Hot --> Consensus
    ^ ^
    | /
    | /
    Mute
    1. Mute: will only answer subscribe requests from others, will not sync from others or from consensus reactor. The Hot Sync reactor stays in Mute when it is fast syncing.
    2. Hot: handle subscribe requests from other peers as a publisher, also subscribe block messages from other peers as a subscriber. A non-validators will stay in Hot when the peer have catch up after fast syncing.
    3. Consensus: handle subscribes requests from other peers as a publisher, but get block/commit message from consensus reactor. A sentry node should stay in Consensus. Or a non-validator should switch from Hot to Consensus when it become a validator.

    Configuration is located in $BNCHOME/config/config.toml:

    • hot_sync_reactor Must be set to true
    • hot_sync Can be set to false or true
    • hot_sync_timeout is the max wait time for subscribe a block. It only takes effect when hot_sync is true
    - + diff --git a/docs/beaconchain/develop/node/upgrade.html b/docs/beaconchain/develop/node/upgrade.html index a45fe71157..1432d53cc0 100644 --- a/docs/beaconchain/develop/node/upgrade.html +++ b/docs/beaconchain/develop/node/upgrade.html @@ -8,13 +8,13 @@ - +

    Upgrade

    Please follow our official channels to get the latest news about upcoming upgrades.

    Upgrading Full Node

    Many of BNB Beacon Chain upgrades are hardfork ones. If so, you have to finish the upgrade steps before the hardfork block height.

    1. If your node is already synced with the network, please download the new binary and replace the previous version
    2. Replace the config.toml and app.toml under home folder with the latest versions. You can customize those parameters.
    3. Stop the bnbchaind process and restart it with the new one.
    bnbchaind start --home <home-path>

    Forgot to Upgrade

    The BNB Beacon Chain has a hardfork upgrade and if you failed to upgrade your fullnode to the latest version, bnbchaind process will stop and even if you restart with the latest version, the following error will appear:

    panic: Tendermint state.AppHash does not match AppHash after replay. Got , expected 393887B67F69B19CAB5C48FB87B4966018ABA893FB3FFD241C0A94D2C8668DD2
    goroutine 1 [running]:
    github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.checkAppHash(0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, 0x20, ...)
    /Users/huangsuyu/go/src/github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus/replay.go:464 +0x213
    github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc000b37980, 0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, ...)

    To recover from the state conflict error, you need to:

    • Backup your home directory, (default is ~/.bnbchaind)

    • Download the tool: state-recover

    • Get the height of upgrade, this height will be announced in the upgrade announcement on the forum. For example, if it's announced as 5000 in the forum and run the following command will make your full node recover to the last block before the upgrade, and that is 4999 :

    ./state_recover 4999 <your_home_path>
    • Restart with the latest version of bnbchaind
    bnbchaind start &
    - + diff --git a/docs/beaconchain/develop/rpc.html b/docs/beaconchain/develop/rpc.html index 17dd8caf73..5b424df067 100644 --- a/docs/beaconchain/develop/rpc.html +++ b/docs/beaconchain/develop/rpc.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/beaconchain/develop/testnetandexplorer.html b/docs/beaconchain/develop/testnetandexplorer.html index 0f0f0e7d2d..3515bf003d 100644 --- a/docs/beaconchain/develop/testnetandexplorer.html +++ b/docs/beaconchain/develop/testnetandexplorer.html @@ -8,13 +8,13 @@ - +
    -

    BNB Beacon Chain Testnet

    What is a Testnet?

    The testnet is a test environment for BNB Chain network, run by the BNB Chain development community, which is open to developers.

    The validators on the testnet are from development team.

    You can connect a node to the testnet by downloading the node binary and testnet configuration from https://github.com/bnb-chain/node/releases.

    What is the Testnet good for?

    • Create your test address and get your testnet funds.
    • Develop applications and try tutorials on BNB Chain without the potential to lose your own assets.
    • Test your applications against new versions of BNB Chain.
    • Analyze blockchain data on a smaller, non-trivial data set compared to the public network.

    How to get Testnet Fund?

    Note: The previous BNB Chain Testnet Faucet is retired at 2020/08/11 at 1:00 PM (UTC). The testnet faucet has migrated to this page: https://testnet.binance.org/faucet-smart

    Steps to claim testnet BNB:

    1. Create a new Wallet of BNB Smart Chain testnet with Trust Wallet or Binance Extension Wallet

    2. Get Testnet Fund: https://testnet.binance.org/faucet-smart

    3. Transfer From BNB Smart Chain to BNB Beacon Chain

    You can use Binance Extension Wallet for cross-chain transfer.

    Explorers for Testnet

    - +

    BNB Beacon Chain Testnet

    What is a Testnet?

    The testnet is a test environment for BNB Chain network, run by the BNB Chain development community, which is open to developers.

    The validators on the testnet are from development team.

    You can connect a node to the testnet by downloading the node binary and testnet configuration from https://github.com/bnb-chain/node/releases.

    What is the Testnet good for?

    • Create your test address and get your testnet funds.
    • Develop applications and try tutorials on BNB Chain without the potential to lose your own assets.
    • Test your applications against new versions of BNB Chain.
    • Analyze blockchain data on a smaller, non-trivial data set compared to the public network.

    How to get Testnet Fund?

    Note: The previous BNB Chain Testnet Faucet is retired at 2020/08/11 at 1:00 PM (UTC). The testnet faucet has migrated to this page: https://testnet.binance.org/faucet-smart

    Steps to claim testnet BNB:

    1. Create a new Wallet of BNB Smart Chain testnet with Trust Wallet or Binance Extension Wallet

    2. Get Testnet Fund: https://testnet.binance.org/faucet-smart

    3. Transfer From BNB Smart Chain to BNB Beacon Chain

    You can use Binance Extension Wallet for cross-chain transfer.

    Explorers for Testnet

    + diff --git a/docs/beaconchain/encoding.html b/docs/beaconchain/encoding.html index bc5ba48778..f06171773d 100644 --- a/docs/beaconchain/encoding.html +++ b/docs/beaconchain/encoding.html @@ -8,13 +8,13 @@ - +

    BNB Beacon Chain Transaction Encoding Specification

    BNB Beacon Chain transactions are protocol-based data types and can only be submitted in a compatible encoded frame.

    The fundamental encoding logic is from Tendermint Amino, which derives from and is "largely compatible with" Google protocol-buffer's Proto3.

    However the client sides only needs to stick to the specifications outlined below for the most frequently used transactions.

    Encoding Output

    BNB Beacon Chain (Amino) encoding logic may encode a data structure into two output formats: Binary and JSON.

    JSON Marshal

    Amino supports JSON encoding natively, which is the same as other usual json marshalers. Except that it can add one more type info for registered type, as shown below.

    {
    "type": "<amino type name>",
    "value": <JSON>
    }

    Binary Marshal

    Please note the below binary encoding logic is subjected to future changes. Please watch out for the community news.

    Binary encoding is a variant of Google's protobuf. The bytes are laid out in the below sequence:

    1. a varint encoded integer - it contains the length of the encoded bytes for the object, which is displayed as SIZE-OF-ENCODED in the below structs. Please note that it contains the length of encoded bytes and also the type prefix (below), but not itself, e.g. if the encoded msg is 20 bytes, then the length would be 20 + 4 = 24, while 4 is used for the type prefix bytes.
    2. an object type prefix of 4-8 bytes - For different type of objects, there will be different type prefixes, and they are displayed as in the specific objects below (data structures).
    3. a binary encoded object - the encoding is mostly the same as protocol buffer encoding mechanism, except the embedded fields of complex type:
      • to encode data field of some specific types, an object type prefix for the field will be added ahead of the real encoding.
    4. repeated (array) Encoding - it is the same as google protocol buffer, while encoding of the object/struct may contain the type prefix as shown below.

    BNB Beacon Chain Transaction Encoding

    Below are the data types that can be sent to BNB Beacon Chain as requests, and their encoding layout. To simplify the presentation, we will use a variant of Google protocol buffer proto3 language to illustrate how the data fields are organized. Except the all-capitalized fields, other fields will use the default proto3 encoding logic.

    Standard Transaction

    Transactions are each wrapped in the below "Standard Transaction": structure:

    // please note the field name is the JSON name.
    message StdTx {
    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding, please note this includes both the below type prefix (4 bytes) and the all encoding bytes
    0xF0625DEE // hardcoded, object type prefix in 4 bytes
    repeated Msg msgs // array of size 1, containing the transaction message, which are one of the transaction types below. please check the above "Array Encoding"
    repeated StdSignature signatures // array of size 1, containing the standard signature structure of the transaction sender
    string memo // a short sentence of remark for the transaction. Please only `Transfer` transaction allows 'memo' input, and other transactions with non-empty `Memo` will be rejected.
    int64 source // an identifier for tools triggerring this transaction, set to zero if unwilling to disclose.
    bytes data // byte array, reserved for future use
    }

    StdSignBytes

    type StdSignDoc struct {
    AccountNumber int64 `json:"account_number"`
    ChainID string `json:"chain_id"`
    Memo string `json:"memo"`
    Msgs []json.RawMessage `json:"msgs"`
    Sequence int64 `json:"sequence"`
    Source int64 `json:"source"`
    Data []byte `json:"data"`
    }

    Canonical Bytes for Signing

    A transaction signature is not formed from the Amino-encoded transaction bytes themselves. Rather, a canonical representation of the transaction is generated in JSON format for signing.

    This would allow for clients to sign a transaction off-chain, for example, with a hardware HSM device like a Ledger, or within a micro-service in an algorithmic trading system. An external system will not have to understand Amino encoding to be able to approve of the transaction's content and produce the signed JSON string.

    The canonical bytes for signing are generated from the StdSignBytes method. It produces a JSON string similar to the format below (formatted for clarity):

    {
    "sequence" : "64",
    "account_number" : "12",
    "data" : null,
    "chain_id" : "chain-bnb",
    "memo" : "smiley",
    "msgs" : [
    {
    "inputs" : [
    {
    "coins" : [
    {
    "denom" : "BNB",
    "amount" : "200000000"
    }
    ],
    "address" : "bnc1hgm0p7khfk85zpz5v0j8wnej3a90w7098fpxyh"
    }
    ],
    "outputs" : [
    {
    "address" : "bnc1cku54wwn66w2rkgs3h6v5zxrwtzyew8chcl720",
    "coins" : [
    {
    "denom" : "BNB",
    "amount" : "200000000"
    }
    ]
    }
    ]
    }
    ],
    "source" : "1"
    }

    This JSON string, with all whitespace removed and keys sorted in alphabetical order, is signed with the private key of the sender. This signature is then attached to the StdTx structure described in the above section. Please note that the transaction broadcasted to the blockchain is not JSON - the JSON is merely used as a canonical representation to generate the signature.

    The next section describes how the generated signature is attached to a transaction.

    Standard Signature

    The sender's signature is stored in the Standard Transaction data via a Standard Signature, as shown below. This structure is included in the StdTx (see above).

    Please note that StdSignature itself doesn't have type prefix, while the PubKey does.

    message StdSignature {
    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding
    // please note there is no type prefix for StdSignature
    message PubKey {
    0xEB5AE987 // hardcoded, object type prefix in 4 bytes
    uint64 SIZE-OF-ENCODED // varint encoded length of the bytes below
    bytes // no name or field id, just encode the bytes
    }
    PubKey pub_key // public key bytes of the signer address
    bytes signature // signature bytes, please check the chain access section for signature generation
    int64 account_number // another identifier of signer, which can be read from chain by account REST API or RPC
    int64 sequence // sequence number for the next transaction of the client, which can be read from the chain by account REST API or RPC. Please check the chain access section for details.
    }

    Message Types

    Messages represent the individual operations possible on BNB Beacon Chain , and these can be inserted into the StdTx.msgs field. Message types are otherwise known as "transaction types", and these terms are used interchangebly in this document and in our technical documentation. So far every StdTx transaction "container" can only contain one "message".

    Transfer

    Transfer is the transaction used for transferring funds to different addresses.

    // please note the field name is the JSON name.
    message Send {
    0x2A2C87FA // hardcoded, object type prefix in 4 bytes
    message Token {
    string denom
    int64 amount
    }
    message Input {
    bytes address
    repeated Token coins
    }
    message Output {
    bytes address
    repeated Token coins
    }
    repeated Input inputs
    repeated Output outputs
    }

    NewOrder

    NewOrder transaction will create a new order to buy or sell tokens on Binance DEX.

    // please note the field name is the JSON name.
    message NewOrder {
    0xCE6DC043 // hardcoded, object type prefix in 4 bytes
    bytes sender // order originating address
    string id // order id, please check the Order ID section below for details.
    string symbol // symbol for trading pair in full name of the token
    int64 ordertype // only accept 2 for now, meaning limit order
    int64 side // 1 for buy and 2 fory sell
    int64 price // price of the order, which is the real price multiplied by 1e8 (10^8) and rounded to integer
    int64 quantity // quantity of the order, which is the real quantity multiplied by 1e8 (10^8) and rounded to integer
    int64 timeinforce // 1 for Good Till Expire(GTE) order and 3 for Immediate Or Cancel (IOC)
    }
    Order ID

    Order ID is unique across the world. It is generated by sender and acknowledged by Binance DEX. The current implementation is composed from 3 parts:

    1. Sender address in HEX format, without human-readable prefix
    2. A dash sign: -
    3. Sequence number

    E.g. 40C2979694BBC961023D1D27BE6FC4D21A9FEBE6-5

    Cancel

    Cancel transactions (cancel the outstanding/unfilled) orders from the Binance DEX. After cancel success, the locked quantity on the orders will return back to the originating address balance and become free to use, i.e. transfer or send new orders.

    // please note the field name is the JSON name.
    message CancelOrder {
    0x166E681B // hardcoded, object type prefix in 4 bytes
    bytes sender // order originating address
    string symbol // symbol for trading pair in full name of the token
    string refid // order id of the order to cancel
    }

    Freeze

    Freeze transaction will move the amount of the tokens into a frozen state, in which they cannot be used for transfers or sending new orders.

    // please note the field name is the JSON name.
    message TokenFreeze {
    0xE774B32D // hardcoded, object type prefix in 4 bytes
    bytes from // owner address
    string symbol // token symbol, in full name with "-" suffix
    int64 amount // amount of tokens to freeze
    }

    Unfreeze

    Unfreeze will reversely turn the amount of frozen tokens back to free state.

    // please note the field name is the JSON name.
    message TokenUnfreeze {
    0x6515FF0D // hardcoded, object type prefix in 4 bytes
    bytes from // owner address
    string symbol // token symbol, in full name with "-" suffix
    int64 amount // amount of tokens to unfreeze
    }

    Vote

    Vote transactions for proposals.

    // please note the field name is the JSON name.
    message Vote {
    0xA1CADD36 // hardcoded, object type prefix in 4 bytes
    int64 proposal_id // ID of the proposal
    bytes voter // address of the voter
    uint64 option // option from OptionSet chosen by the voter
    }

    Below are options for option:

    OptionYes           = 0x01  // yes
    OptionAbstain = 0x02 // abstain
    OptionNo = 0x03 // no
    OptionNoWithVeto = 0x04 // no with veto

    Issue

    Issue (create) new asset on BNB Beacon Chain .

    message IssueTokenValue  {
    0x17EFAB80 // hardcoded, object type prefix in 4 bytes
    bytes from // issuer's address
    string name // token name
    string symbol // token symbol
    string total_supply // total supply
    bool mintable // is mintable
    }

    Mint

    Mint is used to increase the total supply of a token.

    message Mint {
    0x467E0829 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string symbol string // token symbol
    int64 amount // increase amount
    }

    Burn

    Burn is used to decrease the total supply of a token.

    message TokenBurn {
    0x7ED2D2A0 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string symbol string // token symbol
    int64 amount // increase amount
    }

    List

    List is used to add a new trading pair.

    message DexList{
    0xB41DE13F // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 proposal_id // id of corresponding proposal
    string base_asset_symbol // token symbol of base asset
    string quote_asset_symbol // token symbol of quote asset
    int64 init_price // init price of the new token
    }

    Submit Proposal

    Submit proposal is used to create a proposal for validators about adding trading pairs

    message Submit{
    0xB42D614E // hardcoded, object type prefix in 4 bytes
    string title // Title of the proposal
    string description // Description of the proposal
    byte proposal_type // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal,ListTradingPair, FixedFeeParams}
    bytes proposer // Address of the proposer
    message Coin {
    string denom
    int64 amount
    }
    int64 VotingPeriod // Length of the voting period (s)
    }

    Deposit

    Deposit is used to increase the total deposit of a proposal.

    message Deposit{
    0xA18A56E5 // hardcoded, object type prefix in 4 bytes
    int64 ProposalID // ID of the proposal
    bytes Depositer // Address of the depositer
    message Coin {
    string denom
    int64 amount
    }
    }

    Set Account Flags

    You can set the flag value of your account.

    message SetAccountFlags{
    0xBEA6E301 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 flag // account flag
    }

    Time-lock

    You can only lock tokens on your own account for a certain period of time.

    message Timerelock{
    0x07921531 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string description // Description of the lock
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    int64 lock_time // lock time
    }

    Time-unlock

    You can unlock tokens on your own account after a certain period of time.

    message Timeunlock{
    0xC4050C6C // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 id // lock time id
    }

    Time-relock

    You can relock tokens on your own account after a certain period of time.

    message Timerelock{
    0x504711DA // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 Id // lock time id
    string description // Description of the lock
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    int64 lock_time // lock time
    }

    HTLT

    Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain , to serve as HTLC in the first step of Atomic Swap

    message HTLT{
    0xB33F9A24 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes to // receiver's address
    string recipient_other_chain
    string sender_other_chain
    bytes random_number_hash
    int64 timestamp
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    string expected_income
    int64 height_span
    bool cross_chain
    }

    Deposit HTLT

    Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

    message DepositHTLT{
    0x63986496 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    bytes swap_id
    }

    Claim HTLT

    Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

    message ClaimHTLTMsg{
    0xC1665300 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes swap_id
    bytes random_number
    }

    Refund HTLT

    Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

    message RefundHTLTMsg{
    0x3454A27C // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes swap_id
    - + diff --git a/docs/beaconchain/exchange-integration.html b/docs/beaconchain/exchange-integration.html index 42e8b5e41a..c190ff404e 100644 --- a/docs/beaconchain/exchange-integration.html +++ b/docs/beaconchain/exchange-integration.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ List of all endpoints Node RPC service provides can be found: here

    Running a Full Node

    Running a full node requires considerable computational/bandwidth resources.
    Please refer to this guide about how to run your own node.

    Access via Node Command Line Interface (CLI)

    Command Line Interface is currently available for Linux, Mac and Windows.
    Please refer to the CLI Reference.

    SDKs

    There are multiple advanced SDK solutions available for BNB Beacon Chain.

    Majority of SDKs provide simplified functions to:

    • Create wallets and manage keys
    • Encode/sign transactions and submit to BNB Beacon Chain/DEX, including Transfer, New Order, Cancel Order, etc.
    • Communicate with BNB Beacon Chain/DEX via Node RPC calls through public node RPC services or your own private full nodes

    List of currently available SDKs and their respective documentations:

    Important: Ensuring Transaction Finality

    If you intend to add "deposit" and "withdrawal" functionalities to your implementation, it is important that you ensure that transactions are final before the backend system credits or deducts funds from a user account.

    In brief, transactions pass through several phases before they are finalised and included in a block.

    The status "code" recorded for each of these phases can differ, so be sure to check that it is 0 (meaning success) for each of them. A non-zero "code" indicates that there was a problem with the transaction during processing.

    For example, this transaction was invalid because the order was already canceled. You can query that the code for this transaction is 405.

    {
    code: 393621,
    hash: "F296E84917A92FC4876AFE77DE662CC9417F9D6F2EB8ED1AD723A5433EBB8362",
    height: "30771453",
    log: "{"codespace":6,"code":405,"abci_code":393621,"message":"Failed to find order [E0B781A5DA419E0E596D13FE8A06BF5F9CE9C37D-19450]"}",
    ok: false,
    tx: {
    type: "auth/StdTx",
    value: {
    data: null,
    memo: "",
    msg: [
    {
    type: "dex/CancelOrder",
    value: {
    refid: "E0B781A5DA419E0E596D13FE8A06BF5F9CE9C37D-19450",
    sender: "bnb1uzmcrfw6gx0quktdz0lg5p4lt7wwnsmat6ksd6",
    symbol: "BNB_TUSDB-888"
    }
    }
    ],
    signatures: [
    {
    account_number: "153135",
    pub_key: {
    type: "tendermint/PubKeySecp256k1",
    value: "AzWMnQAwvCP9mbpNyaGuOtNVum1ktvlBb+XFy8D50xmh"
    },
    sequence: "19452",
    signature: "y2FTS4rAqWvDmNWLxsOg+8vrz9XZ4gDXs/tGh/psnQwRMQBtw1x1a2TSCgc0G4qbvh0YICe5ZvJFRNvg/zGG7w=="
    }
    ],
    source: "889"
    }
    }
    }

    The two phases we should be concerned about are CheckTx and DeliverTx.

    We recommend that you broadcast your transactions via REST API or, if you wish to run a Full Node, Node RPC via the BroadcastTxSync command.

    While there is an RPC command called BroadcastTxCommit which will wait for both CheckTx and DeliverTx and return with codes for both and a block height, it is unfortunately not recommended for use in production.

    Instead, there are two ways that you can go about checking the status of your transaction after you have broadcasted it.

    If you haven't received anything after a couple of blocks, resend the transaction. If the same happens again, send it to some other node. This is safe to do so long as you are broadcasting the same transaction. Transactions are unique in the blockchain and you cannot spend the coins twice by retrying the send of the same data.

    If you want to be sure that the transaction is included in a block, you can subscribe for the result using JSONRPC via a websocket. See Subscribing to Events via WebSocket.

    The Alternative Way (via RPC Polling)

    Some of the SDKs do not yet support WebSocket subscriptions for RPC queries, so this may be the preferable option in some use cases.

    You can use the Tx RPC method to query for the transaction and get its block height. Here is an example using the JavaScript SDK:

    > rpc.tx({
    hash: Buffer.from('B2EF71DAEB86385E64F6C0B923636ADE5510B3C34C07D19EE5A114FC9075273D', 'hex'),
    prove:false
    }).then(x => console.log('',x))
    {
    hash: 'B2EF71DAEB86385E64F6C0B923636ADE5510B3C34C07D19EE5A114FC9075273D',
    height: '30261607',
    index: 0,
    tx_result: { log: 'Msg 0: ', tags: [ [Object], [Object], [Object] ] },
    tx: '0AHwYl3uCkwqLIf6CiIKFLjeOPB9sCxE5v+lpkRhnPu+K1ahEgoKA0JOQhCMy5ZfEiIKFI6nDX0uqKFLorM9GNXfvW+uCm6oEgoKA0JOQhCMy5ZfEnEKJuta6YchA6Xy63LJBSKNsW1nkGMbPyvWl7VDeD/lVByJrtnB3v1kEkA243QKSCn5GxFSTFbh6EA8ZuqdO+0UTR8+Vq7CDikOzCIpuRo95Ww7zak0qXRmL3/shGkwHcvB4l9ofF61mSQgGKfQCSDDARoJMTAxNzg5MTEz'
    }

    If the Transaction does not yet exist in the blockchain, this attempt will return with an error.

    You should check for an absent "code" field in the tx_result: this indicates a code of 0. You could also perform further checks on the log to make sure that it matches the expected value.

    - + diff --git a/docs/beaconchain/faq.html b/docs/beaconchain/faq.html index ecff03c1db..9f4e933e1f 100644 --- a/docs/beaconchain/faq.html +++ b/docs/beaconchain/faq.html @@ -8,7 +8,7 @@ - + @@ -33,8 +33,8 @@ It can receive and broadcast blocks and transactions with other full nodes and even validators. The only exception is it will not participate in the consensus if the full node is not a Validator.

    Does BNB Beacon Chain support Smart Contracts?

    No. This was an intentional design decision to improve the performance of the system and eliminate having to support unnecessary features.

    If you have certain must-have feature-s, it might be added as a native implementation instead of using smart contract.
    -Feel free to talk to BNB Chain community.

    How can I transfer tokens, such as Bitcoin, from other blockchains onto BNB Beacon Chain?

    Right now, there are 2 ways to transfer tokens cross-chain:

    1. via interoperability among different chains. After the latest “Archimedes” upgrade, BEP3 was introduced and it defines native transactions to support Hash Timelock Contract (HTLC) on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain atomic swap to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including:
    • smart-contract solution that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party.
    • deputy process written in GoLang that handles swap activities

    Any developer is welcome to test the solutions in testnet and then use them in mainnet.

    1. via Binance.com. Binance,the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): BEP2 Bitcoin, BEP2 BCH,BEP2 XRP, BEP2 LTC. Pegged tokens such as BEP2 Bitcoin, are 100% backed by the native coin in reserve. The reserve addresses are published for anyone to audit. Read this blog to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.

    Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them.

    Please do NOT try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins.

    How would a third-party integrate with BNB Beacon Chain and Binance DEX?

    A wallet provider may choose to support the feature set of BNB Beacon Chain, which would cover wallets, addresses, balances, transfers and etc.

    - +Feel free to talk to BNB Chain community.

    How can I transfer tokens, such as Bitcoin, from other blockchains onto BNB Beacon Chain?

    Right now, there are 2 ways to transfer tokens cross-chain:

    1. via interoperability among different chains. After the latest “Archimedes” upgrade, BEP3 was introduced and it defines native transactions to support Hash Timelock Contract (HTLC) on BNB Beacon Chain and it also to defines the infrastructure standard and procedure to use HTLC for inter-chain atomic swap to easily swap tokens on different chains. BNB Beacon Chain development community has finished implementing its solution for BEP3 with BEP2 and ERC20 tokens and decided to open-source all of the key components, including:
    • smart-contract solution that supports Atomic Peg Swap (APS) for Ethereum. Please note that this solution is already audited by 3rd party.
    • deputy process written in GoLang that handles swap activities

    Any developer is welcome to test the solutions in testnet and then use them in mainnet.

    1. via Binance.com. Binance,the largest cryptocurrency exchange, has issued a number of crypto-pegged tokens on BNB Beacon Chain (BEP2 token format): BEP2 Bitcoin, BEP2 BCH,BEP2 XRP, BEP2 LTC. Pegged tokens such as BEP2 Bitcoin, are 100% backed by the native coin in reserve. The reserve addresses are published for anyone to audit. Read this blog to learn about the reserved address. Users are free to convert between native and BEP2 Bitcoin via deposit/withdrawal. This has a higher degree of ease-of-use for most traders. More swap channels will be provided on partner wallets soon.

    Atomic swap and this centralized approach are not exclusive to other decentralized approaches, which can also be implemented in parallel. There are many cross-chain solutions being developed and we are very interested in them.

    Please do NOT try to transfer anything on existing network to BNB Beacon Chain testnet, you may experience loss by doing so, because testnet doesn't run with real coins.

    How would a third-party integrate with BNB Beacon Chain and Binance DEX?

    A wallet provider may choose to support the feature set of BNB Beacon Chain, which would cover wallets, addresses, balances, transfers and etc.

    + diff --git a/docs/beaconchain/fullnode.html b/docs/beaconchain/fullnode.html index f44a8e8318..2bc912a3e7 100644 --- a/docs/beaconchain/fullnode.html +++ b/docs/beaconchain/fullnode.html @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ Now its Mar 1st, latest sync-able block height is 50000, you don't care blocks between 22000 and 50000, you can delete $BNCHOME/data/STATESYNC.LOCK before start your node.
    Then the full node would continue state sync from height 50000.

    Turning off state_sync_reactor and state_sync can save your memory after you successfully state synced.

    Upgrading Full Node

    In most cases, download the new binary and replace it, then restart the full node.
    In special cases, you may have to do extra steps for an incompatible version (hard fork).

    Monitoring

    Prometheus is enabled on port 28660 by default, and the endpoint is /metrics.

    Get Extra Data From Your Full Node

    Full node has the same RPC interface as the one listed here rpc-api

    If you want to get extra information about order book, balance changes or block fee changes from blocks, please refer to getting extra data from fullnode.

    Common Issues and Solutions

    Please refer to this doc to find answers to common issues.

    - + diff --git a/docs/beaconchain/fullnodeissue.html b/docs/beaconchain/fullnodeissue.html index 0a49c71521..08af936c32 100644 --- a/docs/beaconchain/fullnodeissue.html +++ b/docs/beaconchain/fullnodeissue.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ To reset node:

    rm $BNCHOME/data

    rm $BNCHOME/config/priv_validator_key.json

    Then, start again.

    Peer connection error

    • Error log:
    E[2019-04-17|23:52:24.069] Connection failed @ recvRoutine (reading byte) module=p2p peer=[aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146](http://aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146)conn=MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} err=EOF
    E[2019-04-17|23:52:24.070] Stopping peer for error module=p2p peer=&quot;Peer{MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} aea74b16d28d06cbfbb1179c177e8cd71315cce4 out}&quot; err=EOF

    This error is caused by the handshake failing between two peers.

    • Solution

    To solve this problem, you need to make sure node_key.json is under $BNCHOME/config and nodes will try to re-connect automatically, so this issue should not persist.

    Connection Timeout

    • Error log
    Dialing failed module=pex addr=2c1fa9c1698961da38d8cd50da9fe8b4bc433c50@34.202.245.91:26856 err=&quot;dial tcp 34.202.245.91:26856: i/o timeout&quot; attempts=3
    • Solution

    Check your internet connection and make sure it is stable.

    Out of memory

    • Error Log
    fatal error: out of memory
    • Solution

    Your machine must have more than 8 GB of memory, otherwise, it will not handle DB restoration during state sync.

    No priv_validator_state.json after reset

    • Error log
    open /Users/.bnbchaind/data/priv_validator_state.json: no such file or directory
    • Solution

    Delete both priv_validator_state.json & node_key.json file and data folder if you want to reset your full node.

    bnbchaind crashes because of too many open files

    The default number of files Linux can open (per-process) is 1024.
    bnbchaind is likely to open more than 1024 files.
    This causes the process to crash.

    A quick fix is to run ulimit -n 65535 (increase the number of open files allowed) and then restart the process with:

    bnbchaind start

    Verify the number of open files:

    ulimit -a
    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 0
    file size (blocks, -f) unlimited
    pending signals (-i) 3829
    max locked memory (kbytes, -l) 64
    max memory size (kbytes, -m) unlimited
    open files (-n) 65535
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 8192
    cpu time (seconds, -t) unlimited
    max user processes (-u) 3829
    virtual memory (kbytes, -v) unlimited
    file locks (-x) unlimited

    Please note that open files are different now.

    Forget to Upgrade

    The BNB Chain has a hardfork upgrade and if you failed to upgrade your fullnode to the latest version, bnbchaind process will stop and even if you restart with the latest version, the following error will appear:

    panic: Tendermint state.AppHash does not match AppHash after replay. Got , expected 393887B67F69B19CAB5C48FB87B4966018ABA893FB3FFD241C0A94D2C8668DD2
    goroutine 1 [running]:
    github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.checkAppHash(0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, 0x20, ...)
    /Users/huangsuyu/go/src/github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus/replay.go:464 +0x213
    github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc000b37980, 0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, ...)

    To recover from the state conflict error, you need to:

    • Backup your home directory, (default is ~/.bnbchaind)

    • Download the tool: state-recover

    • Get the height of upgrade, this height will be announced in the upgrade announcement on the forum. For example, if it's announced as 5000 in the forum and run the following command will make your full node recover to the last block before the upgrade, and that is 4999 :

    ./state_recover 4999 <your_home_path>
    • Restart with the latest version of bnbchaind
    bnbchaind start &

    bnbchaind is not properly killed

    If you started your bnbchaind process after it was not properly killed. You will see the following error:

    panic: ERROR:
    Codespace: 5
    Code: 9
    Message: "Initial ProposalID already set"

    To recover, please reset your node and restart:

    bnbchaind unsafe-reset-all --home<your-home-dir>

    Cannot start bnbchaind

    If you do not download the binaries completely, you will see the following message:

    ./bnbchaind: line 1: version: command not found ./bnbchaind: line 2: oid: command not found /Library/Developer/CommandLineTools/usr/bin/size: 45160816 No such file or directory

    Since the old binaries are stored in git lfs previously, you will see this error if the binary is not complete. Please use this repo to download the binaries.

    Cannot query a specific block

    Once you have your own node running, you can start querying from it. But sometimes you may not be ablt to get the information you want. For example:

    curl 'localhost:27147/block?height=10'

    The reason is because your node is using statesync to catch up. In this way, it will not store all the history blocks before the snapshot height it got. You can only query blocks after that snapshot height.

    To enable query history blocks, you need to use fast-sync

    - + diff --git a/docs/beaconchain/get-extra-data-from-fullnode.html b/docs/beaconchain/get-extra-data-from-fullnode.html index ac4e103a82..4d49a1e368 100644 --- a/docs/beaconchain/get-extra-data-from-fullnode.html +++ b/docs/beaconchain/get-extra-data-from-fullnode.html @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ Then, the full node will save messages that you are interested into Kafka, and you can consume them in your own apps.
    The message is encoded based on Avro serialization system.
    Their schemas are shown below:

    • OrderUpdates:
    {
    "type": "record",
    "name": "ExecutionResults",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "height", "type": "long" },
    { "name": "timestamp", "type": "long" },
    { "name": "numOfMsgs", "type": "int" },
    { "name": "trades", "type": ["null", {
    "type": "record",
    "name": "Trades",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "trades", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Trade",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "symbol", "type": "string" },
    { "name": "id", "type": "string" },
    { "name": "price", "type": "long" },
    { "name": "qty", "type": "long" },
    { "name": "sid", "type": "string" },
    { "name": "bid", "type": "string" },
    { "name": "sfee", "type": "string" },
    { "name": "bfee", "type": "string" },
    { "name": "saddr", "type": "string" },
    { "name": "baddr", "type": "string" }
    ]
    }
    }
    }
    ]
    }], "default": null },
    { "name": "orders", "type": ["null", {
    "type": "record",
    "name": "Orders",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "orders", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Order",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "symbol", "type": "string" },
    { "name": "status", "type": "string" },
    { "name": "orderId", "type": "string" },
    { "name": "tradeId", "type": "string" },
    { "name": "owner", "type": "string" },
    { "name": "side", "type": "int" },
    { "name": "orderType", "type": "int" },
    { "name": "price", "type": "long" },
    { "name": "qty", "type": "long" },
    { "name": "lastExecutedPrice", "type": "long" },
    { "name": "lastExecutedQty", "type": "long" },
    { "name": "cumQty", "type": "long" },
    { "name": "fee", "type": "string" },
    { "name": "orderCreationTime", "type": "long" },
    { "name": "transactionTime", "type": "long" },
    { "name": "timeInForce", "type": "int" },
    { "name": "currentExecutionType", "type": "string" },
    { "name": "txHash", "type": "string" }
    ]
    }
    }
    }
    ]
    }], "default": null },
    { "name": "proposals", "type": ["null", {
    "type": "record",
    "name": "Proposals",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "proposals", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Proposal",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "id", "type": "long" },
    { "name": "status", "type": "string" }
    ]
    }
    }
    }
    ]
    }], "default": null },
    { "name": "stakeUpdates", "type": ["null", {
    "type": "record",
    "name": "StakeUpdates",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "completedUnbondingDelegations", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "CompletedUnbondingDelegation",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "validator", "type": "string" },
    { "name": "delegator", "type": "string" },
    { "name": "amount", "type": {
    "type": "record",
    "name": "Coin",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "denom", "type": "string" },
    { "name": "amount", "type": "long" }
    ]
    }
    }
    ]
    }
    }
    }
    ]
    }], "default": null }
    ]
    }
    • OrderBooksSchema:
    {
    "type": "record",
    "name": "Books",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long" },
    { "name": "timestamp", "type": "long" },
    { "name": "numOfMsgs", "type": "int" },
    { "name": "books", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "OrderBookDelta",
    "namespace": "com.company",
    "fields": [
    { "name": "symbol", "type": "string" },
    { "name": "buys", "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "PriceLevel",
    "namespace": "com.company",
    "fields": [
    { "name": "price", "type": "long" },
    { "name": "lastQty", "type": "long" }
    ]
    }
    } },
    { "name": "sells", "type": {
    "type": "array",
    "items": "com.company.PriceLevel"
    } }
    ]
    }
    }, "default": []
    }
    ]
    }
    • AccountBalanceSchema:
    {
    "type": "record",
    "name": "Accounts",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long" },
    { "name": "numOfMsgs", "type": "int" },
    { "name": "accounts", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Account",
    "namespace": "com.company",
    "fields": [
    { "name": "owner", "type": "string" },
    { "name": "fee", "type": "string" },
    { "name": "balances", "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "AssetBalance",
    "namespace": "com.company",
    "fields": [
    { "name": "asset", "type": "string" },
    { "name": "free", "type": "long" },
    { "name": "frozen", "type": "long" },
    { "name": "locked", "type": "long" }
    ]
    }
    }
    }
    ]
    }
    }, "default": []
    }
    ]
    }

    • BlockFeeSchema:
    {
    "type": "record",
    "name": "BlockFee",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long"},
    { "name": "fee", "type": "string"},
    { "name": "validators", "type": { "type": "array", "items": "string" }}
    ]
    }
    • TransfersSchema:
    {
    "type": "record",
    "name": "Transfers",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long"},
    { "name": "num", "type": "int" },
    { "name": "timestamp", "type": "long" },
    { "name": "transfers",
    "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "Transfer",
    "namespace": "com.company",
    "fields": [
    { "name": "txhash", "type": "string" },
    { "name": "from", "type": "string" },
    { "name": "to",
    "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "Receiver",
    "namespace": "com.company",
    "fields": [
    { "name": "addr", "type": "string" },
    { "name": "coins",
    "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "Coin",
    "namespace": "com.company",
    "fields": [
    { "name": "denom", "type": "string" },
    { "name": "amount", "type": "long" }
    ]
    }
    }
    }
    ]
    }
    }
    }
    ]
    }
    }
    }
    ]
    }
    - + diff --git a/docs/beaconchain/get-started.html b/docs/beaconchain/get-started.html index f73a1d070c..65fa572c8b 100644 --- a/docs/beaconchain/get-started.html +++ b/docs/beaconchain/get-started.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ Please refer to the CLI Reference.

    Use SDKs

    SDKs are also provided as a starting point for your apps.
    There are two advanced SDK solutions for BNB Beacon Chain : Java and Golang.
    Both solutions provide functions for:

    • Create wallets and manage keys
    • Encode/sign transactions and submit to BNB Beacon Chain /DEX, including Transfer, New Order, Cancel Order, etc.
    • Communicate with BNB Beacon Chain /DEX Node RPC calls through public node RPC services or your own private full nodes

    Please refer to specific SDK documentation for more information:

    Blockchain Details

    Please check the technical details for more technical information.

    - + diff --git a/docs/beaconchain/governance.html b/docs/beaconchain/governance.html index d0670200fd..c6ca432e7b 100644 --- a/docs/beaconchain/governance.html +++ b/docs/beaconchain/governance.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ If the initial proposer's deposit is not sufficient, the proposal enters the deposit period. Then, any BNB holder can increase the deposit by sending a deposit transaction. The deposits are hold by governance escrow account during voting period, and will be refunded or burned later. After deposit period, votes will be casted to decide whether to accept or reject the proposal.

    Parameters

    Global Parameters

    • min-deposit: The threshold for submitting a proposal is 2000BNB.
    • deposit_period: This is a global parameter and the value for mainnet is two days and testnet is two week. It means the time to deposit enough BNB tokens is two days in mainnet and two weeks in testnet.
    • fee: Checkout the fee of governance-related transactions here

    Proposal Parameters

    • deposit: your input must be larger than min-deposit.
    • voting-period: This is the time for validators to vote, your input in seconds, if you omit this field, the default voting period is one week.
    • expire-time: This is the time for you to send list transaction if your proposal passed. This time cannot be earlier than current time.

    Workflow

    Please refer to this for the workflow of proposals.

    Fee Table

    Transaction TypeFee
    Submit Proposal1 BNBs
    Proposal Deposit0.000125 BNB
    Proposal Vote0 BNB

    Commands

    Query proposals

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --statuspassedfilter proposals by proposal status, status: deposit_period/voting_period/passed/rejectedNo
    --voterbnb1h9ymecpakr8p8lhchtah2xxx7x4xq099umclqufilter by proposals voted on by votedNo
    ## mainnet
    ./bnbcli gov query-proposals --node http://dataseed2.defibit.io:80 --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov query-proposals --node http://data-seed-pre-1-s1.bnbchain.org:80 --trust-node --chain-id Binance-Chain-Ganges

    Query proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --proposal-id1proposalID of proposal being queriedYes
    ## mainnet
    ./bnbcli gov query-proposal --proposal-id 1 --node http://dataseed2.defibit.io:80 --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov query-proposal --proposal-id 1 --trust-node --node http://data-seed-pre-1-s1.bnbchain.org:80 --chain-id Binance-Chain-Ganges

    Note: Trying to query proposal that didn't enter the voting period will result in error.

    $ ./bnbcli gov query-proposal --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --proposal-id 2500
    {
    "codespace": 5,
    "code": 1,
    "abci_code": 327681,
    "message": "Unknown proposal with id 2500"
    }

    Query fee parameters

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainNo
    ## mainnet
    ./bnbcli params show-fees --trust-node --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli params show-fees --trust-node --node http://data-seed-pre-1-s1.bnbchain.org:80

    Submit a list proposal

    Note: this kind of proposal is not supported on mainnet and testnnet now.

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --title"list"title of proposalYes
    --voting-period604800voting period in seconds (default 604800)No
    --init-price100000000init price, boosted by 1e8 for decimal partYes
    --quote-asset-symbolBNBthe quote asset symbolYes
    --base-asset-symbolAAA-254the asset symbol you want to listYes
    ## mainnet
    ./bnbcli gov submit-list-proposal --from test --deposit 100000000000:BNB
    --base-asset-symbol AAA-254 --quote-asset-symbol BNB --init-price 100000000 --title "list AAA-254/BNB"
    --description "list AAA-254/BNB" --expire-time 1570665600 --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --voting-period 604800 --json

    ## testnet
    ./tbnbcli gov submit-list-proposal --from test --deposit 200000000000:BNB
    --base-asset-symbol AAA-254 --quote-asset-symbol BNB --init-price 100000000 --title "list AAA-254/BNB"
    --description "list AAA-254/BNB" --expire-time 1570665600 --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --json --voting-period 604800

    Submit a delist proposal

    Note: this kind of proposal is not supported on mainnet and testnnet now.

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --title"list"title of proposalYes
    --voting-period604800voting period in seconds (default 604800)No
    --justification"no longer valid"reason for proposalYes
    --quote-asset-symbolBNBthe quote asset symbolYes
    --base-asset-symbolAAA-254the asset symbol you want to listYes
    # mainnet
    ./bnbcli gov submit-delist-proposal --title "delist EDD-0AC" --voting-period 7200 --deposit "200000000000:BNB" --justification " justification " --base-asset-symbol EDD-0AC --quote-asset-symbol BNB --from <your-key-name> --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --trust-node

    # testnet
    ./tbnbcli gov submit-delist-proposal --title "delist EDD-0AC" --voting-period 7200 --deposit "200000000000:BNB" --justification " justification " --base-asset-symbol EDD-0AC --quote-asset-symbol BNB --from <your-key-name> --chain-id Binance-Chain-Ganges --trust-node --node https://seed-pre-s3.bnbchain.org:443

    Submit fee param change proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --title"test csc change"title of proposalYes
    --fee-param-fileparam.jsonthe file of fee params (json format)Yes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainnet
    ./bnbcli params submit-fee-change-proposal --fee-param-file param.json --deposit 200000000000:BNB --voting-period 100 --title "test proposal" --from delegator1 --trust-node --chain-id Binance-Chain-Tigris --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli params submit-fee-change-proposal --fee-param-file param.json --deposit 200000000000:BNB --voting-period 100 --title "test proposal" --from delegator1 --trust-node --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Vote for proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --proposal-id1proposalID of proposal being queriedYes
    --optionYesvote option {yes, no, no_with_veto, abstain}Yes
    ## mainnet
    ./bnbcli gov vote --from alice --proposal-id 1 --option Yes --chain-id Binance-Chain-Tigris --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli gov vote --from alice --proposal-id 1 --option Yes --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Deposit for proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --proposal-id1proposalID of proposal being queriedYes
    --depositYesamount of depositYes
    ## mainnet
    ./bnbcli gov deposit --from alice --proposal-id 1 --deposit 1000000000:BNB --chain-id Binance-Chain-Tigris --node http://data-seed-pre-1-s1.bnbchain.org:80

    ## testnet
    ./tbnbcli gov deposit --from alice --proposal-id 1 --deposit 1000000000:BNB --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Query votes of proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --proposal-id1proposalID of proposal being queriedYes
    ## mainnet
    ./bnbcli gov query-votes --proposal-id 1 --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443

    ## testnet
    ./tbnbcli gov query-votes --proposal-id 1 --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80
    - + diff --git a/docs/beaconchain/imToken.html b/docs/beaconchain/imToken.html index a0a9ec89d8..c211f7bb75 100644 --- a/docs/beaconchain/imToken.html +++ b/docs/beaconchain/imToken.html @@ -8,13 +8,13 @@ - +

    imToken

    What is it?

    imToken is a decentralized digital wallet used to manage and safeguard a wide range of blockchain- and token-based assets, identities, and data.imToken allows its users to manage assets on 12 mainstream blockchains, as well as seamlessly connect with DApps via a decentralized applications browser.

    Instruction

    Resource

    - + diff --git a/docs/beaconchain/keys.html b/docs/beaconchain/keys.html index 4b687d417f..66b1d922e8 100644 --- a/docs/beaconchain/keys.html +++ b/docs/beaconchain/keys.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ transaction for you if the password is right.

    Usage

    The usage is the same for bnbcli and tbnbcli

    $ ./bnbcli keys
    Keys allows you to manage your local keystore for tendermint.

    These keys may be in any format supported by go-crypto and can be
    used by light-clients, full nodes, or any other application that
    needs to sign with a private key.

    Usage:
    bnbcli keys [command]

    Available Commands:
    mnemonic Compute the bip39 mnemonic for some input entropy
    add Create a new key, or import from seed
    list List all keys
    show Show key info for the given name

    delete Delete the given key
    update Change the password used to protect private key

    Flags:
    -h, --help help for keys

    Global Flags:
    -e, --encoding string Binary encoding (hex|b64|btc) (default "hex")
    --home string directory for config and data (default "/Users/yourname/.bnbcli")
    -o, --output string Output format (text|json) (default "text")
    --trace print out full stack trace on errors

    Use "bnbcli keys [command] --help" for more information about a command.

    mnemonic

    mnemonic is used to generate bip39 mnemonic.
    You can restore key from the mnemonic generated.

    $ ./bnbcli keys mnemonic
    uncle mule squirrel cover theory oven rookie dry intact alert right afraid differ ability mule struggle spray usual must purity social ball flat short

    add

    You can use add to create a new key or import from seed (mnemonic).
    You have to specify the name for the key you want to create.

    To import with a mnemonic phrase, you need to include the --recover flag in the command.

    create a new key

    $ ./bnbcli keys add testkey
    Enter a passphrase for your key:
    Repeat the passphrase:
    NAME: TYPE: ADDRESS: PUBKEY:
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv
    **Important** write this seed phrase in a safe place.
    It is the only way to recover your account if you ever forget your password.

    poverty joke nominee enough harsh elder flush noodle gift one limit tree sponsor sun radio above acid air winter inflict profit there brand water

    import from seed

    $ ./bnbcli keys add testkey --recover
    Enter a passphrase for your key:
    Repeat the passphrase:
    > Enter your recovery seed phrase:
    poverty joke nominee enough harsh elder flush noodle gift one limit tree sponsor sun radio above acid air winter inflict profit there brand water
    NAME: TYPE: ADDRESS: PUBKEY:
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv

    list

    list can list all the keys you have.

    $ ./bnbcli keys list
    NAME: TYPE: ADDRESS: PUBKEY:
    test local bnc16jv838jw8zcgucvrhreen73adwgnue6ujcz2cf bncp1addwnpepqgxacvpgnvss94zs363lheuh2xldj0hvymftuds8d69u5cau5kz3y23rj6l
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv

    show

    show is used to show the detail of the key by the name.

    $ ./bnbcli keys show testkey
    NAME: TYPE: ADDRESS: PUBKEY:
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv

    delete

    delete is used to delete the key.

    $ ./bnbcli keys delete testkey
    DANGER - enter password to permanently delete key:
    Password deleted forever (uh oh!)

    update

    update is used to update the password that is currently used to protect the private key.

    $ ./bnbcli keys update test
    Enter the current passphrase:
    Enter the new passphrase:
    Repeat the new passphrase:
    Password successfully updated!
    - + diff --git a/docs/beaconchain/learn/BEP8.html b/docs/beaconchain/learn/BEP8.html index e0b2369185..abeb471129 100644 --- a/docs/beaconchain/learn/BEP8.html +++ b/docs/beaconchain/learn/BEP8.html @@ -8,13 +8,13 @@ - +

    Introduction

    As explained in BEP8,the idea of BEP8 Tokens is raised to accommodate the small or micro projects, intellectual properties, and other small token economies to build a more comprehensive venue for token trading.

    Based on the limitation usage of the network, the cost of issuing of such BEP8 tokens are minimized to a different magnitude.

    Similar to SME board in the traditional stock markets, BEP8 tokens markets will increase the liquidity of utility tokens of startups or Intellectual Property (IP) tokens by removing the capital requirements for listing. One good example is the open-source license model. A software developer can issue a BEP8 token and link his work to it. This token will be used to cover licensing fees for his work in the future.

    Token Management

    Issue

    Issue is a transaction used to create a new asset. Anyone can issue a new token with fee paid. After issuing, the token would appear in the issuer's account as free balance.

    An issuance transaction contains:

    • Symbol: The length of the string for representing this asset is between 3 and 8 alphanumeric characters and is case insensitive. The symbol will have a suffix autogenerated by the algorithm: the first 3 bytes of the issue transaction hash, plus letter “M”.
    • TokenURI: Optional field. A distinct Uniform Resource Identifier (URI) for the token. The URI may point to a JSON file that conforms to the "Mini-BEP2 Metadata JSON Schema". The schema is also optional.
    • TokenType: 1 for tiny token and 2 for Mini token. Total supply range of tiny token is [1-10K] and mini-token is [1, 1 million]. Mini-token will charge more than tiny-token for issue.
    • TotalSupply: The total supply for this token can have a maximum of 8 digits of decimal and is boosted by 1e8 in order to store as int64. The amount before boosting should not exceed upper bound of supply range.
    • Owner: The initial issuer of this token, the BNB balance of issuer should be more than the fee for issuing tokens
    • Mintable: Whether this token could be minted(increased) after the initial issuing, --mintable means the token can be inflationary.

    Commands

    Example on mainnet:

    ./bnbcli token issue-tiny --home $home -s $symbol --token-name $token_name -n 10000 --mintable --from $from --token-uri http://www.example.com --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node
    ./bnbcli token issue-mini --home $home -s $symbol --token-name $token_name -n 1000000 --mintable --from $from --token-uri http://www.example.com --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node

    Transfer

    BEP8 Transfer type is the same as BEP2. The difference from BEP2 transfer is that the Mini-BEP2 transfer amount should be larger than or equal to 1, unless the sender sends the total amount of the free Mini-BEP2 token in his account.

    Commands

    Example on mainnet:

    ./bnbcli send --from $from-key-alias --to to-address --amount 200000000:mini-token-symbol --chain-id Binance-Chain-Tigris --node  https://dataseed5.defibit.io:443 --json

    Freeze

    The transaction type, message structure and transaction process are the same as BEP2, except that the amount should be larger than or equal to 1, or equal to the free account balance.

    Commands

    Example on mainnet:

    ./bnbcli token freeze --amount 200000000 --symbol $mini-token-symbol --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node

    Unfreeze

    The transaction type, message structure and transaction process are the same as BEP2 Tokens, except that the amount should be larger than or equal to 1, or equal to the frozen account balance.

    Commands

    Example on mainnet:

    ./bnbcli token unfreeze --amount 200000000 --symbol $mini-token-symbol --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Mint

    The transaction type, message structure and transaction process are the same as BEP2 Tokens, except that the amount should be larger than or equal to 1.

    Commands

    Example on mainnet:

    ./bnbcli token mint --amount 10000000000 --symbol $mini-token-symbol --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Burn

    The transaction type, message structure and transaction process are the same as BEP2 Tokens. The difference from BEP2 burn is that the Mini-BEP2 burn amount should be larger than or equal to 1, or equal to the free account balance.

    Commands

    Example on mainnet:

    ./bnbcli token burn --amount 100000000000 --symbol $mini-token-symbol --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Set Token URI

    The SetURI transaction is to change the value of TokenURI. Only token issuer can send this transaction. The URI may point to a JSON file that conforms to the "Mini-BEP2 Metadata JSON Schema".


    {
    "name": "Mini Token Metadata",
    "description": "Metadata description for the Mini Token",
    "external_url": "https://example.com/token",
    "image": "https://example.com/token/1.png",
    "attributes": [
    {
    "name": "custom field",
    "value": "custom value"
    },
    ...
    ]
    }

    Commands

    Example on mainnet:

    ./bnbcli token set-uri-mini --symbol $mini-token-symbol --token-uri http://www.efg.com --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Fee Table

    Mainnet

    API URL: https://dex.binance.org/api/v1/fees?format=amino

    Transaction TypePay in BNB
    TinyIssueFee4
    MiniIssueFee6
    SetUri0.00075

    Testnet

    API URL: https://testnet-dex.binance.org/api/v1/fees?format=amino

    Transaction TypePay in BNB
    TinyIssueFee4
    MiniIssueFee6
    SetUri0.00075
    - + diff --git a/docs/beaconchain/learn/BEP82.html b/docs/beaconchain/learn/BEP82.html index 71822c13e8..e5730e4efb 100644 --- a/docs/beaconchain/learn/BEP82.html +++ b/docs/beaconchain/learn/BEP82.html @@ -8,13 +8,13 @@ - +

    BEP82

    Note: this feature is only available in Testnet after Lagrange Upgrade.

    Introduction

    Before implementing BEP82, many token-related transactions, such as token listing, minting, burning, can only be proposed by the token owner. The owner of any BEP2/BEP8 token can not be changed once the token is issued on BNB Beacon Chain .

    BEP82 introduced the changes related to the token owner who issued a token on BNB Beacon Chain . It provides more convenience and flexibility for these transactions.

    Status

    This BEP is already implemented.

    Changes

    BEP82 introduce the following changes:

    • Token issuers can renounce their ownership and promote others
    • Allows token holders to burn their tokens

    New Transaction Type

    TransferOwnership transaction can transfer ownership of a specific token to another address, and only the original owner has the permission to send this transaction.

    Commands

    Example on mainnet:

    ./bnbcli token transfer-ownership --from  $current-owner --symbol $symbol --new-owner $new-owner  --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node

    Example on testnet:

    ./tbnbcli token transfer-ownership --from  $current-owner --symbol $symbol --new-owner $new-owner --chain-id Binance-Chain-Nile  --node=data-seed-pre-2-s1.bnbchain.org:80--trust-node

    Fees

    0.01 BNB will be charged on TransferOwnership transactions.

    - + diff --git a/docs/beaconchain/learn/accounts.html b/docs/beaconchain/learn/accounts.html index cd8a50acba..f35904255a 100644 --- a/docs/beaconchain/learn/accounts.html +++ b/docs/beaconchain/learn/accounts.html @@ -8,13 +8,13 @@ - +

    Accounts

    Whenever a new address receives an asset, the corresponding transaction would create an Account for that address, which contains balances across all assets that are owned on this address.

    Account Balance

    The balance (the amount of tokens) of each asset is composed of 3 different parts:

    • Available: the amount of tokens that can be transferred, and spent to swap (buy) other assets
    • Locked: the amount of tokens that has been used in any outstanding orders. Once the order terminates (either filled, canceled or expired), the locked amount will decrease.
    • Frozen: the amount of tokens that has been frozen via Freeze transactions.

    You can query the account info with the following command on mainnet:

    ./bnbcli account <your-address> --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --indent --trust-node

    Example output:

    Please note that the amount is boosted by e^8 for the decimal part.

    {"type":"bnbchain/Account","value":{"base":{"address":"tbnb1sylyjw032eajr9cyllp26n04300qzzre38qyv5","coins":[{"denom":"000-0E1","amount":"10530"},{"denom":"BNB","amount":"247349863800"},{"denom":"BTC.B-918","amount":"113218800"},{"denom":"COSMOS-587","amount":"50000101983748977"},{"denom":"EDU-DD0","amount":"139885964"},{"denom":"MFH-9B5","amount":"1258976083286"},{"denom":"NASC-137","amount":"0"},{"denom":"PPC-00A","amount":"205150260"},{"denom":"TGT-9FC","amount":"33251102828"},{"denom":"UCX-CC8","amount":"1398859649"},{"denom":"USDT.B-B7C","amount":"140456966268"},{"denom":"YLC-D8B","amount":"210572645"},{"denom":"ZZZ-21E","amount":"13988596"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"AhOb3ZXecsIqwqKw+HhTscyi6K35xYpKaJx10yYwE0Qa"},"account_number":"406226","sequence":"29"},"name":"","frozen":null,"locked":[{"denom":"KOGE48-35D","amount":"10000000000"}]}}

    From the output you can see that this account account_number is 406226 and its sequence is 29. This is the important information about this account.

    Account and Sequence Number

    After Account is created, besides the balances, Account also contains:

    • Account Number: an internal identifier for the account
    • Sequence Number: an ever-changing integer.

    The Sequence Number is the way how BNB Beacon Chain prevents Replay Attack (the idea is borrowed from Cosmos network, but varies a bit in handling). Every transaction should have a new Sequence Number increased by 1 from the current latest sequence number of the Account, and after this transaction is recorded on the blockchain, the Sequence Number will be set to the same number as the one of latest transaction.

    This logic forces the client to be aware of the current Sequence Number, either by reading from the blockchain via API, or keep the counting locally by themselves. The recommended way is to keep counting locally and re-synchronize from the blockchain periodically.

    Cryptographic Design

    For normal users, all the keys and addresses can be generated via Binance Web Wallet.

    This default wallet would use a similar way to generate keys as Bitcoin, i.e. use 256 bits entropy to generate a 24-word mnemonic based on BIP39, and then use the mnemonic and an empty passphrase to generate a seed; finally use the seed to generate a master key, and derive the private key using BIP32/BIP44 with HD prefix as "44'/714'/", which is reserved at SLIP 44.

    Keys

    BNB Beacon Chain uses the same elliptic curve cryptography as the current Bitcoin implementation, i.e. secp256k1. Its private key is 32 bytes while public key is 33 bytes.

    Address

    Addresses on BNB Beacon Chain are 20 bytes and may be expressed as:

    Address = RIPEMD160(SHA256(compressed public key))

    Typically, an address is encoded in the bech32 format which includes a checksum and human-readable prefix (HRP). However, it doesn't use the SegWit address format (because we do not have SegWit function anyway, so no witness program version etc.).

    A BNB Beacon Chain address is therefore more similar to a Bitcoin Cash address, which does not include a SegWit program script.

    Address format pseudo-code:

    Address_Bech32 = HRP + '1' + bech32.encode(convert8BitsTo5Bits(RIPEMD160(SHA256(compressed public key))))

    For BNB Beacon Chain address, the prefix is bnb for production network, and tbnb for testnet.

    Signature

    BNB Beacon Chain uses an ECDSA signature on curve secp256k1 against a SHA256 hash of the byte array of a JSON-encoded canonical representation of the transaction. For more information, please see this page.

    - + diff --git a/docs/beaconchain/learn/architecture.html b/docs/beaconchain/learn/architecture.html index d5d73c638c..1018acc56c 100644 --- a/docs/beaconchain/learn/architecture.html +++ b/docs/beaconchain/learn/architecture.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ A simplified overview of the application's architecture might look something like this:

    +------------+---------------------+
    | RPC API | Web API |
    +------------------------+---------+
    | Staking | Salshing | Cross Chain |
    +------------------------+---------+
    | Asset Management | Match Engine |
    +----------------------------------+
    | Account Management | Governance |---------> crypto and blockchain governance
    +----------------------------------+
    | State Caching and Persisence +-+
    +----------------------------------+ |
    | Consensus Protocol | |
    +----------------------------------+ |-----> revised Tendermint
    | P2P Protocol | |
    +----------------------------------+ |
    | Networking | Database +-+
    +----------------------------------+

    For more information about Tendermint, please have a look at the Tendermint Core. For more information about Cosmos SDK, please have a look at the Cosmos Intro.

    Modules

    BNB Beacon Chain implements a multi-modular blockchain architecture which is easy to extend and use, and also provides the basic functionalities for side chains and other chains to build upon it. Here are the main moudles:

    • Asset - A fruitful set of features are implemented for asset management, for example, users can issue, mint/burn, freeze/unfreeze, lock/unlock BEP2 and BEP8 tokens.

    • Governance - BNB Beacon Chain supports on-chain governance of BNB Beacon Chain and side chains. Holders of the native token (i.e., BNB) can submit proposals and vote on proposals to apply different kinds of changes on chains.

    • Staking - With this moudle, BNB holders can become validators and can delegate tokens to validators, ultimately determining the effective validator sets for BNB Beacon Chain and side chains (e.g., BSC).

    • Distribution - BNB Beacon Chain will actively distribute rewards between validators and delegators, for both BNB Beacon Chain itself and its side chains.

    • Cross Chain - BNB Beacon Chain supports the cross chain transfers of native tokens. Cross chain communication is also built in, to support different kinds of usage scenarios.

    • Slashing - Slashing module will disincentivize any bad actor by penalizing them.

    • Params - A globally available parameter store is provided by BNB Beacon Chain. These parameters affects the excution of BNB Beacon Chain itself and its side chains, and can be changed by goverenance.

    • APIs - RPC, HTTP, and Websocket APIs are provided for interacting with blockchains and the related services. Developers can use these APIs to build their Web3 applications, wallets, data services and so on.

    - + diff --git a/docs/beaconchain/learn/assets.html b/docs/beaconchain/learn/assets.html index dce881b244..618af776d2 100644 --- a/docs/beaconchain/learn/assets.html +++ b/docs/beaconchain/learn/assets.html @@ -8,13 +8,13 @@ - +

    Assets

    Assets are stored as tokens on BNB Beacon Chain , and the below management actions are available. All the assets are complied with BEP2 standard. BEP stands for BNB Chain Evolution Proposal. Each BEP will be a proposal document providing information to the BNB Beacon Chain /DEX community. The BEP should provide a concise technical specification of the feature or improvement and the rationale behind it. Each BEP proposer is responsible for building consensus within the community and documenting dissenting opinions. Each BEP has a unique index number.

    BEP2 Token Properties

    • Source Address: Source Address is the owner of the issued token.

    • Token Name: Token Name represents the long name of the token - e.g. "MyToken".

    • Symbol: Symbol is the identifier of the newly issued token.

    • Total Supply: Total supply will be the total number of issued tokens.

    • Mintable: Mintable means whether this token can be minted in the future, which would increase the total supply of the token

    Symbol Convention:

    [Symbol][b]-[Suffix]

    Explanations: Suffix is the first 3 bytes of the issue transaction’s hash, for example: BUSD-BD1. It helps to remove the constraint of requiring unique token names. If this token pegs to an existing blockchain, there should be an additional suffix of “B”.

    Issue Process:

    1. Issuer signed an issue transaction and broadcast it to one of BNB Beacon Chain nodes
    2. This BNB Beacon Chain node will check this transaction. If there is no error, then this transaction will be broadcasted to other BNB Beacon Chain nodes
    3. Issue transaction is committed on the blockchain by block proposer
    4. Validators will verify the constraints on total supply and symbol and deduct the fee from issuer’s account
    5. New token’s symbol is generated based on the transaction hash. It is added to the issuer’s address and token info is saved on the BNB Beacon Chain

    BNB

    The Build N Build Coin, BNB, is the native asset on BNB Beacon Chain . There are 200MM BNB coins in total. There will be no mining. The existing coin burns and freezes will still be in effect on the new BNB Beacon Chain blockchain.

    The exact number of BNB coins will be destroyed based on the same number of BNB ERC20 tokens that have already been destroyed.

    Since BNB Beacon Chain is live, all BNB ERC20 tokens will be swapped for BNB Beacon Chain coins. All users who hold BNB ERC20 tokens can deposit them to Binance.com, and upon withdrawal, the new BNB Beacon Chain native coins will be sent to their new wallets.

    - + diff --git a/docs/beaconchain/learn/atomic-swaps.html b/docs/beaconchain/learn/atomic-swaps.html index 0724b07e37..b331f0ef7d 100644 --- a/docs/beaconchain/learn/atomic-swaps.html +++ b/docs/beaconchain/learn/atomic-swaps.html @@ -8,16 +8,16 @@ - +

    Cross-chain Atomic Swaps

    Atomic Swap

    The problem of an atomic swap is one where (at least) two parties, Alice and Bob, own coins, and want to exchange them without having to trust a third party (centralized exchange).

    A non-atomic trivial solution would have Alice send her coins to Bob, and then have Bob send other coins to Alice - but Bob has the option of going back on his end of the bargain and simply not following through with the protocol, ending up with both sets of coins.

    Atomic swaps can be used for trading between BEP2 tokens, or for trading across different blockchains.

    Hash Timer Locked Contract

    HTLC has been used for Atomic Swap and cross payment channel for a few years on Bitcoin and its variant blockchains, and also Ethereum. This BEP defines native transactions to support HTLC on BNB Beacon Chain , and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token, which is called Atomic Peg.

    HTLC on BNB Beacon Chain

    As explained in BEP3, Hash Timer Locked Contract(HTLC) has been used for Atomic Swap and cross payment channels between different blockchains. BEP3 defines native transactions to support HTLC on BNB Beacon Chain and also proposes the standard infrastructure and procedure to use HTLC for inter-chain atomic swap to easily create and use pegged token. During the swap process, the related fund will be locked to a purely-code-controlled escrow account. -A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account has no its own private key and it's only controled by code in protocol. The code for calculating escrow account is the same as how it's done in cosmos-sdk:

    AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))

    The account for mainnet is: bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u and the account for testnet is: tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d. Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts.

    Hash Timer Locked Transfer

    Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain , to serve as HTLC in the first step of Atomic Swap,

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender address, where the asset is fromNo
    recipient-addrAddressReceiver address, where the asset is to, if the proper condition meets.No
    recipient-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
    sender-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
    RandomNumberHash32 byteshash of a random number and timestamp, based on SHA256. If left out, a random value will be generatedTrue
    Timestampint64Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used.No
    OutAmountCoinssimilar to the Coins in the original Transfer defined in BEP2, assets to swap outNo
    ExpectedIncomestringExpected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8No
    HeightSpanint64number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)No
    CrossChainboolSpecify if the HTLT is for cross chain atomic swapTrue, the default value is False

    Outputs

    NameTypeDescription
    Random number32 bytes
    Timestampint64
    Random number hash32 bytes
    Swap ID32 bytes

    Examples

    1. Swap between BEP2 tokens
    • On testnet:

    Command line

    ./tbnbcli token HTLT --recipient-addr <recipient-addr> --amount 100:BNB --expected-income <expectedIncome> --height-span <heightSpan> --from <from-addr> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
    const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
    const amount = [{
    denom: "BNB",
    amount: 100
    }]
    const expectedIncome = "100:BNB"// expected income
    const heightSpan = 400// height span
    const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)

    Example output:

    Please take a note of returned swapID:

    Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b
    Timestamp: 1568792486
    Random number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1
    Password to sign with 'guest':
    Committed at block 39984169 (
    tx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,
    response: {
    Code:0
    Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]
    Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
    Info: GasWanted:0 GasUsed:0
    ...
    )

    Besides, the Data field in the committed result is the byte array of swapID:

    Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]

    swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
    1. Swap from BNB Beacon Chain to Ethereum
    • Clients send HTLT on BNB Beacon Chain on testnet:

    Command line:

    ./tbnbcli token HTLT --from <from-addr> --chain-id Binance-Chain-Ganges  --height-span <heightSpan> --amount <amount> --expected-income <expectedIncome> --recipient-addr <deputy-bep2-addr>  --recipient-other-chain <client ethereum address>  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
    const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
    const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
    const amount = [{
    denom: "BNB",
    amount: 100
    }] // swap out token amount
    const expectedIncome = "100:BNB"// expected income
    const heightSpan = 400 // height span
    const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
    1. Swap from Ethereum to BNB Beacon Chain

    Note: Once cross-chain is true, --recipient-other-chain must not be empty

    • Deputy send HTLT on BNB Beacon Chain on testnet:

    Command line:

    ./tbnbcli token HTLT --from  <from-addr> --chain-id Binance-Chain-Ganges --height-span  <heightSpan>  --amount <amount> --expected-income <expectedIncome> --recipient-other-chain <deputy ethereum address> --sender-other-chain <client ethereum address> --recipient-addr <client bep2 address> --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
    const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address
    const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address
    const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract
    const timestamp = 1571383800 //deputy get this value from the event log of swap contract
    const amount = [{
    denom: "BNB",
    amount: 100
    }] // swap out token amount
    const expectedIncome = "100:BNB"// expected income
    const heightSpan = 400 // height span
    const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)

    Deposit HTLT

    Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender address, where the assets are fromNo
    SwapID32 bytesID of previously created swap, hex encodingNo
    AmountCoinsThe swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"No

    Examples

    • On testnet:

    Command line:

    ./tbnbcli token deposit --swap-id <swapID>  --amount 10000:TEST-599 --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
    const amount = [{
    denom: "TEST-599",
    amount: 10000
    }]
    const res = client.swap.depositHTLT(from, swapID, amount)

    Example output

    Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

    After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by swapID and the in_amount must equal to the amount that you balance decreased.

    Claim HTLT

    Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender addressNo
    SwapID32 bytesID of previously created swap, hex encodingNo
    RandomNumber32 bytesThe random number to unlock the locked hash, 32 bytes, hex encodingNo

    Examples

    • On testnet:

    Command line:

    ./tbnbcli token claim --swap-id  <swapID> --random-number <random-number> --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt
    const res = client.swap.claimHTLT(from, swapID, randomNumber)

    Example output:

    Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

    Refund HTLT

    Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender addressNo
    SwapID32 bytesID of previously created swap, hex encodingNo

    Examples

    • On testnet:

    Command line:

    ./tbnbcli token refund --swap-id <swapID> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
    const res = client.swap.refundHTLT(from, swapID, randomNumber)

    Common error:

    • Already complete
    ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}
    • Not expired
    ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}

    Query Atomic Swap

    Query atomic swap allows you to search swap information by swapID

    Parameters

    NameTypeDescriptionOptional
    SwapID32 bytesID of previously created swap, hex encodingNo

    Examples

    • On testnet:
    ./tbnbcli token query-swap --swap-id <swapID> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Expected output

    {
    "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",
    "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",
    "out_amount": [
    {
    "denom": "BNB",
    "amount": "100"
    }
    ],
    "in_amount": [
    {
    "denom": "TEST-599",
    "amount": "10000"
    }
    ],
    "expected_income": "10000:TEST-599",
    "recipient_other_chain": "",
    "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",
    "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",
    "timestamp": "1568792486",
    "cross_chain": false,
    "expire_height": "39994169",
    "index": "53",
    "closed_time": "1568792927",
    "status": "Completed"
    }

    Query Atomic Swap ID By Recipient

    Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface.

    Parameters

    NameTypeDescriptionOptional
    recipient-addrAddressSwap recipient addressNo

    Examples

    • On testnet:
    ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Example output:

    [
    "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",
    "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"
    ]

    Query Atomic Swap ID By Creator

    Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface.

    Parameters

    NameTypeDescriptionOptional
    creator-addrAddressSwap creator addressNo

    Examples

    • On testnet:
    ./tbnbcli token query-swapIDs-by-creator  --creator-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Example output:

    [
    "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",
    "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",
    "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",
    "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",
    "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"
    ]

    Fees

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    HTLTN/A0.000375 BNBY
    depositHTLTN/A0.000375 BNBY
    claimHTLTN/A0.000375 BNBY
    refundHTLTN/A0.000375 BNBY

    Workflows

    Preparations

    1. Deploy smart-contract which supports Atomic Peg Swap (APS), there is already one example for Ethereum
    2. Deploy deputy process for handling swap activities by token owners, there is an existing open-source solution here: https://github.com/bnb-chain/bep3-deputy
    3. Issue and transfer enough tokens

    Testnet Deployment

    Swap Tokens from Ethereum to BNB Beacon Chain

    image-20190918193751444

    1. Approve Swap Transaction

    Go to this page and approve some amount of tokens.

    • Function: Approve
    • Parameters:
      • _spender: address of smartcontract, which is 0x12DCBf79BE178479870A473A99d91f535ed960AD
      • _value: approved amount, should be bumped by e^10

    Note: Please approve more than 1token. In the following example, 100 PPC token was approved:

    Example of approve 100 PPC on ropsten testnet

    2. Call HTLT function From Ethereum

    Go to smartcontract and call HTLT function

    • Function: htlt
    • Parameters:
      • _randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array
      • _timestamp: it should be about 10 mins span around current timestamp
      • _heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy.
      • _recipientAddr: deputy address on Ethereum, it's 0x1C002969Fe201975eD8F054916b071672326858e for this one
      • _bep2SenderAddr: omit this field with 0x0
      • _bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9
      • _outAmount: approved amount, should be bumped by e^10
      • _bep2Amount: _outAmount * exchange rate, the default rate is 1

    Example of htlt transaction

    3. Deputy Call HTLT on BNB Beacon Chain

    Then, Deputy will send HTLT transaction here

    4. Claim HTLT on BNB Beacon Chain

    • Get the swapID on BNB Beacon Chain
    ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
    [
    "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"
    ]

    You can also get swapID by calculateSwapID in javascript-sdk. It requires three parameters:

    NameTypeDescriptionExample
    randomNumberHashstringrandomNumberHash in client HTLT transaction on Ethereum5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82
    senderstringdeputy bep2 addresstbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr
    senderOtherChainstringclient ethereum address0x133d144f52705ceb3f5801b63b9ebccf4102f5ed
    • Query the swap by swapID
    {
    "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",
    "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",
    "out_amount": [
    {
    "denom": "PPC-00A",
    "amount": "9999999000"
    }
    ],
    "in_amount": null,
    "expected_income": "",
    "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",
    "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",
    "random_number": "",
    "timestamp": "1569497984",
    "cross_chain": true,
    "expire_height": "41380567",
    "index": "1947",
    "closed_time": "",
    "status": "Open"
    }
    • Verify parameters in the swap:

      • random_number_hash must equal to the randomNumberHash in client HTLT transaction on ethereum
      • to must equals to client wallet address
      • timestamp must equal to the timestamp in client HTLT transaction on ethereum
      • out_amount should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees.
      • expire_height must not be passed and should be enough for send claim transaction
    • Send claim transaction on BNB Beacon Chain

    ./tbnbcli token claim --swap-id 12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128  --random-number <random-number> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Example of claim tx on testnet

    5. Deputy Claim ERC20 Token

    Deputy will claim ERC20 tokens afterwards with claim transaction

    6. Demo for Client APP: swap erc20 to bep2

    This is a javascript implementation for client app to swap PPC to PPC-00A with deputy.

      const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
    const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

    const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
    const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

    const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
    const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

    const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
    const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

    const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
    const bnbClient = new BncClient("https://testnet-dex.binance.org")
    await bnbClient.initChain()
    bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
    bnbClient.useDefaultSigningDelegate()
    bnbClient.useDefaultBroadcastDelegate()
    const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")

    const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
    const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

    //--------------------------------------------
    //Step1 approve erc20 to swap contract address
    //--------------------------------------------
    const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()
    let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
    let gasPrice = await web3.eth.getGasPrice()
    let gasLimit = 3000000
    let rawTx = {
    nonce: web3.utils.toHex(nonce),
    gasPrice: web3.utils.toHex(gasPrice),
    gasLimit: web3.utils.toHex(gasLimit),
    to: erc20ContractAddr,
    value: '0x00',
    data: approveData
    }
    var ethereumjs = require('ethereumjs-tx')
    var signTx = new ethereumjs(rawTx)
    signTx.sign(clientEthWalletKey)
    var serializedTx = signTx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
    await wait(20000)
    //----------------------------------------------------------------------------
    //Step2 call swap contract to send htlt transaction on Ethereum
    //----------------------------------------------------------------------------
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
    const timestamp = Math.floor(Date.now()/1000)
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
    const heightSpan = 1000
    const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
    const amount = 10000000000 // 10000000000:PPC, decimal is 10
    const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A

    const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()
    nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
    gasPrice = await web3.eth.getGasPrice()
    gasLimit = 3000000
    rawTx = {
    nonce: web3.utils.toHex(nonce),
    gasPrice: web3.utils.toHex(gasPrice),
    gasLimit: web3.utils.toHex(gasLimit),
    to: swapContractAddr,
    value: '0x00',
    data: htltData
    }
    ethereumjs = require('ethereumjs-tx')
    signTx = new ethereumjs(rawTx)
    signTx.sign(clientEthWalletKey)
    serializedTx = signTx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
    await wait(20000)

    //----------------------------------------------------------------------------
    //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters
    //----------------------------------------------------------------------------
    const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()
    console.log(swapID)
    let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
    while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {
    console.log("Waiting for the atomic swap created by deputy")
    await wait(5000)
    atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
    }
    const atomicSwap = await bnbClient.getSwapByID(swapID)
    console.log(atomicSwap)
    const status = await bnbRPC.status()
    expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)
    expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))
    expect(atomicSwap.result.timestamp).toBe(timestamp)
    expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")
    expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)

    //----------------------------------------------------------------------------
    //Step4 claim on BNB Beacon Chain
    //----------------------------------------------------------------------------
    const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)
    console.log(res)

    //----------------------------------------------------------------------------
    //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum
    //----------------------------------------------------------------------------

    Swap Tokens from BNB Beacon Chain to Ethereum

    image-20190918193910521

    1. Send HTLT Transaction from BNB Beacon Chain

    Please read this section to generate a valid HTLT transaction. Please write down the randomNumber and randomNumberHash.

    ./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr  --chain-id Binance-Chain-Ganges  --height-span 10000 --amount  9900000000:PPC-00A  --expected-income 9900000000:PPC  --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
    Random number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e
    Timestamp: 1569578936
    Random number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e
    Committed at block 634510 (
    tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,
    response: {
    Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]
    Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2
    ...
    )

    Note: the swap amount must be positive.

    Please write down the random number, random number hash, swapID and timestamp for next steps.

    Example is here

    Then, you can query the the swap by SwapID:

    ./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    You can use this swapID for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters.

    2. Deputy Approve Tokens

    You should see that Deputy has approve enough amount of tokens for atomic swap.

    3. Deputy Send HTLT on Ethereum

    You should see that Deputy has sent the htlt transaction afterwards

    To get the swapID on Ethereum, you can check this page -0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e is the swapID on Ethereum.

    4. Claim ERC20 Tokens on Ethereum

    You should see that Deputy has already approved enough tokens and

    In its event log, you should see the swapID. Before calling claim function on ethereum, clients should verify the parameters in the HTLT event.

    • _randomNumberHash must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain
    • _recipientAddr must equal to client ethereum wallet address
    • _timestamp must equal to the timestamp in client HTLT transaction on BNB Beacon Chain
    • _outAmount should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees.
    • _expireHeight must not be passed and should be enough for send claim transaction

    Then, you can call the claim function:

    • Function: claim
    • Parameters:
      • _swapID: this is get from event, you can also calculate it from calSwapID function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})
      • _randomNumber: reveal your randomNumber

    Example is here

    5. Deputy Claim on BNB Beacon Chain

    Claim HTLT transaction from Deputy is sent afterwards:

    6. Demo for Client APP: swap bep2 to erc20

    This is a javascript implementation for client app to swap PPC-00A to PPC with deputy.

      const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
    const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

    const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
    const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

    const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
    const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

    const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
    const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

    const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
    const bnbClient = new BncClient("https://testnet-dex.binance.org")
    await bnbClient.initChain()
    bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
    bnbClient.useDefaultSigningDelegate()
    bnbClient.useDefaultBroadcastDelegate()
    const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")

    const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
    const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

    //--------------------------------------------
    //Step1 send htlt on BNB Beacon Chain
    //--------------------------------------------
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
    const timestamp = Math.floor(Date.now()/1000)
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
    const heightSpan = 10000
    const amount = [{
    denom: "PPC-00A",
    amount: 100000000
    }]
    const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC

    bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
    await wait(1000)

    //----------------------------------------------------------------------------
    //Step2 query swap created by deputy on Ethereum and verify swap parameters
    //----------------------------------------------------------------------------
    const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
    const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()
    console.log(swapID)

    let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
    while (openSwap._randomNumberHash == '0x0000000000000000000000000000000000000000000000000000000000000000') {
    console.log("Waiting for the atomic swap created by deputy")
    await wait(5000)
    openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
    }
    let ethBlock = await web3.eth.getBlock('latest')
    let ethLatestHeight = ethBlock.number
    expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)
    expect(Number(openSwap._timestamp)).toBe(timestamp)
    expect(Number(openSwap._outAmount)).toBe(9999990000)
    expect(openSwap._recipient).toBe(clientEthWalletAddr)
    expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)

    //----------------------------------------------------------------------------
    //Step3 claim on Ethereum
    //----------------------------------------------------------------------------
    const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()
    let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
    let gasPrice = await web3.eth.getGasPrice()
    let gasLimit = 3000000
    let rawTx = {
    nonce: web3.utils.toHex(nonce),
    gasPrice: web3.utils.toHex(gasPrice),
    gasLimit: web3.utils.toHex(gasLimit),
    to: swapContractAddr,
    value: '0x00',
    data: claimData
    }
    var ethereumjs = require('ethereumjs-tx')
    var signTx = new ethereumjs(rawTx)
    signTx.sign(clientEthWalletKey)
    var serializedTx = signTx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
    await wait(20000)

    //----------------------------------------------------------------------------
    //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain
    //----------------------------------------------------------------------------

    Swap between Several BEP2 tokens

    image-20190918193422062

    Swap between Several BEP2 tokens fails

    image-20190918193518929

    - +A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account has no its own private key and it's only controled by code in protocol. The code for calculating escrow account is the same as how it's done in cosmos-sdk:

    AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))

    The account for mainnet is: bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u and the account for testnet is: tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d. Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts.

    Hash Timer Locked Transfer

    Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain , to serve as HTLC in the first step of Atomic Swap,

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender address, where the asset is fromNo
    recipient-addrAddressReceiver address, where the asset is to, if the proper condition meets.No
    recipient-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
    sender-other-chainbytesa byte array, maximum 32 bytes, in any proper encoding. leave it empty for single chain swapYes
    RandomNumberHash32 byteshash of a random number and timestamp, based on SHA256. If left out, a random value will be generatedTrue
    Timestampint64Supposed to be the time of sending transaction, counted by second. It should be identical to the one in swap contract. If left out, current timestamp will be used.No
    OutAmountCoinssimilar to the Coins in the original Transfer defined in BEP2, assets to swap outNo
    ExpectedIncomestringExpected income from swap counter party, example: "100:BNB" or "100:BNB,10000:BTCB-1DE" The amount needs to be bumped by e^8No
    HeightSpanint64number of blocks to wait before the asset may be returned to From if not claimed via Random. The number must be larger than or equal to 360 (>2 minutes), and smaller than 518400 (< 48 hours)No
    CrossChainboolSpecify if the HTLT is for cross chain atomic swapTrue, the default value is False

    Outputs

    NameTypeDescription
    Random number32 bytes
    Timestampint64
    Random number hash32 bytes
    Swap ID32 bytes

    Examples

    1. Swap between BEP2 tokens
    • On testnet:

    Command line

    ./tbnbcli token HTLT --recipient-addr <recipient-addr> --amount 100:BNB --expected-income <expectedIncome> --height-span <heightSpan> --from <from-addr> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
    const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
    const amount = [{
    denom: "BNB",
    amount: 100
    }]
    const expectedIncome = "100:BNB"// expected income
    const heightSpan = 400// height span
    const res = client.swap.HTLT(from, recipient, "", "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, false)

    Example output:

    Please take a note of returned swapID:

    Random number: 927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b
    Timestamp: 1568792486
    Random number hash: 5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1
    Password to sign with 'guest':
    Committed at block 39984169 (
    tx hash: B5A3DD92A40E98745BBE9F608944FE5511B81071B34E9947A754A04A5F378A85,
    response: {
    Code:0
    Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]
    Log:Msg 0: swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
    Info: GasWanted:0 GasUsed:0
    ...
    )

    Besides, the Data field in the committed result is the byte array of swapID:

    Data:[77 137 139 200 85 141 170 77 129 116 134 215 169 59 119 178 200 47 206 194 18 58 191 74 30 183 210 82 18 55 236 205]

    swapID: 4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd
    1. Swap from BNB Beacon Chain to Ethereum
    • Clients send HTLT on BNB Beacon Chain on testnet:

    Command line:

    ./tbnbcli token HTLT --from <from-addr> --chain-id Binance-Chain-Ganges  --height-span <heightSpan> --amount <amount> --expected-income <expectedIncome> --recipient-addr <deputy-bep2-addr>  --recipient-other-chain <client ethereum address>  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
    const recipientOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004"//client ethereum address
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"// 32 bytes random number
    const timestamp = Math.floor(Date.now()/1000)// take the current timestamp
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp)
    const amount = [{
    denom: "BNB",
    amount: 100
    }] // swap out token amount
    const expectedIncome = "100:BNB"// expected income
    const heightSpan = 400 // height span
    const res = client.swap.HTLT(from, recipient, recipientOtherChain, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
    1. Swap from Ethereum to BNB Beacon Chain

    Note: Once cross-chain is true, --recipient-other-chain must not be empty

    • Deputy send HTLT on BNB Beacon Chain on testnet:

    Command line:

    ./tbnbcli token HTLT --from  <from-addr> --chain-id Binance-Chain-Ganges --height-span  <heightSpan>  --amount <amount> --expected-income <expectedIncome> --recipient-other-chain <deputy ethereum address> --sender-other-chain <client ethereum address> --recipient-addr <client bep2 address> --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const recipient = "tbnb1prrujx8kkukrcrppklggadhuvegfnx8pemsq77"// recipient address
    const recipientOtherChain="0xfA5E36a04EeF3152092099F352DDbe88953bB540"//client ethereum address
    const senderOtherChain="0x37B8516a0F88E65D677229b402ec6C1e0E333004" //client ethereum address
    const randomNumberHash = "6632eda86c4f19190c8a986e188526eee865e1ce2758ba59c8bf45e20ffa3bb5" //deputy get this value from the event log of swap contract
    const timestamp = 1571383800 //deputy get this value from the event log of swap contract
    const amount = [{
    denom: "BNB",
    amount: 100
    }] // swap out token amount
    const expectedIncome = "100:BNB"// expected income
    const heightSpan = 400 // height span
    const res = client.swap.HTLT(from, recipient, recipientOtherChain, senderOtherChain, randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)

    Deposit HTLT

    Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender address, where the assets are fromNo
    SwapID32 bytesID of previously created swap, hex encodingNo
    AmountCoinsThe swapped out amount BEP2 tokens, example: "100:BNB" or "100:BNB,10000:BTCB-1DE"No

    Examples

    • On testnet:

    Command line:

    ./tbnbcli token deposit --swap-id <swapID>  --amount 10000:TEST-599 --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const from = "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd"// sender address
    const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
    const amount = [{
    denom: "TEST-599",
    amount: 10000
    }]
    const res = client.swap.depositHTLT(from, swapID, amount)

    Example output

    Committed at block 39984686 (tx hash: AA118F7CFCB3FFF86EF5EED8D2B9ADEAC5D9F242497910DAA232BDE5F6A84C1E, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[100 101 112 111 115 105 116 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

    After the deposit, you may observe that the balance of sender is decreased. The amount in deposit transaction must be positive. Besides, you can query the swap by swapID and the in_amount must equal to the amount that you balance decreased.

    Claim HTLT

    Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender addressNo
    SwapID32 bytesID of previously created swap, hex encodingNo
    RandomNumber32 bytesThe random number to unlock the locked hash, 32 bytes, hex encodingNo

    Examples

    • On testnet:

    Command line:

    ./tbnbcli token claim --swap-id  <swapID> --random-number <random-number> --from <from-key> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3" // the random number generated in htlt
    const res = client.swap.claimHTLT(from, swapID, randomNumber)

    Example output:

    Committed at block 39984971 (tx hash: 15B8625E0247DE54700D3C5C110BE0CE279D33CC13A73845F3E0305758A40902, response: {Code:0 Data:[] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 110 107 120 57 57 52 113 118 113 109 113 103 107 53 55 118 103 117 113 104 54 122 106 108 97 99 113 122 120 100 107 117 101 53 122 106 121 120] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[115 101 110 100 101 114] Value:[116 98 110 98 49 119 120 101 112 108 121 119 55 120 56 97 97 104 121 57 51 119 57 54 121 104 119 109 55 120 99 113 51 107 101 52 102 102 97 115 112 51 100] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[114 101 99 105 112 105 101 110 116] Value:[116 98 110 98 49 103 57 114 122 99 48 101 50 106 102 56 101 102 51 113 112 57 97 120 56 104 48 112 109 112 109 118 106 122 119 109 116 113 52 106 120 102 114] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {Key:[97 99 116 105 111 110] Value:[99 108 97 105 109 72 84 76 84] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})

    Refund HTLT

    Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

    Parameters

    NameTypeDescriptionOptional
    FromAddressSender addressNo
    SwapID32 bytesID of previously created swap, hex encodingNo

    Examples

    • On testnet:

    Command line:

    ./tbnbcli token refund --swap-id <swapID> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Javascript:

      const client = new BncClient("https://testnet-dex.binance.org")
    const privateKey = crypto.getPrivateKeyFromMnemonic(mnemonic)
    client.setPrivateKey(privateKey)
    const swapID = "61daf59e977c5f718f5aaedeaf69ccbea1c376db5274a84bca88848696164ffe" // the ID of an existing swap
    const res = client.swap.refundHTLT(from, swapID, randomNumber)

    Common error:

    • Already complete
    ERROR: {"codespace":8,"code":12,"abci_code":524300,"message":"Expected swap status is Open, actually it is Completed"}
    • Not expired
    ERROR: {"codespace":8,"code":8,"abci_code":524296,"message":"Current block height is 40003412, the expire height (40013236) is still not reached"}

    Query Atomic Swap

    Query atomic swap allows you to search swap information by swapID

    Parameters

    NameTypeDescriptionOptional
    SwapID32 bytesID of previously created swap, hex encodingNo

    Examples

    • On testnet:
    ./tbnbcli token query-swap --swap-id <swapID> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Expected output

    {
    "from": "tbnb1g9rzc0e2jf8ef3qp9ax8h0pmpmvjzwmtq4jxfr",
    "to": "tbnb1nkx994qvqmqgk57vguqh6zjlacqzxdkue5zjyx",
    "out_amount": [
    {
    "denom": "BNB",
    "amount": "100"
    }
    ],
    "in_amount": [
    {
    "denom": "TEST-599",
    "amount": "10000"
    }
    ],
    "expected_income": "10000:TEST-599",
    "recipient_other_chain": "",
    "random_number_hash": "5768702259ee55983378d7b8207890c666648264524b9dada551386f832ba6b1",
    "random_number": "927c1ac33100bdbb001de19c626a05a7c3c11304fc825f5eabb22e741507711b",
    "timestamp": "1568792486",
    "cross_chain": false,
    "expire_height": "39994169",
    "index": "53",
    "closed_time": "1568792927",
    "status": "Completed"
    }

    Query Atomic Swap ID By Recipient

    Query atomic swap ID allows you to search swap history of an recipient. As this is a heavy query interface, some public nodes might close this query interface.

    Parameters

    NameTypeDescriptionOptional
    recipient-addrAddressSwap recipient addressNo

    Examples

    • On testnet:
    ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Example output:

    [
    "4d898bc8558daa4d817486d7a93b77b2c82fcec2123abf4a1eb7d2521237eccd",
    "e7cc2e2eb025cc4617ff0bb84fcffc973d7ba34f15dbc51383fe3543ff143e9c"
    ]

    Query Atomic Swap ID By Creator

    Query atomic swap ID allows you to search swap history of an initiator. As this is a heavy query interface, some public nodes might close this query interface.

    Parameters

    NameTypeDescriptionOptional
    creator-addrAddressSwap creator addressNo

    Examples

    • On testnet:
    ./tbnbcli token query-swapIDs-by-creator  --creator-addr <address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Example output:

    [
    "7341d4ea0519af90d98f60fee45fdc7e385621875ea982bc8caf1fd7a49af8c3",
    "290664c1e8123966d8f9050fdc9d93e94b0e51b36e2e2a6978e492d3796423f1",
    "b260dad3cf63e558fe102a050afbe52d5dd2e30c7db76da33d02ce5f85d07fcf",
    "2b532bf9171c4d33d80fc4a8d6603581a86345b41552337482224d8476fcf5f7",
    "20d22bbfa579520f0ba79cd176fb2b06aa8dbe5b0a6ba8c9b761129f6a42a94c"
    ]

    Fees

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    HTLTN/A0.000375 BNBY
    depositHTLTN/A0.000375 BNBY
    claimHTLTN/A0.000375 BNBY
    refundHTLTN/A0.000375 BNBY

    Workflows

    Preparations

    1. Deploy smart-contract which supports Atomic Peg Swap (APS), there is already one example for Ethereum
    2. Deploy deputy process for handling swap activities by token owners, there is an existing open-source solution here: https://github.com/bnb-chain/bep3-deputy
    3. Issue and transfer enough tokens

    Testnet Deployment

    Swap Tokens from Ethereum to BNB Beacon Chain

    image-20190918193751444

    1. Approve Swap Transaction

    Go to this page and approve some amount of tokens.

    • Function: Approve
    • Parameters:
      • _spender: address of smartcontract, which is 0x12DCBf79BE178479870A473A99d91f535ed960AD
      • _value: approved amount, should be bumped by e^10

    Note: Please approve more than 1token. In the following example, 100 PPC token was approved:

    Example of approve 100 PPC on ropsten testnet

    2. Call HTLT function From Ethereum

    Go to smartcontract and call HTLT function

    • Function: htlt
    • Parameters:
      • _randomNumberHash: SHA256(randomNumber||timestamp), randomNumber is 32-length random byte array
      • _timestamp: it should be about 10 mins span around current timestamp
      • _heightSpan: it's a customized filed for deputy operator. it should be more than 200 for this deputy.
      • _recipientAddr: deputy address on Ethereum, it's 0x1C002969Fe201975eD8F054916b071672326858e for this one
      • _bep2SenderAddr: omit this field with 0x0
      • _bep2RecipientAddr: Decode your testnet address from bech32 encoded to hex, for example: 0xc41f2a85e1d3629637de1222017dce46c6c8e4b9
      • _outAmount: approved amount, should be bumped by e^10
      • _bep2Amount: _outAmount * exchange rate, the default rate is 1

    Example of htlt transaction

    3. Deputy Call HTLT on BNB Beacon Chain

    Then, Deputy will send HTLT transaction here

    4. Claim HTLT on BNB Beacon Chain

    • Get the swapID on BNB Beacon Chain
    ./tbnbcli token query-swapIDs-by-recipient  --recipient-addr tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
    [
    "12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128"
    ]

    You can also get swapID by calculateSwapID in javascript-sdk. It requires three parameters:

    NameTypeDescriptionExample
    randomNumberHashstringrandomNumberHash in client HTLT transaction on Ethereum5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82
    senderstringdeputy bep2 addresstbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr
    senderOtherChainstringclient ethereum address0x133d144f52705ceb3f5801b63b9ebccf4102f5ed
    • Query the swap by swapID
    {
    "from": "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr",
    "to": "tbnb1cs0j4p0p6d3fvd77zg3qzlwwgmrv3e9e63423w",
    "out_amount": [
    {
    "denom": "PPC-00A",
    "amount": "9999999000"
    }
    ],
    "in_amount": null,
    "expected_income": "",
    "recipient_other_chain": "0x1C002969Fe201975eD8F054916b071672326858e",
    "random_number_hash": "5a3728a8f4ecb8b4cb0b983a9441b7d69f95229c4aa531e6e3827d7c19beac82",
    "random_number": "",
    "timestamp": "1569497984",
    "cross_chain": true,
    "expire_height": "41380567",
    "index": "1947",
    "closed_time": "",
    "status": "Open"
    }
    • Verify parameters in the swap:

      • random_number_hash must equal to the randomNumberHash in client HTLT transaction on ethereum
      • to must equals to client wallet address
      • timestamp must equal to the timestamp in client HTLT transaction on ethereum
      • out_amount should be reasonable. Please note that the decimals of bep2 tokens is 8, the out_amount should be something around 10000000000:PPC, deputy will deduct some fees.
      • expire_height must not be passed and should be enough for send claim transaction
    • Send claim transaction on BNB Beacon Chain

    ./tbnbcli token claim --swap-id 12aacc3bdc2cef97e8e45cc9b409796df57904a4e9c76863ad8420ff75f13128  --random-number <random-number> --from <from-key>  --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Example of claim tx on testnet

    5. Deputy Claim ERC20 Token

    Deputy will claim ERC20 tokens afterwards with claim transaction

    6. Demo for Client APP: swap erc20 to bep2

    This is a javascript implementation for client app to swap PPC to PPC-00A with deputy.

      const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
    const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

    const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
    const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

    const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
    const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

    const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
    const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

    const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
    const bnbClient = new BncClient("https://testnet-dex.binance.org")
    await bnbClient.initChain()
    bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
    bnbClient.useDefaultSigningDelegate()
    bnbClient.useDefaultBroadcastDelegate()
    const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")

    const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
    const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

    //--------------------------------------------
    //Step1 approve erc20 to swap contract address
    //--------------------------------------------
    const approveData = erc20Contract.methods.increaseAllowance(swapContractAddr, 10000000000).encodeABI()
    let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
    let gasPrice = await web3.eth.getGasPrice()
    let gasLimit = 3000000
    let rawTx = {
    nonce: web3.utils.toHex(nonce),
    gasPrice: web3.utils.toHex(gasPrice),
    gasLimit: web3.utils.toHex(gasLimit),
    to: erc20ContractAddr,
    value: '0x00',
    data: approveData
    }
    var ethereumjs = require('ethereumjs-tx')
    var signTx = new ethereumjs(rawTx)
    signTx.sign(clientEthWalletKey)
    var serializedTx = signTx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
    await wait(20000)
    //----------------------------------------------------------------------------
    //Step2 call swap contract to send htlt transaction on Ethereum
    //----------------------------------------------------------------------------
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
    const timestamp = Math.floor(Date.now()/1000)
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
    const heightSpan = 1000
    const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
    const amount = 10000000000 // 10000000000:PPC, decimal is 10
    const expectedIncome = 99999000 //"99999000:PPC-00A", decimal is 8, deputy will deduct swap fee, the swap fee is 1000:PPC-00A

    const htltData = swapContract.methods.htlt("0x"+randomNumberHash, timestamp, heightSpan, deputyEthWalletAddr, "0x0", hexEncodingClientBNBaddr, amount, expectedIncome).encodeABI()
    nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
    gasPrice = await web3.eth.getGasPrice()
    gasLimit = 3000000
    rawTx = {
    nonce: web3.utils.toHex(nonce),
    gasPrice: web3.utils.toHex(gasPrice),
    gasLimit: web3.utils.toHex(gasLimit),
    to: swapContractAddr,
    value: '0x00',
    data: htltData
    }
    ethereumjs = require('ethereumjs-tx')
    signTx = new ethereumjs(rawTx)
    signTx.sign(clientEthWalletKey)
    serializedTx = signTx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
    await wait(20000)

    //----------------------------------------------------------------------------
    //Step3 query swap created by deputy on BNB Beacon Chain and verify swap parameters
    //----------------------------------------------------------------------------
    const swapID = calculateSwapID(randomNumberHash.replace("0x", ""), deputyBNBWalletAddr, clientEthWalletAddr).toString()
    console.log(swapID)
    let atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
    while (atomicSwapList.result.atomicSwaps[0].swapId != swapID) {
    console.log("Waiting for the atomic swap created by deputy")
    await wait(5000)
    atomicSwapList = await bnbClient.getSwapByRecipient(clientBnbWalletAddr,1000, 0)
    }
    const atomicSwap = await bnbClient.getSwapByID(swapID)
    console.log(atomicSwap)
    const status = await bnbRPC.status()
    expect(atomicSwap.result.toAddr).toBe(clientBnbWalletAddr)
    expect(atomicSwap.result.randomNumberHash).toBe(randomNumberHash.replace("0x", ""))
    expect(atomicSwap.result.timestamp).toBe(timestamp)
    expect(atomicSwap.result.outAmount).toBe("99999000:PPC-00A")
    expect(Number(atomicSwap.result.expireHeight)).toBeGreaterThan(Number(status.sync_info.latest_block_height)+100)

    //----------------------------------------------------------------------------
    //Step4 claim on BNB Beacon Chain
    //----------------------------------------------------------------------------
    const res = await bnbClient.swap.claimHTLT(clientBnbWalletAddr, swapID, randomNumber)
    console.log(res)

    //----------------------------------------------------------------------------
    //If step3 or step4 are failed and the expire height on Ethereum is passed, try to call refund method on Ethereum
    //----------------------------------------------------------------------------

    Swap Tokens from BNB Beacon Chain to Ethereum

    image-20190918193910521

    1. Send HTLT Transaction from BNB Beacon Chain

    Please read this section to generate a valid HTLT transaction. Please write down the randomNumber and randomNumberHash.

    ./tbnbcli token HTLT --from atomic --recipient-addr tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr  --chain-id Binance-Chain-Ganges  --height-span 10000 --amount  9900000000:PPC-00A  --expected-income 9900000000:PPC  --recipient-other-chain 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed  --cross-chain --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
    Random number: 4811959406ea3e69721d944d308880ec41323b7f89e51a78df3693348779315e
    Timestamp: 1569578936
    Random number hash: b03f256c9efdb97b9815faa1417e1da4cca7672e0bb26e4e7d9bfc82d0f1f15e
    Committed at block 634510 (
    tx hash: 9DEF124E12DE123BA1CC75AA6E68F20CC48EBBE9D7693CE4D0416267C6C0F159,
    response: {
    Code:0 Data:[229 50 241 60 76 91 112 146 93 68 100 222 83 84 180 133 181 151 241 174 93 125 132 82 245 198 5 66 0 123 32 113]
    Log:Msg 0: swapID: f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2
    ...
    )

    Note: the swap amount must be positive.

    Please write down the random number, random number hash, swapID and timestamp for next steps.

    Example is here

    Then, you can query the the swap by SwapID:

    ./tbnbcli token query-swap --swap-id f85dd907df0a5897927b949c0f9e2563d453ba698ff9941fed1ce91f8057afc2 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    You can use this swapID for refund if the deputy doesn't send htlt transaction on ethereum with proper parameters.

    2. Deputy Approve Tokens

    You should see that Deputy has approve enough amount of tokens for atomic swap.

    3. Deputy Send HTLT on Ethereum

    You should see that Deputy has sent the htlt transaction afterwards

    To get the swapID on Ethereum, you can check this page +0xd3bacf63906af5459ead39f27cae189e2f3e76fda34523714a4c61d76c79ee4e is the swapID on Ethereum.

    4. Claim ERC20 Tokens on Ethereum

    You should see that Deputy has already approved enough tokens and

    In its event log, you should see the swapID. Before calling claim function on ethereum, clients should verify the parameters in the HTLT event.

    • _randomNumberHash must equal to the randomNumberHash in client HTLT transaction on BNB Beacon Chain
    • _recipientAddr must equal to client ethereum wallet address
    • _timestamp must equal to the timestamp in client HTLT transaction on BNB Beacon Chain
    • _outAmount should be reasonable. Please note that the decimals erc20 contract and deputy will deduct some fees.
    • _expireHeight must not be passed and should be enough for send claim transaction

    Then, you can call the claim function:

    • Function: claim
    • Parameters:
      • _swapID: this is get from event, you can also calculate it from calSwapID function in the contract. calSwapID(randomNumberHash, {deputy ethereum address}, {hex encoding client binance address})
      • _randomNumber: reveal your randomNumber

    Example is here

    5. Deputy Claim on BNB Beacon Chain

    Claim HTLT transaction from Deputy is sent afterwards:

    6. Demo for Client APP: swap bep2 to erc20

    This is a javascript implementation for client app to swap PPC-00A to PPC with deputy.

      const erc20ContractAddr = "0xd93395b2771914e1679155f3ea58c41d89d96098"
    const swapContractAddr = "0x12DCBf79BE178479870A473A99d91f535ed960AD"

    const deputyEthWalletAddr = "0x1C002969Fe201975eD8F054916b071672326858e"
    const deputyBNBWalletAddr = "tbnb1pk45lc2k7lmf0pnfa59l0uhwrvpk8shsema7gr"

    const clientEthWalletAddr = "0xfA5E36a04EeF3152092099F352DDbe88953bB540"
    const clientEthWalletKey = new Buffer("89A0F0E0732ACAA7AD37C9E6D7A9798ECCE6940C63FF0290A58B1C1C1697486A", "hex")

    const clientBnbWalletAddr = "tbnb17vwyu8npjj5pywh3keq2lm7d4v76n434pwd8av"
    const clientBnbWalletMnemonic = "lawsuit margin siege phrase fabric matrix like picnic day thrive correct velvet stool type broom upon flee fee ten senior install wrestle soap sick"

    const web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/v3/1c5b38a27f92410cb5feb13b6efb2e14"))
    const bnbClient = new BncClient("https://testnet-dex.binance.org")
    await bnbClient.initChain()
    bnbClient.setPrivateKey(crypto.getPrivateKeyFromMnemonic(clientBnbWalletMnemonic))
    bnbClient.useDefaultSigningDelegate()
    bnbClient.useDefaultBroadcastDelegate()
    const bnbRPC = new rpcClient("https://data-seed-pre-0-s1.bnbchain.org:443", "testnet")

    const erc20Contract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"account","type":"address"}],"name":"isPauser","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint8"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"account","type":"address"}],"name":"PauserRemoved","type":"event"}],erc20ContractAddr)
    const swapContract = new web3.eth.Contract([{"constant":true,"inputs":[],"name":"ERC20ContractAddr","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"isSwapExist","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refund","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_swapSender","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"}],"name":"calSwapID","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_swapID","type":"bytes32"},{"name":"_randomNumber","type":"bytes32"}],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_heightSpan","type":"uint256"},{"name":"_recipientAddr","type":"address"},{"name":"_bep2SenderAddr","type":"bytes20"},{"name":"_bep2RecipientAddr","type":"bytes20"},{"name":"_outAmount","type":"uint256"},{"name":"_bep2Amount","type":"uint256"}],"name":"htlt","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"claimable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"refundable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_swapID","type":"bytes32"}],"name":"queryOpenSwap","outputs":[{"name":"_randomNumberHash","type":"bytes32"},{"name":"_timestamp","type":"uint64"},{"name":"_expireHeight","type":"uint256"},{"name":"_outAmount","type":"uint256"},{"name":"_sender","type":"address"},{"name":"_recipient","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_erc20Contract","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_timestamp","type":"uint64"},{"indexed":false,"name":"_bep2Addr","type":"bytes20"},{"indexed":false,"name":"_expireHeight","type":"uint256"},{"indexed":false,"name":"_outAmount","type":"uint256"},{"indexed":false,"name":"_bep2Amount","type":"uint256"}],"name":"HTLT","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"}],"name":"Refunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_msgSender","type":"address"},{"indexed":true,"name":"_recipientAddr","type":"address"},{"indexed":true,"name":"_swapID","type":"bytes32"},{"indexed":false,"name":"_randomNumberHash","type":"bytes32"},{"indexed":false,"name":"_randomNumber","type":"bytes32"}],"name":"Claimed","type":"event"}], swapContractAddr)

    //--------------------------------------------
    //Step1 send htlt on BNB Beacon Chain
    //--------------------------------------------
    const randomNumber = "e8eae926261ab77d018202434791a335249b470246a7b02e28c3b2fb6ffad8f3"
    const timestamp = Math.floor(Date.now()/1000)
    const randomNumberHash = calculateRandomNumberHash(randomNumber, timestamp).toString("hex")
    const heightSpan = 10000
    const amount = [{
    denom: "PPC-00A",
    amount: 100000000
    }]
    const expectedIncome = "9999990000:PPC" //"9999990000:PPC", decimal is 10, deputy will deduct swap fee, the swap fee is 10000:PPC

    bnbClient.swap.HTLT(clientBnbWalletAddr, deputyBNBWalletAddr, clientEthWalletAddr, "", randomNumberHash, timestamp, amount, expectedIncome, heightSpan, true)
    await wait(1000)

    //----------------------------------------------------------------------------
    //Step2 query swap created by deputy on Ethereum and verify swap parameters
    //----------------------------------------------------------------------------
    const hexEncodingClientBNBaddr = '0x'+crypto.decodeAddress(clientBnbWalletAddr).toString("hex")
    const swapID = await swapContract.methods.calSwapID("0x"+randomNumberHash, deputyEthWalletAddr, hexEncodingClientBNBaddr).call()
    console.log(swapID)

    let openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
    while (openSwap._randomNumberHash == '0x0000000000000000000000000000000000000000000000000000000000000000') {
    console.log("Waiting for the atomic swap created by deputy")
    await wait(5000)
    openSwap = await swapContract.methods.queryOpenSwap(swapID).call()
    }
    let ethBlock = await web3.eth.getBlock('latest')
    let ethLatestHeight = ethBlock.number
    expect(openSwap._randomNumberHash).toBe("0x"+randomNumberHash)
    expect(Number(openSwap._timestamp)).toBe(timestamp)
    expect(Number(openSwap._outAmount)).toBe(9999990000)
    expect(openSwap._recipient).toBe(clientEthWalletAddr)
    expect(Number(openSwap._expireHeight)).toBeGreaterThan(Number(ethLatestHeight)+20)

    //----------------------------------------------------------------------------
    //Step3 claim on Ethereum
    //----------------------------------------------------------------------------
    const claimData = swapContract.methods.claim(swapID, "0x"+randomNumber).encodeABI()
    let nonce = await web3.eth.getTransactionCount(clientEthWalletAddr, 'pending')
    let gasPrice = await web3.eth.getGasPrice()
    let gasLimit = 3000000
    let rawTx = {
    nonce: web3.utils.toHex(nonce),
    gasPrice: web3.utils.toHex(gasPrice),
    gasLimit: web3.utils.toHex(gasLimit),
    to: swapContractAddr,
    value: '0x00',
    data: claimData
    }
    var ethereumjs = require('ethereumjs-tx')
    var signTx = new ethereumjs(rawTx)
    signTx.sign(clientEthWalletKey)
    var serializedTx = signTx.serialize();
    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', console.log)
    await wait(20000)

    //----------------------------------------------------------------------------
    //If step2 or step3 are failed and the expire height on BNB Beacon Chain is passed, try to send refundHTLT transaction on BNB Beacon Chain
    //----------------------------------------------------------------------------

    Swap between Several BEP2 tokens

    image-20190918193422062

    Swap between Several BEP2 tokens fails

    image-20190918193518929

    + diff --git a/docs/beaconchain/learn/bc-bridge.html b/docs/beaconchain/learn/bc-bridge.html index 0c907d77fa..12a1af04e6 100644 --- a/docs/beaconchain/learn/bc-bridge.html +++ b/docs/beaconchain/learn/bc-bridge.html @@ -8,14 +8,14 @@ - +

    BC <-> BSC Token Bridge

    !!! Note Please note that BC <-> BSC Token Bridge is a module of BNB Beacon Chain fullnode to facilitate cross-chain transfer between BNB Beacon Chain and BNB Smart Chain , while Binance Bridge, a bridge service providing access to inter-blockchain liquidity for BNB Beacon Chain , BNB Smart Chain decentralized applications, and bring valuable assets to BNB Beacon Chain ecosystems.

    What is BC <-> BSC bridge

    BC <-> BSC token bridge for self transfers of BEP2 tokens to BEP20 (ERC20 representation). The BC <-> BSC bridge connects two chains (BC and BSC). When a user deposits BEP2 into the BC <-> BSC bridge contract contract on BC they get the same amount of BEP20 tokens on BSC, and they can convert them back as well.

    A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code in protocol. The code for calculating escrow account is the same as how it's done in cosmos-sdk:

    AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainPegAccount")))

    The account for mainnet is: bnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj and the account for testnet is: tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr. Once the swap is claimed or refunded, the fund will be transferred from the purely-code-controlled escrow account to client accounts.

    Fee Table

    Transaction TypePay in BNB
    BC <-> BSC Bridge Bind0.01
    Transfer Out0.01
    BC <-> BSC Bridge Bind Relayer Fee0.01
    Transfer Out Relayer Fee0.01

    Commands

    Download

    Please download tbnbcli binary from here

    Bind

    Parameters for BC <-> BSC bridge bind

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --fromaliceaccount nameYes
    --symbolDEF-0E9chain-id of the side chain the validator belongs toYes
    --amount1000000000amount of tokens to bindYes
    --contract-address0x6aade9709155a8386c63c1d2e5939525b960b4e7contract address of token in smart chainYes
    --contract-decimals18decimals of token in smart chainYes
    --expire-time1594715271timestamp of bind expire timeYes

    For example

    • Mainnet
    bnbcli bridge bind --symbol DEF-0F9 --amount 6000000000000000 --expire-time 1594715271 --contract-decimals 18 --from alice --chain-id Binance-Chain-Tigris --contract-address 0x6aade9709155a8386c63c1d2e5939525b960b4e7 --home ~/home_cli

    Unbind

    Parameters for BC <-> BSC bridge unbind

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --fromaliceaccount nameYes
    --symbolDEF-0E9chain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli bridge unbind --symbol DEF-0F9 --from alice --chain-id Binance-Chain-Tigris --home ~/home_cli

    Transfer out

    Parameters for BC <-> BSC bridge transfer-out

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --fromaliceaccount nameYes
    --to0xf9f609f9f4309f191654aa1fd691a6be6aefa7acreceiver address in smart chainYes
    --amount1000000000:BNB (10 BNB)amount of token to transferYes
    --expire-time1594715271timestamp of transfer out expire timeYes

    For example

    • Mainnet
    bnbcli bridge transfer-out --to 0xf9f609f9f4309f191654aa1fd691a6be6aefa7ac --expire-time 1594715271 --chain-id Binance-Chain-Tigris --from alice --amount 100000000:DEF-0F9 --home ~/home_cli
    - + diff --git a/docs/beaconchain/learn/bc-slashing.html b/docs/beaconchain/learn/bc-slashing.html index d01642fadd..1b1f55e10b 100644 --- a/docs/beaconchain/learn/bc-slashing.html +++ b/docs/beaconchain/learn/bc-slashing.html @@ -8,13 +8,13 @@ - +

    Slashing

    Slashing

    Slashing is part of the on-chain governance, to ensure the malicious or negative behaviors are punished. BSC slash can be submitted by anyone. The transaction submission requires slash evidence and cost fees but also brings a larger reward when it is successful.

    So far there are two slashable cases.

    Double Sign

    Anyone can submit a slash request on BC with the evidence of Double Sign of BSC

    Evidence Validation

    • Two block headers have same height and same parent block hash
    • Two block headers are sealed by the same validator
    • Two signatures of these two blocks must not be the same
    • The time of these two blocks must be within the validity of the evidence, which is 24 hours

    If the evidence is valid:

    1. 1000BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 1000BNB, then the unbonding delegation balance would be slashed if it exists until totally 1000BNB slashed from self-delegator of the validator. However, if all the slashed BNB is less than 1000, all the remaining stake of the self-delegator will be slashed
    3. 100 of slashed BNB would allocate to the submitter as a reward
    4. The rest of slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the rest of slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with duration of 7 days, and remove it from validator set by an instance BSC validator set update Cross-Chain update

    Inavailability

    There can be an internal smart contract responsible for recording the missed blocking metrics of each validator.

    If a validator missed more than 50 blocks in 24h, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators. If it missed more than 150 blocks in 24h, then this will be propagated back to BC where another Slashing will happen:

    1. 50BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 50BNB, then the unbonding delegation balance would be slashed if it exists until totally 50BNB slashed from self-delegator of the validator. However, if all the slashed BNB is less than 1000, all the remaining stake of the self-delegator will be slashed
    3. 10 of slashed BNB would allocate to the validators on BC as block fee
    4. The rest of slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the rest of slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with duration of 2 days, and remove it from validator set by an instance BSC validator set update Cross-Chain update

    Unjail

    The malicious validators who are slashed by the previous cases will be set to jailed along with a duration setting as well due to the malicious or negative behaviors. We can set it to ‘unjailed’ by sending a side-unjail transaction if the validation passed.

    When your validator is unjailed on BNB Beacon Chain, it must wait for the next UTC 0:00 to join validatorsest again.

    Transaction Validation

    • validator address must not be empty
    • side chain id exists
    • self-delegation of the validator exists and the tokens of it must be greater than the min-self-delegation setting by 10000BNB
    • the validator is in ‘jailed’ now
    • already passed the duration set when ‘jailed’ happened

    Fee Table

    Transaction TypePay in BNB
    Unjail A Smart Chain Validator1
    Submit Byzaitine Behavior Evidence of A Smart Chain Validator10

    Commands

    Download Binary

    Please download tbnbcli binary from here

    Submit BSC evidence

    Slashing validators of BSC for the malicious behavior of double-sign by submitting evidence consisting of two block headers with same height but signed by one signer

    Parameters for slashing bsc-submit-evidence

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-Tigristhe chain id of binance chainYes
    --frombnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hddName or address of private key with which to signYes
    --evidence[{"difficulty":"0x2","extraData":"0xd98301...},{"difficulty":"0x3","extraData":"0xd64372...}]Evidence details, including two bsc block headers with json formatOption
    --evidence-file/user/evidence.jsonFile of evidence details, if evidence-file is not empty, --evidence will be ignoredOption

    Examples

    • Mainnet
    bnbcli slashing bsc-submit-evidence --from=bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --evidence=[{"parentHash":"0x6116de25352c93149542e950162c7305f207bbc17b0eb725136b78c80aed79cc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xe7cb9d2fd449f7bd11126bff55266e7b74936f2f230e21d44d75c04b7780dfeb","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x20000","number":"0x1","gasLimit":"0x47e7c4","gasUsed":"0x0","timestamp":"0x5eb2a363","extraData":"0x0000000000000000000000000000000000000000000000000000000000000000a2852203a9da8bb555ec98a78c66365437bb1dde6707a08032e9eb916a8a454e37a1fffeab272bcffc2fc1d82aee6f3124bbdc8ed884efcbadfb6ff862cf4c3801","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","hash":"0xd977f1acfd035cf717193a9c3a2351cdccdc2ea0719aff871dade0e8daf8069d"},{"parentHash":"0x6116de25352c93149542e950162c7305f207bbc17b0eb725136b78c80aed79cc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xe7cb9d2fd449f7bd11126bff55266e7b74936f2f230e21d44d75c04b7780dfeb","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x20000","number":"0x1","gasLimit":"0x47e7c4","gasUsed":"0x64","timestamp":"0x5eb2a363","extraData":"0x00000000000000000000000000000000000000000000000000000000000000005eab7a9bf40635d056ccab45ac0d8b4e99be4b4ed859e4246f651b95c0adaacc050760a0afc2d9383f821baab7f995cde07271f286c4805095b413e7ad69d9f401","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","hash":"0x917c38a507c9807426fc9e3e9e8ded2db07c7f61070bd1c7b57b9df287e8f7b2"}]     --chain-id=test-chain-8d7sJz --home ~/home_cli

    Side chain Unjail

    Parameters for slashing side-unjail

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hddThis address has to be the operator address of the validator to be unjailed. Name or address of private key with which to sign.Yes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-unjail --from bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query side chain Signing Info

    Parameters for slashing side-signing-info

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-signing-info 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query side chain slash history

    Parameters for slashing side-slash-history [validator-sideConsAddr]

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --infraction-height100infraction heightYes
    --infraction-typeDoubleSigninfraction type, 'DoubleSign;Downtime'Yes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-slash-history 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --infraction-height 100 --infraction-type DoubleSign --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query side chain slash histories

    Parameters for slashing side-slash-histories

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --infraction-typeDoubleSigninfraction type, 'DoubleSign;Downtime'Option
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-slash-histories 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --infraction-type DoubleSign --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query all side chain slash histories(for internal)

    Parameters for slashing side-all-slash-histories

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-all-slash-histories --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli
    - + diff --git a/docs/beaconchain/learn/bc-staking.html b/docs/beaconchain/learn/bc-staking.html index 4cc957d8a7..e6e0d3ea42 100644 --- a/docs/beaconchain/learn/bc-staking.html +++ b/docs/beaconchain/learn/bc-staking.html @@ -8,13 +8,13 @@ - +
    -

    Staking

    PoSA Consensus of BNB Smart Chain

    BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.

    Staking on BNB Beacon Chain

    Ideally, BNB Smart Chain should build such staking and reward logic into the blockchain, and automatically distribute rewards as the blocking happens. Cosmos Hub, who also build on top of Tendermint consensus like BNB Beacon Chain , works in this way.

    However, as BSC wants to remain compatible with Ethereum as much as possible. On the other side, BNB Beacon Chain already has a staking module and could be extended to support both BC and BSC. In this way, all the staking related operations are recorded in BC. Once there are any changes about BSC's validator set or voting power, the new message will be transferred to BSC through cross-chain communication.

    Staking Economics

    1. The staking token is BNB, as it is a native token on both blockchains anyway
    2. The staking, i.e. token bond and delegation actions and records for BSC, happens on BC.
    3. The BSC validator set is determined by its staking and delegation logic, via a staking module built on BC for BSC, and propagated every day UTC 00:00 from BC to BSC via Cross-Chain communication.
    4. The reward distribution happens on BC around every day UTC 00:00 after.

    Ranking Algorithm

    Validators are ranked by their power and operator address. The more its delegation tokens, the higher ranking is. If two validators get the same amount of delegated tokens, validator with smaller address bytes has higher ranking.

    Reward Distrubution

    Since BSC uses PoSA as its consensus engine, all the delegators of validators can receive some share of the validators’ reward.

    However, the rewards(fees) are collected on BSC while the staking info is stored on BC.

    So the main idea is we transfer all the rewards from BSC to BC once every day and execute the distribution on BC.

    Main Workflow:

    1. ValidatorSet is updated in BreatheBlock, the frequency is once a day. let’s assume it happens on day N.
    2. The info of validator set changes of day N would be transmitted to BSCthrough interchain communication.
    3. The validator set contract on BSC would receive and update the new validatorset. After that, it would trigger several interchain transfer to transfer the fees that every previous validators collected in this period to their addresses on BC. we can see that fees belongs to the validators of day N-1.
    4. To make some room for the error handling, we distribute the fees of day N-1 in the next breathe block (day N+1).

    Details

    1. even if validator set or any their voting powers are not changed on that day, we still transmit the validator set info to BSC.
    2. the validator set contract maintains the history of the fees that every validators collected after the previous period(We define the period as the time between two contract calls of validator set changes). The actual fees are collected on the contract address.
    3. the interchain transfer to send fees from the contract address to each validator’s distribution address on BC. Note the distribution address is auto generated on BC when handling the create-validator tx, so no private key is corresponded to that address and no one except the distribution module can move the tokens on that address. This address is displayed as Distribution Addr in validator info.
    Validator
    Fee Address: tbnb15mgzha93ny878kuvjl0pnqmjygwccdadpw5dxf
    Operator Address: bva15mgzha93ny878kuvjl0pnqmjygwccdad08uecu
    Validator Consensus Pubkey:
    Jailed: false
    Status: Bonded
    Tokens: 5000000000000
    Delegator Shares: 5000000000000
    Description: {Elbrus "" www.binance.org This is Elbrus org on chapel network.}
    Bond Height: 74158
    Unbonding Height: 0
    Minimum Unbonding Time: 1970-01-01 00:00:00 +0000 UTC
    Commission: {rate: 75000000, maxRate: 90000000, maxChangeRate: 3000000, updateTime: 2020-05-22 12:24:19.478568234 +0000 UTC}
    Distribution Addr: tbnb1srkkfjk8qctvvy4s3cllhpnkz9679jphr30t2c
    Side Chain Id: chapel
    Consensus Addr on Side Chain: 0xF474Cf03ccEfF28aBc65C9cbaE594F725c80e12d
    Fee Addr on Side Chain: 0xe61a183325A18a173319dD8E19c8d069459E2175
    1. we have a lower limit of the value of interchain transfer, at least the value can cover the transfer fee. Also, interchain transfer will only allow max 8 decimals for the amount. The tiny left part would be kept in the contract or put into the system reward pool.
    2. the reward: (totalfees * (1-commissionRate)) would be distributed in proportion to the delegations, the left part would be sent to the validator fee address.

    Error handling:

    1. if the cross-chain transfer failed, the tokens would be sent back to a specified address(i.e. the SideFeeAddr in the store section, validators can change this address via the EditValidator tx). After that, validators can manually deposit the tokens to its own DistributionAddr on BC via Transfer tx. We do not force the validator to do so, but it’s an indicator that can help delegators choose validators.

    Fee Table

    Transaction TypePay in BNB
    Create A New Smart Chain Validator10
    Edit Smart Chain Validator Information1
    Delegate Smart Chain Validator0.001
    Redelegate Smart Chain Validator0.003
    Undelegate Smart Chain Validator0.002

    Commands

    Download

    Mainnet

    Please download bnbcli binary from here

    Testnet

    Please download tbnbcli binary from here

    Create BSC Validator

    Parameters for bsc-create-validator

    parameter nameexamplecommentrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, also be used as the validator operator addressYes
    --address-delegatorbnb1xxx/tbnb1xxxoptional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator.No
    --amount2000000000000:BNB (means 20000 BNB)self-delegation amount, it has 8 decimal placesYes
    --monikermyval1validator nameYes
    --identityxxxoptional identity signature (ex. UPort or Keybase)No
    --websitewww.example.comoptional websiteNo
    --detailssome detailsoptional detailsNo
    --commission-rate80000000(that means 0.8 or 80%)The initial commission rate percentage, it has 8 decimal places.Yes
    --commission-max-rate95000000 (0.95 or 95%)The maximum commission rate percentage, it has 8 decimal places. You can not update this rate.Yes
    --commission-max-change-rate3000000 (0.03 or 3%)The maximum commission change rate percentage (per day). You can not update this rate.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --side-cons-addr0x1234abcdconsensus address of the validator on side chain, please use hex format prefixed with 0xYes
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.Yes
    --home/path/to/cli_homehome directory of bnbcli data and config, default to “~/.bnbcli”No

    Some address parameters we need to highlight here:

    Field NameUsage
    DelegatorAddrSelf delegator address. For BC, this address also used to collect fees.
    ValidatorAddrvalidator operator’s address, used in governance ops like voting.
    SideConsAddrblock producer’s address on side chain, i.e. consensus address. BC has another parameter named PubKey, here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.
    SideVoteAddrA bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal.
    SideFeeAddrfees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain . Those BNB will be sent to fee address.

    Examples

    1. If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.
    • Mainnet
    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli
    • Testnet
    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli
    1. If you want a separated self-delegator address, both self-delegator and validator operator need to sign this transaction. Here we need to use another two commands to support multiple signatures.

    a. use the following commands appended with a parameter “--generate-only” and save the result to a json file which would be used to be signed.

    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    b. both validator operator(--from) and self-delegator(--address-delegator) use “bnbcli sign” command to sign the file from a).

    Delegator address need to sign unsigned.json first

    • Online Mode
    ## mainnet
    ./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json

    Then, validator operator addres will sign it later.

    • Online Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json

    c. use “bnbcli broadcast” to send the transaction from above to the blockchain nodes.

    ## mainnet
    ./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges

    Verify your transaction in mainnet-explorer or testnet-explorer

    Edit BSC Validator

    Parameters for bsc-edit-validator

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that also indicate the validator that you want to edit.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --monikermyval1validator name (default "[do-not-modify]")No
    --identityxxxoptional identity signature (ex. UPort or Keybase) (default "[do-not-modify]")No
    --websitewww.example.comoptional website (default "[do-not-modify]")No
    --detailssome detailsoptional details (default "[do-not-modify]")No
    --commission-rate80000000(that means 0.8 or 80%)The new commission rate percentageNo
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.No

    Examples

    • Mainnet
    bnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli
    • Testnet
    tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    Delegate BNB

    Parameters for staking bsc-delegate

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Examples

    ## mainnet
    bnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Redelegate BNB

    Parameters for staking bsc-redelegate

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --addr-validator-sourcebva1xxxbech32 address of the source validator, starts with “bva”Yes
    --addr-validator-destbva1yyybech32 address of the destination validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Examples

    • Mainnet
    bnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli
    • Testnet
    tbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli

    Undelegate BNB

    Parameters for staking bsc-unbond

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Examples

    • Mainnet
    bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Query side chain vaildator by operator

    Parameters for staking side-validator

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Examples

    • Mainnet
    bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f  --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain delegation by delegator and operator

    Parameters for staking side-delegation

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Examples

    • Mainnet
    bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli

    Query side chain delegations by delegator

    Parameters for staking side-delegations

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Examples

    • Mainnet
    bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node

    Query side chain unbonding delegation

    Parameters for staking side-unbonding-delegation

    Usage:

    bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking  side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by delegator

    Parameters for staking side-unbonding-delegations

    Usage:

    bnbcli staking side-unbonding-delegations [delegator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking  side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by validator

    Parameters for staking side-val-unbonding-delegations

    Usage:

    bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegation

    Parameters for staking side-redelegation

    Usage:

    bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking  side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n  bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by delegator

    Parameters for staking side-redelegations

    Usage:

    bnbcli staking side-redelegations [delegator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by validator

    Parameters for staking side-val-redelegations

    Usage:

    bnbcli staking side-val-redelegations [operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain staking pool

    Parameters for staking side-pool

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking     side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home     ~/home_cli

    Query side chain top validators

    Parameters for staking side-top-validators

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --top10number of validators to be returned. set as maximum number of validators by defaultOption

    For example

    bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain validators count

    Parameters for staking side-validators-count

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --jail-involvedtrueif true, meaning that the jailed validators will be involved to countOption

    For example

    bnbcli staking  side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli
    - +

    Staking

    PoSA Consensus of BNB Smart Chain

    BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.

    Staking on BNB Beacon Chain

    Ideally, BNB Smart Chain should build such staking and reward logic into the blockchain, and automatically distribute rewards as the blocking happens. Cosmos Hub, who also build on top of Tendermint consensus like BNB Beacon Chain , works in this way.

    However, as BSC wants to remain compatible with Ethereum as much as possible. On the other side, BNB Beacon Chain already has a staking module and could be extended to support both BC and BSC. In this way, all the staking related operations are recorded in BC. Once there are any changes about BSC's validator set or voting power, the new message will be transferred to BSC through cross-chain communication.

    Staking Economics

    1. The staking token is BNB, as it is a native token on both blockchains anyway
    2. The staking, i.e. token bond and delegation actions and records for BSC, happens on BC.
    3. The BSC validator set is determined by its staking and delegation logic, via a staking module built on BC for BSC, and propagated every day UTC 00:00 from BC to BSC via Cross-Chain communication.
    4. The reward distribution happens on BC around every day UTC 00:00 after.

    Ranking Algorithm

    Validators are ranked by their power and operator address. The more its delegation tokens, the higher ranking is. If two validators get the same amount of delegated tokens, validator with smaller address bytes has higher ranking.

    Reward Distrubution

    Since BSC uses PoSA as its consensus engine, all the delegators of validators can receive some share of the validators’ reward.

    However, the rewards(fees) are collected on BSC while the staking info is stored on BC.

    So the main idea is we transfer all the rewards from BSC to BC once every day and execute the distribution on BC.

    Main Workflow:

    1. ValidatorSet is updated in BreatheBlock, the frequency is once a day. let’s assume it happens on day N.
    2. The info of validator set changes of day N would be transmitted to BSCthrough interchain communication.
    3. The validator set contract on BSC would receive and update the new validatorset. After that, it would trigger several interchain transfer to transfer the fees that every previous validators collected in this period to their addresses on BC. we can see that fees belongs to the validators of day N-1.
    4. To make some room for the error handling, we distribute the fees of day N-1 in the next breathe block (day N+1).

    Details

    1. even if validator set or any their voting powers are not changed on that day, we still transmit the validator set info to BSC.
    2. the validator set contract maintains the history of the fees that every validators collected after the previous period(We define the period as the time between two contract calls of validator set changes). The actual fees are collected on the contract address.
    3. the interchain transfer to send fees from the contract address to each validator’s distribution address on BC. Note the distribution address is auto generated on BC when handling the create-validator tx, so no private key is corresponded to that address and no one except the distribution module can move the tokens on that address. This address is displayed as Distribution Addr in validator info.
    Validator
    Fee Address: tbnb15mgzha93ny878kuvjl0pnqmjygwccdadpw5dxf
    Operator Address: bva15mgzha93ny878kuvjl0pnqmjygwccdad08uecu
    Validator Consensus Pubkey:
    Jailed: false
    Status: Bonded
    Tokens: 5000000000000
    Delegator Shares: 5000000000000
    Description: {Elbrus "" www.binance.org This is Elbrus org on chapel network.}
    Bond Height: 74158
    Unbonding Height: 0
    Minimum Unbonding Time: 1970-01-01 00:00:00 +0000 UTC
    Commission: {rate: 75000000, maxRate: 90000000, maxChangeRate: 3000000, updateTime: 2020-05-22 12:24:19.478568234 +0000 UTC}
    Distribution Addr: tbnb1srkkfjk8qctvvy4s3cllhpnkz9679jphr30t2c
    Side Chain Id: chapel
    Consensus Addr on Side Chain: 0xF474Cf03ccEfF28aBc65C9cbaE594F725c80e12d
    Fee Addr on Side Chain: 0xe61a183325A18a173319dD8E19c8d069459E2175
    1. we have a lower limit of the value of interchain transfer, at least the value can cover the transfer fee. Also, interchain transfer will only allow max 8 decimals for the amount. The tiny left part would be kept in the contract or put into the system reward pool.
    2. the reward: (totalfees * (1-commissionRate)) would be distributed in proportion to the delegations, the left part would be sent to the validator fee address.

    Error handling:

    1. if the cross-chain transfer failed, the tokens would be sent back to a specified address(i.e. the SideFeeAddr in the store section, validators can change this address via the EditValidator tx). After that, validators can manually deposit the tokens to its own DistributionAddr on BC via Transfer tx. We do not force the validator to do so, but it’s an indicator that can help delegators choose validators.

    Fee Table

    Transaction TypePay in BNB
    Create A New Smart Chain Validator10
    Edit Smart Chain Validator Information1
    Delegate Smart Chain Validator0.001
    Redelegate Smart Chain Validator0.003
    Undelegate Smart Chain Validator0.002

    Commands

    Download

    Mainnet

    Please download bnbcli binary from here

    Testnet

    Please download tbnbcli binary from here

    Create BSC Validator

    Parameters for bsc-create-validator

    parameter nameexamplecommentrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, also be used as the validator operator addressYes
    --address-delegatorbnb1xxx/tbnb1xxxoptional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator.No
    --amount2000000000000:BNB (means 20000 BNB)self-delegation amount, it has 8 decimal placesYes
    --monikermyval1validator nameYes
    --identityxxxoptional identity signature (ex. UPort or Keybase)No
    --websitewww.example.comoptional websiteNo
    --detailssome detailsoptional detailsNo
    --commission-rate80000000(that means 0.8 or 80%)The initial commission rate percentage, it has 8 decimal places.Yes
    --commission-max-rate95000000 (0.95 or 95%)The maximum commission rate percentage, it has 8 decimal places. You can not update this rate.Yes
    --commission-max-change-rate3000000 (0.03 or 3%)The maximum commission change rate percentage (per day). You can not update this rate.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --side-cons-addr0x1234abcdconsensus address of the validator on side chain, please use hex format prefixed with 0xYes
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.Yes
    --home/path/to/cli_homehome directory of bnbcli data and config, default to “~/.bnbcli”No

    Some address parameters we need to highlight here:

    Field NameUsage
    DelegatorAddrSelf delegator address. For BC, this address also used to collect fees.
    ValidatorAddrvalidator operator’s address, used in governance ops like voting.
    SideConsAddrblock producer’s address on side chain, i.e. consensus address. BC has another parameter named PubKey, here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.
    SideVoteAddrA bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal.
    SideFeeAddrfees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain . Those BNB will be sent to fee address.

    Examples

    1. If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.
    • Mainnet
    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli
    • Testnet
    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli
    1. If you want a separated self-delegator address, both self-delegator and validator operator need to sign this transaction. Here we need to use another two commands to support multiple signatures.

    a. use the following commands appended with a parameter “--generate-only” and save the result to a json file which would be used to be signed.

    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    b. both validator operator(--from) and self-delegator(--address-delegator) use “bnbcli sign” command to sign the file from a).

    Delegator address need to sign unsigned.json first

    • Online Mode
    ## mainnet
    ./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json

    Then, validator operator addres will sign it later.

    • Online Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json

    c. use “bnbcli broadcast” to send the transaction from above to the blockchain nodes.

    ## mainnet
    ./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges

    Verify your transaction in mainnet-explorer or testnet-explorer

    Edit BSC Validator

    Parameters for bsc-edit-validator

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that also indicate the validator that you want to edit.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --monikermyval1validator name (default "[do-not-modify]")No
    --identityxxxoptional identity signature (ex. UPort or Keybase) (default "[do-not-modify]")No
    --websitewww.example.comoptional website (default "[do-not-modify]")No
    --detailssome detailsoptional details (default "[do-not-modify]")No
    --commission-rate80000000(that means 0.8 or 80%)The new commission rate percentageNo
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.No

    Examples

    • Mainnet
    bnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli
    • Testnet
    tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    Delegate BNB

    Parameters for staking bsc-delegate

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Examples

    ## mainnet
    bnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Redelegate BNB

    Parameters for staking bsc-redelegate

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --addr-validator-sourcebva1xxxbech32 address of the source validator, starts with “bva”Yes
    --addr-validator-destbva1yyybech32 address of the destination validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Examples

    • Mainnet
    bnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli
    • Testnet
    tbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli

    Undelegate BNB

    Parameters for staking bsc-unbond

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Examples

    • Mainnet
    bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Query side chain vaildator by operator

    Parameters for staking side-validator

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Examples

    • Mainnet
    bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f  --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain delegation by delegator and operator

    Parameters for staking side-delegation

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Examples

    • Mainnet
    bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli

    Query side chain delegations by delegator

    Parameters for staking side-delegations

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Examples

    • Mainnet
    bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node

    Query side chain unbonding delegation

    Parameters for staking side-unbonding-delegation

    Usage:

    bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking  side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by delegator

    Parameters for staking side-unbonding-delegations

    Usage:

    bnbcli staking side-unbonding-delegations [delegator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking  side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by validator

    Parameters for staking side-val-unbonding-delegations

    Usage:

    bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegation

    Parameters for staking side-redelegation

    Usage:

    bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking  side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n  bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by delegator

    Parameters for staking side-redelegations

    Usage:

    bnbcli staking side-redelegations [delegator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by validator

    Parameters for staking side-val-redelegations

    Usage:

    bnbcli staking side-val-redelegations [operator-addr] [flags]
    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain staking pool

    Parameters for staking side-pool

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    For example

    bnbcli staking     side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home     ~/home_cli

    Query side chain top validators

    Parameters for staking side-top-validators

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --top10number of validators to be returned. set as maximum number of validators by defaultOption

    For example

    bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain validators count

    Parameters for staking side-validators-count

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --jail-involvedtrueif true, meaning that the jailed validators will be involved to countOption

    For example

    bnbcli staking  side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli
    + diff --git a/docs/beaconchain/learn/breathe-block.html b/docs/beaconchain/learn/breathe-block.html index 8dd0788d90..00c303f040 100644 --- a/docs/beaconchain/learn/breathe-block.html +++ b/docs/beaconchain/learn/breathe-block.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ A breathe block is the first block of a day in UTC time, for example, block 288644676 is a breathe block because it is the first block of 06/01/2023.

    In breathe block, some special logics will be executed, for example, validator set update, staking reward allocations, parameter changes, and so on.

    How to get breathe blocks

    There are several approaches to find breathe blocks:

    • Messages (e.g., kafka messages) can be published to receive breathe blocks, for more information please refer to breathe block.

    • You can also find breathe blocks by accessing local logs if you are running a BNB Beacon Chain node. In node.log log file, the heights of breathe blocks will be logged.

    • Another option is using Explorer by looking at the block time. Please do check the surrounding blocks if you find a potential one (multiple blocks can be mined in the same second).

    What happens in breathe blocks

    Breathe blocks can execute any logics as normal blocks. Besides, there are some logics only happened in breathe blocks, to unify some handlings or avoid any burden on normal blocks (e.g., for performance).

    • Validator set update - In breathe blocks, validator set updates will take effect, i.e., updating validators on BNB Beacon Chain or triggering cross chain communication for side chain's validator set update.

    • Staking reward calculation and allocation - the staking rewards will be calculated and allocated in breathe blocks.

    • Proposal execution and parameter change - some proposals will be only executed in breathe blocks, for example, fee change proposals, cross chain parameter changes.

    - + diff --git a/docs/beaconchain/learn/bsc-gov.html b/docs/beaconchain/learn/bsc-gov.html index 53fdf2d937..29256b2284 100644 --- a/docs/beaconchain/learn/bsc-gov.html +++ b/docs/beaconchain/learn/bsc-gov.html @@ -8,13 +8,13 @@ - +

    Governance of BSC

    There are many system parameters to control the behavior of the BSC:

    • All these parameters of BSC system contracts should be flexible: slashing threshold, cross-chain transfer fees, relayer reward amount and so on.

    • params of Staking/Slash/Oracle/IBC modules on BC

    All these parameters will be determined by BSC Validator Set together through a proposal-vote process based on their staking. Such process will be carried on BC, and the new parameter values will be picked up by corresponding system contracts via cross-chain communication when needed.

    Fee Table

    Transaction TypeFeeFee For
    Submit Smart Chain Proposal10 BNBsProposer
    Smart Chain Proposal Deposit0.00125 BNBProposer
    Smart Chain Proposal Vote1 BNBProposer
    Relayer reward0.001 BNBsystem reward pool

    Global Parameters

    • min-deposit: The threshold for submitting a proposal is 2000BNB.

    Commands

    Query side chain proposals

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --statuspassedfilter proposals by proposal status, status: deposit_period/voting_period/passed/rejectedNo
    --voterbnb1h9ymecpakr8p8lhchtah2xxx7x4xq099umclqufilter by proposals voted on by votedNo
    ## mainnet
    ./bnbcli gov query-proposals --side-chain-id bsc --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov query-proposals --side-chain-id chapel --trust-node --chain-id Binance-Chain-Ganges

    Query side chain proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --proposal-id1proposalID of proposal being queriedYes
    ## mainnet
    ./bnbcli gov query-proposal --proposal-id 1 --side-chain-id bsc --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov query-proposal --proposal-id 1 --side-chain-id chapel --trust-node --chain-id Binance-Chain-Ganges

    Query side chain parameters

    parameter nameexamplecommentsrequired
    --side-chain-idchapelthe id of side chain, default is native chainYes
    ## mainnet
    ./bnbcli params side-params --side-chain-id bsc --trust-node

    ## testnet
    ./tbnbcli params side-params --side-chain-id chapel --trust-node

    Submit cross chain param change proposal.

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --keyfelonyThresholdthe parameter name on the side chainYes
    --target0x0000000000000000000000000000000000001001the address of the contract on side chainYes
    --title"test csc change"title of proposalYes
    --value0x000000000000000000000000000000000000000000000000000000000000001bthe specified value of the parameter on side chain, should encoded in hexYes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainnet
    ./bnbcli params submit-cscParam-change-proposal --key "felonyThreshold" --value "0x000000000000000000000000000000000000000000000000000000000000001b" --target 0x0000000000000000000000000000000000001001 --deposit 200000000000:BNB --voting-period 100 --side-chain-id bsc --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli params submit-cscParam-change-proposal --key "felonyThreshold" --value "0x000000000000000000000000000000000000000000000000000000000000001b" --target 0x0000000000000000000000000000000000001001 --deposit 200000000000:BNB --voting-period 100 --side-chain-id chapel --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Ganges

    Submit cross chain channel management proposal.

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --channel-id1the the channel id that want to manageYes
    --enabletrueenable the channel or not (default true)Yes
    --title"test csc change"title of proposalYes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainnet
    ./bnbcli side-chain submit-channel-manage-proposal --channel-id 2 --enable=true --deposit 200000000000:BNB --voting-period 100 --side-chain-id bsc --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli side-chain submit-channel-manage-proposal --channel-id 2 --enable=true --deposit 200000000000:BNB --voting-period 100 --side-chain-id chapel --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Ganges

    Submit side chain module param change proposal.

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --title"test csc change"title of proposalYes
    --sc-param-fileparam.jsonthe file of Side Chain params (json format)Yes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainnet
    ./bnbcli params submit-sc-change-proposal --sc-param-file param.json --deposit 200000000000:BNB --voting-period 100 --side-chain-id bsc --title "test proposal" --from delegator1 --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli params submit-sc-change-proposal --sc-param-file param.json --deposit 200000000000:BNB --voting-period 100 --side-chain-id chapel --title "test proposal" --from delegator1 --trust-node --chain-id Binance-Chain-Ganges

    Vote for side chain proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --proposal-id1proposalID of proposal being queriedYes
    --optionYesvote option {yes, no, no_with_veto, abstain}Yes
    ## mainnet
    ./bnbcli gov vote --from alice --side-chain-id bsc --proposal-id 1 --option Yes --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov vote --from alice --side-chain-id chapel --proposal-id 1 --option Yes --chain-id Binance-Chain-Ganges

    Deposit for side chain proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --proposal-id1proposalID of proposal being queriedYes
    --depositYesamount of depositYes
    ## mainnet
    ./bnbcli gov deposit --from alice --side-chain-id bsc --proposal-id 1 --deposit 1000000000:BNB --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov deposit --from alice --side-chain-id chapel --proposal-id 1 --deposit 1000000000:BNB --chain-id Binance-Chain-Ganges
    - + diff --git a/docs/beaconchain/learn/encoding.html b/docs/beaconchain/learn/encoding.html index d8864d5479..059256c0e8 100644 --- a/docs/beaconchain/learn/encoding.html +++ b/docs/beaconchain/learn/encoding.html @@ -8,7 +8,7 @@ - + @@ -34,7 +34,7 @@ Marshaler interface contract for these types (e.g. MarshalAccount). Note, they should still use a HybridCodec internally. These extended contracts will typically use concrete types with unique oneof messages.

    - + diff --git a/docs/beaconchain/learn/encoding/amino-example.html b/docs/beaconchain/learn/encoding/amino-example.html index b0cdff3abd..6cb2964f2b 100644 --- a/docs/beaconchain/learn/encoding/amino-example.html +++ b/docs/beaconchain/learn/encoding/amino-example.html @@ -8,13 +8,13 @@ - +

    Encoding Examples

    Encoding Output

    BNB Beacon Chain (Amino) encoding logic may encode a data structure into two output formats: Binary and JSON.

    JSON Marshal

    Amino supports JSON encoding natively, which is the same as other usual json marshalers. Except that it can add one more type info for registered type, as shown below.

    {
    "type": "<amino type name>",
    "value": <JSON>
    }

    Examples in Go-SDK

    Let's take a look at an example function of BNB Beacon Chain go-sdk.

    func (c *HTTP) GetProposal(proposalId int64) (types.Proposal, error) {
    params := types.QueryProposalParams{
    ProposalID: proposalId,
    }
    bz, err := c.cdc.MarshalJSON(params)
    if err != nil {
    return nil, err
    }
    rawProposal, err := c.ABCIQuery("custom/gov/proposal", bz)
    if err != nil {
    return nil, err
    }
    if !rawProposal.Response.IsOK(){
    return nil, fmt.Errorf(rawProposal.Response.Log)
    }
    var proposal types.Proposal

    err = c.cdc.UnmarshalJSON(rawProposal.Response.GetValue(), &proposal)
    return proposal, err
    }

    In order to query the proposal, you can use Amino to marshal the request JSON first.

      bz, err := c.cdc.MarshalJSON(params)

    Then, use the unmarshal method to get the returned result.

      err = c.cdc.UnmarshalJSON(rawProposal.Response.GetValue(), &proposal)

    Binary Marshal

    Binary encoding is a variant of Google protocol buffer. The bytes are layed out in the below sequence:

    1. a varint encoded integer - it contains the length of the encoded bytes for the object, which is displayed as SIZE-OF-ENCODED in the below structs. Please note that it contains the length of encoded bytes and also the type prefix (below), but not itself, e.g. if the encoded msg is 20 bytes, then the length would be 20 + 4 = 24, while 4 is used for the type prefix bytes.
    2. an object type prefix of 4-8 bytes - For different type of objects, there will be different type prefixes, and they are displayed as in the specific objects below (data structures).
    3. a binary encoded object - the encoding is mostly the same as protocol buffer encoding mechanism, except the embedded fields of complex type:
      • to encode data field of some specific types, an object type prefix for the field will be added ahead of the real encoding.
    4. repeated (array) Encoding - it is the same as google protocol buffer, while encoding of the object/struct may contain the type prefix as shown below.

    Examples in Go-SDK

    Let's take a look at an example function of BNB Beacon Chain go-sdk. The signed transaction needs to be amino-encoded, thus ready to be posted to BncChain API.

    rawBz, err := c.keyManager.Sign(*signMsg)
    if err != nil {
    return nil, err
    }
    hexTx := []byte(hex.EncodeToString(rawBz))
    param := map[string]string{}
    if sync {
    param["sync"] = "true"
    }
    commits, err := c.basicClient.PostTx(hexTx, param)

    hexTx is derived from the following function:

      bz, err := tx.Cdc.MarshalBinaryLengthPrefixed(&newTx)

    BNB Beacon Chain Transaction Encoding

    Below are the data types that can be sent to BNB Beacon Chain as requests, and their encoding layout. To simplify the presentation, we will use a variant of Google protocol buffer proto3 language to illustrate how the data fields are organized. Except the all-capitalized fields, other fields will use the default proto3 encoding logic.

    Standard Transaction

    Transactions are each wrapped in the below "Standard Transaction": structure:

    // please note the field name is the JSON name.
    message StdTx {
    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding, please note this includes both the below type prefix (4 bytes) and the all encoding bytes
    0xF0625DEE // hardcoded, object type prefix in 4 bytes
    repeated Msg msgs // array of size 1, containing the transaction message, which are one of the transaction types below. please check the above "Array Encoding"
    repeated StdSignature signatures // array of size 1, containing the standard signature structure of the transaction sender
    string memo // a short sentence of remark for the transaction. Please only `Transfer` transaction allows 'memo' input, and other transactions with non-empty `Memo` will be rejected.
    int64 source // an identifier for tools triggerring this transaction, set to zero if unwilling to disclose.
    bytes data // byte array, reserved for future use
    }

    StdSignBytes

    type StdSignDoc struct {
    AccountNumber int64 `json:"account_number"`
    ChainID string `json:"chain_id"`
    Memo string `json:"memo"`
    Msgs []json.RawMessage `json:"msgs"`
    Sequence int64 `json:"sequence"`
    Source int64 `json:"source"`
    Data []byte `json:"data"`
    }

    Canonical Bytes for Signing

    A transaction signature is not formed from the Amino-encoded transaction bytes themselves. Rather, a canonical representation of the transaction is generated in JSON format for signing.

    This would allow for clients to sign a transaction off-chain, for example, a hardware HSM device like a Ledger, or within a micro-service in an algorithmic trading system. For example an external system will not have to understand Amino encoding to be able to approve of the transaction's content and produce the signed JSON string.

    The canonical bytes for signing are generated from the StdSignBytes method. It produces a JSON string similar to the format below (formatted for clarity):

    {
    "sequence" : "64",
    "account_number" : "12",
    "data" : null,
    "chain_id" : "chain-bnb",
    "memo" : "smiley",
    "msgs" : [
    {
    "inputs" : [
    {
    "coins" : [
    {
    "denom" : "BNB",
    "amount" : "200000000"
    }
    ],
    "address" : "bnc1hgm0p7khfk85zpz5v0j8wnej3a90w7098fpxyh"
    }
    ],
    "outputs" : [
    {
    "address" : "bnc1cku54wwn66w2rkgs3h6v5zxrwtzyew8chcl720",
    "coins" : [
    {
    "denom" : "BNB",
    "amount" : "200000000"
    }
    ]
    }
    ]
    }
    ],
    "source" : "1"
    }

    This JSON string, with all whitespace removed and keys sorted in alphabetical order, is signed with the private key of the sender. This signature is then attached to the StdTx structure described in the above section. Please note that the transaction broadcasted to the blockchain is not JSON - the JSON is merely used as a canonical representation to generate the signature.

    The next section describes how the generated signature is attached to a transaction.

    Standard Signature

    The sender's signature is stored in the Standard Transaction data via a Standard Signature, as shown below. This structure is included in the StdTx (see above).

    Please note that StdSignature itself doesn't have type prefix, while the PubKey does.

    message StdSignature {
    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding
    // please note there is no type prefix for StdSignature
    message PubKey {
    0xEB5AE987 // hardcoded, object type prefix in 4 bytes
    uint64 SIZE-OF-ENCODED // varint encoded length of the bytes below
    bytes // no name or field id, just encode the bytes
    }
    PubKey pub_key // public key bytes of the signer address
    bytes signature // signature bytes, please check chain access section for signature generation
    int64 account_number // another identifier of signer, which can be read from chain by account REST API or RPC
    int64 sequence // sequence number for the next transaction of the client, which can be read from the chain by account REST API or RPC. Please check chain acces section for details.
    }

    Message Types

    Messages represent the individual operations possible on BNB Beacon Chain , and these can be inserted into StdTx.msgs field. Message types are otherwise known as "transaction types", and these terms are used interchangeably in this document and in our technical documentation. So far every StdTx transaction "container" can only contain one "message".

    Transfer

    Transfer is the transaction for transferring funds to different addresses.

    // please note the field name is the JSON name.
    message Send {
    0x2A2C87FA // hardcoded, object type prefix in 4 bytes
    message Token {
    string denom
    int64 amount
    }
    message Input {
    bytes address
    repeated Token coins
    }
    message Output {
    bytes address
    repeated Token coins
    }
    repeated Input inputs
    repeated Output outputs
    }

    Freeze

    Freeze transaction will move the amount of the tokens into a frozen state, in which they cannot be used for transfers or sending new orders.

    // please note the field name is the JSON name.
    message TokenFreeze {
    0xE774B32D // hardcoded, object type prefix in 4 bytes
    bytes from // owner address
    string symbol // token symbol, in full name with "-" suffix
    int64 amount // amount of tokens to freeze
    }

    Unfreeze

    Unfreeze will reversely turn the amount of frozen tokens back to free state.

    // please note the field name is the JSON name.
    message TokenUnfreeze {
    0x6515FF0D // hardcoded, object type prefix in 4 bytes
    bytes from // owner address
    string symbol // token symbol, in full name with "-" suffix
    int64 amount // amount of tokens to unfreeze
    }

    Vote

    Vote transactions for proposals.

    // please note the field name is the JSON name.
    message Vote {
    0xA1CADD36 // hardcoded, object type prefix in 4 bytes
    int64 proposal_id // ID of the proposal
    bytes voter // address of the voter
    uint64 option // option from OptionSet chosen by the voter
    }

    Below are options for option:

    OptionYes           = 0x01  // yes
    OptionAbstain = 0x02 // abstain
    OptionNo = 0x03 // no
    OptionNoWithVeto = 0x04 // no with veto

    Issue

    Issue (create) new asset on BNB Beacon Chain .

    message IssueTokenValue  {
    0x17EFAB80 // hardcoded, object type prefix in 4 bytes
    bytes from // issuer's address
    string name // token name
    string symbol // token symbol
    string total_supply // total supply
    bool mintable // is mintable
    }

    Mint

    Mint is used to increase the total supply of a token.

    message Mint {
    0x467E0829 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string symbol string // token symbol
    int64 amount // increase amount
    }

    Burn

    Burn is used to decrease the total supply of a token.

    message TokenBurn {
    0x7ED2D2A0 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string symbol string // token symbol
    int64 amount // increase amount
    }

    Submit Proposal

    Submit proposal is used to create a proposal for validators about adding trading pairs

    message Submit{
    0xB42D614E // hardcoded, object type prefix in 4 bytes
    string title // Title of the proposal
    string description // Description of the proposal
    byte proposal_type // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal,ListTradingPair, FixedFeeParams}
    bytes proposer // Address of the proposer
    message Coin {
    string denom
    int64 amount
    }
    int64 VotingPeriod // Length of the voting period (s)
    }

    Deposit

    Deposit is used to increase the total deposit of a proposal.

    message Deposit{
    0xA18A56E5 // hardcoded, object type prefix in 4 bytes
    int64 ProposalID // ID of the proposal
    bytes Depositer // Address of the depositer
    message Coin {
    string denom
    int64 amount
    }
    }

    Set Account Flags

    You can set the flag value of your account.

    message SetAccountFlags{
    0xBEA6E301 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 flag // account flag
    }

    Time-lock

    You can only lock tokens on your own account for a certain period of time.

    message Timerelock{
    0x07921531 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string description // Description of the lock
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    int64 lock_time // lock time
    }

    Time-unlock

    You can unlock tokens on your own account after a certain period of time.

    message Timeunlock{
    0xC4050C6C // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 id // lock time id
    }

    Time-relock

    You can relock tokens on your own account after a certain period of time.

    message Timerelock{
    0x504711DA // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 Id // lock time id
    string description // Description of the lock
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    int64 lock_time // lock time
    }

    HTLT

    Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain , to serve as HTLC in the first step of Atomic Swap

    message HTLT{
    0xB33F9A24 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes to // receiver's address
    string recipient_other_chain
    string sender_other_chain
    bytes random_number_hash
    int64 timestamp
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    string expected_income
    int64 height_span
    bool cross_chain
    }

    Deposit HTLT

    Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

    message DepositHTLT{
    0x63986496 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    bytes swap_id
    }

    Claim HTLT

    Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

    message ClaimHTLTMsg{
    0xC1665300 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes swap_id
    bytes random_number
    }

    Refund HTLT

    Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

    message RefundHTLTMsg{
    0x3454A27C // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes swap_id
    - + diff --git a/docs/beaconchain/learn/escrow-accounts.html b/docs/beaconchain/learn/escrow-accounts.html index 82faec759c..047c140102 100644 --- a/docs/beaconchain/learn/escrow-accounts.html +++ b/docs/beaconchain/learn/escrow-accounts.html @@ -8,13 +8,13 @@ - +

    Escrow Accounts

    A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code of the protocol. The code for calculating escrow account is the same that is used in cosmos-sdk.

    Addresses of Escrow Accounts

    Governance module

    A purely-code-controlled escrow account is created for holding deposits during voting period.

    Address in mainnet: bnb1vu5max8wqn997ayhrrys0drpll2rlz4dh39s3h

    Address in testnet: tbnb1vu5max8wqn997ayhrrys0drpll2rlz4deyv53x

    // bnb prefix address: bnb1vu5max8wqn997ayhrrys0drpll2rlz4dh39s3h
    // tbnb prefix address: tbnb1vu5max8wqn997ayhrrys0drpll2rlz4deyv53x
    DepositedCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainDepositedCoins")))

    Staking module

    A purely-code-controlled escrow account is created for holding delegations.

    Address in mainnet: bnb1j725qk29cv4kwpers4addy9x93ukhw7czfkjaj

    Address in testnet: tbnb1j725qk29cv4kwpers4addy9x93ukhw7cvulkar

    // bnb prefix address: bnb1j725qk29cv4kwpers4addy9x93ukhw7czfkjaj
    // tbnb prefix address: tbnb1j725qk29cv4kwpers4addy9x93ukhw7cvulkar
    DelegationAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainStakeDelegation")))

    Bridge module

    A purely-code-controlled escrow account is created to secure the total circulation of the token on both chains.

    Address in mainnet: bnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj

    Address in testnet: tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr

    // bnb prefix address: bnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj
    // tbnb prefix address: tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr
    PegAccount = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainPegAccount")))

    Token module

    A purely-code-controlled escrow account is created to facilitate atomic swaps.

    Address in mainnet: bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u

    Address in testnet: tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d

    // bnb prefix address: bnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4f8ge93u
    // tbnb prefix address: tbnb1wxeplyw7x8aahy93w96yhwm7xcq3ke4ffasp3d
    AtomicSwapCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainAtomicSwapCoins")))

    Another purely-code-controlled escrow account is created to facilitate time locks.

    Address in mainnet: bnb1hn8ym9xht925jkncjpf7lhjnax6z8nv24fv2yq

    Address in testnet: tbnb1hn8ym9xht925jkncjpf7lhjnax6z8nv2mu9wy3

    // bnb prefix address: bnb1hn8ym9xht925jkncjpf7lhjnax6z8nv24fv2yq
    // tbnb prefix address: tbnb1hn8ym9xht925jkncjpf7lhjnax6z8nv2mu9wy3
    TimeLockCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainTimeLockCoins")))
    - + diff --git a/docs/beaconchain/learn/fees.html b/docs/beaconchain/learn/fees.html index 6dce515679..f4467d22cc 100644 --- a/docs/beaconchain/learn/fees.html +++ b/docs/beaconchain/learn/fees.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Fees

    BNB is the native token on BNB Chain , thus users are charged BNB for sending transactions.

    Trading Fees on DEX

    Trading fees are subject to complex logic that may mean that individual trades are not charged exactly by the rates below, but between them instead; this is due to the block-based matching engine in use on the DEX.

    The current fee for trades, applied on the settled amounts, is as follows:

    Transaction TypePay in non-BNB AssetPay in BNB
    Trade0.1%0.05%

    Trading fee can be queried at here. It's under the "params/DexFeeParam/". "FeeRate" and "FeeRateNative" are both under unit of 10^-6.

    Fix Fee Table

    The difference between BNB Chain and Ethereum is that there is no notion of gas. As a result, fees for the rest transactions are fixed. The details are showned in the table below:

    Current Fees Table on Mainnet

    Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Mainnet as of 2021-03-21 is as follows:

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    New Order00Y
    Cancel (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    Order Expire (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    IOC (No Fill)Equivalent 0.00025 BNB0.000005 BNBY
    TransferN/A0.000075 BNBN
    crossTransferOutN/A0.000075 BNBN
    Multi-sendN/A0.00006 BNBN
    Issue AssetN/A10 BNB
    Mint AssetN/A0.002 BNBN
    Transfer ownershipN/A0.002 BNBN
    Burn AssetN/A0.002 BNBN
    Freeze/Unfreeze AssetN/A0.001 BNBN
    Lock/unlock/relock AssetN/A0.002 BNBN
    List AssetN/A200 BNBN
    Submit ProposalN/A1 BNBN
    DepositN/A0.000125 BNBN
    Enable Memo CheckN/A0.2 BNBN
    Disable Memo CheckN/A0.2 BNBN
    HTLTN/A0.000075 BNBN
    depositHTLTN/A0.000075 BNBN
    claimHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    TinyIssueFeeN/A0.4 BNBN
    MiniIssueFeeN/A0.6 BNBN
    SetTokenUriN/A0.000075 BNBN
    List BEP8 TokenN/A1 BNBN
    Create A New Smart Chain ValidatorN/A2 BNBN
    Edit Smart Chain Validator InformationN/A0.2 BNBN
    Delegate Smart Chain ValidatorN/A0.0002 BNBN
    Redelegate Smart Chain ValidatorN/A0.0006 BNBN
    Undelegate Smart Chain ValidatorN/A0.0004 BNBN
    Unjail A Smart Chain ValidatorN/A0.5 BNBN
    Submit Byzaitine Behavior Evidence of A Smart Chain ValidatorN/A0.5 BNBN
    Submit Smart Chain ProposalN/A1 BNBN
    Smart Chain Proposal DepositN/A0.00025 BNBN
    Smart Chain Proposal VoteN/A0 BNBN
    Cross transfer out relayer rewardN/A0.0004 BNBN

    Current Fees Table on Testnet

    Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of 2021-03-17 is as follows:

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    New Order00Y
    Cancel (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    Order Expire (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    IOC (No Fill)Equivalent 0.00025 BNB0.000005 BNBY
    TransferN/A0.000075 BNBN
    crossTransferOutN/A0.000075 BNBN
    Multi-sendN/A0.00006 BNBN
    Issue AssetN/A10 BNB
    Mint AssetN/A0.002 BNBN
    Transfer ownershipN/A0.002 BNBN
    Burn AssetN/A0.002 BNBN
    Freeze/Unfreeze AssetN/A0.001 BNBN
    Lock/unlock/relock AssetN/A0.002 BNBN
    List AssetN/A200 BNBN
    Submit ProposalN/A1 BNBN
    DepositN/A0.000125 BNBN
    Enable Memo CheckN/A0.2 BNBN
    Disable Memo CheckN/A0.2 BNBN
    HTLTN/A0.000075 BNBN
    depositHTLTN/A0.000075 BNBN
    claimHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    TinyIssueFeeN/A0.4 BNBN
    MiniIssueFeeN/A0.6 BNBN
    SetTokenUriN/A0.000075 BNBN
    List BEP8 TokenN/A1 BNBN
    Create A New Smart Chain ValidatorN/A2 BNBN
    Edit Smart Chain Validator InformationN/A0.2 BNBN
    Delegate Smart Chain ValidatorN/A0.0002 BNBN
    Redelegate Smart Chain ValidatorN/A0.0006 BNBN
    Undelegate Smart Chain ValidatorN/A0.0004 BNBN
    Unjail A Smart Chain ValidatorN/A0.5 BNBN
    Submit Byzaitine Behavior Evidence of A Smart Chain ValidatorN/A0.5 BNBN
    Submit Smart Chain ProposalN/A1 BNBN
    Smart Chain Proposal DepositN/A0.00025 BNBN
    Smart Chain Proposal VoteN/A0 BNBN
    Cross transfer out relayer rewardN/A0.0004 BNBN

    How to calculate multisend fee

    bnbcli offers you a multi-send command to transfer multiple tokens to multiple people. 20% discount is available for multi-send transactions. For now, multi-send transaction will send some tokens from one address to multiple output addresses. If the count of output address is bigger than the threshold, currently it's 2, then the total transaction fee is 0.001 BNB per token per address. For example, if you send 3 ABC token,1 SAT token and 1 ABC to 3 different addresses.

    [
    {
    "to":"bnb1g5p04snezgpky203fq6da9qyjsy2k9kzr5yuhl",
    "amount":"100000000:BNB,100000000:ABC"
    },
    {
    "to":"bnb1l86xty0m55ryct9pnypz6chvtsmpyewmhrqwxw",
    "amount":"100000000:BNB"
    },
    {
    "to":"bnb1l86xty0maxdgst9pnypz6chvtsmpydkjflfioe",
    "amount":"100000000:BNB,100000000:SAT"
    }
    ]

    You will pay on mainnet/testnet

    0.0003 BNB * 5 = 0.0015 BNB

    How are rewards distributed between validators?

    you can use API to get the latest fee params.

    [
    {
    msg_type: "submit_proposal",
    fee: 500000000,
    fee_for: 1
    },
    {
    msg_type: "deposit",
    fee: 62500,
    fee_for: 1
    },
    {
    msg_type: "vote",
    fee: 0,
    fee_for: 3
    },
    {
    msg_type: "create_validator",
    fee: 1000000000,
    fee_for: 1
    },
    {
    msg_type: "remove_validator",
    fee: 100000000,
    fee_for: 1
    },
    {
    msg_type: "dexList",
    fee: 100000000000,
    fee_for: 2
    },
    {
    msg_type: "orderNew",
    fee: 0,
    fee_for: 3
    },
    {
    msg_type: "orderCancel",
    fee: 0,
    fee_for: 3
    },
    {
    msg_type: "issueMsg",
    fee: 50000000000,
    fee_for: 2
    },
    {
    msg_type: "mintMsg",
    fee: 500000000,
    fee_for: 2
    },
    {
    msg_type: "tokensBurn",
    fee: 50000000,
    fee_for: 1
    },
    {
    msg_type: "tokensFreeze",
    fee: 500000,
    fee_for: 1
    },
    {
    fixed_fee_params: {
    msg_type: "send",
    fee: 37500,
    fee_for: 1
    },
    multi_transfer_fee: 30000,
    lower_limit_as_multi: 2
    },
    {
    dex_fee_fields: [
    {
    fee_name: "ExpireFee",
    fee_value: 25000
    },
    {
    fee_name: "ExpireFeeNative",
    fee_value: 5000
    },
    {
    fee_name: "CancelFee",
    fee_value: 25000
    },
    {
    fee_name: "CancelFeeNative",
    fee_value: 5000
    },
    {
    fee_name: "FeeRate",
    fee_value: 1000
    },
    {
    fee_name: "FeeRateNative",
    fee_value: 400
    },
    {
    fee_name: "IOCExpireFee",
    fee_value: 10000
    },
    {
    fee_name: "IOCExpireFeeNative",
    fee_value: 2500
    }
    ]
    },
    {
    msg_type: "timeLock",
    fee: 1000000,
    fee_for: 1
    },
    {
    msg_type: "timeUnlock",
    fee: 1000000,
    fee_for: 1
    },
    {
    msg_type: "timeRelock",
    fee: 1000000,
    fee_for: 1
    },
    {
    msg_type: "setAccountFlags",
    fee: 100000000,
    fee_for: 1
    },
    {
    msg_type: "HTLT",
    fee: 37500,
    fee_for: 1
    },
    {
    msg_type: "depositHTLT",
    fee: 37500,
    fee_for: 1
    },
    {
    msg_type: "claimHTLT",
    fee: 37500,
    fee_for: 1
    },
    {
    msg_type: "refundHTLT",
    fee: 37500,
    fee_for: 1
    }
    ]

    The fee_forparameter indicate the different distribution way:

    • 1 means rewards is only for block proposer
    • 2 means rewards are shared among all validators
    • 3 means fee is free.

    How to query fees in every block

    The rewards for BNB Chain validators are displayed in explorer. For example: in block 59947302, validator bnb1tpagqqqx36gq09kzw4f5a3a9sk3tq54dpl5ldn get 0.00005 BNB as rewards.

    If you have a fullnode running, you can also get the rewards details exported. To achieve this, you need to set publishBlockFee to be true in your app.toml. To receive rewards stream, there aretwo options publishKafka and publishLocal

    # Whether we want publish block fee changes
    publishBlockFee = true
    blockFeeTopic = "accounts"
    blockFeeKafka = "127.0.0.1:9092"
    # Global setting
    publicationChannelSize = "10000"
    publishKafka = false
    publishLocal = true

    The rewards history are saved under {fullnode home}/marketdata/marketdata.json. For example,

    Note: Quantities here are expressed without decimals, i.e. shifted by 10^8

    {"Height":59947302,"Fee":"BNB:5000","Validators":["bnb1tpagqqqx36gq09kzw4f5a3a9sk3tq54dpl5ldn"]}
    {"Height":59947303,"Fee":"BNB:5000","Validators":["bnb1y888axmhzz6yjj464syfy68mkhzy9phlv8fzac"]}
    {"Height":59947304,"Fee":"BNB:5000","Validators":["bnb19klje94mnu53wj7pmrk0zmtpwgr0uz8th0fcvw"]}
    {"Height":59947305,"Fee":"BNB:21364","Validators":["bnb19hunw9ps8n9tkrp2j64jvheezgqmfc2eyrxd7a"]}
    {"Height":59947306,"Fee":"","Validators":[]}
    ...
    {"Height":59947480,"Fee":"BUSD-BD1:1486828;XRP-BF2:3311258","Validators":["bnb19klje94mnu53wj7pmrk0zmtpwgr0uz8th0fcvw"]}
    ...

    Trading fees can be charged in different BEP2 tokens,

    - + diff --git a/docs/beaconchain/learn/genesis.html b/docs/beaconchain/learn/genesis.html index fcd1752b0b..dd1bae5fda 100644 --- a/docs/beaconchain/learn/genesis.html +++ b/docs/beaconchain/learn/genesis.html @@ -8,7 +8,7 @@ - + @@ -39,7 +39,7 @@ weighted by voting power) that are the recipient of a valid gentx come online after genesis_time.

      "gentxs": [
    {
    "type": "auth/StdTx",
    "value": {
    "msg": [
    {
    "type": "cosmos-sdk/MsgCreateValidatorProposal",
    "value": {
    "MsgCreateValidator": {
    "Description": {
    "moniker": "Aconcagua",
    "identity": "",
    "website": "",
    "details": ""
    },
    "Commission": {
    "rate": "0",
    "max_rate": "0",
    "max_change_rate": "0"
    },
    "delegator_address": "bnb1y888axmhzz6yjj464syfy68mkhzy9phlv8fzac",
    "validator_address": "bva1kdx4xkktr35j2mpxncvtsshswj5gq577m9l0c3",
    "pubkey": {
    "type": "tendermint/PubKeyEd25519",
    "value": "Xj/NowvRnUXEtzaI2jXn2h/OfGhZssHyDtUgLSQUTj4="
    },
    "delegation": {
    "denom": "BNB",
    "amount": "1000000000000"
    }
    },
    "proposal_id": "0"
    }
    }
    ],
    "signatures": [
    {
    "pub_key": {
    "type": "tendermint/PubKeySecp256k1",
    "value": "AoeLfC96urAqZtAxg7cCSXh/+tRxGMthLbvXFu/w9nO0"
    },
    "signature": "b0wYwS7fJcpg0TerEoH22T1CqcZMc3NHm0BusK/+LPMPtqHQuOkbIlPUM12r1iXJjKZhPM/ItFveKIo1oFtfUg==",
    "account_number": "0",
    "sequence": "0"
    },
    {
    "pub_key": {
    "type": "tendermint/PubKeySecp256k1",
    "value": "AreZUwAj6OlZI+xHZm66K4Nj5G/eNei768x77fdFz1fc"
    },
    "signature": "GefEmRyOFk5jGpIZnaGNAOubzPn+wedg62mf8m8yV5cWK7+SByBCcCTHQ+7kB+mkMjOR1AIuXC7Xfou5Q/QhgQ==",
    "account_number": "0",
    "sequence": "0"
    }
    ],
    "memo": "",
    "source": "0",
    "data": null
    }
    }
    ]

    A gentx is just a signed message that validator signed to agree to be validators. Let us break down the parameters:

    • Signature related info
      • pub_key: pubkey is used for verifying signature
      • signature: the signature from validator
      • account_number: Unique identifier for the account. It is generated the first time a transaction including this account is included in a block. In gentx, they are all 0
      • sequence: This number is used to count the number of transactions sent by this account. It is incremented each time a transaction is included in a block, and used to prevent replay attacks. Initial value is 0.
      • memo, source and data are all customized details regarding this transaction
    • Delegation related info
      • moniker: the name of validator
      • delegator_address: this is the address that is listed in app_state section
      • validator_address: this is the validator pubkey in bech32 encoding with prefix of bva
      • delegation: this is the delegation amount. It's shifted by 8 digits for representing decimals.

    How to Generate Geneis File

    You can generate a default genesis file for your own testnet by running the following command:

    bnbchaind init --chain-id

    The genesis file will be stored in ~/.bnbchaind/config/genesis.json.

    - + diff --git a/docs/beaconchain/learn/matching-engine.html b/docs/beaconchain/learn/matching-engine.html index 042e85111c..18ae315ab5 100644 --- a/docs/beaconchain/learn/matching-engine.html +++ b/docs/beaconchain/learn/matching-engine.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Matching Engine

    Binance DEX is the native marketplace on BNB Beacon Chain , allowing you to exchange digital assets issued and listed on it. The matching happens within the blockchain nodes and all of the transactions are recorded on-chain, therefore forming a complete, auditable ledger of activity.

    ATTENTION: The match logic on DEX is quite different from normal centralized exchange. Please go over the trading and match spec below to get the best interests for your orders.

    • Order Types

    Binance DEX only accept LIMIT orders, which is adhering to SEC definitions of LIMIT orders

    • TimeInForce:

          * GTE: Good Till Expire. Order would stay effective until expire time. Order may expire in the UTC midnight after more than 259, 200 blocks, which is 72 hours in term of blocking time.
      * IOC: Immediate or Cancel. Orders would be executed as much as it can in the booking block round and then got canceled back if there is still quantity left.
    • Match Logic

    Binance DEX uses periodic auction to match all available orders. Maker/Taker concepts are introduced to enhance the current periodic auction match algorithm. The match is still executed only once in each block while the execution prices may vary for maker and taker orders.

    • Anti-front-running

    Front-running means someone can get prior knowledge of transactions from other beneficial owners via technology or market advantage, so that they can influence the price beforehand and result in economic gain, which usually brings loss or cost to others. It is a daunting question asked to both centralized and other decentralized exchanges (DEX). Especially on some DEX, front-running actually happens quite often, e.g. via gas or timestamp manipulations, or slow matching.

    There are several design points in Binance DEX that make front-running very difficult to execute.

    - + diff --git a/docs/beaconchain/learn/signature.html b/docs/beaconchain/learn/signature.html index 45013b9bf8..51435e4533 100644 --- a/docs/beaconchain/learn/signature.html +++ b/docs/beaconchain/learn/signature.html @@ -8,13 +8,13 @@ - +

    Signatures

    Signature is the evidence to prove the sender owns the transaction. It will be created from the actions outlined below:

    1. Compose a data structure. please note msgs, memo, source, data are the same as in the above payload.

      - `chain_id`: a string, unique ID for the Chain, it stays the same for most time, but may vary as BNB Beacon Chain  evolves;
      - `account_number`: a string for a 64-bit integer, an identifier number associated with the signing address
      - `sequence`: a string for a a 64-bit integer, please check [accounts](/docs/beaconchain/learn/accounts)
      - `memo`: a string, a short sentence of remark for the transaction
      - `msgs`: a byte array, **json encoded** transaction messages, please check the [encoding](/docs/beaconchain/learn/encoding/) doc.
      - `source`: a string for a 64 bits integer, which is an identifier for transaction incoming tools
      - `data`: byte array, reserved for future use

      Here is an example in go-sdk:

      // StdSignMsg def
      type StdSignMsg struct {
      ChainID string `json:"chain_id"`
      AccountNumber int64 `json:"account_number"`
      Sequence int64 `json:"sequence"`
      Msgs []msg.Msg `json:"msgs"`
      Memo string `json:"memo"`
      Source int64 `json:"source"`
      Data []byte `json:"data"`
      }
    2. Encode the above data structure in json, with ordered key, Specifically:

      • Maps have their keys sorted lexicographically
      • Structs keys are marshalled in the order defined in the struct
    1. Sign SHA256 of the encoded byte array, to create an ECDSA signature on curve Secp256k1 and serialize the R and S result into a 64-byte array. (both R and S are encoded into 32-byte big endian integers, and then R is put into the first 32 bytes and S are put into the last 32 bytes of the byte array. In order to break S 's malleability, S set to curve.Order() - S if S > curnve.Order()/2.)

    The signature will be encoded together with transaction message and sent as payload to BNB Beacon Chain node via RPC or http REST API, as described in the above section.

    - + diff --git a/docs/beaconchain/learn/threshold-signature-scheme.html b/docs/beaconchain/learn/threshold-signature-scheme.html index c3d8ca1be0..f554223ac1 100644 --- a/docs/beaconchain/learn/threshold-signature-scheme.html +++ b/docs/beaconchain/learn/threshold-signature-scheme.html @@ -8,13 +8,13 @@ - +

    Threshold Signature Scheme

    Introduction

    Threshold Signature Scheme (TSS) is a cryptographic protocol for distributed key generation and signing. TSS allows constructing a signature that is distributed among different parties (for example three users), and each user receives a share of the private signing key. To sign a transaction, at least two of these three users need to join. For individuals, threshold signatures allow for two-factor security or splitting the ability to sign between two devices so that a single compromised device won’t put the money at risk. For businesses, threshold signatures allow for the realization of access control policies that prevent both insiders and outsiders from stealing corporate funds. TSS technology allows us to replace all signing commands with distributed computations.The private key is no longer a single point of failure.

    Motivation

    A physical key must fit exactly into a keyhole to unlock a physical vault. But if this key is compromised or lost, the funds locked in the vault may no longer be safe. This simple approach of key management may make sense when a small sum is at stake. However, when the amount stored in the vault is large, it is wise to consider spreading the responsibility of key ownership between several trusted parties.

    Traditional MultiSig (multi-signature) is a more refined unlocking system that requires multiple independent keys to unlock the vault. MultiSig requires generating a larger private key and the vault has multiple locks - one for each key . More processing power is needed as participants have to sign additional signatures, which must then be checked individually by the network. This is not ideal, because a participant must leave traces showing exactly who signed and multiple parties must be online at the same time.

    With Threshold Signatures, all of the parties must forge the vault’s lock together, in a modular way, where each party owns a share of the key. A TSS vault is indistinguishable from a regular vault and is hence universal, and it has the same privacy and verification cost of a regular vault. Even if only a subset of the keys is available, the vault may still be unlocked (this is known as meeting a threshold of participation).

    Combining TSS feature with BNB Beacon Chain client will help users manage their funds in a much safer way. TSS will be offered in an independent binary, but it will have some impact on the existing functions of bnbcli/tbnbcli.

    Implementation

    Many development resources have been poured into implementing TSS, a cryptographic protocol for distributed key generation and signing. TSS is now compatible and reusable for ECDSA-based blockchains, including BNB Beacon Chain , Bitcoin, and Ethereum networks. We expect that members of the BNB Chain ecosystem and partner community can integrate this TSS library with their applications, such as wallets and custodians, and further develop this exciting new technology.

    With the support of the BNB Beacon Chain community, we are happy to share the open-source code at https://github.com/bnb-chain/tss-lib.

    Security Audit

    The implementation of a multi-party threshold ECDSA library is open source so it can be publicly audited by anyone. An independent third party auditors from Kudelski Security are hired to validate the security of the cryptography in TSS solution. The latest report in October by can be found here.

    Security checks are routinely and continuously planed for all parts of TSS lib implmentations and future audits will be reported to BNB Beacon Chain community.

    Workflow

    Let’s take a look at the major steps in TSS:

    • Vault Initialization: the first step is for setting up tss parameters of each party. This will initialize the node's p2p listen address and setup a directory to save key. It's recommended that you should save your tss key in a different folder other than normal key info.

    • Key Generation: the second step is also the most complex. We need to define the quorum policy: count of total parties (n) that holds secret shares and threshold (t) which means at least t + 1 parties need to take part in the signing process. We need to generate a key which will be public and used to verify future signatures. However, we also have to generate an individual secret for each party, which is called a secret share. The functions guarantee the same public key to all parties and a different secret share for each. In this way, we achieve: (1) privacy: no secret shares data is leaked between any parties, and (2) correctness: the public key is intact with secret share. They need to agree on the channel which they want to use for sending messages between each other. The channel will have its corresponding password. Both ID and password needs to be shared offline.

    • Signing: this step involves a signature generation function. The input of each party will be its own secret share, created as output of the distributed key generation in the previous step. There is also public input known to all, which is the message to be signed. The output will be a digital signature, and the property of privacy ensures that no leakage of secret shares occurred during the computation.

    • Verification: the verification algorithm remains as it is in the classical setting. To be compatible with single key signatures, BNB Beacon Chain validator nodes can be able to verify the signature with the public key. The transaction will be no different from others.

    • Vault Regroup: Regroup will reset secret share and configs between all parties.It's recommend to switch the configuration periodically, say once a month. If some party lost his key, it's also necessory to reset the distribution once some party lost their key. Regroup will generate new_n secret share with new_t threshold. At least old_t + 1 should participant

    Where can I download the Binance TSS CLI?

    You can download tss client and BNB Beacon Chain Commandline here:

    How to Use

    • Warning: Please test your TSS setup before use this on mainnet.

    Please backup your bnbcli home before use this tool:

    cp -r ~/.bnbcli ~/.bnbcli_backup_tss (replace ~/.bnbcli with their bnbcli home)

    Please refer to this Example to help you understand the whole process

    Init

    tss init will create home directory of a new tss setup, generate p2p key pair.

    • Here are the global transaction flags:
    NameTypeDescriptionNote
    vault_namestringname of the vault of this party
    passwordstringthe password of the vaultmust be 32 bytes or more, the default value is 48
    homestringPath to config/route_table/node_key/tss_key files, configs in config file can be overridden by command line argumentthe default value is "~/.tss"
    • Here are the flags for tss init:
    NameTypeDescriptionNote
    kdf.iterationsuint32The number of iterations (or passes) over the memory.the default value is 13
    kdf.key_lengthuint32Length of the generated key (or password hash) "must be 32 bytes or more,the default value is 48"
    kdf.memoryuint32The amount of memory used by the algorithm (in kibibytes)the default value is 65536
    kdf.parallelismuint8The number of threads (or lanes) used by the algorithm.the default value is 4
    kdf.salt_lengthuint32Length of the random salt. 16 bytes is recommended for password hashing.the default value is 16
    monikerstringmoniker of current party
    p2p.listenstringAdds a multiaddress to the listen list

    Describe

    tss describe will show config and address of a tss vault

    • Here are the flags for tss describe:
    NameTypeDescriptionNote
    address_prefixstringbech32 prefix of address (default "bnb")
    • Example
    ./tss describe

    > please set vault of this party:
    [input vault name]
    > Password to sign with this vault:
    [input password]
    address of this vault: bnb1
    config of this vault:
    {
    "p2p": {
    "listen": "/ip4/0.0.0.0/tcp/59968",
    "bootstraps": null,
    "relays": null,
    "peer_addrs": [
    "/ip4/127.0.0.1/tcp/59748",
    "/ip4/127.0.0.1/tcp/60022"
    ],
    "peers": [
    "test3",
    "test2"
    ],
    "DefaultBootstap": false
    },
    "Id": "",
    "Moniker": "tss1",
    "vault_name": "vault1",
    "Threshold": 1,
    "Parties": 3,
    "log_level": "info",
    "profile_addr": "",
    "Home": "~/.tss"
    }

    Channel

    tss channel will generate a channel ID for bootstrapping. One party can generate a channel, then share the generated channel ID with others offline.

    • Here are the flags for tss channel:
    NameTypeDescriptionNote
    channel_expireintexpire time in minutes of this channelDefault value is 30mins

    It's advised to refresh the channels regularly.

    Keygen

    This command will generated the private key and share the secret. Everyone needs to agree on the password of this private key. The lenght of password must be more than eight.

    Note: you need to make sure that all the parties are online.

    • Here are the flags for tss keygen:
    NameTypeDescriptionNote
    address_prefixstringprefix of bech32 addressthe default value is bnb
    channel_idstringchannel id for this session
    channel_passwordstringpassword to this channelThis password has to be set offline. And its length should be more than eight.
    p2p.peer_addrs[]stingpeer's multiplex addresses
    partiesinttotal parities of this scheme
    thresholdintthreshold of this scheme, at least threshold + 1 parties need participant signing

    if you want to add the generated key files in the bnbcli home, you can copy it to the home folder:

    bnbcli keys add --tss -t tss --tss-home ~/.test1 --tss-vault third test1_third

    Regroup

    This command will generate new_n secret from the same private key, and it will be shared with new_t threshold. At least old_t + 1 should participante in signing

    • Here are the flags for tss regroup:
    NameTypeDescriptionNote
    channel_passwordstringchannel password of this session
    channel_idstringchannel id of this session
    is_oldstringwhether this party is old committee. If it is set to true, it will participant signing in regroup. There should be only t+1 parties set this to true for one regroup
    is_new_memberstringwhether this party is new committee, for new party it will changed to true automatically. if an old party set this to true, its share will be replaced by one generated one
    new_partiesintnew total parties of regrouped scheme
    new_thresholdintnew threshold of regrouped scheme
    p2p.new_peer_addrs[]stingunknown peer's multiple addresses
    partiesinttotal parities of this scheme
    thresholdintthreshold of this scheme, at least threshold + 1 parties need participant signing

    Changes to bnbcli/tbnbcli

    We added a new key type “tss” (just like the existing types: “local”, “offline”, “ledger”) to bnbcli which stands for tss secret share.

    To add a tss key into bnbcli’s keystore:

    1. Tss keygen command will automatically add generated secret share into default keystore (~/.bnbcli) with name tss_<moniker>_<vault_name>
    2. User can manually specify tss’s home, vault_name and a customized bnbcli home like:
    bnbcli keys add --home ~/.customized_cli --tss -t tss --tss-home ~/.test1 --tss-vault “default” my_name

    All other commands (i.e. send token, place order, delete key etc.) of bnbcli should support tss type key.

    Example

    In this example, A, B and C are the parties who decided to share a private key together. They decided that any two of them can sign a transaction. To complete a TSS signing process, they need to follow the following steps:

    Step 1: Init TSS

    During this step, all parties from different machines have to initialite their P2P settings before generate the shared key.

    ABC
    command./tss init./tss init./tss init
    Interactive input> please set moniker of this party:
    tss1
    > please set vault of this party:
    vault1
    > please set password of thisvault:
    [input password]
    > please input again:
    [input password]
    > please set moniker of this party:
    tss2
    > please set vault of this party:
    vault1
    > please set password of this vault:
    [input password]
    >please input again:
    [input password]
    > please set moniker of this party:
    tss3
    > please set vault of this party:vault1
    > please set password of this vault:
    [input password]
    > please input again:
    [input password]
    outputLocal party has been initialized under:
    ~/.tss/vault1
    Local party has been initialized under:
    ~/.tss/vault1
    Local party has been initialized under:
    ~/.tss/vault1
    Files touched or generated~/.tss/vault1/config.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/node_key

    Step 2: Generate Channel ID for bootstraping

    In this step, the parties will create a secrect communication channel between them. One of then will generate the channel ID and share with others. In this example, A will generate the channel ID. B and C will not have to do anything. A can also specify the length for this channel session and the default time is 30 mins.

    ABC
    command./tss channelN/AN/A
    Interactive input> please set expire time in minutes, (default: 30):
    [input time]
    N/AN/A
    outputchannel id: 5185D3EF597N/AN/A

    Step 3: Generate and Share Secret

    In this step, the private key will be generated and shared between these three parties. All the parties have to be online at the sme time.

    ABC
    command./tss keygen --vault_name vault1./tss keygen --vault_name vault1./tss keygen --vault_name vault1
    Interactive input> Password to sign with this vault:
    [enter password]
    > please set total parties(n):
    3
    > please set threshold(t), at least t + 1 parties need participant signing:
    1
    > please set channel id of this session
    [enter ID]
    > please input password (AGREED offline with peers) of this session:
    [enter password]
    > please input password of this tss vault:
    [enter password]
    >please input> Password to sign with this vault:
    [enter password]
    > please set total parties(n):
    3
    > please set threshold(t), at least t + 1 parties need participant signing:
    1
    > please set channel id of this session
    [enter ID]
    >please input password (AGREED offline with peers) of this session:
    [enter password]
    >please input password of this tss vault:
    [enter password]
    > Password to sign with this vault:
    [enter password]
    > please set total parties(n):
    3
    > please set threshold(t), at least t + 1 parties need participant signing:
    1
    > please set channel id of this session
    3085D3EC76D
    > please input password (AGREED offline with peers) of this session: [enter password]
    Password of this tss vault:
    [enter password]
    output18:00:09.777 INFO tss-lib: party {0,tss1}: keygen finished! party.go:11318:00:09.777 INFO tss: [tss1] received save data client.go:30418:00:09.777 INFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp client.go:309Password of this tss vault:NAME: TYPE: ADDRESS: PUBKEY:tss_tss1_vault1 tss tbnb19277gzv934ayctxeg5k9zdwnx3j48u6tydjv9p bnbp1addwnpepqwazk6d3f6e3f5rjev6z0ufqxk8znq8z89ax2tgnwmzreaq8nu7sx2u4jcc18:00:09.777 INFO
    : party {1,tss2}: keygen finished! party.go:11318:00:09.777 INFO tss: [tss2] received save data client.go:30418:00:09.777 INFO tss: [tss2] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp client.go:309Password of this tss vault:NAME: TYPE: ADDRESS: PUBKEY:tss_tss2_vault1 tss tbnb19277gzv934ayctxeg5k9zdwnx3j48u6tydjv9p bnbp1addwnpepqwazk6d3f6e3f5rjev6z0ufqxk8znq8z89ax2tgnwmzreaq8nu7sx2u4jcc18:00:09.773 INFO tss-lib: party {2,tss3}: keygen finished! party.go:11318:00:09.773 INFO tss: [tss3] received save data client.go:30418:00:09.773 INFO tss: [tss3] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp client.go:309Password of this tss vault:NAME: TYPE: ADDRESS: PUBKEY:tss_tss3_vault1 tss tbnb19277gzv934ayctxeg5k9zdwnx3j48u6tydjv9p bnbp1addwnpepqwazk6d3f6e3f5rjev6z0ufqxk8znq8z89ax2tgnwmzreaq8nu7sx2u4jcc
    Files touched or generated~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json

    Step 4: Sign Transaction

    In this steo, A and B decided to sign a transaction together. Both A and B will try to broadcast the transaction and only one of them will succeed.

    ABC
    commandtbnbcli send --amount 1000000:BNB --to tbnb1mh3w2kxmdmnvctt7t5nu7hhz9jnp422edqdw2d --from tss_tss1_vault1 --chain-id Binance-Chain-Ganges --node https://data-seed-pre-0-s1.bnbchain.org:443 --trust-nodetbnbcli send --amount 1000000:BNB --to tbnb1mh3w2kxmdmnvctt7t5nu7hhz9jnp422edqdw2d --from tss_tss2_vault1 --chain-id Binance-Chain-Ganges --node https://data-seed-pre-0-s1.bnbchain.org:443 --trust-nodeNA
    Interactive inputPassword to sign with tss_tss1_vault1:
    [Enter password]
    > Channel id:
    5185D3EF597
    please input password (AGREED offline with peers) of this session:
    [Enter password]
    Password to sign with tss_tss2_vault1:
    [Enter password]
    > Channel id:
    5185D3EF597
    please input password (AGREED offline with peers) of this session:
    [Enter password]
    N/A
    outputCommitted at block 33600477 (tx hash: 4FB8096A93D545612A3B5DCE520622608C299C7742103A6BE34C444829BD83A5ERROR: broadcast_tx_commit: Response error: RPC error -32603 - Internal error: Error on broadcastTxCommit: Tx already exists in cacheN/A
    Files touched or generatedN/AN/AN/A

    Step 5: Regroup Vault

    First, please generate a new channel for messaging:

    ABC
    command./tss channelN/AN/A
    Interactive input> please set expire time in minutes, (default: 30):
    [input time]
    N/AN/A
    outputchannel id: 3415D3FBE00N/AN/A

    Then, we can switch to the new channel for sending messages to each others.

    ABC
    command./tss regroup./tss regroup./tss regroup
    Interactive input> please set vault of this party:
    vault1
    > Password to sign with this vault:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set new total parties(n):
    3
    > please set new threshold(t), at least t + 1 parties participant signing:
    1
    > Channel id:
    3415D3FBE00
    please input password (AGREED offline with peers) of this session:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > please set vault of this party:
    vault1
    > Password to sign with this vault:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set new total parties(n):
    3
    > please set new threshold(t), at least t + 1 parties participant signing:
    1
    > Channel id:
    3415D3FBE00
    please input password (AGREED offline with peers) of this session:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > please set vault of this party:
    vault1
    > Password to sign with this vault:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set new total parties(n):
    3
    > please set new threshold(t), at least t + 1 parties participant signing:
    1
    > Channel id:
    3415D3FBE00
    please input password (AGREED offline with peers) of this session:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    outputINFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jpINFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jpINFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp
    Files touched or generated~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/node_key
    • New committee having different t-n from old committee
    1. Change 1-3 into 2-4 scheme.
    2. old parties (A, B) join new committee
    3. new parties (D, E) are newly-joined
    DE
    command./tss init --vault_name vault1./tss init --vault_name vault1
    Interactive input> please set moniker of this party:
    tss4
    > please set password for key share:
    [Enter password]
    > please intput again:
    [Enter password]
    > please set moniker of this party:
    tss4
    > please set password for key share:
    [Enter password]
    > please intput again:
    [Enter password]
    outputLocal party has been initialized under: ~/.tss/vault1Local party has been initialized under: ~/.tss/vault1
    • Regroup from 1-3 to 2-4, with 2 old parties (A and B) and 2 new parties (D and E)
    A (old&new committee)B (old&new committee)D (new committee)E (new committee)
    command./tss regroup/ --vault_name vault1./tss regroup --vault_name vault1./tss regroup --vault_name vault1./tss regroup --vault_name vault1
    Interactive input> please input password:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new commitee? [Y/n]:
    Y
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties participant signing:
    2
    > Channel id:
    3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    > please input password:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties need participant signing:
    2
    > Channel id: 3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    > please input password:
    [Enter password]
    > please set Old total parties(n):
    3
    > please set Old threshold(t), at least t + 1 parties need participant signing:
    1
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties need participant signing:
    2
    > Channel id:
    3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    > please input password:
    [Enter password]
    > please set Old total parties(n):
    3
    > please set Old threshold(t), at least t + 1 parties need participant signing:
    1
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties need participant signing:
    2
    > Channel id:
    3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    output
    Files touched or generated~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/payment/config.json
    ~/.tss/payment/pk.json
    ~/.tss/vault1/sk.json
    - + diff --git a/docs/beaconchain/learn/trading-interface.html b/docs/beaconchain/learn/trading-interface.html index 8cd0d3d0c5..c69d972de9 100644 --- a/docs/beaconchain/learn/trading-interface.html +++ b/docs/beaconchain/learn/trading-interface.html @@ -8,7 +8,7 @@ - + @@ -25,7 +25,7 @@ img

    Your Trading Activities

    img In the bottom left-hand side of the interface, you can locate Open Orders, Order History, Trade History, and Balances.

    • Open Orders: This section shows which orders are not filled in their entirety and are still currently open. You can view all of the orders on the blockchain by looking at their TxHash.
    • Order History: This section shows the orders you have placed, filled, unfilled or canceled. You can view all of the orders on the blockchain by looking at their TxHash.
    • Trade History: This section shows your executed trades on the exchange.
    • Balances: This section displays the current balance of your BNB Chain Wallet.

    Order Form

    Binance DEX currently only supports Limit orders. The Limit order section allows you to define the bid/ask price and the quantity you wish to trade. Please note that all order’s parameters’ constrains:

    • Price: Order price must be changed by multiple of tick size. Tick size stands for the smallest unit on price change
    • Quantity: Order quantity must be multiple of lot size. Lot size stands for the smallest quantity change
    • Timeinforce: It is Good Till Expire (GTE). The order would stay effective until expire time. The order may expire in the UTC midnight after more than 259, 200 blocks, which is 72 hours in terms of blocking time. img
    - + diff --git a/docs/beaconchain/learn/trading-specification.html b/docs/beaconchain/learn/trading-specification.html index b3d462f7ac..ce6100fa1f 100644 --- a/docs/beaconchain/learn/trading-specification.html +++ b/docs/beaconchain/learn/trading-specification.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/beaconchain/learn/transaction.html b/docs/beaconchain/learn/transaction.html index 6a9ecbd518..2179e53710 100644 --- a/docs/beaconchain/learn/transaction.html +++ b/docs/beaconchain/learn/transaction.html @@ -8,13 +8,13 @@ - +

    BNB Beacon Chain Transaction Basics

    A blockchain is a globally shared, transactional database. This means that everyone can read entries in the database just by participating in the network. If you want to change something in the database, you have to create a so-called transaction which has to be accepted by all others. The word transaction implies that the change you want to make (assume you want to change two values at the same time) is either not done at all or completely applied. Furthermore, while your transaction is being applied to the database, no other transaction can alter it.

    As an example, imagine a table that lists the balances of all accounts in an electronic currency. If a transfer from one account to another is requested, the transactional nature of the database ensures that if the amount is subtracted from one account, it is always added to the other account. If due to whatever reason, adding the amount to the target account is not possible, the source account is also not modified.

    Furthermore, a transaction is always cryptographically signed by the sender (creator). This makes it straightforward to guard access to specific modifications of the database. In the example of the electronic currency, a simple check ensures that only the person holding the keys to the account can transfer money from it.

    - + diff --git a/docs/beaconchain/learn/transactions.html b/docs/beaconchain/learn/transactions.html index 600da1dc22..0d3c6e9a1b 100644 --- a/docs/beaconchain/learn/transactions.html +++ b/docs/beaconchain/learn/transactions.html @@ -8,13 +8,13 @@ - +

    BNB Beacon Chain Transaction Basics

    A blockchain is a globally shared, transactional database. This means that everyone can read entries in the database just by participating in the network. If you want to change something in the database, you have to create a so-called transaction which has to be accepted by all others. The word transaction implies that the change you want to make (assume you want to change two values at the same time) is either not done at all or completely applied. Furthermore, while your transaction is being applied to the database, no other transaction can alter it.

    As an example, imagine a table that lists the balances of all accounts in an electronic currency. If a transfer from one account to another is requested, the transactional nature of the database ensures that if the amount is subtracted from one account, it is always added to the other account. If due to whatever reason, adding the amount to the target account is not possible, the source account is also not modified.

    Furthermore, a transaction is always cryptographically signed by the sender (creator). This makes it straightforward to guard access to specific modifications of the database. In the example of the electronic currency, a simple check ensures that only the person holding the keys to the account can transfer money from it.

    - + diff --git a/docs/beaconchain/learn/walletconnect.html b/docs/beaconchain/learn/walletconnect.html index ac548df050..c5706fab70 100644 --- a/docs/beaconchain/learn/walletconnect.html +++ b/docs/beaconchain/learn/walletconnect.html @@ -8,13 +8,13 @@ - +

    Wallet Connect

    What is WalletConnect?

    WalletConnect is an open protocol for connecting desktop Dapps to mobile Wallets using end-to-end encryption by scanning a QR code. Opening up a whole world of Dapps that were once only available to Metamask. The user can interact with any Dapp without comprising their private keys and will be notified to sign any transaction requests on their mobile.

    How does it work?

    WalletConnect is a simple infrastructure that can be setup by any developer. Using a Bridge server to relay the messages without having access to any of its contents. The contents are encrypted using the session data shared by the QR code between the desktop and mobile. There are libraries for Web, iOS and Android. Read more about it in our documentation introduction.

    Wallets with WalletConnect Support for BNB Beacon Chain

    • List of Wallets Supporting WalletConnect on BNB Beacon Chain
    NumberWallet NameNetwork
    1Trust WalletMainnet
    2Math WalletMainnet
    3Meet.One WalletMainnet
    4Equal WalletMainnet & Testnet
    5SafePal WalletMainnet
    6CoolWalletMainnet
    7XWalletMainnet
    8Atomic WalletMainnet

    Get Started

    Currently the WalletConnect protocol has references implementations written in Typescript for the Client (browser/react-native/nodejs), the Bridge Server and the Push server.

    To learn more about how to develop, please read the official documentation.

    The BNB Beacon Chain Web Wallet supports connecting with external wallet providers via the WalletConnect protocol.

    WalletConnect allows the user to scan a QR code from the wallet app to unlock and use their wallet seamlessly in the web UI.

    In order for this to work, some modifications to the standard WalletConnect protocol are used in the BNB Beacon Chain wallet's implementation.

    See the list of wallets which support WalletConnect on BNB Beacon Chain here

    Connecting via WalletConnect

    Wallet providers should make use of the WalletConnect Client SDK for their target programming language and OS. There are implementations on GitHub for iOS, Android, React Native, etc.

    Protocol Differences

    Since we do not use Ethereum transactions, there are some differences:

    • Typically sendTransaction is used with Ethereum transaction parameters in WalletConnect dApp integrations. But in BNB Beacon Chain 's case, instead of invoking sendTransaction in the WalletConnect flow, the new sendCustomRequest call is used instead with a method called bnb_sign (see below).

    • The external wallet provider is responsible for sending back the signature and public key of the transaction but should not broadcast the transaction itself. We have instead defined a custom result format in the form of stringified JSON containing the signature and public key. The reason for this is that the wallet app probably does not have access to the complete serialized binary form of the transaction (as this requires Amino encoding).

    • The web wallet will send back a second custom call (after bnb_sign) called bnb_tx_confirmation, which contains the boolean result of the transaction build/broadcast and any error message encountered by the web wallet during broadcasting. In a complete implementation, this confirmation callback should be responded to with a call to approveRequest.

    Sequence Diagram

    This sequence diagram shows the flow of messages when the web wallet interacts with an external wallet provider via WalletConnect.

    WalletConnect Protocol Sequence

    Custom Requests

    A custom call request adheres to this structure:

    {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "method_name",
    "params": [{ ... }],
    }

    We have two custom call request formats, here are examples of them:

    Example: bnb_sign

    {
    "method": "bnb_sign",
    "params": [
    {
    "account_number": "34",
    "chain_id": "Binance-Chain-Ganges",
    "data": null,
    "memo": "test",
    "msgs": [
    {
    "inputs": [
    {
    "address": "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd",
    "coins": [
    {
    "amount": 1000000000,
    "denom": "BNB",
    },
    ],
    },
    ],
    "outputs": [
    {
    "address": "tbnb1ss57e8sa7xnwq030k2ctr775uac9gjzglqhvpy",
    "coins": [
    {
    "amount": 1000000000,
    "denom": "BNB",
    },
    ],
    },
    ],
    },
    ],
    "sequence": "31",
    "source": "1",
    }
    ]
    }

    Response (approveRequest)

    A response like this should be sent back from the wallet app:

    {
    "id": 1553682007906047,
    "result": "{\"signature\":\"...\",\"publicKey\":\"...\"}"
    }

    In result, a JSON-encoded object must be included containing the following hex-string properties: signature, publicKey.

    Note that:

    • id and jsonrpc are usually pre-filled by the client SDK, so there should be no need to set this in the object yourself.

    • signature should be 64 bytes in length (128 hex chars)

    • publicKey should be 65 bytes in length (130 hex chars, non-compressed form, prefixed with 0x04)

    Example: bnb_tx_confirmation

    {
    "method": "bnb_tx_confirmation",
    "params": [
    {
    "ok": true,
    "error": "Error message (optional)"
    }
    ]
    }

    Receipt of the bnb_tx_confirmation should be confirmed by the app with approveRequest as per the WalletConnect protocol flow.

    For this response, result may be empty or contain an empty JSON-encoded object:

    Response (approveRequest)

    A response like this should be sent back from the wallet app:

    {
    "id": 1553682007906050,
    "result": ""
    }

    Ending the Session

    Remember to call killSession() when the user has finished using the integration from your app!

    This will redirect the user back to the unlock screen in the web wallet.

    - + diff --git a/docs/beaconchain/light-client.html b/docs/beaconchain/light-client.html index 0767e50b09..e88d45e9c5 100644 --- a/docs/beaconchain/light-client.html +++ b/docs/beaconchain/light-client.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ depends on how many requests the light client handles concurrently.
  • Light client is faster than a full node even if it lagged behind the core network for a few months. It only needs a few seconds to catch up with core network.
  • Platforms and System Requirement

    Platforms

    We support running light client node on Mac OS X, Windows and Linux.

    The light client will soon be open sourced, afterwards you can cross compile light client binary and run it on other platforms.

    Requirements

    • 50 megabytes of free disk space.
    • 2 CPU cores, 50 megabytes of memory (RAM).

    Run a light client node

    Help info:

    ./lightd --help
    This node will run a secure proxy to a binance rpc server.

    All calls that can be tracked back to a block header by a proof
    will be verified before passing them back to the caller. Other that
    that it will present the same interface as a full binance node,
    just with added trust and running locally.

    Usage:
    lite [flags]

    Flags:
    --cache-size int Specify the memory trust store cache size (default 10)
    --chain-id string Specify the BNB Beacon Chain ID (default "bnbchain")
    -h, --help help for lite
    --home-dir string Specify the home directory (default ".binance-lite")
    --laddr string Serve the proxy on the given address (default "tcp://localhost:27147")
    --max-open-connections int Maximum number of simultaneous connections (including WebSocket). (default 900)
    --node string Connect to a binance node at this address (default "tcp://localhost:27147")

    You can specify all the parameters above.

    Start the light client node according to the Platform. Replace the platform variable with mac, windows or linux in the following command:

    ./{{platform}}/lightd --chain-id "{chain-id}" --node tcp://{full node addr}:80 > node.log  &

    There are two required parameters to start a light client node: chain id and full node addr.

    The chain id of the network that you want join in.

    You can find chain id at genesis file in test network or genesis file in prod network.

    The full node addr field can be an address of any full node that you have deployed.

    You can refer to Run a BNB Beacon Chain full node to get more details.

    We supply a bunch of full nodes that you can connect to for both mainnet and testnet.

    You cat get full nodes info through a simple python script(notice to replace domain according to different network):

    import requests, json
    d = requests.get('https://dex.binance.org/api/v1/peers').text # replace dex.binance.org with testnet-dex.binance.org for testnet
    l = json.loads(d)
    seeds = ",".join([ (seed["id"]+"@"+seed["original_listen_addr"]) for seed in l if seed["accelerated"] == False])
    print (seeds)

    Example for Mainnet:

    ./lightd --chain-id "Binance-Chain-Tigris" --node tcp://dataseed1.bnbchain.org:80 > node.log  &

    Example for Testnet:

    ./lightd --chain-id "Binance-Chain-Ganges" --node tcp://data-seed-pre-0-s1.bnbchain.org:80 > node.log  &

    Working with the light client

    Light client has the same RPC interface as rpc-api.

    The default port of light client is 27147.

    - + diff --git a/docs/beaconchain/list.html b/docs/beaconchain/list.html index 2dfdfd34e1..ff4ef5edb4 100644 --- a/docs/beaconchain/list.html +++ b/docs/beaconchain/list.html @@ -8,13 +8,13 @@ - +

    List Transaction

    Only BEP2 tokens issued on BNB Beacon Chain can be listed. Learn how to issue BEP2 tokens here. If a token's listing proposal has been passed by valdiators, then a list transaction must be sent before expire-time.

    List Fee

    Fees will be charge when issuing a token, creating a proposal, depositing and listing. You can refer to fee table in trading spec.

    List Transaction

    Proposal Parameters

    • quote-asset-symbol: For now, only support BNB as quote asset.
    • init-price: the initial price for your asset, it is boosted by 1e8
    • proposal-id: this corresponds to the listing proposal that is passed
    • from: this address should be the issuer of base asset

    Example on mainnet:


    $ ./bnbcli dex list -s AAA-254 --quote-asset-symbol BNB --from test \
    --init-price 100000000 --proposal-id 15 --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --json
    {
    "Height":"282409",
    "TxHash":"77AE3D190F430FE6E4B1A9659BEBB3F022CF7631",
    "Response":{
    "log":"Msg 0: ",
    "tags":[
    {
    "key":"YWN0aW9u",
    "value":"ZGV4TGlzdA=="
    }
    ]
    }
    }

    Example on testnet:

    $  ./tbnbcli dex list -s AAA-254 --quote-asset-symbol BNB --from test \
    --init-price 100000000 --proposal-id 15 --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --json
    {
    "Height":"282409",
    "TxHash":"77AE3D190F430FE6E4B1A9659BEBB3F022CF7631",
    "Response":{
    "log":"Msg 0: ",
    "tags":[
    {
    "key":"YWN0aW9u",
    "value":"ZGV4TGlzdA=="
    }
    ]
    }
    }

    After the transaction is executed, you could see the newly added trading pair from Explorer and maket API.

    - + diff --git a/docs/beaconchain/list_instruction.html b/docs/beaconchain/list_instruction.html index 719715f351..6ca9f0a2b4 100644 --- a/docs/beaconchain/list_instruction.html +++ b/docs/beaconchain/list_instruction.html @@ -8,13 +8,13 @@ - +

    List Instructions

    Listing a trading pair is a rather advanced feature in DEX. To list your token, you can follow the step-by-step instruction here.

    There are the steps to get your tokens listed:

    workflow

    1. Issue Tokens on BNB Beacon Chain

    Please refer to this token issue doc to learn about how to issue your own asset on BNB Beacon Chain .

    2. Submit Proposal

    On-Chain Proposal Request

    Please refer to this governance doc to learn about how to create a proposal about listing a new trading pair on BNB Beacon Chain .

    Please ensure that you test EVERYTHING on our testnet (multiple times at least) before you officially execute this on the mainnet.

    Community Thread Proposal (Recommended)

    It is recommended that Token Issuers first create a thread under the “Token Issuance & Listings” category in the BNB Beacon Chain Community Forum (https://community.binance.org/). The whole guideline is here

    3. Send List Transaction

    Please refer to this list doc to learn about how to send a list transaction and finish listing process on BNB Beacon Chain .

    Please ensure that a list transaction must be sent before expire-time.

    FAQ about Listing Tokens

    Which trading pair can be listed?

    Simply allowing trading between two assets seems easy enough, however it is expensive for not only the network but also its users in long term (and liquidity costs can be much larger). In order to efficiently use the network, BNB Beacon Chain only list assets against BNB and other widely accepted market quote assets.

    How is a trading pair created on Binance DEX?

    The design philosophy of Binance DEX adheres to the idea that the most efficient and low cost way to perform trading and price-discovery is still to use single order book. This single order book is managed and replicated across all full nodes with the same, deterministic matching logic.

    - + diff --git a/docs/beaconchain/match-examples.html b/docs/beaconchain/match-examples.html index c9562ff2e9..0ebe2d75a2 100644 --- a/docs/beaconchain/match-examples.html +++ b/docs/beaconchain/match-examples.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ sign indicates sell side pressure.

    - For scenarios that all the the equivalent surplus amounts are positive, if all the prices are
    below the reference price plus an upper limit percentage (e.g. 5%), then algorithm uses the highest
    of the potential equilibrium prices. If all the prices are above the reference price plus an upper
    limit, use the lowest price; for other cases, use the reference price plus the upper limit.
    - Conversely, if market pressure is on the sell side, if all prices are above the reference price
    minus a lower percentage limit, then the algorithm uses the lowest of the potential prices.
    If all the price are below the reference price minus the lower percentage limit, use the highest
    price, otherwise use the reference price minus the lower percentage limit.

    If both positive and negative surplus amounts exist, precede to Step 4.
  • Step 4: When both positive and negative surplus amounts exists at the lowest, if the reference price falls at / into these prices, the reference price should be chose, otherwise the price closest to the reference price would be chosen.

  • Examples

    The chosen price level row would have * on the deciding colume.

    1. Choose the largest execution (Step 1)
    -------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    300 100 150 150 150 -150
    300 99 150 150 -150
    300 250 98 150 300 300* 0
    50 50 97 300 50 250

    2. Choose the largest execution (Step 1)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    300 100 150 150 150 -150
    300 99 50 200 200 -100
    300 98 200 200 -100
    300 200 97 300 500 300* 200
    100 100 96 500 100 400


    3. the least abs surplus imbalance (Step 2)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    1500 102 300 300 300 -1200
    1500 101 300 300 -1200
    1500 100 100 400 400 -1100
    1500 99 200 600 600 -900
    1500 250 98 300 900 900 -600
    1250 250 97 900 900 -350
    1000 1000 96 900 900 -100*

    4. the least abs surplus imbalance (Step 2)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    110 102 30 30 30 -80
    110 101 10 40 40 -70
    110 100 40 40 -70
    110 99 50 90 90 -20
    110 10 98 90 90 -20
    100 50 97 90 90 -10*
    50 96 15 105 50 55
    50 50 95 105 50 55

    5.1 choose the lowest for all the same value of sell surplus imbalance, reference price is 80
    and 5% lower limit (Step 3)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    50 102 10 10 10 -40
    50 101 10 10 -40
    50 100 10 10 -40
    50 99 10 10 -40
    50 98 10 10 -40
    50 97 10 20 20 -30
    50 96 20 20 -30
    50 50 95 20 20 -30*

    5.2 choose the highest for all the same value of sell surplus imbalance, reference price is 100
    and 5% lower limit (Step 3)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    50 99 10 10 10 -40
    50 98 10 10 -40
    50 97 10 10 -40
    50 96 10 10 -40
    50 95 10 10 -40
    50 94 10 20 20 -30*
    50 93 20 20 -30
    50 50 92 20 20 -30

    5.3 choose the reference price for all the same value of buy surplus imbalance, reference price is 90
    and 5% upper limit (Step 3)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    50 99 100 100 50 50
    50 98 100 50 50
    50 97 100 50 50
    50 96 100 50 50
    50 95 100 50 50*
    50 94 100 50 50
    50 93 100 50 50
    50 50 92 100 50 50

    5.4 choose the reference price for all the same value of sell surplus imbalance, reference price is 100
    and 5% lower limit (Step 3)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    50 101 10 10 10 -40
    50 100 10 10 -40
    50 99 10 10 -40
    50 98 10 10 -40
    50 97 10 10 -40
    50 96 10 20 20 -30
    50 95 20 20 -30*
    50 50 94 20 20 -30

    6.1 choose the closest to the last trade price 99 (Step 4)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    50 100 25 25 25 -25
    50 99 25 25 -25*
    50 25 98 25 25 -25
    25 97 25 50 25 25
    25 96 50 25 25
    25 25 95 50 25 25

    6.2 choose the closest to the last trade price 97 (Step 4)
    --------------------------------------------------------------
    SUM SELL PRICE BUY SUM EXECUTION IMBALANCE
    50 100 25 25 25 -25
    50 99 25 25 -25
    50 25 98 25 25 -25
    25 97 25 50 25 25*
    25 96 50 25 25
    25 25 95 50 25 25

    - + diff --git a/docs/beaconchain/match.html b/docs/beaconchain/match.html index 393b8d8901..56bd229cb6 100644 --- a/docs/beaconchain/match.html +++ b/docs/beaconchain/match.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ would be allocated to each order in proportion to their quantity (floored if the number has a partial lot). If the allocation cannot be accurately divided, a deterministic algorithm would guarantee that no consistent bias to any orders.

    After the execution price P is concluded, buy orders with price equal to or larger than P, and sell orders with price equal to or less than P will match. For the orders that come into match in the new block, the trades will be allocated according to the below principles:

    • All new incoming buy orders into this current block (called "new orders" in this context) will get executed with the same price, so do all the sell orders; so that there is no chance for front-running on the same side.
    • All the executed price will honor the order limit price;
    • All the executed price for the new orders will be equal to or better than the concluded auction price P, so no front-running from the opposite side.

    For other orders that have arrived in the previous blocks, they will join match together with the new orders from the new block, and be considered as "Maker" role. The detailed explanation of Maker/Taker is as below:

    Definition of Maker and Taker

    Among all the orders to be allocated, between buy and sell sides, this specification defines four concepts.

    NameDefinition
    Maker Orderorder from the previous blocks
    Taker Ordernew incoming order in the current block
    Maker Sidebuy or sell side which has maker orders. May also have taker orders.
    Taker Sidebuy or sell side which only has taker orders.

    In each round of match, for all the orders that can be filled with the concluded price P, the algorithm ensures only one of the below two circumstances can happen,

    1. Both buy and sell side are Taker Side, when there is no leftover orders from all the previous blocks;

    2. One side is Maker Side that has orders from previous blocks (and may/may not have orders from this current block), and the other is Taker Side that only has orders from this current block.

    Execution Pricing

    Among all the orders to be allocated,

    1. For maker side:

      • all the maker orders are executed at their limit price
      • all the taker orders on the maker side are executed at the concluded price P
    2. For taker side, all the orders are executed at the average execution price from the above #1

    If no maker side in this match, all the orders are executed at price P.

    - + diff --git a/docs/beaconchain/memo-validation.html b/docs/beaconchain/memo-validation.html index 6c31d0811a..cdf493ee79 100644 --- a/docs/beaconchain/memo-validation.html +++ b/docs/beaconchain/memo-validation.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ First, this script will check the following conditions:

    The transaction type is sent. The target address is the receiving address. Then this script will ensure that the transaction memo is not empty and the memo only contains digital letters.

    This is the pseudocode:

    func memoValiation(addr, tx) error {
    if tx.Type != “send” {
    return nil
    }
    if ! isReceiver(tx, addr) {
    return nil
    }
    if tx.memo.length == 0 {
    return err(“tx memo is empty”)
    }
    if tx.memo.length > 100 {
    return err(“tx memo is too long”)
    }
    if !isAllDigital(tx.memo) {
    return err(“tx memo contains non digital character”)
    }
    return nil
    }

    Fee

    1 BNB will be charged on enabling memo validation of transactions.

    Command Line

    Global Parameters

    FieldTypeDescription
    fromstringName of your key.
    chain-idstringName of blockchain
    nodestringurl of the node

    Set-account-flags

    This transaction is aimed to set account flags to any hex value.

    Parameters

    FieldTypeDescription
    account-flagsstringaccount flags, must be hex encoding string with prefix 0x
    • Example on mainnet:
    ./bnbcli token account_flags set-account-flags --from <your-key-name> --account-flags 0x01  --chain-id Binance-Chain-Tigris --node  https://dataseed5.defibit.io:443 --trust-node
    • Example on testnet:
    ./tbnbcli token account_flags set-account-flags --from <your-key-name> --account-flags 0x01 --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Enable-memo-checker

    This transaction is aimed to aimed to enable transfer memo checker scripts.

    • Example on mainnet:
    ./bnbcli account_flags enable-memo-checker --chain-id Binance-Chain-Tigris --node  https://dataseed5.defibit.io:443 --trust-node
    • Example on testnet:
    ./tbnbcli account_flags enable-memo-checker --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    Disable-memo-checker

    This transaction is aimed to disable transfer memo checker.

    • Example on mainnet:
    ./bnbcli account_flag disable-memo-checker --chain-id Binance-Chain-Tigris --node  https://dataseed5.defibit.io:443 --trust-node
    • Example on testnet:
    ./tbnbcli account_flag disable-memo-checker --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80
    - + diff --git a/docs/beaconchain/offline.html b/docs/beaconchain/offline.html index 76d6cc2546..77ad30961d 100644 --- a/docs/beaconchain/offline.html +++ b/docs/beaconchain/offline.html @@ -8,13 +8,13 @@ - +
    -

    Offline

    bnbcli support generating and signing all types of transactions offline, then broadcast them. This feature will let users generate and sign their transactions at an offline machine, then use another machine to broadcast it to the network

    Generate your unsigned transaction

    First step is that you need to generate your unsigned transaction and save it in a file.

    Note: --account-number and --node is not mandatory in unsigned command

    You can generate an unsigned transfer transaction on testnet:

    ./tbnbcli send --from <your-key-name> --account-number <your-sccount-number> --to <destination-address> --amount 200000000:BNB --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --generate-only --offline >> unsigned.json

    You can generate an unsigned transfer transaction on mainnet:

    ./bnbcli send --from <your-key-name> --account-number <your-sccount-number> --to <destination-address> --amount 200000000:BNB --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --generate-only --offline >> unsigned.json

    Then, you can see that the signature of unsigned.json is empty.

    Sign your transaction

    You can view the unsigned.json to verify that all the info about this transaction is correct. You need to get the account-number and sequence about your address here: https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1accountaddress

    You can sign an unsigned transfer transaction on testnet:

    ./tbnbcli sign unsigned.json --account-number <address-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name <your-key-name> >> signed.json

    You can sign an unsigned transfer transaction on mainnet:

    ./bnbcli sign unsigned.json --account-number <address-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name <your-key-name> >> signed.json

    You need to type in your password in this step

    Then, you can see that the signature of signed.json is no longer empty.

    Broadcast Your Transaction

    Please then copy your signed.json to a different server and broadcast this transaction.

    You can broadcast your transaction on testnet:

    ./tbnbcli broadcast signed.json --node http://data-seed-pre-0-s3.bnbchain.org:80

    You can broadcast your transaction on mainnet:

    ./bnbcli broadcast signed.json --node https://dataseed5.defibit.io:443

    You can find the list of nodes here

    If the broadcast is successful, you will see the transaction hash in returned info. Please go and verify it in Explorer.

    - +

    Offline

    bnbcli support generating and signing all types of transactions offline, then broadcast them. This feature will let users generate and sign their transactions at an offline machine, then use another machine to broadcast it to the network

    Generate your unsigned transaction

    First step is that you need to generate your unsigned transaction and save it in a file.

    Note: --account-number and --node is not mandatory in unsigned command

    You can generate an unsigned transfer transaction on testnet:

    ./tbnbcli send --from <your-key-name> --account-number <your-sccount-number> --to <destination-address> --amount 200000000:BNB --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --generate-only --offline >> unsigned.json

    You can generate an unsigned transfer transaction on mainnet:

    ./bnbcli send --from <your-key-name> --account-number <your-sccount-number> --to <destination-address> --amount 200000000:BNB --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --generate-only --offline >> unsigned.json

    Then, you can see that the signature of unsigned.json is empty.

    Sign your transaction

    You can view the unsigned.json to verify that all the info about this transaction is correct. You need to get the account-number and sequence about your address here: https://docs.bnbchain.org/docs/beaconchain/develop/api-reference/dex-api/paths#apiv1accountaddress

    You can sign an unsigned transfer transaction on testnet:

    ./tbnbcli sign unsigned.json --account-number <address-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name <your-key-name> >> signed.json

    You can sign an unsigned transfer transaction on mainnet:

    ./bnbcli sign unsigned.json --account-number <address-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name <your-key-name> >> signed.json

    You need to type in your password in this step

    Then, you can see that the signature of signed.json is no longer empty.

    Broadcast Your Transaction

    Please then copy your signed.json to a different server and broadcast this transaction.

    You can broadcast your transaction on testnet:

    ./tbnbcli broadcast signed.json --node http://data-seed-pre-0-s3.bnbchain.org:80

    You can broadcast your transaction on mainnet:

    ./bnbcli broadcast signed.json --node https://dataseed5.defibit.io:443

    You can find the list of nodes here

    If the broadcast is successful, you will see the transaction hash in returned info. Please go and verify it in Explorer.

    + diff --git a/docs/beaconchain/resources.html b/docs/beaconchain/resources.html index 2a62eb60e7..98bf219b1e 100644 --- a/docs/beaconchain/resources.html +++ b/docs/beaconchain/resources.html @@ -8,13 +8,13 @@ - +

    More Help

    You can always post your question in Online Forum: this is the main portal to get community support.

    To keep track of the latest news in BNB Beacon Chain /DEX, you can read our weekly updates. It will be published on Online Forum too.

    Binance DEX does not have Customer Support Service on Telegram!

    - + diff --git a/docs/beaconchain/timelock.html b/docs/beaconchain/timelock.html index 60dcae1d94..93940bff7c 100644 --- a/docs/beaconchain/timelock.html +++ b/docs/beaconchain/timelock.html @@ -8,14 +8,14 @@ - +

    TimeLock

    As explained in BEP9, some business plans decide to lock certain amount tokens for pre-defined periods of time, and the only vest in the future according to the schedules. For example, some projects may lock some allocation of the issued tokens as a commitment by the founding team; some business scenarios also need to lock some tokens as collateral for value.

    TimeLock

    You can only lock tokens on your own account. TimeLock will transfer locked tokens to a purely-code-controlled escrow account and before the lock time expires. A purely-code-controlled escrow account is a kind of account which is derived from a hard-coded string in BNB Beacon Chain protocol. This kind of account doesn't have its own private key and it's only controlled by code of the protocol. The code for calculating escrow account is the same that is used in cosmos-sdk:

    TimeLockCoinsAccAddr = sdk.AccAddress(crypto.AddressHash([]byte("BinanceChainTimeLockCoins")))

    The account for mainnet is: bnb1hn8ym9xht925jkncjpf7lhjnax6z8nv24fv2yq and the account for testnet is: tbnb1hn8ym9xht925jkncjpf7lhjnax6z8nv2mu9wy3 The specific user will not be able to claim them back, including restrictions where they cannot use, transfer or spend these tokens.

    Command line

    You must use --broadcast to submit your transaction to the blockchain, otherwise it will return an unsigned transaction.

    Parameters

    FieldTypeDescription
    DescriptionstringDescription of the lock operation. Max length of description is 128 bytes.
    Amount[]CoinA set of tokens to be locked
    LockTimeint64The time when these tokens can be unlocked. LockTime is a future timestamp (seconds elapsed from January 1st, 1970 at UTC) and max LockTime should be before 10 years from now.
    broadcastboolif you want to submit your transaction to the blockchain

    Fee

    0.01 BNB will be charged on TimeLock transactions.

    Example

    On testnet, you can lock 1BNB for 1 day.

    ./tbnbcli token time-lock --amount "100000000:BNB" --from <key-name> --description " test timelock" --lock-time <lock-timestamp> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80 --broadcast

    On mainnet, you can lock 1BNB for 1 day.

    ./bnbcli token time-lock --amount "100000000:BNB" --from <key-name> --description " test timelock" --lock-time <lock-timestamp> --chain-id Binance-Chain-Tigris --node http://dataseed1.bnbchain.org:80 --broadcast

    TimeUnlock

    TimeUnlock will claim the locked tokens back when the specified lock time has passed.

    Parameters

    FieldTypeDescription
    addressstringthe address you want to query
    time-lock-idint64the id of your locking, it's incremental

    Fee

    0.01 BNB will be charged on ReLock transactions.

    Example

    On testnet, you can unlock tokens

    ./tbnbcli token time-unlock --from <your-address> --time-lock-id <lock-id> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    On mainnet, you can unlock tokens.

    ./bnbcli token time-unlock --from <key-name> --time-lock-id <lock-id> --chain-id Binance-Chain-Tigris --node http://dataseed1.bnbchain.org:80

    Example output for trying to unlock tokens whose locking period is not expired:

    ERROR: {"codespace":7,"code":7,"abci_code":458759,"message":"Can not unlock: lock time(2019-06-28 09:26:54 +0000 UTC) is after now(2019-06-27 08:31:54.680643156 +0000 UTC)"}

    TimeRelock

    TimeRelock can extend lock times, increase the amount of locked tokens or modify the description of an existing lock record.

    PLease note that you either increase the expire time or amount of your lock of tokens which are not unlocked.

    Parameters

    FieldTypeDescription
    time-lock-idint64the id of your locking, it's incremental
    Amount[]CoinA set of tokens to be locked
    LockTimeint64The time when these tokens can be unlocked. LockTime is a future timestamp(seconds elapsed from January 1st, 1970 at UTC) and max LockTime should be before 10 years from now.
    broadcastboolif you want to submit your transaction to the blockchain

    Fee

    0.01 BNB will be charged on UnLock transactions.

    Example

    On testnet, you can relock tokens

    ./tbnbcli token time-relock --time-lock-id <lock-id> --increase-amount-to <amount of tokens> --from <key-name> --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --broadcast

    On mainnet, you can relock tokens

    ./bnbcli token time-relock --time-lock-id <lock-id> --increase-amount-to <amount of tokens> --from <key-name> --chain-id Binance-Chain-Tigris --node http://dataseed1.bnbchain.org:80 --broadcast

    Output if you don't add more tokens or don't extend your locking period, you will get the following error:

    ERROR: {"codespace":7,"code":6,"abci_code":458758,"message":"Invalid lock amount: new locked coins(100000000BNB) should be more than original locked coins(100000000BNB)"}

    QueryTimeLock

    QueryTimeLock will query a lock record of a given address by the id. If this locking is ended, then no info will be returned.

    Parameters

    FieldTypeDescription
    time-lock-idint64the id of your locking, it's incremental

    Example

    On testnet, you can query lock history by ID:

    ./tbnbcli token query-time-lock --from <your-key-name> --time-lock-id <lock-id> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    On mainnet, you can query lock history:

    ./bnbcli token query-time-lock --from <your-key-name> --time-lock-id <lock-id> --chain-id Binance-Chain-Tigris --trust-node --node http://dataseed1.bnbchain.org:80

    Example output:

    [
    {
    "id": "1",
    "description": " test timelock",
    "amount": [
    {
    "denom": "BNB",
    "amount": "100000000"
    }
    ],
    "lock_time": "2019-06-27T01:59:52Z"
    }
    ]

    QueryTimeLocks

    QueryTimeLocks will query all lock records of a given address.

    QueryTimeLock Parameters

    FieldTypeDescription
    addressstringthe address you want to query

    Example

    On testnet, you can query lock history by address:

    ./tbnbcli token query-time-locks --address <your-address> --chain-id Binance-Chain-Ganges --trust-node --node http://data-seed-pre-0-s3.bnbchain.org:80

    On mainnet, you can query lock history by address:

    ./bnbcli token query-time-locks --address <your-address> --chain-id Binance-Chain-Tigris --trust-node --node http://dataseed1.bnbchain.org:80

    Example output:

    [
    {
    "id": "1",
    "description": " test timelock",
    "amount": [
    {
    "denom": "BNB",
    "amount": "100000000"
    }
    ],
    "lock_time": "2019-06-27T01:59:52Z"
    },
    {
    "id": "2",
    "description": " test timelock",
    "amount": [
    {
    "denom": "BNB",
    "amount": "100000000"
    }
    ],
    "lock_time": "2019-06-28T09:26:54Z"
    }
    ]
    - + diff --git a/docs/beaconchain/tokens.html b/docs/beaconchain/tokens.html index 30134e379f..b7ba7e583a 100644 --- a/docs/beaconchain/tokens.html +++ b/docs/beaconchain/tokens.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ The symbol doesn't have to be unique, "-" followed by random 3 letters will be appended to the provided symbol to avoid uniqueness constraint.
    Those 3 letters are the first three letters of tx hash of the issue transaction.
    For example, "NNB-B90". Only BNB does not have this suffix.
  • Total Supply: an int64 boosted by 1e8 for decimal part. The max total supply is 90 billion.
  • Mintable: that means whether this token can be minted in the future. To set the tokes to be mintable, you need to add --mintable, otherwise just omit this field to set this token to be non-mintable.
  • Example on mainnet:

    # To issue a NNB mintable token with total-supply 1 billion on mainnet
    > ./bnbcli token issue --token-name "new token" --total-supply 100000000000000000 --symbol NNB --mintable --from alice --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --trust-node
    # To issue a NNB non-mintable token with total-supply 1 billion on mainnet
    > ./bnbcli token issue --token-name "new token" --total-supply 100000000000000000 --symbol NNB --from alice --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --trust-node

    Example on testnet:

    # To issue a NNB mintable token with total-supply 1 billion on testnet
    > ./tbnbcli token issue --token-name "new bnb" --total-supply 100000000000000000 --symbol NNB --mintable --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Committed at block 1887 (tx hash: B90A055DDD570AE42A7050182993A0B4DBC81A0D, ... Issued NNB-B90...)
    # To issue a NNB non-mintable token with total-supply 1 billion on testnet
    > ./tbnbcli token issue --token-name "new bnb" --total-supply 100000000000000000 --symbol NNB --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Committed at block 1887 (tx hash: B90A055DDD570AE42A7050182993A0B4DBC81A0D, ... Issued NNB-B90...)

    Mint

    Tokens that is "mintable"(specified when issue) can use this function. The amount is boosted by 1e8 for decimal part. The total supply after mint is still restricted by 90 billion. Note only the owner of the token can use this transaction.

    Example on mainnet:

     > ./bnbcli token mint --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Example on testnet:

     > ./tbnbcli token mint --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Burn

    Burn is to destroy certain amount of token, after which that amount of tokens will be subtracted from the operator's balance. The total supply will be updated at the same time. Notice that only the owner of the token has the permission to burn token. The amount is boosted by 1e8 for decimal part.

    Example on mainnet:

     > ./bnbcli token burn --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Example on testnet:

     > ./tbnbcli token burn --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Freeze & Unfreeze

    Freeze would move the specified amount of token into "frozen" status, so that these tokens can not transferred, spent in orders or any other transaction until they are unfreezed.

    Anyone can (only) freeze or unfreeze tokens on their account with status in "free". The amount is boosted by 1e8 for decimal part.

    Example on mainnet:

    > ./bnbcli token freeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node
    > ./bnbcli token unfreeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Example on testnet:

    > ./tbnbcli token freeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node
    > ./tbnbcli token unfreeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    TransferOwnership

    Note: BEP82 is implemented after Lagrange Upgrade to add this new transactionn type.

    0.01 BNB will be charged on TransferOwnership transactions.

    Example on mainnet:

    ./bnbcli token transfer-ownership --from  $current-owner --symbol $symbol --new-owner $new-owner  --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node

    Example on testnet:

    ./tbnbcli token transfer-ownership --from  $current-owner --symbol $symbol --new-owner $new-owner --chain-id Binance-Chain-Nile  --node=data-seed-pre-2-s1.bnbchain.org:80--trust-node
    - + diff --git a/docs/beaconchain/trade.html b/docs/beaconchain/trade.html index 02bc8ca94b..3cf0644fe5 100644 --- a/docs/beaconchain/trade.html +++ b/docs/beaconchain/trade.html @@ -8,14 +8,14 @@ - +

    Trade

    Binance DEX is the native marketplace which allows you to exchange digital assets issued and listed on it. The matching happens within the blockchain nodes and all of the transactions are recorded on-chain, therefore forming a complete, auditable ledger of activity. The following commands are available for trading:

    Place Order

    You could place a new order with the following command on testnet:

    $ tbnbcli dex order  --symbol ZEBRA-16D_BNB  --side 1 --price 1000000 --qty 1000 --from guest --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 -t gte

    You will be able to place order on mainnet by replaceing chain-id and node.

    Example on mainnet:

    $ bnbcli dex order  --symbol ZEBRA-16D_BNB  --side 1 --price 1000000 --qty 1000 --from guest  --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  -t gte

    For side, you need to put 1 as buy or 2 as sell.

    Please note that the quantity should be rounded to lotSize. Otherwise your order could be invalid. The returned output is the following:

    Committed at block 1616083 (tx hash: C550F348B3A62880062F9DCF67794F08889234D0360B26CF31E68F8D3105C58F, response: {Code:0 Data:[123 34 111 114 100 101 114 95 105 100 34 58 34 56 49 51 69 52 57 51 57 70 49 53 54 55 66 50 49 57 55 48 52 70 70 67 50 65 68 52 68 70 53 56 66 68 69 48 49 48 56 55 57 45 51 48 34 125] Log:Msg 0:  Info: GasWanted:0 GasUsed:0 Tags:[{Key:[97 99 116 105 111 110] Value:[111 114 100 101 114 78 101 119] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}] Codespace: XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0})
    Msg [NewOrderMsg{Sender: 813E4939F1567B219704FFC2AD4DF58BDE010879, Id: 813E4939F1567B219704FFC2AD4DF58BDE010879-30, Symbol: ZEBRA-16D_BNB}] was sent.

    The order id is needed if you want to cancel this order later.

    Cancel Order

    To cancel an order, you could use the following command to cencel order on testnet:

    tbnbcli dex cancel --symbol ZEBRA-16D_BNB   --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --refid  813E4939F1567B219704FFC2AD4DF58BDE010879-30 --from guest

    Please note that refid is what you got from order command.

    Example on mainnet:

    bnbcli dex cancel --symbol ZEBRA-16D_BNB   --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --refid  813E4939F1567B219704FFC2AD4DF58BDE010879-30 --from guest

    View Orders

    To verify that your commands are executed as expected, you could query the orderbook of testnet.

    tbnbcli dex show -l ZEBRA-16D_BNB   --chain-id Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80

    Example output is the following:

             SellQty|       SellPrice|        BuyPrice|          BuyQty
    58.14066000| 0.01400000| 0.00100000| 522278.22159000
    674664.35943000| 0.01500000| 0.00000000| 0.00000000
    291157.71192000| 0.01800000| 0.00000000| 0.00000000
    229.20432000| 0.01900000| 0.00000000| 0.00000000
    292616.45027000| 0.02000000| 0.00000000| 0.00000000
    694954.49683000| 0.03000000| 0.00000000| 0.00000000
    279267.00000000| 0.04000000| 0.00000000| 0.00000000
    271236.08958000| 0.04500000| 0.00000000| 0.00000000
    108472.66524300| 0.05000000| 0.00000000| 0.00000000
    155000.00000000| 0.06000000| 0.00000000| 0.00000000
    105028.64699000| 0.07000000| 0.00000000| 0.00000000
    100000.00000000| 0.08000000| 0.00000000| 0.00000000
    263025.58796000| 0.08500000| 0.00000000| 0.00000000
    1500427.52685800| 0.09000000| 0.00000000| 0.00000000
    2027178.06520900| 0.10000000| 0.00000000| 0.00000000
    114.58796000| 0.17500000| 0.00000000| 0.00000000
    15305.95524500| 0.20000000| 0.00000000| 0.00000000
    10283.97968700| 0.30000000| 0.00000000| 0.00000000

    Example on mainnet:

    bnbcli dex show -l ZEBRA-16D_BNB    --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443
    - + diff --git a/docs/beaconchain/trading-spec.html b/docs/beaconchain/trading-spec.html index 3691f2ddb9..13bd5ce30b 100644 --- a/docs/beaconchain/trading-spec.html +++ b/docs/beaconchain/trading-spec.html @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ existing orders on the order book can still be traded.

    Fees

    We have five kinds of order operations, each kind has its specific fee calculation logic and collection timing as the table described below.

    OperationCalculationCollection Timing
    Place orderfree-
    Cancel orderfixed feeswhen the Cancel transaction executes
    Order expirefixed fees if fully expired, otherwise freewhen the scheduled order expiration happenes
    IOC order cancelfixed fees if fully canceled, otherwise freewhen the IOC order is not fully filled
    Order executionrate based feeswhen the order matched

    BNB is the priority in the fee collection and has some discounts.

    DEX would always calculate and collect the fees based on the latest balance and in the best interest of users.

    Current Fees Table on Mainnet

    Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Mainnet as of 2021-03-21 is as follows:

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    New Order00Y
    Cancel (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    Order Expire (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    IOC (No Fill)Equivalent 0.00025 BNB0.000005 BNBY
    TransferN/A0.000075 BNBN
    crossTransferOutN/A0.000075 BNBN
    Multi-sendN/A0.00006 BNBN
    Issue AssetN/A10 BNB
    Mint AssetN/A0.002 BNBN
    Transfer ownershipN/A0.002 BNBN
    Burn AssetN/A0.002 BNBN
    Freeze/Unfreeze AssetN/A0.001 BNBN
    Lock/unlock/relock AssetN/A0.002 BNBN
    List AssetN/A200 BNBN
    Submit ProposalN/A1 BNBN
    DepositN/A0.000125 BNBN
    Enable Memo CheckN/A0.2 BNBN
    Disable Memo CheckN/A0.2 BNBN
    HTLTN/A0.000075 BNBN
    depositHTLTN/A0.000075 BNBN
    claimHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    TinyIssueFeeN/A0.4 BNBN
    MiniIssueFeeN/A0.6 BNBN
    SetTokenUriN/A0.000075 BNBN
    List BEP8 TokenN/A1 BNBN
    Create A New Smart Chain ValidatorN/A2 BNBN
    Edit Smart Chain Validator InformationN/A0.2 BNBN
    Delegate Smart Chain ValidatorN/A0.0002 BNBN
    Redelegate Smart Chain ValidatorN/A0.0006 BNBN
    Undelegate Smart Chain ValidatorN/A0.0004 BNBN
    Unjail A Smart Chain ValidatorN/A0.5 BNBN
    Submit Byzaitine Behavior Evidence of A Smart Chain ValidatorN/A0.5 BNBN
    Submit Smart Chain ProposalN/A1 BNBN
    Smart Chain Proposal DepositN/A0.00025 BNBN
    Smart Chain Proposal VoteN/A0 BNBN
    Cross transfer out relayer rewardN/A0.0004 BNBN

    Mainnet Fees API

    View system fees updated in real time here.

    Multi-send Fees

    bnbcli offers you a multi-send command to transfer multiple tokens to multiple people. 20% discount is available for multi-send transactions. For now, multi-send transaction will send some tokens from one address to multiple output addresses. If the count of output address is bigger than the threshold, currently it's 2, then the total transaction fee is 0.0003 BNB per token per address. For example, if you send 3 ABC token,1 SAT token and 1 ABC to 3 different addresses.

    [
    {
    "to":"bnb1g5p04snezgpky203fq6da9qyjsy2k9kzr5yuhl",
    "amount":"100000000:BNB,100000000:ABC"
    },
    {
    "to":"bnb1l86xty0m55ryct9pnypz6chvtsmpyewmhrqwxw",
    "amount":"100000000:BNB"
    },
    {
    "to":"bnb1l86xty0maxdgst9pnypz6chvtsmpydkjflfioe",
    "amount":"100000000:BNB,100000000:SAT"
    }
    ]

    You will pay on mainnet/testnet

    0.0003 BNB * 5 = 0.0015 BNB

    Trading Fees

    Trading fees are subject to complex logic that may mean that individual trades are not charged exactly by the rates below, but between them instead; this is due to the block-based matching engine in use on the DEX.

    The current fee for trades, applied on the settled amounts, is as follows:

    Transaction TypePay in non-BNB AssetPay in BNB
    Trade0.1%0.05%

    Trading fee can be queried at here. It's under the "params/DexFeeParam/". "FeeRate" and "FeeRateNative" are both under unit of 10^-6.

    Current Fees Table on Testnet

    Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of 2021-03-17 is as follows:

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    New Order00Y
    Cancel (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    Order Expire (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    IOC (No Fill)Equivalent 0.00025 BNB0.000005 BNBY
    TransferN/A0.000075 BNBN
    crossTransferOutN/A0.000075 BNBN
    Multi-sendN/A0.00006 BNBN
    Issue AssetN/A10 BNB
    Mint AssetN/A0.002 BNBN
    Transfer ownershipN/A0.002 BNBN
    Burn AssetN/A0.002 BNBN
    Freeze/Unfreeze AssetN/A0.001 BNBN
    Lock/unlock/relock AssetN/A0.002 BNBN
    List AssetN/A200 BNBN
    Submit ProposalN/A1 BNBN
    DepositN/A0.000125 BNBN
    Enable Memo CheckN/A0.2 BNBN
    Disable Memo CheckN/A0.2 BNBN
    HTLTN/A0.000075 BNBN
    depositHTLTN/A0.000075 BNBN
    claimHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    TinyIssueFeeN/A0.4 BNBN
    MiniIssueFeeN/A0.6 BNBN
    SetTokenUriN/A0.000075 BNBN
    List BEP8 TokenN/A1 BNBN
    Create A New Smart Chain ValidatorN/A2 BNBN
    Edit Smart Chain Validator InformationN/A0.2 BNBN
    Delegate Smart Chain ValidatorN/A0.0002 BNBN
    Redelegate Smart Chain ValidatorN/A0.0006 BNBN
    Undelegate Smart Chain ValidatorN/A0.0004 BNBN
    Unjail A Smart Chain ValidatorN/A0.5 BNBN
    Submit Byzaitine Behavior Evidence of A Smart Chain ValidatorN/A0.5 BNBN
    Submit Smart Chain ProposalN/A1 BNBN
    Smart Chain Proposal DepositN/A0.00025 BNBN
    Smart Chain Proposal VoteN/A0 BNBN
    Cross transfer out relayer rewardN/A0.0004 BNBN

    Testnet Fees API

    View system fees updated in real time here.

    Notes

    • Trade fee is calculated based on trade notional value, while fees for other transactions are fixed. It is free to send new GTE order, cancel a partially filled order, and you will not be charged a fee when the system expires a partially filled order (GTE or IOC).

    • Non-Trade related transactions will be charged a fee when the transactions happen, and can only be paid in BNB. The transaction will be rejected if the address does not have enough BNB.

    • Trade related transaction would be charged with fee when an order is filled, or canceled/expired/IOC-expired with no fills. If there is enough BNB to pay, BNB fee structure would be used, otherwise, non-BNB fee structure would be used to charged.

    • If the whole order value and free balance for the receiving asset are not enough to pay the fee, all the receiving asset and its residual balance would be charged.

    - + diff --git a/docs/beaconchain/transfer.html b/docs/beaconchain/transfer.html index e30e9e2834..ae00589721 100644 --- a/docs/beaconchain/transfer.html +++ b/docs/beaconchain/transfer.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ format is showed above. In the same time, you can write the transaction detail in a file and specify --transfers-file flag and read from the file contains transaction.

    Example, you can specify --transfers and send it to mainnet:

     ./bnbcli token multi-send --home ./testnodecli --from test --chain-id Binance-Chain-Tigris --node  https://dataseed5.defibit.io:443  --transfers "[{\"to\":\"bnb1g5p04snezgpky203fq6da9qyjsy2k9kzr5yuhl\",\"amount\":\"100000000000000:BNB\"},{\"to\":\"bnb1l86xty0m55ryct9pnypz6chvtsmpyewmhrqwxw\",\"amount\":\"100000000000000:BNB\"}]" --json
    Password to sign with 'test':
    {
    "Height":"1412",
    "TxHash":"A238C3C33625B5398FE648BD3FE9822CB7A07A2DB7778376546916F81C634138",
    "Response":{
    "log":"Msg 0: ",
    "tags":[
    {
    "key":"c2VuZGVy",
    "value":"Ym5iMXFnOTRzMnYzM3NyNTVrNDAybnN2M3NmY3ozMmVtdGF3NmRjeTk2"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWc1cDA0c25lemdwa3kyMDNmcTZkYTlxeWpzeTJrOWt6cjV5dWhs"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWw4Nnh0eTBtNTVyeWN0OXBueXB6NmNodnRzbXB5ZXdtaHJxd3h3"
    },
    {
    "key":"YWN0aW9u",
    "value":"c2VuZA=="
    }
    ]
    }
    }

    Example on testnet:


    ./tbnbcli token multi-send --home ./testnodecli --from test --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --transfers "[{\"to\":\"tbnb1sylyjw032eajr9cyllp26n04300qzzre38qyv5\",\"amount\":\"100000000000000:BNB\"},{\"to\":\"tbnb1e244vmvym7g6cn9lk4hmhf9p2f9jaf0x9hxmwc\",\"amount\":\"100000000000000:BNB\"}]" --json

    Password to sign with 'test':
    {
    "Height":"1412",
    "TxHash":"A238C3C33625B5398FE648BD3FE9822CB7A07A2DB7778376546916F81C634138",
    "Response":{
    "log":"Msg 0: ",
    "tags":[
    {
    "key":"c2VuZGVy",
    "value":"Ym5iMXFnOTRzMnYzM3NyNTVrNDAybnN2M3NmY3ozMmVtdGF3NmRjeTk2"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWc1cDA0c25lemdwa3kyMDNmcTZkYTlxeWpzeTJrOWt6cjV5dWhs"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWw4Nnh0eTBtNTVyeWN0OXBueXB6NmNodnRzbXB5ZXdtaHJxd3h3"
    },
    {
    "key":"YWN0aW9u",
    "value":"c2VuZA=="
    }
    ]
    }
    }

    And you can also try --transfers-file.

    Assume that you have a file named transaction.json in your current path and content is :

    [
    {
    "to":"bnb1g5p04snezgpky203fq6da9qyjsy2k9kzr5yuhl",
    "amount":"100000000000000:BNB"
    },
    {
    "to":"bnb1l86xty0m55ryct9pnypz6chvtsmpyewmhrqwxw",
    "amount":"100000000000000:BNB"
    }
    ]

    Then you can specify --transfers-file and send it to mainnet:

     ./bnbcli token multi-send --home ./testnodecli --from test --chain-id Binance-Chain-Tigris --node  https://dataseed5.defibit.io:443  --transfers-file ./transaction.json --json
    Password to sign with 'test':
    {
    "Height":"1412",
    "TxHash":"A238C3C33625B5398FE648BD3FE9822CB7A07A2DB7778376546916F81C634138",
    "Response":{
    "log":"Msg 0: ",
    "tags":[
    {
    "key":"c2VuZGVy",
    "value":"Ym5iMXFnOTRzMnYzM3NyNTVrNDAybnN2M3NmY3ozMmVtdGF3NmRjeTk2"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWc1cDA0c25lemdwa3kyMDNmcTZkYTlxeWpzeTJrOWt6cjV5dWhs"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWw4Nnh0eTBtNTVyeWN0OXBueXB6NmNodnRzbXB5ZXdtaHJxd3h3"
    },
    {
    "key":"YWN0aW9u",
    "value":"c2VuZA=="
    }
    ]
    }
    }

    Example on testnet:

     ./tbnbcli token multi-send --home ./testnodecli --from test--chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80  --transfers-file ./transaction.json --json

    Password to sign with 'test':
    {
    "Height":"1412",
    "TxHash":"A238C3C33625B5398FE648BD3FE9822CB7A07A2DB7778376546916F81C634138",
    "Response":{
    "log":"Msg 0: ",
    "tags":[
    {
    "key":"c2VuZGVy",
    "value":"Ym5iMXFnOTRzMnYzM3NyNTVrNDAybnN2M3NmY3ozMmVtdGF3NmRjeTk2"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWc1cDA0c25lemdwa3kyMDNmcTZkYTlxeWpzeTJrOWt6cjV5dWhs"
    },
    {
    "key":"cmVjaXBpZW50",
    "value":"Ym5iMWw4Nnh0eTBtNTVyeWN0OXBueXB6NmNodnRzbXB5ZXdtaHJxd3h3"
    },
    {
    "key":"YWN0aW9u",
    "value":"c2VuZA=="
    }
    ]
    }
    }

    Verify Transfer Transaction

    To confirm that your transaction went through, you can use the following queries:

    {"hash":"E79DE52B7D8F6BA93787C5B0389AF26C0C29C03BC84DAE42317965797E38076E","height":"1412766","tx":{"type":"auth/StdTx","value":{"msg":[{"type":"cosmos-sdk/Send","value":{"inputs":[{"address":"tbnb1sylyjw032eajr9cyllp26n04300qzzre38qyv5","coins":[{"denom":"BNB","amount":"20"}]}],"outputs":[{"address":"tbnb1qq559fkes779t3q9p9aegnjplvtc53yg9vusah","coins":[{"denom":"BNB","amount":"20"}]}]}}],"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"AhOb3ZXecsIqwqKw+HhTscyi6K35xYpKaJx10yYwE0Qa"},"signature":"AlpHUBlC/V0cR7YNm5G46aAjmeRIxjkX9Vg8EtTKkfgPso+snT3/r2nRNjsphtjTonub3VYfE4lwOnjpY+Jwcg==","account_number":"406226","sequence":"27"}],"memo":"Test transfer","source":"0","data":null}},"result":{"log":"Msg 0: ","tags":[{"key":"c2VuZGVy","value":"dGJuYjFzeWx5ancwMzJlYWpyOWN5bGxwMjZuMDQzMDBxenpyZTM4cXl2NQ=="},{"key":"cmVjaXBpZW50","value":"dGJuYjFxcTU1OWZrZXM3Nzl0M3E5cDlhZWduanBsdnRjNTN5Zzl2dXNhaA=="},{"key":"YWN0aW9u","value":"c2VuZA=="}]}}

    As you can see from the example output, this transaction is executed at block height 1412766 and you could read about the details. Double check with blockchain explorer if you interact with the network through a full-node.

    - + diff --git a/docs/beaconchain/tss.html b/docs/beaconchain/tss.html index 47536cd187..e016f0ff92 100644 --- a/docs/beaconchain/tss.html +++ b/docs/beaconchain/tss.html @@ -8,13 +8,13 @@ - +

    User Guide of Threshold Signature Scheme (TSS) in BNB Beacon Chain

    Introduction

    Threshold Signature Scheme (TSS) is a cryptographic protocol for distributed key generation and signing. TSS allows constructing a signature that is distributed among different parties (for example three users), and each user receives a share of the private signing key. To sign a transaction, at least two of these three users need to join. For individuals, threshold signatures allow for two-factor security or splitting the ability to sign between two devices so that a single compromised device won’t put the money at risk. For businesses, threshold signatures allow for the realization of access control policies that prevent both insiders and outsiders from stealing corporate funds. TSS technology allows us to replace all signing commands with distributed computations.The private key is no longer a single point of failure.

    Motivation

    A physical key must fit exactly into a keyhole to unlock a physical vault. But if this key is compromised or lost, the funds locked in the vault may no longer be safe. This simple approach of key management may make sense when a small sum is at stake. However, when the amount stored in the vault is large, it is wise to consider spreading the responsibility of key ownership between several trusted parties.

    Traditional MultiSig (multi-signature) is a more refined unlocking system that requires multiple independent keys to unlock the vault. MultiSig requires generating a larger private key and the vault has multiple locks - one for each key . More processing power is needed as participants have to sign additional signatures, which must then be checked individually by the network. This is not ideal, because a participant must leave traces showing exactly who signed and multiple parties must be online at the same time.

    With Threshold Signatures, all of the parties must forge the vault’s lock together, in a modular way, where each party owns a share of the key. A TSS vault is indistinguishable from a regular vault and is hence universal, and it has the same privacy and verification cost of a regular vault. Even if only a subset of the keys is available, the vault may still be unlocked (this is known as meeting a threshold of participation).

    Combining TSS feature with BNB Beacon Chain client will help users manage their funds in a much safer way. TSS will be offered in an independent binary, but it will have some impact on the existing functions of bnbcli/tbnbcli.

    Implementation

    Many development resources have been poured into implementing TSS, a cryptographic protocol for distributed key generation and signing. TSS is now compatible and reusable for ECDSA-based blockchains, including BNB Beacon Chain, Bitcoin, and Ethereum networks. We expect that members of the BNB Chain ecosystem and partner community can integrate this TSS library with their applications, such as wallets and custodians, and further develop this exciting new technology.

    With the support of the BNB Beacon Chain community, we are happy to share the open-source code at https://github.com/bnb-chain/tss-lib.

    Security Audit

    The implementation of a multi-party threshold ECDSA library is open source so it can be publicly audited by anyone. An independent third party auditors from Kudelski Security are hired to validate the security of the cryptography in TSS solution. The latest report in October by can be found here.

    Security checks are routinely and continuously planned for all parts of TSS lib implementations and future audits will be reported to BNB Beacon Chain community.

    Workflow

    Let’s take a look at the major steps in TSS:

    • Vault Initialization: the first step is for setting up tss parameters of each party. This will initialize the node's p2p listen address and setup a directory to save key. It's recommended that you should save your tss key in a different folder other than normal key info.

    • Key Generation: the second step is also the most complex. We need to define the quorum policy: count of total parties (n) that holds secret shares and threshold (t) which means at least t + 1 parties need to take part in the signing process. We need to generate a key which will be public and used to verify future signatures. However, we also have to generate an individual secret for each party, which is called a secret share. The functions guarantee the same public key to all parties and a different secret share for each. In this way, we achieve: (1) privacy: no secret shares data is leaked between any parties, and (2) correctness: the public key is intact with secret share. They need to agree on the channel which they want to use for sending messages between each other. The channel will have its corresponding password. Both ID and password needs to be shared offline.

    • Signing: this step involves a signature generation function. The input of each party will be its own secret share, created as output of the distributed key generation in the previous step. There is also public input known to all, which is the message to be signed. The output will be a digital signature, and the property of privacy ensures that no leakage of secret shares occurred during the computation.

    • Verification: the verification algorithm remains as it is in the classical setting. To be compatible with single key signatures, BNB Beacon Chain validator nodes can be able to verify the signature with the public key. The transaction will be no different from others.

    • Vault Regroup: Regroup will reset secret share and configs between all parties.It's recommend to switch the configuration periodically, say once a month. If some party lost his key, it's also necessory to reset the distribution once some party lost their key. Regroup will generate new_n secret share with new_t threshold. At least old_t + 1 should participant

    Where can I download the Binance TSS CLI?

    You can download TSS client and BNB Beacon Chain Command Line here:

    How to Use

    • Warning: Please test your TSS setup before use this on mainnet.

    Please backup your bnbcli home before use this tool:

    cp -r ~/.bnbcli ~/.bnbcli_backup_tss (replace ~/.bnbcli with their bnbcli home)

    Please refer to this Example to help you understand the whole process

    Init

    tss init will create home directory of a new tss setup, generate p2p key pair.

    • Here are the global transaction flags:
    NameTypeDescriptionNote
    vault_namestringname of the vault of this party
    passwordstringthe password of the vaultmust be 32 bytes or more, the default value is 48
    homestringPath to config/route_table/node_key/tss_key files, configs in config file can be overridden by command line argumentthe default value is "~/.tss"
    • Here are the flags for tss init:
    NameTypeDescriptionNote
    kdf.iterationsuint32The number of iterations (or passes) over the memory.the default value is 13
    kdf.key_lengthuint32Length of the generated key (or password hash) "must be 32 bytes or more,the default value is 48"
    kdf.memoryuint32The amount of memory used by the algorithm (in kibibytes)the default value is 65536
    kdf.parallelismuint8The number of threads (or lanes) used by the algorithm.the default value is 4
    kdf.salt_lengthuint32Length of the random salt. 16 bytes is recommended for password hashing.the default value is 16
    monikerstringmoniker of current party
    p2p.listenstringAdds a multiaddress to the listen list

    Describe

    tss describe will show config and address of a tss vault

    • Here are the flags for tss describe:
    NameTypeDescriptionNote
    address_prefixstringbech32 prefix of address (default "bnb")
    • Example
    ./tss describe

    > please set vault of this party:
    [input vault name]
    > Password to sign with this vault:
    [input password]
    address of this vault: bnb1
    config of this vault:
    {
    "p2p": {
    "listen": "/ip4/0.0.0.0/tcp/59968",
    "bootstraps": null,
    "relays": null,
    "peer_addrs": [
    "/ip4/127.0.0.1/tcp/59748",
    "/ip4/127.0.0.1/tcp/60022"
    ],
    "peers": [
    "test3",
    "test2"
    ],
    "DefaultBootstap": false
    },
    "Id": "",
    "Moniker": "tss1",
    "vault_name": "vault1",
    "Threshold": 1,
    "Parties": 3,
    "log_level": "info",
    "profile_addr": "",
    "Home": "~/.tss"
    }

    Channel

    tss channel will generate a channel ID for bootstrapping. One party can generate a channel, then share the generated channel ID with others offline.

    • Here are the flags for tss channel:
    NameTypeDescriptionNote
    channel_expireintexpire time in minutes of this channelDefault value is 30mins

    It's advised to refresh the channels regularly.

    Keygen

    This command will generate the private key and share the secret. Everyone needs to agree on the password of this private key. The password length must be larger than eight.

    Note: you need to make sure that all the parties are online.

    • Here are the flags for tss keygen:
    NameTypeDescriptionNote
    address_prefixstringprefix of bech32 addressthe default value is bnb
    channel_idstringchannel id for this session
    channel_passwordstringpassword to this channelThis password has to be set offline. And its length should be more than eight.
    p2p.peer_addrs[]stingpeer's multiplex addresses
    partiesinttotal parities of this scheme
    thresholdintthreshold of this scheme, at least threshold + 1 parties need participant signing

    if you want to add the generated key files in the bnbcli home, you can copy it to the home folder:

    bnbcli keys add --tss -t tss --tss-home ~/.test1 --tss-vault third test1_third

    Regroup

    This command will generate new_n secret from the same private key, and it will be shared with new_t threshold. At least old_t + 1 should participante in signing

    • Here are the flags for tss regroup:
    NameTypeDescriptionNote
    channel_passwordstringchannel password of this session
    channel_idstringchannel id of this session
    is_oldstringwhether this party is old committee. If it is set to true, it will participant signing in regroup. There should be only t+1 parties set this to true for one regroup
    is_new_memberstringwhether this party is new committee, for new party it will changed to true automatically. if an old party set this to true, its share will be replaced by one generated one
    new_partiesintnew total parties of regrouped scheme
    new_thresholdintnew threshold of regrouped scheme
    p2p.new_peer_addrs[]stingunknown peer's multiple addresses
    partiesinttotal parities of this scheme
    thresholdintthreshold of this scheme, at least threshold + 1 parties need participant signing

    Changes to bnbcli/tbnbcli

    We added a new key type “tss” (just like the existing types: “local”, “offline”, “ledger”) to bnbcli which stands for tss secret share.

    To add a tss key into bnbcli’s keystore:

    1. Tss keygen command will automatically add generated secret share into default keystore (~/.bnbcli) with name tss_<moniker>_<vault_name>
    2. User can manually specify tss’s home, vault_name and a customized bnbcli home like:
    bnbcli keys add --home ~/.customized_cli --tss -t tss --tss-home ~/.test1 --tss-vault “default” my_name

    All other commands (i.e. send token, place order, delete key etc.) of bnbcli should support tss type key.

    Example

    In this example, A, B and C are the parties who decided to share a private key together. They decided that any two of them can sign a transaction. To complete a TSS signing process, they need to follow the following steps:

    Step 1: Init TSS

    During this step, all parties from different machines have to initialite their P2P settings before generate the shared key.

    ABC
    command./tss init./tss init./tss init
    Interactive input> please set moniker of this party:
    tss1
    > please set vault of this party:
    vault1
    > please set password of thisvault:
    [input password]
    > please input again:
    [input password]
    > please set moniker of this party:
    tss2
    > please set vault of this party:
    vault1
    > please set password of this vault:
    [input password]
    >please input again:
    [input password]
    > please set moniker of this party:
    tss3
    > please set vault of this party:vault1
    > please set password of this vault:
    [input password]
    > please input again:
    [input password]
    outputLocal party has been initialized under:
    ~/.tss/vault1
    Local party has been initialized under:
    ~/.tss/vault1
    Local party has been initialized under:
    ~/.tss/vault1
    Files touched or generated~/.tss/vault1/config.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/node_key

    Step 2: Generate Channel ID for bootstraping

    In this step, the parties will create a secrect communication channel between them. One of then will generate the channel ID and share with others. In this example, A will generate the channel ID. B and C will not have to do anything. A can also specify the length for this channel session and the default time is 30 mins.

    ABC
    command./tss channelN/AN/A
    Interactive input> please set expire time in minutes, (default: 30):
    [input time]
    N/AN/A
    outputchannel id: 5185D3EF597N/AN/A

    Step 3: Generate and Share Secret

    In this step, the private key will be generated and shared between these three parties. All the parties have to be online at the sme time.

    ABC
    command./tss keygen --vault_name vault1./tss keygen --vault_name vault1./tss keygen --vault_name vault1
    Interactive input> Password to sign with this vault:
    [enter password]
    > please set total parties(n):
    3
    > please set threshold(t), at least t + 1 parties need participant signing:
    1
    > please set channel id of this session
    [enter ID]
    > please input password (AGREED offline with peers) of this session:
    [enter password]
    > please input password of this tss vault:
    [enter password]
    >please input> Password to sign with this vault:
    [enter password]
    > please set total parties(n):
    3
    > please set threshold(t), at least t + 1 parties need participant signing:
    1
    > please set channel id of this session
    [enter ID]
    >please input password (AGREED offline with peers) of this session:
    [enter password]
    >please input password of this tss vault:
    [enter password]
    > Password to sign with this vault:
    [enter password]
    > please set total parties(n):
    3
    > please set threshold(t), at least t + 1 parties need participant signing:
    1
    > please set channel id of this session
    3085D3EC76D
    > please input password (AGREED offline with peers) of this session: [enter password]
    Password of this tss vault:
    [enter password]
    output18:00:09.777 INFO tss-lib: party {0,tss1}: keygen finished! party.go:11318:00:09.777 INFO tss: [tss1] received save data client.go:30418:00:09.777 INFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp client.go:309Password of this tss vault:NAME: TYPE: ADDRESS: PUBKEY:tss_tss1_vault1 tss tbnb19277gzv934ayctxeg5k9zdwnx3j48u6tydjv9p bnbp1addwnpepqwazk6d3f6e3f5rjev6z0ufqxk8znq8z89ax2tgnwmzreaq8nu7sx2u4jcc18:00:09.777 INFO
    : party {1,tss2}: keygen finished! party.go:11318:00:09.777 INFO tss: [tss2] received save data client.go:30418:00:09.777 INFO tss: [tss2] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp client.go:309Password of this tss vault:NAME: TYPE: ADDRESS: PUBKEY:tss_tss2_vault1 tss tbnb19277gzv934ayctxeg5k9zdwnx3j48u6tydjv9p bnbp1addwnpepqwazk6d3f6e3f5rjev6z0ufqxk8znq8z89ax2tgnwmzreaq8nu7sx2u4jcc18:00:09.773 INFO tss-lib: party {2,tss3}: keygen finished! party.go:11318:00:09.773 INFO tss: [tss3] received save data client.go:30418:00:09.773 INFO tss: [tss3] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp client.go:309Password of this tss vault:NAME: TYPE: ADDRESS: PUBKEY:tss_tss3_vault1 tss tbnb19277gzv934ayctxeg5k9zdwnx3j48u6tydjv9p bnbp1addwnpepqwazk6d3f6e3f5rjev6z0ufqxk8znq8z89ax2tgnwmzreaq8nu7sx2u4jcc
    Files touched or generated~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json

    Step 4: Sign Transaction

    In this steo, A and B decided to sign a transaction together. Both A and B will try to broadcast the transaction and only one of them will succeed.

    ABC
    commandtbnbcli send --amount 1000000:BNB --to tbnb1mh3w2kxmdmnvctt7t5nu7hhz9jnp422edqdw2d --from tss_tss1_vault1 --chain-id Binance-Chain-Ganges --node https://data-seed-pre-0-s1.bnbchain.org:443 --trust-nodetbnbcli send --amount 1000000:BNB --to tbnb1mh3w2kxmdmnvctt7t5nu7hhz9jnp422edqdw2d --from tss_tss2_vault1 --chain-id Binance-Chain-Ganges --node https://data-seed-pre-0-s1.bnbchain.org:443 --trust-nodeNA
    Interactive inputPassword to sign with tss_tss1_vault1:
    [Enter password]
    > Channel id:
    5185D3EF597
    please input password (AGREED offline with peers) of this session:
    [Enter password]
    Password to sign with tss_tss2_vault1:
    [Enter password]
    > Channel id:
    5185D3EF597
    please input password (AGREED offline with peers) of this session:
    [Enter password]
    N/A
    outputCommitted at block 33600477 (tx hash: 4FB8096A93D545612A3B5DCE520622608C299C7742103A6BE34C444829BD83A5ERROR: broadcast_tx_commit: Response error: RPC error -32603 - Internal error: Error on broadcastTxCommit: Tx already exists in cacheN/A
    Files touched or generatedN/AN/AN/A

    Step 5: Regroup Vault

    First, please generate a new channel for messaging:

    ABC
    command./tss channelN/AN/A
    Interactive input> please set expire time in minutes, (default: 30):
    [input time]
    N/AN/A
    outputchannel id: 3415D3FBE00N/AN/A

    Then, we can switch to the new channel for sending messages to each others.

    ABC
    command./tss regroup./tss regroup./tss regroup
    Interactive input> please set vault of this party:
    vault1
    > Password to sign with this vault:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set new total parties(n):
    3
    > please set new threshold(t), at least t + 1 parties participant signing:
    1
    > Channel id:
    3415D3FBE00
    please input password (AGREED offline with peers) of this session:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > please set vault of this party:
    vault1
    > Password to sign with this vault:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set new total parties(n):
    3
    > please set new threshold(t), at least t + 1 parties participant signing:
    1
    > Channel id:
    3415D3FBE00
    please input password (AGREED offline with peers) of this session:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > please set vault of this party:
    vault1
    > Password to sign with this vault:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set new total parties(n):
    3
    > please set new threshold(t), at least t + 1 parties participant signing:
    1
    > Channel id:
    3415D3FBE00
    please input password (AGREED offline with peers) of this session:
    Password to sign with tss_tss1_vault1:
    [Enter password]
    outputINFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jpINFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jpINFO tss: [tss1] bech32 address is: tbnb1mcn0tl9rtf03ke7g2a6nedqtrd470e8l8035jp
    Files touched or generated~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/node_key
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/node_key
    • New committee having different t-n from old committee
    1. Change 1-3 into 2-4 scheme.
    2. old parties (A, B) join new committee
    3. new parties (D, E) are newly-joined
    DE
    command./tss init --vault_name vault1./tss init --vault_name vault1
    Interactive input> please set moniker of this party:
    tss4
    > please set password for key share:
    [Enter password]
    > please intput again:
    [Enter password]
    > please set moniker of this party:
    tss4
    > please set password for key share:
    [Enter password]
    > please intput again:
    [Enter password]
    outputLocal party has been initialized under: ~/.tss/vault1Local party has been initialized under: ~/.tss/vault1
    • Regroup from 1-3 to 2-4, with 2 old parties (A and B) and 2 new parties (D and E)
    A (old&new committee)B (old&new committee)D (new committee)E (new committee)
    command./tss regroup/ --vault_name vault1./tss regroup --vault_name vault1./tss regroup --vault_name vault1./tss regroup --vault_name vault1
    Interactive input> please input password:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties participant signing:
    2
    > Channel id:
    3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    > please input password:
    [Enter password]
    > Participant as an old committee? [Y/n]:
    Y
    > Participant as a new committee? [Y/n]:
    Y
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties need participant signing:
    2
    > Channel id: 3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    > please input password:
    [Enter password]
    > please set Old total parties(n):
    3
    > please set Old threshold(t), at least t + 1 parties need participant signing:
    1
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties need participant signing:
    2
    > Channel id:
    3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    > please input password:
    [Enter password]
    > please set Old total parties(n):
    3
    > please set Old threshold(t), at least t + 1 parties need participant signing:
    1
    > please set NEW total parties(n):
    4
    > please set NEW threshold(t), at least t + 1 parties need participant signing:
    2
    > Channel id:
    3415D3FBE00
    > please input password (AGREED offline with peers) of this session:
    [Enter password]
    output
    Files touched or generated~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/vault1/config.json
    ~/.tss/vault1/pk.json
    ~/.tss/vault1/sk.json
    ~/.tss/payment/config.json
    ~/.tss/payment/pk.json
    ~/.tss/vault1/sk.json
    - + diff --git a/docs/beaconchain/validator/create-val.html b/docs/beaconchain/validator/create-val.html index 05a9172734..dd03ee7eaf 100644 --- a/docs/beaconchain/validator/create-val.html +++ b/docs/beaconchain/validator/create-val.html @@ -8,14 +8,14 @@ - +

    Create Validator

    Requirements and Responsibility

    To become a validator, you'll need to

    1. Send a create-validator-open transaction to declare the candidacy. The minimal self-delegation asset amount is 10000 BNB.
    2. Make users delegate on your validator. All the validators will be ranked by their accumulated BNB stake amount. There is an on-chain parameter MaxValidators. Only the validator candidates whose rank meets the requirement can be elected.
    3. Run a full node to help produce blocks on BC.

    Become a Validator Candidate

    You will need BNB Beacon Chain CLI for the commands.

    Step1: Generate Consensus Key

    Use the command below to generate a consensus key. It will be used in the full node to sign the consensus message if the validator gets bonded.

    $ bnbcli utils gen-consensus-key
    The consensus key has been generated and saved to ./priv_validator_key.json successfully
    The consensus pubkey is bcap1zcjduepqg6glk780f4ynvjjk82drnycty7zjl0uz79a6h2depnhavshvg39sm0c5tl

    Step2: Send Create Validator Transaction

    Create or recover an account, make sure the account gets more than 10000 BNB.

    $ bnbcli keys add your_key_name

    $ bnbcli keys add your_key_name --recover

    Send create-validator-open transaction to declare the candidacy.

    # Command for create validator on mainnet  
    $ bnbcli staking create-validator-open \
    --address-delegator {wallet address on BC} \
    --amount 10000000000:BNB \
    --pubkey {the concensus pubkey created in step 1} \
    --commission-rate {10000000 represent 10%} \
    --commission-max-rate {20000000 represent 20%} \
    --commission-max-change-rate {500000000 represent 5%} \
    --moniker {validator name} \
    --details {validator detailed description} \
    --identity {keybase identity} \
    --website {website for validator} \
    --from {key name} \
    --chain-id Binance-Chain-Tigris \
    --node https://dataseed5.defibit.io:443

    # Query validators
    ./bnbcli staking validators --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443

    # Command for create validator on testnet
    $ tbnbcli staking create-validator-open \
    --address-delegator {wallet address on BC} \
    --amount 10000000000:BNB \
    --pubkey {the concensus pubkey created in step 1} \
    --commission-rate {10000000 represent 10%} \
    --commission-max-rate {20000000 represent 20%} \
    --commission-max-change-rate {10000000 represent 1%} \
    --moniker {validator name} \
    --details {validator detailed description} \
    --identity {keybase identity} \
    --website {website for validator} \
    --from {key name} \
    --chain-id Binance-Chain-Ganges \
    --node=http://data-seed-pre-2-s1.bnbchain.org:80

    ## Query validators on testnet
    ./tbnbcli staking validators --chain-id Binance-Chain-Ganges --node=http://data-seed-pre-2-s1.bnbchain.org:80
    - + diff --git a/docs/beaconchain/validator/overview.html b/docs/beaconchain/validator/overview.html index 7bcf12f721..2cb39d4b31 100644 --- a/docs/beaconchain/validator/overview.html +++ b/docs/beaconchain/validator/overview.html @@ -8,7 +8,7 @@ - + @@ -28,7 +28,7 @@ BSC security. It will happen in the block reward distribution period. The initial ratio will be decided through governance.
  • The block proposer and its delegators receive between 1% and 5% of block fee rewards. It includes 2 parts:
    • base: fees * baseProposerReward
    • bonus: fees * bonusProposerReward * P, where P = (total number of validators with included precommits / total bonded validator number). The more precommits the proposer includes, the larger P is. P can never be larger than 1.00 (since only bonded validators can supply valid precommits) and is always larger than 2/3.
  • Any remaining fees are distributed among all validators equally, including the proposer.
  • The fees will be distributed and accumulated in the system-controlled addresses in every block. The FeeForAll part will go to a fixed address and the FeeForProposer part will go to a custody address which is derived from the proposer’s validator address. Nobody can spend money on the FeeForAll address and validators’ custody addresses. They can only be distributed to validators and delegators during the reward distribution period.
  • To reduce the cost of frequent block reward distribution, the reward distribution to delegators will happen every day around UTC 00:00(in the breath block).
  • The BEP-128 introduced an optimized mechanism that distributes staking rewards in many consecutive blocks, to minimize the burden on the specific block. It's expected to use the same mechanism in BC reward distribution. The BC reward distribution will happen right after the BSC reward distribution.
  • - + diff --git a/docs/beaconchain/validator/run-val.html b/docs/beaconchain/validator/run-val.html index bf3c4afae6..a6655febf4 100644 --- a/docs/beaconchain/validator/run-val.html +++ b/docs/beaconchain/validator/run-val.html @@ -8,13 +8,13 @@ - +

    Run Validator

    Validator Hardware Requirements

    • VPS running recent versions of Mac OS X or Linux.
    • 2 TB of free disk space, accessible at a minimum read/write speed of 200 MB/s.
    • 8 cores of CPU and 16 gigabytes of memory (RAM).
    • Suggest m5.2xlarge instance type on AWS, or c2-standard-8 on Google cloud.
    • A broadband Internet connection with upload/download speeds of at least 10 megabyte per second.

    Setting up Validator Node

    1. Install Fullnode

    Follow the instructions here to set up a full node.

    2. Start Validator Node

    Put priv_validator_key.json, which contains your validator key, into config directory. The file looks like this:

    {
    "address": "A3258DCBF45DCA0DF052981870F2D1441A36D145",
    "pub_key": {
    "type": "tendermint/PubKeyEd25519",
    "value": "AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="
    },
    "priv_key": {
    "type": "tendermint/PrivKeyEd25519",
    "value": "EVkqJO/jIXp3rkASXfh9YnyToYXRXhBr6g9cQVxPFnQBP/5povV4HTjvsy530kybxKHwEi85iU8YL0qQhSYVoQ=="
    }
    }

    Then start your node.

    bnbchaind start &
    note

    Alternatively, if you choose a different $BNCHOME location and you are not using the suggested default ~/.bnbchaind, you may start the full node by using below script, where $BNCHOME is your selected directory.

    Example: If you set /usr/local/beacon-chain as your home directory. Run the Full Node with:

    bnbchaind start --home /usr/local/beacon-chain &

    Post Running

    1. Monitor Node Status

    You can check the overall status by accessing the following url.

    curl localhost:26657/status

    2. Change Keys

    Your can stop your node, and replace priv_validator_key.json with a new one.

    3. Stop Validating

    After unbonding, your node will stop validating new blocks.

    - + diff --git a/docs/beaconchain/wallet/tutorial/How-to-use-BSC-on-imToken.html b/docs/beaconchain/wallet/tutorial/How-to-use-BSC-on-imToken.html index fecf029814..e7849afe3b 100644 --- a/docs/beaconchain/wallet/tutorial/How-to-use-BSC-on-imToken.html +++ b/docs/beaconchain/wallet/tutorial/How-to-use-BSC-on-imToken.html @@ -8,14 +8,14 @@ - +

    How to use BNB Smart Chain (BSC) on imToken?

    An introduction on how to start with using BSC on the imToken wallet

    How to download the imToken wallet?

    1.To get started, download imToken wallet via our official website token.im, the Apple App Store or Google Play.

    2.Android phone users best download via Google Play or the official website.

    3.Make sure to download the official, genuine App, since there are scammers out there providing fake apps.

    4.Apple users can use the App Store. Here as well, please double check the app developer being IMTOKEN PTE.LTD. Be aware of scam apps. img

    How to create an imToken identity wallet?

    1. Open imToken, click "Create Identity" and click to agree to the terms of service.

    2. Fill in your identity name and wallet password. Next, click "Create", copy the backup mnemonic phrase with pen and paper and keep it in a safe place. Confirm the mnemonic words in order again and click "Next" to successfully create a wallet.

    What is BSC?

    BSC is the abbreviation of BNB Smart Chain . The chain adopts PoSA (Proof of Staked Authority), which means holders of BNB (BSC's native token) vote to select 50 validators that are responsible for on-chain transaction verification and block production.

    Since BSC is EMV-compatible, developers can easily deploy smart contracts and build DApps on the chain. Compared with Ethereum, BSC has lower gas fees and faster transaction settlement with lower security guarantees.

    With imToken wallet we do not only support BSC DApps and watching token balances but also the DeFi Portfolio feature, providing a holistic BSC experience.

    How to start using BSC in imToken?

    Switch to BSC

    Open imToken's ETH wallet and click "Ethereum Mainnet" under "Wallet" to enter the network switching page, and select "BNB Smart Chain ".

    After the switch is successful, you can transfer and collect funds on the BSC chain in imToken, and experience its ecosystem DApps.

    img

    Receiving a payment via BSC on imToken

    Click "Receipt", copy the address or payment code and send it to the other party.

    img

    Transferring via BSC on imToken

    Click "Transfer", enter the payment address and amount, and then click "Next" to make the payment.

    img

    Ecosystem applications

    Click on "Ecosystem Applications" on the asset homepage to view and experience recent popular DApps on the BSC chain.

    img

    How to send funds from Binance to your imToken Wallet

    To withdraw BSC assets from Binance to imToken, you can follow the steps below. We use the BNB token as an example.

    Click on the wallet address, enter the payment page, and click "Copy".

    img

    Open Binance, click "Funds"-"Withdraw", select "BNB" or other BSC-supported assets.

    img

    Select "BEP20 (BSC)" in "Network", paste the copied address, and enter the withdrawal password to proceed with withdrawal. Make sure it’s the correct address.

    img

    Withdraw coins from imToken wallet to Binance Exchange

    If you want to recharge assets on BSC from imToken to Binance Exchange, you can follow the steps below, here is BNB as an example.

    Enter Binance Exchange, click "Assets"-"Recharge", select "BNB" or other BSC-supported assets.

    img

    Select "BEP20 (BSC)" in "Network" and click to copy the BNB recharge address.

    img

    On the asset page, click BNB to enter the transfer page, click "Transfer", paste Binance's recharge address, enter the withdrawal amount, and click "Next" to complete the transfer after paying the miner's fee.

    img

    Learn more: https://token.im

    Risk Warning: The content of this article does not constitute any form of investment advice or recommendation. imToken does not make any guarantees and promises for the third-party services and products mentioned in this article, nor assume any responsibility. Digital asset investment has risks. You should carefully evaluate these investment risks and consult with relevant professionals to make your own decisions.

    - + diff --git a/docs/beaconchain/wallet/tutorial/bep8.html b/docs/beaconchain/wallet/tutorial/bep8.html index 09b115b5fd..fe14968b8b 100644 --- a/docs/beaconchain/wallet/tutorial/bep8.html +++ b/docs/beaconchain/wallet/tutorial/bep8.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ img
  • Burn Tokens Click on Burn button and input amount img
  • - + diff --git a/docs/beaconchain/wallet/tutorial/how-to-create-a-wallet-on-trustwallet.html b/docs/beaconchain/wallet/tutorial/how-to-create-a-wallet-on-trustwallet.html index 6d00e695bf..d6a46120e6 100644 --- a/docs/beaconchain/wallet/tutorial/how-to-create-a-wallet-on-trustwallet.html +++ b/docs/beaconchain/wallet/tutorial/how-to-create-a-wallet-on-trustwallet.html @@ -8,7 +8,7 @@ - + @@ -24,7 +24,7 @@ 30+ Blockchains, including Bitcoin, Ethereum, BNB, XRP and many more.
    Exchange these cryptocurrencies with our upcoming coin swap function and buy Bitcoin, Ethereum and more with your credit card.

    img

    - + diff --git a/docs/beaconchain/wallet/tutorial/how-to-trade-on-binance-dex.html b/docs/beaconchain/wallet/tutorial/how-to-trade-on-binance-dex.html index 1793f5f0e4..62c38dc0cf 100644 --- a/docs/beaconchain/wallet/tutorial/how-to-trade-on-binance-dex.html +++ b/docs/beaconchain/wallet/tutorial/how-to-trade-on-binance-dex.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    How to Trade on Binance DEX

    1) Go to www.binance.org

    Click on "Start Trading"

    img

    2) Click "Unlock wallet" on the top right navigation bar

    img

    The recommended way for unlocking is by WalletConnect or Ledger.

    img

    If you use Ledger, please select the address you want to use for this session.

    img

    After unlocking your wallet, make sure that your balance is correct by clicking the "Balance" button on the navigation bar. Then, you will go to: https://www.binance.org/en/balances

    img

    img

    3) Go to trading page

    You can see that there are multiple trading pairs.
    In this example, we use $ONE https://www.binance.org/en/trade/ONE-5F9_BNB

    img

    4) Place your order (Found on the bottom right of the page)

    img

    At the moment, Binance DEX only supports Limit Orders.

    img

    You can use the "Best Ask" to input the minimum price that you can currently buy for.
    You use the "Best Bid" to input the highest price that you can currently sell for.

    img

    • "Price" - The number of tokens per token that you are willing to buy / sell for. "Price" can only be changed with "Tick Size". For $ONE, the tick size is 0.00000001
    • "Amount" the number of tokens you wish to buy / sell. "Amount" can only be changed with "Lot Size". For $ONE, the lot size is 10.
    • "25% / 50% / 75% / 100%" This will allocate the selected percentage of your funds to either be sold or used to buy.

    For example on the buy side if you want to buy 100$ONE and your limit price is 0.0006625. Then, the total notional for this order is 0.06625.

    img

    Click "Buy ONE" Confirm the submission of your order.

    Common Error

    • "Not enough balance" A common error that will occur if the number of tokens required to execute the order is more than the total number of tokens displayed in your "Total" balance.

    img

    • Price warning - if the price you inputted an order at is above 2% higher than the latest market price then you will be notified. Proceed with caution.

    img

    Confirming a trade on a Ledger Wallet

    img

    You can view the transaction info and confirm it on Ledger:

    img

    "Limit Buy / Sell order created"

    A note will pop up on the right corner of your screen after you confirmed your order.

    img

    5) Verifying your order was created and placed

    Once you made an order, you can see that in your order history on the first tab at the bottom left of the page.

    img

    Once filled you can view your completed trades under "Order History" on the second tab at the bottom left of the page.

    img

    To check wallet balance click the "Balance" button

    img

    6) Cancelling open orders

    To cancel an order that has either not been filled or has only been partially filled you can click on the "X" at the right side of the "Open Orders" tab on the bottom right of the screen.

    img

    - + diff --git a/docs/beaconchain/wallet/tutorial/ledger-nano-s-usage-guide.html b/docs/beaconchain/wallet/tutorial/ledger-nano-s-usage-guide.html index f646541632..32f363fd05 100644 --- a/docs/beaconchain/wallet/tutorial/ledger-nano-s-usage-guide.html +++ b/docs/beaconchain/wallet/tutorial/ledger-nano-s-usage-guide.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ If it is, the installation has been successful.

    img

    Setup/Login Instructions

    6) Go to www.binance.org

    Go to "Unlock wallet" page.

    Choose "Ledger Device" and verify your address.

    img

    Choose one address to use for this session and click on "Confirm".
    You will then be redirected to the Trading Interface.

    img

    For your security, please read the information displayed in the following popup and confirm that the address shown on your Ledger device matches the one shown on-screen.
    Press the right button on your device to confirm that the address matches (You must do this to continue).

    How to send BNB Beacon Chain Crypto Assets

    Confirming a trade on a Ledger Wallet:

    img

    You can view the transaction info and confirm it on Ledger:

    img

    Once the transaction has successfully been signed and broadcasted, your Ledger device will display this screen.

    img

    - + diff --git a/docs/beaconchain/wallet/tutorial/trezor-model-t-user-guide.html b/docs/beaconchain/wallet/tutorial/trezor-model-t-user-guide.html index 5fa4e03285..f50004679b 100644 --- a/docs/beaconchain/wallet/tutorial/trezor-model-t-user-guide.html +++ b/docs/beaconchain/wallet/tutorial/trezor-model-t-user-guide.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Trezor User Guide

    This guide will show you how to use your Trezor Model T hardware wallet with BNB Beacon Chain and Binance DEX. Please follow best security practices when using any hardware wallet to store cryptocurrency.

    Please note that the Trezor Model One is not supported yet.

    Requirements

    In order to use a Trezor with BNB Beacon Chain and Binance DEX, you will need:

    • A supported web browser: Chrome or Firefox
    • Access to the BNB Beacon Chain web wallet (https://binance.org/unlock) using your web browser
    • An initialized Trezor Model T device with the most recent firmware updates installed
    • The Trezor Bridge application installed on your computer

    App Installation Instructions

    1. Install Trezor Bridge

    Please make sure that you have bridge installed on your computer.

    img

    1. Install the firmware

    Please make sure your Trezor has the latest firmware installed.

    img

    1. Generate and backup your address

    Please make sure that you have seed phrase backed up.

    imgimg

    Setup/Login Instructions

    1. Open (BNB Chain Web wallet)[www.binance.org], then go to unlock page. You should see that Trezor is already an option for you.

    img

    1. Allow access to your device:

    img

    1. Export Binance address for account #1

    img

    1. Get your address for this device

    img

    1. Confirm your address on Trezor

    img

    Please note that Trezor only supports the BNB Beacon Chain mainnet

    1) Click on the “Balances” navigation button in the Trading Interface to view your account balances.

    img

    2) Your account balances are displayed.

    img

    How to send BNB Beacon Chain crypto assets

    1) Click on the “Balances” navigation button in the Trading Interface to view your account balances.

    img

    2) Then click on the “Send” button for the asset that you would like to send.

    img

    3) Confirm to give permission img

    4) Check details about this transaction

    img

    5) You’ll see this pop-up to ask to hold the screen to sign the transaction on your Trezor.

    img

    How to trade BNB Beacon Chain crypto assets

    1) You can place your order on trading page

    img

    2) Confirm to give permission

    img

    3) Check details about this transaction

    img

    4) You’ll see this pop-up to ask to hold the screen to sign the transaction on your Trezor.

    img

    Reference: https://wiki.trezor.io/User_manual

    - + diff --git a/docs/beaconchain/wallet/tutorial/videos.html b/docs/beaconchain/wallet/tutorial/videos.html index 2701ef4986..e4a1b3d558 100644 --- a/docs/beaconchain/wallet/tutorial/videos.html +++ b/docs/beaconchain/wallet/tutorial/videos.html @@ -8,13 +8,13 @@ - +
    - + diff --git a/docs/beaconchain/walletconnect-support.html b/docs/beaconchain/walletconnect-support.html index 47a7d4f9ef..edada9dc38 100644 --- a/docs/beaconchain/walletconnect-support.html +++ b/docs/beaconchain/walletconnect-support.html @@ -8,13 +8,13 @@ - +
    - + diff --git a/docs/beaconchain/walletconnect.html b/docs/beaconchain/walletconnect.html index 9aa9b21798..c921d760b8 100644 --- a/docs/beaconchain/walletconnect.html +++ b/docs/beaconchain/walletconnect.html @@ -8,13 +8,13 @@ - +

    Wallet Connect

    The BNB Beacon Chain Web Wallet supports connecting with external wallet providers via the WalletConnect protocol.

    WalletConnect allows the user to scan a QR code from the wallet app to unlock and use their wallet seamlessly in the web UI.

    In order for this to work, some modifications to the standard WalletConnect protocol are used in the BNB Beacon Chain wallet's implementation.

    See the list of wallets which support WalletConnect on BNB Beacon Chain here

    Connecting via WalletConnect

    Wallet providers should make use of the WalletConnect Client SDK for their target programming language and OS. There are implementations on GitHub for iOS, Android, React Native, etc.

    Protocol Differences

    Since we do not use Ethereum transactions, there are some differences:

    • Typically sendTransaction is used with Ethereum transaction parameters in WalletConnect dApp integrations. But in BNB Beacon Chain 's case, instead of invoking sendTransaction in the WalletConnect flow, the new sendCustomRequest call is used instead with a method called bnb_sign (see below).

    • The external wallet provider is responsible for sending back the signature and public key of the transaction but should not broadcast the transaction itself. We have instead defined a custom result format in the form of stringified JSON containing the signature and public key. The reason for this is that the wallet app probably does not have access to the complete serialized binary form of the transaction (as this requires Amino encoding).

    • The web wallet will send back a second custom call (after bnb_sign) called bnb_tx_confirmation, which contains the boolean result of the transaction build/broadcast and any error message encountered by the web wallet during broadcasting. In a complete implementation, this confirmation callback should be responded to with a call to approveRequest.

    Sequence Diagram

    This sequence diagram shows the flow of messages when the web wallet interacts with an external wallet provider via WalletConnect.

    WalletConnect Protocol Sequence

    Custom Requests

    A custom call request adheres to this structure:

    {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "method_name",
    "params": [{ ... }],
    }

    We have two custom call request formats, here are examples of them:

    Example: bnb_sign

    {
    "method": "bnb_sign",
    "params": [
    {
    "account_number": "34",
    "chain_id": "Binance-Chain-Ganges",
    "data": null,
    "memo": "test",
    "msgs": [
    {
    "inputs": [
    {
    "address": "tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd",
    "coins": [
    {
    "amount": 1000000000,
    "denom": "BNB",
    },
    ],
    },
    ],
    "outputs": [
    {
    "address": "tbnb1ss57e8sa7xnwq030k2ctr775uac9gjzglqhvpy",
    "coins": [
    {
    "amount": 1000000000,
    "denom": "BNB",
    },
    ],
    },
    ],
    },
    ],
    "sequence": "31",
    "source": "1",
    }
    ]
    }

    Response (approveRequest)

    A response like this should be sent back from the wallet app:

    {
    "id": 1553682007906047,
    "result": "{\"signature\":\"...\",\"publicKey\":\"...\"}"
    }

    In result, a JSON-encoded object must be included containing the following hex-string properties: signature, publicKey.

    Note that:

    • id and jsonrpc are usually pre-filled by the client SDK, so there should be no need to set this in the object yourself.

    • signature should be 64 bytes in length (128 hex chars)

    • publicKey should be 65 bytes in length (130 hex chars, non-compressed form, prefixed with 0x04)

    Example: bnb_tx_confirmation

    {
    "method": "bnb_tx_confirmation",
    "params": [
    {
    "ok": true,
    "error": "Error message (optional)"
    }
    ]
    }

    Receipt of the bnb_tx_confirmation should be confirmed by the app with approveRequest as per the WalletConnect protocol flow.

    For this response, result may be empty or contain an empty JSON-encoded object:

    Response (approveRequest)

    A response like this should be sent back from the wallet app:

    {
    "id": 1553682007906050,
    "result": ""
    }

    Ending the Session

    Remember to call killSession() when the user has finished using the integration from your app!

    This will redirect the user back to the unlock screen in the web wallet.

    - + diff --git a/docs/beaconchain/wallets.html b/docs/beaconchain/wallets.html index 5d414361ff..7be6aa7c27 100644 --- a/docs/beaconchain/wallets.html +++ b/docs/beaconchain/wallets.html @@ -8,13 +8,13 @@ - +

    Supported Wallets

    • List of Wallets Supporting BNB Beacon Chain Mainnet
    NumberWallet NameWebsiteDEX Feature AvailableTestnet SupportWalletConnect Support
    1Trust Wallethttps://trustwallet.com/YesYesYes
    2Trubi Wallethttps://trubi.io/YesNoYes
    3Ledgerhttps://www.ledger.com/Yes, via Binance.org and TrubiYes, via Binance.org and TrubiYes, via Binance.org and Trubi
    4CoolWallet (Hardware Wallet)https://coolwallet.io/Yes, via Binance.org and TrubiYes, via Binance.org and TrubiYes, via Binance.org and Trubi
    5Enjinhttps://enjinwallet.io/NoNoNo
    6Coinomi Wallethttp://coinomi.com/YesNoYes
    7Atomic Wallethttps://atomicwallet.io/NoNoYes
    8Math Wallethttps://www.mathwallet.org/en/YesNoYes
    9Ellipal Wallethttps://www.ellipal.com/YesNoNo
    10Exodushttps://www.exodus.io/NoNoNo
    11Guarda Wallethttps://guarda.co/NoNoNo
    12DDEX Wallethttps://ddex.io/YesNoNo
    13Pundi X Wallethttps://pundix.com/NoNoNo
    14SafePal Wallet (Hardware Wallet)https://www.safepal.ioYesNoYes
    15Zengo Wallethttps://zengo.com/NoNoNo
    16TokenPocket Wallethttps://www.tokenpocket.pro/NoNoYes
    17Cobo Wallethttps://cobo.com/NoNoYes
    18Midas Wallethttps://www.midasprotocol.ioNoNoNo
    19Cosmostation Wallethttps://www.cosmostation.io/NoNoNo
    20Trezorhttps://trezor.io/NoNoYes
    21Mixinhttps://mixin.oneNoNoNo
    22Ownbithttps://ownbit.ioNoNoNo
    23Frontierhttps://frontierwallet.com/NoYesNo
    24Infinity Wallet (Desktop Wallet)https://infinitywallet.io/YesNoYes
    25BitKeep Wallet (App & Chrome)https://bitkeep.com/YesNoYes
    26imToken (App)https://token.imYesYesYes
    - + diff --git a/docs/binance.html b/docs/binance.html index 5d9f702d0d..caa30ed90e 100644 --- a/docs/binance.html +++ b/docs/binance.html @@ -8,14 +8,14 @@ - +

    Using Binance Extension Wallet

    What is it?

    Binance Extension Wallet is a Crypto Wallet for BNB Beacon Chain and BNB Smart Chain. You can send and receive funds on both BNB Beacon Chain and BNB Smart Chain as well as perform cross-chain transfers between both of BNB Chain’s blockchains.

    In the future, Binance Extension Wallet will add support for Ethereum blockchain and enable access for distributed applications, or "Dapps" in your browser!

    It’s supported in Firefox and Chrome browsers.

    !!! Tip -Firefox users are more likely to access the latest version timely

    How to manually install the Binance Extension Wallet

    Install

    Example: Install BNB Chain Wallet in Firefox browser

    img

    Note: Make sure it’s offered by Binance Chain

    • Click on “Add to Firefox

    img

    That’s it! You have successfully installed the BNB Chain Wallet extension in Firefox!

    The workflow is the same for all browsers

    Create an account in extension wallet for BNB Smart Chain

    • Click on “I do not own a wallet

    img

    • Choose your own Password

    Note: it has to be a strong password

    img

    • Click on “Continue

    • Backup your recovery phrase

    img

    Congratulations! you have created your account!

    Recover your account with Mnemonic Phrase

    • Install BNB Chain extension by following the previous steps
    • firstClick on “I own a wallet”
    • Type your recovery phrase and choose a strong password
    • Click on “Get started

    Now you are all set!

    Get Testnet BNB from Faucet

    img

    • Switch to BNB Smart Chain Testnet after unlock your extension wallet

    img

    • Copy your address

    img

    • Paste your address in the box and click on “Give me BNB”
    • Click on the “+” and add “BNB” token

    img

    After the transfer transaction is sent, you will see an increase in your balance

    img

    Transfer Testnet BNB from BSC to BC

    • Switch to BNB Beacon Chain testnet and copy your address after unlock your extension wallet, start with tbnb1

    img

    • Click on the “+” and add “BNB” token

    • Switch to BNB Smart Chain testnet and click on “Send”

    img

    • Click on “Send” when you have filled in other information. You have to confirm it too

    img

    • Switch back to BNB Chain Testnet to confirm this cross-chain transfer

    img

    Transfer Testnet BNB from BC to BSC

    • Switch to BNB Smart Chain testnet after unlock your extension wallet and copy your address, start with 0x
    • Click on the “+” and add “BNB” token

    • Switch to BNB Chain testnet and click on “Send”

    • Click on “Send” when you have filled in other information. You have to confirm it too
    • Switch back to BNB Smart Chain Testnet to confirm this cross-chain transfer

    Swap Testnet BEP2 token to its BEP20 equivalent

    • Follow the instructions above to Install Binance Extension Wallet if not ready
    • Follow the instructions above to create or Recover your account
    • Switch to BNB Chain testnet after unlock your extension wallet and Click at “+” to add your BEP2 token if necessary

    Verify your balance has enough BNB to pay transfer fee

    • Switch to BNB Smart Chain testnet and copy your address, start with 0x

    Click at “+” to add your BEP20 token if necessary

    • Switch to BNB Chain testnet and click on “Send”
    • Click on “Send” when you have filled in other information. You have to confirm it too
    • Switch to BNB Smart Chain testnet, you should see your BEP20 token balance change

    Swap Testnet BEP20 token to its BEP2 equivalent

    • Follow the instructions above to Install Binance Extension Wallet if not ready
    • Follow the instructions above to create or Recover your account
    • Switch to BNB Smart Chain testnet and Click at “+” to add your BEP20 token if necessary

    Verify your balance has enough BNB to pay transfer fee

    • Switch to BNB Chain testnet and copy your address, start with tbnb1

    Note: for mainnet, the address starts with bnb1

    • Click at “+” to add your BEP2 token if necessary
    • Switch to BNB Smart Chain testnet and click on “Send”
    • Confirm your transaction and verify your balance change
    - +Firefox users are more likely to access the latest version timely

    How to manually install the Binance Extension Wallet

    Install

    Example: Install BNB Chain Wallet in Firefox browser

    img

    Note: Make sure it’s offered by BNB Chain

    • Click on “Add to Firefox

    img

    That’s it! You have successfully installed the BNB Chain Wallet extension in Firefox!

    The workflow is the same for all browsers

    Create an account in extension wallet for BNB Smart Chain

    • Click on “I do not own a wallet

    img

    • Choose your own Password

    Note: it has to be a strong password

    img

    • Click on “Continue

    • Backup your recovery phrase

    img

    Congratulations! you have created your account!

    Recover your account with Mnemonic Phrase

    • Install BNB Chain extension by following the previous steps
    • firstClick on “I own a wallet”
    • Type your recovery phrase and choose a strong password
    • Click on “Get started

    Now you are all set!

    Get Testnet BNB from Faucet

    img

    • Switch to BNB Smart Chain Testnet after unlock your extension wallet

    img

    • Copy your address

    img

    • Paste your address in the box and click on “Give me BNB”
    • Click on the “+” and add “BNB” token

    img

    After the transfer transaction is sent, you will see an increase in your balance

    img

    Transfer Testnet BNB from BSC to BC

    • Switch to BNB Beacon Chain testnet and copy your address after unlock your extension wallet, start with tbnb1

    img

    • Click on the “+” and add “BNB” token

    • Switch to BNB Smart Chain testnet and click on “Send”

    img

    • Click on “Send” when you have filled in other information. You have to confirm it too

    img

    • Switch back to BNB Chain Testnet to confirm this cross-chain transfer

    img

    Transfer Testnet BNB from BC to BSC

    • Switch to BNB Smart Chain testnet after unlock your extension wallet and copy your address, start with 0x
    • Click on the “+” and add “BNB” token

    • Switch to BNB Chain testnet and click on “Send”

    • Click on “Send” when you have filled in other information. You have to confirm it too
    • Switch back to BNB Smart Chain Testnet to confirm this cross-chain transfer

    Swap Testnet BEP2 token to its BEP20 equivalent

    • Follow the instructions above to Install Binance Extension Wallet if not ready
    • Follow the instructions above to create or Recover your account
    • Switch to BNB Chain testnet after unlock your extension wallet and Click at “+” to add your BEP2 token if necessary

    Verify your balance has enough BNB to pay transfer fee

    • Switch to BNB Smart Chain testnet and copy your address, start with 0x

    Click at “+” to add your BEP20 token if necessary

    • Switch to BNB Chain testnet and click on “Send”
    • Click on “Send” when you have filled in other information. You have to confirm it too
    • Switch to BNB Smart Chain testnet, you should see your BEP20 token balance change

    Swap Testnet BEP20 token to its BEP2 equivalent

    • Follow the instructions above to Install Binance Extension Wallet if not ready
    • Follow the instructions above to create or Recover your account
    • Switch to BNB Smart Chain testnet and Click at “+” to add your BEP20 token if necessary

    Verify your balance has enough BNB to pay transfer fee

    • Switch to BNB Chain testnet and copy your address, start with tbnb1

    Note: for mainnet, the address starts with bnb1

    • Click at “+” to add your BEP2 token if necessary
    • Switch to BNB Smart Chain testnet and click on “Send”
    • Confirm your transaction and verify your balance change
    + diff --git a/docs/bind-tokens.html b/docs/bind-tokens.html index 84264ba12f..77b417b145 100644 --- a/docs/bind-tokens.html +++ b/docs/bind-tokens.html @@ -8,14 +8,14 @@ - +

    Bind BEP2 and BEP20 Tokens

    BSC and BC work together to ensure that one token can circulate in both formats with confirmed total supply and be used in different use cases. Token Binding can happen at any time after BEP2/BEP8 and BEP20 are ready. The token owners of either BEP2/BEP8 or BEP20 only need to complete the Binding process when a cross-chain feature is necessary.

    You can use this tool.

    Issue BEP2 or BEP8 Token

    Please refer to this doc to issue BEP2

    Please refer to this doc to issue BEP8

    Example Let's issue a new BEP2 token ABC

    ## mainnet
    bnbcli token issue --symbol ABC --token-name "ABC token" --mintable --total-supply 10000000000000000 --from owner --chain-id Binance-Chain-Tigris --node https://dataseed1.bnbchain.org:443

    ## testnet
    tbnbcli token issue --symbol ABC --token-name "ABC token" --mintable --total-supply 10000000000000000 --from owner --chain-id Binance-Chain-Ganges --node https://data-seed-pre-0-s1.bnbchain.org:443

    Deploy BEP20 Token

    Please refer to this doc

    caution

    The symbol of the BEP20 token must be exactly identical to the prefix of the bep2 token(case sensitive).

    Token Binding

    Send Bind Transaction

    note

    expire-time need to be 600 seconds after now

    ## mainnet
    bnbcli bridge bind --symbol ABC-A64 --amount 6000000000000000 --expire-time 1597545851 --contract-decimals 18 --from owner --chain-id Binance-Chain-Tigris --contract-address 0xee3de9d0640ab4342bf83fe2897201543924a324 --node https://dataseed1.bnbchain.org:443

    ## testnet
    tbnbcli bridge bind --symbol ABC-A64 --amount 6000000000000000 --expire-time 1597545851 --contract-decimals 18 --from owner --chain-id Binance-Chain-Ganges --contract-address 0xee3de9d0640ab4342bf83fe2897201543924a324 --node https://data-seed-pre-0-s1.bnbchain.org:443

    The total supply of the ABC-A64 token is 100 million. The above bind transfer will transfer 60 million to a pure-code-controlled address. And then there are 40 million flowable tokens in BC. According to our bind mechanism, we have to lock 40 million token to TokenManager contract and leave 60 million flowable token on BSC. Thus the sum of flowable tokens on both chains is 100 million. Please remember that the amounts I mentioned above don’t include decimals.

    Approve Bind Request

    1. Grant allowance:

      In myetherwallet, call the approve of the BEP20 to grant a 40 million allowance to TokenManager contract. The spender value should be 0x0000000000000000000000000000000000001008, and the amount value should be 4e25. The transaction sender should be the BEP20 owner.

      img

    2. Approve Bind

      In myetherwallet, call approveBind in TokenManager contract with the latest ABI to approve the bind request from the BEP20 owner address.

      img

      The value here should be no less than miniRelayFee/1e18. The initial miniRelayFee is 1e16. So miniRelayFee/1e18 equals to 0.01. Besides, miniRelayFee can be changed by on-chain governance

    3. Confirm bind result on BC

      Wait for about 20 seconds and execute this command:

      ## mainnet
      bnbcli token info --symbol ABC-A64 --trust-node --node https://dataseed1.bnbchain.org:443
      ## testnet
      tbnbcli token info --symbol ABC-A64 --trust-node --node https://data-seed-pre-0-s1.bnbchain.org:443
      {
      "type": "bnbchain/Token",
      "value": {
      "name": "ABC Token",
      "symbol": "ABC-A64",
      "original_symbol": "ABC",
      "total_supply": "100000000.00000000",
      "owner": "tbnb1l9ffdr8e2pk7h4agvhwcslh2urwpuhqm2u82hy",
      "mintable": false,
      "contract_address": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "contract_decimals": 18
      }
      }

      If the bind was successful, then in the above response, "contract_address" and "contract_decimals" should not be empty.

    Use Cases

    Case 1: Lock non-zero in bind transaction

    Suppose you have 20 million on your treasure, you decide to lock some tokens via the bind tx:

    1. Send bind transfer on BNB Chain and specify the 20 million as the lock amount.
    2. Your BEP20 has 100 million supplies, you need to run the approve to grant allowance to the tokenHub contract, then you run approveBind, along these step, you don't have to specify how much exactly you need to transfer to the tokenHub contract, it will figure it out (here actually it is 80 million), as long as you approve it with enough amount.
    3. If your approveBind runs successfully, the bind is done. Your 20 million treasures actually will be on your owner address on BSC, and this is your CHOICE.
    4. After your bind, you can spend your 20 million whatever you want (including transferring back to BC), and for other holders of your token on BC, they can transfer their token to BSC at their own choice without your help or your permission.

    Case 2: Lock zero in bind transaction

    Suppose you choose not to touch your 20 million in treasure at all:

    1. When you have 20 million on your treasure, you can choose to lock ZERO when you run the bind tx.
    2. Suppose Your BEP20 has 100 million supplies, you need to run the approve to grant 100 million allowance to the tokenHub contract, then you run approveBind.
    3. If your approveBind runs successfully, the bind is done. Your 20 million treasures stay at BC in your treasure address, nothing happens to it, and this is your CHOICE. Meanwhile, on BSC, no one has any BEP20 tokens, except the tokenHub. However, because the bind is done, ANYONE, including yourself, can get BEP20 whenever they want by a simple cross-chain transfer.
    - + diff --git a/docs/bsc-faucet.html b/docs/bsc-faucet.html index eddf485984..3788fbc1aa 100644 --- a/docs/bsc-faucet.html +++ b/docs/bsc-faucet.html @@ -8,13 +8,13 @@ - +

    Claim tBNB Tokens from Discord Faucet

    tBNB is the test BNB Tokens used on the BNB Smart Chain (BSC) Testnet. To get some tBNB of BSC testnet for testing purpose, you can join the BNB discord and go to the test-faucet channel under the faucet section. There you can claim your tBNB for free.

    1. Type the command /faucet ${your-wallet-address}.

    2. Switch to the BNB smart chain testnet in your wallet and check your balance.

    Claim tBNB from Online Faucet

    To get some tBNB of BSC testnet for testing purpose, you can use the online faucet to claim your tokens.

    1. Copy your wallet address and paste the address in the textbox

    2. Select the tokens you need to claim. Major peggy tokens like BUSD, USDT, and others are supported.

    info

    Please note if your wallet balance is larger than 1 tBNB, you can not get new tBNB from the Discord bot faucet.

    You can only claim once in 24 hours.

    - + diff --git a/docs/bsc-tutorials.html b/docs/bsc-tutorials.html index 143d438a27..6529bccace 100644 --- a/docs/bsc-tutorials.html +++ b/docs/bsc-tutorials.html @@ -8,13 +8,13 @@ - +

    Tutorials

    In this section, we have provided tutorials on usage of different components of BNB Smart Chain.

    Validator

    Full Node

    Archive Node

    Staking and Delegation

    Smart Contracts

    Tokens

    BEP Tokens

    NFT

    Dapp Development

    Wallets

    • Please refer here for a list of tutorials on different supported wallets.

    BNB Chain Development (Video Series)

    - + diff --git a/docs/chainide.html b/docs/chainide.html index c8b205ffca..bb6bf6a838 100644 --- a/docs/chainide.html +++ b/docs/chainide.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Using ChainIDE

    Introduction

    ChainIDE is a chain agnostic, cloud-based IDE for creating decentralized applications. It enhances the development cycle through pre-configured plugins that save users' time and effort. This is a beginner guide on creating a simple smart contract and deploying it to the BNB Smart Chain. If you have any questions, feel free to ask them in the ChainIDE Discord.

    Pre-requisites

    1. ChainIDE
    2. Web3 Wallet
    3. Solidity

    What You'll Do

    The following are general steps for deploying a storage smart contract

    1. Setting up a Wallet
    2. Write down a Storage Smart Contract
    3. Compile a Storage Smart Contract
    4. Deploy a Storage Smart Contract
    5. Create a Flattened File using Flattener Library
    6. Verify a Storage Smart Contract
    7. Contract Interaction

    Setting up a Wallet

    Install Binance Wallet/MetaMask

    When deploying a smart contract to a blockchain or when making a transaction to a deployed smart contract, a gas fee must be paid, and for that, we need to use a crypto wallet which can be Binance Wallet or MetaMask. If you want to use Binance Wallet, click here to get Binance Wallet and if you want to continue with MetaMask Wallet, click here to install MetaMask.

    Adding BNB Smart Chain Test Network to MetaMask Wallet

    Visit ChainIDE, create a project, and click on the "unconnected button" in the upper right corner, select the "Injected Web3 Provider" button, and then click the "MetaMask" to connect to the MetaMask wallet ("BNB Chain Mainnet" is the main network, and "BNB Chain Testnet" is the test network, click on the "BNB Chain Testnet" and it will be added to your MetaMask wallet.

    Enabling the BNB Smart Chain Test Network to Binance Wallet

    If you want to continue with Binance Wallet, install Binance Wallet, and After installing Binance Wallet, you need to enable "Show Test Networks" and switch to the "BNB Smart Chain Test Network".

    img

    Obtaining Test BNB tokens

    Once BNB Smart Chain Test Network has been added to MetaMask, navigate to the BNB Smart Chain Faucet to receive test tokens. Tokens are needed to pay for gas fees to deploy and interact with the smart contract. On the faucet page, paste your MetaMask wallet address. Then, click submit and the faucet will send you some test BNBs.

    img

    Write down a Storage Smart Contract

    You need to write down all the required functions that you want to implement in your storage smart contract. A general storage smart contract has the following functions:

    • Store(): store value in variables
    • retrieve(): returns the stored value

    The ChainIDE team has prepared a simple storage smart contract that includes all the required functions; you may use this built-in template and add/delete functions according to your requirements.

    Visit the ChainIDE site and click on "Try Now".

    Then, click on "New Project" and select "BNB Chain", and "Storage".

    Now, you can see the template contract, Storage.sol, that includes all the required functions.

    Compile a Storage Smart Contract

    After you have completed your smart contract, it is time to compile it. To compile, navigate to the "Compile", module, choose an appropriate compiler version according to your source code, and press the "Compile" button. An ABI and bytecode for the source code generate upon successful compilation. If there are some errors in your source code, they will be displayed under the output panel in the "Logger module". You may need to carefully read the error, resolve it accordingly and compile the contract again.

    Note down the compiler version and the license for your source code as it would be needed when you verify your smart contract on the BNB Smart Chain Test Network.

    Deploy a Storage Smart Contract

    After successful compilation, it's time to deploy your compiled storage smart contract to the BNB Smart Chain Test Network. For that, you need to have a MetaMask installed, the BNB Smart Chain Test Network added to your wallet, and some testnet tokens to pay for the transaction fee.

    Navigate to the "Deploy & Interaction" module and choose the smart contract that you want to deploy among the compiled smart contracts and click the "deploy" button. For this tutorial, the Storage smart contract will be deployed.

    Create a Flattened File using Flattener Library

    To verify a smart contract that imports other smart contracts, we need to create a flattened file, a flattened file including all the source code of imported contracts in a single file. To create a flattened file, you need to add a "Flattener" plug-in.

    Once the Flatterner plug-in is activated, you'll be able to access it as a separate module as shown in the figure below. Choose the compiled file, and click on the flatten button to create a flattened file, once the flattened file is created, it will be automatically copied to the clipboard, you may paste it to a file and save it for later usage.

    If you want to save the flattened file, click the save button, and a flattened file will be saved in the current repository.

    The saved flattened file can be accessed under the explorer module.

    Verify a Smart Contract

    To verify a smart contract, you need to visit BNB Smart Chain Explorer and search for the deployed smart contract using the contract address.

    Click on the "verify and publish" link shown under the contract section.

    Once you click on the verify and publish link, you will be asked for the following:

    • Contract Address: The address of a deployed smart contract that you want to verify
    • Compiler Type: Either you want to verify a single file or multiple files
    • Compiler Version: The compiler version that you used to compile the smart contract
    • License: Open-source license type that you used for your source code

    After that, you need to paste the flattened file that you created in step 5, and your smart contract will be verified.

    If there are no issues with your smart contract, it would be verified, and you'll be able to see an image similar to the one that is shown below.

    Congratulations, you have successfully deployed your smart contract to the blockchain and verified it, now it's time to interact with your deployed smart contract.

    Contract Interaction

    After successful deployment and verification. All the functions in the deployed smart contract can be seen in the "INTERACT" panel. In our scenario, we have two functions, Store() that is used to store the value to the blockchain, and Retrieve() to retrieve stored data from the blockchain.

    - + diff --git a/docs/circulation-model.html b/docs/circulation-model.html index 36f4db3de6..f61e7f0140 100644 --- a/docs/circulation-model.html +++ b/docs/circulation-model.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ Peg Account is a pure-code-controlled account that no one has the right to access to the account.

    • For BC, the Peg Account is bnb1v8vkkymvhe2sf7gd2092ujc6hweta38xadu2pj. (tbnb1v8vkkymvhe2sf7gd2092ujc6hweta38xnc4wpr for testnet)
    • For BSC, the Peg Account is TokenHub contract.

    Bind

    Token Binding can happen at any time after BEP2/BEP8 and BEP20 are ready. The token owners of either BEP2/BEP8 or BEP20 only need to complete the Binding process when a cross-chain feature is necessary.

    Binding process helps to build the relationship between the two tokens on BC and BSC. It will ensure that the two tokens share the same symbol and same total supply. The most important part is that it will reallocate the circulation on both chains to ensure the total circulation equals the total supply.

    Let's walk through an example:

    1. Bob issues BTC on BC with a total supply of 10, and he sends Alice 2 BTC.
    2. Bob issues BTC on BSC with a total supply of 10, and he sends Tom 1 BTC.

    Now Bob wants BTC to flow between BC and BSC, but the total circulation on BC and BSC is 20=10+10 BTC which is not correct, so he decided to bind these two tokens. He made a decision that 8 BTC circulation on BC and 2 BTC circulation on BSC, then he started a bind transaction.

    The BC execution engine will:

    1. Transfer 2 BTC from Bob's account to Peg Account.
    2. Emit a cross-chain event.

    For now, on BC, Bob has 6 BTC, Alice has 2 BTC, 2 BTC is locked in Peg Account, circulation on BC is 8 BTC.

    The Relayer watches the cross-chain event on BC, and sends a transaction to TokenManager contract on BSC.

    Then Bob invokes the BTC contract on BSC to approve TokenManager to spend 8 BTC of his account. After that Bob approves the bind request by invoking TokenManager. The TokenManager will transfer 8 BTC from Bob's account to Peg Account.

    For now, on BSC, Bob has 1 BTC, Tom has 1 BTC, 8 BTC is locked in Peg Account, circulation on BSC is 2 BTC.

    The binding process ends here, and the total circulation on both chains is 10 BTC which equals to its total supply.

    Cross Chain Transfer

    When one token transfer from the native chain to the parallel chain, the process is:

    1. Token transfer from the sender to Peg Account on the native chain.
    2. Token transfer from Peg Account to the receiver on the parallel chain.

    Burn

    When a user burns a certain amount of token on the native chain, there is no need to burn on the parallel chain.

    Let's walk through an example:

    1. The circulation on BC is 5 BTC, and 5 BTC on BSC.
    2. User burns 2 BTC on BC.
    3. Now circulation on BC is 3 BTC, and 5 BTC on BSC.
    4. The total circulation is 8 now which is expected.

    Mint

    When a user mints a token on the native chain, but does not mint it on the parallel chain, it may cause an issue that users can not cross transfer all tokens from the native chain to the parallel chain.

    Let's walk through an example:

    1. The circulation on BC is 5 BTC, and the locked token is 5 BTC.
    2. The circulation on BSC is 5 BTC, and the locked token is 5 BTC.
    3. User mint 2 BTC on BC.
    4. It will fail if the user tries to transfer 7 BTC from BC to BSC, because the balance of Peg Account on BSC is 5 BTC and can’t afford to unlock 7 BTC.

    The best practice for mint is:

    1. Mint token on the native chain.
    2. Mint token on the parallel chain.
    3. Transfer the mint token to Peg Account on the parallel chain.
    - + diff --git a/docs/contribute.html b/docs/contribute.html index 03ec44e7d7..10005e4d56 100644 --- a/docs/contribute.html +++ b/docs/contribute.html @@ -8,14 +8,14 @@ - +

    How to Contribute to BNB Chain Documentations Project

    Your contributions to the BNB Chain will help build a fast and secure decentralized digital asset exchange.

    We want to make it as easy as possible to contribute changes that help the BNB Chain grow and thrive. There are a few guidelines that we ask contributors to follow so that we can merge your changes quickly.

    Steps for Contributing on GitHub

    • Make sure you have a GitHub account.
    • Create a GitHub issue for your contribution, assuming one does not already exist.
    • Clearly describe the issue including steps to reproduce if it is a bug.
    • Fork the repository on GitHub.
    • Minor Changes
    • Documentation
    • For small changes to comments and documentation, it is not always necessary to create a new GitHub issue. In this case, it is appropriate to start the first line of a commit with 'doc' instead of an issue number.

    Finding things to work on The first place to start is always looking over the current GitHub issues for the project you are interested in contributing to. Issues marked with [help wanted][help-wanted] are usually pretty self-contained and a good place to get started.

    Of course, feel free to create a new issue if you think something needs to be added or fixed.

    Making Changes

    • Create a topic branch from where you want to base your work. This is usually the master branch. Please avoid working directly on the master branch.
    • Make sure you have added the necessary tests for your changes and make sure all tests pass.

    Submitting Changes

    • Submit a pull request to the docs repository in the BNB Chain organization.
    • Include a descriptive [commit message][commit-msg].
    • Changes contributed via pull request should focus on a single issue at a time.
    • Rebase your local changes against the master branch. Resolve any conflicts that arise.

    This document is inspired by:

    - + diff --git a/docs/create-wallet.html b/docs/create-wallet.html index b8dbf032bb..a00d15c946 100644 --- a/docs/create-wallet.html +++ b/docs/create-wallet.html @@ -8,13 +8,13 @@ - +

    Key Management

    This article is a guide about key management strategy on client side of your Decentralised Application on BNB Smart Chain

    Setup Web3

    web3.js is a javascript library that allows our client-side application to talk to the blockchain. We configure web3 to communicate via Metamask.

    web3.js doc is here

    Connect to BSC network

        // mainnet 
    const web3 = new Web3('https://bsc-dataseed1.bnbchain.org:443');
    // testnet
    const web3 = new Web3('https://data-seed-prebsc-1-s1.bnbchain.org:8545');

    Set up account

    If the installation and instantiation of web3 was successful, the following should successfully return a random account:

        const account = web3.eth.accounts.create();

    Recover account

    If you have backup the private key of your account, you can use it to restore your account.

        const account = web3.eth.accounts.privateKeyToAccount("$private-key")

    Full Example

    const Web3 = require('web3');
    async function main() {

    const web3 = new Web3('https://bsc-dataseed1.bnbchain.org:443');
    const loader = setupLoader({ provider: web3 }).web3;

    const account = web3.eth.accounts.create();
    console.log(account);
    }
    - + diff --git a/docs/cross.html b/docs/cross.html index 5311d96d37..74ab85e23e 100644 --- a/docs/cross.html +++ b/docs/cross.html @@ -8,13 +8,13 @@ - +

    Cross-chain Communication

    How much is cross-chain transfer fee?

    The total cost of transfer from BC to BSC is composed of 2 parts:

    • Fee for executing bridge transfer-out transaction is 0.004BNB, pay validators on BNB Beacon Chain

    • Fee for BSC-relayers 0.004BNB. it will cover the fees of calling TokenHub Contract on BSC.

    The total cost of transfer from BSC to BC is composed of 2 parts:

    • Fee for Oracle-relayers 0.004BNB, pay for BSC relayers

    • Call TokenHub Contract: You need to pay BNB for calling smart-contract on BSC, this transaction is metered by gas, which is a global parameter. At the moment, you need to pay about 0.0005BNB ~ 0.0015BNB.

    What's is a BSC relayer?

    BSC relayer monitors cross chain packages on BNB Beacon Chain, builds and broadcasts transactions to BSC to deliver these packages, which is the key of cross chain communication from BNB Beacon Chain to BSC.

    What's is an Oracle relayer?

    Oracle Relayer watches the state change of BNB Smart Chain. Once it catches Cross-Chain Communication Events, it will submit to vote for the requests. After Oracle Relayers from ⅔ of the voting power of BC validators vote for the changes, the cross-chain actions will be performed. Only validators of BNB Beacon Chain are eligible to run Oracle relayers.

    What's an oracle?

    In blockchain network, an oracle refers to the element that connects smart contracts with data from the outside world. In the network of BNB Smart Chain, the execution of the transaction wil emit Events, and such events can be packaged and relayed onto BC. In this way, BC will get updates about changes of BSC.

    How to send cross-chain transfer?

    You can use Binance Extension Wallet or

    use Trust wallet

    - + diff --git a/docs/dapp-dev/Hello-World.html b/docs/dapp-dev/Hello-World.html index 07b12d9576..749ce3ae60 100644 --- a/docs/dapp-dev/Hello-World.html +++ b/docs/dapp-dev/Hello-World.html @@ -8,13 +8,13 @@ - +

    Develop Full Stack dApp on BNB Smart Chain in 5 minutes

    Designed for anyone wanting to learn blockchain development, this tutorial provides a step-by-step guide on how to develop a full-stack Hello World Smart dApp that is used for storing and retrieving data from the BSC blockchain. The technology stack used in this tutorial includes Solidity, Truffle, Ganache, Web3.js, and Node js. We also cover how to deploy smart contracts on the BNB Smart Chain Testnet.

    Learning Takeaways:

    This tutorial will help you gain knowledge on the following learning points:

    • MetaMask Wallet connectivity to BSC Testnet;
    • Smart-contract development;
    • Using truffle and ganache for local development and testing;
    • Unit testing of smart contracts;
    • Deploying smart contracts on BSC Testnet;
    • Front-end integration with the smart contract using web3.js library;

    Technology Stack Details

    • node v16.13.0
    • npm v8.1.0
    • Truffle v5.5.19 (core: 5.5.19)
    • Ganache CLI v6.12.2 (ganache-core: 2.13.2)
    • Solidity ^0.8.0 (solc-js)
    • Web3.js v1.5.3
    • MetaMask Wallet v10.16.1

    Brief Introduction Tech Stack

    1. Truffle Framework: set of tools for smart contract development, testing, and asset pipelining for any blockchain that uses the Ethereum Virtual Machine (EVM).
    2. Ganache: available as both desktop application and CLI, it is a personal blockchain that can be used for local blockchain development.
    3. Solidity: one of the most popular object-oriented high-level smart contract programming languages. For more details on Solidity, refer here.
    4. MetaMask Wallet Browser Extension: we recommend using the Metamask Chrome extension. It is a web wallet that allows connecting the chrome browser to any valid blockchain network.
    5. Node JS: this is used for UI or Front end development.
    6. Web3.js: JavaScript library that allows communication with the EVM-based blockchains. This is the magic tool that turns our web application into a blockchain-enabled application.

    Setting up the development environment

    1. Install Truffle: npm install -g truffle

    2. Install Ganache-CLI: npm install -g ganache-cli

    3. Clone the BNBChain-Tutorial repository: git clone https://github.com/bnb-chain/bnb-chain-tutorial.git

    4. Change the current directory: cd 01- Hello World Full Stack dApp on BSC;

    5. Install all the dependencies (node modules): npm install

    6. Install and configure MetaMask Chrome Extension to use with BSC Testnet. Referherefor a detailed guide.

    7. Create a .secret file with the secret phrase of MetaMask. Refer here for details on how to get MetaMask secret phrase.

    Smart Contract in Action: Compile and Deploy

    1. Compile Smart Contracts. Use the commandtrufflecompile to compile your smart contracts.

    image

    1. Migrate Smart Contracts. Use the following command to deploy/migrate your smart contracts onto the BSC Testnet truffle migrate --reset --network bscTestnet

    image

    1. Unit Test Your Smart Contracts.

      1. Open a terminal and move into the root directory of the project. Run the ganache-cli using the command ganache-cli.

    image

      2. Make sure that the terminal is not closed, i.e., ganache-cli is running in the background. This is important because testing is done on the local network.

    3. From the root directory of the project, in a new terminal, run the command ```truffle test``` to run the tests.

    image

    1. Create the build. Run the command npm run build to create the build files for your web application using the webpack library.

    image

    1. Run the application. Run the command npm run dev to start the application on the localhost. Note: before running the application make sure nothing is running on localhost:3000

    image

    1. Navigate to localhost:3000 on Chrome Browser to see the dApp in action

    image

    Using the dApp

    1. Make sure that your MetaMask wallet is correctly installed and configured to connect to BSC Testnet. Refer to this guide for details. To use the dApp successfully make sure that your MetaMask wallet is connected to the site.

    image

    1. Click on Greet Button to display a message, by default it's Hello, World.

    image

    1. Enter a name in the input field, Click Save Name button to save the name.

    image

    1. Confirm the transaction when MetaMask notification pops up.

    image

    1. Upon successful transaction confirmation you will see the Save successful message.

    image

    1. Click on the Greet Button to display a message along with the last name saved with the current account.

    image

    Conclusion

    In this post, we developed both the backend and front-end for a decentralized application developed in Node.js that can be used for interacting with smart contracts deployed on the BSC Testnet. The tech stack includes Web3.js, Truffle, Ganache-cli, Node js, MetaMask, and jQuery. Check out our GitHub for more tutorials on how to develop on BSC. If you have any questions or are stuck, reach out to us on our Discord Channel.

    - + diff --git a/docs/dapp-dev/web3js-tutorial.html b/docs/dapp-dev/web3js-tutorial.html index c01abdb188..eb29b7bf48 100644 --- a/docs/dapp-dev/web3js-tutorial.html +++ b/docs/dapp-dev/web3js-tutorial.html @@ -8,13 +8,13 @@ - +

    Using Web3.js Library on BNB Smart Chain

    Designed for anyone wanting to learn development on the BNB Smart Chain, this tutorial provides a step-by-step guide on how to use web3.js library along with Nodereal API to fetch transaction details from the BNB Smart Chain blockchain for the given transaction hash. The technology stack used in this tutorial includes Web3.js, Nodereal MegaNode, and http-server.

    Learning Takeaways:

    This tutorial will help you gain knowledge on the following learning points:

    • Using Web3.js library to fetch blockchain data;
    • Using Nodereal’s Meganode API;
    • Deploying static pages onto localhost using http-server.

    Technology Stack Details

    • node v16.13.0
    • npm v8.1.0
    • Web3.js
    • http-server

    Setting up the development environment

    1. Install http-server: npm install -g http-server

    image

    1. Clone the BNBChain-Tutorial repository: git clone https://github.com/bnb-chain/bnb-chain-tutorial.git
    2. Change the current directory: cd "02-BSC-Block-Explorer"
    3. Install all the dependencies (node modules): npm install
    4. Before running the application, make sure that you have included the HTTP link for the Nodereal Meganode API in the index.html as shown in the figure below.

    image

    1. For this project, we have used the BSC Testnet public API key, as shown in the figure below. For a complete list of Nodereal Meganode Public API keys, refer here.

    image

    1. Run the application by using the command http-server from the project directory.

    image

    1. Open your web browser and navigate to any of the ports indicated by the http-server command.

    image

    How to Use

    1. Since we have used the HTTP reference of Nodereal’s Meganode API for BSC testnet, open BSCscan for Testnet, and copy the transaction hash of any transaction of your choice.
    2. Paste this transaction hash into the input field in our block explorer.

    image

    1. Click on the Fetch Details button to fetch details of this transaction.

    image

    1. You can also display other details from the received transaction receipt by changing the code block shown in the figure below as we have displayed the minimum.

    image

    1. The received transaction receipt has several fields as shown in the figure below.

    image

    Conclusion

    In this tutorial, we developed a dapp that has both backend and front-end integration that uses Web3.js library that can be used for fetching details of transactions on the BSC testnet by given a transaction hash. The tech stack includes Web3.js, Nodereal MegaNode, and http-server. Check out our GitHub for more tutorials on how to develop on BSC. If you have any questions or are stuck, reach out to us on our Discord Channel.

    - + diff --git a/docs/dev-outlook-2022.html b/docs/dev-outlook-2022.html index 44af772595..131c03f00f 100644 --- a/docs/dev-outlook-2022.html +++ b/docs/dev-outlook-2022.html @@ -8,13 +8,13 @@ - +

    Overview

    In 2017, Binance and BNB were born. Three years later, BNB Smart Chain (BSC) was introduced to the world. As Binance grew bigger and stronger, so did BNB Smart Chain. BSC was born in time for the DeFi revolution, as the public showed increased interest in alternative financial solutions and use cases powered by blockchain. Today, both Binance and BSC remain connected by BNB.

    beyond-binance

    Beyond Binance

    BNB is more than just Binance. BNB has its own living, breathing ecosystem, together with BSC. The vision is that one day everyone will own BNB, and that’s why it’s necessary to set it free. For BNB to reach its true potential, Binance and BSC must set sail on different courses. From today, BNB Chain and BNB Smart Chain (BSC) become BNB Chain.

    BSC development teams and community pioneers would like to share the outlook for the future development direction of the BNB blockchain ecosystem and to demonstrate the resilience and persistence of the BNB spirit: for the builders and users and target to onboard 1B users.

    With this name change also comes more advancements to benefit users, projects and developers connected to the BNB Chain community. BNB Chain will embrace large-scale applications, including GameFi, SocialFi and the Metaverse. In particular:

    • Scaling from one chain to multi-chain
    • Boosting the throughput of BSC
    • Introducing on-chain governance mechanisms
    • Improving scaling solutions and an expansion of the validator set of BSC from 21 to 50 (with 29 validators functioning as candidate block producers)
    - + diff --git a/docs/dev-outlook/community.html b/docs/dev-outlook/community.html index 20c992adf8..48bad29214 100644 --- a/docs/dev-outlook/community.html +++ b/docs/dev-outlook/community.html @@ -8,13 +8,13 @@ - +

    community

    Buidling For the Community, With the Community, and By the Community

    BNB has been on a journey. BSC is not the end, but another start. BSC is a testimony on how a great ecosystem can be co-built by the community. The same as other blockchain projects, the secret sauce of the success always includes the attitude to be more open, inclusive, collaborative, persistent and down-to-earth.

    The research and development of the BNB ecosystem, with BSC as the first major inception point, will go further down the road to embrace the community, open source, and collective intelligence, which are essentially the good part of decentralization.

    That is why we put this as a topic to push hard on persistently, for now and for the future.

    - + diff --git a/docs/dev-outlook/decentralization.html b/docs/dev-outlook/decentralization.html index 4789671d6a..ad904ab3ef 100644 --- a/docs/dev-outlook/decentralization.html +++ b/docs/dev-outlook/decentralization.html @@ -8,13 +8,13 @@ - +

    Decentralization Further

    Candidate ValidatorSet

    In order to decentralize the network further, more validators should be introduced. Besides increasing the anti-censorship, it always increases the robustness and availability of the network. BSC should survive even if more than half of the validator set were censored or taken down in a hostile way.

    Meanwhile BSC has 29 active validators and many inactive validators. The inactive validators have no reward so the incentive for the runner to ensure the node quality and the delegation from the BNB holders are not enough.

    BSC will introduce more validators, e.g. another 20 inactive validators, into the validator set as backups, which will be called “Candidates”.

    Candidates will produce blocks and charge gas fees in BSC mainnet, but in a much less chance than the official validator set of 29 elected. The unavailable candidates will be slashed as well though in a smaller size. A decent motivation is expected to be maintained so that the candidate validators are willing to ensure the quality and help secure BSC.

    In an extreme case, if a majority of the active 29 validators get attacked and offline, Candidate Validators can report to BNB Beacon Chain about the stale blocking, resume it and eventually propose a re-election of active validator set.

    Temporary Maintenance Mode for Validators

    Due to the design of ‘Parlia’ consensus, the absence of the validator, even if it is due to scheduled maintenance, will cause instability and capacity of BSC due to the extra waiting time and chain reorganization.

    Here a “Temporary maintenance” mode should be introduced, which is supposed to last a few minutes to half an hour. The validator can claim to the network about its planned maintenance. Its seat will be temporarily dropped from the block producing rotation, though it will still be slashed.

    - + diff --git a/docs/dev-outlook/scaling.html b/docs/dev-outlook/scaling.html index bb17e268ff..df94654a71 100644 --- a/docs/dev-outlook/scaling.html +++ b/docs/dev-outlook/scaling.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ The excluded accounts and contracts will only be presented as intermediate node of MPT, so that they can still be used to calculate the new MPT; Ephemeral Client can work in a similar way as a full node, in the sense that it will execute all the transactions and verify all the data. It should load the excluded data during the execution from another full node or the Portal Network, or even pre-load the excluded data based on the transactions in the mempool. Apparently sometimes the ephemeral clients may run slower than a full node, but it is a trade-off to make it much easier to run, and run faster.

    Deriving from this concept, it is natural to consider separating the hot data from the cold data, which has been a classic technique used in the computing industry. If the EVM blockchain is considered as a “world computer”, the memory of the node should be the registers, while the storage can be the RAM (yes, with MPT used in a similar way as ECC in RAM). RAM has never been big enough, so that the data has to be swapped out onto local or/and remote disks. The EVM blockchain needs such “local or/and remote disks” too.

    This is not an easy problem to solve:

    1. Data location is not part of the consensus. It may be easy to mark the data as “swap-out” or “offline” and reach the consensus, but the more important issue is to reach the implicit consensus that “my proposed block has some transactions that swap in data from the offline mode”. The short blocking time may not be enough from other validators to respond.
    2. Some contracts may have a very big storage, which is a great help to swap it out, but very challenging to swap it in as a whole back to “online”.

    One potential solution may be:

    1. Swap the data out by the unit of account and contract when they have not been changed for a long time, and put this as an transaction to get consensus;
    2. Swap in data by a deterministic set size, which may not be as large as the whole contract data.
    3. The swapped-in data can be passed in as extra calldata on the block, and the other validators can execute the transactions and verify the data as a “stateless client” if they cannot load the data in time.
    4. The transaction senders will pay extra gas to run any transaction that requires swapping in the data.

    A new data layer may emerge due to the requirement to store the cold data.

    EVM Parallelization

    Running transactions in parallel for Ethereum has been studied for several years. Solana goes with a native design to enable this as much as possible so that it can take advantage of the powerful GPU.

    Based on the analytics of BSC data, the CPU has not been the No.1 bottleneck but the storage is. Even though the EVM parallelization will take better usage of multiple cores of the modern CPUs, the primary goal is to increase the parallelism of storage operation to maximize the SSD usage (even the SATA ones).

    In order to maintain backwards compatibility and not change the account structures as Solana does, the most straightforward method is heuristic based, i.e. try-and-rerun-the-failed. The full nodes can do some preprocessing to categorize the transactions in the blocks and mempool into different concurrent workers before actually running them. A lower level instrument monitor will be planted at the storage level, if the race condition is detected, and relevant transactions will be put back into the main worker to rerun in order to generate the correct state. Block producers may even place some hints for others to run the blocks in the most efficient way via the P2P network, though the hint itself is not part of the block.

    Besides the parallelization within one block, BSC inherits one limit from Ethereum that the block proposer has to wait until it applies all the previous blocks before it can execute any transactions in its block to propose at its turn. If the previous block proposers send the block late, or the blocks are delayed due to slow network etc, the proposer may not have enough time to execute enough transactions into their blocks and have to propose an empty block or even miss its turn. Tendermint is a good example that solves the above issue. The block proposer on Tendermint network only needs to assemble the block without executing them. How to control the gas used within one block without executing transactions is a difficult topic on the EVM network.

    How to run transactions in parallel even among different blocks will be very rewarding here, but it will be very difficult as well.

    EVM JIT Compilation

    Using JIT compilation in EVM was proposed and discussed in the early days of Ethereum. When popular dApps dominate the network, such as OpenSea and Uniswap on Ethereum, and PancakeSwap on BSC, and one GameFi dApp had a few million transactions per day, the idea is fascinating that these applications can be compiled into native instructions and able to run faster. This benefits even the compilation is not done “just-in-time” but offline.

    However, this is a very challenging feature because it touches the very low level of EVM and can be quite prone to error and security issues. Here is just a placeholder for the talented developers to conquer in the later stage.

    User Experience

    Besides the limitation of the block gas limit cap, the other major factor that can impact BSC capacity is the rate of fork. Fork and re-organization of the blockchain can be very costly for both validators and fullnode.

    Fast Finality

    Although BSC is designed to produce blocks every 3 seconds, it is recommended to wait until more than half of the validator set has produced new blocks on the block before the block can be confirmed in a probabilistic manner. This will cost at least 3x11 = 33 seconds after the block is visible on the network.

    As the validator set is well known every 24 hours, BSC can get a faster consensus on the longest chain based on the “attestation” from more than a certain percentage of the validator set considering it is the longest chain.

    This essentially requires altering the “Parlia” consensus mechanism of BSC. A BEP candidate has been proposed by the community at [WIP] BEP-97: Introduce Fast Finality Mechanism by KeefeL · Pull Request #126 · binance-chain/BEPs · GitHub

    - + diff --git a/docs/dev-tools.html b/docs/dev-tools.html index bd3ac3f94a..e3072ea618 100644 --- a/docs/dev-tools.html +++ b/docs/dev-tools.html @@ -8,13 +8,13 @@ - +

    Development Tools on BSC

    Smart Contracts

    Smart contracts development with BSC enables you to build your smart contracts for any use, including cryptocurrency exchanges, smart contract-based dApps, Decentralized Finance, and more.

    Smart contracts are programming logic that are executed automatically on when a certain condition(s) are met. In BSC, smart contracts can be written in Solidity programming language.

    Please refer to the official documentation of Solidity for any queries.

    IDE and Libraries

    Multiple IDEs and libraries can be used for developing and deploying smart contracts.

    • Remix IDE: powerful open source tool that helps you write Solidity contracts straight from the browser. It is written in JavaScript and supports both usage in the browser, in the browser but run locally and in a desktop version. Remix IDE has modules for testing, debugging and deploying of smart contracts and much more.
    • Truffle: development tool that allows users to compile, test, debug and deploy smart contracts.
    • Web3JS: collection of libraries that allow you to interact with a local or remote ethereum node using HTTP, IPC or WebSocket.
    - + diff --git a/docs/dia.html b/docs/dia.html index 43dd232c16..8bb8a59dac 100644 --- a/docs/dia.html +++ b/docs/dia.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    DIA Data Oracles on BNB Smart Chain

    Introduction

    DApp developers who want to leverage DIA oracles can access the published data on BNB Smart Chain. DIA offers cryptocurrency and data about traditional financial assets.

    Supported Assets

    DIA supports assets from various categories to be included into the oracle. A selection of assets is listed here:

    Data Feed NameData Type
    BNB CoinCrypto Price
    BitcoinCrypto Price
    EthereumCrypto Price
    TetherCrypto Price
    XRPCrypto price
    Barnbridge ProtocolFarming Pool Data
    yearn.financeFarming Pool Data
    CREX on CrexChart Point on Exchange
    DAI on CurveFiChart Point on Exchange
    WBNB on PancakeSwapChart Point on Exchange

    Data Access

    All asset prices are determined in USD. Where appliccable, the oracle also provides information on circulating supply and the timestamp of data collection. The query in the smart contract is realized with the symbol of the asset.

    Smart Contract

    DIA data is published in the DIAOracle smart contract. By querying the getCoinInfo() function you can retrieve the requested data.

    It takes the name of the asset as input, e.g., Bitcoin and returns this struct of data:

    struct CoinInfo {
    uint256 price;
    uint256 supply;
    uint256 lastUpdateTimestamp;
    string symbol;
    }

    The following snippet shows how to retrieve the BTC price of an asset (e.g. BNB Coin) using a smart contract.

    pragma solidity ^0.4.24;

    contract DiaOracle {
    address owner;

    struct CoinInfo {
    uint256 price;
    uint256 supply;
    uint256 lastUpdateTimestamp;
    string symbol;
    }

    mapping(string => CoinInfo) diaOracles;

    event newCoinInfo(
    string name,
    string symbol,
    uint256 price,
    uint256 supply,
    uint256 lastUpdateTimestamp
    );

    constructor() public {
    owner = msg.sender;
    }

    function changeOwner(address newOwner) public {
    require(msg.sender == owner);
    owner = newOwner;
    }

    function updateCoinInfo(string name, string symbol, uint256 newPrice, uint256 newSupply, uint256 newTimestamp) public {
    require(msg.sender == owner);
    diaOracles[name] = (CoinInfo(newPrice, newSupply, newTimestamp, symbol));
    emit newCoinInfo(name, symbol, newPrice, newSupply, newTimestamp);
    }

    function getCoinInfo(string name) public view returns (uint256, uint256, uint256, string) {
    return (
    diaOracles[name].price,
    diaOracles[name].supply,
    diaOracles[name].lastUpdateTimestamp,
    diaOracles[name].symbol
    );
    }
    }

    contract DiaAssetBtcOracle {
    DiaOracle oracle;
    address owner;

    constructor() public {
    owner = msg.sender;
    }

    function setOracleAddress(address _address) public {
    require(msg.sender == owner);
    oracle = DiaOracle(_address);
    }

    function getAssetEurRate(string asset) constant public returns (uint256) {
    (uint assetPrice,,,) = oracle.getCoinInfo(asset);
    (uint btcPrice,,,) = oracle.getCoinInfo("Bitcoin");
    return (assetPrice * 100000 / btcPrice);
    }

    }

    Deployed Addresses

    Chain nameOracle Contract AddressUpdate Frequency
    BSC: Testnet0xf35bEE4B6727D2D1c9167C5fB4D51855D6bB693c1/day
    BSC: Mainnet0xf35bEE4B6727D2D1c9167C5fB4D51855D6bB693c1/day

    The full documentation of the DIA oracle is located here.

    - + diff --git a/docs/dstorages.html b/docs/dstorages.html index efd8f65a57..9221d202c2 100644 --- a/docs/dstorages.html +++ b/docs/dstorages.html @@ -8,13 +8,13 @@ - +

    Decentralized Storage

    Decentralized storage system enable users to store their data in a peer-to-peer distributed network which consists of operators across different locations. Comparing with centralized storage, it offers more control, privacy as well as security over the user's own data. Further more, decentralized storage is more resilient since there is no single point of failure of the storage.

    Following is the list of decentralized Storage protocols or networks that you can used with BNB Chain.

    • IPFS: The InterPlanetary File System (IPFS) is a distributed file system allows users to store and access verifiable and content-addressable data in a peer-to-peer network.. It is a distributed protocol designed to preserve and grow humanity's knowledge by making the web upgradeable, resilient and more open.
    • Filecoin: Filecoin is a peer-to-peer network that stores files, with built-in economic incentives to ensure files are stored reliably over time. Filecoin combines the benefits of storage on IPFS with blockchain-powered verifiability and persistency. The network offers robust and resilient distributed storage at massively lower cost compared to current centralized alternatives.
    - + diff --git a/docs/encoding.html b/docs/encoding.html index 67823a6312..db2871b92c 100644 --- a/docs/encoding.html +++ b/docs/encoding.html @@ -8,13 +8,13 @@ - +

    BNB Beacon Chain Transaction Encoding Specification

    BNB Beacon Chain transactions are protocol-based data types and can only be submitted in a compatible encoded frame.

    The fundamental encoding logic is from Tendermint Amino, which derives from and is "largely compatible with" Google protocol-buffer's Proto3.

    However, the client sides only needs to stick to the specifications outlined below for the most frequently used transactions.

    Encoding Output

    BNB Beacon Chain (Amino) encoding logic may encode a data structure into two output formats: Binary and JSON.

    JSON Marshal

    Amino supports JSON encoding natively, which is the same as other usual json marshalers. Except that it can add one more type info for registered type, as shown below.

    {
    "type": "<amino type name>",
    "value": <JSON>
    }

    Binary Marshal

    Please note the below binary encoding logic is subjected to future changes. Please watch out for the community news.

    Binary encoding is a variant of Google's protobuf. The bytes are laid out in the below sequence:

    1. a varint encoded integer - it contains the length of the encoded bytes for the object, which is displayed as SIZE-OF-ENCODED in the below structs. Please note that it contains the length of encoded bytes and also the type prefix (below), but not itself, e.g. if the encoded msg is 20 bytes, then the length would be 20 + 4 = 24, while 4 is used for the type prefix bytes.
    2. an object type prefix of 4-8 bytes - For different type of objects, there will be different type prefixes, and they are displayed as in the specific objects below (data structures).
    3. a binary encoded object - the encoding is mostly the same as protocol buffer encoding mechanism, except the embedded fields of complex type:
      • to encode data field of some specific types, an object type prefix for the field will be added ahead of the real encoding.
    4. repeated (array) Encoding - it is the same as google protocol buffer, while encoding of the object/struct may contain the type prefix as shown below.

    BNB Beacon Chain Transaction Encoding

    Below are the data types that can be sent to BNB Beacon Chain as requests, and their encoding layout. To simplify the presentation, we will use a variant of Google protocol buffer proto3 language to illustrate how the data fields are organized. Except the all-capitalized fields, other fields will use the default proto3 encoding logic.

    Standard Transaction

    Transactions are each wrapped in the below "Standard Transaction": structure:

    // please note the field name is the JSON name.
    message StdTx {
    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding, please note this includes both the below type prefix (4 bytes) and the all encoding bytes
    0xF0625DEE // hardcoded, object type prefix in 4 bytes
    repeated Msg msgs // array of size 1, containing the transaction message, which are one of the transaction types below. please check the above "Array Encoding"
    repeated StdSignature signatures // array of size 1, containing the standard signature structure of the transaction sender
    string memo // a short sentence of remark for the transaction. Please only `Transfer` transaction allows 'memo' input, and other transactions with non-empty `Memo` will be rejected.
    int64 source // an identifier for tools triggerring this transaction, set to zero if unwilling to disclose.
    bytes data // byte array, reserved for future use
    }

    StdSignBytes

    type StdSignDoc struct {
    AccountNumber int64 `json:"account_number"`
    ChainID string `json:"chain_id"`
    Memo string `json:"memo"`
    Msgs []json.RawMessage `json:"msgs"`
    Sequence int64 `json:"sequence"`
    Source int64 `json:"source"`
    Data []byte `json:"data"`
    }

    Canonical Bytes for Signing

    A transaction signature is not formed from the Amino-encoded transaction bytes themselves. Rather, a canonical representation of the transaction is generated in JSON format for signing.

    This would allow for clients to sign a transaction off-chain, for example, with a hardware HSM device like a Ledger, or within a micro-service in an algorithmic trading system. An external system will not have to understand Amino encoding to be able to approve of the transaction's content and produce the signed JSON string.

    The canonical bytes for signing are generated from the StdSignBytes method. It produces a JSON string similar to the format below (formatted for clarity):

    {
    "sequence" : "64",
    "account_number" : "12",
    "data" : null,
    "chain_id" : "chain-bnb",
    "memo" : "smiley",
    "msgs" : [
    {
    "inputs" : [
    {
    "coins" : [
    {
    "denom" : "BNB",
    "amount" : "200000000"
    }
    ],
    "address" : "bnc1hgm0p7khfk85zpz5v0j8wnej3a90w7098fpxyh"
    }
    ],
    "outputs" : [
    {
    "address" : "bnc1cku54wwn66w2rkgs3h6v5zxrwtzyew8chcl720",
    "coins" : [
    {
    "denom" : "BNB",
    "amount" : "200000000"
    }
    ]
    }
    ]
    }
    ],
    "source" : "1"
    }

    This JSON string, with all whitespace removed and keys sorted in alphabetical order, is signed with the private key of the sender. This signature is then attached to the StdTx structure described in the above section. Please note that the transaction broadcasted to the blockchain is not JSON - the JSON is merely used as a canonical representation to generate the signature.

    The next section describes how the generated signature is attached to a transaction.

    Standard Signature

    The sender's signature is stored in the Standard Transaction data via a Standard Signature, as shown below. This structure is included in the StdTx (see above).

    Please note that StdSignature itself doesn't have type prefix, while the PubKey does.

    message StdSignature {
    uint64 SIZE-OF-ENCODED // varint encoded length of the structure after encoding
    // please note there is no type prefix for StdSignature
    message PubKey {
    0xEB5AE987 // hardcoded, object type prefix in 4 bytes
    uint64 SIZE-OF-ENCODED // varint encoded length of the bytes below
    bytes // no name or field id, just encode the bytes
    }
    PubKey pub_key // public key bytes of the signer address
    bytes signature // signature bytes, please check the chain access section for signature generation
    int64 account_number // another identifier of signer, which can be read from chain by account REST API or RPC
    int64 sequence // sequence number for the next transaction of the client, which can be read from the chain by account REST API or RPC. Please check the chain access section for details.
    }

    Message Types

    Messages represent the individual operations possible on BNB Beacon Chain, and these can be inserted into the StdTx.msgs field. Message types are otherwise known as "transaction types", and these terms are used interchangebly in this document and in our technical documentation. So far every StdTx transaction "container" can only contain one "message".

    Transfer

    Transfer is the transaction used for transferring funds to different addresses.

    // please note the field name is the JSON name.
    message Send {
    0x2A2C87FA // hardcoded, object type prefix in 4 bytes
    message Token {
    string denom
    int64 amount
    }
    message Input {
    bytes address
    repeated Token coins
    }
    message Output {
    bytes address
    repeated Token coins
    }
    repeated Input inputs
    repeated Output outputs
    }

    Freeze

    Freeze transaction will move the amount of the tokens into a frozen state, in which they cannot be used for transfers or sending new orders.

    // please note the field name is the JSON name.
    message TokenFreeze {
    0xE774B32D // hardcoded, object type prefix in 4 bytes
    bytes from // owner address
    string symbol // token symbol, in full name with "-" suffix
    int64 amount // amount of tokens to freeze
    }

    Unfreeze

    Unfreeze will reversely turn the amount of frozen tokens back to free state.

    // please note the field name is the JSON name.
    message TokenUnfreeze {
    0x6515FF0D // hardcoded, object type prefix in 4 bytes
    bytes from // owner address
    string symbol // token symbol, in full name with "-" suffix
    int64 amount // amount of tokens to unfreeze
    }

    Vote

    Vote transactions for proposals.

    // please note the field name is the JSON name.
    message Vote {
    0xA1CADD36 // hardcoded, object type prefix in 4 bytes
    int64 proposal_id // ID of the proposal
    bytes voter // address of the voter
    uint64 option // option from OptionSet chosen by the voter
    }

    Below are options for option:

    OptionYes           = 0x01  // yes
    OptionAbstain = 0x02 // abstain
    OptionNo = 0x03 // no
    OptionNoWithVeto = 0x04 // no with veto

    Issue

    Issue (create) new asset on BNB Beacon Chain.

    message IssueTokenValue  {
    0x17EFAB80 // hardcoded, object type prefix in 4 bytes
    bytes from // issuer's address
    string name // token name
    string symbol // token symbol
    string total_supply // total supply
    bool mintable // is mintable
    }

    Mint

    Mint is used to increase the total supply of a token.

    message Mint {
    0x467E0829 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string symbol string // token symbol
    int64 amount // increase amount
    }

    Burn

    Burn is used to decrease the total supply of a token.

    message TokenBurn {
    0x7ED2D2A0 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string symbol string // token symbol
    int64 amount // increase amount
    }

    Submit Proposal

    Submit proposal is used to create a proposal for validators about adding trading pairs

    message Submit{
    0xB42D614E // hardcoded, object type prefix in 4 bytes
    string title // Title of the proposal
    string description // Description of the proposal
    byte proposal_type // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal,ListTradingPair, FixedFeeParams}
    bytes proposer // Address of the proposer
    message Coin {
    string denom
    int64 amount
    }
    int64 VotingPeriod // Length of the voting period (s)
    }

    Deposit

    Deposit is used to increase the total deposit of a proposal.

    message Deposit{
    0xA18A56E5 // hardcoded, object type prefix in 4 bytes
    int64 ProposalID // ID of the proposal
    bytes Depositer // Address of the depositer
    message Coin {
    string denom
    int64 amount
    }
    }

    Set Account Flags

    You can set the flag value of your account.

    message SetAccountFlags{
    0xBEA6E301 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 flag // account flag
    }

    Time-lock

    You can only lock tokens on your own account for a certain period of time.

    message Timerelock{
    0x07921531 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    string description // Description of the lock
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    int64 lock_time // lock time
    }

    Time-unlock

    You can unlock tokens on your own account after a certain period of time.

    message Timeunlock{
    0xC4050C6C // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 id // lock time id
    }

    Time-relock

    You can relock tokens on your own account after a certain period of time.

    message Timerelock{
    0x504711DA // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    int64 Id // lock time id
    string description // Description of the lock
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    int64 lock_time // lock time
    }

    HTLT

    Hash Timer Locked Transfer (HTLT) is a new transaction type on BNB Beacon Chain, to serve as HTLC in the first step of Atomic Swap

    message HTLT{
    0xB33F9A24 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes to // receiver's address
    string recipient_other_chain
    string sender_other_chain
    bytes random_number_hash
    int64 timestamp
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    string expected_income
    int64 height_span
    bool cross_chain
    }

    Deposit HTLT

    Deposit Hash Timer Locked Transfer is to lock new BEP2 asset to an existed HTLT which is for single chain atomic swap.

    message DepositHTLT{
    0x63986496 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    message Coin {
    string denom
    int64 amount
    }
    repeated Coin amount
    bytes swap_id
    }

    Claim HTLT

    Claim Hash Timer Locked Transfer is to claim the locked asset by showing the random number value that matches the hash. Each HTLT locked asset is guaranteed to be release once.

    message ClaimHTLTMsg{
    0xC1665300 // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes swap_id
    bytes random_number
    }

    Refund HTLT

    Refund Hash Timer Locked Transfer is to refund the locked asset after timelock is expired.

    message RefundHTLTMsg{
    0x3454A27C // hardcoded, object type prefix in 4 bytes
    bytes from // sender's address
    bytes swap_id
    - + diff --git a/docs/faq.html b/docs/faq.html index ab0c653cb2..37819291f2 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -8,7 +8,7 @@ - + @@ -17,10 +17,10 @@ img

    :::warn Make sure it’s offered by BNB Chain :::

    1. Click on “Add to Firefox” -img

    That’s it! You have successfully installed the Binance Chain Wallet extension in Firefox!

    Binance Wallet Mobile: Binance Mobile is a secure and trusted multi-chain wallet. It is your one-stop gateway to store, exchange and earn crypto.

    How to stay safe

    Wallets are a bit of a shift in thinking. Financial freedom and the ability to access and use funds anywhere comes with a bit of responsibility – there’s no customer support in crypto.

    Take responsibility for your own funds

    Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. Just remember you’re trusting that exchange with custody over your funds. If that company is attacked or folds, your funds are at risk.

    Write down your seed phrase

    Wallets will often give you a seed phrase that you must write down somewhere safe. This is the only way you’ll be able to recover your wallet.

    Here's an example:

    there aeroplane curve vent formation doge possible product distinct under spirit lamp

    Don’t store it on a computer. Write it down and keep it safe.

    Do Your Own Research

    If you use a web wallet, bookmark the site to protect yourself against phishing scams.

    Remember transactions can’t be reversed and wallets can’t be easily recovered so take care.

    Tokens not visible after withdrawing from Binance

    Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like MetaMask. So once you've used their withdraw form, what could be scarier than not seeing your tokens?

    First, you'll need to use the MetaMask add Custom Network feature to add the BNB Beacon Chain or BNB Smart Chain's RPC URLs endpoints to your MetaMask.

    Once you've added the BNB Beacon Chain or the BNB Smart Chain to your MetaMask, you will be able to select different networks to view the assets (you may need to add Custom Tokens too) held by your selected account on that network.

    How Much BNB You Need To Send Tokens

    if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee.

    You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction.

    A standard Ether transfer TX will be 21000 gas & a gas price of 15 Gwei. +img

    That’s it! You have successfully installed the BNB Chain Wallet extension in Firefox!

    Binance Wallet Mobile: Binance Mobile is a secure and trusted multi-chain wallet. It is your one-stop gateway to store, exchange and earn crypto.

    How to stay safe

    Wallets are a bit of a shift in thinking. Financial freedom and the ability to access and use funds anywhere comes with a bit of responsibility – there’s no customer support in crypto.

    Take responsibility for your own funds

    Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. Just remember you’re trusting that exchange with custody over your funds. If that company is attacked or folds, your funds are at risk.

    Write down your seed phrase

    Wallets will often give you a seed phrase that you must write down somewhere safe. This is the only way you’ll be able to recover your wallet.

    Here's an example:

    there aeroplane curve vent formation doge possible product distinct under spirit lamp

    Don’t store it on a computer. Write it down and keep it safe.

    Do Your Own Research

    If you use a web wallet, bookmark the site to protect yourself against phishing scams.

    Remember transactions can’t be reversed and wallets can’t be easily recovered so take care.

    Tokens not visible after withdrawing from Binance

    Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like MetaMask. So once you've used their withdraw form, what could be scarier than not seeing your tokens?

    First, you'll need to use the MetaMask add Custom Network feature to add the BNB Beacon Chain or BNB Smart Chain's RPC URLs endpoints to your MetaMask.

    Once you've added the BNB Beacon Chain or the BNB Smart Chain to your MetaMask, you will be able to select different networks to view the assets (you may need to add Custom Tokens too) held by your selected account on that network.

    How Much BNB You Need To Send Tokens

    if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee.

    You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction.

    A standard Ether transfer TX will be 21000 gas & a gas price of 15 Gwei. With tokens, the amount of gas is typically gas, so the total TX fee increases to 0.002 BNB - 0.003 BNB.

    Current Gas Price

    curl --location --request POST 'https://bsc-dataseed2.bnbchain.org' \
    --header 'Content-Type: application/json' \
    --data-raw '{"jsonrpc":"2.0", "id":1, "method":"eth_gasPrice", "params": []}'

    How to Reveal Your Seed Phrase

    When dealing with cryptocurrencies or crypto assets like BNB or BUSD, it is important to always be aware of and have your private keys, seed phrases and passwords backed up in case the unexpected occurs.

    What do i do if i lost/forgot my Seed Phrase?

    1. Seed phrase is only made known to user directly. In the event that is lost, there is no way of recovering it.

      • We do advice to user to safeguard their seed phrase and do not share with anyone.

      • If you login from public/shared computer or laptop, please make sure to "Lock" the wallet before walking off.

    2. There are multiple login options made available to user : do leverage these options as well.

      a. Safulet

      b. tKey

    3. Recovering of seed phrase is possible only if you are able to login to your account.

      • Login to your account.

      • Access account details on the top right corner.

      • Click on "Settings".

      • View "Seed Phrase".

    Important Note: Keeping your seed phrases safe is of paramount importance. If they are stolen or lost, your assets cannot be recovered.

    Backing Up When Installing

    When you create a new Binance Extension Wallet account, you are given your 12 word seed phrase is the most important bit of information for you to record and keep safe when managing your extension account.

    You can write your seed phrase down on a piece of paper, store it on a flash drive or we also make it optional to download a file containing this information.

    img

    Backing Up After You Install Binance Extension Wallet

    If for some reason you forgot to record your 12 word seed phrase or you lost the original copy, you can reveal your seed phrase so you can back it up again.

    Select Dropdown Menu (on top-right corner) --> Manage Accounts

    img

    click on Download button

    img

    Enter your password to reveal your seed words.

    img

    How to Reset My Password or Import an Account

    When resetting your password for your Binance Extension wallet, you will need your 12 or 24 word seed phrase. If you do not already have your seed phrase saved someplace safe, please make sure to read How to Reveal Your Seed Phrase.

    Before trying these steps, confirm that you have your seed phrase with you as you will not be able to reset your password otherwise and will risk becoming locked out of your wallet.

    1. If your wallet is currently unlocked, please lock your wallet first.
    2. Click Import Import seed phrase

    img

    1. Enter your seed phrase in the "Seed Phrase" text box
    2. Enter your new password
    3. Retype your password to confirm it was written correctly
    4. Click Reset

    img

    Which network does BEW support?

    • BNB Beacon Chain (BEP2)
    • BNB Smart Chain (BEP20)
    • Ethereum (ERC20)

    Why my Tokens are not visible?

    !!! Note : By default each wallet/network will shows the the main token they support. You will need to add additional token to your list.

    For Binance Extension Wallet users You'll need to switch to BNB Beacon Chain Mainnet (BC) mainnet or BNB Smart Chain (BSC) mainnet

    Once you've added the asset to your wallet, you will be able to select different networks to view the assets held by your selected account on that network.

    For Metamask wallet users

    You'll need to add BNB Smart Chain (BSC) mainnet network, refer here for more details.

    Then add tokens manually: https://docs.yearn.finance/how-to-guides/how-to-add-a-custom-token-to-metamask

    How much BNB you need for sending tokens?

    A standard Ether transfer TX will be 21000 gas & a gas price of 5 GWEI. With tokens, the amount of gas is typically gas, so the total TX fee increases to 0.0005 BNB - 0.0007 BNB.

    if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee.

    You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction.

    How to Recover Crypto Transferred to the Wrong Network on Binance?

    Please read this article

    Extension Wallet Update: Chrome

    It is crucial that you always have the latest wallet version installed. If you know that a new version of an extension is out but Chrome hasn’t updated it, here’s how to do it manually.

    1. Start Google Chrome.

    2. Click the vertical ellipsis icon on the browser toolbar.

    3. Click on "Extensions" -> "Manage Extensions".

    4. Click the Developer Mode button on the right side of the header

    5. From there, you should see the “Update” button below the search bar. Click on it to update the extensions.

    Extension Wallet Update : Firefox

    It is crucial that you have the latest version installed.

    1. Click the menu button, click "Add-ons and Themes" and select "Extensions".

    2. Click the gear icon in the upper-right area of the Extensions panel.

    3. Choose one of the options below:

      • Check for Updates: Allows you to check for any updates to your add-ons manually. If there is an update available, you have the option to choose to update it now or later.
      • View Recent Updates: When you click this option, a Recent Updates panel appears on the left, showing your last updated add-ons.
      • Update Add-ons Automatically: If you want to keep your add-ons up to date, select this option to let them update automatically.
      • Reset All Add-ons to Update Automatically: If any add-ons have been set to update manually, clicking this option will reset all add-ons to update automatically.

    Why are Tokens not visible after withdrawing from Binance?

    Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like Binance Extension wallet or MetaMask. So once you've used their withdrawal form, what could be scarier than not seeing your tokens?

    First, you'll need to use BNB Beacon Chain Mainnet (BC) mainnet or BNB Smart Chain (BSC) mainnet

    Once you've added the asset to your wallet, you will be able to select different networks to view the assets held by your selected account on that network.

    Can I use Extension wallet for Binance DEX

    No, you cannot now. The support will be added in future release.

    How to Recover funds send to Ethereum network

    If the fund is sent to one of your existing accounts, please

    • Switch to Ethereum network
    • Add your asset
    • Then you should see your tokens in asset list.

    If it's sent to accounts in a different wallet, please

    • Export seed phrase of this account
    • Recover your account in Binance Extension Wallet
    • Switch to Ethereum network
    • Add your asset
    • Then you should see your tokens in asset list.

    Why should I use Wallet Direct?

    • Seamless Token Transfer: Transfer tokens (which support BNB Beacon Chain, BNB Smart Chain and Ethereum) between paired Binance.com account and Binance Extension Wallet. Without the trouble of copy/paste address and memo every time

    • BNB Holding: The BNB positions of your Binance.com account will not change.

    Common issues with Ledger Account

    1. Wallet direct does not support Ledger account at the moment.

    2. Binance DEX still supports Ledger. However, it is recommended to use BEW if you encounter issues when using Ledger.

    • Install our BEW extension on your browser and login with your BEW wallet account.

    • Import ledger to your BEW account.

    • Use BEW for your transactions.

    1. Alternatively, you can also reach out to Ledger for support via https://support.ledger.com/hc/en-us/categories/4404369571601-Support?support=true .

    How can dApp connect with BEW?

    Please read this doc: https://binance-wallet.gitbook.io/binance-chain-wallet/bew-guides/dapp-interaction

    How to get support about technical issue on full node?

    Join our node support discord channel

    - + diff --git a/docs/fullnodeissue.html b/docs/fullnodeissue.html index cd42225c34..0f337bd2ea 100644 --- a/docs/fullnodeissue.html +++ b/docs/fullnodeissue.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ To reset node:

    rm $BNCHOME/data

    rm $BNCHOME/config/priv_validator_key.json

    Then, start again.

    Peer connection error

    • Error log:
    E[2019-04-17|23:52:24.069] Connection failed @ recvRoutine (reading byte) module=p2p peer=[aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146](http://aea74b16d28d06cbfbb1179c177e8cd71315cce4@54.64.99.130:27146)conn=MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} err=EOF
    E[2019-04-17|23:52:24.070] Stopping peer for error module=p2p peer=&quot;Peer{MConn{[52.199.237.19:27146](http://52.199.237.19:27146)} aea74b16d28d06cbfbb1179c177e8cd71315cce4 out}&quot; err=EOF

    This error is caused by the handshake failing between two peers.

    • Solution

    To solve this problem, you need to make sure node_key.json is under $BNCHOME/config and nodes will try to re-connect automatically, so this issue should not persist.

    Connection Timeout

    • Error log
    Dialing failed module=pex addr=2c1fa9c1698961da38d8cd50da9fe8b4bc433c50@34.202.245.91:26856 err=&quot;dial tcp 34.202.245.91:26856: i/o timeout&quot; attempts=3
    • Solution

    Check your internet connection and make sure it is stable.

    Out of Memory

    • Error Log
    fatal error: out of memory
    • Solution

    Your machine must have more than 8 GB of memory, otherwise, it will not handle DB restoration during state sync.

    No priv_validator_state.json After Reset

    • Error log
    open /Users/.bnbchaind/data/priv_validator_state.json: no such file or directory
    • Solution

    Delete both priv_validator_state.json & node_key.json file and data folder if you want to reset your full node.

    bnbchaind Crashes Because of too many open files

    The default number of files Linux can open (per-process) is 1024.
    bnbchaind is likely to open more than 1024 files.
    This causes the process to crash.

    A quick fix is to run ulimit -n 65535 (increase the number of open files allowed) and then restart the process with:

    bnbchaind start

    Verify the number of open files:

    ulimit -a
    core file size (blocks, -c) 0
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 0
    file size (blocks, -f) unlimited
    pending signals (-i) 3829
    max locked memory (kbytes, -l) 64
    max memory size (kbytes, -m) unlimited
    open files (-n) 65535
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 8192
    cpu time (seconds, -t) unlimited
    max user processes (-u) 3829
    virtual memory (kbytes, -v) unlimited
    file locks (-x) unlimited

    Please note that open files are different now.

    Forgot to Upgrade

    The BNB Beacon Chain has a hardfork upgrade and if you failed to upgrade your fullnode to the latest version, bnbchaind process will stop and even if you restart with the latest version, the following error will appear:

    panic: Tendermint state.AppHash does not match AppHash after replay. Got , expected 393887B67F69B19CAB5C48FB87B4966018ABA893FB3FFD241C0A94D2C8668DD2
    goroutine 1 [running]:
    github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.checkAppHash(0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, 0x20, ...)
    /Users/huangsuyu/go/src/github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus/replay.go:464 +0x213
    github.com/bnb-chain/node/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc000b37980, 0xa, 0x0, 0xc000bd8c56, 0x6, 0xc000b247c0, 0x12, 0x14e7bf9, 0x8592eb, 0xc000b247e0, ...)

    To recover from the state conflict error, you need to:

    • Backup your home directory, (default is ~/.bnbchaind)

    • Download the tool: state-recover

    • Get the height of upgrade, this height will be announced in the upgrade announcement on the forum. For example, if it's announced as 5000 in the forum and run the following command will make your full node recover to the last block before the upgrade, and that is 4999 :

    ./state_recover 4999 <your_home_path>
    • Restart with the latest version of bnbchaind
    bnbchaind start &

    bnbchaind is Not Properly Killed

    If you started your bnbchaind process after it was not properly killed. You will see the following error:

    panic: ERROR:
    Codespace: 5
    Code: 9
    Message: "Initial ProposalID already set"

    To recover, please reset your node and restart:

    bnbchaind unsafe-reset-all --home<your-home-dir>

    Cannot Start bnbchaind

    If you do not download the binaries completely, you will see the following message:

    ./bnbchaind: line 1: version: command not found ./bnbchaind: line 2: oid: command not found /Library/Developer/CommandLineTools/usr/bin/size: 45160816 No such file or directory

    Since all the binaries are stored in git lfs, you will see this error is the binary is not complete. Please download the latest binaries from https://github.com/bnb-chain/node/releases.

    Cannot Query a Specific Block

    Once you have your own node running, you can start querying from it. But sometimes you may not be ablt to get the information you want. For example:

    curl 'localhost:27147/block?height=10'

    The reason is because your node is using statesync to catch up. In this way, it will not store all the history blocks before the snapshot height it got. You can only query blocks after that snapshot height.

    To enable query history blocks, you need to use fast-sync

    - + diff --git a/docs/get-extra-data-from-fullnode.html b/docs/get-extra-data-from-fullnode.html index 0cf7ee8df6..6d25482494 100644 --- a/docs/get-extra-data-from-fullnode.html +++ b/docs/get-extra-data-from-fullnode.html @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ Then, the full node will save messages that you are interested into Kafka, and you can consume them in your own apps.
    The message is encoded based on Avro serialization system.
    Their schemas are shown below:

    • OrderUpdates:
    {
    "type": "record",
    "name": "ExecutionResults",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "height", "type": "long" },
    { "name": "timestamp", "type": "long" },
    { "name": "numOfMsgs", "type": "int" },
    { "name": "trades", "type": ["null", {
    "type": "record",
    "name": "Trades",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "trades", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Trade",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "symbol", "type": "string" },
    { "name": "id", "type": "string" },
    { "name": "price", "type": "long" },
    { "name": "qty", "type": "long" },
    { "name": "sid", "type": "string" },
    { "name": "bid", "type": "string" },
    { "name": "sfee", "type": "string" },
    { "name": "bfee", "type": "string" },
    { "name": "saddr", "type": "string" },
    { "name": "baddr", "type": "string" }
    ]
    }
    }
    }
    ]
    }], "default": null },
    { "name": "orders", "type": ["null", {
    "type": "record",
    "name": "Orders",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "orders", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Order",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "symbol", "type": "string" },
    { "name": "status", "type": "string" },
    { "name": "orderId", "type": "string" },
    { "name": "tradeId", "type": "string" },
    { "name": "owner", "type": "string" },
    { "name": "side", "type": "int" },
    { "name": "orderType", "type": "int" },
    { "name": "price", "type": "long" },
    { "name": "qty", "type": "long" },
    { "name": "lastExecutedPrice", "type": "long" },
    { "name": "lastExecutedQty", "type": "long" },
    { "name": "cumQty", "type": "long" },
    { "name": "fee", "type": "string" },
    { "name": "orderCreationTime", "type": "long" },
    { "name": "transactionTime", "type": "long" },
    { "name": "timeInForce", "type": "int" },
    { "name": "currentExecutionType", "type": "string" },
    { "name": "txHash", "type": "string" }
    ]
    }
    }
    }
    ]
    }], "default": null },
    { "name": "proposals", "type": ["null", {
    "type": "record",
    "name": "Proposals",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "proposals", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Proposal",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "id", "type": "long" },
    { "name": "status", "type": "string" }
    ]
    }
    }
    }
    ]
    }], "default": null },
    { "name": "stakeUpdates", "type": ["null", {
    "type": "record",
    "name": "StakeUpdates",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "numOfMsgs", "type": "int" },
    { "name": "completedUnbondingDelegations", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "CompletedUnbondingDelegation",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "validator", "type": "string" },
    { "name": "delegator", "type": "string" },
    { "name": "amount", "type": {
    "type": "record",
    "name": "Coin",
    "namespace": "org.binance.dex.model.avro",
    "fields": [
    { "name": "denom", "type": "string" },
    { "name": "amount", "type": "long" }
    ]
    }
    }
    ]
    }
    }
    }
    ]
    }], "default": null }
    ]
    }
    • OrderBooksSchema:
    {
    "type": "record",
    "name": "Books",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long" },
    { "name": "timestamp", "type": "long" },
    { "name": "numOfMsgs", "type": "int" },
    { "name": "books", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "OrderBookDelta",
    "namespace": "com.company",
    "fields": [
    { "name": "symbol", "type": "string" },
    { "name": "buys", "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "PriceLevel",
    "namespace": "com.company",
    "fields": [
    { "name": "price", "type": "long" },
    { "name": "lastQty", "type": "long" }
    ]
    }
    } },
    { "name": "sells", "type": {
    "type": "array",
    "items": "com.company.PriceLevel"
    } }
    ]
    }
    }, "default": []
    }
    ]
    }
    • AccountBalanceSchema:
    {
    "type": "record",
    "name": "Accounts",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long" },
    { "name": "numOfMsgs", "type": "int" },
    { "name": "accounts", "type": {
    "type": "array",
    "items":
    {
    "type": "record",
    "name": "Account",
    "namespace": "com.company",
    "fields": [
    { "name": "owner", "type": "string" },
    { "name": "fee", "type": "string" },
    { "name": "balances", "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "AssetBalance",
    "namespace": "com.company",
    "fields": [
    { "name": "asset", "type": "string" },
    { "name": "free", "type": "long" },
    { "name": "frozen", "type": "long" },
    { "name": "locked", "type": "long" }
    ]
    }
    }
    }
    ]
    }
    }, "default": []
    }
    ]
    }

    • BlockFeeSchema:
    {
    "type": "record",
    "name": "BlockFee",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long"},
    { "name": "fee", "type": "string"},
    { "name": "validators", "type": { "type": "array", "items": "string" }}
    ]
    }
    • TransfersSchema:
    {
    "type": "record",
    "name": "Transfers",
    "namespace": "com.company",
    "fields": [
    { "name": "height", "type": "long"},
    { "name": "num", "type": "int" },
    { "name": "timestamp", "type": "long" },
    { "name": "transfers",
    "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "Transfer",
    "namespace": "com.company",
    "fields": [
    { "name": "txhash", "type": "string" },
    { "name": "from", "type": "string" },
    { "name": "to",
    "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "Receiver",
    "namespace": "com.company",
    "fields": [
    { "name": "addr", "type": "string" },
    { "name": "coins",
    "type": {
    "type": "array",
    "items": {
    "type": "record",
    "name": "Coin",
    "namespace": "com.company",
    "fields": [
    { "name": "denom", "type": "string" },
    { "name": "amount", "type": "long" }
    ]
    }
    }
    }
    ]
    }
    }
    }
    ]
    }
    }
    }
    ]
    }
    - + diff --git a/docs/getting-started.html b/docs/getting-started.html index 88037403dc..9bbb56a91b 100644 --- a/docs/getting-started.html +++ b/docs/getting-started.html @@ -8,14 +8,14 @@ - +

    Getting Started

    This document serve as a starting point for new users to the BNB Chain ecosystem. General knowledge of cryptocurrency is assumed, and in particular familiarity with the Ethereum ecosystem. If you don't understand something right away, that's OK. Search for an answer online, and if you don't find it, ask on our Discord.

    What can users do with BNB Smart Chain (BSC)?

    BNB Smart Chain (BSC) is the blockchain component of the BNB Chain ecosystem that is equipped with the smart contract functionality and compatibility with the Ethereum Virtual Machine (EVM) and is used for developing various kinds of decentralized applications. The design goal of BSC was to leave the high throughput of BNB Beacon Chain intact while introducing smart contracts into the BNB Chain ecosystem. Being EVM-compatible, other than easy portability, BSC enjoys support of the rich universe of Ethereum tools and dApps

    Tokenization

    On the BNB Smart Chain, users can:

    BNB Token and Fees

    BNB is the cryptocurrency coin that powers the BNB Chain ecosystem. As one of the world's most popular utility tokens, not only can you trade BNB like any other cryptocurrency, you can also use BNB in a wide range of applications and use cases.

    Although initially based on the Ethereum network, the ERC-20 BNB tokens were later swapped with BEP-2 BNB at a 1:1 ratio. The BEP-2 BNB is the native coin of the BNB Beacon Chain, and the mainnet.

    In 2020, the BNB Smart Chain (BSC) was launched. BSC is a blockchain network that runs in parallel with the BNB Beacon Chain. This means that BNB can be found in three different forms:

    • BNB BEP-2 on the BNB Beacon Chain.
    • BNB BEP-20 on the BNB Smart Chain.
    • BNB ERC-20 on the Ethereum network.

    How to Buy BNB Tokens

    As all fees on BNB Chain are paid in BNB, therefore, in order to interact with the BNB Smart Chain network you will need to have some BNB tokens.

    • BNB tokens can also be received for usage on testnet through the Testnet Faucet.
    • Refer here for tutorials on different wallets for use with BNB Chain to send/receive/purchase BNB Tokens.

    Extensive Support of Wallets

    For a list of tutorials on how to use other supported wallets with BNB Smart Chain, refer here.

    Using Blockchain Explorers

    Explore the transaction history, blocks on the chain check different asset types, the distribution of their ownerships, and owners' transactions, etc. via the use of explorers. Refer here for a complete list.

    Building dApps

    BSC empowers developers to build dApps of different kinds. Below is a list of tutorials on how to develop smart contracts using IDEs

    Migrate your dApps to BSC

    • Migrate your existing dApps from other blockchains to BSC

    Node RPC

    There are data seed nodes in the network which allow users to perform low-level operations like executing ABCI queries, viewing network/consensus state or broadcasting a transaction. If you run a full node by yourself, you can also use RPC functions. For a list of all the Node RPC services for BNB Beacon Chain refer here and for BNB Smart Chain refer here.

    - + diff --git a/docs/greenfield/design/architecture.html b/docs/greenfield/design/architecture.html index 5cc0743a12..af2bdb0388 100644 --- a/docs/greenfield/design/architecture.html +++ b/docs/greenfield/design/architecture.html @@ -8,7 +8,7 @@ - + @@ -25,7 +25,7 @@ BSC and integrated with smart contract systems there, such as DeFi, to create new business models.

    The Trinity

    From the viewpoint of BNB Greenfield dApps, these applications can help users to create, read, and execute data on the BNB Greenfield, Greenfield SPs, and BSC, and serve a purpose to users' needs.

    From the viewpoint of BNB Greenfield Core Infrastructure, they accept requests and observations from the Greenfield dApps on behalf of the users, and also instructions from BSC to operate together for different business scenarios.

    From the viewpoint of BSC, they can accept transferred data assets from BNB Greenfield, and provide more business scenarios via smart contracts to new types of Greenfield dApps.

    The users can interact with all parts of the trinity for different purposes directly or/and indirectly.

    - + diff --git a/docs/greenfield/design/assumptions.html b/docs/greenfield/design/assumptions.html index 9c8f25a6e9..257466e879 100644 --- a/docs/greenfield/design/assumptions.html +++ b/docs/greenfield/design/assumptions.html @@ -8,7 +8,7 @@ - + @@ -42,7 +42,7 @@ transparency. This results in the considerable design for cross-chain between BNB Greenfield and BNB Smart Chain (BSC). This should be the most important assumption and hopefully close to the truth.

    - + diff --git a/docs/greenfield/design/data-storage.html b/docs/greenfield/design/data-storage.html index f12d7fcb76..f5a712c168 100644 --- a/docs/greenfield/design/data-storage.html +++ b/docs/greenfield/design/data-storage.html @@ -8,7 +8,7 @@ - + @@ -30,7 +30,7 @@ After that, Primary SP computes a data redundancy solution for these segments based on Erasure Coding (EC). Then Primary SP or the users will select a few secondary SPs to store these segment replicas and their EC parity pieces. This data distribution communication will be done via the p2p network and REST APIs among SPs. The data redundancy setup is to ensure that even if the primary SP and a few secondary SPs become unavailable at a later time, Greenfield can still recover the full data.

    - + diff --git a/docs/greenfield/design/design-principles.html b/docs/greenfield/design/design-principles.html index a4fa6dd1e2..7550a73051 100644 --- a/docs/greenfield/design/design-principles.html +++ b/docs/greenfield/design/design-principles.html @@ -8,13 +8,13 @@ - +

    Design of the BNB Greenfield

    This section of BNB Greenfield documentation describes the general principles and considerations for the design of BNB Greenfield. It covers the architecture and functionality analysis. Although the true model innovation is at the cross-chain with BSC, the unique storage fundamentals are also important to highlight.

    Design Principles

    1. Simplicity - The design prefers this first principle over the other considerations. Simple solutions are not only easy to implement, run, maintain, and extend, but also friendly to software performance, which is a main goal of the design. For example, high computing-intensive proof, like what Filecoin adopts, is ruled out according to this principle.

    2. Upgradable and continuously evolving - Perfect system at one go is not the goal of the design. We expect the whole architecture, different components, and even this whitepaper to evolve and get improved based on the community and market feedbacks and future technology development. The infrastructure should have "just enough" establishment to develop and upgrade as time goes on.

    3. Open platform - The biggest lesson learned from the crypto industry and BNB ecosystem is that the community have the most talent and power to build more applications and infrastructure in different self-driven ways. The design should focus on the core platform and technical foundation that provide enough interface, tools, and other facilitation to the developer community to build upon them.

    4. Massive adoption - The economy targets beyond the existing BNB Chain clients, but also traditional Web2 users and developers. The system design should try to be as compatible as possible with popular Web2 and Web3 standards.

    5. Decentralization is a journey - Take the storage system as an example, there are two ends to the decentralization spectrum. On one extreme end, users have to create and store all their data on a single service supplier; on the other end, users can create and store their data on any household's computing terminal (it does not even have to be a desktop). The design will not force itself to be on the latter end right from day one. It picks up the simplest solution that moves the needle toward higher decentralization and will improve as time goes on. From this sense, the first step Greenfield goes ahead with is to provide the freedom to choose among plenty of service suppliers at any time with trivial costs because they own the data.

    img

    Decentralization Spectrum
    - + diff --git a/docs/greenfield/design/economy-of-data-assets.html b/docs/greenfield/design/economy-of-data-assets.html index 81165371c2..256dc117ed 100644 --- a/docs/greenfield/design/economy-of-data-assets.html +++ b/docs/greenfield/design/economy-of-data-assets.html @@ -8,7 +8,7 @@ - + @@ -29,7 +29,7 @@ revised from the ERC-721 standard. These NFTs have corresponding metadata information for the resources. The ownerships of the NFTs on BSC stand for the ownerships of these resources on Greenfield. As these ownerships are not transferable on Greenfield, these NFTs are not transferable on BSC.

    Cross-Chain Operating Primitives

    A few series of cross-chain primitives are defined for dApps to call to operate on these resource entities.

    It is worth highlighting that smart contracts can call these primitives in a similar way as EOAs.

    Accounts:

    • Create payment accounts on BSC

    BNB:

    • transfer bidirectionally between BSC and Greenfield among accounts (including even payment accounts)

    Bucket:

    • Create a bucket on BSC
    • Mirror bucket from Greenfield to BSC

    Object:

    • Mirror object from Greenfield to BSC
    • Create an object on BSC
    • Grant/revoke permissions of objects on BSC to accounts/groups
    • Copy objects on BSC
    • Kick off the execution of an object on BSC
    • Associate buckets to payment accounts on BSC

    Group:

    • Mirror group from Greenfield to BSC
    • Create a group on BSC
    • Change group members on BSC
    • Leave a group on BSC

    Once these primitives are called by EOA or smart contracts, the predefined events will be emitted. Greenfield Relayers should pick up these events and relay them over to Greenfield and BSC. As the change will happen asynchronously, there will be specific cross-chain packages for acknowledgments or errors, which can trigger a callback. The caller of the primitives should pay the fees upfront for cross-chain operations and also for the potential callback. More details are discussed in the Technical Specifications.

    - + diff --git a/docs/greenfield/design/greenfield-core.html b/docs/greenfield/design/greenfield-core.html index c38e99b427..1ec0ba3417 100644 --- a/docs/greenfield/design/greenfield-core.html +++ b/docs/greenfield/design/greenfield-core.html @@ -8,7 +8,7 @@ - + @@ -43,7 +43,7 @@ BitTorrent.

    More SPs are welcome to ensure decentralization and data redundancy. But too many SPs may make SPs unable to make enough to sustain the business. Greenfield has an incentive design to make a proper number of SPs available. While SPs can choose to stay with the network or leave.

    When the SPs join and leave the network, they have to follow a series of actions to ensure data redundancy for the users; otherwise, their "Service Stake" will be fined. This is achieved through the data availability challenge (described in detail in the Technical Specifications Section) and validator governance votes.

    The Pair Synergy

    Greenfield validators and SPs form a pair synergy to provide the whole storage service. Validators store the metadata and financial ledger with consensus, while SPs provide real data storage and downloading. Validators have the motivation to ensure enough good SPs to provide decent service, while users and SPs rely on a stable and decentralized Greenfield blockchain as a single source of truth on metadata.

    - + diff --git a/docs/greenfield/design/not-end-ack.html b/docs/greenfield/design/not-end-ack.html index 3806a411aa..580822dbff 100644 --- a/docs/greenfield/design/not-end-ack.html +++ b/docs/greenfield/design/not-end-ack.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Ever Evolving Design

    Many details are not covered in this Design Section. While some topics will be added and expanded in the technical specifications, some are very strategic items that shoot too far for the team to consider now.

    For example, the "execute" trait of a data object. That concept points out that some data are runnable programs. Greenfield may create a more transparent computing environment. Users are comfortable using or devoting their data to particular programs stored on Greenfield because they can verify the program, they do not have to worry about the program may change after their confirmation, and they know the program can only run with their data in a trustful environment provided by Greenfield.

    This particular function, together with other new features will be researched and studied with the future development of BNB Greenfield.

    Acknowledgement

    We'd like to especially thank the efforts and ideas from the below teams and communities (in no particular order and definitely not an exhaustive, full list). BNB Greenfield stands on these giants' shoulders to build.

    1. Ethereum

    2. Cosmos SDK

    3. Superfluid

    4. Amazon Web Services

    5. MinIO, and other open-source storage systems

    6. Filecoin, Arweave, StorJ, and other decentralized storage networks

    7. Bitcoin, and

    8. all the other folks and projects that strive for the new Web3 economy

    - + diff --git a/docs/greenfield/design/overview-x.html b/docs/greenfield/design/overview-x.html index 02f189893f..604e714661 100644 --- a/docs/greenfield/design/overview-x.html +++ b/docs/greenfield/design/overview-x.html @@ -8,13 +8,13 @@ - + - + diff --git a/docs/greenfield/design/storage-economics.html b/docs/greenfield/design/storage-economics.html index 09e6a121d4..249e4b33a5 100644 --- a/docs/greenfield/design/storage-economics.html +++ b/docs/greenfield/design/storage-economics.html @@ -8,7 +8,7 @@ - + @@ -41,7 +41,7 @@ submit challenge transactions to other SPs; and lastly, Greenfield blockchain will issue internal challenge events randomly as well.

    The challenge can be triggered by Greenfield transactions or internal events at the end of blocking. Once Greenfield validators observe such a challenge, they should run a standard off-chain check against the data from the SPs being challenged. These validators will vote for the challenge results via an aggregated multisig via an off-chain P2P network and submit them to the Greenfield blockchain. The failed result for a challenge will slash the corresponding SPs. The submitter and validators will get rewards for such challenges.

    The data that failed the challenge will not be challenged within a certain amount of time to give the SPs some time to recover.

    Another section in Technical Specifications will cover the data availability challenges in greater detail.

    Data Delete

    Users can request to delete their data objects. Greenfield will remove the metadata from the blockchain state, while the primary SP should respond to this request and drop all the replicas and redundant segments. The payment stream will be closed with a reward rebate to encourage the deletion in the future.

    - + diff --git a/docs/greenfield/faqs/storage-providers.html b/docs/greenfield/faqs/storage-providers.html index 759e184f36..d98ada538f 100644 --- a/docs/greenfield/faqs/storage-providers.html +++ b/docs/greenfield/faqs/storage-providers.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    BNB Greenfield - Storage Providers FAQs

    What is Greenfield?

    Greenfield is a protocol that provides core primitives, enabling a programmable, trustless decentralised storage network, parallel and interchangeable to traditional cloud storage services.

    What is the connection between Validators and Storage Providers?

    Greenfield Validators and Storage Providers (SP) form a pair synergy to provide the whole storage service, but are separated from each other. The Greenfield validators are responsible for generating Greenfield blocks, maintaining the Greenfield blockchain security, challenging the data availability, and maintaining cross-chain communication; while the Storage Providers are responsible for storing the data objects and responding to downloading requests. There is no strong binding relationship between them, although the same organization can play two roles at the same time.

    What are the differences between Primary and Secondary Storage Providers?

    Among the multiple SPs that one object is stored on, one SP will be the “Primary SP”, while the others are “Secondary SP”. Primary SP serves as a gateway for the users to access and manage their data - that is it should be used as the only SP to download the data. Users can change the primary SP for their objects later if they are not satisfied with their service.

    Secondary SPs are used for replication. One provider can serve multiple roles, both as Primary and as Secondary provider on different objects. Primary SP or the users will select a few secondary SPs to store these segment replicas using Erasure Coding.

    A single provider can serve multiple roles on different data objects. Once the primary provider exhausted their networking resources, they can use the remaining storage capacity to serve as secondary storage provider for other data objects - thus, increasing the hardware utilization and therefore overall return on the operation. What are hardware requirements of running a storage provider? As Primary and Secondary SPs serve a different role in the Greenfield ecosystem, the requirement towards the used hardware is different.

    Primary SP is mostly network bound, as it serves the main gateway for the user to download and upload data. As such, we recommend running network optimised servers. Directly facing internet (public IP, no NAT) 8 cores CPU 16GB of RAM 500 SSD storage.

    On the contrary, Secondary SPs serve for the replication purposes and are mostly CPU bound. We recommend running CPU optimised servers. Directly facing internet (public IP, no NAT) 8 cores CPU 16GB of RAM 500 SSD storage.

    Should the storage provider serve both as Primary and Secondary SP for different data objects, we recommend running CPU and network optimised servers.

    How do Storage Providers earn money with BNB Greenfield?

    • Staking Reward: Storage Providers will receive transaction fees as the staking reward. The rewards will be distributed passively. This is different from BNB Beacon Chain, where the system will distribute the rewards automatically. SPs can submit withdrawal requests to get all the up-to-date transaction rewards, and when SPs change commission rates or quit, all the transaction rewards that are not withdrawn will also be distributed.
    • Data Storage Fees: Storage Providers will receive fees as per amount of actual data stored by them. The storage fees are distributed among Primary and Secondary storage providers, participating in the object replication. As Primary SP serves as a gateway for the download, it will receive much higher usage of the I/O operations. As such, the storage rewards are calculated with Primary SP receiving the majority of the storage fees.
    • Data Traffic Fees: Storage Providers will receive fees as per amount of actual data served by them. The traffic fees are awarded only to the Primary storage provider, as it solely serves as the gateway for the users to access their data.
    • Force Settlement Rewards: If the user's payment account is depleted and no more funds are supplied, once balance is under the forced settlement threshold, the account will be forcibly settled. All payment streams of the account will be closed and the account will be marked as out of balance. The download speed for all objects associated with the account or payment account will be downgraded. The objects will be deleted by the SPs if no fund is provided within the predefined threshold.

    The forced settlement will charge some fees, which is another incentive for users to replenish funds proactively. The fees will be distributed among the Primary and Secondary storage providers, in the ratio similar to the data storage fees.

    What happens if the user refuses or is unable to pay?

    To store data in Greenfield, users must reserve the minimum BNB amount equal to fund storage for a configurable amount of time. There are two configurations in the system, ReserveTime and LiquidateTime - both can be updated by the community vote. Let's say 7 days and 1 day, and the user wants to store the data costing 1$ per day. In such a scenario, the user must reserve fees for 7 days in buffer balance - 7$.

    If the user's payment account is depleted and no more funds are supplied, the objects will be deleted by the SPs if no fund is provided within the predefined threshold LiquidateTime - 1 day.

    Explain the Tokenomics of BNB Greenfield

    BNB Greenfield uses BNB token as the utility token. There is a native cross-chain bridge between the Greenfield blockchain and BNB Smart Chain (BSC). The initial BNB will be locked on BSC and re-minted on Greenfield. BNB and data operation primitives can flow between Greenfield and BSC. Thus, total circulation of BNB will stay unchanged as it is now but flow among BNB Beacon Chain, BSC, and Greenfield.

    One of the unique benefits of the BNB token is that it has limited supply, which means no one can create more BNB tokens, just to prop their balance sheet. Moreover, BNB token is also deflationary and is being periodically burned, or moved out of circulation, during the block creation of the BNB Smart Chain. Lastly, BNB token is used for all the projects within the BNB Chain ecosystem, including all the rollup and scaling solutions.

    All these make BNB token extremely versatile, having no correlation with any specific domain, and ideal for financial project planning and COGS predictability.

    Don't see your question?

    We're working on expanding this FAQ with more content, including questions from the community and partners, so please watch this space! However, if you don't see your question, please ask in the BNB forum, so you can get the answers you need and make us aware of new FAQ items.

    - + diff --git a/docs/greenfield/faqs/users.html b/docs/greenfield/faqs/users.html index 57a62fa271..03eaf26277 100644 --- a/docs/greenfield/faqs/users.html +++ b/docs/greenfield/faqs/users.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ This is very different, both conceptually and architecturally, to the Arweave billing system, where users pay a high one-time fee for future unlimited usage.

    Also, similarly to IPFS, Arweave doesn’t provide any guarantees of SLA, so in order to use it in the production environment, users should integrate 3rd party scaling solutions into the application, such as Bundlr.

    Overall, given Arweave’s long-term payment and lack of programmability capabilities, makes it a very good fit for storing archive data - an important, but different target from the Greenfield’s vision perspective.

    Tokenomics of BNB Greenfield

    One thing users need to be aware of is tokenomics of the projects. Each of the previously described projects use their own token, which solely serves as a unity token of the particular project.

    This is very different from Greenfield, which uses BNB token as the utility token. One of the unique benefits of the BNB token is that it has limited supply, which means no one can create more BNB tokens, just to prop their balance sheet. Moreover, BNB token is also deflationary and is being periodically burned, or moved out of circulation, during the block creation of the BNB Smart Chain. Lastly, BNB token is used for all the projects within the BNB Chain ecosystem, including all the rollup and scaling solutions.

    All these make BNB token extremely versatile, having no correlation with any specific domain, and ideal for financial project planning and COGS predictability.

    Will it be cheaper to store data on BNB Greenfield than other centralized cloud services?

    As Greenfield is a free market, the price will be determined by a number of variables related to the supply and demand for storage. It’s difficult to predict before launch. However, a few design elements of the network help support inexpensive storage.

    The design prefers simplicity first principle over other considerations. Simple solutions are not only easy to implement, run, maintain, and extend, but also friendly to software performance, which is a main goal of the design. For example, any computing-intensive proof, like what Filecoin adopts, is ruled out according to this principle.

    The biggest lesson learned from the crypto industry and BNB ecosystem is that the community has the most talent and power to build more applications and infrastructure in different self-driven ways. The design should focus on the core platform and technical foundation that provide enough interface, tools, and other facilitation to the developer community to build upon them.

    The economy targets beyond the existing BNB Chain clients, but also traditional Web2 users and developers. The system design should try to be as compatible as possible with popular Web2 and Web3 standards.

    Further, Greenfield introduces a concept called Service Providers. There will be many Service Providers offering different prices, based on region and need SLA. We expect Greenfield’s permissionless and programmable model to result in very efficient operations with inherently added value provided by the built-in programmability.

    Servicer Providers will provide publicly accessible APIs for users to upload and manage data. These APIs are very similar to AWS S3 APIs, so that existing developers may feel familiar enough to write code for it - and result with little cost to update the application with Greenfield programmable capabilities and build superior products for the users.

    Who owns users' data and who has access to it?

    Data resources on Greenfield, such as the data objects and the buckets, all have access control, such as which address can create, read, list, or even execute the resources, and which address can grant/revoke these permissions.

    Only the user who initially uploaded the data is considered as sole owner of the data. Data objects can be only read and downloaded by the other users with proper read permissions.

    Unlike IPFS and other storage systems, only authorized users can access the data - even if they have the url link to the data. Owners can later revoke the permissions to anyone, effectively removing the access rights.

    Also, proof of existence challenges, which validators perform on the data, is done on the sector level - that is small pieces of data of a particular file. As such, no entity besides the specifically authorized parties can access the full file.

    Will users be able to privately store and delete items from Greenfield?

    By design, the bytes that are stored and downloaded later for the object are exactly the same bytes that were originally uploaded and cannot be altered. Users may choose their own encryption scheme if they want the data to be unrecognizable by Service Providers or any others, even though Service Providers have the obligation to not circulate these data out of users’ instruction.

    Only the metadata is stored as the state data on the blockchain, the actual data is stored by Service Providers. Once a user wishes to delete their items, the metadata is deleted, which can be verified on blockchain, as such state removal will change the hashroot of the state.

    Unlike other decentralised solutions, where there cannot be a guarantee that all copies of the file are gone from the network, Greenfield provides a cryptographic proof of the deletion process by the Service Provider, ensuring that the data is no longer stored on the network.

    This design ensures that users have full control over their data, making the system fully compliant with various privacy policies, including GDPR .

    Unlike other decentralized solutions, where there cannot be a guarantee that all copies of the file are gone from the network, Greenfield provides an explicit acknowledgement of the deletion process by the Service Provider, ensuring that the data is no longer stored on the network. This design ensures that users have full control over their data, making the system fully compliant with various privacy policies.

    We at BNB Chain believe that a decentralized, know-nothing approach to data storage offers far better security than traditional, centralized approaches. However, many older data security and privacy standards (e.g., HIPAA, GDPR), require making specific representations about the physical location of data (e.g, requiring that data only be stored in certain countries or in data centers that meet certain standards). Therefore, if your application is subject to those standards, you should make sure that BNB Greenfield is right for you.

    BNB Greenfield roadmap includes a project around geotagging and making sure that data only goes to nodes in certain countries. As the list of Storage Providers operators includes both individuals and data centers, once there is a critical mass of Storage Providers operators who are operating compliant data centers, we also intend to add an option for customers to only store data on nodes in compliant data centers should they need to meet storage compliance requirements. However, neither of these two important capabilities for compliant storage is live as of the last publication date.

    How does the Sharing Data mechanism work?

    BNB Greenfield has implemented a very secure and highly flexible mechanism for sharing files, portions of folders, etc., relying on the blockchain mechanism. An Access Grant is a security envelope that contains a Service Provider address, a restricted authorization token, and a restricted path-based encryption key—everything an application needs to locate an object on the network, access that object, and decrypt it. Access Grants coordinate two parallel constructs—encryption and authorization-- in a way that makes it easy to share data without having to manage access control lists or use complex encryption tools. Both of these constructs work together to provide a client-side access management framework that’s secure and private, as well as extremely flexible for application developers.

    Since the underlying technology is based on blockchain signatures, there are no security implications in the choice of creating access grants in the command line interface vs. the browser interface.

    How is the overall system security of BNB Greenfield is ensured?

    The data integrity should be first guarded by the checksum of the objects as well as by the cryptographic signatures of the user. So when the user uploads the file, the user signs the file metadata, including the file checksum. As a result, no actor, including the Storage Providers, cannot change both the files and the checksum. The checksum is part of the data object metadata, and is verified constantly by the Greenfield validators.

    The overall security of the system is ensured by the underlying security of the blockchain, on which all the interaction is managed. The off-chain communication between the Storage Providers is also based on the battle proven Tendermint SDK p2p protocol ensuring the battle proven security according to the most strict industry standards.

    In general, data stored on Greenfield can be considered more secure, compared to existing traditional data storage providers, as access is secured by cryptographic elements - which are much more resistant to security attacks than cloud Single-sign-on (SSO) membership management. Overall, blockchain-backed security adds an additional layer of security, versus both traditional cloud-based and decentralized storage, that can help to prevent unauthorized access and protect against threats such as malware and other attacks.

    By providing a secure and reliable way to store and process sensitive data and code, Greenfield can help to prevent unauthorized access and tampering, which can be a major concern in decentralized storage networks.

    Are there any Single Points of Failure (SPOF)?

    BNB Greenfield is designed to be extraordinarily resilient to data loss. The decentralized nature of our Storage Providers provides exceptional resilience against a lot of things that cause data loss in conventional storage systems (IT failure, fire, floods, power outages, etc.). The infrastructure automatically provides replication among the primary and secondary Storage Providers to store data segments replicas and their EC parity pieces.

    In addition, data metadata is held on-chain using the BNB Greenfield blockchain, where the integrity is ensured by the consensus protocol - similarly to BNB Smart Chain. Thus, the integrity of the data is fully ensured by the decentralization of both the storage as well as the metadata layer.

    An important aspect of BNB Greenfield is compatibility with the existing, de facto standard for cloud object storage, AWS S3. As S3 is a vast, 15-year-old API, while we have aimed to support the most important capabilities---which cover the overwhelming majority of cloud storage-based applications--there is a long tail list of lesser-used functions that are not yet supported.

    The end goal is to provide 100% compatibility and our next major effort involves supporting a range of server-side S3 functions. We listen to the community and users when prioritizing additional S3 functionality.

    How can I contribute to the design and implementation of the BNB Greenfield?

    BNB Chain always pursues the best system for the community and the overall blockchain ecosystem. Of course, BNB Greenfield design is not 100% final and the community still has work to do based on the feedback from the validators, storage providers, and of course the users. This document is intended to address the known limitations of the technology with regard to security, performance, availability, usability, tokenomics, and more. The main purpose of this document is for the users and community members to understand the design choices and make well-informed decisions. Important to note, that while as with every software product, some compromises have been made, everything is open for discussion and if you strongly disagree with the made architectural choices, please do raise your concerns in the github development page and discord channel. As with other BNB Chain systems, BNB Greenfield is open-source. We also publish detailed whitepapers, and frequent technical updates, so you can see what it is we are doing. This includes public access to github issues, including bugs, the internal roadmap, and everything although the internal discussion process. and we strongly encourage wider participation both in the discussion and the implementation process.

    Read more FAQs related to Greenfield validators and Greenfield Service Providers.

    Don't see your question?

    We're working on expanding this FAQ with more content, including questions from the community and partners, so please watch this space! However, if you don't see your question, please ask in the BNB forum, so you can get the answers you need and make us aware of new FAQ items.

    - + diff --git a/docs/greenfield/faqs/validators.html b/docs/greenfield/faqs/validators.html index 350cae4795..bc9995cccb 100644 --- a/docs/greenfield/faqs/validators.html +++ b/docs/greenfield/faqs/validators.html @@ -8,14 +8,14 @@ - +

    BNB Greenfield - Validators FAQs

    What is Greenfield?

    Greenfield is a protocol that provides core primitives, enabling a programmable, trustless decentralised storage network, parallel and interchangeable to traditional cloud storage services.

    What is the connection between validators and Storage Providers?

    Greenfield validators and Storage Providers (SP) form a pair synergy to provide the whole storage service, but are separated from each other. The Greenfield validators are responsible for generating Greenfield blocks, maintaining the Greenfield blockchain security, challenging the data availability, and maintaining cross-chain communication; while the Storage Providers are responsible for storing the data objects and responding to downloading requests. There is no strong binding relationship between them, although the same organization can play two roles at the same time.

    Although validators can potentially maintain a meaningful and healthy number of storage providers, there is enough incentive for the validators to manage a reasonable number of non-affiliated SPs.

    What consensus mechanism does BNB Greenfield have?

    As Proof-of-Stake is adopted in Greenfield, there will be a founding validator set in the genesis state. Validators can self-bond, meaning they can delegate BNB to themselves, and they can also receive delegations from any other BNB holders. These bonded BNB acts as collateral and cause each delegate, including validators, to have “skin in the game” so to speak. If any equivocation or byzantine behavior by a validator were to be committed, the validator would be slashed a predefined amount of bonded stake. The minimum self-delegated amount is 2,000 BNB. These validators deposit their BNBs on a BSC smart contract, which would be locked as their stakes. The new validator can be voted by the majority of the current validators to join in and gets elected as the active validator based on its delegation size.

    What are hardware requirements of running a validator node?

    Processing transactions is mostly CPU bound. However BNB Greenfield validators also have the responsibility to perform data availability challenges across the SPs. Therefore we recommend running CPU optimized servers. Directly facing internet (public IP, no NAT) 8 cores CPU 16GB of RAM 500 SSD storage"

    How do validators earn money with BNB Greenfield?

    • Staking Reward: Validators will receive transaction fees as the staking reward. The rewards will be distributed passively. This is different from BNB Beacon Chain, where the system will distribute the rewards automatically. Validators can submit withdrawal requests to get all the up-to-date transaction rewards, and when validators change commission rates or quit, all the transaction rewards that are not withdrawn will also be distributed.
    • Relayer Reward: Greenfield validators also have the obligation to run the relayer system for cross-chain communication with BSC. The package deliverer will get a fixed ratio of the relay fee as a reward. There are multiple Greenfield relayers and they may compete to submit the aggregated multi-signed packages onto the Greenfield blockchain and BSC. To avoid racing transactions caused by the competition, which wastes gas, the relayers are rotated to relay transactions, e.g. taking shifts every 10 minutes.
    • Block Building Reward: Every transaction in BNB Greenfield requires gas fees to be paid by the user and distributed among the Greenfield validators to write the metadata on-chain.
    • Data Challenge Reward: The Greenfield validators have the responsibility to verify the data availability from the SPs. They form a voting committee to execute this task by the incentive of fees and potential fines (slashes) on SPs.

    Explain the Tokenomics of BNB Greenfield

    BNB Greenfield uses BNB token as the utility token. There is a native cross-chain bridge between the Greenfield blockchain and BNB Smart Chain (BSC). The initial BNB will be locked on BSC and re-minted on Greenfield. BNB and data operation primitives can flow between Greenfield and BSC. Thus, total circulation of BNB will stay unchanged as it is now but flow among BNB Beacon Chain, BSC, and Greenfield.

    One of the unique benefits of the BNB token is that it has limited supply, which means no one can create more BNB tokens, just to prop their balance sheet. Moreover, BNB token is also deflationary and is being periodically burned, or moved out of circulation, during the block creation of the BNB Smart Chain. Lastly, BNB token is used for all the projects within the BNB Chain ecosystem, including all the rollup and scaling solutions.

    All these make BNB token extremely versatile, having no correlation with any specific domain, and ideal for financial project planning and COGS predictability.

    Don't see your question?

    We're working on expanding this FAQ with more content, including questions from the community and partners, so please watch this space! However, if you don't see your question, please ask in the BNB forum, so you can get the answers you need and make us aware of new FAQ items.

    - + diff --git a/docs/greenfield/overview.html b/docs/greenfield/overview.html index 967bbe9e6e..3bc8931f4c 100644 --- a/docs/greenfield/overview.html +++ b/docs/greenfield/overview.html @@ -8,7 +8,7 @@ - + @@ -47,7 +47,7 @@ introduce new business models, which should be more open and fair.

    This whitepaper is about the design and implementation of such a series of systems, named BNB Greenfield, and calls for more buidlers to build their own data infrastructure and business with it.

    The paper contains 3 Parts.

    • Part 1 talks about the design, including the main technical logic and economic considerations;
    • Part 2 provides showcases that can be imagined in laboratories to inspire how new applications may use the new infrastructure;
    • Part 3 is a more detailed technical specification for the design in Part 1, although they are still simplified to a certain degree.

    We suggest you read through Part 1 and Part 2 sequentially, but only refer to Part 3 when you need to dig into the details for particular components.

    For any queries or discussions refer to the BNB Chain official forum.

    - + diff --git a/docs/greenfield/tech-specs/billing-and-payment.html b/docs/greenfield/tech-specs/billing-and-payment.html index d89aba5027..1d0328b29c 100644 --- a/docs/greenfield/tech-specs/billing-and-payment.html +++ b/docs/greenfield/tech-specs/billing-and-payment.html @@ -8,7 +8,7 @@ - + @@ -90,7 +90,7 @@ formula might be flexible enough so it can be hard-coded on-chain.

    There may be a chance the SPs want to change the formula(e.g. for business model update). That will be achieved by SPs and validators' coordinated governance.

    - + diff --git a/docs/greenfield/tech-specs/cross-chain-models.html b/docs/greenfield/tech-specs/cross-chain-models.html index 83f6e95814..aaf5604c5c 100644 --- a/docs/greenfield/tech-specs/cross-chain-models.html +++ b/docs/greenfield/tech-specs/cross-chain-models.html @@ -8,7 +8,7 @@ - + @@ -79,7 +79,7 @@ cross-chain packages if there are any pending failed packages in their queue. It asks the BSC dApps must handle the failed packages in sequence.

    The communication layer can catch any exception thrown by the resource mirror layer or application layer, so that package delivery won't be blocked by any customized applications.

    - + diff --git a/docs/greenfield/tech-specs/data-availability-challenge.html b/docs/greenfield/tech-specs/data-availability-challenge.html index 35ec99a863..0043083141 100644 --- a/docs/greenfield/tech-specs/data-availability-challenge.html +++ b/docs/greenfield/tech-specs/data-availability-challenge.html @@ -8,7 +8,7 @@ - + @@ -51,7 +51,7 @@ unavailable.

    3. Compute the checksum hash of the challenged piece, and compare it with the related checksum that is recorded in the local manifest. If they are different, the piece should be regarded as unavailable.

    Any of the above "unavailable" cases will mark the challenge success that the data is unavailable, and the validator will vote "unavailable".

    4. The validator uses its BLS private key to sign a data challenge vote according to the result. The data to vote should be the same for all validators to sign: it should include the block header of the block that contains the challenge, data challenge information, and the challenge result.

    5. The data availability challenge votes are propagated through the P2P network.

    6. Once a validator collects an agreement from more than 2/3 validators, an "attestment" is concluded. The validator can aggregate the signatures, assemble data challenge attestation, and submit an attestation transaction. In order to solve the concern that validators may just follow the others' results and not perform the check themselves, a "commit-and-reveal" logic will be introduced.

    7. The data challenge attestation transaction will be executed on-chain. The first validator who submits the attestation can get a submission reward, while the later submission will be rejected. The more votes the submitter aggregates, the more reward it can get. Besides the submission rewards, there are attestment rewards too. Only the validators whose votes wrapped into the attestation will be rewarded, so it may be that some validators voted, but their votes were not assembled by the validator. They won't get rewarded for these data availability challenges. Also, for different results, the rewards will be different: the "unavailable" result that slashes the SPs will get validators more rewards.

    8. After a number of blocks, for example, 100 blocks, the data availability challenge will expire even if the submissions of attestments haven't arrived. In such a case, the challenge will just expire with no further actions.

    9. Once a case of data availability is successfully challenged, i.e. the data is confirmed not available with quality service, there will be a cooling-off period for the SPs to regain, recover, or shift this piece of data.

    10. Once the cooling-off period time expires, this data availability can be challenged again if this piece of data is still unavailable, the SP would be slashed again.

    - + diff --git a/docs/greenfield/tech-specs/ecosystem-players.html b/docs/greenfield/tech-specs/ecosystem-players.html index 656830569c..4086ae8ae7 100644 --- a/docs/greenfield/tech-specs/ecosystem-players.html +++ b/docs/greenfield/tech-specs/ecosystem-players.html @@ -8,7 +8,7 @@ - + @@ -43,7 +43,7 @@ the different kinds of use case scenarios.

    In Greenfield, similar to other decentralized environments, dApps don't need to ask for registration but communicate with users' wallets to get users' instructions and other information.

    - + diff --git a/docs/greenfield/tech-specs/greenfield-blockchain.html b/docs/greenfield/tech-specs/greenfield-blockchain.html index 3a294dba0d..0065d17e1f 100644 --- a/docs/greenfield/tech-specs/greenfield-blockchain.html +++ b/docs/greenfield/tech-specs/greenfield-blockchain.html @@ -8,7 +8,7 @@ - + @@ -51,7 +51,7 @@ storage provider doesn't provide a good service or prefers to stop service. The current active validators can vote on this proposal. Once this proposal is passed, the SP will be restricted from accepting new object-storing requests, but still has the obligation to serve query requests. Other SPs or the data owners should start requesting to move the data off this "to-be-removed" SP. The "to-be-removed" SP has to facilitate the data moving so that it can get the full deposit back and avoid further slash. Actually, even if it chooses to not cooperate, the data can be recovered from the other SPs. After all the data has been migrated, this "to-be-removed" SP can withdraw all its deposit, and this SP would be removed.

    - + diff --git a/docs/greenfield/tech-specs/overview-x.html b/docs/greenfield/tech-specs/overview-x.html index 5777a9c484..6abbbd69c5 100644 --- a/docs/greenfield/tech-specs/overview-x.html +++ b/docs/greenfield/tech-specs/overview-x.html @@ -8,13 +8,13 @@ - +

    Simplified Technical Specifications

    This part of the documentation on BNB Greenfield is the most detailed so it is subject to frequent changes. It should be highlighted here and widely understood that the content in this part will be continuously updated, much more frequently than the other parts, with either new sections added or existing sections revised.

    Table of Content

    - + diff --git a/docs/greenfield/tech-specs/payload-storage-mngt.html b/docs/greenfield/tech-specs/payload-storage-mngt.html index b5416319c8..b4b388a4b0 100644 --- a/docs/greenfield/tech-specs/payload-storage-mngt.html +++ b/docs/greenfield/tech-specs/payload-storage-mngt.html @@ -8,7 +8,7 @@ - + @@ -78,7 +78,7 @@ data via the EC chunks. As designed, the ECIndex with values 0-3 are data blocks while 4-5 are parity blocks. There are two processing cases to reconstruct the object payload:

    1. All data blocks are fully stored in secondary SPs. The recovery initiator can just read the pieces which are data blocks sequentially and stitch them together;

    2. Some data blocks have been lost by secondary SPs. The recovery initiator needs to read all the data blocks and parity blocks and use the Decode function of the EC module to recover the content of all the segments.

    - + diff --git a/docs/greenfield/tech-specs/sp-apis.html b/docs/greenfield/tech-specs/sp-apis.html index c125840bba..21a8c17ebf 100644 --- a/docs/greenfield/tech-specs/sp-apis.html +++ b/docs/greenfield/tech-specs/sp-apis.html @@ -8,7 +8,7 @@ - + @@ -43,7 +43,7 @@ via a Greenfield blockchain full node RPCs. Here SPs should provide these functions via corresponding APIs so that the users have a better experience to store, check, download, and manage the objects.

    - + diff --git a/docs/greenfield/tech-specs/storage-metadata-models.html b/docs/greenfield/tech-specs/storage-metadata-models.html index c77d9a8946..dc4d59e2f3 100644 --- a/docs/greenfield/tech-specs/storage-metadata-models.html +++ b/docs/greenfield/tech-specs/storage-metadata-models.html @@ -8,7 +8,7 @@ - + @@ -50,7 +50,7 @@ associates and check whether Alice is a member of one of these groups by checking, e.g. if the key 0x21 | ResourceID(group, e.g. Games) existed, then iterate the permissionInfo map, and determine if Alice is in a group which has the permission to do CopyObject operation via the key 0x12| ResourceID(Games) | Address(Alice) - + diff --git a/docs/greenfield/tech-specs/storage-transactions.html b/docs/greenfield/tech-specs/storage-transactions.html index d8915576e2..206ee0f46e 100644 --- a/docs/greenfield/tech-specs/storage-transactions.html +++ b/docs/greenfield/tech-specs/storage-transactions.html @@ -8,7 +8,7 @@ - + @@ -24,7 +24,7 @@ buckets. It will be asynchronous as the action may take some time based on the number and size of the objects in the bucket. The bucket needs to be "Sealed" again by the new Primary SP.

    - + diff --git a/docs/greenfield/tech-specs/user-identifier.html b/docs/greenfield/tech-specs/user-identifier.html index 751944e509..01c5d124b4 100644 --- a/docs/greenfield/tech-specs/user-identifier.html +++ b/docs/greenfield/tech-specs/user-identifier.html @@ -8,7 +8,7 @@ - + @@ -43,7 +43,7 @@ participate in staking, pay for gas fees of Greenfield transactions, and pay for Greenfield services.

    This balance can be added via native BNB transfer on Greenfield, or cross-chain transfer between Greenfield and BSC.

    - + diff --git a/docs/greenfield/use-cases/decentralized-storage.html b/docs/greenfield/use-cases/decentralized-storage.html index c0fab68174..5cf7eb74b3 100644 --- a/docs/greenfield/use-cases/decentralized-storage.html +++ b/docs/greenfield/use-cases/decentralized-storage.html @@ -8,7 +8,7 @@ - + @@ -21,7 +21,7 @@ the data from Greenfield back to BSC. These ideas are being considered by BSC Core Dev already.

    Data Availability Layer for the Layer 2 Rollups

    Similar to Ethereum, BSC also welcomes Layer 2 Rollups as the solution to scale the total computing power and ledger size. Storing data on BSC is cheaper than Ethereum, but it can be much more effective if there is a common storage infrastructure that is reliable and verifiable. Such infrastructure and corresponding data availability layer management can significantly reduce the cost of the rollups.

    Snapshots and Block Data Backups

    Data storage for the long term was not a topic that was seriously considered when blockchain was invented. However, it has become a problem today. Most developers prefer to run a blockchain node from a snapshot, instead of running for months from the genesis. Many networks, including Ethereum, have been researching that the block and historic data that has existed for more than a certain time should be allowed to drop. The community needs a publicly accessible and credible data source to read these very old data and recent snapshots. BNB Greenfield can be a good option. Its sponsorship feature is natural for this data of social good.

    - + diff --git a/docs/greenfield/use-cases/digital-publishing.html b/docs/greenfield/use-cases/digital-publishing.html index a45a78e50f..d67d80a853 100644 --- a/docs/greenfield/use-cases/digital-publishing.html +++ b/docs/greenfield/use-cases/digital-publishing.html @@ -8,7 +8,7 @@ - + @@ -37,7 +37,7 @@ copyright dispute.

    Authors, publishers, and dApps should be aware of these limitations and choose to use them at their own risk for now. More copyright-related features may be introduced to Greenfield with the help of the community.

    - + diff --git a/docs/greenfield/use-cases/overview-x.html b/docs/greenfield/use-cases/overview-x.html index 382ec5acc3..3627e0177b 100644 --- a/docs/greenfield/use-cases/overview-x.html +++ b/docs/greenfield/use-cases/overview-x.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Showcases in Labs

    The goal of the BNB Greenfield platform is to unleash the power of decentralized blockchain and storage technology on data ownership and data economy.

    This part of the documentation on BNB Greenfield is neither accurate as industrial designs nor serious as academic research. It just lists a few potential showcases that can be modeled upon BNB Greenfield in a "laboratory environment". The showcases are used to inspire further experimentation and solid design to create the next generation of decentralized applications.

    From Showcases to Real Production

    Different big and small showcases are in this section. Some of them may be worth to be implemented into a real application, but more are expected to inspire new models to be invented to unleash the power of BNB Greenfield. This part of the documentation is expected to be soon substituted by real applications in production.

    Table of Contents

    - + diff --git a/docs/greenfield/use-cases/personal-data-market.html b/docs/greenfield/use-cases/personal-data-market.html index e1e84d3727..4a6adc63c9 100644 --- a/docs/greenfield/use-cases/personal-data-market.html +++ b/docs/greenfield/use-cases/personal-data-market.html @@ -8,7 +8,7 @@ - + @@ -48,7 +48,7 @@ data market owner) can, and only those two can decrypt the data.

    Many more infrastructures related to the scenario above are not considered in this paper yet but can be gradually designed and implemented on BNB Greenfield.

    - + diff --git a/docs/greenfield/use-cases/user-generated-content.html b/docs/greenfield/use-cases/user-generated-content.html index de73a900f9..096cf6a42e 100644 --- a/docs/greenfield/use-cases/user-generated-content.html +++ b/docs/greenfield/use-cases/user-generated-content.html @@ -8,7 +8,7 @@ - + @@ -43,7 +43,7 @@ each list under the designated bucket for the business. The list of objects and fully tracked change history are priceless functions for such decentralized voting and governance ideas.

    - + diff --git a/docs/hardhat-new.html b/docs/hardhat-new.html index 55ec8cc062..6d4487c572 100644 --- a/docs/hardhat-new.html +++ b/docs/hardhat-new.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Using Hardhat for Deploying Smart Contracts on BSC

    In this tutorial, we explain step-by-step how to create, compile and deploy a simple smart contract on the BSC Testnet using Hardhat.

    What is Hardhat

    Hardhat is a development environment to compile, deploy, test, and debug your smart contract.

    Setting up the development environment

    There are a few technical requirements before we start.

    Pre-requisites

    There are a few technical requirements before we start as listed below:

    • Node.js v10+ LTS and npm (comes with Node)
    • Git
    • Create an empty project npm init --yes
    • Once your project is ready, run npm install --save-dev hardhat to install Hardhat.
    • Install hardhat toolbox npm install @nomicfoundation/hardhat-toolbox
    • To use your local installation of Hardhat, you need to use npx to run it (i.e. npx hardhat).

    Create A Project

    • To create your Hardhat project run npx hardhat in your project folder to intialize your project.
    • Select Create an empty hardhat.config.js with your keyboard and hit enter.
    $ npx hardhat
    888 888 888 888 888
    888 888 888 888 888
    888 888 888 888 888
    8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
    888 888 "88b 888P" d88" 888 888 "88b "88b 888
    888 888 .d888888 888 888 888 888 888 .d888888 888
    888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
    888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888

    Welcome to Hardhat v2.10.1

    √ What do you want to do? · Create a JavaScript project
    √ Hardhat project root: · Project-Directory
    √ Do you want to add a .gitignore? (Y/n) · y

    You need to install these dependencies to run the sample project:
    npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
    npm install --save-dev "hardhat@^2.10.1" "@nomicfoundation/hardhat-toolbox@^1.0.1"

    Project created

    See the README.md file for some example tasks you can run

    Give Hardhat a star on Github if you're enjoying it!

    https://github.com/NomicFoundation/hardhat

    When Hardhat is run, it searches for the closest hardhat.config.js file starting from the current working directory. This file normally lives in the root of your project and an empty hardhat.config.js is enough for Hardhat to work. The entirety of your setup is contained in this file.

    Create Smart Contract

    You can write your own smart contract or download the BEP20 token smart contract template, place it in the contracts directory of your project and remane it as BEP20Token.sol.

    Configure Hardhat for BSC

    • Go to hardhat.config.js
    • Update the config with bsc-network-crendentials.
    require("@nomicfoundation/hardhat-toolbox");

    const { mnemonic } = require('./secrets.json');

    // This is a sample Hardhat task. To learn how to create your own go to
    // https://hardhat.org/guides/create-task.html
    task("accounts", "Prints the list of accounts", async () => {
    const accounts = await ethers.getSigners();

    for (const account of accounts) {
    console.log(account.address);
    }
    });

    // You need to export an object to set up your config
    // Go to https://hardhat.org/config/ to learn more

    /**
    * @type import('hardhat/config').HardhatUserConfig
    */
    module.exports = {
    defaultNetwork: "mainnet",
    networks: {
    localhost: {
    url: "http://127.0.0.1:8545"
    },
    hardhat: {
    },
    testnet: {
    url: "https://data-seed-prebsc-1-s1.bnbchain.org:8545",
    chainId: 97,
    gasPrice: 20000000000,
    accounts: {mnemonic: mnemonic}
    },
    mainnet: {
    url: "https://bsc-dataseed.bnbchain.org/",
    chainId: 56,
    gasPrice: 20000000000,
    accounts: {mnemonic: mnemonic}
    }
    },
    solidity: {
    version: "0.8.9",
    settings: {
    optimizer: {
    enabled: true
    }
    }
    },
    paths: {
    sources: "./contracts",
    tests: "./test",
    cache: "./cache",
    artifacts: "./artifacts"
    },
    mocha: {
    timeout: 20000
    }
    };

    note
        It requires mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new `secrets.json` file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.
    Sample secrets.json

    {
    "mnemonic": "Your_12_Word_MetaMask_Seed_Phrase"
    }

    Compile Smart Contract

    To compile a Hardhat project, change to the root of the directory where the project is located and then type the following into a terminal:

    npx hardhat compile

    Deploy Smart Contract on BSC Network

    • Copy and paste the following content into the scripts/deploy.js file.
    async function main() {
    const [deployer] = await ethers.getSigners();

    console.log("Deploying contracts with the account:", deployer.address);

    console.log("Account balance:", (await deployer.getBalance()).toString());

    const Token = await ethers.getContractFactory("BEP20Token"); //Replace with name of your smart contract
    const token = await Token.deploy();

    console.log("Token address:", token.address);
    }

    main()
    .then(() => process.exit(0))
    .catch((error) => {
    console.error(error);
    process.exit(1);
    });

    • Run this command in root of the project directory:
    $  npx hardhat run --network testnet scripts/deploy.js
    • Sample Output
    $ npx hardhat run --network testnet scripts/deploy.js
    Deploying contracts with the account: 0x27cf2CEAcdedce834f1673005Ed1C60efA63c081
    Account balance: 100721709119999208161
    Token address: 0xbF39886B4F91F5170934191b0d96Dd277147FBB2

    Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.

    Congratulations! You have successfully deployed BEP20 Smart Contract. Now you can interact with the Smart Contract.

    You can check the deployment status here: https://bscscan.com/ or https://testnet.bscscan.com/

    Verify with Hardhat

    Hardhat has an Etherscan plugin: Hardhat Etherscan plugin

    Note: Hardhat was previously Buidler.

    Install the plugin

    npm install --save-dev @nomiclabs/hardhat-etherscan

    Configure the EthereScan plugin in hardhat.config.js

    • Step1: Add require("@nomiclabs/hardhat-etherscan");
    • Step2: Add your Bscscan API key. Register and obtain your API key from https://bscscan.com/myapikey .
    • Step3: Always remember to set the solidity compiler version to match what was used for deploying the smart contract.

    !!! warning Keep your API key as secret and never it commit to version control

    // hardhat.config.js
    const { mnemonic, bscscanApiKey } = require('./secrets.json');

    require('@nomiclabs/hardhat-ethers');
    require("@nomiclabs/hardhat-etherscan");
    /**
    * @type import('hardhat/config').HardhatUserConfig
    */
    module.exports = {

    networks: {
    testnet: {
    url: `https://data-seed-prebsc-1-s1.bnbchain.org:8545`,
    accounts: {mnemonic: mnemonic}
    },
    mainnet: {
    url: `https://bsc-dataseed.bnbchain.org/`,
    accounts: {mnemonic: mnemonic}
    }
    },

    etherscan: {
    // Your API key for Etherscan
    // Obtain one at https://bscscan.com/
    apiKey: bscscanApiKey
    },
    solidity: "0.8.9"
    };

    Verify Command

    !!! warning Remove any unnecessary contracts and clear the artifacts otherwise these will also be part of the verified contract.

    Run the following command:

    npx buidler verify --network mainnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"
    • Example
    $ npx hardhat  verify --network testnet 0xbF39886B4F91F5170934191b0d96Dd277147FBB2
    Nothing to compile
    Compiling 1 file with 0.5.16
    Successfully submitted source code for contract
    contracts/BEP20Token.sol:BEP20Token at 0xbF39886B4F91F5170934191b0d96Dd277147FBB2
    for verification on Etherscan. Waiting for verification result...

    Successfully verified contract BEP20Token on Etherscan.
    https://testnet.bscscan.com/address/0xbF39886B4F91F5170934191b0d96Dd277147FBB2#code

    Conclusion

    This tutorial guided you through the basics of creating and deploying a simple smart contract using the Hardhat IDE. It also provides step-by-step guide on how to verify your deployed smart contract. This tutorial uses testnet, however, the exact same instructions and sequence will work on the mainnet as well.

    - + diff --git a/docs/hardhat.html b/docs/hardhat.html index 510af00ab7..25308b0ad9 100644 --- a/docs/hardhat.html +++ b/docs/hardhat.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ Requirements:

    Installing

    There are a few technical requirements before we start. Please install the following: Requirements:

    First, you need to create an empty project npm init --yes

    Once your project is ready, you should run

    npm install --save-dev hardhat

    It's recommeded to install some dependencies.

    npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers

    To use your local installation of Hardhat, you need to use npx to run it (i.e. npx hardhat).

    Create A Project

    To create your Hardhat project run npx hardhat in your project folder:

    mkdir MegaCoin
    cd MegaCoin
    • Intialize your project:
    $ npx hardhat
    888 888 888 888 888
    888 888 888 888 888
    888 888 888 888 888
    8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888
    888 888 "88b 888P" d88" 888 888 "88b "88b 888
    888 888 .d888888 888 888 888 888 888 .d888888 888
    888 888 888 888 888 Y88b 888 888 888 888 888 Y88b.
    888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888

    Welcome to Hardhat v2.0.8

    ? What do you want to do? …
    ❯ Create a sample project
    Create an empty hardhat.config.js
    Quit

    Once this project is initialized, you'll now have a project structure with the following items:

    • contracts/: Directory for Solidity contracts
    • scripts/: Directory for scriptable deployment files
    • test/: Directory for test files for testing your application and contracts
    • hardhat-config.js: Hardhat configuration file

    Create Contract

    You can write your own smart contract or download the BEP20 token smart contract template.

    Config Hardhat for BSC

    • Go to hardhat.config.js
    • Update the config with bsc-network-crendentials.
    require("@nomiclabs/hardhat-waffle");
    require('@nomiclabs/hardhat-ethers');
    const { mnemonic } = require('./secrets.json');

    // This is a sample Hardhat task. To learn how to create your own go to
    // https://hardhat.org/guides/create-task.html
    task("accounts", "Prints the list of accounts", async () => {
    const accounts = await ethers.getSigners();

    for (const account of accounts) {
    console.log(account.address);
    }
    });

    // You need to export an object to set up your config
    // Go to https://hardhat.org/config/ to learn more

    /**
    * @type import('hardhat/config').HardhatUserConfig
    */
    module.exports = {
    defaultNetwork: "mainnet",
    networks: {
    localhost: {
    url: "http://127.0.0.1:8545"
    },
    hardhat: {
    },
    testnet: {
    url: "https://data-seed-prebsc-1-s1.bnbchain.org:8545",
    chainId: 97,
    gasPrice: 20000000000,
    accounts: {mnemonic: mnemonic}
    },
    mainnet: {
    url: "https://bsc-dataseed.bnbchain.org/",
    chainId: 56,
    gasPrice: 20000000000,
    accounts: {mnemonic: mnemonic}
    }
    },
    solidity: {
    version: "0.5.16",
    settings: {
    optimizer: {
    enabled: true
    }
    }
    },
    paths: {
    sources: "./contracts",
    tests: "./test",
    cache: "./cache",
    artifacts: "./artifacts"
    },
    mocha: {
    timeout: 20000
    }
    };

    !!! Note It requires mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from MetaMask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.

    Compile Contract

    To compile a Hardhat project, change to the root of the directory where the project is located and then type the following into a terminal:

    npx hardhat compile

    Deploying on BSC Network

    Run this command in root of the project directory:

    $  npx hardhat run --network testnet scripts/deploy.js

    Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.

    Congratulations! You have successfully deployed BEP20 Smart Contract. Now you can interact with the Smart Contract.

    You can check the deployment status here: https://bscscan.com/ or https://testnet.bscscan.com/

    - + diff --git a/docs/issue-BEP20.html b/docs/issue-BEP20.html index 71c684ca44..71be4b9437 100644 --- a/docs/issue-BEP20.html +++ b/docs/issue-BEP20.html @@ -8,13 +8,13 @@ - +

    Issue BEP20 Tokens

    Compile and Deploy BEP20 Contract

    1. Open Remix IDE: https://remix.ethereum.org

    img

    1. Select solidity language

    img

    1. Create new contract BEP20Token.sol and copy contract code from the bep20 token template here

    2. Modify “name”, “symbol”, “decimals” and “totalSupply” according to your requirements.

    img

    1. Compile the BEP20 token contract

      a. Step1: Click button to switch to compile page

      b. Step2: Select “BEP20Token” contract

      c. Step3: Enable “Auto compile” and “optimization”

      d. Step4: Click “ABI” to copy the contract abi and save it.

    img

    1. Deploy the contract to BSC

      a. Step1: Click button to switch to compile button.

      b. Step2: Select “Injected Web3”

      c. Step3: Select “BEP20Token”

      d. Step4: Client “Deploy” button and Metamask will pop up

      e. Client “confirm” button to sign and broadcast transaction to BSC.

    img

    img
    - + diff --git a/docs/keys.html b/docs/keys.html index 69bcb4855b..ff0586abba 100644 --- a/docs/keys.html +++ b/docs/keys.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ transaction for you if the password is right.

    Usage

    The usage is the same for bnbcli and tbnbcli

    $ ./bnbcli keys
    Keys allows you to manage your local keystore for tendermint.

    These keys may be in any format supported by go-crypto and can be
    used by light-clients, full nodes, or any other application that
    needs to sign with a private key.

    Usage:
    bnbcli keys [command]

    Available Commands:
    mnemonic Compute the bip39 mnemonic for some input entropy
    add Create a new key, or import from seed
    list List all keys
    show Show key info for the given name

    delete Delete the given key
    update Change the password used to protect private key

    Flags:
    -h, --help help for keys

    Global Flags:
    -e, --encoding string Binary encoding (hex|b64|btc) (default "hex")
    --home string directory for config and data (default "/Users/yourname/.bnbcli")
    -o, --output string Output format (text|json) (default "text")
    --trace print out full stack trace on errors

    Use "bnbcli keys [command] --help" for more information about a command.

    mnemonic

    mnemonic is used to generate bip39 mnemonic.
    You can restore key from the mnemonic generated.

    $ ./bnbcli keys mnemonic
    uncle mule squirrel cover theory oven rookie dry intact alert right afraid differ ability mule struggle spray usual must purity social ball flat short

    add

    You can use add to create a new key or import from seed (mnemonic).
    You have to specify the name for the key you want to create.

    To import with a mnemonic phrase, you need to include the --recover flag in the command.

    create a new key

    $ ./bnbcli keys add testkey
    Enter a passphrase for your key:
    Repeat the passphrase:
    NAME: TYPE: ADDRESS: PUBKEY:
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv
    **Important** write this seed phrase in a safe place.
    It is the only way to recover your account if you ever forget your password.

    poverty joke nominee enough harsh elder flush noodle gift one limit tree sponsor sun radio above acid air winter inflict profit there brand water

    import from seed

    $ ./bnbcli keys add testkey --recover
    Enter a passphrase for your key:
    Repeat the passphrase:
    > Enter your recovery seed phrase:
    poverty joke nominee enough harsh elder flush noodle gift one limit tree sponsor sun radio above acid air winter inflict profit there brand water
    NAME: TYPE: ADDRESS: PUBKEY:
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv

    list

    list can list all the keys you have.

    $ ./bnbcli keys list
    NAME: TYPE: ADDRESS: PUBKEY:
    test local bnc16jv838jw8zcgucvrhreen73adwgnue6ujcz2cf bncp1addwnpepqgxacvpgnvss94zs363lheuh2xldj0hvymftuds8d69u5cau5kz3y23rj6l
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv

    show

    show is used to show the detail of the key by the name.

    $ ./bnbcli keys show testkey
    NAME: TYPE: ADDRESS: PUBKEY:
    testkey local bnc1e8zhj9wmgq4pwzrv264gfru2fk8x2hdvpclx3n bncp1addwnpepqffepxlkrka9n33vyzmjwkpy05gpm46cn5de3x9v0vqswk7st5lkc7alhjv

    delete

    delete is used to delete the key.

    $ ./bnbcli keys delete testkey
    DANGER - enter password to permanently delete key:
    Password deleted forever (uh oh!)

    update

    update is used to update the password that is currently used to protect the private key.

    $ ./bnbcli keys update test
    Enter the current passphrase:
    Enter the new passphrase:
    Repeat the new passphrase:
    Password successfully updated!
    - + diff --git a/docs/learn/beaconIntro.html b/docs/learn/beaconIntro.html index 8fd9ec29aa..5d75e19042 100644 --- a/docs/learn/beaconIntro.html +++ b/docs/learn/beaconIntro.html @@ -8,7 +8,7 @@ - + @@ -23,7 +23,7 @@ Users can submit different kinds of proposals for signaling, changing consensus parameters on chains, for example, text proposals, fee parameter change proposals, staking parameter change proposals, and so on. For each on-chain proposal, there are deposit period for depositing BNB and voting period for voters to make votes. Once the proposal passes, it will make effect on BNB Beacon Chain and side chains via cross chain communications.

    Participate

    There are different ways to participate in the network, from light nodes to full validators. BNB Beacon Chain follows a philosophy of progressive decentralization. We envision a future where organizations and individuals can run validator nodes, and BNB can be staked to join governance.

    - + diff --git a/docs/learn/bsc-gov.html b/docs/learn/bsc-gov.html index 329aca7d1a..f92ae5be40 100644 --- a/docs/learn/bsc-gov.html +++ b/docs/learn/bsc-gov.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ validator operators in this governance stage are actually voting Yes, No, or Abstain. If a proposal reaches quorum or the minimum threshold defined by the protocol it will pass to the next stage for tallying.

    Tallying & Execution Stage

    After voting stage, the following condition will be taken into consideration to determine if it passes or not:

    • Quorum: more than 50% of the total staked tokens at the end of the voting period need to have voted
    • Threshold: More than 50% or a majority of the tokens that participated in the vote, excluding "Abstain" votes must have voted "Yes"
    • Veto: Less than 33.4% of the tokens that participated in the vote, not counting "Abstain" votes, have vetoed the decision "No (With Veto)".

    If any of these conditions are not met, the deposit associated with the denied proposal will not be refunded. These funds will be sent to the validator set.

    Once a parameter change is voted on and passes all conditions, the upgrade will take effect automatically in the whole network. And this is how you would have seen the BSC evolve to the current version today!

    Contract Interface

    Every contract that wants to subscribe param change event, should implement the following interface: function updateParam(string key, bytes calldata value) external

    Some following check must be done inside the interface:

    • The msg sender must be the gov contract.
    • Basic check of value. (length, value range)

    An example implementation:

    modifier onlyGov() {
    require(msg.sender == GOV_CONTRACT_ADDR, "the msg sender must be the gov contract");
    _;
    }

    function updateParam(string key, bytes calldata value) external onlyGov{
    if (key == "relayerReward"){
    require(value.length == 32, "the length of value is not 32 when update relayer_reward param");
    uint256 memory paramValue = TypesToBytes.ToUint256(0, value);
    require(paramValue >= MIN_RELAYER_REWARD, "the relayerReward is smaller than the minimum value");
    require(paramValue <= MAX_RELAYER_REWARD, "the relayerReward is bigger than the maximal value");
    relayerReward = paramValue;
    }else{
    require(false, "receive unknown param");
    }
    }

    Parameters that control the behavior of BSC

    There are many system parameters to control the behavior of the BSC:

    • All these parameters of BSC system contracts is governable: slashing threshold, cross-chain transfer fees, relayer reward amount and so on.

    • params of Staking/Slash/Oracle/IBC modules on BC

    All these parameters will be determined by BSC Validator Set together through a proposal-vote process based on their staking. Such processes will be carried on BC, and the new parameter values will be picked up by corresponding system contracts via cross-chain communication when needed.

    Fee Table

    Transaction TypeFee
    Submit Smart Chain Proposal1 BNBs
    Smart Chain Proposal Deposit0.00025 BNB
    Smart Chain Proposal Vote0 BNB

    Commands

    Query side chain proposals

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --statuspassedfilter proposals by proposal status, status: deposit_period/voting_period/passed/rejectedNo
    --voterbnb1h9ymecpakr8p8lhchtah2xxx7x4xq099umclqufilter by proposals voted on by votedNo
    ## mainnet
    ./bnbcli gov query-proposals --side-chain-id bsc --node http://dataseed2.defibit.io:80 --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov query-proposals --side-chain-id chapel --node http://data-seed-pre-1-s1.bnbchain.org:80 --trust-node --chain-id Binance-Chain-Ganges

    Query side chain proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --proposal-id1proposalID of proposal being queriedYes
    ## mainnet
    ./bnbcli gov query-proposal --proposal-id 1 --side-chain-id bsc --node http://dataseed2.defibit.io:80 --trust-node --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli gov query-proposal --proposal-id 1 --side-chain-id chapel --trust-node --node http://data-seed-pre-1-s1.bnbchain.org:80 --chain-id Binance-Chain-Ganges

    Query side chain parameters

    parameter nameexamplecommentsrequired
    --side-chain-idchapelthe id of side chain, default is native chainYes
    ## mainnet
    ./bnbcli params side-params --side-chain-id bsc --trust-node --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli params side-params --side-chain-id chapel --trust-node --node http://data-seed-pre-1-s1.bnbchain.org:80

    Submit cross chain param change proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --keyfelonyThresholdthe parameter name on the side chainYes
    --target0x0000000000000000000000000000000000001001the address of the contract on side chainYes
    --title"test csc change"title of proposalYes
    --value0x000000000000000000000000000000000000000000000000000000000000001bthe specified value of the parameter on side chain, should encoded in hexYes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainet
    ./bnbcli params submit-cscParam-change-proposal --key "felonyThreshold" --value "0x000000000000000000000000000000000000000000000000000000000000001b" --target 0x0000000000000000000000000000000000001001 --deposit 200000000000:BNB --voting-period 100 --side-chain-id bsc --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Tigris --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli params submit-cscParam-change-proposal --key "felonyThreshold" --value "0x000000000000000000000000000000000000000000000000000000000000001b" --target 0x0000000000000000000000000000000000001001 --deposit 200000000000:BNB --voting-period 100 --side-chain-id chapel --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Submit cross chain channel management proposal

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --deposit200000000000:BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --channel-id1the the channel id that want to manageYes
    --enabletrueenable the channel or not (default true)Yes
    --title"test csc change"title of proposalYes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainnet
    ./bnbcli side-chain submit-channel-manage-proposal --channel-id 2 --enable=true --deposit 200000000000:BNB --voting-period 100 --side-chain-id bsc --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Tigris --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli side-chain submit-channel-manage-proposal --channel-id 2 --enable=true --deposit 200000000000:BNB --voting-period 100 --side-chain-id chapel --title "test csc change" --from alice --trust-node --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Submit side chain module param change proposal

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --deposit200000000000 BNBdeposit of proposalYes
    --fromaliceName or address of private key with which to signYes
    --title"test csc change"title of proposalYes
    --sc-param-fileparam.jsonthe file of Side Chain params (json format)Yes
    --voting-period604800voting period in seconds (default 604800)No
    ## mainnet
    ./bnbcli params submit-sc-change-proposal --sc-param-file param.json --deposit 200000000000:BNB --voting-period 100 --side-chain-id bsc --title "test proposal" --from delegator1 --trust-node --chain-id Binance-Chain-Tigris --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli params submit-sc-change-proposal --sc-param-file param.json --deposit 200000000000:BNB --voting-period 100 --side-chain-id chapel --title "test proposal" --from delegator1 --trust-node --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Vote for side chain proposal

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --proposal-id1proposalID of proposal being queriedYes
    --optionYesvote option {yes, no, no_with_veto, abstain}Yes
    ## mainnet
    ./bnbcli gov vote --from alice --side-chain-id bsc --proposal-id 1 --option Yes --chain-id Binance-Chain-Tigris --node http://dataseed2.defibit.io:80

    ## testnet
    ./tbnbcli gov vote --from alice --side-chain-id chapel --proposal-id 1 --option Yes --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80

    Deposit for side chain proposal

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelthe id of side chain, default is native chainYes
    --proposal-id1proposalID of proposal being queriedYes
    --depositYesamount of depositYes
    ## mainnet
    ./bnbcli gov deposit --from alice --side-chain-id bsc --proposal-id 1 --deposit 1000000000:BNB --chain-id Binance-Chain-Tigris --node http://data-seed-pre-1-s1.bnbchain.org:80

    ## testnet
    ./tbnbcli gov deposit --from alice --side-chain-id chapel --proposal-id 1 --deposit 1000000000:BNB --chain-id Binance-Chain-Ganges --node http://data-seed-pre-1-s1.bnbchain.org:80
    - + diff --git a/docs/learn/bsc-relayer.html b/docs/learn/bsc-relayer.html index 0096357464..693f366435 100644 --- a/docs/learn/bsc-relayer.html +++ b/docs/learn/bsc-relayer.html @@ -8,13 +8,13 @@ - +

    BSC Relayer

    Relayers are responsible for submitting Cross-Chain Communication Packages between the two blockchains, BNB Smart Chain (BSC) and BNB Beacon Chain (BC). Due to the heterogeneous parallel chain structure, two different types of Relayers are created.

    Relayers for BC-to-BSC communication referred to as BSC Relayers are a standalone process that can be run by anyone, and anywhere, except that Relayers must register themselves onto BSC and deposit a certain amount of BNB. Only relaying requests from the registered Relayers will be accepted by BSC.

    GitHub Implementation link: https://github.com/bnb-chain/bsc-relayer

    Config Files: https://github.com/bnb-chain/bsc-relayer-config

    - + diff --git a/docs/learn/consensus.html b/docs/learn/consensus.html index a5cee7ee54..9858d95d99 100644 --- a/docs/learn/consensus.html +++ b/docs/learn/consensus.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Consensus Engine

    Although Proof-of-Work (PoW) has been recognized as a practical mechanism to implement a decentralized network, it is not friendly to the environment and also requires a large size of participants to maintain the security.

    Ethereum and some other blockchain networks, such as MATIC Bor, TOMOChain, GoChain, xDAI, do use Proof-of-Authority(PoA) or its variants in different scenarios, including both testnet and mainnet. PoA provides some defense to 51% attack, with improved efficiency and tolerance to certain levels of Byzantine players (malicious or hacked). It serves as an easy choice to pick as the fundamentals.

    Meanwhile, the PoA protocol is most criticized for being not as decentralized as PoW, as the validators, i.e. the nodes that take turns to produce blocks, have all the authorities and are prone to corruption and security attacks. Other blockchains, such as EOS and Lisk both, introduce different types of Delegated Proof of Stake (DPoS) to allow the token holders to vote and elect the validator set. It increases the decentralization and favors community governance.

    BSC here proposes to combine DPoS and PoA for consensus, so that:

    1. Blocks are produced by a limited set of validators
    2. Validators take turns to produce blocks in a PoA manner, similar to Ethereum's Clique consensus design
    3. Validator set are elected in and out based on a staking based governance

    Fast finalization can greatly improve user experience. The Fast Finality feature will be enabled upon the coming Plato upgrade. This will be a major advantage of BSC, and many dapps will benefit from it.

    The consensus protocol of BSC fulfills the following goals:

    1. Short Blocking time, 3 seconds on mainnet.
    2. It requires quite short time to confirm the finality of transactions, around 6s for mainnet after the coming Plato upgrade.
    3. There is no inflation of native token: BNB, the block reward is collected from transaction fees, and it will be paid in BNB.
    4. It is 100% compatible with Ethereum system .
    5. It allows modern proof-of-stake blockchain network governance.

    Validator Quorum

    In the genesis stage, a few trusted nodes will run as the initial Validator Set. After the blocking starts, anyone can compete to join as candidates to elect as a validator. The staking status decides the top 29 most staked nodes to be the next validator set, and such an election will repeat every 24 hours.

    BNB is the token used to stake for BSC.

    In order to remain as compatible as Ethereum and upgradeable to future consensus protocols to be developed, BSC chooses to rely on the BC for staking management. There is a dedicated staking module for BSC on BC. It will accept BSC staking from BNB holders and calculate the highest staked node set. Upon every UTC midnight, BC will issue a verifiable ValidatorSetUpdate cross-chain message to notify BSC to update its validator set.

    While producing further blocks, the existing BSC validators check whether there is a ValidatorSetUpdate message relayed onto BSC periodically. If there is, they will update the validator set after an epoch period, i.e. a predefined number of blocking time. For example, if BSC produces a block every 5 seconds, and the epoch period is 240 blocks, then the current validator set will check and update the validator set for the next epoch in 1200 seconds (20 minutes).

    Parlia

    The implement of the consensus engine is named as Parlia which is similar to clique. This doc will focus more on the difference and ignore the common details.

    Light Client Security

    Validators set changes take place at the (epoch+N/2) blocks. (N is the size of validatorset before epoch block). Considering the security of light client, we delay N/2 block to let validatorSet change take place.

    Every epoch block, validator will query the validatorset from contract and fill it in the extra_data field of block header. Full node will verify it against the validatorset in contract. A light client will use it as the validatorSet for next epoch blocks, however, it can not verify it against contract, it have to believe the signer of the epoch block. If the signer of the epoch block write a wrong extra_data, the light client may just go to a wrong chain. If we delay N/2 block to let validatorSet change take place, the wrong epoch block won’t get another N/2 subsequent blocks that signed by other validators, so that the light client are free of such attack.

    System Transaction

    The consensus engine may invoke system contracts, such transactions are called system transactions. System transactions is signed by the the validator who is producing the block. For the witness node, will generate the system transactions(without signature) according to its intrinsic logic and compare them with the system transactions in the block before applying them.

    Enforce Backoff

    In Clique consensus protocol, out-of-turn validators have to wait a randomized amount of time before sealing the block. It is implemented in the client-side node software and works with the assumption that validators would run the canonical version. However, given that validators would be economically incentivized to seal blocks as soon as possible, it would be possible that the validators would run a modified version of the node software to ignore such a delay. To prevent validator rushing to seal a block, every out-turn validator will get a specified time slot to seal the block. Any block with a earlier blocking time produced by an out-turn validator will be discarded by other witness node.

    Extending the ruling of the current validator set via temporary censorship

    If the transaction that updates the validator is sent to the BSC right on the epoch period, then it is possible for the in-turn validator to censor the transaction and not change the set of validators for that epoch. While a transaction cannot be forever censored without the help of other n/2 validators, by this it can extend the time of the current validator set and gain some rewards. In general, the probability of this scheme can increase by colluding with other validators. It is relatively benign issue that a block may be approximately 3 secs and one epoch being 200 blocks, i.e. 20 mins so the validators could only be extended for another 10 mins.

    Security

    Given there are more than ½*N+1 validators are honest, PoA based networks usually work securely and properly. However, there are still cases where certain amount Byzantine validators may still manage to attack the network, e.g. through the Clone Attack. BSC does introduce Slashing logic to penalize Byzantine validators for double signing or inavailability. This Slashing logic will expose the malicious validators in a very short time and make the "Clone Attack" very hard or extremely non-beneficial to execute.

    Fast Finality

    Finality is critical for blockchain security, once the block is finalized, it wouldn’t be reverted anymore. The fast finality feature is very useful, the users can make sure they get the accurate information from the latest finalized block, then they can decide what to do next instantly. More details of design, please to refer BEP-126

    Before the coming Plato upgrade,to secure as much as BC, BSC users are encouraged to wait until receiving blocks sealed by more than ⅔*N+1 different validators. In that way, the BSC can be trusted at a similar security level to BC and can tolerate less than ⅓*N Byzantine validators.With 21 validators, if the block time is 3 seconds, the ⅔*N+1 different validator seals will need a time period of (⅔*21+1)*3 = 45 seconds. Any critical applications for BSC may have to wait for ⅔*N+1 to ensure a relatively secure finality. With above enhancement by slashing mechanism, ½*N+1 or even fewer blocks are enough as confirmation for most transactions.

    After the coming Plato upgrade, the feature Fast Finality will be enabled. The chain will be finalized within two blocks if ⅔*N or more validators vote normally, otherwise the chain has a fixed number of blocks to reach probabilistic finality as before.

    - + diff --git a/docs/learn/cross-chain-api.html b/docs/learn/cross-chain-api.html index b22bc89289..dfb72ad53d 100644 --- a/docs/learn/cross-chain-api.html +++ b/docs/learn/cross-chain-api.html @@ -8,13 +8,13 @@ - +

    Cross-Chain API

    To facilitate querying cross chain transactions between BNB Beacon Chain and BNB Smart Chain, following APIs are provided.

    Mainnet base path: https://api.bnbchain.org

    Version: 1.0.0

    /cross_chain/v1/transfer_in_txs?address={address}

    Method

    GET

    Summary

    Query transfer in cross chain transactions.

    Parameters

    NameLocated inDescriptionRequiredSchema
    addressqueryBNB Beacon Chain address or BNB Smart Chain addressYesstring
    pagequerypage numberNoint
    page_sizequerypage sizeNoint

    Responses

    CodeDescriptionSchema
    200OKTransferIns
    401Unauthorized
    403Forbidden

    /cross_chain/v1/transfer_out_txs?address={address}

    Method

    GET

    Summary

    Query transfer-out cross chain transactions.

    Parameters

    NameLocated inDescriptionRequiredSchema
    addressqueryBNB Beacon Chain address or BNB Smart Chain addressYesstring
    pagequerypage numberNoint
    page_sizequerypage sizeNoint

    Responses

    CodeDescriptionSchema
    200OKTransferOuts
    401Unauthorized
    403Forbidden

    /cross_chain/v1/tx/{tx_hash}

    Method

    GET

    Summary

    Query cross chain transaction on target chain by transaction hash.

    Parameters

    NameLocated inDescriptionRequiredSchema
    tx_hashqueryBNB Smart Chain transaction hashYesstring

    Responses

    CodeDescriptionSchema
    200OKTx
    401Unauthorized
    403Forbidden

    /cross_chain/v1/reverse_tx/{tx_hash}

    Method

    GET

    Summary

    Query source transaction (the transaction on the other chain) by the transaction hash on target chain.

    Parameters

    NameLocated inDescriptionRequiredSchema
    tx_hashqueryBNB Beacon Chain transaction hashYesstring

    Responses

    CodeDescriptionSchema
    200OKReverseTx
    401Unauthorized
    403Forbidden

    Models

    Tx

    NameTypeDescriptionRequired
    has_refundbooleanwhether the transaction has been refundedYes
    cross_chain_tx_hashstringtransaction hash on the other chainYes
    refund_tx_hashstringrefund transaction hash if existsNo

    ReverseTx

    NameTypeDescriptionRequired
    original_chain_tx_hashstringsource transaction hash on the other chainYes

    TransferIns

    NameTypeDescriptionRequired
    pageintpage numberYes
    page_sizeintpage sizeYes
    total_countinttotal transactionsYes
    transfer_in_txsarraytransfer-in transaction hashesYes
    original_txsarraythe corresponding source transaction hashesYes

    TransferOuts

    NameTypeDescriptionRequired
    pageintpage numberYes
    page_sizeintpage sizeYes
    total_countinttotal transactionsYes
    transfer_out_txsarraytransfer-out transaction hashesYes
    original_txsarraythe corresponding source transaction hashesYes
    - + diff --git a/docs/learn/cross-chain-bridges.html b/docs/learn/cross-chain-bridges.html index d8bceef4d7..c36ce5dd97 100644 --- a/docs/learn/cross-chain-bridges.html +++ b/docs/learn/cross-chain-bridges.html @@ -8,13 +8,13 @@ - +

    Cross-Chain Bridges

    The ability to transfer tokens cross-chain is an essential need. This allows users to transfer their funds from one blockchain network to another. Keeping the importance of cross-chain support in mind, multiple networks now have their respective "bridges" to help in easy fund transfers. Following is a list of bridges and exchanges that support cross-chain transfer of BSC with other tokens.

    List of Cross-chain Bridges Supporting BNB Smart Chain

    TypeNameWebsiteTutorial
    Fungible TokenAnyswaphttps://bsc.anyswap.exchange/bridgeLink
    Fungible Tokenmultichain.xyzhttps://multichain.xyz/
    Fungible TokenxDaihttps://bsc-to-xdai-omnibridge.web.app/Link
    Fungible TokenPoly.networkhttps://bridge.poly.network/Link
    Fungible Tokenallbridgehttps://allbridge.io/link
    Fungible Tokenrenbridgehttps://bridge.renproject.io/Link
    Fungible TokenCeler cBridgehttps://cbridge.celer.network/Link
    NFTpNetworkhttps://dapp.ptokens.io/Link
    NFTcurvegridhttps://www.curvegrid.com/Link
    NFTs from SolanaPortal Bridgehttps://www.portalbridge.com/#/nftLink
    Fungible Tokens from SolanaPortal Bridgehttps://www.portalbridge.com/Link
    - + diff --git a/docs/learn/cross-chain.html b/docs/learn/cross-chain.html index de7e220b6b..9aa1d7286f 100644 --- a/docs/learn/cross-chain.html +++ b/docs/learn/cross-chain.html @@ -8,13 +8,13 @@ - +

    Cross-Chain Communication

    Cross-chain communication is the key foundation to allow the community to take advantage of the dual chain structure:

    • Users are free to create any tokenization, financial products, and digital assets on BSC or BC as they wish.
    • The items on BSC can be manually and programmingly traded and circulated in a stable, high throughput, lighting fast and friendly environment of BC.
    • Users can operate these in one UI and tooling ecosystem.

    Architecture Diagram

    img

    A native cross chain communication protocol is developed between BC (BNB Beacon Chain) and BSC (BNB Smart Chain). It has the following key parts:

    BC to BSC Architecture

    BC is a Tendermint-based, instant finality blockchain. Validators with at least ⅔*N+1 of the total voting power will co-sign each block on the chain. So that it is practical to verify the block transactions and even the state value via Block Header and Merkle Proof verification. This has been researched and implemented as "Light-Client Protocol", which are intensively discussed in the Ethereum community, studied and implemented for Cosmos inter-chain communication.

    BC-to-BSC communication will be verified in an "on-chain light client" implemented via BSC Smart Contracts (some of them may be "pre-compiled"). After some transactions and state change happen on BC, if a transaction is defined to trigger cross-chain communication,the Cross-chain "package" message will be created and BSC Relayers will pass and submit them onto BSC as data into the "build-in system contracts". The build-in system contracts will verify the package and execute the transactions if it passes the verification. The verification will be guaranteed with the below design:

    1. BC blocking status will be synced to the light client contracts on BSC from time to time, via block header and pre-commits, for the below information:

      • block and app hash of BC that are signed by validators
      • current validatorset, and validator set update
    2. the key-value from the blockchain state will be verified based on the Merkle Proof and information from above #1.

    After confirming the key-value is accurate and trustful, the build-in system contracts will execute the actions corresponding to the cross-chain packages. Some examples of such packages that can be created for BC-to-BSC are:

    1. Bind: bind the BEP2 tokens and BEP2E
    2. Transfer: transfer tokens after binding, this means the circulation will decrease (be locked) from BC and appear in the target address balance on BSC
    3. Error Handling: to handle any timeout/failure event for BSC-to-BC communication
    4. Validatorset update of BSC

    To ensure no duplication, proper message sequence and timely timeout, there is a "Channel" concept introduced on BC to manage any types of the communication.

    For relayers, please also refer to the below "Relayers" section.

    BSC to BC Architecture

    BSC uses Proof of Staked Authority consensus protocol, which has a chance to fork and requires confirmation of more blocks. One block only has the signature of one validator, so that it is not easy to rely on one block to verify data from BSC.

    To take full advantage of validator quorum of BC, an idea similar to many Bridge or Oracle blockchains is adopted:

    1. The cross-chain communication requests from BSC will be submitted and executed onto BSC as transactions. The execution of the transaction wil emit Events, and such events can be observed and packaged in certain "Oracle" onto BC. Instead of Block Headers, Hash and Merkle Proof, this type of "Oracle" package directly contains the cross-chain information for actions, such as sender, receiver and amount for transfer.
    2. To ensure the security of the Oracle, the validators of BC will form another quorum of "Oracle Relayers". Each validator of the BC should run a dedicated process as the Oracle Relayer. These Oracle Relayers will submit and vote for the cross-chain communication package, like Oracle, onto BC, using the same validator keys. Any package signed by more than ⅔*N+1 Oracle Relayers’ voting power is as secure as any block signed by ⅔*N+1 of the same quorum of validators’ voting power.

    By using the same validator quorum, it saves the light client code on BC and continuous block updates onto BC. Such Oracles also have Oracle IDs and types, to ensure sequencing and proper error handling.

    Timeout and Error Handling

    There are scenarios that the cross-chain communication fails. For example, the relayed package cannot be executed on BSC due to some coding bug in the contracts. Timeout and error handling logics are used in such scenarios.

    For the recognizable user and system errors or any expected exceptions, the two networks should heal themselves. For example, when BC to BSC transfer fails, BSC will issue a failure event and Oracle Relayers will execute a refund on BC; when BSC to BC transfer fails, BC will issue a refund package for Relayer to relay in order to unlock the fund.

    However, unexpected error or exception may still happen on any step of the cross-chain communication. In such a case, the Relayers and Oracle Relayers will discover that the corresponding cross-chain channel is stuck in a particular sequence. After a Timeout period, the Relayers and Oracle Relayers can request a "SkipSequence" transaction, the stuck sequence will be marked as "Unexecutable". A corresponding alerts will be raised, and the community has to discuss how to handle this scenario, e.g. payback via the sponsor of the validators, or event clear the fund during next network upgrade.

    - + diff --git a/docs/learn/ecosystem.html b/docs/learn/ecosystem.html index cdb2e6e42d..e9d6de3dee 100644 --- a/docs/learn/ecosystem.html +++ b/docs/learn/ecosystem.html @@ -8,13 +8,13 @@ - +

    BNB Chain Development Tools

    In order to check the latest updates on the ecosystem of BNB Chain, visit our official GitHub Page.

    The goal of this page is to provide the current status of the open-source BNB Smart Chain Tech Stack and highlight the potential interesting projects that are most demanded by the BSC community and ecosystem.

    About

    BNB Smart Chain is a 100% EVM compatible blockchain, and is one of the prime choices for decentralized application (dApp) development within many possible verticals including DeFi, NFT, Gaming, and many others.

    To get a better understanding of the current BSC landscope, we divide each of the layers into the various components which we feel are most important. We then highlight some of the existing projects as well as some potentially interesting projects that we would like to fund by Binance Accelerator Funds. If you see a component with 0 or 1 existing projects then it's likely that we would consider grant support in this area. By describing our areas of priority in detail we do not wish to preclude grant applications that address different areas that we may not have thought of. We would like to fund all projects that bring value to the ecosystem.

    📝 This is a living document and we are relying on our community to contribute to this and help maintain it. Please feel free to make edits and additions via pull requests.

    Layers of BSC Stack

    In the below sections you can find a list of different layers of the BSC Stack.

    Explorer and Wallets

    ComponentsExisting ProjectsPotentially Interesting Projects
    Desktop WalletsWise Safe (a port of Gnosis Safe), TokenPocket, infinity Wallet
    Browser ExtensionsBinance Wallet, MetaMask, MathWallet, SafePal, ezDeFi, BitKeep, Coin98, Rabby Wallet, Onto, Slope
    Mobile WalletsMathWallet, TrustWallet, BitKeep, TokenPocket, SafePal, ONTO Wallet, 1Inch Wallet, Coin98, Onto, Slope
    Web (burner) WalletsTorus,MyEtherWallet (MEW), Guarda
    CLI Walletgeth, Seth
    Wallet SDKsBSC Connector, Venly, Sequence.app, Web3Auth, Particle Network
    Multisignature WalletsMultiSigWalletGnosis, Qredo
    Hardware WalletsLedger, Trezor, SafePal
    Block ExplorersBSCScan, BSCtrace, NFTscan, Mintscan
    Validator DashboardsBSCScan, BSC-Staking
    Governance DashboardsUI for BSC proposal/vote
    BNBChain List ExplorerBNBChain List

    Infrastructure

    ComponentsExisting ProjectsPotentially Interesting Projects
    API/Node AccessNodereal, Ankr, Chainstack, NowNodes, QuickNode, Covalent, Infstones, Moralis
    NFT APIsNFTScan, BlockVision, Venly, Gomu, Bounce Finance, NFTrade
    Archive Node ServiceChainstack, InfStones, QuickNode, Nodereal’s Meganode
    Public RPC EndpointsRPC EndpointsMore public nodes are encouraged
    Community Polling Dashboard
    Gas Station Networkopengsn
    FaucetBSC Test Faucet
    BrowserOpera
    Dapp StoreDapp Bay, Magic Square

    Tools, APIs and Languages

    ComponentsExisting ProjectsPotentially Interesting Projects
    Smart Contract LanguagesSolidity, Vyper
    Dev FrameworksTruffle, Embark, Waffle, Dapp, OpenZeppelin SDK,hardhat, Starton
    IDEsBSC Studio,Remix,Intellij Solidity Plugin, ChainIDE
    Lint ToolsSolhint, Ethlint, Manticore, Slither, Echidna
    Testing ToolsSolidity code coverage, Solidity function profiler, eth-tester
    Test Blockchain Networksbscnode, Ganache
    Security ToolsMythX, Mythril, Oyente, Securify, Solgraph, solc-verify
    ABI (Application Binary Interface) ToolsABI decoder, ABI-gen, Ethereum ABI UI
    MonitoringNeufund - Smart Contract Watch, BlockScout, Terminal, Ethereum-watcher
    Frontend BSC APIsWeb3.js, Eth.js, Ethers.js, light.js
    Backend BSC APIsWeb3.py, Web3.php, Java Web3, Net Web3, Ruby Web3

    Goto BSC Developer Ecosystem to navigate the full list.

    Dapps infra

    ComponentsExisting ProjectsPotentially Interesting Projects
    Data Analytics & VisualizationThe Graph,DappRadar,dapp.com,CMC,dapp.review,DefiStation,BitQuery,PARSIQ, CryptoSlam, Nakji, Dune, YeildWatch, DeBank, Bloxy, Footprint Analytics, Web3Go
    NFT MarketplacesRareboard, Venly, NFTrade, Element
    OracleBinance Oracle, Band Protocol, ChainLink, Pyth
    Archive DataInfStones
    Decentralized StorageIPFS, Filecoin, Arweave, pinata.cloud
    Cross Chain BridgesrenVM, NerveNetwork,PolyNetwork, Orbit Bridge, Multichain, Celer cbridge, ChainHop, LayerZero, HashFlow , AxelarDecentralized, trustless, Open Access
    AutomationGelato
    BrowsersBrave, Opera
    Identity/DID/CredentialsOntology, Galaxy, Space ID, CyberConnect
    Easy Wallet OnboardingWeb3auth, Venly, Sequence
    Social NetworkingPrometeus, CyberConnect
    Gasless SolutionsBiconomy
    Governance/DAOTally, Collab.Land, Coinshift, Snapshot, HQ.xyz
    Gaming Related InfrastructureCarv (Gaming Credential), Community Gaming (Tournament), GameSpace
    Security AuditCertik, PeckShield, SlowMist, Staging Labs, Go+ / Plus, Verichains, HashDit, Halborn, Trail of Bits, Consensys Diligence, Zokyo
    PaymentSWFT, MultiSenderCeler Network, Connext
    Payment GatewayBinance Connect, Okse, Kado, SuperFluid, Pip, Bifinity, MoonPay, Transak
    - + diff --git a/docs/learn/genesis.html b/docs/learn/genesis.html index f177bfb493..46fd0aa0c0 100644 --- a/docs/learn/genesis.html +++ b/docs/learn/genesis.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ Genesis Link for Chapel Testnet: https://github.com/bnb-chain/bsc/releases/download/v1.0.2/testnet.zip

    Explaination

    • chainId

    66 for main-net and 96 for test-net. To compatible with third part service that already supports Ethereum, we’d better not use network id that Ethereum ecology that already used. The network id of test-net should be distinct from main-net.

    • period

    Minimum difference between two consecutive block’s timestamps. Suggested 3s for the testnet .

    • epoch

    Number of blocks after which to checkpoint and reset the pending votes. Suggested 100 for testnet

    • nonce

    The nonce is the cryptographically secure mining proof-of-work that proves beyond reasonable doubt that a particular amount of computation has been expended in the determination of this token value.

    In BNB Smart Chain, this value is always set to 0x0.

    • timestamp

    Must be at least the parent timestamp + BLOCK_PERIOD.

    • extraData

      • EXTRA_VANITY: Fixed number of extra-data prefix bytes reserved for signer vanity. Suggested 32 bytes
      • Signer Info: validator address
      • EXTRA_SEAL bytes (fixed) is the signer’s signature sealing the header.
    • gasLimit

    A scalar value equal to the current chain-wide limit of Gas expenditure per block. High in our case to avoid being limited by this threshold during tests. Note: this does not indicate that we should not pay attention to the Gas consumption of our Contracts.

    GasCeil is 40000000 for testnet

    • difficulty

    A scalar value corresponding to the difficulty level applied during the nonce discovering of this block. Suggested 0x1 for testnet

    • mixHash

    Reserved for fork protection logic, similar to the extra-data during the DAO. Must be filled with zeroes during normal operation.

    • coinbase

    System controled address for collecting block rewards

    • alloc

    Allows to define a list of pre-filled wallets.

    Contract NameAddressABI file
    BSCValidatorSet0x0000000000000000000000000000000000001000bscvalidatorset
    SlashIndicator0x0000000000000000000000000000000000001001slashindicator
    SystemReward0x0000000000000000000000000000000000001002systemreward
    TendermintLightClient0x0000000000000000000000000000000000001003tendermintlightclient
    TokenHub0x0000000000000000000000000000000000001004tokenhub
    RelayerIncentivize0x0000000000000000000000000000000000001005relayerincentivize
    RelayerHub0x0000000000000000000000000000000000001006relayerhub
    GovHub0x0000000000000000000000000000000000001007govhub
    TokenManager0x0000000000000000000000000000000000001008tokenmanager
    CrossChain0x0000000000000000000000000000000000002000crosschain
    • number

    Block height in the chain, where the height of the genesis is block 0.

    • parentHash

    The Keccak 256-bit hash of the entire parent block’s header (including its nonce and mixhash). Pointer to the parent block, thus effectively building the chain of blocks. In the case of the Genesis block, and only in this case, it's 0.

    BNB Smart Chain Initialization

    There are two requirements we need to meet:

    1. There are already some BNBs in the BC network when it starts up.
    2. All the initial validators of BNB Smart Chain should be recorded in the BC.

    The first one is a must, because if we want to transfer some BNB to BSC, we will consume some gas in BSC. So we must ensure there are already some BNBs in BSC. That means the first interchain transfer should be done in the genesis block of side chain.

    For the second one, we should have that to ensure all the validators info and changes are tracked in the main chain.

    So the solution is we enable the staking functionality of BSC first on BC. So people can apply to be a validator or delegate to these candidates. We can have a time limit. After that, we collect all the elected validators and write them to the genesis of BSC.

    Account and Address

    For normal users, all the keys and addresses can be generated via Binance Extension Wallet.

    This default wallet would use a similar way to generate keys as Ethereum, i.e. use 256 bits entropy to generate a 24-word mnemonic based on BIP39, and then use the mnemonic and an empty passphrase to generate a seed; finally use the seed to generate a master key, and derive the private key using BIP32/BIP44 with HD prefix as "44'/60'/", which is the same as Ethereum's derivation path.

    - + diff --git a/docs/learn/gnosis.html b/docs/learn/gnosis.html index 5a7ce8181b..0e3f5f6b76 100644 --- a/docs/learn/gnosis.html +++ b/docs/learn/gnosis.html @@ -8,13 +8,13 @@ - +

    Gnosis Safe Multisig on BNB Smart Chain

    Introduction

    First deployed in early 2017, Gnosis multi-signature wallet became the foundational infrastructure for storing funds on Ethereum. The Gnosis Safe is the most secure way to manage your crypto funds.

    Today, you can set up the Gnosis Safe Multisig on BNB Smart Chain in less than 60 seconds, and you can use wallets including Ledger, Trezor, Wallet Connect, Torus, and browser wallets like Metamask as signing keys so that you can manage your crypto collectively and inter-operably.

    Advantages of Gnosis Safe contracts

    The Gnosis Safe is a smart contract wallet with multi-signature functionality at its core. It enables the following features:

    • High Security

    • Advanced execution logic

    • Advanced access management

    Mainnet Deployment Address

    NameAddress
    GnosisSafeProxyFactoryhttps://bscscan.com/tx/0x73481bbd5a80aa4510869877aa385be63d32b80a2931c663f137604840646e62
    GnosisSafehttps://bscscan.com/address/0x2bb001433cf04c1f7d71e3c40fed66b2b563065e#code
    CreateAndAddModuleshttps://bscscan.com/address/0x2e133d504f011019135cba146b2154438e214530
    MultiSendhttps://bscscan.com/address/0x663a65a0523103846a1761ab90a1a4731156c453
    StateChannelModulehttps://bscscan.com/address/0x5503e23e8298841cb0c3612ba9f5eb306202557d
    DailyLimitModulehttps://bscscan.com/address/0x1bc46962bced5c37b27531a222a0599d9daf0e41
    SocialRecoveryModulehttps://bscscan.com/address/0x8630b088c3060caae3fa9c0a76606c8402c60881
    WhitelistModulehttps://bscscan.com/address/0x62256a26611842ee95622076223e7065159b82af

    Set up your own Gnosis Safe Multisig Now

    Projects building with the Gnosis Safe

    Please read the list here

    User Guides

    Create Gnosis Safe

    • Go to the welcome page here

    img

    • Connect wallet

    img

    • Create Safe

    img

    • Choose owners and confirmations

    img

    • Review safe settings

    img

    • Sign transactions to create your safe

    img

    Great! You have created a Gnosis safe.

    img

    Receive Funds for Multi-sig Wallet

    • Go to the home page

    img

    • Click on "Receive" to get QR code for receiving funds

    Send Funds from Multi-sig Wallet

    • Go to the home page

    img

    • Click on "Send" to create a transaction
    • Submit transaction
    • Signing your request
    • Another key person needs to connect with Gnosis to confirm this transaction
    • Approve Transaction
    • Sign transaction
    • Transaction will be sent after the second signature is sent

    img

    • The others may reject the transaction, they only need to send a different transaction

    Load existing Safe

    • Select "Load Existing Safe"
    • Input address

    img

    • Verify owner

    img

    • Click load

    img

    • Load Transactions

    img

    API

    API to keep track of transactions sent via Gnosis Safe smart contracts

    https://safe-transaction.gnosis.io/

    - + diff --git a/docs/learn/incentives.html b/docs/learn/incentives.html index 4b1951bdaa..08afe70f45 100644 --- a/docs/learn/incentives.html +++ b/docs/learn/incentives.html @@ -8,14 +8,14 @@ - +

    Incentive Mechanism

    The BSC relayers play an important role in relaying interchain packages from BC to BSC. All BSC relayers build their stable infrastructure, watch any event happened on the BNB Beacon Chain, and act timely to get paid accordingly. The following discussion is about how to distribute the rewards to let the relayers are willing to make a long-term contribution.

    Principle

    Considering the following points:

    1. Fairness, competitiveness, and redundancy: Everyone has a chance to run a relayer even on cheap hardware. It should be hard for someone to get all the rewards.
    2. Simplicity.
    3. Robustness: The relayer may have a strategy to make its largest profit accordingly, under any condition, the interchain communication should not be blocked.
    4. Low Risk: The relayer should take a little risk to play in this game. For the top N relayers, they should gain enough rewards to cover the cost.

    It is tough hard to achieve all these goals; we make some trade-off on robustness and low risk in the following design.

    Rewards Source and Allocation

    We have three reward sources:

    1. Users paid rewards: Users who send bind or cross chain transfer transactions need to pay extra fee as BSC relayer rewards.
    2. System rewards: Rewards comes from SystemReward contract.

    The role of relayers and their rewards comes from:

    Relayer BehaviorRewards come from
    User packages(bind, unbind, transfer) from BC to BSCUsers pay for the reward
    System packages(staking, slash, governance) from BC to BSCSystem reward
    Relayer for sync tendermint header to light client contractSystem reward

    Rewards Distribution Formula

    To prevent the relayer who has the best network always winning the game, we gather the reward into two reward pools (header relayer reward pool and package relayer reward pool) and reallocate to the relayers to achieve redundancy:

    1. S is a constant number of transactions that in around. Each round, there are S transactions, and the last transaction of the round will trigger reward distribution.
    2. N is the maximum weight that a relayer can gain in a round. R is the total reward in this round. Ki is the number of successful transactions from Relayer i. Wi is the reward weight of Relayer i. Ri is the rewards of Relayer i.
    3. R is the total reward in this round.
    4. Ki is the number of successful transactions from Relayer i.
    5. Wi is the reward weight of Relayer i.
    6. Ri is the rewards of Relayer i.

    Weight formula for package relayers:

    formula

    Rp represents the total balance of package reward pool.

    Weight formula for header relayers:

    formula

    Rh represents the total balance of header reward pool.

    We consider setting these parameters a reasonable value:

    1. S to be 100. Some rewards come from gas fee, we can not guarantee enough rewards during a small round, a large round may dismiss deviation and let relayer give up relaying when it has made its max profit.
    2. N to be 40. We think the redundancy of relayer around 3-5 is best. If N is too large, the redundancy will decrease. If N is too small, then there will not be enough relayers. Set N as 40 may be a reasonable value, at least 3 relayers can compete.
    3. The relayFee of a single package and the ratio of reward for header relayer can be modified by governance on BNB Beacon Chain.

    Distribution And Claim Reward

    In each round, the last package delivery transaction will trigger the reward distribution. Both the header reward pool and package reward pool will be distributed. However, the reward won't be paid directly to relayer accounts. The distribution algorithm just calculates rewards for all relayers and writes down the amounts. Relayers are required to actively send transactions to claim their own accumulated rewards.

    Other Consideration

    System Reward Pool

    The system reward pool can hold at most 100BNB for example, to prevent the pool get unnecessary income.

    The client needs to query the balance of the contract to decide whether to distribute 1/16 of the transaction fee to the contract or not. It seems not that fair that some validators pay more to the reward pool than others, but this is random and will eventually become fair in the long run.

    If there are not enough rewards in the pool, all the tokens in the pool will be distributed.

    Block header sync transaction with validatorSet change will claim reward to relayers from system reward pool directly.

    Foul Play

    For example, a relayer may deliver packages using a different address in round robin, we can’t recognize this. We try to introduce registration and BNB deposit for relayer to raise the cost of cheat. How it works:

    • A BSC account needs to call the register of RelayerHub contract to deposit 100BNB(more or less than 100 BNB will be rejected) to become a BSC relayer.
    • Only a valid relayer can sync BNB Beacon Chain Headers and deliver cross-chain packages.
    • Relayer can withdraw its deposit, but we will charge 0.1 BNB as the transaction fee so that it will receive 99.9 BNB back.
    • The charged fee will directly go to the system reward pool.
    - + diff --git a/docs/learn/intro.html b/docs/learn/intro.html index ebd630654d..2b97426f0f 100644 --- a/docs/learn/intro.html +++ b/docs/learn/intro.html @@ -8,14 +8,14 @@ - +

    Introduction

    BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection, malicious vote detection and other slashing logic guarantee security, stability, and chain finality. Other than the 29 active validators, BSC will introduce more validators, e.g. another 20 inactive validators, into the validator set as backups, which will be called "Candidates".

    Candidates will produce blocks and charge gas fees in BSC mainnet, but in a much less chance than the official validator set of 29 elected. The unavailable candidates will be slashed as well though in a smaller size. A decent motivation is expected to be maintained so that the candidate validators are willing to ensure the quality and help secure BSC.

    In an extreme case, if a majority of the active 29 validators get attacked and offline, Candidate Validators can report to BNB Beacon Chain about the stale blocking, resume it and eventually propose a re-election of the active validator set.

    The BNB Smart Chain also supports EVM-compatible smart contracts and protocols. Cross-chain transfer and other communication are possible due to native support of interoperability. The BNB Smart Chain will be:

    • A self-sovereign blockchain: Provides security and safety with elected validators.
    • EVM-compatible: Supports all the existing Ethereum tooling along with faster finality and cheaper transaction fees.
    • Fast Finality: Finalizes the chain within two blocks in most cases.
    • Interoperable: Comes with efficient native dual chain communication; Optimized for scaling high-performance dApps that require a fast and smooth user experience.
    • Distributed with on-chain governance: Proof of Staked Authority (PoSA) brings in decentralization and community participants. As the native token, BNB will serve as both the gas of smart contract execution and tokens for staking.

    Proof of Staked Authority

    Although Proof-of-Work (PoW) has been recognized as a practical mechanism to implement a decentralized network, it is not friendly to the environment and also requires a large size of participants to maintain the security.

    Ethereum and some other blockchain networks, such as MATIC Bor, TOMOChain, GoChain, xDAI, do use Proof-of-Authority(PoA) or its variants in different scenarios, including both testnet and mainnet. PoA provides some defense to 51% attack, with improved efficiency and tolerance to certain levels of Byzantine players (malicious or hacked). It serves as an easy choice to pick as the fundamentals.

    Meanwhile, the PoA protocol is most criticized for being not as decentralized as PoW, as the validators, i.e. the nodes that take turns to produce blocks, have all the authorities and are prone to corruption and security attacks. Other blockchains, such as EOS and Lisk both, introduce different types of Delegated Proof of Stake (DPoS) to allow the token holders to vote and elect the validator set. It increases the decentralization and favors community governance.

    BSC here proposes to combine DPoS and PoA for consensus, so that:

    1. Blocks are produced by a limited set of validators
    2. Validators take turns to produce blocks in a PoA manner, similar to Ethereum's Clique consensus design
    3. Validator set are elected in and out based on a staking based governance

    Fast finalization can greatly improve user experience. The Fast Finality feature will be enabled upon the coming Plato upgrade. This will be a major advantage of BSC, and many dapps will benefit from it.

    The consensus protocol of BSC fulfills the following goals:

    1. Short Blocking time, 3 seconds on mainnet.
    2. It requires quite short time to confirm the finality of transactions, around 6s for mainnet after the coming Plato upgrade.
    3. There is no inflation of native token: BNB, the block reward is collected from transaction fees, and it will be paid in BNB.
    4. It is 100% compatible with Ethereum system .
    5. It allows modern proof-of-stake blockchain network governance.

    Security

    Given there are more than ½*N+1 validators are honest, PoA based networks usually work securely and properly. However, there are still cases where certain amount Byzantine validators may still manage to attack the network, e.g. through the Clone Attack. BSC does introduce Slashing logic to penalize Byzantine validators for double signing or inavailability. This Slashing logic will expose the malicious validators in a very short time and make the "Clone Attack" very hard or extremely non-beneficial to execute.

    Fast Finality

    Finality is critical for blockchain security, once the block is finalized, it wouldn’t be reverted anymore. The fast finality feature is very useful, the users can make sure they get the accurate information from the latest finalized block, then they can decide what to do next instantly. More details of design, please to refer BEP-126

    Before the coming Plato upgrade,to secure as much as BC, BSC users are encouraged to wait until receiving blocks sealed by more than ⅔*N+1 different validators. In that way, the BSC can be trusted at a similar security level to BC and can tolerate less than ⅓*N Byzantine validators.With 21 validators, if the block time is 3 seconds, the ⅔*N+1 different validator seals will need a time period of (⅔*21+1)*3 = 45 seconds. Any critical applications for BSC may have to wait for ⅔*N+1 to ensure a relatively secure finality. With above enhancement by slashing mechanism, ½*N+1 or even fewer blocks are enough as confirmation for most transactions.

    After the coming Plato upgrade, the feature Fast Finality will be enabled. The chain will be finalized within two blocks if ⅔*N or more validators vote normally, otherwise the chain has a fixed number of blocks to reach probabilistic finality as before.

    Reward

    All the BSC validators in the current validator set will be rewarded with transaction fees in BNB. As BNB is not an inflationary token, there will be no mining rewards as what Bitcoin and Ethereum network generate, and the gas fee is the major reward for validators. After the coming Plato upgrade, part of the fees collected will be used as reward for finality voting. As BNB is also utility tokens with other use cases, delegators and validators will still enjoy other benefits of holding BNB.

    The reward for validators is the fees collected from transactions in each block. Validators can decide how much to give back to the delegators who stake their BNB to them, in order to attract more staking. Every validator will take turns to produce the blocks in the same probability (if they stick to 100% liveness), thus, in the long run, all the stable validators may get a similar size of the reward. Meanwhile, the stakes on each validator may be different, so this brings a counter-intuitive situation that more users trust and delegate to one validator, they potentially get less reward. So rational delegators will tend to delegate to the one with fewer stakes as long as the validator is still trustful (insecure validator may bring slashable risk). In the end, the stakes on all the validators will have less variation. This will actually prevent the stake concentration and "winner wins forever" problem seen on some other networks.

    Token Economy

    BC and BSC share the same token universe for BNB and BEP2 tokens. This defines:

    1. The same token can circulate on both networks, and flow between them bi-directionally via a cross-chain communication mechanism.
    2. The total circulation of the same token should be managed across the two networks, i.e. the total effective supply of a token should be the sum of the token’s total effective supply on both BSC and BC.
    3. The tokens can be initially created on BSC in a similar format as ERC20 token standard, or on BC as a BEP2, then created on the other. There are native ways on both networks to link the two and secure the total supply of the token.

    Cross-Chain Transfer and Communication

    Cross-chain communication is the key foundation to allow the community to take advantage of the dual chain structure:

    1. users are free to create any tokenization, financial products, and digital assets on BSC or BC as they wish
    2. the items on BSC can be manually and programmingly traded and circulated in a stable, high throughput, lighting fast and friendly environment of BC
    3. users can operate these in one UI and tooling ecosystem.

    Staking and Governance

    Proof of Staked Authority brings in decentralization and community involvement. Its core logic can be summarized as the below. You may see similar ideas from other networks, especially Cosmos and EOS.

    1. Token holders, including the validators, can put their tokens "bonded" into the stake. Token holders can delegate their tokens onto any validator or validator candidate, to expect it can become an actual validator, and later they can choose a different validator or candidate to re-delegate their tokens1.
    2. All validator candidates will be ranked by the number of bonded tokens on them, and the top ones will become the real validators.
    3. Validators can share (part of) their blocking reward with their delegators.
    4. Validators can suffer from "Slashing", a punishment for their bad behaviors, such as double sign and/or instability.
    5. There is an "unbonding period" for validators and delegators so that the system makes sure the tokens remain bonded when bad behaviors are caught, the responsible will get slashed during this period.
    - + diff --git a/docs/learn/oracle-module.html b/docs/learn/oracle-module.html index 983a8c078a..81a8aff3dd 100644 --- a/docs/learn/oracle-module.html +++ b/docs/learn/oracle-module.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Oracle on BNB Beacon Chain

    The Oracle module is a common module like the Governance module which is used to handle prophecy and claim. Prophecy means the validators want to reach a consensus on something, like cross chain transfer. Claim is raised by a validator and the content of claim is the cross chain transfer. When most of the validators (like 70%) claim the same thing on the prophecy, the winning claim will be executed.For oracle module is a common module, other module which depends on oracle module will register claim type and related hooks checking and handling claim. Each claim type has a sequence, oracle module should process prophecy and claim by sequence. When one prophecy is executed successfully, the sequence of the claim type will be increased by one.

    Oracle Process

    1. Oracle module receives a claim message from validator, if the sequence is not current sequence, the claim message will be rejected.
    2. If sequence is valid, the hooks of the claim type will check the claim message, if the claim message is invalid, then return
    3. If the claim message is valid and it’s the first claim, the related prophecy will be created. If claim message is not the first claim, then it will be added to the existed prophecy.
    4. If the power of validators which claim the same content reaches a threshold like 70%, the prophecy will be marked success and the hooks will execute the winning claim and the sequence of claim type will be increased.
    5. If there is no chance that the validators will reach a consensus, the prophecy will be marked failed and the prophecy will be deleted and the validators should start over again.

    Bridge Module

    Bridge module will process cross chain transactions. It contains two parts: transactions from BC to BSC and transactions from BSC to BC. For transactions from BSC to BC, it will depend on the oracle module. When the validators reach a consensus on a certain claim, the bridge module will process the transaction according to the claim, like transfer from BSC to BC. For transactions from BC to BSC, it will process the BC part of the transaction and write the related cross chain package for BSC.

    - + diff --git a/docs/learn/oracle-relayer.html b/docs/learn/oracle-relayer.html index e7404c21a2..42c226b7ea 100644 --- a/docs/learn/oracle-relayer.html +++ b/docs/learn/oracle-relayer.html @@ -8,13 +8,13 @@ - +

    Oracle Relayer

    The relayer is a service which monitors events on BSC, builds and broadcasts transactions to BC. Each validator operator should maintain its own relayer service. The relayer service requires to have access to the validator operator private key. All relayer service independently witness the peggy contract events, then build transactions to claim events to BC oracle module.

    The relay process:

    • Continually listen for cross chain event
    • Parse the cross-chain transfer parameters from event data
    • Use this information to build an unsigned BC oracle transaction
    • Sign and broadcast transaction.

    GitHub Implementation link: https://github.com/bnb-chain/oracle-relayer

    - + diff --git a/docs/learn/system-contract.html b/docs/learn/system-contract.html index f80cb83943..a2a3b9b692 100644 --- a/docs/learn/system-contract.html +++ b/docs/learn/system-contract.html @@ -8,13 +8,13 @@ - +

    Build-in System Contract

    GitHub Implementation link: https://github.com/bnb-chain/bsc-genesis-contract

    Contract NameContract AddressABI file
    BSCValidatorSet Contract0x0000000000000000000000000000000000001000bscvalidatorset
    Liveness Slash Contract0x0000000000000000000000000000000000001001slashindicator
    SystemReward Contract0x0000000000000000000000000000000000001002systemreward
    TendermintLightClient Contract0x0000000000000000000000000000000000001003tendermintlightclient
    TokenHub Contract0x0000000000000000000000000000000000001004tokenhub
    RelayerIncentivize Contract0x0000000000000000000000000000000000001005relayerincentivize
    RelayerHub Contract0x0000000000000000000000000000000000001006relayerhub
    GovHub Contract0x0000000000000000000000000000000000001007govhub
    TokenManager Contract0x0000000000000000000000000000000000001008tokenmanager
    CrossChain Contract0x0000000000000000000000000000000000002000crosschain
    Native Staking Contract0x0000000000000000000000000000000000002001staking

    On-Chain Light Client

    The purpose of cross-chain interoperability is to enable one blockchain to function as a light-client of another. Since BNB Beacon Chain is using a classical Byzantine Fault Tolerant consensus algorithm, light-client verification is cheap and easy: all we have to do is check validator signatures on the latest block, and verify a Merkle proof of the state.

    In Tendermint, validators agree on a block before processing it. This means that the signatures and state root for that block aren't included until the next block. Thus, each block contains a field called LastCommit, which contains the votes responsible for committing the previous block, and a field in the block header called AppHash, which refers to the Merkle root hash of the application after processing the transactions from the previous block. So, if we want to verify the AppHash from height H, we need the signatures from LastCommit at height H+1. (And remember that this AppHash only contains the results from all transactions up to and including block H-1)

    Unlike Proof-of-Work, the light-client protocol does not need to download and check all the headers in the blockchain - the client can always jump straight to the latest header available, so long as the validator set has not changed much. If the validator set is changing, the client needs to track these changes, which requires downloading headers for each block in which there is a significant change. Here, we will assume the validator set is constant, and postpone handling validator set changes for another time.

    Ethereum platform supports stateless precompiled contract implemented with golang and normal contract implemented with solidity. As compared to normal contracts, precompiled contracts are more efficient and costs less gas, but they are stateless. However, on-chain light client must be stateful. So here we will try to a mixed approach: precompiled implemented contract(stateless calculation, such as signature verification) and normal contract (store validator set and trusted appHash).

    img

    Precompile Contract

    Validate Tendermint Header

    This contract implements tendermint header verification algorithm. The input parameters contain the trusted consensus state and a new tendermint header. The validation algorithm will verify the new tendermint header against the trusted consensus state. If the new header is valid, a new consensus state will be created and returned to caller. Otherwise, an error will be returned.

    Validate Merkle Proof

    This contract implements a Tendermint merkle proof verification algorithm.

    Build-in System Contract

    Merkle Proof Verification Library

    This library provides an util to verify merkle proof from BC. Contracts which need to verify Merkle proof just need to import this library.

    TokenHub Contract

    This contract focuses on cross chain token transfer.

    TokenManager Contract

    This contract focuses on binding and unbinding tokens on two chains.

    BSCValidatorSet Contract

    It is a watcher of validators change of BSC on BNB Beacon Chain. It will interact with light client contracts to verify the interchain transaction, and apply the validator set change for BSC. It also stores rewarded gas fee of blocking for validators, and distribute it to validators when receiving cross chain package of validatorSet change.

    System Reward Contract

    The incentive mechanism for relayers to maintain system contracts. They will get rewards from system reward contract.

    Liveness Slash Contract

    The liveness of BSC relies on validator set can produce blocks timely when it is their turn. Validators can miss their turns due to any reason. This instability of the operation will hurt the performance of the network and introduce more non-deterministic into the system. This contract responsible for recording the missed blocking metrics of each validator. Once the metrics are above the predefined threshold, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators.

    BscValidatorSet Contract

    This contract focuses on handling staking change package from BC. It also provides the validatorset data query for BSC consensus engine.

    RelayerHub Contract

    This contract manages the authority of bsc-relayer. Someone who wants to run a bsc-relayer must call the contract to deposit some BNB to get the authorization.

    Governance Contract

    This contract handles the governance package from BC. The governance package contains the target contract address, parameter name and new parameter value. Once the package is verified, this contract will call the parameter update method of the target contract to update the parameter to new value.

    Cross Chain Contract

    This contract focuses on cross chain packages pretreatment and sending cross chain packages to BC by emit event. The packages pretreatment includes sequence validation and the merkle proof verification. Once they are passed, the package will be routed to application build-in system contract, such as tokenhub or bscvalidator. Besides, if tokenhub or bscvalidator wants to send packages to BC, they need to encode their packages with rlp and call this contract to send them.

    - + diff --git a/docs/link.html b/docs/link.html index 22a9851e98..b093204735 100644 --- a/docs/link.html +++ b/docs/link.html @@ -8,13 +8,13 @@ - +

    BNB Smart Chain Price Feeds from Chainlink

    Introduction to Price Feeds

    Chainlink Price Feeds provide a way to connect your smart contracts to the real-world market prices of assets. They enable smart contracts to retrieve the latest price of an asset in a single call.

    Often, smart contracts need to act upon prices of assets in real-time. This is especially true in DeFi. For example, Synthetix use Price Feeds to determine prices on their derivatives platform. Lending and Borrowing platforms like AAVE use Price Feeds to ensure the total value of the collateral.

    Get the Latest Price

    This section explains how to get the latest price of BNB inside smart contracts using Chainlink Price Feeds, on the BNB Smart Chain.

    Solidity Contract

    To consume price data, your smart contract should reference AggregatorV3Interface, which defines the external functions implemented by Price Feeds.

    pragma solidity ^0.6.7;

    import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

    contract PriceConsumerV3 {

    AggregatorV3Interface internal priceFeed;

    /**
    * Network: BNB Smart Chain
    * Aggregator: BNB/USD
    * Address: 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE
    */
    constructor() public {
    priceFeed = AggregatorV3Interface(0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE);
    }

    /**
    * Returns the latest price
    */
    function getLatestPrice() public view returns (int) {
    (
    uint80 roundID,
    int price,
    uint startedAt,
    uint timeStamp,
    uint80 answeredInRound
    ) = priceFeed.latestRoundData();
    return price;
    }
    }

    Javascript Web3

    const Web3 = require("web3");
    const web3 = new Web3("https://data-seed-prebsc-1-s1.bnbchain.org:8545");
    const aggregatorV3InterfaceABI = [{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}];
    const addr = "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE";
    const priceFeed = new web3.eth.Contract(aggregatorV3InterfaceABI, addr);
    priceFeed.methods.latestRoundData().call()
    .then((roundData) => {
    // Do something with roundData
    console.log("Latest Round Data", roundData)
    });

    Python Web3

    from web3 import Web3
    web3 = Web3(Web3.HTTPProvider('https://data-seed-prebsc-1-s1.bnbchain.org:8545'))
    abi = '[{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]'
    addr = '0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE'
    contract = web3.eth.contract(address=addr, abi=abi)
    latestData = contract.functions.latestRoundData().call()
    print(latestData)

    Get Historical Price Data

    The most common use case for Price Feeds is to get the latest price. However, AggregatorV3Interface also exposes functions which can be used to retrieve price data of a previous round ID.

    Solidity Contract

    pragma solidity ^0.6.7;

    import "https://github.com/smartcontractkit/chainlink/blob/master/evm-contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

    contract HistoricalPriceConsumerV3 {

    AggregatorV3Interface internal priceFeed;

    /**
    * Network: BNB Smart Chain
    * Aggregator: BNB/USD
    * Address: 0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE
    */
    constructor() public {
    priceFeed = AggregatorV3Interface(0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE);
    }

    /**
    * Returns historical price for a round id.
    * roundId is NOT incremental. Not all roundIds are valid.
    * You must know a valid roundId before consuming historical data.
    * @dev A timestamp with zero value means the round is not complete and should not be used.
    */
    function getHistoricalPrice(uint80 roundId) public view returns (int256) {
    (
    uint80 id,
    int price,
    uint startedAt,
    uint timeStamp,
    uint80 answeredInRound
    ) = priceFeed.getRoundData(roundId);
    require(timeStamp > 0, "Round not complete");
    return price;
    }
    }

    Javascript Web3


    const Web3 = require("web3");

    const web3 = new Web3("https://data-seed-prebsc-1-s1.bnbchain.org:8545");
    const aggregatorV3InterfaceABI = [{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}];
    const addr = "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE";
    const priceFeed = new web3.eth.Contract(aggregatorV3InterfaceABI, addr);

    // Valid roundId must be known. They are NOT incremental.
    let validId = BigInt("18446744073709554130");

    priceFeed.methods.getRoundData(validId).call()
    .then((historicalRoundData) => {
    // Do something with price
    console.log("Historical round data", historicalRoundData);
    })

    Python Web3

    from web3 import Web3

    web3 = Web3(Web3.HTTPProvider('https://data-seed-prebsc-1-s1.bnbchain.org:8545'))
    abi = '[{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]'
    addr = '0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE'
    contract = web3.eth.contract(address=addr, abi=abi)

    # Valid roundId must be known. They are NOT incremental.
    validRoundId = 18446744073709554130

    historicalData = contract.functions.getRoundData(validRoundId).call()
    print(historicalData)

    API Reference

    API reference for AggregatorV3Interface.

    Functions

    NameDescription
    decimalsThe number of decimals in the response.
    descriptionThe description of the aggregator that the proxy points to.
    getRoundDataGet data from a specific round.
    latestRoundDataGet data from the latest round.
    versionThe version representing the type of aggregator the proxy points to.

    decimals

    Get the number of decimals present in the response value.

    function decimals() external view returns (uint8)
    • RETURN: The number of decimals.

    description

    Get the description of the underlying aggregator that the proxy points to.

    function description() external view returns (string memory)
    • RETURN: The description of the underlying aggregator.

    getRoundData

    Get data about a specific round, using the roundId.

    function getRoundData(uint80 _roundId) external view
    returns (
    uint80 roundId,
    int256 answer,
    uint256 startedAt,
    uint256 updatedAt,
    uint80 answeredInRound
    )

    Parameters

    • roundId: The round ID

    Return Values

    • roundId: The round ID.
    • answer: The price.
    • startedAt: Timestamp of when the round started.
    • updatedAt: Timestamp of when the round was updated.
    • answeredInRound: The round ID of the round in which the answer
      • was computed.

    latestRoundData

    Get the price from the latest round.

    function latestRoundData() external view
    returns (
    uint80 roundId,
    int256 answer,
    uint256 startedAt,
    uint256 updatedAt,
    uint80 answeredInRound
    )

    Return Values

    • roundId: The round ID.
    • answer: The price.
    • startedAt: Timestamp of when the round started.
    • updatedAt: Timestamp of when the round was updated.
    • answeredInRound: The round ID of the round in which the answer
      • was computed.

    version

    The version representing the type of aggregator the proxy points to.

    function version() external view returns (uint256)
    • RETURN: The version number.

    Contract Addresses

    Chainlink price feed contracts are updated on a regular basis by multiple Chainlink nodes. This section lists the contract addresses for Price Feeds on the BNB Smart Chain.

    Mainnet

    PairProxy
    BNB / USD0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE
    BTC / USD0x264990fbd0A4796A3E3d8E37C4d5F87a3aCa5Ebf
    ETH / USD0x9ef1B8c0E4F7dc8bF5719Ea496883DC6401d5b2e

    Original source is from Chainlink website

    - + diff --git a/docs/manual.html b/docs/manual.html index 2dd1a6894d..81e2e41ef5 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -8,13 +8,13 @@ - +

    How to Manually Install Binance Extension Wallet

    Download the zip file

    img

    • Click Chrome and you will download the file BinanceChainBrowserExtension-1.114.0.zip

    Install in Chrome

    • Visit chrome://extensions/

    • Open the Developer mode

    img

    • Drag and drop the mathwallet.zip file into the Extension window. Then the installation is completed.

    Other browsers

    The same method is working for the browsers such as Firefox, Brave etc. If you have any other questions, join our Telegram Channel.

    Note: manually installed version will not upgrade automatically, so you will need to manually install the new version.

    - + diff --git a/docs/migration/evm-chains/chain-comparison.html b/docs/migration/evm-chains/chain-comparison.html index 2b6dabd495..a03770401e 100644 --- a/docs/migration/evm-chains/chain-comparison.html +++ b/docs/migration/evm-chains/chain-comparison.html @@ -8,7 +8,7 @@ - + @@ -23,7 +23,7 @@ As Polygon is a Layer-2 scaling solution that utilizes sidechains for performing computation, it can also be regarded as a Commit Chain of Ethereum. This means Polygon can't exist without Ethereum as all the final transactions are done on Ethereum. Currently, Polygon uses the POS (Proof of Stake) algorithm which is less decentralized, but they plan to move to ZK rollups to address the criticism it receives for itd. On the other hand, BSC is a hard fork of Ethereum. As BSC is a separate Layer-1 blockchain of its own, it does not need Ethereum to survive and thus has achieved 100% availability since its inception - even during the time Ethereum experienced downtimes.

    EVM Compatibility

    Support for the EVM allows interoperability between BSC, Polygon Network, and the Ethereum Network. So, developers can conveniently migrate their dApps from the Ethereum network to either Polygon or BSC and vice versa.

    Architecture

    Overview of BSC’s Architecture

    BNB Chain is an ecosystem comprising of two major blockchains that serve different purposes, namely, BNB Beacon Chain (BC) and BNB Smart Chain (BSC). To deal with the increased volumes of transactions and daily active users (DAU), BNB Chain ecosystem has evolved to add more scaling solutions and now includes the following components with different responsibilities and purposes.

    1. BNB Beacon Chain - BNB Chain Governance (staking, voting)
    2. BNB Smart Chain (BSC) - EVM compatible, consensus layers, and with hubs to multi-chains
    3. ZkBNB- ZkRollup solution to scale BSC as a super high-performance blockchain.

    bnb-chain-ecosystem

    The design principles of BSC:

    1. Standalone Blockchain: even though BSC can be termed as a Layer-2 solution to BNB Beacon Chain, technically, it is a standalone blockchain. Most of the fundamental technical and business functions of BSC are self-contained and it can run well even if the BC is stopped.
    2. Ethereum Compatibility: To take advantage of the mature applications and community of Ethereum, BSC chooses to be compatible with the existing Ethereum mainnet. This means all of the dApps, ecosystem components, and toolings work with BSC and require zero or minimum changes. Furthermore, BSC nodes require similar (or a bit higher) hardware specification and skills to run and operate.
    3. Staking Involved Consensus and Governance: Staking-based consensus is more environmentally friendly and leaves more flexible options to community governance. Expectedly, this consensus enables better network performance over proof-of-work blockchain systems, i.e., faster blocking time and higher transaction capacity.
    4. Native Cross-Chain Communication: both BC and BSC are implemented with native support for cross-chain communication among the two blockchains. The communication protocol is designed to be bi-directional, decentralized, and trustless. It concentrates on moving digital assets between BC and BSC, i.e., BEP2 tokens, and eventually, any other BEP tokens introduced later.

    Overview of the Polygon’s Architecture

    Polygon’s architecture can be divided into three layers.

    • *Ethereum layer: comprises a set of contracts for different functionalities, like staking, checkpointing, and rewards, that exist on the Ethereum mainnet.
    • *Heimdall layer: comprises a set of proof-of-stake Heimdall nodes that run parallel to the Ethereum mainnet and are responsible for monitoring the set of staking contracts deployed on the Ethereum mainnet and committing the Polygon Network checkpoints to the Ethereum mainnet. Heimdall is based on the Tendermint protocol.
    • *Bor layer: a set of block-producing Bor nodes shuffled by Heimdall nodes. Bor is based on Go Ethereum.

    Staking management smart contracts on Ethereum

    A set of staking management contracts are employed on the Ethereum mainnet which enable the Proof of Stake (PoS) mechanism on Polygon. The staking contracts implement the following features:

    • Anyone can stake the MATIC tokens on the staking contracts existing on the Ethereum mainnet to join the Polygon system as a validator.
    • Earn staking rewards for validating state transitions on the Polygon Network.
    • Save checkpoints on the Ethereum mainnet.
    Heimdall (validation layer)

    The Heimdall can rightfully be called the heart of the Polygon system. It is responsible for the management of validators, block producer selection, spans, the state-sync mechanism between Ethereum and Polygon and other essential aspects of the system. It uses the Cosmos-SDK and a forked version of Tendermint, called Peppermint. Even though Heimdall uses a customized version of the Cosmos-SDK, it follows the same pattern - for better for worse. The Heimdall layer can also be called the validation layer. It is responsible for the collection of blocks produced by Bor into a Merkle tree and publishing the Merkle root periodically to the root chain. Checkpoints are referred to as the periodic publishing of snapshots of the Bor sidechain. For every few blocks produced on the Bor layer, a validator on the Heimdall layer is responsible for the following

    1. Validating all the blocks produced since the last checkpoint.
    2. Creation of a Merkle tree of the block hashes.
    3. Publishing the Merkle root hash to the Ethereum mainnet.

    Checkpointing

    In the Polygon network, Checkpoints hold greater significance, primarily due to the following reasons

    1. Providing finality on the root chain.
    2. Providing proof of burn in withdrawal of assets.

    Overview of the Checkpointing Process.

    • A subset of active validators from the pool is selected to act as block producers for a span and are responsible for the creation and broadcasting of new blocks on the network.
    • A checkpoint includes the Merkle root hash of all blocks created during any given interval. All nodes validate the Merkle root hash and attach their signature to it.
    • A proposer selected from the validator set is responsible for collecting all the signatures for a particular checkpoint and then committing the checkpoint on the Ethereum mainnet.
    • The responsibility of creating blocks and proposing checkpoints is variably dependent on a validator’s stake ratio in the overall pool.

    Bor (block producer layer)

    Bor can also be termed as Polygon's sidechain block producer. It is the entity which is responsible for the collection of transactions into blocks. Bor block producers are essentially a subset of the validators and to maintain decentralization these are periodically shuffled using historical Ethereum block hashes by the Heimdall validators. The Bor node implementation is basically the sidechain operator. The sidechain VM is EVM-compatible and is a basic Geth implementation with custom changes to the consensus algorithm.

    Consensus Algorithms

    Polygon utilizes the Proof-of-Stake (PoS) consensus algorithm, whereas BSC employs the Proof-of-Stake-Authority (PoSA). Both consensus mechanisms' major concern is to overcome Ethereum’s high gas fees and slower transactions.

    In the PoS consensus algorithm, validators are chosen based on a user's commitment to the network in terms of its stake, meaning that the higher the stake, higher the chances of getting selected as a validator. On the other hand, PoSA is a combination of the PoS and the PoA (Proof of Authority) consensus mechanisms.

    Utilizing the PoSA consensus mechanism, BSC was initially launched with 21 validators. However, now BSC supports a set of 44 validators, with 26 of them being active. In future, BSC plans to increase the active validators to 41, and about 80-100 validators in total. The top validator candidates with the most bonded stakes are chosen to be part of the subset of active validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality. Other than the 41 active validators, BSC also has a set of inactive validators known as the Candidates. Even though the chances of getting elected are less, the Candidates upon selection can produce blocks and charge gas fees in the BSC mainnet. Similar to Active Validators, unavailable candidates are slashed but for a smaller amount. In an extreme case, if a majority of the active 41 validators get attacked and offline, Candidate Validators can report to BNB Beacon Chain about the stale blocking, resume it and eventually propose re-election of the active validator set.

    In contrast, Polygon uses the Proof-of-Stake (PoS) consensus mechanism on its Plasma/POS commit chains. For any user willing to participate in the consensus process, users are required to stake MATIC tokens on the staking smart contracts on Ethereum mainnet. This staking indicates a user's commitment to the process. A slashing mechanism (removal of staked funds) is also implemented to discourage stakers from submitting invalid blocks, illegally verifying blocks, or executing invalid transactions. Requiring validators to put funds at risk before they can participate in consensus helps maintain the integrity of the network.

    Conclusion

    There are a variety of EVM-compatible blockchain on the market, and while from the first sight, it may look as if all of them are the same, the reality is every blockchain is aimed for specific use cases and both security and availability requirements. This is why BSC has undergone several iterations of improvements to ensure superb performance and the most advanced security.

    - + diff --git a/docs/migration/evm-chains/token-comparison.html b/docs/migration/evm-chains/token-comparison.html index 45a47ffba9..2e99a26fef 100644 --- a/docs/migration/evm-chains/token-comparison.html +++ b/docs/migration/evm-chains/token-comparison.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ In this article, we provide an overview of what tokens are and supported tokens by BSC

    Overview of Tokens

    Technically speaking, “token” is just another term used for referencing cryptocurrencies or crypto-assets. Nevertheless, with the evolution in the standards for crypto tokens, tokens can be described in the context of their use. One description of tokens is that of cryptocurrencies, where tokens are used in the form of digital money and are native to a particular blockchain. In another way, tokens can also be described as digital assets running on top of other cryptocurrencies’ blockchain, e.g., most of the decentralized finance (DeFi) tokens. There is a wide spectrum of use cases where tokens can be functional. e.g., decentralized exchanges, tradable assets, digitization of assets, etc. Generally, all tokens can be traded or held like any other cryptocurrency.

    Importance of Tokens

    Tokens hold a very important role in the blockchain-based decentralized ecosystem and can be used for various purposes within a dapp’s universe. Other than fungible tokens, which are a representation of interchangeable assets on a blockchain and are usually used as cryptocurrencies, some of the most important categories based on usage are as follows:

    • DeFi Tokens: DeFi protocols and dApps are aimed at reproducing traditional financial system functions (lending, borrowing, saving, insurance, trading, etc.). DeFi tokens represent a diverse set of cryptocurrencies native to automated, decentralized DeFi platforms run through smart contracts. These tokens perform a wide range of functions within the DeFi platform and are also tradable or can be held like any other cryptocurrency.
    • Utility Tokens: These types of tokens are designed to serve particular purposes within a specific application/protocol's ecosystem and allow users to be part of the decision-making on a specific network. Furthermore, utility tokens are unique to their ecosystem and are non-mineable cryptocurrencies. They are usually pre-mined, being created all at once, and distributed in a manner chosen by the team behind the project.
    • Governance Tokens: These specialized tokens give holders the right to vote on issues that govern the development and operations of a blockchain project. It’s a method for projects to distribute decision-making power to their communities. This decentralized governance model helps align the interests of the token holders with that of the project.
    • Non-Fungible Tokens (NFTs): NFTs are used to represent ownership rights to a unique digital or real-world asset. These allow the tokenization of real-world things like art, collectibles, real estate, etc. Ownership of an asset is secured by the blockchain network, as no one can modify the record of ownership or copy/paste a new NFT into existence.
    • Security Tokens: are a new class of assets that aim to be the crypto equivalent of traditional securities like stocks and bonds. Their main use case is to sell shares in a company (very much like the shares or fractional shares sold via conventional markets) or other enterprises (for instance, real estate) without the need for a broker. Major companies and startups have been reported to be investigating security tokens as a potential alternative to other methods of fundraising.

    Token Standards

    Ethereum is the pioneer of blockchain platforms to provide smart contract functionalities and standards for developing crypto tokens. However, with time, several blockchain platforms have emerged, some being EVM-compatible and others non-EVM. With a multitude of blockchain projects issuing their own tokens on different blockchains, it is important to make sure that these tokens are compatible with the underlying blockchains and adhere to the platform’s token standards. To ensure compatibility, interoperability, and security, token standards are issued. These are a set of rules for the issuance and implementation of new tokens. The most commonly included requirements in these token standards are the token’s total supply limit, minting, burning, and the process for performing transactions using the token. Furthermore, token standards are designed to help avoid fraud, technical incompatibilities between tokens, and issuance of tokens not aligned with the blockchain’s principles. For example, the rules for total supply and new token minting help contain potential token value depreciation.

    ERC Token Standard

    One of the most popular token standards is the ERC standard. ERC (Ethereum Request for Comments) is a set of rules defining the issuance and implementation of tokens on the Ethereum Blockchain. ERC20 is a technical standard that describes a common set of rules that should be followed for a token to function properly within the Ethereum ecosystem. It is one of the most commonly used standards and is usually used for fungible tokens in the form of cryptocurrencies. Other popular ERC standards are ERC-721 (NFTs) and ERC-1155 Multi-Token Standard.

    BEP Token Standard

    Similar to ERC, BNB Chain defines its own set of standards for token issuance, management, and implementation known as BEP (BNB Evolution Proposals). BEPs are token management rules and pre-defined criteria for launching on-chain assets on BNB Chain. The most popular BEP standards are BEP2 and BEP20. BEP2 is the native coin of the BNB Beacon Chain. Whereas BEP20 is popular for use on BSC. It is to note here that BEP20 is very similar to ERC20 and extends its functionality. Note that BNB, which is the native token of the BNB Chain ecosystem, is a BEP2 token.

    Difference between ERC and BEP tokens

    Both ERC20 and BEP20 standards are very similar in mechanism. However, ERC-20 is dedicated to Ethereum, whereas BEP-20 is dedicated to BNB Smart Chain. In simpler terms, each of these is a token standard that belongs to a different blockchain.

    ERC20 vs BEP20

    In this section, we provide a brief difference between the ERC20 and BEP20 tokens.

    ERC20BEP20
    Gas fees are paid for performing any transaction on the Ethereum blockchain. Ethereum has higher gas costs as compared to the BNB Chain.Gas fees collected to create BEP20 tokens are comparatively lower than ERC20 tokens.
    ERC20 transactions are slower, as up to 15 seconds are required for them to take place.Transaction speed is 5 times faster as BEP20 transactions take up to 3 seconds to take place.
    Proof-of-Stake (PoS) algorithm is used for the verification and validation of ERC20 transactions, ensuring higher security.BEP20 token also offers high security and uses Proof-of-Staked-Authority (PoSA) for verification and validation of transactions.
    ERC20 tokens are mostly used for crypto crowdfunding, trading, staking, etc.BEP20 tokens are mostly used for crypto crowdfunding, trading, staking, etc.

    Token Standards Supported by BSC

    BNB Chain is an ecosystem that runs on two blockchain giants, namely, BNB Beacon Chain (BC) and BNB Smart Chain (BSC). The native token standard for BNB Beacon Chain is BEP2, while the native token standard for BNB Smart Chain is BEP20. BNB ecosystem’s native currency, BNB, initially launched as an ERC20 token, is in fact a BEP2 token.

    BEP2 Tokens

    BNB Beacon Chain is essentially a digital asset creation and exchange platform. BNB Beacon Chain is responsible for the governance of the BNB Chain ecosystem, which includes staking and voting. BEP2 is the token standard for BNB Chain's native currency, BNB, on Binance's crypto exchanges. It is a unique token standard. BEP2 is not compatible with blockchains other than BNB Chain. Additionally, BNB in the BEP2 format can only be used as a transaction fee on both Binance cryptocurrency exchanges. One limitation of BEP2 is its lack of support for smart contract development. For more information, you can read the full BEP2 proposal here.

    BEP20 Tokens

    BSC is the blockchain component of the BNB Chain that provides its users with a smart contract facility and is a platform for dApp development. BEP20 is a token interface standard for creating token contracts on BSC. The BEP20 tokens are designed to be compatible with BEP2 and ERC20. It extends ERC20 for compatibility with EVM chain and Ethereum smart contracts. Other than the ERC20 functionalities, the BEP20 standard contains additional interfaces, such as getOwner and decimals. For more information on BEP20, read the full proposal here.

    - + diff --git a/docs/migration/evm-chains/token-migration.html b/docs/migration/evm-chains/token-migration.html index b338070269..17d738727b 100644 --- a/docs/migration/evm-chains/token-migration.html +++ b/docs/migration/evm-chains/token-migration.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ One thing critical to understand is how cross-chain bridges actually work. Cross-chain bridges work by "wrapping" tokens in a smart contract and issuing native assets you can use on another chain. For example, wrapped Bitcoin (wBTC) is an ERC-20 token that uses Bitcoin (BTC) as a collateral. Users must deposit BTC on the Bitcoin blockchain, before receiving wBTC tokens on the BSC network.

    Celer's cBridge

    In this section of the article, we describe how to use Celer's cBridge for bridging tokens from Polygon to BSC. For custom tokens, you will have to get your token whitelisted by the Celer team. For this tutorial, we will be bridging a more commonly supported USDC token from the Polygon blockchain to BSC using the Celer cBridge.

    Using Celer cBridge to bridge tokens from Polygon to BSC

    1. Head over to the official Website of cBridge and connect your wallet. After clicking on the connect wallet button, choose your desired wallet. If metamask is chosen, confirm the connection on the popup notification.

    1. Select your source and destination chains. To make sure your Metamask wallet is connected to the source chain, approve and switch to the network by confirming the metamask notification.
    2. Make sure your source chain is set to Polygon and the destination chain is BSC. Also, confirm that you have selected USDC for transfer.

    1. Adjust the slippage tolerance if required. Your transfer may fail if you choose a very low slippage tolerance.

    1. Review your transaction details and confirm the transaction.
    2. Confirm Transfer, then sign the transaction on your wallet.
    3. Wait for the transaction to confirm and for your funds to arrive on your destination
    4. In case of transfer failure, due to insufficient liquidity on the destination chain or an unfavorable slippage tolerance, you will receive a popup explaining the reason for the failure. You can cancel the transfer either through the popup, or by clicking Request Refund in the transfer history.

    Migrating Vested Token from Polygon to BSC

    In crypto space, Vesting is known as the process of locking and distributing purchased tokens within a particular timeframe known as the Vesting Period. Vested tokens can be described as a certain amount of tokens that are held aside for a particular time period, usually for the team members, partners, advisors, and others who are contributing to the development of the project. Vested tokens are essentially locked in a smart contract and are released automatically until certain conditions are met. Vesting basically gives the impression that the team is highly interested in the project and aims to continue working on the project development. Additionally, vesting lowers market price manipulations. There are two options available for migrating vested tokens from EMV-based blockchain to BSC.

    • Migrate the vesting contract and move the whole vesting schedule to BSC.
    • Migrate the tokens that are being released as per the schedule

    Migrating Vesting Contract

    Vesting is essentially a smart contract that has all of the vested tokens locked up which are released over a time period automatically when certain conditions are met. One of the possible ways to migrate vested tokens from BSC is to migrate the vesting contract that is to deploy your vesting smart contract to BSC.

    Migrating Vesting Tokens

    Another method is to ask the holders of vested tokens to exchange the already bought vested tokens with a newly created equivalent token on BSC and continue the release of vested tokens as per schedule. Another way is to take a snapshot of the vested token holders and update their wallets with an equivalent amount of new tokens and continue with the vesting schedule and release of tokens.

    Conclusion

    With several advantages and an ecosystem that supports web3 development, BNB Chain has gained a lot of attention from developers and blockchain projects. Several blockchain projects are now choosing to migrate their tokens from other EVM chains to BSC. In this article, we provided a brief overview of how to migrate tokens from one EVM to another, in particular from Polygon to BSC.

    - + diff --git a/docs/migration/non-evm-chains/solana/architecture-comparison.html b/docs/migration/non-evm-chains/solana/architecture-comparison.html index 6137704497..3dc6e7125b 100644 --- a/docs/migration/non-evm-chains/solana/architecture-comparison.html +++ b/docs/migration/non-evm-chains/solana/architecture-comparison.html @@ -8,7 +8,7 @@ - + @@ -21,7 +21,7 @@ EVM-based blockchains have two types of accounts - Externally Owned Accounts (EOA) and Contract Accounts. EOAs can store asset balances and are capable of sending and receiving transactions. Contract accounts form the basis for on-chain smart contracts. Along with storing the EVM code, every contract account also has an associated storage map that is used for reading and writing arbitrary data. The EVM provides instructions for each contract to read and write to its own storage, but it is impossible to read from other contracts’ storage.

    Solana’s Sealevel (runtime component for smart-contract) also has two types of accounts: executable and non-executable accounts. Unlike the EVM, both of these accounts have the capability of storing data. Executable accounts are immutable in Sealevel and can either store their own executable byte code or a proxy address of an account that stores mutable executable byte code. Due to the immutable nature of the executable accounts, non-executable accounts are used for storing their application state.

    In the EVM, contracts can only read and write their own storage. On the other hand, in Sealevel, any account’s data can be read or written to by a contract. However, the runtime enforces that only an account’s “owner” is allowed to modify it. Changes by any other programs will be reverted and cause the transaction to fail.

    b. Contract Storage

    On the BSC blockchain, EVM is responsible for the execution of smart contracts. The contract state or memory is stored at the contract address. This storage resembles the array data structure of infinite length located at the contract’s address. The storage mechanism ensures no conflicts in storage locations and follows a set of rules. Using these rules, we can decode the state of any contract.

    As compared to BSC, data storage and management are much more complex on Solana. There are different account categories used for data storage on Solana:

    • Program Accounts: are accounts that store executable code, the equivalent to BSC’s smart contracts.

    • Storage Accounts: are used for storing the data connected to programs (smart contracts).

    • Token Accounts: are used for keeping track of an account balance of tokens and allow for transferring or receiving tokens between accounts.

      In the Solana blockchain, smart contracts are referred to as programs. Unlike BSC, there is a separation between the program and the data/state of the program. Both are assigned separate accounts but are connected. In BSC, a smart contract and its data are both located in one location on the blockchain. If you were to make a program that counted the number of token transfers that a program made, you would need to create the program to make the transfers as well as another account to store the count of transfers.

      image

      Image Source

  • EVM Contracts vs Solana PDA On BSC, smart contracts are EVM compatible. On EVM, smart contracts are stored on the contract accounts. A contract account is controlled by code executed by the EVM. Contract accounts have associated code and data storage, controlled by the code itself. The controlling behavior is defined in the smart contract stored in them. Creating a contract account has a cost due to network storage. A contract account can only send transactions in response to receiving a transaction. Transactions from an external account (user account) to a contract account can trigger code, which can execute many different actions.

    On the Solana blockchain, Program Derived Accounts (PDA) are referred to as the account whose owner is a program and are designed to be controlled by a specific program. With PDAs, programs can programmatically sign for certain addresses without needing a private key. These serve as the foundation for Cross-Program Invocation through which Solana-based apps are composable with one another.

  • Smart Contract Life cycle On an EVM-based blockchain, like BSC, there are four phases involved in the life cycle of smart contracts.

    • Creation of the smart contract
    • Freezing of the smart contract
    • Execution of the smart contract
    • Finalization of the smart contract

    On BSC, Smart contracts are usually written in a high-level language, like Solidity. However, in order to run, they are compiled to the low-level bytecode compatible to run on the EVM. Once compiled, the bytecode is deployed on the BSC platform using a special contract creation transaction. Each contract is identified by a BSC contract address, which is derived from the contract creation transaction as a function of the originating account and nonce. The address of a contract can be used in a transaction as the recipient, sending funds to the contract, or calling one of the contract’s functions.

    In the case of Solana, on-chain programs are compiled via the LLVM compiler infrastructure to an Executable and Linkable Format (ELF) containing a variation of the Berkeley Packet Filter (BPF) bytecode. Because Solana uses the LLVM compiler infrastructure, a program may be written in any programming language that can target the LLVM's BPF backend. Solana currently supports writing programs in Rust and C/C++. BPF provides an efficient instruction set that can be executed in an interpreted virtual machine or as efficient just-in-time compiled native instructions.

  • Interaction with Smart contracts

    a. Solana execution model vs EVM model: EVM follows a stack-based model for the execution of transactions and smart contracts. On the other hand, Solana offers a parallel execution model. Its Sealevel runtime is a concurrent transaction processor. Transactions specify their data dependencies upfront and dynamic memory allocation is explicit. By separating program code from the state it operates on, the runtime is able to perform concurrent access. Transactions accessing only read-only accounts are executed in parallel whereas transactions accessing writable accounts are serialized. The runtime interacts with the program through an entry point with a well-defined interface. The data stored in an account is an opaque type, an array of bytes. The program has full control over its contents.

  • Conclusion

    With a multitude of blockchain platforms available for development in the Web3 domain, BNB Chain has emerged amongst the top ranks. BNB Chain offers developers speed, security, efficiency, and low cost with ensured scalability. In this article, we have provided a detailed comparison of the architecture of the BNB Smart Chain and the Solana network. This article is aimed at giving readers understand the differences in the underlying architecture.

    - + diff --git a/docs/migration/non-evm-chains/solana/token-migration.html b/docs/migration/non-evm-chains/solana/token-migration.html index d6c802df8a..bc6c3eff45 100644 --- a/docs/migration/non-evm-chains/solana/token-migration.html +++ b/docs/migration/non-evm-chains/solana/token-migration.html @@ -8,13 +8,13 @@ - +

    Token Migration from Solana to BNB Smart Chain

    Blockchain technology has gained superlative popularity over time, proving that it is here to stay. This popularity has resulted in a multitude of blockchain platforms that offer unique features for dapp development. As every blockchain platform has its pros and cons and differs from each other in terms of the underlying architecture, working mechanisms, etc., it is possible for blockchain-based projects and crypto tokens to migrate from one blockchain platform to another. For instance, from Solana to BNB Smart Chain (BSC), for better user experience by leveraging the innovative features of BSC.

    Even though it has been only two years since its launch, BNB Chain has quickly gained a lot of popularity because of its compelling features of low cost and faster transaction rate. BSC is the largest network with an all-time high daily active users (DAU) of 2.2M on Dec 2021. At the time of writing, the current value of DAU of BNB Smart Chain is 1.2M with daily network usage of approximately 13% and more than 3.6B transactions, along with a TVL of 6.14B. Being the largest smart contracts-powered blockchain ecosystem, several projects that are based on other blockchain platforms are now migrating to the BNB Chain platform.

    In this article, we dive into token migration from a non-EVM chain, Solana, to BSC. We provide an overview of what tokens are, supported tokens by BSC, migrating tokens from Solana to BSC, and migration of vested tokens.

    Overview of Tokens

    Technically, "token" can be described as a term that is used for referencing cryptocurrencies or crypto-assets. However, with advancements in standards for cryptocurrencies and assets, the term token can be used in different contexts, since now tokens are functional in a wide spectrum of use cases. For example,, tokens can take up the form of cryptocurrencies, as well as, they can also be digital assets that run on top of other cryptocurrencies' blockchains. Nevertheless, all tokens in all forms can generally be traded or held like any other cryptocurrency.

    Importance of Tokens

    In a blockchain-based decentralized ecosystem, tokens play a very important role in accomplishing various different purposes within a decentralized application's (dApp) ecosystem. Broadly, tokens can be divided into two categories, fungible and non-fungible. Fungible tokens are essentially representations of interchangeable assets on a blockchain and are usually used as cryptocurrencies. Other important classifications of tokens based on usage are as follows:

    • DeFi tokens: DeFi protocols and dapps are aimed at rendering traditional financial-system functions (lending, borrowing, saving, insurance, trading, etc.). DeFi tokens essentially power DeFi apps and protocols and are programmable to perform payments as well as transaction flows. These are also tradable or can be held like any other cryptocurrency.
    • Utility Tokens: are designed to serve particular purposes within a specific application/protocol's ecosystem. These further allow users to be part of the decision-making process of a specific network. Additionally, utility tokens are unique to their ecosystem and are non-mineable cryptocurrencies. These are usually pre-mined, created all at once, and distributed in a manner chosen by the team behind the project.
    • Governance tokens: these are specialized tokens that authorize holders the right to vote on issues related to the governance of the development and operations of a blockchain project. It's a method for projects to distribute decision-making power to their communities. This decentralized governance model helps align the interests of the token holders with that of the project.
    • Non-Fungible Tokens (NFTs): NFTs are used for representing ownership rights to a unique digital or real-world asset. These allow the tokenization of real-world things like art, collectibles, real estate, etc. Ownership of an asset is secured by the blockchain network as no one can modify the record of ownership or copy/paste a new NFT into existence.
    • Security tokens: are a new class of assets that aim to be the crypto equivalent of traditional securities like stocks and bonds. Their main use case is to sell shares in a company (very much like the shares or fractional shares sold via conventional markets) or other enterprises (for instance, real estate) without the need for a broker. Major companies and startups have been reported to be investigating security tokens as a potential alternative to other methods of fundraising.

    Token Standards

    With blockchain technology gaining unprecedented popularity there is a multitude of blockchain projects issuing their own tokens on different blockchains. It is important to make sure that these tokens are compatible with the underlying blockchains and adhere to the platform's token standards.

    To ensure compatibility, interoperability, and security, token standards are issued. token standards are designed to help avoid fraud, technical incompatibilities between tokens, and issuance of tokens not aligned with the blockchain's principles. These are essentially a set of rules defining the issuance and implementation of new tokens. Some of the most commonly included rules in these token standards include the token's total supply limit, minting process, burning process, and process for performing transactions using the token.

    ERC Token Standard

    One of the most widely used token standards is the ERC standard. Ethereum Request for Comments (ERC) is a set of rules defining the issuance and implementation of tokens on the Ethereum Blockchain. ERC20 is a technical standard that describes a common set of rules that should be followed for a token to function properly within the Ethereum ecosystem. It is one of the most commonly used standards and is usually used for fungible tokens in the form of cryptocurrencies. Other popular ERC standards are ERC-721 (NFTs) and ERC-1155 Multi-Token standard.

    BEP Token Standard

    Similarly to ERC, BNB Chain defines its own set of standards for token issuance, management, and implementation known as BEP (BNB Chain Evolution Proposals). BEPs are token management rules and pre-defined criteria for launching on-chain assets on BNB Chain. The most popular BEP standards are BEP2 and BEP20. BEP2 is the native coin of the BNB Beacon Chain. Whereas, BEP20 is popular for use on BSC. It is to note here that BEP20 is very similar to ERC20 and extends its functionality. Note that, BNB which is the native token of the BNB Chain ecosystem, is also a BEP20 token.

    SPL Token Standard

    Famous for its parallel execution engine, the Solana blockchain was launched in 2017 and is currently amongst the popular blockchain ecosystems. SOL is the native token of the Solana ecosystem and is essentially a Utility token. SOL uses the SPL protocol. Similar to the ERC standard on Ethereum and BEP on BSC, Solana Program Library (SPL) is the token standard of the Solana blockchain. SPL is a collection of on-chain programs that target Solana's "Sealevel" parallel runtime. The Token Program on Solana defines a common implementation for Fungible and Non-Fungible tokens. The SOL token has two main use cases:

    • Paying for transaction fees incurred when using the network or smart contracts.
    • Staking tokens as part of the Proof of Stake consensus mechanism.

    Token Standards Supported by BSC

    BNB Chain is an ecosystem that runs on two blockchain giants, namely, BNB Beacon Chain (BC) and BNB Smart Chain (BSC). The native token standard for BNB Beacon Chain is BEP2, while the native token standard for BNB Smart Chain is BEP-20. BNB Ecosystem's native currency, BNB, initially launched as an ERC20 token, is a BEP2 token.

    BEP2 Tokens

    The BNB Beacon Chain is responsible for the governance of the BNB Chain ecosystem which includes staking and voting. BEP2 is the token standard for BNB Chain's native currency, BNB, on Binance's crypto exchanges. It is a unique token standard, BEP2 is not compatible with blockchains other than BNB Chain. Additionally, BNB in the BEP2 format can only be used as a transaction fee on both Binance cryptocurrency exchanges. One limitation of BEP2 is its lack of support for smart contract development. For more information, you can read the full BEP2 proposal here.

    BEP20 Tokens

    BSC is the blockchain component of the BNB Chain that provides its users with a smart contract facility and is a platform for dApp development. BEP20 is a token interface standard for creating token contracts on BSC. The BEP20 tokens are designed to be compatible with BEP2 andERC20. It extends ERC20 for compatibility with EVM chain and Ethereum smart contracts. Other than the ERC20 functionalities, the BEP20 standard contains additional interfaces, such as getOwner and decimals. For more information on BEP20, read the full proposal here.

    Token migration

    Often blockchain projects begin as whitepapers promising innovative technologies to follow in the future. However, there can be multiple twists and turns in the process of transforming from a design paper to a real product. One such can be choosing to move to an entirely different blockchain than that proposed initially. In such scenarios, it is possible for projects to require a token migration, also known as a token swap. Token migration is a process that involves transmitting a token holder's balance on one blockchain to another blockchain. In this section, we cover token migration from Solana to BSC.

    Migrating Tokens from Solana to BSC

    The process of bridging between Solana and BNB Smart Chain (BSC) is a little difficult because they are not compatible chains. There are two options to migrate your tokens from Solana to BSC. First, you can use cross-chain bridges to migrate the tokens to BSC from Solana. The second is to create new tokens on the BSC network, deposit equivalent amounts to the holders and discontinue the previously deployed token on Solana. In this section, we provide readers with a guide on how to create custom BEP20 tokens on BSC and later how to bridge tokens from Solana to BSC.

    Creating BEP20 Token on BSC

    BEP20 is BSC's equivalent version of the ERC20 token standard for Ethereum. The difference between the two is that BEP20 Tokens are only compatible with the BSC network. Nevertheless, as BSC is Ethereum Virtual Machine (EVM) based both ERC20 and BEP20 are practically identical in both specification and implementation. In this section, we provide you with a walkthrough on how to create custom BEP20 tokens.

    For this tutorial, we will be using Remix IDE for compiling and deploying BEP20 token smart contracts onto the BSC test network.

    Pre-requisites

    For details, refer here**

    There is no need for any local environment settings for compiling and deploying Solidity smart contracts on BSC using the Remix IDE.

    All you require is a browser-based Web3 wallet (e.g. MetaMask) to interact with the BSC Testnet and deployed contracts. If you are already using MetaMask, it is recommended to create a new account for testing with Remix IDE. You can do this from the account menu, which appears when you click on the account avatar in the top right corner of the MetaMask interface, for more details refer here.

    You must set up all of the following prerequisites to be able to deploy your solidity smart contract on BSC:

    Setting Up Remix IDE

    For details, refer here

    • Remix is an online IDE to develop smart contracts.
    • You need to choose Solidity Compiler, Choose the appropriate compiler version. We used 0.8.17 for this tutorial.

    img

    Creating a Workspace in Remix IDE

    • Click on the plus icon to create a new workspace.

    img

    • Choose OpenZeppelin's ERC20 template; give a meaningful name to your workspace and press ok.

    img

    • Remix will create a smart contract "MyToken.sol" for you as well as will import any dependencies. We can edit this "MyToken.sol" to create our own ERC20 tokens.

    img

    Writing the Smart Contract

    For details, refer here

    • Open the "MyToken.sol" file and replace the token name and symbol with that of your choice, as shown in the code below
    SPDX-License-Identifier: MIT
    pragma solidity ^0.8.0;
    import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

    contract BEP20 is ERC20 {
    constructor(uint256 initialSupply) ERC20("BEP20Test", "BPT") {
    \_mint(msg.sender, initialSupply);
    }
    }

    • Rename the MyToken.sol file to the name of your token, BEP20.sol in our case.

    img

    • Compile the smart contract

    img

    • Deploy the smart contract. Make sure that your MetaMask wallet is configured for use with the BNB Smart Chain Testnet. Select inject provider in the environment variable and make sure you see your connect account address in the Account field. Click on the Deploy button to deploy the BEP20 token smart contract. Our smart contract takes initialSupply as a parameter to the constructor that would create that many tokens at the time of deployment.

    img

    • The input field next to the Deploy button is the place to specify the initialSupply parameter. For e.g. if you want to create 100 tokens, then pass 100000000000000000000 and then click on "Deploy".
    • You will need to accept a MetaMask transaction as it will cost BNB to deploy something to the network. Confirm the transaction by pressing the confirm button on the metamask notification

    img

    • To view your tokens in your metamask wallet follow this tutorial.

    img

    Bridging Tokens from Solana to BSC

    With several different blockchain platforms available for development, of the varied underlying architecture, consensus mechanism, etc., interoperability and cross-communication between these platforms with respect to token and data transfers can be nearly impossible. Blockchain bridges are designed to overcome this hindrance of interoperability and provide a secure mechanism for decentralized token transfers.

    A cross-chain bridge connects independent blockchains and enables the transfer of assets and information between them, allowing users to access other protocols easily. One thing critical to understand is how cross-chain bridges actually work. Cross-chain bridges work by "wrapping" tokens in a smart contract and issuing native assets you can use on another chain. For e.g., wrapped BTC (wBTC) is an ERC-20 token that uses BTC as collateral. Users must deposit BTC on the Bitcoin blockchain before receiving wBTC tokens on the Ethereum network.

    In this section of the article, we describe how to use the Portal Bridge for bridging tokens from Solana to BSC. One thing to remember is to be able to see your deployed custom token on the Portal bridge, you will have to get your token whitelisted by the Portal bridge's team. For this tutorial, we will be bridging a more commonly supported USDC token from the Solana blockchain to BSC using the Portal Bridge.

    Wormhole's Portal Bridge

    Wormhole's Portal Bridge allows you to bridge tokens across different chains. Instead of swapping or converting assets directly, Wormhole locks your source assets in a smart contract and mints new Wormhole-wrapped assets on the target chain. You can then swap Wormhole-wrapped assets on an exchange for other assets on the target chain. This tutorial can be used to bridge your assets between Solana and other chains, including BSC, using Wormhole.

    Using Portal Bridge to Bridge Tokens from Solana to BSC

    One thing to remember is to be able to see your deployed custom token on the Portal bridge, you will have to get your token whitelisted by the bridge's official team. For this tutorial, we will be bridging a more commonly supported USDC token from the Solana blockchain to BSC using the Portal Bridge.

    The bridging process involves four primary steps, as indicated on the landing page:

    • Source selection
    • Target selection
    • Sending tokens
    • Redeeming tokens

    In this guide, we will be bridging from Solana to BSC.

    Step 1: Select Source Chain, Target Chain, and Source Token

    • On "Source," select the chain from which you want to bridge. In this case, the tokens are on the Solana blockchain, so Solana is selected as our "Source."
    • "Target" is the chain to which the tokens will be bridged. Select BNB Smart Chain as your "Target."

    • After selecting Source and Target, click "Connect." This will prompt a pop-up from the Source wallet, which is Phantom in this guide.
    • When the wallet is connected, the "Select a Token" button will appear.
    • Select the Source Token. These are the tokens that you want to bridge or swap from Solana. In this guide, we'll be bridging USDCso from Solana to BSC.

    Note: The "Featured" tokens at the top of the drop-down menu are those with liquidity on Solana, and there are links to the exchanges where you can swap these tokens. Do not select tokens besides those in the Featured category. You may accidentally bridge a token with little or no liquidity on Solana, and you won't be able to swap them.

    • After selecting the token you want to bridge, the interface will display the current balance of the selected Source Token.
    • Select the amount of tokens you want to bridge. Then, click "Next."

    Step 2: Select Target Chain and Connect Target Wallet

    • Select your Target Chain. This is the chain to which you want to bridge your tokens.

    • Click "Select Wallet." This will prompt a pop-up from the native wallet of your Target Chain. In this guide, we'll be using Metamask.
    • On the pop-up, click "Connect."
    • The "Create Associated Account" button will now appear. Click this button to create a token account in your Metamask wallet where your tokens will appear.

    • When you click "Create an Associated Account," a pop-up from the Target Wallet will appear. Click "Approve."

    Step 3: Send Tokens

    • Your Source Wallet will now be connected, and your token's associated account will be ready. Click "Transfer" to initiate the transaction.

    • Click "Confirm" in the site pop-up.
    • Click "Confirm" in your wallet pop-up. This will approve paying gas to transfer tokens from the chain you want to bridge from. Note: You will be paying transaction fees on the sending as well as receiving side.

    Step 4: Redeem Tokens

    • Click "Redeem" to initiate the transfer to your Target Wallet.
    • A series of pop-ups (typically four) will appear from your Target Wallet.
    • Approve each of these transactions to continue.
    • Remember: Transaction fees on the receiving side need to be paid in the Target chain's native token.

    Reference Tutorial:

    Migrating Vested Tokens from Solana to BSC

    In crypto-space, Vesting is known as the process of locking and distributing purchased tokens within a particular timeframe called the Vesting Period. Vested tokens can be described as a certain amount of tokens that are held aside for a particular time period usually for the team members, partners, advisors, and others who are contributing to the development of the project.

    Vested tokens are locked in a smart contract and released automatically until certain conditions are met. Vesting basically gives the impression that the team is highly interested in the project, and aims to continue working on the project development. Additionally, vesting lowers market price manipulations.

    There are two options available for migrating vested tokens from Solana to BSC.

    • Migrate the vesting contract and move the vesting schedule from Solana to BSC.
    • Migrate the tokens and release them as per schedule.

    Migrating Vesting Contract

    Vesting is essentially a smart contract that has all of the vested tokens locked up which are released over a time period automatically when certain conditions are met. One of the possible ways to migrate vested tokens from the Solana blockchain to BSC is to migrate the vesting contract from the Solana blockchain to BSC. One thing to remember here is that Solana uses the RUST programming language for writing smart contracts. Whereas, smart contracts in BSC are usually written in the Solidity programming language. This language incompatibility means that either you would have to re-write your smart contract in Solidity from scratch or use rust-compatible EVM solutions on BSC for running rust-based smart contracts.

    Migrating Vesting Tokens

    As both Solana and BSC have completely different token standards, even though the tokens can be bridged, a better approach is to mint new tokens on the BSC. The migrating project's team can ask the holders of its vested tokens to exchange the already bought vested tokens with a newly created equivalent token on BSC within a given time frame and continue the release of vested tokens as per schedule. Another way is to take a snapshot of the vested token holders and update their wallets with an equivalent amount of new tokens and continue with the vesting schedule and release of tokens.

    Conclusion

    With several advantages and an ecosystem that supports Web3 development, BNB Chain has gained much attention from developers and blockchain projects. Several blockchain projects are now choosing to migrate their blockchain projects and crypto tokens from non-EVM-based chains like Solana to BSC which is an EVM-based chain. In this article, we provided a brief overview of token migration from Solana to BSC, covering an overview of crypto tokens, how to create custom tokens on BSC, how to bridge assets from Solana to BSC, and how to migrate vested tokens.

    - + diff --git a/docs/mirror.html b/docs/mirror.html index be9efce3e7..f3e1e23ed7 100644 --- a/docs/mirror.html +++ b/docs/mirror.html @@ -8,13 +8,13 @@ - +

    Mirror BEP2 and BEP20 Token

    Pre-requisites

    This BEP20 token is not bound to any BEP2 token

    Motivation

    Anyone can call the mirror method to issue a BEP2 token automatically and bind them.

    What Happens Under the Hood

    • Verify there is no pending mirror request
    • Check the total supply and token symbol is valid
    • Send a cross-chain package to issue a BEP2 token on BNB Beacon Chain
    • The newly created BEP2 token is locked until the token holder send cross-chain transfer

    After binding, all liquid circulation is on BSC.

    Fee Table

    Fee NamePay in BNB
    mirrorFeeit's 10 BNB on mainnet now
    relayFeeit's 0.002BNB on mainnet now

    Both mirrorFee and relayFee can be changed by on-chain governance

    To query mirrorFee from system contract;

    • Call Tokenmanager Contract with the latest ABI

    • Query mirrorFee function

    Fee= result/1e18

    To query relayFee from system contract;

    • Call TokenHub Contract with the latest ABI

    • Query getMiniRelayFee function

    Fee= result/1e18

    Mirror With MyEtherWallet

    • Call Tokenmanager Contract with the latest ABI

    img

    • Select mirror function and fill-in with your BEP20 address

    The value here should be no less than mirrorFee+ relayFee.

    Time stamp should be greater than unix_timestamp(now()). The difference should be between 120 and 86400. It's recommended to use unix_timestamp(now())+1000

    img

    All set!

    img

    Query BEP2 Token Symbol

    You can query BEP2 Token symbol from tokenhub contract with the latest ABI

    Select getBoundBep2Symbol function input BEP20 token contract address, then you can see the token symbol in the result.

    img

    - + diff --git a/docs/more-help.html b/docs/more-help.html index c8382adc26..e664d15de7 100644 --- a/docs/more-help.html +++ b/docs/more-help.html @@ -8,13 +8,13 @@ - +

    More Help

    There is a #validator-support Discord channel available to reach other testnet participants.

    Can't find what you're looking for? reach out to us on our Discord Channel.

    - + diff --git a/docs/nft-metadata-standard.html b/docs/nft-metadata-standard.html index 53be527680..26d260fd96 100644 --- a/docs/nft-metadata-standard.html +++ b/docs/nft-metadata-standard.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ The below metadata structure, allows the BSC Marketplace to read and display the details about the assets which your NFTs represent.


    {
    "name":"NFT Name",
    "description":"NFT Description",
    "image":"https://somedomain.com/pic/xxxx.jpg",
    "external_url":"https://originalsite.io/2",
    "attributes":[...]
    }

    Here's how each of these properties work:

    PropertyDescription
    nameName of the item. Max 200 characters.
    descriptionA human-readable description of the item. Markdown is supported. Max 500 characters.
    imageThis is the URL to the image of the item. It can be just about any type of image. A 350 x 350 image is recommended.
    animation_urlThis is the URL to a multi-media attachment for the item. The file extensions GLTF, GLB, WEBM, MP4, M4V, OGV, and OGG are supported, along with the audio-only extensions MP3, WAV, and OGA.
    animation_typeThis is the file format of the multi-media attachment provided from animation_url.
    external_urlThis is the URL that will appear below the asset's image on the marketplace and will allow users to leave the marketplace and view the item on your site.
    attributesThese are the attributes for the item to describe the detail of the NFT. (see array below)

    Attributes

    To present NFT traits, include the following array in the metadata:


    {
    "attributes":[
    {
    "trait_type":"Rarity Class",
    "value":"Normal"
    },
    {
    "trait_type":"Type",
    "value":"Male"
    },
    {
    "trait_type":"Face",
    "value":"Mole"
    },
    {
    "trait_type":"Beard",
    "value":"Chinstrap"
    },
    {
    "display_type":"boost_number",
    "trait_type":"Power",
    "value":"Power"
    },
    {
    "display_type":"boost_percentage",
    "trait_type":"Health Increase",
    "value":"20"
    },
    {
    "display_type":"number",
    "trait_type":"Generation",
    "value":"3"
    }
    ]
    }

    Here trait_type is the name of the trait, value is the value of the trait, and display_type is a field indicating how you would like a numeric value should be displayed. For string traits, you don't have to worry about display_type. All traits included in the attributes will be displayed in Attribute. If you don't want to have a trait_type for a particular trait, you can include just a value in the trait and it will be set as a generic attribute.

    Numeric Traits

    There are 3 supported options for display_type: number will show the value in pure number, boost_number allows you to show the number with Plus or Minus symbol, and boost_percentage is similar to boost_number but will show a percent sign behind the number.

    Date

    Marketplace also supports date traits in date display_type. Pass in a unix timestamp as the value.


    {
    "display_type": "date",
    "trait_type": "birthday",
    "value": 1608490000
    }

    - + diff --git a/docs/nft-storage.html b/docs/nft-storage.html index af9db68390..808d02e995 100644 --- a/docs/nft-storage.html +++ b/docs/nft-storage.html @@ -8,14 +8,14 @@ - +

    Storing NFTs on IPFS & Filecoin

    After the preview two tutorials, you must have learned how to write NFT smart contract and deploy it on BSC testNet. The most important part for any NFT project is that where your NFT assets are stored. If you want to avoid the risk of losing your NFT assets or not able to access them, storing your NFTs on decentralized network is the better option for you.

    So in this tutorial, we will walk you through the process of storing your NFT assets on decentralied storage network, like IPFS & Filecoin. We will use NFT.Storage in this tutorial since it provides easy to use API/SDK for developers to upload their NFT assets on both IPFS and Filecoin.

    What we will use in this tutorial:

    Store NFTs using NFT.storage

    NFT.Storage is a storage service that lets you store off-chain NFT assets decentralized for free. Your NFT assets will be stored on both IPFS and Filecoin for the guaranty of fast content-addressing and retrieval on IPFS, as well as verifiable long-term storage on Filecoin.

    NFT.Storage provides multiple ways to upload your NFTs, from user-friendly web UI and NFTUp application to easy to use API to support developers. So it is especially useful for individual creators who are minting NFTs, or NFT tooling developers looking to support creators and collectors!

    In this tutorial, we will more focus on developers who is integrating NFT.Storage into their application to Mint NFTs. If you want to learn more about different ways to upload and manager your NFTs, you can check this Quick Start docs.

    Then let's get started.

    Create an account and get an API token

    If this is the first time you use NFT.Storage, you need to create a NFT.Storage account to get a API token which you can use in your applications when you upload NFTs.

    You can sign up an account for free using either your email or GitHub.

    1. Go to nft.storage/login to get started.

    2. Click GitHub on the Login screen.

    3. Authorize NFT.Storage when asked by GitHub.

    4. Once you are logged in success, you can click the API Keys to create an token.

      API Token

    5. Click + New Key, and enter a descriptive name for your API token and click Create.

    6. Now you have successfully create a API Token, you can click Action- Copy to copy it to your clipboard to use it later.

    Upload NFTs using Javascript Client

    The NFT.Storage JavaScript client makes it simple to upload files and create ERC-1155 compatible NFT metadata in your NFT applications. Both NFT and its metadata will be stored on IPFS and Filecoin, you will receive a IPFS URL for you metadata which you can use to mint your NFT.

    We will use a simple node JS script to demonstrate the code to upload NFT and receive the corresponding IPFS URL for its metadata. You can easily integrate this function in your JavaScript or TypeScript applications.

    You'll need Node.js version 16 or later for this example.

    1. Make a new JavaScript project.

      mkdir nft-storage-quickstart
      cd nft-storage-quickstart
      npm init

      NPM will ask a few questions about your project and create a package.json file.

    2. Install nft.storage client in your project.

      Run the following command to install the latest version of nft.storage package, and also install mime package for the file types.

      npm install nft.storage
      npm install mime
    3. Create a file called upload.mjs and open it with your VS Code.

      Below is the code you need to upload an image with ERC-1155 compatible NFT metadata.This code here will be used only as example, you can add similar upload logic in your application.

      import { NFTStorage, File } from "nft.storage"
      import fs from 'fs'
      import dotenv from 'dotenv'
      dotenv.config()
      //This the the API token you have created earlier which is added as one env variable.
      const API_KEY = process.env.NFT_STORAGE_API_KEY

      async function storeAsset() {
      const client = new NFTStorage({ token: API_KEY })
      const metadata = await client.store({
      name: 'ExampleNFT',
      description: 'My ExampleNFT is an NFT example!',
      image: new File(
      [await fs.promises.readFile('MyExampleNFT.png')],
      'MyExampleNFT.png',
      { type: 'image/png' }
      ),
      })
      console.log("Metadata stored on Filecoin and IPFS with URL:", metadata.url)
      }

      storeAsset()
      .then(() => process.exit(0))
      .catch((error) => {
      console.error(error);
      process.exit(1);
      });

      The main part of the script is the storeAsset function. It creates a new client connecting to NFT.Storage using the API key you created earlier. Next we introduce the metadata consisting of the name, description, and image. Note that we are reading the NFT asset directly from the file system from the assets directory. At the end of the function, we will print the metadata URL as we will use it later when creating the NFT on BNB Chain.

    4. Run your script with nodeJS

      Let's execute the upload logic by running the script and see the output.

      node upload.mjs

      The output should look like down blow. You can directly use the IPFS URL to mint NFT token, or use the URL of NFT.Strorage gateway. For instance, https://nftstorage.link/ipfs/<CID of your NFT>/metadata.json

      Metadata stored on Filecoin and IPFS with URL: ipfs://bafyreihegljuej4y4ai5ftzb2rdztseb5mmjzba5f5xcdktgd43rkoxhw4/metadata.json

    Now you have your NFT assets stored on IPFS and Filecoin, you can access it via NFT.Strorage gateway and you are ready to mint your NFT. Please record the metadata url which we will use to mint NFT later.

    Mint NFTs

    This tutorial will more focus on how to store NFT assets on IPFS and Filecoin other them teaching how to develop NFT smart contract. If you wish to learn how to deploy NFTs on BSC, you should learn it from Deploy NFTS on BSC using Truffle.

    In this section, I will simply use Remix to write NFT contract, deploy and invoke it via MetaMask. Before we move forward, let's make sure you have the following items ready.

    • Installed MetaMask.
    • Configured BNB Smart Chain TestNet on MetaMask.
    • Requested BNB TestNet tokens.

    Write NFT contract using Remix

    We will use Remix IDE to write your NFT contract. In this example, we are going to use ERC721URIStorage from OpenZeppenlin.

    Open Remix IDE, create a new solidify file, name it NFTExample.sol and copy the contract code down blow.

    // SPDX-License-Identifier: UNLICENSED
    pragma solidity >=0.4.22 <0.9.0;
    import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
    import "@openzeppelin/contracts/utils/Counters.sol";

    contract BSCNFT is ERC721URIStorage{
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;
    event NewNFTMinted(address sender, uint256 tokenId, string tokenURI);

    constructor() ERC721 ("NFT Examples on BSC", "BSC-NFT") {}

    function mintItem(string memory tokenURI) public{
    _tokenIds.increment();
    uint256 newItemId = _tokenIds.current();
    _mint(msg.sender, newItemId);
    _setTokenURI(newItemId, tokenURI);
    emit NewNFTMinted(msg.sender, newItemId, tokenURI);
    }
    }

    If everything works fine, the Remix will compile your smart contract automatically and it is ready to be deployed to BSC TestNet.

    Deploy your NFT contract

    Before deploying your NFT smart contract, make sure you switch the network to BSC TestNet on MetaMask and also have some test tokens to pay for transaction fees.

    On the Remix IDE, go to Deployment page and make sure you choose Injected Provider - MetaMask for the environment. Now, you can click the Deply button and confirm the transaction on MetaMask.

    Remix Deploy contract

    Once the deployment transaction is confirmed on-chain, you will be able to verify the transaction and contract on BSC TestNet blockchain explorer.

    You can also directly interact with the deployed NFT contract on Remix IDE. Try to invoke the name and symbol methods to verify if this is the NFT contract you deployed.

    Mint your NFT

    Now, we are all set to mint the NFT. Instead of using metadata storing on centralized server, we will use the metadata which we stored on IPFS & Filecoin using NFT.Storage in previous steps.

    We will copy the NFT metedata URL, something like ipfs://bafyreihegljuej4y4ai5ftzb2rdztseb5mmjzba5f5xcdktgd43rkoxhw4/metadata.json and mint NFT on Remix IDE.

    • On Remix IDE, go to the Deployed Contracts section and find mintItem method.

    • Paste the NFT metadata URL in the tokenURI params field, and click transact.

      Mint NFT image

    • You will need to confirm and sign the transaction when MetaMask popup for confirmation.

    • Verify your newly minted NFT Once the transaction is confirmed on BSC TestNet, you will be able to verify whether your NFT is minted successfully or not by invoking either balanceOf or ownerOf. I will take balanceOf as the example here.

      Balance of ImageYou can also verify your NFT on Opensea Testnets once you connect to MetaMask account. Then you will be see the freshly minted NFT under your account.

      Your NFT on OpenSea

    - + diff --git a/docs/nft_blackide.html b/docs/nft_blackide.html index b1c1e18c06..c54b3dddcf 100644 --- a/docs/nft_blackide.html +++ b/docs/nft_blackide.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Using Black IDE to Deploy NFTs on BSC

    In this tutorial, we provide a step-by-step guide to the readers on how to issue Non-fungible tokens (NFTs) (ERC721/1155) on the BNB Smart Chain (BSC) Testnet using the Black IDE. This is a detailed guide to learning how to issue, mint and transfer NFTs on the BSC Testnet. The technology stack used in this tutorial includes Solidity , Truffle, MetaMask, and BlackIDE.

    Learning Takeaways:

    This tutorial will help you gain knowledge on the following learning points:

    • Using BlackIDE for smart contract development;
    • Managing Keypairs and Funding BNB Tokens to your account on BlackIDE;
    • MetaMask Wallet connectivity to BSC Testnet;
    • Smart-contract development;
    • Issuing, minting, and transferring NFTs;

    Technology Stack Details

    • BlackIDE v0.15.4
    • Truffle v5.5.19 (core: 5.5.19)
    • MetaMask Wallet v10.16.1
    • Docker v20.10.14

    Brief Introduction Tech Stack

    1. Solidity: one of the most popular object-oriented high-level smart contract programming languages. For more details on Solidity, refer here.
    2. MetaMask Wallet Browser Extension: we recommend using the Metamask Chrome extension. It is a web wallet that allows connecting the chrome browser to any valid blockchain network.
    3. Black IDE: Black IDE is an integrated development environment (IDE), making developing EVM-compatible smart contracts faster and easier. Black IDE offers both desktop and web (Black IDE Web) applications.

    Setting up the Environment

    We aim to keep this tutorial as simple as possible and hence tend to use as minimal resources as possible and have used the following tools in this tutorial.

    • Metamask Wallet
    • Ensure that you have the Metamask Wallet extension installed and running on our browser.
    • Configure the Metamask wallet for use with the BSC Testnet. Use the following details to add the BSC Testnet. For further details, refer here.
    • Network Name: BSC Testnet
    • RPC URL: https://data-seed-prebsc-1-s1.bnbchain.org:8545
    • Chain ID: 97
    • Currency Symbol: BNB
    • Block Explorer URL: https://testnet.bscscan.com
    • Black IDE: both desktop app and web app are available and it is up to your convenience to choose from. For this tutorial, we used the desktop app as the web app lacks support for importing OpenZeppelin Contracts.
    • Download/Install any dependencies required by BlackIDE

    image

    Login into Black IDE

    1. Open the Black IDE desktop application. We will be using it for compiling and deploying our smart contract for NFTs on the BSC Testnet.
    2. Click on the Login button and authorize using your GitHub account.

    image

    Create New Project

    1. Click on the New button next to the projects to create a new project.

    image

    1. Specify the location where you want to save your project on your device, the project name, e.g. “BSC-NFT”, and select the project type from the dropdown list as “Basics- ERC20, ERC721, & ERC1155 (v31+)”. Then click the Create button to create the project.

    image

    1. Remember the smart contract in this tutorial is just a sample, you can always modify and be innovative.

    Smart Contract Creation

    1. Expand the contracts menu and delete the default files.

    image

    1. Right-click on the contracts menu and select New File. Specify a name for your file, e.g., BSC-NFT.sol, and then click Create button.

    image

    Write your smart contract code

    1. Copy the following code into your smart contract file. We have used the contract code from this repo.
    2. Remember to change the MINT_PRICE, MAX_SUPPLY, name, and symbol of the token as per your need. Also, remember to change the _baseURI as per your token.

    image

    Edit default project settings

    1. Click on the config.json file to change the default setting. Change the main file name to the name of your contract, BSC-NFT.sol in our case. Similarly, change the name of the smart contract to deploy, BSCNFT.json in our case.

    image

    Connect the Black IDE to the BSC Testnet

    1. In order to connect the Black IDE to the BSC Testnet, click on the dropdown icon on the network menu in the top right corner and then select Testnet under the BNB Chain label.

    image

    1. Click on the image icon in the bottom left corner of the IDE to generate new keypair to perform transactions. You can skip this step if you already have generated a keypair. On the Keypair Manager, click on the CREATE button to generate new keypair.

    image

    1. Specify your desired name for the keypair, in our case BSC-Testnet-Key. Then click on the CREATE button. Remember to keep your private keys securely and not share them with anyone.

    image

    Acquire BNB Test Tokens

    • Initially, the balance of a newly created key pair is 0.0 ETH. To get BNB test tokens, you can use the BSC Testnet Faucet.
    • Copy your public address from the keypair manager

    image

    • Paste this on the facet and acquire test tokens as required, as shown below. A green pop-up is displayed on the successful transfer of test tokens.

    image

    • Close and re-open keypair manager to verify that the balance has been updated. Wait for approx. 1-2 mins for balance to get updated.

    image

    Deploy Smart Contract on BSC Testnet

    1. Select the appropriate Solidity compiler version from the bottom right corner of the IDE, Solc (0.8.4), image in our case.
    2. Click on the Build icon image to build your smart contract. Upon successful build, the project navigation pane reflects a new folder named build. This folder contains contracts folder that has json files of the contracts built. All of the contracts imported in our BSCNFT contract are also built and imported as json files.

    image

    1. After successfully building your contract, it’s time to deploy the contract. Click on the Deploy icon image for deploying your smart contract. Specify the details for your contract, as shown below, then click on the Estimate & Deploy button. The wizard will auto-estimate and fill the gas limit for your contract. Then click the Deploy button.

    image image

    1. Deployment details will pop-up, as shown in the figure below.

    image

    1. The status of the transaction will be updated to confirmed after the transaction is confirmed as shown in the figure below

    image

    1. You can also view this transaction by clicking on the transaction icon in the bottom left on the IDE.

    image

    Interact with deployed smart contract and Mint NFTs

    1. You can also interact with the contract using the different functions. Click on the Transactions Icon on the bottom-left corner of the IDE and then transaction of deployment of your smart contract. On the transaction details, click on the contract address to access the functions to interact with the smart contract. The left most column has all the Write Functions. The middle column has the View Functions and the right most column has the Events details.

    image

    Mint NFTs

    1. As per our smart contract, when the contract is deployed, unless the NFTs are minted they won’t be visible in the wallet.
    2. Create another keypair as defined previously. We will be issuing i.e. minting NFTs to the public address of this new keypair.
    3. To mint i.e. issue an NFT to a specific user we use the “safeMint” function of the deployed smart contract. As shown in Steps 1 and 2 in the figure below, navigate to the deployed contracts, then in the left-most column click the drop-down menu to view the list of write functions available for use with the deployed contract. Select the “safeMint” function.
    4. Use the safeMint function to mint new NFTs to a specific user address. As shown in figure above, steps 3 to 6, enter the “ETH to send” as the minting price of NFT, as per our smart contract the minting price is 50000000000000000 Wei, i.e., 0.05 ETH. We entered 0.06 ETH to cover the transaction charges as well. Then select the address to whom you want to issue (mint) an NFT to. Here, for the To address use the newly generated keypair in the section above. After this, click the transact button to execute the safeMint function. For the Signer, ensure that you are using the account that was used to deploy the smart contract.

    image

    1. To confirm what transfers have occurred, execute the Transfer event from the right most column. This will display the list of NFT transfers along with NFT token id, as shown in the figure below.

    image

    1. To confirm owner of an NFT, use the ownerOf function. Pass the token id as input to the function, as illustrated in the figure below.

    image

    View Your NFTs in Metamask Wallet

    1. On the receiving end, the user can import the NFT token details into their Metamask wallet to view the assets. Please note that currently, Metamask Web Extension does not support the use of NFTs however, the mobile app version does support it. For the next steps to view the owned NFTs in your Metamask wallet, we will be using the Metamask Mobile Application.
    2. Open Keypair manager on the Black IDE and copy the private key of the keypair that you minted i.e., transfer NFT.

    image

    1. On the Metamask wallet mobile app, import an account using this key pair. Enter the private key copied in the previous step and click import.

    image

    1. After importing account, the next step is to add the BSC Testnet configuration to the wallet. Ensure that you are using the same account whose pubic address was issued the NFT.

    image

    1. Ensure that your account is connected to the BSC Testnet. Also, ensure that you have enough BNB test tokens in your account. If not, you can use the BSC Testnet Faucet to acquire some, as mentioned earlier.

    image

    1. To view the owned NFT assets your Metamask Mobile Wallet, click on the NFTs tab and then on the Import Tokens. Fill in the NFT details. In the address field, pass the address of the deployed contract and in the Id field pass the tokenID. Then click the Import button.

    image

    Conclusion

    In this tutorial, we provided a step-to-step guide on how to issue, mint and transfer NFTs on the BSC Testnet using the BlackIDE from Obsidian Labs.. The technology stack used in this tutorial includes Solidity, Truffle, MetaMask, and BlackIDE. Check out our GitHub for more tutorials on how to develop on BSC. If you have any questions or are stuck, reach out to us on our Discord Channel.

    - + diff --git a/docs/oracles.html b/docs/oracles.html index f6f30dc236..d1e8828dfd 100644 --- a/docs/oracles.html +++ b/docs/oracles.html @@ -8,13 +8,13 @@ - +

    Oracles

    Blockchain oracles are entities that connect blockchains to external systems, thereby enabling smart contracts to execute based upon inputs and outputs from the real world. Simply put, oracles provide a mechanism for the decentralized Web3 ecosystem to access existing data sources, legacy systems, and advanced computations.

    Following is the list of Data Oracles supported by BNB Chain.

    • Binance Oracle: Binance Oracle, a decentralized Web3 Oracle, a data feed network that connects real-world data to blockchain smart contracts. Binance Oracle will enable smart contracts to run on real-world inputs and outputs, starting with the BNB Chain ecosystem. Refer here for API Reference.
    • Band Protocol: Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts. Refer here for API Reference.
    • Chainlink: Securely connect smart contracts with off-chain data and services Chainlink decentralized oracle networks provide tamper-proof inputs, outputs, and computations to support advanced smart contracts on any blockchain. Refer here for API Reference.
    • Pyth: Pyth delivers real-time on-chain market data. Refer here for API Reference.
    - + diff --git a/docs/overview.html b/docs/overview.html index 75ca88b717..0faa4cad06 100644 --- a/docs/overview.html +++ b/docs/overview.html @@ -8,14 +8,14 @@ - +

    BNB Chain: An Ecosystem of Blockchains

    Build N Build Chain aka BNB Chain, one of the most popular blockchains in the world, dedicates to delivering its core infrastructure necessary for future public adoption, and always remains as a community-first and open-source ecosystem built on a permissionless and decentralized environment.

    BNB Chain is composed of two blockchains - BNB Beacon Chain (BC) and BNB Smart Chain (BSC). The BNB Beacon Chain is the blockchain component that is responsible for the governance of the BNB Chain and manages staking and voting on the BNB Chain. Whereas, the BNB Smart Chain is the blokchain component that is EVM compatible, consensus layers, and with hubs to multi-chains. BNB Chain, one of the most popular blockchains in the world, dedicates to delivering its core infrastructure necessary for future public adoption, and always remains as a community-first and open-source ecosystem built on a permissionless and decentralized environment.

    What is Build N Build (BNB) Chain?

    BNB Chain is comprised of:

    1. BNB Beacon Chain - BNB Beacon Chain is the staking and governance layer of the BNB ecosystem.
    2. BNB Smart Chain (BSC) - An EVM-compatible blockchain that brings programmability and interoperability to the BNB ecosystem.
    3. zkBNB - zkBNB is an infrastructure that is built on zk-Rollup architecture for developers that helps them to build large-scale BSC-based apps with higher throughput and much lower or even zero transaction fees.
    4. opBNB - opBNB network is the Layer 2 scaling solution for the BNB Smart Chain powered by the bedrock version of Optimism opStack.
    5. BNB Greenfield - BNB Greenfield introduces an entirely new structural and economic paradigm for data in the Web3 era. The ownership, usage, and monetization of data are now possible first and foremost for users, as well as all participants in the BNB Chain ecosystem.

    BSC 2022

    BNB Token

    BNB stands for "Build and Build". Along with fueling transactions on BNB Chain (similar to gas on Ethereum), BNB also acts as a governance token. Holding BNB gives you the right to make your voice heard and is necessary for participation in BNB Chain's decentralized on-chain governance. With this name change also comes more advancements to benefit users, projects, and developers connected to the BNB Chain community.

    Key Features

    Currently, BSC offers a considerable block size of 140M gas ceiling. We plan to introduce a more advanced logic for blockchain storage and BSC client to cover it and allow further expansion. Currently, to fully sync the BSC blockchain, validators need extensive storage and time. Scaling down the validator and node operator requirements is necessary to enable a seamless BSC experience.

    • New technologies, like Erigon, are being verified to decrease both time and storage demands for validator nodes while performing full sync.
    • Working with validators and infrastructure providers to deploy new solutions to address this issue, such as
      • Parallel EVM
      • Better block process pipeline
      • Improved state caching
      • Fast sync mode
      • Distributed nodes
      • Introduce more validators to join the block production of BSC

    Future Goal

    Innovation never sleeps, and it's clear that the future of BNB Chain goes into a world of over 1 billion users. BNB Chain's mission is to build the infrastructure that powers the world's parallel virtual ecosystem, and BNB Chain's commitment to the community is that it will be:

    • Open
    • Multi-chain
    • For creators and inventors
    • Permissionless
    • Forever decentralized

    Resources

    - + diff --git a/docs/parameters.html b/docs/parameters.html index 1e21a4b323..d309c2e51a 100644 --- a/docs/parameters.html +++ b/docs/parameters.html @@ -8,13 +8,13 @@ - +

    BNB Smart Chain Staking Parameters

    Staking Token

    • BNB

    Max Validator Count

    • 11 validators on Testnet
    • 21 validators on Mainnet

    Validator Candidate

    Mainnet

    • Minimiun Self-delegate Amount: 2000BNB on Mainnet .
    • Claim reward frequency: everyday at 0:00 UTC
    • Unbonding Period: 7 days

    Testnet

    • Minimiun Self-delegate Amount: 1000BNB on testnet.
    • Claim reward frequency: every 2 hours
    • Unbonding Period: 4 hours

    Delegator

    Mainnet

    • Redelegate frequency: 7 days

    Testnet

    • Redelegate frequency: 4 hours

    Slashing

    Mainnet

    • Double-Sign Slash: 10000BNB
      • Details: Anyone can submit a slashing request on BC with the evidence of Double Sign of BSC, which should contain the 2 block headers with the same height and parent block, sealed by the offending validator.
    • Offline Slash: 50BNB
      • Details: If a validator missed more than 50 blocks every 24h, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators. If it missed more than 150 blocks every 24h, then this will be propagated back to BC where another Slashing will happen
    • Rewards for submitting double-sign evidence: 1000BNB
    • Double-Sign Jail time: 2^63-1 seconds
    • Downtime Jail time: 2 days
    • Too Low self-delegation Jail time: 1 day

    Testnet

    • Double-Sign Slash: 10000BNB
      • Details: Anyone can submit a slashing request on BC with the evidence of Double Sign of BSC, which should contain the 2 block headers with the same height and parent block, sealed by the offending validator.
    • Offline Slash: 30BNB
      • Details: If a validator missed more than 50 blocks every 24h, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators. If it missed more than 150 blocks every 24h, then this will be propagated back to BC where another Slashing will happen
    • Rewards for submitting double-sign evidence: 1000BNB
    • Double-Sign Jail time: 2^63-1 seconds
    • Downtime Jail time: 4h
    • Too Low self-delegation Jail time: 4h
    - + diff --git a/docs/proxy.html b/docs/proxy.html index 3549942a15..ecc0bc4ebb 100644 --- a/docs/proxy.html +++ b/docs/proxy.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ Here’s what you’d need to do to fix a bug in a contract you cannot upgrade:

    • Deploy a new version of the contract
    • Manually migrate all the states from the old one contract to the new one (which can be very expensive in terms of gas fees!)
    • Update all contracts that interacted with the old contract to use the address of the new one
    • Reach out to all your users and convince them to start using the new deployment (and handle both contracts being used simultaneously, as users are slow to migrate)

    There are several approaches that allow us to make some changes to smart contracts.

    Separate logic and data

    By using this approach, data will be read from a designated data contract directly. This is a relatively common approach that is also used outside of Solidity. One of the main disadvantages of this approach is that you cannot change the interface of contracts external to the entire system, and you cannot add or remove functions.

    Delegatecall Proxy

    delegatecall opcode was implemented in EIP-7. It is possible to delegate execution to other contract, but execution context stays the same. As with delegatecall, the msg.sender will remain that of the caller of the proxy contract. One of the main disadvantages of this approach is that contract code of the proxy will not reflect the state that it stores.

    Writing Upgradeable BEP20 Contracts

    It’s worth mentioning that these restrictions have their roots in how the Ethereum VM works, and apply to all projects that work with upgradeable contracts, not just OpenZeppelin Upgrades.

    Initializers

    You can use your Solidity contracts in the OpenZeppelin Upgrades without any modifications, except for their constructors. Due to a requirement of the proxy-based upgradeability system, no constructors can be used in upgradeable contracts. To learn about the reasons behind this restriction, head to Proxies.

    This means that, when using a contract with the OpenZeppelin Upgrades, you need to change its constructor into a regular function, typically named initialize, where you run all the setup logic:

    pragma solidity ^0.6.0;
    import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol";
    contract BEP20UpgradeableProxy is TransparentUpgradeableProxy {
    constructor(address logic, address admin, bytes memory data) TransparentUpgradeableProxy(logic, admin, data) public {
    }}

    OpenZeppelin Upgrades provides an Initializable base contract that has an initializer modifier to prevent a contract from being initialized multiple times: https://github.com/bnb-chain/canonical-upgradeable-bep20/blob/47ed7a710e6e86bdc85f2118bf63fc892e3b7716/contracts/BEP20TokenImplementation.sol#L37

     /**
    * @dev sets initials supply and the owner
    */
    function initialize(string memory name, string memory symbol, uint8 decimals, uint256 amount, bool mintable, address owner) public initializer {
    _owner = owner;
    _name = name;
    _symbol = symbol;
    _decimals = decimals;
    _mintable = mintable;
    _mint(owner, amount);
    }

    BEP20 contract initializes the token’s name, symbol, and decimals in its constructor. You should not use these contracts in your BEP20 Upgrades contract. , make sure to use the upgradableBEP20implementation that has been modified to use initializers instead of constructors. https://github.com/bnb-chain/bsc-genesis-contract/blob/42922472b43397fbca9d0c84c7f72fbfaf39efc3/contracts/bep20_template/BEP20Token.template#L351

    constructor() public {
    _name = {{TOKEN_NAME}};
    _symbol = {{TOKEN_SYMBOL}};
    _decimals = {{DECIMALS}};
    _totalSupply = {{TOTAL_SUPPLY}};
    _balances[msg.sender] = _totalSupply;

    }

    Using Truffle

    Setting up the Environment

    We will begin by creating a new npm project:

    mkdir mycontract && cd mycontract

    Then,

    npm init -y

    Installation

    We will install Truffle.

    npm install --save-dev truffle
    npm install --save-dev @openzeppelin/contracts
    npm install --save-dev zeppelin-solidity

    When running Truffle select the option to “Create a truffle-config.js”

    npx truffle init

    Create upgradeable contract

    This example token has a fixed supply that is minted to the deployer of the contract.

    https://github.com/bnb-chain/canonical-upgradeable-bep20/blob/master/contracts/BEP20TokenImplementation.sol

    const BEP20TokenImplementation = artifacts.require("BEP20TokenImplementation");const BEP20TokenFactory = artifacts.require("BEP20TokenFactory");
    const Web3 = require('web3');const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));
    const fs = require('fs');
    module.exports = function(deployer, network, accounts) { deployer.then(async () => { await deployer.deploy(BEP20TokenImplementation); await deployer.deploy(BEP20TokenFactory, BEP20TokenImplementation.address); });};

    Test the contract locally

    To test upgradeable contracts we should create unit tests for the implementation contract, along with creating higher level tests for testing interaction via the proxy.

    contract('Upgradeable BEP20 token', (accounts) => {  it('Create Token', async () => {    const BEP20TokenFactoryInstance = await BEP20TokenFactory.deployed();    bep20FactoryOwner = accounts[0];    bep20Owner = accounts[1];    proxyAdmin = accounts[0];
    const tx = await BEP20TokenFactoryInstance.createBEP20Token("ABC Token", "ABC", 18, web3.utils.toBN(1e18), true, bep20Owner, proxyAdmin, {from: bep20FactoryOwner}); truffleAssert.eventEmitted(tx, "TokenCreated",(ev) => { bep20TokenAddress = ev.token; return true; });
    });

    Transfer Control

    You can change the proxy owner to another address.

    let event = await bep20proxy.methods.changeAdmin(newAdmin).send({from: proxyAdmin});
    bep20proxy.getPastEvents("AdminChanged", {fromBlock: 0, toBlock: "latest"}).then(console.log)

    Transfer Owner

    You can change the BEP20 token owner to another address.

        await bep20.methods.transferOwnership(accounts[5]).send({from: accounts[1]});
    const owner = await bep20.methods.getOwner().call({from: accounts[5]});

    Deploy on Testnet

    Create the following 2_bep20.js script in the migrations directory.

    module.exports = function(deployer, network, accounts) { deployer.then(async () => {  await deployer.deploy(BEP20TokenImplementation);  await deployer.deploy(BEP20TokenFactory, BEP20TokenImplementation.address); });};

    You can first deploy our contract to a local test (such as ganache-cli) and manually interact with it, then deploy your contract to a public test network.

    $ npx truffle console --network ganache

    We can interact with our contract using the Truffle console.

    truffle(ganache)> BEP20TokenFactoryInstance = await BEP20TokenFactory.deployed();undefinedtruffle(ganache)> await BEP20TokenFactoryInstance.createBEP20Token("ABC Token", "ABC", 18, web3.utils.toBN(1e18), true, {address1}, {address2});

    Note: any secrets such as mnemonics or bscscan keys should not be committed to version control.

    Run truffle migrate with the BSC testnet to deploy. We can see our implementation contract 'BEP20TokenImplementation' and the 'BEP20TokenFactory' being deployed.

    Deploying 'BEP20TokenImplementation'
    ------------------------------------
    > transaction hash: 0xdcd37a388bf9b2f822eff5b816bd4c9db80bc4f6046e3f922cedca12162d46d9
    > Blocks: 3 Seconds: 8
    > contract address: 0xB3fbaf029580145885e915B3CAeEd259Edb9DfE1
    > block number: 5174292
    > block timestamp: 1609990661
    > account: 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed
    > balance: 10.648947766
    > gas used: 1147250 (0x118172)
    > gas price: 20 gwei
    > value sent: 0 ETH
    > total cost: 0.022945 ETH

    Pausing for 5 confirmations...
    ------------------------------
    > confirmation number: 2 (block: 5174294)
    > confirmation number: 3 (block: 5174295)
    > confirmation number: 5 (block: 5174297)

    Deploying 'BEP20TokenFactory'
    -----------------------------
    > transaction hash: 0x821c8355aaecc36a9f7fe50d2b3722c840047883a6bf500343393554d8ce3696
    > Blocks: 3 Seconds: 8
    > contract address: 0xDC1015512AbBC71e57a607A121a4aC9CF05D89BC
    > block number: 5174300
    > block timestamp: 1609990685
    > account: 0x133D144F52705cEb3f5801B63b9EBcCF4102f5Ed
    > balance: 10.629661146
    > gas used: 964331 (0xeb6eb)
    > gas price: 20 gwei
    > value sent: 0 ETH
    > total cost: 0.01928662 ETH


    Create a new version of our implementation

    After a period of time, we decide that we want to add functionality to our contract. In this guide we will add an whitelist function.

    Create the new implementation, BEP2_V2.sol in your contracts directory with the following Solidity code.

    /**   * @dev sets multiple whitelist address   */
    function multiWhitelistAdd(address[] memory addresses) external onlyOwner {
    for (uint256 i = 0; i < addresses.length; i++) {
    whitelist[addresses[i]] = true;
    }
    }
    /**
    * @dev remove whitelisted address
    */
    function multiWhitelistRemove(address[] memory addresses) external onlyOwner {
    for (uint256 i = 0; i < addresses.length; i++) {
    whitelist[addresses[i]] = false;
    }
    }
    /**
    * @dev check if is a whitelist address
    */
    function isInWhitelist(address a) internal view returns (bool) {
    return whitelist[a];
    }

    Test the upgrade locally

    To test our upgrade we should create unit tests for the new implementation contract, along with creating higher level tests for testing interaction via the proxy, checking that state is maintained across upgrades.

    We will create unit tests for the new implementation contract. We can add to the unit tests we already created to ensure high coverage.

    Create uograde.test.js in your test directory with the following JavaScript.

    let tx = await bep20proxy.methods.upgradeTo(newInstance.address).send({from: proxyAdmin});
    bep20proxy.getPastEvents("Upgraded", {fromBlock: 0, toBlock: "latest"}).then(console.log)
    - + diff --git a/docs/remix-new.html b/docs/remix-new.html index e695862fe3..4b5de79a67 100644 --- a/docs/remix-new.html +++ b/docs/remix-new.html @@ -8,13 +8,13 @@ - +

    Using Remix IDE for Deploying Smart Contracts on BSC

    In this tutorial, we provide guidelines on how to create, compile, and deploy a simple Hello World smart contract on BSC using the Remix IDE.

    Pre-requisites

    There is no need for any local environment settings for deploying solidity smart contracts on BSC using the Remix IDE.

    All you require is a browser-based Web3 wallet (e.g. MetaMask) to interact with the BSC Testnet and deployed contracts. If you are already using MetaMask, it is recommended to create a new account for testing with Replit. You can do this from the account menu, which appears when you click on the account avatar in the top right corner of MetaMask interface.

    You must set up all of the following Pre-requisites to be able to deploy your solidity smart contract on BSC:

    Setting Up Remix IDE

    • Remix is an online IDE to develop smart contracts.
    • You need to choose Solidity Compiler, Choose the appropriate compiler version. We used 0.8.15 for this tutorial.

    Writing the Smart Contract

    • Create a new file, name it HelloWorld.sol, and copy the contract code given below
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.15;
    contract HelloWorld {
    function sayHelloWorld() public pure returns (string memory) {
    return "Hello World";
    }
    }

    The first line, pragma solidity ^0.8.15 specifies that the source code is for a Solidity version greater than 0.8.15. Pragmas are common instructions for compilers about how to treat the source code (e.g., pragma once).

    A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. Learn more about the constructor and memory in the docs.

    Compile Smart Contract

    • Step1: Click button to switch to compile page.

    • Step2: Select the appropriate compiler version, 0.8.15 in our case.

    • Step3: Enable "Auto compile" and "Optimization" from Advanced Configurations,

    • Step4: Select "HelloWorld" from the contract drop-down menu.

    • Step5: Click "ABI" to copy the contract ABI and save it.

    img

    Configure MetaMask and Fund Your Account

    Now, We have to deploy our smart contract on BNB Smart Chain Network. For that, we have to connect to Web3 world, this can be done by many services like MetaMask, Brave, Portis etc. We will be using MetaMask. Please follow this tutorial to setup a Metamask Account for configuring the MetaMask wallet to use with BSC.

    • Open Metamask and select Custom RPC from the networks dropdown

    • Go to setting page

    img
    • Add a new network
    img
    • Go ahead and click save

    • Copy your address from Metamask

    • Head over to Faucet and request test BNB

    Deploy Smart Contract

    Follow the following steps to deploy the HelloWorld smart contract on the BNB Smart Chain Testnet.

    img
    • Step1: Navigate to the Deployment Page.
    • Step2: Select Injected Provider in the Environment dropdown
    • Step3: Confirm the Connection Request on the MetaMask notification.
    img
    • Step4: Once Metamask is connected to Remix, click on the "Deploy" button which would generate another metamask popup that requires transaction confirmation.
    img

    Congratulations! You have successfully deployed a simple Smart Contract on the BSC Testnet. Now you can interact with the Smart Contract. Check the deployment status here: https://testnet.bscscan.com/

    Verify the deployed contract on BscScan

    The first and foremost step is to flatten the solidity contract into a single file to be able to get it verified on BscScan.

    Flatten the Smart Contract Code

    • Copy and Paste your smart contract into a local file on your system named as HelloWorld.sol.
    • Install Truffle Flattener by running the command npm install truffle-flattener on your terminal or command prompt.
    • Flatten the contract by running the command in the npx truffle-flattener HelloWorld.sol > FlatHelloWorld.sol contracts directory
    • Clean up the licensing information.
      • The flattened contract will have the same licensing note imported from each of the files.
      • Multiple licensing notes in one file break the BscScan verification, so you have to leave one licensing note for the entirety of the flattened contract.
      • The easiest way to clean up is to search for the SPDX mentions in the file and remove all of them except for the very first one.

    Using Flattened Code to Verify

    At this point, you have your flattened and cleaned-up contract ready for the BscScan verification.

    • Go to BscScan Testnet.
    • Find your deployed contract by searching it using its address.
    • On the main page of BscScan, on the header click Misc > Verify Contract.
    • In Compiler Type, select Solidity (Single file).
    • In Compiler Version, select v0.8.15. This is the version this tutorial used to compile the contract.
    • In Open Source License Type, select MIT License (MIT).
    • Click Continue.
    • Keep the Optimization option set to No as Remix does not use optimization by default.
    • Paste the entirety of your flattened .sol contract in the Enter the Solidity Contract Code below field.
    • Click Verify and Publish.
    • BscScan will take a few seconds to compile your contract, verify, and publish it.

    Conclusion

    This tutorial guided you through the basics of creating and deploying a simple smart contract using the Remix IDE and MetaMask Web Wallet. It also provides step-by-step guide on how to verify and publish your deployed smart contract. This tutorial uses testnet, however, the exact same instructions and sequence will work on the mainnet as well.

    - + diff --git a/docs/replit.html b/docs/replit.html index 670cb1ae44..12f02d927c 100644 --- a/docs/replit.html +++ b/docs/replit.html @@ -8,14 +8,14 @@ - +

    Using Replit IDE for Deploying Smart Contracts on BSC

    Replit is a coding platform that allows you to write code and host apps. Replit supports Solidity programming language and provides all of the features and functionality that are required by Web3 developers for creating and deploying smart contracts.

    In this tutorial, we explain how to build and deploy a solidity smart contract on the BSC Testnet using the Replit IDE and the Replit Solidity Template (Solidity starter beta)

    note

    For additional examples about Solidity with Replit, you can read the article Get started with Replit! or check Replit Solidity documentation and Escrow contract tutorial

    Pre-Requisites

    There is no need for any local environment settings for deploying solidity smart contracts on BSC using Replit.

    All you require is a browser-based Web3 wallet (e.g. MetaMask) to interact with the BSC Testnet and deployed contracts. If you are already using MetaMask, it is recommended to create a new account for testing with Replit. You can do this from the account menu, which appears when you click on the account avatar in the top right corner of MetaMask interface.

    You must set up all of the following Pre-requisites to be able to deploy your solidity smart contract on BSC:

    1. Create a Replit account
    2. Download Metamask wallet
    3. Configure BNB Smart Chain Testnet on Metamask
    4. Get BNB testnet tokens

    Working with a Repl

    Every Repl that you create is a fully functional development and production environment. Follow the steps to create a solidity starter Repl:

    1. Login or create an account. After creating your Replit account, your home screen will include a dashboard where you can view, create projects, and manage your account.
    2. Once logged in, create a Solidity starter repl, Select + Create Repl from the left panel or + in the top right corner of the screen.
    3. Select the Solidity starter (beta) template and specify a title for your project.
    4. Click on + Create Repl for creating your project.

    Note The Solidity starter repl comes with a friendly web interface, built using the Web3 Ethereum JavaScript API, which you can use to deploy and interact with your smart contracts. For this tutorial, we will deploy smart contract on to BNB Smart Chain Testnet.

    Create Smart Contract

    Delete the contents of the contract.sol file and paste the following solidity code into this file.

    // SPDX-License-Identifier: MIT
    pragma solidity >0.4.0 <= 0.9.0;

    contract HelloWorld{
    function sayHello() public pure returns (string memory) {
    return "Hello, World!";
    }
    }

    Deploy on BSC

    Make sure that you have followed the list of Pre-requisites above so that you are ready to deploy and interact with your smart contract:

    1. Click on Run (at the Top) to install all relevant packages and start up the contract deployment UI.
    2. Click on image icon to open the web interface for deloyment in a new browser tab.
    3. Connect your MetaMask wallet to the web interface and switch to the BSC Testnet.
    4. Click on Connect wallet, select your account, then choose Connect.

    image

    image

    1. From the Drop-down list, Select the contract that you want to deploy. Click on Deploy.

    image

    1. Approve the MetaMask notification that appears asking for confirmation of the transaction from your wallet to deploy the smart contract.

    image

    1. Copy the address of the deployed contract.

    image

    1. Navigate to BscScan Testnet Explorer to search and view your deployed contract. Using the contract address to search for it.

    image

    Once your contract has been deployed, it will show up as expandable boxes below the drop-down box. Expand it and take a look at all the different functions available. You can now interact with your contract using the provided user interface or from a sharable URL shown on the interface.

    image

    Publish to Replit​

    Replit allows you to publish your projects to a personal profile. After publishing, projects will show up on your spotlight page for others to explore, interact with, clone, and collaborate.

    See Publish your Repl.

    Conclusion

    This tutorial guided you through the basics of creating and deploying a smart contract using the Replit IDE. We also provided steps on how to interact with the deployed contract online and publish your replit project. This tutorial uses testnet, however, the exact same instructions and sequence will work on the mainnet as well.

    - + diff --git a/docs/rpc.html b/docs/rpc.html index 5444ff0085..7a5109bea9 100644 --- a/docs/rpc.html +++ b/docs/rpc.html @@ -8,14 +8,14 @@ - +

    JSON-RPC Endpoint

    JSON-RPC endpoints refers to the network location where a program could transfer its RPC requests to access server data. Once you connect a decentralized application to an RPC endpoint, you can access the functionalities of different operations, which could enable real-time usage of blockchain data. BNB Chain provides several RPC endpoints for connectinto both its Minent and Testnet. In this section, we list the JSON-RPC endpoints that can be used for connecting to BNB Smart Chain.

    RPC Endpoints for BNB Smart Chain

    info

    The rate limit of BSC endpoint on Testnet and Mainnet is 10K/5min.

    note

    eth_getLogs is disabled on below Mainnet endpoints, please use 3rd party endpoints from here. If you need to pull logs frequently, we recommend using WebSockets to push new logs to you when they are available.

    BSC Mainnet (ChainID 0x38, 56 in decimal)

    You could find more endpoints from here.

    BSC Testnet (ChainID 0x61, 97 in decimal)

    Thrid-Party RPC Providers

    Starting HTTP JSON-RPC

    You can start the HTTP JSON-RPC with the --http flag

    ## mainnet
    geth attach https://bsc-dataseed.bnbchain.org

    ## testnet
    geth attach https://data-seed-prebsc-1-s1.bnbchain.org:8545

    JSON-RPC methods

    Please refer to this wiki page or use Postman: https://documenter.getpostman.com/view/4117254/ethereum-json-rpc/RVu7CT5J?version=latest

    RPC Endpoints for BNB Beacon Chain

    Mainnet

    Testnet

    - + diff --git a/docs/stake/Staking.html b/docs/stake/Staking.html index f5515055e7..2388c70083 100644 --- a/docs/stake/Staking.html +++ b/docs/stake/Staking.html @@ -8,13 +8,13 @@ - +

    Staking

    BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.

    Ideally, BNB Smart Chain should build such staking and reward logic into the blockchain, and automatically distribute rewards as the blocking happens. Cosmos Hub, who also build on top of Tendermint consensus like BNB Beacon Chain, works in this way.

    However, as BSC wants to remain compatible with Ethereum as much as possible. On the other side, BNB Beacon Chain already has a staking module and could be extended to support both BC and BSC. In this way, all the staking related operations are recorded in BC. Once there are any changes about BSC's validator set or voting power, the new message will be transferred to BSC through cross-chain communication.

    Staking Economics

    1. The staking token is BNB, as it is a native token on both blockchains anyway
    2. The staking, i.e. token bond and delegation actions and records for BSC, happens on BC.
    3. The BSC validator set is determined by its staking and delegation logic, via a staking module built on BC for BSC, and propagated every day UTC 00:00 from BC to BSC via Cross-Chain communication.
    4. The reward distribution happens on BC around every day UTC 00:00 after.

    Ranking Algorithm

    Validators are ranked by their power and operator address. The more its delegation tokens, the higher ranking is. If two validators get the same amount of delegated tokens, validator with smaller address bytes has higher ranking.

    Reward Distrubution

    Since BSC uses PoSA as its consensus engine, all the delegators of validators can receive some share of the validators’ reward. However, the rewards(fees) are collected on BSC while the staking info is stored on BC. So, the main idea is we transfer all the rewards from BSC to BC once every day and execute the distribution on BC.

    Main Workflow:

    1. ValidatorSet is updated in BreatheBlock, the frequency is once a day. let’s assume it happens on day N.
    2. The info of validator set changes of day N would be transmitted to BSCthrough interchain communication.
    3. The validator set contract on BSC would receive and update the new validatorset. After that, it would trigger several interchain transfer to transfer the fees that every previous validators collected in this period to their addresses on BC. we can see that fees belongs to the validators of day N-1.
    4. To make some room for the error handling, we distribute the fees of day N-1 in the next breathe block (day N+1).

    Details

    1. Even if validator set or any their voting powers are not changed on that day, we still transmit the validator set info to BSC.
    2. The validator set contract maintains the history of the fees that every validators collected after the previous period(We define the period as the time between two contract calls of validator set changes). The actual fees are collected on the contract address.
    3. The interchain transfer to send fees from the contract address to each validator’s distribution address on BC. Note the distribution address is auto generated on BC when handling the create-validator tx, so no private key is corresponded to that address and no one except the distribution module can move the tokens on that address. This address is displayed as Distribution Addr in validator info.
    Validator
    Fee Address: tbnb15mgzha93ny878kuvjl0pnqmjygwccdadpw5dxf
    Operator Address: bva15mgzha93ny878kuvjl0pnqmjygwccdad08uecu
    Validator Consensus Pubkey:
    Jailed: false
    Status: Bonded
    Tokens: 5000000000000
    Delegator Shares: 5000000000000
    Description: {Elbrus "" www.binance.org This is Elbrus org on chapel network.}
    Bond Height: 74158
    Unbonding Height: 0
    Minimum Unbonding Time: 1970-01-01 00:00:00 +0000 UTC
    Commission: {rate: 75000000, maxRate: 90000000, maxChangeRate: 3000000, updateTime: 2020-05-22 12:24:19.478568234 +0000 UTC}
    Distribution Addr: tbnb1srkkfjk8qctvvy4s3cllhpnkz9679jphr30t2c
    Side Chain Id: chapel
    Consensus Addr on Side Chain: 0xF474Cf03ccEfF28aBc65C9cbaE594F725c80e12d
    Fee Addr on Side Chain: 0xe61a183325A18a173319dD8E19c8d069459E2175
    1. We have a lower limit of the value of interchain transfer, at least the value can cover the transfer fee. Also, interchain transfer will only allow max 8 decimals for the amount. The tiny left part would be kept in the contract or put into the system reward pool.
    2. Reward: (totalfees \* (1-commissionRate)) would be distributed in proportion to the delegations, the left part would be sent to the validator fee address.

    Error handling

    If the cross-chain transfer failed, the tokens would be sent back to a specified address(i.e. the SideFeeAddr in the store section, validators can change this address via the EditValidator tx). After that, validators can manually deposit the tokens to its own DistributionAddr on BC via Transfer tx. We do not force the validator to do so, but it’s an indicator that can help delegators choose validators.

    Fee Table

    Transaction TypePay in BNB
    Create A New Smart Chain Validator10
    Edit Smart Chain Validator Information1
    Delegate Smart Chain Validator0.001
    Redelegate Smart Chain Validator0.003
    Undelegate Smart Chain Validator0.002
    - + diff --git a/docs/stake/cli-commands.html b/docs/stake/cli-commands.html index 19dc28c549..cc8ba3209b 100644 --- a/docs/stake/cli-commands.html +++ b/docs/stake/cli-commands.html @@ -8,13 +8,13 @@ - +
    -

    CLI Commands

    In order to run the CLI commands related to staking and delegation, it important to first download the bnbcli and tbnbcli binaries.

    Download Binaries

    For Mainnet

    Please download bnbcli binary from here

    For Testnet

    Please download tbnbcli binary from here

    Create BSC Validator

    Parameters for bsc-create-validator

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, also be used as the validator operator addressYes
    --address-delegatorbnb1xxx/tbnb1xxxoptional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator.No
    --amount2000000000000:BNB (means 20000 BNB)self-delegation amount, it has 8 decimal placesYes
    --monikermyval1validator nameYes
    --identityxxxoptional identity signature (ex. UPort or Keybase)No
    --websitewww.example.comoptional websiteNo
    --detailssome detailsoptional detailsNo
    --commission-rate80000000(that means 0.8 or 80%)The initial commission rate percentage, it has 8 decimal places.Yes
    --commission-max-rate95000000 (0.95 or 95%)The maximum commission rate percentage, it has 8 decimal places. You can not update this rate.Yes
    --commission-max-change-rate3000000 (0.03 or 3%)The maximum commission change rate percentage (per day). You can not update this rate.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --side-cons-addr0x1234abcdconsensus address of the validator on side chain, please use hex format prefixed with 0xYes
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.Yes
    --home/path/to/cli_homehome directory of bnbcli data and config, default to “~/.bnbcli”No

    Some address parameters we need to highlight here:

    Field NameUsage
    DelegatorAddrSelf delegator address. For BC, this address also used to collect fees.
    ValidatorAddrvalidator operator’s address, used in governance ops like voting.
    SideConsAddrblock producer’s address on side chain, i.e. consensus address. BC has another parameter named PubKey, here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.
    SideVoteAddrA bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal. |
    SideFeeAddrfees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain. Those BNB will be sent to fee address.

    Examples Showing Usage of bsc-create-validator

    If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.

    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    If you want a separated self-delegator address, both self-delegator and validator operator need to sign this transaction.

    Here we need to use another two commands to support multiple signatures.

    a. Use the following commands appended with a parameter **--generate-only** and save the result to a json file which would be used to be signed.

    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    b. both validator operator(--from) and self-delegator(--address-delegator) use **bnbcli sign** command to sign the file from a).

    Delegator address need to sign unsigned.json first

    • Online Mode
    ## mainnet
    ./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json

    Then, validator operator addres will sign it later.

    • Online Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json

    c. Use **bnbcli broadcast** to send the transaction from above to the blockchain nodes.

    ## mainnet
    ./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges

    Verify your transaction in mainnet-explorer or testnet-explorer

    Edit BSC Validator

    Parameters for bsc-edit-validator

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that also indicate the validator that you want to edit.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --monikermyval1validator name (default "[do-not-modify]")No
    --identityxxxoptional identity signature (ex. UPort or Keybase) (default "[do-not-modify]")No
    --websitewww.example.comoptional website (default "[do-not-modify]")No
    --detailssome detailsoptional details (default "[do-not-modify]")No
    --commission-rate80000000(that means 0.8 or 80%)The new commission rate percentageNo
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.No

    Examples

    ## mainnet
    bnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ##testnet
    bash tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    Delegate BNB

    Parameters for staking bsc-delegate

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Example

    ## mainnet
    bnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Redelegate BNB

    Parameters for staking bsc-redelegate

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --addr-validator-sourcebva1xxxbech32 address of the source validator, starts with “bva”Yes
    --addr-validator-destbva1yyybech32 address of the destination validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    ###s Example

    ## mainnet
    bnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli


    ### testnet

    tbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli

    Undelegate BNB

    Parameters for staking bsc-unbond

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Example

    • Mainnet
    bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Query side chain vaildator by operator

    Parameters for staking side-validator

    Parameter NameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    • Mainnet
    bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f  --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain delegation by delegator and operator

    Parameters for staking side-delegation

    Parameter NameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    • Mainnet
    bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli

    Query side chain delegations by delegator

    Parameters for staking side-delegations

    Parameter NameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    • Mainnet
    bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node

    Query side chain unbonding delegation

    Parameters for staking side-unbonding-delegation

    bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking  side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by delegator

    Parameters for staking side-unbonding-delegations

    Usage:

    bnbcli staking side-unbonding-delegations [delegator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking  side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by validator

    Parameters for staking side-val-unbonding-delegations

    Usage:

    bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegation

    Parameters for staking side-redelegation

    Usage:

    bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking  side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n  bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by delegator

    Parameters for staking side-redelegations

    Usage:

    bnbcli staking side-redelegations [delegator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by validator

    Parameters for staking side-val-redelegations

    Usage:

    bnbcli staking side-val-redelegations [operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain staking pool

    Parameters for staking side-pool

    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking     side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home     ~/home_cli

    Query side chain top validators

    Parameters for staking side-top-validators

    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --top10number of validators to be returned. set as maximum number of validators by defaultOption

    Example

    bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain validators count

    Parameters for staking side-validators-count

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --jail-involvedtrueif true, meaning that the jailed validators will be involved to countOption

    Example

    bnbcli staking  side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli
    - +

    CLI Commands

    In order to run the CLI commands related to staking and delegation, it important to first download the bnbcli and tbnbcli binaries.

    Download Binaries

    For Mainnet

    Please download bnbcli binary from here

    For Testnet

    Please download tbnbcli binary from here

    Create BSC Validator

    Parameters for bsc-create-validator

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, also be used as the validator operator addressYes
    --address-delegatorbnb1xxx/tbnb1xxxoptional, bech32 address of the self-delegator. if not provided, --from address will be used as self-delegator.No
    --amount2000000000000:BNB (means 20000 BNB)self-delegation amount, it has 8 decimal placesYes
    --monikermyval1validator nameYes
    --identityxxxoptional identity signature (ex. UPort or Keybase)No
    --websitewww.example.comoptional websiteNo
    --detailssome detailsoptional detailsNo
    --commission-rate80000000(that means 0.8 or 80%)The initial commission rate percentage, it has 8 decimal places.Yes
    --commission-max-rate95000000 (0.95 or 95%)The maximum commission rate percentage, it has 8 decimal places. You can not update this rate.Yes
    --commission-max-change-rate3000000 (0.03 or 3%)The maximum commission change rate percentage (per day). You can not update this rate.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --side-cons-addr0x1234abcdconsensus address of the validator on side chain, please use hex format prefixed with 0xYes
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.Yes
    --home/path/to/cli_homehome directory of bnbcli data and config, default to “~/.bnbcli”No

    Some address parameters we need to highlight here:

    Field NameUsage
    DelegatorAddrSelf delegator address. For BC, this address also used to collect fees.
    ValidatorAddrvalidator operator’s address, used in governance ops like voting.
    SideConsAddrblock producer’s address on side chain, i.e. consensus address. BC has another parameter named PubKey, here SideConsAddr replaced that for BSC. Only BSC validators need this parameter.
    SideVoteAddrA bls public key. It's used by validators to vote for blocks, so the BSC chain can finalize blocks within two block periods in normal. |
    SideFeeAddrfees are collected in this address on BSC, Only BSC validators need this parameter. Due to different token units, there are some BNB left as dust when sending block rewards from BNB Smart Chain to BNB Beacon Chain. Those BNB will be sent to fee address.

    Examples Showing Usage of bsc-create-validator

    If you want to create a validator with the same operator address and self-delegator address, you only need one signature for this transaction.

    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 1000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --amount 2000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "[www.example.](http://www.binance.org)com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    If you want a separated self-delegator address, both self-delegator and validator operator need to sign this transaction.

    Here we need to use another two commands to support multiple signatures.

    a. Use the following commands appended with a parameter **--generate-only** and save the result to a json file which would be used to be signed.

    ## mainnet
    bnbcli staking bsc-create-validator --chain-id Binance-Chain-Tigris --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id bsc --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    ## testnet
    tbnbcli staking bsc-create-validator --chain-id Binance-Chain-Ganges --from {validator-operator-address} --address-delegator {delegator-address} --amount 5000000000000:BNB --moniker bsc_v1 --identity "xxx" --website "www.example.com" --details "bsc validator node 1" --commission-rate 80000000 --commission-max-rate 95000000 --commission-max-change-rate 3000000 --side-chain-id chapel --side-cons-addr 0x9B24Ee0BfBf708b541fB65b6087D6e991a0D11A8 --side-fee-addr 0x5885d2A27Bd4c6D111B83Bc3fC359eD951E8E6F8 --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli --generate-only > unsigned.json

    b. both validator operator(--from) and self-delegator(--address-delegator) use **bnbcli sign** command to sign the file from a).

    Delegator address need to sign unsigned.json first

    • Online Mode
    ## mainnet
    ./bnbcli sign unsigned.json --from {delegator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --from {delegator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> delegator-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {delegator-address} >> delegator-signed.json

    ## testnet
    ./tbnbcli sign unsigned.json --account-number <delegator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {delegator-address} >> delegator-signed.json

    Then, validator operator addres will sign it later.

    • Online Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --from {validator-address} --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --from {validator-address} --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges >> both-signed.json
    • Offline Mode
    ## mainnet
    ./bnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Tigris --offline --name {validator-address} >> both-signed.json

    ## testnet
    ./tbnbcli sign delegator-signed.json --account-number <validator-account-number> --sequence <address-sequence> --chain-id Binance-Chain-Ganges --offline --name {validator-address} >> both-signed.json

    c. Use **bnbcli broadcast** to send the transaction from above to the blockchain nodes.

    ## mainnet
    ./bnbcli broadcast both-signed.json --node dataseed4.bnbchain.org:80 --chain-id Binance-Chain-Tigris

    ## testnet
    ./tbnbcli broadcast both-signed.json --node data-seed-pre-0-s3.bnbchain.org:80 --chain-id Binance-Chain-Ganges

    Verify your transaction in mainnet-explorer or testnet-explorer

    Edit BSC Validator

    Parameters for bsc-edit-validator

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that also indicate the validator that you want to edit.Yes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --monikermyval1validator name (default "[do-not-modify]")No
    --identityxxxoptional identity signature (ex. UPort or Keybase) (default "[do-not-modify]")No
    --websitewww.example.comoptional website (default "[do-not-modify]")No
    --detailssome detailsoptional details (default "[do-not-modify]")No
    --commission-rate80000000(that means 0.8 or 80%)The new commission rate percentageNo
    --side-vote-addr0x1234abcdvote pub key of the validator on side chain, please use hex format prefixed with 0x, supported after BEP126Yes
    --side-fee-addr0xabcd1234address that validator collects fee rewards on side chain, please use hex format prefixed with 0x.No

    Examples

    ## mainnet
    bnbcli staking bsc-edit-validator --chain-id Binance-Chain-Tigris --side-chain-id bsc --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    ##testnet
    bash tbnbcli staking bsc-edit-validator --chain-id Binance-Chain-Ganges --side-chain-id chapel --moniker bsc_v1_new --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --side-vote-addr 0x85e6972fc98cd3c81d64d40e325acfed44365b97a7567a27939c14dbc7512ddcf54cb1284eb637cfa308ae4e00cb5588 --home ~/home_cli

    Delegate BNB

    Parameters for staking bsc-delegate

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Example

    ## mainnet
    bnbcli staking bsc-delegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    ## testnet
    tbnbcli staking bsc-delegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Redelegate BNB

    Parameters for staking bsc-redelegate

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --addr-validator-sourcebva1xxxbech32 address of the source validator, starts with “bva”Yes
    --addr-validator-destbva1yyybech32 address of the destination validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    ###s Example

    ## mainnet
    bnbcli staking bsc-redelegate --chain-id Binance-Chain-Tigris --side-chain-id bsc --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli


    ### testnet

    tbnbcli staking bsc-redelegate --chain-id Binance-Chain-Ganges --side-chain-id chapel --from tbnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --addr-validator-source bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --addr-validator-dest bva1jam9wn8drs97mskmwg7jwm09kuy5yjumvvx6r2 --amount1000000000:BNB --home ~/home_cli

    Undelegate BNB

    Parameters for staking bsc-unbond

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb1xxx/tbnb1xxxaddress of private key with which to sign this tx, that is also the delegator addressYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --validatorbva1xxxbech32 address of the validator, starts with “bva”Yes
    --amount1000000000:BNB (10 BNB)delegation amount, it has 8 decimal placesYes

    Example

    • Mainnet
    bnbcli staking bsc-unbond --chain-id Binance-Chain-Ganges --side-chain-id chapel --from bnb1tfh30c67mkzfz06as2hk0756mgdx8mgypu7ajl --validator bva1tfh30c67mkzfz06as2hk0756mgdx8mgypqldvm --amount 1000000000:BNB --home ~/home_cli

    Query side chain vaildator by operator

    Parameters for staking side-validator

    Parameter NameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    • Mainnet
    bnbcli staking side-validator bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f  --side-chain-id bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain delegation by delegator and operator

    Parameters for staking side-delegation

    Parameter NameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    • Mainnet
    bnbcli staking side-delegation bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --chain-id=Binance-Chain-Tigris --side-chain-id bsc --home ~/home_cli

    Query side chain delegations by delegator

    Parameters for staking side-delegations

    Parameter NameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    • Mainnet
    bnbcli staking side-delegations bnb1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcqre0d --side-chain-id bsc --node=0.0.0.0:26657 --chain-id=Binance-Chain-Tigris --trust-node

    Query side chain unbonding delegation

    Parameters for staking side-unbonding-delegation

    bnbcli staking side-unbonding-delegation [delegator-addr] [operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking  side-unbonding-delegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by delegator

    Parameters for staking side-unbonding-delegations

    Usage:

    bnbcli staking side-unbonding-delegations [delegator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking  side-unbonding-delegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain unbonding delegations by validator

    Parameters for staking side-val-unbonding-delegations

    Usage:

    bnbcli staking side-val-unbonding-delegation [operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking side-val-unbonding-delegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegation

    Parameters for staking side-redelegation

    Usage:

    bnbcli staking side-redelegation [delegator-addr] [src-operator-addr] [dst-operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking  side-redelegation bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n  bva1hz5sg3u0v4gq2veyw5355z7qx6y7uuqhcuzf3f --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by delegator

    Parameters for staking side-redelegations

    Usage:

    bnbcli staking side-redelegations [delegator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking side-redelegations bnb1rtzy6szuyzcj4amfn6uarvne8a5epxrdklwhhj --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain re-delegations by validator

    Parameters for staking side-val-redelegations

    Usage:

    bnbcli staking side-val-redelegations [operator-addr] [flags]
    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking side-val-redelegations bva12hlquylu78cjylk5zshxpdj6hf3t0tahqmr98n --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain staking pool

    Parameters for staking side-pool

    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idbsc/chapelchain-id of the side chain the validator belongs toYes

    Example

    bnbcli staking     side-pool --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home     ~/home_cli

    Query side chain top validators

    Parameters for staking side-top-validators

    parameter nameExampleExplanationrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --top10number of validators to be returned. set as maximum number of validators by defaultOption

    Example

    bnbcli staking side-top-validators --top 10 --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli

    Query side chain validators count

    Parameters for staking side-validators-count

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of BNB Beacon ChainYes
    --side-chain-idchapelchain-id of the side chain the validator belongs toYes
    --jail-involvedtrueif true, meaning that the jailed validators will be involved to countOption

    Example

    bnbcli staking  side-validators-count --jail-involved --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home_cli
    + diff --git a/docs/staking-with-ext-wallet.html b/docs/staking-with-ext-wallet.html index ff73194377..dae7f6048b 100644 --- a/docs/staking-with-ext-wallet.html +++ b/docs/staking-with-ext-wallet.html @@ -8,13 +8,13 @@ - +

    Staking with Binance Extension Wallet

    How to Delegate Your BNB with Binance Extension Wallet

    Testnet example

    img

    • Click on “Connect Wallet”

    img

    • Unlock your wallet

    img

    • Click on Delegate and input the amount

    img

    • Confirm your transaction in extension wallet

    img

    • Upon Success you will see a similar output

    img

    • Your delegation overview

    img

    • You can also see the staking history

    img

    How to Redelegate Your BNB With Binance Extension Wallet

    By staking you BNB, you participate in the selection process of BNB Smart Chain validators and earn rewards. Staking BNB is critical for securing the network. Validators can self-bond, meaning they can delegate BNB to themselves, and they can also receive delegations from any other BNB holders.

    Redelegations between a unique delegator, source validator, and destination validator can only happen once every 7 days

    • Click on Redelegate

    img

    • Select a new validator and input amount to redelegate

    img

    • Confirm your transaction in extension wallet

    img

    • Upon Success you will see a similar output

    img

    • Refresh and see your delegation changes

    img

    How to Undelegate Your BNB with Binance Extension Wallet

    • Click on Undelegate

    img

    • Input the amount

    img

    • Confirm your transaction in extension wallet

    img

    • Upon Success you will see a similar output

    img

    • Refresh and see your delegation changes

    img

    - + diff --git a/docs/sync.html b/docs/sync.html index 822f3f5c77..056453c4e2 100644 --- a/docs/sync.html +++ b/docs/sync.html @@ -8,13 +8,13 @@ - +

    Sync BEP2 and BEP20 Token Supply

    Prerequisite

    This BEP20 token is mirrored to a BEP2 token.

    Motivation

    For a BEP20 token which has been mirrored to BC, anyone can call the sync method to balance the total supply on BC and BSC. Thus, the total supply among two Blockchains will remain the same.

    What happens under the hood

    • Verify there is already mirrored
    • Check the total supply and token symbol is valid
    • Send a cross-chain package to modify a BEP2 token total supply on BNB Beacon Chain

    After syncing, the total supply on BC and BSC are the same.

    Fee Table

    Fee NamePay in BNB
    syncFeeit's 0.002BNB on mainnet now
    relayFeeit's 0.002BNB on mainnet now

    Both syncFee and relayFee can be changed by on-chain governance

    To query syncFee from system contract;

    • Call Tokenmanager Contract with the latest ABI

    • Query syncFee function

    Fee= result/1e18

    To query relayFee from system contract;

    • Call TokenHub Contract with the latest ABI

    • Query getMiniRelayFee function

    Fee= result/1e18

    Mirror With MyEtherWallet

    • Call Tokenmanager Contract

    Use the latest ABI

    img

    • Select sync function and fill-in with your BEP20 address

    The value here should be no less than syncFee+ relayFee.

    Time stamp should be greater than unix_timestamp(now()). The difference should be between 120 and 86400. It's recommended to use unix_timestamp(now())+1000

    img

    All set!

    - + diff --git a/docs/token-bind-tool.html b/docs/token-bind-tool.html index c2591b47cd..b10b22e310 100644 --- a/docs/token-bind-tool.html +++ b/docs/token-bind-tool.html @@ -8,14 +8,14 @@ - +

    token-bind-tool

    Tool to bind BEP2 tokens and BEP20 tokens. please refer to document for detail bind mechanism. Github repo for bind token tool here.

    Compile

    Compile token bind tool:

    make build

    Preparation for binding tokens

    1. Generate temp account (Deploy contract on BNB Smart Chain):

      ./build/token-bind-tool initKey --network-type {testnet/mainnet}

      Example response:

      Temp account: 0xde9Aa1d632b48d881B50528FC524C88474Ec8809, Explorer url: https://bscscan.com/address/0xde9Aa1d632b48d881B50528FC524C88474Ec8809
    2. Transfer 1 BNB to the temp account.

      2.1 Cross chain transfer

       bnbcli bridge transfer-out --expire-time `expr $(date +%s) + 3600` \
      --chain-id Binance-Chain-Tigris --from {keyName} --node http://dataseed4.bnbchain.org:80 \
      --to {temp account address} --amount 100000000:BNB

      Example command:

      bnbcli bridge transfer-out --expire-time `expr $(date +%s) + 3600` \
      --chain-id Binance-Chain-Tigris --from bep2TokenIssuer --node http://dataseed4.bnbchain.org:80 \
      --to 0xde9Aa1d632b48d881B50528FC524C88474Ec8809 --amount 100000000:BNB

      2.2 You can also transfer BNB from other BNB Smart Chain account with Metamask.

    Bind BEP2 token with BEP20 token

    Case 1

    Suppose you have already issued a BEP2 token, and you want to deploy a BEP20 token and bind it with existing BEP2 token:

    1. Import bep2 token owner key(Send bind transaction on BNB Beacon Chain):

      1.1 From ledger: connect ledger to your computer and open BNB Beacon Chain App

      bnbcli keys add bep2TokenIssuer --ledger --index {your ledger key index}

      1.2 From mnemonic:

      bnbcli keys add bep2TokenIssuer --recover
    2. Prepare BEP20 contract code

      2.1 You can refer to BEP20 Template and modify it according to your own requirements.

      NOTE 1: Ensure the BEP20 symbol is identical to the prefix of a BEP2 token symbol. Suppose a BEP2 token symbol is ABC-123, then the BEP20 symbol must be ABC.

      NOTE 2: Ensure the total supply equals to the BEP2 token total supply. As we know, the decimals of BEP2 tokens are 8, if the BEP20 decimal is 18, then the BEP20 total supply must be BEP2_total_supply*10^10.

      NOTE 3: If your BEP2 token is mintable, then you'd better implement mint in BEP20 contract. Otherwise, you'd better remove mint in BEP20 contract.

      2.2 Compile your contract with Remix and get contract byte code: img

    3. Edit script/contract.json to add contract byte code:

      {
      "contract_data": ""
      }

      Fill contract byte code to contract_data

    4. Deploy contract, bind and transfer ownership:

      ./script/bind.sh {mainnet/testnet} {bep2TokenIssuerKeyName} {password, for ledger key, use empty string: ""} {peggyAmount} {bep2 token symbol} {token owner} {path to bnbcli or tbnbcli}

      Example command:

      ./script/bind.sh testnet bep2TokenIssuer "12345678" 0 ABC-D9B 0xaa25Aa7a19f9c426E07dee59b12f944f4d9f1DD3 $HOME/go/bin/tbnbcli

    Case 2

    Suppose you have already issued BEP2 token, deployed BEP20 contract and sent bind transaction, now you just want to approve bind from your Ledger device:

    1. Connect ledger to your machine and open Ethereum app.
    2. Execute this command to approve bind:
    ./build/token-bind-tool approveBindFromLedger --bep2-symbol {bep2 symbol} --bep20-contract-addr {bep20 contract address} \
    --ledger-account-index {ledger key index} --peggy-amount {peggy amount} --network-type {mainnet/testnet}

    Case 3

    Suppose you just want to deploy a BEP20 contract and transfer all token and ownership to your owner account, then you can try this command:

    ./build/token-bind-tool deployBEP20ContractTransferTotalSupplyAndOwnership --bep20-owner {bep20 owner} \
    --config-path {contract byte code path, refer to `script/contract.json`} --network-type {mainnet/testnet}

    Refund rest BNB on temp account

    ./build/token-bind-tool refundRestBNB --network-type {mainnet/testnet} --recipient {bsc account}
    - + diff --git a/docs/tokens-cross-chain.html b/docs/tokens-cross-chain.html index 86eb275317..9251b6251a 100644 --- a/docs/tokens-cross-chain.html +++ b/docs/tokens-cross-chain.html @@ -8,13 +8,13 @@ - +

    Cross-chain Token Management

    The dual-chain architecture of BNB Beacon Chain & BNB Smart Chain empowers you to build your own decentralized apps. The native cross-chain communication mechanism allows tokens to be transferred between BC and BSC easily.

    BNB Smart Chain and BNB Beacon Chain work together to ensure that one token can circulate in both formats with confirmed total supply and be used in different use cases.

    BEP2/BEP8 Token Owner

    If you are BEP2/BEP9 token owner, please follow this guideline to complete Bind process when you wish to migrate to BSC.

    You can also use this tool.

    BEP20 Token Owner

    If you are BEP20 token owner or anybody else, please follow this guideline to complete Mirror process when you wish to migrate to BC.

    Comparison Between Bind and Mirror

    BindMirror
    InitiatorBEP2/BEP8 Token OwnerAnyone, including BEP20 Token Owner and others
    Feeless than 1BNB10 BNB, mirrorFee is a governable parameter
    How long will it takeseveral minutes~30s
    Supply DistributionCustomized between BC & BSCAll supplies are on BSC
    - + diff --git a/docs/tokens.html b/docs/tokens.html index 57599201eb..e31a134201 100644 --- a/docs/tokens.html +++ b/docs/tokens.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ The symbol doesn't have to be unique, "-" followed by random 3 letters will be appended to the provided symbol to avoid uniqueness constraint.
    Those 3 letters are the first three letters of tx hash of the issue transaction.
    For example, "NNB-B90". Only BNB does not have this suffix.
  • Total Supply: an int64 boosted by 1e8 for decimal part. The max total supply is 90 billion.
  • Mintable: that means whether this token can be minted in the future. To set the tokes to be mintable, you need to add --mintable, otherwise just omit this field to set this token to be non-mintable.
  • Example on mainnet:

    # To issue a NNB mintable token with total-supply 1 billion on mainnet
    > ./bnbcli token issue --token-name "new token" --total-supply 100000000000000000 --symbol NNB --mintable --from alice --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --trust-node
    # To issue a NNB non-mintable token with total-supply 1 billion on mainnet
    > ./bnbcli token issue --token-name "new token" --total-supply 100000000000000000 --symbol NNB --from alice --chain-id Binance-Chain-Tigris --node https://dataseed5.defibit.io:443 --trust-node

    Example on testnet:

    # To issue a NNB mintable token with total-supply 1 billion on testnet
    > ./tbnbcli token issue --token-name "new bnb" --total-supply 100000000000000000 --symbol NNB --mintable --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Committed at block 1887 (tx hash: B90A055DDD570AE42A7050182993A0B4DBC81A0D, ... Issued NNB-B90...)
    # To issue a NNB non-mintable token with total-supply 1 billion on testnet
    > ./tbnbcli token issue --token-name "new bnb" --total-supply 100000000000000000 --symbol NNB --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Committed at block 1887 (tx hash: B90A055DDD570AE42A7050182993A0B4DBC81A0D, ... Issued NNB-B90...)

    Mint

    Tokens that is "mintable"(specified when issue) can use this function. The amount is boosted by 1e8 for decimal part. The total supply after mint is still restricted by 90 billion. Note only the owner of the token can use this transaction.

    Example on mainnet:

     > ./bnbcli token mint --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Example on testnet:

     > ./tbnbcli token mint --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Burn

    Burn is to destroy certain amount of token, after which that amount of tokens will be subtracted from the operator's balance. The total supply will be updated at the same time. Notice that only the owner of the token has the permission to burn token. The amount is boosted by 1e8 for decimal part.

    Example on mainnet:

     > ./bnbcli token burn --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Example on testnet:

     > ./tbnbcli token burn --amount 100000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    Freeze & Unfreeze

    Freeze would move the specified amount of token into "frozen" status, so that these tokens can not transferred, spent in orders or any other transaction until they are unfreezed.

    Anyone can (only) freeze or unfreeze tokens on their account with status in "free". The amount is boosted by 1e8 for decimal part.

    Example on mainnet:

    > ./bnbcli token freeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node
    > ./bnbcli token unfreeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443  --trust-node

    Example on testnet:

    > ./tbnbcli token freeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node
    > ./tbnbcli token unfreeze --amount 20000000000000000 --symbol NNB-B90 --from alice --chain-id=Binance-Chain-Ganges --node=data-seed-pre-2-s1.bnbchain.org:80 --trust-node

    TransferOwnership

    Note: BEP82 is implemented after Lagrange Upgrade to add this new transactionn type.

    0.01 BNB will be charged on TransferOwnership transactions.

    Example on mainnet:

    ./bnbcli token transfer-ownership --from  $current-owner --symbol $symbol --new-owner $new-owner  --chain-id Binance-Chain-Tigris   --node  https://dataseed5.defibit.io:443 --trust-node

    Example on testnet:

    ./tbnbcli token transfer-ownership --from  $current-owner --symbol $symbol --new-owner $new-owner --chain-id Binance-Chain-Nile  --node=data-seed-pre-2-s1.bnbchain.org:80--trust-node
    - + diff --git a/docs/trading-spec.html b/docs/trading-spec.html index 94e807aa74..dc7acdd00d 100644 --- a/docs/trading-spec.html +++ b/docs/trading-spec.html @@ -8,7 +8,7 @@ - + @@ -31,7 +31,7 @@ existing orders on the order book can still be traded.

    Fees

    We have five kinds of order operations, each kind has its specific fee calculation logic and collection timing as the table described below.

    OperationCalculationCollection Timing
    Place orderfree-
    Cancel orderfixed feeswhen the Cancel transaction executes
    Order expirefixed fees if fully expired, otherwise freewhen the scheduled order expiration happenes
    IOC order cancelfixed fees if fully canceled, otherwise freewhen the IOC order is not fully filled
    Order executionrate based feeswhen the order matched

    BNB is the priority in the fee collection and has some discounts.

    DEX would always calculate and collect the fees based on the latest balance and in the best interest of users.

    Current Fees Table on Mainnet

    Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Mainnet as of 2021-03-21 is as follows:

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    New Order00Y
    Cancel (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    Order Expire (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    IOC (No Fill)Equivalent 0.00025 BNB0.000005 BNBY
    TransferN/A0.000075 BNBN
    crossTransferOutN/A0.000075 BNBN
    Multi-sendN/A0.00006 BNBN
    Issue AssetN/A10 BNB
    Mint AssetN/A0.002 BNBN
    Transfer ownershipN/A0.002 BNBN
    Burn AssetN/A0.002 BNBN
    Freeze/Unfreeze AssetN/A0.001 BNBN
    Lock/unlock/relock AssetN/A0.002 BNBN
    List AssetN/A200 BNBN
    Submit ProposalN/A1 BNBN
    DepositN/A0.000125 BNBN
    Enable Memo CheckN/A0.2 BNBN
    Disable Memo CheckN/A0.2 BNBN
    HTLTN/A0.000075 BNBN
    depositHTLTN/A0.000075 BNBN
    claimHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    TinyIssueFeeN/A0.4 BNBN
    MiniIssueFeeN/A0.6 BNBN
    SetTokenUriN/A0.000075 BNBN
    List BEP8 TokenN/A1 BNBN
    Create A New Smart Chain ValidatorN/A2 BNBN
    Edit Smart Chain Validator InformationN/A0.2 BNBN
    Delegate Smart Chain ValidatorN/A0.0002 BNBN
    Redelegate Smart Chain ValidatorN/A0.0006 BNBN
    Undelegate Smart Chain ValidatorN/A0.0004 BNBN
    Unjail A Smart Chain ValidatorN/A0.5 BNBN
    Submit Byzaitine Behavior Evidence of A Smart Chain ValidatorN/A0.5 BNBN
    Submit Smart Chain ProposalN/A1 BNBN
    Smart Chain Proposal DepositN/A0.00025 BNBN
    Smart Chain Proposal VoteN/A0 BNBN
    Cross transfer out relayer rewardN/A0.0004 BNBN

    Mainnet Fees API

    View system fees updated in real time here.

    Multi-send Fees

    bnbcli offers you a multi-send command to transfer multiple tokens to multiple people. 20% discount is available for multi-send transactions. For now, multi-send transaction will send some tokens from one address to multiple output addresses. If the count of output address is bigger than the threshold, currently it's 2, then the total transaction fee is 0.0003 BNB per token per address. For example, if you send 3 ABC token,1 SAT token and 1 ABC to 3 different addresses.

    [
    {
    "to":"bnb1g5p04snezgpky203fq6da9qyjsy2k9kzr5yuhl",
    "amount":"100000000:BNB,100000000:ABC"
    },
    {
    "to":"bnb1l86xty0m55ryct9pnypz6chvtsmpyewmhrqwxw",
    "amount":"100000000:BNB"
    },
    {
    "to":"bnb1l86xty0maxdgst9pnypz6chvtsmpydkjflfioe",
    "amount":"100000000:BNB,100000000:SAT"
    }
    ]

    You will pay on mainnet/testnet

    0.0003 BNB * 5 = 0.0015 BNB

    Trading Fees

    Trading fees are subject to complex logic that may mean that individual trades are not charged exactly by the rates below, but between them instead; this is due to the block-based matching engine in use on the DEX.

    The current fee for trades, applied on the settled amounts, is as follows:

    Transaction TypePay in non-BNB AssetPay in BNB
    Trade0.1%0.05%

    Trading fee can be queried at here. It's under the "params/DexFeeParam/". "FeeRate" and "FeeRateNative" are both under unit of 10^-6.

    Current Fees Table on Testnet

    Fees are variable and may change over time as governance proposals are proposed and voted on. The current fees table for Testnet as of 2021-03-17 is as follows:

    Transaction TypePay in Non-BNB AssetPay in BNBExchange (DEX) Related
    New Order00Y
    Cancel (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    Order Expire (No Fill)Equivalent 0.00005 BNB0.00001 BNBY
    IOC (No Fill)Equivalent 0.00025 BNB0.000005 BNBY
    TransferN/A0.000075 BNBN
    crossTransferOutN/A0.000075 BNBN
    Multi-sendN/A0.00006 BNBN
    Issue AssetN/A10 BNB
    Mint AssetN/A0.002 BNBN
    Transfer ownershipN/A0.002 BNBN
    Burn AssetN/A0.002 BNBN
    Freeze/Unfreeze AssetN/A0.001 BNBN
    Lock/unlock/relock AssetN/A0.002 BNBN
    List AssetN/A200 BNBN
    Submit ProposalN/A1 BNBN
    DepositN/A0.000125 BNBN
    Enable Memo CheckN/A0.2 BNBN
    Disable Memo CheckN/A0.2 BNBN
    HTLTN/A0.000075 BNBN
    depositHTLTN/A0.000075 BNBN
    claimHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    refundHTLTN/A0.000075 BNBN
    TinyIssueFeeN/A0.4 BNBN
    MiniIssueFeeN/A0.6 BNBN
    SetTokenUriN/A0.000075 BNBN
    List BEP8 TokenN/A1 BNBN
    Create A New Smart Chain ValidatorN/A2 BNBN
    Edit Smart Chain Validator InformationN/A0.2 BNBN
    Delegate Smart Chain ValidatorN/A0.0002 BNBN
    Redelegate Smart Chain ValidatorN/A0.0006 BNBN
    Undelegate Smart Chain ValidatorN/A0.0004 BNBN
    Unjail A Smart Chain ValidatorN/A0.5 BNBN
    Submit Byzaitine Behavior Evidence of A Smart Chain ValidatorN/A0.5 BNBN
    Submit Smart Chain ProposalN/A1 BNBN
    Smart Chain Proposal DepositN/A0.00025 BNBN
    Smart Chain Proposal VoteN/A0 BNBN
    Cross transfer out relayer rewardN/A0.0004 BNBN

    Testnet Fees API

    View system fees updated in real time here.

    Notes

    • Trade fee is calculated based on trade notional value, while fees for other transactions are fixed. It is free to send new GTE order, cancel a partially filled order, and you will not be charged a fee when the system expires a partially filled order (GTE or IOC).

    • Non-Trade related transactions will be charged a fee when the transactions happen, and can only be paid in BNB. The transaction will be rejected if the address does not have enough BNB.

    • Trade related transaction would be charged with fee when an order is filled, or canceled/expired/IOC-expired with no fills. If there is enough BNB to pay, BNB fee structure would be used, otherwise, non-BNB fee structure would be used to charged.

    • If the whole order value and free balance for the receiving asset are not enough to pay the fee, all the receiving asset and its residual balance would be charged.

    - + diff --git a/docs/truffle-new.html b/docs/truffle-new.html index 553602f2ef..88604a576f 100644 --- a/docs/truffle-new.html +++ b/docs/truffle-new.html @@ -8,14 +8,14 @@ - +

    Using Truffle for Deploying Smart Contracts on BSC

    In this tutorial, you will learn to create, compile and deploy smart contract on the BNB Smart Chain network using the Truffle IDE.

    Setting up the development environment

    Requirements

    There are a few technical requirements before we start. Please install the following:

    Recommendations for Windows If you're running Truffle on Windows, you may encounter some naming conflicts that could prevent Truffle from executing properly. Please refer to the official Truffle Documentation to find solutions for resolving naming conflicts.

    Installing Truffle

    Once the above mentioned softwares are installed, we only need one command to install Truffle:

    npm install -g truffle

    To verify that Truffle is installed properly, type truffle version on a terminal. If you see an error, make sure that your npm modules are added to your path.

    If you're new to Truffle then please follow the Getting Started by truffle, To setup the truffle environment.

    Project Creation, Compilation, and Configuration

    To use most Truffle commands, you need to run them against an existing Truffle project. So the first step is to create a Truffle project.

    Creation

    For creating a scaffold project for getting started, you can use the Truffle Boxes, BSC Starter Box which is a boilerplate to jump start development on the BNB Smart Chain.

    For this tutorial, we have used the MetaCoin box as an example, which creates a token that can be transferred between accounts. Use the command truffle unbox metacoin to unbox the metacoin box.

    NOTE: You can use the truffle unbox <box-name> command to download any of the other Truffle Boxes. Another alternative is to create a bare Truffle project with no smart contracts included using the truffle init command.

    Once this operation is completed, you'll now have a project structure with the following items:

    • contracts/: Directory for Solidity contracts
    • migrations/: Directory for scriptable deployment files
    • test/: Directory for test files for testing your application and contracts
    • truffle-config.js: Truffle configuration file

    Create Contract

    You can write your own smart contract or download the BEP20 token smart contract template and place it in the contracts directory.

    Compile Contract

    To compile a Truffle project, change to the root of the directory where the project is located and then type the following into a terminal:

    truffle compile

    Configuring Truffle for BSC

    • Go to truffle-config.js
    • Update the truffle-config with bsc-network-crendentials.
    const HDWalletProvider = require('@truffle/hdwallet-provider');
    const fs = require('fs');
    const mnemonic = fs.readFileSync(".secret").toString().trim();

    module.exports = {
    networks: {
    development: {
    host: "127.0.0.1", // Localhost (default: none)
    port: 8545, // Standard BSC port (default: none)
    network_id: "*", // Any network (default: none)
    },
    testnet: {
    provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s1.bnbchain.org:8545`),
    network_id: 97,
    confirmations: 10,
    timeoutBlocks: 200,
    skipDryRun: true
    },
    bsc: {
    provider: () => new HDWalletProvider(mnemonic, `https://bsc-dataseed1.bnbchain.org`),
    network_id: 56,
    confirmations: 10,
    timeoutBlocks: 200,
    skipDryRun: true
    },
    },

    // Set default mocha options here, use special reporters etc.
    mocha: {
    // timeout: 100000
    },

    // Configure your compilers
    compilers: {
    solc: {
    version: "^0.8.0", // A version or constraint - Ex. "^0.5.0"
    }
    }
    }

    NOTE: Notice, it requires mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words, refer here for more details.

    Deploying on BSC Network

    Run this command in root of the project directory:

    $ truffle migrate --network testnet

    Contract will be deployed on BNB Smart Chain Testnet, it look like this:

    1_initial_migration.js
    ======================

    Deploying 'Migrations'
    ----------------------
    > transaction hash: 0xaf4502198400bde2148eb4274b08d727a17080b685cd2dcd4aee13d8eb954adc
    > Blocks: 3 Seconds: 9
    > contract address: 0x81eCD10b61978D9160428943a0c0Fb31a5460466
    > block number: 3223948
    > block timestamp: 1604049862
    > account: 0x623ac9f6E62A8134bBD5Dc96D9B8b29b4B60e45F
    > balance: 6.24574114
    > gas used: 191943 (0x2edc7)
    > gas price: 20 gwei
    > value sent: 0 ETH
    > total cost: 0.00383886 ETH

    Pausing for 5 confirmations...
    ------------------------------
    > confirmation number: 2 (block: 3223952)
    > confirmation number: 3 (block: 3223953)
    > confirmation number: 4 (block: 3223954)
    > confirmation number: 6 (block: 3223956)

    > Saving migration to chain.
    > Saving artifacts
    -------------------------------------
    > Total cost: 0.00383886 ETH


    Summary
    =======
    > Total deployments: 1
    > Final cost: 0.00383886 ETH

    Note Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.

    🎉 Congratulations! You have successfully deployed BEP20 Smart Contract. Now you can interact with the Smart Contract.

    You can check the deployment status here: https://bscscan.com/ or https://testnet.bscscan.com/

    Verify Your Contract on BscScan

    The recommended way to verify a smart contract is using the plugin. It is easier to read and imports and licenses are maintained.

    Verified using Truffle

    Example: https://testnet.bscscan.com/token/0x68D2E27940CA48109Fa3DaD0D2C8B27E64a0c6cf

    GitHub Project: https://github.com/huangsuyu/verify-example

    BscScan plugin for Truffle

    Truffle has a BscScan plugin: truffle-plugin-verify

    You need to deploy with Truffle to verify with the Truffle verify plugin.

    Get API key: https://bscscan.com/myapikey

    Install the plugin

    npm install -D truffle-plugin-verify

    Configure the plugin

    Configure the plugin in truffle-config.js using the following command

    const HDWalletProvider = require("@truffle/hdwallet-provider");

    // const infuraKey = "fj4jll3k.....";
    //
    const { mnemonic, BSCSCANAPIKEY} = require('./env.json');

    module.exports = {

    plugins: [
    'truffle-plugin-verify'
    ],
    api_keys: {
    bscscan: BSCSCANAPIKEY
    },
    networks: {

    testnet: {
    provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s1.bnbchain.org:8545`),
    network_id: 97,
    timeoutBlocks: 200,
    confirmations: 5,
    production: true // Treats this network as if it was a public net. (default: false)
    }
    },

    // Set default mocha options here, use special reporters etc.
    mocha: {
    timeout: 100000
    },

    // Configure your compilers
    compilers: {
    solc: {
    version: "0.5.16", // Fetch exact version from solc-bin (default: truffle's version)
    // docker: true, // Use "0.5.1" you've installed locally with docker (default: false)
    settings: { // See the solidity docs for advice about optimization and evmVersion
    optimizer: {
    enabled: false,
    runs: 200
    },
    evmVersion: "byzantium"
    }
    },
    },
    };

    Verification Command

    truffle run verify BEP20Token@{contract-address} --network testnet

    You should see the following output:

    Verifying BEP20Token@0x68D2E27940CA48109Fa3DaD0D2C8B27E64a0c6cf
    Pass - Verified: https://testnet.bscscan.com/address/0x68D2E27940CA48109Fa3DaD0D2C8B27E64a0c6cf#contracts
    Successfully verified 1 contract(s).
    - + diff --git a/docs/truffle.html b/docs/truffle.html index 11f79b082f..af02d9a73c 100644 --- a/docs/truffle.html +++ b/docs/truffle.html @@ -8,14 +8,14 @@ - +

    Using Truffle

    Setting up the development environment

    There are a few technical requirements before we start. Please install the following: Requirements:

    Recommendations for Windows

    If you're running Truffle on Windows, you may encounter some naming conflicts that could prevent Truffle from executing properly. Please see the section on resolving naming conflicts for solutions.

    Installing

    Once we have those installed, we only need one command to install Truffle:

    npm install -g truffle

    To verify that Truffle is installed properly, type truffle version on a terminal. If you see an error, make sure that your npm modules are added to your path.

    Create A Project

    The first step is to create a Truffle project. We'll use the *MegaCoin as an example, which creates a token that can be transferred between accounts:

    • Create a new directory for your Truffle project
    mkdir MegaCoin
    cd MegaCoin
    • Intialize your project:
    truffle init

    Once this operation is completed, you'll now have a project structure with the following items:

    • contracts/: Directory for Solidity contracts
    • migrations/: Directory for scriptable deployment files
    • test/: Directory for test files for testing your application and contracts
    • truffle-config.js: Truffle configuration file

    Create Contract

    You can write your own smart contract or download the BEP20 token smart contract template.

    Compile Contract

    To compile a Truffle project, change to the root of the directory where the project is located and then type the following into a terminal:

    truffle compile

    Config Truffle for BSC

    • Go to truffle-config.js
    • Update the truffle-config with bsc-network-crendentials.
    const HDWalletProvider = require('@truffle/hdwallet-provider');
    const fs = require('fs');
    const mnemonic = fs.readFileSync(".secret").toString().trim();

    module.exports = {
    networks: {
    development: {
    host: "127.0.0.1", // Localhost (default: none)
    port: 8545, // Standard BSC port (default: none)
    network_id: "*", // Any network (default: none)
    },
    testnet: {
    provider: () => new HDWalletProvider(mnemonic, `https://data-seed-prebsc-1-s1.bnbchain.org:8545`),
    network_id: 97,
    confirmations: 10,
    timeoutBlocks: 200,
    skipDryRun: true
    },
    bsc: {
    provider: () => new HDWalletProvider(mnemonic, `https://bsc-dataseed1.bnbchain.org`),
    network_id: 56,
    confirmations: 10,
    timeoutBlocks: 200,
    skipDryRun: true
    },
    },

    // Set default mocha options here, use special reporters etc.
    mocha: {
    // timeout: 100000
    },

    // Configure your compilers
    compilers: {
    solc: {
    version: "^0.6.12", // A version or constraint - Ex. "^0.5.0"
    }
    }
    }

    Notice, it requires mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.

    Deploying on BSC Network

    Run this command in root of the project directory:

    $ truffle migrate --network testnet

    Contract will be deployed on BNB Smart Chain Testnet, it look like this:

    1_initial_migration.js
    ======================

    Deploying 'Migrations'
    ----------------------
    > transaction hash: 0xaf4502198400bde2148eb4274b08d727a17080b685cd2dcd4aee13d8eb954adc
    > Blocks: 3 Seconds: 9
    > contract address: 0x81eCD10b61978D9160428943a0c0Fb31a5460466
    > block number: 3223948
    > block timestamp: 1604049862
    > account: 0x623ac9f6E62A8134bBD5Dc96D9B8b29b4B60e45F
    > balance: 6.24574114
    > gas used: 191943 (0x2edc7)
    > gas price: 20 gwei
    > value sent: 0 ETH
    > total cost: 0.00383886 ETH

    Pausing for 5 confirmations...
    ------------------------------
    > confirmation number: 2 (block: 3223952)
    > confirmation number: 3 (block: 3223953)
    > confirmation number: 4 (block: 3223954)
    > confirmation number: 6 (block: 3223956)

    > Saving migration to chain.
    > Saving artifacts
    -------------------------------------
    > Total cost: 0.00383886 ETH


    Summary
    =======
    > Total deployments: 1
    > Final cost: 0.00383886 ETH

    Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.

    Congratulations! You have successfully deployed BEP20 Smart Contract. Now you can interact with the Smart Contract.

    You can check the deployment status here: https://bscscan.com/ or https://testnet.bscscan.com/

    - + diff --git a/docs/upgrade-fullnode.html b/docs/upgrade-fullnode.html index 5d31df3dd1..12b3a945f7 100644 --- a/docs/upgrade-fullnode.html +++ b/docs/upgrade-fullnode.html @@ -8,13 +8,13 @@ - +

    How to Upgrade Geth

    Updating geth is as easy as it gets. You just need to download and install the newer version of geth, shutdown your node and restart with the new software. Geth will automatically use the data of your old node and sync the latest blocks that were mined since you shutdown the old software.

    Step 1: Compile the new version

    git clone https://github.com/bnb-chain/bsc
    # Enter the folder bsc was cloned into
    cd bsc
    # Comile and install bsc
    make geth

    Step 2: Stop Geth


    $ pid=`ps -ef | grep geth | grep -v grep | awk '{print $2}'`

    $ kill $pid

    Step 3: Restart

    ## start a full node
    geth --config ./config.toml --datadir ./node --syncmode snap
    - + diff --git a/docs/validator/Penalty-overview.html b/docs/validator/Penalty-overview.html index 7d309ce03e..13cd355c83 100644 --- a/docs/validator/Penalty-overview.html +++ b/docs/validator/Penalty-overview.html @@ -8,7 +8,7 @@ - + @@ -20,7 +20,7 @@ The penalty message will be sent back to the BC chain through the cross-chain bridge; A predefined amount of BNB would be slashed from the self-delegated BNB of the validator; Both validator and its delegators will not receive the staking rewards; The slashed BNB will be allocated to the other validators’ custody addresses, and distributed to all delegators in the same way as blocking reward.

    Inavailability

    The liveness of BSC relies on everyone in the Proof of Staked Authority validator set can produce blocks timely when it is their turn. Validators can miss their turn due to any reason, especially problems in their hardware, software, configuration or network. This instability of the operation will hurt the performance and introduce more indeterministic into the system.

    There can be an internal smart contract responsible for recording the missed blocking metrics of each validator. Once the metrics are above the predefined threshold, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators. In such a way, the poorly-operating validator should be gradually voted out of the validator set as their delegators will receive less or none reward. If the metrics remain above another higher level of threshold, the validator will be dropped from the rotation, and this will be propagated back to BC, then a predefined amount of BNB would be slashed from the self-delegated BNB of the validator. Both validators and delegators will not receive their staking rewards.

    - + diff --git a/docs/validator/bc-slashing.html b/docs/validator/bc-slashing.html index f28282f237..d653ab655e 100644 --- a/docs/validator/bc-slashing.html +++ b/docs/validator/bc-slashing.html @@ -8,13 +8,13 @@ - +

    Slashing

    Slashing

    Slashing is part of the on-chain governance, to ensure the malicious or negative behaviors are punished. BSC slash can be submitted by anyone. The transaction submission requires slash evidence and cost fees but also brings a larger reward when it is successful.

    So far there are two slashable cases.

    Double Sign

    Anyone can submit a slash request on BC with the evidence of Double Sign of BSC

    Evidence Validation

    • Two block headers have same height and same parent block hash
    • Two block headers are sealed by the same validator
    • Two signatures of these two blocks must not be the same
    • The time of these two blocks must be within the validity of the evidence, which is 24 hours

    If the evidence is valid:

    1. 1000BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 1000BNB, then the unbonding delegation balance would be slashed if it exists until totally 1000BNB slashed from self-delegator of the validator. However, if all the slashed BNB is less than 1000, all the remaining stake of the self-delegator will be slashed
    3. 100 of slashed BNB would allocate to the submitter as a reward
    4. The rest of slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the rest of slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with duration of 7 days, and remove it from validator set by an instance BSC validator set update Cross-Chain update

    Inavailability

    There can be an internal smart contract responsible for recording the missed blocking metrics of each validator.

    If a validator missed more than 50 blocks in 24h, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators. If it missed more than 150 blocks in 24h, then this will be propagated back to BC where another Slashing will happen:

    1. 50BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 50BNB, then the unbonding delegation balance would be slashed if it exists until totally 50BNB slashed from self-delegator of the validator. However, if all the slashed BNB is less than 1000, all the remaining stake of the self-delegator will be slashed
    3. 10 of slashed BNB would allocate to the validators on BC as block fee
    4. The rest of slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the rest of slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with duration of 2 days, and remove it from validator set by an instance BSC validator set update Cross-Chain update

    Unjail

    The malicious validators who are slashed by the previous cases will be set to jailed along with a duration setting as well due to the malicious or negative behaviors. We can set it to ‘unjailed’ by sending a side-unjail transaction if the validation passed.

    When your validator is unjailed on BNB Chain, it must wait for the next UTC 0:00 to join validatorsest again.

    Transaction Validation

    • validator address must not be empty
    • side chain id exists
    • self-delegation of the validator exists and the tokens of it must be greater than the min-self-delegation setting by 10000BNB
    • the validator is in ‘jailed’ now
    • already passed the duration set when ‘jailed’ happened

    Fee Table

    Transaction TypePay in BNB
    Unjail A Smart Chain Validator1
    Submit Byzaitine Behavior Evidence of A Smart Chain Validator10

    Commands

    Download Binary

    Please download tbnbcli binary from here

    Submit BSC evidence

    Slashing validators of BSC for the malicious behavior of double-sign by submitting evidence consisting of two block headers with same height but signed by one signer

    Parameters for slashing bsc-submit-evidence

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-Tigristhe chain id of binance chainYes
    --frombnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hddName or address of private key with which to signYes
    --evidence[{"difficulty":"0x2","extraData":"0xd98301...},{"difficulty":"0x3","extraData":"0xd64372...}]Evidence details, including two bsc block headers with json formatOption
    --evidence-file/user/evidence.jsonFile of evidence details, if evidence-file is not empty, --evidence will be ignoredOption

    Examples

    • Mainnet
    bnbcli slashing bsc-submit-evidence --from=bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --evidence=[{"parentHash":"0x6116de25352c93149542e950162c7305f207bbc17b0eb725136b78c80aed79cc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xe7cb9d2fd449f7bd11126bff55266e7b74936f2f230e21d44d75c04b7780dfeb","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x20000","number":"0x1","gasLimit":"0x47e7c4","gasUsed":"0x0","timestamp":"0x5eb2a363","extraData":"0x0000000000000000000000000000000000000000000000000000000000000000a2852203a9da8bb555ec98a78c66365437bb1dde6707a08032e9eb916a8a454e37a1fffeab272bcffc2fc1d82aee6f3124bbdc8ed884efcbadfb6ff862cf4c3801","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","hash":"0xd977f1acfd035cf717193a9c3a2351cdccdc2ea0719aff871dade0e8daf8069d"},{"parentHash":"0x6116de25352c93149542e950162c7305f207bbc17b0eb725136b78c80aed79cc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xe7cb9d2fd449f7bd11126bff55266e7b74936f2f230e21d44d75c04b7780dfeb","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x20000","number":"0x1","gasLimit":"0x47e7c4","gasUsed":"0x64","timestamp":"0x5eb2a363","extraData":"0x00000000000000000000000000000000000000000000000000000000000000005eab7a9bf40635d056ccab45ac0d8b4e99be4b4ed859e4246f651b95c0adaacc050760a0afc2d9383f821baab7f995cde07271f286c4805095b413e7ad69d9f401","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","hash":"0x917c38a507c9807426fc9e3e9e8ded2db07c7f61070bd1c7b57b9df287e8f7b2"}]     --chain-id=test-chain-8d7sJz --home ~/home_cli

    Side chain Unjail

    Parameters for slashing side-unjail

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hddThis address has to be the operator address of the validator to be unjailed. Name or address of private key with which to sign.Yes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-unjail --from bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query side chain Signing Info

    Parameters for slashing side-signing-info

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-signing-info 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query side chain slash history

    Parameters for slashing side-slash-history [validator-sideConsAddr]

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --infraction-height100infraction heightYes
    --infraction-typeDoubleSigninfraction type, 'DoubleSign;Downtime'Yes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-slash-history 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --infraction-height 100 --infraction-type DoubleSign --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query side chain slash histories

    Parameters for slashing side-slash-histories

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --infraction-typeDoubleSigninfraction type, 'DoubleSign;Downtime'Option
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-slash-histories 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --infraction-type DoubleSign --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query all side chain slash histories(for internal)

    Parameters for slashing side-all-slash-histories

    parameter nameexamplecommentsrequired
    --chain-idBinance-Chain-XXXthe chain id of BNB ChainYes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    For example

    • Mainnet
    bnbcli slashing side-all-slash-histories --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli
    - + diff --git a/docs/validator/best-practice.html b/docs/validator/best-practice.html index 447db12ff2..71967a4efa 100644 --- a/docs/validator/best-practice.html +++ b/docs/validator/best-practice.html @@ -8,7 +8,7 @@ - + @@ -20,7 +20,7 @@ [::] will be parsed as localhost (127.0.0.1). If your nodes are on a local network check each individual host machine and find your IP with ifconfig If your peers are not on the local network, you need to know your external IP address (use a service) to construct the enode URL. Copy this value and in the console of the first node run,

    Update config.toml file of validator node

    # make node invisible
    NoDiscovery = true
    # connect only to sentry
    StaticNodes = ["enode://f2da64f49c30a0038bba3391f40805d531510c473ec2bcc7c201631ba003c6f16fa09e03308e48f87d21c0fed1e4e0bc53428047f6dcf34da344d3f5bb69373b@[10.1.1.1]:30306"]

    This will return true if successful, but that doesn’t mean the node was added successfully.

    To confirm run admin.peers and you should see the details of the node you just added.

    That way your validator node will try to peer with your provided sentry nodes only.

    1. Confirm the connection

    To confirm run admin.peers and you should see the details of the node you just added.

    img

    Firewall Configuration

    geth uses several TCP ports for different purposes.

    geth use a listener (TCP) port and a discovery (UDP) port, both on 30303 by default.

    If you need to run JSON-RPC, you'll also need TCP port 8545. Note that JSON-RPC port should not be opened to the outside world, because from there you can do admin operations.

    - + diff --git a/docs/validator/create-val.html b/docs/validator/create-val.html index 6d36c781dd..ac07350416 100644 --- a/docs/validator/create-val.html +++ b/docs/validator/create-val.html @@ -8,14 +8,14 @@ - +

    Create Validator

    Create a mining account

    You need to create an account that represents a key pair first. Use the following command to create a new account and set a password for that account:

    geth account new --datadir ./node

    This command will return the public address and the path to your private key. BACKUP of the keyfile is necessary!

    If you already have an account, use the seed phrase to recover it:

    geth account import --datadir ./node

    Create a voting key

    You are incentivized to set a voting key which will be used for fast finality voting. Voters will receive due rewards.

    geth bls account new --datadir ./node

    This command will create a bls wallet and generate a voting key. During the process, you will need to set the wallet password and another password used to encrypt the voting key. The former is required when running the validator, and the latter is only used to import the voting key into the existing wallet. Do not disclose the voting key, otherwise it may be used for malicious voting!

    If you already have a voting key, create a bls wallet and use the keyfile to recover it:

    geth bls wallet create --datadir ./node
    geth bls account import <keyfile> --datadir ./node

    Become a Validator Candidate

    You need use bnbcli binary to send create-validator transaction, thus to declare the candidacy.

    Use bnbcli to create an account or recover an account, make sure the account get more than 10000 BNB.

    ## Command for create validator on mainnet
    bnbcli staking bsc-create-validator \
    --side-cons-addr {mining account} \
    --side-vote-addr {validator vote pub key} \
    --side-fee-addr {wallet address on BSC} \
    --address-delegator {wallet address on BC} \
    --side-chain-id bsc \
    --amount 2000000000:BNB \
    --commission-rate {10000000 represent 10%} \
    --commission-max-rate {20000000 represent 20%} \
    --commission-max-change-rate {500000000 represent 5%} \
    --moniker {validator name} \
    --details {validator detailed description} \
    --identity {keybase identity} \
    --website {website for validator} \
    --from {key name} \
    --chain-id Binance-Chain-Tigris \
    --node https://dataseed5.defibit.io:443

    ## Command for create validator on testnet
    tbnbcli staking bsc-create-validator \
    --side-cons-addr {mining account} \
    --side-vote-addr {validator vote pub key} \
    --side-fee-addr {wallet address on BSC} \
    --address-delegator {wallet address on BC} \
    --side-chain-id chapel \
    --amount 1000000000:BNB \
    --commission-rate {10000000 represent 10%} \
    --commission-max-rate {20000000 represent 20%} \
    --commission-max-change-rate {10000000 represent 1%} \
    --moniker {validator name} \
    --details {validator detailed description} \
    --identity {keybase identity} \
    --website {website for validator} \
    --from {key name} \
    --chain-id Binance-Chain-Ganges \
    --node=http://data-seed-pre-1-s3.bnbchain.org:80

    Please ensure that the newly created mining account in the above step is assigned as the side-cons-addr.

    Go to explorer to verify your transactions.

    Running a Validator

    Refer to Running as Validator to start a real running validator.

    - + diff --git a/docs/validator/docker.html b/docs/validator/docker.html index 25bb17b174..f93a49c569 100644 --- a/docs/validator/docker.html +++ b/docs/validator/docker.html @@ -8,14 +8,14 @@ - +

    How to Run A Fullnode Using BSC Docker Image

    Resources

    Supported Platforms

    We support running a BSC docker image on Mac OS X, Linux, and Windows.

    Steps to Run a Fullnode in Docker

    Install Docker

    Post install:

    Start docker during boot up:

    systemctl enable docker.service
    systemctl enable containerd.service

    Add user "ubuntu" to group docker so the user has privileges to run docker commands:

    usermod -aG docker ubuntu

    Pull BSC Node Image

    docker pull ghcr.io/bnb-chain/bsc:1.1.18_hf

    Download BSC Node Config Files

    Download genesis.json and config.toml by:

    Mainnet

    wget   $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
    unzip mainnet.zip

    Testnet

    wget   $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
    unzip testnet.zip

    Running Docker Container

    1. Dockers Variables and Config file Location

    Important Environment Variables to note:

    $BSC_HOME = /bsc
    $DATA_DIR = /data

    File location:

    • BSC_CONFIG=${BSC_HOME}/config/config.toml
    • BSC_GENESIS=${BSC_HOME}/config/genesis.json
    1. Docker Volumes to Mount

    Essentially we need to bind mount two directories:

    MountLocalDocker
    Blockchain datadata/node/bsc/node
    Config filesconfig/bsc/config
    1. Download data on local host Download latest chaindata snapshot from here. Follow the guide to structure your files.

    2. Start container

    You can also use ETHEREUM OPTIONS to overwrite settings in the configuration file:

    docker run -v $(pwd)/config:/bsc/config -v $(pwd)/data/node:/bsc/node -p 8575:8575 --rm --name bsc -it ghcr.io/bnb-chain/bsc:1.1.18_hr --http.addr 0.0.0.0 --http.port 8575 --http.vhosts '*' --verbosity 5
    • -p 8575:8575: This will map port 8575 from host to container, so it exposes 8575 on host node.
    • --http --http.addr 0.0.0.0: Extra Geth flags to enable RPC and listen on all network interfaces of the container.

    NOTE: port 8575 is the default port for the RPC service on TESTNET. If you are using mainnet the default port is 8545.

    1. Start Geth console
    geth attach http://localhost:8575

    How to access the container

    Execute bash (shell/terminal) on the container named bsc:

    docker exec -it bsc bash

    Once logged in you can perform regular tasks you would do on a node without docker.

    How to Check Node Running Status

    Check Synchronization

    Start Geth Console:

    geth attach ipc:node/geth.ipc

    Once started, run:

    >eth.syncing

    Check Geth Logs

    tail -f node/bsc.log
    - + diff --git a/docs/validator/fullnode.html b/docs/validator/fullnode.html index 42316a024c..4e12a0bcd1 100644 --- a/docs/validator/fullnode.html +++ b/docs/validator/fullnode.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    How to Run A Fullnode on BNB Smart Chain

    Fullnodes Functions

    • Stores the full blockchain history on disk and can answer the data request from the network.
    • Receives and validates the new blocks and transactions.
    • Verifies the states of every account.

    Supported Platforms

    We support running a full node on Mac OS X, Linux, and Windows.

    Suggested Requirements

    • VPS running recent versions of Mac OS X, Linux, or Windows.
    • IMPORTANT 3 TB of free disk space, solid-state drive(SSD), gp3, 8k IOPS, 250 MB/S throughput, read latency <1ms. (if node is started with snap sync, it will need NVMe SSD)
    • 16 cores of CPU and 64 GB of memory (RAM)
    • Suggest m5zn.3xlarge instance type on AWS, c2-standard-16 on Google cloud.
    • A broadband Internet connection with upload/download speeds of 5 MB/S

    Steps to Run a Fullnode

    1. Download the pre-build binaries from the release page or follow the instructions below
    # Linux
    wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_linux |cut -d\" -f4)
    mv geth_linux geth
    chmod -v u+x geth

    # MacOS
    wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_mac |cut -d\" -f4)
    mv geth_mac geth
    chmod -v u+x geth
    1. Download the config files

    Download genesis.json and config.toml by:

    wget   $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
    unzip mainnet.zip
    1. Download snapshot

    Download latest chaindata snapshot from here. Follow the guide to structure your files.

    note

    Your --datadir flag should point to the folder where the extracted snapshot data is. In our case, we created a new folder named node, and we moved the extracted snapshot data to this folder.

    mv server/data-seed/geth/chaindata node/geth/chaindata
    mv server/data-seed/geth/chaindata node/geth/triecache
    1. Start a full node
    ./geth --config ./config.toml --datadir ./node  --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0
    note

    Make sure you use the version of geth you downloaded with wget above, and not your local installation of geth, which might be the wrong version.

    tip

    It is recommended to run a fast node, which is a full node with the flag --tries-verify-mode none set if you want high performance and care little about state consistency. Check here for full details on running a fast node.

    ./geth --config ./config.toml --datadir ./node  --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none
    1. Monitor node status

    You can monitor the log from ./node/bsc.log by default. When your node has started syncing, you should be able to see the following output:

    t=2022-09-08T13:00:27+0000 lvl=info msg="Imported new chain segment"             blocks=1    txs=177   mgas=17.317   elapsed=31.131ms    mgasps=556.259  number=21,153,429 hash=0x42e6b54ba7106387f0650defc62c9ace3160b427702dab7bd1c5abb83a32d8db dirty="0.00 B"
    t=2022-09-08T13:00:29+0000 lvl=info msg="Imported new chain segment" blocks=1 txs=251 mgas=39.638 elapsed=68.827ms mgasps=575.900 number=21,153,430 hash=0xa3397b273b31b013e43487689782f20c03f47525b4cd4107c1715af45a88796e dirty="0.00 B"
    t=2022-09-08T13:00:33+0000 lvl=info msg="Imported new chain segment" blocks=1 txs=197 mgas=19.364 elapsed=34.663ms mgasps=558.632 number=21,153,431 hash=0x0c7872b698f28cb5c36a8a3e1e315b1d31bda6109b15467a9735a12380e2ad14 dirty="0.00 B"
    note

    To sync from genesis block, you would need a more powerful hardware. Server should at least have 40k IOPS and be at least an i3/i3en series server.

    1. Write genesis state locally
    ./geth --datadir node init genesis.json

    You could see the following output:

    INFO [05-19|14:53:17.468] Allocated cache and file handles         database=/Users/huangsuyu/Downloads/bsc/node/geth/chaindata cache=16.00MiB handles=16
    INFO [05-19|14:53:17.498] Writing custom genesis block
    INFO [05-19|14:53:17.501] Persisted trie from memory database nodes=21 size=56.84KiB time=357.915µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=-574.00B
    INFO [05-19|14:53:17.502] Successfully wrote genesis state database=chaindata hash=7d79cc…fb0d1e
    INFO [05-19|14:53:17.503] Allocated cache and file handles database=/Users/huangsuyu/Downloads/bsc/node/geth/lightchaindata cache=16.00MiB handles=16
    INFO [05-19|14:53:17.524] Writing custom genesis block
    INFO [05-19|14:53:17.525] Persisted trie from memory database nodes=21 size=56.84KiB time=638.396µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=-574.00B
    INFO [05-19|14:53:17.528] Successfully wrote genesis state database=lightchaindata hash=7d79cc…fb0d1e
    1. Start fullnode
    ## start a full node
    ./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0

    Sync Mode

    There are two sync modes for running a full node: snap and full which can be specified by flag --syncmode.

    The snap sync mode is used for initial sync, which will download the latest states rather than execute the blocks from the genesis. When the initial sync is done, it will switch to full sync automatically.

    The full sync mode can also be used to do initial sync, which will execute all the blocks since genesis. But it is not recommended, since the amount of historical data is too large. Instead, you can download a snapshot from the official repo and start full sync from the snapshot.

    If the flag --syncmode is not provided, the default sync mode will depend on the state of the data folder. It will be snap mode if you sync from genesis or full mode if you start from a snapshot.

    Local Private Network

    Please refer to BSC-Deploy Tools to setup a local private network.

    Node Maintenance

    Please read this guide

    Upgrade Geth

    Please read this guide

    - + diff --git a/docs/validator/monitor-and-query-slash.html b/docs/validator/monitor-and-query-slash.html index 6f92bf750f..80a21bff69 100644 --- a/docs/validator/monitor-and-query-slash.html +++ b/docs/validator/monitor-and-query-slash.html @@ -8,14 +8,14 @@ - +

    Monitoring

    Monitoring Slash Contract

    As best practice, it is advisable to keep monitoring the event log of the slash contract on the BSC scanner at https://bscscan.com/address/0x0000000000000000000000000000000000001001#events. Additionally, you can also check the slash indicator by reading the contract and pay attention to those above 30. Once it exceeds 150, the validator contract will be jailed.

    Query Side Chain Signing Info

    Parameters for Slashing side-signing-info

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of bnb chainYes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    Example

    bnbcli slashing side-signing-info 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query Side Chain Slash History

    Parameters for Slashing side-slash-history [validator-sideConsAddr]

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of bnb chainYes
    --infraction-height100infraction heightYes
    --infraction-typeDoubleSigninfraction type, 'DoubleSign;Downtime;MaliciousVote'Yes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    Example

    bnbcli slashing side-slash-history 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --infraction-height 100 --infraction-type DoubleSign --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query Side Chain Slash Histories

    Parameters for Slashing side-slash-histories

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of bnb chainYes
    --infraction-typeDoubleSigninfraction type, 'DoubleSign;Downtime;MaliciousVote'Option
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    Example

    bnbcli slashing side-slash-histories 0x625448c3f21AB4636bBCef84Baaf8D6cCdE13c3F --infraction-type DoubleSign --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli

    Query All Side Chain Slash Histories(for internal)

    Parameters for Slashing side-all-slash-histories

    Parameter NameExampleCommentsRequired
    --chain-idBinance-Chain-XXXthe chain id of bnb chainYes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    Example

    bnbcli slashing side-all-slash-histories --side-chain-id=bsc --chain-id=test-chain-8d7sJz --home ~/home_cli
    - + diff --git a/docs/validator/node-maintenance.html b/docs/validator/node-maintenance.html index e63ddfd48f..fa7df78d22 100644 --- a/docs/validator/node-maintenance.html +++ b/docs/validator/node-maintenance.html @@ -8,14 +8,14 @@ - +

    Node Maintainence

    Binary

    All the clients are suggested to upgrade to the latest release. The latest version is supposed to be more stable and has better performance.

    Storage

    Prune State

    According to the test, the performance of a full node will degrade when the storage size reaches a high volume(previously it was 1.5TB, which is an experimental value, the latest number needs to be updated). We suggest that the fullnode always keep light storage by pruning the storage.

    How to Prune
    1. Stop the BSC node.
    2. Run nohup geth snapshot prune-state --datadir {the data dir of your bsc node} &. It will take 3-5 hours to finish.
    3. Start the node once it is done.

    The maintainers should always have a few backup nodes in case one of the nodes is getting pruned. The hardware is also important, make sure the SSD meets: 2 TB of free disk space, solid-state drive(SSD), gp3, 8k IOPS, 250MB/S throughput, read latency <1ms.

    Prune Ancient Data in Real Time

    Ancient data is block data that is already considered immutable. This is determined by a threshold which is currently set at 90000. This means that blocks older than 90000 are considered ancient data. We recommend the --prunceancient flag to users who don't care about the ancient data. This is also advised for users who want to save disk space since this will only keep data for the latest 90000 blocks. Note that once this flag is turned on, the ancient data will not be recovered again and you cannot go back running your node without this flag in the start-up command.

    How to use the flag
    ./geth --tries-verify-mode none --config /server/config.toml --datadir /server/node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --pruneancient=true --syncmode=full

    Prune Block Tools

    A new offline feature introduced in v1.1.8 to prune undesired ancient block data. It will discard block, receipt, and header in the ancient database to save space.

    How to prune
    1. Stop the BSC Node.
    2. Run
    ./geth snapshot prune-block --datadir /server/node --datadir.ancient ./chaindata/ancient --block-amount-reserved 1024

    block-amount-reserved is the number of ancient data blocks that you want to keep after pruning.

    Light Storage

    When the node crashes or been force killed, the node will sync from a block that was a few minutes or a few hours ago. This is because the state in memory is not persisted into the database in real time, and the node needs to replay blocks from the last checkpoint once it start. The replaying time depends on the configuration TrieTimeout in the config.toml. We suggest you raise it if you can tolerate with long replaying time, so the node can keep light storage.

    Upgrade Geth

    Please read this guide

    - + diff --git a/docs/validator/overview.html b/docs/validator/overview.html index cf3ca56ddd..cfd406483e 100644 --- a/docs/validator/overview.html +++ b/docs/validator/overview.html @@ -8,13 +8,13 @@ - +

    Overview

    BNB Smart Chain is an innovative solution to bring programmability and interoperability to BNB Beacon Chain. BNB Smart Chain relies on a system of 50 validators with Proof of Staked Authority (PoSA) consensus that can support short block time and lower fees. The most bonded validator candidates of staking will become validators and produce blocks. The double-sign detection and other slashing logic guarantee security, stability, and chain finality.

    Other than the 29 active validators, BSC will introduce more validators, e.g. another 20 inactive validators, into the validator set as backups, which will be called “Candidates”.

    Candidates will produce blocks and charge gas fees in BSC mainnet, but in a much less chance than the official validator set of 29 elected. The unavailable candidates will be slashed as well though in a smaller size. A decent motivation is expected to be maintained so that the candidate validators are willing to ensure the quality and help secure BSC.

    In an extreme case, if a majority of the active 29 validators get attacked and offline, Candidate Validators can report to BNB Beacon Chain about the stale blocking, resume it and eventually propose a re-election of active validator set.

    What is Validator?

    BNB Smart Chain relies on a set of validators who are responsible for committing new blocks in the blockchain. These validators participate in the consensus protocol by signing blocks that contain cryptographic signatures signed by each validator's private key. The validator set is determined by a staking module built on BNB Beacon Chain for BNB Smart Chain, and propagated every day 00:00 UTC from BC to BSC via Cross-Chain communication.

    Economics

    Validator's rewards come from transaction fees and commission fees from delegators.

    Let us also assume that the reward for a block is 100 BNB and that a certain validator has 20% of self-bonded BNB and sets its commission rate to 20%. These tokens do not go directly to the proposer. Instead, they are shared among validators and delegators. These 100 BNB will be distributed according to each participant's stake:

    Commission: 80*20%= 16 BNB
    Validator gets: 100\*20% + Commission = 36 BNB
    All delegators get: 100\*80% - Commission = 64 BNB

    The rewards for motivating validators to vote for Fast Finality also comes from transaction fees. The specific rules can refer to BEP126

    If validators double sign, malicious vote or frequently offline, their staked BNB (not including BNB of users that delegated to them) can be slashed. The penalty depends on the severity of the violation.

    You can learn to see the revenue history from BitQuery's chart or a table of BscScan

    Risks for Validators

    If you try to cheat the system, or act contrary to the specification, you will be liable to incur a penalty, known as slashing.

    Potential Loss

    Loss for Double-Sign Slash

    Running your validator keys simultaneously on two or more machines will result in Double-Sign slashing.

    Penalty for Double-Sign Slash
    1. 10000 staked BNB will be slashed for the validator.
    2. The Double-Sign Jail time is 2^63-1 seconds, which means the candidate cannot become a validator anymore.

    Note: Rewards for submitting double-sign evidence: 1000BNB Anyone can submit a slashing request on BC with the evidence of Double Sign of BSC, which should contain the 2 block headers with the same height and parent block, sealed by the offending validator.

    Loss for Malicious Vote Slash

    Running your validators with the same consensus keys and voting keys concurrently on two or more machines will result in Malicious Vote slashing.

    Penalty for Malicious Vote Slash
    1. 10000 staked BNB will be slashed for the validator.
    2. The Double-Sign Jail time is 2^63-1 seconds, which means the candidate cannot become a validator anymore.

    Note: Rewards for submitting Malicious Vote evidence: 50BNB. Only relayers can submit a slash request on BSC with the evidence of Malicious Vote of BSC for now, which should contain the 2 votes, signed by the offending validator. Open access to anyone is planned.

    Loss for Offline Slash

    If a validator missed more than 50 blocks every 24 hours, the blocking reward for validator will not be relayed to BC for distribution but shared with other better validators. If it missed more than 150 blocks every 24 hours, then this will be propagated back to BC where another slashing will happen

    Penalty for Offline Slash
    1. 50 staked BNB will be slashed for the validator.
    2. The Downtime Jail time is 2 days, which means the candidate can send a unjail transaction to become a candidate again.

    Loss for Too Low self-delegation

    Validator candidates must stake 2000 BNB as self-delegation. If the self-delegation amount is lower, the Jail time is 1 day.

    - + diff --git a/docs/validator/run-val.html b/docs/validator/run-val.html index cd4fbfc191..7ba12a6b22 100644 --- a/docs/validator/run-val.html +++ b/docs/validator/run-val.html @@ -8,7 +8,7 @@ - + @@ -20,7 +20,7 @@ then you may add the flag to specify it: –blswallet /<path>/bls/wallet

    • Step 4: restart
      • You may only provide the flag: --vote, if you did not specify it in config.toml Then you may go ahead, just restart the node.

    For more details, please look into this: https://forum.bnbchain.org/t/bnb-smart-chain-testnet-luban-upgrade-announcement/1331 (section: https://forum.bnbchain.org/t/bnb-smart-chain-testnet-luban-upgrade-announcement/1331#h-22important-for-validator-operator-8)

    Post Running

    1. Monitor node status

    To get started quickly, run GethExporter in a Docker container.

    docker run -it -d -p 9090:9090 \
    -e "GETH=http://mygethserverhere.com:8545" \
    hunterlong/gethexporter

    2. Update validator profile

    You can submit a PullRequest to this repository to update your information: https://github.com/bnb-chain/validator-directory Reference: https://grafana.com/grafana/dashboards/6976

    3. Publish Validator Information

    Please submit a Pull Request to this repo https://github.com/bnb-chain/validator-directory

    This repository is a place for validator candidates to give potential delegators a brief introduction about your team and infrastructure, and present your ecosystem contributions.

    4. Stop Validating

    You can stop mining new blocks by sending commands in geth console

    Connect to your validator node with geth attach ipc:path/to/geth.ipc

    miner.stop()

    To resume validating,

    miner.start()
    - + diff --git a/docs/validator/security.html b/docs/validator/security.html index 2cc5365178..8e517348a7 100644 --- a/docs/validator/security.html +++ b/docs/validator/security.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ [::] will be parsed as localhost (127.0.0.1). If your nodes are on a local network check each individual host machine and find your IP with ifconfig If your peers are not on the local network, you need to know your external IP address (use a service) to construct the enode URL. Copy this value and in the console of the first node run,

    Update config.toml file of validator node

    # make node invisible
    NoDiscovery = true
    # connect only to sentry
    StaticNodes = ["enode://f2da64f49c30a0038bba3391f40805d531510c473ec2bcc7c201631ba003c6f16fa09e03308e48f87d21c0fed1e4e0bc53428047f6dcf34da344d3f5bb69373b@[10.1.1.1]:30306"]

    This will return true if successful, but that doesn't mean the node was added successfully.

    To confirm run admin.peers and you should see the details of the node you just added.

    That way your validator node will try to peer with your provided sentry nodes only.

    1. Confirm the connection

    To confirm run admin.peers and you should see the details of the node you just added.

    img

    Firewall Configuration

    geth uses several TCP ports for different purposes.

    geth use a listener (TCP) port and a discovery (UDP) port, both on 30303 by default.

    If you need to run JSON-RPC, you'll also need TCP port 8545. Note that JSON-RPC port should not be opened to the outside world, because from there you can do admin operations.

    - + diff --git a/docs/validator/send-slash-evidence.html b/docs/validator/send-slash-evidence.html index 30083ffd55..7e8ead586a 100644 --- a/docs/validator/send-slash-evidence.html +++ b/docs/validator/send-slash-evidence.html @@ -8,13 +8,13 @@ - +

    How to send BSC Slash Evidence

    Double Sign

    To submit BSC slash evidence, download the bnbcli binary.

    Command for submitting evidence

    bnbcli slashing bsc-submit-evidence 
    \--from={Name or address of private key with which to sign}
    \--evidence={Evidence details, including two bsc block headers with json format}
    \--evidence-file={File of evidence details}
    \--chain-id={the chain id of BNB Chain}

    Parameters for slashing bsc-submit-evidence

    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-Tigristhe chain id of binance chainYes
    --frombnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hddName or address of private key with which to signYes
    --evidence[{"difficulty":"0x2","extraData":"0xd98301...},{"difficulty":"0x3","extraData":"0xd64372...}]Evidence details, including two bsc block headers with json formatOption
    --evidence-file/user/evidence.jsonFile of evidence details, if evidence-file is not empty, --evidence will be ignoredOption

    In the above command, --evidence and --evidence-file are optional parameters. If --evidence-file is not empty, --evidence will be ignored. --from and --chain-id are mandatory parameters.

    Example

    bnbcli slashing bsc-submit-evidence --from= bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --chain-id=Binance-Chain-Tigris --home  ~/home_cli

    Example

    bnbcli slashing bsc-submit-evidence --from=bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --evidence=[{"parentHash":"0x6116de25352c93149542e950162c7305f207bbc17b0eb725136b78c80aed79cc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xe7cb9d2fd449f7bd11126bff55266e7b74936f2f230e21d44d75c04b7780dfeb","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x20000","number":"0x1","gasLimit":"0x47e7c4","gasUsed":"0x0","timestamp":"0x5eb2a363","extraData":"0x0000000000000000000000000000000000000000000000000000000000000000a2852203a9da8bb555ec98a78c66365437bb1dde6707a08032e9eb916a8a454e37a1fffeab272bcffc2fc1d82aee6f3124bbdc8ed884efcbadfb6ff862cf4c3801","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","hash":"0xd977f1acfd035cf717193a9c3a2351cdccdc2ea0719aff871dade0e8daf8069d"},{"parentHash":"0x6116de25352c93149542e950162c7305f207bbc17b0eb725136b78c80aed79cc","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","miner":"0x0000000000000000000000000000000000000000","stateRoot":"0xe7cb9d2fd449f7bd11126bff55266e7b74936f2f230e21d44d75c04b7780dfeb","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x20000","number":"0x1","gasLimit":"0x47e7c4","gasUsed":"0x64","timestamp":"0x5eb2a363","extraData":"0x00000000000000000000000000000000000000000000000000000000000000005eab7a9bf40635d056ccab45ac0d8b4e99be4b4ed859e4246f651b95c0adaacc050760a0afc2d9383f821baab7f995cde07271f286c4805095b413e7ad69d9f401","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","hash":"0x917c38a507c9807426fc9e3e9e8ded2db07c7f61070bd1c7b57b9df287e8f7b2"}]     --chain-id=test-chain-8d7sJz --home ~/home_cli

    Malicious Vote

    If you run bsc with flag monitor.maliciousvote, evidence will be output into logs when votes violating rules are detected, then the tool maliciousvote-submit can be used to submit the evidence.

    Example

    maliciousvote-submit --chainId 714 --sender 59ba8068eb256d520179e903f43dacf6d8d57d72bd306e1bd603fdb812345678 --node ws://localhost:8545 --evidence "{\"VoteA\":{\"SrcNum\":6948,\"SrcHash\":\"dc58ff5dca8deefb7b03904ef2837e5f8b0e84ec147f021d4ff08343635540d3\",\"TarNum\":6949,\"TarHash\":\"24726f05534dc55c36ecc364951025abada0defa6d1b53bcb6b637f583b59996\",\"Sig\":\"9379a0626f962b828ed21fb34a6b6de034a23651c2e0c12b907293cf8f21d4fdd559e6f9c7f450a4243d33ad7aa5783d0e51e70979631d82819c254dfb130dfe924f057f7e2b4e64195fc7562f1cb0c45486c9cc3e6cc5679b4c0b5744bf33b5\"},\"VoteB\":{\"SrcNum\":6947,\"SrcHash\":\"24726f05534dc55c36ecc364951025abada0defa6d1b53bcb6b637f583b59996\",\"TarNum\":6950,\"TarHash\":\"6257f70ea6439b84d910595064a6e44e55ba0f2abc0c887346c420a60a5ef119\",\"Sig\":\"af9b500877d64277e80eea7c42b8d6ae5744d715625344ef6ddc66fa4e1dcb3e94568c79e018239641b724bacaa93046052d13f87b655d58b7afecf4e31036d5eca911e8c7436deea68c1e64ef7ed527ed25416039e4e7352f9b089cfb86481f\"},\"VoteAddr\":\"98b94137e4e2d4e628dcbc4a05d554f44950a7498040d3276d49c265708229127cd20e48c773cdc7a898b3bb572a17bf\"}"
    - + diff --git a/docs/validator/slash-fee.html b/docs/validator/slash-fee.html index f8c2096b3d..4dc9589288 100644 --- a/docs/validator/slash-fee.html +++ b/docs/validator/slash-fee.html @@ -8,13 +8,13 @@ - +

    Slashing Fee and Evidence Validation

    Double Sign

    Anyone can submit a slash request on BC with the evidence of Double Sign of BSC

    Evidence Validation

    • Two block headers have the same height and the same parent block hash
    • Two block headers are sealed by the same validator
    • Two signatures of these two blocks must not be the same
    • The time of these two blocks must be within the validity of the evidence, which is 24 hours

    If the evidence is valid:

    1. 10,000BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 10,000BNB, then the unbonded delegation balance would be slashed if it exists until totally 10,000BNB slashed from the self-delegator of the validator. However, if all the slashed BNB is less than 10,000, all the remaining stake of the self-delegator will be slashed
    3. 1000 of slashed BNB would allocate to the submitter as a reward
    4. The rest of slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the rest of slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with a duration of 292 years, and remove it from validator set by an instance BSC validator set update Cross-Chain update

    Malicious Vote

    Only relayers can submit a slash request on BSC with the evidence of Malicious Vote of BSC for now. Open access to anyone is planned.

    • The target number voted by two votes lags behind the block header of the canonical chain by no more than 256
    • The source numbers of the two votes are both smaller than their respective target numbers
    • The source hash and target hash of the two votes are both not equal
    • The target number of the two votes is the same or the span of one vote includes the span of the other vote
    • The two votes are signed by the same voting key, and the verification of signatures are both passed
    • The voting key used for signing is in the list sent by the last two breathe blocks

    If the evidence is valid:

    1. 10,000BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 10,000BNB, then the unbonded delegation balance would be slashed if it exists until totally 10,000BNB slashed from the self-delegator of the validator. However, if all the slashed BNB is less than 10,000, all the remaining stake of the self-delegator will be slashed
    3. 50BNB would allocate to the submitter from the systemreward contract as a reward if the validator is active when the evidence submitted
    4. The slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with a duration of 292 years, and remove it from validator set by an instance BSC validator set update Cross-Chain update

    Unavailability

    There can be an internal smart contract responsible for recording the missed blocking metrics of each validator.

    If a validator missed more than 50 blocks in 24h, the blocking reward for the validator will not be relayed to BC for distribution but shared with other better validators. If it missed more than 150 blocks in 24h, then this will be propagated back to BC where another Slashing will happen:

    1. 50BNB would be slashed from the self-delegated BNB of the validator
    2. If the self-delegator’s stake amount on the validator is less than 50BNB, then the unbonded delegation balance would be slashed if it exists until totally 50BNB slashed from self-delegator of the validator. However, if all the slashed BNB is less than 50, all the remaining stake of the self-delegator will be slashed
    3. 10 of slashed BNB would allocate to the validators on BC as block fee
    4. The rest of slashed BNB will allocate to the custody addresses of which validators would take part in the next distribution. If no matched validators found, then the rest of slashed BNB will allocate to validators on BC as block fee
    5. Set the validator ‘jailed’ with a duration of 2 days, and remove it from validator set by an instance BSC validator set update Cross-Chain update
    - + diff --git a/docs/validator/unjail.html b/docs/validator/unjail.html index f030891ae0..83af5d276a 100644 --- a/docs/validator/unjail.html +++ b/docs/validator/unjail.html @@ -8,13 +8,13 @@ - +

    Unjail

    Jailed validator nodes due to their malicious or bad behavior, may request for release by sending side-unjail transactions provided they passed initial validation. After release, to re-join the validator set again, the validator must wait for the following UTC 0:00. The fees to unjail a smart contract validator is 1 BNB. Whereas, the fee for submitting a byzantine behavior evidence of a validator is 10 BNB.

    Transaction Validation

    • Validator address must not be empty.
    • The side chain id exists.
    • Self-delegation of the validator exists and must be greater than the min-self-delegation setting by 2,000 BNB.
    • Requestor is in 'jailed' state when requesting to be un-jailed.
    • Complete the required jailed term.

    Fee Table

    Transaction TypePay in BNB
    Unjail A Smart Chain Validator1
    Submit Byzaitine Behavior Evidence of A Smart Chain Validator10

    Command to get Unjailed

    bnbcli slashing side-unjail 
    \--from= {this address has to be the operator address of the validator to be unjailed.
    Name or address of private key with which to sign}
    \--side-chain-id= {chain-id of the side chain the validator belongs to}
    \--chain-id= {the chain id of BNB Chain}
    Parameter NameExampleExplanationRequired
    --chain-idBinance-Chain-XXXthe chain id of binance chainYes
    --frombnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hddThis address has to be the operator address of the validator to be unjailed. Name or address of private key with which to sign.Yes
    --side-chain-idBSC-XXXchain-id of the side chain the validator belongs toYes

    Example

    bnbcli slashing side-unjail --from bnb19awsmku5ch689lp0rj0c6su7x0n5wxhjm65hdd --side-chain-id=bsc --chain-id=Binance-Chain-Tigris --home ~/home\_cli
    - + diff --git a/docs/validator/upgrade-fullnode.html b/docs/validator/upgrade-fullnode.html index 85f5e7efed..30c5e42479 100644 --- a/docs/validator/upgrade-fullnode.html +++ b/docs/validator/upgrade-fullnode.html @@ -8,13 +8,13 @@ - +

    How to Upgrade Geth

    Updating geth is as easy as it gets. You just need to download and install the newer version of geth, shutdown your node and restart with the new software. Geth will automatically use the data of your old node and sync the latest blocks that were mined since you shut down the old software.

    Step 1: Compile the New Version or download new pre-build binaries from release

    git clone https://github.com/bnb-chain/bsc
    # Enter the folder bsc was cloned into
    cd bsc
    # Compile and install bsc
    make geth
    # Download pre-build binaries

    # Linux
    wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_linux |cut -d\" -f4)
    mv geth_linux geth
    chmod -v u+x geth

    # MacOS
    wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_mac |cut -d\" -f4)
    mv geth_mac geth
    chmod -v u+x geth
    make geth

    Step 2: Stop Geth


    $ pid=`ps -ef | grep geth | grep -v grep | awk '{print $2}'`
    $ kill $pid

    Step 3: Restart

    note

    Make sure to use the same start-up command you used before the upgrade. So in this case we use the same command as in our tutorial

    ##
    ./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0
    - + diff --git a/docs/verify-proxy.html b/docs/verify-proxy.html index 011ecf811f..0650f28bd0 100644 --- a/docs/verify-proxy.html +++ b/docs/verify-proxy.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    How to Verify Proxy Contract

    In this section, we provide a quick guide on how to verify a deployed BEP20 proxy contract.

    Flatten your contract

    Install flattener

    npm install truffle-flattener -g

    Run the following command:

    $ truffle-flattener BEP20TokenImplementation.sol > BEP20TokenImplementationFlattened.sol
    $ truffle-flattener BEP20UpgradeableProxy.sol > BEP20UpgradeableProxyFlattened.sol"

    Compile and deploy your contract with Remix

    Compile Implementation contract

    • Open Remix IDE: https://remix.ethereum.org
    • Select solidity language
    • Create new contract BEP20Token.sol and copy contract code from flattened BEP20TokenImplementationFlattened.sol
    • Compile the implementation contract
    • Click on this button to switch to the compile page
      • Select “BEP20TokenImplementation” contract
      • Enable “Auto compile” and “optimization”
      • Click “ABI” to copy the contract abi and save it.

    Deploy the implementation contract

    • Select “Injected Web3”
    • Select “BEP20TokenImplementation” contract
    • Click the “Deploy” button and Metamask will pop up
    • Click the “confirm” button to sign and broadcast the transaction to BSC.
    • Then, you need to initialize the token: fill in all the parameters and click on “transact”
    img

    Note: Owner should be the address who send the deploy transaction before.

    • Click on the “Copy” icon to save the initializatioin data: Like the following: ```
    0xef3ebcb800000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000fc41d5571120442d1bb82cea0884966e543cb78b000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000548454c4c4f000000000000000000000000000000000000000000000000000000
    • Confirm your transaction in MetaMask
    img

    Compile Proxy Contract

    • Create new contract proxy.sol and copy contract code from flattened BEP20UpgradeableProxyFlattened.sol . Here is and example
    • Compile the proxy contractClick on this button to switch to the compile page
      • Select “BEP20UpgradeableProxy” contract
      • Enable “Auto compile” and “optimization”Click “ABI” to copy the contract abi and save it.

    Deploy the proxy contract

    • Select “Injected Web3”Select “BEP20UpgradeableProxy.sol” contract
    • Fill in the parameters
    img

    Logic: The address of BEP20Implementation contract Admin: admin cannot be BEP20 token owner Data: use the initialization data you saved before

    • Click the “Deploy” button and Metamask will pop up
    • Click the “confirm” button to sign and broadcast transaction to BSC.

    Verify Proxy Contract on BscScan

    Note: The way to verify the BEP20TokenImplementation contract is the same as before.

    • Go to your contact page and click on “Verify and Publish”
    img
    • Select Single file
    img
    • Copy your contract code below and check “Optimization” if it’s enabled
    • Contractor Data: Please use this site for getting the correct constructor data: https://abi.hashex.org/#

    First, you need to copy ABI json of “BEP20UpgradeableProxy.sol” contractThen, click on “Parse”

    img

    Add all those 3 parameters as indicated. Then copy/paste the result.

    That’s it! You have verified your proxy contract.

    img
    • Click on “More Options” and choose “is this a proxy”.
    img
    • Verify your proxy address
    img
    • Confirm the implementation address.
    img

    If you go back to the contract page and you can see two more buttons “Read as Proxy” and “Write as Proxy”

    img
    - + diff --git a/docs/verify.html b/docs/verify.html index e76716a180..6ff75604c2 100644 --- a/docs/verify.html +++ b/docs/verify.html @@ -8,13 +8,13 @@ - +

    How to Verify Your Contract on BscScan

    Step 1: Deploy your contract on BNB Smart Chain

    Step 2: Go to BSC Explorer or Testnet Explorer

    Click on "Verify and Publish"

    img

    Step 3: Fill in the correct information of your contract

    img

    • Contract Address
    • Compiler Type you chose in Remix or other complier
    • Select Open Source License Type

    Step 4: Enter the Solidity Contract Code

    img

    You need to select "Yes" for Optimization, if that's enabled.

    Contructor arguement is optional. If your contract do have one, you can go to this page to generate the encoded ABI json.

    !!! info

    The default BEP20 contract template does not have a constructor method

    Click on "Verify and Publish" to finish this process. Now you are all set!

    - + diff --git a/docs/wallet/AlphaWallet.html b/docs/wallet/AlphaWallet.html index 648bfd9427..823b1fe8fd 100644 --- a/docs/wallet/AlphaWallet.html +++ b/docs/wallet/AlphaWallet.html @@ -8,14 +8,14 @@ - +

    How to Use AlphaWallet for BNB Smart Chain on Your Mobile

    Install

    1. Get App from Andriod Play Store, iOS app Store, Andriod APK file or iOS TestFlight https://alphawallet.com/download-alphawallet-app/ Or you can make your own build from the open source code https://github.com/AlphaWallet

    2. Open AlphaWallet on your mobile, backup Seed Phrase

    Setup Your Wallet for BNB Smart Chain

    1. Click Setting tab, Select Active Network

    2. Select BNB Chain. If you want to enable the testnet as well, select BNB Chain(test).

    Setup Your DApp browser for BNB Smart Chain

    1. Click Browser tab, Click the Ethereum

    2. In the browser active network page, select BNB Chain or BNB Chain(Test)

    It’s ready, and now you can get some testnet BNB from the faucet.

    Get Testnet Fund

    1. Copy your address.

    2. Go to https://testnet.binance.org/faucet-smart/

    - + diff --git a/docs/wallet/arkane-developer.html b/docs/wallet/arkane-developer.html index 00f6913d6d..09b292bdbf 100644 --- a/docs/wallet/arkane-developer.html +++ b/docs/wallet/arkane-developer.html @@ -8,13 +8,13 @@ - +

    Wallet provider for Dapps

    A wallet provider is a service that allows DApps to provide wallets to their end-users without having to deal with the security concerns of key management. It is a great way to make your Dapp ready to onboard a more mainstream audience.

    Arkane allows you to easily integrate your app with the BNB Smart Chain, whether you already have an Dapp integrated with web3 or are building a new application from scratch. Arkane provides a smooth and delightful experience for you, your users on both web and mobile.

    Arkane will help you interact with the BNB Smart Chain, create blockchain wallets, create different asset types such as fungible (BEP20, ERC20), and non-fungible tokens - NFTs - (ERC721, and ERC1155) and interact with smart contracts. Next to a superior developer experience, you can give your users a user-friendly interface.

    Each application is unique and has different needs, therefore they provide different ways of interacting with Arkane. Applications that have support for Web3 are recommended to integrate the Arkane Web3 provider, others are suggested to use the Arkane Widget.

    Key features

    • Support for Web and mobile applications
    • Offers social logins
    • Offers a fiat-on-ramp
    • Only wallet that supports NFTs (ERC721 and ERC1155) on BNB Smart Chain
    • Multichain, supports both BSC and Ethereum
    • Easy to integrate using web3
    • Build for a mainstream audience
    • Offers in-app customer support
    • Provide a complete test environment
    • Wallet creation via APIs

    Getting Started 🎉

    If you already support Web3-technology, you can improve the UX within your application by integrating the Arkane Web3 provider, a smart wrapper around the existing Web3 Ethereum JavaScript API.

    By making use of our Web3 provider you are able to leverage the full potential of Arkane with minimal effort and you will be able to onboard users that are less tech savvy without making them leave your application or download third party plugins. Integrating just takes 2 steps and 5 minutes

    Don't support Web3 yet?

    Don't worry we've got you covered with our 📦 Widget - Arkane Connect.

    Step 1: Add the library to your project

    Install the library by downloading it to your project via NPM

    npm i @arkane-network/web3-arkane-provider

    followed by adding the script to the head of your page.

    <script src="/node_modules/@arkane-network/web3-arkane-provider/dist/web3-arkane-provider.js"></script>

    After adding the javascript file to your page, a global Arkane object is added to your window. This object is the gateway for creating the web3 wrapper and fully integrates the widget - Arkane Connect.

    Step 2: Initialize the web3 provider

    Add the following lines of code to your project, it will load the Arkane web3 provider.

    Arkane.createArkaneProviderEngine({clientId: ‘Arketype’}).then(provider => {
    web3 = new Web3(provider);
    });

    The web3 instance now works as if it was injected by parity or metamask. You can fetch wallets, sign transactions, and messages.

    Congratulations, your dapp now supports Arkane 🎉

    🧙 To connect to Arkanes production environment and mainnet, you will need to register your app and request your Client ID.

    Want to know more about the wonderful world Arkane has to offer, check out their documentation

    Receive BNB and BEP20 tokens

    Every BSC wallet in Arkane is able to send and receive BNB or BEP20 tokens. They will automatically appear in your wallet.

    img

    Resources:

    - + diff --git a/docs/wallet/arkane.html b/docs/wallet/arkane.html index 31bf69a416..844e4cce5b 100644 --- a/docs/wallet/arkane.html +++ b/docs/wallet/arkane.html @@ -8,13 +8,13 @@ - +

    How to create a BSC wallet in Arkane

    If you are looking for a user-friendly BNB Smart Chain wallet, consider creating an Arkane wallet. It allows you to enable the recovery mechanism and comes with end-user support via their in-app chat, making sure you are never lost in the wonderful land of cryptocurrency.

    Key features

    • Cloud wallet, offers support Web and mobile
    • Register via social (Google, Facebook, Twitter)
    • In app crypto purchases
    • Support multiple blockchains
    • Build for a mainstream audience
    • In-app customer support

    Step 1. Sign up to Arkane

    img

    • Click 'Create Account' if you are new to Arkane. You can sign up to Arkane with your social credentials or with email and password.

    img

    • After signing up with one of your social accounts (fastest) or with your email address and password. You will need to accept the terms and conditions.

    img

    • To secure your wallet you need to configure a PIN. You PIN should be between 4 and 6 digits. Your PIN will be used to approve future transactions.

    img

    Step 2. Create your wallet

    • Now that you've configured your PIN, you are ready to create a BNB Smart Chain wallet. Just select BNB Smart Chain from the list.

    img

    • To create a new wallet press 'Create new wallet'

    img

    • Once you've press the button, Arkane will ask you to confirm using your PIN (the one you configured a few steps before). After that your wallet will be created and you will be taken to your Dashboard.

    img

    🥳 Congratulations!

    • You have now created your BNB Smart Chain wallet to manage your digital assets on the BNB Smart Chain blockchain.

    Receive BNB and BEP20 tokens

    • Every BSC wallet in Arkane is able to send and receive BNB or BEP20 tokens. They will automatically appear in your wallet.

    img

    Resources:

    - + diff --git a/docs/wallet/binance-cn.html b/docs/wallet/binance-cn.html index 6c5fd01907..4f26fde4c4 100644 --- a/docs/wallet/binance-cn.html +++ b/docs/wallet/binance-cn.html @@ -8,14 +8,14 @@ - +

    币安链插件钱包指南

    币安链插件钱包是什么?

    币安链插件钱包支持币安链和币安智能链。用户也可以完成跨链转账。

    币安链插件钱包将很快支持以太坊。同时,也会很快支持与Dapps的交互。

    火狐和Chrome浏览器都上架币安链插件钱包。

    !!! Tip 火狐浏览器更新更快。

    安装

    以火狐浏览器为例

    img

    注意⚠️: 请确认开发者是BNB Chain

    • 点击 “Add to Firefox”
    img

    完成! 你已经成功在火狐浏览器中安装币安链插件钱包!

    其他浏览器的流程类似。

    在币安链插件钱包中创建新账户

    • 点击 “I do not own a wallet”

    img

    • 输入密码

    注意⚠️:必须是强密码

    img

    • 点击 “Continue”

    • 备份助记词

    img

    你已经完成账户创建!

    通过助记词导入已有账户

    • 按照上述步骤完成安装

    • 点击 “I own a wallet”

      img
    • 输入你的助记词和密码

      img
    • 点击 “Get started”

    你已经完成账户恢复!

    获得测试网BNB

    img

    • 打开钱包后,切换到BNB Smart Chain Testnet

    img

    • 复制地址

    img

    • 粘贴到输入框并点击 “Give me BNB”
    • 点击 “+” and 添加“BNB” 代币

    img

    交易完成后,你很快就能看到账户上的BNB

    img

    BNB从BSC转到BC

    以测试网为例:

    • 打开钱包后,切换到BNB Chain Testnet。复制地址,以 tbnb1开头

    img

    • 点击 “+” and 添加“BNB” 代币

    • 切换到BNB Smart Chain Testnet,点击 “Send”

    img

    • 在输入地址和和金额后,点击“Send”

    img

    • 切换到BNB Chain Testnet,确认转账完成

    img

    BNB从BC转到BSC

    • 打开钱包后,切换到BNB Smart Chain Testnet。复制地址,以 0x开头
    img
    • 点击 “+” and 添加“BNB” 代币
    • 切换到BNB Chain Testnet,点击 “Send”
    img
    • 在输入地址和和金额后,点击“Send”
    img
    • 切换到BNB Smart Chain Testnet,确认转账完成

    在测试网上完将BEP2代币转换为BEP20格式

    • 根据以上指令完成安装
    • 根据以上指令完成账户的创建或恢复
    • 打开钱包后,切换到Binance Chain Testnet。点击“+” 添加你的BEP2代币
    img

    确认BNB余额够支付跨链转账费用

    • 切换到BNB Chain Testnet。复制地址,以 tbnb1开头
    img

    若需要,点击“+” 添加你的BEP20代币

    img
    • 切换到BNB Chain Testnet,点击 “Send”
    img
    • 在输入地址和和金额后,点击“Send”并确认
    img
    • 切换到BNB Smart Chain Testnet,确认收到BEP20代币
    img

    在测试网上完将BEP20代币转换为BEP2格式

    • 根据以上指令完成安装
    • 根据以上指令完成账户的创建或恢复
    • 打开钱包后,切换到BNB Smart Chain Testnet。点击“+” 添加你的BEP20代币
    img

    确认BNB余额够支付跨链转账费用

    • 切换到BNB Chain Testnet。复制地址,以 tbnb1开头

    注意⚠️:主网地址以 bnb1开头

    img
    • 若需要,点击“+” 添加你的BEP2代币
    img
    • 切换到BNB Smart Chain Testnet,点击 “Send”
    img
    • 切换到BNB Chain Testnet,确认收到BEP2代币
    - + diff --git a/docs/wallet/binance.html b/docs/wallet/binance.html index d1f8c39269..04e5e6ed9b 100644 --- a/docs/wallet/binance.html +++ b/docs/wallet/binance.html @@ -8,13 +8,13 @@ - +

    Binance Extension Wallet

    What is it?

    Binance Extension Wallet is a crypto Wallet for BNB Beacon Chain and BNB Smart Chain. You can send and receive funds on BNB Beacon Chain, BNB Smart Chain and cross-chain transfers between both of BNB Chain’s blockchains.

    In the future, Binance Extension Wallet will add support for Ethereum blockchain and enable access for distributed applications, or "Dapps" in your browser!

    It’s supported in Firefox and Chrome browsers.

    Chrome App Store Link: https://chrome.google.com/webstore/detail/binance-chain-wallet/fhbohimaelbohpjbbldcngcnapndodjp

    Firefox App Store Link: https://addons.mozilla.org/en-US/firefox/addon/binance-chain/?src=search

    How to manually install the Binance Extension Wallet

    Install

    Example: Install Binance Extension Wallet in Firefox browser

    img

    Note: Make sure it’s offered by BNB Chain

    • Click on “Add to Firefox”
    img

    That’s it! You have successfully installed the Binance Wallet extension in Firefox!

    Note: The workflow is the same for all browsers.

    Create an account in extension wallet for BNB Smart Chain

    • Click on “I do not own a wallet

    img

    • Choose your own Password

    Note: it has to be a strong password

    img

    • Click on “Continue

    • Backup your recovery phrase

    img

    Congratulations! you have created your account!

    Recover your account with Mnemonic Phrase

    • Install BNB Chain Extension by following the previous steps

    • firstClick on “I own a wallet

      img
    • Type your recovery phrase and choose a strong password

    img
    • Click on “Get started

    Now you are all set!

    Get Testnet BNB from Faucet

    img

    • Switch to BNB Smart Chain Testnet after unlock your extension wallet

    img

    • Copy your address

    img

    • Paste your address in the box and click on “Give me BNB”
    • Click on the “+” and add “BNB” token

    img

    After the transfer transaction is sent, you will see an increase in your balance

    img

    Transfer Testnet BNB from BSC to BC

    • Switch BNB Beacon Chain testnet and copy your address after unlock your extension wallet, start with tbnb1

    img

    • Click on the “+” and add “BNB” token

    • Switch to BNB Smart Chain testnet and click on “Send”

    img

    • Click on “Send” when you have filled in other information. You have to confirm it too

    img

    • Switch back to BNB Beacon Chain Testnet to confirm this cross-chain transfer

    img

    Transfer Testnet BNB from BC to BSC

    • Switch to BNB Smart Chain testnet after unlock your extension wallet and copy your address, start with 0x
    img
    • Click on the “+” and add “BNB” token
    • Switch to BNB Beacon Chain testnet and click on “Send”
    img
    • Click on “Send” when you have filled in other information. You have to confirm it too
    img
    • Switch back to BNB Smart Chain Testnet to confirm this cross-chain transfer

    Swap Testnet BEP2 token to its BEP20 equivalent

    • Follow the instructions above to Install Binance Extension Wallet if not ready
    • Follow the instructions above to create or Recover your account
    • Switch to BNB Beacon Chain testnet after unlock your extension wallet and Click at “+” to add your BEP2 token if necessary
    img

    Verify your balance has enough BNB to pay transfer fee

    • Switch to BNB Smart Chain testnet and copy your address, start with 0x
    img

    Click at “+” to add your BEP20 token if necessary

    img
    • Switch to BNB Beacon Chain testnet and click on “Send”
    img
    • Click on “Send” when you have filled in other information. You have to confirm it too
    img
    • Switch to BNB Smart Chain testnet, you should see your BEP20 token balance change
    img

    Swap Testnet BEP20 token to its BEP2 equivalent

    • Follow the instructions above to Install Binance Extension Wallet if not ready
    • Follow the instructions above to create or Recover your account
    • Switch to BNB Smart Chain testnet and Click at “+” to add your BEP20 token if necessary
    img

    Verify your balance has enough BNB to pay transfer fee

    • Switch to BNB Beacon Chain testnet and copy your address, start with tbnb1

    Note: for mainnet, the address starts with bnb1

    img
    • Click at “+” to add your BEP2 token if necessary
    img
    • Switch to BNB Smart Chain testnet and click on “Send”
    img
    • Confirm your transaction and verify your balance change
    - + diff --git a/docs/wallet/coin98wallet.html b/docs/wallet/coin98wallet.html index a0468da6b8..47462f0b43 100644 --- a/docs/wallet/coin98wallet.html +++ b/docs/wallet/coin98wallet.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    How to create BNB Smart Chain Wallet on Coin98 Wallet

    Users are able to store, send & receive BNB, the native token of BNB Smart Chain and BEP20 tokens on Coin98 Wallet

    Coin98 Mobile Wallet

    Step 1: Open Coin98 Mobile Wallet & click Manage on the home screen.

    Step 2: Click Add Wallet, choose BNB Smart Chain (BNB BEP20) icon, and click Create. img

    Step 3: Name the wallet. Click Next

    • Paste the provided Passphrase/ Private Key into the confirmation box.

    • After copying & saving your Passphrase, tick the “Backup your recovery key” box to confirm & back up the provided Passphrase & Private Key. Please note that this information is crucial to keeping your assets safe.

    • Tick the remaining boxes to confirm you’re aware of the risks.

    • Click Create Wallet. img

    Your BNB Wallet will instantly be displayed on the home screen. You can also click Manage to check your wallets.

    How to receive BNB and BEP20 tokens to Coin98 Mobile Wallet

    Step 1: Select your BNB (BEP20) wallet on the home screen.

    Step 2: Click Receive.

    Step 3: Click the copy icon to copy the wallet address.

    Step 4: Send BNB tokens to this address.

    img

    How to send BNB and BEP20 tokens from Coin98 Mobile Wallet

    Step 1: Select your BNB (BEP20) wallet on the home screen.

    Step 2: Click Send.

    Step 3: Fill in the amount of tokens, the receiver’s wallet address, messages (if necessary) and adjust the gas fee to your needs.

    Step 4: Slide Send to complete.

    img

    Note:

    • The default gas fee on Coin98 Wallet has been set at the standard rate that offers the most optimized speed at a reasonable cost.

    • The gas fee is approximately 0.000105 BNB for each transaction on BNB Smart Chain.


    Coin98 Extension Wallet

    Users are also able to store, send & receive BNB and BEP20 tokens directly on Coin98 Extension Wallet.

    Step 1: Open Coin98 Extension Wallet, enter your password, and click Manage on the home screen → Click Add Wallet.

    Step 2: Choose BNB Smart Chain (BNB BEP20) wallet icon, then click Create Wallet.

    img

    Step 3: Name the wallet & back up the provided Passphrase & Private Key. Please note that this information is crucial for keeping your assets safe.

    • After copying & saving your Passphrase, tick the “Backup your recovery key” box to confirm.

    • Tick the remaining boxes to confirm you’re aware of the risks.

    • Click Create Wallet.

    Step 4: Paste the provided Passphrase into the confirmation box, then click Create.

    img

    Your BNB Wallet will instantly be displayed on the home screen. You can also click Manage to check your wallets.

    How to receive BNB and BEP20 tokens

    Step 1: Click on your BNB wallet on the home screen.

    Step 2: Choose Receive.

    Step 3: Copy the wallet address by clicking the Copy icon or screenshot the QR code.

    Transfer BEP20 tokens to the address copied on step 3.

    img

    How to send BNB and BEP20 tokens

    Step 1: Click on your BNB wallet on the home screen.

    Step 2: Choose Send.

    Step 3: Enter the amount and the recipient's wallet address, adjust the gas setting, then click Send to complete the transaction.

    img

    Note:

    • The default gas fee on Coin98 Wallet has been set at the standard rate that offers the most optimized speed with a reasonable cost.

    • The gas fee is approximately 0.000105 BNB for each transaction on BNB Smart Chain.

    - + diff --git a/docs/wallet/create-wallet.html b/docs/wallet/create-wallet.html index d82698321f..136cdfa6f4 100644 --- a/docs/wallet/create-wallet.html +++ b/docs/wallet/create-wallet.html @@ -8,13 +8,13 @@ - +

    Key Management

    This article is a guide about key management strategy on client side of your Decentralised Application on BNB Smart Chain

    Setup Web3

    web3.js is a javascript library that allows our client-side application to talk to the blockchain. We configure web3 to communicate via Metamask.

    web3.js doc is here

    Connect to BSC network

        // mainnet 
    const web3 = new Web3('https://bsc-dataseed1.bnbchain.org:443');
    // testnet
    const web3 = new Web3('https://data-seed-prebsc-1-s1.bnbchain.org:8545');

    Set up account

    If the installation and instantiation of web3 was successful, the following should successfully return a random account:

        const account = web3.eth.accounts.create();

    Recover account

    If you have backup the private key of your account, you can use it to restore your account.

        const account = web3.eth.accounts.privateKeyToAccount("$private-key")

    Full Example

    const Web3 = require('web3');
    async function main() {

    const web3 = new Web3('https://bsc-dataseed1.bnbchain.org:443');
    const loader = setupLoader({ provider: web3 }).web3;

    const account = web3.eth.accounts.create();
    console.log(account);
    }
    - + diff --git a/docs/wallet/extension/add-account.html b/docs/wallet/extension/add-account.html index 68be6d3468..5d709f1d34 100644 --- a/docs/wallet/extension/add-account.html +++ b/docs/wallet/extension/add-account.html @@ -8,13 +8,13 @@ - +

    How does Add Account Work

    BIP39

    Bitcoin Improvement Proposal (BIP) 39 defines a formula for the generation of a mnemonic sentence (also referred to as mnemonic words, seed phrase, recovery phrase, etc.)the generation of a seed from that mnemonic sentence. That seed is used to produce your private and public keys, but those details will be covered in the next post in this series.

    BIP32

    BIP 32 is a specification for creating Hierarchical Deterministic wallets. They are wallets that, from a root it can generate multiple "child" private keys in a deterministic way. You only need to remember the "path" of the child key.For example hardware wallets use them from a single root you can generate separate keys for Bitcoin (with path m/44'/0'/0'/0) and Ethereum (path m/44'/60'/0'/0).

    Add Account in Binance Extension Wallet

    Binance Extension wallet would use a similar way to generate keys as Ethereum, i.e. derive the private key using BIP32/BIP44 with HD prefix as "44'/60'/", which is the same as Ethereum's derivation path.

    img

    Whenever you click on “Add Account”, your seed is extended at the end by a counter value which makes it possible to automatically derive an unlimited number of new addresses in your extension wallet.

    - + diff --git a/docs/wallet/extension/add-asset.html b/docs/wallet/extension/add-asset.html index 3ffc1379e8..68dd71179d 100644 --- a/docs/wallet/extension/add-asset.html +++ b/docs/wallet/extension/add-asset.html @@ -8,13 +8,13 @@ - +

    How to Add a Token

    How to Add Pegged Token

    By default, Binance Extension wallet will only show BNB your balance.

    • Open Extension wallet and click Assets to see the tokens in your wallet.
    • Scroll down to the bottom and click “+”.

    You could search for your token with symbol. All pegged BEP20 tokens are already listed.

    • then you should see your asset after checking box

    How to Add a Custom Token

    Here's how you add a custom token.

    • Open Extension wallet and click Assets to see the tokens in your wallet.
    • Scroll down to the bottom and click “+”.
    • Click “+” on the right corner
    • Paste the contract address
    • Click Add Token to confirm
    • You're done. You'll now see it in your assets list so it's easier to track and use.
    - + diff --git a/docs/wallet/extension/direct.html b/docs/wallet/extension/direct.html index f8a9df2d17..c135a747f5 100644 --- a/docs/wallet/extension/direct.html +++ b/docs/wallet/extension/direct.html @@ -8,7 +8,7 @@ - + @@ -18,7 +18,7 @@ The BNB positions of your Binance.com account will not change.

    User Guide

    Prerequisites

    How to pair your wallets

    1. Choose one of your accounts

    You cannot use the accounts imported from your Ledger hardware wallet.

    Click on “Connect to Binance.com account”

    img
    1. Verify Address Ownership 2.1 Connect your browser extension wallet
    img

    2.2 Sign messageSign via browser extension wallet

    img

    2.3: Connected and wallet direct successfully

    img

    The connected address display on this page: https://www.binance.com/en/wallet-direct

    img

    You can confirm the paired status from the Extension wallet

    img

    How to undo your paired wallets?

    img

    Go to this page: https://www.binance.com/en/wallet-direct and click on “Disconnect‘, then your address is not connected anymore.

    img
    • Unpair from your Binance Extension wallet

    Click on the “Manage” button to view the details of your account

    img

    Click on “Disconnect” then confirm

    img

    You can confirm the paired status from the Extension wallet

    img

    How to Withdraw Tokens from Binance.com to a paired account in Extension wallet?

    1. Unlock your pairs account of Binance Extension wallet

    Click on the “Receive” button

    img
    1. Choose “Wallet Direct‘
    img
    1. Select one of your assets from the account balance of Binance.com
    img

    Fill in the amount

    img

    Confirm your withdrawal transaction by following the verification process

    img

    Wait for your tokens to come

    img

    How to Deposit Tokens from your BNB Chain Extension wallet account to a paired Binance.com account?

    1. Unlock your pairs account of BNB Chain Extension wallet Click on the “Send” button.
    img
    1. Choose one of your assets and the paired account as the recipient
    img
    1. Confirm your transfer
    img
    1. Wait for your confirmation
    img

    How to view your withdrawal history between paired accounts?

    • Click on the “Manage” button to view the details of your account
    img
    • Click on “Transaction History”
    img
    • View the history of withdrawal transfers
    img - + diff --git a/docs/wallet/extension/ledger.html b/docs/wallet/extension/ledger.html index 1154eba4e3..e91e84609e 100644 --- a/docs/wallet/extension/ledger.html +++ b/docs/wallet/extension/ledger.html @@ -8,14 +8,14 @@ - +

    How to use Ledger with Binance Extension Wallet

    Binance Extension Wallet v1.121.1 is released and verified on Firefox and Chrome with Ledger Nano S

    Connect to Ledger Nano S Hardware Wallet

    What you need:

    Next:

    1. Your first step is to plug your Ledger into your computer. Ensure it powers on and then input the pin you chose when setting up your ledger.
    2. Select and open the Ethereum Application. If you haven't installed Ethereum Application, please read this guide
    3. Enabling contract data for BEP20. The first item in the settings menu is “Contract Data”. Push down both buttons to select it. Once you have set your ledger up like this the first time, you won’t have to do it again each time you want to use it with Binance Extension wallet.
    4. Open BNB Chain Extension Wallet and select "BNB Smart Chain" network
    5. Choose "Hardware Wallet" in Settings. Then, click on "Connect"
    1. Choose HD Path. Use "Legacy" by default
    img
    1. Finally, you can see a new account with LEDGER tag
    img

    !!! Warning Please note you cannot use Ledger account for BNB Chain network.

    You are connected!

    Sign Transaction with Ledger

    1. Connect Ledger and open the Ethereum Application

    2. Submit a transaction

    img

    3.Review and sign this transaction on Ledger

    img

    Interact with dApp

    img

    Have Connection Issues?

    Please read this FAQ: https://support.ledger.com/hc/en-us/articles/115005165269-Connection-issues-with-Windows-or-Linux

    - + diff --git a/docs/wallet/extension/reset.html b/docs/wallet/extension/reset.html index 2c0a515165..549e0abb93 100644 --- a/docs/wallet/extension/reset.html +++ b/docs/wallet/extension/reset.html @@ -8,13 +8,13 @@ - +

    How to Reset My Password or Import an Account

    When resetting your password for your Binance Extension wallet, you will need your 12 or 24 word seed phrase. If you do not already have your seed phrase saved someplace safe, please make sure to read How to Reveal Your Seed Phrase

    Before trying these steps, confirm that you have your seed phrase with you as you will not be able to reset your password otherwise and will risk becoming locked out of your wallet.

    1. If your wallet is currently unlocked, please lock your wallet first.
    2. Click Import Import seed phrase

    img

    1. Enter your seed phrase in the "Seed Phrase" text box
    2. Enter your new password
    3. Retype your password to confirm it was written correctly
    4. Click Reset

    img

    - + diff --git a/docs/wallet/extension/safe.html b/docs/wallet/extension/safe.html index 65453fafdb..c39be9d2ab 100644 --- a/docs/wallet/extension/safe.html +++ b/docs/wallet/extension/safe.html @@ -8,13 +8,13 @@ - +

    How to stay safe

    Wallets are a bit of a shift in thinking. Financial freedom and the ability to access and use funds anywhere comes with a bit of responsibility – there’s no customer support in crypto.

    Take responsibility for your own funds

    Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. Just remember you’re trusting that exchange with custody over your funds. If that company is attacked or folds, your funds are at risk.

    Write down your seed phrase

    Wallets will often give you a seed phrase that you must write down somewhere safe. This is the only way you’ll be able to recover your wallet.

    Here's an example:

    there aeroplane curve vent formation doge possible product distinct under spirit lamp

    Don’t store it on a computer. Write it down and keep it safe.

    Do Your Own Research

    If you use a web wallet, bookmark the site to protect yourself against phishing scams.

    Remember transactions can’t be reversed and wallets can’t be easily recovered so take care.

    - + diff --git a/docs/wallet/extension/seed.html b/docs/wallet/extension/seed.html index 4de2a088dd..e8ee4ca65d 100644 --- a/docs/wallet/extension/seed.html +++ b/docs/wallet/extension/seed.html @@ -8,13 +8,13 @@ - +

    How to Reveal Your Seed Phrase

    When dealing with cryptocurrencies or crypto assets like BNB or BUSD, it is important to always be aware of and have your private keys, seed phrases and passwords backed up in case the unexpected occurs.

    Backing Up When Installing

    When you create a new Binance Extension Wallet account, you are given your 12 word seed phrase is the most important bit of information for you to record and keep safe when managing your extension account.

    You can write your seed phrase down on a piece of paper, store it on a flash drive or we also make it optional to download a file containing this information.

    img

    Backing Up After You Install Binance Extension Wallet

    If for some reason you forgot to record your 12 word seed phrase or you lost the original copy, you can reveal your seed phrase so you can back it up again.

    Select Dropdown Menu (on top-right corner) --> Manage Accounts

    img

    click on Download button

    img

    Enter your password to reveal your seed words.

    img
    - + diff --git a/docs/wallet/ezdefi.html b/docs/wallet/ezdefi.html index e23936afde..80c1241d44 100644 --- a/docs/wallet/ezdefi.html +++ b/docs/wallet/ezdefi.html @@ -8,14 +8,14 @@ - +

    Using ezDeFi for BNB Smart Chain

    Install ezDeFi

    Go to http://ezdefi.com to install the most recent version of ezDeFi.

    Download ezDeFi Mobile App wallet on Apple Appstore or the Google PlayStore and ezDeFi Browser Extension on Chrome Webstore

    img

    img

    Launch the mobile app (or browser extension) in order to start a new wallet.

    img img

    Get ready by completing the initial setup.

    Getting the BNB Smart Chain

    On mobile app, go to "Setting" => "Advanced Setting" => "Custom RPC Network" to see default BNB Smart Chain . On browser extension, go to "Setting" => "Network" to see default BNB Smart Chain

    img

    img

    Add BNB token in your wallet

    On mobile app, tap on the "Add more", search for "Smart Chain", tap on the "+" button and create new address of BNB token. On browser extension, click on "More Assets", search for "Smart Chain", select BNB token

    img

    img

    Back to main screen to see BNB token already added on mobile app (or browser extension)

    img

    img

    Add a address of BNB token

    You can add new addrew address by create new, add Existed Address or import of the other wallet

    Create New, or add Existed address of the other token

    img

    img

    Import from Private key, from Phrase recovery (or Mnemonic phrase), or from Read only address (or account)

    img

    img

    Sending BNB token

    • On mobile app

    img

    img

    • On browser extension

    img

    img

    img

    Access BNB Smart Chain DApps

    ezDeFi Wallet is fully compatible with BNB Smart Chain DApps.

    • On mobile app

    img

    img

    img

    • On browser extension

    img

    ezDeFi at a glance

    ezDeFi “Global Payment Ecosystem Based On Blockchain” has 4 key products: Public blockchain, Mobile app wallet, Browser Extension wallet, and Payment gateway. ezDeFi wallet has 2 versions: mobile application and browser extension with features of multi-chain, multi-address, cloud backup, and app-extension sync. ezDeFi Payment Gateway supports merchants with a wide range of blockchains and e-commerce platforms namely: WHMCS, woo-commerce, EDD, and more with a low transaction fee, no-chargeback, and multiple cryptocurrency integration. In 2019, ezDeFi has acquired 523 clients using Payment Gateway, 2000+ downloads for wallets of both mobile app and browesr extension

    - + diff --git a/docs/wallet/faq.html b/docs/wallet/faq.html index 46c0a9e955..bec050eed2 100644 --- a/docs/wallet/faq.html +++ b/docs/wallet/faq.html @@ -8,14 +8,14 @@ - +

    Binance Extension Wallet FAQ

    Tokens not visible after withdrawing from Binance

    Many users who interact with a centralized exchange like Binance eventually want to withdraw to a wallet that they fully control, like MetaMask. So once you've used their withdraw form, what could be scarier than not seeing your tokens?

    First, you'll need to use the MetaMask add Custom Network feature to add the BNB Beacon Chain or BNB Smart Chain's RPC URLs endpoints to your MetaMask.

    Once you've added the BNB Beacon Chain or the BNB Smart Chain to your MetaMask, you will be able to select different networks to view the assets (you may need to add Custom Tokens too) held by your selected account on that network.

    How Much BNB You Need To Send Tokens

    if you try to send tokens without having any BNB in your account you will be told you have insufficient funds. This means you do not have enough BNB in your account to cover the cost of gas. Each transaction (including token and contract transactions) require gas and that gas is paid in BNB. You can think of this like a transaction fee.

    You can remedy this by sending 0.001 BNB to that account in order to be able to make the transaction.

    A standard Ether transfer TX will be 21000 gas & a gas price of 15 Gwei. With tokens, the amount of gas is typically gas, so the total TX fee increases to 0.002 BNB - 0.003 BNB.

    Current Gas Price

    curl --location --request POST 'https://bsc-dataseed2.bnbchain.org' \
    --header 'Content-Type: application/json' \
    --data-raw '{"jsonrpc":"2.0", "id":1, "method":"eth_gasPrice", "params": []}'
    - + diff --git a/docs/wallet/infinitywallet.html b/docs/wallet/infinitywallet.html index 9c4817e4d7..86f6fff026 100644 --- a/docs/wallet/infinitywallet.html +++ b/docs/wallet/infinitywallet.html @@ -8,13 +8,13 @@ - +

    Using Infinity Wallet on the BNB Smart Chain

    What is it?

    Infinity Wallet is the ultimate easy to use, secure, multicurrency, practical and convenient self-custodial cryptocurrency wallet, that provides all a user will ever need in one platform. With a wide range of new and innovative features to access digital assets, empowering financial freedom.

    Advancing the world of decentralized finance with an all-in-one digital wallet experience and streamlining adoption of cryptocurrency. Infinity Wallet is packed with a wealth of features and designed for the best possible user experience. With a simple and modular interface allowing to interact, monitor, trade, transact, view news and much more in a secure environment, as the one-stop application that a user will ever need for decentralized finance.

    Connect to DeFi protocols and Dapps directly on desktop or mobile from within the Infinity Wallet, to securely use decentralized platforms without compromising your assets. Providing enhanced ease of use and security, as well as support for multiple chains.

    Install Infinity Wallet

    Go to https://infinitywallet.io to install the most recent version of the Infinity Wallet.

    The Infinity Wallet is currently available to be downloaded for desktop devices on Windows, macOS and Linux. In the coming months there will be a mobile wallet released to accompany our revolutionary desktop wallet.

    img

    Launch the Infinity Wallet to create your local account and wallet

    • Create a local account, you can name this anything as the account name is only used locally within your own device

    img

    • Create a password for your local account and confirm your password

    img

    • Select to either create a new wallet or recover an existing wallet (You can import your 12 or 24 word seed phrase from most other wallets into the Infinity Wallet as we follow the standard)

    img

    • Give your wallet a name so you can easily identify it within your local account

    img

    • If you would like to have additional security, you can create an individual pin for each of your wallets (This is optional)

    img

    • Select if you want to use a 12 or 24 word seed

    img

    • You will now need to confirm that you understand that you have to backup your 12 or 24 word seed to be able to recover your wallet. We recommend keeping your seed phrase offline and somewhere secure (Never share your seed with anyone, including the Infinity Wallet support team)

    img

    • Make a backup of the words on the screen, we recommend making a paper backup and not an online backup. If you ever lose access to your computer or forget your password, you will need your 12 or 24 word seed to recover your wallet (Keep these words secure and never share them with anyone, as these words grant full access to your wallet)

    img

    • Confirm a selection of the words in the correct order as requested, to generate your wallet

    img

    • Congratulations you have successfully created your Infinity Wallet and can now access the vast array of features it has to offer

    img

    Using BNB Smart Chain

    • Now that you have created your wallet you can monitor and manage a wide range of different cryptos within the Infinity Wallet, including BNB and BNB Smart Chain Tokens

    img

    Receive BNB on the BNB Smart Chain

    • To receive BNB on the BNB Smart Chain you will have to enable it by going to My Wallet and clicking on + Add asset, then select to enable BNB Coin (BSC). All BSC tokens on the Infinity Wallet will use the same address as BNB BSC

    img

    • Now that BNB Coin (BSC) is enabled go back to My Wallet and select BNB Coin (BSC), to get your receive adddress click on the receive button

    img

    • Copy your receive address by clicking on it, or select one of the options to print, share or request an amount to generate a decentralized link to request funds

    img

    Send BNB on the BNB Smart Chain

    • To send go to My Wallet, select BNB Coin (BSC) and then click on the send button

    img

    • Either enter an address to send to, select from your contact list, or scan a QR request by importing, scanning with a webcam, or using our drag and scan desktop technology

    img

    • If you select to use the drag and scan QR technology, then all you need to do is drag the window over a QR code you have been shared and it will automatically detect the address and fill it in for you as the send address

    img

    • Enter the amount of the coin you want to send

    img

    • Confirm the details of your send

    img

    • Congratulations you have successfully sent

    img

    Connect to DeFi Platforms and Dapps

    Infinity Wallet supports the ability for users to connect securely to decentralized application on the BNB Smart Chain, BNB Beacon Chain and Ethereum.

    To connect your wallet make sure the platform you are connecting to supports Wallet Connect, then go to your Infinity Wallet and click WalletConnect in the bottom left corner.

    • In the popup that will show you can select one of 3 options to connect, the recommended and easiest option will be to use the "Desktop Scan" which uses our drag and scan desktop technology

    img

    • Drag and resize the desktop QR scanner over the QR you want to scan, in this case we will be connecting to Infinity Crypto (https://infinitycrypto.com/)

    img

    • Approve the connection between the platform and your wallet. All transactions on the platform will be pushed to be confirmed and signed within the Infinity Wallet, ensuring your keys are never shared and providing maximum security while interacting with Dapps and DeFi

    img

    • After sucessfully approving the connection between the Infinity Wallet and the Dapp or DeFi platform, you will see that the WalletConnect icon in the bottom left of the Infinity Wallet will be green, signifying that your wallet is now connected to the Dapp or DeFi platform

    img

    img

    • Congratulations you can now start interacting with the Dapp or DeFi platform and confirming all transactions securely from the safety of your Infinity Wallet

    img

    • On creating a transaction on the Dapp or DeFi platform you will receive a popup request within your Infinity Wallet to send, sign or approve a transaction. You can review the information of the transaction and either accept or decline it

    img

    • After confirming an interaction, the Infinity Wallet will sign the transaction and push it over the network, without revealing your key to the platform you are interacting with. Within the Infinity Wallet and on the Platform you should see a success message that the transaction was signed and pushed

    img

    The Infinity Wallet is aiming to push crypto innovation to its limits and has a wide range of future features and UI enhancements on the roadmap, to further expedite global adoption of cryptocurrency. Along with its companion platform Infinity Crypto, which is revolutionizing the DeFi and exchange space on BNB Smart Chain and Ethereum.

    - + diff --git a/docs/wallet/ledger.html b/docs/wallet/ledger.html index b4f130f21f..963ad55066 100644 --- a/docs/wallet/ledger.html +++ b/docs/wallet/ledger.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ The existing Ethereum App is compatible with BNB Smart Chain

    1) Plug in and unlock your Ledger device, open Ledger Live on your computer, then open the "Manager" panel.

    img

    2) Within the "Manager" pane, type in "Ethereum" in the search field. Locate "Ethereum", then click on "Install". (Note: Do not use the "BNB Chain" App)

    img

    img

    3) The Ethereum app will now install on your Ledger device.

    img

    Enabling contract data for BEP20

    !!! Tip Please ensure your enabled contract data before transferring BEP20 tokens If you want to send BEP-20 tokens, you need to activate contract data on your device. Otherwise, invalid status 6a80 is returned.

    Steps:

    • Connect and unlock your Ledger device.
    • Open the Ethereum application.
    • Press the right button to navigate to Settings. Then press both buttons to validate.
    • In the Contract data settings, press both buttons to allow contract data in transactions.
    • The device displays Allowed.

    Connect with MetaMask

    BNB Smart Chain is compatible with MetaMask. Users can use MetaMask as a bridge between Ledger Nano S and BNB Smart Chain to make transactions to the BNB Smart Chain testnet.

    1) Connect MetaMask to BSC Testnet by following this guide to add a custom network

    Unlock your Metamask

    img

    Click on “Connect Hardware Wallet”

    img

    Choose “Ledger”

    img

    Choose your address

    img

    You should see a new account

    img

    Please read this doc to learn about how to interact with blockchain.

    With Ledger, you need to approve your transaction in your device.

    Initiate a transfer transaction, then click on next

    img

    Review the transaction details, then confirm the same info on Ledger device

    img

    You can view the transaction info and confirm it on Ledger:

    img

    11) Once the transaction is ready to get signed, your Ledger device will display this screen. Click on both buttons for broadcasting this transaction.

    img

    12) Track the transaction status in “Activity” tab

    img

    FAQ

    1. Fail to transfer BEP20 tokens

    Error message:

     '{"value":{"code":-32603,"message":"Error: TransportStatusError: Ledger device: Invalid data received (0x6a80)"}}'

    You need to follow the steps mentioned above to enable contract data.

    - + diff --git a/docs/wallet/math-resource.html b/docs/wallet/math-resource.html index d61f6fb155..655c9d45da 100644 --- a/docs/wallet/math-resource.html +++ b/docs/wallet/math-resource.html @@ -8,13 +8,13 @@ - +
    - + diff --git a/docs/wallet/math.html b/docs/wallet/math.html index 22111abd50..014d66c012 100644 --- a/docs/wallet/math.html +++ b/docs/wallet/math.html @@ -8,15 +8,15 @@ - +

    How to use Math Wallet for BNB Smart Chain

    Install

    1. Get App from Chrome web store

      img
    2. Add to your browser, for example, Brave

      img
    img

    Setup Your Wallet

    1. Set your password

    2. img
    3. Choose BSC network

    img
    1. Choose BNB Smart Chain from this list
    img
    1. Create Your Wallet
    imgimg
    1. Save your private key
    img

    It’s ready, and now you can get some testnet BNB from the faucet.

    Get Testnet Fund

    1. Copy your address.
    img
    1. Go to https://testnet.binance.org/faucet-smart/

    Go to explorer to verify BNB is sent: https://testnet.bscscan.com/

    Transfer BNB from BSC to BC in Testnet

    1. Create your BNB Chain Ganges Testnet address with tbnbcli
    • Download the binary here

      If you already have a backup of your recovery phrase from BNB Chain Ganges Testnet, it can be reused here.

    tbnbcli keys add {wallet-alias}
    1. Go to this page: https://developer.mathwallet.org/bsc02/

    Go to this page for mainnet: https://developer.mathwallet.org/bsc01/

    Paste your testnet address to Recipient and fill the transfer amount. img

    Please note the fees are also deducted for paying gas and cross-chain transfer.

    1. Approve your transaction

    img

    1. Confirm Reception in explorer -Link: https://testnet-explorer.binance.org/

    Transfer BEP20 from BSC to BC in Testnet

    One of the key innovations of a dual-chain architecture is that token issuer can manage its assets on both chains. They could bind BEP2 tokens and BEP20 tokens together. In BNB Chain Ganges Testnet, there are several pegged tokens:

    You can get some of these pegged tokens from faucet and transfer them back to BNB Beacon Chain testnet.

    1. Approve this transactionimg

    2. Send BEP20 To BCimg

    - +Link: https://testnet-explorer.bnbchain.org/

    Transfer BEP20 from BSC to BC in Testnet

    One of the key innovations of a dual-chain architecture is that token issuer can manage its assets on both chains. They could bind BEP2 tokens and BEP20 tokens together. In BNB Chain Ganges Testnet, there are several pegged tokens:

    You can get some of these pegged tokens from faucet and transfer them back to BNB Beacon Chain testnet.

    1. Approve this transactionimg

    2. Send BEP20 To BCimg

    + diff --git a/docs/wallet/metamask.html b/docs/wallet/metamask.html index c5b923fcfa..e0a9589bae 100644 --- a/docs/wallet/metamask.html +++ b/docs/wallet/metamask.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ Note: Make sure it’s offered by metamask.io

    • Click on “Add to Brave”

    That’s it! You have successfully installed MetaMask extension in Brave!

    img

    !!! Tip The workflow is the same for all browsers

    Create an account in MetaMask for BNB Smart Chain

    1. Click on the “Create a wallet” button

    img

    1. Create Password of at least 8 characters
    img
    1. Click on “Create” and then write down your backup phrase.

    img

    1. Select each phrase in order to make sure it is correct then click “Confirm”.

    img

    Congratulations! you have create your MetaMask account!

    Connect Your MetaMask With BNB Smart Chain

    1. Go to setting page
    img
    1. Add a new network
    img
    1. Claim some testnet token to your account. Click on your address for copy

    img

    1. Go to faucet page: https://testnet.binance.org/faucet-smart, then paste your address in the box and click on “Give me BNB”

    !!! Tip Please note that you can only claim once every minute

    img

    After the transfer transaction is sent, you will see an increase of your balance

    img

    Transfer BNB to other BNB Smart Chain address

    1. Log in to your MetaMask
    1. Click on Send button
    img
    1. Copy the receiver’s address in the box
    img
    1. Input the amount
    img
    1. Go to Advanced Options to modify default gas price when necessary
    img
    1. Confirm your transaction, then click Next
    img
    1. Click Confirm to send your transaction
    img
    1. Wait for your transaction to be included in the new block
    img
    1. Once your transaction is confirmed, check it on block explorer by clicking Details
    img
    1. Click on your account to see "Details''
    img
    img
    1. Verify your transaction in Explorer:

    img

    Add BEP20 Tokens

    1. Deploy an ERC20 contract at https://remix.ethereum.org/

    2. You can create a new file or import a sample contract: https://gist.github.com/HaoyangLiu/3c4dc081b7b5250877e40b82667c8508

    1. Connect your BNB Smart Chain Account to Remix
    img
    1. Select “ABCToken” contract and compile

    img

    1. Deploy your compiled contract

    img

    1. Adjust Gas Fee for your contract, then confirm your deploy contract
    img
    1. You can see that there is a new create contract transaction in block explorer
    img
    1. In MetaMask, Click on “Add Token”
    img
    1. Choose “Custom Token” and copy the contract address in the box
    img
    1. Click on “Add Tokens”
    img

    Then you can see change of your balance

    imgimg

    Create Multiple Accounts

    1. To create multiple accounts, you click on Profile icon on MetaMask and then click on Create Account
    img
    1. You can then add an account name and click on Create.
    img
    1. Then you can see a new account is created!
    img

    Upgrade

    Since the release of v8.1.3, MetaMask sometimes displays the warning message "Invalid Custom Network".

    img

    To solve this issue, click on "'Settings" and enter Chain ID of BNB Smart Chain network again. If 56 doesn’t work, try 0x38.

    img

    - + diff --git a/docs/wallet/myetherwallet.html b/docs/wallet/myetherwallet.html index 65fa95d483..1a7fa1f7db 100644 --- a/docs/wallet/myetherwallet.html +++ b/docs/wallet/myetherwallet.html @@ -8,14 +8,14 @@ - + - + diff --git a/docs/wallet/staking.html b/docs/wallet/staking.html index 5de0ecc341..cb20f05475 100644 --- a/docs/wallet/staking.html +++ b/docs/wallet/staking.html @@ -8,13 +8,13 @@ - +

    Staking with Binance Extension Wallet

    How to Delegate Your BNB with the Binance Extension Wallet

    Testnet example

    img

    • Click on Connect Wallet

    img

    • Unlock your wallet

    img

    • Click on Delegate and input the amount

    img

    • Confirm your transaction in The Binance Extension wallet

    img

    • Upon Success you will see a similar output

    img

    • View your delegation overview

    img

    • You can see the staking history

    img

    How to Redelegate Your BNB with Binance Extension Wallet

    By staking your BNB, you participate in the selection process of BNB Smart Chain validators and earn rewards. Staking BNB is critical for securing the network. Validators can self-bond, meaning they can delegate BNB to themselves, and they can also receive delegations from any other BNB holders.

    Redelegations between a unique delegator, source validator, and destination validator can only happen once every 7 days.

    • Click on Redelegate

    img

    • Select a new validator and input amount to redelegate

    img

    • Confirm your transaction in the Binance Extension Wallet

    img

    • Upon Success you will see a similar output

    img

    • Refresh and see your delegation changes

    img

    How to Undelegate Your BNB with Binance Extension Wallet

    • Click on Undelegate

    img

    • Input the amount

    img

    • Confirm your transaction in the Binance Extension Wallet

    img

    • Upon Success you will see a similar output

    img

    • Refresh and see your delegation changes

    img

    - + diff --git a/docs/wallet/trezor.html b/docs/wallet/trezor.html index edd8844e91..dd26667078 100644 --- a/docs/wallet/trezor.html +++ b/docs/wallet/trezor.html @@ -8,13 +8,13 @@ - +

    Using Trezor Wallet with BNB Smart Chain

    BNB and coins on BNB Smart Chain are supported by the Trezor hardware wallet. The following describes how to use Trezor to connect to BSC.

    Requirements

    • Visit https://wallet.trezor.io and initialize your Trezor
    • Trezor Model T firmware version 2.3.0.
    • Trezor Model One firmware version 1.9.3.
    • An internet connection and an available USB port. Use an adapter for USB-C ports
    • U2F compatible browsers: Google Chrome, Opera, FireFox, Brave

    Connect with MetaMask

    BNB Smart Chain is compatible with MetaMask. Users can use MetaMask as a bridge between Trezor and BNB Smart Chain to make transactions to the BNB Smart Chain testnet.

    1) Connect MetaMask to BSC Testnet by following this guide to add a custom network

    img

    Unlock your Metamask

    img

    Click on “Connect Hardware Wallet”

    img

    Choose an address in your Trezor

    img

    You should see a new account

    img

    Transfer Guide

    Initiate a transfer transaction, then click on next

    img

    Review the transaction details, then confirm the same info in your Trezor device

    img

    Confirm the same info in your Trezor device

    img

    Track the transaction status in “Activity” tab

    img
    - + diff --git a/docs/wallet/trustwallet.html b/docs/wallet/trustwallet.html index 41f5098265..ad9d0df039 100644 --- a/docs/wallet/trustwallet.html +++ b/docs/wallet/trustwallet.html @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ img img

    Receive BNB and BEP20 tokens

    Your Smart Chain address is able to receive BNB or BEP20 tokens.

    imgimg

    • BEP20 tokens are also supported by Trust Wallet.

    imgimg

    Sending BNB to a Smart Chain address

    1. Tap on Send to initiate the transfer, then fill in Recepient address and Amount. imgimg

    2. Confirm the transaction by tapping on Send. Transaction will be done in seconds. imgimg

    Access BNB Smart Chain DApps

    1. Switching to BNB Smart Chain Network to access DApps.

    1.1 Type the URL on the built in browser in order to access a DApp.

    img img

    1.2 Tap on the ETH logon on the upper right corner to see Network options. Choose BNB Smart Chain.

    imgimg

    Trust Wallet is fully compatible with BNB Smart Chain DApps.

    More DApps will be added on the built-in browser for convenience.

    img img

    Resources:

    - + diff --git a/docs/wallet/wallet_api.html b/docs/wallet/wallet_api.html index 3752ed198b..07d1206322 100644 --- a/docs/wallet/wallet_api.html +++ b/docs/wallet/wallet_api.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ BinanceChain.transfer({fromAddress:"tbnb1sndxdzsg42jg8lc0hehx8dzzpyfxrvq937mt0w", toAddress:"tbnb1sndxdzsg42jg8lc0hehx8dzzpyfxrvq937mt0w", asset:"BUSD-BAF", amount:1, accountId:"fba0b0ce46c7f79cd7cd91cdd732b6c699440acf8c539d7e7d753d38c9deea544230e51899d5d9841b8698b74a3c77b79e70d686c76cb35dca9cac0e615628ed", networkId:"bbc-testnet"})

    Events

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('accountsChanged', (accounts) => {
    // Handle the new accounts, or lack thereof.
    // "accounts" will always be an array, but it can be empty.
    });

    BinanceChain.on('chainChanged', (chainId) => {
    // Handle the new chain.
    // Correctly handling chain changes can be complicated.
    // We recommend reloading the page unless you have a very good reason not to.
    window.location.reload();
    });

    connect

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    interface ConnectInfo {
    chainId: string;
    }

    BinanceChain.on('connect', handler: (connectInfo: ConnectInfo) => void);

    disconnect

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('disconnect', handler: (error: ProviderRpcError) => void);

    accountsChanged

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('accountsChanged', handler: (accounts: Array<string>) => void);

    chainChanged

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('chainChanged', handler: (chainId: string) => void);
    BinanceChain.on('chainChanged', (_chainId) => window.location.reload());

    message

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    interface ProviderMessage {
    type: string;
    data: unknown;
    }

    BinanceChain.on('message', handler: (message: ProviderMessage) => void);

    Errors

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    Using the Provider

    This snippet explains how to accomplish the three most common requirements for web3 sites:

    • Detect which BinanceChain network the user is connected to
    • Get the user's BinanceChain account(s)
    /**********************************************************/
    /* Handle chain (network) and chainChanged (per EIP-1193) */
    /**********************************************************/

    // Normally, we would recommend the 'eth_chainId' RPC method, but it currently
    // returns incorrectly formatted chain ID values.
    let currentChainId = BinanceChain.chainId;

    BinanceChain.on('chainChanged', handleChainChanged);

    function handleChainChanged(_chainId) {
    // We recommend reloading the page, unless you must do otherwise
    window.location.reload();
    }

    /***********************************************************/
    /* Handle user accounts and accountsChanged (per EIP-1193) */
    /***********************************************************/

    let currentAccount = null;
    BinanceChain
    .request({ method: 'eth_accounts' })
    .then(handleAccountsChanged)
    .catch((err) => {
    // Some unexpected error.
    // For backwards compatibility reasons, if no accounts are available,
    // eth_accounts will return an empty array.
    console.error(err);
    });

    // Note that this event is emitted on page load.
    // If the array of accounts is non-empty, you're already
    // connected.
    BinanceChain.on('accountsChanged', handleAccountsChanged);

    // For now, 'eth_accounts' will continue to always return an array
    function handleAccountsChanged(accounts) {
    if (accounts.length === 0) {
    // Binance Extension Wallet is locked or the user has not connected any accounts
    console.log('Please connect to Binance Extension Wallet.');
    } else if (accounts[0] !== currentAccount) {
    currentAccount = accounts[0];
    // Do any other work!
    }
    }

    /*********************************************/
    /* Access the user's accounts (per EIP-1102) */
    /*********************************************/

    // You should only attempt to request the user's accounts in response to user
    // interaction, such as a button click.
    // Otherwise, you popup-spam the user like it's 1999.
    // If you fail to retrieve the user's account(s), you should encourage the user
    // to initiate the attempt.
    document.getElementById('connectButton', connect);

    function connect() {
    BinanceChain
    .request({ method: 'eth_requestAccounts' })
    .then(handleAccountsChanged)
    .catch((err) => {
    if (err.code === 4001) {
    // EIP-1193 userRejectedRequest error
    // If this happens, the user rejected the connection request.
    console.log('Please connect to MetaMask.');
    } else {
    console.error(err);
    }
    });
    }

    Legacy API

    !!! warning You should never rely on any of these methods, properties, or events in practice.

    This section documents MetaMask's legacy provider API.

    To be compatible with existing dApps that support MetaMask, Binance Extension Wallet implements them as well, but please don't rely on them. We may deprecate them soon in the future.

    Legacy Properties

    BinanceChain.networkVersion (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.selectedAddress (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    Legacy Methods

    BinanceChain.enable() (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.sendAsync() (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    interface JsonRpcRequest {
    id: string | undefined;
    jsonrpc: '2.0';
    method: string;
    params?: Array<any>;
    }

    interface JsonRpcResponse {
    id: string | undefined;
    jsonrpc: '2.0';
    method: string;
    result?: unknown;
    error?: Error;
    }

    type JsonRpcCallback = (error: Error, response: JsonRpcResponse) => unknown;

    BinanceChain.sendAsync(payload: JsonRpcRequest, callback: JsonRpcCallback): void;

    BinanceChain.send() (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.send(
    methodOrPayload: string | JsonRpcRequest,
    paramsOrCallback: Array<unknown> | JsonRpcCallback,
    ): Promise<JsonRpcResponse> | void;

    This method behaves unpredictably and should be avoided at all costs. It is essentially an overloaded version of BinanceChain.sendAsync().

    BinanceChain.send() can be called in three different ways:

    // 1.
    BinanceChain.send(payload: JsonRpcRequest, callback: JsonRpcCallback): void;

    // 2.
    BinanceChain.send(method: string, params?: Array<unknown>): Promise<JsonRpcResponse>;

    // 3.
    BinanceChain.send(payload: JsonRpcRequest): unknown;

    You can think of these signatures as follows:

    1. This signature is exactly like BinanceChain.sendAsync()

    2. This signature is like an async BinanceChain.sendAsync() with method and params as arguments, instead of a JSON-RPC payload and callback

    3. This signature enables you to call the following RPC methods synchronously:

      • eth_accounts
      • eth_coinbase
      • eth_uninstallFilter
      • net_version

    Legacy Events

    close (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('close', handler: (error: Error) => void);

    chainIdChanged (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('chainChanged', handler: (chainId: string) => void);

    networkChanged (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('networkChanged', handler: (networkId: string) => void);

    notification (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('notification', handler: (payload: any) => void);
    - + diff --git a/docs/wallet/withdraw-cn.html b/docs/wallet/withdraw-cn.html index 35ffd3b95c..1bb75b7195 100644 --- a/docs/wallet/withdraw-cn.html +++ b/docs/wallet/withdraw-cn.html @@ -8,13 +8,13 @@ - +

    如何找回您提现BEP20 而误选ERC20 的Token?

    背景

    在提币的过程中,因为ERC20 和 BEP20的地址规则是一样的,用户很可能充值 以太坊的ERC20 上,如果您误选了ERC20,并且已经在metamask钱包中导入了BSC主网账号的情况下,可以通过下面的步骤把token找回来:

    步骤

    • 网络类型切换为太坊主网

    img

    • 点击Add Token

    img

    • 选择添加您提现时的币种,如USDT

    img

    • 添加后,提现的币就在您这个账号里

    img

    • 重新充值

    你通过 metamask重新充值回币安主站,注意:充值方式是 ERC20

    - + diff --git a/docs/wallet/withdraw-en.html b/docs/wallet/withdraw-en.html index cd0d6fb033..2f035a4fec 100644 --- a/docs/wallet/withdraw-en.html +++ b/docs/wallet/withdraw-en.html @@ -8,14 +8,14 @@ - +

    How to recover if you choose the wrong network type?

    Background

    Since BNB Smart Chain and Ethereum follow the same address generation algorithm. In some cases, users may mistakenly choose the wrong network type when withdrawing tokens to BNB Smart Chain network.

    Steps to Recover

    • Metamask Setup Import the account into Metamask using user’s recovery phrase of BSC

    img

    • Switch to Ethereum Mainnet

    img

    • Click on “Add Token”

    img

    • Input your token name, for example

    img

    • Then you can see your balance of this token

    img

    • Then you have to deposit to Binance.com again. Please note you have to choose the ERC20 type for deposit
    - + diff --git a/docs/wallet_api.html b/docs/wallet_api.html index 58c46e1ec0..3305cd4c5c 100644 --- a/docs/wallet_api.html +++ b/docs/wallet_api.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ BinanceChain.transfer({fromAddress:"tbnb1sndxdzsg42jg8lc0hehx8dzzpyfxrvq937mt0w", toAddress:"tbnb1sndxdzsg42jg8lc0hehx8dzzpyfxrvq937mt0w", asset:"BUSD-BAF", amount:1, accountId:"fba0b0ce46c7f79cd7cd91cdd732b6c699440acf8c539d7e7d753d38c9deea544230e51899d5d9841b8698b74a3c77b79e70d686c76cb35dca9cac0e615628ed", networkId:"bbc-testnet"})

    Events

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('accountsChanged', (accounts) => {
    // Handle the new accounts, or lack thereof.
    // "accounts" will always be an array, but it can be empty.
    });

    BinanceChain.on('chainChanged', (chainId) => {
    // Handle the new chain.
    // Correctly handling chain changes can be complicated.
    // We recommend reloading the page unless you have a very good reason not to.
    window.location.reload();
    });

    connect

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    interface ConnectInfo {
    chainId: string;
    }

    BinanceChain.on('connect', handler: (connectInfo: ConnectInfo) => void);

    disconnect

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('disconnect', handler: (error: ProviderRpcError) => void);

    accountsChanged

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('accountsChanged', handler: (accounts: Array<string>) => void);

    chainChanged

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('chainChanged', handler: (chainId: string) => void);
    BinanceChain.on('chainChanged', (_chainId) => window.location.reload());

    message

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    interface ProviderMessage {
    type: string;
    data: unknown;
    }

    BinanceChain.on('message', handler: (message: ProviderMessage) => void);

    Errors

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    Using the Provider

    This snippet explains how to accomplish the three most common requirements for web3 sites:

    • Detect which BinanceChain network the user is connected to
    • Get the user's BinanceChain account(s)
    /**********************************************************/
    /* Handle chain (network) and chainChanged (per EIP-1193) */
    /**********************************************************/

    // Normally, we would recommend the 'eth_chainId' RPC method, but it currently
    // returns incorrectly formatted chain ID values.
    let currentChainId = BinanceChain.chainId;

    BinanceChain.on('chainChanged', handleChainChanged);

    function handleChainChanged(_chainId) {
    // We recommend reloading the page, unless you must do otherwise
    window.location.reload();
    }

    /***********************************************************/
    /* Handle user accounts and accountsChanged (per EIP-1193) */
    /***********************************************************/

    let currentAccount = null;
    BinanceChain
    .request({ method: 'eth_accounts' })
    .then(handleAccountsChanged)
    .catch((err) => {
    // Some unexpected error.
    // For backwards compatibility reasons, if no accounts are available,
    // eth_accounts will return an empty array.
    console.error(err);
    });

    // Note that this event is emitted on page load.
    // If the array of accounts is non-empty, you're already
    // connected.
    BinanceChain.on('accountsChanged', handleAccountsChanged);

    // For now, 'eth_accounts' will continue to always return an array
    function handleAccountsChanged(accounts) {
    if (accounts.length === 0) {
    // Binance Extension Wallet is locked or the user has not connected any accounts
    console.log('Please connect to Binance Extension Wallet.');
    } else if (accounts[0] !== currentAccount) {
    currentAccount = accounts[0];
    // Do any other work!
    }
    }

    /*********************************************/
    /* Access the user's accounts (per EIP-1102) */
    /*********************************************/

    // You should only attempt to request the user's accounts in response to user
    // interaction, such as a button click.
    // Otherwise, you popup-spam the user like it's 1999.
    // If you fail to retrieve the user's account(s), you should encourage the user
    // to initiate the attempt.
    document.getElementById('connectButton', connect);

    function connect() {
    BinanceChain
    .request({ method: 'eth_requestAccounts' })
    .then(handleAccountsChanged)
    .catch((err) => {
    if (err.code === 4001) {
    // EIP-1193 userRejectedRequest error
    // If this happens, the user rejected the connection request.
    console.log('Please connect to MetaMask.');
    } else {
    console.error(err);
    }
    });
    }

    Legacy API

    !!! warning You should never rely on any of these methods, properties, or events in practice.

    This section documents MetaMask's legacy provider API.

    To be compatible with existing dApps that support MetaMask, Binance Extension Wallet implements them as well, but please don't rely on them. We may deprecate them soon in the future.

    Legacy Properties

    BinanceChain.networkVersion (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.selectedAddress (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    Legacy Methods

    BinanceChain.enable() (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.sendAsync() (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    interface JsonRpcRequest {
    id: string | undefined;
    jsonrpc: '2.0';
    method: string;
    params?: Array<any>;
    }

    interface JsonRpcResponse {
    id: string | undefined;
    jsonrpc: '2.0';
    method: string;
    result?: unknown;
    error?: Error;
    }

    type JsonRpcCallback = (error: Error, response: JsonRpcResponse) => unknown;

    BinanceChain.sendAsync(payload: JsonRpcRequest, callback: JsonRpcCallback): void;

    BinanceChain.send() (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.send(
    methodOrPayload: string | JsonRpcRequest,
    paramsOrCallback: Array<unknown> | JsonRpcCallback,
    ): Promise<JsonRpcResponse> | void;

    This method behaves unpredictably and should be avoided at all costs. It is essentially an overloaded version of BinanceChain.sendAsync().

    BinanceChain.send() can be called in three different ways:

    // 1.
    BinanceChain.send(payload: JsonRpcRequest, callback: JsonRpcCallback): void;

    // 2.
    BinanceChain.send(method: string, params?: Array<unknown>): Promise<JsonRpcResponse>;

    // 3.
    BinanceChain.send(payload: JsonRpcRequest): unknown;

    You can think of these signatures as follows:

    1. This signature is exactly like BinanceChain.sendAsync()

    2. This signature is like an async BinanceChain.sendAsync() with method and params as arguments, instead of a JSON-RPC payload and callback

    3. This signature enables you to call the following RPC methods synchronously:

      • eth_accounts
      • eth_coinbase
      • eth_uninstallFilter
      • net_version

    Legacy Events

    close (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('close', handler: (error: Error) => void);

    chainIdChanged (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('chainChanged', handler: (chainId: string) => void);

    networkChanged (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('networkChanged', handler: (networkId: string) => void);

    notification (DEPRECATED)

    Please refer to MetaMask Doc, the only difference is we injected a different object.

    BinanceChain.on('notification', handler: (payload: any) => void);
    - + diff --git a/docs/wallets.html b/docs/wallets.html index ac9b8b860f..f131bb09e4 100644 --- a/docs/wallets.html +++ b/docs/wallets.html @@ -8,13 +8,13 @@ - +

    Wallet Support

    • List of Wallets Supporting BNB Beacon Chain Mainnet
    NumberWallet NameWebsiteDEX Feature AvailableTestnet SupportWalletConnect Support
    1Trust Wallethttps://trustwallet.com/YesYesYes
    2Trubi Wallethttps://trubi.io/YesNoYes
    3Ledgerhttps://www.ledger.com/Yes, via Binance.org and TrubiYes, via Binance.org and TrubiYes, via Binance.org and Trubi
    4CoolWallet (Hardware Wallet)https://coolwallet.io/Yes, via Binance.org and TrubiYes, via Binance.org and TrubiYes, via Binance.org and Trubi
    5Enjinhttps://enjinwallet.io/NoNoNo
    6Coinomi Wallethttp://coinomi.com/YesNoYes
    7Atomic Wallethttps://atomicwallet.io/NoNoYes
    8Math Wallethttps://www.mathwallet.org/en/YesNoYes
    9Ellipal Wallethttps://www.ellipal.com/YesNoNo
    10Exodushttps://www.exodus.io/NoNoNo
    11Guarda Wallethttps://guarda.co/NoNoNo
    12DDEX Wallethttps://ddex.io/YesNoNo
    13Pundi X Wallethttps://pundix.com/NoNoNo
    14SafePal Wallet (Hardware Wallet)https://www.safepal.ioYesNoYes
    15Zengo Wallethttps://zengo.com/NoNoNo
    16TokenPocket Wallethttps://www.tokenpocket.pro/NoNoYes
    17Cobo Wallethttps://cobo.com/NoNoYes
    18Midas Wallethttps://www.midasprotocol.ioNoNoNo
    19Cosmostation Wallethttps://www.cosmostation.io/NoNoNo
    20Trezorhttps://trezor.io/NoNoYes
    21Mixinhttps://mixin.oneNoNoNo
    22Ownbithttps://ownbit.ioNoNoNo
    23Frontierhttps://frontierwallet.com/NoYesNo
    24Infinity Wallet (Desktop Wallet)https://infinitywallet.io/YesNoYes
    25BitKeep Wallet (App & Chrome)https://bitkeep.com/YesNoYes
    26imToken (App)https://token.imYesYesYes
    - + diff --git a/docs/wallets/tutorial/BSCimToken.html b/docs/wallets/tutorial/BSCimToken.html index 09c02a911e..0a1a98b205 100644 --- a/docs/wallets/tutorial/BSCimToken.html +++ b/docs/wallets/tutorial/BSCimToken.html @@ -8,14 +8,14 @@ - +

    How to use BNB Smart Chain (BSC) on imToken?

    An introduction on how to start with using BSC on the imToken wallet

    How to Download the imToken Wallet?

    1. To get started, download imToken wallet via our official website token.im, the Apple App Store or Google Play.

    2. Android phone users best download via Google Play or the official website.

    3. Make sure to download the official, genuine App, since there are scammers out there providing fake apps.

    4. Apple users can use the App Store. Here as well, please double check the app developer being IMTOKEN PTE.LTD. Be aware of scam apps. img

    How to Create an imToken Identity Wallet?

    1. Open imToken, click "Create Identity" and click to agree to the terms of service.

    2. Fill in your identity name and wallet password. Next, click "Create", copy the backup mnemonic phrase with pen and paper and keep it in a safe place. Confirm the mnemonic words in order again and click "Next" to successfully create a wallet.

    What is BSC?

    BSC is the abbreviation of BNB Smart Chain. The chain adopts PoSA (Proof of Staked Authority), which means holders of BNB (BSC's native token) vote to select 50 validators that are responsible for on-chain transaction verification and block production.

    Since BSC is EMV-compatible, developers can easily deploy smart contracts and build DApps on the chain. Compared with Ethereum, BSC has lower gas fees and faster transaction settlement with lower security guarantees.

    With imToken wallet, we do not only support BSC DApps and watching token balances but also the DeFi Portfolio feature, providing a holistic BSC experience.

    How to start using BSC in imToken?

    Switch to BSC

    Open imToken's ETH wallet and click "Ethereum Mainnet" under "Wallet" to enter the network switching page, and select "BNB Smart Chain".

    After the switch is successful, you can transfer and collect funds on the BSC chain in imToken, and experience its ecosystem DApps.

    img

    Receiving a Payment via BSC on imToken

    Click "Receipt", copy the address or payment code and send it to the other party.

    img

    Transferring via BSC on imToken

    Click "Transfer", enter the payment address and amount, and then click "Next" to make the payment.

    img

    Ecosystem Applications

    Click on "Ecosystem Applications" on the asset homepage to view and experience recent popular DApps on the BSC chain.

    img

    How to Send Funds from Binance to your imToken Wallet

    To withdraw BSC assets from Binance to imToken, you can follow the steps below. We use the BNB token as an example.

    Click on the wallet address, enter the payment page, and click "Copy".

    img

    Open Binance, click "Funds"-"Withdraw", select "BNB" or other BSC-supported assets.

    img

    Select "BEP20 (BSC)" in "Network", paste the copied address, and enter the withdrawal password to proceed with withdrawal. Make sure it’s the correct address.

    img

    Withdraw coins from imToken wallet to Binance Exchange

    If you want to recharge assets on BSC from imToken to Binance Exchange, you can follow the steps below, here is BNB as an example.

    Enter Binance Exchange, click "Assets"-"Recharge", select "BNB" or other BSC-supported assets.

    img

    Select "BEP20 (BSC)" in "Network" and click to copy the BNB recharge address.

    img

    On the asset page, click BNB to enter the transfer page, click "Transfer", paste Binance's recharge address, enter the withdrawal amount, and click "Next" to complete the transfer after paying the miner's fee.

    img

    Learn more: https://token.im

    Risk Warning: The content of this article does not constitute any form of investment advice or recommendation. imToken does not make any guarantees and promises for the third-party services and products mentioned in this article, nor assume any responsibility. Digital asset investment has risks. You should carefully evaluate these investment risks and consult with relevant professionals to make your own decisions.

    - + diff --git a/docs/wallets/tutorial/bep8.html b/docs/wallets/tutorial/bep8.html index ddd9395316..efebb9fc4a 100644 --- a/docs/wallets/tutorial/bep8.html +++ b/docs/wallets/tutorial/bep8.html @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ img
  • Burn Tokens Click on Burn button and input amount img
  • - + diff --git a/docs/wallets/tutorial/how-to-create-a-wallet-on-trustwallet.html b/docs/wallets/tutorial/how-to-create-a-wallet-on-trustwallet.html index b926c25a15..78f567aab4 100644 --- a/docs/wallets/tutorial/how-to-create-a-wallet-on-trustwallet.html +++ b/docs/wallets/tutorial/how-to-create-a-wallet-on-trustwallet.html @@ -8,7 +8,7 @@ - + @@ -24,7 +24,7 @@ 30+ Blockchains, including Bitcoin, Ethereum, BNB, XRP and many more.
    Exchange these cryptocurrencies with our upcoming coin swap function and buy Bitcoin, Ethereum and more with your credit card.

    img

    - + diff --git a/docs/wallets/tutorial/how-to-trade-on-binance-dex.html b/docs/wallets/tutorial/how-to-trade-on-binance-dex.html index e1f3665b7b..2add911dfb 100644 --- a/docs/wallets/tutorial/how-to-trade-on-binance-dex.html +++ b/docs/wallets/tutorial/how-to-trade-on-binance-dex.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    How to Trade on Binance DEX

    1) Go to www.binance.org

    Click on "Start Trading"

    img

    2) Click "Unlock wallet" on the top right navigation bar

    img

    The recommended way for unlocking is by WalletConnect or Ledger.

    img

    If you use Ledger, please select the address you want to use for this session.

    img

    After unlocking your wallet, make sure that your balance is correct by clicking the "Balance" button on the navigation bar. Then, you will go to: https://www.binance.org/en/balances

    img

    img

    3) Go to trading page

    You can see that there are multiple trading pairs.
    In this example, we use $ONE https://www.binance.org/en/trade/ONE-5F9_BNB

    img

    4) Place your order (Found on the bottom right of the page)

    img

    At the moment, Binance DEX only supports Limit Orders.

    img

    You can use the "Best Ask" to input the minimum price that you can currently buy for.
    You use the "Best Bid" to input the highest price that you can currently sell for.

    img

    • "Price" - The number of tokens per token that you are willing to buy / sell for. "Price" can only be changed with "Tick Size". For $ONE, the tick size is 0.00000001
    • "Amount" the number of tokens you wish to buy / sell. "Amount" can only be changed with "Lot Size". For $ONE, the lot size is 10.
    • "25% / 50% / 75% / 100%" This will allocate the selected percentage of your funds to either be sold or used to buy.

    For example on the buy side if you want to buy 100$ONE and your limit price is 0.0006625. Then, the total notional for this order is 0.06625.

    img

    Click "Buy ONE" Confirm the submission of your order.

    Common Error

    • "Not enough balance" A common error that will occur if the number of tokens required to execute the order is more than the total number of tokens displayed in your "Total" balance.

    img

    • Price warning - if the price you inputted an order at is above 2% higher than the latest market price then you will be notified. Proceed with caution.

    img

    Confirming a trade on a Ledger Wallet

    img

    You can view the transaction info and confirm it on Ledger:

    img

    "Limit Buy / Sell order created"

    A note will pop up on the right corner of your screen after you confirmed your order.

    img

    5) Verifying your order was created and placed

    Once you made an order, you can see that in your order history on the first tab at the bottom left of the page.

    img

    Once filled you can view your completed trades under "Order History" on the second tab at the bottom left of the page.

    img

    To check wallet balance click the "Balance" button

    img

    6) Cancelling open orders

    To cancel an order that has either not been filled or has only been partially filled you can click on the "X" at the right side of the "Open Orders" tab on the bottom right of the screen.

    img

    - + diff --git a/docs/wallets/tutorial/ledger-nano-s-usage-guide.html b/docs/wallets/tutorial/ledger-nano-s-usage-guide.html index 13abd152ec..095856fd6d 100644 --- a/docs/wallets/tutorial/ledger-nano-s-usage-guide.html +++ b/docs/wallets/tutorial/ledger-nano-s-usage-guide.html @@ -8,7 +8,7 @@ - + @@ -19,7 +19,7 @@ If it is, the installation has been successful.

    img

    Setup/Login Instructions

    6) Go to www.binance.org

    Go to "Unlock wallet" page.

    Choose "Ledger Device" and verify your address.

    img

    Choose one address to use for this session and click on "Confirm".
    You will then be redirected to the Trading Interface.

    img

    For your security, please read the information displayed in the following popup and confirm that the address shown on your Ledger device matches the one shown on-screen.
    Press the right button on your device to confirm that the address matches (You must do this to continue).

    How to send BNB Beacon Chain crypto assets

    Confirming a trade on a Ledger Wallet:

    img

    You can view the transaction info and confirm it on Ledger:

    img

    Once the transaction has successfully been signed and broadcasted, your Ledger device will display this screen.

    img

    - + diff --git a/docs/wallets/tutorial/trezor-model-t-user-guide.html b/docs/wallets/tutorial/trezor-model-t-user-guide.html index 0e2c64f4c1..2379d3d20e 100644 --- a/docs/wallets/tutorial/trezor-model-t-user-guide.html +++ b/docs/wallets/tutorial/trezor-model-t-user-guide.html @@ -8,7 +8,7 @@ - + @@ -16,7 +16,7 @@

    Trezor User Guide

    This guide will show you how to use your Trezor Model T hardware wallet with BNB Beacon Chain and Binance DEX. Please follow best security practices when using any hardware wallet to store cryptocurrency.

    Please note that the Trezor Model One is not supported yet.

    Requirements

    In order to use a Trezor with BNB Beacon Chain and Binance DEX, you will need:

    • A supported web browser: Chrome or Firefox
    • Access to the Binance Extension Web Wallet (https://binance.org/unlock) using your web browser
    • An initialized Trezor Model T device with the most recent firmware updates installed
    • The Trezor Bridge application installed on your computer

    App Installation Instructions

    1. Install Trezor Bridge

    Please make sure that you have bridge installed on your computer.

    img

    1. Install the firmware

    Please make sure your Trezor has the latest firmware installed.

    img

    1. Generate and backup your address

    Please make sure that you have seed phrase backed up.

    imgimg

    Setup/Login Instructions

    1. Open Binance Extension Web Wallet (www.binance.org), then go to unlock page. You should see that Trezor is already an option for you.

    img

    1. Allow access to your device:

    img

    1. Export Binance address for account #1

    img

    1. Get your address for this device

    img

    1. Confirm your address on Trezor

    img

    Please note that Trezor only supports the BNB Beacon Chain mainnet

    1) Click on the “Balances” navigation button in the Trading Interface to view your account balances.

    img

    2) Your account balances are displayed.

    img

    How to send BNB Beacon Chain crypto assets

    1) Click on the “Balances” navigation button in the Trading Interface to view your account balances.

    img

    2) Then click on the “Send” button for the asset that you would like to send.

    img

    3) Confirm to give permission img

    4) Check details about this transaction

    img

    5) You’ll see this pop-up to ask to hold the screen to sign the transaction on your Trezor.

    img

    How to trade BNB Beacon Chain crypto assets

    1) You can place your order on trading page

    img

    2) Confirm to give permission

    img

    3) Check details about this transaction

    img

    4) You’ll see this pop-up to ask to hold the screen to sign the transaction on your Trezor.

    img

    Reference: https://wiki.trezor.io/User_manual

    - + diff --git a/docs/wallets/tutorial/videos.html b/docs/wallets/tutorial/videos.html index 2eb481ee41..67ac36e07d 100644 --- a/docs/wallets/tutorial/videos.html +++ b/docs/wallets/tutorial/videos.html @@ -8,13 +8,13 @@ - +
    - + diff --git a/docs/wallets/wallet-tutorial-overview.html b/docs/wallets/wallet-tutorial-overview.html index f61654fa80..f30be7349e 100644 --- a/docs/wallets/wallet-tutorial-overview.html +++ b/docs/wallets/wallet-tutorial-overview.html @@ -8,13 +8,13 @@ - +

    Tutorials on Using Third-Party Wallets on BNB Smart Chain

    BNB Smart Chain offers extensive support of third-party wallets that can be used for sending/receiving/buying/exchanging/staking BNB Tokens. Below we provide a list of the most popular wallets.

    BNBChain List is a list of BSC-related networks, including BNB Smart Chain (BSC) and its Application Sidechains (BAS). Users can use the information to connect their wallets and Web3 middleware providers to the appropriate Chain ID and Network ID to connect to the correct chain.

    WalletTutorial Link
    Binance Extension WalletHow to use Binance Extension Wallet with BNB Smart Chain
    Staking with Binance Extension WalletHow to Stake BNB Tokens using Binance Extension Wallet
    Trust WalletHow to use Trust Wallet with BNB Smart Chain
    MetamaskHow to use Metamask with BNB Smart Chain
    Alpha WalletHow to use Alpha Wallet with BNB Smart Chain
    Arkane WalletHow to use Arkane Wallet with BNB Smart Chain
    Coin98 WalletHow to use Coin98 Wallet with BNB Smart Chain
    ezDeFi WalletHow to use ezDeFi with BNB Smart Chain
    Infinity WalletHow to use Infinity Wallet with BNB Smart Chain
    Ledger Nano S Hardware WalletHow to use Ledger Nano S Hardware Wallet with BNB Smart Chain
    Math WalletHow to use Math Wallet with BNB Smart Chain
    MyEtherWalletHow to use Metamask with BNB Smart Chain
    Trezor WalletHow to use Metamask with BNB Smart Chain
    imtokenHow to use imToken with BNB Smart Chain
    - + diff --git a/docs/wallets/walletconnect-support.html b/docs/wallets/walletconnect-support.html index 233cc1d141..72194cbf6d 100644 --- a/docs/wallets/walletconnect-support.html +++ b/docs/wallets/walletconnect-support.html @@ -8,13 +8,13 @@ - +
    - + diff --git a/index.html b/index.html index 9b8f21ce68..9b1cf568e7 100644 --- a/index.html +++ b/index.html @@ -8,13 +8,13 @@ - +
    - + diff --git a/markdown-page.html b/markdown-page.html index 25b34ae768..9677845607 100644 --- a/markdown-page.html +++ b/markdown-page.html @@ -8,13 +8,13 @@ - +

    Markdown page example

    You don't need React to write simple standalone pages.

    - + diff --git a/search.html b/search.html index 7598cae042..c877bc6056 100644 --- a/search.html +++ b/search.html @@ -8,13 +8,13 @@ - +

    Search the documentation

    - +