Skip to content

Commit d47ef14

Browse files
authored
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
2 parents 0c2e638 + ec1f5bb commit d47ef14

File tree

154 files changed

+17136
-2898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+17136
-2898
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ node_modules
2222
# cli
2323
dist
2424

25+
# logs
2526
logs/
27+
ethlocal.service.log
28+
secret.service.log
29+
secret-docker.log
30+
relayer.service.log
31+
run.log
2632

2733
**/node_modules/
2834
**/yarn-error.log
@@ -31,11 +37,14 @@ logs/
3137
.nx/cache
3238
tsconfig.tsbuildinfo
3339
.env
34-
packages/secret-upload-contract/.env
40+
packages/secret-contracts-scripts/.env
3541
packages/secret-instantiate-contract/.env
3642

3743
## ignore different deployments while we are in dev (comment this once contracts stable)
3844
packages/nextjs/contracts/deployedContracts.ts
3945

4046
## NB hardhat ignores are in packages/hardhat/.gitignore
4147

48+
# yq files
49+
yq.1
50+
install-man-page.sh

.gitmodules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "relayer"]
2+
path = packages/relayer/SecretPath
3+
url = [email protected]:ltfschoen/SecretPath.git
4+
branch = nunya

.yarn/releases/yarn-4.2.2.cjs

Lines changed: 0 additions & 894 deletions
This file was deleted.

.yarn/releases/yarn-4.5.3.cjs

Lines changed: 934 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ nmHoistingLimits: workspaces
88

99
nodeLinker: node-modules
1010

11-
yarnPath: .yarn/releases/yarn-4.2.2.cjs
11+
yarnPath: .yarn/releases/yarn-4.5.3.cjs

