-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from svub/submit-pubkey
feat: End-to-end request via custom EVM Gateway.sol on Ethereum Local Network to custom Relayer to custom Secret contract on Localsecret with response back and then to NunyaBusiness.sol
- Loading branch information
Showing
154 changed files
with
17,136 additions
and
2,898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "relayer"] | ||
path = packages/relayer/SecretPath | ||
url = [email protected]:ltfschoen/SecretPath.git | ||
branch = nunya |
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## Maintainer Only | ||
|
||
Note applicable if you do not maintain the repository. | ||
|
||
### Setup Github SSH Keys | ||
* Generate Github SSH keys on remote machine. Copy the output to Github SSH Keys https://github.com/settings/keys | ||
```bash | ||
apt-get install -y xclip && \ | ||
ssh-keygen -y -t rsa -f ~/.ssh/id_rsa -P "" && \ | ||
cat ~/.ssh/id_rsa.pub | ||
``` | ||
|
||
### Remove Gitsubmodule | ||
|
||
* Remove submodule from ./.git/config | ||
* Other changes | ||
```bash | ||
git rm -r --cached ./packages/relayer | ||
rm -rf ./.git/modules/ | ||
rm -rf ./packages/relayer/ | ||
rm ./.gitmodules | ||
git restore --staged .gitmodules | ||
git ls-files --stage | grep 160000 | ||
``` | ||
|
||
### Setup Gitsubmodule | ||
|
||
* Note: The path argument must match the output of `git ls-files --stage | grep 160000`, and it should include the repository name at the end | ||
|
||
```bash | ||
git config --local --add checkout.defaultRemote origin | ||
git config status.submodulesummary 1 | ||
git submodule add -b nunya --name relayer -- [email protected]:ltfschoen/SecretPath.git packages/relayer/SecretPath | ||
git submodule status | ||
git ls-files --stage | grep 160000 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
## Unsorted | ||
|
||
The below is unfinished work that may not be necessary anymore. | ||
|
||
### WIP - SecretCLI <a id="run-secret-cli"></a> | ||
|
||
Enter Secret Development Docker container to interact manually with SecretCLI: | ||
|
||
```bash | ||
docker exec -it secretdev /bin/bash | ||
secretcli --help | ||
secretcli keys list | ||
ls /root/.secretd/config | ||
``` | ||
|
||
* IGNORE - Transfer some Localhost Ethereum tokens from a default account like `Account #0` that is shown when running Ethereum Localhost to an Ethereum wallet address associated with the private key `ETH_DEVELOPMENT_PRIVATE_KEY`. | ||
``` | ||
Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH) | ||
privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", | ||
``` | ||
|
||
* TODO - is this necessary? why not just use the default account? | ||
|
||
* Transfer some Localhost Secret tokens from a default account that is shown when running Secret Localhost (e.g. secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03) to that Secret wallet address (e.g. secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg). | ||
* Reference: https://docs.scrt.network/secret-network-documentation/infrastructure/secret-cli/configuration | ||
|
||
``` | ||
docker exec -it secretdev /bin/bash | ||
secretcli config view | ||
secretcli config set client node tcp://localhost:26657 | ||
secretcli config set client chain-id secretdev-1 | ||
secretcli config set client output json | ||
secretcli config set client keyring-backend test | ||
secretcli config view client --output-format json | ||
secretcli config home | ||
secretcli query bank balances secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 | jq | ||
secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq | ||
``` | ||
* Note: Configuration is stored in /root/.secretd/config/client.toml | ||
* Note: `keyring-backend` is where the keys are stored from possible options including: (os|file|kwallet|pass|test|memory) | ||
* Note: We need the 300000uscrt to process the broadcast the `submitRequestValue` transaction from the relayer, so give them more than that. | ||
* Note: If you forget to do this before running the relayer, then you might get error `[SCRT Interface: ERROR] Failed to fetch account info: HTTP 404` | ||
``` | ||
secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt -y | ||
secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq | ||
``` | ||
|
||
* Note: This is necessary because the default account only has a mnemonic phrase, not a private key. | ||
|
||
* IGNORE | ||
``` | ||
a_mnemonic="grant rice replace explain federal release fix clever romance raise often wild taxi quarter soccer fiber love must tape steak together observe swap guitar" | ||
echo $a_mnemonic | secretcli keys add account --recover | ||
secretcli keys show account | ||
# it should output `secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03` | ||
b_mnemonic="jelly shadow frog dirt dragon use armed praise universe win jungle close inmate rain oil canvas beauty pioneer chef soccer icon dizzy thunder meadow" | ||
echo $b_mnemonic | secretcli keys add account2 --recover | ||
secretcli keys show account2 | ||
# it should output `secret1fc3fzy78ttp0lwuujw7e52rhspxn8uj52zfyne` | ||
custom_mnemonic="<INSERT_MNEMONIC_PHRASE>" | ||
echo $custom_mnemonic | secretcli keys add custom --hd-path="m/44'/60'/0'/0" --recover | ||
secretcli keys show custom | ||
``` | ||
* IGNORE | ||
* TODO - why doesn't the wallet address recovered with `custom_mnemonic` match the one that was generated with MyCrypto when recovering it with that mnemonic phrase? is it possible to recover with the private key instead so it recovers the correct wallet address? | ||
* Note: Used `m/44'/60'/0'/0` since that was the default HD path chosen when generating the wallet in MyCrypto for use with Metamask that uses BIP44 derivation, where the HD path is defined as `m / purpose' / coin_type' / account' / change / address_index` | ||
References: | ||
* https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki | ||
* https://ethereum.stackexchange.com/questions/19055/what-is-the-difference-between-m-44-60-0-0-and-m-44-60-0 | ||
* Note: The `coin_type` is `529` for Secret Network by default, but we generated it using MyCrypto for Ether, which is `60` | ||
References: | ||
* https://help.keplr.app/articles/how-to-set-a-custom-derivation-path | ||
* TODO | ||
* https://github.com/scrtlabs/SecretNetwork/issues/1690 | ||
* https://github.com/scrtlabs/SecretNetwork/issues/1689 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{ | ||
"data": { | ||
"relayer": { | ||
"path": "/root/nunya/packages/relayer" | ||
}, | ||
"evm": { | ||
"network": "localhost", | ||
"localhost": { | ||
"chainId": "31337", | ||
"endpoint": "http://127.0.0.1:8545", | ||
"nunyaBusinessContractAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3", | ||
"gatewayContractAddress": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512" | ||
}, | ||
"sepolia": { | ||
"chainId": "11155111", | ||
"endpoint": "", | ||
"nunyaBusinessContractAddress": "0xAFFF311821C3F3AF863C7103BB17BDC1Ba04603D", | ||
"gatewayContractAddress": "0x1E4B12A9F82b33DA1127B27861EFf5E652de7a6F" | ||
} | ||
}, | ||
"secret": { | ||
"network": "localhost", | ||
"testnet": { | ||
"chainId": "", | ||
"endpoint": "", | ||
"secretNunya": { | ||
"nunyaContractCodeId": "", | ||
"nunyaContractCodeHash": "", | ||
"nunyaContractAddress": "" | ||
}, | ||
"secretGateway": { | ||
"gatewayContractCodeId": "", | ||
"gatewayContractAddress": "", | ||
"gatewayContractCodeHash": "", | ||
"gatewayContractAdminAddress": "", | ||
"gatewayContractPublicKey": "", | ||
"gatewayContractEncryptionKeyForChaChaPoly1305": "" | ||
} | ||
}, | ||
"localhost": { | ||
"chainId": "secretdev-1", | ||
"endpoint": "http://127.0.0.1:1317", | ||
"secretNunya": { | ||
"nunyaContractCodeId": "2", | ||
"nunyaContractCodeHash": "57f4f72804e180100c7108282fc46fa6275bee92829a3faa9e18526c9105948e", | ||
"nunyaContractAddress": "secret1gyruqan6yxf0q423t8z5zce3x7np35uw8s8wqc" | ||
}, | ||
"secretGateway": { | ||
"gatewayContractCodeId": "1", | ||
"gatewayContractAddress": "secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q", | ||
"gatewayContractCodeHash": "be3db4b4c42d33300eee7801769a4176ed3046f23c08812fc2a85bc76075e1d5", | ||
"gatewayContractAdminAddress": "secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg", | ||
"gatewayContractPublicKey": "0x047c4f7a52a10c051639ec0edd3e2d44fef02d993de6b8412273a78ca67f9c10c66069161d67278de0c74c501de435335163d6b7c5a22abae70e49d83a2b3debbd", | ||
"gatewayContractEncryptionKeyForChaChaPoly1305": "A3xPelKhDAUWOewO3T4tRP7wLZk95rhBInOnjKZ/nBDG" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Generating typings for: 9 artifacts in dir: typechain-types for target: ethers-v6 | ||
Successfully generated 20 typings! | ||
Compiled 9 Solidity files successfully (evm target: paris). | ||
network: localhost | ||
chain id: 31337 | ||
deployerAddress: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | ||
Deployer account balance: 10000.0 ETH | ||
deploying "NunyaBusiness" (tx: 0x932f4c98ac26557cf674d48ae941d2d5d4b402bdf05a2e54ab8f25bbc61ed5c0)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 2871810 gas | ||
Successfully deployed NunyaBusiness to address: 0x5FbDB2315678afecb367f032d93F642f64180aa3 | ||
deploying "Gateway" (tx: 0x21d9641b416d1a45d6d7454155129f258c66ed4dd74276f9494f9d608fa78162)...: deployed at 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 with 3337714 gas | ||
Successfully deployed Gateway to address: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 | ||
setGatewayAddressTx tx hash: 0xe87ded4e0e64d7a0872e7120a2cea2e1be91190d7ac1d762f6e0d13e69aa4caf | ||
👋 Nunya contract: 0x5FbDB2315678afecb367f032d93F642f64180aa3 | ||
NunyaBusiness balance: 0.000500000000021 | ||
Gateway balance: 0.000099999999979 | ||
📝 Updated TypeScript contract definition file on ../nextjs/contracts/deployedContracts.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Generating typings for: 9 artifacts in dir: typechain-types for target: ethers-v6 | ||
Successfully generated 20 typings! | ||
Compiled 9 Solidity files successfully (evm target: paris). | ||
network: sepolia | ||
chain id: 11155111 | ||
hre.network.name: sepolia | ||
deployerAddress: 0x83De04f1aad8ABF1883166B14A29c084b7B8AB59 | ||
Deployer account balance: 6.938448757518362804 ETH | ||
deploying "NunyaBusiness" (tx: 0x95ce8c146374df85ce0f0f5425e65a2e33092a74b972495c005fa038fe094d33)...: deployed at 0xAFFF311821C3F3AF863C7103BB17BDC1Ba04603D with 2871810 gas | ||
Successfully deployed NunyaBusiness to address: 0xAFFF311821C3F3AF863C7103BB17BDC1Ba04603D | ||
deploying "Gateway" (tx: 0x0c5c2b097801afec5518d3714095569b7df2a53dcde0802c192d036dbd95a66a)...: deployed at 0x1E4B12A9F82b33DA1127B27861EFf5E652de7a6F with 3337833 gas | ||
Successfully deployed Gateway to address: 0x1E4B12A9F82b33DA1127B27861EFf5E652de7a6F | ||
setGatewayAddressTx tx hash: 0xefc300507bbddb3ca95dc178d95b857a3771fd0a0334626f036edfe6ffda4343 | ||
👋 Nunya contract: 0xAFFF311821C3F3AF863C7103BB17BDC1Ba04603D | ||
NunyaBusiness balance: 0.0005 | ||
Gateway balance: 0.0 |
Oops, something went wrong.