Skip to content

Commit 53e8f1d

Browse files
committed
feat(SOLNENG-27): initial commit
0 parents  commit 53e8f1d

File tree

5 files changed

+562
-0
lines changed

5 files changed

+562
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.crt
2+
*.key
3+
.vscode

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
## Sample go staking app demo
3+
4+
5+
```mermaid
6+
sequenceDiagram
7+
autonumber
8+
participant StakeClient as Sample stake<br> client application
9+
participant StakeAPI as Stake Intent API
10+
participant Blockchain as Blockchain
11+
participant TSM as Sender Wallet Vault<br>(private key)
12+
13+
StakeClient ->> StakeAPI: get StakeIntent unsigned tx data <br>(amount, withdrawal & recipient address)
14+
StakeClient ->> Blockchain: get blockchain inputs for new tx<br>(gas fee, chainID, sender wallet nonce)
15+
StakeClient ->> StakeClient: construct unsigned tx
16+
StakeClient ->> TSM: request signature of unsigned tx
17+
TSM -->> StakeClient: return tx signature
18+
StakeClient ->> Blockchain: broadcast signed tx<br>(signed tx, deposit contract)
19+
```
20+
21+
22+
<!--
23+
- ToDo:
24+
- use AWS Builder Vault environment (remove all code needed for mTLS with BDApp Builder Vault)
25+
26+
# Get Plans
27+
http -b GET https://svc.blockdaemon.com/boss/v1/plans?protocols=ethereum&networks=holesky \
28+
X-API-KEY:$XAPIKEY \
29+
X-Client-ID:demo-organization
30+
31+
# Post Intent
32+
http -b POST https://svc.blockdaemon.com/boss/v1/ethereum/holesky/stake-intents \
33+
X-API-KEY:$XAPIKEY \
34+
accept:application/json \
35+
content-type:application/json \
36+
stakes:='[{"amount":"32000000000","withdrawal_address":"0x00000000219ab540356cBB839Cbe05303d7705Fa","fee_recipient":"0x93247f2209abcacf57b75a51dafae777f9dd38bc"}]'
37+
38+
# Get Intents
39+
http GET https://svc.blockdaemon.com/boss/v1/stake-intents?protocols=ethereum&networks=holesky \
40+
X-API-KEY:$XAPIKEY
41+
```
42+
--!>

go.mod

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
module samplestakedemo
2+
3+
go 1.21.0
4+
5+
require (
6+
github.com/ethereum/go-ethereum v1.13.14
7+
gitlab.com/Blockdaemon/go-tsm-sdkv2 v0.0.0-20240227205306-65d60d978f8d
8+
golang.org/x/sync v0.6.0
9+
)
10+
11+
require (
12+
filippo.io/edwards25519 v1.1.0 // indirect
13+
github.com/Microsoft/go-winio v0.6.1 // indirect
14+
github.com/StackExchange/wmi v1.2.1 // indirect
15+
github.com/bits-and-blooms/bitset v1.10.0 // indirect
16+
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
17+
github.com/consensys/bavard v0.1.13 // indirect
18+
github.com/consensys/gnark-crypto v0.12.1 // indirect
19+
github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect
20+
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
21+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
22+
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
23+
github.com/go-ole/go-ole v1.3.0 // indirect
24+
github.com/gorilla/websocket v1.4.2 // indirect
25+
github.com/holiman/uint256 v1.2.4 // indirect
26+
github.com/mmcloughlin/addchain v0.4.0 // indirect
27+
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
28+
github.com/supranational/blst v0.3.11 // indirect
29+
github.com/tklauser/go-sysconf v0.3.12 // indirect
30+
github.com/tklauser/numcpus v0.6.1 // indirect
31+
golang.org/x/crypto v0.20.0 // indirect
32+
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
33+
golang.org/x/mod v0.14.0 // indirect
34+
golang.org/x/sys v0.17.0 // indirect
35+
golang.org/x/tools v0.15.0 // indirect
36+
rsc.io/tmplfunc v0.0.3 // indirect
37+
)

0 commit comments

Comments
 (0)