-
Notifications
You must be signed in to change notification settings - Fork 126
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 #96 from renproject/feat/integration-ava
Feat/integration ava
- Loading branch information
Showing
9 changed files
with
207 additions
and
5 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 |
---|---|---|
|
@@ -20,6 +20,10 @@ RUN apt-get update && \ | |
ENV GO111MODULE=on | ||
ENV GOPROXY=https://proxy.golang.org | ||
|
||
ARG GITHUB_TOKEN | ||
RUN git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/" | ||
ENV GOPRIVATE=github.com/renproject/ren-solana | ||
|
||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
||
|
@@ -39,6 +43,6 @@ RUN mkdir -p src/github.com/renproject | |
WORKDIR $GOPATH/src/github.com/renproject | ||
RUN git clone https://github.com/renproject/solana-ffi | ||
WORKDIR $GOPATH/src/github.com/renproject/solana-ffi | ||
RUN git checkout df7838d724f5eaf262ed77ed93b35b3f1f652bd3 | ||
RUN git checkout f6521b8a1af44f4d468bc8e7e67ba3766a5602ef | ||
RUN make clean && make | ||
RUN go install ./... |
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,26 @@ | ||
FROM ubuntu:groovy | ||
|
||
RUN apt update -y | ||
RUN apt-get install -y wget curl build-essential | ||
|
||
# INSTALL GO AND RUST | ||
RUN wget -c https://golang.org/dl/go1.15.5.linux-amd64.tar.gz | ||
RUN tar -C /usr/local -xzf go1.15.5.linux-amd64.tar.gz | ||
ENV PATH=$PATH:/usr/local/go/bin | ||
|
||
# Fetch avalanchego | ||
WORKDIR /app | ||
RUN wget https://github.com/ava-labs/avalanchego/releases/download/v1.4.5/avalanchego-linux-amd64-v1.4.5.tar.gz | ||
RUN tar -xzf avalanchego-linux-amd64-v1.4.5.tar.gz | ||
RUN rm avalanchego-linux-amd64-v1.4.5.tar.gz | ||
ENV PATH=$PATH:/app/avalanchego-v1.4.5 | ||
|
||
# COPY run script | ||
COPY run.sh run.sh | ||
RUN chmod +x run.sh | ||
|
||
# RPC SERVER PORT | ||
EXPOSE 9650 | ||
|
||
# RUN | ||
ENTRYPOINT [ "./run.sh" ] |
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,103 @@ | ||
#!/bin/bash | ||
|
||
AVAX_USERNAME=$1 | ||
AVAX_PASSWORD=$2 | ||
AVAX_PK=$3 | ||
AVAX_ADDRESS=$4 | ||
C_AVAX_PK=$5 | ||
C_AVAX_HEX_ADDRESS=$6 | ||
C_AVAX_BECH32_ADDRESS=$7 | ||
|
||
avalanchego \ | ||
--assertions-enabled=true \ | ||
--tx-fee=1000000 \ | ||
--public-ip=0.0.0.0 \ | ||
--network-id=local \ | ||
--signature-verification-enabled=true \ | ||
--api-admin-enabled=true \ | ||
--api-ipcs-enabled=true \ | ||
--api-keystore-enabled=true \ | ||
--api-metrics-enabled=true \ | ||
--http-host=0.0.0.0 \ | ||
--http-port=9650 \ | ||
--http-tls-enabled=false \ | ||
--plugin-dir=/app/avalanchego-v1.4.5/avalanchego-latest/plugins \ | ||
--log-level=info \ | ||
--snow-avalanche-batch-size=30 \ | ||
--snow-avalanche-num-parents=5 \ | ||
--snow-sample-size=1 \ | ||
--snow-quorum-size=1 \ | ||
--snow-virtuous-commit-threshold=1 \ | ||
--snow-rogue-commit-threshold=4 \ | ||
--staking-enabled=false \ | ||
--staking-port=9651 \ | ||
--api-auth-required=false & | ||
|
||
# create a new user | ||
sleep 10 | ||
curl -X POST --data '{ | ||
"jsonrpc":"2.0", | ||
"id" :1, | ||
"method" :"keystore.createUser", | ||
"params" :{ | ||
"username":"'"$AVAX_USERNAME"'", | ||
"password":"'"$AVAX_PASSWORD"'" | ||
} | ||
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore | ||
|
||
# import private key that contains AVAX into X-chain | ||
sleep 1 | ||
curl -X POST --data '{ | ||
"jsonrpc":"2.0", | ||
"id" :1, | ||
"method" :"avm.importKey", | ||
"params" :{ | ||
"username":"'"$AVAX_USERNAME"'", | ||
"password":"'"$AVAX_PASSWORD"'", | ||
"privateKey":"'"$AVAX_PK"'" | ||
} | ||
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X | ||
|
||
# import private key into C-chain | ||
sleep 1 | ||
curl -X POST --data '{ | ||
"jsonrpc":"2.0", | ||
"id" :1, | ||
"method" :"avax.importKey", | ||
"params" :{ | ||
"username" :"'"$AVAX_USERNAME"'", | ||
"password":"'"$AVAX_PASSWORD"'", | ||
"privateKey":"'"$AVAX_PK"'" | ||
} | ||
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/avax | ||
|
||
# export the AVAX to C-chain | ||
sleep 1 | ||
curl -X POST --data '{ | ||
"jsonrpc":"2.0", | ||
"id" :1, | ||
"method" :"avm.exportAVAX", | ||
"params" :{ | ||
"to":"'"$C_AVAX_BECH32_ADDRESS"'", | ||
"destinationChain": "C", | ||
"amount": 5000000000000, | ||
"username":"'"$AVAX_USERNAME"'", | ||
"password":"'"$AVAX_PASSWORD"'" | ||
} | ||
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X | ||
|
||
# import AVAX to the hex address | ||
sleep 1 | ||
curl -X POST --data '{ | ||
"jsonrpc":"2.0", | ||
"id" :1, | ||
"method" :"avax.importAVAX", | ||
"params" :{ | ||
"to":"'"$C_AVAX_HEX_ADDRESS"'", | ||
"sourceChain":"X", | ||
"username":"'"$AVAX_USERNAME"'", | ||
"password":"'"$AVAX_PASSWORD"'" | ||
} | ||
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/C/avax | ||
|
||
wait %1 |
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