Skip to content

Commit

Permalink
Merge pull request #347 from EYBlockchain/wenxing/from-mumbai-to-amoy
Browse files Browse the repository at this point in the history
fix: update for polygon testnet from mumbai to amoy
  • Loading branch information
lydiagarms authored Jan 13, 2025
2 parents d829286 + 7df3554 commit a831339
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,17 +344,9 @@ Starlight handles secret initiation in the constructor by creating a proof at th

Since this inevitably creates a commitment to be sent your local db, simply restarting the zapp will **not** work. The blockchain will be aware of the constructor commitment, but your zapp will not.

If you would like to restart the zapp and redeploy the contract, always (with no running docker containers) run:

`./bin/redeploy` <-- creates a new constructor proof and saves the commitment, then deploys the shield contract

`npm run restart` <-- if you'd like to use the APIs, always **restart** rather than **start** since the latter clears your local dbs

Then, if you previously had nullifiers, reinstate them in your local sparse merkle tree by sending a POST to `http://localhost:3000/reinstateNullifiers`.

#### Deploy on public testnets

Apart from local ganache instance, Starlight output zapps can now be deployed in Sepolia, Goerli and Polygon Mumbai as cli options. Connection to Sepolia and Goerli are made through [infura](https://infura.io/) endpoints and that of Polygon Mumbai is provided via [maticvigil](https://rpc.maticvigil.com/).
Apart from local ganache instance, Starlight output zapps can now be deployed in Sepolia, Goerli and Polygon Amoy as cli options. Connection to Sepolia and Goerli are made through [infura](https://infura.io/) endpoints and that of Polygon Amoy is provided via [Alchemy](https://www.alchemy.com/).

The configuration can be done during `./bin/setup` phase in the following way.

Expand All @@ -364,7 +356,7 @@ The configuration can be done during `./bin/setup` phase in the following way.

| option | description |
|:--|:--|
| `-n` | Network : Specify testnet you want to connect to. possible options: `mumbai/ sepolia/ goerli` |
| `-n` | Network : Specify testnet you want to connect to. possible options: `amoy/ sepolia/ goerli` |
| `-a` | Ethereum address |
| `-k` | Private key of above ethereum address |
| `-m` - | 12 letter mnemonic passphrase |
Expand Down
2 changes: 1 addition & 1 deletion bin/start
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -e

npm install -g ./

tsc
./node_modules/typescript/bin/tsc
8 changes: 4 additions & 4 deletions src/boilerplate/common/bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rm -rf proving-files

perl -i -pe "s,docker-compose.zapp.yml -f docker-compose.zapp.override.yml,docker-compose.zapp.yml,g" package.json

if [[ $network == 'mumbai' ]] || [[ $network == 'sepolia' ]] || [[ $network == 'goerli' ]]
if [[ $network == 'amoy' ]] || [[ $network == 'sepolia' ]] || [[ $network == 'goerli' ]]
then
perl -i -pe "s,DEFAULT_ACCOUNT: '',DEFAULT_ACCOUNT: \'$account\',g" docker-compose.zapp.override.yml
perl -i -pe "s,DEFAULT_ACCOUNT_MNEMONIC: '',DEFAULT_ACCOUNT_MNEMONIC: \'$mnemonic\',g" docker-compose.zapp.override.yml
Expand All @@ -54,10 +54,10 @@ perl -i -pe "s,docker-compose.zapp.yml,docker-compose.zapp.yml -f docker-compose
perl -i -pe "s,docker-compose -f docker-compose.zapp.yml up -d ganache, ## up ganache service for ganache,g" bin/startup
fi

if [[ $network == 'mumbai' ]]
if [[ $network == 'amoy' ]]
then
perl -i -pe "s,RPC_URL: '',RPC_URL: \'wss:\/\/rpc-mumbai.maticvigil.com\/ws\/v1\/$rpc\',g" docker-compose.zapp.override.yml
perl -i -pe "s,development_ganache,mumbai,g" entrypoint.sh
perl -i -pe "s,RPC_URL: '',RPC_URL: \'wss:\/\/polygon-amoy.g.alchemy.com\/v2\/$rpc\',g" docker-compose.zapp.override.yml
perl -i -pe "s,development_ganache,amoy,g" entrypoint.sh
perl -i -pe "s,while,##while,g" entrypoint.sh
perl -i -pe "s,10,60,g" bin/startup
fi
Expand Down
22 changes: 18 additions & 4 deletions src/boilerplate/common/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,41 @@ module.exports = {
port: process.env.BLOCKCHAIN_PORT,
},
// web3:
web3: {
web3: {
host: process.env.BLOCKCHAIN_HOST,
port: process.env.BLOCKCHAIN_PORT,
// url: `${process.env.BLOCKCHAIN_HOST}:${process.env.BLOCKCHAIN_PORT}`,
url: process.env.RPC_URL,
rpcUrl: process.env.RPC_URL,
defaultAccountMnemonic: process.env.DEFAULT_ACCOUNT_MNEMONIC,
key: process.env.KEY,
autoReconnectInterval: process.env.BLOCKCHAIN_RECONNECT_INTERVAL || 1000,

options: {
// defaultAccount: '0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1',
defaultAccount: process.env.DEFAULT_ACCOUNT,
defaultGas: 5221975,
defaultGasPrice: 20000000000,
defaultGas: 11511304,
defaultGasPrice: 30000000000,
// defaultBlock: '0', // e.g. the genesis block our blockchain
// defaultGas: 90000000,
// defaultGasPrice: 20000000000,
// transactionBlockTimeout: 50,
transactionBlockTimeout: 150,
// transactionConfirmationBlocks: 15,
// transactionPollingTimeout: 480,
// transactionSigner: new CustomTransactionSigner()
clientConfig: {
// Useful to keep a connection alive
keepalive: true,
// Keep keepalive interval small so that socket doesn't die
keepaliveInterval: -1,
},
timeout: 0,
reconnect: {
auto: true,
delay: 5000, // ms
maxAttempts: 120,
onTimeout: false,
},
},
},
};
6 changes: 4 additions & 2 deletions src/boilerplate/common/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ module.exports = {
network_id: 1337, // Any network (default: none)
gas: 10000000,
},
mumbai: {
amoy: {
networkCheckTimeout: 10000,
provider: () => new HDWalletProvider(mnemonic, rpcUrl),
network_id: 80001,
network_id: 80002,
gas:8500000,
gasPrice:30000000000,
confirmations: 2,
timeoutBlocks: 200,
port: 8545,
Expand Down

0 comments on commit a831339

Please sign in to comment.