Skip to content

Commit 35bee34

Browse files
(feat) add rr feeds (#450)
* remove mention of pgas * Revert "Merge branch 'main' of https://github.com/pyth-network/documentation" This reverts commit b2cc20f, reversing changes made to 20caa0e. * chore(entropy) Protocol design edit (#446) * chore(entropy) Protocol design ediy * improvements * improvements * chore(pricefeed) Add unichain sepolia (#447) * fix(pricefeed) Fix unichain address (#448) * initial commit --------- Co-authored-by: Aditya Arora <arora.aditya520@gmail.com>
1 parent 0be0400 commit 35bee34

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

pages/entropy/protocol-design.mdx

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,13 @@ up-front using a hash chain. Users of the protocol then simply grab the next ran
2525
The provider commits to $x_0$ by posting it to the Entropy contract.
2626
Each random number in the sequence can then be verified against the previous one in the sequence by hashing it, i.e., $\mathrm{hash}(x_i) = x_{i - 1}$
2727

28-
**Request**: To produce a random number, the following steps occur.
29-
30-
1. The user U draws a random number $x_U$, and submits $h_U = \mathrm{hash}(x_U)$ to the contract
31-
2. The contract remembers $h_U$ and assigns it an incrementing sequence number $i$, representing which
32-
of the provider's random numbers the user will receive.
33-
3. The user submits an off-chain request (e.g. via HTTP) to the provider to reveal the $i$'th random number.
34-
4. The provider checks the on-chain sequence number and ensures it is > $i$. If it is not, the provider
35-
refuses to reveal the ith random number. The provider should wait for a sufficient number of block confirmations
36-
to ensure that the request does not get re-orged out of the blockchain.
37-
5. The provider reveals $x_i$ to the user.
38-
6. The user submits both the provider's revealed number $x_i$ and their own $x_U$ to the contract.
39-
7. The contract verifies $\mathrm{hash}(x_i) = x_{i-1}$ to prove that $x_i$ is the $i$'th random number. The contract also checks that $\mathrm{hash}(x_U) = h_U$.
40-
The contract stores $x_i$ as the $i$'th random number to reuse for future verifications.
41-
8. If both of the above conditions are satisfied, the random number $r = \mathrm{hash}(x_i, x_U)$.
42-
As an added security mechanism, this step can incorporate the blockhash of the block that the
43-
request transaction landed in: $r = \mathrm{hash}(x_i, x_U, \mathrm{blockhash})$.
28+
Pyth Entropy uses automatic callbacks to simplify the flow:
4429

45-
This protocol has the same security properties as the 2-party randomness protocol above: as long as either
46-
the provider or user is honest, the number $r$ is random. Honesty here means that the participant keeps their
47-
random number $x$ a secret until the revelation phase (step 5) of the protocol. Note that providers need to
48-
be careful to ensure their off-chain service isn't compromised to reveal the random numbers -- if this occurs,
49-
then users will be able to influence the random number $r$.
50-
51-
With automatic callbacks the flow is simplified:
30+
- **Request**: To produce a random number, the following steps occur.
5231

53-
1. The user U draws a random number $x_U$, and submits **both** $x_U$ and $h_U = \mathrm{hash}(x_U)$ to the contract
54-
2. The contract remembers $h_U$ and assigns it an incrementing sequence number $i$, representing which
55-
of the provider's random numbers the user will receive. $x_U$ is recorded in the event logs.
32+
1. The user U draws a random number $x_U$, and submits it to the contract. The contract generates the hash $h_U = \mathrm{hash}(x_U)$ and records both $x_U$ and $h_U$. The contract uses [`constructUserCommitment`](https://github.com/pyth-network/pyth-crosschain/blob/7bccde484f01c19844b7105d63df207a24018957/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol#L628-L632) to generate the user's commitment.
33+
2. The contract [remembers $h_U$ and assigns it an incrementing **sequence number $i$**](https://github.com/pyth-network/pyth-crosschain/blob/7bccde484f01c19844b7105d63df207a24018957/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol#L232-L246), representing which
34+
of the provider's random numbers the user will receive. $x_U$ is recorded in the [event logs](https://github.com/pyth-network/pyth-crosschain/blob/7bccde484f01c19844b7105d63df207a24018957/target_chains/ethereum/contracts/contracts/entropy/Entropy.sol#L300-L306).
5635
3. After sufficient block confirmations, the provider submits a reveal transaction with $x_i$ and $x_U$ to the contract.
5736
4. The contract verifies $\mathrm{hash}(x_U) = h_U$ and $\mathrm{hash}(x_i) = x_{i-1}$ to prove that $x_i$ is the $i$'th random number.
5837
5. If both of the above conditions are satisfied,
@@ -61,3 +40,10 @@ With automatic callbacks the flow is simplified:
6140
In this flow, providers can refuse revealing $x_i$ if the final random number $r$ is not in their favor, or
6241
they may be able to access $x_U$ before on-chain submission (e.g. via mempool) and rotate their commitments to influence the random number $r$.
6342
Of course, both of these behaviors are detectable and protocols can blacklist providers that exhibit them.
43+
44+
This protocol has the same security properties as the 2-party randomness protocol above: as long as either
45+
the provider or user is honest, the number $r$ is random.
46+
47+
Note that providers need to be careful to ensure their off-chain service isn't compromised to reveal the random numbers -- if this occurs, then users will be able to influence the random number $r$.
48+
49+
The code of default deployed provider can be found [here](https://github.com/pyth-network/pyth-crosschain/tree/7bccde484f01c19844b7105d63df207a24018957/apps/fortuna).

pages/price-feeds/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"api-reference": "API Reference",
3939
"price-feed-ids": "Price Feed IDs",
4040
"sponsored-feeds": "Sponsored Feeds",
41+
"asset-classes": "Asset Classes",
4142
"market-hours": "Market Hours",
4243
"best-practices": "Best Practices",
4344
"error-codes": "Error Codes",

pages/price-feeds/asset-classes.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Asset Classes
2+
3+
Pyth [price feeds](https://www.pyth.network/price-feeds) provide data for the following asset classes:
4+
5+
| Asset Class | Subclass | Definition |
6+
| ----------- | ---------------- | ---------- |
7+
| Crypto | Spot Prices | |
8+
| | Redemption Rates | |
9+
| | Indices | |
10+
| US Equities | Spot Prices | |
11+
| FX | Spot Prices | |
12+
| Metals | Spot Prices | |
13+
| Rates | Future Prices | |
14+
| Commodities | Futures Prices | |

pages/price-feeds/contract-addresses/evm.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ Pyth is currently available on the EVM networks below using Pyth Stable price so
141141
| Sepolia (Ethereum testnet) | [`0xDd24F84d36BF92C65F92307595335bdFab5Bbd21`](https://sepolia.etherscan.io/address/0xDd24F84d36BF92C65F92307595335bdFab5Bbd21) |
142142
| Shimmer testnet | [`0x8D254a21b3C86D32F7179855531CE99164721933`](https://explorer.evm.testnet.shimmer.network/address/0x8D254a21b3C86D32F7179855531CE99164721933) |
143143
| Soneium (testnet) | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://explorer-testnet.soneium.org/address/0x2880aB155794e7179c9eE2e38200202908C17B43) |
144-
| Sonic Fantom Testnet | [`0x96124d1f6e44ffdf1fb5d6d74bb2de1b7fb`](https://testnet.soniclabs.com/address/0x96124d1f6e44ffdf1fb5d6d74bb2de1b7fbe7376) |
144+
| Sonic Fantom Testnet | [`0x96124d1f6e44ffdf1fb5d6d74bb2de1b7fb`](https://unichain-sepolia.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) |
145+
| Unichain Sepolia | [`0x2880aB155794e7179c9eE2e38200202908C17B43`](https://unichain-sepolia.blockscout.com/address/0x2880aB155794e7179c9eE2e38200202908C17B43) |
145146
| Viction testnet | [`0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167`](https://testnet.tomoscan.io/address/0x5D289Ad1CE59fCC25b6892e7A303dfFf3a9f7167) |
146147
| WEMIX testnet | [`0x26DD80569a8B23768A1d80869Ed7339e07595E85`](https://explorer.test.wemix.com/address/0x26DD80569a8B23768A1d80869Ed7339e07595E85) |
147148
| ZKFair testnet | [`0xA2aa501b19aff244D90cc15a4Cf739D2725B5729`](https://testnet-scan.zkfair.io/address/0xA2aa501b19aff244D90cc15a4Cf739D2725B5729) |

0 commit comments

Comments
 (0)