You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: basics/solana-signature-verification/anchor/README.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,30 @@
1
1
# Solana Program: Unlocking a Vault Based on SOL Price and Signature Verification
2
+
2
3
This Solana escrow program allows users to withdraw funds only when the SOL price reaches a certain target and after verifying their Ed25519 signature.
4
+
3
5
## Ed25519 Signature Verification
6
+
4
7
In Solana, programs cannot directly call the Ed25519 program using a CPI (Cross-Program Invocation) because signature verification is computationally expensive. Instead, the Ed25519 signature verification program exists as a precompiled instruction outside the Solana Virtual Machine (SVM).
5
8
we do verification by passing two instructions one [Ed25519 program](https://github.com/anza-xyz/agave/blob/master/sdk/ed25519-program/src/lib.rs) ix and second our custom logic ix (it mush have a sysvar ix to get current chain state)
6
9
7
10
The sysvar instructions account provides access to all instructions within the same transaction.
8
11
This allows our program to fetch and verify the arguments passed to the Ed25519 program, ensuring they were correctly signed before unlocking funds.
12
+
13
+
## Running test
14
+
15
+
To run this test on devnet, you can do the following:
16
+
17
+
```bash
18
+
$ pnpm install
19
+
$ anchor test --skip-deploy
20
+
```
21
+
9
22
# Vault Unlock Conditions
23
+
10
24
The SOL price must meet or exceed the target threshold & Ed25519 signature must be verified
0 commit comments