Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Jazys/web3-initiation

web3-initiation
https://github.com/Jazys/web3-initiation

Last synced: 6 days ago
JSON representation

web3-initiation

Awesome Lists containing this project

README

        

#To install hardhat tools and create project

#Create moonbeam node

In order to create your node on internet (no buy ou swap coin, only transfer and call contract)

```use docker-compose -f docker-compose-with-traefik up -d```

It deploy a blockchain node and nginx server to make test.
All example of html file are in webpage directory

Note: when you purge your node (restart for example), you need to clear all transaction from account in metamask

To view blockchain like etherscan, you can use :

https://polkadot.js.org/apps

And change config in developpement menu, for example, to view my node :

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fmoon-ws.nuage.omvpb.ovh#/explorer/query/0x26a9456aaf24d12f195d9301136d11ce1815e85d3234d98d2a595e75339bebdb

```
sudo apt update
sudo apt install curl git
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
```

to create a project and directory :

```
npm init --yes
npm install --save-dev hardhat
npm install @nomiclabs/hardhat-ethers ethers @nomiclabs/hardhat-waffle ethereum-waffle chai
npm install web3
npx hardhat (and select empty project)
```

Moombean node provide you 10 ten accounts for testing.
Install Node moombean for developpement (with docker) :

```
version: '3'
services:
polkadot:
image: purestake/moonbeam:v0.18.1
ports:
- "30333:30333"
- "9933:9933"
- "9944:9944"
command: --dev --rpc-external --ws-external
```

The accounts_moombean contains all account with public adress and private key

Copy paste this config and change IP according to your moombean installation docker dev :

```
// ethers plugin required to interact with the contract
require('@nomiclabs/hardhat-ethers');

// private key from the pre-funded Moonbase Alpha testing account
const { privateKey } = require('./secrets.json');

module.exports = {
// latest Solidity version
solidity: "0.8.1",

networks: {
moonbase: {
url: 'http://185.189.157.205:9933',
chainId: 1281, // 0x507 in hex,
accounts: [privateKey]
}
}
};
```

You need to have a secrets json file that contains one private key on a pre-configured account offer by moombean dev

Create your contract (see directory)

Compile your contract :

```
npx hardhat compile
```

# To deploy the contract :

```
npx hardhat run --network moonbase scripts/deployXXX.js
````

Useful link :
https://dev.to/hideckies/ethers-js-cheat-sheet-1h5j
https://betterprogramming.pub/the-complete-hands-on-hardhat-tutorial-9e23728fc8a4