-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
docs/build/smart-contracts/getting-started/testnet-to-mainnet.mdx
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,86 @@ | ||
--- | ||
sidebar_position: 50 | ||
title: 5. Move from Testnet to Mainnet | ||
description: Move from Testnet to Miannet. | ||
pagination_next: build/apps/dapp-frontend | ||
--- | ||
|
||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta property="og:title" content="Move from Testnet to Mainnet." /> | ||
<meta property="og:description" content="Move from Testnet to Mainnet." /> | ||
</head> | ||
|
||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import { getPlatform } from "@site/src/helpers/getPlatform"; | ||
|
||
## Moving a Contract from Testnet to Mainnet | ||
|
||
This guide outlines the process for securely deploying Soroban smart contracts from testnet to mainnet using GitHub Actions and Github Attestation for source code validation. | ||
|
||
## Steps to Deploy | ||
|
||
### 1. Set Up Contract Source Validation | ||
|
||
- Configure your GitHub repository for automated source validation. | ||
- Create a workflow file `.github/workflows/release.yml` in your repository. | ||
|
||
Example workflow: | ||
|
||
```yaml | ||
name: Build and Release # arbitrary name | ||
on: | ||
push: | ||
tags: | ||
- "v*" # triggered whenever a new tag (prefixed with "v") is pushed | ||
|
||
permissions: # required permissions | ||
id-token: write | ||
contents: write | ||
attestations: write | ||
|
||
jobs: | ||
release-contract-a: | ||
uses: stellar-expert/soroban-build-workflow/.github/workflows/release.yml@main | ||
with: | ||
release_name: ${{ github.ref_name }} # git tag as unique release name | ||
release_description: "Contract release" # text to attach to the release | ||
relative_path: '["src/my-awesome-contract"]' # relative contract path | ||
package: "my-awesome-contract" # package name to build | ||
make_target: "build-dependencies" # make target to invoke | ||
secrets: # authentication tokens will be automatically created by GitHub | ||
release_token: ${{ secrets.GITHUB_TOKEN }} # don't modify this line | ||
``` | ||
### 2. Compile and Validate Contract | ||
- Trigger the workflow by pushing a new tag (e.g., `v1.0`). | ||
- The workflow will: | ||
- Compile the contract to WASM. | ||
- Publish a GitHub release with build artifacts. | ||
- Generate a GitHub attestation, linking the WASM to the source code. | ||
|
||
```bash | ||
stellar contract build \ | ||
--meta name="Contract Name" \ | ||
--meta description="Descripton of the contract" | ||
--meta source="https://api.github.com/repos/<user_name>/<repo_name>" | ||
``` | ||
|
||
### 3. Deploy to Mainnet | ||
|
||
- Retrieve the compiled WASM from the GitHub release. | ||
- Deploy the WASM to the Stellar mainnet using the Soroban CLI: | ||
|
||
```bash | ||
stellar contract deploy --source-acount <source-account> --wasm <path-to-wasm> --network mainnet | ||
``` | ||
|
||
### 4. Verify Contract Authenticity | ||
|
||
Use the GitHub API to confirm the WASM's source: Retrieve attestation via: `https://api.github.com/repos/<user_name>/<repo_name>/attestations/sha256:<wasm_hash>` Ensure the source code and commit hash match the deployed contract. | ||
|
||
## Up next | ||
|
||
Ready to turn these deployed contracts into a simple web application? Head over to the [Build a Dapp Frontend section](../../apps/dapp-frontend.mdx). |