Polkabtc Project
Participate in the BTC cross-chain project
Opening
Reasons for choosing to support this project:
- believe in BTC
- believe in PolkaDot
- we need decentralized exchange
Project description
PolkaBTC Project is a parallel chain built on PolkaDot to bridge the BTC Chain, using the XCLAIM protocol to bridge BTC across the chain to the PolkaDot ecosystem, with a token named PolkaBTC, with BTC assets locked to the BTC chain and minted in the Polkadot system at a PolkaBTC is a token anchored to BTC in a 1:1 ratio in the Polkadot system. PolkaBTC is able to convert between parallel chains like all native tokens in the PolkaDOT ecosystem, and there is no risk of centralization in the PolkaBTC bridging project, like companies, communities, and individuals can all participate in running BTC parallel chains.
Components
-
XCLAIM (BTC,DOT)
This component implements four application protocols, issue, transfer, redeem, replace, maintaining the entire PolkaBTC token system.
-
BTC-Relay
This component is used to check and confirm transactions that occur on the BTC chain. For example, when a user minted a new PolkaBTC token, an equal amount of BitCoins will be locked on the BTC chain, after which the user’s transaction record can be captured and confirmed by the BTC-Relay component.
As you can observe from the above image, User -> (lock Bitcoin) -> BTC-Relay -> verify-Transaction -> XCLAIM -> Issue-PolkaBTC
User locks BTC, BTC-Relay verifies the locked transaction and saves the BTC block header, XCLAIM minting the anchor coin PolkaBTC, and user gets the unlocked BTC anchor coin PolkaBTC.
Let’s look at the actual flow chart of XCLAIM:
-
(Issue) the user will call Bitcoin to Vault (we can think of it as a decentralized banking system), Vault received the user to call the asset, will lock the asset, and notify the smart contract in the PolkaBTC system to confirm the transaction, if the confirmation passed, the user will get the BTC equivalent of PolkaBTC Token. 2.
-
(Transfer & Swap) exchange and forward tokens, the sender and receiver only need to do this operation through the smart contract.
-
(Redeem) The user redeems the corresponding BitCoin, the user requests an unlock operation to the smart contract, the smart contract receives the unlock event and requests Vault to unlock the corresponding BitCoin, Vault confirms that it can be unlocked, and finally the user will receive the BitCoin and will destroy the corresponding equivalent amount of PolkaBTC Token.
Participant
-
Vaults You can call them Vaults, similar to the centralized banks in our life, except it is decentralized. To run Vaults you need to pledge a certain number of DOT tokens, they receive and hold BitCoin from the user of the transaction, and when the user needs to destroy the PolkaBTC Token, the Vault will unlock the corresponding BitCoin and send it to the address of the corresponding user.
-
Users Users include, requesters (pledging BitCoin, wishing to receive PolkaBTC), senders and receivers, and redeemers.
-
Staked Relayers Staked Relayers run the Bitcoin full node, monitor the transactions on the BTC chain, monitor the Vault for cheating and theft, if a Relayer is found it will notify the BTC parallel chain, if the Relayer stops running, the bridge between PolkaDOT and BTC will be broken.
-
Governance Mechanism Governance Mechanism that monitors the operational security of the entire BTC parallel chain, including the correct behavior of Staked Relayers, and employs security policies to manually intervene in all modules on the BTC parallel chain when Staked Relayers behave incorrectly.
Module architecture diagram
PolkaBTC is divided into a total of seven modules:
-
Oracle Prophecy Machine, used to link centralized and decentralized exchanges and to obtain exchange rates for token exchanges.
-
Treasury Treasury module, which is used to manage the user’s PolkaBTC funding pool.
-
VaultRegistry for keeping information about the vault.
-
Issue Redeem Replace The protocol interface for minting, redemption, and transfer.
-
StabilizedCollateral Handles vault collateral, stabilizes exchange rates, and automatic liquidation.
-
BTC-Relay Track the BTC main chain and verify transactions.
-
Parachain Governance Keeps the BTC parallel chain running correctly and intervenes or stops it when necessary.
Framework
Contest deployment
Competition Program Rules Address
Preparations to start bitcoin test network full nodes.
---
apiVersion: apps/v1
kind: StatefulSet
metadata.
Name: bitcoin-testnet-full-node
namespace: polkadot
tag.
application: bitcoin-testnet-full-node
Specification.
Service name." bitcoin-testnet-node"
Selector.
matchLabels:
Application: bitcoin-testnet-full-node
Template.
metadata:
Tags.
Application: bitcoin-testnet-full-node
specification.
nodeSelector:
localpv: "true"
Container.
- Name: bitcoin-testnet-full-node
Resource.
Limits.
Memory: 7Gi
cpu: 4
Request.
Memory: 2Gi
cpu: 1
Image: 192.168.1.114:5000/bitcoin:0.21.1
Environment.
args:
- Bitcoin
-datadir=/data
-testnet
-server
-par=1
-maxuploadtarget=200
-only number of blocks
-rpcuser=user
-rpcpassword=password
-fallbackfee=0.0002
-rpcallowip=0.0.0.0/0
-rpcbind=*
volumeMounts:
- name: bitcoin-testnet-node-database
mountPath: /data
volumeClaimTemplates:
- metadata:
name: bitcoin-testnet-node-database
Specification.
accessModes:
- Read and write at once
storageClassName: openebs-hostpath
resource.
Request.
Storage. 500Gi
---
apiVersion: v1
Type: Service
Metadata.
Name: bitcoin-testnet-node
Namespace: polkadot
Spec.
Port.
- Port. 18332
Target port: 18332
Name: test node
Selector.
Application: bitcoin-testnet-full-node
---
apiVersion: v1
Type: service
Metadata.
Name: bitcoin-testnet-node-port
Namespace: polkadot
Spec.
Type. Node port
Port.
- Port. 18333
nodePort: 30183
Selector.
Application: bitcoin-testnet-full-node
After BTC full node sync is done, start staked-relayer
apiVersion: apps/v1
Type: state set
Metadata.
name: polkabtc-staked-relayer
namespace: polkadot
tag.
application: polkabtc-staked-relayer
specification.
serviceName: "polkabtc-staked-relayer"
selector.
matchLabels:
Application: polkabtc-staked-relayer
template.
metadata:
Tags.
app: polkabtc-staked-relayer
spec.
container.
- name: polkabtc-staked-relayer
resource.
Limits.
Memory: 7Gi
cpu: 4
Requests.
Memory: 2Gi
cpu: 1
Image: 192.168.1.114:5000/polkabtc-client-testnet:0.7.11
environment.
- Name: RUST_LOG
Value: info
args:
- The stored relayer
-bitcoin-rpc-url
- http://bitcoin-testnet-node:18332
-bitcoin-rpc-user
- user
--bitcoin-rpc-password
- password
--keyfile
- /keyfile.json
--keyname
- keyboard-name: polkabtcrelayer
--automatic-funding-with-tap-url
- https://beta.polkabtc.io/api/faucet
--telemetry-url
- https://beta.polkabtc.io/api/telemetry
--btc-parachain-url
- wss://beta.polkabtc.io/api/parachain
volumeMounts:
- name: keyfile-json
mountPath: /keyfile.json
subPath: keyfile.json
volume.
- name: keyfile-json
configMap:
name: polkabtcrelayer-keyfile-json
Start polkabtc vault
apiVersion: apps/v1
type: StatefulSet
Metadata.
Name: polkabtc-vault
Namespace: polkadot
Tags.
Application: polkabtc-vault
Specification.
Name of the service." polkabtc-vault"
Selector.
matchLabels:
Application: polkabtc-vault
Template.
metadata:
Tags.
Application: polkabtc-vault
specification.
nodeSelector:
localpv: "true"
container.
- Name: polkabtc-vault
Resource.
Limits.
Memory: 7Gi
cpu: 4
Request.
Memory: 2Gi
cpu: 1
Image: 192.168.1.114:5000/polkabtc-client-testnet:0.7.10
environment.
- Name: RUST_LOG
Value: info
args:
- Vault
-bitcoin-rpc-url
- http://bitcoin-testnet-node:18332
-bitcoin-rpc-user
- user
--bitcoin-rpc-password
- password
--keyfile
- /keyfile.json
--keyname
- alexchenfeng
--automatically-register-with-tap-url
- https://beta.polkabtc.io/api/faucet
--remote measurement-url
- https://beta.polkabtc.io/api/telemetry
--btc-parachain-url
- wss://beta.polkabtc.io/api/parachain
--network=testnet
volumeMounts:
- name: keyfile-json
mountPath: /keyfile.json
subPath: keyfile.json
volume.
- name: keyfile-json
configMap:
name: test-keyfile-json
The result of the contest.
One of the SLA metrics is crucial, full name: Service Level Agreement, both Vault and Staked-relayer have this score value, the value range between 0~100, the higher the score, the more Vault and Staked-relayer will gain, if a Vault or Staked-relayer If a Vault or Staked-relayer falls below a certain threshold value, they will be punished, and the degree of punishment can be classified as, confiscation of a certain amount of pledges, full confiscation of pledges, being banned from the system.
The following actions will increase the Vault SLA.
-
executing an issue token
-
submitting proof of issue
-
Execute redemption Execute redemption
-
maintaining a pledge rate above the security pledge threshold
-
perform a replacement operation
The following actions will reduce the Vault SLA.
-
fail to redeem
-
failed replacement
-
liquidation
-
Repeated failed redemptions
-
Repeated failed replacements
The following actions will increase the SLA of the pegging layer.
-
Submitting a valid BTC block header.
-
Correctly report theft
-
Correctly report NO_DATA Report block with no data
-
correctly report INVALID Report invalid blocks
-
correctly report ORACLE_OFFLINE report prophecy machine offline status