0g-storage-node/docs/run.md

101 lines
1.4 KiB
Markdown
Raw Normal View History

2024-01-03 10:24:52 +00:00
# Run
## Deploy contract: Token, Flow and Mine contracts
### Setup Environment
Install dependencies Node.js, yarn, hardhat.
2024-03-24 14:37:46 +00:00
- Linux
- Ubuntu
2024-01-03 10:24:52 +00:00
```shell
# node >=12.18
sudo apt install npm
sudo npm install --global yarn
sudo npm install --global hardhat
```
2024-03-24 14:37:46 +00:00
- Mac
2024-01-03 10:24:52 +00:00
```shell
brew install node
sudo npm install --global yarn
sudo npm install --global hardhat
```
2024-03-24 14:37:46 +00:00
- Windows
Download and install node from [here](https://nodejs.org/en/download/)
2024-01-03 10:24:52 +00:00
```shell
npm install --global yarn
npm install --global hardhat
```
### Download contract source code
2024-03-24 14:37:46 +00:00
2024-01-03 10:24:52 +00:00
```shell
git clone https://github.com/0glabs/0g-storage-contracts.git
cd 0g-storage-contracts
2024-01-03 10:24:52 +00:00
```
Add target network to your hardhat.config.js, i.e.
2024-03-24 14:37:46 +00:00
2024-01-03 10:24:52 +00:00
```shell
# example
networks: {
targetNetwork: {
url: "******",
accounts: [
"******",
],
},
},
```
### Compile
2024-03-24 14:37:46 +00:00
2024-01-03 10:24:52 +00:00
```shell
yarn
yarn compile
```
### Deploy contract
2024-03-24 14:37:46 +00:00
2024-01-03 10:24:52 +00:00
```shell
npx hardhat run scripts/deploy.ts --network targetnetwork
```
Keep contracts addresses
2024-03-24 14:37:46 +00:00
## Run 0G Storage
2024-01-03 10:24:52 +00:00
Update coinfig run/config.toml as required:
```shell
# p2p port
network_libp2p_port
# rpc endpoint
rpc_listen_address
# peer nodes
network_libp2p_nodes
# flow contract address
log_contract_address
# mine contract address
mine_contract_address
# layer one blockchain rpc endpoint
blockchain_rpc_endpoint
```
Run node
2024-03-24 14:37:46 +00:00
2024-01-03 10:24:52 +00:00
```shell
cd run
../target/release/zgs_node --config config.toml
```