Skip to content

Commit

Permalink
Merge pull request #14 from lambdaclass/turing-bridge-api
Browse files Browse the repository at this point in the history
Using Turing Bridge API
  • Loading branch information
jordibonet-lambdaclass authored May 30, 2024
2 parents 7bab794 + 3dd3ab3 commit 23aec10
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 166 deletions.
37 changes: 14 additions & 23 deletions deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
A Deno script that uses PolkadotSDK to submit data and get proof of its
availability in AvailDA.

Using the [Avail's Bridge API](https://github.com/availproject/bridge-api)
(running locally) and
Using the [Avail's Bridge API](https://github.com/availproject/bridge-api) (of
[Turing](https://turing-bridge-api.fra.avail.so)) and
[Vector X's contracts](https://github.com/succinctlabs/vectorx?tab=readme-ov-file)
of [Succinct](https://blog.succinct.xyz/vector-x/) with Turing Testnet.

Expand All @@ -15,32 +15,13 @@ of [Succinct](https://blog.succinct.xyz/vector-x/) with Turing Testnet.
## Requirements

- [Deno](https://deno.com/)
- [Avail's Bridge API](https://github.com/availproject/bridge-api) running
locally and configured with the following `.env` in its directory:

```
AVAIL_CLIENT_URL=https://turing-rpc.avail.so/rpc
SUCCINCT_URL=https://beaconapi.succinct.xyz/api/integrations/vectorx
AVAIL_CHAIN_NAME=turing
CONTRACT_CHAIN_ID=11155111
VECTORX_CONTRACT_ADDRESS=0xe542db219a7e2b29c7aeaeace242c9a2cd528f96
BRIDGE_CONTRACT_ADDRESS=0x1369a4c9391cf90d393b40faead521b0f7019dc5
ETHEREUM_CLIENT_URL=https://ethereum-sepolia.publicnode.com
BEACONCHAIN_URL=https://sepolia.beaconcha.in/api/v1/slot
HOST=0.0.0.0
PORT=8080
```

- A `.env` file:

```
# avail rpc endpoint devnet/testnet
AVAIL_RPC=wss://turing-rpc.avail.so/ws # ws://127.0.0.1:9944
# mnemonic of the account to sign transactions on Avail network
AVAIL_RPC=wss://turing-rpc.avail.so/ws
SURI='your phrase'
# main devnet DA contract address
DA_BRIDGE_ADDRESS=0x967F7DdC4ec508462231849AE81eeaa68Ad01389
BRIDGE_API_URL=http://localhost:8080
BRIDGE_API_URL=https://turing-bridge-api.fra.avail.so
ETH_PROVIDER_URL=https://ethereum-sepolia.rpc.subquery.network/public
```

Expand Down Expand Up @@ -119,3 +100,13 @@ You can retrieve AVAIL tokens from [this website](https://faucet.avail.tools/).

You can check the block using [Subscan](https://avail-turing.subscan.io/) or
[Avail Explorer](https://explorer.avail.so).

## References

This script is based on the following articles and resources:

- [Avail's Bridge API Documentation](https://github.com/availproject/bridge-api)
- [Vector X Contracts](https://github.com/succinctlabs/vectorx?tab=readme-ov-file)
by Succinct
- [Succinct Blog on Vector X](https://blog.succinct.xyz/vector-x/)
- [Validium Reference Documentation](https://docs.availproject.org/docs/build-with-avail/Validium/reference)
8 changes: 8 additions & 0 deletions deno/validium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ const account = new Keyring({ type: "sr25519" }).addFromUri(SURI);
*/
// deno-lint-ignore no-unused-vars
class ProofData {
// proof of inclusion for the data root
dataRootProof: Array<string> | undefined;
// proof of inclusion of leaf within blob/bridge root
leafProof: string | undefined;
// abi.encodePacked(startBlock, endBlock) of header range commitment on VectorX
rangeHash: string | undefined;
// index of the data root in the commitment tree
dataRootIndex: number | undefined;
// blob root to check proof against, or reconstruct the data root
blobRoot: string | undefined;
// bridge root to check proof against, or reconstruct the data root
bridgeRoot: string | undefined;
// leaf being proven
leaf: string | undefined;
// index of the leaf in the blob/bridge root tree
leafIndex: number | undefined;
}

Expand Down
Loading

0 comments on commit 23aec10

Please sign in to comment.