Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Hardhat quickstart, reworked smart contracts section #78

Closed
wants to merge 50 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a62e14b
Added Hardhat quickstart, reworked smart contracts section
jpop32 Jan 29, 2021
485b622
wording. nits
Feb 2, 2021
5e734ec
typos
Feb 2, 2021
5c20153
typos
Feb 2, 2021
52e53ad
Revamp C-Chain API documentation and add eth_getAssetBalance
aaronbuchwald Jan 29, 2021
75835bc
Cleanup eth_getAssetBalance description
aaronbuchwald Jan 29, 2021
26e46c8
Update bech32 docs and add regex.
cgcardona Jan 28, 2021
07870fc
Add missing list item.
cgcardona Jan 28, 2021
445825f
Address PR comment.
cgcardona Jan 28, 2021
fdf2064
nits
Jan 29, 2021
6d86d46
GitBook: [master] 5 pages and 19 assets modified
Feb 1, 2021
a69528a
GitBook: [master] 2 pages modified
Feb 1, 2021
849259c
GitBook: [master] one page modified
Feb 2, 2021
7995c34
Update install script to check for curl
jpop32 Feb 3, 2021
9e147f0
GitBook: [master] 7 pages modified
Feb 3, 2021
0a9a9a8
GitBook: [master] 5 pages modified
Feb 3, 2021
720365d
GitBook: [master] one page modified
Feb 4, 2021
12b3369
Updated script to handle if the binary is missing
jpop32 Feb 5, 2021
27f228c
add log
Feb 5, 2021
3208001
GitBook: [master] 2 pages and 20 assets modified
Feb 5, 2021
09de9ed
GitBook: [master] one page modified
Feb 5, 2021
a8b9944
Stakeable instead of stackeable.
cgcardona Feb 5, 2021
9e0708b
Update using-truffle-with-the-avalanche-c-chain.md
Devilla Feb 2, 2021
3a80bf4
Update using-truffle-with-the-avalanche-c-chain.md
Devilla Feb 2, 2021
be48bd9
GitBook: [master] 2 pages modified
Feb 8, 2021
5d589ba
GitBook: [master] 66 pages modified
Avalanche-Rocky Feb 8, 2021
b513251
GitBook: [master] one page modified
Feb 8, 2021
3e92d76
GitBook: [master] one page modified
Feb 9, 2021
2f98574
Add tutorial for connecting metamask to figment.
cgcardona Feb 9, 2021
761646b
* Remove description
cgcardona Feb 9, 2021
d05783e
rewordings/nits
Feb 9, 2021
0a92c13
Add "Integrate Figment and Metamask" tutorial to Summary.
cgcardona Feb 9, 2021
a0c2df8
Fix typo.
cgcardona Feb 9, 2021
40acae6
Add link to Figment/Metamask tutorial to smart digital assets README.
cgcardona Feb 10, 2021
0b17b79
tesnet -> testnet typo :)
pawelnguyen Feb 10, 2021
a8daafd
GitBook: [master] 2 pages modified
Feb 12, 2021
b265fe7
Remove Figment tutorial for now.
cgcardona Feb 18, 2021
9c305dd
GitBook: [master] 66 pages and 21 assets modified
jpop32 Feb 22, 2021
cae775d
GitBook: [master] 66 pages and 21 assets modified
jpop32 Feb 24, 2021
0df0e05
Add docs for admin.getChainAliases RPC
cgcardona Feb 25, 2021
62010a4
Remove link to RaspberryPi video tutorial
jpop32 Feb 25, 2021
be01bba
Update the url of ERC20PresetMinterPauser.sol
codewiz Feb 26, 2021
165b092
GitBook: [master] 3 pages and 2 assets modified
Avalanche-Rocky Feb 26, 2021
0ed20e1
GitBook: [master] one page modified
Feb 27, 2021
6adc033
update command line args
Mar 1, 2021
38cc6cf
typos
Mar 1, 2021
4319ace
typos
Mar 1, 2021
97e9ddd
add genesis arg
Mar 2, 2021
144037e
Updated version of Hardhat quickstart
jpop32 Mar 4, 2021
c966e94
nits
jpop32 Mar 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rewordings/nits
  • Loading branch information
Dan Laine authored and jpop32 committed Mar 4, 2021
commit d05783edce8717662dbd43f240b2b5302f225ca2
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
# Integrating Figment and Metamask

