Coder Social home page Coder Social logo

zklinkprotocol / recover_state_server Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 9.0 2.09 MB

If the zkLink sequencer is abnormally closed or the dApp cannot work properly, this program can help users recover their funds by themselves without relying on any external services.

Home Page: https://zk.link/dunkirk

Rust 91.10% PLpgSQL 0.10% GAP 1.03% HTML 0.17% TypeScript 7.04% CSS 0.02% Shell 0.16% JavaScript 0.38%
multi-chain midware blockchain dunkirk

recover_state_server's Introduction

zkLink Exodus Model

This repository contains the Server, Prover and React App for zkLink Exodus Model.

Table of Contents

Prerequisites

We recommend using the Ubuntu OS, and below are three recommended configurations.

AWS EC2 Instance Price Prove Performance
c5a.4xlarge $0.768/hr 0.3 proofs/min
c5a.12xlarge $2.304/hr 1 proofs/min
c5a.24xlarge $4.608/hr 2 proofs/min

Before you begin, you will need to have the following software installed:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update

sudo apt-get -y install postgresql

You also need to install the following dependencies:

sudo apt-get install libpq-dev libssl-dev pkg-config axel

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

nvm install v16.20

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

sudo apt install build-essential

cargo install diesel_cli --no-default-features --features postgres

Note: For the first time, you need to set the psql password.

sudo su - postgres

#connect to postgresql
psql

#modify password
\password
echo 'export DATABASE_URL=postgres://postgres:password@localhost/plasma' >> ~/.bashrc

source ~/.bashrc

To accommodate a high volume of requests on the Web service, append the following line to the /etc/security/limits.conf file:

* soft nofile 1048576
# To ensure that the changes take effect, you should log out and log back in to the current shell session.
exit 

Getting Started

Clone the git repository and download the setup file:

git clone https://github.com/zkLinkProtocol/recover_state_server.git

cd recover_state_server

axel -c https://universal-setup.ams3.digitaloceanspaces.com/setup_2%5E23.key -o ./zklink_keys

Configure the Environment Variables

There is a .env.e.g file in the root path of our project, copy and rename it to .env.

cp .env.e.g .env

# Must configure `RUNTIME_CONFIG_ZKLINK_HOME` and `DATABASE_URL` based on your environment
sed -i "s|/home/user/zklink/recover_state_server|$(pwd)|g" .env

sed -i "s|postgres://postgres:password@localhost/plasma|${DATABASE_URL}|g" .env

Explanation of .env Configuration Items: env.md

We recommend displaying your NAME and LOGO on the recovery page, as it can help with the branding of the recovery node operator. Please refer to the exodus-interface/README.md for more information.


Starting the recovery program, prover program, and web service server

export PORT=8081  # The access port for the frontend page.

# Forward traffic from port 80 to port 8081
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8081

./exodus.sh start

This command may take several hours to complete.

If you want to monitor the state recovery process, please run the following command:

tail -f log/recover_state.log

The recovery program will close automatically when synchronization is complete.

Stopping recovery program, Prover program, and web service server

./exodus.sh stop

Cleaning Up All Exodus Data

./exodus.sh clean

License

This project is licensed under the MIT License - see the LICENSE file for details.

recover_state_server's People

Contributors

garymrepublic avatar jashspark avatar kevinfitzroy avatar requiemofsoul avatar zkcarter avatar zklinklabs avatar zktyral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

recover_state_server's Issues

impl updating token event for starknet #2

Implementing an updating token event for StarkNet involves incorporating functionality that triggers an event when a token update occurs. You should try to follow this Guide Steps:

Define Event Structure:
Begin by defining the structure of your updating token event. Decide what information needs to be included, such as the token's new details or any relevant changes.

Smart Contract Logic:
Integrate the updating event logic within your smart contract. This might involve creating a function that updates the token details and emits the event. For example:

python
Copy code
@public
def updateTokenDetails(newName: string, newSymbol: string):
# Update token details logic here

# Emit the updating token event
self.tokenUpdated(newName, newSymbol)

Declare Event in Contract:
Declare the updating token event in your smart contract. This involves specifying the parameters that the event will take.

python
Copy code
event tokenUpdated(newName: string, newSymbol: string)
Handle Events Off-Chain:
Off-chain systems can listen for this event and react accordingly. This allows you to keep external systems synchronized with the on-chain updates.

Testing:
Thoroughly test the implementation to ensure that the updating token event is triggered correctly and contains the accurate information.
These are steps you should Follow if you want To update tokene event for Starknet, I hope this guide will be Helpful for you and have a nice day ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.