Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions atlas/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
repository cardano-haskell-packages
url: https://chap.intersectmbo.org/
secure: True
root-keys:
3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f
443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1
a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82
bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

packages:
zkfold-smart-wallet-api
zkfold-smart-wallet-server-lib

tests: true

source-repository-package
type: git
location: https://github.com/geniusyield/atlas
tag: cc48d63d33ca876a54c827edc34a0737c934fda2

-------- Begin contents from @atlas@'s @cabal.project@ file. --------

-- repeating the index-state for hackage to work around hackage.nix parsing limitation
index-state: 2025-01-01T23:24:19Z

-- NOTE: Do not bump chap index beyond that used by target cardano-node version.
index-state:
, hackage.haskell.org 2025-01-01T23:24:19Z
, cardano-haskell-packages 2025-02-11T21:18:23Z

-- TODO: Default value should be @direct@ in upcoming 3.10 version of cabal, omit this line then.
test-show-details: direct

package cardano-crypto-praos
flags: -external-libsodium-vrf

source-repository-package
type: git
location: https://github.com/maestro-org/haskell-sdk
tag: 3e39a6d485d7c6f98222b1ca58aed2fb45e5ff27
--sha256: sha256-plfrSgirKf7WGESYvEBqBkR1s673Qd0ZhGs0KzGfOig=

-- TODO: Temporary, until proposed changes are in upstream (track https://github.com/mlabs-haskell/clb/pull/72)
source-repository-package
type: git
location: https://github.com/sourabhxyz/clb
tag: 1b084647dc9118520c1cc615cf2fa7c3dd8a394e
--sha256: sha256-QliJng5PmJIRJd/l644T0zxBBOKhuMkIgeu1B5ymfVU=
subdir:
clb
emulator

-- TODO: Temporary, remove once we are on 10.9 or above. Fix relates to issue: https://github.com/IntersectMBO/cardano-api/issues/714.
source-repository-package
type: git
location: https://github.com/sourabhxyz/cardano-api
tag: 14674d6b099e8fc36e5044e206bfc32164f75cee
--sha256: sha256-Qr4rv9bLz+wJdICYjxDVnnzgsVwx+wsU+tSFwDYr/kE=
subdir:
cardano-api
cardano-api-gen

-- Using latest version which is not on CHaP.
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-node
tag: 36161c9e00850616bd64b8db0c06bd77eb1ec951
--sha256: sha256-eaaj6kQb/TMGmxAhw355x4kBJfznKAem+rhC9SkmePs=
subdir:
cardano-node
cardano-testnet
trace-dispatcher
trace-forward

-- Temporary until latest version is available on Hackage (or CHaP for that matter). Track https://github.com/IntersectMBO/cardano-addresses/issues/294.
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-addresses
tag: d611632fc3d616d5b4038a70f864bf2613c125d0
--sha256: sha256-vQ2XB95kw05IZuRkyK4cPQtaKZ1bZAoLtN9GrOOwQvM=

------ Following is mostly from @cardano-node@'s @cabal.project@ file. -------

allow-newer:
katip:Win32
, ekg-wai:time

-- Using RDRAND instead of /dev/urandom as an entropy source for key
-- generation is dubious. Set the flag so we use /dev/urandom by default.
package cryptonite
flags: -support_rdrand

package cardano-node
flags: -systemd

package bitvec
flags: -simd

-------- End contents from @cardano-node@'s @cabal.project@ file. --------
-------- Begin contents from @atlas@'s @cabal.project@ file. --------
100 changes: 100 additions & 0 deletions atlas/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# zkFold Smart Wallet API

This repository houses off-chain code and server endpoints to interact with zk based smart wallet by [zkFold](https://zkfold.io/).

## Table of Contents

- [zkFold Smart Wallet API](#zkfold-smart-wallet-api)
- [Table of Contents](#table-of-contents)
- [Structure of repository](#structure-of-repository)
- [zkFold Smart Wallet API Server](#zkfold-smart-wallet-api-server)
- [Building locally from source using the Haskell Toolchain](#building-locally-from-source-using-the-haskell-toolchain)
- [OpenApi documentation](#openapi-documentation)

## Structure of repository

- [`zkfold-smart-wallet-api`](./zkfold-smart-wallet-api/) provides off-chain code to interact with the wallet.
- [`zkfold-smart-wallet-server-lib`](./zkfold-smart-wallet-server-lib/) serves endpoints using our off-chain code to easily interact with the wallet.

## zkFold Smart Wallet API Server

### Building locally from source using the Haskell Toolchain

1. Make sure your environment is configured properly, consult ["How to build?"](https://atlas-app.io/getting-started/how-to-build) section of Atlas documentation for it.
2. Prepare a configuration, which can be stored either in file or in `SERVER_CONFIG` environment variable. Structure of it is as follows:

```yaml
# Blockchain provider used by Atlas, our off-chain transaction building tool.
# Head over to https://atlas-app.io/getting-started/endpoints#providing-data-provider section to know how to configure `coreProvider` and what all options are available for it.
coreProvider:
maestroToken: YOUR_MAESTRO_TOKEN
turboSubmit: false
# Network id, only `mainnet` and `preprod` are supported for at the moment.
networkId: mainnet
# Logging configuration. It's an array to cater for potentially multiple scribes.
# See it's description mentioned at https://atlas-app.io/getting-started/endpoints#providing-data-provider for more information.
logging:
- type:
tag: stderr
# Possible values of `severity` are `Debug`, `Info`, `Warning` and `Error`.
severity: Debug
# Possible values of `verbosity` are `V0`, `V1`, `V2`, `V3` and `V4`. Consult https://hackage.haskell.org/package/katip-0.8.8.0/docs/Katip.html#t:Verbosity for more information about it.
verbosity: V2
# Port to serve endpoints at.
port: 8082
# API key to protect server endpoints with. It's value must be provided under `api-key` header of request.
serverApiKey: YOUR_SECRET_KEY
# UTxO to be used as collateral.
collateral: tx-id#tx-ix
# Wallet that provides UTxO to be used as collateral.
collateralWallet:
tag: mnemonicWallet
contents:
mnemonic:
- health
- unable
- dog
- lend
- artefact
- arctic
- dinner
- energy
- silent
- wealth
- shock
- safe
- glad
- mail
- gas
- flag
- beauty
- penalty
- mixed
- garbage
- erupt
- wonder
- magnet
- around
# Account index.
accIx: 0
# Payment address index.
addrIx: 0
```
3. Run the server with command `cabal run zkfold-smart-wallet-server -- serve -c my-config.yaml`.

Call: `cabal run zkfold-smart-wallet-server -- -h` for help. 😉

4. Test if server is running successfully by calling, say, `/settings` endpoint. Example `curl` request: `curl -H 'api-key: YOUR_SECRET_KEY' -X GET http://localhost:8082/v0/settings | jq`, assuming port was specified as `8082`. On success, it should return something akin to:

```json
{
"network":"mainnet",
"version":"0.1.0",
"collateral":"tx-id#tx-ix",
"collateral_address":"addr1qx...w60mw"
}
```

### OpenApi documentation

Endpoints made available by server are specified [here](./web/openapi/api.yaml).
Loading