[Figment](https://figment.io) is a blockchain cloud service provider. They offer a free API gateway service for AVM, EVM and platform chain APIs which developers can use to build on Avalanche.
[Figment](https://figment.io) is a blockchain cloud service provider. Figment offers free access to Avalanche's APIs, which developers can use to build on Avalanche.

## Setup

First, [create an account](https://figment.io/datahub/avalanche). You'll get a email with a verification link. When you click it then you'll be signed back in to Figment's DataHub dashboard.
First, [create an account](https://figment.io/datahub/avalanche) on Figment.
You'll get a email with a verification link. When you click it, you'll be signed into Figment's DataHub dashboard.

## DataHub Dashboard

Once signed in and at the [DataHub dashboard](https://datahub.figment.io) select Avalanche from Available protocols. This will give you access to the free tier of the API gateway service. The free tier has a quota of 200k requests per day. There are [upgrade options](https://datahub.figment.io/services/avalanche/prices) for more requests if you max out over 200k per day. After selecting Avalanche you'll land on the Avalanche Dashboard.
Once you're signed in and at the [DataHub dashboard](https://datahub.figment.io), find the `Available protocols` section and select Avalanche.
This will bring you to the Avalanche dashboard. Figment's free tier of service for Avalanche has a limit of 200,000 requests per day.
If you want to make more requests per day, you can selection from their [paid options](https://datahub.figment.io/services/avalanche/prices).

## Avalanche Dashboard

On the Avalanche dashboard you'll see a graph of API requests at the top of the page. Below that you'll see your current plan and stats related to your daily usage.
On the Avalanche dashboard you'll data about your plan and your usage of Avalanche APIs.

Next you'll see API keys, which are passed in the URL. Lastly API service URLs. Figment provides API endpoints for mainnet and fuji testnet.
Next, you'll see your API key. It will look something like this: `f81e193b9412a683af7101e964766c07`.
This piece of information is used to authenticate you when you make calls to the Avalanche API.
You must provide it when you make a call to an Avalanche API hosted by Figment.

* Mainnet avalanche--mainnet--rpc.datahub.figment.io
* Fuji avalanche--fuji--rpc.datahub.figment.io
As the table on the dashboard says, you can make an API call to Avalanche's mainnet at `avalanche--mainnet--rpc.datahub.figment.io`.
You can make an API call to the Fuji testnet at `avalanche--fuji--rpc.datahub.figment.io`.

### Confirm it works
### Try it Out

Try the following `curl` to confirm that you can access the Figment node's RPC. This `curl` is asking for the blockchainID of the X-Chain on the Fuji tesnet. Make sure to add your API key to `api-key` in the url below.
Paste the following command into your computer's terminal to confirm that you can access the Avalanche API hosted by Figment.
This `curl` is asking for the blockchainID of the X-Chain on the Fuji tesnet.
Replace `APIKEYGOESHERE` with the API key you see on the Avalanche dashboard.

```zsh
curl --location --request POST 'https://avalanche--fuji--rpc.datahub.figment.io/apikey/api-key/ext/info' \
curl --location --request POST 'https://avalanche--fuji--rpc.datahub.figment.io/apikey/APIKEYGOESHERE/ext/info' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc":"2.0",
Expand All @@ -50,28 +57,35 @@ If you are successully able to POST to the figment full node then you should get

## Set up Metamask

The first thing we should set is a metamask wallet.
Let's connect our Metamask wallet to the Avalanche API hosted by Figment.
Open Metamask and select the network drop-down menu.
Then, select `Custom RPC`

![Image for post](https://miro.medium.com/max/408/0*0HGM4O_J5iF3943S)

Click to metamask icon on the browser and select the network drop-down menu. Here we should connect to C-Chain. Click to “Custom RPC”.

![Image for post](https://miro.medium.com/max/989/1*Y7O1bBeTWnuQBAqTnwmqUQ.png)
Now, fill in the boxes with the following values, depending on whether you want to connect to mainnet or the Fuji testnet.
Again, replace `APIKEYGOESHERE` with your API key from Figment.

Now, we need to set these boxes with correct values.
### Mainnet Settings

* **Network Name**: Figment-of-my-imagination
* **New RPC URL**:
* **Mainnet:** [https://avalanche--mainnet--rpc.datahub.figment.io/apikey/api-key/ext/bc/C/rpc](https://avalanche--mainnet--rpc.datahub.figment.io/apikey/api-key/ext/bc/C/rpc)
* **Fuji Testnet:** [https://avalanche--fuji--rpc.datahub.figment.io/apikey/api-key/ext/bc/C/rpc](https://avalanche--fuji--rpc.datahub.figment.io/apikey/api-key/ext/bc/C/rpc)
* **ChainID**:
* **Mainnet:** `0xa86a`
* **Fuji Testnet:** `0xa869`
* **Network Name**: Figment C-Chain Mainnet
* **New RPC URL**: `https://avalanche--mainnet--rpc.datahub.figment.io/apikey/APIKEYGOESHERE/ext/bc/C/rpc`
* **ChainID**: `0xa86a`
* **Symbol**: AVAX
* **Explorer**:
* **Mainnet:** [https://cchain.explorer.avax.network](https://cchain.explorer.avax.network/)
* **Fuji Testnet:** [https://cchain.explorer.avax-test.network](https://cchain.explorer.avax-test.network/)
* **Explorer**: `https://cchain.explorer.avax.network`

### Fuji Settings

* **Network Name**: Figment C-Chain Fuji
* **New RPC URL**: `https://avalanche--fuji--rpc.datahub.figment.io/apikey/APIKEYGOESHERE/ext/bc/C/rpc`
* **ChainID**: `0xa869`
* **Symbol**: AVAX
* **Explorer**: `https://cchain.explorer.avax-test.network`

![Image for post](https://miro.medium.com/max/358/1*q0HIWcI3okakwYV2glos0A.png)

After setting up all the parameters correctly, we should see this page. For now, we have 0 C-AVAX. “C” refers to C-chain and we have to get some C-AVAX to interact with the network.
![Image for post](https://miro.medium.com/max/989/1*Y7O1bBeTWnuQBAqTnwmqUQ.png)

After setting up all of the parameters, you should see this page, which shows your (empty) balance.

![Image for post](https://miro.medium.com/max/358/1*q0HIWcI3okakwYV2glos0A.png)