_DEMO_AND_VIDEO.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,5 @@
2222
* Video of Nunya.business compile, upload, and instantiate a SecretPath Public Gateway Contract to Sepolia Ethereum Testnet.
2323
[YouTube Link](https://youtu.be/O0unCWsrKA4)
2424
* It successfully also deploys NunyaBusiness contract since we added `secretContract = IGateway(gateway);` to use an interface based on Gateway.sol instead of the old DummyGatewayContract interface file.
25-
* Note: The Gateway was deployed with tx: 0x848763e137d97ea53000f360fa27db943f47a13e4e03982320d72dec33478e36 to address 0x41E52332e76988AFBc38280583a7A02492177C65
26-
* Note: The NunyaContract was deployed with tx:
2725

2826
* Video of Nunya.business frontend integration [video](./assets/demo.mp4)

_MAINTAINER.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Maintainer Only
2+
3+
Note applicable if you do not maintain the repository.
4+
5+
### Setup Github SSH Keys
6+
* Generate Github SSH keys on remote machine. Copy the output to Github SSH Keys https://github.com/settings/keys
7+
```bash
8+
apt-get install -y xclip && \
9+
ssh-keygen -y -t rsa -f ~/.ssh/id_rsa -P "" && \
10+
cat ~/.ssh/id_rsa.pub
11+
```
12+
13+
### Remove Gitsubmodule
14+
15+
* Remove submodule from ./.git/config
16+
* Other changes
17+
```bash
18+
git rm -r --cached ./packages/relayer
19+
rm -rf ./.git/modules/
20+
rm -rf ./packages/relayer/
21+
rm ./.gitmodules
22+
git restore --staged .gitmodules
23+
git ls-files --stage | grep 160000
24+
```
25+
26+
### Setup Gitsubmodule
27+
28+
* 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
29+
30+
```bash
31+
git config --local --add checkout.defaultRemote origin
32+
git config status.submodulesummary 1
33+
git submodule add -b nunya --name relayer -- [email protected]:ltfschoen/SecretPath.git packages/relayer/SecretPath
34+
git submodule status
35+
git ls-files --stage | grep 160000
36+
```

_SETUP.md

Lines changed: 359 additions & 141 deletions
Large diffs are not rendered by default.

_UNSORTED.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
## Unsorted
2+
3+
The below is unfinished work that may not be necessary anymore.
4+
5+
### WIP - SecretCLI <a id="run-secret-cli"></a>
6+
7+
Enter Secret Development Docker container to interact manually with SecretCLI:
8+
9+
```bash
10+
docker exec -it secretdev /bin/bash
11+
secretcli --help
12+
secretcli keys list
13+
ls /root/.secretd/config
14+
```
15+
16+
* 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`.
17+
```
18+
Account #0: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
19+
privateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
20+
```
21+
22+
* TODO - is this necessary? why not just use the default account?
23+
24+
* 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).
25+
* Reference: https://docs.scrt.network/secret-network-documentation/infrastructure/secret-cli/configuration
26+
27+
```
28+
docker exec -it secretdev /bin/bash
29+
secretcli config view
30+
secretcli config set client node tcp://localhost:26657
31+
secretcli config set client chain-id secretdev-1
32+
secretcli config set client output json
33+
secretcli config set client keyring-backend test
34+
secretcli config view client --output-format json
35+
secretcli config home
36+
37+
secretcli query bank balances secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 | jq
38+
secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq
39+
```
40+
* Note: Configuration is stored in /root/.secretd/config/client.toml
41+
* Note: `keyring-backend` is where the keys are stored from possible options including: (os|file|kwallet|pass|test|memory)
42+
* Note: We need the 300000uscrt to process the broadcast the `submitRequestValue` transaction from the relayer, so give them more than that.
43+
* 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`
44+
```
45+
secretcli tx bank send secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03 secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg 100000000000000000uscrt -y
46+
47+
secretcli query bank balances secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg | jq
48+
```
49+
50+
* Note: This is necessary because the default account only has a mnemonic phrase, not a private key.
51+
52+
* IGNORE
53+
```
54+
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"
55+
echo $a_mnemonic | secretcli keys add account --recover
56+
secretcli keys show account
57+
58+
# it should output `secret1ap26qrlp8mcq2pg6r47w43l0y8zkqm8a450s03`
59+
60+
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"
61+
echo $b_mnemonic | secretcli keys add account2 --recover
62+
secretcli keys show account2
63+
64+
# it should output `secret1fc3fzy78ttp0lwuujw7e52rhspxn8uj52zfyne`
65+
66+
custom_mnemonic="<INSERT_MNEMONIC_PHRASE>"
67+
echo $custom_mnemonic | secretcli keys add custom --hd-path="m/44'/60'/0'/0" --recover
68+
secretcli keys show custom
69+
```
70+
71+
* IGNORE
72+
* 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?
73+
* 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`
74+
References:
75+
* https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
76+
* https://ethereum.stackexchange.com/questions/19055/what-is-the-difference-between-m-44-60-0-0-and-m-44-60-0
77+
* Note: The `coin_type` is `529` for Secret Network by default, but we generated it using MyCrypto for Ether, which is `60`
78+
References:
79+
* https://help.keplr.app/articles/how-to-set-a-custom-derivation-path
80+
* TODO
81+
* https://github.com/scrtlabs/SecretNetwork/issues/1690
82+
* https://github.com/scrtlabs/SecretNetwork/issues/1689

deployed.json

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"data": {
3+
"relayer": {
4+
"path": "/root/nunya/packages/relayer"
5+
},
6+
"evm": {
7+
"network": "localhost",
8+
"localhost": {
9+
"chainId": "31337",
10+
"endpoint": "http://127.0.0.1:8545",
11+
"nunyaBusinessContractAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
12+
"gatewayContractAddress": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"
13+
},
14+
"sepolia": {
15+
"chainId": "11155111",
16+
"endpoint": "",
17+
"nunyaBusinessContractAddress": "0xAFFF311821C3F3AF863C7103BB17BDC1Ba04603D",
18+
"gatewayContractAddress": "0x1E4B12A9F82b33DA1127B27861EFf5E652de7a6F"
19+
}
20+
},
21+
"secret": {
22+
"network": "localhost",
23+
"testnet": {
24+
"chainId": "",
25+
"endpoint": "",
26+
"secretNunya": {
27+
"nunyaContractCodeId": "",
28+
"nunyaContractCodeHash": "",
29+
"nunyaContractAddress": ""
30+
},
31+
"secretGateway": {
32+
"gatewayContractCodeId": "",
33+
"gatewayContractAddress": "",
34+
"gatewayContractCodeHash": "",
35+
"gatewayContractAdminAddress": "",
36+
"gatewayContractPublicKey": "",
37+
"gatewayContractEncryptionKeyForChaChaPoly1305": ""
38+
}
39+
},
40+
"localhost": {
41+
"chainId": "secretdev-1",
42+
"endpoint": "http://127.0.0.1:1317",
43+
"secretNunya": {
44+
"nunyaContractCodeId": "2",
45+
"nunyaContractCodeHash": "57f4f72804e180100c7108282fc46fa6275bee92829a3faa9e18526c9105948e",
46+
"nunyaContractAddress": "secret1gyruqan6yxf0q423t8z5zce3x7np35uw8s8wqc"
47+
},
48+
"secretGateway": {
49+
"gatewayContractCodeId": "1",
50+
"gatewayContractAddress": "secret1mfk7n6mc2cg6lznujmeckdh4x0a5ezf6hx6y8q",
51+
"gatewayContractCodeHash": "be3db4b4c42d33300eee7801769a4176ed3046f23c08812fc2a85bc76075e1d5",
52+
"gatewayContractAdminAddress": "secret1glfedwlusunwly7q05umghzwl6nf2vj6wr38fg",
53+
"gatewayContractPublicKey": "0x047c4f7a52a10c051639ec0edd3e2d44fef02d993de6b8412273a78ca67f9c10c66069161d67278de0c74c501de435335163d6b7c5a22abae70e49d83a2b3debbd",
54+
"gatewayContractEncryptionKeyForChaChaPoly1305": "A3xPelKhDAUWOewO3T4tRP7wLZk95rhBInOnjKZ/nBDG"
55+
}
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)