Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/ren…
Browse files Browse the repository at this point in the history
…der-equations

# Conflicts:
#	package.json
#	yarn.lock
  • Loading branch information
alexcss committed Nov 14, 2024
2 parents bad116e + f189da4 commit 14d7460
Show file tree
Hide file tree
Showing 22 changed files with 788 additions and 147 deletions.
23 changes: 12 additions & 11 deletions docs/01-concepts/powpeg/hsm-firmware-attestation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ render_features: 'powpeg-hsm-attestation-frame'

To verify the PowPeg protocol nodes, follow the HSM firmware attestation process using the steps below. See the [Attestation README](https://github.com/rsksmart/rsk-powhsm/blob/2.3.5/docs/attestation.md).

### PowPeg HSM Firmware Attestation - Sovryn

<iframe class="w-100 rounded-4" src="/img/rsk/architecture/powpeg-hsm-attestation/sovryn.html" title="Sovryn" height="400"></iframe>

### PowPeg HSM Firmware Attestation - pNetwork

<iframe class="w-100 rounded-4" src="/img/rsk/architecture/powpeg-hsm-attestation/pnetwork.html" title="pNetwork" height="400"></iframe>
<Tabs>
<TabItem value="sovryn" label="Sovryn" default>
<iframe class="w-100 rounded-4" src="/img/rsk/architecture/powpeg-hsm-attestation/sovryn.html" title="Sovryn" height="400"></iframe>
</TabItem>
<TabItem value="pNetwork" label="pNetwork">
<iframe class="w-100 rounded-4" src="/img/rsk/architecture/powpeg-hsm-attestation/pnetwork.html" title="pNetwork" height="400"></iframe>
</TabItem>
</Tabs>

### Frequently Asked Questions

<Accordion>
<Accordion.Item eventKey="1">
<Accordion.Header as="h3">What is the multisig scheme for the powHSM? It is a M of N multisig.
<Accordion.Header as="h3">What is the multisig scheme for the powHSM? It is a M of N multisig.
What is M and what is N?</Accordion.Header>
<Accordion.Body>
> - A: The best way to get this information is by querying the Bridge directly, since the number of members of the PowPeg may change after a PowPeg composition change.
> - You can use the following methods to query the bridge: `getFederationSize`, `getFederationThreshold`.
> - A: The best way to get this information is by querying the Bridge directly, since the number of members of the PowPeg may change after a PowPeg composition change.
> - You can use the following methods to query the bridge: `getFederationSize`, `getFederationThreshold`.
> - By consensus the required amount of signers (M) will always be half plus one the total amount of pegnatories `M = N / 2 + 1`. See the signatories and attestation information in [PowPeg HSM Firmware Attestation](#powpeg-hsm-firmware-attestation---sovryn).
</Accordion.Body>
</Accordion.Item>
</Accordion>
</Accordion>
6 changes: 3 additions & 3 deletions docs/01-concepts/rbtc/conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Thus, we have `BTC` and `RBTC` on the Mainnets, which correspond to `tBTC` and `

Enter your BTC address below to verify whether it may be used to peg in from BTC to RBTC.

<AddressVerifier />

## User Guide

- [Mainnet Guide](/concepts/rbtc/networks#mainnet-conversion)
Expand All @@ -47,9 +49,7 @@ You can try the conversion process using either options below;

Watch this explainer video on **How to do BTC & R-BTC Conversions using the Rootstock Powpeg**.

<div class="video-container">
<iframe width="949" height="534" src="https://youtube.com/embed/XTpQW9Rw838" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<iframe width="949" height="534" src="https://youtube.com/embed/XTpQW9Rw838" frameBorder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowFullScreen></iframe>

### FAQs

Expand Down
76 changes: 31 additions & 45 deletions docs/01-concepts/rif-suite/rns/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,41 @@ description: "Information about the RIF token, where to obtain it, how to transf

RNS provides an architecture which enables the identification of blockchain addresses by human-readable names.

<form class="form" id="frm-rns-search">
<div class="form-group">
<div class="input-group">
<input type="text" id="txt-rns-name" class="form-control" placeholder="find your domain" />
<div class="input-group-append">
<span class="input-group-text">.rsk</span>
</div>
<div class="input-group-append">
<button class="btn btn-rns-register">Register!</button>
</div>
<RNSDomainSearch />

<div className="row rif_blue_text">
<div className="col">
<div className="rns-index-box">
<a href="try-rns">Try the service</a>
<br />
<br />
<p>Register a domain in the Testnet, for free.</p>
</div>
</div>
</form>

<div class="container the-stack">
<div class="row rif_blue_text">
<div class="col">
<div class="rns-index-box">
<a href="try-rns">Try the service</a>
<br />
<br />
<p>Register a domain in the Testnet, for free.</p>
</div>
</div>
<div class="col">
<div class="rns-index-box">
<a href="./integrate">Integrate with RNS</a>
<br />
<br />
<p>Easy guides on how to integrate RNS in your solution.</p>
</div>
<div className="col">
<div className="rns-index-box">
<a href="./integrate">Integrate with RNS</a>
<br />
<br />
<p>Easy guides on how to integrate RNS in your solution.</p>
</div>
</div>
<div class="row rif_blue_text">
<div class="col">
<div class="rns-index-box">
<a href="run-locally">Develop on top of RNS</a>
<br />
<br />
<p>Deploy RNS suite in your local development environment</p>
</div>
</div>
<div className="row rif_blue_text">
<div className="col">
<div className="rns-index-box">
<a href="run-locally">Develop on top of RNS</a>
<br />
<br />
<p>Deploy RNS suite in your local development environment</p>
</div>
<div class="col">
<div class="rns-index-box">
<a href="libs">Use the libraries</a>
<br />
<br />
<p>Use simple libraries to interact with RNS service.</p>
</div>
</div>
<div className="col">
<div className="rns-index-box">
<a href="libs">Use the libraries</a>
<br />
<br />
<p>Use simple libraries to interact with RNS service.</p>
</div>
</div>
</div>
Expand Down Expand Up @@ -97,7 +83,7 @@ RNS has four major components:
| **RNS Registry** | The RNS Registry is a specification for a tree-structured namespace and the data associated with the names. Conceptually, each node and leaf in the domain name space tree represents a set of information. Query operations attempt to extract specific types of information from a particular set. A query specifies the domain name of interest and the type of resource information desired. | [Specs](./specs/registry) |
| **RNS Resolvers** | RNS Resolvers are contracts that provide information from a name in response to client requests. Resolvers must answer a query directly or use referrals to other resolvers. Typically, a resolver is a contract's public function that is directly accessible to user programs or other contracts. No specific protocol is required between the resolver and the user program. | [Specs](./specs/resolver) |
| **RNS Registrar** | The RNS Registrar is a critical component within the RIF Name Service, managing the registration of `.rsk` domain names. This contract has the authority to register names in the RSK Owner contract, ensuring that new domain registrations are handled securely and efficiently. | [Specs](./specs/registrar) |
| **Renewer** | The Renewer is a contract designed to facilitate the renewal of names registered in the Node Owner. It is equipped with permissions to renew these names and provides flexibility in how the renewal is executed.
| **Renewer** | The Renewer is a contract designed to facilitate the renewal of names registered in the Node Owner. It is equipped with permissions to renew these names and provides flexibility in how the renewal is executed.

These fours components roughly correspond to the four layers or views of the domain system:
- From the user's point of view, the domain system is accessed through a simple resolution operation. The domain space consists of a single tree and the user can request information from any section of the tree.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
"@mendable/search": "^0.0.206",
"@splidejs/react-splide": "^0.7.12",
"bootstrap": "5.3.3",
"buffer": "^6.0.3",
"clsx": "^2.0.0",
"docusaurus-plugin-sass": "^0.2.5",
"jssha": "^3.3.1",
"katex": "^0.16.11",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
Expand Down
46 changes: 46 additions & 0 deletions src/_utils/pegin-address-verifier/crypto/base58.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Base58 encoding/decoding
// Originally written by Mike Hearn for BitcoinJ
// Copyright (c) 2011 Google Inc
// Ported to JavaScript by Stefan Thomas
// Merged Buffer refactorings from base58-native by Stephen Pair
// Copyright (c) 2013 BitPay Inc

var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
var ALPHABET_MAP = {};
for (var i = 0; i < ALPHABET.length; ++i) {
ALPHABET_MAP[ALPHABET.charAt(i)] = i;
}
var BASE = ALPHABET.length;

module.exports = {
decode: function(string) {
if (string.length === 0) return [];

var i, j, bytes = [0];
for (i = 0; i < string.length; ++i) {
var c = string[i];
if (!(c in ALPHABET_MAP)) throw new Error('Non-base58 character');

for (j = 0; j < bytes.length; ++j) bytes[j] *= BASE
bytes[0] += ALPHABET_MAP[c];

var carry = 0;
for (j = 0; j < bytes.length; ++j) {
bytes[j] += carry;
carry = bytes[j] >> 8;
bytes[j] &= 0xff
}

while (carry) {
bytes.push(carry & 0xff);
carry >>= 8;
}
}
// deal with leading zeros
for (i = 0; string[i] === '1' && i < string.length - 1; ++i){
bytes.push(0);
}

return bytes.reverse();
}
};
116 changes: 116 additions & 0 deletions src/_utils/pegin-address-verifier/crypto/bech32.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright (c) 2017 Pieter Wuille
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

var CHARSET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';
var GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3];

module.exports = {
decode: decode,
encode: encode,
};


function polymod (values) {
var chk = 1;
for (var p = 0; p < values.length; ++p) {
var top = chk >> 25;
chk = (chk & 0x1ffffff) << 5 ^ values[p];
for (var i = 0; i < 5; ++i) {
if ((top >> i) & 1) {
chk ^= GENERATOR[i];
}
}
}
return chk;
}

function hrpExpand (hrp) {
var ret = [];
var p;
for (p = 0; p < hrp.length; ++p) {
ret.push(hrp.charCodeAt(p) >> 5);
}
ret.push(0);
for (p = 0; p < hrp.length; ++p) {
ret.push(hrp.charCodeAt(p) & 31);
}
return ret;
}

function verifyChecksum (hrp, data) {
return polymod(hrpExpand(hrp).concat(data)) === 1;
}

function createChecksum (hrp, data) {
var values = hrpExpand(hrp).concat(data).concat([0, 0, 0, 0, 0, 0]);
var mod = polymod(values) ^ 1;
var ret = [];
for (var p = 0; p < 6; ++p) {
ret.push((mod >> 5 * (5 - p)) & 31);
}
return ret;
}

function encode (hrp, data) {
var combined = data.concat(createChecksum(hrp, data));
var ret = hrp + '1';
for (var p = 0; p < combined.length; ++p) {
ret += CHARSET.charAt(combined[p]);
}
return ret;
}

function decode (bechString) {
var p;
var has_lower = false;
var has_upper = false;
for (p = 0; p < bechString.length; ++p) {
if (bechString.charCodeAt(p) < 33 || bechString.charCodeAt(p) > 126) {
return null;
}
if (bechString.charCodeAt(p) >= 97 && bechString.charCodeAt(p) <= 122) {
has_lower = true;
}
if (bechString.charCodeAt(p) >= 65 && bechString.charCodeAt(p) <= 90) {
has_upper = true;
}
}
if (has_lower && has_upper) {
return null;
}
bechString = bechString.toLowerCase();
var pos = bechString.lastIndexOf('1');
if (pos < 1 || pos + 7 > bechString.length || bechString.length > 90) {
return null;
}
var hrp = bechString.substring(0, pos);
var data = [];
for (p = pos + 1; p < bechString.length; ++p) {
var d = CHARSET.indexOf(bechString.charAt(p));
if (d === -1) {
return null;
}
data.push(d);
}
if (!verifyChecksum(hrp, data)) {
return null;
}
return {hrp: hrp, data: data.slice(0, data.length - 6)};
}
29 changes: 29 additions & 0 deletions src/_utils/pegin-address-verifier/crypto/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const ADDRESS_TYPES = {
P2PKH: 'p2pkh',
P2SH: 'p2sh',
BECH32: 'bech32'
};

const NETWORKS = {
MAINNET: 'mainnet',
TESTNET: 'testnet',
REGTEST: 'regtest'
};

const HASH_FIELD_NAMES = {
p2pkh: 'scriptPubKey',
p2sh: 'scriptHash'
};

// Check https://github.com/rsksmart/RSKIPs/blob/2c994cc108885ccc5a116e4aee8c073b5eca5682/IPs/RSKIP170.md#specification for more details.
const ADDRESS_TYPES_CODES = {
p2pkh: '01',
p2sh: '02'
};

module.exports = {
ADDRESS_TYPES,
NETWORKS,
HASH_FIELD_NAMES,
ADDRESS_TYPES_CODES,
};
Loading

0 comments on commit 14d7460

Please sign in to comment.