Skip to content

Commit 95e62db

Browse files
authored
Merge pull request #125 from inkonchain/docs/joel-devdocs-updates
Docs/joel devdocs updates
2 parents f1192df + 02d3ff3 commit 95e62db

File tree

9 files changed

+242
-43
lines changed

9 files changed

+242
-43
lines changed

cspell/project-words.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,9 @@ Supersim
100100
verif
101101
Sourcify
102102
sourcify
103-
sourcecode
103+
sourcecode
104+
Superbridge
105+
inkonchain
106+
Drand
107+
Viem
108+
viem

src/images/vrf.png

112 KB
Loading

src/pages/build/tools/bridges.mdx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
import { Callout } from 'nextra/components'
22

33
# Bridges
4+
These bridges provide different interfaces to the canonical smart contracts that facilitate migrating ETH from one chain to another.
45

56
<Callout type="info" emoji="ℹ️">
67
Transaction times vary based on network congestion and gas fees. Please ensure you have enough ETH in your wallet to cover transaction fees.
78
</Callout>
89

9-
## Canonical bridge (Gelato)
10-
Bridge: https://bridge.gelato.network/bridge/ink
11-
12-
### How to use
13-
1. Visit the Gelato bridge and connect your wallet.
10+
##### How to use
11+
1. Visit the bridge and connect your wallet.
1412
2. Choose Sepolia as your source and Ink as the destination.
1513
3. Input the amount of assets you want to bridge.
1614
4. Confirm and sign the transaction with your wallet.
17-
5. Once the bridging is complete the assets will appear in your wallet on Ink.\
15+
5. Once the bridging is complete the assets will appear in your wallet on Ink.
16+
17+
## Gelato bridge
18+
Bridge: http://bridge-gel-sepolia.inkonchain.com/
19+
20+
## Kraken Bridge
21+
Bridge:
22+
23+
## Brid.gg
24+
Bridge:
1825

19-
## Brid.gg
26+
## Superbridge
27+
Bridge:

src/pages/build/tools/rpcs.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Public RPCs
2+
3+
###### Gelato
4+
- HTTPS: https://rpc-gel-sepolia.inkonchain.com
5+
- WSS: wss://ws-gel-sepolia.inkonchain.com
6+
7+
###### Quicknode:
8+
9+
###### Tenderly:

