Skip to content

Commit d5453c1

Browse files
committed
add updates
1 parent feea961 commit d5453c1

1 file changed

Lines changed: 52 additions & 41 deletions

File tree

docs/base-chain/quickstart/base-solana-bridge.mdx

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,23 @@ This guide covers the bridge architecture and provides practical examples for im
2323
### On Base
2424
The Base bridge contract locks or burns your tokens and emits a message. Validators collect these messages into Merkle trees and post roots to Solana every ~15 minutes. You then prove your message exists in the tree to complete the transfer on Solana.
2525

26-
**Smart contracts:**
27-
- **Bridge Contract** (`0xB2068ECCDb908902C76E3f965c1712a9cF64171E`): Handles outgoing transfers
28-
- **CrossChainERC20**: Mintable/burnable tokens for cross-chain transfers
29-
- **BridgeValidator**: Validates messages with oracle signatures
26+
**Key Smart contracts:**
27+
- [**Bridge Contract**](https://github.com/base/bridge/blob/main/base/src/Bridge.sol): Handles outgoing transfers
28+
- [**CrossChainERC20**](https://github.com/base/bridge/blob/main/base/src/CrossChainERC20.sol): Mintable/burnable tokens for cross-chain transfers
29+
- [**BridgeValidator**](https://github.com/base/bridge/blob/main/base/src/BridgeValidator.sol): Validates messages with oracle signatures
30+
- [**Twin Contract**](https://github.com/base/bridge/blob/main/base/src/Twin.sol): Your personal smart contract on Base for executing calls from Solana
31+
32+
<Tip>
33+
**What is the Twin Contract?**
34+
The Twin Contract is a smart contract that acts as your execution context on Base.
35+
It represents the `msg.sender` on Base when you send an arbitrary contract call from Solana.
36+
</Tip>
3037

3138
### On Solana
3239
The Solana bridge program locks or burns your tokens and emits events. Validators relay these messages to Base where they're executed through your personal Twin contract - a smart contract that acts as your execution context on Base.
33-
**Programs:**
34-
- **Bridge Program** (`HSvNvzehozUpYhRBuCKq3Fq8udpRocTmGMUYXmCSiCCc`): Handles outgoing transfers
35-
- **Base Relayer Program** (`ExS1gcALmaA983oiVpvFSVohi1zCtAUTgsLj5xiFPPgL`): Coordinates message relay
36-
- **Twin Contracts**: Your personal smart contract on Base for receiving tokens
40+
**Key Programs:**
41+
- [**Bridge Program**](https://github.com/base/bridge/blob/main/solana/programs/bridge): Handles outgoing transfers
42+
- [**Base Relayer Program**](https://github.com/base/bridge/blob/main/solana/programs/base_relayer): Coordinates message relay
3743

3844
You can access the full repository from the link below:
3945
<GithubRepoCard title="Base Bridge - Official Repository" githubUrl="https://github.com/base/bridge" />
@@ -148,6 +154,44 @@ const relayIx = getRelayMessageInstruction({ message: messagePda });
148154
await buildAndSendTransaction(SOLANA_RPC_URL, [proveIx, relayIx], payer);
149155
```
150156

157+
## Utilities
158+
159+
The repository includes utilities for converting between Solana and Base address formats,
160+
getting your Solana CLI keypair for signing transactions,
161+
and building and sending Solana transactions.
162+
163+
<GithubRepoCard title="Base Bridge Examples - Utilities" githubUrl="https://github.com/jackchuma/base-bridge-examples/tree/main/bridgeSolFromBaseToSolana/utils" />
164+
165+
### Address Conversion
166+
167+
Convert Solana pubkey to bytes32 for Base contracts:
168+
```typescript example.ts
169+
// Convert Solana pubkey to bytes32 for Base contracts
170+
import { pubkeyToBytes32 } from "./utils/pubkeyToBytes32";
171+
172+
const bytes32Address = pubkeyToBytes32(solanaAddress);
173+
```
174+
175+
### Keypair Management
176+
177+
Get your Solana CLI keypair for signing transactions:
178+
179+
```typescript example.ts
180+
import { getSolanaCliConfigKeypairSigner } from "./utils/keypair";
181+
182+
const payer = await getSolanaCliConfigKeypairSigner();
183+
```
184+
185+
### Transaction Building
186+
187+
Build and send Solana transactions:
188+
189+
```typescript example.ts
190+
import { buildAndSendTransaction } from "./utils/buildAndSendTransaction";
191+
192+
const signature = await buildAndSendTransaction(SOLANA_RPC_URL, ixs, payer);
193+
```
194+
151195
## Sol2Base: Full Stack Example
152196

153197
<GithubRepoCard title="Sol2Base - Full Stack Bridge App" githubUrl="https://github.com/base/sol2base" />
@@ -406,39 +450,6 @@ To get access to the faucet API, you can follow the instructions [here](https://
406450
}
407451
```
408452

409-
## Utilities
410-
411-
### Address Conversion
412-
413-
The repository includes utilities for converting between Solana and Base address formats:
414-
415-
```typescript
416-
// Convert Solana pubkey to bytes32 for Base contracts
417-
import { pubkeyToBytes32 } from "./utils/pubkeyToBytes32";
418-
419-
const bytes32Address = pubkeyToBytes32(solanaAddress);
420-
```
421-
422-
### Keypair Management
423-
424-
Get your Solana CLI keypair for signing transactions:
425-
426-
```typescript
427-
import { getSolanaCliConfigKeypairSigner } from "./utils/keypair";
428-
429-
const payer = await getSolanaCliConfigKeypairSigner();
430-
```
431-
432-
### Transaction Building
433-
434-
Build and send Solana transactions:
435-
436-
```typescript
437-
import { buildAndSendTransaction } from "./utils/buildAndSendTransaction";
438-
439-
const signature = await buildAndSendTransaction(SOLANA_RPC_URL, ixs, payer);
440-
```
441-
442453
## Troubleshooting
443454

444455
<AccordionGroup>

0 commit comments

Comments
 (0)