Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anchor Platform: Add SEP-6 Integration Guide #268

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 7 additions & 0 deletions docs/anchoring-assets/anchor-platform/sep6/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"position": 65,
"label": "Programmatic Deposits and Withdrawals",
"link": {
"type": "generated-index"
}
}
127 changes: 127 additions & 0 deletions docs/anchoring-assets/anchor-platform/sep6/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
title: "Configuration"
sidebar_position: 20
---

import { CodeExample } from "@site/src/components/CodeExample";

## Modify a Stellar Info File

Next, let's modify the `stellar.toml` file created [earlier][sep1-ap]. Wallets need to know that SEP-6 functionality is supported by your business, and they also need to know all the currencies you support.

<CodeExample>

```toml
# dev.stellar.toml
ACCOUNTS = ["add your public keys for your distribution accounts here"]
SIGNING_KEY = "add your signing key here"
NETWORK_PASSPHRASE = "Test SDF Network ; September 2015"

TRANSFER_SERVER = "http://localhost:8080/sep6"
WEB_AUTH_ENDPOINT = "http://localhost:8080/auth"

# Add support for USDC
[[CURRENCIES]]
code = "USDC"
issuer = "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"
status = "test"
is_asset_anchored = false
desc = "USD Coin issued by Circle"

[DOCUMENTATION]
ORG_NAME = "Your organization"
ORG_URL = "Your website"
ORG_DESCRIPTION = "A description of your organization"
```

</CodeExample>

Note that you will need to create another file for your production deployment that uses the public network's passphrase, your production service URLs, your Mainnet distribution accounts and signing key, as well as the Mainnet issuing accounts of the assets your service utilizes.

## Enable Programmatic Deposits & Withdrawals

Now you're ready to enable programmatic deposits and withdrawals using the SEP-6 API. Specify the following in your `dev.assets.yaml` file, and change the values depending on your use case. This example asset file enables support for Circle's USDC and a fiat USD to deposit from and withdraw to.

<CodeExample>

```yaml
assets:
- schema: stellar
code: USDC
issuer: GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5
distribution_account: GBLSAHONJRODSFTLOV225NZR4LHICH63RIFQTQN37L5CRTR2IMQ5UEK7
significant_decimals: 2
sep6_enabled: true
deposit:
enabled: true
methods:
- SEPA
philipliu marked this conversation as resolved.
Show resolved Hide resolved
- SWIFT
- cash
withdraw:
enabled: true
methods:
- bank_account
- cash
- schema: iso4217
code: USD
significant_decimals: 2
```

</CodeExample>

The information provided for the `assets` value closely maps to the information that will be exposed to the wallet application using the [`GET /info`][sep-6] SEP-6 endpoint. The Anchor Platform also uses this information to validate requests made to your service.

## Test With the Demo Wallet

Wallets should now be able to discover, authenticate, and initiate transactions with your service! Your project and source files should now look something like this.

<CodeExample>

```
├── dev.env
├── docker-compose.yaml
├── config
│ ├── dev.assets.yaml
│ ├── dev.stellar.toml
```

</CodeExample>

Your environment should now look like the following.

<CodeExample>

```bash
# dev.env
ASSETS_TYPE=file
ASSETS_VALUE=/home/dev.assets.yaml

SEP1_ENABLED=true
SEP1_TOML_TYPE=file
SEP1_TOML_VALUE=/home/dev.stellar.toml

SEP10_ENABLED=true
SEP10_HOME_DOMAIN=localhost:8080
SECRET_SEP10_SIGNING_SEED="a Stellar private key"
SECRET_SEP10_JWT_SECRET="a secret encryption key"
```

</CodeExample>

To test this out, go to the [Stellar Demo Wallet][stellar-demo-wallet].

Initiate a deposit transaction by doing the following:

- Create a new keypair
- Click the "Add Asset" button and enter
- the code of the Stellar asset on your `stellar.toml` file
- your home domain, `localhost:8080`
- Select the dropdown and click "SEP-6 Deposit", then click "Start"

The demo wallet should be able to find your `stellar.toml` file, authenticate using the Stellar keypair you just created, and initiate a transaction.

[sep-1]: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0001.md
[sep-6]: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0006.md
[sep1-ap]: /docs/category/stellar-info-file
[stellar-demo-wallet]: https://demo-wallet.stellar.org/
33 changes: 33 additions & 0 deletions docs/anchoring-assets/anchor-platform/sep6/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: "Getting Started"
sidebar_position: 10
---

This guide will walk you through configuring and integration with the Anchor Platform for the purpose of build an on & off-ramp service compatible with [SEP-6][sep-6], the ecosystem's standardized protocol for programmatic deposit and withdrawals.

By leveraging the Anchor Platform's support for SEP-6, businesses make their own on & off-ramp service available as an in-app experience through Stellar-based applications such as wallets and exchanges, extending their reach and connecting with users through the applications they already use.

Before continuing with this section, make sure that you have already [installed][installation-ap] the Anchor Platform, and configured necessary features, required by SEP-6: [SEP-1 (Stellar Info File)][sep1-ap] and [SEP-10 (Stellar Authentication)][sep10-ap].

## The Basic User Experience

The complete customer experience for a deposit or withdrawal using SEP-6 is as follows:

1. The customer opens the SEP-6 wallet application of their choice
2. The customer selects an asset to deposit and the wallet finds an anchor (clients could also choose the specific anchor)
3. Once the wallet authenticates with the anchor, the customer begins entering their KYC and transaction information requested by the anchor
4. The wallet provides instructions, and the customer deposits real fiat currency with the anchor (e.g. makes a bank transfer)
5. Once the wallet receives the deposit, the customer receives the tokenized asset on the Stellar network from the anchor's distribution account

The customer can then use the digital asset on the Stellar network for remittance, payments, trading, store of value, or another use case not listed here. At some later date, the customer could decide to withdraw their assets from the Stellar network, which would look something like this:

1. The customer opens their wallet application
2. The customer selects the asset for withdrawal and wallet finds the anchor
3. After authenticating with the anchor, the customer can enter their transaction information and any additional KYC information that wasn't already collected
4. After asking for customer approval, the wallet sends the specified amount of the customer's asset balance to the anchor's distribution account on Stellar
5. Once the anchor receives the payment, the customer receives the withdrawn funds via bank transfer
philipliu marked this conversation as resolved.
Show resolved Hide resolved

[sep-6]: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0006.md
[installation-ap]: /docs/anchoring-assets/anchor-platform/getting_started
[sep1-ap]: /docs/category/stellar-info-file
[sep10-ap]: /docs/category/stellar-authentication
Loading