src/pages/build/tools/vrf.mdx

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Gelato VRF
2+
3+
- **Mechanism**: Uses [Drand](https://drand.love/), a decentralized source for random numbers.
4+
- **Benefits**: Provides genuine, verifiable random values for blockchain applications.
5+
6+
## What can VRF be used for?
7+
8+
- **Gaming**: For fair outcomes in online games and games of luck.
9+
- **Decentralized Finance (DeFi)**: Random selections for e.g. lotteries in DeFi protocols.
10+
- **NFT Generation**: Random trait generation for unique digital assets.
11+
- **Protocol Decision Making**: Randomized selections for validators or jurors.
12+
13+
## Steps to Set Up Gelato VRF
14+
15+
1. **Set Up Development Environment**: Install either Foundry or Hardhat.
16+
2. **Install Gelato VRF Contracts**: Use specific commands for Hardhat or Foundry.
17+
3. **Inherit `GelatoVRFConsumerBase` Contract**: Incorporate it into your contract.
18+
4. **Request Randomness**: Call `_requestRandomness()` function.
19+
5. **Implement Callback Function**: Define how your contract handles the randomness response.
20+
6. **Include `dedicated msg.sender`**: Essential for contract security and function.
21+
22+
## Quick Start
23+
24+
### Step 1: Set Up Your Development Environment
25+
26+
Make sure you have Hardhat or Foundry ready for use.
27+
28+
### Step 2: Install Gelato VRF Contracts
29+
30+
For Hardhat, clone the repository and set up the environment. For Foundry, use the `forge install` command.
31+
32+
### Step 3: Inherit GelatoVRFConsumerBase Contract
33+
34+
Create a contract that inherits from [GelatoVRFConsumerBase](https://github.com/gelatodigital/vrf-contracts/blob/main/contracts/GelatoVRFConsumerBase.sol).
35+
36+
```solidity
37+
// SPDX-License-Identifier: MIT
38+
pragma solidity 0.8.18;
39+
40+
import {GelatoVRFConsumerBase} from "./GelatoVRFConsumerBase.sol";
41+
42+
contract YourContract is GelatoVRFConsumerBase {
43+
// Your contract's code
44+
}
45+
```
46+
47+
### Step 4: Request Randomness
48+
49+
To request randomness, call the \_requestRandomness() function. You should protect the call since it will take from your 1Balance. The data argument will be passed back to you by the W3F.
50+
51+
```typescript
52+
function requestRandomness(bytes memory data) external {
53+
require(msg.sender == ...);
54+
uint64 requestId = _requestRandomness(data);
55+
}
56+
```
57+
58+
### Step 5: Implement Callback Function
59+
60+
```typescript
61+
function _fulfillRandomness(
62+
bytes32 randomness,
63+
uint64 requestId,
64+
bytes memory data,
65+
) internal override {
66+
}
67+
}
68+
```
69+
70+
### Step 6: Include Dedicated msg.sender
71+
72+
When you're ready to deploy your Gelato VRF-compatible contract, an important step is to include the dedicated msg.sender as a constructor parameter. This ensures that your contract is set up to work with the correct operator for fulfilling the randomness requests.. It's crucial for ensuring that only authorized requests are processed.
73+
74+
```solidity
75+
// SPDX-License-Identifier: MIT
76+
pragma solidity 0.8.18;
77+
78+
import {GelatoVRFConsumerBase} from "./GelatoVRFConsumerBase.sol";
79+
80+
contract YourContract is GelatoVRFConsumerBase {
81+
constructor(address operator)
82+
GelatoVRFConsumerBase(operator) {
83+
// Additional initializations
84+
}
85+
86+
// The rest of your contract code
87+
}
88+
```
89+
90+
## Task Creation
91+
92+
Upon deploying your contract, you will need to create a Gelato Task. This can be done via the [Gelato UI](https://app.gelato.network/).
93+
Next, you will be prompted to provide the address of the Request Contract to which the Gelato nodes should respond. Enter the address of your contract, and once all details have been correctly entered, proceed with launching your Gelato VRF instance.
94+
95+
![Gelato VRF Task Creation](/images/vrf.png)
96+
97+
Now every time you call the `_requestRandomness()` function, the Gelato nodes will respond with a random number that you can use in your contract.
98+
99+
For more detailed information, refer to the [Gelato VRF documentation](https://docs.gelato.network/docs/gelato-vrf).

src/pages/build/web3-clients.mdx

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Ethers.js - Instructions for Connecting to Ink
44

5+
Ethers.js documentation: https://docs.ethers.org/v5/
6+
57
To connect to Ink by instantiating a new `ethers.js` `JsonRpcProvider` object with an RPC URL of Ink's testnet, follow the steps below:
68

79
1. **Install ethers.js**: Ensure you have `ethers.js` installed in your project. If not, you can install it using npm or yarn.
@@ -52,3 +54,75 @@ async function getBlockNumber() {
5254

5355
getBlockNumber();
5456
```
57+
58+
## Viem - Instructions for Connecting to Ink
59+
60+
Viem documentation: https://viem.sh/docs/introduction
61+
62+
1. **Install Viem**: Ensure you have `viem` installed in your project. If not, you can install it using npm or yarn.
63+
64+
```bash
65+
npm install viem
66+
```
67+
68+
or
69+
70+
```bash
71+
yarn add viem
72+
```
73+
74+
2. **Define** a new chain
75+
76+
```javascript
77+
import { defineChain } from 'viem'
78+
79+
export const ink = defineChain({
80+
id: 763373,
81+
name: 'Ink',
82+
nativeCurrency: {
83+
decimals: 18,
84+
name: 'Ether',
85+
symbol: 'ETH',
86+
},
87+
rpcUrls: {
88+
default: {
89+
http: ['https://rpc-gel-sepolia.inkonchain.com'],
90+
websocket: ['wss://ws-gel-sepolia.inkonchain.com']
91+
},
92+
},
93+
blockExplorers: {
94+
default: { name: 'Explorer', url: 'https://explorer-sepolia.inkonchain.com' },
95+
},
96+
contracts: {
97+
98+
},
99+
})
100+
101+
```
102+
103+
3. **Instantiate Provider**
104+
105+
```javascript
106+
import { createPublicClient, http } from 'viem'
107+
import { mainnet } from 'viem/chains'
108+
109+
const client = createPublicClient({
110+
chain: mainnet,
111+
transport: http(),
112+
})
113+
```
114+
115+
4. **Consuming Ethereum Actions**
116+
117+
```javascript
118+
import { createPublicClient, http } from 'viem'
119+
import { mainnet } from 'viem/chains'
120+
121+
const client = createPublicClient({
122+
chain: mainnet,
123+
transport: http(),
124+
})
125+
126+
const blockNumber = await client.getBlockNumber()
127+
```
128+
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
# Get in Touch
1+
# Get Support
22

33
Join the Ink community, vibe with fellow developers and get support:
44

5-
- Access our developer-exclusive Discord for fast support, feedback and memes: https://discord.com/invite/inkonchain
5+
- Access our exclusive Discord for fast support, feedback and memes: https://discord.com/invite/inkonchain
6+
- Join the Ink Telegram for general discussion and questions: https://t.me/inkonchain
67

src/pages/quick-start/faucets.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
## Faucets
22
Get fake Ether (ETH) from these faucets so you can fund your wallet to send transactions and deploy contracts on Ink Sepolia. You can also [bridge](https://docs.inkonchain.com/quick-start/faucets#bridging-funds-to-ink-sepolia) testnet funds to Ink.
33

4-
###### Kraken
5-
Our in house faucet provides a quick and easy way to acquire testnet ETH.
6-
- https://mystery-faucet.demo.inkonchain.com/
4+
###### Optimism - Superchain Faucet
5+
- The Superchain Faucet provides testnet ETH for all OP chains, including Ink.
76
###### Quicknode
87
Quicknode faucet is an easy to use Multi-Chain Faucet. You can use Quicknode Faucet to claim Ink Sepolia for testnet ETH for free - one drip per network every 12 hours.
98
- https://quicknode.com
109
###### Tenderly
1110
Tenderly Node is a fast and reliable production node that enables access to over 12 blockchain networks via RPC. It allows you to send transactions, deploy smart contracts, query blockchain data or other operations without having to run your own node or manage infrastructure.
12-
- https://tenderly.co
13-
###### Optimism
14-
###### Superchain
15-
- The Superchain Faucet provides testnet ETH for all OP chains, including Ink.
11+
- https://tenderly.co
12+
###### Kraken
13+
Our in house faucet provides a quick and easy way to acquire testnet ETH.
14+
- https://mystery-faucet.demo.inkonchain.com/
15+
1616

1717
## Bridging funds to Ink Sepolia
1818
If you need an alternative to the above faucets you can choose to bridge ETH onto Ink Sepolia.

src/pages/quick-start/get-connected.mdx

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@ import { AddNetworkButton } from "../../components/AddNetworkButton";
22

33
# Get Connected
44

5-
Step-by-step instructions for the following:
6-
7-
Adding Ink testnet to Metamask, both via our blockscout explorer, and manually via metamask.
5+
The button below will automatically add Sepolia to your web3 wallet:
86

97
<AddNetworkButton />
108

119

1210
## Network Information
1311

14-
| Field | Information |
15-
| --------------- | -------------------------------------------------------------- |
16-
| Network Name | Ink Sepolia |
17-
| Description | Ink's public testnet |
18-
| RPC Endpoint | [https://rpc-gel-sepolia.inkonchain.com](https://rpc-gel-sepolia.inkonchain.com) |
19-
| Chain ID | 763373 |
20-
| Currency Symbol | ETH |
21-
| Block Explorer | [https://explorer-sepolia.inkonchain.com](https://explorer-sepolia.inkonchain.com) |
12+
| Field | Information |
13+
| -------------------- | -------------------------------------------------------------- |
14+
| Network Name | Ink Sepolia |
15+
| Description | Ink's public testnet |
16+
| RPC Endpoint (HTTPS) | https://rpc-gel-sepolia.inkonchain.com |
17+
| RPC Endpoint (WSS) | wss://ws-gel-sepolia.inkonchain.com |
18+
| Chain ID | 763373 |
19+
| Currency Symbol | ETH |
20+
| Block Explorer | https://explorer-sepolia.inkonchain.com |
2221

2322

24-
## What Do I Need to Start Developing on Ink?
25-
1. An editor (with a Solidity highlighting package) like Visual Studio Code
26-
2. A web3 wallet
27-
3. Testnet funds
28-
4. Recommended: a development framework like Foundry or Hardhat
29-
5. If you want to deploy code to the blockchain through the browser, a web3 browser extension (most web3 wallets will have one)
23+
## What do I Need to Start Developing on Ink?
24+
1. An editor (with a Solidity highlighting package) like [Visual Studio Code](https://code.visualstudio.com/) to efficiently write smart contract code. This code will need the be compiled before deployment; see Step 4.
25+
2. A web3 wallet that holds funds to transact and deploy blockchain code such as [Kraken Wallet](https://www.kraken.com/wallet)
26+
3. Testnet funds to fund your transactions (see [Get Testnet Funds](/quick-start/faucets))
27+
4. Recommended: a development framework like [Foundry](https://book.getfoundry.sh/) or [Hardhat](https://hardhat.org/) to streamline smart contract development.
28+
- You will need the private key to your wallet account to deploy through these frameworks.
29+
- These frameworks can also take care of code compilation for you - otherwise you will need a standalone [solution](https://docs.soliditylang.org/en/latest/installing-solidity.html).
30+
5. If you want to deploy code to the blockchain through the browser instead, a web3 browser extension (most web3 wallets will have one)
3031

31-
As an alternative to most of the above you can use [Remix](https://remix.ethereum.org/), but you will still need a web3 wallet with funds to deploy your code.
32+
As an alternative to most of the above you can use [Remix](https://remix.ethereum.org/), but you will still need a web3 wallet browser extension with funds to deploy your code.
3233

3334
## Connecting to Ink
3435

@@ -37,13 +38,13 @@ In order to deploy code to Ink, you need a blockchain wallet that has funds in i
3738
2. Connecting the wallet to the Ink chain
3839
3. Getting funds to use on Ink from a [faucet](https://https://docs.inkonchain.com/quick-start/faucets) or by [bridging]()
3940

40-
###### Creating a wallet
41-
1. Get a wallet from [Rabby](https://rabby.io/), [Metamask](https://metamask.io/), [Rainbow](https://rainbow.me/en-us/) or many more.
42-
- Make sure your wallet is EVM compatible i.e. works with Ethereum-based chains. The ones mentioned above do.
41+
###### Creating a Wallet
42+
1. Get a wallet from [Kraken Wallet](https://www.kraken.com/wallet), [Metamask](https://metamask.io/), [Rainbow](https://rainbow.me/en-us/) or many more.
43+
- Make sure your wallet is EVM compatible i.e. works with Ethereum-based chains. The ones mentioned above do.
4344
- Use the browser extension of the wallet you chose to simplify deploying code.
4445
2. Set up your wallet, which will include writing down a mnemonic (a set of words) and getting an address that starts with "0x".
4546

46-
###### Connecting Metamask wallet to Ink Sepolia (Testnet)
47+
###### Connecting Metamask Wallet to Ink Sepolia (Testnet)
4748

4849
In order to connect your wallet to Ink you must add Ink Sepolia as a custom network. Note that your wallet should be EVM-compatible.
4950

@@ -59,10 +60,12 @@ Next: get some [play money](#faucet) from our faucets!
5960

6061
![Tux, the Linux mascot](../../images/add_network.png)
6162

62-
###### Fund your wallet
63-
Get fake Ether (ETH) from these faucets so you can fund your wallet to send transactions and deploy contracts on Ink Sepolia. Kraken's in house faucet provides a quick and easy way to acquire testnet ETH:
64-
https://mystery-faucet.demo.inkonchain.com/
63+
###### Fund your Wallet
64+
Get fake Ether (ETH) from these faucets so you can fund your wallet to send transactions and deploy contracts on Ink Sepolia.
65+
66+
Check out faucets [here](https://docs.inkonchain.com/quick-start/faucets). Alternatively, you can [bridge](https://docs.inkonchain.com/quick-start/faucets#bridging-funds-to-ink-sepolia) testnet funds.
6567

66-
Check out alternative faucets [here](https://docs.inkonchain.com/quick-start/faucets). Alternatively, you can [bridge](https://docs.inkonchain.com/quick-start/faucets#bridging-funds-to-ink-sepolia) testnet funds.
68+
## What Next?
69+
Check out the [tutorials](/build/tutorials) to learn how to deploy contracts on Ink and more!
6770

6871
## Troubleshooting

0 commit comments

Comments
 (0)